blecsd 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +4 -2
  2. package/README.md +209 -66
  3. package/dist/3d/index.d.ts +2 -2
  4. package/dist/3d/index.js +1 -1
  5. package/dist/audio/index.d.ts +2 -2
  6. package/dist/{border-D_Jb4ZJV.d.ts → border-Jb7TrMob.d.ts} +20 -10
  7. package/dist/chunk-2IEMMRUO.js +1 -0
  8. package/dist/chunk-3AV52GY5.js +1 -0
  9. package/dist/chunk-3LHLSY3Y.js +1 -0
  10. package/dist/chunk-3O4TQHGK.js +4 -0
  11. package/dist/chunk-3UJWZ5ZN.js +1 -0
  12. package/dist/chunk-5N3O25O7.js +1 -0
  13. package/dist/chunk-6M2J5QUA.js +1 -0
  14. package/dist/chunk-7IQEUVGF.js +1 -0
  15. package/dist/chunk-A6M6TFBL.js +1 -0
  16. package/dist/chunk-CUEUJAHK.js +3 -0
  17. package/dist/chunk-D42Q2KKR.js +1 -0
  18. package/dist/chunk-DYEXOFUU.js +2 -0
  19. package/dist/chunk-DYU72XLL.js +1 -0
  20. package/dist/chunk-E4CJRSND.js +1 -0
  21. package/dist/chunk-EAY7B5GL.js +1 -0
  22. package/dist/chunk-FCMTWFSE.js +1 -0
  23. package/dist/chunk-FL56THSI.js +25 -0
  24. package/dist/{chunk-2UBBZFE4.js → chunk-G437VE43.js} +1 -1
  25. package/dist/chunk-GGXNWT36.js +8 -0
  26. package/dist/chunk-HLFORKXS.js +1 -0
  27. package/dist/chunk-J7MBKEBY.js +1 -0
  28. package/dist/{chunk-TYMY2TBR.js → chunk-JHCKPCUH.js} +3 -3
  29. package/dist/chunk-K3SX2LY5.js +1 -0
  30. package/dist/chunk-LDAFEXN5.js +1 -0
  31. package/dist/chunk-MKMFUXLB.js +33 -0
  32. package/dist/chunk-MQWPHPUM.js +1 -0
  33. package/dist/chunk-MTI376CU.js +5 -0
  34. package/dist/chunk-MTV2RJZD.js +1 -0
  35. package/dist/chunk-NPDPBAW6.js +4 -0
  36. package/dist/chunk-OB66FB4F.js +1 -0
  37. package/dist/chunk-OR3BZY7C.js +1 -0
  38. package/dist/{chunk-VNZ6CWJA.js → chunk-R7AICVRN.js} +2 -2
  39. package/dist/{chunk-3B7MIVW6.js → chunk-RZ7FGVI6.js} +1 -1
  40. package/dist/chunk-UMGTXSQB.js +11 -0
  41. package/dist/chunk-X3Q3T2SS.js +4 -0
  42. package/dist/{chunk-JKVHO4LH.js → chunk-XZJRWFOS.js} +1 -1
  43. package/dist/chunk-ZAHG7Y3X.js +1 -0
  44. package/dist/cli/init.d.ts +1 -1
  45. package/dist/componentStorage-CJTh-TPO.d.ts +246 -0
  46. package/dist/components/index.d.ts +1942 -514
  47. package/dist/components/index.js +1 -1
  48. package/dist/core/index.d.ts +857 -259
  49. package/dist/core/index.js +1 -1
  50. package/dist/debug/index.d.ts +491 -98
  51. package/dist/debug/index.js +1 -1
  52. package/dist/dirtyTracking-C4v8MmM9.d.ts +235 -0
  53. package/dist/errors/index.d.ts +12 -12
  54. package/dist/errors/index.js +1 -1
  55. package/dist/{events-BbbxkgvX.d.ts → events-9ForpTfM.d.ts} +75 -2
  56. package/dist/game/index.d.ts +7 -7
  57. package/dist/game/index.js +1 -1
  58. package/dist/{gameLoop-BIPW7-OY.d.ts → gameLoop-C-Ez_i54.d.ts} +2 -2
  59. package/dist/{index-zSGJ2eUk.d.ts → index-DBS5Uefn.d.ts} +2 -2
  60. package/dist/index.d.ts +283 -20
  61. package/dist/index.js +3 -1
  62. package/dist/input/index.d.ts +1 -1
  63. package/dist/input/index.js +1 -1
  64. package/dist/{inputActions-CefRUBuT.d.ts → inputActions-CRsUtTHM.d.ts} +10 -721
  65. package/dist/packedStore-BgvnEdE7.d.ts +191 -0
  66. package/dist/{renderable-jTMOA-GK.d.ts → renderable-CwqGwrEV.d.ts} +9 -9
  67. package/dist/{scheduler-DcfoFuum.d.ts → scheduler-CMcYew9Z.d.ts} +65 -3
  68. package/dist/systems/index.d.ts +356 -55
  69. package/dist/systems/index.js +1 -1
  70. package/dist/terminal/index.d.ts +2233 -2299
  71. package/dist/terminal/index.js +1 -1
  72. package/dist/{tilemap-D1HJvKy3.d.ts → tilemap-BirMJdbu.d.ts} +92 -3
  73. package/dist/{types-BcsvoKzf.d.ts → types-CPB4CpbH.d.ts} +2 -2
  74. package/dist/utils/index.d.ts +27 -180
  75. package/dist/utils/index.js +1 -1
  76. package/dist/{virtualScrollback-DvZTRU8a.d.ts → virtualScrollback-D9uLFe8l.d.ts} +4 -4
  77. package/dist/{virtualViewport-Dx2iJliO.d.ts → virtualViewport-Bpv6jlKt.d.ts} +283 -761
  78. package/dist/widgets/bigText.d.ts +1 -1
  79. package/dist/widgets/bigText.js +1 -1
  80. package/dist/widgets/index.d.ts +10519 -5463
  81. package/dist/widgets/index.js +1 -1
  82. package/package.json +102 -6
  83. package/dist/chunk-35I22JJO.js +0 -1
  84. package/dist/chunk-3EGGGI5J.js +0 -3
  85. package/dist/chunk-4X4N4HNQ.js +0 -2
  86. package/dist/chunk-AQ7LW75B.js +0 -1
  87. package/dist/chunk-AXZQAH4X.js +0 -1
  88. package/dist/chunk-BCADUCOZ.js +0 -1
  89. package/dist/chunk-EJ5WVDDZ.js +0 -6
  90. package/dist/chunk-FT7BMYSN.js +0 -1
  91. package/dist/chunk-FYEBZAWN.js +0 -1
  92. package/dist/chunk-GYHI26UE.js +0 -1
  93. package/dist/chunk-H2YAOJDW.js +0 -1
  94. package/dist/chunk-K2B2OXQ5.js +0 -5
  95. package/dist/chunk-K37L3G4Z.js +0 -4
  96. package/dist/chunk-KD55INV7.js +0 -1
  97. package/dist/chunk-KFAK4A3G.js +0 -1
  98. package/dist/chunk-LCN2ZITE.js +0 -1
  99. package/dist/chunk-OUXUPF3V.js +0 -33
  100. package/dist/chunk-P6CJO3BC.js +0 -1
  101. package/dist/chunk-PI5UOHOH.js +0 -1
  102. package/dist/chunk-PSXXMBVJ.js +0 -1
  103. package/dist/chunk-TRK4422V.js +0 -12
  104. package/dist/chunk-W5OU7Z6J.js +0 -1
  105. package/dist/chunk-WNG4A3K7.js +0 -4
  106. package/dist/chunk-XRJNAHNG.js +0 -19
  107. package/dist/chunk-XZA63ZPO.js +0 -1
  108. package/dist/chunk-YAMOSPWB.js +0 -4
  109. package/dist/chunk-YD6ULIUR.js +0 -1
  110. package/dist/{keyParser-Bwm8-l7v.d.ts → keyParser-BnHbg2iD.d.ts} +1 -1
