blecsd 0.4.0 → 0.6.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 +145 -145
- package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
- package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
- package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
- package/dist/chunk-4N7IFBRQ.js +4 -0
- package/dist/{chunk-DNRXW56C.js → chunk-4XCFTNGN.js} +1 -1
- package/dist/chunk-5YWRP2KG.js +3 -0
- package/dist/chunk-73Y45MLV.js +12 -0
- package/dist/chunk-7ZFQO3OQ.js +1 -0
- package/dist/chunk-A3GSH6MV.js +1 -0
- package/dist/chunk-A5B2BGUM.js +1 -0
- package/dist/chunk-AM6IDSXI.js +1 -0
- package/dist/chunk-EHYOVHRL.js +2 -0
- package/dist/chunk-EMZA6G2M.js +4 -0
- package/dist/chunk-EOFT3PNU.js +1 -0
- package/dist/chunk-ETFDYZVJ.js +1 -0
- package/dist/chunk-FUW7OD3H.js +1 -0
- package/dist/chunk-GRMSEMU7.js +1 -0
- package/dist/chunk-I7AUKTXE.js +1 -0
- package/dist/chunk-IANAVH2A.js +1 -0
- package/dist/chunk-JN2OGNK3.js +1 -0
- package/dist/chunk-JVMNMAHX.js +1 -0
- package/dist/chunk-K2QWNDXV.js +1 -0
- package/dist/chunk-KYNS3GBJ.js +2 -0
- package/dist/chunk-LI3ZYXUT.js +1 -0
- package/dist/chunk-LNEISTXM.js +1 -0
- package/dist/chunk-QABNK7IA.js +1 -0
- package/dist/chunk-QS5QXZNJ.js +1 -0
- package/dist/chunk-QTDRFJG2.js +1 -0
- package/dist/chunk-SVHITP3F.js +2 -0
- package/dist/chunk-UKVY43V3.js +1 -0
- package/dist/chunk-VIT4KE6Q.js +1 -0
- package/dist/chunk-XG5PVDOP.js +1 -0
- package/dist/chunk-XH5GTWCV.js +1 -0
- package/dist/chunk-XYMPBCYW.js +1 -0
- package/dist/chunk-YRSSCEAS.js +1 -0
- package/dist/chunk-ZL46COQF.js +1 -0
- package/dist/cli/init.js +1 -1
- package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
- package/dist/components/index.d.ts +8172 -7777
- package/dist/components/index.js +5 -1
- package/dist/core/index.d.ts +4777 -3942
- package/dist/core/index.js +1 -1
- package/dist/debug/index.d.ts +310 -84
- package/dist/debug/index.js +8 -1
- package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-kCS9-NVF.d.ts} +2 -2
- package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-CWASihKh.d.ts} +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
- package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
- package/dist/index.d.ts +24 -1217
- package/dist/index.js +1 -3
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/inputStream-COARA4CP.d.ts +1182 -0
- package/dist/interactiveSystem-h92W9W4n.d.ts +1977 -0
- package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
- package/dist/{events-9ForpTfM.d.ts → mouseParser-CCqSEUVN.d.ts} +177 -2
- package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
- package/dist/panelMovement-DGzIQ8Ll.d.ts +1908 -0
- package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
- package/dist/positioning-DiUivJXa.d.ts +917 -0
- package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
- package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
- package/dist/schemas/index.d.ts +6 -6
- package/dist/schemas/index.js +1 -1
- package/dist/systems/index.d.ts +785 -1882
- package/dist/systems/index.js +1 -1
- package/dist/terminal/index.d.ts +7563 -3387
- package/dist/terminal/index.js +1 -1
- package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
- package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
- package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
- package/dist/text/index.d.ts +263 -0
- package/dist/text/index.js +3 -0
- package/dist/textWrap-Ct2J8gO6.d.ts +761 -0
- package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
- package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
- package/dist/utils/index.d.ts +829 -782
- package/dist/utils/index.js +32 -1
- package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
- package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
- package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
- package/dist/widgets/bigText.d.ts +13 -13
- package/dist/widgets/bigText.js +1 -1
- package/dist/widgets/fonts/index.d.ts +1 -1
- package/dist/widgets/fonts/index.js +1 -1
- package/dist/widgets/index.d.ts +1620 -910
- package/dist/widgets/index.js +24 -1
- package/package.json +9 -22
- package/dist/3d/index.d.ts +0 -5
- package/dist/3d/index.js +0 -1
- package/dist/audio/index.d.ts +0 -177
- package/dist/audio/index.js +0 -1
- package/dist/chunk-25OEBENM.js +0 -3
- package/dist/chunk-26STV7ZS.js +0 -1
- package/dist/chunk-2NMGUEFC.js +0 -4
- package/dist/chunk-35LCBY6P.js +0 -1
- package/dist/chunk-4PRDJTCM.js +0 -1
- package/dist/chunk-5PELJRUQ.js +0 -1
- package/dist/chunk-5VEKHA3B.js +0 -5
- package/dist/chunk-6KEM3OS2.js +0 -11
- package/dist/chunk-6XWY6GB7.js +0 -1
- package/dist/chunk-735KKTP3.js +0 -1
- package/dist/chunk-7SWJNDOL.js +0 -26
- package/dist/chunk-APKUNIMB.js +0 -1
- package/dist/chunk-CJCSZRV6.js +0 -1
- package/dist/chunk-DMBMCCLN.js +0 -1
- package/dist/chunk-DQTVJITR.js +0 -1
- package/dist/chunk-DSKQ5J4R.js +0 -1
- package/dist/chunk-E4CJRSND.js +0 -1
- package/dist/chunk-EF4DC6IN.js +0 -1
- package/dist/chunk-EJAKECSN.js +0 -1
- package/dist/chunk-FNQRUMFD.js +0 -1
- package/dist/chunk-GJ3RS2VG.js +0 -1
- package/dist/chunk-KTVEMB2I.js +0 -1
- package/dist/chunk-KYAPE44E.js +0 -8
- package/dist/chunk-LI4Y7TBZ.js +0 -1
- package/dist/chunk-NHOL4BN6.js +0 -1
- package/dist/chunk-NPNUUSIB.js +0 -1
- package/dist/chunk-NZ55KBM6.js +0 -1
- package/dist/chunk-OFRWGW2G.js +0 -1
- package/dist/chunk-OMMJ7B5P.js +0 -1
- package/dist/chunk-OMU5BSAS.js +0 -2
- package/dist/chunk-P3ZLIQJP.js +0 -1
- package/dist/chunk-PWI36BQJ.js +0 -1
- package/dist/chunk-QQMUDJ32.js +0 -2
- package/dist/chunk-R3ICZOE4.js +0 -1
- package/dist/chunk-RZ7FGVI6.js +0 -1
- package/dist/chunk-S6WS46FE.js +0 -1
- package/dist/chunk-TSARUU56.js +0 -1
- package/dist/chunk-WJRVUAZR.js +0 -33
- package/dist/chunk-WY5EZOOL.js +0 -1
- package/dist/chunk-YY6RZCZH.js +0 -4
- package/dist/chunk-ZPGJCHXH.js +0 -1
- package/dist/chunk-ZPL2J25N.js +0 -1
- package/dist/game/index.d.ts +0 -486
- package/dist/game/index.js +0 -1
- package/dist/index-DBS5Uefn.d.ts +0 -3156
- package/dist/mouseParser-B7p5ow7K.d.ts +0 -177
- package/dist/viewport3d-xI33-_wq.d.ts +0 -182
- package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {i as i$1,b as b$1,c as c$3,d as d$2}from'./chunk-XH5GTWCV.js';import {a as a$3}from'./chunk-VIT4KE6Q.js';import {a}from'./chunk-5N3O25O7.js';import {c,a as a$2}from'./chunk-ZL46COQF.js';import {f,v,d as d$3}from'./chunk-LI3ZYXUT.js';import {m as m$1}from'./chunk-RJULLVTH.js';import {g,b as b$2,c as c$2,h as h$2,i as i$4,j as j$1}from'./chunk-UKVY43V3.js';import {u,c as c$1,i as i$3}from'./chunk-K2QWNDXV.js';import {o,k,p}from'./chunk-EOFT3PNU.js';import {d as d$1,l as l$1,f as f$3}from'./chunk-JN2OGNK3.js';import {Ea as Ea$1,Da as Da$1,Ca as Ca$1,ba as ba$1,a as a$1,i,Ga as Ga$1,b,fa as fa$1,Ba as Ba$1,d,f as f$1,e,sa as sa$1,ka as ka$1,M,na as na$1,I,$,ea as ea$1,R as R$1,G,k as k$2,g as g$1}from'./chunk-ETFDYZVJ.js';import {b as b$3,f as f$4}from'./chunk-NPDPBAW6.js';import {m,i as i$2,o as o$1,k as k$1,f as f$2,l,j,h as h$1}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';function Nt(e){if(!d$3(e))return {width:80,height:24};let t=f(e);return !t||!fa$1(e,t)?{width:80,height:24}:{width:$.width[t],height:$.height[t]}}function jn(e,t,n){Ea$1(e,t,true);let r=Da$1(e,t)?.y??0;return Ca$1(e,t,n,r),t}function Gn(e,t,n){let o=Nt(e),i=ba$1(e,t)?.width??0;Ea$1(e,t,true);let a=o.width-n-i,l=Da$1(e,t)?.y??0;return Ca$1(e,t,a,l),t}function Yn(e,t,n){Ea$1(e,t,true);let r=Da$1(e,t)?.x??0;return Ca$1(e,t,r,n),t}function Jn(e,t,n){let o=Nt(e),i=ba$1(e,t)?.height??0;Ea$1(e,t,true);let a=o.height-n-i,l=Da$1(e,t)?.x??0;return Ca$1(e,t,l,a),t}function ti(e,t,n){let{left:o,right:r,top:i,bottom:a}=n;return Ea$1(e,t,true),o!==void 0?jn(e,t,o):r!==void 0&&Gn(e,t,r),i!==void 0?Yn(e,t,i):a!==void 0&&Jn(e,t,a),t}function ni(e,t){let n=Da$1(e,t);if(!n||!n.absolute)return;let o=ba$1(e,t),r=o?.width??0,i=o?.height??0,a=Nt(e),s=n.x,l=a.width-s-r,c=n.y,p=a.height-c-i;return {left:s,right:l,top:c,bottom:p}}function Zn(e){let t=f(e);return t?v(e,t):false}function Ut(e,t){let n={left:0,top:0,right:0,bottom:0};return !Zn(e)||!o(e,t)||k.type[t]===0?n:{left:k.left[t]===1?1:0,top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0}}function $n(e,t){let n=g(e,t),o=n?.left??0,r=n?.top??0,i=n?.right??0,a=n?.bottom??0,s=Ut(e,t),l=o+s.left,c=r+s.top,p=i+s.right,u=a+s.bottom;return {left:l,top:c,right:p,bottom:u,horizontal:l+p,vertical:c+u}}function ri(e,t){let n=$n(e,t);return n.left+n.top+n.right+n.bottom}function ii(e,t){let n=Ut(e,t);return n.left>0||n.top>0||n.right>0||n.bottom>0}var _t={teeRight:9500,teeLeft:9508,teeDown:9516,teeUp:9524,cross:9532,horizontal:9472,vertical:9474},Xn={teeRight:9568,teeLeft:9571,teeDown:9574,teeUp:9577,cross:9580,horizontal:9552,vertical:9553},qn={teeRight:9507,teeLeft:9515,teeDown:9523,teeUp:9531,cross:9547,horizontal:9473,vertical:9475},Qn={teeRight:43,teeLeft:43,teeDown:43,teeUp:43,cross:43,horizontal:45,vertical:124};function ai(e,t,n={}){return {width:e,height:t,edges:new Map,enabled:n.enabled??true}}function si(e){e.edges.clear();}function li(e,t,n){return {...e,width:t,height:n}}function Se(e,t){return `${e},${t}`}function eo(e){let[t,n]=e.split(",");return {x:Number.parseInt(t??"0",10),y:Number.parseInt(n??"0",10)}}function zt(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 Ht(e){switch(e){case "single":return _t;case "double":return Xn;case "bold":return qn;case "ascii":return Qn;default:return _t}}function Q(e,t,n,o,r,i,a){let s=Se(t,n),l={x:t,y:n,type:o,char:r,fg:i,bg:a,style:zt(r)},c=e.edges.get(s);c?c.push(l):e.edges.set(s,[l]);}function ui(e,t,n,o,r,i,a,s,l){for(let c=1;c<o-1;c++)Q(e,t+c,n,"h",i,s,l);for(let c=1;c<o-1;c++)Q(e,t+c,n+r-1,"h",i,s,l);for(let c=1;c<r-1;c++)Q(e,t,n+c,"v",a,s,l);for(let c=1;c<r-1;c++)Q(e,t+o-1,n+c,"v",a,s,l);Q(e,t,n,"c",0,s,l),Q(e,t+o-1,n,"c",0,s,l),Q(e,t,n+r-1,"c",0,s,l),Q(e,t+o-1,n+r-1,"c",0,s,l);}function Vt(e,t,n){let o=e.edges.get(Se(t-1,n)),r=e.edges.get(Se(t+1,n)),i=e.edges.get(Se(t,n-1)),a=e.edges.get(Se(t,n+1));return {left:o?.some(s=>s.type==="h"||s.type==="c")??false,right:r?.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 jt(e,t){let{left:n,top:o,right:r,bottom:i}=e;return (n?1:0)+(o?1:0)+(r?1:0)+(i?1:0)<3?null:n&&o&&r&&i?t.cross:n&&o&&i?t.teeLeft:r&&o&&i?t.teeRight:n&&r&&i?t.teeDown:n&&r&&o?t.teeUp:null}function ci(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o)||(n.add(o),r.length<2))continue;let{x:i,y:a}=eo(o),s=Vt(e,i,a),l=r[0];if(!l)continue;let c=Ht(l.style),p=jt(s,c);p!==null&&t.push({x:i,y:a,char:p,fg:l.fg,bg:l.bg});}return t}function di(e,t){let n=t.some(r=>r.type==="h"),o=t.some(r=>r.type==="v");return {left:e.left||n,right:e.right||n,top:e.top||o,bottom:e.bottom||o}}function fi(e,t,n,o){if(!e.some(l=>l.type==="c")||e.length<=1)return null;let i=e[0];if(!i)return null;let a=Ht(i.style),s=jt(t,a);return s===null?null:{x:n,y:o,char:s,fg:i.fg,bg:i.bg}}function pi(e){if(!e.enabled)return [];let t=[],n=new Set;for(let[o,r]of e.edges){if(n.has(o))continue;n.add(o);let{x:i,y:a}=eo(o),s=Vt(e,i,a),l=di(s,r),c=fi(r,l,i,a);c&&t.push(c);}return t}function mi(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 yi(e){return e.map(t=>({x:t.x,y:t.y,char:String.fromCodePoint(t.char),fg:t.fg,bg:t.bg}))}function gi(e){return zt(e)!=="unknown"}function bi(e){return e>=9500&&e<=9532||e>=9568&&e<=9580||e>=9507&&e<=9547||e===43}function hi(e){return e.edges.size}function vi(e,t,n){return e.edges.get(Se(t,n))??[]}var it=1e4,se={HIDDEN:0,VISIBLE:1,SCROLL:2},T={overflow:new Uint8Array(it),overflowX:new Uint8Array(it),overflowY:new Uint8Array(it),hasIndependentOverflow:new Uint8Array(it)};function Ei(e,t){m(e,t,T)||(l(e,t,T),T.overflow[t]=se.HIDDEN,T.overflowX[t]=se.HIDDEN,T.overflowY[t]=se.HIDDEN,T.hasIndependentOverflow[t]=0);}function xi(e,t){return m(e,t,T)}function Si(e,t,n){return Ei(e,t),typeof n=="number"?(T.overflow[t]=n,T.overflowX[t]=n,T.overflowY[t]=n,T.hasIndependentOverflow[t]=0):(n.overflow!==void 0&&(T.overflow[t]=n.overflow,T.overflowX[t]=n.overflow,T.overflowY[t]=n.overflow),n.overflowX!==void 0&&(T.overflowX[t]=n.overflowX,T.hasIndependentOverflow[t]=1),n.overflowY!==void 0&&(T.overflowY[t]=n.overflowY,T.hasIndependentOverflow[t]=1)),t}function at(e,t){return m(e,t,T)?T.overflow[t]:se.HIDDEN}function Ci(e,t){if(m(e,t,T))return {overflow:T.overflow[t],overflowX:T.overflowX[t],overflowY:T.overflowY[t]}}function Di(e,t,n,o){return {x1:e,y1:t,x2:e+n,y2:t+o}}function ze(){return {x1:-1/0,y1:-1/0,x2:1/0,y2:1/0}}function Ti(e){return e.x1>=e.x2||e.y1>=e.y2}function Pi(e,t,n){return t>=e.x1&&t<e.x2&&n>=e.y1&&n<e.y2}function ki(e,t,n,o,r){return t<e.x2&&t+o>e.x1&&n<e.y2&&n+r>e.y1}function st(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 Ai(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 Ii(e){return e.x2-e.x1}function Ri(e){return e.y2-e.y1}function Bi(e,t){return p(e,t)?{top:k.top[t]===1?1:0,right:k.right[t]===1?1:0,bottom:k.bottom[t]===1?1:0,left:k.left[t]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function to(e,t){if(!c(e,t))return null;let n=a$2.x[t],o=a$2.y[t],r=a$2.width[t],i=a$2.height[t],a=Bi(e,t);return {x1:n+a.left,y1:o+a.top,x2:n+r-a.right,y2:o+i-a.bottom}}function Wi(e,t){let n=ze(),o=t;for(;o!==a$1;){if(at(e,o)!==se.VISIBLE){let a=to(e,o);a&&(n=st(n,a));}o=i(e,o)??a$1;}return n}function Mi(e,t,n){let o=ze(),r=t;for(;r!==a$1&&r!==n;){if(at(e,r)!==se.VISIBLE){let s=to(e,r);s&&(o=st(o,s));}r=i(e,r)??a$1;}return o}function wi(e,t){return at(e,t)!==se.VISIBLE}function Li(){return {stack:[],current:ze()}}function Fi(e,t){let n=[...e.stack,e.current],o=st(e.current,t);return {stack:n,current:o}}function Oi(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??ze()}}function Ki(e){return e.current}function Gt(e,t){return o(e,t)?k.type[t]===0?0:1:0}function Yt(e,t){if(!fa$1(e,t))return {width:0,height:0};let n=ba$1(e,t);return {width:n?.width??0,height:n?.height??0}}function Ni(e,t){let n=Gt(e,t),o=n,r=g(e,t);return r&&(n+=r.left,o+=r.top),{x:n,y:o}}function no(e,t){let n=0,o=0;if(!m(e,t,b))return {x:n,y:o};let r=i(e,t);for(;r!==a$1;){if(!Ga$1(e,r)){r=i(e,r);continue}let i$1=Da$1(e,r);if(!i$1){r=i(e,r);continue}n+=i$1.x,o+=i$1.y;let a=Ni(e,r);if(n+=a.x,o+=a.y,i$1.absolute)break;r=i(e,r);}return {x:n,y:o}}function lt(e,t){if(!Ga$1(e,t))return;let n=Da$1(e,t);if(!n)return;let o=Yt(e,t);if(n.absolute)return {left:n.x,top:n.y,right:n.x+o.width-1,bottom:n.y+o.height-1};let r=no(e,t),i=n.x+r.x,a=n.y+r.y;return {left:i,top:a,right:i+o.width-1,bottom:a+o.height-1}}function oo(e,t){if(!Ga$1(e,t))return;let n=Da$1(e,t);if(!n)return;let o=Yt(e,t),r=0,i$1=0;if(m(e,t,b)){let a=i(e,t);if(a!==a$1){let s=ut(e,a);s&&(r=s.width,i$1=s.height);}}return {left:n.x,top:n.y,right:Math.max(0,r-n.x-o.width),bottom:Math.max(0,i$1-n.y-o.height)}}function Jt(e,t){let n=lt(e,t);if(!n)return;let o=Gt(e,t),r=g(e,t),i=r?.left??0,a=r?.top??0,s=r?.right??0,l=r?.bottom??0;return {left:n.left+o+i,top:n.top+o+a,right:n.right-o-s,bottom:n.bottom-o-l}}function ut(e,t){if(!fa$1(e,t))return;let n=ba$1(e,t);if(!n)return;let o=Gt(e,t),r=g(e,t),i=(r?.left??0)+(r?.right??0),a=(r?.top??0)+(r?.bottom??0);return {width:Math.max(0,n.width-o*2-i),height:Math.max(0,n.height-o*2-a)}}function ro(e,t){let n=g(e,t),o=n?.left??0,r=n?.right??0,i=n?.top??0,a=n?.bottom??0;return {horizontal:o+r,vertical:i+a,total:o+r+i+a}}function Ui(e,t,n,o){let r=no(e,t),i=n-r.x,a=o-r.y;return Ba$1.x[t]=i,Ba$1.y[t]=a,t}function _i(e,t,n){let o=Yt(e,t),r=0,i$1=0;if(m(e,t,b)){let l=i(e,t);if(l!==a$1){let c=ut(e,l);c&&(r=c.width,i$1=c.height);}}let a;n.left!==void 0?a=n.left:n.right!==void 0?a=r-o.width-n.right:a=Ba$1.x[t];let s;return n.top!==void 0?s=n.top:n.bottom!==void 0?s=i$1-o.height-n.bottom:s=Ba$1.y[t],Ba$1.x[t]=a,Ba$1.y[t]=s,t}function zi(e,t){let n=lt(e,t);if(!n)return;let o=oo(e,t);if(!o)return;let r=Jt(e,t);if(!r)return;let i=ut(e,t)??{width:0,height:0},a=ro(e,t);return {absolute:n,relative:o,inner:r,innerDimensions:i,totalPadding:a}}function Zt(e,t,n,o){let r=lt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}function Hi(e,t,n,o){let r=Jt(e,t);return r?n>=r.left&&n<=r.right&&o>=r.top&&o<=r.bottom:false}var $t=new Map,Xt=new Map;function io(e,t){return `${e}:${t}`}function Vi(e,t){$t.set(e,t);}function ct(e,t,n){Xt.set(io(e,t),n);}function ao(e){return typeof e=="function"}function ji(e){return ao(e)?e():e}function qt(e,t={},n=[]){return {type:e,config:t,children:n}}function Gi(e,t,n,o=[]){return {type:e,config:t,children:o,ref:n}}function Yi(e={},t=[]){return qt("box",{...e,layout:"vertical"},t)}function Ji(e={},t=[]){return qt("box",{...e,layout:"horizontal"},t)}function Zi(e,t,n){let o=[],r=[];so(e,t,n,o,r);let i=o[0];if(i===void 0)throw new Error(`Failed to mount widget of type '${t.type}': no entity created`);return {root:i,entities:[...o],dispose:()=>{for(let a of r)a.dispose();r.length=0;}}}function so(e,t,n,o,r){let i=$t.get(t.type);if(!i)throw new Error(`No factory registered for widget type '${t.type}'. Call registerWidgetFactory() first.`);let a={};for(let[l,c]of Object.entries(t.config))a[l]=ji(c);let s=i(e,a);o.push(s),n!==void 0&&d(e,n,s);for(let[l,c]of Object.entries(t.config)){if(!ao(c))continue;let p=Xt.get(io(t.type,l));if(!p)continue;let u=c,f=i$1(()=>{let m=u();p(e,s,m);});r.push(f);}t.ref&&t.ref(s);for(let l of t.children)so(e,l,s,o,r);return s}function $i(e){e.dispose();}function Xi(e,t,n,o){return i$1(()=>{let r=n();o(e,t,r);})}function qi(e){let t=["box","text","gauge","list","progressbar"];for(let n of t)ct(n,"content",e.setContent),ct(n,"width",e.setWidth),ct(n,"height",e.setHeight);}function Qi(){$t.clear(),Xt.clear();}function uo(e,t){let n=e*t,o=Math.ceil(n/8);return {width:e,height:t,dirtyCells:new Uint8Array(o),dirtyEntities:new Set,entityBounds:m$1({iterable:true}),dirtyRegions:[],regionsStale:true,forceFullRedraw:true,frameCount:0}}function ea(e,t,n){let o=uo(t,n);return e.entityBounds.forEach((r,i)=>{r.prevX<t&&r.prevY<n&&o.entityBounds.set(i,{...r});}),o.forceFullRedraw=true,o}function ta(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];a!==void 0&&(e.dirtyCells[r]=a|1<<i),e.regionsStale=true;}function na(e,t,n){if(t<0||t>=e.width||n<0||n>=e.height)return false;let o=n*e.width+t,r=o>>3,i=o&7,a=e.dirtyCells[r];return a===void 0?false:(a&1<<i)!==0}function dt(e,t,n,o,r){let i=Math.max(0,Math.floor(t)),a=Math.max(0,Math.floor(n)),s=Math.min(e.width,Math.floor(t+o)),l=Math.min(e.height,Math.floor(n+r));if(!(s<=i||l<=a)){for(let c=a;c<l;c++)for(let p=i;p<s;p++){let u=c*e.width+p,f=u>>3,m=u&7,D=e.dirtyCells[f];D!==void 0&&(e.dirtyCells[f]=D|1<<m);}e.regionsStale=true;}}function co(e,t,n){if(e.dirtyEntities.add(n),!c(t,n))return;let o=a$2.x[n],r=a$2.y[n],i=a$2.width[n],a=a$2.height[n],s=e.entityBounds.get(n);s&&(s.prevX!==o||s.prevY!==r||s.prevWidth!==i||s.prevHeight!==a)&&dt(e,s.prevX,s.prevY,s.prevWidth,s.prevHeight),dt(e,o,r,i,a),e.regionsStale=true;}function oa(e,t,n,o){if(!c(t,n)){e.entityBounds.delete(n);return}let r={prevX:a$2.x[n],prevY:a$2.y[n],prevWidth:a$2.width[n],prevHeight:a$2.height[n],wasVisible:o};e.entityBounds.set(n,r);}function ra(e,t){let n=e.entityBounds.get(t);n?.wasVisible&&dt(e,n.prevX,n.prevY,n.prevWidth,n.prevHeight),e.dirtyEntities.delete(t),e.entityBounds.delete(t);}function ia(e,t){return e.dirtyEntities.has(t)}function ft(e,t,n){let o=t*n+e;return {byteIndex:o>>3,bitIndex:o&7}}function lo(e,t,n){let o=e[t];if(o!==void 0)return (o&1<<n)!==0}function aa(e,t,n){let o=e[t];o!==void 0&&(e[t]=o|1<<n);}function Qt(e,t,n,o){let r=lo(e,n,o),i=lo(t,n,o);return r===void 0||i===void 0?false:r&&!i}function sa(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 o=0;o<e.height;o++)for(let r=0;r<e.width;r++){let{byteIndex:i,bitIndex:a}=ft(r,o,e.width);if(Qt(e.dirtyCells,n,i,a)){let s=da(e,n,r,o);s.width>0&&s.height>0&&t.push(s);}}return pa(t)}function la(e,t,n,o,r,i){let a=n;for(;a<i;){let{byteIndex:s,bitIndex:l}=ft(a,o,r);if(!Qt(e,t,s,l))break;a++;}return a}function ua(e,t,n,o,r,i){for(let a=n;a<o;a++){let{byteIndex:s,bitIndex:l}=ft(a,r,i);if(!Qt(e,t,s,l))return false}return true}function ca(e,t,n,o,r,i){for(let a=n;a<r;a++)for(let s=t;s<o;s++){let{byteIndex:l,bitIndex:c}=ft(s,a,i);aa(e,l,c);}}function da(e,t,n,o){let r=la(e.dirtyCells,t,n,o,e.width,e.width),i=r-n;if(i===0)return {x:n,y:o,width:0,height:0};let a=o;for(;a<e.height&&ua(e.dirtyCells,t,n,r,a,e.width);)a++;return ca(t,n,o,r,a,e.width),{x:n,y:o,width:i,height:a-o}}function fa(e,t,n,o){let r=e,i=false;for(let a=o;a<t.length;a++){if(n.has(a))continue;let s=t[a];s&&ma(r,s)&&(r=ya(r,s),n.add(a),i=true);}return {merged:r,didMerge:i}}function pa(e){if(e.length<2)return e;let t=[...e].sort((r,i)=>i.width*i.height-r.width*r.height),n=[],o=new Set;for(let r=0;r<t.length;r++){if(o.has(r))continue;let i=t[r];if(!i)continue;o.add(r);let a=true;for(;a;){let s=fa(i,t,o,r+1);i=s.merged,a=s.didMerge;}n.push(i);}return n}function ma(e,t){let n=e.x+e.width,o=e.y+e.height,r=t.x+t.width,i=t.y+t.height;return !(t.x>n+1||r<e.x-1||t.y>o+1||i<e.y-1)}function ya(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=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:o,width:r-n,height:i-o}}function pt(e){return e.regionsStale&&(e.dirtyRegions.length=0,e.dirtyRegions.push(...sa(e)),e.regionsStale=false),e.dirtyRegions}function ga(e){return e.forceFullRedraw?true:e.dirtyEntities.size>0}function ba(e){return e.forceFullRedraw}function ha(e){return e.dirtyEntities}function va(e){let t=pt(e),n=e.width*e.height,o=0;for(let r of t)o+=r.width*r.height;return {dirtyEntityCount:e.dirtyEntities.size,dirtyRegionCount:t.length,dirtyArea:o,dirtyPercent:n>0?o/n*100:0,fullRedraw:e.forceFullRedraw,trackedEntityCount:e.entityBounds.size}}function Ea(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=true,e.forceFullRedraw=false,e.frameCount++;}function xa(e){e.forceFullRedraw=true,e.regionsStale=true;}function Sa(e,t){e.entityBounds.forEach((n,o)=>{co(e,t,o);});}function Ca(e,t,n,o,r){if(e.forceFullRedraw)return true;let i=pt(e);for(let a of i)if(t<a.x+a.width&&t+o>a.x&&n<a.y+a.height&&n+r>a.y)return true;return false}function Da(e,t,n,o,r){let i=pt(e),a=[];for(let s of i){let l=Math.max(s.x,t),c=Math.max(s.y,n),p=Math.min(s.x+s.width,t+o),u=Math.min(s.y+s.height,n+r);p>l&&u>c&&a.push({x:l,y:c,width:p-l,height:u-c});}return a}var mt=new Map;function ee(e,t){let n=mt.get(e);return n||(n=t(),mt.set(e,n)),n}function en(e){mt.delete(e);}function Ta(){mt.clear();}function Pa(e,t,n,o){e.emit("reparent",{entity:t,oldParent:n,newParent:o});}function ka(e,t,n){e.emit("adopt",{parent:t,child:n});}function Aa(e,t,n){e.emit("attach",{entity:t,screen:n});}function Ia(e,t,n){e.emit("detach",{entity:t,screen:n});}function Ra(e,t,n){e.emit("remove",{parent:t,child:n});}function tn(e,t){e.emit("destroy",{entity:t});}function Ba(e,t,n){return ee(e,n).on("reparent",t)}function Wa(e,t,n){return ee(e,n).on("adopt",t)}function Ma(e,t,n){return ee(e,n).on("attach",t)}function wa(e,t,n){return ee(e,n).on("detach",t)}function La(e,t,n){return ee(e,n).on("remove",t)}function Fa(e,t,n){return ee(e,n).on("destroy",t)}var te=new Set,nn=new WeakMap,Ce=[];function yt(e){let t=nn.get(e);return t||(t=new Set,nn.set(e,t)),t}function Oa(e){return Ce.push(e),()=>{let t=Ce.indexOf(e);t!==-1&&Ce.splice(t,1);}}function fo(){Ce.length=0;}function po(e,t,n={}){let{immediate:o=false,destroyChildren:r=true,emitEvent:i=true}=n;if(o)on(e,t,r,i);else {let a=yt(e);if(a.add(t),te.add(t),r&&m(e,t,b)){let s=f$1(e,t);for(let l of s)a.add(l),te.add(l);}}}function Ka(e,t,n={}){if(!m(e,t,b))return;let o=f$1(e,t);for(let r of o)po(e,r,n);}function Na(e){return te.has(e)}function Ua(e){let t=yt(e),n=t.size;if(n===0)return 0;let o=Array.from(t);o.sort((r,i)=>{let a=m(e,r,b)?b.depth[r]??0:0;return (m(e,i,b)?b.depth[i]??0:0)-a});for(let r of o)te.has(r)&&on(e,r,false,true);return t.clear(),n}function on(e$1,t,n,o){if(te.delete(t),o)try{let r=ee(t,()=>a$3());tn(r,t);}catch{}if(n&&m(e$1,t,b)){let r=f$1(e$1,t);for(let i of r)on(e$1,i,true,o);}if(m(e$1,t,b)){let r=i(e$1,t);r!==a$1&&e(e$1,r,t);}for(let r of Ce)try{r(e$1,t);}catch{}en(t);try{i$2(e$1,t);}catch{}}function _a(e){yt(e).clear(),te.clear(),fo();}function za(e){return e?nn.get(e)?.size??0:te.size}function Ha(e){let t=yt(e);for(let n of t)te.delete(n);t.clear();}function Va(){te.clear(),Ce.length=0;}var U=new Map;function De(e,t,n){return typeof n=="function"?n(e,t):n}function Te(e,t,n){let o={};return n.fg!==void 0&&(o.fg=De(e,t,n.fg)),n.bg!==void 0&&(o.bg=De(e,t,n.bg)),n.bold!==void 0&&(o.bold=De(e,t,n.bold)),n.underline!==void 0&&(o.underline=De(e,t,n.underline)),n.blink!==void 0&&(o.blink=De(e,t,n.blink)),n.inverse!==void 0&&(o.inverse=De(e,t,n.inverse)),o}function ja(e,t){return R$1(e,t)?{fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}:{fg:I.fg[t],bg:I.bg[t],bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function He(e,t){let n=U.get(t);return n||(n={original:ja(e,t),focusApplied:false,hoverApplied:false},U.set(t,n)),n}function Ga(e,t){return U.get(t)}function Ya(e,t){return U.has(t)}function Ja(e,t){U.delete(t);}function Za(){U.clear();}function pe(e,t,n){n.fg!==void 0&&(I.fg[t]=n.fg),n.bg!==void 0&&(I.bg[t]=n.bg),n.bold!==void 0&&(I.bold[t]=n.bold?1:0),n.underline!==void 0&&(I.underline[t]=n.underline?1:0),n.blink!==void 0&&(I.blink[t]=n.blink?1:0),n.inverse!==void 0&&(I.inverse[t]=n.inverse?1:0);}function Ve(e,t,n){I.fg[t]=n.fg,I.bg[t]=n.bg,I.bold[t]=n.bold?1:0,I.underline[t]=n.underline?1:0,I.blink[t]=n.blink?1:0,I.inverse[t]=n.inverse?1:0,I.transparent[t]=n.transparent?1:0;}function mo(e,t){if(!sa$1(e,t))return;let n=He(e,t);if(n.focusApplied)return;let o={},r=ka$1.focusEffectFg[t],i=ka$1.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o),n.focusApplied=true,M(e,t);}function yo(e,t){let n=U.get(t);!n||!n.focusApplied||(n.focusApplied=false,n.hoverApplied?$a(e,t,n):(Ve(e,t,n.original),U.delete(t)),M(e,t));}function gt(e,t){return U.get(t)?.focusApplied??false}function $a(e,t,n){if(!u(e,t))return;Ve(e,t,n.original);let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o);}function go(e,t){if(!u(e,t))return;let n=He(e,t);if(n.hoverApplied)return;let o={},r=c$1.hoverEffectFg[t],i=c$1.hoverEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o),n.hoverApplied=true,M(e,t);}function bo(e,t){let n=U.get(t);!n||!n.hoverApplied||(n.hoverApplied=false,n.focusApplied?Xa(e,t,n):(Ve(e,t,n.original),U.delete(t)),M(e,t));}function Xa(e,t,n){if(!sa$1(e,t))return;Ve(e,t,n.original);let o={},r=ka$1.focusEffectFg[t],i=ka$1.focusEffectBg[t];(r&4278190080)!==0&&(o.fg=r),(i&4278190080)!==0&&(o.bg=i),pe(e,t,o);}function bt(e,t){return U.get(t)?.hoverApplied??false}function qa(e,t,n){He(e,t);let o=Te(e,t,n);pe(e,t,o),M(e,t);}function ho(e,t){let n=U.get(t);n&&(Ve(e,t,n.original),U.delete(t),M(e,t));}function ht(e,t){let n=sa$1(e,t)&&na$1(e,t),o=u(e,t)&&i$3(e,t),r=gt(e,t),i=bt(e,t);n&&!r?mo(e,t):!n&&r&&yo(e,t),o&&!i?go(e,t):!o&&i&&bo(e,t);}function vo(e,t){return {fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}}function Qa(e,t){let n=U.get(t);return n?n.original:vo(e,t)}var me=new Map,ne=new Map;function es(e,t,n){if(me.set(t,n),n.focus&&sa$1(e,t)){let o=Te(e,t,n.focus);o.fg!==void 0&&(ka$1.focusEffectFg[t]=o.fg),o.bg!==void 0&&(ka$1.focusEffectBg[t]=o.bg);}if(n.hover&&u(e,t)){let o=Te(e,t,n.hover);o.fg!==void 0&&(c$1.hoverEffectFg[t]=o.fg),o.bg!==void 0&&(c$1.hoverEffectBg[t]=o.bg);}ht(e,t);}function ts(e,t){return me.get(t)}function ns(e,t){me.delete(t),ne.delete(t),ho(e,t);}function Eo(e,t){let n=ne.get(t);return n||(n={pressApplied:false,disabledApplied:false},ne.set(t,n)),n}function os(e,t){let n=me.get(t);if(!n?.press)return;let o=Eo(e,t);if(o.pressApplied)return;He(e,t);let r=Te(e,t,n.press);pe(e,t,r),o.pressApplied=true,M(e,t);}function rs(e,t){let n=ne.get(t);n?.pressApplied&&(n.pressApplied=false,ht(e,t));}function is(e,t){let n=me.get(t);if(!n?.disabled)return;let o=Eo(e,t);if(o.disabledApplied)return;He(e,t);let r=Te(e,t,n.disabled);pe(e,t,r),o.disabledApplied=true,M(e,t);}function as(e,t){let n=ne.get(t);n?.disabledApplied&&(n.disabledApplied=false,ht(e,t));}function rn(e,t){return ne.get(t)?.pressApplied??false}function an(e,t){return ne.get(t)?.disabledApplied??false}function ss(e,t){return gt(e,t)||bt(e,t)||rn(e,t)||an(e,t)}function ls(e,t){return {focus:gt(e,t),hover:bt(e,t),press:rn(e,t),disabled:an(e,t)}}function us(e,t){U.delete(t),me.delete(t),ne.delete(t);}function cs(){me.clear(),ne.clear();}function ds(e){let{type:t,target:n,payload:o,bubbles:r=true}=e,i={type:t,target:n,currentTarget:n,bubbles:r,defaultPrevented:false,propagationStopped:false,immediatePropagationStopped:false,payload:o,stopPropagation(){i.propagationStopped=true;},stopImmediatePropagation(){i.propagationStopped=true,i.immediatePropagationStopped=true;},preventDefault(){i.defaultPrevented=true;}};return i}function fs(e,t,n){let o=0,r=t.target;for(;r!==a$1;){t.currentTarget=r;let i$1=n(e,r);if(i$1&&(i$1.emit(t.type,t),o++,t.immediatePropagationStopped)||t.propagationStopped||!t.bubbles||!m(e,r,b))break;r=i(e,r);}return {defaultPrevented:t.defaultPrevented,propagationStopped:t.propagationStopped,dispatchCount:o}}var Xo=z.object({dispatchCount:z.number().int().nonnegative(),maxDepth:z.number().int().nonnegative(),circularReferenceDetected:z.boolean()}),qo=z.object({maxDepth:z.number().int().positive().optional(),includeRoot:z.boolean().optional()});function ps(e,t,n,o,r,i){let a=i?qo.parse(i):{includeRoot:true,maxDepth:Number.POSITIVE_INFINITY},s=a.maxDepth??Number.POSITIVE_INFINITY,l=a.includeRoot??true,c=new Set,p=0,u=0,f=false;function m$1(P,K){if(K>s)return;if(c.has(P)){f=true;return}if(c.add(P),u=Math.max(u,K),K>0||l){let M=r(e,P);M&&(M.emit(n,o),p++);}if(!m(e,P,b))return;let W=b.firstChild[P];for(;W!==a$1;)m$1(W,K+1),W=b.nextSibling[W];}m$1(t,0);let D={dispatchCount:p,maxDepth:u,circularReferenceDetected:f};return Xo.parse(D)}var ms=z.object({tickRate:z.number().positive(),maxUpdatesPerFrame:z.number().int().positive(),interpolate:z.boolean()}),ys=z.object({targetFPS:z.number().nonnegative().optional(),fixedTimestep:z.boolean().optional(),maxDeltaTime:z.number().positive().optional(),fixedTimestepMode:ms.optional()}),Qo=(o=>(o[o.STOPPED=0]="STOPPED",o[o.RUNNING=1]="RUNNING",o[o.PAUSED=2]="PAUSED",o))(Qo||{});function je(){let[e,t]=process.hrtime();return e+t/1e9}function gs(e,t={},n={}){let o=ys.parse(t),r=e,i=b$1(),a={...n},s=0,l={targetFPS:o.targetFPS??60,fixedTimestep:o.fixedTimestep??true,maxDeltaTime:o.maxDeltaTime??.1,fixedTimestepMode:o.fixedTimestepMode},c=0,p=l.targetFPS>0?1/l.targetFPS:0,u=0,f=0,m=0,D=0,P=0,K=0,W=0,M=l.fixedTimestepMode?1/l.fixedTimestepMode.tickRate:1/60,G=0,he=0,ve=0,re=0,d=0,g=null,E=null;function A(){if(l.targetFPS===0)g=setImmediate(()=>It());else {let I=je()-c,$=Math.max(0,p-I);$>.001?E=setTimeout(()=>It(),$*1e3):g=setImmediate(()=>It());}}function j(){g!==null&&(clearImmediate(g),g=null),E!==null&&(clearTimeout(E),E=null);}function Pn(b){a.onBeforeInput?.(r,b),r=i.run(r,b),a.onAfterInput?.(r,b),a.onBeforeUpdate?.(r,b),a.onAfterUpdate?.(r,b),a.onBeforeRender?.(r,b),a.onAfterRender?.(r,b),u++;}function kn(b){let I=l.fixedTimestepMode;if(!I)return;a.onBeforeInput?.(r,b),r=i.runInputOnly(r,b),a.onAfterInput?.(r,b),W+=b,d=0;let $=0;for(;W>=M;){if($>=I.maxUpdatesPerFrame){d=Math.floor(W/M),W=W%M;break}a.onBeforeFixedUpdate?.(r,M,G),a.onBeforeUpdate?.(r,M),r=i.runFixedUpdatePhases(r,M),a.onAfterUpdate?.(r,M),a.onAfterFixedUpdate?.(r,M,G),W-=M,G++,he++,$++;}re=I.interpolate?W/M:0,I.interpolate&&a.onInterpolate&&a.onInterpolate(r,re),a.onBeforeRender?.(r,b),r=i.runRenderPhases(r,b),a.onAfterRender?.(r,b),u++;}function ei(b,I){K=I*1e3,D++,b-m>=1&&(P=D,ve=he,D=0,he=0,m=b);}function It(){if(s!==1)return;let b=je(),I=b-c;c=b,I>l.maxDeltaTime&&(I=l.maxDeltaTime),l.fixedTimestepMode?kn(I):Pn(I),ei(b,I),A();}let An={getState(){return s},isRunning(){return s===1},isPaused(){return s===2},isStopped(){return s===0},getStats(){return {fps:P,frameTime:K,frameCount:u,runningTime:s!==0?je()-f:0,tickCount:G,ticksPerSecond:ve,interpolationAlpha:re,skippedUpdates:d}},getInterpolationAlpha(){return re},getFixedTimestepConfig(){return l.fixedTimestepMode},isFixedTimestepMode(){return l.fixedTimestepMode!==void 0},getScheduler(){return i},getWorld(){return r},setWorld(b){if(s!==0)throw new Error("Cannot change world while loop is running");r=b;},setTargetFPS(b){l.targetFPS=b,p=b>0?1/b:0;},getTargetFPS(){return l.targetFPS},registerSystem(b,I,$=0){i.registerSystem(b,I,$);},unregisterSystem(b){i.unregisterSystem(b);},registerInputSystem(b,I=0){i.registerInputSystem(b,I);},setHooks(b){a={...a,...b};},start(){if(s===1)return;let b=s===0;s=1,c=je(),b?(u=0,f=c,m=c,D=0,W=0,G=0,he=0,ve=0,re=0,d=0,a.onStart?.()):a.onResume?.(),A();},stop(){s!==0&&(j(),s=0,a.onStop?.());},pause(){s===1&&(j(),s=2,a.onPause?.());},resume(){s===2&&An.start();},step(b){let I=je(),$=b??(c>0?I-c:1/60);c=I;let Xe=Math.min($,l.maxDeltaTime);l.fixedTimestepMode?kn(Xe):Pn(Xe),K=Xe*1e3;},stepFixed(){if(!l.fixedTimestepMode)throw new Error("stepFixed() requires fixedTimestepMode to be enabled");a.onBeforeFixedUpdate?.(r,M,G),a.onBeforeUpdate?.(r,M),r=i.runFixedUpdatePhases(r,M),a.onAfterUpdate?.(r,M),a.onAfterFixedUpdate?.(r,M,G),G++;}};return An}function bs(e){return e?.isRunning()??false}function hs(e){return e?.isPaused()??false}var S={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 vs(e,t,n){S.xi[t]=n.xi,S.xl[t]=n.xl,S.yi[t]=n.yi,S.yl[t]=n.yl,S.base[t]=n.base,S.valid[t]=1;}function Es(e,t){if(S.valid[t]===1)return {xi:S.xi[t],xl:S.xl[t],yi:S.yi[t],yl:S.yl[t],base:S.base[t]}}function xs(e,t){return S.valid[t]===1}function Ss(e,t){S.valid[t]=0;}function Cs(e,t,n){S.valid[t]=0;let o=n(e,t);for(let r of o)S.valid[r]=0;}function Ds(e){S.valid.fill(0);}function Ts(e,t){return S.valid[t]!==1?0:S.xl[t]-S.xi[t]}function Ps(e,t){return S.valid[t]!==1?0:S.yl[t]-S.yi[t]}function ks(e,t,n){S.valid[t]===1&&(S.base[t]=n);}function sn(e,t,n,o){if(S.valid[t]!==1)return false;let r=S.xi[t],i=S.xl[t],a=S.yi[t],s=S.yl[t];return n>=r&&n<i&&o>=a&&o<s}function As(e){return o$1(e,[Ba$1,$,I])}function Is(e){return o$1(e,[ka$1])}function Pe(e){return o$1(e,[c$1])}function Rs(e){return o$1(e,[b$2])}function Bs(e){return o$1(e,[Ba$1,$,I,d$1])}function Ws(e){return o$1(e,[Ba$1,$,I,k])}function Ms(e){return o$1(e,[Ba$1,$,I,c$2])}function er(e){return o$1(e,[b])}function ws(e,t){return t.filter(n=>I.visible[n]===1)}function Ls(e,t){return t.filter(n=>I.dirty[n]===1)}function Fs(e,t){return t.filter(n=>I.visible[n]===1&&I.dirty[n]===1)}function tr(e,t){let n=[],o=b.firstChild[t];for(;o!==0;)n.push(o),o=b.nextSibling[o];return n}function Os(e,t){let n=[],o=[t];for(;o.length>0;){let r=o.pop(),i=tr(e,r);for(let a of i)n.push(a),o.push(a);}return n}function Ks(e){return er(e).filter(n=>b.parent[n]===0)}function Ns(e,t){return t.filter(n=>ka$1.focusable[n]===1)}function Us(e,t){return t.filter(n=>c$1.clickable[n]===1)}function _s(e,t){return [...t].sort((n,o)=>{let r=ka$1.tabIndex[n]??0,i=ka$1.tabIndex[o]??0;return r===0&&i!==0?1:i===0&&r!==0?-1:r-i})}function zs(e,t){return [...t].sort((n,o)=>(b.depth[n]??0)-(b.depth[o]??0))}var R=0,vt=2147483647,Et=-2147483648,nr=1e4,h={zIndex:new Int32Array(nr),localZ:new Int32Array(nr)};function Hs(e){h.zIndex[e]=R,h.localZ[e]=R;}function ge(e,t){m(e,t,h)||(l(e,t,h),Hs(t));}function ke(e,t){return m(e,t,h)?h.zIndex[t]??R:R}function Vs(e,t){return m(e,t,h)?h.localZ[t]??R:R}function xt(e,t){return m(e,t,h)}function js(e,t,n){ge(e,t),h.zIndex[t]=Math.max(Et,Math.min(vt,Math.floor(n)));}function Gs(e,t,n){ge(e,t),h.localZ[t]=Math.max(Et,Math.min(vt,Math.floor(n)));}function Ys(e,t){ge(e,t);let n=St(e,t);if(n.length===0)return;let o=h.zIndex[t]??R;for(let r of n)if(m(e,r,h)){let i=h.zIndex[r]??R;i>=o&&(o=i+1);}h.zIndex[t]=o;}function Js(e,t){ge(e,t);let n=St(e,t);if(n.length===0)return;let o=h.zIndex[t]??R;for(let r of n)if(m(e,r,h)){let i=h.zIndex[r]??R;i<=o&&(o=i-1);}h.zIndex[t]=o;}function Zs(e,t){ge(e,t);let n=St(e,t),o=h.zIndex[t]??R,r=null,i=vt;for(let a of n)if(m(e,a,h)){let s=h.zIndex[a]??R;s>o&&s<i&&(r=a,i=s);}return r!==null?(h.zIndex[t]=i,h.zIndex[r]=o,true):false}function $s(e,t){ge(e,t);let n=St(e,t),o=h.zIndex[t]??R,r=null,i=Et;for(let a of n)if(m(e,a,h)){let s=h.zIndex[a]??R;s<o&&s>i&&(r=a,i=s);}return r!==null?(h.zIndex[t]=i,h.zIndex[r]=o,true):false}function or(e,t){return [...t].sort((n,o)=>{let r=m(e,n,h)?h.zIndex[n]??R:R,i=m(e,o,h)?h.zIndex[o]??R:R;return r-i})}function rr(e,t){let n=f$1(e,t);return or(e,n)}function St(e,t){if(!m(e,t,b))return [];let n=i(e,t);return n===a$1?[]:f$1(e,n).filter(r=>r!==t)}function Xs(e,t){let n=rr(e,t);for(let o=0;o<n.length;o++){let r=n[o];r!==void 0&&(ge(e,r),h.zIndex[r]=o);}}function qs(e){h.zIndex[e]=R,h.localZ[e]=R;}function Qs(){return {entities:[],dirty:true,lastCount:0}}function el(e){e.dirty=true;}function tl(e){return e.dirty}function Re(e,t){if(!t.dirty)return;let o=Pe(e).filter(r=>c$1.clickable[r]===1||c$1.hoverable[r]===1);o.sort((r,i)=>{let a=xt(e,r)?h.zIndex[r]??0:0;return (xt(e,i)?h.zIndex[i]??0:0)-a}),t.entities=o,t.lastCount=o.length,t.dirty=false;}function nl(e,t){return Re(e,t),t.entities}function ol(e,t){return Re(e,t),t.entities.length}var ln={useCachedPositions:true,clickableOnly:true,hoverableOnly:false,interactiveOnly:false};function Ae(e,t,n){return m(e,t,c$1)?n.interactiveOnly?c$1.clickable[t]===1||c$1.hoverable[t]===1:n.clickableOnly&&n.hoverableOnly?c$1.clickable[t]===1&&c$1.hoverable[t]===1:n.clickableOnly?c$1.clickable[t]===1:n.hoverableOnly?c$1.hoverable[t]===1:true:false}function Ie(e,t,n,o,r){return r?sn(e,t,n,o):Zt(e,t,n,o)}function rl(e,t,n,o,r){let i=r.useCachedPositions??true;Re(e,t);for(let a of t.entities)if(Ae(e,a,r)&&Ie(e,a,n,o,i))return a;return null}function il(e,t,n,o){let r=o.useCachedPositions??true,i=Pe(e),a=[];for(let s of i)Ae(e,s,o)&&Ie(e,s,t,n,r)&&a.push({eid:s,z:ke(e,s)});return a.length===0?null:(a.sort((s,l)=>l.z-s.z),a[0]?.eid??null)}function Ge(e,t,n,o,r=ln){return o?rl(e,o,t,n,r):il(e,t,n,r)}function un(e,t,n,o,r=ln){let i=r.useCachedPositions??true,a=[];if(o){Re(e,o);for(let c of o.entities)Ae(e,c,r)&&Ie(e,c,t,n,i)&&a.push(c);return a}let s=Pe(e),l=[];for(let c of s)Ae(e,c,r)&&Ie(e,c,t,n,i)&&l.push({eid:c,z:ke(e,c)});return l.sort((c,p)=>p.z-c.z),l.map(c=>c.eid)}function al(e,t,n,o,r=ln){let i=r.useCachedPositions??true,a=[];if(o){Re(e,o);for(let l of o.entities)Ae(e,l,r)&&Ie(e,l,t,n,i)&&a.push({entity:l,zIndex:ke(e,l)});return a}let s=Pe(e);for(let l of s)Ae(e,l,r)&&Ie(e,l,t,n,i)&&a.push({entity:l,zIndex:ke(e,l)});return a.sort((l,c)=>c.zIndex-l.zIndex),a}function sl(e,t,n,o){return Ge(e,t,n,o,{clickableOnly:true,useCachedPositions:true})!==null}function ll(e,t,n,o){return Ge(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})!==null}function ul(e,t,n,o){return Ge(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function cl(e,t,n,o){return Ge(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}function dl(e,t,n,o){return un(e,t,n,o,{clickableOnly:true,useCachedPositions:true})}function fl(e,t,n,o){return un(e,t,n,o,{hoverableOnly:true,clickableOnly:false,useCachedPositions:true})}var ar=z.object({action:z.string().min(1,"Action name is required"),keys:z.array(z.string()).default([]),mouseButtons:z.array(z.enum(["left","right","middle","wheelUp","wheelDown","unknown"])).optional(),continuous:z.boolean().default(false),deadzone:z.number().min(0).max(1).default(.1)}),sr=z.object({version:z.number().int().positive(),bindings:z.array(z.object({action:z.string(),keys:z.array(z.string()),mouseButtons:z.array(z.string()).optional(),continuous:z.boolean().optional()}))}),ir={active:false,justActivated:false,justDeactivated:false,activeTime:0,value:0},pl=1;function ml(e,t){for(let n of e.keys)if(t.isKeyDown(n))return true;for(let n of e.mouseButtons)if(t.isMouseButtonDown(n))return true;return false}function yl(e){let t=new Map,n=new Map,o=new Map,r=new Set;function i(u,f,m){u.active=true,u.justActivated=true,u.activeTime=0,u.value=1,c(f,u,m);}function a(u,f,m){u.active=false,u.justDeactivated=true,u.value=0,c(f,u,m);}function s(u,f,m,D,P){u.activeTime+=D,u.value=1,f.continuous&&c(m,u,P);}function l(u,f,m,D,P){m.justActivated=false,m.justDeactivated=false;let K=m.active,W=ml(f,P);W&&!K?i(m,u,P):!W&&K?a(m,u,P):W&&s(m,f,u,D,P);}function c(u,f,m){let D=o.get(u);if(D)for(let P of D)P(u,f,m);for(let P of r)P(u,f,m);}let p={register(u){let f=ar.parse(u),m={action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons?[...f.mouseButtons]:[],continuous:f.continuous??false,deadzone:f.deadzone??.1};return t.set(f.action,m),n.has(f.action)||n.set(f.action,{...ir}),p},registerAll(u){for(let f of u)p.register(f);return p},unregister(u){let f=t.delete(u);return n.delete(u),o.delete(u),f},hasAction(u){return t.has(u)},getActions(){return [...t.keys()]},getBinding(u){let f=t.get(u);if(f)return {action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous,deadzone:f.deadzone}},update(u,f){let m=f*1e3;for(let[D,P]of t){let K=n.get(D);K&&l(D,P,K,m,u);}},isActive(u){return n.get(u)?.active??false},isJustActivated(u){return n.get(u)?.justActivated??false},isJustDeactivated(u){return n.get(u)?.justDeactivated??false},getValue(u){return n.get(u)?.value??0},getActiveTime(u){return n.get(u)?.activeTime??0},getState(u){return n.get(u)??ir},getActiveActions(){let u=[];for(let[f,m]of n)m.active&&u.push(f);return u},rebindKeys(u,f){let m=t.get(u);return m?(m.keys=[...f],true):false},rebindMouseButtons(u,f){let m=t.get(u);return m?(m.mouseButtons=[...f],true):false},addKey(u,f){let m=t.get(u);return m?(m.keys.includes(f)||m.keys.push(f),true):false},removeKey(u,f){let m=t.get(u);if(!m)return false;let D=m.keys.indexOf(f);return D!==-1?(m.keys.splice(D,1),true):false},getKeysForAction(u){let f=t.get(u);return f?[...f.keys]:[]},getMouseButtonsForAction(u){let f=t.get(u);return f?[...f.mouseButtons]:[]},getActionsForKey(u){let f=[];for(let[m,D]of t)D.keys.includes(u)&&f.push(m);return f},onAction(u,f){let m=o.get(u);return m||(m=new Set,o.set(u,m)),m.add(f),()=>{m?.delete(f);}},onAnyAction(u){return r.add(u),()=>{r.delete(u);}},saveBindings(){let u=[];for(let[,f]of t)u.push({action:f.action,keys:[...f.keys],mouseButtons:f.mouseButtons.length>0?[...f.mouseButtons]:void 0,continuous:f.continuous||void 0});return {version:pl,bindings:u}},loadBindings(u){let f=sr.parse(u);t.clear(),n.clear();for(let m of f.bindings)p.register({action:m.action,keys:m.keys,mouseButtons:m.mouseButtons,continuous:m.continuous});},toJSON(u=false){let f=p.saveBindings();return u?JSON.stringify(f,null,2):JSON.stringify(f)},fromJSON(u){let f=JSON.parse(u);p.loadBindings(f);},resetStates(){for(let u of n.values())u.active=false,u.justActivated=false,u.justDeactivated=false,u.activeTime=0,u.value=0;},clear(){t.clear(),n.clear(),o.clear(),r.clear();}};return e&&p.registerAll(e),p}var gl={platformer:[{action:"move_left",keys:["a","left"],continuous:true},{action:"move_right",keys:["d","right"],continuous:true},{action:"jump",keys:["space","w","up"]},{action:"crouch",keys:["s","down"],continuous:true},{action:"attack",keys:["j","enter"]}],topDown:[{action:"move_up",keys:["w","up"],continuous:true},{action:"move_down",keys:["s","down"],continuous:true},{action:"move_left",keys:["a","left"],continuous:true},{action:"move_right",keys:["d","right"],continuous:true},{action:"action",keys:["space","enter"]}],menu:[{action:"up",keys:["w","up"]},{action:"down",keys:["s","down"]},{action:"left",keys:["a","left"]},{action:"right",keys:["d","right"]},{action:"confirm",keys:["enter","space"]},{action:"cancel",keys:["escape","backspace"]}]};function Ct(){return performance.now()}function cn(e){return e.length===0?0:e.reduce((n,o)=>n+o,0)/e.length}function lr(e,t){if(e.length===0)return 0;if(e.length===1)return e[0]??0;let n=Math.ceil(t*e.length)-1;return e[Math.max(0,Math.min(n,e.length-1))]??0}function bl(e,t){t&&console.warn(`[InputEventBuffer] Dropped ${e} events due to buffer overflow`);}function ur(e={}){let t=e.warnOnOverflow??true;return {keyEvents:[],mouseEvents:[],latencySamples:[],frameProcessingTimes:[],frameStartTime:0,totalKeyEvents:0,totalMouseEvents:0,droppedEvents:0,config:{maxBufferSize:e.maxBufferSize??1e3,maxLatencySamples:e.maxLatencySamples??1e3,maxFrameSamples:e.maxFrameSamples??100,warnOnOverflow:t,onOverflow:e.onOverflow??(n=>bl(n,t))}}}function cr(e,t){let n=e.config.maxBufferSize;if(n<=0)return 0;if(t.length>n){let o=t.length-n;return t.splice(0,o),e.droppedEvents+=o,e.config.onOverflow(o),o}return 0}function hl(e,t,n){e.totalKeyEvents++;let o={type:"key",event:t,timestamp:n??Ct()};e.keyEvents.push(o),cr(e,e.keyEvents);}function vl(e,t,n){e.totalMouseEvents++;let o={type:"mouse",event:t,timestamp:n??Ct()};e.mouseEvents.push(o),cr(e,e.mouseEvents);}function dr(e){let t=e.keyEvents;return e.keyEvents=[],t}function fr(e){let t=e.mouseEvents;return e.mouseEvents=[],t}function El(e){let t=dr(e),n=fr(e),o=[...t,...n];return o.sort((r,i)=>r.timestamp-i.timestamp),o}function xl(e){let t=[...e.keyEvents,...e.mouseEvents];return t.sort((n,o)=>n.timestamp-o.timestamp),t}function Sl(e){return e.keyEvents}function Cl(e){return e.mouseEvents}function Dl(e){e.keyEvents=[],e.mouseEvents=[];}function Tl(e){return e.keyEvents.length}function Pl(e){return e.mouseEvents.length}function kl(e){return e.keyEvents.length+e.mouseEvents.length}function Al(e){return e.keyEvents.length>0||e.mouseEvents.length>0}function Il(e){return {totalKeyEvents:e.totalKeyEvents,totalMouseEvents:e.totalMouseEvents,pendingKeyEvents:e.keyEvents.length,pendingMouseEvents:e.mouseEvents.length,droppedEvents:e.droppedEvents,maxBufferSize:e.config.maxBufferSize}}function Rl(e){e.totalKeyEvents=0,e.totalMouseEvents=0,e.droppedEvents=0;}function Bl(e){e.frameStartTime=Ct();}function Wl(e){let n=Ct()-e.frameStartTime;return e.frameProcessingTimes.push(n),e.frameProcessingTimes.length>e.config.maxFrameSamples&&e.frameProcessingTimes.shift(),n}function Ml(e,t){e.latencySamples.push(t),e.latencySamples.length>e.config.maxLatencySamples&&e.latencySamples.shift();}function wl(e,t,n){for(let o=0;o<Math.min(n,10);o++)e.latencySamples.push(t);for(;e.latencySamples.length>e.config.maxLatencySamples;)e.latencySamples.shift();}function dn(e){let t=e.latencySamples,n=e.frameProcessingTimes;if(t.length===0)return {min:0,max:0,avg:0,p95:0,p99:0,sampleCount:0,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:cn(n)};let o=[...t].sort((r,i)=>r-i);return {min:o[0]??0,max:o[o.length-1]??0,avg:cn(o),p95:lr(o,.95),p99:lr(o,.99),sampleCount:o.length,lastFrameProcessingTime:n[n.length-1]??0,avgFrameProcessingTime:cn(n)}}function Ll(e){e.latencySamples=[],e.frameProcessingTimes=[];}function Fl(e,t=16){return dn(e).p95<=t}function Ol(e,t=1){return dn(e).avgFrameProcessingTime<=t}var Kl=ur();var Nl=z.object({trackRepeats:z.boolean().optional(),debounceTime:z.number().nonnegative().optional(),customRepeatRate:z.number().positive().optional(),customRepeatDelay:z.number().positive().optional()}),pr={pressed:false,justPressed:false,justReleased:false,heldTime:0,repeatCount:0,lastEventTime:0},Be={pressed:false,justPressed:false,justReleased:false,heldTime:0,lastEventTime:0};function mr(){return {x:0,y:0,deltaX:0,deltaY:0,wheelDelta:0,buttons:{left:{...Be},right:{...Be},middle:{...Be},wheelUp:{...Be},wheelDown:{...Be},unknown:{...Be}}}}function Ul(e,t){return e.toLowerCase()}function _l(e={}){let t=Nl.parse(e),n={trackRepeats:t.trackRepeats??true,debounceTime:t.debounceTime??0,customRepeatRate:t.customRepeatRate??0,customRepeatDelay:t.customRepeatDelay??500},o=new Map,r=mr(),i=0,a=0,s=0,l=false,c=false,p=false;function u(){for(let d of o.values())d.justPressed=false,d.justReleased=false;for(let d of Object.values(r.buttons))d.justPressed=false,d.justReleased=false;}function f(d){for(let g of o.values())g.pressed&&(g.heldTime+=d);}function m(d,g){return n.debounceTime<=0||d.lastEventTime<=0?false:g-d.lastEventTime<n.debounceTime}function D(d){n.trackRepeats&&d.repeatCount++;}function P(d){d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0,d.repeatCount=0;}function K(d,g){let E=Ul(d.name),A=o.get(E);A||(A={...pr},o.set(E,A)),!m(A,g)&&(A.pressed?D(A):P(A),A.lastEventTime=g,d.ctrl&&!A.pressed&&(l=true),d.meta&&!A.pressed&&(c=true),d.shift&&!A.pressed&&(p=true));}function W(d,g){let E=o.get(d);!E||!E.pressed||(E.pressed=false,E.justPressed=false,E.justReleased=true,E.lastEventTime=g,d==="ctrl"&&(l=false),d==="alt"&&(c=false),d==="shift"&&(p=false));}function M(d){let g=r.x,E=r.y;r.x=d.x,r.y=d.y,r.deltaX+=d.x-g,r.deltaY+=d.y-E;}function G(d,g,E){g==="press"&&!d.pressed?(d.pressed=true,d.justPressed=true,d.justReleased=false,d.heldTime=0):g==="release"&&d.pressed&&(d.pressed=false,d.justPressed=false,d.justReleased=true),d.lastEventTime=E;}function he(d,g){M(d),d.button==="wheelUp"?r.wheelDelta+=1:d.button==="wheelDown"&&(r.wheelDelta-=1);let E=r.buttons[d.button];E&&G(E,d.action,g);}let ve=()=>{let d=performance.now();for(let[g,E]of o)E.pressed&&W(g,d);l=false,c=false,p=false;},re=()=>{let d=performance.now();for(let g of Object.values(r.buttons))g.pressed&&(g.pressed=false,g.justReleased=true,g.lastEventTime=d);};return {update(d,g,E){i++,a=d.length,s=g.length;let A=E*1e3;u(),f(A);for(let j of d)K(j.event,j.timestamp);r.deltaX=0,r.deltaY=0,r.wheelDelta=0;for(let j of g)he(j.event,j.timestamp);for(let j of Object.values(r.buttons))j.pressed&&(j.heldTime+=A);},isKeyDown(d){return o.get(d.toLowerCase())?.pressed??false},isKeyPressed(d){return o.get(d.toLowerCase())?.justPressed??false},isKeyReleased(d){return o.get(d.toLowerCase())?.justReleased??false},getKeyHeldTime(d){return o.get(d.toLowerCase())?.heldTime??0},getKeyState(d){return o.get(d.toLowerCase())??pr},getKeyRepeatCount(d){return o.get(d.toLowerCase())?.repeatCount??0},getPressedKeys(){let d=[];for(let[g,E]of o)E.pressed&&d.push(g);return d},getJustPressedKeys(){let d=[];for(let[g,E]of o)E.justPressed&&d.push(g);return d},getJustReleasedKeys(){let d=[];for(let[g,E]of o)E.justReleased&&d.push(g);return d},isCtrlDown(){return l},isAltDown(){return c},isShiftDown(){return p},hasModifier(){return l||c||p},isMouseButtonDown(d){return r.buttons[d]?.pressed??false},isMouseButtonPressed(d){return r.buttons[d]?.justPressed??false},isMouseButtonReleased(d){return r.buttons[d]?.justReleased??false},getMouseX(){return r.x},getMouseY(){return r.y},getMousePosition(){return {x:r.x,y:r.y}},getMouseDelta(){return {deltaX:r.deltaX,deltaY:r.deltaY}},getWheelDelta(){return r.wheelDelta},getMouseState(){return r},releaseKey(d){W(d.toLowerCase(),performance.now());},releaseAllKeys:ve,releaseAllMouseButtons:re,releaseAll(){ve(),re();},getStats(){let d=0,g=0,E=0;for(let A of o.values())A.pressed&&d++,A.justPressed&&g++,A.justReleased&&E++;return {keysDown:d,keysPressed:g,keysReleased:E,keyEventsThisFrame:a,mouseEventsThisFrame:s,frameCount:i}},getFrameCount(){return i},reset(){o.clear(),r=mr(),i=0,a=0,s=0,l=false,c=false,p=false;}}}function zl(e,t){for(let n of t)if(e.isKeyDown(n))return true;return false}function Hl(e,t){for(let n of t)if(!e.isKeyDown(n))return false;return true}function Vl(e,t){for(let n of t)if(e.isKeyPressed(n))return true;return false}function jl(e){let t=0,n=0;return (e.isKeyDown("a")||e.isKeyDown("left"))&&(t-=1),(e.isKeyDown("d")||e.isKeyDown("right"))&&(t+=1),(e.isKeyDown("w")||e.isKeyDown("up"))&&(n-=1),(e.isKeyDown("s")||e.isKeyDown("down"))&&(n+=1),{x:t,y:n}}var yr=z.object({keys:z.union([z.string(),z.array(z.string()).readonly()]),action:z.string().min(1),when:z.string().optional(),preventDefault:z.boolean().optional(),description:z.string().optional()}),Gl=z.array(yr),Yl={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"},Jl={control:"ctrl",cmd:"meta",command:"meta",option:"meta",alt:"meta",win:"meta",super:"meta"};function Zl(e,t){t==="ctrl"?e.ctrl=true:t==="meta"?e.meta=true:t==="shift"&&(e.shift=true);}function $l(e,t,n){if(t){let o=Xl(e);if(!o)return false;n.name=o;}else {let o=ql(e);if(!o)return false;Zl(n,o);}return true}function pn(e){if(!e)return null;let t=e.toLowerCase().split("+").map(o=>o.trim());if(t.length===0)return null;let n={name:"undefined",ctrl:false,meta:false,shift:false};for(let o=0;o<t.length;o++){let r=t[o];if(r&&!$l(r,o===t.length-1,n))return null}return n.name==="undefined"?null:n}function Xl(e){let t=e.toLowerCase(),n=Yl[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 ql(e){let t=e.toLowerCase();return t==="ctrl"||t==="meta"||t==="shift"?t:Jl[t]??null}function mn(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 gr(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 Ql(){return {bindings:new Map,keyIndex:new Map}}function br(e,t){let n=new Map(e.bindings),o=new Map;for(let[i,a]of e.keyIndex)o.set(i,[...a]);n.set(t.action,t);let r=Array.isArray(t.keys)?t.keys:[t.keys];for(let i of r){let a=pn(i);if(!a)continue;let s=mn(a),l=o.get(s)??[];o.set(s,[...l,t]);}return {bindings:n,keyIndex:o}}function eu(e,t){return t.reduce((n,o)=>br(n,o),e)}function tu(e,t){if(!e.bindings.get(t))return e;let o=new Map(e.bindings),r=new Map;for(let[i,a]of e.keyIndex){let s=a.filter(l=>l.action!==t);s.length>0&&r.set(i,s);}return o.delete(t),{bindings:o,keyIndex:r}}function nu(e,t){return e.bindings.get(t)}function ou(e,t){let n=mn(t);return e.keyIndex.get(n)??[]}function ru(e,t){let n=Array.isArray(e.keys)?e.keys:[e.keys];for(let o of n){let r=pn(o);if(r&&r.name===t.name&&r.ctrl===t.ctrl&&r.meta===t.meta&&r.shift===t.shift)return true}return false}function hr(e,t){if(!e)return true;let n=e.split("&&").map(o=>o.trim());for(let o of n)if(!vr(o,t))return false;return true}function vr(e,t){let n=e.trim();if(n.startsWith("!"))return !vr(n.slice(1),t);if(n.includes("==")){let r=n.split("==").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=fn(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)===l}if(n.includes("!=")){let r=n.split("!=").map(c=>c.trim()),i=r[0],a=r[1];if(!i||!a)return false;let s=fn(i,t),l=a.replace(/^['"]|['"]$/g,"");return String(s)!==l}return !!fn(n,t)}function fn(e,t){let n=e.trim();return t[n]}function iu(e,t,n={}){let o=gr(t),r=e.keyIndex.get(o)??[],i=[];for(let a of r)a.when&&!hr(a.when,n)||i.push({binding:a,action:a.action,preventDefault:a.preventDefault??true});return i}function au(e){return mn(e)}function su(e){return gr(e)}function lu(e){return [...e.bindings.values()]}var uu=[{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"}],cu=[{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 Er={CRITICAL:0,HIGH:1,NORMAL:2,LOW:3};function du(e){let t,n=false;return {get(){return n||(t=e(),n=true),t},isInitialized(){return n},reset(){t=void 0,n=false;}}}var be=[],We=null,Dt=null;function fu(e,t,n){be.find(r=>r.name===e)||be.push({name:e,priority:t,initFn:n,initialized:false,initTimeMs:null});}function xr(e){let t=be.find(r=>r.name===e);if(!t||t.initialized)return null;We===null&&(We=performance.now());let n=performance.now();t.initFn();let o=performance.now()-n;return t.initialized=true,t.initTimeMs=o,Dt===null&&(Dt=performance.now()-We),o}function pu(e=Er.LOW){We===null&&(We=performance.now());let t=0,n=[...be].filter(o=>!o.initialized&&o.priority<=e).sort((o,r)=>o.priority-r.priority);for(let o of n){let r=xr(o.name);r!==null&&(t+=r);}return t}function mu(){return {totalMs:be.filter(n=>n.initialized).reduce((n,o)=>n+(o.initTimeMs??0),0),subsystems:be.map(n=>({name:n.name,priority:n.priority,initTimeMs:n.initTimeMs??0,lazy:!n.initialized})),timeToFirstInit:Dt??0}}function yu(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 o of e.subsystems){let r=o.lazy?"(lazy)":`${o.initTimeMs.toFixed(1)}ms`,i=n[o.priority]??"UNKNOWN";t.push(` [${i}] ${o.name}: ${r}`);}return t.join(`
|
|
2
|
+
`)}function gu(){be.length=0,We=null,Dt=null;}function bu(e=6e4){let t=yn.value;if(t&&Date.now()-t.cachedAt<e)return t;let n=process.env,o=n.TERM??"",r=n.COLORTERM??"",i=r==="truecolor"||r==="24bit"||o.includes("24bit")||o.includes("truecolor"),a=i||o.includes("256color")||r==="256color",s=(n.LANG??"").includes("UTF-8")||(n.LC_ALL??"").includes("UTF-8"),l={term:o,trueColor:i,color256:a,unicode:s,width:process.stdout.columns??80,height:process.stdout.rows??24,cachedAt:Date.now()};return yn.value=l,l}var yn={value:null};function hu(){yn.value=null;}var Cr={0:"INPUT",1:"EARLY_UPDATE",2:"UPDATE",3:"LATE_UPDATE",4:"PHYSICS",5:"LAYOUT",6:"RENDER",7:"POST_RENDER"};function vu(e){return typeof e=="number"&&e>=0&&e<=7}function Sr(e){for(let t=0;t<=7;t++)e.set(t,{id:t,name:Cr[t]??`PHASE_${t}`,order:t*1e3,isBuiltin:true});}function Dr(){let e=new Map,t=0,n=true,o=[];Sr(e);function r(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),o=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}`,p=l.order,u=r(p),f=p+(u-p)/2;return e.set(c,{id:c,name:a,order:f,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(),o},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,Sr(e),n=true;}}}var Eu=Dr();var Tr=z.object({name:z.string().min(1),store:z.unknown()}),Pr=z.object({system:z.function(),phase:z.nativeEnum(a),priority:z.number().optional()}),kr=z.object({name:z.string().min(1),description:z.string().optional(),factory:z.function(),tags:z.array(z.string()).readonly().optional()}),Ar=z.object({name:z.string().min(1),theme:z.record(z.string(),z.unknown())}),Ir=z.object({name:z.string().min(1),version:z.string().min(1),dependencies:z.array(z.string().min(1)).readonly().optional(),components:z.array(Tr).readonly().optional(),systems:z.array(Pr).readonly().optional(),widgets:z.array(kr).readonly().optional(),themes:z.array(Ar).readonly().optional(),configSchema:z.unknown().optional(),init:z.function().optional(),onActivate:z.function().optional(),onDeactivate:z.function().optional(),cleanup:z.function().optional()});function xu(){return {_plugins:new Map}}function Su(e,t,n,o){let r=Ir.safeParse(o);if(!r.success)return {success:false,error:`Invalid plugin manifest: ${r.error.message}`,systemsRegistered:0,componentsRegistered:0};let i=e._plugins;if(i.has(o.name))return {success:false,error:`Plugin "${o.name}" is already registered`,systemsRegistered:0,componentsRegistered:0};if(o.dependencies){for(let s of o.dependencies)if(!i.has(s))return {success:false,error:`Missing dependency: "${s}" (required by "${o.name}")`,systemsRegistered:0,componentsRegistered:0}}let a=[];if(o.systems)for(let s of o.systems)t.registerSystem(s.phase,s.system,s.priority??0),a.push(s);return i.set(o.name,{plugin:o,registeredSystems:a,active:true}),o.init&&o.init(n),o.onActivate&&o.onActivate(n),{success:true,systemsRegistered:a.length,componentsRegistered:o.components?.length??0}}function Cu(e,t,n,o){let r=e._plugins,i=r.get(o);if(!i)return false;for(let[a,s]of r)if(a!==o&&s.plugin.dependencies?.includes(o))return false;i.active&&i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.plugin.cleanup&&i.plugin.cleanup(n),r.delete(o),true}function Du(e){let t=[];for(let n of e._plugins.values())t.push({name:n.plugin.name,version:n.plugin.version,dependencies:n.plugin.dependencies??[],componentCount:n.plugin.components?.length??0,systemCount:n.registeredSystems.length,widgetCount:n.plugin.widgets?.length??0,themeCount:n.plugin.themes?.length??0,active:n.active});return t}function Tu(e,t){return e._plugins.has(t)}function Pu(e){return e._plugins.size}function ku(e,t,n){let o=e._plugins,r=[...o.keys()].reverse();for(let i of r){let a=o.get(i);if(a){a.active&&a.plugin.onDeactivate&&a.plugin.onDeactivate(n);for(let s of a.registeredSystems)t.unregisterSystem(s.system);a.plugin.cleanup&&a.plugin.cleanup(n);}}o.clear();}function Au(e){return e}function Iu(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(i.active)return true;for(let a of i.registeredSystems)t.registerSystem(a.phase,a.system,a.priority??0);return i.active=true,i.plugin.onActivate&&i.plugin.onActivate(n),true}function Ru(e,t,n,o){let i=e._plugins.get(o);if(!i)return false;if(!i.active)return true;i.plugin.onDeactivate&&i.plugin.onDeactivate(n);for(let a of i.registeredSystems)t.unregisterSystem(a.system);return i.active=false,true}function Bu(e,t){return e._plugins.get(t)?.active??false}function Wu(e,t){return e.configSchema?e.configSchema.parse(t):t}var Mu=z.union([z.number(),z.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)'})]),Rr={center:"center",half:"half",left:"start",right:"end",top:"start",bottom:"end"};function wu(e){let t=e.match(/^(\d+(?:\.\d+)?)(%?)(([+-])(\d+(?:\.\d+)?))?$/);if(!t)return null;let n=Number.parseFloat(t[1]),o=t[2]==="%",r=0;if(t[3]){let i=t[4],a=Number.parseFloat(t[5]);r=i==="-"?-a:a;}return {base:n,isPercent:o,offset:r}}function Tt(e,t,n=0){if(typeof e=="number")return Math.floor(e)||0;let o=Rr[e];if(o)switch(o){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 r=wu(e);if(!r)return 0;let i;return r.isPercent?i=r.base/100*t:i=r.base,i+=r.offset,Math.floor(i)}function Lu(e,t,n=0){if(typeof e=="number"&&e<0)return t+e-n;if(typeof e=="string"&&e.startsWith("-")){let o=e.match(/^-(\d+(?:\.\d+)?)$/);if(o){let r=Number.parseFloat(o[1]);return t-r-n}}return Tt(e,t,n)}function bn(e,t,n=0){let o=t-n;return e<0?0:e>o?Math.max(0,o):e}function Fu(e){return typeof e=="number"?false:e.includes("%")}function Ou(e){return typeof e=="number"?false:e in Rr}function Ku(){return "center"}function Nu(e){return `${e}%`}function Uu(e,t){return t>=0?`${e}%+${t}`:`${e}%${t}`}function Br(e,t,n,o,r=0,i=0){return {x:Tt(e,n,r),y:Tt(t,o,i)}}function _u(e,t,n,o,r=0,i=0){let a=Br(e,t,n,o,r,i);return {x:bn(a.x,n,r),y:bn(a.y,o,i)}}function zu(e,t){let[n,o]=c$3(e()),r=setInterval(()=>{o(e());},t);return [n,()=>{clearInterval(r);}]}function Hu(e){let t=Date.now(),[n,o]=c$3(0),r=setInterval(()=>{let s=Date.now()-t,l=Math.min(s/e,1);o(l),l>=1&&clearInterval(r);},16);return [n,()=>{clearInterval(r);}]}function Vu(e,t){let[n,o]=c$3(t);return [n,i=>{let a=n(),s=e(a,i);o(s);}]}function ju(e,t){return d$2(()=>{let n=e.map(o=>o());return t(...n)})}function Gu(e,t){let{transform:n=p=>p.toString("utf8"),initialValue:o,destroyOnDispose:r=false}=t,[i,a]=c$3(o),s=(...p)=>{let u=p[0];a(n(u));},l=(...p)=>{let u=p[0];console.error("Stream error:",u);};return e.on("data",s),e.on("error",l),[i,()=>{e.removeListener("data",s),e.removeListener("error",l),r&&e.destroy&&e.destroy();}]}function Yu(e,t){let[n,o]=c$3(t),r=e(i=>{o(i);});return [n,r]}function Ju(e,t,n){let[o,r]=c$3(n),i=false,a=async()=>{if(!i)try{let c=await e();i||r(c);}catch(c){console.error("Polling error:",c);}};a();let s=setInterval(()=>{a();},t);return [o,()=>{i=true,clearInterval(s);}]}function Zu(e,t,n){let[o,r]=c$3(n),i=(...s)=>{let l=s[0];r(l);};return e.on(t,i),[o,()=>{e.removeListener(t,i);}]}function hn(e,t,n,o,r){e.transition={transition:r,elapsed:0,fromScene:n,toScene:o},r.onStart?.(t);}function $u(e,t){e.transition&&(e.transition.transition.onComplete?.(t),e.transition=null);}function vn(e,t){e.created||(e.scene.onCreate?.(t),e.created=true);}function Pt(e,t){vn(e,t),e.scene.onEnter?.(t);}function ue(e,t){e.onExit?.(t);}function Xu(e,t,n){for(let o=e.stack.length-1;o>=0;o--){let r=e.stack[o];r&&ue(r,t);}e.stack=[n.scene],Pt(n,t);}function qu(e,t,n){let o=e.stack[e.stack.length-1];o&&ue(o,t),e.stack.push(n.scene),Pt(n,t);}function Qu(e,t){if(e.stack.length<=0)return false;let n=e.stack[e.stack.length-1];n&&ue(n,t),e.stack.pop();let o=e.stack[e.stack.length-1];if(o){let r=e.registry.get(o.name);r&&Pt(r,t);}return true}function ec(){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 o=e.registry.get(n);if(!o)return false;let r=e.stack.indexOf(o.scene);return r!==-1&&(ue(o.scene,t),e.stack.splice(r,1)),o.created&&o.scene.onDestroy?.(t),e.registry.delete(n),true},switchTo(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){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&&ue(s,t);}e.stack=[r.scene],vn(r,t),hn(e,t,i,r.scene,o);}else Xu(e,t,r);return true},push(t,n,o){let r=e.registry.get(n);if(!r)return false;if(o){let i=e.stack[e.stack.length-1]??null;i&&ue(i,t),e.stack.push(r.scene),vn(r,t),hn(e,t,i,r.scene,o);}else qu(e,t,r);return true},pop(t,n){if(e.stack.length<=0)return false;if(n){let o=e.stack[e.stack.length-1]??null;o&&ue(o,t),e.stack.pop();let r=e.stack[e.stack.length-1]??null;return r?hn(e,t,o,r,n):e.transition=null,true}return Qu(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 o=Math.min(1,e.transition.elapsed/e.transition.transition.duration);if(e.transition.transition.onUpdate?.(t,o),o>=1){let r=e.transition.toScene;$u(e,t);let i=e.registry.get(r.name);i&&Pt(i,t);}},reset(t){e.transition=null;for(let n=e.stack.length-1;n>=0;n--){let o=e.stack[n];o&&ue(o,t);}for(let n of e.registry.values())n.created&&n.scene.onDestroy?.(t);e.registry.clear(),e.stack=[];}}}function tc(e,t){return {duration:e,onUpdate:t}}function nc(e,t,n){return {duration:e,onUpdate(o,r){n?.(o,r,t);}}}function oc(e,t){return n=>{let o=t();return e.isTransitioning()&&e.updateTransition(n,o),e.isTransitioning()||e.getCurrentScene()?.onUpdate?.(n,o),n}}function Wr(e,t,n,o){let r=[],i={};for(let s of n.fields)i[s]=[];let a=n.component;for(let s of t)if(o(e,s,n.component)){r.push(s);for(let l of n.fields){let c=a[l];c&&typeof c[s]<"u"?i[l]?.push(c[s]??0):i[l]?.push(0);}}return r.length===0?null:{name:n.name,entities:r,values:i}}function Mr(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function wr(e,t,n){let o=new Map,r=Array.from(t).sort((i,a)=>i-a);for(let i of r){let a=n(e);o.set(i,a);}return o}function Lr(e,t,n,o,r){for(let i of r){let a=n[i];if(!a||typeof a[o]>"u")continue;let s=e[i];s&&(s[t]=a[o]);}}function En(e){let t=new Set;for(let n of e.components)for(let o of n.entities)t.add(o);return t}function Fr(e,t){let n=[],o=[];for(let r of t)e.has(r)||n.push(r);for(let r of e)t.has(r)||o.push(r);return {added:n,removed:o}}function rc(e,t,n,o){if(!n||!n.entities.includes(o))return true;let r=n.entities.indexOf(o);for(let i of Object.keys(e.values)){let a=e.values[i]?.[t],s=n.values[i]?.[r];if(a!==s)return true}return false}function Or(e,t,n){let o=[],r={};for(let i of Object.keys(e.values))r[i]=[];for(let i=0;i<e.entities.length;i++){let a=e.entities[i];if(!(a===void 0||n.includes(a))&&rc(e,i,t,a)){o.push(a);for(let s of Object.keys(e.values)){let l=e.values[s]?.[i];l!==void 0&&r[s]?.push(l);}}}return o.length===0?null:{name:e.name,entities:o,values:r}}function ic(e,t){let n={};for(let o of Object.keys(t.values))n[o]=[...e.values[o]||[],...t.values[o]||[]];return {name:e.name,entities:[...e.entities,...t.entities],values:n}}function Kr(e,t,n){let o=[],r={};for(let s of Object.keys(e.values))r[s]=[];for(let s=0;s<e.entities.length;s++){let l=e.entities[s];if(!(l===void 0||!t.includes(l))){o.push(l);for(let c of Object.keys(e.values)){let p=e.values[c]?.[s];p!==void 0&&r[c]?.push(p);}}}if(o.length===0)return;let i={name:e.name,entities:o,values:r},a=n.find(s=>s.name===e.name);if(a){let s=ic(a,i),l=n.indexOf(a);n[l]=s;}else n.push(i);}function Nr(e){let t=new Map;for(let n of e)t.set(n,n);return t}function Ur(e,t,n,o,r){for(let i of t)if(!r(e,i)){let a=o(e);for(;a!==i&&a<i;)a=o(e);n.set(i,a);}}function _r(e,t,n,o,r,i,a,s){if(!s(e,t))return;i(e,t,n.component)||a(e,t,n.component);let l=n.component;for(let c of n.fields){let p=o.values[c];if(!p||typeof p[r]>"u")continue;let u=l[c];u&&(u[t]=p[r]);}}var ac=z.record(z.string(),z.array(z.number())),zr=z.object({name:z.string(),entities:z.array(z.number()),values:ac}),kt=z.object({version:z.number().int().positive(),timestamp:z.number().int().nonnegative(),entityCount:z.number().int().nonnegative(),components:z.array(zr)}),Hr=z.object({baseTimestamp:z.number().int().nonnegative(),timestamp:z.number().int().nonnegative(),addedEntities:z.array(z.number()),removedEntities:z.array(z.number()),changedComponents:z.array(zr)}),xn=[];function sc(e){xn=e;}function lc(){return xn}var uc=1;function cc(e,t){let n=k$1(e),o=[];for(let i of t){let a=Wr(e,n,i,m);a&&o.push(a);}let r={version:uc,timestamp:Date.now(),entityCount:n.length,components:o};return kt.parse(r)}function dc(e){kt.parse(e);let t=f$2(),n=Mr(e),o=wr(t,n,h$1);for(let r of e.components){let i=xn.find(a=>a.name===r.name);if(!i)throw new Error(`Component ${r.name} not registered`);for(let a=0;a<r.entities.length;a++){let s=r.entities[a];if(s===void 0)continue;let l$1=o.get(s);l$1!==void 0&&(l(t,l$1,i.component),Lr(i.component,l$1,r.values,a,i.fields));}}return t}function fc(e,t){kt.parse(e),kt.parse(t);let n=En(e),o=En(t),{added:r,removed:i}=Fr(n,o),a=[];for(let l of t.components){let c=e.components.find(u=>u.name===l.name),p=Or(l,c,r);p&&a.push(p);}for(let l of t.components)Kr(l,r,a);let s={baseTimestamp:e.timestamp,timestamp:t.timestamp,addedEntities:r,removedEntities:i,changedComponents:a};return Hr.parse(s)}function pc(e,t,n){Hr.parse(t);for(let i of t.removedEntities)j(e,i)&&i$2(e,i);let o=k$1(e),r=Nr(o);Ur(e,t.addedEntities,r,h$1,j);for(let i of t.changedComponents){let a=n.find(s=>s.name===i.name);if(!a)throw new Error(`Component ${i.name} not registered`);for(let s=0;s<i.entities.length;s++){let l$1=i.entities[s];if(l$1===void 0)continue;let c=r.get(l$1)||l$1;_r(e,c,a,i,s,m,l,j);}}return e}function jr(e,t){return o(e,t)?{h:2,v:2}:{h:0,v:0}}function At(e,t){let n=jr(e,t),o=h$2(e,t)?i$4(e,t):0;return n.h+o}function Vr(e,t){let n=jr(e,t),o=h$2(e,t)?j$1(e,t):0;return n.v+o}function Gr(e,t){if(!l$1(e,t))return At(e,t);let n=f$3(e,t);if(!n)return At(e,t);let o=n.split(`
|
|
3
|
+
`),r=0;for(let i of o){let a=b$3(i);a>r&&(r=a);}return r+At(e,t)}function Yr(e,t,n){if(!l$1(e,t))return Vr(e,t);let o=f$3(e,t),r=At(e,t),i=n?n-r:void 0,a;return i&&i>0?a=f$4(o,{width:i,wrap:true}).length:a=o.split(`
|
|
4
|
+
`).length,a+Vr(e,t)}function Sn(e,t){let n=Gr(e,t),o=Yr(e,t,n);return {width:n,height:o}}function mc(e,t){if(!ea$1(e,t)||!fa$1(e,t))return false;let n=Sn(e,t),o=$.minWidth[t],r=$.minHeight[t],i=$.maxWidth[t],a=$.maxHeight[t],s=Math.min(Math.max(n.width,o),i),l=Math.min(Math.max(n.height,r),a);return $.width[t]=s,$.height[t]=l,true}function yc(e,t){if(!fa$1(e,t))return;let n=Sn(e,t),o=$.minWidth[t],r=$.minHeight[t],i=$.maxWidth[t],a=$.maxHeight[t];return {width:Math.min(Math.max(n.width,o),i),height:Math.min(Math.max(n.height,r),a)}}var Zr=["fg","bold","underline","blink","inverse"],gc=["bg","transparent"],we=new Map,Je=0;function bc(){return Je}function hc(e){we.delete(e);}function vc(){Je++,we.clear();}function Ec(){we.clear();}function xc(e){let t=we.get(e);return t!==void 0&&t.timestamp===Je}function Me(e,t){return R$1(e,t)?{fg:I.fg[t],bg:I.bg[t],bold:I.bold[t]===1,underline:I.underline[t]===1,blink:I.blink[t]===1,inverse:I.inverse[t]===1,transparent:I.transparent[t]===1,opacity:I.opacity[t]??1}:Tn()}function Tn(){return {fg:G,bg:0,bold:false,underline:false,blink:false,inverse:false,transparent:false,opacity:1}}function Dn(e,t){return {fg:t.fg!==G?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 Sc(e){return e===G||e===0}function Ze(e,t){let n=we.get(t);if(n!==void 0&&n.timestamp===Je)return n.style;let o=Me(e,t);if(!k$2(e,t))return Cn(t,o),o;let r=g$1(e,t);if(r.length===0)return Cn(t,o),o;let i=Cc(e,r,o);return Cn(t,i),i}function Cc(e,t,n){let o=Me(e,t[t.length-1]);for(let r=t.length-2;r>=0;r--){let i=Me(e,t[r]);o=Dn(o,i);}return Dn(o,n)}function Cn(e,t){we.set(e,{style:t,timestamp:Je});}function Dc(e,t){return Ze(e,t)}function Tc(e){return Zr.includes(e)}function Pc(e,t,n){return Ze(e,t)[n]}function kc(e,t,n){let o=Me(e,t);if(Jr(o,n))return t;if(!k$2(e,t))return 0;let r=g$1(e,t);for(let i of r){let a=Me(e,i);if(Jr(a,n))return i}return 0}function Jr(e,t){let n=Tn();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 Ac(e,t){for(let n of t)Ze(e,n);}function Ic(e,t){let n=new Map;for(let o of t)n.set(o,Ze(e,o));return n}var oe={TERMINAL_TOO_SMALL:"terminal-too-small",UNSUPPORTED_CAPABILITY:"unsupported-capability",DEPRECATED_API:"deprecated-api",PERFORMANCE_ISSUE:"performance-issue"},$r=z.object({width:z.number().int().nonnegative(),height:z.number().int().nonnegative(),minWidth:z.number().int().positive(),minHeight:z.number().int().positive()}),Xr=z.object({capability:z.string(),fallback:z.string().optional()}),qr=z.object({api:z.string(),replacement:z.string(),since:z.string()}),Qr=z.object({metric:z.string(),value:z.number(),threshold:z.number(),frameTime:z.number().optional()}),$e=z.object({type:z.enum([oe.TERMINAL_TOO_SMALL,oe.UNSUPPORTED_CAPABILITY,oe.DEPRECATED_API,oe.PERFORMANCE_ISSUE]),message:z.string(),metadata:z.union([$r,Xr,qr,Qr]),timestamp:z.number()});function Rc(){return a$3()}function Bc(e,t,n,o,r){let i={width:t,height:n,minWidth:o,minHeight:r},a={type:oe.TERMINAL_TOO_SMALL,message:`Terminal size (${t}x${n}) is smaller than recommended (${o}x${r})`,metadata:i,timestamp:Date.now()};e.emit("warning",$e.parse(a));}function Wc(e,t,n){let o={capability:t,fallback:n},r={type:oe.UNSUPPORTED_CAPABILITY,message:`Terminal capability '${t}' is not supported${n?`. ${n}`:""}`,metadata:o,timestamp:Date.now()};e.emit("warning",$e.parse(r));}function Mc(e,t,n,o){let r={api:t,replacement:n,since:o},i={type:oe.DEPRECATED_API,message:`API '${t}' is deprecated since ${o}. Use '${n}' instead.`,metadata:r,timestamp:Date.now()};e.emit("warning",$e.parse(i));}function wc(e,t,n,o,r){let i={metric:t,value:n,threshold:o,frameTime:r},a={type:oe.PERFORMANCE_ISSUE,message:`Performance issue: ${t} (${n.toFixed(2)}) exceeds threshold (${o.toFixed(2)})`,metadata:i,timestamp:Date.now()};e.emit("warning",$e.parse(a));}export{er as $,_t as $a,uo as $b,gs as $c,Er as $d,sc as $e,oo as A,qs as Aa,Di as Ab,go as Ac,dn as Ad,Iu as Ae,Ac as Af,Jt as B,Qs as Ba,ze as Bb,bo as Bc,Ll as Bd,Ru as Be,Ic as Bf,ut as C,el as Ca,Ti as Cb,bt as Cc,Fl as Cd,Bu as Ce,oe as Cf,ro as D,tl as Da,Pi as Db,qa as Dc,Ol as Dd,Wu as De,$r as Df,Ui as E,Re as Ea,ki as Eb,ho as Ec,Kl as Ed,Mu as Ee,Xr as Ef,_i as F,nl as Fa,st as Fb,ht as Fc,_l as Fd,Tt as Fe,qr as Ff,zi as G,ol as Ga,Ai as Gb,vo as Gc,zl as Gd,Lu as Ge,Qr as Gf,Zt as H,Ge as Ha,Ii as Hb,Qa as Hc,Hl as Hd,bn as He,$e as Hf,Hi as I,un as Ia,Ri as Ib,es as Ic,Vl as Id,Fu as Ie,Rc as If,S as J,al as Ja,Wi as Jb,ts as Jc,jl as Jd,Ou as Je,Bc as Jf,vs as K,sl as Ka,Mi as Kb,ns as Kc,yr as Kd,Ku as Ke,Wc as Kf,Es as L,ll as La,wi as Lb,os as Lc,Gl as Ld,Nu as Le,Mc as Lf,xs as M,ul as Ma,Li as Mb,rs as Mc,pn as Md,Uu as Me,wc as Mf,Ss as N,cl as Na,Fi as Nb,is as Nc,Ql as Nd,Br as Ne,Cs as O,dl as Oa,Oi as Ob,as as Oc,br as Od,_u as Oe,Ds as P,fl as Pa,Ki as Pb,rn as Pc,eu as Pd,zu as Pe,Ts as Q,jn as Qa,Vi as Qb,an as Qc,tu as Qd,Hu as Qe,Ps as R,Gn as Ra,ct as Rb,ss as Rc,nu as Rd,Vu as Re,ks as S,Yn as Sa,qt as Sb,ls as Sc,ou as Sd,ju as Se,sn as T,Jn as Ta,Gi as Tb,us as Tc,ru as Td,Gu as Te,As as U,ti as Ua,Yi as Ub,cs as Uc,hr as Ud,Yu as Ue,Is as V,ni as Va,Ji as Vb,ds as Vc,iu as Vd,Ju as Ve,Pe as W,Zn as Wa,Zi as Wb,fs as Wc,au as Wd,Zu as We,Rs as X,Ut as Xa,$i as Xb,Xo as Xc,su as Xd,ec as Xe,Bs as Y,$n as Ya,Xi as Yb,qo as Yc,lu as Yd,tc as Ye,Ws as Z,ri as Za,qi as Zb,ps as Zc,uu as Zd,nc as Ze,Ms as _,ii as _a,Qi as _b,Qo as _c,cu as _d,oc as _e,ee as a,ws as aa,Xn as ab,ea as ac,bs as ad,du as ae,lc as af,en as b,Ls as ba,qn as bb,ta as bc,hs as bd,fu as be,cc as bf,Ta as c,Fs as ca,Qn as cb,na as cc,ar as cd,xr as ce,dc as cf,Pa as d,tr as da,ai as db,dt as dc,sr as dd,pu as de,fc as df,ka as e,Os as ea,si as eb,co as ec,yl as ed,mu as ee,pc as ef,Aa as f,Ks as fa,li as fb,oa as fc,gl as fd,yu as fe,Gr as ff,Ia as g,Ns as ga,zt as gb,ra as gc,ur as gd,gu as ge,Yr as gf,Ra as h,Us as ha,Ht as hb,ia as hc,hl as hd,bu as he,Sn as hf,tn as i,_s as ia,Q as ib,pt as ic,vl as id,hu as ie,mc as if,Ba as j,zs as ja,ui as jb,ga as jc,dr as jd,Cr as je,yc as jf,Wa as k,R as ka,Vt as kb,ba as kc,fr as kd,vu as ke,Zr as kf,Ma as l,vt as la,jt as lb,ha as lc,El as ld,Dr as le,gc as lf,wa as m,Et as ma,ci as mb,va as mc,xl as md,Eu as me,bc as mf,La as n,h as na,pi as nb,Ea as nc,Sl as nd,Tr as ne,hc as nf,Fa as o,ke as oa,mi as ob,xa as oc,Cl as od,Pr as oe,vc as of,Oa as p,Vs as pa,yi as pb,Sa as pc,Dl as pd,kr as pe,Ec as pf,fo as q,xt as qa,gi as qb,Ca as qc,Tl as qd,Ar as qe,xc as qf,po as r,js as ra,bi as rb,Da as rc,Pl as rd,Ir as re,Me as rf,Ka as s,Gs as sa,hi as sb,Te as sc,kl as sd,xu as se,Tn as sf,Na as t,Ys as ta,vi as tb,Ga as tc,Al as td,Su as te,Dn as tf,Ua as u,Js as ua,se as ub,Ya as uc,Il as ud,Cu as ue,Sc as uf,_a as v,Zs as va,T as vb,Ja as vc,Rl as vd,Du as ve,Ze as vf,za as w,$s as wa,xi as wb,Za as wc,Bl as wd,Tu as we,Dc as wf,Ha as x,or as xa,Si as xb,mo as xc,Wl as xd,Pu as xe,Tc as xf,Va as y,rr as ya,at as yb,yo as yc,Ml as yd,ku as ye,Pc as yf,lt as z,Xs as za,Ci as zb,gt as zc,wl as zd,Au as ze,kc as zf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {m as m$1,l,v as v$1}from'./chunk-7ZFQO3OQ.js';var e=1e4,m=(n=>(n[n.None=0]="None",n[n.Line=1]="Line",n[n.Background=2]="Background",n[n.Custom=3]="Custom",n))(m||{}),f={topLeft:9484,topRight:9488,bottomLeft:9492,bottomRight:9496,horizontal:9472,vertical:9474},s={topLeft:9556,topRight:9559,bottomLeft:9562,bottomRight:9565,horizontal:9552,vertical:9553},d={topLeft:9581,topRight:9582,bottomLeft:9584,bottomRight:9583,horizontal:9472,vertical:9474},L={topLeft:9487,topRight:9491,bottomLeft:9495,bottomRight:9499,horizontal:9473,vertical:9475},E={topLeft:43,topRight:43,bottomLeft:43,bottomRight:43,horizontal:45,vertical:124},A={topLeft:43,topRight:43,bottomLeft:43,bottomRight:43,horizontal:9476,vertical:9478},D={topLeft:43,topRight:43,bottomLeft:43,bottomRight:43,horizontal:9477,vertical:9479},u=4294967295,p=0,r={type:new Uint8Array(e),left:new Uint8Array(e),top:new Uint8Array(e),right:new Uint8Array(e),bottom:new Uint8Array(e),fg:new Uint32Array(e),bg:new Uint32Array(e),charTopLeft:new Uint32Array(e),charTopRight:new Uint32Array(e),charBottomLeft:new Uint32Array(e),charBottomRight:new Uint32Array(e),charHorizontal:new Uint32Array(e),charVertical:new Uint32Array(e)};function g(o){r.type[o]=0,r.left[o]=1,r.top[o]=1,r.right[o]=1,r.bottom[o]=1,r.fg[o]=u,r.bg[o]=p,r.charTopLeft[o]=f.topLeft,r.charTopRight[o]=f.topRight,r.charBottomLeft[o]=f.bottomLeft,r.charBottomRight[o]=f.bottomRight,r.charHorizontal[o]=f.horizontal,r.charVertical[o]=f.vertical;}function i(o,t){m$1(o,t,r)||(l(o,t,r),g(t));}function x(o,t){t.left!==void 0&&(r.left[o]=t.left?1:0),t.top!==void 0&&(r.top[o]=t.top?1:0),t.right!==void 0&&(r.right[o]=t.right?1:0),t.bottom!==void 0&&(r.bottom[o]=t.bottom?1:0);}function y(o,t){t.type!==void 0&&(r.type[o]=t.type),x(o,t),t.fg!==void 0&&(r.fg[o]=v$1(t.fg)),t.bg!==void 0&&(r.bg[o]=v$1(t.bg)),t.chars!==void 0&&c(o,t.chars);}function C(o,t,h){return i(o,t),y(t,h),t}function c(o,t){r.charTopLeft[o]=t.topLeft,r.charTopRight[o]=t.topRight,r.charBottomLeft[o]=t.bottomLeft,r.charBottomRight[o]=t.bottomRight,r.charHorizontal[o]=t.horizontal,r.charVertical[o]=t.vertical;}function z(o,t,h){return i(o,t),c(t,h),t}function U(o,t){if(m$1(o,t,r))return {type:r.type[t],left:r.left[t]===1,top:r.top[t]===1,right:r.right[t]===1,bottom:r.bottom[t]===1,fg:r.fg[t],bg:r.bg[t],charTopLeft:r.charTopLeft[t],charTopRight:r.charTopRight[t],charBottomLeft:r.charBottomLeft[t],charBottomRight:r.charBottomRight[t],charHorizontal:r.charHorizontal[t],charVertical:r.charVertical[t]}}function v(o,t){return m$1(o,t,r)}function O(o,t){return !m$1(o,t,r)||r.type[t]===0?false:r.left[t]===1||r.top[t]===1||r.right[t]===1||r.bottom[t]===1}function T(o,t){return i(o,t),r.left[t]=1,r.top[t]=1,r.right[t]=1,r.bottom[t]=1,t}function w(o,t){return i(o,t),r.left[t]=0,r.top[t]=0,r.right[t]=0,r.bottom[t]=0,t}function _(o,t,h){if(m$1(o,t,r))switch(h){case "topLeft":return r.charTopLeft[t];case "topRight":return r.charTopRight[t];case "bottomLeft":return r.charBottomLeft[t];case "bottomRight":return r.charBottomRight[t];case "horizontal":return r.charHorizontal[t];case "vertical":return r.charVertical[t]}}export{m as a,f as b,s as c,d,L as e,E as f,A as g,D as h,u as i,p as j,r as k,C as l,z as m,U as n,v as o,O as p,T as q,w as r,_ as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {r,m as m$1,l as l$1,v as v$1}from'./chunk-7ZFQO3OQ.js';import {i as i$1,c as c$1,e,a as a$1,b}from'./chunk-Z4EZERNE.js';var I=1e4,a=0,i={parent:new Uint32Array(I),firstChild:new Uint32Array(I),nextSibling:new Uint32Array(I),prevSibling:new Uint32Array(I),childCount:new Uint16Array(I),depth:new Uint16Array(I)};function et(n){i.parent[n]=a,i.firstChild[n]=a,i.nextSibling[n]=a,i.prevSibling[n]=a,i.childCount[n]=0,i.depth[n]=0;}function C(n,t){m$1(n,t,i)||(l$1(n,t,i),et(t));}function v(n,t){i.depth[n]=t;let r=i.firstChild[n];for(;r!==a;)v(r,t+1),r=i.nextSibling[r];}function _(n,t,r){C(n,t),r!==a&&C(n,r);let e=i.parent[t];return e===r||(e!==a&&P(t,e),r!==a?it(t,r):(i.parent[t]=a,v(t,0))),t}function P(n,t){let r=i.prevSibling[n],e=i.nextSibling[n];r!==a?i.nextSibling[r]=e:i.firstChild[t]=e,e!==a&&(i.prevSibling[e]=r),i.prevSibling[n]=a,i.nextSibling[n]=a,i.childCount[t]=i.childCount[t]-1;}function it(n,t){i.parent[n]=t;let r=i.firstChild[t];if(r===a)i.firstChild[t]=n;else {let o=r;for(;i.nextSibling[o]!==a;)o=i.nextSibling[o];i.nextSibling[o]=n,i.prevSibling[n]=o;}i.childCount[t]=i.childCount[t]+1;let e=i.depth[t];v(n,e+1);}function ot(n,t,r){return _(n,r,t),t}function Wt(n,t,r){return !m$1(n,r,i)||i.parent[r]!==t||_(n,r,a),t}function Ct(n,t){if(!m$1(n,t,i))return [];let r=[],e=i.firstChild[t];for(;e!==a;)r.push(e),e=i.nextSibling[e];return r}function V(n,t){if(!m$1(n,t,i))return [];let r=[],e=i.parent[t];for(;e!==a;)r.push(e),e=i.parent[e];return r}function St(n,t){if(!m$1(n,t,i))return [];let r=[],e=[],o=i.firstChild[t];for(;o!==a;)e.push(o),o=i.nextSibling[o];for(;e.length>0;){let f=e.pop();r.push(f);let b=[],E=i.firstChild[f];for(;E!==a;)b.push(E),E=i.nextSibling[E];for(let h=b.length-1;h>=0;h--)e.push(b[h]);}return r}function B(n,t){return m$1(n,t,i)?i.parent[t]:a}function It(n,t){if(m$1(n,t,i))return {parent:i.parent[t],firstChild:i.firstChild[t],nextSibling:i.nextSibling[t],prevSibling:i.prevSibling[t],childCount:i.childCount[t],depth:i.depth[t]}}function M(n,t){return m$1(n,t,i)}function Z(n,t){return m$1(n,t,i)?i.parent[t]===a:true}function vt(n,t){return m$1(n,t,i)?i.childCount[t]===0:true}function At(n,t){return m$1(n,t,i)?i.depth[t]:0}function Ft(n,t){return m$1(n,t,i)?i.nextSibling[t]:a}function Dt(n,t){return m$1(n,t,i)?i.prevSibling[t]:a}function ut(n,t,r){C(n,r),C(n,t);let e=i.parent[r];e!==a&&P(r,e);let o=i.firstChild[t];i.parent[r]=t,i.firstChild[t]=r,i.prevSibling[r]=a,i.nextSibling[r]=o,o!==a&&(i.prevSibling[o]=r),i.childCount[t]=i.childCount[t]+1;let f=i.depth[t];return v(r,f+1),t}function Tt(n,t,r,e){C(n,t);let o=i.childCount[t],f=e;if(f<0&&(f=Math.max(0,o+f)),f>=o)return ot(n,t,r);if(f===0)return ut(n,t,r);let b=i.firstChild[t];for(let E=0;E<f;E++)b=i.nextSibling[b];return at(n,r,b)}function at(n,t,r){if(!m$1(n,r,i))return t;let e=i.parent[r];if(e===a)return t;C(n,t);let o=i.parent[t];o!==a&&P(t,o);let f=i.prevSibling[r];i.parent[t]=e,i.prevSibling[t]=f,i.nextSibling[t]=r,i.prevSibling[r]=t,f!==a?i.nextSibling[f]=t:i.firstChild[e]=t,i.childCount[e]=i.childCount[e]+1;let b=i.depth[e];return v(t,b+1),t}function Pt(n,t,r){if(!m$1(n,r,i))return t;let e=i.parent[r];if(e===a)return t;C(n,t);let o=i.parent[t];o!==a&&P(t,o);let f=i.nextSibling[r];i.parent[t]=e,i.prevSibling[t]=r,i.nextSibling[t]=f,i.nextSibling[r]=t,f!==a&&(i.prevSibling[f]=t),i.childCount[e]=i.childCount[e]+1;let b=i.depth[e];return v(t,b+1),t}function kt(n,t){return _(n,t,a)}function Ut(n,t){if(!m$1(n,t,i))return a;let r=i.firstChild[t];if(r===a)return a;for(;i.nextSibling[r]!==a;)r=i.nextSibling[r];return r}function Ht(n,t){return m$1(n,t,i)?i.firstChild[t]:a}function Ot(n,t){if(!m$1(n,t,i))return -1;let r=i.parent[t];if(r===a)return -1;let e=0,o=i.firstChild[r];for(;o!==a;){if(o===t)return e;e++,o=i.nextSibling[o];}return -1}function Nt(n,t,r){if(!m$1(n,t,i)||r<0)return a;let e=i.firstChild[t];for(let o=0;o<r&&e!==a;o++)e=i.nextSibling[e];return e}function q(n,t){let r=[],e=i.firstChild[n];for(;e!==a;)r.push({entity:e,depth:t}),e=i.nextSibling[e];return r}function J(n,t){for(let r=n.length-1;r>=0;r--){let e=n[r];e&&t.push(e);}}function zt(n,t,r){if(!m$1(n,t,i))return true;let e=[],o=i.depth[t]??0,f=q(t,o+1);for(J(f,e);e.length>0;){let b=e.pop();if(!b)continue;let{entity:E,depth:h}=b;if(r(E,h-o)===false)return false;let rt=q(E,h+1);J(rt,e);}return true}function wt(n,t,r){if(!m$1(n,t,i))return true;let e=1,o=i.parent[t];for(;o!==a;){if(r(o,e)===false)return false;o=i.parent[o],e++;}return true}function st(n,t,r){if(!m$1(n,t,i)||!m$1(n,r,i)||t===r)return false;let e=i.parent[r];for(;e!==a;){if(e===t)return true;e=i.parent[e];}return false}function _t(n,t,r){return st(n,r,t)}function Vt(n,t){if(!m$1(n,t,i))return t;let r=t,e=i.parent[r];for(;e!==a;)r=e,e=i.parent[r];return r}function Bt(n,t,r){if(!m$1(n,t,i)||!m$1(n,r,i))return a;let e=new Set;e.add(t);let o=i.parent[t];for(;o!==a;)e.add(o),o=i.parent[o];if(e.has(r))return r;for(o=i.parent[r];o!==a;){if(e.has(o))return o;o=i.parent[o];}return a}function Mt(n,t){if(!m$1(n,t,i))return [];let r=i.parent[t];if(r===a)return [];let e=[],o=i.firstChild[r];for(;o!==a;)o!==t&&e.push(o),o=i.nextSibling[o];return e}var x=1e4,ft=r(255,255,255),lt=r(0,0,0,0),s={visible:new Uint8Array(x),dirty:new Uint8Array(x),fg:new Uint32Array(x),bg:new Uint32Array(x),bold:new Uint8Array(x),underline:new Uint8Array(x),blink:new Uint8Array(x),inverse:new Uint8Array(x),transparent:new Uint8Array(x),opacity:new Uint8Array(x)};function yt(n){s.visible[n]=1,s.dirty[n]=1,s.fg[n]=ft,s.bg[n]=lt,s.bold[n]=0,s.underline[n]=0,s.blink[n]=0,s.inverse[n]=0,s.transparent[n]=0,s.opacity[n]=255;}function R(n,t){m$1(n,t,s)||(l$1(n,t,s),yt(t));}function qt(n,t,r){return i$1.parse(r),R(n,t),Et(t,r),s.dirty[t]=1,t}function ct(n,t){t.fg!==void 0&&(s.fg[n]=v$1(t.fg)),t.bg!==void 0&&(s.bg[n]=v$1(t.bg));}function F(n,t,r){r!==void 0&&(t[n]=r?1:0);}function bt(n,t){if(F(n,s.bold,t.bold),F(n,s.underline,t.underline),F(n,s.blink,t.blink),F(n,s.inverse,t.inverse),F(n,s.transparent,t.transparent),t.opacity!==void 0){let r=Math.max(0,Math.min(1,t.opacity));s.opacity[n]=Math.round(r*255);}}function Et(n,t){ct(n,t),bt(n,t);}function Jt(n,t){if(m$1(n,t,s))return {fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function Qt(n,t){if(m$1(n,t,s))return {visible:s.visible[t]===1,dirty:s.dirty[t]===1,fg:s.fg[t],bg:s.bg[t],bold:s.bold[t]===1,underline:s.underline[t]===1,blink:s.blink[t]===1,inverse:s.inverse[t]===1,transparent:s.transparent[t]===1,opacity:s.opacity[t]/255}}function Xt(n,t){return R(n,t),s.dirty[t]=1,t}function tn(n,t){return m$1(n,t,s)&&(s.dirty[t]=0),t}function nn(n,t){return m$1(n,t,s)?s.dirty[t]===1:false}function Y(n,t,r){R(n,t);let e=s.visible[t]===1;return s.visible[t]=r?1:0,e!==r&&(s.dirty[t]=1),t}function L(n,t){return m$1(n,t,s)?s.visible[t]===1:false}function rn(n,t){return m$1(n,t,s)}function en(n,t){return Y(n,t,true)}function on(n,t){return Y(n,t,false)}function un(n,t){let r=L(n,t);return Y(n,t,!r)}function an(n,t){if(!L(n,t))return false;if(!M(n,t))return true;let r=V(n,t);for(let e of r)if(!L(n,e))return false;return true}function sn(n,t){if(!M(n,t)||Z(n,t))return false;let r=V(n,t);if(r.length===0)return true;let e=r[r.length-1];return e===void 0?true:!Z(n,e)}var S=1e4,d=-1;function pt(n){return -(n+2)}function X(n){if(n>=d)return null;let t=-(n+2);return t===0?0:t}function bn(n){return n<d}var y={width:new Float32Array(S),height:new Float32Array(S),minWidth:new Float32Array(S),minHeight:new Float32Array(S),maxWidth:new Float32Array(S),maxHeight:new Float32Array(S),shrink:new Uint8Array(S)};function Q(n){if(n==="auto")return d;if(typeof n=="string"){let t=Number.parseFloat(n);return pt(t)}return n}function En(n,t,r,e){return c$1.parse(r),c$1.parse(e),m$1(n,t,y)||(l$1(n,t,y),y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY,y.shrink[t]=0),y.width[t]=Q(r),y.height[t]=Q(e),t}function k(n,t){if(m$1(n,t,y))return {width:y.width[t],height:y.height[t],minWidth:y.minWidth[t],minHeight:y.minHeight[t],maxWidth:y.maxWidth[t],maxHeight:y.maxHeight[t],shrink:y.shrink[t]===1}}function pn(n,t,r){return e.parse(r),m$1(n,t,y)||(l$1(n,t,y),y.width[t]=d,y.height[t]=d,y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY,y.shrink[t]=0),r.minWidth!==void 0&&(y.minWidth[t]=r.minWidth),r.minHeight!==void 0&&(y.minHeight[t]=r.minHeight),r.maxWidth!==void 0&&(y.maxWidth[t]=r.maxWidth),r.maxHeight!==void 0&&(y.maxHeight[t]=r.maxHeight),t}function mn(n,t,r){return m$1(n,t,y)||(l$1(n,t,y),y.width[t]=d,y.height[t]=d,y.minWidth[t]=0,y.minHeight[t]=0,y.maxWidth[t]=Number.POSITIVE_INFINITY,y.maxHeight[t]=Number.POSITIVE_INFINITY),y.shrink[t]=r?1:0,t}function xn(n,t){return m$1(n,t,y)?y.shrink[t]===1:false}function hn(n,t){return m$1(n,t,y)}function gn(n,t,r){if(!m$1(n,t,y))return;let e=y.width[t];if(e===d)return;let o=X(e);return o!==null?o/100*r:e}function dn(n,t,r){if(!m$1(n,t,y))return;let e=y.height[t];if(e===d)return;let o=X(e);return o!==null?o/100*r:e}var D=1e4,mt=4294967295,xt=0,c={focusable:new Uint8Array(D),focused:new Uint8Array(D),tabIndex:new Int16Array(D),focusEffectFg:new Uint32Array(D),focusEffectBg:new Uint32Array(D)},m=null;function ht(n){c.focusable[n]=1,c.focused[n]=0,c.tabIndex[n]=0,c.focusEffectFg[n]=mt,c.focusEffectBg[n]=xt;}function U(n,t){m$1(n,t,c)||(l$1(n,t,c),ht(t));}function Sn(n,t,r){return U(n,t),r.focusable!==void 0&&(c.focusable[t]=r.focusable?1:0),r.tabIndex!==void 0&&(c.tabIndex[t]=r.tabIndex),r.focusEffectFg!==void 0&&(c.focusEffectFg[t]=r.focusEffectFg),r.focusEffectBg!==void 0&&(c.focusEffectBg[t]=r.focusEffectBg),t}function In(n,t,r){return U(n,t),c.focusable[t]=r?1:0,t}function vn(n,t){return m$1(n,t,c)?c.focused[t]===1:false}function An(n,t){return m$1(n,t,c)?c.focusable[t]===1:false}function tt(n,t){return U(n,t),c.focusable[t]!==1||(m!==null&&m!==t&&m$1(n,m,c)&&(c.focused[m]=0),c.focused[t]=1,m=t),t}function Fn(n,t){return m$1(n,t,c)&&(c.focused[t]=0,m===t&&(m=null)),t}function Dn(n,t){if(m$1(n,t,c))return {focusable:c.focusable[t]===1,focused:c.focused[t]===1,tabIndex:c.tabIndex[t],focusEffectFg:c.focusEffectFg[t],focusEffectBg:c.focusEffectBg[t]}}function Tn(n,t){return m$1(n,t,c)}function Pn(){return m}function kn(n,t,r){return U(n,t),c.tabIndex[t]=r,t}function Un(n,t){return m$1(n,t,c)?c.tabIndex[t]:-1}function gt(n,t){return m$1(n,t,c)?c.tabIndex[t]>=0&&c.focusable[t]===1:false}function nt(n,t){return t.filter(r=>gt(n,r)).sort((r,e)=>c.tabIndex[r]-c.tabIndex[e])}function Hn(n,t){let r=nt(n,t);if(r.length===0)return null;let o=((m!==null?r.indexOf(m):-1)+1)%r.length,f=r[o];return f!==void 0?(tt(n,f),f):null}function On(n,t){let r=nt(n,t);if(r.length===0)return null;let o=((m!==null?r.indexOf(m):0)-1+r.length)%r.length,f=r[o];return f!==void 0?(tt(n,f),f):null}function Nn(){m=null;}var H=1e4,l={x:new Float32Array(H),y:new Float32Array(H),z:new Uint16Array(H),absolute:new Uint8Array(H)};function W(n,t,r,e,o=0){return a$1.parse({x:r,y:e,z:o}),m$1(n,t,l)||(l$1(n,t,l),l.absolute[t]=0),l.x[t]=r,l.y[t]=e,l.z[t]=o,t}function Mn(n,t){if(m$1(n,t,l))return {x:l.x[t],y:l.y[t],z:l.z[t],absolute:l.absolute[t]===1}}function Zn(n,t,r){return m$1(n,t,l)||(l$1(n,t,l),l.x[t]=0,l.y[t]=0,l.z[t]=0),l.absolute[t]=r?1:0,t}function Ln(n,t){return m$1(n,t,l)?l.absolute[t]===1:false}function Rn(n,t){return m$1(n,t,l)}function Yn(n,t,r,e){return m$1(n,t,l)||(l$1(n,t,l),l.x[t]=0,l.y[t]=0,l.z[t]=0,l.absolute[t]=0),l.x[t]=l.x[t]+r,l.y[t]=l.y[t]+e,t}function A(n,t,r){return b.parse(r),m$1(n,t,l)||(l$1(n,t,l),l.x[t]=0,l.y[t]=0,l.absolute[t]=0),l.z[t]=r,t}function N(n,t){return m$1(n,t,l)?l.z[t]:0}function Gn(n,t,r){let e=0;for(let f of r)if(f!==t&&m$1(n,f,l)){let b=l.z[f];b>e&&(e=b);}let o=Math.min(e+1,65535);return A(n,t,o)}function Kn(n,t,r){let e=65535;for(let f of r)if(f!==t&&m$1(n,f,l)){let b=l.z[f];b<e&&(e=b);}let o=Math.max(e-1,0);return A(n,t,o)}function $n(n,t,r){let e=N(n,t),o=65535,f=false;for(let b of r)if(b!==t&&m$1(n,b,l)){let E=l.z[b];E>e&&E<o&&(o=E,f=true);}return f?A(n,t,Math.min(o+1,65535)):t}function jn(n,t,r){let e=N(n,t),o=0,f=false;for(let b of r)if(b!==t&&m$1(n,b,l)){let E=l.z[b];E<e&&E>o&&(o=E,f=true);}return f?A(n,t,Math.max(o-1,0)):t}function qn(n,t){let r=[];for(let e of t)m$1(n,e,l)&&r.push({entity:e,z:l.z[e]});r.sort((e,o)=>e.z-o.z);for(let e=0;e<r.length;e++){let o=r[e];o&&(l.z[o.entity]=e);}}function Jn(n,t,r){let e=N(n,t),o=N(n,r);A(n,t,o),A(n,r,e);}function Qn(n,t,r){if(!m$1(n,t,i)){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let e=B(n,t);if(e===0){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let o=k(n,e);if(!o){let g=O(r,0,0,0,0);return W(n,t,g.x,g.y),t}let f=k(n,t),b=f?.width??0,E=f?.height??0,h=O(r,o.width,o.height,b,E);return W(n,t,h.x,h.y),t}function O(n,t,r,e,o){switch(n){case "center":return {x:Math.floor((t-e)/2),y:Math.floor((r-o)/2)};case "top-left":case "tl":return {x:0,y:0};case "top-right":case "tr":return {x:Math.max(0,t-e),y:0};case "bottom-left":case "bl":return {x:0,y:Math.max(0,r-o)};case "bottom-right":case "br":return {x:Math.max(0,t-e),y:Math.max(0,r-o)};default:return {x:0,y:0}}}function Xn(n,t,r,e){if(!m$1(n,t,i))return W(n,t,0,0),t;let o=B(n,t);if(o===0)return W(n,t,0,0),t;let f=k(n,o);if(!f)return W(n,t,0,0),t;let b=Math.floor(f.width*r/100),E=Math.floor(f.height*e/100);return W(n,t,b,E),t}export{y as $,wt as A,Nn as Aa,st as B,l as Ba,_t as C,W as Ca,Vt as D,Mn as Da,Bt as E,Zn as Ea,Mt as F,Ln as Fa,ft as G,Rn as Ga,lt as H,Yn as Ha,s as I,A as Ia,qt as J,N as Ja,Jt as K,Gn as Ka,Qt as L,Kn as La,Xt as M,$n as Ma,tn as N,jn as Na,nn as O,qn as Oa,Y as P,Jn as Pa,L as Q,Qn as Qa,rn as R,Xn as Ra,en as S,on as T,un as U,an as V,sn as W,d as X,pt as Y,X as Z,bn as _,a,En as aa,i as b,k as ba,_ as c,pn as ca,ot as d,mn as da,Wt as e,xn as ea,Ct as f,hn as fa,V as g,gn as ga,St as h,dn as ha,B as i,mt as ia,It as j,xt as ja,M as k,c as ka,Z as l,Sn as la,vt as m,In as ma,At as n,vn as na,Ft as o,An as oa,Dt as p,tt as pa,ut as q,Fn as qa,Tt as r,Dn as ra,at as s,Tn as sa,Pt as t,Pn as ta,kt as u,kn as ua,Ut as v,Un as va,Ht as w,gt as wa,Ot as x,nt as xa,Nt as y,Hn as ya,zt as z,On as za};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {z as z$1}from'zod';var U=z$1.number().int().min(0).max(255).transform(r=>r),y=z$1.object({r:z$1.number().int().min(0).max(255),g:z$1.number().int().min(0).max(255),b:z$1.number().int().min(0).max(255)}),j=y.extend({a:z$1.number().min(0).max(1)}),I=z$1.object({h:z$1.number().min(0).max(360),s:z$1.number().min(0).max(100),l:z$1.number().min(0).max(100)}),W=I.extend({a:z$1.number().min(0).max(1)}),z=z$1.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,"Invalid hex color format. Expected #RGB, #RRGGBB, or #RRGGBBAA");function C(r){return typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=255}function M(r){if(!C(r))throw new Error(`Invalid Color256: ${r}. Must be integer 0-255.`);return r}function X(r){if(typeof r!="object"||r===null)return false;let o=r;return typeof o.r=="number"&&typeof o.g=="number"&&typeof o.b=="number"&&o.r>=0&&o.r<=255&&o.g>=0&&o.g<=255&&o.b>=0&&o.b<=255}var L=[{r:0,g:0,b:0},{r:128,g:0,b:0},{r:0,g:128,b:0},{r:128,g:128,b:0},{r:0,g:0,b:128},{r:128,g:0,b:128},{r:0,g:128,b:128},{r:192,g:192,b:192},{r:128,g:128,b:128},{r:255,g:0,b:0},{r:0,g:255,b:0},{r:255,g:255,b:0},{r:0,g:0,b:255},{r:255,g:0,b:255},{r:0,g:255,b:255},{r:255,g:255,b:255}];function H(){let r=[0,95,135,175,215,255],o=[];for(let n=0;n<6;n++)for(let t=0;t<6;t++)for(let e=0;e<6;e++)o.push({r:r[n]??0,g:r[t]??0,b:r[e]??0});return o}function S(){let r=[];for(let o=0;o<24;o++){let n=8+o*10;r.push({r:n,g:n,b:n});}return r}var w=H(),$=S(),l=[...L,...w,...$];function N(r){let o=n=>n.toString(16).padStart(2,"0");return `#${o(r.r)}${o(r.g)}${o(r.b)}`}var _=l.map(N);function J(r){let o=l[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return o}function Q(r){let o=_[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return o}var Z=[0,95,135,175,215,255];function q(r,o,n){if(r<0||r>5||o<0||o>5||n<0||n>5)throw new Error("Color cube levels must be 0-5");return 16+36*r+6*o+n}function v(r){if(r<0||r>23)throw new Error("Grayscale step must be 0-23");return 232+r}function rr(r){return r>=0&&r<=15}function or(r){return r>=16&&r<=231}function nr(r){return r>=232&&r<=255}var O={BLACK:0,MAROON:1,GREEN:2,OLIVE:3,NAVY:4,PURPLE:5,TEAL:6,SILVER:7,GRAY:8,RED:9,LIME:10,YELLOW:11,BLUE:12,FUCHSIA:13,CYAN:14,WHITE:15},tr={...O,DARK_GRAY:8,LIGHT_GRAY:7,BRIGHT_RED:9,BRIGHT_GREEN:10,BRIGHT_YELLOW:11,BRIGHT_BLUE:12,BRIGHT_MAGENTA:13,BRIGHT_CYAN:14,MAGENTA:5,DARK_RED:1,DARK_GREEN:2,DARK_YELLOW:3,DARK_BLUE:4,DARK_MAGENTA:5,DARK_CYAN:6};function G(r){let o=r.startsWith("#")?r.slice(1):r;if(!/^[0-9a-fA-F]+$/.test(o))throw new Error(`Invalid hex color: ${r}`);let n,t,e,s;if(o.length===3){let a=o[0]??"0",u=o[1]??"0",i=o[2]??"0";n=Number.parseInt(a+a,16),t=Number.parseInt(u+u,16),e=Number.parseInt(i+i,16);}else if(o.length===6)n=Number.parseInt(o.slice(0,2),16),t=Number.parseInt(o.slice(2,4),16),e=Number.parseInt(o.slice(4,6),16);else if(o.length===8)n=Number.parseInt(o.slice(0,2),16),t=Number.parseInt(o.slice(2,4),16),e=Number.parseInt(o.slice(4,6),16),s=Number.parseInt(o.slice(6,8),16)/255;else throw new Error(`Invalid hex color length: ${r}`);return s!==void 0?{r:n,g:t,b:e,a:s}:{r:n,g:t,b:e}}function d(r){let o=n=>Math.max(0,Math.min(255,Math.round(n))).toString(16).padStart(2,"0");return `#${o(r.r)}${o(r.g)}${o(r.b)}`}function ur(r){let o=t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0"),n=Math.round(r.a*255);return `#${o(r.r)}${o(r.g)}${o(r.b)}${o(n)}`}function R(r){let o=r.r/255,n=r.g/255,t=r.b/255,e=Math.max(o,n,t),s=Math.min(o,n,t),a=(e+s)/2;if(e===s)return {h:0,s:0,l:Math.round(a*100)};let u=e-s,i=a>.5?u/(2-e-s):u/(e+s),g;switch(e){case o:g=((n-t)/u+(n<t?6:0))/6;break;case n:g=((t-o)/u+2)/6;break;default:g=((o-n)/u+4)/6;break}return {h:Math.round(g*360),s:Math.round(i*100),l:Math.round(a*100)}}function p(r){let o=r.h/360,n=r.s/100,t=r.l/100;if(n===0){let u=Math.round(t*255);return {r:u,g:u,b:u}}let e=(u,i,g)=>{let b=g;return b<0&&(b+=1),b>1&&(b-=1),b<1/6?u+(i-u)*6*b:b<1/2?i:b<2/3?u+(i-u)*(2/3-b)*6:u},s=t<.5?t*(1+n):t+n-t*n,a=2*t-s;return {r:Math.round(e(a,s,o+1/3)*255),g:Math.round(e(a,s,o)*255),b:Math.round(e(a,s,o-1/3)*255)}}function ar(r){return {...R(r),a:r.a}}function ir(r){return {...p(r),a:r.a}}function m(r){let o=0,n=Number.POSITIVE_INFINITY;for(let t=0;t<256;t++){let e=l[t];if(!e)continue;let s=r.r-e.r,a=r.g-e.g,u=r.b-e.b,i=s*s+a*a+u*u;if(i<n&&(n=i,o=t),i===0)break}return o}function D(r){let o=l[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return o}function cr(r){let o=G(r);return m(o)}function br(r){let o=l[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return d(o)}function B(r){let o=Math.max(0,Math.min(255,Math.round(r.r))),n=Math.max(0,Math.min(255,Math.round(r.g))),t=Math.max(0,Math.min(255,Math.round(r.b)));return o<<16|n<<8|t}function x(r){return {r:r>>16&255,g:r>>8&255,b:r&255}}function lr(r){let o=G(r);return B(o)}function mr(r){return d(x(r))}function gr(r){return m(x(r))}function fr(r){let o=l[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return B(o)}function Rr(r){return `38;5;${r}`}function pr(r){return `48;5;${r}`}function xr(r){let o=typeof r=="number"?x(r):r;return `38;2;${o.r};${o.g};${o.b}`}function Cr(r){let o=typeof r=="number"?x(r):r;return `48;2;${o.r};${o.g};${o.b}`}function h(r){return r<48?0:r<115?1:r<155?2:r<195?3:r<235?4:5}function hr(r){let o=h(r.r),n=h(r.g),t=h(r.b);return 16+36*o+6*n+t}function Gr(r){let o=(r.r+r.g+r.b)/3;return 232+Math.max(0,Math.min(23,Math.round((o-8)/10)))}function A(r){if(typeof r=="string")return G(r);if(typeof r=="object"&&r!==null){if("r"in r&&"g"in r&&"b"in r)return {r:r.r,g:r.g,b:r.b};throw new Error("Invalid color object")}if(typeof r=="number")return C(r)?D(r):x(r);throw new Error(`Invalid color value: ${r}`)}function dr(r){if(typeof r=="number"&&C(r))return M(r);let o=A(r);return m(o)}function Br(r){let o=A(r);return B(o)}function Ar(r){let o=A(r);return d(o)}function T(r,o,n=.5){let t=Math.max(0,Math.min(1,n)),e=1-t;return {r:Math.round(r.r*e+o.r*t),g:Math.round(r.g*e+o.g*t),b:Math.round(r.b*e+o.b*t)}}function Tr(r,o,n=.5){let t={...f(r)},e={...f(o)},s=T(t,e,n);return m(s)}function Y(r,o){let n=Math.max(0,Math.min(1,o));return {r:Math.round(r.r+(255-r.r)*n),g:Math.round(r.g+(255-r.g)*n),b:Math.round(r.b+(255-r.b)*n)}}function k(r,o){let t=1-Math.max(0,Math.min(1,o));return {r:Math.round(r.r*t),g:Math.round(r.g*t),b:Math.round(r.b*t)}}function yr(r,o){let n={...f(r)},t=Y(n,o);return m(t)}function Ir(r,o){let n={...f(r)},t=k(n,o);return m(t)}function Lr(r,o){let n=R(r),t=Math.min(100,n.s+n.s*o);return p({...n,s:t})}function Hr(r,o){let n=R(r),t=Math.max(0,n.s-n.s*o);return p({...n,s:t})}function Sr(r){let o=Math.round(r.r*.299+r.g*.587+r.b*.114);return {r:o,g:o,b:o}}function wr(r,o){let n=r.a,t=1-n;return {r:Math.round(r.r*n+o.r*t),g:Math.round(r.g*n+o.g*t),b:Math.round(r.b*n+o.b*t)}}function $r(r,o){let n=r.a,t=o.a*(1-n),e=n+t;return e===0?{r:0,g:0,b:0,a:0}:{r:Math.round((r.r*n+o.r*t)/e),g:Math.round((r.g*n+o.g*t)/e),b:Math.round((r.b*n+o.b*t)/e),a:e}}function V(r,o){let n=R(r),t=(n.h+o)%360;return p({...n,h:t<0?t+360:t})}function Nr(r){return V(r,180)}function _r(r){return {r:255-r.r,g:255-r.g,b:255-r.b}}function F(r,o,n){if(n<2)return [r];let t=[];for(let e=0;e<n;e++){let s=e/(n-1);t.push(T(r,o,s));}return t}function Or(r,o,n){let t={...f(r)},e={...f(o)};return F(t,e,n).map(m)}function E(r){let o=r.r/255,n=r.g/255,t=r.b/255,e=o<=.03928?o/12.92:((o+.055)/1.055)**2.4,s=n<=.03928?n/12.92:((n+.055)/1.055)**2.4,a=t<=.03928?t/12.92:((t+.055)/1.055)**2.4;return .2126*e+.7152*s+.0722*a}function K(r,o){let n=E(r),t=E(o),e=Math.max(n,t),s=Math.min(n,t);return (e+.05)/(s+.05)}function Dr(r,o,n=4.5){return K(r,o)>=n}function f(r){let o=l[r];if(!o)throw new Error(`Invalid Color256: ${r}`);return o}export{Ir as $,ar as A,ir as B,m as C,D,cr as E,br as F,B as G,x as H,lr as I,mr as J,gr as K,fr as L,Rr as M,pr as N,xr as O,Cr as P,hr as Q,Gr as R,A as S,dr as T,Br as U,Ar as V,T as W,Tr as X,Y,k as Z,yr as _,U as a,Lr as aa,y as b,Hr as ba,j as c,Sr as ca,I as d,wr as da,W as e,$r as ea,z as f,V as fa,C as g,Nr as ga,M as h,_r as ha,X as i,F as ia,l as j,Or as ja,_ as k,E as ka,J as l,K as la,Q as m,Dr as ma,Z as n,q as o,v as p,rr as q,or as r,nr as s,O as t,tr as u,G as v,d as w,ur as x,R as y,p as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {m,l as l$1,n}from'./chunk-7ZFQO3OQ.js';var i=1e4,b={NONE:0,CTRL:1,META:2,SHIFT:4},s={lastKeyCode:new Uint32Array(i),lastKeyTime:new Float64Array(i),modifiers:new Uint8Array(i)},v={NONE:0,LEFT:1,MIDDLE:2,RIGHT:3,WHEEL_UP:4,WHEEL_DOWN:5},r={x:new Int16Array(i),y:new Int16Array(i),button:new Uint8Array(i),pressed:new Uint8Array(i),lastClickTime:new Float64Array(i),clickCount:new Uint8Array(i)},u={bufferId:new Uint32Array(i),cursorPos:new Uint16Array(i),selectionStart:new Int16Array(i),selectionEnd:new Int16Array(i)},l=new Map,I=1,p={create(t=""){let e=I++;return l.set(e,t),e},getText(t){return l.get(t)??""},setText(t,e){l.has(t)&&l.set(t,e);},insert(t,e,n){let o=l.get(t)??"",a=o.slice(0,e),c=o.slice(e);l.set(t,a+n+c);},delete(t,e,n){let o=l.get(t)??"",a=o.slice(0,e),c=o.slice(n);l.set(t,a+c);},getLength(t){return (l.get(t)??"").length},remove(t){return l.delete(t)},has(t){return l.has(t)},clear(){l.clear(),I=1;}};function K(t,e,n){let o=0;return t&&(o|=b.CTRL),e&&(o|=b.META),n&&(o|=b.SHIFT),o}function E(t){return {ctrl:!!(t&b.CTRL),meta:!!(t&b.META),shift:!!(t&b.SHIFT)}}function k(t){s.lastKeyCode[t]=0,s.lastKeyTime[t]=0,s.modifiers[t]=0;}function S(t,e,n){if(m(t,e,s)||(l$1(t,e,s),k(e)),n.lastKeyCode!==void 0&&(s.lastKeyCode[e]=n.lastKeyCode),n.lastKeyTime!==void 0&&(s.lastKeyTime[e]=n.lastKeyTime),n.modifiers!==void 0)s.modifiers[e]=n.modifiers;else if(n.ctrl!==void 0||n.meta!==void 0||n.shift!==void 0){let o=E(s.modifiers[e]??0);s.modifiers[e]=K(n.ctrl??o.ctrl,n.meta??o.meta,n.shift??o.shift);}return e}function A(t,e){if(!m(t,e,s))return;let n=s.modifiers[e]??0,o=E(n);return {lastKeyCode:s.lastKeyCode[e]??0,lastKeyTime:s.lastKeyTime[e]??0,modifiers:n,ctrl:o.ctrl,meta:o.meta,shift:o.shift}}function B(t,e){return m(t,e,s)}function D(t,e){m(t,e,s)&&n(t,e,s);}function L(t,e){m(t,e,s)&&(s.lastKeyCode[e]=0,s.modifiers[e]=0);}var W=500,M=3;function x(t){r.x[t]=0,r.y[t]=0,r.button[t]=0,r.pressed[t]=0,r.lastClickTime[t]=0,r.clickCount[t]=0;}function O(t,e,n){return m(t,e,r)||(l$1(t,e,r),x(e)),n.x!==void 0&&(r.x[e]=n.x),n.y!==void 0&&(r.y[e]=n.y),n.button!==void 0&&(r.button[e]=n.button),n.pressed!==void 0&&(r.pressed[e]=n.pressed?1:0),n.lastClickTime!==void 0&&(r.lastClickTime[e]=n.lastClickTime),n.clickCount!==void 0&&(r.clickCount[e]=n.clickCount),e}function P(t,e){if(m(t,e,r))return {x:r.x[e]??0,y:r.y[e]??0,button:r.button[e]??0,pressed:(r.pressed[e]??0)===1,lastClickTime:r.lastClickTime[e]??0,clickCount:r.clickCount[e]??0}}function U(t,e){return m(t,e,r)}function w(t,e){m(t,e,r)&&n(t,e,r);}function F(t,e,n,o,a,c=Date.now()){m(t,e,r)||(l$1(t,e,r),x(e));let C=r.lastClickTime[e]??0,T=r.button[e]??0,y=r.clickCount[e]??0;return a===T&&c-C<W?y=Math.min(y+1,M):y=1,r.x[e]=n,r.y[e]=o,r.button[e]=a,r.pressed[e]=1,r.lastClickTime[e]=c,r.clickCount[e]=y,y}function H(t,e){m(t,e,r)&&(r.button[e]=0,r.pressed[e]=0,r.clickCount[e]=0);}function g(t){u.bufferId[t]=0,u.cursorPos[t]=0,u.selectionStart[t]=-1,u.selectionEnd[t]=-1;}function _(t,e,n){return m(t,e,u)||(l$1(t,e,u),g(e)),n.bufferId!==void 0&&(u.bufferId[e]=n.bufferId),n.cursorPos!==void 0&&(u.cursorPos[e]=n.cursorPos),n.selectionStart!==void 0&&(u.selectionStart[e]=n.selectionStart),n.selectionEnd!==void 0&&(u.selectionEnd[e]=n.selectionEnd),e}function N(t,e){if(!m(t,e,u))return;let n=u.selectionStart[e]??-1,o=u.selectionEnd[e]??-1;return {bufferId:u.bufferId[e]??0,cursorPos:u.cursorPos[e]??0,selectionStart:n,selectionEnd:o,hasSelection:n>=0&&o>=0&&n!==o}}function R(t,e){return m(t,e,u)}function G(t,e){if(m(t,e,u)){let n$1=u.bufferId[e]??0;n$1>0&&p.remove(n$1),n(t,e,u);}}function X(t,e){if(!m(t,e,u))return "";let n=u.bufferId[e]??0;return p.getText(n)}function Y(t,e,n){if(!m(t,e,u))return;let o=u.bufferId[e]??0;o>0&&p.setText(o,n);}function j(t,e){m(t,e,u)&&(u.selectionStart[e]=-1,u.selectionEnd[e]=-1);}function q(t,e,n,o){m(t,e,u)&&(u.selectionStart[e]=n,u.selectionEnd[e]=o);}export{q as A,b as a,s as b,v as c,r as d,u as e,p as f,K as g,E as h,S as i,A as j,B as k,D as l,L as m,O as n,P as o,U as p,w as q,F as r,H as s,_ as t,N as u,R as v,G as w,X as x,Y as y,j as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {Ba,Ga}from'./chunk-ETFDYZVJ.js';import {m,l,n}from'./chunk-7ZFQO3OQ.js';var x=1e4,M=(r=>(r[r.BOX=0]="BOX",r[r.CIRCLE=1]="CIRCLE",r))(M||{}),o={type:new Uint8Array(x),width:new Float32Array(x),height:new Float32Array(x),offsetX:new Float32Array(x),offsetY:new Float32Array(x),layer:new Uint16Array(x),mask:new Uint16Array(x),isTrigger:new Uint8Array(x)},k=1,w=65535;function B(t,n){o.type[n]=0,o.width[n]=1,o.height[n]=1,o.offsetX[n]=0,o.offsetY[n]=0,o.layer[n]=k,o.mask[n]=w,o.isTrigger[n]=0;}function H(t,n,r={}){return m(t,n,o)||(l(t,n,o),B(t,n)),r.type!==void 0&&(o.type[n]=r.type),r.width!==void 0&&(o.width[n]=r.width),r.height!==void 0&&(o.height[n]=r.height),r.offsetX!==void 0&&(o.offsetX[n]=r.offsetX),r.offsetY!==void 0&&(o.offsetY[n]=r.offsetY),r.layer!==void 0&&(o.layer[n]=r.layer),r.mask!==void 0&&(o.mask[n]=r.mask),r.isTrigger!==void 0&&(o.isTrigger[n]=r.isTrigger?1:0),n}function j(t,n){if(m(t,n,o))return {type:o.type[n],width:o.width[n],height:o.height[n],offsetX:o.offsetX[n],offsetY:o.offsetY[n],layer:o.layer[n],mask:o.mask[n],isTrigger:o.isTrigger[n]===1}}function z(t,n){return m(t,n,o)}function G(t,n$1){return m(t,n$1,o)&&n(t,n$1,o),n$1}function J(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.layer[n]=r,n}function N(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.mask[n]=r,n}function Q(t,n,r){return m(t,n,o)||(l(t,n,o),B(t,n)),o.isTrigger[n]=r?1:0,n}function Z(t,n){return m(t,n,o)?o.isTrigger[n]===1:false}function nn(t,n,r,a){return (n&r)!==0&&(a&t)!==0}function T(t,n,r,a){let f=o.type[n],y=o.width[n],c=o.height[n],m=o.offsetX[n],b=o.offsetY[n],l=r+m,A=a+b;if(f===1){let p=y/2;return {minX:l-p,minY:A-p,maxX:l+p,maxY:A+p}}let W=y/2,Y=c/2;return {minX:l-W,minY:A-Y,maxX:l+W,maxY:A+Y}}function D(t,n){return t.minX<n.maxX&&t.maxX>n.minX&&t.minY<n.maxY&&t.maxY>n.minY}function P(t,n,r,a,f,y){let c=a-t,m=f-n,b=c*c+m*m,l=r+y;return b<l*l}function V(t,n,r,a){let f=Math.max(a.minX,Math.min(t,a.maxX)),y=Math.max(a.minY,Math.min(n,a.maxY)),c=t-f,m=n-y;return c*c+m*m<r*r}function tn(t,n,r,a,f,y,c){let m=o.type[n],b=o.type[f],l=o.offsetX[n],A=o.offsetY[n],W=o.offsetX[f],Y=o.offsetY[f],p=r+l,v=a+A,S=y+W,F=c+Y;if(m===1&&b===1){let E=o.width[n]/2,h=o.width[f]/2;return P(p,v,E,S,F,h)}if(m===0&&b===0){let E=T(t,n,r,a),h=T(t,f,y,c);return D(E,h)}if(m===1&&b===0){let E=o.width[n]/2,h=T(t,f,y,c);return V(p,v,E,h)}if(m===0&&b===1){let E=T(t,n,r,a),h=o.width[f]/2;return V(S,F,h,E)}return false}function rn(t,n,r){return t<n?{entityA:t,entityB:n,isTrigger:r}:{entityA:n,entityB:t,isTrigger:r}}function en(t){return `${t.entityA}:${t.entityB}`}var g=1e4,e={x:new Float32Array(g),y:new Float32Array(g),maxSpeed:new Float32Array(g),friction:new Float32Array(g)};function X(t){e.x[t]=0,e.y[t]=0,e.maxSpeed[t]=0,e.friction[t]=0;}function fn(t,n,r,a){return m(t,n,e)||(l(t,n,e),X(n)),e.x[n]=r,e.y[n]=a,n}function yn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),r.x!==void 0&&(e.x[n]=r.x),r.y!==void 0&&(e.y[n]=r.y),r.maxSpeed!==void 0&&(e.maxSpeed[n]=r.maxSpeed),r.friction!==void 0&&(e.friction[n]=r.friction),n}function mn(t,n){if(m(t,n,e))return {x:e.x[n],y:e.y[n],maxSpeed:e.maxSpeed[n],friction:e.friction[n]}}function I(t,n){return m(t,n,e)}function sn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),e.maxSpeed[n]=r,n}function cn(t,n,r){return m(t,n,e)||(l(t,n,e),X(n)),e.friction[n]=Math.max(0,Math.min(1,r)),n}function ln(t,n,r,a){return m(t,n,e)||(l(t,n,e),X(n)),e.x[n]=e.x[n]+r,e.y[n]=e.y[n]+a,n}function bn(t,n){if(!m(t,n,e))return 0;let r=e.x[n],a=e.y[n];return Math.sqrt(r*r+a*a)}function xn(t,n){return m(t,n,e)&&(e.x[n]=0,e.y[n]=0),n}function pn(t,n){return m(t,n,e)&&(e.x[n]=0,e.y[n]=0,e.maxSpeed[n]=0,e.friction[n]=0),n}var i={x:new Float32Array(g),y:new Float32Array(g)};function U(t){i.x[t]=0,i.y[t]=0;}function En(t,n,r,a){return m(t,n,i)||(l(t,n,i),U(n)),i.x[n]=r,i.y[n]=a,n}function hn(t,n){if(m(t,n,i))return {x:i.x[n],y:i.y[n]}}function R(t,n){return m(t,n,i)}function An(t,n){return m(t,n,i)&&(i.x[n]=0,i.y[n]=0),n}function Cn(t,n){return m(t,n,i)&&(i.x[n]=0,i.y[n]=0),n}function q(t,n){i.x[t]===void 0||e.x[t]===void 0||(e.x[t]=e.x[t]+i.x[t]*n,e.y[t]=e.y[t]+i.y[t]*n);}function _(t,n){let r=e.friction[t];if(r<=0)return;let a=1-r*n;if(a<=0){e.x[t]=0,e.y[t]=0;return}e.x[t]=e.x[t]*a,e.y[t]=e.y[t]*a;}function K(t){let n=e.maxSpeed[t];if(n<=0)return;let r=e.x[t],a=e.y[t],f=Math.sqrt(r*r+a*a);if(f>n){let y=n/f;e.x[t]=r*y,e.y[t]=a*y;}}function $(t,n){Ba.x[t]===void 0||e.x[t]===void 0||(Ba.x[t]=Ba.x[t]+e.x[t]*n,Ba.y[t]=Ba.y[t]+e.y[t]*n);}function gn(t,n,r){I(t,n)&&(R(t,n)&&q(n,r),_(n,r),K(n),Ga(t,n)&&$(n,r));}export{cn as A,ln as B,bn as C,xn as D,pn as E,i as F,En as G,hn as H,R as I,An as J,Cn as K,q as L,_ as M,K as N,$ as O,gn as P,M as a,o as b,k as c,w as d,H as e,j as f,z as g,G as h,J as i,N as j,Q as k,Z as l,nn as m,T as n,D as o,P as p,V as q,tn as r,rn as s,en as t,e as u,fn as v,yn as w,mn as x,I as y,sn as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-NPDPBAW6.js';import {m,l as l$1}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';var i=1e4,h=(o=>(o[o.Left=0]="Left",o[o.Center=1]="Center",o[o.Right=2]="Right",o))(h||{}),x=(o=>(o[o.Top=0]="Top",o[o.Middle=1]="Middle",o[o.Bottom=2]="Bottom",o))(x||{}),l=new Map,f=1,s={set(n,t){let r=f++;return l.set(r,t),r},get(n){return l.get(n)??""},delete(n){l.delete(n);},clear(){l.clear(),f=1;}};function E(n){let t=5381;for(let r=0;r<n.length;r++)t=(t<<5)+t^n.charCodeAt(r);return t>>>0}var e={contentId:new Uint32Array(i),length:new Uint32Array(i),hash:new Uint32Array(i),wrap:new Uint8Array(i),align:new Uint8Array(i),valign:new Uint8Array(i),parseTags:new Uint8Array(i),tabSize:new Uint8Array(i)},T=z$1.number().int().min(1).max(16),C=8;function d(n){e.contentId[n]=0,e.length[n]=0,e.hash[n]=0,e.wrap[n]=0,e.align[n]=0,e.valign[n]=0,e.parseTags[n]=0,e.tabSize[n]=C;}function u(n,t){m(n,t,e)||(l$1(n,t,e),d(t));}function W(n,t){if(t.wrap!==void 0&&(e.wrap[n]=t.wrap?1:0),t.align!==void 0&&(e.align[n]=t.align),t.valign!==void 0&&(e.valign[n]=t.valign),t.parseTags!==void 0&&(e.parseTags[n]=t.parseTags?1:0),t.tabSize!==void 0){let r=T.parse(t.tabSize);e.tabSize[n]=r;}}function y(n,t,r,o){u(n,t);let g=s.set(t,r);return e.contentId[t]=g,e.length[t]=r.length,e.hash[t]=E(r),o&&W(t,o),t}function b(n,t){if(!m(n,t,e))return "";let r=e.contentId[t];return s.get(r)}function z(n,t){if(!m(n,t,e))return;let r=e.contentId[t];return {text:s.get(r),length:e.length[t],hash:e.hash[t],wrap:e.wrap[t]===1,align:e.align[t],valign:e.valign[t],parseTags:e.parseTags[t]===1,tabSize:e.tabSize[t]}}function A(n,t,r,o){let g=a(r);return y(n,t,g,o)}function I(n,t){let r=b(n,t);return a(r)}function U(n,t,r){let o=b(n,t);return y(n,t,o+r)}function D(n,t){if(!m(n,t,e))return t;let r=e.contentId[t];return r!==0&&s.delete(r),e.contentId[t]=0,e.length[t]=0,e.hash[t]=0,t}function L(n,t){return m(n,t,e)}function O(n,t){return m(n,t,e)?e.length[t]:0}function _(n,t){return m(n,t,e)?e.hash[t]:0}function P(n,t,r){return u(n,t),e.align[t]=r,t}function B(n,t,r){return u(n,t),e.valign[t]=r,t}function F(n,t,r){return u(n,t),e.wrap[t]=r?1:0,t}function M(n,t){return m(n,t,e)?e.wrap[t]===1:false}function H(n,t,r){return u(n,t),e.parseTags[t]=r?1:0,t}function R(n,t){return m(n,t,e)?e.parseTags[t]===1:false}function Y(){s.clear();}export{h as a,x as b,s as c,e as d,y as e,b as f,z as g,A as h,I as i,U as j,D as k,L as l,O as m,_ as n,P as o,B as p,F as q,M as r,H as s,R as t,Y as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,c as c$2,e}from'./chunk-4LWWONFK.js';import {k as k$1,m as m$2,p,s,i,c as c$3,n as n$1,r as r$1}from'./chunk-GRMSEMU7.js';import {a as a$2,e as e$1,r,t,o as o$2}from'./chunk-C5PCEQ6G.js';import {a as a$1,h,o as o$3}from'./chunk-VIT4KE6Q.js';import {c as c$4,a as a$3}from'./chunk-ZL46COQF.js';import {c as c$1,u,o as o$1,m as m$3,p as p$2,k as k$2}from'./chunk-K2QWNDXV.js';import {p as p$1,n,k as k$3}from'./chunk-EOFT3PNU.js';import {Ba,$,ka,K as K$1,V,O,I,ta,za,ya,N,oa,pa}from'./chunk-ETFDYZVJ.js';import {m as m$1,o,a as a$4}from'./chunk-7ZFQO3OQ.js';var l={eventQueue:[],capturedEntity:null,lastMouseX:0,lastMouseY:0,lastHoveredEntity:null,eventBus:a$1()};function Oe(){l.eventQueue=[],l.capturedEntity=null,l.lastMouseX=0,l.lastMouseY=0,l.lastHoveredEntity=null;}function De(t){l.eventQueue.push({type:"key",event:t,timestamp:Date.now()});}function Ne(t){l.eventQueue.push({type:"mouse",event:t,timestamp:Date.now()});}function Te(){return l.eventQueue}function Me(){l.eventQueue=[];}function ke(){return l.eventBus}function We(t){l.capturedEntity=t;}function Dt(){l.capturedEntity=null;}function $e(){return l.capturedEntity!==null}function Pe(){return l.capturedEntity}function Nt(t,e,n,r){return !m$1(t,e,Ba)||!m$1(t,e,$)?false:gt(e,n,r)}function gt(t,e,n){let r=Ba.x[t]??0,o=Ba.y[t]??0,u=$.width[t]??0,i=$.height[t]??0;return u<=0||i<=0?false:e>=r&&e<r+u&&n>=o&&n<o+i}function Ae(t,e,n){let r=[],o$1=o(t,[Ba,$]);for(let u of o$1){if(!Nt(t,u,e,n))continue;let i=Ba.x[u]??0,s=Ba.y[u]??0,p=Ba.z[u]??0;r.push({entity:u,localX:e-i,localY:n-s,zIndex:p});}return r.sort((u,i)=>i.zIndex-u.zIndex),r}function Tt(t,e,n){let r=null,o$1=Number.NEGATIVE_INFINITY;for(let u of o(t,[Ba,$,c$1])){if(!gt(u,e,n))continue;let i=Ba.z[u]??0;i<o$1||(o$1=i,r=u);}return r}function Mt(t){switch(t){case "left":return c$3.LEFT;case "middle":return c$3.MIDDLE;case "right":return c$3.RIGHT;case "wheelUp":return c$3.WHEEL_UP;case "wheelDown":return c$3.WHEEL_DOWN;default:return c$3.NONE}}function kt(t,e){let n=ta();if(e.name==="tab"){let r=Array.from(o(t,[ka]));e.shift?za(t,r):ya(t,r);return}if(n!==null){let r=e.raw.length>0?e.raw[0]??0:0;i(t,n,{lastKeyCode:r,lastKeyTime:Date.now(),ctrl:e.ctrl,meta:e.meta,shift:e.shift}),l.eventBus.emit("keypress",{key:e.name,ctrl:e.ctrl,meta:e.meta,shift:e.shift});}}function Wt(t,e,n,r,o){e!==n&&(e!==null&&u(t,e)&&(o$1(t,e,false),l.eventBus.emit("mouseleave",{x:r,y:o})),n!==null&&u(t,n)&&m$3(t,n)&&(o$1(t,n,true),l.eventBus.emit("mouseenter",{x:r,y:o})),l.lastHoveredEntity=n);}function $t(t,e,n,r,o){p(t,e)&&(n$1(t,e,{x:n,y:r,button:o,pressed:true}),r$1(t,e,n,r,o)),u(t,e)&&p$2(t,e,true),l.eventBus.emit("mousedown",{x:n,y:r,button:o}),oa(t,e)&&pa(t,e);}function Pt(t,e,n,r,o){p(t,e)&&n$1(t,e,{x:n,y:r,button:o,pressed:false}),u(t,e)&&p$2(t,e,false),l.eventBus.emit("mouseup",{x:n,y:r,button:o}),k$2(t,e)&&l.eventBus.emit("click",{x:n,y:r,button:o}),l.capturedEntity!==null&&Dt();}function At(t,e){let n=e.x,r=e.y,o=Mt(e.button);l.lastMouseX=n,l.lastMouseY=r;let u=l.capturedEntity;if(u===null&&(u=Tt(t,n,r)),Wt(t,l.lastHoveredEntity,u,n,r),l.eventBus.emit("mousemove",{x:n,y:r}),u!==null)switch(e.action){case "press":$t(t,u,n,r,o);break;case "release":Pt(t,u,n,r,o);break;case "move":p(t,u)&&n$1(t,u,{x:n,y:r});break;case "wheel":{let i=o===c$3.WHEEL_UP?"up":"down";l.eventBus.emit("scroll",{direction:i,amount:1});break}}}var Et=t=>{let e=l.eventQueue;l.eventQueue=[];for(let n of e)n.type==="key"?kt(t,n.event):n.type==="mouse"&&At(t,n.event);return t};function Le(){return Et}function He(t,e=0){t.registerInputSystem(Et,e);}function Ke(t,e){k$1(t,e)&&m$2(t,e),p(t,e)&&s(t,e);}var P=[];function Fe(t){P.length=0;let e=new Set;for(let n of o(t,[c$1]))e.has(n)||(e.add(n),P.push(n));for(let n of o(t,[ka]))e.has(n)||(e.add(n),P.push(n));return P}var c="\x1B[",y={RESET:0,BOLD:1,DIM:2,ITALIC:3,UNDERLINE:4,BLINK:5,INVERSE:7,HIDDEN:8,STRIKETHROUGH:9,FG_256:38,BG_256:48};function xt(){return {lastX:-1,lastY:-1,lastFg:-1,lastBg:-1,lastAttrs:-1,alternateScreen:false,mouseTracking:false,mouseMode:null,syncOutput:false,bracketedPaste:false,focusReporting:false}}function L(t){return a$4(t,"output:colorCache")}function x(...t){return `${c}${t.join(";")}m`}function vt(t,e){return `${c}${e+1};${t+1}H`}function Lt(t){return `${c}${t+1}G`}function Ht(t){return t===1?`${c}C`:`${c}${t}C`}function Bt(t){return {a:t>>>24&255,r:t>>>16&255,g:t>>>8&255,b:t&255}}function Kt(t,e){let n=e|4294967296,r=L(t).get(n);if(r!==void 0)return r;let{r:o,g:u,b:i,a:s}=Bt(e),p=s===0?x(39):x(y.FG_256,2,o,u,i);return L(t).set(n,p),p}function Ft(t,e){let n=L(t).get(e);if(n!==void 0)return n;let{r,g:o,b:u,a:i}=Bt(e),s=i===0?x(49):x(y.BG_256,2,r,o,u);return L(t).set(e,s),s}function wt(t){let e=[];return t===a$2.NONE||(t&a$2.BOLD&&e.push(y.BOLD),t&a$2.DIM&&e.push(y.DIM),t&a$2.ITALIC&&e.push(y.ITALIC),t&a$2.UNDERLINE&&e.push(y.UNDERLINE),t&a$2.BLINK&&e.push(y.BLINK),t&a$2.INVERSE&&e.push(y.INVERSE),t&a$2.HIDDEN&&e.push(y.HIDDEN),t&a$2.STRIKETHROUGH&&e.push(y.STRIKETHROUGH),e.length===0)?"":x(...e)}function St(t,e,n){if(t.lastX===e&&t.lastY===n)return "";if(t.lastY===n){let r=e-t.lastX;return r===1?"":r>0&&r<=4?Ht(r):Lt(e)}return vt(e,n)}function Ct(t,e,n){let r="";return e.lastAttrs!==-1&&e.lastAttrs!==a$2.NONE&&n.attrs===a$2.NONE&&(r+=x(y.RESET),e.lastFg=-1,e.lastBg=-1,e.lastAttrs=-1),n.attrs!==e.lastAttrs&&n.attrs!==a$2.NONE?(e.lastAttrs!==-1&&e.lastAttrs!==a$2.NONE&&(r+=x(y.RESET),e.lastFg=-1,e.lastBg=-1),r+=wt(n.attrs),e.lastAttrs=n.attrs):n.attrs===a$2.NONE&&e.lastAttrs===-1&&(e.lastAttrs=a$2.NONE),n.fg!==e.lastFg&&(r+=Kt(t,n.fg),e.lastFg=n.fg),n.bg!==e.lastBg&&(r+=Ft(t,n.bg),e.lastBg=n.bg),r}function Qt(t,e,n){let{x:r,y:o,cell:u}=n,i="";return i+=St(e,r,o),i+=Ct(t,e,u),i+=u.char,e.lastX=r+1,e.lastY=o,i}function Vt(t,e){if(e)return t;let n=Array.from(t);return n.sort((r,o)=>r.y!==o.y?r.y-o.y:r.x-o.x),n}function Yt(t,e){let n=e+1;for(;n<t.length;){let r=t[n],o=t[n-1];if(!r||!o||!(r.y===o.y&&r.x===o.x+1&&r.cell.fg===o.cell.fg&&r.cell.bg===o.cell.bg&&r.cell.attrs===o.cell.attrs))break;n++;}return n}function Xt(t,e,n,r,o,u){let i=n[r];if(i){u.push(St(e,i.x,i.y)),u.push(Ct(t,e,i.cell));for(let s=r;s<o;s++){let p=n[s];p&&u.push(p.cell.char);}e.lastX=i.x+(o-r),e.lastY=i.y;}}function Ut(t,e,n,r=false){if(n.length===0)return "";let o=[],u=Vt(n,r),i=0;for(;i<u.length&&u[i];){let s=Yt(u,i);if(s-i===1){let p=u[i];p&&o.push(Qt(t,e,p));}else Xt(t,e,u,i,s,o);i=s;}return o.join("")}var A=null,B=null,b=null;function Xe(t){B=t;}function Ue(){return B}function _e(){B=null;}function qe(t){b=t;}function ze(){return b}function Ge(){b=null;}function m(){return A||(A=xt()),A}function je(){A=xt();}var _t=t=>{if(!B||!b)return t;let e$1=m(),n=b.fullRedraw,r=f(b);if(r.length===0)return c$2(b),e(b),t;let o=Ut(t,e$1,r,n);return o.length>0&&B.write(o),c$2(b),e(b),t};function Je(){return _t}function a(t){B&&B.write(t);}function Ze(){a(`${c}?25l`);}function qt(){a(`${c}?25h`);}function tn(){a(`${c}?1049h`);let t=m();t.alternateScreen=true;}function zt(){a(`${c}?1049l`);let t=m();t.alternateScreen=false;}function en(){a(`${c}2J`);}function Gt(){a(`${c}H`);let t=m();t.lastX=0,t.lastY=0;}function jt(){a(x(y.RESET));let t=m();t.lastFg=-1,t.lastBg=-1,t.lastAttrs=-1;}function nn(){a("\x07");}function rn(t,e){a(vt(t,e));let n=m();n.lastX=t,n.lastY=e;}function on(t="any"){let e=m();a(`${c}?1006h`),a(t==="normal"?`${c}?1000h`:t==="button"?`${c}?1002h`:`${c}?1003h`),e.mouseTracking=true,e.mouseMode=t;}function Jt(){let t=m();a(`${c}?1000l`),a(`${c}?1002l`),a(`${c}?1003l`),a(`${c}?1006l`),t.mouseTracking=false,t.mouseMode=null;}function un(t){a(`${c}${t==="block"?2:t==="underline"?4:6} q`);}function sn(t){a(`\x1B]2;${t}\x07`);}function ln(){a(`${c}?2026h`);let t=m();t.syncOutput=true;}function Zt(){a(`${c}?2026l`);let t=m();t.syncOutput=false;}function an(){a("\x1B7");}function cn(){a("\x1B8");}function fn(){a(`${c}?2004h`);let t=m();t.bracketedPaste=true;}function te(){a(`${c}?2004l`);let t=m();t.bracketedPaste=false;}function pn(){a(`${c}?1004h`);let t=m();t.focusReporting=true;}function ee(){a(`${c}?1004l`);let t=m();t.focusReporting=false;}function mn(){let t=m();t.bracketedPaste&&te(),t.focusReporting&&ee(),t.mouseTracking&&Jt(),t.syncOutput&&Zt(),t.alternateScreen&&zt(),jt(),qt(),Gt();}var ne=[],re=[];function oe(t,e){if(!m$1(t,e,I))return a$2.NONE;let n=a$2.NONE;return I.bold[e]===1&&(n|=a$2.BOLD),I.underline[e]===1&&(n|=a$2.UNDERLINE),I.blink[e]===1&&(n|=a$2.BLINK),I.inverse[e]===1&&(n|=a$2.INVERSE),n}function Ot(t,e){if(c$4(t,e))return {x:a$3.x[e],y:a$3.y[e],width:a$3.width[e],height:a$3.height[e]}}function ue(t,e){return p$1(t,e)?{top:k$3.top[e]===1?1:0,right:k$3.right[e]===1?1:0,bottom:k$3.bottom[e]===1?1:0,left:k$3.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function ie(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function se(t,e,n){let{world:r$1,buffer:o}=t,u=K$1(r$1,e);if(!u||u.transparent)return;let i=oe(r$1,e),s=e$1(" ",u.fg,u.bg,i);r(o,n.x,n.y,n.width,n.height,s);}function H(t,e,n,r,o,u){let i=String.fromCodePoint(r);o$2(t,e,n,e$1(i,o,u));}function Rt(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),p=e$1(s,u,i);for(let h=0;h<r;h++)o$2(t,e+h,n,p);}function It(t,e,n,r,o,u,i){let s=String.fromCodePoint(o),p=e$1(s,u,i);for(let h=0;h<r;h++)o$2(t,e,n+h,p);}function le(t,e,n,r,o,u){if(!e)return;let{x:i,y:s,width:p,height:h}=n;r.top&&r.left&&H(t,i,s,e.charTopLeft,o,u),r.top&&r.right&&H(t,i+p-1,s,e.charTopRight,o,u),r.bottom&&r.left&&H(t,i,s+h-1,e.charBottomLeft,o,u),r.bottom&&r.right&&H(t,i+p-1,s+h-1,e.charBottomRight,o,u);}function ae(t,e,n,r,o,u){let i=r.left?1:0,s=n.width-i-(r.right?1:0);s<=0||(r.top&&Rt(t,n.x+i,n.y,s,e,o,u),r.bottom&&Rt(t,n.x+i,n.y+n.height-1,s,e,o,u));}function ce(t,e,n,r,o,u){let i=r.top?1:0,s=n.height-i-(r.bottom?1:0);s<=0||(r.left&&It(t,n.x,n.y+i,s,e,o,u),r.right&&It(t,n.x+n.width-1,n.y+i,s,e,o,u));}function fe(t,e,n$1){let{world:r,buffer:o}=t;if(!p$1(r,e))return;let u=n(r,e);if(!u||u.type===0||n$1.width<1||n$1.height<1)return;let{fg:i,bg:s}=u,p={left:u.left,top:u.top,right:u.right,bottom:u.bottom};le(o,u,n$1,p,i,s),ae(o,u.charHorizontal,n$1,p,i,s),ce(o,u.charVertical,n$1,p,i,s);}function Cn(t,e,n){}function Rn(t,e,n){}function pe(t,e){let{world:n}=t,r=Ot(n,e);if(!r||r.width<=0||r.height<=0)return;se(t,e,r),fe(t,e,r);let o=ue(n,e);ie(r,o);o$3(t.dirtyTracker,n,e),N(n,e);}var g=null;function In(t){g=t;}function On(){return g}function me(t){return g?t.x+t.width<=g.x||t.x>=g.x+g.width||t.y+t.height<=g.y||t.y>=g.y+g.height:false}function de(t,e){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function ye(t,e){if(e.length===0)return false;for(let n of e)if(de(t,n))return true;return false}function he(t,e){t.push({x:e.x,y:e.y,width:e.width,height:e.height});}function be(t,e,n){let{world:r}=t,o=Ot(r,e);return !o||o.width<=0||o.height<=0?(N(r,e),false):me(o)?(N(r,e),false):F&&ye(o,n)?(N(r,e),false):(pe(t,e),F&&he(n,o),true)}var k=null,K=null,F=false;function Dn(t,e){k=t,K=e;}function Nn(){return k}function Tn(){k=null,K=null;}function Mn(t){F=t;}function kn(){return F}var ge=t=>{if(!k||!K)return t;let e={world:t,buffer:K,dirtyTracker:k},n=h(t).queryRenderables(t),r=n.length,o=ne;o.length=0;for(let i=0;i<r;i++){let s=n[i];V(t,s)&&O(t,s)&&o.push(s);}o.length>1&&o.sort((i,s)=>Ba.z[i]-Ba.z[s]);let u=re;u.length=0;for(let i of o)be(e,i,u);return t};function Wn(){return ge}function $n(t$1,e,n,r,o,u,i=a$2.NONE){return t(t$1,e,n,r,o,u,i)}function Pn(t,e,n,r$1,o,u){r(t,e,n,r$1,o,u);}function An(t){let e=h(t).queryRenderables(t),n=e.length;for(let r=0;r<n;r++)I.dirty[e[r]]=1;}export{mn as $,Ge as A,m as B,je as C,_t as D,Je as E,a as F,Ze as G,qt as H,tn as I,zt as J,en as K,Gt as L,jt as M,nn as N,rn as O,on as P,Jt as Q,un as R,sn as S,ln as T,Zt as U,an as V,cn as W,fn as X,te as Y,pn as Z,ee as _,l as a,se as aa,Oe as b,fe as ba,De as c,Cn as ca,Ne as d,Rn as da,Te as e,In as ea,Me as f,On as fa,ke as g,Dn as ga,We as h,Nn as ha,Dt as i,Tn as ia,$e as j,Mn as ja,Pe as k,kn as ka,Nt as l,ge as la,Ae as m,Wn as ma,Tt as n,$n as na,Et as o,Pn as oa,Le as p,An as pa,He as q,Ke as r,Fe as s,xt as t,Ut as u,Xe as v,Ue as w,_e as x,qe as y,ze as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {ma}from'./chunk-ETFDYZVJ.js';import {m as m$1,l as l$1}from'./chunk-7ZFQO3OQ.js';var b=4294967295,E=0;var t={clickable:new Uint8Array(1e4),draggable:new Uint8Array(1e4),hoverable:new Uint8Array(1e4),hovered:new Uint8Array(1e4),pressed:new Uint8Array(1e4),keyable:new Uint8Array(1e4),focusable:new Uint8Array(1e4),focused:new Uint8Array(1e4),tabIndex:new Int16Array(1e4),enabled:new Uint8Array(1e4),hoverEffectFg:new Uint32Array(1e4),hoverEffectBg:new Uint32Array(1e4),focusEffectFg:new Uint32Array(1e4),focusEffectBg:new Uint32Array(1e4)};function A(n){t.clickable[n]=0,t.draggable[n]=0,t.hoverable[n]=0,t.hovered[n]=0,t.pressed[n]=0,t.keyable[n]=0,t.focusable[n]=0,t.focused[n]=0,t.tabIndex[n]=0,t.enabled[n]=1,t.hoverEffectFg[n]=4294967295,t.hoverEffectBg[n]=0,t.focusEffectFg[n]=4278255615,t.focusEffectBg[n]=0;}function a(n,e){m$1(n,e,t)||(l$1(n,e,t),A(e));}function f(n,e,r){r!==void 0&&(e[n]=r?1:0);}function l(n,e,r){r!==void 0&&(e[n]=r);}function F(n,e,r){return a(n,e),f(e,t.clickable,r.clickable),f(e,t.draggable,r.draggable),f(e,t.hoverable,r.hoverable),f(e,t.keyable,r.keyable),f(e,t.focusable,r.focusable),f(e,t.enabled,r.enabled),l(e,t.tabIndex,r.tabIndex),l(e,t.hoverEffectFg,r.hoverEffectFg),l(e,t.hoverEffectBg,r.hoverEffectBg),l(e,t.focusEffectFg,r.focusEffectFg),l(e,t.focusEffectBg,r.focusEffectBg),r.focusable!==void 0&&ma(n,e,r.focusable),e}function h(n,e,r){return a(n,e),t.clickable[e]=r?1:0,e}function I(n,e,r){return a(n,e),t.draggable[e]=r?1:0,e}function U(n,e,r){return a(n,e),t.hoverable[e]=r?1:0,e}function T(n,e,r){return a(n,e),t.keyable[e]=r?1:0,e}function C(n,e){return m$1(n,e,t)?t.hovered[e]===1:false}function W(n,e){return m$1(n,e,t)?t.pressed[e]===1:false}function m(n,e){return m$1(n,e,t)?t.clickable[e]===1:false}function k(n,e){return m$1(n,e,t)?t.draggable[e]===1:false}function d(n,e){return m$1(n,e,t)?t.hoverable[e]===1:false}function _(n,e){return m$1(n,e,t)?t.keyable[e]===1:false}function D(n,e,r){return a(n,e),t.hovered[e]=r?1:0,e}function B(n,e,r){return a(n,e),t.pressed[e]=r?1:0,e}function L(n,e,r){return a(n,e),t.focused[e]=r?1:0,e}function P(n,e){if(m$1(n,e,t))return {fg:t.focusEffectFg[e],bg:t.focusEffectBg[e]}}function Y(n,e,r,s){return a(n,e),t.focusEffectFg[e]=r,t.focusEffectBg[e]=s,e}function O(n,e){if(m$1(n,e,t))return {clickable:t.clickable[e]===1,draggable:t.draggable[e]===1,hoverable:t.hoverable[e]===1,hovered:t.hovered[e]===1,pressed:t.pressed[e]===1,keyable:t.keyable[e]===1,focusable:t.focusable[e]===1,focused:t.focused[e]===1,tabIndex:t.tabIndex[e],enabled:t.enabled[e]===1,hoverEffectFg:t.hoverEffectFg[e],hoverEffectBg:t.hoverEffectBg[e],focusEffectFg:t.focusEffectFg[e],focusEffectBg:t.focusEffectBg[e]}}function w(n,e){return m$1(n,e,t)}function G(n,e){return m$1(n,e,t)&&(t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0),e}function H(n,e){return a(n,e),t.clickable[e]=1,t.hoverable[e]=1,e}function S(n,e){return m$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0),e}function K(n,e){return a(n,e),t.keyable[e]=1,e}function R(n,e){return m$1(n,e,t)&&(t.keyable[e]=0),e}function V(n,e){return a(n,e),t.clickable[e]=1,t.hoverable[e]=1,t.keyable[e]=1,e}function M(n,e){return m$1(n,e,t)&&(t.clickable[e]=0,t.hoverable[e]=0,t.keyable[e]=0),e}function N(n,e){return m$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1:false}function j(n,e){return m$1(n,e,t)?t.keyable[e]===1:false}function q(n,e){return m$1(n,e,t)?t.clickable[e]===1||t.hoverable[e]===1||t.keyable[e]===1:false}function z(n,e){return a(n,e),t.enabled[e]=1,e}function J(n,e){return a(n,e),t.enabled[e]=0,t.hovered[e]=0,t.pressed[e]=0,t.focused[e]=0,e}function Q(n,e){return m$1(n,e,t)?t.enabled[e]===1:true}export{V as A,M as B,N as C,j as D,q as E,z as F,J as G,Q as H,b as a,E as b,t as c,F as d,h as e,I as f,U as g,T as h,C as i,W as j,m as k,k as l,d as m,_ as n,D as o,B as p,L as q,P as r,Y as s,O as t,w as u,G as v,H as w,S as x,K as y,R as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1,c as c$1,d as d$1,e}from'./chunk-EOFT3PNU.js';function b(e){return {topLeft:String.fromCodePoint(e.topLeft),topRight:String.fromCodePoint(e.topRight),bottomLeft:String.fromCodePoint(e.bottomLeft),bottomRight:String.fromCodePoint(e.bottomRight),horizontal:String.fromCodePoint(e.horizontal),vertical:String.fromCodePoint(e.vertical)}}var V=b(b$1),q=b(c$1),J=b(d$1),K=b(e),Q={topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|"},W={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u254C",vertical:"\u254E"};function Y(e,t,r=4294967295,n=0){let l=[];for(let o=0;o<t;o++){let i=[];for(let f=0;f<e;f++)i.push({char:" ",fg:r,bg:n});l.push(i);}return {width:e,height:t,cells:l,setCell(o,i,f,u,s){if(o<0||o>=e||i<0||i>=t)return;let a=l[i]?.[o];a&&(a.char=f,u!==void 0&&(a.fg=u),s!==void 0&&(a.bg=s));}}}function O(e,t,r,n,l,o,i,f,u,s){e.setCell(t,r,f.topLeft,u,s),o>1&&e.setCell(n,r,f.topRight,u,s),i>1&&e.setCell(t,l,f.bottomLeft,u,s),o>1&&i>1&&e.setCell(n,l,f.bottomRight,u,s);}function X(e,t,r,n,l,o,i,f,u,s){for(let a=t+1;a<n;a++)e.setCell(a,r,f.horizontal,u,s),i>1&&e.setCell(a,l,f.horizontal,u,s);for(let a=r+1;a<l;a++)e.setCell(t,a,f.vertical,u,s),o>1&&e.setCell(n,a,f.vertical,u,s);}function $(e,t,r,n,l,o,i={}){let{fg:f,bg:u,fill:s=false,fillChar:a=" "}=i;if(n<1||l<1)return;let B=t+n-1,E=r+l-1;O(e,t,r,B,E,n,l,o,f,u),X(e,t,r,B,E,n,l,o,f,u),s&&n>2&&l>2&&M(e,t+1,r+1,n-2,l-2,a,f,u);}function ee(e,t,r,n,l="\u2500",o,i){for(let f=0;f<n;f++)e.setCell(t+f,r,l,o,i);}function te(e,t,r,n,l="\u2502",o,i){for(let f=0;f<n;f++)e.setCell(t,r+f,l,o,i);}function M(e,t,r,n,l,o=" ",i,f){for(let u=0;u<l;u++)for(let s=0;s<n;s++)e.setCell(t+s,r+u,o,i,f);}function ne(e,t,r,n,l,o){for(let i=0;i<n.length;i++){let f=n[i];f!==void 0&&e.setCell(t+i,r,f,l,o);}}function re(e){let t=[];for(let r=0;r<e.height;r++){let n="";for(let l=0;l<e.width;l++)n+=e.cells[r]?.[l]?.char??" ";t.push(n);}return t.join(`
|
|
2
|
+
`)}var oe=512,ie=256,fe=48;function P(e){let t=0;for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t++;return t}function F(e){let t=[];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r);return t}function c(e){let t=F(e);return {type:"leaf",text:e,length:e.length,newlines:t.length,lineBreaks:t}}function h(){return {type:"leaf",text:"",length:0,newlines:0,lineBreaks:[]}}function d(e,t){let r=e.type==="node"?e.depth:0,n=t.type==="node"?t.depth:0;return {type:"node",left:e,right:t,leftLength:e.length,length:e.length+t.length,newlines:e.newlines+t.newlines,depth:Math.max(r,n)+1}}function k(e){let t=e.left.type==="node"?e.left.depth:0,r=e.right.type==="node"?e.right.depth:0;return Math.abs(t-r)>1||e.depth>48}function R(e,t){if(e.type==="leaf"){e.length>0&&t.push(e.text);return}R(e.left,t),R(e.right,t);}function p(e){if(e.length===0)return h();if(e.length===1){let l=e[0];return l===void 0?h():c(l)}let t=Math.floor(e.length/2),r=p(e.slice(0,t)),n=p(e.slice(t));return d(r,n)}function z(e){if(e.type==="leaf"||!k(e))return e;let t=[];R(e,t);let r=[];for(let n of t)if(n.length<=512)r.push(n);else for(let l=0;l<n.length;l+=512)r.push(n.slice(l,l+512));return p(r)}function Z(e=""){if(e.length===0)return h();if(e.length<=512)return c(e);let t=[];for(let r=0;r<e.length;r+=512)t.push(e.slice(r,r+512));return p(t)}function ue(){return h()}function se(e){return e.length}function ae(e){return e.newlines}function ge(e){return e.newlines+1}function ce(e){return e.length===0}function I(e,t){if(!(t<0||t>=e.length))return e.type==="leaf"?e.text.charAt(t):t<e.leftLength?I(e.left,t):I(e.right,t-e.leftLength)}function g(e,t,r){let n=r??e.length,l=t;if(l<0&&(l=0),n>e.length)return g(e,l,e.length);if(l>=n)return "";if(e.type==="leaf")return e.text.slice(l,n);let o=e.leftLength;if(n<=o)return g(e.left,l,n);if(l>=o)return g(e.right,l-o,n-o);let i=g(e.left,l,o),f=g(e.right,0,n-o);return i+f}function he(e){if(e.type==="leaf")return e.text;let t=[];return R(e,t),t.join("")}function v(e,t){if(t<=0)return 0;if(t>=e.length)return e.newlines;if(e.type==="leaf"){let n=0;for(let l of e.lineBreaks){if(l>=t)break;n++;}return n}return t<e.leftLength?v(e.left,t):e.left.newlines+v(e.right,t-e.leftLength)}function T(e,t){return t<0?-1:t===0?0:t>e.newlines?-1:L(e,t,0)}function L(e,t,r){if(e.type==="leaf"){let l=0;for(let o of e.lineBreaks)if(l++,l===t)return r+o+1;return -1}let n=e.left.newlines;return t<=n?L(e.left,t,r):L(e.right,t-n,r+e.leftLength)}function H(e,t){return t<0||t>e.newlines?-1:t===e.newlines?e.length:x(e,t,0)}function x(e,t,r){if(e.type==="leaf"){let l=0;for(let o of e.lineBreaks){if(l===t)return r+o;l++;}return -1}let n=e.left.newlines;return t<n?x(e.left,t,r):x(e.right,t-n,r+e.leftLength)}function U(e,t){if(t<0||t>e.newlines)return;let r=T(e,t),n=H(e,t);return r===-1?{text:g(e,0,n===-1?e.length:n),start:0,end:n===-1?e.length:n,lineNumber:t}:{text:g(e,r,n===-1?e.length:n),start:r,end:n===-1?e.length:n,lineNumber:t}}function me(e,t,r){let n=[],l=e.newlines+1;for(let o=t;o<r&&o<l;o++){let i=U(e,o);i&&n.push(i);}return n}function m(e,t){if(t<=0)return {left:null,right:e};if(t>=e.length)return {left:e,right:null};if(e.type==="leaf"){let l=e.text.slice(0,t),o=e.text.slice(t);return {left:l.length>0?c(l):null,right:o.length>0?c(o):null}}if(t<=e.leftLength){let{left:l,right:o}=m(e.left,t);return o===null?{left:l,right:e.right}:{left:l,right:d(o,e.right)}}let{left:r,right:n}=m(e.right,t-e.leftLength);return r===null?{left:e.left,right:n}:{left:d(e.left,r),right:n}}function C(e,t){if(e===null||e.length===0)return t??h();if(t===null||t.length===0)return e;if(e.type==="leaf"&&t.type==="leaf"&&e.length+t.length<=512)return c(e.text+t.text);let r=d(e,t);return z(r)}function y(e,t,r){if(r.length===0)return e;let n=t;n<0&&(n=0),n>e.length&&(n=e.length);let l=Z(r),{left:o,right:i}=m(e,n);return C(C(o,l),i)}function be(e,t){return y(e,e.length,t)}function de(e,t){return y(e,0,t)}function j(e,t,r){let n=t,l=r;if(n<0&&(n=0),l>e.length&&(l=e.length),n>=l)return e;let{left:o}=m(e,n),{right:i}=m(e,l);return C(o,i)}function Re(e,t,r,n){let l=j(e,t,r);return y(l,t,n)}function pe(e){let t=0,r=0,n=0;function l(o,i){if(o.type==="leaf"){t++,r+=o.length,n=Math.max(n,i);return}l(o.left,i+1),l(o.right,i+1);}return l(e,0),{length:e.length,newlines:e.newlines,leafCount:t,depth:n,avgLeafSize:t>0?r/t:0}}function D(e){return e.type==="leaf"?e.length===e.text.length&&e.newlines===P(e.text)&&e.lineBreaks.length===e.newlines:e.leftLength!==e.left.length||e.length!==e.left.length+e.right.length||e.newlines!==e.left.newlines+e.right.newlines?false:D(e.left)&&D(e.right)}export{v as A,T as B,H as C,U as D,me as E,y as F,be as G,de as H,j as I,Re as J,pe as K,D as L,b as a,V as b,q as c,J as d,K as e,Q as f,W as g,Y as h,$ as i,ee as j,te as k,M as l,ne as m,re as n,oe as o,ie as p,fe as q,Z as r,ue as s,se as t,ae as u,ge as v,ce as w,I as x,g as y,he as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1,ba,aa,I as I$1}from'./chunk-ETFDYZVJ.js';import {l as l$1,m}from'./chunk-7ZFQO3OQ.js';var l=1e4,h={BLOCK:0,UNDERLINE:1,BAR:2,BLINKING_BLOCK:3,BLINKING_UNDERLINE:4,BLINKING_BAR:5},o={cursorX:new Uint16Array(l),cursorY:new Uint16Array(l),cursorVisible:new Uint8Array(l),cursorShape:new Uint8Array(l),focused:new Uint32Array(l),hovered:new Uint32Array(l),fullUnicode:new Uint8Array(l),autoPadding:new Uint8Array(l)},a=new WeakMap;function x(r,e,n={}){l$1(r,e,o),o.cursorX[e]=0,o.cursorY[e]=0,o.cursorVisible[e]=n.cursorVisible!==false?1:0,o.cursorShape[e]=n.cursorShape??h.BLOCK,o.focused[e]=a$1,o.hovered[e]=a$1,o.fullUnicode[e]=n.fullUnicode!==false?1:0,o.autoPadding[e]=n.autoPadding===true?1:0;}function g(r){return a.has(r)}function W(r,e){if(a.has(r))throw new Error("A screen already exists in this world. Only one screen is allowed.");a.set(r,e);}function C(r){return a.get(r)??null}function U(r,e){return a.get(r)===e}function t(r,e){return m(r,e,o)}function v(r,e){if(t(r,e))return {x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]}}function A(r,e,n,i){return t(r,e)?(o.cursorX[e]=Math.max(0,Math.floor(n)),o.cursorY[e]=Math.max(0,Math.floor(i)),true):false}function V(r,e,n){return t(r,e)?(o.cursorVisible[e]=n?1:0,true):false}function w(r,e,n){return t(r,e)?(o.cursorShape[e]=n,true):false}function N(r,e){if(!t(r,e))return null;let n=o.focused[e];return n===a$1?null:n}function P(r,e,n){return t(r,e)?(o.focused[e]=n??a$1,true):false}function L(r,e){if(!t(r,e))return null;let n=o.hovered[e];return n===a$1?null:n}function I(r,e,n){return t(r,e)?(o.hovered[e]=n??a$1,true):false}function B(r,e){if(!t(r,e))return;let n=ba(r,e),i=o.focused[e],c=o.hovered[e];return {cursor:{x:o.cursorX[e],y:o.cursorY[e],visible:o.cursorVisible[e]===1,shape:o.cursorShape[e]},focused:i===a$1?null:i,hovered:c===a$1?null:c,fullUnicode:o.fullUnicode[e]===1,autoPadding:o.autoPadding[e]===1,width:n?.width??0,height:n?.height??0}}function D(r,e){if(!t(r,e))return;let n=ba(r,e);if(n)return {width:n.width,height:n.height}}function Y(r,e,n,i){return !t(r,e)||n<=0||i<=0?false:(aa(r,e,n,i),I$1.dirty[e]=1,true)}function K(r,e){return t(r,e)?o.fullUnicode[e]===1:false}function M(r,e,n){return t(r,e)?(o.fullUnicode[e]=n?1:0,true):false}function O(r,e){return t(r,e)?o.autoPadding[e]===1:false}function F(r,e,n){return t(r,e)?(o.autoPadding[e]=n?1:0,true):false}function R(r){return a.get(r)===void 0?false:(a.delete(r),true)}function X(r){a.delete(r);}export{h as a,o as b,x as c,g as d,W as e,C as f,U as g,t as h,v as i,A as j,V as k,w as l,N as m,P as n,L as o,I as p,B as q,D as r,Y as s,K as t,M as u,O as v,F as w,R as x,X as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {m,l}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';var c=1e4,V=5,E=5,C=1,x=z$1.object({firstVisibleLine:z$1.number().int().nonnegative().optional(),visibleLineCount:z$1.number().int().nonnegative().optional(),totalLineCount:z$1.number().int().nonnegative().optional(),overscanBefore:z$1.number().int().min(0).max(255).optional(),overscanAfter:z$1.number().int().min(0).max(255).optional(),estimatedLineHeight:z$1.number().int().min(1).max(255).optional(),isVariableHeight:z$1.boolean().optional(),selectedLine:z$1.number().int().min(-1).optional(),cursorLine:z$1.number().int().min(-1).optional()}),B=z$1.object({start:z$1.number().int().nonnegative(),end:z$1.number().int().nonnegative(),visibleStart:z$1.number().int().nonnegative(),visibleEnd:z$1.number().int().nonnegative(),count:z$1.number().int().nonnegative()}),D=z$1.object({currentLine:z$1.number().int().nonnegative(),totalLines:z$1.number().int().nonnegative(),viewportSize:z$1.number().int().nonnegative(),maxScrollLine:z$1.number().int().nonnegative(),scrollPercent:z$1.number().min(0).max(100),atTop:z$1.boolean(),atBottom:z$1.boolean()}),t={firstVisibleLine:new Uint32Array(c),visibleLineCount:new Uint32Array(c),totalLineCount:new Uint32Array(c),overscanBefore:new Uint8Array(c),overscanAfter:new Uint8Array(c),estimatedLineHeight:new Uint8Array(c),isVariableHeight:new Uint8Array(c),isDirty:new Uint8Array(c),selectedLine:new Int32Array(c),cursorLine:new Int32Array(c)};function g(e){t.firstVisibleLine[e]=0,t.visibleLineCount[e]=0,t.totalLineCount[e]=0,t.overscanBefore[e]=V,t.overscanAfter[e]=E,t.estimatedLineHeight[e]=C,t.isVariableHeight[e]=0,t.isDirty[e]=1,t.selectedLine[e]=-1,t.cursorLine[e]=-1;}function b(e,n){m(e,n,t)||(l(e,n,t),g(n));}function f(e){let n=t.totalLineCount[e],i=t.visibleLineCount[e],r=t.firstVisibleLine[e],s=Math.max(0,n-i);t.firstVisibleLine[e]=Math.max(0,Math.min(s,r));}function u(e){t.isDirty[e]=1;}function M(e,n,i){let r=x.parse(i);return b(e,n),r.totalLineCount!==void 0&&(t.totalLineCount[n]=r.totalLineCount),r.visibleLineCount!==void 0&&(t.visibleLineCount[n]=r.visibleLineCount),r.firstVisibleLine!==void 0&&(t.firstVisibleLine[n]=r.firstVisibleLine),r.overscanBefore!==void 0&&(t.overscanBefore[n]=r.overscanBefore),r.overscanAfter!==void 0&&(t.overscanAfter[n]=r.overscanAfter),r.estimatedLineHeight!==void 0&&(t.estimatedLineHeight[n]=r.estimatedLineHeight),r.isVariableHeight!==void 0&&(t.isVariableHeight[n]=r.isVariableHeight?1:0),r.selectedLine!==void 0&&(t.selectedLine[n]=r.selectedLine),r.cursorLine!==void 0&&(t.cursorLine[n]=r.cursorLine),f(n),u(n),n}function T(e,n){if(m(e,n,t))return {firstVisibleLine:t.firstVisibleLine[n],visibleLineCount:t.visibleLineCount[n],totalLineCount:t.totalLineCount[n],overscanBefore:t.overscanBefore[n],overscanAfter:t.overscanAfter[n],estimatedLineHeight:t.estimatedLineHeight[n],isVariableHeight:t.isVariableHeight[n]===1,isDirty:t.isDirty[n]===1,selectedLine:t.selectedLine[n],cursorLine:t.cursorLine[n]}}function U(e,n){return m(e,n,t)}function h(e,n,i){return b(e,n),t.firstVisibleLine[n]=i,f(n),u(n),n}function A(e,n){if(!m(e,n,t))return;let i=t.firstVisibleLine[n],r=t.visibleLineCount[n],s=t.totalLineCount[n],l=t.overscanBefore[n],m$1=t.overscanAfter[n],L=Math.min(s,i+r),y=Math.max(0,i-l),v=Math.min(s,L+m$1);return {start:y,end:v,visibleStart:i,visibleEnd:L,count:v-y}}function F(e,n,i){if(!m(e,n,t))return false;let r=t.firstVisibleLine[n],s=t.visibleLineCount[n];return i>=r&&i<r+s}function R(e,n,i){let r=A(e,n);return r?i>=r.start&&i<r.end:false}function I(e,n,i){b(e,n);let r=t.visibleLineCount[n],s=Math.max(0,i-Math.floor(r/2));return t.firstVisibleLine[n]=s,f(n),u(n),n}function w(e,n,i){b(e,n);let r=t.firstVisibleLine[n],s=t.totalLineCount[n],l=t.visibleLineCount[n],m=r+i,L=Math.max(0,s-l);return t.firstVisibleLine[n]=Math.max(0,Math.min(L,m)),u(n),n}function O(e,n,i){b(e,n);let r=t.visibleLineCount[n],s=i*Math.max(1,r-1);return w(e,n,s)}function _(e,n){return h(e,n,0)}function d(e,n){b(e,n);let i=t.totalLineCount[n],r=t.visibleLineCount[n];return t.firstVisibleLine[n]=Math.max(0,i-r),u(n),n}function P(e,n){if(!m(e,n,t))return;let i=t.firstVisibleLine[n],r=t.totalLineCount[n],s=t.visibleLineCount[n],l=Math.max(0,r-s),m$1=l>0?i/l*100:0;return {currentLine:i,totalLines:r,viewportSize:s,maxScrollLine:l,scrollPercent:Math.min(100,Math.max(0,m$1)),atTop:i<=0,atBottom:i>=l}}function z(e,n,i){return b(e,n),t.totalLineCount[n]=i,f(n),u(n),n}function j(e,n,i){return b(e,n),t.visibleLineCount[n]=i,f(n),u(n),n}function N(e,n,i,r){return b(e,n),t.overscanBefore[n]=i,t.overscanAfter[n]=r,u(n),n}function k(e,n,i){return b(e,n),t.selectedLine[n]=i,u(n),n}function G(e,n){return m(e,n,t)?t.selectedLine[n]:-1}function Y(e,n,i){return b(e,n),t.cursorLine[n]=i,u(n),n}function q(e,n){return m(e,n,t)?t.cursorLine[n]:-1}function J(e,n,i){b(e,n);let r=t.totalLineCount[n],s=t.cursorLine[n],l=s<0?0:s,m=Math.max(0,Math.min(r-1,l+i));return t.cursorLine[n]=m,W(e,n),u(n),n}function W(e,n){if(!m(e,n,t))return n;let i=t.cursorLine[n];if(i<0)return n;let r=t.firstVisibleLine[n],s=t.visibleLineCount[n];i<r&&(t.firstVisibleLine[n]=i,u(n));let l=r+s-1;return i>l&&(t.firstVisibleLine[n]=i-s+1,f(n),u(n)),n}function K(e,n){return m(e,n,t)?t.isDirty[n]===1:false}function Q(e,n){return m(e,n,t)&&(t.isDirty[n]=0),n}function X(e,n){return m(e,n,t)&&(t.isDirty[n]=1),n}export{K as A,Q as B,X as C,x as a,B as b,D as c,t as d,M as e,T as f,U as g,h,A as i,F as j,R as k,I as l,w as m,O as n,_ as o,d as p,P as q,z as r,j as s,N as t,k as u,G as v,Y as w,q as x,J as y,W as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {j}from'./chunk-FUW7OD3H.js';import {z}from'zod';function m(e,r){let t=e.r-r.r,o=e.g-r.g,a=e.b-r.b;return t*t+o*o+a*a}function c(e,r={}){let{distance:t=m,palette:o=j,indices:a}=r,l=0,n=Number.POSITIVE_INFINITY;for(let i=0;i<o.length;i++){let d=o[i];if(!d)continue;let b=t(e,d);if(b<n&&(n=b,l=a?a[i]??i:i),b===0)break}return l}function y(e=1024){let r=new Map;function t(o){return o.r<<16|o.g<<8|o.b}return {get(o){let a=t(o),l=r.get(a);return l!==void 0&&(r.delete(a),r.set(a,l)),l},set(o,a){let l=t(o);if(r.has(l)&&r.delete(l),r.size>=e){let n=r.keys().next().value;n!==void 0&&r.delete(n);}r.set(l,a);},clear(){r.clear();},get size(){return r.size}}}var C=y(4096);function k(e,r){if(!r||r.distance===void 0&&r.palette===void 0){let t=C.get(e);if(t!==void 0)return t;let o=c(e,r);return C.set(e,o),o}return c(e,r)}j.slice(232,256);Array.from({length:24},(e,r)=>232+r);j.slice(16,232);Array.from({length:216},(e,r)=>16+r);j.slice(0,16);Array.from({length:16},(e,r)=>r);var g={black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,white:7,lightblack:8,lightred:9,lightgreen:10,lightyellow:11,lightblue:12,lightmagenta:13,lightcyan:14,lightwhite:15,brightblack:8,brightred:9,brightgreen:10,brightyellow:11,brightblue:12,brightmagenta:13,brightcyan:14,brightwhite:15,darkred:1,darkgreen:2,darkyellow:3,darkblue:4,darkmagenta:5,darkcyan:6,darkgray:8,darkgrey:8,gray:8,grey:8,silver:7,maroon:1,olive:3,navy:4,purple:5,teal:6,aqua:14,lime:10,fuchsia:13,orange:208},h={grey:"gray",lightgrey:"lightblack",lightgray:"lightblack",darkgrey:"darkgray",bright:"light",hi:"light",crimson:"red",scarlet:"red",vermillion:"red",emerald:"green",forest:"green",azure:"blue",cobalt:"blue",indigo:"blue",violet:"magenta",pink:"lightmagenta",gold:"yellow",brown:"maroon",colour:"color"};var x=Object.keys(g);z.string().transform(e=>e.toLowerCase().trim()).refine(e=>x.includes(e)||e==="default"||e==="transparent"||e==="inherit",{message:"Invalid color name"});function p(e){let r=e.toLowerCase().trim();if(r in g)return g[r]??null;let t=h[r];if(t&&t in g)return g[t]??null;if(r==="default"||r==="transparent"||r==="inherit")return null;let o=r.split(/[-_\s]+/);if(o.length===2){let a=o[0],l=o[1];if(a&&l){let n=a+l;if(n in g)return g[n]??null}}return null}var f={indianred:{r:205,g:92,b:92},lightcoral:{r:240,g:128,b:128},salmon:{r:250,g:128,b:114},darksalmon:{r:233,g:150,b:122},lightsalmon:{r:255,g:160,b:122},crimson:{r:220,g:20,b:60},firebrick:{r:178,g:34,b:34},darkred:{r:139,g:0,b:0},pink:{r:255,g:192,b:203},lightpink:{r:255,g:182,b:193},hotpink:{r:255,g:105,b:180},deeppink:{r:255,g:20,b:147},mediumvioletred:{r:199,g:21,b:133},palevioletred:{r:219,g:112,b:147},coral:{r:255,g:127,b:80},tomato:{r:255,g:99,b:71},orangered:{r:255,g:69,b:0},darkorange:{r:255,g:140,b:0},orange:{r:255,g:165,b:0},gold:{r:255,g:215,b:0},lightyellow:{r:255,g:255,b:224},lemonchiffon:{r:255,g:250,b:205},papayawhip:{r:255,g:239,b:213},moccasin:{r:255,g:228,b:181},peachpuff:{r:255,g:218,b:185},palegoldenrod:{r:238,g:232,b:170},khaki:{r:240,g:230,b:140},darkkhaki:{r:189,g:183,b:107},lavender:{r:230,g:230,b:250},thistle:{r:216,g:191,b:216},plum:{r:221,g:160,b:221},violet:{r:238,g:130,b:238},orchid:{r:218,g:112,b:214},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},rebeccapurple:{r:102,g:51,b:153},blueviolet:{r:138,g:43,b:226},darkviolet:{r:148,g:0,b:211},darkorchid:{r:153,g:50,b:204},darkmagenta:{r:139,g:0,b:139},indigo:{r:75,g:0,b:130},slateblue:{r:106,g:90,b:205},darkslateblue:{r:72,g:61,b:139},greenyellow:{r:173,g:255,b:47},chartreuse:{r:127,g:255,b:0},lawngreen:{r:124,g:252,b:0},limegreen:{r:50,g:205,b:50},palegreen:{r:152,g:251,b:152},lightgreen:{r:144,g:238,b:144},mediumspringgreen:{r:0,g:250,b:154},springgreen:{r:0,g:255,b:127},mediumseagreen:{r:60,g:179,b:113},seagreen:{r:46,g:139,b:87},forestgreen:{r:34,g:139,b:34},darkgreen:{r:0,g:100,b:0},yellowgreen:{r:154,g:205,b:50},olivedrab:{r:107,g:142,b:35},darkolivegreen:{r:85,g:107,b:47},mediumaquamarine:{r:102,g:205,b:170},darkseagreen:{r:143,g:188,b:143},lightseagreen:{r:32,g:178,b:170},darkcyan:{r:0,g:139,b:139},lightcyan:{r:224,g:255,b:255},paleturquoise:{r:175,g:238,b:238},aquamarine:{r:127,g:255,b:212},turquoise:{r:64,g:224,b:208},mediumturquoise:{r:72,g:209,b:204},darkturquoise:{r:0,g:206,b:209},cadetblue:{r:95,g:158,b:160},steelblue:{r:70,g:130,b:180},lightsteelblue:{r:176,g:196,b:222},powderblue:{r:176,g:224,b:230},lightblue:{r:173,g:216,b:230},skyblue:{r:135,g:206,b:235},lightskyblue:{r:135,g:206,b:250},deepskyblue:{r:0,g:191,b:255},dodgerblue:{r:30,g:144,b:255},cornflowerblue:{r:100,g:149,b:237},royalblue:{r:65,g:105,b:225},mediumblue:{r:0,g:0,b:205},darkblue:{r:0,g:0,b:139},midnightblue:{r:25,g:25,b:112},cornsilk:{r:255,g:248,b:220},blanchedalmond:{r:255,g:235,b:205},bisque:{r:255,g:228,b:196},navajowhite:{r:255,g:222,b:173},wheat:{r:245,g:222,b:179},burlywood:{r:222,g:184,b:135},tan:{r:210,g:180,b:140},rosybrown:{r:188,g:143,b:143},sandybrown:{r:244,g:164,b:96},goldenrod:{r:218,g:165,b:32},darkgoldenrod:{r:184,g:134,b:11},peru:{r:205,g:133,b:63},chocolate:{r:210,g:105,b:30},saddlebrown:{r:139,g:69,b:19},sienna:{r:160,g:82,b:45},brown:{r:165,g:42,b:42},snow:{r:255,g:250,b:250},honeydew:{r:240,g:255,b:240},mintcream:{r:245,g:255,b:250},azure:{r:240,g:255,b:255},aliceblue:{r:240,g:248,b:255},ghostwhite:{r:248,g:248,b:255},whitesmoke:{r:245,g:245,b:245},seashell:{r:255,g:245,b:238},beige:{r:245,g:245,b:220},oldlace:{r:253,g:245,b:230},floralwhite:{r:255,g:250,b:240},ivory:{r:255,g:255,b:240},antiquewhite:{r:250,g:235,b:215},linen:{r:250,g:240,b:230},lavenderblush:{r:255,g:240,b:245},mistyrose:{r:255,g:228,b:225},gainsboro:{r:220,g:220,b:220},lightgray:{r:211,g:211,b:211},lightgrey:{r:211,g:211,b:211},darkgray:{r:169,g:169,b:169},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79}},u=new Map;function S(e){let r=e.toLowerCase().trim(),t=u.get(r);if(t!==void 0)return t;let o=p(r);if(o!==null)return u.set(r,o),o;let a=f[r];if(a){let l=c(a);return u.set(r,l),l}return null}export{c as a,k as b,p as c,S as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=new Map;function d(r,t,n,e){let a=o.get(t);if(!a)return e;let i=a.get(n);return i===void 0?e:i}function l(r,t,n,e){let a=o.get(t);a||(a=new Map,o.set(t,a)),a.set(n,e);}function u(r,t,n){return o.get(t)?.has(n)??false}function s(r,t,n){return o.get(t)?.delete(n)??false}function y(r,t){let n=o.get(t);return n?Array.from(n.keys()):[]}function c(r,t){let n=o.get(t);if(!n)return {};let e={};for(let[a,i]of n)e[a]=i;return e}function f(r,t,n){for(let[e,a]of Object.entries(n))l(r,t,e,a);}function E(r,t){o.delete(t);}function p(){o.clear();}function D(){return o.size}function g(r,t){let n=o.get(t);return n!==void 0&&n.size>0}function x(r,t,n,e){let a=d(r,t,n);l(r,t,n,e(a));}export{d as a,l as b,u as c,s as d,y as e,c as f,f as g,E as h,p as i,D as j,g as k,x as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b,d as d$2}from'./chunk-4LWWONFK.js';import {k as k$1}from'./chunk-VOCM5T2G.js';import {d as d$1,A,i,B as B$1}from'./chunk-LNEISTXM.js';import {a,e,r,o as o$1,t}from'./chunk-C5PCEQ6G.js';import {c,a as a$2}from'./chunk-ZL46COQF.js';import {p as p$1,k}from'./chunk-EOFT3PNU.js';import {Ba,I,V,N,K}from'./chunk-ETFDYZVJ.js';import {o,a as a$1,m}from'./chunk-7ZFQO3OQ.js';import {z}from'zod';var d=z.number().int().min(0).max(4294967295),Q=z.number().int().min(0).max(65535),te=z.object({fg:d.optional(),bg:d.optional(),selectedFg:d.optional(),selectedBg:d.optional(),cursorFg:d.optional(),cursorBg:d.optional(),showLineNumbers:z.boolean().optional(),lineNumberWidth:z.number().int().nonnegative().max(20).optional(),attrs:Q.optional()}),Ce=z.object({fg:d.default(4294967295),bg:d.default(255),selectedFg:d.default(255),selectedBg:d.default(4294967295),cursorFg:d.default(255),cursorBg:d.default(16711935),showLineNumbers:z.boolean().default(false),lineNumberWidth:z.number().int().nonnegative().max(20).default(0),attrs:Q.default(a.NONE)}),T={fg:4294967295,bg:255,selectedFg:255,selectedBg:4294967295,cursorFg:255,cursorBg:16711935,showLineNumbers:false,lineNumberWidth:0,attrs:a.NONE},p=null;function L(t){return a$1(t,"virtualRender:lineStore")}function B(t){return a$1(t,"virtualRender:lineConfig")}function Se(t){p=t;}function Ne(){return p}function Ve(){p=null;}function ve(t,e,r){L(t).set(e,r);}function We(t,e){return L(t).get(e)}function ze(t,e){L(t).delete(e);}function De(t,e,r){L(t).set(e,r);}function we(t,e,r){let f=te.parse(r),i={};for(let[o,u]of Object.entries(f))u!==void 0&&(i[o]=u);let n=B(t).get(e)??T;B(t).set(e,{...n,...i});}function ne(t,e){return B(t).get(e)??T}function Fe(t,e){B(t).delete(e);}function re(t,e){if(!m(t,e,I))return a.NONE;let r=a.NONE;return I.bold[e]===1&&(r|=a.BOLD),I.underline[e]===1&&(r|=a.UNDERLINE),I.blink[e]===1&&(r|=a.BLINK),I.inverse[e]===1&&(r|=a.INVERSE),r}function ie(t,e){if(c(t,e))return {x:a$2.x[e],y:a$2.y[e],width:a$2.width[e],height:a$2.height[e]}}function oe(t,e){return p$1(t,e)?{top:k.top[e]===1?1:0,right:k.right[e]===1?1:0,bottom:k.bottom[e]===1?1:0,left:k.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function fe(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function O(t$1,e$1,r,f,i,n,o,u){let m=e(" ",n,o,u);for(let l=0;l<f;l++)o$1(t$1,e$1+l,r,m);let a=i.length>f?i.slice(0,f):i;a.length>0&&t(t$1,e$1,r,a,n,o,u);}function ue(t$1,e,r,f,i,n,o){let u=`${String(i+1).padStart(f-1," ")} `;t(t$1,e,r,u.slice(0,f),n,o,a.DIM);}function le(t,e,r,f,i,n){let{buffer:o}=t,{x:u,y:m,width:a$1,height:l}=r,x=k$1(i,f.start,f.end),N=n.showLineNumbers?u+n.lineNumberWidth:u,V=n.showLineNumbers?Math.max(0,a$1-n.lineNumberWidth):a$1,b=d$1.selectedLine[e],v=d$1.cursorLine[e];for(let c=0;c<x.lines.length;c++){let E=m+c;if(c>=l)break;let z=x.startLine+c,ee=x.lines[c]??"",D=n.fg,w=n.bg;z===v?(D=n.cursorFg,w=n.cursorBg):z===b&&(D=n.selectedFg,w=n.selectedBg),n.showLineNumbers&&ue(o,u,E,n.lineNumberWidth,z,n.fg,n.bg),O(o,N,E,V,ee,D,w,n.attrs);}let Z=Math.min(x.lines.length,l);for(let c=Z;c<l;c++){let E=m+c;n.showLineNumbers&&O(o,u,E,n.lineNumberWidth,"",n.fg,n.bg,a.NONE),O(o,N,E,V,"",n.fg,n.bg,a.NONE);}}function ae(t,e$1,r,f,i){if(r<=i)return;let{buffer:n}=t,o=e$1.height,u=e$1.x+e$1.width-1,m=e$1.y,a=i/r,l=Math.max(1,Math.floor(o*a)),x=Math.floor(f/r*o),N=e("\u2502",1717987071,255);for(let b=0;b<o;b++)o$1(n,u,m+b,N);let V=e("\u2588",2863311615,255);for(let b=0;b<l;b++){let v=m+x+b;v<m+o&&o$1(n,u,v,V);}}function se(t,e$1,r$1){let{world:f,buffer:i}=t,n=K(f,e$1);if(!n||n.transparent)return;let o=re(f,e$1),u=e(" ",n.fg,n.bg,o);r(i,r$1.x,r$1.y,r$1.width,r$1.height,u);}function de(t,e){let{world:r,doubleBuffer:f}=t,i$1=ie(r,e);if(!i$1||i$1.width<=0||i$1.height<=0)return;let n=L(r).get(e);if(!n)return;let o=i(r,e);if(!o)return;let u=ne(r,e);se(t,e,i$1);let m=oe(r,e),a=fe(i$1,m);a.width>0&&a.height>0&&le(t,e,a,o,n,u);let l={firstVisibleLine:d$1.firstVisibleLine[e],visibleLineCount:d$1.visibleLineCount[e],totalLineCount:d$1.totalLineCount[e]};l.totalLineCount>l.visibleLineCount&&ae(t,a,l.totalLineCount,l.firstVisibleLine,l.visibleLineCount),d$2(f,i$1.x,i$1.y,i$1.width,i$1.height),B$1(r,e),N(r,e);}var me=t=>{if(!p)return t;let e=b(p),r={world:t,buffer:e,doubleBuffer:p},f=o(t,[d$1,Ba,I]);for(let i of f)V(t,i)&&(!A(t,i)&&I.dirty[i]!==1||de(r,i));return t};function Me(){return me}function Oe(t){p=null,L(t).clear(),B(t).clear();}function ke(t,e){L(t).delete(e),B(t).delete(e);}export{Ce as a,Se as b,Ne as c,Ve as d,ve as e,We as f,ze as g,De as h,we as i,ne as j,Fe as k,me as l,Me as m,Oe as n,ke as o};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {H as H$1,o,n,q,ka as ka$1,Ba as Ba$1,fa,ea,Yc,yd,Wd,we,Ae as Ae$1,kb,ob,Mb,Fb,_b,qc,wc,Gc,Lc,Hc,Le as Le$1,Be as Be$1}from'./chunk-XG5PVDOP.js';import {d as d$3,c as c$2,e as e$1}from'./chunk-LI3ZYXUT.js';import {b as b$1,c as c$3,d as d$4}from'./chunk-UKVY43V3.js';import {c as c$1,d as d$2}from'./chunk-K2QWNDXV.js';import {k as k$1,l as l$1}from'./chunk-EOFT3PNU.js';import {d as d$1,e}from'./chunk-JN2OGNK3.js';import {c,ka,la,Ba,$,I as I$1,b,J}from'./chunk-ETFDYZVJ.js';import {h as h$1,l}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';var S=z$1.object({x:z$1.number().optional(),y:z$1.number().optional(),z:z$1.number().optional(),absolute:z$1.boolean().optional()}),B=z$1.object({width:z$1.union([z$1.number(),z$1.string()]).optional(),height:z$1.union([z$1.number(),z$1.string()]).optional(),minWidth:z$1.number().optional(),maxWidth:z$1.number().optional(),minHeight:z$1.number().optional(),maxHeight:z$1.number().optional(),shrink:z$1.boolean().optional()}),k=z$1.object({fg:z$1.number().optional(),bg:z$1.number().optional(),bold:z$1.boolean().optional(),italic:z$1.boolean().optional(),underline:z$1.boolean().optional(),strikethrough:z$1.boolean().optional(),dim:z$1.boolean().optional(),inverse:z$1.boolean().optional(),blink:z$1.boolean().optional(),visible:z$1.boolean().optional()}),F=z$1.object({type:z$1.number().optional(),left:z$1.boolean().optional(),right:z$1.boolean().optional(),top:z$1.boolean().optional(),bottom:z$1.boolean().optional(),fg:z$1.number().optional(),bg:z$1.number().optional(),chars:z$1.custom().optional()}),I=z$1.object({left:z$1.number().optional(),right:z$1.number().optional(),top:z$1.number().optional(),bottom:z$1.number().optional()}),Ue=z$1.object({text:z$1.string().optional(),align:z$1.number().optional(),valign:z$1.number().optional(),wrap:z$1.boolean().optional(),parseTags:z$1.boolean().optional()}),j=z$1.object({clickable:z$1.boolean().optional(),draggable:z$1.boolean().optional(),hoverable:z$1.boolean().optional(),keyable:z$1.boolean().optional(),hoverEffectFg:z$1.number().optional(),hoverEffectBg:z$1.number().optional()}),T=z$1.object({focusable:z$1.boolean().optional(),tabIndex:z$1.number().optional(),focusEffectFg:z$1.number().optional(),focusEffectBg:z$1.number().optional()}),Ce=z$1.object({scrollable:z$1.boolean().optional(),scrollX:z$1.number().optional(),scrollY:z$1.number().optional(),scrollWidth:z$1.number().optional(),scrollHeight:z$1.number().optional(),scrollbarVisible:z$1.number().optional()}),xe=z$1.object({parent:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),Ee=z$1.object({parent:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(Ue),ve=z$1.object({parent:z$1.number().optional(),label:z$1.string().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Se=z$1.object({width:z$1.number().int().positive(),height:z$1.number().int().positive(),title:z$1.string().optional(),cursorVisible:z$1.boolean().optional(),cursorShape:z$1.number().int().min(0).max(5).optional(),fullUnicode:z$1.boolean().optional(),autoPadding:z$1.boolean().optional()}),Be=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),maxLength:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),ke=z$1.object({parent:z$1.number().optional(),items:z$1.array(z$1.string()).optional(),selectedIndex:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(Ce).merge(T),Fe=z$1.object({parent:z$1.number().optional(),label:z$1.string().optional(),checked:z$1.boolean().optional(),checkedChar:z$1.string().optional(),uncheckedChar:z$1.string().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Ie=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),secret:z$1.boolean().optional(),censor:z$1.string().optional(),maxLength:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Oe=z$1.object({parent:z$1.number().optional(),value:z$1.string().optional(),placeholder:z$1.string().optional(),maxLength:z$1.number().optional(),scrollable:z$1.boolean().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T).merge(Ce),We=z$1.object({parent:z$1.number().optional(),options:z$1.array(z$1.object({label:z$1.string(),value:z$1.string()})).optional(),selectedIndex:z$1.number().optional(),placeholder:z$1.string().optional(),closedIndicator:z$1.string().optional(),openIndicator:z$1.string().optional(),selectedMark:z$1.string().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Te=z$1.object({parent:z$1.number().optional(),min:z$1.number().optional(),max:z$1.number().optional(),value:z$1.number().optional(),step:z$1.number().optional(),orientation:z$1.number().optional(),showValue:z$1.boolean().optional(),trackChar:z$1.string().optional(),thumbChar:z$1.string().optional(),fillChar:z$1.string().optional(),trackFg:z$1.number().optional(),trackBg:z$1.number().optional(),thumbFg:z$1.number().optional(),thumbBg:z$1.number().optional(),fillFg:z$1.number().optional(),fillBg:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T),Pe=z$1.object({parent:z$1.number().optional(),keys:z$1.boolean().optional(),submitOnEnter:z$1.boolean().optional(),fields:z$1.array(z$1.object({name:z$1.string(),entity:z$1.number(),initialValue:z$1.unknown().optional()})).optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),je=z$1.object({parent:z$1.number().optional(),value:z$1.number().optional(),min:z$1.number().optional(),max:z$1.number().optional(),orientation:z$1.number().optional(),showPercentage:z$1.boolean().optional(),fillChar:z$1.string().optional(),emptyChar:z$1.string().optional(),fillFg:z$1.number().optional(),fillBg:z$1.number().optional(),emptyFg:z$1.number().optional(),emptyBg:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),ze=z$1.object({parent:z$1.number().optional(),selectedIndex:z$1.number().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k),De=z$1.object({parent:z$1.number().optional(),radioSet:z$1.number().optional(),value:z$1.string().optional(),label:z$1.string().optional(),selected:z$1.boolean().optional(),selectedChar:z$1.string().optional(),unselectedChar:z$1.string().optional(),border:F.optional(),padding:I.optional()}).merge(S).merge(B).merge(k).merge(j).merge(T);function d(n,o){l(n,o,Ba),l(n,o,$),l(n,o,I$1),l(n,o,b),Ba.x[o]=0,Ba.y[o]=0,Ba.z[o]=0,Ba.absolute[o]=0,$.width[o]=0,$.height[o]=0,$.minWidth[o]=0,$.minHeight[o]=0,$.maxWidth[o]=Number.POSITIVE_INFINITY,$.maxHeight[o]=Number.POSITIVE_INFINITY,$.shrink[o]=0,I$1.visible[o]=1,I$1.dirty[o]=1,I$1.fg[o]=4294967295,I$1.bg[o]=255,I$1.bold[o]=0,I$1.underline[o]=0,I$1.blink[o]=0,I$1.inverse[o]=0,I$1.transparent[o]=0,b.parent[o]=0,b.firstChild[o]=0,b.nextSibling[o]=0,b.prevSibling[o]=0,b.childCount[o]=0,b.depth[o]=0;}function h(n,o){o.x!==void 0&&(Ba.x[n]=o.x),o.y!==void 0&&(Ba.y[n]=o.y),o.z!==void 0&&(Ba.z[n]=o.z),o.absolute!==void 0&&(Ba.absolute[n]=o.absolute?1:0);}function He(n){return typeof n=="string"&&n.endsWith("%")?-(Number.parseFloat(n)+2):n==="auto"?-1:n}function Me(n,o){o.minWidth!==void 0&&($.minWidth[n]=o.minWidth),o.maxWidth!==void 0&&($.maxWidth[n]=o.maxWidth),o.minHeight!==void 0&&($.minHeight[n]=o.minHeight),o.maxHeight!==void 0&&($.maxHeight[n]=o.maxHeight),o.shrink!==void 0&&($.shrink[n]=o.shrink?1:0);}function y(n,o){o.width!==void 0&&($.width[n]=He(o.width)),o.height!==void 0&&($.height[n]=He(o.height)),Me(n,o);}function C(n,o,e){let t={};e.fg!==void 0&&(t.fg=e.fg),e.bg!==void 0&&(t.bg=e.bg),e.bold!==void 0&&(t.bold=e.bold),e.underline!==void 0&&(t.underline=e.underline),e.inverse!==void 0&&(t.inverse=e.inverse),e.blink!==void 0&&(t.blink=e.blink),Object.keys(t).length>0&&J(n,o,t),e.visible!==void 0&&(I$1.visible[o]=e.visible?1:0);}function x(n,o,e){if(!e||!(e.type!==void 0||e.left!==void 0||e.right!==void 0||e.top!==void 0||e.bottom!==void 0||e.fg!==void 0||e.bg!==void 0||e.chars!==void 0))return;k$1.type[o]=e.type??0,k$1.left[o]=0,k$1.right[o]=0,k$1.top[o]=0,k$1.bottom[o]=0,k$1.fg[o]=4294967295,k$1.bg[o]=255;let a={};e.type!==void 0&&(a.type=e.type),e.left!==void 0&&(a.left=e.left),e.right!==void 0&&(a.right=e.right),e.top!==void 0&&(a.top=e.top),e.bottom!==void 0&&(a.bottom=e.bottom),e.fg!==void 0&&(a.fg=e.fg),e.bg!==void 0&&(a.bg=e.bg),e.chars!==void 0&&(a.chars=e.chars),l$1(n,o,a);}function E(n,o,e){if(!e||!(e.left!==void 0||e.right!==void 0||e.top!==void 0||e.bottom!==void 0))return;c$3.left[o]=0,c$3.right[o]=0,c$3.top[o]=0,c$3.bottom[o]=0;let a={};e.left!==void 0&&(a.left=e.left),e.right!==void 0&&(a.right=e.right),e.top!==void 0&&(a.top=e.top),e.bottom!==void 0&&(a.bottom=e.bottom),d$4(n,o,a);}function z(n,o){l(n,o,d$1),d$1.align[o]=0,d$1.valign[o]=0,d$1.wrap[o]=0,d$1.parseTags[o]=0,d$1.length[o]=0,d$1.hash[o]=0,d$1.contentId[o]=0;}function Ke(n,o){o.align!==void 0&&(d$1.align[n]=o.align),o.valign!==void 0&&(d$1.valign[n]=o.valign),o.wrap!==void 0&&(d$1.wrap[n]=o.wrap?1:0),o.parseTags!==void 0&&(d$1.parseTags[n]=o.parseTags?1:0);}function Ve(n,o,e$1){if(e$1.text!==void 0){let t={};e$1.align!==void 0&&(t.align=e$1.align),e$1.valign!==void 0&&(t.valign=e$1.valign),e$1.wrap!==void 0&&(t.wrap=e$1.wrap),e$1.parseTags!==void 0&&(t.parseTags=e$1.parseTags),e(n,o,e$1.text,t);}else Ke(o,e$1);}function Le(n,o,e){l(n,o,b$1),b$1.scrollX[o]=0,b$1.scrollY[o]=0,b$1.scrollWidth[o]=0,b$1.scrollHeight[o]=e,b$1.scrollbarVisible[o]=2;}function Re(n,o,e){let t={};e.scrollable!==void 0&&(t.scrollX=0),e.scrollX!==void 0&&(t.scrollX=e.scrollX),e.scrollY!==void 0&&(t.scrollY=e.scrollY),e.scrollWidth!==void 0&&(t.scrollWidth=e.scrollWidth),e.scrollHeight!==void 0&&(t.scrollHeight=e.scrollHeight),e.scrollbarVisible!==void 0&&(t.scrollbarVisible=e.scrollbarVisible),Object.keys(t).length>0&&Le$1(n,o,t);}function Ye(n){c$1.clickable[n]=1,c$1.draggable[n]=0,c$1.hoverable[n]=0,c$1.hovered[n]=0,c$1.pressed[n]=0,c$1.keyable[n]=1,c$1.hoverEffectFg[n]=4294967295,c$1.hoverEffectBg[n]=1145324799;}function Xe(n,o){l(n,o,ka),ka.focusable[o]=1,ka.focused[o]=0,ka.tabIndex[o]=0,ka.focusEffectFg[o]=4294967295,ka.focusEffectBg[o]=6750207;}function D(n,o,e){let t={};e.focusable!==void 0&&(t.focusable=e.focusable),e.tabIndex!==void 0&&(t.tabIndex=e.tabIndex),e.focusEffectFg!==void 0&&(t.focusEffectFg=e.focusEffectFg),e.focusEffectBg!==void 0&&(t.focusEffectBg=e.focusEffectBg),Object.keys(t).length>0&&la(n,o,t);}function H(n,o,e){let t={};e.clickable!==void 0&&(t.clickable=e.clickable),e.draggable!==void 0&&(t.draggable=e.draggable),e.hoverable!==void 0&&(t.hoverable=e.hoverable),e.keyable!==void 0&&(t.keyable=e.keyable),e.hoverEffectFg!==void 0&&(t.hoverEffectFg=e.hoverEffectFg),e.hoverEffectBg!==void 0&&(t.hoverEffectBg=e.hoverEffectBg),Object.keys(t).length>0&&d$2(n,o,t);}function V(n,o){l(n,o,c$1),c$1.clickable[o]=1,c$1.draggable[o]=0,c$1.hoverable[o]=1,c$1.hovered[o]=0,c$1.pressed[o]=0,c$1.keyable[o]=1,c$1.hoverEffectFg[o]=4294967295,c$1.hoverEffectBg[o]=1145324799;}function L(n,o){l(n,o,ka),ka.focusable[o]=1,ka.focused[o]=0,ka.tabIndex[o]=0,ka.focusEffectFg[o]=4294967295,ka.focusEffectBg[o]=6750207;}function Ae(n,o,e){let t={};e.scrollX!==void 0&&(t.scrollX=e.scrollX),e.scrollY!==void 0&&(t.scrollY=e.scrollY),e.scrollWidth!==void 0&&(t.scrollWidth=e.scrollWidth),e.scrollHeight!==void 0&&(t.scrollHeight=e.scrollHeight),e.scrollbarVisible!==void 0&&(t.scrollbarVisible=e.scrollbarVisible),Object.keys(t).length>0&&Le$1(n,o,t);}function Ne(n,o,e){let t={};e.trackChar!==void 0&&(t.trackChar=e.trackChar),e.thumbChar!==void 0&&(t.thumbChar=e.thumbChar),e.fillChar!==void 0&&(t.fillChar=e.fillChar),e.trackFg!==void 0&&(t.trackFg=e.trackFg),e.trackBg!==void 0&&(t.trackBg=e.trackBg),e.thumbFg!==void 0&&(t.thumbFg=e.thumbFg),e.thumbBg!==void 0&&(t.thumbBg=e.thumbBg),e.fillFg!==void 0&&(t.fillFg=e.fillFg),e.fillBg!==void 0&&(t.fillBg=e.fillBg),Be$1(n,o,t);}function Tt(n,o={}){let e=xe.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),e.parent!==void 0&&c(n,t,e.parent),t}function Pt(n,o={}){let e=Ee.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),z(n,t),Ve(n,t,e),e.parent!==void 0&&c(n,t,e.parent),t}function jt(n,o={}){let e$1=ve.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),d$1.align[t]=1,d$1.valign[t]=1,d$1.wrap[t]=0,d$1.parseTags[t]=0,d$1.length[t]=0,d$1.hash[t]=0,e$1.label!==void 0&&e(n,t,e$1.label),l(n,t,c$1),c$1.clickable[t]=1,c$1.draggable[t]=0,c$1.hoverable[t]=1,c$1.hovered[t]=0,c$1.pressed[t]=0,c$1.keyable[t]=1,c$1.hoverEffectFg[t]=4294967295,c$1.hoverEffectBg[t]=1145324799;let a={};e$1.clickable!==void 0&&(a.clickable=e$1.clickable),e$1.draggable!==void 0&&(a.draggable=e$1.draggable),e$1.hoverable!==void 0&&(a.hoverable=e$1.hoverable),e$1.keyable!==void 0&&(a.keyable=e$1.keyable),e$1.hoverEffectFg!==void 0&&(a.hoverEffectFg=e$1.hoverEffectFg),e$1.hoverEffectBg!==void 0&&(a.hoverEffectBg=e$1.hoverEffectBg),Object.keys(a).length>0&&d$2(n,t,a),l(n,t,ka),ka.focusable[t]=1,ka.focused[t]=0,ka.tabIndex[t]=0,ka.focusEffectFg[t]=4294967295,ka.focusEffectBg[t]=6750207;let p={};return e$1.focusable!==void 0&&(p.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p.focusEffectBg=e$1.focusEffectBg),Object.keys(p).length>0&&la(n,t,p),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function zt(n,o){if(d$3(n))throw new Error("A screen already exists in this world. Only one screen is allowed.");let e=Se.parse(o),t=h$1(n);return d(n,t),Ba.x[t]=0,Ba.y[t]=0,Ba.z[t]=0,Ba.absolute[t]=0,$.width[t]=e.width,$.height[t]=e.height,I$1.visible[t]=1,I$1.dirty[t]=1,b.parent[t]=0,b.depth[t]=0,c$2(n,t,{cursorVisible:e.cursorVisible,cursorShape:e.cursorShape,fullUnicode:e.fullUnicode,autoPadding:e.autoPadding}),e$1(n,t),t}function Dt(n,o={}){let e$1=Be.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),d$1.align[t]=0,d$1.valign[t]=1,d$1.wrap[t]=0,d$1.parseTags[t]=0,d$1.length[t]=0,d$1.hash[t]=0,e$1.value!==void 0&&e(n,t,e$1.value),c$1.clickable[t]=1,c$1.draggable[t]=0,c$1.hoverable[t]=1,c$1.hovered[t]=0,c$1.pressed[t]=0,c$1.keyable[t]=1,c$1.hoverEffectFg[t]=4294967295,c$1.hoverEffectBg[t]=858993663;let a={};e$1.clickable!==void 0&&(a.clickable=e$1.clickable),e$1.draggable!==void 0&&(a.draggable=e$1.draggable),e$1.hoverable!==void 0&&(a.hoverable=e$1.hoverable),e$1.keyable!==void 0&&(a.keyable=e$1.keyable),e$1.hoverEffectFg!==void 0&&(a.hoverEffectFg=e$1.hoverEffectFg),e$1.hoverEffectBg!==void 0&&(a.hoverEffectBg=e$1.hoverEffectBg),Object.keys(a).length>0&&d$2(n,t,a),l(n,t,ka),ka.focusable[t]=1,ka.focused[t]=0,ka.tabIndex[t]=0,ka.focusEffectFg[t]=4294967295,ka.focusEffectBg[t]=6750207;let p={};return e$1.focusable!==void 0&&(p.focusable=e$1.focusable),e$1.tabIndex!==void 0&&(p.tabIndex=e$1.tabIndex),e$1.focusEffectFg!==void 0&&(p.focusEffectFg=e$1.focusEffectFg),e$1.focusEffectBg!==void 0&&(p.focusEffectBg=e$1.focusEffectBg),Object.keys(p).length>0&&la(n,t,p),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Ht(n,o={}){let e$1=ke.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),e$1.items!==void 0&&e$1.items.length>0&&e(n,t,e$1.items.join(`
|
|
2
|
+
`)),Le(n,t,e$1.items?.length??0),Re(n,t,e$1),Xe(n,t),D(n,t,e$1),Ye(t),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Vt(n$1,o$1={}){let e$1=Fe.parse(o$1),t=h$1(n$1);return d(n$1,t),h(t,e$1),y(t,e$1),C(n$1,t,e$1),x(n$1,t,e$1.border),E(n$1,t,e$1.padding),z(n$1,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n$1,t,e$1.label),V(n$1,t),H(n$1,t,e$1),L(n$1,t),D(n$1,t,e$1),H$1(n$1,t,{checkedChar:e$1.checkedChar??n,uncheckedChar:e$1.uncheckedChar??o}),q(n$1,t,e$1.checked??false),e$1.parent!==void 0&&c(n$1,t,e$1.parent),t}function Lt(n,o={}){let e$1=Ie.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.value!==void 0&&e(n,t,e$1.value),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),ka$1(n,t),Ba$1(n,t,{secret:e$1.secret??false,censor:e$1.censor??ea,placeholder:e$1.placeholder??fa,maxLength:e$1.maxLength??0}),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Rt(n,o={}){let e$1=Oe.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=0,e$1.value!==void 0&&e(n,t,e$1.value),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),e$1.scrollable&&(l(n,t,b$1),b$1.scrollX[t]=0,b$1.scrollY[t]=0,b$1.scrollWidth[t]=0,b$1.scrollHeight[t]=0,b$1.scrollbarVisible[t]=2,Ae(n,t,e$1)),ka$1(n,t),Ba$1(n,t,{secret:false,censor:"",placeholder:e$1.placeholder??fa,maxLength:e$1.maxLength??0,multiline:true}),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Yt(n,o={}){let e$1=We.parse(o),t=h$1(n);d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1);let a=e$1.options??[],p=e$1.selectedIndex??-1;Yc(n,t,a,p);let R={};return e$1.closedIndicator!==void 0&&(R.closedIndicator=e$1.closedIndicator),e$1.openIndicator!==void 0&&(R.openIndicator=e$1.openIndicator),e$1.selectedMark!==void 0&&(R.selectedMark=e$1.selectedMark),yd(n,t,R),p>=0&&a[p]?e(n,t,a[p].label):e$1.placeholder&&e(n,t,e$1.placeholder),e$1.parent!==void 0&&c(n,t,e$1.parent),t}function Xt(n,o={}){let e=Te.parse(o),t=h$1(n);d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),V(n,t),c$1.draggable[t]=1,c$1.hoverEffectBg[t]=858993663,H(n,t,e),L(n,t),D(n,t,e);let a=e.min??0,p=e.max??100,R=e.value??0,_e=e.step??1;return Wd(n,t,a,p,R,_e),e.orientation!==void 0&&we(n,t,e.orientation),e.showValue!==void 0&&Ae$1(n,t,e.showValue),Ne(n,t,e),e.parent!==void 0&&c(n,t,e.parent),t}function At(n,o={}){let e=Pe.parse(o),t=h$1(n);if(d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),kb(n,t,{keys:e.keys??true,submitOnEnter:e.submitOnEnter??true}),e.fields)for(let a of e.fields)ob(n,t,a.entity,a.name,a.initialValue);return e.parent!==void 0&&c(n,t,e.parent),t}function Nt(n,o={}){let e=je.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),Mb(n,t,{value:e.value??0,min:e.min??0,max:e.max??100,orientation:e.orientation??Fb.Horizontal,showPercentage:e.showPercentage??false}),(e.fillChar!==void 0||e.emptyChar!==void 0||e.fillFg!==void 0||e.fillBg!==void 0||e.emptyFg!==void 0||e.emptyBg!==void 0)&&_b(n,t,{fillChar:e.fillChar,emptyChar:e.emptyChar,fillFg:e.fillFg,fillBg:e.fillBg,emptyFg:e.emptyFg,emptyBg:e.emptyBg}),e.parent!==void 0&&c(n,t,e.parent),t}function _t(n,o={}){let e=ze.parse(o),t=h$1(n);return d(n,t),h(t,e),y(t,e),C(n,t,e),x(n,t,e.border),E(n,t,e.padding),qc(n,t),e.parent!==void 0&&c(n,t,e.parent),t}function Ut(n,o={}){let e$1=De.parse(o),t=h$1(n);return d(n,t),h(t,e$1),y(t,e$1),C(n,t,e$1),x(n,t,e$1.border),E(n,t,e$1.padding),z(n,t),d$1.align[t]=0,d$1.valign[t]=1,e$1.label!==void 0&&e(n,t,e$1.label),V(n,t),c$1.hoverEffectBg[t]=858993663,H(n,t,e$1),L(n,t),D(n,t,e$1),wc(n,t,e$1.radioSet),e$1.value!==void 0&&Gc(n,t,e$1.value),(e$1.selectedChar!==void 0||e$1.unselectedChar!==void 0)&&Lc(n,t,{selectedChar:e$1.selectedChar,unselectedChar:e$1.unselectedChar}),e$1.parent!==void 0&&c(n,t,e$1.parent),e$1.selected&&Hc(n,t),t}export{At as A,Nt as B,_t as C,Ut as D,xe as a,Ee as b,ve as c,Se as d,Be as e,ke as f,Fe as g,Ie as h,Oe as i,We as j,Te as k,Pe as l,je as m,ze as n,De as o,Tt as p,Pt as q,jt as r,zt as s,Dt as t,Ht as u,Vt as v,Lt as w,Rt as x,Yt as y,Xt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {m,l}from'./chunk-7ZFQO3OQ.js';import {g as g$1,f as f$1}from'./chunk-Z4EZERNE.js';var d=(o=>(o[o.Hidden=0]="Hidden",o[o.Visible=1]="Visible",o[o.Auto=2]="Auto",o))(d||{}),A={scrollX:new Float32Array(1e4),scrollY:new Float32Array(1e4),scrollWidth:new Float32Array(1e4),scrollHeight:new Float32Array(1e4),viewportWidth:new Float32Array(1e4),viewportHeight:new Float32Array(1e4),scrollbarVisible:new Uint8Array(1e4),trackVisible:new Uint8Array(1e4),alwaysScroll:new Uint8Array(1e4),clampEnabled:new Uint8Array(1e4)};var i=1e4,n={left:new Uint8Array(i),top:new Uint8Array(i),right:new Uint8Array(i),bottom:new Uint8Array(i)};function f(t){n.left[t]=0,n.top[t]=0,n.right[t]=0,n.bottom[t]=0;}function u(t,r){m(t,r,n)||(l(t,r,n),f(r));}function p(t,r,e){return g$1.parse(e),u(t,r),e.left!==void 0&&(n.left[r]=e.left),e.top!==void 0&&(n.top[r]=e.top),e.right!==void 0&&(n.right[r]=e.right),e.bottom!==void 0&&(n.bottom[r]=e.bottom),r}function g(t,r,e){return f$1.parse(e),u(t,r),n.left[r]=e,n.top[r]=e,n.right[r]=e,n.bottom[r]=e,r}function P(t,r,e,o){return f$1.parse(e),f$1.parse(o),u(t,r),n.left[r]=e,n.right[r]=e,n.top[r]=o,n.bottom[r]=o,r}function E(t,r){if(m(t,r,n))return {left:n.left[r],top:n.top[r],right:n.right[r],bottom:n.bottom[r]}}function h(t,r){return m(t,r,n)}function C(t,r){return m(t,r,n)?n.left[r]+n.right[r]:0}function T(t,r){return m(t,r,n)?n.top[r]+n.bottom[r]:0}function w(t,r){return m(t,r,n)?n.left[r]>0||n.top[r]>0||n.right[r]>0||n.bottom[r]>0:false}export{d as a,A as b,n as c,p as d,g as e,P as f,E as g,h,C as i,T as j,w as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c,a}from'./chunk-ZL46COQF.js';import {Ba,I as I$1,V}from'./chunk-ETFDYZVJ.js';import {o,m as m$1}from'./chunk-7ZFQO3OQ.js';import {z as z$1}from'zod';function B(){let e=new Map;function r(t,o,s){let i=e.get(t);i||(i=new Set,e.set(t,i));let d={handler:o,once:s};return i.add(d),()=>{i.delete(d),i.size===0&&e.delete(t);}}let n={on(t,o){return r(t,o,false)},once(t,o){return r(t,o,true)},off(t,o){let s=e.get(t);if(!s)return n;for(let i of s)if(i.handler===o){s.delete(i);break}return s.size===0&&e.delete(t),n},emit(t,o){let s=e.get(t);if(!s||s.size===0)return false;let i=[];for(let d of s)d.handler(o),d.once&&i.push(d);for(let d of i)s.delete(d);return s.size===0&&e.delete(t),true},removeAllListeners(t){return t===void 0?e.clear():e.delete(t),n},listenerCount(t){return e.get(t)?.size??0},eventNames(){return Array.from(e.keys())},hasListeners(t){return n.listenerCount(t)>0}};return n}function U(){let e=new Map;return {get(r,n){return e.get(n)},getOrCreate(r,n){let t=e.get(n);return t||(t=B(),e.set(n,t)),t},set(r,n,t){e.set(n,t);},has(r,n){return e.has(n)},delete(r,n){return e.delete(n)},clear(){e.clear();}}}var Q=[{name:"renderables",components:[Ba,I$1]}],M=z$1.object({name:z$1.string().min(1),components:z$1.array(z$1.unknown()).min(1)}),z=z$1.object({queries:z$1.array(M),initialCapacity:z$1.number().int().positive().optional(),syncMode:z$1.enum(["all","render_only"]).optional()}),g=Object.freeze([]),K=Object.freeze([]);function P(e){return o(e,[Ba,I$1])}var m={type:"bitecs",queryRenderables:P},E=new WeakMap;function X(e={}){return {...m,...e,type:e.type??m.type,queryRenderables:e.queryRenderables??m.queryRenderables}}function G(e,r){E.set(e,r);}function L(e){return E.get(e)??m}function J(e){let r=L(e);I(r)&&r.sync(e);}function Z(e){E.delete(e);}function D(e,r){return {name:e,components:r,cachedResult:null,cachedSize:0,cacheFrameId:-1}}function f(e,r,n){if(e.cacheFrameId===n)return;let t=o(r,e.components);e.cachedResult=t,e.cachedSize=t.length,e.cacheFrameId=n;}function _(e){z.parse(e);let r=e.syncMode??"all",n=new Map;for(let i of e.queries)n.set(i.name,D(i.name,i.components));n.has("renderables")||n.set("renderables",D("renderables",[Ba,I$1]));let t=Object.freeze([...n.keys()]),o=null,s=0;return {type:"custom",syncMode:r,queryRenderables(i){let d=n.get("renderables");return d?(f(d,i,s),d.cachedResult??g):g},queryByName(i,d){let l=n.get(i);if(l)return f(l,d,s),l.cachedResult??g},sync(i){o=i,s++;},getQueryData(i){let d=n.get(i);return !d||!o?K:(f(d,o,s),d.cachedResult??K)},getQuerySize(i){let d=n.get(i);return !d||!o?0:(f(d,o,s),d.cachedSize)},getRegisteredQueries(){return t}}}function $(e=256){return _({queries:Q,syncMode:"render_only"})}function I(e){return "sync"in e&&"getQueryData"in e&&"getQuerySize"in e&&"getRegisteredQueries"in e}function oe(e,r){let n=e*r,t=Math.ceil(n/8);return {width:e,height:r,dirtyCells:new Uint8Array(t),dirtyEntities:new Set,entityBoundsCache:new Map,dirtyRegions:[],regionsStale:false,forceFullRedraw:false,frameCount:0}}function ie(e,r,n){if(e.dirtyEntities.add(n),!c(r,n))return;let t=Math.floor(a.x[n]),o=Math.floor(a.y[n]),s=Math.floor(a.width[n]),i=Math.floor(a.height[n]),d=m$1(r,n,I$1)&&V(r,n),l=e.entityBoundsCache.get(n);l?(l.wasVisible&&v(e,l.prevX,l.prevY,l.prevWidth,l.prevHeight),d&&v(e,t,o,s,i),l.prevX=t,l.prevY=o,l.prevWidth=s,l.prevHeight=i,l.wasVisible=d):(e.entityBoundsCache.set(n,{prevX:t,prevY:o,prevWidth:s,prevHeight:i,wasVisible:d}),d&&v(e,t,o,s,i)),e.regionsStale=true;}function de(e,r){e.dirtyEntities.delete(r),e.entityBoundsCache.delete(r);}function se(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];i!==void 0&&(e.dirtyCells[o]=i|1<<s),e.regionsStale=true;}function T(e,r,n){if(r<0||r>=e.width||n<0||n>=e.height)return false;let t=n*e.width+r,o=Math.floor(t/8),s=t%8,i=e.dirtyCells[o];return i!==void 0&&(i&1<<s)!==0}function v(e,r,n,t,o){let s=Math.max(0,r),i=Math.max(0,n),d=Math.min(e.width,r+t),l=Math.min(e.height,n+o);if(!(d<=s||l<=i)){for(let b=i;b<l;b++)for(let p=s;p<d;p++){let x=b*e.width+p,w=Math.floor(x/8),S=x%8,R=e.dirtyCells[w];R!==void 0&&(e.dirtyCells[w]=R|1<<S);}e.regionsStale=true;}}function k(e,r,n){let t=1;for(;r+t<e.width&&T(e,r+t,n);)t++;return t}function H(e,r,n,t){for(let o=0;o<t;o++)if(!T(e,r+o,n))return false;return true}function q(e,r,n,t){let o=1;for(;n+o<e.height&&H(e,r,n+o,t);)o++;return o}function F(e,r,n,t,o,s){for(let i=0;i<o;i++)for(let d=0;d<t;d++)s.add((n+i)*e.width+(r+d));}function le(e){if(e.forceFullRedraw)return [{x:0,y:0,width:e.width,height:e.height}];if(!e.regionsStale&&e.dirtyRegions.length>0)return e.dirtyRegions;e.dirtyRegions.length=0;let r=[],n=new Set;for(let t=0;t<e.height;t++)for(let o=0;o<e.width;o++){let s=t*e.width+o;if(n.has(s)||!T(e,o,t))continue;let i=k(e,o,t),d=q(e,o,t,i);F(e,o,t,i,d,n),r.push({x:o,y:t,width:i,height:d});}return e.dirtyRegions.length=0,e.dirtyRegions.push(...r),e.regionsStale=false,e.dirtyRegions}function ae(e){if(e.forceFullRedraw||e.dirtyEntities.size>0)return true;for(let r=0;r<e.dirtyCells.length;r++)if(e.dirtyCells[r]!==0)return true;return false}function ue(e){e.dirtyCells.fill(0),e.dirtyEntities.clear(),e.dirtyRegions.length=0,e.regionsStale=false,e.forceFullRedraw=false,e.frameCount++;}function ye(e){e.forceFullRedraw=true,e.regionsStale=true;}function ce(e){let r=0;for(let n=0;n<e.dirtyCells.length;n++){let t=e.dirtyCells[n];if(t!==void 0)for(let o=0;o<8;o++)t&1<<o&&r++;}return {dirtyCellCount:r,dirtyEntityCount:e.dirtyEntities.size,cachedEntityCount:e.entityBoundsCache.size,dirtyRegionCount:e.regionsStale?0:e.dirtyRegions.length,frameCount:e.frameCount}}export{B as a,U as b,M as c,z as d,m as e,X as f,G as g,L as h,J as i,Z as j,_ as k,$ as l,I as m,oe as n,ie as o,de as p,se as q,T as r,v as s,le as t,ae as u,ue as v,ye as w,ce as x};
|