@@ -1,33 +0,0 @@
1
- import {s,b as b$1,c as c$1,d,e}from'./chunk-LCN2ZITE.js';import {f}from'./chunk-SHUC6JWA.js';import {c}from'./chunk-5PELJRUQ.js';import {z as z$1}from'zod';import*as Un from'fs';import*as k from'path';s();function _(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 wr=_(b$1),Er=_(c$1),Mr=_(d),Wr=_(e),Ir={topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|"},Dr={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u254C",vertical:"\u254E"};function vr(e,t,n=4294967295,r=0){let o=[];for(let i=0;i<t;i++){let a=[];for(let l=0;l<e;l++)a.push({char:" ",fg:n,bg:r});o.push(a);}return {width:e,height:t,cells:o,setCell(i,a,l,s,u){if(i<0||i>=e||a<0||a>=t)return;let d=o[a]?.[i];d&&(d.char=l,s!==void 0&&(d.fg=s),u!==void 0&&(d.bg=u));}}}function Br(e,t,n,r,o,i,a,l,s,u){e.setCell(t,n,l.topLeft,s,u),i>1&&e.setCell(r,n,l.topRight,s,u),a>1&&e.setCell(t,o,l.bottomLeft,s,u),i>1&&a>1&&e.setCell(r,o,l.bottomRight,s,u);}function Fr(e,t,n,r,o,i,a,l,s,u){for(let d=t+1;d<r;d++)e.setCell(d,n,l.horizontal,s,u),a>1&&e.setCell(d,o,l.horizontal,s,u);for(let d=n+1;d<o;d++)e.setCell(t,d,l.vertical,s,u),i>1&&e.setCell(r,d,l.vertical,s,u);}function Pr(e,t,n,r,o,i,a={}){let{fg:l,bg:s,fill:u=false,fillChar:d=" "}=a;if(r<1||o<1)return;let f=t+r-1,c=n+o-1;Br(e,t,n,f,c,r,o,i,l,s),Fr(e,t,n,f,c,r,o,i,l,s),u&&r>2&&o>2&&At(e,t+1,n+1,r-2,o-2,d,l,s);}function _r(e,t,n,r,o="\u2500",i,a){for(let l=0;l<r;l++)e.setCell(t+l,n,o,i,a);}function Or(e,t,n,r,o="\u2502",i,a){for(let l=0;l<r;l++)e.setCell(t,n+l,o,i,a);}function At(e,t,n,r,o,i=" ",a,l){for(let s=0;s<o;s++)for(let u=0;u<r;u++)e.setCell(t+u,n+s,i,a,l);}function Nr(e,t,n,r,o,i){for(let a=0;a<r.length;a++){let l=r[a];l!==void 0&&e.setCell(t+a,n,l,o,i);}}function zr(e){let t=[];for(let n=0;n<e.height;n++){let r="";for(let o=0;o<e.width;o++)r+=e.cells[n]?.[o]?.char??" ";t.push(r);}return t.join(`
2
- `)}var Hr={maxDelayMs:16,maxBatchSize:100,immediateCursor:true};function Gr(e,t){return {config:{...Hr,...t},pending:[],flushCallback:e,flushTimer:null,totalProcessed:0,totalFlushes:0}}function Ur(e,t){if(e.pending.push(t),e.pending.length>=e.config.maxBatchSize){Y(e);return}e.flushTimer||(e.flushTimer=setTimeout(()=>{Y(e);},e.config.maxDelayMs));}function Y(e){if(e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),e.pending.length===0)return;let t=[...e.pending];e.pending=[];let n=qr(t),r=t.length>1?(t[t.length-1]?.timestamp??0)-(t[0]?.timestamp??0):0,o={dirtyRegion:n,changeCount:t.length,timeSpanMs:r,changes:t};return e.totalProcessed+=t.length,e.totalFlushes++,e.flushCallback&&e.flushCallback(o),o}function Vr(e){return {config:e.config,pendingCount:e.pending.length,flushScheduled:e.flushTimer!==null,totalProcessed:e.totalProcessed,totalFlushes:e.totalFlushes,avgChangesPerFlush:e.totalFlushes>0?e.totalProcessed/e.totalFlushes:0}}function jr(e,t,n){return {startLine:e,startColumn:t,endLine:e,endColumn:t,text:n,timestamp:Date.now()}}function $r(e,t,n,r){return {startLine:e,startColumn:t,endLine:n,endColumn:r,text:"",timestamp:Date.now()}}function Zr(e,t,n,r,o){return {startLine:e,startColumn:t,endLine:n,endColumn:r,text:o,timestamp:Date.now()}}function Kr(e){let t=Y(e);return e.flushCallback=null,t}function qr(e){if(e.length===0)return {startLine:0,endLine:0,lineCountChanged:false,lineDelta:0};let t=Number.POSITIVE_INFINITY,n=0,r=0;for(let o of e){t=Math.min(t,o.startLine),n=Math.max(n,o.endLine);let i=0;for(let l=0;l<o.text.length;l++)o.text[l]===`
3
- `&&i++;let a=o.endLine-o.startLine;r+=i-a,n=Math.max(n,o.startLine+i);}return {startLine:t===Number.POSITIVE_INFINITY?0:t,endLine:n,lineCountChanged:r!==0,lineDelta:r}}f();function Xr(e){let t=new Map;return {get:n=>t.get(n),set:(n,r)=>{t.set(n,r);},has:n=>t.has(n),delete:n=>t.delete(n),get size(){return t.size},entries:()=>t.entries(),clear:()=>t.clear(),memoryUsage:()=>64+t.size*120}}function Yr(){let e=new Map,t=0,n=0;function r(i){let a=1;for(;a<i;)a*=2;return a}function o(i){let a=r(i),l=e.get(a);return l&&l.arrays.length>0?(n-=a,l.arrays.pop()):(t+=a,new ArrayBuffer(a))}return {allocateF32(i){let a=o(i*4);return new Float32Array(a,0,i)},allocateU32(i){let a=o(i*4);return new Uint32Array(a,0,i)},allocateU8(i){let a=o(i);return new Uint8Array(a,0,i)},release(i){let a=i.buffer,l=r(a.byteLength),s=e.get(l);s||(s={arrays:[]},e.set(l,s)),s.arrays.push(a),n+=l;},get totalAllocated(){return t},get totalFree(){return n},reset(){e.clear(),t=0,n=0;}}}function wt(e,t,n=4,r=4){let i=e*t*r*n,a=e*8;return i+a}function Jr(e,t){let n=new Map,r=0,o=0;for(let[a,l]of Object.entries(t)){let s=0;for(let u of Object.values(l))ArrayBuffer.isView(u)&&(s+=u.byteLength,o=Math.max(o,u.length));n.set(a,s),r+=s;}let i=o*n.size*4;return {totalBytes:r,componentBytes:n,entityCount:o,avgBytesPerEntity:o>0?r/o:0,efficiency:i>0?r/i:1}}function Qr(e,t=100,n=5){return wt(e,n)<t*1024*1024}var J={scrollPadding:5,horizontalPadding:5,lineWrap:true,tabWidth:4};function eo(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
4
- `&&t.push(n+1);return {offsets:t,lineCount:t.length}}function to(e){let t=[0],n=0;for(let r=0;r<e.length-1;r++)n+=e[r]??0,t.push(n);return {offsets:t,lineCount:e.length}}function no(e,t){let n=e.offsets,r=0,o=n.length-1;for(;r<=o;){let i=r+o>>>1;(n[i]??0)<=t?r=i+1:o=i-1;}return Math.max(0,r-1)}function ro(e,t){return t<0||t>=e.lineCount?-1:e.offsets[t]??-1}function Q(e=0,t=0){return {line:Math.max(0,e),column:Math.max(0,t)}}function oo(e=0,t=24,n=0,r=80){return {topLine:Math.max(0,e),height:Math.max(1,t),leftColumn:Math.max(0,n),width:Math.max(1,r)}}function io(e){return {...J,...e}}function I(e,t,n,r){let o={...J,...r},{topLine:i,leftColumn:a}=t,l=false,s=e.line-t.height+1+o.scrollPadding,u=e.line-o.scrollPadding;i>u&&(i=Math.max(0,u),l=true),i<s&&(i=Math.min(Math.max(0,n-t.height),Math.max(0,s)),l=true);let d=e.column-t.width+1+o.horizontalPadding,f=e.column-o.horizontalPadding;return a>f&&(a=Math.max(0,f),l=true),a<d&&(a=Math.max(0,d),l=true),l?{viewport:{...t,topLine:i,leftColumn:a},scrolled:true}:{viewport:t,scrolled:false}}function Ee(e,t,n){let r=Math.max(0,Math.min(e.line,t-1)),o=r<t?n(r):0,i=Math.max(0,Math.min(e.column,o));return {line:r,column:i}}function Et(e,t,n,r,o){let i=Q(e.line-t,e.column),a=Ee(i,r,()=>e.column),{viewport:l,scrolled:s}=I(a,n,r,o);return {cursor:a,viewport:l,scrolled:s}}function Mt(e,t,n,r,o){let i=Q(e.line+t,e.column),a=Ee(i,r,()=>e.column),{viewport:l,scrolled:s}=I(a,n,r,o);return {cursor:a,viewport:l,scrolled:s}}function Me(e,t,n,r){let o=Math.max(0,Math.min(e,n-1)),i=Q(o,0),{viewport:a,scrolled:l}=I(i,t,n,r);return {cursor:i,viewport:a,scrolled:l}}function ao(e,t,n,r){return Et(e,t.height-1,t,n,r)}function lo(e,t,n,r){return Mt(e,t.height-1,t,n,r)}function so(e,t,n){return Me(0,e,t,n)}function uo(e,t,n){return Me(t-1,e,t,n)}function fo(e,t,n,r,o,i){let a={...J,...i},{line:l,column:s}=e;s-=t,s<0&&a.lineWrap&&l>0?(l--,s=o(l)):s=Math.max(0,s);let u={line:l,column:s},{viewport:d,scrolled:f}=I(u,n,r,i);return {cursor:u,viewport:d,scrolled:f}}function co(e,t,n,r,o,i){let a={...J,...i},{line:l,column:s}=e,u=o(l);s+=t,s>u&&a.lineWrap&&l<r-1?(l++,s=0):s=Math.min(s,u);let d={line:l,column:s},{viewport:f,scrolled:c}=I(d,n,r,i);return {cursor:d,viewport:f,scrolled:c}}var mo=3,ho=10;function Wt(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r|0;}return t}function go(e,t){let n=e.length,r=t.length,o=n+r,i=Do(e,t);if(i)return i;let a=vo(e,t,o);return po(a.trace,e,t,a.offset)}function po(e,t,n,r){let o=[],i=t.length,a=n.length;for(let l=e.length-1;l>=0;l--){let s=e[l]??[],u=i-a,d=Po(u,l,s,r),f=s[d+r]??0,c=f-d,m=_o(o,t,i,a,f,c);i=m.x,a=m.y;let h=Oo(o,t,n,l,i,a,f);i=h.x,a=h.y;}return o}function bo(e,t){let n=e.length,r=t.length,o=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let i=1;i<=n;i++){let a=o[i];if(a)for(let l=1;l<=r;l++)e[i-1]===t[l-1]?a[l]=(o[i-1]?.[l-1]??0)+1:a[l]=Math.max(o[i-1]?.[l]??0,a[l-1]??0);}return o}function xo(e,t,n){let r=[],o=t.length,i=n.length,a=[];for(;o>0||i>0;){let l=Vo(e,t,n,o,i);a.unshift(l.op),o=l.nextI,i=l.nextJ;}for(let l of a)r.push({type:l.type,content:l.line,oldLineNo:l.oldNo,newLineNo:l.newNo});return r}function yo(e,t){let n=e.length,r=t.length;if(n>100||r>100)return go(e,t);let o=bo(e,t);return xo(o,e,t)}function Co(e,t,n){if(e.length===0)return [];let r=[],o=[],i=0,a=1,l=1,s=0,u=0;function d(){if(o.length===0)return;let f=o.filter(m=>m.type==="remove"||m.type==="context").length,c=o.filter(m=>m.type==="add"||m.type==="context").length;r.push({id:i++,oldStart:a,oldCount:f,newStart:l,newCount:c,lines:o,collapsed:false,contextBefore:u,contextAfter:s}),a+=f,l+=c,o=[],u=0;}for(let f of e)if(f.type==="context")if(s++,s>t*2+n){let c=o.slice(-t);o=o.slice(0,-t),o.length>0&&(s=t,d()),o=[...c,f],u=c.length+1,s=1;}else o.push(f);else s=0,o.push(f);return d(),r}function vt(e,t,n={}){let r=performance.now(),o=n.contextLines??3,i=n.collapseThreshold??10,{oldLines:a,newLines:l}=No(e,t),s=yo(a,l),u=Co(s,o,i);n.initiallyCollapsed&&zo(u);let d=Ho(s);return {chunks:u,additions:d.additions,deletions:d.deletions,contextLines:d.contextLines,computeTimeMs:performance.now()-r}}function So(){return {oldHash:0,newHash:0,result:null,expandedChunks:new Set}}function Lo(e){e.oldHash=0,e.newHash=0,e.result=null,e.expandedChunks.clear();}function ko(e,t,n,r={}){let o=Wt(t),i=Wt(n);if(e.oldHash===o&&e.newHash===i&&e.result)return e.result;let a=vt(t,n,r);e.oldHash=o,e.newHash=i,e.result=a;for(let l of a.chunks)e.expandedChunks.has(l.id)&&(l.collapsed=false);return a}function Bt(e,t,n){let r=t.chunks.find(o=>o.id===n);r&&(r.collapsed=false,e.expandedChunks.add(n));}function Ft(e,t,n){let r=t.chunks.find(o=>o.id===n);r&&(r.collapsed=true,e.expandedChunks.delete(n));}function To(e,t,n){let r=t.chunks.find(o=>o.id===n);return r?r.collapsed?(Bt(e,t,n),false):(Ft(e,t,n),true):false}function Ro(e,t){for(let n of t.chunks)n.collapsed=false,e.expandedChunks.add(n.id);}function Ao(e,t){for(let n of t.chunks)n.lines.some(o=>o.type==="add"||o.type==="remove")||(n.collapsed=true,e.expandedChunks.delete(n.id));}function wo(e,t,n){let r=[];for(let l of e.chunks)if(l.collapsed)r.push({line:{type:"header",content:`... ${l.lines.length} lines hidden ...`},chunkId:l.id,collapsed:true});else for(let s of l.lines)r.push({line:s,chunkId:l.id,collapsed:false});let o=Math.max(0,t),i=Math.min(r.length,t+n),a=r.slice(o,i);return {lines:a.map(l=>l.line),startIndex:o,totalLines:r.length,chunkInfo:a.map(l=>({chunkId:l.chunkId,collapsed:l.collapsed}))}}function Eo(e){let t=0;for(let n of e.chunks)n.collapsed?t+=1:t+=n.lines.length;return t}function Mo(e,t,n){let r=Go(e),o=Math.max(0,t),i=Math.min(r.length,t+n);return r.slice(o,i)}function Wo(e,t="a",n="b"){let r=[];r.push(`--- ${t}`),r.push(`+++ ${n}`);for(let o of e.chunks){r.push(`@@ -${o.oldStart},${o.oldCount} +${o.newStart},${o.newCount} @@`);for(let i of o.lines){let a=i.type==="add"?"+":i.type==="remove"?"-":" ";r.push(a+i.content);}}return r.join(`
5
- `)}function Io(e){let t=performance.now(),n=e.split(`
6
- `),r=[],o=null,i=[],a=0,l=0,s=0,u=0,d=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;for(let f of n){if(f.startsWith("---")||f.startsWith("+++"))continue;let c=d.exec(f);if(c){let h=Uo(c,a);a+=1;let g=Dt(r,o,i);o=h,i=g;continue}if(!o)continue;let m=jo(f);m&&(i.push(m.line),l+=m.additions,s+=m.deletions,u+=m.contextLines);}return Dt(r,o,i),{chunks:r,additions:l,deletions:s,contextLines:u,computeTimeMs:performance.now()-t}}function Do(e,t){let n=e.length,r=t.length;return n===0&&r===0?[]:n===0?t.map((o,i)=>({type:"add",content:o,newLineNo:i+1})):r===0?e.map((o,i)=>({type:"remove",content:o,oldLineNo:i+1})):null}function vo(e,t,n){let r=e.length,o=t.length,i=2*n+1,a=new Array(i).fill(0),l=n,s=[];e:for(let u=0;u<=n;u++){s.push(a.slice());for(let d=-u;d<=u;d+=2){let f=Bo(a,d,u,l),c=Fo(e,t,f,d);if(a[d+l]=c.x,c.x>=r&&c.y>=o)break e}}return {trace:s,offset:l}}function Bo(e,t,n,r){return t===-n||t!==n&&(e[t-1+r]??0)<(e[t+1+r]??0)?e[t+1+r]??0:(e[t-1+r]??0)+1}function Fo(e,t,n,r){let o=n,i=o-r;for(;o<e.length&&i<t.length&&e[o]===t[i];)o++,i++;return {x:o,y:i}}function Po(e,t,n,r){return e===-t||e!==t&&(n[e-1+r]??0)<(n[e+1+r]??0)?e+1:e-1}function _o(e,t,n,r,o,i){let a=n,l=r;for(;a>o&&l>i;)a--,l--,e.unshift({type:"context",content:t[a]??"",oldLineNo:a+1,newLineNo:l+1});return {x:a,y:l}}function Oo(e,t,n,r,o,i,a){if(r<=0)return {x:o,y:i};if(o===a){let s=i-1;return e.unshift({type:"add",content:n[s]??"",newLineNo:s+1}),{x:o,y:s}}let l=o-1;return e.unshift({type:"remove",content:t[l]??"",oldLineNo:l+1}),{x:l,y:i}}function No(e,t){return {oldLines:e===""?[]:e.split(`
7
- `),newLines:t===""?[]:t.split(`
8
- `)}}function zo(e){for(let t of e)t.lines.some(r=>r.type==="add"||r.type==="remove")||(t.collapsed=true);}function Ho(e){let t=0,n=0,r=0;for(let o of e)o.type==="add"?t++:o.type==="remove"?n++:o.type==="context"&&r++;return {additions:t,deletions:n,contextLines:r}}function Go(e){let t=[];for(let n of e.chunks){if(n.collapsed){t.push({left:void 0,right:void 0});continue}let r=[],o=[];for(let i of n.lines){if(i.type==="context"){It(t,r,o),t.push({left:ee(i,"context","left"),right:ee(i,"context","right")});continue}if(i.type==="remove"){r.push(i);continue}i.type==="add"&&o.push(i);}It(t,r,o);}return t}function It(e,t,n){for(;t.length>0||n.length>0;){let r=t.shift(),o=n.shift();e.push({left:r?ee(r,"remove","left"):void 0,right:o?ee(o,"add","right"):void 0});}}function ee(e,t,n){return {lineNo:(n==="left"?e.oldLineNo:e.newLineNo)??0,content:e.content,type:t}}function Uo(e,t){return {id:t,oldStart:parseInt(e[1]??"0",10),oldCount:parseInt(e[2]??"1",10),newStart:parseInt(e[3]??"0",10),newCount:parseInt(e[4]??"1",10),lines:[],collapsed:false,contextBefore:0,contextAfter:0}}function Vo(e,t,n,r,o){let i=r>0?t[r-1]:void 0,a=o>0?n[o-1]:void 0;return i!==void 0&&a!==void 0&&i===a?{op:{type:"context",line:i,oldNo:r,newNo:o},nextI:r-1,nextJ:o-1}:a!==void 0&&(r===0||(e[r]?.[o-1]??0)>=(e[r-1]?.[o]??0))?{op:{type:"add",line:a,newNo:o},nextI:r,nextJ:o-1}:{op:{type:"remove",line:i??"",oldNo:r},nextI:r-1,nextJ:o}}function Dt(e,t,n){return !t||n.length===0?n:(e.push({...t,lines:n}),[])}function jo(e){return e.startsWith("+")?{line:{type:"add",content:e.slice(1)},additions:1,deletions:0,contextLines:0}:e.startsWith("-")?{line:{type:"remove",content:e.slice(1)},additions:0,deletions:1,contextLines:0}:e.startsWith(" ")?{line:{type:"context",content:e.slice(1)},additions:0,deletions:0,contextLines:1}:null}function $o(e){return {additions:e.additions,deletions:e.deletions,totalChanges:e.additions+e.deletions,chunks:e.chunks.length,collapsedChunks:e.chunks.filter(t=>t.collapsed).length}}var Ut={};c(Ut,{CP1252_HIGH_BYTES:()=>ve,CP437_CONTROL_CHARS:()=>O,CP437_HIGH_BYTES:()=>We,CP850_HIGH_BYTES:()=>Ie,CP866_HIGH_BYTES:()=>De,CodePageSchema:()=>C,ConversionOptionsSchema:()=>Zo,UnmappableModeSchema:()=>Ot,bufferToString:()=>Yo,byteToChar:()=>Fe,charToByte:()=>Xo,getCodePageMap:()=>ti,getSupportedCodePages:()=>ei,isCodePageSupported:()=>Qo,stringToBuffer:()=>Jo});var We=["\xC7","\xFC","\xE9","\xE2","\xE4","\xE0","\xE5","\xE7","\xEA","\xEB","\xE8","\xEF","\xEE","\xEC","\xC4","\xC5","\xC9","\xE6","\xC6","\xF4","\xF6","\xF2","\xFB","\xF9","\xFF","\xD6","\xDC","\xA2","\xA3","\xA5","\u20A7","\u0192","\xE1","\xED","\xF3","\xFA","\xF1","\xD1","\xAA","\xBA","\xBF","\u2310","\xAC","\xBD","\xBC","\xA1","\xAB","\xBB","\u2591","\u2592","\u2593","\u2502","\u2524","\u2561","\u2562","\u2556","\u2555","\u2563","\u2551","\u2557","\u255D","\u255C","\u255B","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\u255E","\u255F","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\u2567","\u2568","\u2564","\u2565","\u2559","\u2558","\u2552","\u2553","\u256B","\u256A","\u2518","\u250C","\u2588","\u2584","\u258C","\u2590","\u2580","\u03B1","\xDF","\u0393","\u03C0","\u03A3","\u03C3","\xB5","\u03C4","\u03A6","\u0398","\u03A9","\u03B4","\u221E","\u03C6","\u03B5","\u2229","\u2261","\xB1","\u2265","\u2264","\u2320","\u2321","\xF7","\u2248","\xB0","\u2219","\xB7","\u221A","\u207F","\xB2","\u25A0","\xA0"],O=["\0","\u263A","\u263B","\u2665","\u2666","\u2663","\u2660","\u2022","\u25D8","\u25CB","\u25D9","\u2642","\u2640","\u266A","\u266B","\u263C","\u25BA","\u25C4","\u2195","\u203C","\xB6","\xA7","\u25AC","\u21A8","\u2191","\u2193","\u2192","\u2190","\u221F","\u2194","\u25B2","\u25BC"],Ie=["\xC7","\xFC","\xE9","\xE2","\xE4","\xE0","\xE5","\xE7","\xEA","\xEB","\xE8","\xEF","\xEE","\xEC","\xC4","\xC5","\xC9","\xE6","\xC6","\xF4","\xF6","\xF2","\xFB","\xF9","\xFF","\xD6","\xDC","\xF8","\xA3","\xD8","\xD7","\u0192","\xE1","\xED","\xF3","\xFA","\xF1","\xD1","\xAA","\xBA","\xBF","\xAE","\xAC","\xBD","\xBC","\xA1","\xAB","\xBB","\u2591","\u2592","\u2593","\u2502","\u2524","\xC1","\xC2","\xC0","\xA9","\u2563","\u2551","\u2557","\u255D","\xA2","\xA5","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\xE3","\xC3","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\xA4","\xF0","\xD0","\xCA","\xCB","\xC8","\u0131","\xCD","\xCE","\xCF","\u2518","\u250C","\u2588","\u2584","\xA6","\xCC","\u2580","\xD3","\xDF","\xD4","\xD2","\xF5","\xD5","\xB5","\xFE","\xDE","\xDA","\xDB","\xD9","\xFD","\xDD","\xAF","\xB4","\xAD","\xB1","\u2017","\xBE","\xB6","\xA7","\xF7","\xB8","\xB0","\xA8","\xB7","\xB9","\xB3","\xB2","\u25A0","\xA0"],De=["\u0410","\u0411","\u0412","\u0413","\u0414","\u0415","\u0416","\u0417","\u0418","\u0419","\u041A","\u041B","\u041C","\u041D","\u041E","\u041F","\u0420","\u0421","\u0422","\u0423","\u0424","\u0425","\u0426","\u0427","\u0428","\u0429","\u042A","\u042B","\u042C","\u042D","\u042E","\u042F","\u0430","\u0431","\u0432","\u0433","\u0434","\u0435","\u0436","\u0437","\u0438","\u0439","\u043A","\u043B","\u043C","\u043D","\u043E","\u043F","\u2591","\u2592","\u2593","\u2502","\u2524","\u2561","\u2562","\u2556","\u2555","\u2563","\u2551","\u2557","\u255D","\u255C","\u255B","\u2510","\u2514","\u2534","\u252C","\u251C","\u2500","\u253C","\u255E","\u255F","\u255A","\u2554","\u2569","\u2566","\u2560","\u2550","\u256C","\u2567","\u2568","\u2564","\u2565","\u2559","\u2558","\u2552","\u2553","\u256B","\u256A","\u2518","\u250C","\u2588","\u2584","\u258C","\u2590","\u2580","\u0440","\u0441","\u0442","\u0443","\u0444","\u0445","\u0446","\u0447","\u0448","\u0449","\u044A","\u044B","\u044C","\u044D","\u044E","\u044F","\u0401","\u0451","\u0404","\u0454","\u0407","\u0457","\u040E","\u045E","\xB0","\u2219","\xB7","\u221A","\u2116","\xA4","\u25A0","\xA0"],ve=["\u20AC","\x81","\u201A","\u0192","\u201E","\u2026","\u2020","\u2021","\u02C6","\u2030","\u0160","\u2039","\u0152","\x8D","\u017D","\x8F","\x90","\u2018","\u2019","\u201C","\u201D","\u2022","\u2013","\u2014","\u02DC","\u2122","\u0161","\u203A","\u0153","\x9D","\u017E","\u0178","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6","\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE","\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6","\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE","\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6","\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE","\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6","\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE","\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6","\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE","\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6","\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE","\xFF"],Be={cp437:We,cp850:Ie,cp866:De,cp1252:ve},Pt={cp437:O,cp850:void 0,cp866:void 0,cp1252:void 0};var C=z$1.enum(["cp437","cp850","cp866","cp1252"]),Ot=z$1.enum(["replace","skip","error"]),Zo=z$1.object({codepage:C,unmappable:Ot.default("replace"),replacement:z$1.string().default("\uFFFD"),interpretControlChars:z$1.boolean().default(false)}).strict(),Nt=128,zt=32,Ko=128,Ht=255;function qo(e,t){let n=new Map;for(let r=0;r<e.length;r++){let o=e[r];o&&n.set(o,Nt+r);}if(t)for(let r=0;r<t.length;r++){let o=t[r];o&&o!=="\0"&&n.set(o,r);}for(let r=0;r<zt;r++)n.set(String.fromCharCode(r),r);for(let r=32;r<=126;r++)n.set(String.fromCharCode(r),r);return n.set("\x7F",127),n}var _t=new Map;function Gt(e){let t=_t.get(e);if(t)return t;let n=Be[e],r=Pt[e];if(!n)throw new Error(`Unknown codepage: ${e}`);let o=qo(n,r);return _t.set(e,o),o}function Fe(e,t,n){let r=C.parse(t);if(e<0||e>Ht)throw new RangeError(`Byte value must be 0-255, got: ${e}`);let o=e|0;if(o<zt){if(n?.interpretControlChars&&r==="cp437"){let s=O[o];if(s)return s}return String.fromCharCode(o)}if(o<Ko)return String.fromCharCode(o);let i=Be[r];if(!i)throw new Error(`Unknown codepage: ${r}`);let a=o-Nt,l=i[a];return l||(n?.replacement??"\uFFFD")}function Xo(e,t){let n=C.parse(t),r=Gt(n),i=[...e][0];if(i)return r.get(i)}function Yo(e,t,n){let r=C.parse(t),o={replacement:"\uFFFD",interpretControlChars:false,...n},i=[];for(let a=0;a<e.length;a++){let l=e[a];if(l===void 0)continue;let s=Fe(l,r,o);i.push(s);}return i.join("")}function Jo(e,t,n){let r=C.parse(t),o={unmappable:"replace",replacement:"?",...n},i=Gt(r),a=[],l=[...e];for(let s=0;s<l.length;s++){let u=l[s];if(!u)continue;let d=i.get(u);if(d!==void 0){a.push(d);continue}switch(o.unmappable){case "error":throw new Error(`Character '${u}' (U+${u.codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be encoded in ${r}`);case "skip":break;default:{let f=o.replacement??"?",c=i.get(f);c!==void 0?a.push(c):a.push(63);break}}}return Buffer.from(a)}function Qo(e){return C.safeParse(e).success}function ei(){return ["cp437","cp850","cp866","cp1252"]}function ti(e,t){let n=C.parse(e),r=[];for(let o=0;o<=Ht;o++)r.push(Fe(o,n,t));return r}var Vt=55296,jt=56319,$t=56320,Zt=57343;function Pe(e){return e>=55296&&e<=56319}function _e(e){return e>=56320&&e<=57343}function z(e){return e>=55296&&e<=57343}function Kt(e,t){if(t<0||t>=e.length)return false;let n=e.charCodeAt(t);return z(n)}function qt(e,t){if(!Pe(e))throw new Error(`Invalid high surrogate: 0x${e.toString(16)}`);if(!_e(t))throw new Error(`Invalid low surrogate: 0x${t.toString(16)}`);return (e-55296)*1024+(t-56320)+65536}function Xt(e){if(e<=65535)throw new Error(`Code point 0x${e.toString(16)} doesn't need surrogate encoding`);if(e>1114111)throw new Error(`Invalid code point: 0x${e.toString(16)} (exceeds U+10FFFF)`);let t=e-65536,n=(t>>10)+55296,r=(t&1023)+56320;return [n,r]}function Yt(e,t){if(t<0||t>=e.length)return -1;let n=e.codePointAt(t);return n===void 0?-1:n}function Jt(...e){return String.fromCodePoint(...e)}function*Oe(e){for(let t of e){let n=t.codePointAt(0);n!==void 0&&(yield n);}}function Qt(e){return [...Oe(e)]}function*en(e){for(let t of e)yield t;}function tn(e){let t=0;for(let n of e)t++;return t}function nn(e){return !(e<0||e>1114111||e>=55296&&e<=57343)}function rn(e){return e>=0&&e<=65535}function te(e){return e>=65536&&e<=1114111}function on(e,t){if(t<0)return "";let n=0;for(let r of e){if(n===t)return r;n++;}return ""}function an(e,t,n){let r=t<0?0:t,o="",i=0;for(let a of e){if(n!==void 0&&i>=n)break;i>=r&&(o+=a),i++;}return o}var ne=[[768,879],[6832,6911],[7616,7679],[8400,8447],[65056,65071],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2901,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6159,6159],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[65024,65039],[917760,917999]],re=new Set((function*(){for(let[e,t]of ne)for(let n=e;n<=t;n++)yield n;})());function ni(e,t){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;let[a,l]=i;if(e<a)r=o-1;else if(e>l)n=o+1;else return true}return false}function H(e){return e<768?false:re.has(e)}function ln(e){return e<768?false:ni(e,ne)}function sn(){return re.size}var Ne=[[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12736,12783],[12784,12799],[12800,13055],[13056,13311],[13312,19903],[19968,40959],[40960,42127],[42128,42191],[44032,55203],[63744,64255],[65040,65055],[65072,65103],[65104,65135],[65280,65376],[65504,65510],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[194560,195103],[196608,201551],[201552,205743]],un=[[65281,65374],[65504,65510]],ze=[[0,31],[127,159],[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[6832,6845],[6846,6846],[6847,6848],[7616,7679],[8203,8207],[8288,8292],[8294,8303],[8400,8447],[65024,65039],[65056,65071],[65279,65279],[917760,917999]],He=[[161,161],[164,164],[167,168],[170,170],[173,174],[176,180],[182,186],[188,191],[198,198],[208,208],[215,216],[222,225],[230,230],[232,234],[236,237],[240,240],[242,243],[247,250],[252,252],[254,254],[913,929],[931,937],[945,961],[963,969],[1025,1025],[1040,1103],[1105,1105],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175]],Ge=[[127744,128511],[128512,128591],[128640,128767],[129280,129535],[129536,129647],[129648,129791]];function oe(e,t){let n=0,r=t.length-1;for(;n<=r;){let o=Math.floor((n+r)/2),i=t[o];if(!i)break;let[a,l]=i;if(e<a)r=o-1;else if(e>l)n=o+1;else return true}return false}function D(e){return e<4352?false:!!(oe(e,Ne)||oe(e,Ge))}function S(e){return oe(e,ze)}function Ue(e){return oe(e,He)}function p(e,t=false){return S(e)?0:D(e)||t&&Ue(e)?2:1}var dn=typeof Intl<"u"&&"Segmenter"in Intl,Ve=null;function fn(){return dn?(Ve||(Ve=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ve):null}function*A(e){if(e.length===0)return;let t=fn();if(t)for(let n of t.segment(e))yield n.segment;else for(let n of e)yield n;}function je(e){return [...A(e)]}function cn(e){if(e.length===0)return 0;let t=fn();if(t){let r=0;for(let o of t.segment(e))r++;return r}let n=0;for(let r of e)n++;return n}function mn(e,t){if(t<0)return;let n=0;for(let r of A(e)){if(n===t)return r;n++;}}function hn(e,t,n){let r=t<0?0:t,o="",i=0;for(let a of A(e)){if(n!==void 0&&i>=n)break;i>=r&&(o+=a),i++;}return o}function le(e){if(e.length===0)return 0;let t=e.codePointAt(0);return t===void 0?0:ri(e)?2:p(t)}function ri(e){if(e.length===0)return false;let t=e.codePointAt(0);return t===void 0?false:!!(t>=127462&&t<=127487||t>=127744&&t<=129535||t>=129536&&t<=129791||t>=9728&&t<=9983||t>=9984&&t<=10175||e.includes("\uFE0F")||e.includes("\u200D"))}function ie(e){let t=0;for(let n of A(e))t+=le(n);return t}function ae(e,t){let n=0,r="";for(let o of A(e)){let i=le(o);if(n+i>t)return {text:r,width:n,truncated:true};n+=i,r+=o;}return {text:r,width:n,truncated:false}}function gn(e,t,n="\u2026"){if(ie(e)<=t)return e;let o=ie(n);if(o>=t)return ae(n,t).text;let i=t-o;return ae(e,i).text+n}function pn(){return dn}function bn(e){return je(e).reverse().join("")}var oi={replacement:"?",dropWide:true,dropCombining:true,dropAstral:true,dropZeroWidth:true,dropControl:false};function xn(e){return e>=0&&e<=31?e!==9&&e!==10&&e!==13:e===127||e>=128&&e<=159}function ii(e){return e===9||e===10||e===13}function ai(e,t,n){return n&&S(t)?ii(t)?e:"":null}function li(e,t,n,r,o){return te(t)?n||r&&D(t)?o:e:null}function si(e,t,n){if(z(t))return n.replacement;if(H(t))return n.dropCombining?"":e;if(xn(t))return n.dropControl?"":e;let r=ai(e,t,n.dropZeroWidth);if(r!==null)return r;let o=li(e,t,n.dropAstral,n.dropWide,n.replacement);return o!==null?o:n.dropWide&&D(t)?n.replacement:e}function yn(e,t){let n={...oi,...t},r="";for(let o of e){let i=o.codePointAt(0);if(i===void 0){r+=n.replacement;continue}r+=si(o,i,n);}return r}function Cn(e,t="?"){let n="";for(let r of e){let o=r.codePointAt(0);if(o===void 0){n+=t;continue}o>=32&&o<=126||o===9||o===10||o===13?n+=r:n+=t;}return n}function Sn(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!S(r)&&(t+=n);}return t}function Ln(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!H(r)&&(t+=n);}return t}function kn(e){let t="";for(let n of e){let r=n.codePointAt(0);r!==void 0&&!xn(r)&&(t+=n);}return t}function Tn(e){return e.normalize("NFC")}function Rn(e){return e.normalize("NFD")}function An(e){return e.normalize("NFKC")}function wn(e){return e.normalize("NFKD")}function En(e,t=false){return p(e,t)}function G(e,t=false){if(e.length===0)return 0;let n=e.codePointAt(0);return n===void 0?0:p(n,t)}function Mn(e,t,n=false){if(t<0)return -1;let r=0;for(let o of e){if(r===t){let i=o.codePointAt(0);return i===void 0?0:p(i,n)}r++;}return -1}var ue=8,de=9;function b(e,t){let n=t?.tabWidth??ue,r=t?.ambiguousAsWide??false,o=0;for(let i of e){let a=i.codePointAt(0);if(a!==void 0){if(a===de){let l=o%n;o+=n-l;continue}o+=p(a,r);}}return o}function Wn(e,t){return b(e,t)}function $e(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??ue,i=0,a="";for(let l of e){let s=l.codePointAt(0);if(s===void 0)continue;let u;if(s===de){let d=i%o;u=o-d;}else u=p(s,r);if(i+u>t)return {text:a,width:i,truncated:true};i+=u,a+=l;}return {text:a,width:i,truncated:false}}function se(e,t,n){return $e(e,t,n).text}function In(e,t,n="\u2026",r){if(b(e,r)<=t)return e;let i=b(n,r);if(i>=t)return se(n,t,r);let a=t-i;return se(e,a,r)+n}function Dn(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/i);return e+n.repeat(l)}function vn(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/i);return n.repeat(l)+e}function Bn(e,t,n=" ",r){let o=b(e,r);if(o>=t)return e;let i=G(n,r?.ambiguousAsWide);if(i===0)return e;let a=t-o,l=Math.floor(a/2),s=a-l,u=Math.floor(l/i),d=Math.floor(s/i);return n.repeat(u)+e+n.repeat(d)}function Fn(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??ue;if(t<0)return -1;let i=0,a=0;for(let l of e){let s=l.codePointAt(0);if(s===void 0){a++;continue}let u;if(s===de){let d=i%o;u=o-d;}else u=p(s,r);if(t>=i&&t<i+u||u===0&&t===i)return a;i+=u,a++;}return -1}function Pn(e,t,n){let r=n?.ambiguousAsWide??false,o=n?.tabWidth??ue;if(t<0)return -1;let i=0,a=0;for(let l of e){if(a===t)return i;let s=l.codePointAt(0);if(s===void 0){a++;continue}let u;if(s===de){let d=i%o;u=o-d;}else u=p(s,r);i+=u,a++;}return -1}function _n(e){for(let t of e){let n=t.codePointAt(0);if(n!==void 0&&p(n)===2)return true}return false}function On(e){for(let t of e){let n=t.codePointAt(0);if(n!==void 0&&S(n))return true}return false}var Nn=z$1.object({codePoint:z$1.number().int().nonnegative(),width:z$1.number().int().min(0).max(2)}),zn=z$1.object({terminal:z$1.string().min(1),overrides:z$1.array(Nn)});function ui(){return [{label:"Family emoji (ZWJ sequence)",input:"\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",expectedWidth:2,category:"emoji-zwj",notes:"Most terminals render as single 2-wide glyph, some render 8-wide"},{label:"Couple with heart (ZWJ)",input:"\u{1F469}\u200D\u2764\uFE0F\u200D\u{1F468}",expectedWidth:2,category:"emoji-zwj",notes:"ZWJ joins three characters into one grapheme"},{label:"Person with white hair (ZWJ)",input:"\u{1F9D1}\u200D\u{1F9B3}",expectedWidth:2,category:"emoji-zwj"},{label:"Pirate flag (ZWJ)",input:"\u{1F3F4}\u200D\u2620\uFE0F",expectedWidth:2,category:"emoji-zwj"},{label:"ZWJ character alone",input:"\u200D",expectedWidth:0,category:"emoji-zwj"},{label:"US flag (regional indicators)",input:"\u{1F1FA}\u{1F1F8}",expectedWidth:2,category:"regional-indicators",notes:"Two regional indicators form a flag"},{label:"Japan flag",input:"\u{1F1EF}\u{1F1F5}",expectedWidth:2,category:"regional-indicators"},{label:"Single regional indicator",input:"\u{1F1FA}",expectedWidth:2,category:"regional-indicators",notes:"Unpaired regional indicators vary by terminal"},{label:"Text presentation (VS15)",input:"\u2764\uFE0E",expectedWidth:1,category:"variation-selectors",notes:"VS15 forces text presentation (narrow)"},{label:"Emoji presentation (VS16)",input:"\u2764\uFE0F",expectedWidth:2,category:"variation-selectors",notes:"VS16 forces emoji presentation (wide)"},{label:"Number sign with VS16",input:"#\uFE0F\u20E3",expectedWidth:2,category:"variation-selectors",notes:"Keycap sequence"},{label:"Variation selector alone",input:"\uFE0F",expectedWidth:0,category:"variation-selectors"},{label:"CJK ideograph (U+4E2D)",input:"\u4E2D",expectedWidth:2,category:"cjk"},{label:'CJK string "\u4E2D\u6587\u6D4B\u8BD5"',input:"\u4E2D\u6587\u6D4B\u8BD5",expectedWidth:8,category:"cjk"},{label:"Hangul syllable (\uAC00)",input:"\uAC00",expectedWidth:2,category:"cjk"},{label:"Katakana (\u30AB\u30BF\u30AB\u30CA)",input:"\u30AB\u30BF\u30AB\u30CA",expectedWidth:8,category:"cjk"},{label:"CJK compatibility ideograph",input:"\uF900",expectedWidth:2,category:"cjk"},{label:"Latin a + combining acute",input:"a\u0301",expectedWidth:1,category:"combining"},{label:"Multiple combining marks (Zalgo-style)",input:"a\u0300\u0301\u0302\u0303",expectedWidth:1,category:"combining",notes:"All combining marks are zero-width"},{label:"Devanagari with combining",input:"\u0915\u094D\u0937",expectedWidth:2,category:"combining",notes:"Consonant cluster"},{label:"Korean jamo with combining",input:"\u1100\u1161",expectedWidth:2,category:"combining",notes:"Lead + vowel jamo"},{label:"Single tab",input:" ",expectedWidth:8,category:"tabs",notes:"Default tab width is 8"},{label:"Tab after 3 chars",input:"abc ",expectedWidth:8,category:"tabs",notes:"Tab extends to next 8-column boundary"},{label:"Null character",input:"\0",expectedWidth:0,category:"control"},{label:"Bell character",input:"\x07",expectedWidth:0,category:"control"},{label:"Backspace",input:"\b",expectedWidth:0,category:"control"},{label:"Soft hyphen",input:"\xAD",expectedWidth:1,category:"control",notes:"Soft hyphen is technically a format character but width=1 in most terminals"},{label:"Fullwidth A",input:"\uFF21",expectedWidth:2,category:"fullwidth"},{label:"Fullwidth digits",input:"\uFF10\uFF11\uFF12",expectedWidth:6,category:"fullwidth"},{label:"Fullwidth exclamation mark",input:"\uFF01",expectedWidth:2,category:"fullwidth"},{label:"Halfwidth katakana",input:"\uFF66",expectedWidth:1,category:"halfwidth"},{label:"Halfwidth Hangul",input:"\uFFA0",expectedWidth:1,category:"halfwidth"},{label:"Greek alpha",input:"\u03B1",expectedWidth:1,category:"ambiguous",notes:"Ambiguous width - 1 in Western locale, 2 in CJK locale"},{label:"Box drawing (light horizontal)",input:"\u2500",expectedWidth:1,category:"ambiguous"},{label:"Bullet (\u2022)",input:"\u2022",expectedWidth:1,category:"ambiguous"},{label:"Musical symbol (U+1D11E)",input:"\u{1D11E}",expectedWidth:1,category:"surrogate-pairs"},{label:"Emoji face (U+1F600)",input:"\u{1F600}",expectedWidth:2,category:"surrogate-pairs"},{label:"Skin tone modifier (U+1F3FD)",input:"\u{1F44B}\u{1F3FD}",expectedWidth:2,category:"surrogate-pairs",notes:"Waving hand + medium skin tone"},{label:"ASCII + CJK mixed",input:"Hello\u4E16\u754C",expectedWidth:9,category:"mixed"},{label:"Emoji + text mixed",input:"\u{1F389} Party!",expectedWidth:9,category:"mixed"},{label:"Empty string",input:"",expectedWidth:0,category:"mixed"},{label:"Newline only",input:`
9
- `,expectedWidth:0,category:"mixed"}]}function di(){return [{label:"Family ZWJ emoji",input:"\u{1F468}\u200D\u{1F469}\u200D\u{1F467}\u200D\u{1F466}",expectedWidth:2,terminalWidths:{"xterm-256color":8,kitty:2,alacritty:2,wezterm:2,"gnome-terminal":2,iterm2:2,"windows-terminal":2},severity:"major"},{label:"Flag sequence (regional indicators)",input:"\u{1F1FA}\u{1F1F8}",expectedWidth:2,terminalWidths:{"xterm-256color":4,kitty:2,alacritty:2,wezterm:2,iterm2:2},severity:"major"},{label:"Unpaired regional indicator",input:"\u{1F1FA}",expectedWidth:2,terminalWidths:{"xterm-256color":2,kitty:1,alacritty:2},severity:"minor"},{label:"Skin tone emoji",input:"\u{1F44B}\u{1F3FD}",expectedWidth:2,terminalWidths:{"xterm-256color":4,kitty:2,alacritty:2,iterm2:2},severity:"major"},{label:"VS16 heart emoji",input:"\u2764\uFE0F",expectedWidth:2,terminalWidths:{"xterm-256color":1,kitty:2,alacritty:2,iterm2:2},severity:"minor"},{label:"Keycap sequence #\uFE0F\u20E3",input:"#\uFE0F\u20E3",expectedWidth:2,terminalWidths:{"xterm-256color":2,kitty:2,alacritty:1},severity:"minor"},{label:"Devanagari conjunct",input:"\u0915\u094D\u0937",expectedWidth:2,terminalWidths:{"xterm-256color":1,kitty:2,alacritty:1},severity:"minor"},{label:"Zalgo text (heavy combining)",input:"a\u0300\u0301\u0302\u0303\u0304\u0305\u0306\u0307",expectedWidth:1,terminalWidths:{"xterm-256color":1,kitty:1,alacritty:1},severity:"critical"}]}var B=new Map;function fi(e){let t=zn.parse(e);for(let n of t.overrides)B.set(n.codePoint,n.width);}function ci(){B.clear();}function mi(){return B.size}function hi(e){return B.get(e)??null}function gi(e,t){if(B.size===0)return b(e,t);let n=t?.tabWidth??8,r=0,o=0;for(let i=0;i<e.length;i++){let a=e.codePointAt(i);if(a===void 0)continue;if(a===10){o=0;continue}if(a===9){let s=n-o%n;r+=s,o+=s;continue}let l=B.get(a);if(l!==void 0)r+=l,o+=l;else {let s=p(a);r+=s,o+=s;}a>65535&&i++;}return r}function pi(e,t){let n=[],r=0;for(let o of e){let i=b(o.input,t);i===o.expectedWidth?r++:n.push({testCase:o,actualWidth:i});}return {total:e.length,passed:r,failed:n.length,failures:n}}function bi(e,t){return e.filter(n=>n.category===t)}function xi(e){let t=new Set;for(let n of e)t.add(n.category);return [...t]}function yi(e){let t=[];if(t.push(`Width Test Results: ${e.passed}/${e.total} passed`),t.push(""),e.failures.length===0)return t.push("All tests passed!"),t.join(`
10
- `);t.push(`Failures (${e.failed}):`);for(let n of e.failures)t.push(` [${n.testCase.category}] ${n.testCase.label}`),t.push(` Expected: ${n.testCase.expectedWidth}, Got: ${n.actualWidth}`),t.push(` Input: ${JSON.stringify(n.testCase.input)}`),n.testCase.notes&&t.push(` Note: ${n.testCase.notes}`);return t.join(`
11
- `)}var Ci=1e3,Hn=100;function fe(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return t>>>0}function Si(e){return {width:e,entries:new Map,dirty:new Set,totalLines:0,lineOffsets:[],fullInvalidate:true}}function Li(e){e.entries.clear(),e.dirty.clear(),e.totalLines=0,e.lineOffsets.length=0,e.fullInvalidate=true;}function ki(e,t){if(e.width!==t){e.width=t,e.fullInvalidate=true;for(let[n]of e.entries)e.dirty.add(n);}}function Ti(e,t,n,r){if(t<=0)return {lines:[""],breakPoints:[0]};if(e.length===0)return {lines:[""],breakPoints:[0]};let o=Ri();for(let i=0;i<=e.length;i++)Ii(o,e,i,t,n,r);return {lines:o.lines,breakPoints:o.breakPoints}}function Ri(){return {lines:[],breakPoints:[0],lineStart:0,lineWidth:0,wordWidth:0,lastBreakable:-1,lastBreakableWidth:0}}function Ai(e,t,n,r){let o=t.slice(e.lineStart,n);(o.length>0||e.lines.length===0)&&(e.lines.push(o),r||e.breakPoints.push(n+1)),wi(e,n+1);}function wi(e,t){e.lineStart=t,e.lineWidth=0,e.wordWidth=0,e.lastBreakable=-1,e.lastBreakableWidth=0;}function Ei(e,t,n){e.lastBreakable=t,e.lastBreakableWidth=e.lineWidth,e.wordWidth=0,e.lineWidth+=n;}function Mi(e,t){e.wordWidth+=t,e.lineWidth+=t;}function Wi(e,t,n,r,o,i){if(e.lastBreakable>=e.lineStart&&!i){let a=t.slice(e.lineStart,e.lastBreakable);e.lines.push(a),e.breakPoints.push(e.lastBreakable+1),e.lineStart=e.lastBreakable+1,e.lineWidth=e.lineWidth-e.lastBreakableWidth-1,e.lastBreakable=-1;return}if(i||e.wordWidth>o){let a=t.slice(e.lineStart,n);e.lines.push(a),e.breakPoints.push(n),e.lineStart=n,e.lineWidth=r,e.wordWidth=r,e.lastBreakable=-1;}}function Ii(e,t,n,r,o,i){let a=n<t.length?t[n]:void 0,l=n===t.length;if(a===`
12
- `||l){Ai(e,t,n,l);return}let u=i?b(a??""):1;a===" "||a===" "?Ei(e,n,u):Mi(e,u),e.lineWidth>r&&Wi(e,t,n,u,r,o);}function Ze(e,t,n,r){let{lines:o,breakPoints:i}=Ti(e,t,n,r);return {text:e,hash:fe(e),width:t,lines:o,breakPoints:i}}function Di(e,t,n){let r=n?.width??e.width,o=n?.breakWord??false,i=n?.unicodeWidth??true,a=t.split(`
13
- `),l=[];e.lineOffsets.length=0;let s=0;for(let u=0;u<a.length;u++){let d=a[u];if(d===void 0)continue;e.lineOffsets.push(s);let f=e.entries.get(u),c=fe(d);if(f&&f.hash===c&&f.width===r&&!e.dirty.has(u)&&!e.fullInvalidate){l.push(...f.lines),s+=f.lines.length;continue}let m=Ze(d,r,o,i);e.entries.set(u,m),e.dirty.delete(u),l.push(...m.lines),s+=m.lines.length;}e.totalLines=s,e.fullInvalidate=false;for(let[u]of e.entries)u>=a.length&&e.entries.delete(u);return l}function vi(e,t,n,r,o){let i=performance.now(),a=o?.width??e.width,l=o?.breakWord??false,s=o?.unicodeWidth??true,u=t.split(`
14
- `),d=[],f=Bi(e,n),c=f.currentLine,m=f.targetParagraph,h=0,g=u.length;for(let x=m;x<g&&c<r;x++){let St=u[x];if(St===void 0)continue;let kr=Fi(e,x,St,a,l,s);c=Pi(d,kr.lines,c,n,r),h=x+1;}let W=performance.now()-i;return {lines:d,hasMore:h<g,nextParagraph:h,timeMs:W}}function Bi(e,t){let n=0,r=0;if(e.lineOffsets.length===0||e.fullInvalidate)return {targetParagraph:n,currentLine:r};for(let o=0;o<e.lineOffsets.length;o++){let i=e.lineOffsets[o];if(i!==void 0&&i<=t)n=o,r=i;else break}return {targetParagraph:n,currentLine:r}}function Fi(e,t,n,r,o,i){let a=e.entries.get(t),l=fe(n);if(a&&a.hash===l&&a.width===r&&!e.dirty.has(t)&&!e.fullInvalidate)return a;let s=Ze(n,r,o,i);return e.entries.set(t,s),e.dirty.delete(t),s}function Pi(e,t,n,r,o){let i=n;for(let a=0;a<t.length;a++){if(i>=r&&i<o){let l=t[a];l!==void 0&&e.push(l);}i++;}return i}function _i(e,t,n,r=Hn,o){let i=performance.now(),a=o?.width??e.width,l=o?.breakWord??false,s=o?.unicodeWidth??true,u=t.split(`
15
- `),d=[],f=Math.min(n+r,u.length);for(let m=n;m<f;m++){let h=u[m];if(h===void 0)continue;let g=e.entries.get(m),W=fe(h),x;g&&g.hash===W&&g.width===a&&!e.dirty.has(m)&&!e.fullInvalidate?x=g:(x=Ze(h,a,l,s),e.entries.set(m,x),e.dirty.delete(m)),d.push(...x.lines);}let c=performance.now()-i;return {lines:d,hasMore:f<u.length,nextParagraph:f,timeMs:c}}function Oi(e,t,n){for(let r=t;r<n;r++)e.dirty.add(r);}function Ni(e,t){e.dirty.add(t);}function zi(e){e.fullInvalidate=true;}function Hi(e,t){if(t<0||t>=e.totalLines)return;let n=0,r=e.lineOffsets.length-1,o=0;for(;n<=r;){let u=Math.floor((n+r)/2),d=e.lineOffsets[u];if(d===void 0)break;d<=t?(o=u,n=u+1):r=u-1;}let i=e.lineOffsets[o]??0,a=t-i,s=e.entries.get(o)?.breakPoints[a]??0;return {paragraph:o,lineInParagraph:a,charOffset:s}}function Gi(e,t,n=0){if(t<0||t>=e.lineOffsets.length)return -1;let r=e.lineOffsets[t];return r===void 0?-1:r+n}function Ui(e){return {cachedParagraphs:e.entries.size,dirtyParagraphs:e.dirty.size,totalLines:e.totalLines,width:e.width,fullInvalidate:e.fullInvalidate}}var Vi={minFoldableLines:2,labelTemplate:"... {count} lines",maxDepth:10};function ji(e,t){return {config:{...Vi,...t},regions:new Map,totalDocumentLines:e,nextId:0}}function $i(e,t,n,r){let o=n-t;if(o<e.config.minFoldableLines||t<0||n>=e.totalDocumentLines||t>=n)return;let i=`fold-${e.nextId++}`,a=la(e,t,n);if(a>=e.config.maxDepth)return;let l=r??e.config.labelTemplate.replace("{count}",String(o)),s={id:i,startLine:t,endLine:n,folded:false,label:l,depth:a};return e.regions.set(i,s),i}function Zi(e,t){return e.regions.delete(t)}function Ki(e,t){let n=e.regions.get(t);return !n||n.folded?false:(e.regions.set(t,{...n,folded:true}),true)}function qi(e,t){let n=e.regions.get(t);return !n||!n.folded?false:(e.regions.set(t,{...n,folded:false}),true)}function Xi(e,t){let n=e.regions.get(t);if(!n)return;let r=!n.folded;return e.regions.set(t,{...n,folded:r}),r}function Yi(e){let t=0;for(let[n,r]of e.regions)r.folded||(e.regions.set(n,{...r,folded:true}),t++);return t}function Ji(e){let t=0;for(let[n,r]of e.regions)r.folded&&(e.regions.set(n,{...r,folded:false}),t++);return t}function Qi(e,t){let n=0;for(let[r,o]of e.regions)o.depth>=t&&!o.folded&&(e.regions.set(r,{...o,folded:true}),n++);return n}function ea(e,t){let n;for(let r of e.regions.values())t>=r.startLine&&t<=r.endLine&&(!n||r.depth>n.depth)&&(n=r);return n}function ta(e){return Array.from(e.regions.values()).sort((t,n)=>t.startLine-n.startLine)}function na(e,t,n){let r=me(e),o=[],i=0,a=0;for(;i<t&&a<e.totalDocumentLines;){let l=ce(r,a);l?(i++,a=l.endLine+1):(i++,a++);}for(;o.length<n&&a<e.totalDocumentLines;){let l=ce(r,a);l?(o.push({originalLine:l.startLine,isFoldPlaceholder:true,foldId:l.id,foldLabel:l.label,hiddenLines:l.endLine-l.startLine}),a=l.endLine+1):(o.push({originalLine:a,isFoldPlaceholder:false,foldId:void 0,foldLabel:void 0,hiddenLines:0}),a++);}return o}function ra(e,t){let n=me(e),r=0,o=0;for(;r<t&&o<e.totalDocumentLines;){let i=ce(n,o);i?(r++,o=i.endLine+1):(r++,o++);}return o}function oa(e,t){let n=me(e),r=0,o=0;for(;o<t&&o<e.totalDocumentLines;){let i=ce(n,o);if(i){if(r++,t>i.startLine&&t<=i.endLine)return -1;o=i.endLine+1;}else r++,o++;}return r}function ia(e){let t=0,n=0,r=0,o=me(e);for(let i of o)t++,n+=i.endLine-i.startLine;for(let i of e.regions.values())i.depth>r&&(r=i.depth),i.folded&&(t=Math.max(t,t));return {totalRegions:e.regions.size,foldedRegions:t,hiddenLines:n,visibleLines:e.totalDocumentLines-n,maxDepth:r}}function aa(e,t){e.totalDocumentLines=t;for(let[n,r]of e.regions)(r.startLine>=t||r.endLine>=t)&&e.regions.delete(n);}function la(e,t,n){let r=0;for(let o of e.regions.values())o.startLine<=t&&o.endLine>=n&&(r=Math.max(r,o.depth+1));return r}function me(e){let t=[];for(let r of e.regions.values())r.folded&&t.push({id:r.id,startLine:r.startLine,endLine:r.endLine,label:r.label});t.sort((r,o)=>r.startLine-o.startLine);let n=[];for(let r of t){let o=n[n.length-1];if(o&&r.startLine<=o.endLine){r.endLine>o.endLine&&(n[n.length-1]={...o,endLine:r.endLine});continue}n.push(r);}return n}function ce(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=n+r>>>1,i=e[o];if(!i)break;if(t<i.startLine)r=o-1;else if(t>i.endLine)n=o+1;else return i}}var sa=z$1.object({caseSensitive:z$1.boolean().default(false),threshold:z$1.number().min(0).max(1).default(0),limit:z$1.number().int().positive().optional(),consecutiveBonus:z$1.number().min(0).max(1).default(.3),wordBoundaryBonus:z$1.number().min(0).max(1).default(.2),prefixBonus:z$1.number().min(0).max(1).default(.5),gapPenalty:z$1.number().min(0).max(1).default(.1)}),ua={caseSensitive:false,threshold:0,limit:void 0,consecutiveBonus:.3,wordBoundaryBonus:.2,prefixBonus:.5,gapPenalty:.1};function Ke(e={}){return {...ua,...e}}function da(e,t){if(t===0)return true;let n=e[t-1],r=e[t];return !n||!r?false:n===" "||n==="_"||n==="-"||n==="/"||n===n.toLowerCase()&&r===r.toUpperCase()}function fa(e,t,n,r,o,i){let a=e.length/Math.max(t.length,e.length),l=0,s=-2;for(let u=0;u<o.length;u++){let d=o[u];if(d!==void 0){if(d===s+1)l++,a+=i.consecutiveBonus*(l/e.length);else if(l=0,s>=0){let f=d-s-1;a-=i.gapPenalty*(f/t.length);}da(t,d)&&(a+=i.wordBoundaryBonus/e.length),s=d;}}return o[0]===0&&(a+=i.prefixBonus),n===r&&(a=1),Math.max(0,Math.min(1,a))}function he(e,t,n={}){let r=Ke(n);if(!e)return {item:t,text:t,score:1,indices:[]};let o=r.caseSensitive?e:e.toLowerCase(),i=r.caseSensitive?t:t.toLowerCase(),a=[],l=0,s=0;for(;l<o.length&&s<i.length;)o[l]===i[s]&&(a.push(s),l++),s++;if(l!==o.length)return null;let u=fa(e,t,o,i,a,r);return {item:t,text:t,score:u,indices:a}}function Gn(e,t,n={}){let r=Ke(n),o=[];for(let i of t){let a=he(e,i,r);a&&a.score>=(r.threshold||0)&&o.push(a);}return o.sort((i,a)=>a.score-i.score),r.limit!==void 0&&o.length>r.limit?o.slice(0,r.limit):o}function ca(e,t,n){let{getText:r=String,...o}=n,i=Ke(o),a=[];for(let l of t){let s=r(l),u=he(e,s,i);u&&u.score>=(i.threshold||0)&&a.push({item:l,text:s,score:u.score,indices:u.indices});}return a.sort((l,s)=>s.score-l.score),i.limit!==void 0&&a.length>i.limit?a.slice(0,i.limit):a}function ma(e,t,n=r=>`[${r}]`){let r=new Set(t),o="";for(let i=0;i<e.length;i++){let a=e[i];a!==void 0&&(r.has(i)?o+=n(a):o+=a);}return o}function ha(e,t,n={}){return Gn(e,t,n).map(o=>o.item)}function ga(e,t,n={}){let r=he(e,t,n);return r!==null&&r.score>=(n.threshold??0)}function Vn(e,t){let n={...e};for(let r in t)if(Object.hasOwn(t,r)){let o=t[r],i=n[r];o!==null&&typeof o=="object"&&!Array.isArray(o)&&i!==null&&typeof i=="object"&&!Array.isArray(i)?n[r]=Vn(i,o):n[r]=o;}return n}function pa(e,t){return {...e,...t}}function ba(e){return [...e].sort((t,n)=>{let r=t.name.startsWith("."),o=n.name.startsWith(".");return r&&!o?1:!r&&o?-1:t.name.toLowerCase().localeCompare(n.name.toLowerCase())})}function xa(e){return [...e].sort((t,n)=>t.index-n.index)}function ya(e){return [...e].sort((t,n)=>n.priority-t.priority)}function Ca(e,t,n=false){return [...e].sort((r,o)=>{let i=t(r),a=t(o),l;return typeof i=="string"&&typeof a=="string"?l=i.localeCompare(a):l=i-a,n?-l:l})}var jn=new Set(["node_modules",".git",".svn",".hg","dist","build","coverage",".cache",".next","__pycache__"]);function Sa(e,t,n){let r=n?.maxDepth??10,o=new Set([...jn,...n?.excludeDirs??[]]);function i(a,l){if(l>r)return null;let s=$n(a);if(!s)return null;let u=ka(s,a,t);return u||Ta(s,a,l,r,o,i)}return i(k.resolve(e),0)}function La(e,t,n){let r=n?.maxDepth??10,o=new Set([...jn,...n?.excludeDirs??[]]),i=n?.maxResults??Number.POSITIVE_INFINITY,a=[];function l(s,u){if(u>r||a.length>=i)return;let d=$n(s);d&&(Ra(d,s,t,a,i),Aa(d,s,u,r,o,a,i,l));}return l(k.resolve(e),0),a}function $n(e){try{return Un.readdirSync(e,{withFileTypes:!0})}catch{return null}}function ka(e,t,n){for(let r of e)if(r.name===n&&r.isFile())return k.join(t,r.name);return null}function Ta(e,t,n,r,o,i){for(let a of e){if(!a.isDirectory()||o.has(a.name))continue;let l=i(k.join(t,a.name),n+1);if(l)return l}return null}function Ra(e,t,n,r,o){for(let i of e){if(r.length>=o)return;i.name===n&&i.isFile()&&r.push(k.join(t,i.name));}}function Aa(e,t,n,r,o,i,a,l){for(let s of e){if(i.length>=a)return;!s.isDirectory()||o.has(s.name)||l(k.join(t,s.name),n+1);}}function wa(e){return [...new Set(e)]}function Ea(e,t){let n=new Set,r=[];for(let o of e){let i=t(o);n.has(i)||(n.add(i),r.push(o));}return r}function Ma(e,t){let n=new Map;for(let r of e){let o=t(r),i=n.get(o);i?i.push(r):n.set(o,[r]);}return n}function Wa(e,t){let n=[],r=[];for(let o of e)t(o)?n.push(o):r.push(o);return [n,r]}var Ia={chunkSize:1e3,maxCachedChunks:50,readAheadLines:500,readBehindLines:200,maxMemoryBytes:104857600};function Da(e,t){return {config:{...Ia,...t},source:e,chunks:new Map,accessOrder:[],hits:0,misses:0}}function va(e,t,n){let r={start:Math.max(0,t),end:Math.min(n,e.source.totalLines)},o=[],i=e.config.chunkSize,a=Math.floor(r.start/i),l=Math.floor(Math.max(0,r.end-1)/i);for(let s=a;s<=l;s++){let u=Kn(e,s);if(!u)continue;let d=s*i,f=Math.max(0,r.start-d),c=Math.min(u.lines.length,r.end-d);for(let m=f;m<c;m++){let h=u.lines[m];h!==void 0&&o.push(h);}}return o}function Ba(e,t,n){let{readAheadLines:r,readBehindLines:o,chunkSize:i}=e.config,a=Math.max(0,t-o),l=Math.min(e.source.totalLines,n+r),s=Math.floor(a/i),u=Math.floor(Math.max(0,l-1)/i);for(let d=s;d<=u;d++)Kn(e,d);}function Zn(e,t){let n=t??e.config.maxCachedChunks,r=0;for(;e.chunks.size>n&&e.accessOrder.length>0;){let o=e.accessOrder.shift();if(o===void 0)break;e.chunks.has(o)&&(e.chunks.delete(o),r++);}return r}function Fa(e){e.chunks.clear(),e.accessOrder=[],e.hits=0,e.misses=0;}function Pa(e){let t=0;for(let r of e.chunks.values())t+=r.byteSize;let n=e.hits+e.misses;return {config:e.config,totalLines:e.source.totalLines,loadedChunks:e.chunks.size,memoryUsage:t,hitRate:n>0?e.hits/n:0}}function _a(e,t,n){let r=e.config.chunkSize,o=Math.floor(t/r),i=Math.floor(Math.max(0,n-1)/r);for(let a=o;a<=i;a++)if(!e.chunks.has(a))return false;return true}function Oa(e){return {totalLines:e.length,isExactCount:true,loadRange:(t,n)=>e.slice(t,n)}}function Kn(e,t){let n=e.chunks.get(t);if(n)return e.hits++,Na(e,t),{...n,lastAccessedAt:Date.now()};e.misses++;let r=e.config.chunkSize,o=t*r,i=Math.min(o+r,e.source.totalLines);if(o>=e.source.totalLines)return;e.chunks.size>=e.config.maxCachedChunks&&Zn(e,e.config.maxCachedChunks-1);let a=e.source.loadRange(o,i),l=0;for(let u of a)l+=u.length*2;let s={index:t,startLine:o,endLine:i,lines:a,byteSize:l,lastAccessedAt:Date.now()};return e.chunks.set(t,s),e.accessOrder.push(t),s}function Na(e,t){let n=e.accessOrder.indexOf(t);n>=0&&e.accessOrder.splice(n,1),e.accessOrder.push(t);}var qe={mode:"absolute",minWidth:3,rightPadding:1,padChar:" ",separator:"\u2502",highlightCurrent:true};function ge(e,t){if(e<=0)return t;let n=Math.floor(Math.log10(e))+1;return Math.max(n,t)}function qn(e,t){let n={...qe,...t};return e+n.rightPadding+1}function za(e){return {...qe,...e}}function Xn(e,t,n,r){let o=e===t;if(r==="absolute")return String(e).padStart(n," ");if(r==="relative"){if(o)return String(e).padStart(n," ");let a=Math.abs(e-t);return String(a).padStart(n," ")}if(o)return String(e).padStart(n," ");let i=Math.abs(e-t);return String(i).padStart(n," ")}function Ha(e,t,n,r,o){let i={...qe,...o},a=ge(e,i.minWidth),l=qn(a,i),s=[],u=Math.min(t+n,e);for(let d=t;d<u;d++){let f=d+1,c=f===r,h=Xn(f,r,a,i.mode)+i.padChar.repeat(i.rightPadding)+i.separator;s.push({text:h,isCurrent:c,lineNumber:f,width:l});}return {lines:s,gutterWidth:l,digitWidth:a,totalLines:e}}function Ga(e,t,n=3){return ge(e,n)!==ge(t,n)}function Ua(e,t,n,r="\x1B[0m"){return e.lines.map(o=>`${o.isCurrent?t:n}${o.text}${r}`)}var Va=100,pe={inString:null,inComment:false,templateDepth:0,commentDepth:0},U={name:"javascript",extensions:[".js",".jsx",".ts",".tsx",".mjs",".cjs"],keywords:new Set(["async","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","of","package","private","protected","public","return","static","super","switch","this","throw","try","type","typeof","var","void","while","with","yield","as","is","keyof","readonly","declare","namespace","abstract","satisfies"]),builtins:new Set(["Array","Boolean","Date","Error","Function","JSON","Math","Number","Object","Promise","RegExp","String","Symbol","Map","Set","WeakMap","WeakSet","console","window","document","globalThis","process","require","module","exports","Buffer","setTimeout","setInterval","clearTimeout","clearInterval","fetch","Response","Request","Headers","URL","URLSearchParams","FormData","Blob","File","FileReader","Intl","Proxy","Reflect","BigInt"]),types:new Set(["any","boolean","number","string","void","never","unknown","null","undefined","object","symbol","bigint"]),constants:new Set(["true","false","null","undefined","NaN","Infinity"]),operators:/[+\-*/%=<>!&|^~?:]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:["'",'"'],templateLiteralStart:"`",templateLiteralEnd:"`",numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?n?)\b/,identifierPattern:/[a-zA-Z_$][a-zA-Z0-9_$]*/,nestedComments:false},V={name:"python",extensions:[".py",".pyw",".pyi"],keywords:new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","match","case"]),builtins:new Set(["abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__"]),types:new Set(["int","float","str","bool","list","dict","set","tuple","bytes","None"]),constants:new Set(["True","False","None","Ellipsis","NotImplemented","__debug__"]),operators:/[+\-*/%=<>!@&|^~:]+/,lineComment:"#",blockCommentStart:null,blockCommentEnd:null,stringDelimiters:["'",'"',"'''",'"""'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?[jJ]?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},be={name:"rust",extensions:[".rs"],keywords:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","macro_rules"]),builtins:new Set(["Option","Some","None","Result","Ok","Err","Box","Vec","String","HashMap","HashSet","Rc","Arc","RefCell","Cell","Mutex","RwLock","println","eprintln","print","eprint","format","panic","assert","assert_eq","assert_ne","debug_assert","todo","unimplemented","unreachable","cfg","derive"]),types:new Set(["bool","char","str","u8","u16","u32","u64","u128","usize","i8","i16","i32","i64","i128","isize","f32","f64","()"]),constants:new Set(["true","false"]),operators:/[+\-*/%=<>!&|^~?:@]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:['"'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?(?:_?(?:u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|f32|f64))?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:true},Xe={name:"go",extensions:[".go"],keywords:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"]),builtins:new Set(["append","cap","close","complex","copy","delete","imag","len","make","new","panic","print","println","real","recover"]),types:new Set(["bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),constants:new Set(["true","false","nil","iota"]),operators:/[+\-*/%=<>!&|^~:]+/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",stringDelimiters:['"',"'","`"],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][+-]?\d[\d_]*)?i?)\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},xe={name:"shell",extensions:[".sh",".bash",".zsh",".fish"],keywords:new Set(["if","then","else","elif","fi","case","esac","for","while","until","do","done","in","function","select","time","coproc","return","exit","break","continue","local","declare","typeset","readonly","export","unset","shift","source","alias","unalias"]),builtins:new Set(["echo","printf","read","cd","pwd","pushd","popd","dirs","set","shopt","test","eval","exec","trap","wait","kill","jobs","fg","bg","suspend","disown","builtin","command","type","hash","help","let","true","false","getopts","bind","complete","compgen","compopt","caller","enable","mapfile","readarray","ulimit","umask"]),types:new Set([]),constants:new Set(["true","false"]),operators:/[+\-*/%=<>!&|^~?:;]+/,lineComment:"#",blockCommentStart:null,blockCommentEnd:null,stringDelimiters:['"',"'"],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b\d+\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},Ye={name:"json",extensions:[".json",".jsonc",".json5"],keywords:new Set([]),builtins:new Set([]),types:new Set([]),constants:new Set(["true","false","null"]),operators:/[:]/,lineComment:null,blockCommentStart:null,blockCommentEnd:null,stringDelimiters:['"'],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/\b-?(?:\d+)?\.?\d+(?:[eE][+-]?\d+)?\b/,identifierPattern:/[a-zA-Z_][a-zA-Z0-9_]*/,nestedComments:false},$={name:"plaintext",extensions:[".txt",".text"],keywords:new Set([]),builtins:new Set([]),types:new Set([]),constants:new Set([]),operators:/(?!)/,lineComment:null,blockCommentStart:null,blockCommentEnd:null,stringDelimiters:[],templateLiteralStart:null,templateLiteralEnd:null,numberPattern:/(?!)/,identifierPattern:/(?!)/,nestedComments:false},Je=[U,V,be,Xe,xe,Ye,$];function Qe(e){return {grammar:e,entries:new Map,dirty:new Set,lineCount:0,fullInvalidate:true}}function ja(e){e.entries.clear(),e.dirty.clear(),e.lineCount=0,e.fullInvalidate=true;}function et(e,t){if(e.grammar.name!==t.name){e.grammar=t,e.fullInvalidate=true;for(let n=0;n<e.lineCount;n++)e.dirty.add(n);}}function $a(e){return {cachedLines:e.entries.size,dirtyLines:e.dirty.size,grammar:e.grammar.name,lineCount:e.lineCount,fullInvalidate:e.fullInvalidate}}function Za(e,t,n){for(let r=t;r<n;r++)e.dirty.add(r);}function Ka(e,t){e.dirty.add(t);}function qa(e){e.fullInvalidate=true;for(let t=0;t<e.lineCount;t++)e.dirty.add(t);}function j(e,t){return e.inString===t.inString&&e.inComment===t.inComment&&e.templateDepth===t.templateDepth&&e.commentDepth===t.commentDepth}function F(e,t,n){let o=Ja(e,t,n,[]),i=Qa(e),a=Xa(i);for(;o.pos<t.length;)Ya(o,a)||o.pos++;return {text:t,tokens:o.tokens,startState:n,endState:o.state}}function Xa(e){return [el,tl,nl,rl,ol,il,al,t=>ll(t,e),fl,cl,ml,hl]}function Ya(e,t){for(let n of t)if(n(e))return true;return false}function Ja(e,t,n,r){return {grammar:e,line:t,tokens:r,pos:0,state:{...n},addToken:(o,i,a)=>{a>i&&r.push({type:o,start:i,end:a,text:t.slice(i,a)});},startsWithAt:(o,i)=>t.slice(i,i+o.length)===o}}function Qa(e){return [...e.stringDelimiters].sort((t,n)=>n.length-t.length)}function el(e){if(e.state.inString===null)return false;let t=e.state.inString,n=e.pos;for(;e.pos<e.line.length;){let r=e.line[e.pos];if(r==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(t.length===3&&e.startsWithAt(t,e.pos)||t.length===1&&r===t){e.pos+=t.length,e.state={...e.state,inString:null};break}else e.pos++;}return e.addToken("string",n,e.pos),true}function tl(e){if(!e.state.inComment||!e.grammar.blockCommentEnd)return false;let t=e.pos;for(;e.pos<e.line.length;)if(e.grammar.nestedComments&&e.grammar.blockCommentStart&&e.startsWithAt(e.grammar.blockCommentStart,e.pos))e.state={...e.state,commentDepth:e.state.commentDepth+1},e.pos+=e.grammar.blockCommentStart.length;else if(e.startsWithAt(e.grammar.blockCommentEnd,e.pos))if(e.grammar.nestedComments&&e.state.commentDepth>0)e.state={...e.state,commentDepth:e.state.commentDepth-1},e.pos+=e.grammar.blockCommentEnd.length;else {e.pos+=e.grammar.blockCommentEnd.length,e.state={...e.state,inComment:false,commentDepth:0};break}else e.pos++;return e.addToken("comment",t,e.pos),true}function nl(e){if(e.state.templateDepth<=0||!e.grammar.templateLiteralEnd)return false;let t=e.pos;for(;e.pos<e.line.length;)if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(e.startsWithAt("${",e.pos)){e.addToken("string",t,e.pos),e.pos+=2,e.addToken("punctuation",e.pos-2,e.pos);break}else if(e.startsWithAt(e.grammar.templateLiteralEnd,e.pos)){e.pos+=e.grammar.templateLiteralEnd.length,e.state={...e.state,templateDepth:e.state.templateDepth-1};break}else e.pos++;return e.pos>t&&e.addToken("string",t,e.pos),true}function rl(e){if(!/\s/.test(e.line[e.pos]||""))return false;let t=e.pos;for(;e.pos<e.line.length&&/\s/.test(e.line[e.pos]||"");)e.pos++;return e.addToken("text",t,e.pos),true}function ol(e){return !e.grammar.lineComment||!e.startsWithAt(e.grammar.lineComment,e.pos)?false:(e.addToken("comment",e.pos,e.line.length),e.pos=e.line.length,true)}function il(e){if(!e.grammar.blockCommentStart||!e.startsWithAt(e.grammar.blockCommentStart,e.pos))return false;let t=e.pos;return sl(e)||(e.state={...e.state,inComment:true}),e.addToken("comment",t,e.pos),true}function al(e){if(!e.grammar.templateLiteralStart||!e.startsWithAt(e.grammar.templateLiteralStart,e.pos))return false;let t=e.pos;for(e.pos+=e.grammar.templateLiteralStart.length;e.pos<e.line.length&&e.grammar.templateLiteralEnd;)if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length)e.pos+=2;else if(e.startsWithAt("${",e.pos)){e.addToken("string",t,e.pos),e.pos+=2,e.addToken("punctuation",e.pos-2,e.pos),e.state={...e.state,templateDepth:e.state.templateDepth+1};break}else if(e.startsWithAt(e.grammar.templateLiteralEnd,e.pos)){e.pos+=e.grammar.templateLiteralEnd.length,e.addToken("string",t,e.pos);break}else e.pos++;return e.pos>=e.line.length&&e.pos>t+1&&(e.state={...e.state,templateDepth:e.state.templateDepth+1},e.addToken("string",t,e.pos)),true}function ll(e,t){let n=ul(e,t);if(!n)return false;let r=e.pos;return e.pos+=n.length,dl(e,n),e.pos>=e.line.length&&n.length===3&&(e.state={...e.state,inString:n}),e.addToken("string",r,e.pos),true}function sl(e){if(!e.grammar.blockCommentStart||!e.grammar.blockCommentEnd)return false;for(e.pos+=e.grammar.blockCommentStart.length;e.pos<e.line.length;){if(e.grammar.nestedComments&&e.startsWithAt(e.grammar.blockCommentStart,e.pos)){e.state={...e.state,commentDepth:e.state.commentDepth+1},e.pos+=e.grammar.blockCommentStart.length;continue}if(e.startsWithAt(e.grammar.blockCommentEnd,e.pos)){if(e.grammar.nestedComments&&e.state.commentDepth>0){e.state={...e.state,commentDepth:e.state.commentDepth-1},e.pos+=e.grammar.blockCommentEnd.length;continue}return e.pos+=e.grammar.blockCommentEnd.length,true}e.pos++;}return false}function ul(e,t){for(let n of t)if(e.startsWithAt(n,e.pos))return n;return null}function dl(e,t){for(;e.pos<e.line.length;){if(e.line[e.pos]==="\\"&&e.pos+1<e.line.length){e.pos+=2;continue}if(t.length===3&&e.startsWithAt(t,e.pos)||t.length===1&&e.line[e.pos]===t){e.pos+=t.length;break}e.pos++;}}function fl(e){let t=e.grammar.numberPattern.exec(e.line.slice(e.pos));return !t||t.index!==0?false:(e.addToken("number",e.pos,e.pos+t[0].length),e.pos+=t[0].length,true)}function cl(e){let t=e.grammar.identifierPattern.exec(e.line.slice(e.pos));if(!t||t.index!==0)return false;let n=t[0],r="identifier";return e.grammar.keywords.has(n)?r="keyword":e.grammar.constants.has(n)?r="constant":e.grammar.builtins.has(n)?r="builtin":(e.grammar.types.has(n)||/^[A-Z]/.test(n))&&(r="type"),e.line.slice(e.pos+n.length).trimStart().startsWith("(")&&r==="identifier"&&(r="function"),e.addToken(r,e.pos,e.pos+n.length),e.pos+=n.length,true}function ml(e){let t=e.grammar.operators.exec(e.line.slice(e.pos));return !t||t.index!==0?false:(e.addToken("operator",e.pos,e.pos+t[0].length),e.pos+=t[0].length,true)}function hl(e){let t=e.line[e.pos]||"";return /[()[\]{},;.]/.test(t)?(e.addToken("punctuation",e.pos,e.pos+1),e.pos++,true):false}function tt(e,t){let n=t.split(`
16
- `);e.lineCount=n.length,e.fullInvalidate&&(e.entries.clear(),e.dirty.clear(),e.fullInvalidate=false);let r=[],o=pe;for(let i=0;i<n.length;i++){let a=n[i]??"",l=e.entries.get(i);if(l&&l.text===a&&j(l.startState,o)&&!e.dirty.has(i))r.push(l),o=l.endState;else {let s=F(e.grammar,a,o);e.entries.set(i,s),e.dirty.delete(i),r.push(s),o=s.endState;let u=e.entries.get(i+1);u&&!j(o,u.startState)&&e.dirty.add(i+1);}}return r}function gl(e,t,n,r){let o=performance.now(),i=t.split(`
17
- `);e.lineCount=i.length;let a=Math.max(0,n),l=Math.min(i.length,r);e.fullInvalidate&&(e.entries.clear(),e.dirty.clear(),e.fullInvalidate=false);let s=pe;for(let c=0;c<a;c++){let m=i[c]??"",h=e.entries.get(c);if(h&&h.text===m&&j(h.startState,s)&&!e.dirty.has(c))s=h.endState;else {let g=F(e.grammar,m,s);e.entries.set(c,g),e.dirty.delete(c),s=g.endState;}}let u=[];for(let c=a;c<l;c++){let m=i[c]??"",h=e.entries.get(c);if(h&&h.text===m&&j(h.startState,s)&&!e.dirty.has(c))u.push(h),s=h.endState;else {let g=F(e.grammar,m,s);e.entries.set(c,g),e.dirty.delete(c),u.push(g),s=g.endState;}}let d=l<i.length,f=performance.now()-o;return {lines:u,hasMore:d,nextLine:l,timeMs:f}}function pl(e,t,n,r=100){let o=performance.now(),i=t.split(`
18
- `);e.lineCount=i.length;let a=Math.max(0,Math.min(n,i.length)),l=Math.min(a+r,i.length),s=pe,u=e.entries.get(a-1);if(a>0&&u)s=u.endState;else if(a>0)for(let m=0;m<a;m++){let h=i[m]??"",g=e.entries.get(m);if(g&&g.text===h&&j(g.startState,s))s=g.endState;else {let W=F(e.grammar,h,s);e.entries.set(m,W),s=W.endState;}}let d=[];for(let m=a;m<l;m++){let h=i[m]??"",g=F(e.grammar,h,s);e.entries.set(m,g),e.dirty.delete(m),d.push(g),s=g.endState;}let f=l<i.length,c=performance.now()-o;return {lines:d,hasMore:f,nextLine:l,timeMs:c}}function nt(e){let t=e.slice(e.lastIndexOf(".")).toLowerCase();for(let n of Je)if(n.extensions.includes(t))return n;return $}function bl(e){let t=e.split(`
19
- `)[0]||"";if(t.startsWith("#!")){if(/python/.test(t))return V;if(/node|deno|bun/.test(t))return U;if(/bash|sh|zsh/.test(t))return xe}return /^package\s+\w+/.test(t)?Xe:/^(use\s+|mod\s+|fn\s+|struct\s+|impl\s+|pub\s+)/.test(t)?be:/^(import|from|def|class)\s+/.test(t)?V:/^(import|export|const|let|var|function|class)\s+/.test(t)?U:/^\s*\{/.test(t)?Ye:$}function rt(e){let t=e.toLowerCase();for(let n of Je)if(n.name===t)return n;return t==="ts"||t==="typescript"||t==="tsx"||t==="jsx"?U:t==="py"?V:t==="rs"?be:t==="bash"||t==="sh"||t==="zsh"?xe:$}var xl=100,Qn=/^(#{1,6})\s+(.+)$/,er=/^(`{3,}|~{3,})(\w*)?$/,tr=/^([-*_])\s*\1\s*\1\s*(\1|\s)*$/,ye=/^(\s*)[-*+]\s+(.*)$/,Ce=/^(\s*)(\d+)[.)]\s+(.*)$/,yl=/^\[([ xX])\]\s+(.*)$/,ot=/^>\s?(.*)$/,Cl=/^\|?[\s:-]+\|[\s:|+-]+\|?$/,Yn=/^\|(.+)\|$/;function T(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return t}function w(e){let t=[],n=e,r=0;for(;r<n.length;){let o=Ll(n.slice(r));if(o){r>0&&(t.push({type:"text",content:n.slice(0,r)}),n=n.slice(r),r=0),t.push(o.element),n=n.slice(o.length);continue}r++;}return n.length>0&&t.push({type:"text",content:n}),t}var Sl=[kl,Tl,Rl,Al,wl,El];function Ll(e){for(let t of Sl){let n=t(e);if(n)return n}return null}function kl(e){let t=e.match(/^`([^`]+)`/);return t?{element:{type:"code",content:t[1]??""},length:t[0].length}:null}function Tl(e){let t=e.match(/^(\*\*|__)(.+?)\1/);if(!t)return null;let n=t[2]??"";return {element:{type:"bold",content:n,children:w(n)},length:t[0].length}}function Rl(e){let t=e.match(/^(\*|_)(.+?)\1/);if(!t)return null;let n=t[2]??"";return {element:{type:"italic",content:n,children:w(n)},length:t[0].length}}function Al(e){let t=e.match(/^\[([^\]]+)\]\(([^)]+)\)/);return t?{element:{type:"link",content:t[1]??"",href:t[2]??""},length:t[0].length}:null}function wl(e){let t=e.match(/^!\[([^\]]*)\]\(([^)]+)\)/);return t?{element:{type:"image",content:t[1]??"",href:t[2]??""},length:t[0].length}:null}function El(e){let t=e.match(/^~~(.+?)~~/);return t?{element:{type:"strikethrough",content:t[1]??""},length:t[0].length}:null}function it(e){let t=performance.now(),n=e.split(`
20
- `),r=[],o=0;for(;o<n.length;){let i=n[o];if(i===void 0){o++;continue}if(i.trim()===""){o++;continue}let a=Wl(n,o);if(a){r.push(a.block),o=a.nextIndex;continue}o++;}return {blocks:r,parseTimeMs:performance.now()-t}}var Ml=[Il,Dl,vl,Bl,Fl,Pl,_l];function Wl(e,t){for(let n of Ml){let r=n(e,t);if(r)return r}return null}function Il(e,t){let n=e[t];if(n===void 0)return null;let r=n.match(Qn);if(!r)return null;let o=r[2]??"";return {block:{type:"heading",source:n,lineStart:t,lineEnd:t+1,hash:T(n),data:{kind:"heading",level:r[1]?.length??1,text:o,inline:w(o)}},nextIndex:t+1}}function Dl(e,t){let n=e[t];return n===void 0||!tr.test(n)?null:{block:{type:"hr",source:n,lineStart:t,lineEnd:t+1,hash:T(n),data:{kind:"hr"}},nextIndex:t+1}}function vl(e,t){let n=e[t];if(n===void 0)return null;let r=n.match(er);if(!r)return null;let o=r[1]??"",i=r[2]??"",a=[],l=t,s=t+1;for(;s<e.length;){let d=e[s];if(d===void 0)break;if(d.startsWith(o)&&d.trim()===o){s++;break}a.push(d),s++;}let u=a.join(`
21
- `);return {block:{type:"code",source:e.slice(l,s).join(`
22
- `),lineStart:l,lineEnd:s,hash:T(u+i),data:{kind:"code",language:i||nt("code.txt").name||"",code:u}},nextIndex:s}}function Bl(e,t){let n=e[t];if(n===void 0||!ot.test(n))return null;let r=[],o=t,i=t;for(;i<e.length;){let s=e[i];if(s===void 0)break;let u=s.match(ot);if(!u&&s.trim()!=="")break;r.push(u?u[1]??"":""),i++;}let a=r.join(`
23
- `),l=it(a);return {block:{type:"blockquote",source:e.slice(o,i).join(`
24
- `),lineStart:o,lineEnd:i,hash:T(a),data:{kind:"blockquote",content:a,blocks:l.blocks}},nextIndex:i}}function Fl(e,t){let n=e[t],r=e[t+1];if(n===void 0||r===void 0||!Yn.test(n)||!Cl.test(r))return null;let o=t,i=Jn(n),a=Ol(r),l=[],s=t+2;for(;s<e.length;){let u=e[s];if(u===void 0||!Yn.test(u))break;l.push(Jn(u)),s++;}return {block:{type:"table",source:e.slice(o,s).join(`
25
- `),lineStart:o,lineEnd:s,hash:T(e.slice(o,s).join(`
26
- `)),data:{kind:"table",headers:i,alignments:a,rows:l}},nextIndex:s}}function Pl(e,t){let n=e[t];if(n===void 0)return null;let r=zl(n);if(!r)return null;let o=t,i=Hl(e,t,r.ordered);return {block:{type:"list",source:e.slice(o,i.nextIndex).join(`
27
- `),lineStart:o,lineEnd:i.nextIndex,hash:T(e.slice(o,i.nextIndex).join(`
28
- `)),data:{kind:"list",ordered:r.ordered,start:r.start,items:i.items}},nextIndex:i.nextIndex}}function _l(e,t){let n=[],r=t,o=t;for(;o<e.length;){let a=e[o];if(a===void 0||a.trim()===""||n.length>0&&Ul(a))break;n.push(a),o++;}if(n.length===0)return null;let i=n.join(" ");return {block:{type:"paragraph",source:n.join(`
29
- `),lineStart:r,lineEnd:o,hash:T(i),data:{kind:"paragraph",text:i,inline:w(i)}},nextIndex:o}}function Jn(e){return nr(e).map(t=>{let n=t.trim();return {content:n,inline:w(n)}})}function Ol(e){return nr(e).map(t=>{let n=t.trim();return n.startsWith(":")&&n.endsWith(":")?"center":n.endsWith(":")?"right":n.startsWith(":")?"left":null})}function nr(e){return e.slice(1,-1).split("|")}function Nl(e,t,n){let r=e[t];return r===void 0?false:n?Ce.test(r):ye.test(r)}function zl(e){let t=e.match(ye),n=e.match(Ce);return !t&&!n?null:{ordered:!!n,start:n?parseInt(n[2]??"1",10):void 0}}function Hl(e,t,n){let r=[],o=t;for(;o<e.length;){let i=e[o];if(i===void 0)break;let a=n?i.match(Ce):i.match(ye);if(!a&&i.trim()===""){if(!Nl(e,o+1,n))break;o++;continue}if(!a)break;r.push(Gl(a,n)),o++;}return {items:r,nextIndex:o}}function Gl(e,t){let n=(e[1]??"").length,r=t?e[3]??"":e[2]??"",o=r.match(yl),i=o?o[2]??"":r;return {content:i,inline:w(i),indent:n,checked:o?o[1]?.toLowerCase()==="x":void 0}}function Ul(e){return Qn.test(e)||tr.test(e)||er.test(e)||ye.test(e)||Ce.test(e)||ot.test(e)}function Vl(){return {blocks:new Map,sourceHash:0,highlightCaches:new Map,renderedLines:null}}function jl(e){e.blocks.clear(),e.sourceHash=0,e.highlightCaches.clear(),e.renderedLines=null;}function $l(e,t){let n=T(t);if(e.sourceHash===n&&e.renderedLines)return {blocks:Array.from(e.blocks.values()),parseTimeMs:0};let r=it(t);e.blocks.clear();for(let o of r.blocks){let i=`${o.lineStart}-${o.lineEnd}`;e.blocks.set(i,o);}return e.sourceHash=n,e.renderedLines=null,r}function Zl(e,t,n){for(let[r,o]of e.blocks)o.lineStart<n&&o.lineEnd>t&&e.blocks.delete(r);e.renderedLines=null;}function at(e,t){let n=[],r={},o=Kl[e.data.kind];return o&&o(e,t,n,r),n}function lt(e,t){if(t.renderedLines)return t.renderedLines;let n=[],r=0;for(let[o,i]of e.blocks.entries()){let a=at(i,t);for(let l of a)n.push({...l,blockIndex:o}),r++;o<e.blocks.length-1&&(n.push({content:"",style:{},blockIndex:o,lineInBlock:-1}),r++);}return t.renderedLines=n,n}var Kl={heading:ql,paragraph:Xl,code:Yl,list:Jl,table:Ql,blockquote:es,hr:ts,html:ns};function ql(e,t,n,r){let o=e.data;o.kind==="heading"&&n.push({content:`${"#".repeat(o.level)} ${o.text}`,style:{bold:true},blockIndex:0,lineInBlock:0});}function Xl(e,t,n,r){let o=e.data;o.kind==="paragraph"&&n.push({content:o.text,style:r,blockIndex:0,lineInBlock:0});}function Yl(e,t,n,r){let o=e.data;if(o.kind!=="code")return;let i=rt(o.language||"plaintext"),a=t.highlightCaches.get(e.hash.toString());a?a.grammar.name!==i.name&&et(a,i):(a=Qe(i),t.highlightCaches.set(e.hash.toString(),a)),tt(a,o.code);for(let[l,s]of o.code.split(`
30
- `).entries())n.push({content:s,style:{dim:true},blockIndex:0,lineInBlock:l});}function Jl(e,t,n,r){let o=e.data;if(o.kind==="list")for(let[i,a]of o.items.entries()){let l=o.ordered?`${(o.start||1)+i}. `:`${" ".repeat(a.indent/2)}- `,s=a.checked!==void 0?a.checked?"[x] ":"[ ] ":"";n.push({content:l+s+a.content,style:r,blockIndex:0,lineInBlock:i});}}function Ql(e,t,n,r){let o=e.data;if(o.kind!=="table")return;let i=o.headers.map(l=>l.content).join(" | ");n.push({content:`| ${i} |`,style:{bold:true},blockIndex:0,lineInBlock:0});let a=o.headers.map((l,s)=>{let u=o.alignments[s];return u==="center"?":---:":u==="right"?"---:":u==="left"?":---":"---"}).join(" | ");n.push({content:`| ${a} |`,style:r,blockIndex:0,lineInBlock:1});for(let[l,s]of o.rows.entries()){let u=s.map(d=>d.content).join(" | ");n.push({content:`| ${u} |`,style:r,blockIndex:0,lineInBlock:l+2});}}function es(e,t,n,r){let o=e.data;if(o.kind==="blockquote"){for(let i of o.blocks){let a=at(i,t);for(let l of a)n.push({...l,content:`> ${l.content}`,style:{...l.style,italic:true}});}n.length===0&&n.push({content:">",style:{italic:true},blockIndex:0,lineInBlock:0});}}function ts(e,t,n,r){e.data.kind==="hr"&&n.push({content:"---",style:{dim:true},blockIndex:0,lineInBlock:0});}function ns(e,t,n,r){let o=e.data;if(o.kind==="html")for(let[i,a]of o.html.split(`
31
- `).entries())n.push({content:a,style:{dim:true},blockIndex:0,lineInBlock:i});}function rs(e,t,n,r){let o=lt(e,t),i=Math.min(n+r,o.length);return {lines:o.slice(n,i),totalLines:o.length,startIndex:n,endIndex:i}}function os(e,t){return lt(e,t).length}function is(e){let t=0,n=0,r=0,o=0,i=0,a=0;for(let l of e.blocks){switch(a+=l.lineEnd-l.lineStart,l.type){case "heading":t++;break;case "code":n++;break;case "list":r++;break;case "table":o++;break}let s=u=>{let d=0;for(let f of u)f.type==="link"&&d++,f.children&&(d+=s(f.children));return d};(l.data.kind==="paragraph"||l.data.kind==="heading")&&(i+=s(l.data.inline));}return {blockCount:e.blocks.length,lineCount:a,headingCount:t,codeBlockCount:n,listCount:r,tableCount:o,linkCount:i}}var as=512,ls=256,ss=48;function us(e){let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function ds(e){let t=[];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n);return t}function Z(e){let t=ds(e);return {type:"leaf",text:e,length:e.length,newlines:t.length,lineBreaks:t}}function K(){return {type:"leaf",text:"",length:0,newlines:0,lineBreaks:[]}}function Se(e,t){let n=e.type==="node"?e.depth:0,r=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(n,r)+1}}function fs(e){let t=e.left.type==="node"?e.left.depth:0,n=e.right.type==="node"?e.right.depth:0;return Math.abs(t-n)>1||e.depth>48}function Le(e,t){if(e.type==="leaf"){e.length>0&&t.push(e.text);return}Le(e.left,t),Le(e.right,t);}function ke(e){if(e.length===0)return K();if(e.length===1){let o=e[0];return o===void 0?K():Z(o)}let t=Math.floor(e.length/2),n=ke(e.slice(0,t)),r=ke(e.slice(t));return Se(n,r)}function cs(e){if(e.type==="leaf"||!fs(e))return e;let t=[];Le(e,t);let n=[];for(let r of t)if(r.length<=512)n.push(r);else for(let o=0;o<r.length;o+=512)n.push(r.slice(o,o+512));return ke(n)}function rr(e=""){if(e.length===0)return K();if(e.length<=512)return Z(e);let t=[];for(let n=0;n<e.length;n+=512)t.push(e.slice(n,n+512));return ke(t)}function ms(){return K()}function hs(e){return e.length}function gs(e){return e.newlines}function ps(e){return e.newlines+1}function bs(e){return e.length===0}function st(e,t){if(!(t<0||t>=e.length))return e.type==="leaf"?e.text.charAt(t):t<e.leftLength?st(e.left,t):st(e.right,t-e.leftLength)}function R(e,t,n){let r=n??e.length,o=t;if(o<0&&(o=0),r>e.length)return R(e,o,e.length);if(o>=r)return "";if(e.type==="leaf")return e.text.slice(o,r);let i=e.leftLength;if(r<=i)return R(e.left,o,r);if(o>=i)return R(e.right,o-i,r-i);let a=R(e.left,o,i),l=R(e.right,0,r-i);return a+l}function xs(e){if(e.type==="leaf")return e.text;let t=[];return Le(e,t),t.join("")}function ut(e,t){if(t<=0)return 0;if(t>=e.length)return e.newlines;if(e.type==="leaf"){let r=0;for(let o of e.lineBreaks){if(o>=t)break;r++;}return r}return t<e.leftLength?ut(e.left,t):e.left.newlines+ut(e.right,t-e.leftLength)}function or(e,t){return t<0?-1:t===0?0:t>e.newlines?-1:dt(e,t,0)}function dt(e,t,n){if(e.type==="leaf"){let o=0;for(let i of e.lineBreaks)if(o++,o===t)return n+i+1;return -1}let r=e.left.newlines;return t<=r?dt(e.left,t,n):dt(e.right,t-r,n+e.leftLength)}function ir(e,t){return t<0||t>e.newlines?-1:t===e.newlines?e.length:ft(e,t,0)}function ft(e,t,n){if(e.type==="leaf"){let o=0;for(let i of e.lineBreaks){if(o===t)return n+i;o++;}return -1}let r=e.left.newlines;return t<r?ft(e.left,t,n):ft(e.right,t-r,n+e.leftLength)}function ar(e,t){if(t<0||t>e.newlines)return;let n=or(e,t),r=ir(e,t);return n===-1?{text:R(e,0,r===-1?e.length:r),start:0,end:r===-1?e.length:r,lineNumber:t}:{text:R(e,n,r===-1?e.length:r),start:n,end:r===-1?e.length:r,lineNumber:t}}function ys(e,t,n){let r=[],o=e.newlines+1;for(let i=t;i<n&&i<o;i++){let a=ar(e,i);a&&r.push(a);}return r}function q(e,t){if(t<=0)return {left:null,right:e};if(t>=e.length)return {left:e,right:null};if(e.type==="leaf"){let o=e.text.slice(0,t),i=e.text.slice(t);return {left:o.length>0?Z(o):null,right:i.length>0?Z(i):null}}if(t<=e.leftLength){let{left:o,right:i}=q(e.left,t);return i===null?{left:o,right:e.right}:{left:o,right:Se(i,e.right)}}let{left:n,right:r}=q(e.right,t-e.leftLength);return n===null?{left:e.left,right:r}:{left:Se(e.left,n),right:r}}function ct(e,t){if(e===null||e.length===0)return t??K();if(t===null||t.length===0)return e;if(e.type==="leaf"&&t.type==="leaf"&&e.length+t.length<=512)return Z(e.text+t.text);let n=Se(e,t);return cs(n)}function Te(e,t,n){if(n.length===0)return e;let r=t;r<0&&(r=0),r>e.length&&(r=e.length);let o=rr(n),{left:i,right:a}=q(e,r);return ct(ct(i,o),a)}function Cs(e,t){return Te(e,e.length,t)}function Ss(e,t){return Te(e,0,t)}function lr(e,t,n){let r=t,o=n;if(r<0&&(r=0),o>e.length&&(o=e.length),r>=o)return e;let{left:i}=q(e,r),{right:a}=q(e,o);return ct(i,a)}function Ls(e,t,n,r){let o=lr(e,t,n);return Te(o,t,r)}function ks(e){let t=0,n=0,r=0;function o(i,a){if(i.type==="leaf"){t++,n+=i.length,r=Math.max(r,a);return}o(i.left,a+1),o(i.right,a+1);}return o(e,0),{length:e.length,newlines:e.newlines,leafCount:t,depth:r,avgLeafSize:t>0?n/t:0}}function mt(e){return e.type==="leaf"?e.length===e.text.length&&e.newlines===us(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:mt(e.left)&&mt(e.right)}var sr=(u=>(u[u.NONE=0]="NONE",u[u.BOLD=1]="BOLD",u[u.UNDERLINE=2]="UNDERLINE",u[u.BLINK=4]="BLINK",u[u.INVERSE=8]="INVERSE",u[u.INVISIBLE=16]="INVISIBLE",u[u.DIM=32]="DIM",u[u.ITALIC=64]="ITALIC",u[u.STRIKETHROUGH=128]="STRIKETHROUGH",u))(sr||{});function ht(e){let t=0;return e.bold&&(t|=1),e.underline&&(t|=2),e.blink&&(t|=4),e.inverse&&(t|=8),e.invisible&&(t|=16),e.dim&&(t|=32),e.italic&&(t|=64),e.strikethrough&&(t|=128),t}function Ts(e){return {bold:(e&1)!==0,underline:(e&2)!==0,blink:(e&4)!==0,inverse:(e&8)!==0,invisible:(e&16)!==0,dim:(e&32)!==0,italic:(e&64)!==0,strikethrough:(e&128)!==0}}function Rs(e,t=4294967295,n=0){return {fg:e.fg??t,bg:e.bg??n,attrs:ht(e)}}function As(e){return {fg:e.fg,bg:e.bg,attrs:ht(e)}}function ws(e,t){return e.fg===t.fg&&e.bg===t.bg&&e.attrs===t.attrs}function Es(e){return {fg:e.fg,bg:e.bg,attrs:e.attrs}}function Ms(e,t){return {fg:t.fg??e.fg,bg:t.bg??e.bg,attrs:t.attrs!==void 0?t.attrs:e.attrs}}function Ws(e,t){return (e.attrs&t)!==0}function Is(e,t){return {fg:e.fg,bg:e.bg,attrs:e.attrs|t}}function Ds(e,t){return {fg:e.fg,bg:e.bg,attrs:e.attrs&~t}}function vs(e){return {fg:e.bg,bg:e.fg,attrs:e.attrs}}function Bs(){return {fg:4294967295,bg:0,attrs:0}}function Fs(e){let t=BigInt(e.fg>>>0),n=BigInt(e.bg>>>0)<<32n,r=BigInt(e.attrs)<<64n;return t|n|r}function Ps(e){let t=Number(e&0xffffffffn),n=Number(e>>32n&0xffffffffn),r=Number(e>>64n&0xffn);return {fg:t,bg:n,attrs:r}}var E=4294967295,M=0,P=/\{(\/?[a-zA-Z0-9_#-]+|\/)\}/g,Re="\0LBRACE\0",Ae="\0RBRACE\0",gt={black:255,red:4278190335,green:16711935,yellow:4294902015,blue:65535,magenta:4278255615,cyan:16777215,white:4294967295,"bright-black":2155905279,gray:2155905279,grey:2155905279,"bright-red":4286611711,"bright-green":2164228351,"bright-yellow":4294934783,"bright-blue":2155937791,"bright-magenta":4286644223,"bright-cyan":2164260863,"bright-white":4294967295,orange:4289003775,pink:4290825215,purple:2147516671,brown:2771004159,lime:852308735,navy:33023,teal:8421631,olive:2155872511,maroon:2147483903,aqua:16777215,silver:3233857791,default:0,transparent:0},ur={bold:1,underline:2,ul:2,blink:4,inverse:8,invisible:16,hidden:16,dim:32,italic:64,strikethrough:128,strike:128},dr={left:"left",center:"center",right:"right"};function _s(e){let t=e.startsWith("#")?e.slice(1):e;if(!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(t))return null;let n,r,o;if(t.length===3){let i=t[0]??"0",a=t[1]??"0",l=t[2]??"0";n=Number.parseInt(i+i,16),r=Number.parseInt(a+a,16),o=Number.parseInt(l+l,16);}else n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),o=Number.parseInt(t.slice(4,6),16);return (n<<24|r<<16|o<<8|255)>>>0}function bt(e){let t=e.toLowerCase();if(t in gt)return gt[t]??null;let n=_s(e);if(n!==null)return n;let r=Number.parseInt(e,10);return !Number.isNaN(r)&&r>=0&&r<=255?Os(r):null}function Os(e){if(e<8)return [255,2147483903,8388863,2155872511,33023,2147516671,8421631,3233857791][e]??255;if(e<16)return [2155905279,4278190335,16711935,4294902015,65535,4278255615,16777215,4294967295][e-8]??2155905279;if(e<232){let n=e-16,r=Math.floor(n/36)*51,o=Math.floor(n/6)%6*51,i=n%6*51;return (r<<24|o<<16|i<<8|255)>>>0}let t=(e-232)*10+8;return (t<<24|t<<16|t<<8|255)>>>0}function Ns(){return {fg:[],bg:[],attrs:new Map}}function zs(e,t){e.fg=E,e.bg=M,e.attrs=0,t.fg=[],t.bg=[],t.attrs.clear();}function Hs(e,t,n){n.attrs.get(e)?.pop()?.prevValue?t.attrs|=e:t.attrs&=~e;}function Gs(e,t,n,r){let o=r.attrs.get(e);o||(o=[],r.attrs.set(e,o)),o.push({type:"attr",prevValue:n.attrs&e,tagName:t}),n.attrs|=e;}function Us(e,t,n,r){if(!(e in ur))return false;let o=ur[e];return o===void 0?false:(t?Hs(o,n,r):Gs(o,e,n,r),true)}function Vs(e,t,n,r){let o=e.match(/^(.+)-fg$/);if(!o?.[1])return false;if(t)if(r.fg.length>0){let i=r.fg.pop();i&&(n.fg=i.prevValue);}else n.fg=E;else {let i=bt(o[1]);i!==null&&(r.fg.push({type:"fg",prevValue:n.fg,tagName:e}),n.fg=i);}return true}function js(e,t,n,r){let o=e.match(/^(.+)-bg$/);if(!o?.[1])return false;if(t)if(r.bg.length>0){let i=r.bg.pop();i&&(n.bg=i.prevValue);}else n.bg=M;else {let i=bt(o[1]);i!==null&&(r.bg.push({type:"bg",prevValue:n.bg,tagName:e}),n.bg=i);}return true}function $s(e,t,n,r){if(t)return false;let o=bt(e);return o===null?false:(r.fg.push({type:"fg",prevValue:n.fg,tagName:e}),n.fg=o,true)}function Zs(e,t,n){if(e==="/")return zs(t,n),null;let r=e.startsWith("/"),o=r?e.slice(1):e;return o in dr?dr[o]??null:(Us(o,r,t,n)||Vs(o,r,t,n)||js(o,r,t,n)||$s(o,r,t,n),null)}function Ks(e){let t=[],n="left",r="",o=e.replace(/\{\{/g,Re).replace(/\}\}/g,Ae),i={fg:E,bg:M,attrs:0},a=Ns(),l=0,s;for(P.lastIndex=0;(s=P.exec(o))!==null;){if(s.index>l){let d=fr(o.slice(l,s.index));r=cr(t,i,d,r);}let u=s[1];if(u!==void 0){let d=Zs(u,i,a);d!==null&&(n=d);}l=P.lastIndex;}if(l<o.length){let u=fr(o.slice(l));r=cr(t,i,u,r);}return t.length===0&&e.length===0?{segments:[],alignment:n,plainText:""}:{segments:t,alignment:n,plainText:r}}function fr(e){return e.replaceAll(Re,"{").replaceAll(Ae,"}")}function cr(e,t,n,r){return n.length===0?r:(e.push({text:n,fg:t.fg,bg:t.bg,attrs:t.attrs}),r+n)}function xt(e){return e.replace(/\{\{/g,Re).replace(/\}\}/g,Ae).replace(P,"").replaceAll(Re,"{").replaceAll(Ae,"}")}function qs(e){return xt(e).trim()}function we(e){return e.replace(/\{/g,"{{").replace(/\}/g,"}}")}function Xs(e,t){let n=[];if(t.bold&&n.push("{bold}"),t.underline&&n.push("{underline}"),t.blink&&n.push("{blink}"),t.inverse&&n.push("{inverse}"),t.invisible&&n.push("{invisible}"),t.dim&&n.push("{dim}"),t.italic&&n.push("{italic}"),t.strikethrough&&n.push("{strikethrough}"),t.fg!==void 0&&t.fg!==E){let o=pt(t.fg);n.push(`{#${o}-fg}`);}if(t.bg!==void 0&&t.bg!==M){let o=pt(t.bg);n.push(`{#${o}-bg}`);}let r=we(e);return n.length===0?r:`${n.join("")}${r}{/}`}function pt(e){let t=e>>>24&255,n=e>>>16&255,r=e>>>8&255;return t.toString(16).padStart(2,"0")+n.toString(16).padStart(2,"0")+r.toString(16).padStart(2,"0")}function Ys(e){if(e.length===0)return [];let t=e[0];if(!t)return [];let n=[],r={...t};for(let o=1;o<e.length;o++){let i=e[o];i&&(i.fg===r.fg&&i.bg===r.bg&&i.attrs===r.attrs?r={...r,text:r.text+i.text}:(n.push(r),r={...i}));}return n.push(r),n}function Js(e){return xt(e).length}function Qs(e){let t=e.replace(/\{\{/g,"").replace(/\}\}/g,"");return P.lastIndex=0,P.test(t)}var mr=z$1.enum(["left","center","right"]);function X(e,t){for(let[r,o]of Object.entries(gt))if(o===e)return `{${r}-${t}}`;return `{#${pt(e)}-${t}}`}function eu(e){return e&1?"{bold}":e&2?"{underline}":e&4?"{blink}":e&8?"{inverse}":e&16?"{invisible}":e&32?"{dim}":e&64?"{italic}":e&128?"{strikethrough}":""}function tu(e){let t=[];return e.bold&&t.push("{bold}"),e.underline&&t.push("{underline}"),e.blink&&t.push("{blink}"),e.inverse&&t.push("{inverse}"),e.invisible&&t.push("{invisible}"),e.dim&&t.push("{dim}"),e.italic&&t.push("{italic}"),e.strikethrough&&t.push("{strikethrough}"),e.fg!==void 0&&e.fg!==E&&t.push(X(e.fg,"fg")),e.bg!==void 0&&e.bg!==M&&t.push(X(e.bg,"bg")),t}function nu(e){let t=[];return e.bg!==void 0&&e.bg!==M&&t.push("{/bg}"),e.fg!==void 0&&e.fg!==E&&t.push("{/fg}"),e.strikethrough&&t.push("{/strikethrough}"),e.italic&&t.push("{/italic}"),e.dim&&t.push("{/dim}"),e.invisible&&t.push("{/invisible}"),e.inverse&&t.push("{/inverse}"),e.blink&&t.push("{/blink}"),e.underline&&t.push("{/underline}"),e.bold&&t.push("{/bold}"),t}function ru(e,t,n){let r=we(e),o=t.join(""),i=n?n.join(""):"{/}";return `${o}${r}${i}`}function hr(e){let t=[];return e&1&&t.push("{bold}"),e&2&&t.push("{underline}"),e&4&&t.push("{blink}"),e&8&&t.push("{inverse}"),e&16&&t.push("{invisible}"),e&32&&t.push("{dim}"),e&64&&t.push("{italic}"),e&128&&t.push("{strikethrough}"),t}function gr(e){let t=[],n=hr(e.attrs);t.push(...n),e.fg!==E&&t.push(X(e.fg,"fg")),e.bg!==M&&t.push(X(e.bg,"bg"));let r=we(e.text);return t.length===0?r:`${t.join("")}${r}{/}`}function ou(e){let t=[];e.alignment!=="left"&&t.push(`{${e.alignment}}`);for(let n of e.segments)t.push(gr(n));return t.join("")}var pr=z$1.object({text:z$1.string(),fg:z$1.number(),bg:z$1.number(),attrs:z$1.number()}),iu=z$1.object({segments:z$1.array(pr),alignment:mr,plainText:z$1.string()});var au=5e3,lu=1e5,su=/(?:^|[^\w])/,uu=/(?:$|[^\w])/;function du(e){let t=new Map,n=e.length;for(let r=0;r<n-1;r++){let o=e[r];o!==void 0&&t.set(o,n-1-r);}return t}function br(e,t,n=true,r=0){if(t.length===0)return [];let o=n?e:e.toLowerCase(),i=n?t:t.toLowerCase(),a=o.length,l=i.length,s=[];if(l>a)return s;let u=du(i),d=r+l-1;for(;d<a;){let f=l-1,c=d;for(;f>=0&&o[c]===i[f];)f--,c--;if(f<0)s.push(c+1),d++;else {let m=o[d],h=m!==void 0?u.get(m)??l:l;d+=Math.max(1,h);}}return s}function fu(e){let t=0,n=Math.min(e.length,1e3);for(let r=0;r<n;r++){let o=e.charCodeAt(r);t=(t<<5)-t+o|0;}return t=(t<<5)-t+e.length|0,t}function cu(e,t){let n=0,r=0;for(let o=0;o<t&&o<e.length;o++)e[o]===`
32
- `&&(n++,r=o+1);return {line:n,column:t-r}}function xr(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
33
- `&&t.push(n+1);return t}function mu(e,t){let n=0,r=e.length-1;for(;n<r;){let o=Math.floor((n+r+1)/2),i=e[o];i!==void 0&&i<=t?n=o:r=o-1;}return n}function yr(e,t,n={}){let r=performance.now(),o=n.caseSensitive??false,i=n.wholeWord??false,a=n.maxMatches,l=n.startPosition??0;if(t.length===0)return yt(t,r);let s=br(e,t,o,l),u=xr(e),{matches:d,truncated:f}=gu(e,t,s,u,i,a);return {matches:d,totalCount:f?s.length:d.length,truncated:f,timedOut:false,timeMs:performance.now()-r,query:t}}function Cr(e,t,n={}){let r=performance.now(),o=n.caseSensitive??false,i=n.maxMatches,a=n.timeout??5e3,l=n.startPosition??0;if(t.length===0)return yt(t,r);let s=hu(t,o);if(!s)return yt(t,r);let u=xr(e),d=bu(e,s,u,l,r+a,i);return {matches:d.matches,totalCount:d.matches.length,truncated:d.truncated,timedOut:d.timedOut,timeMs:performance.now()-r,query:t}}function yt(e,t){return {matches:[],totalCount:0,truncated:false,timedOut:false,timeMs:performance.now()-t,query:e}}function hu(e,t){try{let n=t?"g":"gi";return new RegExp(e,n)}catch{return null}}function gu(e,t,n,r,o,i){let a=[],l=false;for(let s of n)if(!(o&&!pu(e,s,t.length))&&(a.push(Sr(e,r,s,t.length)),i&&a.length>=i)){l=true;break}return {matches:a,truncated:l}}function pu(e,t,n){let r=t>0?e[t-1]:"",o=e[t+n]??"";return !(r&&/\w/.test(r)||o&&/\w/.test(o))}function Sr(e,t,n,r){let o=mu(t,n),i=t[o]??0,a=e.slice(n,n+r);return {start:n,end:n+r,line:o,column:n-i,text:a}}function bu(e,t,n,r,o,i){let a=[],l=false,s=false,u=r;t.lastIndex=r;let d=t.exec(e);for(;d!==null;){if(a.length%1e3===0&&performance.now()>o){s=true;break}if(d.index===u&&(t.lastIndex=u+1),u=t.lastIndex,a.push(Sr(e,n,d.index,d[0].length)),i&&a.length>=i){l=true;break}d=t.exec(e);}return {matches:a,truncated:l,timedOut:s}}function Ct(e,t,n={}){return n.regex?Cr(e,t,n):yr(e,t,n)}function Lr(e,t,n,r=1e5,o={}){let i=performance.now();if(t.length===0||n>=e.length)return {matches:[],hasMore:false,nextPosition:e.length,timeMs:performance.now()-i};let a=Math.min(n+r,e.length),l=e.slice(0,a),u=Ct(l,t,{...o,startPosition:n}).matches.filter(f=>f.start>=n&&f.start<a),d=a<e.length;return {matches:u,hasMore:d,nextPosition:a,timeMs:performance.now()-i}}function xu(){return {query:"",options:{},matches:[],textHash:0,currentIndex:-1,complete:false,lastPosition:0}}function yu(e){e.query="",e.options={},e.matches=[],e.textHash=0,e.currentIndex=-1,e.complete=false,e.lastPosition=0;}function Cu(e,t,n,r={}){let o=fu(t),i=e.query!==n,a=e.options.caseSensitive!==r.caseSensitive||e.options.wholeWord!==r.wholeWord||e.options.regex!==r.regex,l=e.textHash!==o;return i||a||l?(e.query=n,e.options=r,e.matches=[],e.textHash=o,e.currentIndex=-1,e.complete=false,e.lastPosition=0,true):false}function Su(e,t,n=1e5){let r=performance.now();if(e.query.length===0)return {matches:e.matches,totalCount:0,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query};if(e.complete)return {matches:e.matches,totalCount:e.matches.length,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query};let o=Lr(t,e.query,e.lastPosition,n,e.options);return e.matches.push(...o.matches),e.lastPosition=o.nextPosition,e.complete=!o.hasMore,{matches:e.matches,totalCount:e.matches.length,truncated:false,timedOut:false,timeMs:performance.now()-r,query:e.query}}function Lu(e){if(e.matches.length!==0)return e.currentIndex=(e.currentIndex+1)%e.matches.length,e.matches[e.currentIndex]}function ku(e){if(e.matches.length!==0)return e.currentIndex=e.currentIndex<=0?e.matches.length-1:e.currentIndex-1,e.matches[e.currentIndex]}function Tu(e,t){if(!(t<0||t>=e.matches.length))return e.currentIndex=t,e.matches[t]}function Ru(e,t,n=true){if(e.matches.length===0)return;let r=0,o=e.matches.length-1;for(;r<o;){let l=Math.floor((r+o)/2),s=e.matches[l];s&&s.start<t?r=l+1:o=l;}let i=e.matches[r],a=r>0?e.matches[r-1]:void 0;if(n&&i)return e.currentIndex=r,{match:i,index:r};if(!n&&a)return e.currentIndex=r-1,{match:a,index:r-1};if(i)return e.currentIndex=r,{match:i,index:r};if(a)return e.currentIndex=r-1,{match:a,index:r-1}}function Au(e,t,n){return e.matches.filter(r=>r.line>=t&&r.line<n)}function wu(e){return {current:e.currentIndex+1,total:e.matches.length,complete:e.complete}}function Eu(e,t,n={}){let r=Ct(e,t,n);return {...r,matches:[...r.matches].reverse()}}export{To as $,pn as $a,$i as $b,Xe as $c,mt as $d,wu as $e,Qr as A,rn as Aa,zn as Ab,Ca as Ac,lt as Ad,tu as Ae,eo as B,te as Ba,ui as Bb,Sa as Bc,rs as Bd,nu as Be,to as C,on as Ca,di as Cb,La as Cc,os as Cd,ru as Ce,no as D,an as Da,fi as Db,wa as Dc,is as Dd,hr as De,ro as E,ne as Ea,ci as Eb,Ea as Ec,as as Ed,gr as Ee,Q as F,re as Fa,mi as Fb,Ma as Fc,ls as Fd,ou as Fe,oo as G,H as Ga,hi as Gb,Wa as Gc,ss as Gd,pr as Ge,io as H,ln as Ha,gi as Hb,Da as Hc,rr as Hd,iu as He,I,sn as Ia,pi as Ib,va as Ic,ms as Id,au as Ie,Ee as J,Ne as Ja,bi as Jb,Ba as Jc,hs as Jd,lu as Je,Et as K,un as Ka,xi as Kb,Zn as Kc,gs as Kd,su as Ke,Mt as L,ze as La,yi as Lb,Fa as Lc,ps as Ld,uu as Le,Me as M,He as Ma,Ci as Mb,Pa as Mc,bs as Md,br as Me,ao as N,Ge as Na,Hn as Nb,_a as Nc,st as Nd,cu as Ne,lo as O,D as Oa,Si as Ob,Oa as Oc,R as Od,yr as Oe,so as P,S as Pa,Li as Pb,ge as Pc,xs as Pd,Cr as Pe,uo as Q,Ue as Qa,ki as Qb,qn as Qc,ut as Qd,Ct as Qe,fo as R,p as Ra,Di as Rb,za as Rc,or as Rd,Lr as Re,co as S,A as Sa,vi as Sb,Xn as Sc,ir as Sd,xu as Se,mo as T,je as Ta,_i as Tb,Ha as Tc,ar as Td,yu as Te,ho as U,cn as Ua,Oi as Ub,Ga as Uc,ys as Ud,Cu as Ue,vt as V,mn as Va,Ni as Vb,Ua as Vc,Te as Vd,Su as Ve,So as W,hn as Wa,zi as Wb,Va as Wc,Cs as Wd,Lu as We,Lo as X,le as Xa,Hi as Xb,pe as Xc,Ss as Xd,ku as Xe,ko as Y,ie as Ya,Gi as Yb,U as Yc,lr as Yd,Tu as Ye,Bt as Z,ae as Za,Ui as Zb,V as Zc,Ls as Zd,Ru as Ze,Ft as _,gn as _a,ji as _b,be as _c,ks as _d,Au as _e,_ as a,Ro as aa,bn as ab,Zi as ac,xe as ad,sr as ae,Eu as af,wr as b,Ao as ba,yn as bb,Ki as bc,Ye as bd,ht as be,Er as c,wo as ca,Cn as cb,qi as cc,$ as cd,Ts as ce,Mr as d,Eo as da,Sn as db,Xi as dc,Je as dd,Rs as de,Wr as e,Mo as ea,Ln as eb,Yi as ec,Qe as ed,As as ee,Ir as f,Wo as fa,kn as fb,Ji as fc,ja as fd,ws as fe,Dr as g,Io as ga,Tn as gb,Qi as gc,et as gd,Es as ge,vr as h,$o as ha,Rn as hb,ea as hc,$a as hd,Ms as he,Pr as i,Ut as ia,An as ib,ta as ic,Za as id,Ws as ie,_r as j,Vt as ja,wn as jb,na as jc,Ka as jd,Is as je,Or as k,jt as ka,En as kb,ra as kc,qa as kd,Ds as ke,At as l,$t as la,G as lb,oa as lc,F as ld,vs as le,Nr as m,Zt as ma,Mn as mb,ia as mc,tt as md,Bs as me,zr as n,Pe as na,b as nb,aa as nc,gl as nd,Fs as ne,Gr as o,_e as oa,Wn as ob,sa as oc,pl as od,Ps as oe,Ur as p,z as pa,$e as pb,he as pc,nt as pd,Ks as pe,Y as q,Kt as qa,se as qb,Gn as qc,bl as qd,xt as qe,Vr as r,qt as ra,In as rb,ca as rc,rt as rd,qs as re,jr as s,Xt as sa,Dn as sb,ma as sc,xl as sd,we as se,$r as t,Yt as ta,vn as tb,ha as tc,w as td,Xs as te,Zr as u,Jt as ua,Bn as ub,ga as uc,it as ud,Ys as ue,Kr as v,Oe as va,Fn as vb,Vn as vc,Vl as vd,Js as ve,Xr as w,Qt as wa,Pn as wb,pa as wc,jl as wd,Qs as we,Yr as x,en as xa,_n as xb,ba as xc,$l as xd,mr as xe,wt as y,tn as ya,On as yb,xa as yc,Zl as yd,X as ye,Jr as z,nn as za,Nn as zb,ya as zc,at as zd,eu as ze};
@@ -1 +0,0 @@
1
- import {b as b$1,k as k$1,d,f as f$1,i}from'./chunk-KFAK4A3G.js';import {f as f$2,e}from'./chunk-FYEBZAWN.js';import {g,Z as Z$1,ha,ia,ga}from'./chunk-W5OU7Z6J.js';import {m,n}from'./chunk-Z4EZERNE.js';import {h}from'./chunk-G7GIWWLE.js';import {z as z$1}from'zod';var _e={initial:"idle",states:{idle:{on:{mouseenter:"hovered",focus:"focused",disable:"disabled"}},hovered:{on:{mousedown:"pressed",mouseleave:"idle",focus:"focused",disable:"disabled"}},pressed:{on:{mouseup:"hovered",mouseleave:"idle"}},focused:{on:{blur:"idle",mouseenter:"hovered",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},Oe=1e4;function Ue(e=Oe){return {isButton:new Uint8Array(e),machineId:new Uint32Array(e)}}var et=Ue(),R=new Map;function tr(){et.isButton.fill(0),et.machineId.fill(0),R.clear();}function er(e,t){let n=b$1(e,t,_e);return et.isButton[t]=1,et.machineId[t]=n,n}function I(e,t){return (et.isButton[t]??0)===1&&k$1(e,t)}function gt(e,t){if(I(e,t))return d(e,t)}function Ht(e,t,n){if(!I(e,t))return false;let r=d(e,t),o=f$1(e,t,n);return o&&(g(e,t),r==="pressed"&&n==="mouseup"&&wt(t)),o}function xt(e,t,n){return I(e,t)?i(e,t,n):false}function nr(e,t){return xt(e,t,"hovered")}function rr(e,t){return xt(e,t,"pressed")}function or(e,t){return xt(e,t,"focused")}function ir(e,t){return xt(e,t,"disabled")}function lr(e,t){return Ht(e,t,"disable")}function ar(e,t){return Ht(e,t,"enable")}function sr(e,t){let n=R.get(e);return n||(n=[],R.set(e,n)),n.push(t),()=>{let r=R.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function wt(e){let t=R.get(e);if(t)for(let n of t)n();}function Le(e,t){return !I(e,t)||gt(e,t)==="disabled"?false:(wt(t),true)}function cr(e){R.delete(e);}function ur(e,t,n){if(!I(e,t))return false;let r=gt(e,t);return r==="disabled"||r!=="focused"?false:n==="return"||n==="enter"||n==="space"?(Le(e,t),true):false}var Ve={initial:"unchecked",states:{unchecked:{on:{toggle:"checked",check:"checked",disable:"disabled"}},checked:{on:{toggle:"unchecked",uncheck:"unchecked",disable:"disabled"}},disabled:{on:{enable:"unchecked"}}}},He=1e4;function we(e=He){return {isCheckbox:new Uint8Array(e),machineId:new Uint32Array(e)}}var nt=we(),P=new Map,Nt="\u2611",Kt="\u2610",rt=new Map;function gr(){nt.isCheckbox.fill(0),nt.machineId.fill(0),P.clear(),rt.clear();}function xr(e,t,n=false){let r=b$1(e,t,Ve);return nt.isCheckbox[t]=1,nt.machineId[t]=r,n&&f$1(e,t,"check"),r}function C(e,t){return (nt.isCheckbox[t]??0)===1&&k$1(e,t)}function vt(e,t){if(C(e,t))return d(e,t)}function ot(e,t,n){if(!C(e,t))return false;let r=d(e,t),o=f$1(e,t,n);if(o){g(e,t);let i=d(e,t);(r==="checked"||r==="unchecked")&&(i==="checked"||i==="unchecked")&&r!==i&&ze(t,i==="checked");}return o}function kt(e,t,n){return C(e,t)?i(e,t,n):false}function Gt(e,t){return kt(e,t,"checked")}function yr(e,t){return kt(e,t,"unchecked")}function br(e,t){return kt(e,t,"disabled")}function Ne(e,t){return ot(e,t,"toggle")}function Ke(e,t){return ot(e,t,"check")}function Ge(e,t){return ot(e,t,"uncheck")}function hr(e,t){return ot(e,t,"disable")}function mr(e,t){return ot(e,t,"enable")}function zt(e,t,n){if(!C(e,t))return false;let r=vt(e,t);return r==="disabled"?false:n&&r==="unchecked"?Ke(e,t):!n&&r==="checked"?Ge(e,t):false}function Er(e,t){let n=P.get(e);return n||(n=[],P.set(e,n)),n.push(t),()=>{let r=P.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function ze(e,t){let n=P.get(e);if(n)for(let r of n)r(t);}function Sr(e){P.delete(e);}function Cr(e,t,n){return !C(e,t)||vt(e,t)==="disabled"?false:n==="return"||n==="enter"||n==="space"?(Ne(e,t),true):false}function vr(e,t){let n=rt.get(e)??{checkedChar:Nt,uncheckedChar:Kt};rt.set(e,{checkedChar:t.checkedChar??n.checkedChar,uncheckedChar:t.uncheckedChar??n.uncheckedChar});}function Ye(e){return rt.get(e)??{checkedChar:Nt,uncheckedChar:Kt}}function kr(e,t){let n=Ye(t);return vt(e,t)==="checked"?n.checkedChar:n.uncheckedChar}function Ir(e){rt.delete(e);}var Xe={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{startEdit:"editing",blur:"idle",error:"error",disable:"disabled"}},editing:{on:{endEdit:"focused",blur:"idle",error:"error"}},error:{on:{clearError:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}},$e=1e4,_={Line:0,Block:1},je=530;function qe(e=$e){return {isTextInput:new Uint8Array(e),machineId:new Uint32Array(e),cursorPos:new Uint32Array(e),selectionStart:new Int32Array(e).fill(-1),selectionEnd:new Int32Array(e).fill(-1),inputMode:new Uint8Array(e),cursorMode:new Uint8Array(e),cursorBlink:new Uint8Array(e).fill(1),cursorBlinkStart:new Float64Array(e)}}var c=qe(),It="*",At="",V=new Map,O=new Map,U=new Map,L=new Map;function Tr(){c.isTextInput.fill(0),c.machineId.fill(0),c.cursorPos.fill(0),c.selectionStart.fill(-1),c.selectionEnd.fill(-1),c.inputMode.fill(0),c.cursorMode.fill(0),c.cursorBlink.fill(1),c.cursorBlinkStart.fill(0),V.clear(),O.clear(),U.clear(),L.clear(),Wt.clear();}function Wr(e,t){let n=b$1(e,t,Xe);return c.isTextInput[t]=1,c.machineId[t]=n,c.cursorPos[t]=0,c.selectionStart[t]=-1,c.selectionEnd[t]=-1,c.inputMode[t]=0,c.cursorMode[t]=_.Line,c.cursorBlink[t]=1,c.cursorBlinkStart[t]=Date.now(),V.set(t,{secret:false,censor:It,placeholder:At,maxLength:0,multiline:false}),n}function b(e,t){return (c.isTextInput[t]??0)===1&&k$1(e,t)}function Bt(e,t){if(b(e,t))return d(e,t)}function k(e,t,n){if(!b(e,t))return false;let r=f$1(e,t,n);if(r){g(e,t);let o=d(e,t);c.inputMode[t]=o==="editing"?1:0;}return r}function Ft(e,t,n){return b(e,t)?i(e,t,n):false}function Mr(e,t){let n=Bt(e,t);return n==="focused"||n==="editing"}function Dr(e,t){return Ft(e,t,"editing")}function Rr(e,t){return Ft(e,t,"error")}function Pr(e,t){return Ft(e,t,"disabled")}function Je(e,t){return k(e,t,"focus")}function _r(e,t){return k(e,t,"blur")}function Or(e,t){return k(e,t,"startEdit")}function Ur(e,t){return k(e,t,"endEdit")}function Lr(e,t){return k(e,t,"disable")}function Vr(e,t){return k(e,t,"enable")}function Hr(e,t){return k(e,t,"error")}function wr(e,t){return k(e,t,"clearError")}function Tt(e){return c.cursorPos[e]??0}function Qe(e,t,n){b(e,t)&&(c.cursorPos[t]=Math.max(0,n),c.cursorBlinkStart[t]=Date.now(),g(e,t));}function Nr(e,t,n){let r=Tt(t);Qe(e,t,r+n);}function Yt(e){let t=c.selectionStart[e],n=c.selectionEnd[e];return t===void 0||n===void 0||t<0||n<0?null:[t,n]}function Kr(e,t,n,r){b(e,t)&&(c.selectionStart[t]=n,c.selectionEnd[t]=r,g(e,t));}function Gr(e,t){b(e,t)&&(c.selectionStart[t]=-1,c.selectionEnd[t]=-1,g(e,t));}function zr(e){return Yt(e)!==null}var Ze="\u2502",tn="\u2588",Wt=new Map;function Mt(e){return Wt.get(e)??{blink:true,blinkIntervalMs:je,lineChar:Ze,blockChar:tn}}function Yr(e,t){let n=Mt(e);Wt.set(e,{blink:t.blink??n.blink,blinkIntervalMs:t.blinkIntervalMs??n.blinkIntervalMs,lineChar:t.lineChar??n.lineChar,blockChar:t.blockChar??n.blockChar});}function Dt(e){return c.cursorMode[e]??0}function en(e,t,n){b(e,t)&&(c.cursorMode[t]=n,g(e,t));}function Xr(e,t){let r=Dt(t)===_.Line?_.Block:_.Line;return en(e,t,r),r}function nn(e){return (c.cursorBlink[e]??1)===1}function $r(e,t,n){b(e,t)&&(c.cursorBlink[t]=n?1:0,n&&(c.cursorBlinkStart[t]=Date.now()),g(e,t));}function jr(e){c.cursorBlinkStart[e]=Date.now();}function rn(e,t){let n=Bt(e,t);if(n!=="focused"&&n!=="editing")return false;if(!nn(t))return true;let r=Mt(t),o=c.cursorBlinkStart[t]??Date.now(),i=Date.now()-o;return Math.floor(i/r.blinkIntervalMs)%2===0}function on(e){let t=Mt(e);return Dt(e)===_.Block?t.blockChar:t.lineChar}function qr(e,t,n){let r=A(t),o=Tt(t),i=n;if(r.secret&&(i=r.censor.repeat(n.length)),i.length===0&&r.placeholder)return {displayText:r.placeholder,cursorVisible:false,cursorPosition:0};if(!rn(e,t))return {displayText:i,cursorVisible:false,cursorPosition:o};let p=on(t),h=Dt(t),g;return h===_.Block&&o<i.length?g=i.substring(0,o)+p+i.substring(o+1):g=i.substring(0,o)+p+i.substring(o),{displayText:g,cursorVisible:true,cursorPosition:o}}function Jr(e){let t=Yt(e);if(!t)return null;let[n,r]=t;return {start:Math.min(n,r),end:Math.max(n,r)}}function Qr(e,t){let n=V.get(e)??{secret:false,censor:It,placeholder:At,maxLength:0,multiline:false};V.set(e,{secret:t.secret??n.secret,censor:t.censor??n.censor,placeholder:t.placeholder??n.placeholder,maxLength:t.maxLength??n.maxLength,multiline:t.multiline??n.multiline});}function A(e){return V.get(e)??{secret:false,censor:It,placeholder:At,maxLength:0,multiline:false}}function ln(e){return A(e).secret}function an(e){return A(e).censor}function Zr(e){return A(e).placeholder}function to(e){return A(e).maxLength}function eo(e){return A(e).multiline}function no(e,t){return ln(e)?an(e).repeat(t.length):t}function ro(e,t){let n=O.get(e);return n||(n=[],O.set(e,n)),n.push(t),()=>{let r=O.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function oo(e,t){let n=U.get(e);return n||(n=[],U.set(e,n)),n.push(t),()=>{let r=U.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function io(e,t){let n=L.get(e);return n||(n=[],L.set(e,n)),n.push(t),()=>{let r=L.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function lo(e,t){let n=O.get(e);if(n)for(let r of n)r(t);}function ao(e,t){let n=U.get(e);if(n)for(let r of n)r(t);}function so(e){let t=L.get(e);if(t)for(let n of t)n();}function co(e){O.delete(e),U.delete(e),L.delete(e),V.delete(e);}function sn(e,t,n){return e.multiline?e.maxLength>0&&n.length>=e.maxLength?null:{type:"newline",position:t}:{type:"submit",value:n}}function cn(e,t){return e.multiline?{type:"submit",value:t}:{type:"cancel"}}function un(e,t,n){return e==="left"&&t>0?{type:"moveCursor",position:t-1}:e==="right"&&t<n?{type:"moveCursor",position:t+1}:e==="home"&&t!==0?{type:"moveCursor",position:0}:e==="end"&&t!==n?{type:"moveCursor",position:n}:null}function fn(e,t,n){return e==="backspace"&&t>0?{type:"delete",start:t-1,end:t}:e==="delete"&&t<n?{type:"delete",start:t,end:t+1}:null}function pn(e,t,n,r){return e.length!==1||n.maxLength>0&&r>=n.maxLength?null:{type:"insert",char:e,position:t}}function uo(e,t,n,r){if(!b(e,t))return null;let o=Bt(e,t);if(o==="disabled")return null;if(o==="idle")return Je(e,t),null;let i=Tt(t),u=A(t),p=r.length;if(n==="return"||n==="enter")return sn(u,i,r);if(n==="escape")return cn(u,r);let h=fn(n,i,p);if(h)return h;let g=un(n,i,p);return g||pn(n,i,u,p)}var dn=1e4,Xt=1,$t=2;function gn(e=dn){return {isForm:new Uint8Array(e),flags:new Uint8Array(e)}}var B=gn(),F=new Map,it=new Map,H=new Map,w=new Map;function Eo(){B.isForm.fill(0),B.flags.fill(0),F.clear(),it.clear(),H.clear(),w.clear();}function So(e,t,n={}){B.isForm[t]=1;let r=0;n.keys!==false&&(r|=Xt),n.submitOnEnter!==false&&(r|=$t),B.flags[t]=r,F.set(t,new Map),it.set(t,new Map),g(e,t);}function jt(e,t){return B.isForm[t]===1}function xn(e){return (B.flags[e]&Xt)!==0}function yn(e){return (B.flags[e]&$t)!==0}function bn(e,t,n,r,o){if(!jt(e,t))return;let i=F.get(t),u=it.get(t);i&&u&&(i.set(n,r),o!==void 0?u.set(n,o):u.set(n,Jt(e,n)));}function Co(e,t,n){let r=F.get(t),o=it.get(t);r&&r.delete(n),o&&o.delete(n);}function qt(e,t){let n=F.get(t);return n?Array.from(n.keys()):[]}function vo(e,t){return F.get(e)?.get(t)}function Jt(e,t){return b(e,t)?f$2(e,t)??"":C(e,t)?Gt(e,t):I(e,t)?gt(e,t)==="pressed":f$2(e,t)??null}function hn(e$1,t,n){if(b(e$1,t)){e(e$1,t,String(n??""));return}if(C(e$1,t)){zt(e$1,t,!!n);return}n!==null&&e(e$1,t,String(n));}function mn(e,t){let n={},r=F.get(t);if(!r)return n;for(let[o,i]of r)n[i]=Jt(e,o);return n}function ko(e,t){let n=it.get(t);if(!n)return;for(let[o,i]of n)hn(e,o,i);let r=w.get(t);if(r)for(let o of r)o();g(e,t);}function En(e,t){let n=mn(e,t),r=H.get(t);if(r)for(let o of r)o(n);return n}function Io(e,t){let n=H.get(e)??[];return n.push(t),H.set(e,n),()=>{let r=H.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Ao(e,t){let n=w.get(e)??[];return n.push(t),w.set(e,n),()=>{let r=w.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Bo(e){H.delete(e),w.delete(e);}function Sn(e,t){let r=qt(e,t).filter(o=>Z$1(e,o));return ha(e,r)}function Cn(e,t){let r=qt(e,t).filter(o=>Z$1(e,o));return ia(e,r)}function Fo(e,t){let r=h(e,t).filter(o=>Z$1(e,o));return ga(e,r)}function To(e,t,n,r){return !jt(e,t)||!xn(t)?false:n==="tab"?(r?Cn(e,t):Sn(e,t),true):(n==="return"||n==="enter")&&yn(t)?(En(e,t),true):false}function Wo(e,t,n="field_"){let r=h(e,t);for(let o of r)if(b(e,o)||C(e,o)){let i=`${n}${o}`;bn(e,t,o,i);}}var vn=1e4,lt={Horizontal:0,Vertical:1};function kn(e=vn){return {isProgressBar:new Uint8Array(e),value:new Float32Array(e),min:new Float32Array(e),max:new Float32Array(e),orientation:new Uint8Array(e),showPercentage:new Uint8Array(e)}}var s=kn(),Qt="\u2588",Zt="\u2591",te="\u2588",ee="\u2591",at=new Map,N=new Map,K=new Map;function Ro(){s.isProgressBar.fill(0),s.value.fill(0),s.min.fill(0),s.max.fill(0),s.orientation.fill(0),s.showPercentage.fill(0),at.clear(),N.clear(),K.clear();}function Po(e,t,n={}){s.isProgressBar[t]=1,s.min[t]=n.min??0,s.max[t]=n.max??100,s.value[t]=n.value??0,s.orientation[t]=n.orientation??lt.Horizontal,s.showPercentage[t]=n.showPercentage?1:0,In(t,{}),g(e,t);}function _o(e,t){return s.isProgressBar[t]===1}function Oo(e){return s.value[e]}function Uo(e){return s.min[e]}function Lo(e){return s.max[e]}function ne(e){let t=s.min[e],n=s.max[e],r=s.value[e];return n===t?0:(r-t)/(n-t)*100}function Vo(e){return s.orientation[e]}function Ho(e){return s.showPercentage[e]===1}function st(e,t,n){let r=s.min[t],o=s.max[t],i=s.value[t],u=Math.max(r,Math.min(o,n));if(s.value[t]=u,g(e,t),u!==i){let p=ne(t);Bn(t,u,p),u===o&&i<o&&An(t);}}function wo(e,t,n=1){let r=s.value[t];st(e,t,r+n);}function No(e,t,n=1){let r=s.value[t];st(e,t,r-n);}function Ko(e,t){let n=s.min[t];st(e,t,n);}function Go(e,t){let n=s.max[t];st(e,t,n);}function zo(e){let t=s.max[e];return s.value[e]>=t}function In(e,t){let n=at.get(e),r=s.orientation[e],o=r===lt.Vertical?te:Qt,i=r===lt.Vertical?ee:Zt;at.set(e,{fillChar:t.fillChar??n?.fillChar??o,emptyChar:t.emptyChar??n?.emptyChar??i,fillFg:t.fillFg??n?.fillFg??16711935,fillBg:t.fillBg??n?.fillBg??255,emptyFg:t.emptyFg??n?.emptyFg??1717987071,emptyBg:t.emptyBg??n?.emptyBg??255});}function Rt(e){let t=at.get(e);if(t)return t;let n=s.orientation[e],r=n===lt.Vertical?te:Qt,o=n===lt.Vertical?ee:Zt;return {fillChar:r,emptyChar:o,fillFg:16711935,fillBg:255,emptyFg:1717987071,emptyBg:255}}function Yo(e){at.delete(e);}function Xo(e){return Rt(e).fillChar}function $o(e){return Rt(e).emptyChar}function jo(e,t){let n=ne(e)/100,r=Rt(e),o=Math.round(t*n),i=t-o;return r.fillChar.repeat(o)+r.emptyChar.repeat(i)}function qo(e,t){let n=N.get(e)??[];return n.push(t),N.set(e,n),()=>{let r=N.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Jo(e,t){let n=K.get(e)??[];return n.push(t),K.set(e,n),()=>{let r=K.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function An(e){let t=N.get(e);if(t)for(let n of t)n();}function Bn(e,t,n){let r=K.get(e);if(r)for(let o of r)o(t,n);}function Qo(e){N.delete(e),K.delete(e);}function Zo(e,t,n){s.orientation[t]=n,g(e,t);}function ti(e,t,n){s.showPercentage[t]=n?1:0,g(e,t);}function ei(e,t,n,r){s.min[t]=n,s.max[t]=r;let o=s.value[t];(o<n||o>r)&&st(e,t,Math.max(n,Math.min(r,o))),g(e,t);}var Fn={initial:"unselected",states:{unselected:{on:{select:"selected",disable:"disabled"}},selected:{on:{deselect:"unselected",disable:"disabled"}},disabled:{on:{enable:"unselected"}}}},re=1e4;function Tn(e=re){return {isRadioButton:new Uint8Array(e),machineId:new Uint32Array(e),radioSetId:new Uint32Array(e)}}var x=Tn();function Wn(e=re){return {isRadioSet:new Uint8Array(e),selectedButton:new Uint32Array(e)}}var S=Wn(),oe="\u25C9",ie="\u25CB",ct=new Map,z=new Map,G=new Map;function ii(){x.isRadioButton.fill(0),x.machineId.fill(0),x.radioSetId.fill(0),S.isRadioSet.fill(0),S.selectedButton.fill(0),ct.clear(),z.clear(),G.clear();}function li(e,t){S.isRadioSet[t]=1,S.selectedButton[t]=0,g(e,t);}function ai(e,t){return S.isRadioSet[t]===1}function Mn(e){return S.selectedButton[e]}function si(e){let t=S.selectedButton[e];return t===0?null:z.get(t)??null}function ci(e,t){let n=G.get(e)??[];return n.push(t),G.set(e,n),()=>{let r=G.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function le(e){let t=G.get(e);if(t){let n=Mn(e),r=n!==0?z.get(n)??null:null;for(let o of t)o(r,n!==0?n:null);}}function ui(e){G.delete(e);}function fi(e,t,n){x.isRadioButton[t]=1,x.radioSetId[t]=n??0;let r=b$1(e,t,Fn);return x.machineId[t]=r,Rn(t,{}),g(e,t),r}function Y(e,t){return x.isRadioButton[t]===1}function pi(e,t){if(Y(e,t)&&k$1(e,t))return d(e,t)}function ut(e,t,n){return Y(e,t)?f$1(e,t,n):false}function ae(e,t,n){return Y(e,t)?i(e,t,n):false}function Dn(e,t){return ae(e,t,"selected")}function se(e,t){return ae(e,t,"disabled")}function di(e){return x.radioSetId[e]}function gi(e,t){x.radioSetId[e]=t;}function xi(e){return z.get(e)}function yi(e,t){z.set(e,t);}function ce(e,t){if(!Y(e,t)||se(e,t))return;let n=x.radioSetId[t];if(n!==0){let r=S.selectedButton[n];r!==0&&r!==t&&ut(e,r,"deselect"),S.selectedButton[n]=t;}ut(e,t,"select"),g(e,t),n!==0&&le(n);}function bi(e,t){if(!Y(e,t))return;ut(e,t,"deselect");let n=x.radioSetId[t];n!==0&&S.selectedButton[n]===t&&(S.selectedButton[n]=0,le(n)),g(e,t);}function hi(e,t){ut(e,t,"disable"),g(e,t);}function mi(e,t){ut(e,t,"enable"),g(e,t);}function Rn(e,t){let n=ct.get(e);ct.set(e,{selectedChar:t.selectedChar??n?.selectedChar??oe,unselectedChar:t.unselectedChar??n?.unselectedChar??ie});}function Pn(e){return ct.get(e)??{selectedChar:oe,unselectedChar:ie}}function Ei(e,t){let n=Pn(t);return Dn(e,t)?n.selectedChar:n.unselectedChar}function Si(e){ct.delete(e);}function Ci(e,t,n){return !Y(e,t)||se(e,t)?false:n==="space"||n==="return"||n==="enter"?(ce(e,t),true):false}function _n(e){let t=[];for(let n=0;n<x.isRadioButton.length;n++)x.isRadioButton[n]===1&&x.radioSetId[n]===e&&t.push(n);return t}function vi(e,t,n){let r=_n(t);for(let o of r)if(z.get(o)===n)return ce(e,o),true;return false}var fe="\u25BC",pe="\u25B2",de="\u25CF",ge=" ",yt=1e4,f={isSelect:new Uint8Array(yt),selectedIndex:new Int32Array(yt).fill(-1),highlightedIndex:new Int32Array(yt).fill(0),optionCount:new Uint32Array(yt)},T=new Map,ft=new Map,X=new Map,$=new Map,j=new Map,On={initial:"closed",states:{closed:{on:{open:"open",toggle:"open",disable:"disabled"}},open:{on:{close:"closed",select:"closed",toggle:"closed",disable:"disabled"}},disabled:{on:{enable:"closed"}}}};function Bi(e,t,n=[],r=-1){f.isSelect[t]=1,f.selectedIndex[t]=r,f.highlightedIndex[t]=r>=0?r:0,f.optionCount[t]=n.length,T.set(t,[...n]),b$1(e,t,On);}function xe(e,t){return f.isSelect[t]===1&&k$1(e,t)}function bt(e,t){return d(e,t)??"closed"}function ye(e,t,n){return bt(e,t)===n}function Un(e,t){return ye(e,t,"open")}function Ln(e,t){return ye(e,t,"disabled")}function ue(e,t){let n=t.get(e);if(n)for(let r of n)r();}function Vn(e,t,n){t!=="open"&&n==="open"?ue(e,$):t==="open"&&n!=="open"&&ue(e,j);}function q(e,t,n){if(!xe(e,t))return false;let r=bt(e,t),o=f$1(e,t,n);if(o){let i=bt(e,t);g(e,t),Vn(t,r,i);}return o}function Fi(e,t){return q(e,t,"open")}function Ti(e,t){return q(e,t,"close")}function Wi(e,t){return q(e,t,"toggle")}function Mi(e,t){return q(e,t,"disable")}function Di(e,t){return q(e,t,"enable")}function Ri(e){return T.get(e)??[]}function Pi(e,t,n){T.set(t,[...n]),f.optionCount[t]=n.length,(f.selectedIndex[t]??-1)>=n.length&&(f.selectedIndex[t]=n.length>0?0:-1),f.highlightedIndex[t]=0,g(e,t);}function _i(e){return f.optionCount[e]??0}function Hn(e,t){return T.get(e)?.[t]}function Oi(e){return f.selectedIndex[e]??-1}function be(e){let t=f.selectedIndex[e]??-1;if(!(t<0))return Hn(e,t)}function Ui(e){return be(e)?.value}function Li(e){return be(e)?.label}function he(e,t,n){let r=T.get(t);if(!r||n<0||n>=r.length||(f.selectedIndex[t]??-1)===n)return false;f.selectedIndex[t]=n,f.highlightedIndex[t]=n,g(e,t);let i=r[n],u=X.get(t);if(u&&i)for(let p of u)p(i.value,i.label,n);return q(e,t,"select"),true}function Vi(e,t,n){let r=T.get(t);if(!r)return false;let o=r.findIndex(i=>i.value===n);return o<0?false:he(e,t,o)}function Hi(e,t){f.selectedIndex[t]=-1,g(e,t);}function wn(e){return f.highlightedIndex[e]??0}function me(e,t,n){let r=f.optionCount[t]??0;if(r===0)return;let o=Math.max(0,Math.min(n,r-1));f.highlightedIndex[t]=o,g(e,t);}function wi(e,t,n=true){let r=f.optionCount[t]??0;if(r===0)return;let o=(f.highlightedIndex[t]??0)+1;o>=r&&(o=n?0:r-1),me(e,t,o);}function Ni(e,t,n=true){let r=f.optionCount[t]??0;if(r===0)return;let o=(f.highlightedIndex[t]??0)-1;o<0&&(o=n?r-1:0),me(e,t,o);}function Ki(e,t){let n=f.highlightedIndex[t]??0;return he(e,t,n)}function Gi(e,t){let n=ft.get(e);ft.set(e,{closedIndicator:t.closedIndicator??n?.closedIndicator??fe,openIndicator:t.openIndicator??n?.openIndicator??pe,selectedMark:t.selectedMark??n?.selectedMark??de,separator:t.separator??n?.separator??ge});}function Nn(e){return ft.get(e)??{closedIndicator:fe,openIndicator:pe,selectedMark:de,separator:ge}}function zi(e){ft.delete(e);}function Yi(e,t){let n=Nn(t);return bt(e,t)==="open"?n.openIndicator:n.closedIndicator}function Xi(e,t){let n=X.get(e)??[];return n.push(t),X.set(e,n),()=>{let r=X.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function $i(e,t){let n=$.get(e)??[];return n.push(t),$.set(e,n),()=>{let r=$.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function ji(e,t){let n=j.get(e)??[];return n.push(t),j.set(e,n),()=>{let r=j.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function qi(e){X.delete(e),$.delete(e),j.delete(e);}function Ji(e,t,n){if(!xe(e,t)||Ln(e,t))return null;let r=Un(e,t);switch(n){case "return":case "enter":case "space":return r?{type:"select",index:wn(t)}:{type:"open"};case "escape":return r?{type:"close"}:null;case "up":return r?{type:"highlightPrev"}:{type:"open"};case "down":return r?{type:"highlightNext"}:{type:"open"};case "home":return r?{type:"highlightFirst"}:null;case "end":return r?{type:"highlightLast"}:null;default:return null}}function Qi(){f.isSelect.fill(0),f.selectedIndex.fill(-1),f.highlightedIndex.fill(0),f.optionCount.fill(0),T.clear(),ft.clear(),X.clear(),$.clear(),j.clear();}var M={Horizontal:0,Vertical:1},Se="\u2500",Ce="\u2502",ve="\u25CF",ke="\u2501",Ie="\u2503",Ae=1717987071,Be=255,Fe=4294967295,Te=6750207,We=16711935,Me=255,W=1e4,l={isSlider:new Uint8Array(W),value:new Float32Array(W),min:new Float32Array(W),max:new Float32Array(W).fill(100),step:new Float32Array(W).fill(1),orientation:new Uint8Array(W),showValue:new Uint8Array(W)},pt=new Map,J=new Map,Q=new Map,Z=new Map,Gn={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",dragStart:"dragging",disable:"disabled"}},dragging:{on:{dragEnd:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function ol(e,t,n=0,r=100,o=0,i=1){l.isSlider[t]=1,l.min[t]=n,l.max[t]=r,l.value[t]=Pt(o,n,r),l.step[t]=i,l.orientation[t]=M.Horizontal,l.showValue[t]=0,b$1(e,t,Gn);}function Pt(e,t,n){return Math.max(t,Math.min(n,e))}function De(e,t,n){return t<=0?e:n+Math.round((e-n)/t)*t}function Re(e,t){return l.isSlider[t]===1&&k$1(e,t)}function ht(e,t){return d(e,t)??"idle"}function Pe(e,t,n){return ht(e,t)===n}function il(e,t){let n=ht(e,t);return n==="focused"||n==="dragging"}function ll(e,t){return Pe(e,t,"dragging")}function zn(e,t){return Pe(e,t,"disabled")}function Ee(e,t){let n=t.get(e);if(n)for(let r of n)r();}function Yn(e,t,n){t!=="dragging"&&n==="dragging"?Ee(e,Q):t==="dragging"&&n!=="dragging"&&Ee(e,Z);}function tt(e,t,n){if(!Re(e,t))return false;let r=ht(e,t),o=f$1(e,t,n);if(o){let i=ht(e,t);g(e,t),Yn(t,r,i);}return o}function al(e,t){return tt(e,t,"focus")}function sl(e,t){return tt(e,t,"blur")}function cl(e,t){return tt(e,t,"dragStart")}function ul(e,t){return tt(e,t,"dragEnd")}function fl(e,t){return tt(e,t,"disable")}function pl(e,t){return tt(e,t,"enable")}function Xn(e){return l.value[e]??0}function D(e,t,n){let r=l.min[t]??0,o=l.max[t]??100,i=l.step[t]??1,u=Pt(De(n,i,r),r,o),p=l.value[t]??0;if(u!==p){l.value[t]=u,g(e,t);let h=J.get(t);if(h)for(let g of h)g(u);}}function dl(e){return l.min[e]??0}function gl(e){return l.max[e]??100}function xl(e){return l.step[e]??1}function yl(e,t,n,r){m.parse({min:n,max:r}),l.min[t]=n,l.max[t]=r;let o=l.value[t]??0,i=Pt(o,n,r);i!==o&&D(e,t,i),g(e,t);}function bl(e,t,n$1){n.parse(n$1),l.step[t]=n$1;let r=l.value[t]??0,o=l.min[t]??0,i=De(r,n$1,o);i!==r&&D(e,t,i),g(e,t);}function $n(e){let t=l.min[e]??0,n=l.max[e]??100,r=l.value[e]??0;return n===t?0:(r-t)/(n-t)}function hl(e,t,n){z$1.number().finite().parse(n);let r=l.min[t]??0,o=l.max[t]??100,i=Math.max(0,Math.min(1,n)),u=r+i*(o-r);D(e,t,u);}function ml(e,t,n=1){let r=l.step[t]??1,o=l.value[t]??0;D(e,t,o+r*n);}function El(e,t,n=1){let r=l.step[t]??1,o=l.value[t]??0;D(e,t,o-r*n);}function Sl(e,t){D(e,t,l.min[t]??0);}function Cl(e,t){D(e,t,l.max[t]??100);}function mt(e){return l.orientation[e]}function vl(e,t,n){l.orientation[t]=n,g(e,t);}function jn(e){return mt(e)===M.Horizontal}function kl(e){return mt(e)===M.Vertical}function qn(e){return l.showValue[e]===1}function Il(e,t,n){l.showValue[t]=n?1:0,g(e,t);}function Al(e,t){let n=pt.get(e),r=mt(e),o=r===M.Vertical?Ce:Se,i=r===M.Vertical?Ie:ke;pt.set(e,{trackChar:t.trackChar??n?.trackChar??o,thumbChar:t.thumbChar??n?.thumbChar??ve,fillChar:t.fillChar??n?.fillChar??i,trackFg:t.trackFg??n?.trackFg??Ae,trackBg:t.trackBg??n?.trackBg??Be,thumbFg:t.thumbFg??n?.thumbFg??Fe,thumbBg:t.thumbBg??n?.thumbBg??Te,fillFg:t.fillFg??n?.fillFg??We,fillBg:t.fillBg??n?.fillBg??Me});}function Jn(e){let t=mt(e),n=t===M.Vertical?Ce:Se,r=t===M.Vertical?Ie:ke;return pt.get(e)??{trackChar:n,thumbChar:ve,fillChar:r,trackFg:Ae,trackBg:Be,thumbFg:Fe,thumbBg:Te,fillFg:We,fillBg:Me}}function Bl(e){pt.delete(e);}function Fl(e,t){let n=J.get(e)??[];return n.push(t),J.set(e,n),()=>{let r=J.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Tl(e,t){let n=Q.get(e)??[];return n.push(t),Q.set(e,n),()=>{let r=Q.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Wl(e,t){let n=Z.get(e)??[];return n.push(t),Z.set(e,n),()=>{let r=Z.get(e);if(r){let o=r.indexOf(t);o!==-1&&r.splice(o,1);}}}function Ml(e){J.delete(e),Q.delete(e),Z.delete(e);}function Dl(e,t,n){if(!Re(e,t)||zn(e,t))return null;let r=jn(t);switch(n){case "right":return r?{type:"increment",multiplier:1}:null;case "left":return r?{type:"decrement",multiplier:1}:null;case "up":return r?null:{type:"increment",multiplier:1};case "down":return r?null:{type:"decrement",multiplier:1};case "pageup":return {type:"increment",multiplier:10};case "pagedown":return {type:"decrement",multiplier:10};case "home":return {type:"toMin"};case "end":return {type:"toMax"};default:return null}}function Rl(e,t){if(t<=0)return "";let n=$n(e),r=Jn(e),o=qn(e),i="",u=t;o&&(i=` ${Xn(e)}`,u=Math.max(1,t-i.length));let p=Math.round(n*(u-1)),h="";for(let g=0;g<u;g++)g===p?h+=r.thumbChar:g<p?h+=r.fillChar:h+=r.trackChar;return h+i}function Pl(){l.isSlider.fill(0),l.value.fill(0),l.min.fill(0),l.max.fill(100),l.step.fill(1),l.orientation.fill(0),l.showValue.fill(0),pt.clear(),J.clear(),Q.clear(),Z.clear();}export{Bt as $,So as $a,Fn as $b,_i as $c,dl as $d,ot as A,en as Aa,Ro as Ab,Rn as Ac,ve as Ad,kt as B,Xr as Ba,Po as Bb,Pn as Bc,ke as Bd,Gt as C,nn as Ca,_o as Cb,Ei as Cc,Ie as Cd,yr as D,$r as Da,Oo as Db,Si as Dc,Ae as Dd,br as E,jr as Ea,Uo as Eb,Ci as Ec,Be as Ed,Ne as F,rn as Fa,Lo as Fb,_n as Fc,Fe as Fd,Ke as G,on as Ga,ne as Gb,vi as Gc,Te as Gd,Ge as H,qr as Ha,Vo as Hb,fe as Hc,We as Hd,hr as I,Jr as Ia,Ho as Ib,pe as Ic,Me as Id,mr as J,Qr as Ja,st as Jb,de as Jc,l as Jd,zt as K,A as Ka,wo as Kb,ge as Kc,Gn as Kd,Er as L,ln as La,No as Lb,f as Lc,ol as Ld,Sr as M,an as Ma,Ko as Mb,On as Mc,Re as Md,Cr as N,Zr as Na,Go as Nb,Bi as Nc,ht as Nd,vr as O,to as Oa,zo as Ob,xe as Oc,Pe as Od,Ye as P,eo as Pa,In as Pb,bt as Pc,il as Pd,kr as Q,no as Qa,Rt as Qb,ye as Qc,ll as Qd,Ir as R,ro as Ra,Yo as Rb,Un as Rc,zn as Rd,Xe as S,oo as Sa,Xo as Sb,Ln as Sc,tt as Sd,_ as T,io as Ta,$o as Tb,q as Tc,al as Td,je as U,lo as Ua,jo as Ub,Fi as Uc,sl as Ud,c as V,ao as Va,qo as Vb,Ti as Vc,cl as Vd,It as W,so as Wa,Jo as Wb,Wi as Wc,ul as Wd,At as X,co as Xa,Qo as Xb,Mi as Xc,fl as Xd,Tr as Y,uo as Ya,Zo as Yb,Di as Yc,pl as Yd,Wr as Z,B as Za,ti as Zb,Ri as Zc,Xn as Zd,b as _,Eo as _a,ei as _b,Pi as _c,D as _d,_e as a,k as aa,jt as ab,x as ac,Hn as ad,gl as ae,et as b,Ft as ba,xn as bb,S as bc,Oi as bd,xl as be,tr as c,Mr as ca,yn as cb,oe as cc,be as cd,yl as ce,er as d,Dr as da,bn as db,ie as dc,Ui as dd,bl as de,I as e,Rr as ea,Co as eb,ii as ec,Li as ed,$n as ee,gt as f,Pr as fa,qt as fb,li as fc,he as fd,hl as fe,Ht as g,Je as ga,vo as gb,ai as gc,Vi as gd,ml as ge,xt as h,_r as ha,Jt as hb,Mn as hc,Hi as hd,El as he,nr as i,Or as ia,hn as ib,si as ic,wn as id,Sl as ie,rr as j,Ur as ja,mn as jb,ci as jc,me as jd,Cl as je,or as k,Lr as ka,ko as kb,ui as kc,wi as kd,mt as ke,ir as l,Vr as la,En as lb,fi as lc,Ni as ld,vl as le,lr as m,Hr as ma,Io as mb,Y as mc,Ki as md,jn as me,ar as n,wr as na,Ao as nb,pi as nc,Gi as nd,kl as ne,sr as o,Tt as oa,Bo as ob,ut as oc,Nn as od,qn as oe,Le as p,Qe as pa,Sn as pb,ae as pc,zi as pd,Il as pe,cr as q,Nr as qa,Cn as qb,Dn as qc,Yi as qd,Al as qe,ur as r,Yt as ra,Fo as rb,se as rc,Xi as rd,Jn as re,Ve as s,Kr as sa,To as sb,di as sc,$i as sd,Bl as se,nt as t,Gr as ta,Wo as tb,gi as tc,ji as td,Fl as te,Nt as u,zr as ua,lt as ub,xi as uc,qi as ud,Tl as ue,Kt as v,Ze as va,s as vb,yi as vc,Ji as vd,Wl as ve,gr as w,tn as wa,Qt as wb,ce as wc,Qi as wd,Ml as we,xr as x,Mt as xa,Zt as xb,bi as xc,M as xd,Dl as xe,C as y,Yr as ya,te as yb,hi as yc,Se as yd,Rl as ye,vt as z,Dt as za,ee as zb,mi as zc,Ce as zd,Pl as ze};
@@ -1 +0,0 @@
1
- import {f,B,a as a$1,b as b$1,A as A$1,x,y,z,D,Y,$,aa,pa,na,_ as _$2,ka,qa,Sa,Fa,za as za$1,ca,ea as ea$1,ya as ya$1}from'./chunk-YD6ULIUR.js';import {O,Q,_ as _$1,fa,ga,va,ya,za,Aa,Ba,la,ia,ha,$ as $$1,ea}from'./chunk-JKVHO4LH.js';import {a}from'./chunk-AQ7LW75B.js';import {b,a as a$3}from'./chunk-H2YAOJDW.js';import {f as f$1,b as b$2,n as n$1}from'./chunk-BCADUCOZ.js';import {l,q,c as c$1,r as r$1}from'./chunk-KD55INV7.js';import {r,s,t,y as y$1,p as p$1,w as w$1,K,c as c$2,g as g$1,M}from'./chunk-W5OU7Z6J.js';import {a as a$2,i as i$1}from'./chunk-G7GIWWLE.js';import {n,k,i,d,e,l as l$1,m}from'./chunk-PXXGH3BV.js';n();var cn=1e4;function mn(e=cn){return {animationId:new Uint32Array(e),playing:new Uint8Array(e),loop:new Uint8Array(e),speed:new Float32Array(e),elapsed:new Float32Array(e),currentFrameIndex:new Uint16Array(e),direction:new Int8Array(e)}}var fn=mn(),ft=new WeakSet,pt=null;function dt(e){return ft.has(e)||(pt=l$1(e,m(()=>fn)),ft.add(e)),pt}function yt(e){let t=dt(e);return Array.from(k(e,[t]))}function pn(e,t){let n=dt(e);return i(e,t,n)}var Ce=e=>{let t=b(),n=yt(e);for(let r of n)O(e,r,t);return e};function dn(){return Ce}function yn(e,t=0){e.registerSystem(2,Ce,t);}function gn(e,t,n){for(let r of t)O(e,r,n);}n();function bn(e,t){if(w$1(e,t))return {x:r.x[t],y:r.y[t]}}function Sn(e,t,n,r$1,o){i(e,t,r)&&(r.x[t]=r.x[t]+n*o,r.y[t]=r.y[t]+r$1*o);}function hn(e,t){let n=e.getPosition??bn,r=e.applyMovement??Sn;return o=>{let i=e.getDelta(),a=t(o);for(let l of a)f(o,l)&&(B(o,l,i),xn(o,l,i,n,r));return o}}function xn(e,t,n,r,o){let i=a$1.behaviorType[t];if(i===b$1.Idle)return;if(i===b$1.Custom){A$1(e,t,n);return}let a=r(e,t);if(!a)return;if(i===b$1.Patrol){vn(e,t,a.x,a.y,n,o);return}let l=a$1.targetEntity[t];if(l===0)return;let s=r(e,l);s&&(i===b$1.Chase?Mn(e,t,a.x,a.y,s.x,s.y,n,o):i===b$1.Flee&&En(e,t,a.x,a.y,s.x,s.y,n,o));}function vn(e,t,n,r,o,i){let a=x(e,t,n,r,o);a&&(a.dx!==0||a.dy!==0)&&i(e,t,a.dx,a.dy,o);}function Mn(e,t,n,r,o,i,a,l){let s=y(e,t,n,r,o,i);s&&(s.dx!==0||s.dy!==0)&&l(e,t,s.dx,s.dy,a);}function En(e,t,n,r,o,i,a,l){let s=z(e,t,n,r,o,i);s&&(s.dx!==0||s.dy!==0)&&l(e,t,s.dx,s.dy,a);}n();function Te(e){return Array.from(k(e,[D]))}var Pe=e=>{let t=b(),n=Te(e);for(let r of n)Y(e,r,t);return e};function Cn(){return Pe}function Tn(e,t=20){e.registerSystem(2,Pe,t);}function Pn(e,t){let n=Te(e);for(let r of n)Y(e,r,t);}n();var g={eventBus:a(),activePairs:new Map,activeTriggers:new Map};function Wn(){return g.eventBus}function kn(){return g.activePairs}function An(){return g.activeTriggers}function Fn(){g.activePairs.clear(),g.activeTriggers.clear();}function bt(e){return Array.from(k(e,[Q]))}function Rn(e,t,n,r$1,o,i$1,a,l){if(!i(e,l,r))return;let s=Q.layer[l],u=Q.mask[l];if(!$$1(o,i$1,s,u))return;let f=r.x[l],d=r.y[l];if(!ea(t,n,r$1,l,f,d))return;let y=_$1(e,l);return fa(t,l,a||y)}function St(e){let t=bt(e),n=[];for(let r$1=0;r$1<t.length;r$1++){let o=t[r$1];if(o===void 0||!i(e,o,r))continue;let i$1=r.x[o],a=r.y[o],l=Q.layer[o],s=Q.mask[o],u=_$1(e,o);for(let f=r$1+1;f<t.length;f++){let d=t[f];if(d===void 0)continue;let y=Rn(e,o,i$1,a,l,s,u,d);y&&n.push(y);}}return n}function gt(e,t,n){for(let[r,o]of e)t.has(r)||(e.delete(r),g.eventBus.emit(n,{entityA:o.entityA,entityB:o.entityB}));}function Dn(e,t,n){let r=ga(e);e.isTrigger?(n.add(r),g.activeTriggers.has(r)||(g.activeTriggers.set(r,e),g.eventBus.emit("triggerEnter",{entityA:e.entityA,entityB:e.entityB}))):(t.add(r),g.activePairs.has(r)||(g.activePairs.set(r,e),g.eventBus.emit("collisionStart",{entityA:e.entityA,entityB:e.entityB})));}function Yn(e){let t=new Set,n=new Set;for(let r of e)Dn(r,t,n);gt(g.activePairs,t,"collisionEnd"),gt(g.activeTriggers,n,"triggerExit");}var We=e=>{let t=St(e);return Yn(t),e};function Hn(){return We}function Xn(e,t=10){e.registerSystem(2,We,t);}function Bn(e){for(let t of g.activePairs.values())if(t.entityA===e||t.entityB===e)return true;return false}function In(e){for(let t of g.activeTriggers.values())if(t.entityA===e||t.entityB===e)return true;return false}function On(e){let t=[];for(let n of g.activePairs.values())n.entityA===e?t.push(n.entityB):n.entityB===e&&t.push(n.entityA);return t}function zn(e){let t=[];for(let n of g.activeTriggers.values())n.entityA===e?t.push(n.entityB):n.entityB===e&&t.push(n.entityA);return t}function wn(e,t){let n=fa(e,t,false),r=ga(n);return g.activePairs.has(r)||g.activeTriggers.has(r)}var ee=new Map,J=new Map;function Ln(){return {dragging:null,startX:0,startY:0,offsetX:0,offsetY:0,lastX:0,lastY:0,constraints:{},verifyCallback:null}}function Vn(e,t){ee.set(e,t);}function ht(e){return ee.get(e)??{}}function Gn(e){ee.delete(e);}function qn(e,t){t?J.set(e,t):J.delete(e);}function xt(e){return J.get(e)??null}function Un(e,t,n,r$1){return r$1==="x"?{x:t,y:r.y[e]??n}:r$1==="y"?{x:r.x[e]??t,y:n}:{x:t,y:n}}function Nn(e,t,n){return n?{x:Math.round(e/n.x)*n.x,y:Math.round(t/n.y)*n.y}:{x:e,y:t}}function _n(e,t,n){let r=e,o=t;return n.minX!==void 0&&(r=Math.max(r,n.minX)),n.maxX!==void 0&&(r=Math.min(r,n.maxX)),n.minY!==void 0&&(o=Math.max(o,n.minY)),n.maxY!==void 0&&(o=Math.min(o,n.maxY)),{x:r,y:o}}function Zn(e,t,n,r,o){if(!o)return {x:n,y:r};let i=i$1(e,t);if(i===a$2)return {x:n,y:r};let a=M(e,i);if(!a)return {x:n,y:r};let l=M(e,t),s=l?.width??1,u=l?.height??1;return {x:Math.max(0,Math.min(n,a.width-s)),y:Math.max(0,Math.min(r,a.height-u))}}function Qn(e,t,n,r,o){let i=Un(t,n,r,o.constrainAxis);return i=Nn(i.x,i.y,o.snapToGrid),i=_n(i.x,i.y,o),i=Zn(e,t,i.x,i.y,o.constrainToParent),i}function Kn(e){let t$1=Ln();return {getState(){return t$1},isDragging(){return t$1.dragging!==null},getDraggingEntity(){return t$1.dragging},canDrag(n,r){return l(n,r)},startDrag(n,r,o,i){if(!l(n,r)||t$1.dragging!==null)return false;let a=t(n,r);if(!a)return false;if(t$1.dragging=r,t$1.startX=a.x,t$1.startY=a.y,t$1.offsetX=o-a.x,t$1.offsetY=i-a.y,t$1.lastX=a.x,t$1.lastY=a.y,t$1.constraints=ht(r),t$1.verifyCallback=xt(r),t$1.constraints.bringToFront){let l=t$1.constraints.frontZIndex??9999;y$1(n,r,l);}return e.emit("dragstart",{entity:r,startX:a.x,startY:a.y,mouseX:o,mouseY:i}),true},updateDrag(n,r,o){if(t$1.dragging===null)return false;let i=t$1.dragging,a=r-t$1.offsetX,l=o-t$1.offsetY,s$1=Qn(n,i,a,l,t$1.constraints);a=s$1.x,l=s$1.y;let u=a-t$1.lastX,f=l-t$1.lastY;return u===0&&f===0||t$1.verifyCallback&&!t$1.verifyCallback(i,u,f)?false:(s(n,i,a,l),t$1.lastX=a,t$1.lastY=l,e.emit("drag",{entity:i,x:a,y:l,dx:u,dy:f,mouseX:r,mouseY:o}),true)},endDrag(n,r=null,o=false){if(t$1.dragging===null)return;let i=t$1.dragging,a=t(n,i),l=a?.x??t$1.lastX,s=a?.y??t$1.lastY;e.emit("dragend",{entity:i,x:l,y:s,totalDx:l-t$1.startX,totalDy:s-t$1.startY,cancelled:o}),o||e.emit("drop",{entity:i,x:l,y:s,dropTarget:r}),t$1.dragging=null,t$1.startX=0,t$1.startY=0,t$1.offsetX=0,t$1.offsetY=0,t$1.lastX=0,t$1.lastY=0,t$1.constraints={},t$1.verifyCallback=null;},cancelDrag(n){if(t$1.dragging===null)return;let r=t$1.dragging;s(n,r,t$1.startX,t$1.startY),this.endDrag(n,null,true);}}}function $n(){ee.clear(),J.clear();}n();var te=null,N=new WeakMap,ke=new WeakMap;function Ae(e){let t=N.get(e);return t||(t=[],N.set(e,t)),t}function vt(){return te||(te=a()),te}function jn(){te=null;}var Jn=e=>k(e,[r,c$2,c$1]);function w(e){let t=Jn(e),n=[];for(let r$1 of t){if(!q(e,r$1)||!p$1(e,r$1))continue;let o=c$1.tabIndex[r$1];o<0||n.push({eid:r$1,tabIndex:o,y:r.y[r$1],x:r.x[r$1]});}return n.sort((r,o)=>r.tabIndex!==0&&o.tabIndex!==0?r.tabIndex-o.tabIndex:r.tabIndex!==0?-1:o.tabIndex!==0?1:r.y!==o.y?r.y-o.y:r.x-o.x),n.map(r=>r.eid)}function ne(e){let t=f$1(e);if(!t)return null;let n=b$2.focused[t];return n===a$2?null:n}function L(e,t,n,r){let o=vt();r!==null&&(r$1(e,r,false),g$1(e,r),o.emit("blur",{entity:r,previousEntity:null,nextEntity:n})),n!==null&&(r$1(e,n,true),g$1(e,n),o.emit("focus",{entity:n,previousEntity:r,nextEntity:null})),n$1(e,t,n);}function H(e,t){let n=f$1(e);if(!n||!q(e,t)||!p$1(e,t))return false;let r=b$2.focused[n],o=r===0?null:r;return o===t||L(e,n,t,o),true}function Mt(e){let t=f$1(e);if(!t)return;let n=b$2.focused[t],r=n===0?null:n;r!==null&&L(e,t,null,r);}function er(e){let t=f$1(e);if(!t)return null;let n=w(e);if(n.length===0)return null;let r=b$2.focused[t],o=r===0?null:r,i=0;if(o!==null){let l=n.indexOf(o);l>=0&&(i=(l+1)%n.length);}let a=n[i];return a===void 0?null:(L(e,t,a,o),a)}function tr(e){let t=f$1(e);if(!t)return null;let n=w(e);if(n.length===0)return null;let r=b$2.focused[t],o=r===0?null:r,i=n.length-1;if(o!==null){let l=n.indexOf(o);l>=0&&(i=(l-1+n.length)%n.length);}let a=n[i];return a===void 0?null:(L(e,t,a,o),a)}function Et(e){let t=w(e);if(t.length===0)return null;let n=t[0];return n===void 0?null:H(e,n)?n:null}function nr(e){let t=w(e);if(t.length===0)return null;let n=t[t.length-1];return n===void 0?null:H(e,n)?n:null}function rr(e,t){let n=Ae(e),r=ne(e);return r!==null&&n.push(r),H(e,t)}function or(e){let t=Ae(e);if(t.length===0)return Mt(e),null;let n=t.pop();return q(e,n)&&p$1(e,n)?(H(e,n),n):Ct(e)}function ir(e){let t=ne(e);ke.set(e,t);}function ar(e){let t=ke.get(e);return ke.delete(e),t==null?null:q(e,t)&&p$1(e,t)?(H(e,t),t):null}function Ct(e){let t=Ae(e);for(;t.length>0;){let n=t.pop();if(q(e,n)&&p$1(e,n))return H(e,n),n}return Et(e)}function lr(e,t){if(t===0)return ne(e);let n=f$1(e);if(!n)return null;let r=w(e);if(r.length===0)return null;let o=b$2.focused[n],i=o===0?null:o,a=-1;i!==null&&(a=r.indexOf(i));let l;a<0?l=t>0?0:r.length-1:l=((a+t)%r.length+r.length)%r.length;let s=r[l];return s===void 0?null:(L(e,n,s,i),s)}function sr(e){let t=N.get(e);return t?t.length:0}function ur(e){let t=N.get(e);t&&(t.length=0);}function cr(e){let t=N.get(e);return !t||t.length===0?null:t[t.length-1]??null}var Tt=e=>{let t=f$1(e);if(!t)return e;let n=b$2.focused[t];if(n!==0){let r=n;(!q(e,r)||!p$1(e,r))&&L(e,t,null,r);}return e};function mr(){return Tt}var Wt={targetFrameMs:16.67,phaseBudgets:{},rollingWindowSize:120,warnOnOverrun:true},p=null;function Fe(e){return {samples:Array.from({length:e},()=>0),idx:0,count:0,total:0,min:Number.POSITIVE_INFINITY,max:0}}function kt(e,t){let n=e.samples[e.idx%e.samples.length]??0;e.samples[e.idx%e.samples.length]=t,e.idx++,e.count<e.samples.length?(e.count++,e.total+=t):e.total+=t-n,t<e.min&&(e.min=t),t>e.max&&(e.max=t);}function V(e,t){if(e.count===0)return 0;let n=e.samples.slice(0,e.count).sort((o,i)=>o-i),r=Math.min(Math.floor(n.length*t),n.length-1);return n[r]??0}function Pt(e){return e.count>0?e.total/e.count:0}function fr(e){let t={...Wt,...e};return p={config:t,systemSamples:new Map,phaseTotals:new Map,frameSamples:Fe(t.rollingWindowSize),totalFrames:0,budgetOverruns:0,alerts:[],onAlert:null},Re()}function At(e,t){if(!p)return;let n=p.systemSamples.get(e);n||(n=Fe(p.config.rollingWindowSize),p.systemSamples.set(e,n)),kt(n,t);}function pr(e,t){if(!p)return;p.phaseTotals.set(e,t);let n=p.config.phaseBudgets[e];if(n!==void 0&&t>n){let r={phase:e,budgetMs:n,actualMs:t,frame:p.totalFrames};p.alerts.push(r),p.alerts.length>100&&p.alerts.shift(),p.budgetOverruns++,p.onAlert&&p.onAlert(r);}}function dr(e){p&&(kt(p.frameSamples,e),p.totalFrames++);}function yr(e,t){return n=>{let r=performance.now(),o=t(n);return At(e,performance.now()-r),o}}function Re(){if(!p)return {config:Wt,stats:{frameTimeMs:0,avgFrameMs:0,p50FrameMs:0,p95FrameMs:0,p99FrameMs:0,fps:0,avgFps:0,totalFrames:0,budgetOverruns:0,systemTimings:[],phaseTimings:{}},alerts:[]};let e=p,t=[];for(let[i,a]of e.systemSamples)t.push({name:i,lastMs:a.count>0?a.samples[(a.idx-1+a.samples.length)%a.samples.length]??0:0,avgMs:Pt(a),minMs:a.min===Number.POSITIVE_INFINITY?0:a.min,maxMs:a.max,p50Ms:V(a,.5),p95Ms:V(a,.95),p99Ms:V(a,.99),count:a.count});let n={};for(let[i,a]of e.phaseTotals)n[a$3[i]??"unknown"]=a;let r=e.frameSamples.count>0?e.frameSamples.samples[(e.frameSamples.idx-1+e.frameSamples.samples.length)%e.frameSamples.samples.length]??0:0,o=Pt(e.frameSamples);return {config:e.config,stats:{frameTimeMs:r,avgFrameMs:o,p50FrameMs:V(e.frameSamples,.5),p95FrameMs:V(e.frameSamples,.95),p99FrameMs:V(e.frameSamples,.99),fps:r>0?1e3/r:0,avgFps:o>0?1e3/o:0,totalFrames:e.totalFrames,budgetOverruns:e.budgetOverruns,systemTimings:t,phaseTimings:n},alerts:[...e.alerts]}}function gr(e){p&&(p.onAlert=e);}function br(){p&&(p.systemSamples.clear(),p.phaseTotals.clear(),p.frameSamples=Fe(p.config.rollingWindowSize),p.totalFrames=0,p.budgetOverruns=0,p.alerts=[]);}function Sr(){p=null;}function hr(){let e=Re();return {config:e.config,stats:e.stats,alerts:e.alerts,exportedAt:Date.now()}}n();var xr=1e4;function vr(e=xr){return {x:new Float32Array(e),y:new Float32Array(e),maxSpeed:new Float32Array(e),friction:new Float32Array(e)}}var Mr=vr(),Ft=new WeakSet,Rt=null;function Dt(e){return Ft.has(e)||(Rt=l$1(e,m(()=>Mr)),Ft.add(e)),Rt}function Yt(e){let t=Dt(e);return Array.from(k(e,[t]))}function Er(e,t){let n=Dt(e);return i(e,t,n)}var De=e=>{let t=b(),n=Yt(e);for(let r$1 of n)va(e,r$1)&&ya(r$1,t),za(r$1,t),Aa(r$1),i(e,r$1,r)&&Ba(r$1,t);return e};function Cr(){return De}function Tr(e,t=0){e.registerSystem(4,De,t);}function Pr(e,t,n){for(let r$1 of t)la(e,r$1)&&(va(e,r$1)&&ya(r$1,n),za(r$1,n),Aa(r$1),i(e,r$1,r)&&Ba(r$1,n));}var _={minWidth:4,minHeight:2,maxWidth:0,maxHeight:0,constrainToScreen:true,screenWidth:80,screenHeight:24,snapGrid:0},Ye={deferLayout:true,outlineResize:false,keyboardStep:1,keyboardResizeStep:1};function Ht(){return {entity:void 0,isMoving:false,isResizing:false,resizeHandle:void 0,startX:0,startY:0,panelStartX:0,panelStartY:0,panelStartWidth:0,panelStartHeight:0,layoutDeferred:false}}function Wr(e){return {...Ye,...e}}function kr(e){return {..._,...e}}function Ar(e,t,n,r,o,i,a,l,s){let u={...Ye,...s};return {...e,entity:t,isMoving:true,isResizing:false,resizeHandle:void 0,startX:n,startY:r,panelStartX:o,panelStartY:i,panelStartWidth:a,panelStartHeight:l,layoutDeferred:u.deferLayout}}function Fr(e,t,n,r,o,i,a,l,s,u){let f={...Ye,...u};return {...e,entity:t,isMoving:false,isResizing:true,resizeHandle:n,startX:r,startY:o,panelStartX:i,panelStartY:a,panelStartWidth:l,panelStartHeight:s,layoutDeferred:f.deferLayout}}function Rr(e,t,n,r){if(!e.isMoving)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={..._,...r},i=t-e.startX,a=n-e.startY,l=e.panelStartX+i,s=e.panelStartY+a,u=false;if(o.snapGrid>0&&(l=Math.round(l/o.snapGrid)*o.snapGrid,s=Math.round(s/o.snapGrid)*o.snapGrid),o.constrainToScreen){let d=Math.max(0,Math.min(l,o.screenWidth-e.panelStartWidth)),y=Math.max(0,Math.min(s,o.screenHeight-e.panelStartHeight));(d!==l||y!==s)&&(u=true),l=d,s=y;}let f=Gr(e.panelStartX+(t-e.startX-i+i),e.panelStartY+(n-e.startY-a+a),l,s,e.panelStartWidth,e.panelStartHeight);return {x:l,y:s,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:f,clamped:u}}function Dr(e,t,n,r,o,i,a){let l=t,s=n,u=r,f=o;return (e.includes("right")||e==="right")&&(u+=i),(e.includes("bottom")||e==="bottom")&&(f+=a),(e.includes("left")||e==="left")&&(l+=i,u-=i),(e.includes("top")||e==="top")&&(s+=a,f-=a),{x:l,y:s,w:u,h:f}}function Yr(e,t,n){let r=e,o=t,i=false;return r<n.minWidth&&(r=n.minWidth,i=true),o<n.minHeight&&(o=n.minHeight,i=true),n.maxWidth>0&&r>n.maxWidth&&(r=n.maxWidth,i=true),n.maxHeight>0&&o>n.maxHeight&&(o=n.maxHeight,i=true),{width:r,height:o,clamped:i}}function Hr(e,t,n,r,o){return o<=0?{x:e,y:t,w:n,h:r}:{x:Math.round(e/o)*o,y:Math.round(t/o)*o,w:Math.round(n/o)*o,h:Math.round(r/o)*o}}function Xr(e,t,n,r,o){if(!o.constrainToScreen)return {x:e,y:t,w:n,h:r};let i=Math.max(0,e),a=Math.max(0,t),l=n,s=r;return i+l>o.screenWidth&&(l=o.screenWidth-i),a+s>o.screenHeight&&(s=o.screenHeight-a),{x:i,y:a,w:l,h:s}}function Br(e,t,n,r){if(!e.isResizing||!e.resizeHandle)return {x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight,dirtyRects:[],clamped:false};let o={..._,...r},i=t-e.startX,a=n-e.startY,l=Dr(e.resizeHandle,e.panelStartX,e.panelStartY,e.panelStartWidth,e.panelStartHeight,i,a),s=Yr(l.w,l.h,o);l.w=s.width,l.h=s.height;let u=s.clamped;l=Hr(l.x,l.y,l.w,l.h,o.snapGrid),l=Xr(l.x,l.y,l.w,l.h,o);let f=[{x:e.panelStartX,y:e.panelStartY,width:e.panelStartWidth,height:e.panelStartHeight},{x:l.x,y:l.y,width:l.w,height:l.h}];return {x:l.x,y:l.y,width:l.w,height:l.h,dirtyRects:f,clamped:u}}function Ir(e){return {...e,isMoving:false,isResizing:false,resizeHandle:void 0,layoutDeferred:false}}function Or(e){return {state:Ht(),restoreX:e.panelStartX,restoreY:e.panelStartY,restoreWidth:e.panelStartWidth,restoreHeight:e.panelStartHeight}}function zr(e,t,n,r,o,i,a){let l={..._,...a},s=e,u=t;return o==="up"&&(u-=i),o==="down"&&(u+=i),o==="left"&&(s-=i),o==="right"&&(s+=i),l.constrainToScreen&&(s=Math.max(0,Math.min(s,l.screenWidth-n)),u=Math.max(0,Math.min(u,l.screenHeight-r))),l.snapGrid>0&&(s=Math.round(s/l.snapGrid)*l.snapGrid,u=Math.round(u/l.snapGrid)*l.snapGrid),{x:s,y:u}}function wr(e,t,n,r,o){let i={..._,...o},a=e,l=t;return n==="grow-horizontal"&&(a+=r),n==="shrink-horizontal"&&(a-=r),n==="grow-vertical"&&(l+=r),n==="shrink-vertical"&&(l-=r),a=Math.max(i.minWidth,a),l=Math.max(i.minHeight,l),i.maxWidth>0&&(a=Math.min(i.maxWidth,a)),i.maxHeight>0&&(l=Math.min(i.maxHeight,l)),{width:a,height:l}}function Lr(e,t,n,r,o=1){let i=e<o,a=e>=n-o,l=t<o,s=t>=r-o;if(l&&i)return "topLeft";if(l&&a)return "topRight";if(s&&i)return "bottomLeft";if(s&&a)return "bottomRight";if(l)return "top";if(s)return "bottom";if(i)return "left";if(a)return "right"}function Vr(e){if(e.length===0)return;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=0,o=0;for(let i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x+i.width),o=Math.max(o,i.y+i.height);return {x:t,y:n,width:r-t,height:o-n}}function Gr(e,t,n,r,o,i){return [{x:e,y:t,width:o,height:i},{x:n,y:r,width:o,height:i}]}n();function He(e,t,n){if(!i(e,t,$))return -1;let r$1=d(e),o=Math.floor(Math.random()*n.chars.length),i$1=n.chars[o]??42;aa(e,r$1,{lifetime:$.lifetime[t],char:i$1,startFg:n.startFg,endFg:n.endFg??n.startFg,fadeOut:n.fadeOut??true,emitter:t});let a=w$1(e,t)?r.x[t]:0,l=w$1(e,t)?r.y[t]:0;s(e,r$1,a,l);let s$1=$.angle[t],u=$.spread[t],f=s$1+(Math.random()-.5)*u,d$1=$.speed[t],y=Math.cos(f)*d$1,E=Math.sin(f)*d$1;return ia(e,r$1,y,E),pa(t,r$1),r$1}function qr(e,t,n,r=1e3,o=0){if(!i(e,t,$))return [];let i$1=na(t);if(!i$1)return [];let a=n??$.burstCount[t],l=[];for(let s=0;s<a&&!(o+l.length>=r);s++){let u=He(e,t,i$1);u!==-1&&l.push(u);}return l}function Xt(e,t,n){if(!i(e,t,_$2))return;_$2.age[t]=_$2.age[t]+n;let r=_$2.emitter[t];if(r>0&&ka(e,r)){let o=$.gravity[r];o!==0&&la(e,t)&&(ha.y[t]=ha.y[t]+o*n);}}function Bt(e,t,n){!w$1(e,t)||!la(e,t)||(r.x[t]=r.x[t]+ha.x[t]*n,r.y[t]=r.y[t]+ha.y[t]*n);}function It(e$1,t){let n=_$2.emitter[t];n>0&&qa(n,t),e(e$1,t);}function Ur(e,t){return !(!i(e,t,$)||$.active[t]!==1)}function Nr(e,t,n,r,o){let i=na(t);if(!i)return o;let a=$.rate[t];if(a<=0)return o;$.accumulator[t]=$.accumulator[t]+n;let l=1/a,s=o;for(;$.accumulator[t]>=l&&s<r;)$.accumulator[t]=$.accumulator[t]-l,He(e,t,i)!==-1&&s++;return s}function _r(e,t,n,r,o){let i=o;for(let a of t)Ur(e,a)&&(i=Nr(e,a,n,r,i));return i}function Zr(e,t,n){ca(e,t)&&(Xt(e,t,n),Bt(e,t,n),ea$1(e,t)&&It(e,t));}function Qr(e){let t=e.maxParticles??1e3;return n=>{let r=.016666666666666666,o=e.emitters(n),i=e.particles(n);_r(n,o,r,t,i.length);for(let a of i)Zr(n,a,r);return n}}var Ot={friction:.92,minVelocity:.1,maxVelocity:200,sensitivity:1,springStiffness:.3,springDamping:.8,maxOverscroll:50,enableMomentum:true,enableBounce:true},v=new Map;function Kr(e,t,n,r,o){let i=e,a=v.get(i);return a?(a.contentWidth=t,a.contentHeight=n,a.viewportWidth=r,a.viewportHeight=o):(a={scrollX:0,scrollY:0,velocityX:0,velocityY:0,contentWidth:t,contentHeight:n,viewportWidth:r,viewportHeight:o,isAnimating:false,isUserScrolling:false,targetX:null,targetY:null},v.set(i,a)),a}function $r(e){v.delete(e);}function jr(){v.clear();}function Jr(e,t,n,r){let o={...Ot,...r},i=v.get(e);i&&(i.velocityX+=t*o.sensitivity,i.velocityY+=n*o.sensitivity,i.velocityX=Math.max(-o.maxVelocity,Math.min(o.maxVelocity,i.velocityX)),i.velocityY=Math.max(-o.maxVelocity,Math.min(o.maxVelocity,i.velocityY)),i.isAnimating=true,i.targetX=null,i.targetY=null);}function eo(e,t,n){let r=v.get(e);r&&(r.targetX=t,r.targetY=n,r.isAnimating=true);}function to(e,t,n){let r=v.get(e);r&&(r.scrollX=t,r.scrollY=n,r.velocityX=0,r.velocityY=0,r.targetX=null,r.targetY=null,r.isAnimating=false);}function no(e){let t=v.get(e);t&&(t.isUserScrolling=true,t.velocityX=0,t.velocityY=0);}function ro(e,t,n){let r=v.get(e);r&&(r.isUserScrolling=false,r.velocityX=t,r.velocityY=n,r.isAnimating=Math.abs(t)>.1||Math.abs(n)>.1);}function oo(e,t){let n=Math.max(0,e.contentWidth-e.viewportWidth),r=Math.max(0,e.contentHeight-e.viewportHeight);if(!t.enableBounce){e.scrollX=Math.max(0,Math.min(n,e.scrollX)),e.scrollY=Math.max(0,Math.min(r,e.scrollY));return}let o=e.scrollX<0?e.scrollX:e.scrollX>n?e.scrollX-n:0,i=e.scrollY<0?e.scrollY:e.scrollY>r?e.scrollY-r:0;Math.abs(o)>0&&!e.isUserScrolling&&(e.velocityX-=o*t.springStiffness,e.velocityX*=t.springDamping),Math.abs(i)>0&&!e.isUserScrolling&&(e.velocityY-=i*t.springStiffness,e.velocityY*=t.springDamping),e.scrollX=Math.max(-t.maxOverscroll,Math.min(n+t.maxOverscroll,e.scrollX)),e.scrollY=Math.max(-t.maxOverscroll,Math.min(r+t.maxOverscroll,e.scrollY));}function io(e){if(!(e.targetX===null&&e.targetY===null)){if(e.targetX!==null){let t=e.targetX-e.scrollX;Math.abs(t)<.5?(e.scrollX=e.targetX,e.targetX=null,e.velocityX=0):e.velocityX=t*.15;}if(e.targetY!==null){let t=e.targetY-e.scrollY;Math.abs(t)<.5?(e.scrollY=e.targetY,e.targetY=null,e.velocityY=0):e.velocityY=t*.15;}}}function ao(e,t){e.scrollX+=e.velocityX*t*60,e.scrollY+=e.velocityY*t*60;}function lo(e,t){!t.enableMomentum||e.isUserScrolling||(e.velocityX*=t.friction,e.velocityY*=t.friction);}function so(e,t){return Math.abs(e.velocityX)<t.minVelocity&&Math.abs(e.velocityY)<t.minVelocity&&e.targetX===null&&e.targetY===null}function uo(e){e.velocityX=0,e.velocityY=0,e.isAnimating=false,e.scrollX=Math.round(e.scrollX),e.scrollY=Math.round(e.scrollY);let t=Math.max(0,e.contentWidth-e.viewportWidth),n=Math.max(0,e.contentHeight-e.viewportHeight);e.scrollX=Math.max(0,Math.min(t,e.scrollX)),e.scrollY=Math.max(0,Math.min(n,e.scrollY));}function zt(e,t,n){let r={...Ot,...n};if(!e.isAnimating)return false;let o=e.scrollX,i=e.scrollY;return io(e),ao(e,t),lo(e,r),oo(e,r),so(e,r)&&uo(e),e.scrollX!==o||e.scrollY!==i}function co(e){return v.get(e)?.isAnimating??false}function mo(e){let t=v.get(e);return t?{x:t.scrollX,y:t.scrollY}:null}function fo(e){let t=performance.now();return n=>{let r=performance.now(),o=Math.min((r-t)/1e3,1/15);t=r;for(let[,i]of v)zt(i,o,e);return n}}n();var wt=8;function po(e){return {cellSize:e?.cellSize??wt,cells:new Map,entityCells:new Map}}function Xe(e,t){let n=e>=0?e*2:-e*2-1,r=t>=0?t*2:-t*2-1;return (n+r)*(n+r+1)/2+r}function yo(e,t,n){return {cx:Math.floor(t/e.cellSize),cy:Math.floor(n/e.cellSize)}}function oe(e,t,n,r,o=1,i=1){Lt(e,t);let a=t,l=new Set,s=Math.floor(n/e.cellSize),u=Math.floor(r/e.cellSize),f=Math.floor((n+o-.001)/e.cellSize),d=Math.floor((r+i-.001)/e.cellSize);for(let y=s;y<=f;y++)for(let E=u;E<=d;E++){let C=Xe(y,E);l.add(C);let R=e.cells.get(C);R||(R=new Set,e.cells.set(C,R)),R.add(a);}e.entityCells.set(a,l);}function Lt(e,t){let n=t,r=e.entityCells.get(n);if(r){for(let o of r){let i=e.cells.get(o);i&&(i.delete(n),i.size===0&&e.cells.delete(o));}e.entityCells.delete(n);}}function Be(e,t,n,r=1,o=1){let i=new Set,a=Math.floor(t/e.cellSize),l=Math.floor(n/e.cellSize),s=Math.floor((t+r-.001)/e.cellSize),u=Math.floor((n+o-.001)/e.cellSize);for(let f=a;f<=s;f++)for(let d=l;d<=u;d++){let y=Xe(f,d),E=e.cells.get(y);if(E)for(let C of E)i.add(C);}return i}function go(e,t){let n=t,r=new Set,o=e.entityCells.get(n);if(!o)return r;for(let i of o){let a=e.cells.get(i);if(a)for(let l of a)l!==n&&r.add(l);}return r}function Vt(e,t,n){let r=Xe(t,n);return e.cells.get(r)??new Set}function bo(e,t,n){let r=Math.floor(t/e.cellSize),o=Math.floor(n/e.cellSize);return Vt(e,r,o)}function Gt(e){e.cells.clear(),e.entityCells.clear();}function So(e){let t=0,n=0;for(let o of e.cells.values())n+=o.size,o.size>t&&(t=o.size);let r=e.cells.size;return {cellCount:r,entityCount:e.entityCells.size,averageEntitiesPerCell:r>0?n/r:0,maxEntitiesInCell:t}}function qt(e,t){Gt(e);let n=k(t,[r,Q]);for(let r$1 of n){let o=r.x[r$1],i=r.y[r$1],a=Q.width[r$1],l=Q.height[r$1],s=Q.offsetX[r$1],u=Q.offsetY[r$1];oe(e,r$1,o+s,i+u,a,l);}}var re=null;function ho(e){re=e;}function xo(){return re}var Ut=e=>(re&&qt(re,e),e);function vo(){return Ut}n();var Mo=1e4;function Eo(e=Mo){return {machineId:new Uint32Array(e),currentState:new Uint16Array(e),previousState:new Uint16Array(e),stateAge:new Float32Array(e)}}var A=Eo(),Nt=new WeakSet,_t=null;function Co(e){return Nt.has(e)||(_t=l$1(e,m(()=>A)),Nt.add(e)),_t}function Zt(e){let t=Co(e);return Array.from(k(e,[t]))}function To(){return A.stateAge}var Ie=e=>{let t=b(),n=Zt(e);for(let r of n){let o=A.stateAge[r]??0;A.stateAge[r]=o+t;}return e};function Po(){return Ie}function Wo(e,t=0){e.registerSystem(2,Ie,t);}function ko(e,t){for(let n of e){let r=A.stateAge[n]??0;A.stateAge[n]=r+t;}}function Ao(e){A.stateAge[e]=0;}function Fo(e){return A.stateAge[e]??0}n();var F=null,ie=null;function Ro(e){F=e;}function Do(){return F}function Yo(){return ie}function Ho(){ie=null;}function Xo(){F=null,ie=null;}function Qt(e,t){let n=[];for(let r=0;r<t;r++){let o=[];for(let i=0;i<e;i++)o.push({char:" ",fg:0,bg:0});n.push(o);}return {width:e,height:t,cells:n}}function Bo(e,t,n,r){let o=" ",i=0,a=0;for(let l of e.layers){if(!l.visible)continue;let s=l.tiles[r*e.width+n];if(s===ya$1)continue;let u=t.tiles[s];u&&(o=u.char,i=u.fg,a=u.bg);}return {char:o,fg:i,bg:a}}function Io(e,t,n,r,o,i){for(let a=0;a<i;a++){let l=r+a;if(l<0||l>=e.height)continue;let s=e.cells[l];if(s)for(let u=0;u<o;u++){let f=n+u;f<0||f>=e.width||(s[f]=t);}}}function Oo(e,t,n,r,o,i,a,l){let s=Math.max(0,Math.floor(-e/o)),u=Math.max(0,Math.floor(-t/i)),f=Math.min(n,Math.ceil((a-e)/o)),d=Math.min(r,Math.ceil((l-t)/i));return [s,u,f,d]}function Kt(e,t,n,r$1){let o=Sa.width[t],i=Sa.height[t],a=Sa.tileWidth[t],l=Sa.tileHeight[t],s=Sa.dataId[t],u=Sa.tilesetId[t],f=Fa.data.get(s),d=za$1.tilesets.get(u);if(!f||!d)return;let y=r.x[t],E=r.y[t],C=y-n,R=E-r$1,[nn,rn,on,an]=Oo(C,R,o,i,a,l,e.width,e.height);for(let Z=rn;Z<an;Z++)for(let Q=nn;Q<on;Q++){let ln=Bo(f,d,Q,Z),sn=Math.round(C+Q*a),un=Math.round(R+Z*l);Io(e,ln,sn,un,a,l);}}function $t(e){if(!F)return null;let t=Qt(F.viewportWidth,F.viewportHeight),n=k(e,[Sa,r]);for(let r of n)Kt(t,r,F.camera.x,F.camera.y);return ie=t,t}var jt=e=>($t(e),e);function zo(){return jt}n();function wo(){return {prevX:new Map,prevY:new Map,prevW:new Map,prevH:new Map}}function Jt(e,t,n,r,o,i,a){let l=n,s=t.prevX.get(l),u=t.prevY.get(l),f=t.prevW.get(l),d=t.prevH.get(l);return s===r&&u===o&&f===i&&d===a?false:(oe(e,n,r,o,i,a),t.prevX.set(l,r),t.prevY.set(l,o),t.prevW.set(l,i),t.prevH.set(l,a),true)}function Lo(e,t){let n=t;e.prevX.delete(n),e.prevY.delete(n),e.prevW.delete(n),e.prevH.delete(n);}function Vo(e){e.prevX.clear(),e.prevY.clear(),e.prevW.clear(),e.prevH.clear();}function Oe(e,t){return Be(e,t.x,t.y,t.width,t.height)}function Go(e,t,n){let r=Oe(e,t),o=Array.from(r);return {visible:o,total:n,culled:n-o.length}}function qo(e,t){return n=>{let r$1=k(n,[r]);for(let o of r$1){let i$1=r.x[o],a=r.y[o],l=1,s=1;i(n,o,K)&&(l=K.width[o],s=K.height[o]),Jt(e,t,o,i$1,a,l,s);}return n}}function Uo(e,t){return n=>{let r=t();return Oe(e,r),n}}function No(){try{let e=globalThis.require?.("os");if(e?.cpus)return Math.max(1,e.cpus().length-1)}catch{}return 2}var en={maxWorkers:No(),taskTimeout:5e3,enabled:true},c=null,ze=0;function _o(e){return c={config:{...en,...e},queue:[],running:new Map,handlers:new Map,completedCount:0,cancelledCount:0,failedCount:0,totalDurationMs:0},tn()}function Zo(e,t){c&&c.handlers.set(e,t);}function Qo(e,t,n="normal"){if(!c||!c.config.enabled)return Jo(e,t);let r=`task-${ze++}`,o={id:r,type:e,input:t,priority:n,queuedAt:Date.now()};return new Promise(i=>{if(!c){i({id:r,type:e,output:void 0,cancelled:false,error:"Worker pool not initialized",durationMs:0});return}let a=c.handlers.get(e);if(!a){i({id:r,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});return}let l={task:o,resolve:i,handler:a,timerHandle:null},s={high:0,normal:1,low:2},u=s[n],f=c.queue.length;for(let d=0;d<c.queue.length;d++){let y=c.queue[d];if(y&&s[y.task.priority]>u){f=d;break}}c.queue.splice(f,0,l),queueMicrotask(()=>oi());})}function Ko(e){if(!c)return false;let t=c.queue.findIndex(n=>n.task.id===e);if(t>=0){let[n]=c.queue.splice(t,1);return n?(n.resolve({id:e,type:n.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0}),c.cancelledCount++,true):false}return false}function $o(e){if(!c)return 0;let t=0,n=[];for(let r of c.queue)r.task.type===e?(r.resolve({id:r.task.id,type:e,output:void 0,cancelled:true,error:void 0,durationMs:0}),t++):n.push(r);return c.queue=n,c.cancelledCount+=t,t}function tn(){if(!c)return {config:en,stats:{activeWorkers:0,idleWorkers:0,queuedTasks:0,runningTasks:0,completedTasks:0,cancelledTasks:0,failedTasks:0,avgDurationMs:0,enabled:false}};let e=c.completedCount+c.failedCount;return {config:c.config,stats:{activeWorkers:c.running.size,idleWorkers:Math.max(0,c.config.maxWorkers-c.running.size),queuedTasks:c.queue.length,runningTasks:c.running.size,completedTasks:c.completedCount,cancelledTasks:c.cancelledCount,failedTasks:c.failedCount,avgDurationMs:e>0?c.totalDurationMs/e:0,enabled:c.config.enabled}}}function jo(){if(c){for(let e of c.queue)e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:true,error:void 0,durationMs:0});for(let e of c.running.values())e.timerHandle&&clearTimeout(e.timerHandle);c=null,ze=0;}}function Jo(e,t){let n=`sync-${ze++}`,r=c?.handlers.get(e);if(!r)return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:`No handler registered for task type: ${e}`,durationMs:0});let o=performance.now();try{let i=r(t);return Promise.resolve({id:n,type:e,output:i,cancelled:!1,error:void 0,durationMs:performance.now()-o})}catch(i){return Promise.resolve({id:n,type:e,output:void 0,cancelled:false,error:i instanceof Error?i.message:String(i),durationMs:performance.now()-o})}}function ei(e,t){t<=0||(e.timerHandle=setTimeout(()=>{c&&(c.running.delete(e.task.id),c.failedCount++,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:`Task timed out after ${t}ms`,durationMs:t}));},t));}function ti(e,t,n){c&&c.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),c.running.delete(e.task.id),c.completedCount++,c.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:t,cancelled:false,error:void 0,durationMs:n}));}function ni(e,t,n){c&&c.running.has(e.task.id)&&(e.timerHandle&&clearTimeout(e.timerHandle),c.running.delete(e.task.id),c.failedCount++,c.totalDurationMs+=n,e.resolve({id:e.task.id,type:e.task.type,output:void 0,cancelled:false,error:t instanceof Error?t.message:String(t),durationMs:n}));}function ri(e){if(!c)return;ei(e,c.config.taskTimeout);let t=performance.now();try{let n=e.handler(e.task.input),r=performance.now()-t;ti(e,n,r);}catch(n){let r=performance.now()-t;ni(e,n,r);}}function oi(){if(c)for(;c.queue.length>0&&c.running.size<c.config.maxWorkers;){let e=c.queue.shift();if(!e)break;c.running.set(e.task.id,e),ri(e);}}export{mr as $,go as $a,Vn as A,wr as Aa,zo as Ab,ht as B,Lr as Ba,wo as Bb,Gn as C,Vr as Ca,Jt as Cb,qn as D,He as Da,Lo as Db,xt as E,qr as Ea,Vo as Eb,Kn as F,Xt as Fa,Oe as Fb,$n as G,Bt as Ga,Go as Gb,vt as H,It as Ha,qo as Hb,jn as I,Qr as Ia,Uo as Ib,w as J,Kr as Ja,_o as Jb,ne as K,$r as Ka,Zo as Kb,H as L,jr as La,Qo as Lb,Mt as M,Jr as Ma,Ko as Mb,er as N,eo as Na,$o as Nb,tr as O,to as Oa,tn as Ob,Et as P,no as Pa,jo as Pb,nr as Q,ro as Qa,rr as R,zt as Ra,or as S,co as Sa,ir as T,mo as Ta,ar as U,fo as Ua,Ct as V,wt as Va,lr as W,po as Wa,sr as X,yo as Xa,ur as Y,oe as Ya,cr as Z,Lt as Za,Tt as _,Be as _a,yt as a,fr as aa,Vt as ab,pn as b,At as ba,bo as bb,Ce as c,pr as ca,Gt as cb,dn as d,dr as da,So as db,yn as e,yr as ea,qt as eb,gn as f,Re as fa,ho as fb,hn as g,gr as ga,xo as gb,Te as h,br as ha,Ut as hb,Pe as i,Sr as ia,vo as ib,Cn as j,hr as ja,Zt as jb,Tn as k,Yt as ka,To as kb,Pn as l,Er as la,Ie as lb,Wn as m,De as ma,Po as mb,kn as n,Cr as na,Wo as nb,An as o,Tr as oa,ko as ob,Fn as p,Pr as pa,Ao as pb,bt as q,Ht as qa,Fo as qb,St as r,Wr as ra,Ro as rb,We as s,kr as sa,Do as sb,Hn as t,Ar as ta,Yo as tb,Xn as u,Fr as ua,Ho as ub,Bn as v,Rr as va,Xo as vb,In as w,Br as wa,Qt as wb,On as x,Ir as xa,Kt as xb,zn as y,Or as ya,$t as yb,wn as z,zr as za,jt as zb};
@@ -1 +0,0 @@
1
- import {g as g$1,f,j as j$1}from'./chunk-Z4EZERNE.js';import {n,i as i$1,h}from'./chunk-PXXGH3BV.js';n();var g=1e4,e={left:new Uint8Array(g),top:new Uint8Array(g),right:new Uint8Array(g),bottom:new Uint8Array(g)};function S(r){e.left[r]=0,e.top[r]=0,e.right[r]=0,e.bottom[r]=0;}function w(r,t){i$1(r,t,e)||(h(r,t,e),S(t));}function U(r,t,n){return g$1.parse(n),w(r,t),n.left!==void 0&&(e.left[t]=n.left),n.top!==void 0&&(e.top[t]=n.top),n.right!==void 0&&(e.right[t]=n.right),n.bottom!==void 0&&(e.bottom[t]=n.bottom),t}function k(r,t,n){return f.parse(n),w(r,t),e.left[t]=n,e.top[t]=n,e.right[t]=n,e.bottom[t]=n,t}function C(r,t,n,o){return f.parse(n),f.parse(o),w(r,t),e.left[t]=n,e.right[t]=n,e.top[t]=o,e.bottom[t]=o,t}function F(r,t){if(i$1(r,t,e))return {left:e.left[t],top:e.top[t],right:e.right[t],bottom:e.bottom[t]}}function D(r,t){return i$1(r,t,e)}function B(r,t){return i$1(r,t,e)?e.left[t]+e.right[t]:0}function L(r,t){return i$1(r,t,e)?e.top[t]+e.bottom[t]:0}function I(r,t){return i$1(r,t,e)?e.left[t]>0||e.top[t]>0||e.right[t]>0||e.bottom[t]>0:false}n();var u=1e4,Y=(o=>(o[o.Hidden=0]="Hidden",o[o.Visible=1]="Visible",o[o.Auto=2]="Auto",o))(Y||{}),l={scrollX:new Float32Array(u),scrollY:new Float32Array(u),scrollWidth:new Float32Array(u),scrollHeight:new Float32Array(u),viewportWidth:new Float32Array(u),viewportHeight:new Float32Array(u),scrollbarVisible:new Uint8Array(u),trackVisible:new Uint8Array(u),alwaysScroll:new Uint8Array(u),clampEnabled:new Uint8Array(u)};function X(r){l.scrollX[r]=0,l.scrollY[r]=0,l.scrollWidth[r]=0,l.scrollHeight[r]=0,l.viewportWidth[r]=0,l.viewportHeight[r]=0,l.scrollbarVisible[r]=2,l.trackVisible[r]=1,l.alwaysScroll[r]=0,l.clampEnabled[r]=1;}function i(r,t){i$1(r,t,l)||(h(r,t,l),X(t));}function m(r){if(!(l.clampEnabled[r]===1))return;let n=l.viewportWidth[r],o=l.viewportHeight[r],c=l.scrollWidth[r],s=l.scrollHeight[r];if(n>0){let b=Math.max(0,c-n);l.scrollX[r]=Math.max(0,Math.min(b,l.scrollX[r]));}else l.scrollX[r]=Math.max(0,l.scrollX[r]);if(o>0){let b=Math.max(0,s-o);l.scrollY[r]=Math.max(0,Math.min(b,l.scrollY[r]));}else l.scrollY[r]=Math.max(0,l.scrollY[r]);}function A(r,t){t.scrollWidth!==void 0&&(l.scrollWidth[r]=t.scrollWidth),t.scrollHeight!==void 0&&(l.scrollHeight[r]=t.scrollHeight),t.viewportWidth!==void 0&&(l.viewportWidth[r]=t.viewportWidth),t.viewportHeight!==void 0&&(l.viewportHeight[r]=t.viewportHeight),t.scrollbarVisible!==void 0&&(l.scrollbarVisible[r]=t.scrollbarVisible);}function P(r,t){t.trackVisible!==void 0&&(l.trackVisible[r]=t.trackVisible?1:0),t.alwaysScroll!==void 0&&(l.alwaysScroll[r]=t.alwaysScroll?1:0),t.clampEnabled!==void 0&&(l.clampEnabled[r]=t.clampEnabled?1:0);}function V(r,t){A(r,t),P(r,t),t.scrollX!==void 0&&(l.scrollX[r]=t.scrollX),t.scrollY!==void 0&&(l.scrollY[r]=t.scrollY),m(r);}function j(r,t,n){return j$1.parse(n),i(r,t),V(t,n),t}function M(r,t,n,o){return i(r,t),l.scrollX[t]=n,l.scrollY[t]=o,m(t),t}function q(r,t){return i$1(r,t,l)?{x:l.scrollX[t],y:l.scrollY[t]}:{x:0,y:0}}function z(r,t,n,o){return i(r,t),l.scrollX[t]=l.scrollX[t]+n,l.scrollY[t]=l.scrollY[t]+o,m(t),t}function G(r,t,n,o){return M(r,t,n,o)}function J(r,t){if(!i$1(r,t,l))return {x:0,y:0};let n=l.scrollX[t],o=l.scrollY[t],c=l.scrollWidth[t],s=l.scrollHeight[t],b=l.viewportWidth[t],W=l.viewportHeight[t],h=c-b,p=s-W,E=h>0?n/h*100:0,x=p>0?o/p*100:0;return {x:Math.min(100,Math.max(0,E)),y:Math.min(100,Math.max(0,x))}}function K(r,t,n,o){i(r,t);let c=l.scrollWidth[t],s=l.scrollHeight[t],b=l.viewportWidth[t],W=l.viewportHeight[t],h=Math.min(100,Math.max(0,n)),p=Math.min(100,Math.max(0,o)),E=Math.max(0,c-b),x=Math.max(0,s-W);return l.scrollX[t]=h/100*E,l.scrollY[t]=p/100*x,t}function Q(r,t){if(i$1(r,t,l))return {scrollX:l.scrollX[t],scrollY:l.scrollY[t],scrollWidth:l.scrollWidth[t],scrollHeight:l.scrollHeight[t],viewportWidth:l.viewportWidth[t],viewportHeight:l.viewportHeight[t],scrollbarVisible:l.scrollbarVisible[t],trackVisible:l.trackVisible[t]===1,alwaysScroll:l.alwaysScroll[t]===1,clampEnabled:l.clampEnabled[t]===1}}function Z(r,t){return i$1(r,t,l)}function $(r,t,n,o){return i(r,t),l.scrollWidth[t]=n,l.scrollHeight[t]=o,m(t),t}function tt(r,t,n,o){return i(r,t),l.viewportWidth[t]=n,l.viewportHeight[t]=o,m(t),t}function rt(r,t,n){return i(r,t),l.scrollbarVisible[t]=n,t}function lt(r,t){return i(r,t),l.scrollY[t]=0,t}function nt(r,t){i(r,t);let n=l.scrollHeight[t],o=l.viewportHeight[t];return l.scrollY[t]=Math.max(0,n-o),t}function ot(r,t){return i(r,t),l.scrollX[t]=0,t}function et(r,t){i(r,t);let n=l.scrollWidth[t],o=l.viewportWidth[t];return l.scrollX[t]=Math.max(0,n-o),t}function at(r,t){if(!i$1(r,t,l))return false;let n=l.scrollWidth[t],o=l.scrollHeight[t],c=l.viewportWidth[t],s=l.viewportHeight[t];return c>0||s>0?n>c||o>s:n>0||o>0}function ct(r,t){if(!i$1(r,t,l))return false;let n=l.scrollWidth[t],o=l.viewportWidth[t];return n>o}function st(r,t){if(!i$1(r,t,l))return false;let n=l.scrollHeight[t],o=l.viewportHeight[t];return n>o}function it(r,t){return i$1(r,t,l)?l.scrollY[t]<=0:true}function ut(r,t){if(!i$1(r,t,l))return true;let n=l.scrollY[t],o=l.scrollHeight[t],c=l.viewportHeight[t],s=Math.max(0,o-c);return n>=s}function bt(r,t){return i$1(r,t,l)?l.scrollX[t]<=0:true}function mt(r,t){if(!i$1(r,t,l))return true;let n=l.scrollX[t],o=l.scrollWidth[t],c=l.viewportWidth[t],s=Math.max(0,o-c);return n>=s}export{et as A,at as B,ct as C,st as D,it as E,ut as F,bt as G,mt as H,e as a,U as b,k as c,C as d,F as e,D as f,B as g,L as h,I as i,Y as j,l as k,j as l,M as m,q as n,z as o,G as p,J as q,K as r,Q as s,Z as t,$ as u,tt as v,rt as w,lt as x,nt as y,ot as z};