nothumanallowed 14.5.16 → 14.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "14.5.16",
3
+ "version": "14.6.0",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,6 +63,7 @@
63
63
  "acorn-jsx": "^5.3.2",
64
64
  "imapflow": "^1.3.3",
65
65
  "mailparser": "^3.9.8",
66
+ "typescript": "^6.0.3",
66
67
  "ws": "^8.18.0"
67
68
  },
68
69
  "optionalDependencies": {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '14.5.16';
8
+ export const VERSION = '14.6.0';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1926,7 +1926,75 @@ export function register(router) {
1926
1926
  });
1927
1927
 
1928
1928
  // ── Diagnostics (lint) — returns errors/warnings for a file ───────────────
1929
- // ── Advanced LinterAST-based diagnostics (acorn + scope analysis) ─────────
1929
+ // ── TypeScript checkJs linter enterprise-grade diagnostics ─────────────────
1930
+
1931
+ let _tscPath = null;
1932
+ let _tscChecked = false;
1933
+
1934
+ function findTsc() {
1935
+ if (_tscChecked) return _tscPath;
1936
+ _tscChecked = true;
1937
+ // Our own bundled tsc (from package dependency)
1938
+ const __dir = path.dirname(fileURLToPath(import.meta.url));
1939
+ const ownTsc = path.resolve(__dir, '../../node_modules/.bin/tsc');
1940
+ const candidates = [
1941
+ ownTsc,
1942
+ path.resolve(__dir, '../../../node_modules/.bin/tsc'),
1943
+ ];
1944
+ // Also try global
1945
+ try {
1946
+ const globalTsc = require('child_process').execSync('which tsc 2>/dev/null || where tsc 2>nul', { encoding: 'utf-8', timeout: 3000 }).trim();
1947
+ if (globalTsc) candidates.push(globalTsc);
1948
+ } catch {}
1949
+ for (const c of candidates) {
1950
+ try { if (fs.existsSync(c)) { _tscPath = c; return c; } } catch {}
1951
+ }
1952
+ return null;
1953
+ }
1954
+
1955
+ async function lintJSWithTypeScript(projectDir, relPath) {
1956
+ const tsc = findTsc();
1957
+ if (!tsc) return null; // fallback to acorn
1958
+
1959
+ const absFile = path.join(projectDir, relPath);
1960
+ if (!fs.existsSync(absFile)) return null;
1961
+
1962
+ try {
1963
+ const { stdout, stderr } = await execAsync(
1964
+ `"${tsc}" --noEmit --checkJs --allowJs --target es2020 --moduleResolution node --skipLibCheck --lib es2020,dom --strict false "${absFile}" 2>&1`,
1965
+ { cwd: projectDir, timeout: 10000 }
1966
+ );
1967
+ const output = stdout || stderr || '';
1968
+ const diagnostics = [];
1969
+ // Parse tsc output: path(line,col): error TSxxxx: message
1970
+ const lineRegex = /\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(.+)/g;
1971
+ let m;
1972
+ while ((m = lineRegex.exec(output)) !== null) {
1973
+ diagnostics.push({
1974
+ from: { line: parseInt(m[1]), col: parseInt(m[2]) - 1 },
1975
+ severity: m[3] === 'error' ? 'error' : 'warning',
1976
+ message: m[4].trim(),
1977
+ });
1978
+ }
1979
+ return diagnostics;
1980
+ } catch (e) {
1981
+ // tsc returns exit code 1 when there are errors — parse its output
1982
+ const output = e.stdout || e.stderr || e.message || '';
1983
+ const diagnostics = [];
1984
+ const lineRegex = /\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(.+)/g;
1985
+ let m;
1986
+ while ((m = lineRegex.exec(output)) !== null) {
1987
+ diagnostics.push({
1988
+ from: { line: parseInt(m[1]), col: parseInt(m[2]) - 1 },
1989
+ severity: m[3] === 'error' ? 'error' : 'warning',
1990
+ message: m[4].trim(),
1991
+ });
1992
+ }
1993
+ return diagnostics.length > 0 ? diagnostics : null;
1994
+ }
1995
+ }
1996
+
1997
+ // ── Acorn fallback linter — AST-based diagnostics ──────────────────────────
1930
1998
 
1931
1999
  const JsxParser = acorn.Parser.extend(acornJsx());
1932
2000
  const JS_BUILTINS = new Set([
@@ -2316,9 +2384,11 @@ export function register(router) {
2316
2384
  const ext = (relPath.split('.').pop() || '').toLowerCase();
2317
2385
  let diagnostics = [];
2318
2386
 
2319
- // JavaScript / JSX — full AST analysis
2387
+ // JavaScript / JSX — try TypeScript checkJs first, fallback to acorn
2320
2388
  if (['js', 'mjs', 'jsx', 'cjs'].includes(ext)) {
2321
- diagnostics = lintJS(content, relPath, projectName);
2389
+ const projectDir = ProjectStore.dir(projectName);
2390
+ const tsDiags = await lintJSWithTypeScript(projectDir, relPath);
2391
+ diagnostics = tsDiags || lintJS(content, relPath, projectName);
2322
2392
  }
2323
2393
 
2324
2394
  // JSON — parse errors with precise location
@@ -2512,7 +2582,8 @@ export function register(router) {
2512
2582
 
2513
2583
  let diags = [];
2514
2584
  if (['js', 'mjs', 'jsx', 'cjs'].includes(ext)) {
2515
- diags = lintJS(content, relPath, projectName);
2585
+ const tsDiags = await lintJSWithTypeScript(dir, relPath);
2586
+ diags = tsDiags || lintJS(content, relPath, projectName);
2516
2587
  } else if (ext === 'json') {
2517
2588
  try { JSON.parse(content); } catch (e) {
2518
2589
  diags.push({ from: { line: 1, col: 0 }, severity: 'error', message: e.message });
@@ -2693,7 +2764,25 @@ module.exports.default = store;
2693
2764
  `;
2694
2765
 
2695
2766
  // Security headers shim (express middleware)
2696
- const helmetShim = `module.exports = () => (req, res, next) => next();`;
2767
+ const helmetShim = `
2768
+ const noop = (req, res, next) => next();
2769
+ const handler = () => noop;
2770
+ handler.contentSecurityPolicy = handler;
2771
+ handler.crossOriginEmbedderPolicy = handler;
2772
+ handler.crossOriginOpenerPolicy = handler;
2773
+ handler.crossOriginResourcePolicy = handler;
2774
+ handler.dnsPrefetchControl = handler;
2775
+ handler.frameguard = handler;
2776
+ handler.hidePoweredBy = handler;
2777
+ handler.hsts = handler;
2778
+ handler.ieNoOpen = handler;
2779
+ handler.noSniff = handler;
2780
+ handler.originAgentCluster = handler;
2781
+ handler.permittedCrossDomainPolicies = handler;
2782
+ handler.referrerPolicy = handler;
2783
+ handler.xssFilter = handler;
2784
+ module.exports = handler;
2785
+ `;
2697
2786
 
2698
2787
  // Generic no-op shim for unknown enterprise deps
2699
2788
  const noopShim = `module.exports = new Proxy({}, { get: () => new Proxy(() => {}, { get: (_, p) => p === 'then' ? undefined : new Proxy(() => {}, { get: (__, q) => q === 'then' ? undefined : () => {} }) }) });`;
@@ -673,9 +673,9 @@ Be concise. Highlight what each agent contributed uniquely. Give your own synthe
673
673
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:if(e.altKey){o.key=r.C0.ESC+r.C0.DEL;break}o.key=r.C0.DEL;break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let n=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[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],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],r=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],i;t.UnicodeV6=class{constructor(){if(this.version=`6`,!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<n.length;++e)i.fill(0,n[e][0],n[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,r)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n=Object.assign({},t.DEFAULT_OPTIONS);for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=e.length;for(let r=0;r<n;++r){let i=e.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=n)return t+this.wcwidth(i);let a=e.charCodeAt(r);56320<=a&&a<=57343?i=1024*(i-55296)+a-56320+65536:t+=this.wcwidth(a)}t+=this.wcwidth(i)}return t}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions=Object.assign({},this._core.options);let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
674
674
  `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))}))(),NT=2,PT=1,FT=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(NT,Math.floor(u/e.css.cell.width)),rows:Math.max(PT,Math.floor(l/e.css.cell.height))}}};function IT({wsUrl:e,projectDir:t,logs:n,className:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!i.current)return;let e=new MT.Terminal({theme:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#6366f1`,selectionBackground:`rgba(99, 102, 241, 0.3)`,black:`#0d1117`,red:`#f87171`,green:`#4ade80`,yellow:`#facc15`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#e6edf3`,brightBlack:`#484f58`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde68a`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},fontSize:12,fontFamily:`'SF Mono', Monaco, 'Cascadia Code', monospace`,cursorBlink:!0,cursorStyle:`bar`,scrollback:5e3,convertEol:!0}),t=new FT;e.loadAddon(t),e.open(i.current),t.fit(),a.current=e,o.current=t;let n=new ResizeObserver(()=>{try{t.fit()}catch{}});return n.observe(i.current),()=>{n.disconnect(),e.dispose(),a.current=null,o.current=null}},[]),(0,_.useEffect)(()=>{if(!a.current)return;let n=a.current,r=window.location.protocol===`https:`?`wss:`:`ws:`,i=e||`${r}//${window.location.host}/ws/terminal${t?`?cwd=${encodeURIComponent(t)}`:``}`,o=new WebSocket(i);return s.current=o,o.binaryType=`arraybuffer`,o.onmessage=e=>{e.data instanceof ArrayBuffer?n.write(new Uint8Array(e.data)):n.write(e.data)},o.onclose=()=>{n.write(`\r
675
675
  \x1B[90m[disconnected]\x1B[0m\r
676
- `)},n.onData(e=>{o.readyState===WebSocket.OPEN&&o.send(e)}),()=>{o.close(),s.current=null}},[e,t]),(0,_.useEffect)(()=>{if(!n||!a.current)return;let e=a.current;for(let t of n)e.writeln(t)},[n]),(0,k.jsx)(`div`,{ref:i,className:r,style:{flex:1,minHeight:0,overflow:`hidden`,background:`#0d1117`}})}var $={root:`_root_tixg5_2`,header:`_header_tixg5_10`,title:`_title_tixg5_21`,subtitle:`_subtitle_tixg5_28`,headerTabs:`_headerTabs_tixg5_34`,tabBtn:`_tabBtn_tixg5_40`,tabActive:`_tabActive_tixg5_51`,body:`_body_tixg5_58`,editor:`_editor_tixg5_67`,examples:`_examples_tixg5_75`,sectionLabel:`_sectionLabel_tixg5_81`,examplePills:`_examplePills_tixg5_89`,examplePill:`_examplePill_tixg5_89`,editorCols:`_editorCols_tixg5_109`,leftSidebar:`_leftSidebar_tixg5_119`,panel:`_panel_tixg5_128`,panelHeader:`_panelHeader_tixg5_135`,panelTitle:`_panelTitle_tixg5_142`,addBtn:`_addBtn_tixg5_149`,blockLabel:`_blockLabel_tixg5_160`,blockCheck:`_blockCheck_tixg5_170`,authField:`_authField_tixg5_173`,authFieldInput:`_authFieldInput_tixg5_183`,authFieldSelect:`_authFieldSelect_tixg5_193`,authFieldReq:`_authFieldReq_tixg5_204`,removeFieldBtn:`_removeFieldBtn_tixg5_205`,skillsList:`_skillsList_tixg5_208`,skillRow:`_skillRow_tixg5_210`,skillIcon:`_skillIcon_tixg5_218`,skillName:`_skillName_tixg5_220`,skillBadge:`_skillBadge_tixg5_229`,skillBadge_skill:`_skillBadge_skill_tixg5_237`,skillBadge_memory:`_skillBadge_memory_tixg5_238`,skillBadge_provider:`_skillBadge_provider_tixg5_239`,skillBadge_log:`_skillBadge_log_tixg5_240`,skillEmpty:`_skillEmpty_tixg5_242`,skillBtn:`_skillBtn_tixg5_244`,skillsEmpty:`_skillsEmpty_tixg5_246`,snapshotRow:`_snapshotRow_tixg5_249`,snapshotTs:`_snapshotTs_tixg5_258`,snapshotCount:`_snapshotCount_tixg5_259`,snapshotBtn:`_snapshotBtn_tixg5_260`,genStatus:`_genStatus_tixg5_263`,repairStatus:`_repairStatus_tixg5_265`,repairStatusTitle:`_repairStatusTitle_tixg5_266`,repairStatusProg:`_repairStatusProg_tixg5_267`,repairStatusFile:`_repairStatusFile_tixg5_268`,actionRow:`_actionRow_tixg5_271`,actionBtn:`_actionBtn_tixg5_273`,actionBtnIcon:`_actionBtnIcon_tixg5_275`,actionBtnActive:`_actionBtnActive_tixg5_276`,repairBtn:`_repairBtn_tixg5_278`,sandboxBtn:`_sandboxBtn_tixg5_280`,statsBar:`_statsBar_tixg5_282`,rightPanel:`_rightPanel_tixg5_285`,rightTabBar:`_rightTabBar_tixg5_296`,rightTab:`_rightTab_tixg5_296`,rightTabActive:`_rightTabActive_tixg5_313`,repairBar:`_repairBar_tixg5_316`,repairBarRow:`_repairBarRow_tixg5_326`,repairBarIcon:`_repairBarIcon_tixg5_327`,repairBarLabel:`_repairBarLabel_tixg5_328`,repairBarFile:`_repairBarFile_tixg5_329`,repairBarCounter:`_repairBarCounter_tixg5_330`,repairBarTime:`_repairBarTime_tixg5_331`,genBar:`_genBar_tixg5_333`,genBarRow:`_genBarRow_tixg5_343`,genBarRobot:`_genBarRobot_tixg5_344`,robotBob:`_robotBob_tixg5_1`,genBarLabel:`_genBarLabel_tixg5_345`,genBarFile:`_genBarFile_tixg5_346`,genBarCounter:`_genBarCounter_tixg5_347`,genBarTime:`_genBarTime_tixg5_348`,progressTrack:`_progressTrack_tixg5_350`,repairProgress:`_repairProgress_tixg5_351`,genProgress:`_genProgress_tixg5_352`,genDots:`_genDots_tixg5_355`,dot:`_dot_tixg5_356`,dot1:`_dot1_tixg5_357`,dotBounce:`_dotBounce_tixg5_1`,dot2:`_dot2_tixg5_358`,dot3:`_dot3_tixg5_359`,stopBtn:`_stopBtn_tixg5_362`,codeArea:`_codeArea_tixg5_365`,sandboxWrap:`_sandboxWrap_tixg5_366`,sandboxFrame:`_sandboxFrame_tixg5_367`,sandboxEmpty:`_sandboxEmpty_tixg5_368`,sandboxStartBtn:`_sandboxStartBtn_tixg5_369`,sandboxStatusBar:`_sandboxStatusBar_tixg5_372`,sandboxStatusDot:`_sandboxStatusDot_tixg5_381`,sandboxStatusText:`_sandboxStatusText_tixg5_382`,sandboxStartBtnSmall:`_sandboxStartBtnSmall_tixg5_383`,runtimeErrors:`_runtimeErrors_tixg5_386`,runtimeErrorsHeader:`_runtimeErrorsHeader_tixg5_392`,runtimeErrorsFix:`_runtimeErrorsFix_tixg5_401`,runtimeErrorsDismiss:`_runtimeErrorsDismiss_tixg5_413`,runtimeErrorLine:`_runtimeErrorLine_tixg5_414`,sandboxConsole:`_sandboxConsole_tixg5_425`,sandboxConsoleCollapsed:`_sandboxConsoleCollapsed_tixg5_434`,sandboxConsoleHeader:`_sandboxConsoleHeader_tixg5_435`,sandboxConsoleTitle:`_sandboxConsoleTitle_tixg5_447`,sandboxConsolePort:`_sandboxConsolePort_tixg5_448`,sandboxConsoleDots:`_sandboxConsoleDots_tixg5_449`,sandboxConsoleToggle:`_sandboxConsoleToggle_tixg5_450`,sandboxReloadBtn:`_sandboxReloadBtn_tixg5_451`,sandboxStopBtn:`_sandboxStopBtn_tixg5_453`,sandboxConsoleBody:`_sandboxConsoleBody_tixg5_455`,sandboxLogLine:`_sandboxLogLine_tixg5_461`,sandboxLogPhase:`_sandboxLogPhase_tixg5_470`,sandboxLogError:`_sandboxLogError_tixg5_471`,sandboxLogWarn:`_sandboxLogWarn_tixg5_472`,sandboxLogOk:`_sandboxLogOk_tixg5_473`,codeLayout:`_codeLayout_tixg5_476`,codeRow:`_codeRow_tixg5_485`,ideTabBar:`_ideTabBar_tixg5_493`,ideTab:`_ideTab_tixg5_493`,ideTabActive:`_ideTabActive_tixg5_525`,ideTabError:`_ideTabError_tixg5_530`,ideTabPending:`_ideTabPending_tixg5_531`,ideTabIcon:`_ideTabIcon_tixg5_532`,ideTabName:`_ideTabName_tixg5_533`,ideTabDot:`_ideTabDot_tixg5_534`,ideTabUnsaved:`_ideTabUnsaved_tixg5_540`,codeEditorWrap:`_codeEditorWrap_tixg5_548`,editToggleBtn:`_editToggleBtn_tixg5_559`,editToggleBtnActive:`_editToggleBtnActive_tixg5_570`,codeEditor:`_codeEditor_tixg5_548`,genCursor:`_genCursor_tixg5_592`,cursorBlink:`_cursorBlink_tixg5_1`,diffOverlay:`_diffOverlay_tixg5_601`,diffOverlayHeader:`_diffOverlayHeader_tixg5_610`,diffOverlayActions:`_diffOverlayActions_tixg5_621`,diffAcceptBtn:`_diffAcceptBtn_tixg5_622`,diffRejectBtn:`_diffRejectBtn_tixg5_623`,diffOverlayBody:`_diffOverlayBody_tixg5_624`,diffSame:`_diffSame_tixg5_625`,diffRem:`_diffRem_tixg5_626`,diffAdd:`_diffAdd_tixg5_627`,noFiles:`_noFiles_tixg5_629`,noFilesHero:`_noFilesHero_tixg5_639`,noFilesIcon:`_noFilesIcon_tixg5_646`,noFilesTitle:`_noFilesTitle_tixg5_648`,noFilesTagline:`_noFilesTagline_tixg5_655`,noFilesSteps:`_noFilesSteps_tixg5_660`,noFilesStep:`_noFilesStep_tixg5_660`,noFilesStepNum:`_noFilesStepNum_tixg5_677`,noFilesExamplesHint:`_noFilesExamplesHint_tixg5_691`,noFilesExampleBtn:`_noFilesExampleBtn_tixg5_701`,codeViewer:`_codeViewer_tixg5_713`,codeHeader:`_codeHeader_tixg5_721`,codeFileIcon:`_codeFileIcon_tixg5_734`,codeFileName:`_codeFileName_tixg5_735`,codeFileMeta:`_codeFileMeta_tixg5_736`,fileError:`_fileError_tixg5_738`,fileSyntaxError:`_fileSyntaxError_tixg5_739`,filePending:`_filePending_tixg5_740`,codeWithLines:`_codeWithLines_tixg5_743`,lineNumbers:`_lineNumbers_tixg5_750`,lineNum:`_lineNum_tixg5_750`,code:`_code_tixg5_365`,codeError:`_codeError_tixg5_781`,codeSyntaxError:`_codeSyntaxError_tixg5_782`,fileSidebar:`_fileSidebar_tixg5_785`,fileSidebarHeader:`_fileSidebarHeader_tixg5_794`,fileTab:`_fileTab_tixg5_804`,fileTabActive:`_fileTabActive_tixg5_820`,fileTabError:`_fileTabError_tixg5_821`,fileTabRow:`_fileTabRow_tixg5_823`,fileTabIcon:`_fileTabIcon_tixg5_824`,fileTabName:`_fileTabName_tixg5_825`,fileTabSize:`_fileTabSize_tixg5_826`,fileTabDir:`_fileTabDir_tixg5_827`,fileTabTokens:`_fileTabTokens_tixg5_828`,fileTabMeta:`_fileTabMeta_tixg5_829`,projectsList:`_projectsList_tixg5_832`,emptyProjects:`_emptyProjects_tixg5_834`,emptyIcon:`_emptyIcon_tixg5_835`,emptyHint:`_emptyHint_tixg5_836`,projectCard:`_projectCard_tixg5_838`,projectInfo:`_projectInfo_tixg5_839`,projectName:`_projectName_tixg5_840`,projectDesc:`_projectDesc_tixg5_841`,projectMeta:`_projectMeta_tixg5_842`,openBtn:`_openBtn_tixg5_843`,deleteBtn:`_deleteBtn_tixg5_844`,planBanner:`_planBanner_tixg5_847`,planTitle:`_planTitle_tixg5_856`,planText:`_planText_tixg5_857`,planActions:`_planActions_tixg5_858`,planApprove:`_planApprove_tixg5_859`,planReject:`_planReject_tixg5_860`,grepPanel:`_grepPanel_tixg5_863`,grepRow:`_grepRow_tixg5_872`,grepInput:`_grepInput_tixg5_873`,grepBtn:`_grepBtn_tixg5_875`,grepClose:`_grepClose_tixg5_876`,grepCount:`_grepCount_tixg5_877`,grepResults:`_grepResults_tixg5_878`,grepEmpty:`_grepEmpty_tixg5_879`,grepMatch:`_grepMatch_tixg5_880`,grepMatchFile:`_grepMatchFile_tixg5_882`,grepMatchLine:`_grepMatchLine_tixg5_883`,diffPanel:`_diffPanel_tixg5_886`,diffHeader:`_diffHeader_tixg5_895`,diffClose:`_diffClose_tixg5_896`,diffFile:`_diffFile_tixg5_897`,diffSummary:`_diffSummary_tixg5_898`,diffArrow:`_diffArrow_tixg5_899`,diffFileName:`_diffFileName_tixg5_900`,diffAdded:`_diffAdded_tixg5_901`,diffRemoved:`_diffRemoved_tixg5_902`,diffContent:`_diffContent_tixg5_903`,diffInline:`_diffInline_tixg5_906`,diffInlineHeader:`_diffInlineHeader_tixg5_907`,diffRemLine:`_diffRemLine_tixg5_908`,diffAddLine:`_diffAddLine_tixg5_909`,chatPanel:`_chatPanel_tixg5_912`,chatMessages:`_chatMessages_tixg5_921`,chatWelcome:`_chatWelcome_tixg5_923`,doctrineOpenBtn:`_doctrineOpenBtn_tixg5_924`,streamingPre:`_streamingPre_tixg5_927`,streamingCursor:`_streamingCursor_tixg5_940`,streamBlink:`_streamBlink_tixg5_1`,doctrineSubtitle:`_doctrineSubtitle_tixg5_947`,doctrineSection:`_doctrineSection_tixg5_948`,doctrineSectionTitle:`_doctrineSectionTitle_tixg5_953`,doctrineSectionBody:`_doctrineSectionBody_tixg5_960`,doctrineBullet:`_doctrineBullet_tixg5_969`,chatUser:`_chatUser_tixg5_979`,chatUserBubble:`_chatUserBubble_tixg5_980`,chatAttachPreviews:`_chatAttachPreviews_tixg5_981`,chatAttachBadge:`_chatAttachBadge_tixg5_982`,chatSystem:`_chatSystem_tixg5_984`,chatSystemBubble:`_chatSystemBubble_tixg5_985`,chatSyntaxErr:`_chatSyntaxErr_tixg5_986`,chatAgent:`_chatAgent_tixg5_988`,chatAgentCard:`_chatAgentCard_tixg5_989`,chatAgentHeader:`_chatAgentHeader_tixg5_990`,chatAgentRobot:`_chatAgentRobot_tixg5_991`,chatAgentRobotAnim:`_chatAgentRobotAnim_tixg5_992`,chatAgentLabel:`_chatAgentLabel_tixg5_993`,chatRunningDots:`_chatRunningDots_tixg5_994`,chatAgentText:`_chatAgentText_tixg5_995`,chatToolBadges:`_chatToolBadges_tixg5_996`,toolBadge:`_toolBadge_tixg5_997`,toolBadgeOk:`_toolBadgeOk_tixg5_998`,toolBadgeErr:`_toolBadgeErr_tixg5_999`,cursor:`_cursor_tixg5_1001`,blink:`_blink_tixg5_1`,attachPreviews:`_attachPreviews_tixg5_1004`,attachBadge:`_attachBadge_tixg5_1005`,removeAttachBtn:`_removeAttachBtn_tixg5_1006`,projNameRow:`_projNameRow_tixg5_1009`,projNameLabel:`_projNameLabel_tixg5_1010`,projNameInput:`_projNameInput_tixg5_1011`,projActiveRow:`_projActiveRow_tixg5_1012`,projActiveName:`_projActiveName_tixg5_1013`,chatInputRow:`_chatInputRow_tixg5_1016`,attachLabel:`_attachLabel_tixg5_1017`,chatTextarea:`_chatTextarea_tixg5_1018`,chatSendCol:`_chatSendCol_tixg5_1021`,chatSendBtn:`_chatSendBtn_tixg5_1022`,chatStopBtn:`_chatStopBtn_tixg5_1024`,modalOverlay:`_modalOverlay_tixg5_1027`,modal:`_modal_tixg5_1027`,modalHeader:`_modalHeader_tixg5_1049`,modalTitle:`_modalTitle_tixg5_1050`,modalClose:`_modalClose_tixg5_1051`,modalBody:`_modalBody_tixg5_1053`,modalRow:`_modalRow_tixg5_1055`,modalField:`_modalField_tixg5_1056`,modalLabel:`_modalLabel_tixg5_1057`,modalLabelRow:`_modalLabelRow_tixg5_1058`,modalSelect:`_modalSelect_tixg5_1060`,modalInput:`_modalInput_tixg5_1061`,modalHint:`_modalHint_tixg5_1064`,modalAiBox:`_modalAiBox_tixg5_1066`,modalAiRow:`_modalAiRow_tixg5_1067`,modalAiDesc:`_modalAiDesc_tixg5_1068`,modalAiBtn:`_modalAiBtn_tixg5_1069`,modalContentArea:`_modalContentArea_tixg5_1072`,logView:`_logView_tixg5_1075`,modalFooter:`_modalFooter_tixg5_1077`,modalCancelBtn:`_modalCancelBtn_tixg5_1078`,modalSaveBtn:`_modalSaveBtn_tixg5_1079`,fileTreeWrap:`_fileTreeWrap_tixg5_1082`,headerIconBtn:`_headerIconBtn_tixg5_1092`,headerIconBtnActive:`_headerIconBtnActive_tixg5_1103`,terminalPanel:`_terminalPanel_tixg5_1106`,terminalHeader:`_terminalHeader_tixg5_1114`,terminalTitle:`_terminalTitle_tixg5_1123`,terminalClose:`_terminalClose_tixg5_1124`,scanBanner:`_scanBanner_tixg5_1127`,scanBannerIcon:`_scanBannerIcon_tixg5_1136`,scanBannerText:`_scanBannerText_tixg5_1137`,scanBannerFix:`_scanBannerFix_tixg5_1138`,findBar:`_findBar_tixg5_1141`,findInput:`_findInput_tixg5_1150`,findCount:`_findCount_tixg5_1161`,findBtn:`_findBtn_tixg5_1162`,findClose:`_findClose_tixg5_1164`};function LT(e,t){let n=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);return e.split(`
676
+ `)},n.onData(e=>{o.readyState===WebSocket.OPEN&&o.send(e)}),()=>{o.close(),s.current=null}},[e,t]),(0,_.useEffect)(()=>{if(!n||!a.current)return;let e=a.current;for(let t of n)e.writeln(t)},[n]),(0,k.jsx)(`div`,{ref:i,className:r,style:{flex:1,minHeight:0,overflow:`hidden`,background:`#0d1117`}})}var $={root:`_root_tixg5_2`,header:`_header_tixg5_10`,title:`_title_tixg5_21`,subtitle:`_subtitle_tixg5_28`,headerTabs:`_headerTabs_tixg5_34`,tabBtn:`_tabBtn_tixg5_40`,tabActive:`_tabActive_tixg5_51`,body:`_body_tixg5_58`,editor:`_editor_tixg5_67`,examples:`_examples_tixg5_75`,sectionLabel:`_sectionLabel_tixg5_81`,examplePills:`_examplePills_tixg5_89`,examplePill:`_examplePill_tixg5_89`,editorCols:`_editorCols_tixg5_109`,leftSidebar:`_leftSidebar_tixg5_119`,panel:`_panel_tixg5_128`,panelHeader:`_panelHeader_tixg5_135`,panelTitle:`_panelTitle_tixg5_142`,addBtn:`_addBtn_tixg5_149`,blockLabel:`_blockLabel_tixg5_160`,blockCheck:`_blockCheck_tixg5_170`,authField:`_authField_tixg5_173`,authFieldInput:`_authFieldInput_tixg5_183`,authFieldSelect:`_authFieldSelect_tixg5_193`,authFieldReq:`_authFieldReq_tixg5_204`,removeFieldBtn:`_removeFieldBtn_tixg5_205`,skillsList:`_skillsList_tixg5_208`,skillRow:`_skillRow_tixg5_210`,skillIcon:`_skillIcon_tixg5_218`,skillName:`_skillName_tixg5_220`,skillBadge:`_skillBadge_tixg5_229`,skillBadge_skill:`_skillBadge_skill_tixg5_237`,skillBadge_memory:`_skillBadge_memory_tixg5_238`,skillBadge_provider:`_skillBadge_provider_tixg5_239`,skillBadge_log:`_skillBadge_log_tixg5_240`,skillEmpty:`_skillEmpty_tixg5_242`,skillBtn:`_skillBtn_tixg5_244`,skillsEmpty:`_skillsEmpty_tixg5_246`,snapshotRow:`_snapshotRow_tixg5_249`,snapshotTs:`_snapshotTs_tixg5_258`,snapshotCount:`_snapshotCount_tixg5_259`,snapshotBtn:`_snapshotBtn_tixg5_260`,genStatus:`_genStatus_tixg5_263`,repairStatus:`_repairStatus_tixg5_265`,repairStatusTitle:`_repairStatusTitle_tixg5_266`,repairStatusProg:`_repairStatusProg_tixg5_267`,repairStatusFile:`_repairStatusFile_tixg5_268`,actionRow:`_actionRow_tixg5_271`,actionBtn:`_actionBtn_tixg5_273`,actionBtnIcon:`_actionBtnIcon_tixg5_275`,actionBtnActive:`_actionBtnActive_tixg5_276`,repairBtn:`_repairBtn_tixg5_278`,sandboxBtn:`_sandboxBtn_tixg5_280`,statsBar:`_statsBar_tixg5_282`,rightPanel:`_rightPanel_tixg5_285`,rightTabBar:`_rightTabBar_tixg5_296`,rightTab:`_rightTab_tixg5_296`,rightTabActive:`_rightTabActive_tixg5_313`,repairBar:`_repairBar_tixg5_316`,repairBarRow:`_repairBarRow_tixg5_326`,repairBarIcon:`_repairBarIcon_tixg5_327`,repairBarLabel:`_repairBarLabel_tixg5_328`,repairBarFile:`_repairBarFile_tixg5_329`,repairBarCounter:`_repairBarCounter_tixg5_330`,repairBarTime:`_repairBarTime_tixg5_331`,genBar:`_genBar_tixg5_333`,genBarRow:`_genBarRow_tixg5_343`,genBarRobot:`_genBarRobot_tixg5_344`,robotBob:`_robotBob_tixg5_1`,genBarLabel:`_genBarLabel_tixg5_345`,genBarFile:`_genBarFile_tixg5_346`,genBarCounter:`_genBarCounter_tixg5_347`,genBarTime:`_genBarTime_tixg5_348`,progressTrack:`_progressTrack_tixg5_350`,repairProgress:`_repairProgress_tixg5_351`,genProgress:`_genProgress_tixg5_352`,genDots:`_genDots_tixg5_355`,dot:`_dot_tixg5_356`,dot1:`_dot1_tixg5_357`,dotBounce:`_dotBounce_tixg5_1`,dot2:`_dot2_tixg5_358`,dot3:`_dot3_tixg5_359`,stopBtn:`_stopBtn_tixg5_362`,codeArea:`_codeArea_tixg5_365`,sandboxWrap:`_sandboxWrap_tixg5_366`,sandboxFrame:`_sandboxFrame_tixg5_367`,sandboxEmpty:`_sandboxEmpty_tixg5_368`,sandboxStartBtn:`_sandboxStartBtn_tixg5_369`,sandboxStatusBar:`_sandboxStatusBar_tixg5_372`,sandboxStatusDot:`_sandboxStatusDot_tixg5_381`,sandboxStatusText:`_sandboxStatusText_tixg5_382`,sandboxStartBtnSmall:`_sandboxStartBtnSmall_tixg5_383`,runtimeErrors:`_runtimeErrors_tixg5_386`,runtimeErrorsHeader:`_runtimeErrorsHeader_tixg5_392`,runtimeErrorsFix:`_runtimeErrorsFix_tixg5_401`,runtimeErrorsDismiss:`_runtimeErrorsDismiss_tixg5_413`,runtimeErrorLine:`_runtimeErrorLine_tixg5_414`,sandboxConsole:`_sandboxConsole_tixg5_425`,sandboxConsoleCollapsed:`_sandboxConsoleCollapsed_tixg5_434`,sandboxConsoleHeader:`_sandboxConsoleHeader_tixg5_435`,sandboxConsoleTitle:`_sandboxConsoleTitle_tixg5_447`,sandboxConsolePort:`_sandboxConsolePort_tixg5_448`,sandboxConsoleDots:`_sandboxConsoleDots_tixg5_449`,sandboxConsoleToggle:`_sandboxConsoleToggle_tixg5_450`,sandboxReloadBtn:`_sandboxReloadBtn_tixg5_451`,sandboxStopBtn:`_sandboxStopBtn_tixg5_453`,sandboxConsoleBody:`_sandboxConsoleBody_tixg5_455`,sandboxLogLine:`_sandboxLogLine_tixg5_461`,sandboxLogPhase:`_sandboxLogPhase_tixg5_470`,sandboxLogError:`_sandboxLogError_tixg5_471`,sandboxLogWarn:`_sandboxLogWarn_tixg5_472`,sandboxLogOk:`_sandboxLogOk_tixg5_473`,codeLayout:`_codeLayout_tixg5_476`,codeRow:`_codeRow_tixg5_485`,ideTabBar:`_ideTabBar_tixg5_493`,ideTab:`_ideTab_tixg5_493`,ideTabActive:`_ideTabActive_tixg5_525`,ideTabError:`_ideTabError_tixg5_530`,ideTabPending:`_ideTabPending_tixg5_531`,ideTabIcon:`_ideTabIcon_tixg5_532`,ideTabName:`_ideTabName_tixg5_533`,ideTabDot:`_ideTabDot_tixg5_534`,ideTabUnsaved:`_ideTabUnsaved_tixg5_540`,codeEditorWrap:`_codeEditorWrap_tixg5_548`,editToggleBtn:`_editToggleBtn_tixg5_559`,editToggleBtnActive:`_editToggleBtnActive_tixg5_570`,codeEditor:`_codeEditor_tixg5_548`,genCursor:`_genCursor_tixg5_592`,cursorBlink:`_cursorBlink_tixg5_1`,diffOverlay:`_diffOverlay_tixg5_601`,diffOverlayHeader:`_diffOverlayHeader_tixg5_610`,diffOverlayActions:`_diffOverlayActions_tixg5_621`,diffAcceptBtn:`_diffAcceptBtn_tixg5_622`,diffRejectBtn:`_diffRejectBtn_tixg5_623`,diffOverlayBody:`_diffOverlayBody_tixg5_624`,diffSame:`_diffSame_tixg5_625`,diffRem:`_diffRem_tixg5_626`,diffAdd:`_diffAdd_tixg5_627`,noFiles:`_noFiles_tixg5_629`,noFilesHero:`_noFilesHero_tixg5_639`,noFilesIcon:`_noFilesIcon_tixg5_646`,noFilesTitle:`_noFilesTitle_tixg5_648`,noFilesTagline:`_noFilesTagline_tixg5_655`,noFilesSteps:`_noFilesSteps_tixg5_660`,noFilesStep:`_noFilesStep_tixg5_660`,noFilesStepNum:`_noFilesStepNum_tixg5_677`,noFilesExamplesHint:`_noFilesExamplesHint_tixg5_691`,noFilesExampleBtn:`_noFilesExampleBtn_tixg5_701`,codeViewer:`_codeViewer_tixg5_713`,codeHeader:`_codeHeader_tixg5_721`,codeFileIcon:`_codeFileIcon_tixg5_734`,codeFileName:`_codeFileName_tixg5_735`,codeFileMeta:`_codeFileMeta_tixg5_736`,fileError:`_fileError_tixg5_738`,fileSyntaxError:`_fileSyntaxError_tixg5_739`,filePending:`_filePending_tixg5_740`,codeWithLines:`_codeWithLines_tixg5_743`,lineNumbers:`_lineNumbers_tixg5_750`,lineNum:`_lineNum_tixg5_750`,code:`_code_tixg5_365`,codeError:`_codeError_tixg5_781`,codeSyntaxError:`_codeSyntaxError_tixg5_782`,fileSidebar:`_fileSidebar_tixg5_785`,fileSidebarHeader:`_fileSidebarHeader_tixg5_794`,fileTab:`_fileTab_tixg5_804`,fileTabActive:`_fileTabActive_tixg5_820`,fileTabError:`_fileTabError_tixg5_821`,fileTabRow:`_fileTabRow_tixg5_823`,fileTabIcon:`_fileTabIcon_tixg5_824`,fileTabName:`_fileTabName_tixg5_825`,fileTabSize:`_fileTabSize_tixg5_826`,fileTabDir:`_fileTabDir_tixg5_827`,fileTabTokens:`_fileTabTokens_tixg5_828`,fileTabMeta:`_fileTabMeta_tixg5_829`,projectsList:`_projectsList_tixg5_832`,emptyProjects:`_emptyProjects_tixg5_834`,emptyIcon:`_emptyIcon_tixg5_835`,emptyHint:`_emptyHint_tixg5_836`,projectCard:`_projectCard_tixg5_838`,projectInfo:`_projectInfo_tixg5_839`,projectName:`_projectName_tixg5_840`,projectDesc:`_projectDesc_tixg5_841`,projectMeta:`_projectMeta_tixg5_842`,openBtn:`_openBtn_tixg5_843`,deleteBtn:`_deleteBtn_tixg5_844`,planBanner:`_planBanner_tixg5_847`,planTitle:`_planTitle_tixg5_856`,planText:`_planText_tixg5_857`,planActions:`_planActions_tixg5_858`,planApprove:`_planApprove_tixg5_859`,planReject:`_planReject_tixg5_860`,grepPanel:`_grepPanel_tixg5_863`,grepRow:`_grepRow_tixg5_872`,grepInput:`_grepInput_tixg5_873`,grepBtn:`_grepBtn_tixg5_875`,grepClose:`_grepClose_tixg5_876`,grepCount:`_grepCount_tixg5_877`,grepResults:`_grepResults_tixg5_878`,grepEmpty:`_grepEmpty_tixg5_879`,grepMatch:`_grepMatch_tixg5_880`,grepMatchFile:`_grepMatchFile_tixg5_882`,grepMatchLine:`_grepMatchLine_tixg5_883`,diffPanel:`_diffPanel_tixg5_886`,diffHeader:`_diffHeader_tixg5_895`,diffClose:`_diffClose_tixg5_896`,diffFile:`_diffFile_tixg5_897`,diffSummary:`_diffSummary_tixg5_898`,diffArrow:`_diffArrow_tixg5_899`,diffFileName:`_diffFileName_tixg5_900`,diffAdded:`_diffAdded_tixg5_901`,diffRemoved:`_diffRemoved_tixg5_902`,diffContent:`_diffContent_tixg5_903`,diffInline:`_diffInline_tixg5_906`,diffInlineHeader:`_diffInlineHeader_tixg5_907`,diffRemLine:`_diffRemLine_tixg5_908`,diffAddLine:`_diffAddLine_tixg5_909`,chatPanel:`_chatPanel_tixg5_912`,chatMessages:`_chatMessages_tixg5_921`,chatWelcome:`_chatWelcome_tixg5_923`,doctrineOpenBtn:`_doctrineOpenBtn_tixg5_924`,streamingPre:`_streamingPre_tixg5_927`,streamingCursor:`_streamingCursor_tixg5_940`,streamBlink:`_streamBlink_tixg5_1`,doctrineSubtitle:`_doctrineSubtitle_tixg5_947`,doctrineSection:`_doctrineSection_tixg5_948`,doctrineSectionTitle:`_doctrineSectionTitle_tixg5_953`,doctrineSectionBody:`_doctrineSectionBody_tixg5_960`,doctrineBullet:`_doctrineBullet_tixg5_969`,chatUser:`_chatUser_tixg5_979`,chatUserBubble:`_chatUserBubble_tixg5_980`,chatAttachPreviews:`_chatAttachPreviews_tixg5_981`,chatAttachBadge:`_chatAttachBadge_tixg5_982`,chatSystem:`_chatSystem_tixg5_984`,chatSystemBubble:`_chatSystemBubble_tixg5_985`,chatSyntaxErr:`_chatSyntaxErr_tixg5_986`,chatAgent:`_chatAgent_tixg5_988`,chatAgentCard:`_chatAgentCard_tixg5_989`,chatAgentHeader:`_chatAgentHeader_tixg5_990`,chatAgentRobot:`_chatAgentRobot_tixg5_991`,chatAgentRobotAnim:`_chatAgentRobotAnim_tixg5_992`,chatAgentLabel:`_chatAgentLabel_tixg5_993`,chatRunningDots:`_chatRunningDots_tixg5_994`,chatAgentText:`_chatAgentText_tixg5_995`,chatToolBadges:`_chatToolBadges_tixg5_996`,toolBadge:`_toolBadge_tixg5_997`,toolBadgeOk:`_toolBadgeOk_tixg5_998`,toolBadgeErr:`_toolBadgeErr_tixg5_999`,cursor:`_cursor_tixg5_1001`,blink:`_blink_tixg5_1`,attachPreviews:`_attachPreviews_tixg5_1004`,attachBadge:`_attachBadge_tixg5_1005`,removeAttachBtn:`_removeAttachBtn_tixg5_1006`,projNameRow:`_projNameRow_tixg5_1009`,projNameLabel:`_projNameLabel_tixg5_1010`,projNameInput:`_projNameInput_tixg5_1011`,projActiveRow:`_projActiveRow_tixg5_1012`,projActiveName:`_projActiveName_tixg5_1013`,chatInputRow:`_chatInputRow_tixg5_1016`,attachLabel:`_attachLabel_tixg5_1017`,chatTextarea:`_chatTextarea_tixg5_1018`,chatSendCol:`_chatSendCol_tixg5_1021`,chatSendBtn:`_chatSendBtn_tixg5_1022`,chatStopBtn:`_chatStopBtn_tixg5_1024`,modalOverlay:`_modalOverlay_tixg5_1027`,modal:`_modal_tixg5_1027`,modalHeader:`_modalHeader_tixg5_1049`,modalTitle:`_modalTitle_tixg5_1050`,modalClose:`_modalClose_tixg5_1051`,modalBody:`_modalBody_tixg5_1053`,modalRow:`_modalRow_tixg5_1055`,modalField:`_modalField_tixg5_1056`,modalLabel:`_modalLabel_tixg5_1057`,modalLabelRow:`_modalLabelRow_tixg5_1058`,modalSelect:`_modalSelect_tixg5_1060`,modalInput:`_modalInput_tixg5_1061`,modalHint:`_modalHint_tixg5_1064`,modalAiBox:`_modalAiBox_tixg5_1066`,modalAiRow:`_modalAiRow_tixg5_1067`,modalAiDesc:`_modalAiDesc_tixg5_1068`,modalAiBtn:`_modalAiBtn_tixg5_1069`,modalContentArea:`_modalContentArea_tixg5_1072`,logView:`_logView_tixg5_1075`,modalFooter:`_modalFooter_tixg5_1077`,modalCancelBtn:`_modalCancelBtn_tixg5_1078`,modalSaveBtn:`_modalSaveBtn_tixg5_1079`,fileTreeWrap:`_fileTreeWrap_tixg5_1082`,headerIconBtn:`_headerIconBtn_tixg5_1092`,headerIconBtnActive:`_headerIconBtnActive_tixg5_1103`,terminalPanel:`_terminalPanel_tixg5_1106`,terminalHeader:`_terminalHeader_tixg5_1114`,terminalTitle:`_terminalTitle_tixg5_1123`,terminalClose:`_terminalClose_tixg5_1124`,scanBanner:`_scanBanner_tixg5_1127`,scanBannerIcon:`_scanBannerIcon_tixg5_1136`,scanBannerText:`_scanBannerText_tixg5_1137`,scanBannerFix:`_scanBannerFix_tixg5_1138`,findBar:`_findBar_tixg5_1141`,findInput:`_findInput_tixg5_1150`,findCount:`_findCount_tixg5_1161`,findBtn:`_findBtn_tixg5_1162`,findClose:`_findClose_tixg5_1164`};function LT(e,t){if(!e)return``;let n=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);return e.split(`
677
677
  `).map(e=>{let r=n(e);if(t===`css`)r=r.replace(/([a-z-]+)\s*(?=:)/g,`<span style="color:#82aaff">$1</span>`),r=r.replace(/(\/\*[\s\S]*?\*\/)/g,`<span style="color:#546e7a;font-style:italic">$1</span>`);else if(t===`html`||t===`htm`)r=r.replace(/(&lt;\/?)([\w-]+)/g,`$1<span style="color:#f07178">$2</span>`),r=r.replace(/\s([\w-]+)(?==)/g,` <span style="color:#ffcb6b">$1</span>`),r=r.replace(/(["'])(?:(?!\1).)*?\1/g,`<span style="color:#c3e88d">$&</span>`);else if(t===`json`)r=r.replace(/(["'])(?:(?!\1|\\).|\\.)*?\1(?=\s*:)/g,`<span style="color:#82aaff">$&</span>`),r=r.replace(/:\s*(["'])(?:(?!\1|\\).|\\.)*?\1/g,e=>`: <span style="color:#c3e88d">`+e.slice(2)+`</span>`),r=r.replace(/:\s*(true|false|null)\b/g,`: <span style="color:#c792ea">$1</span>`),r=r.replace(/:\s*(\d+\.?\d*)/g,`: <span style="color:#f78c6c">$1</span>`);else{if(/^\s*\/\//.test(r))return`<span style="color:#546e7a;font-style:italic">`+r+`</span>`;r=r.replace(/(["'`])(?:(?!\1|\\).|\\.)*?\1/g,`<span style="color:#c3e88d">$&</span>`),r=r.replace(/\b(const|let|var|function|return|if|else|for|while|switch|case|break|continue|try|catch|throw|new|class|extends|import|export|from|default|async|await|typeof|instanceof)\b/g,`<span style="color:#c792ea">$&</span>`),r=r.replace(/\b(null|undefined|true|false)\b/g,`<span style="color:#ff5370">$&</span>`),r=r.replace(/\b(require|module|exports|console|process)\b/g,`<span style="color:#82aaff">$&</span>`)}return r}).join(`
678
- `)}function RT(e){let t=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);return e.split(/(```[\s\S]*?```)/g).map(e=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.indexOf(`
678
+ `)}function RT(e){if(!e)return``;let t=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);return e.split(/(```[\s\S]*?```)/g).map(e=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.indexOf(`
679
679
  `);return r>0&&n.slice(0,r).trim(),`<pre style="background:rgba(0,0,0,0.3);border:1px solid rgba(255,255,255,0.08);border-radius:6px;padding:8px 10px;margin:6px 0;overflow-x:auto;font-size:11px;line-height:1.5"><code>${t(r>0?n.slice(r+1):n)}</code></pre>`}let n=t(e);return n=n.replace(/`([^`]+)`/g,`<code style="background:rgba(99,102,241,0.15);padding:1px 5px;border-radius:3px;font-size:0.9em">$1</code>`),n=n.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),n=n.replace(/\*([^*]+)\*/g,`<em>$1</em>`),n=n.replace(/^### (.+)$/gm,`<div style="font-weight:700;font-size:13px;margin-top:8px;color:#6366f1">$1</div>`),n=n.replace(/^## (.+)$/gm,`<div style="font-weight:700;font-size:14px;margin-top:10px;color:#818cf8">$1</div>`),n=n.replace(/^[-*] (.+)$/gm,`<div style="padding-left:12px">• $1</div>`),n=n.replace(/^\d+\. (.+)$/gm,(e,t)=>`<div style="padding-left:12px">${t}</div>`),n=n.replace(/\n/g,`<br/>`),n}).join(``)}var zT=[{name:`MySaaS`,desc:`Full-stack SaaS web application with Node.js/Express backend and vanilla JS frontend.
680
680
 
681
681
  BACKEND (server.js + routes/):
@@ -781,7 +781,7 @@ Errore: `+e.msg,Le(!1))}catch{}}}}catch(e){Ne(t=>[...t,{role:`agent`,text:`Error
781
781
  `)}`),i(`files`)},children:`Fix`})]}),(0,k.jsx)(jT,{files:p,activeIndex:h,unsavedFiles:S,onSelect:e=>{g(e),x(null),y(null),be&&M.current!==null&&e!==M.current&&(fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{M.current!==null&&(g(M.current),y(null))},1e4))}})]}),(0,k.jsx)(`div`,{className:$.codeEditorWrap,children:Jt&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:$.codeHeader,children:[(0,k.jsx)(`span`,{className:$.codeFileIcon,children:HT(Jt.name)}),(0,k.jsx)(`span`,{className:$.codeFileName,children:Jt.name}),Jt.content&&!Jt._error&&(0,k.jsxs)(`span`,{className:$.codeFileMeta,children:[Jt.content.split(`
782
782
  `).length,` righe · `,UT(Jt.content)]}),!Jt._pending&&!Jt._error&&Jt.content&&(0,k.jsx)(`button`,{className:`${$.editToggleBtn} ${b===null?``:$.editToggleBtnActive}`,onClick:()=>{b===null?x(Jt.content):(m(e=>e.map((e,t)=>t===h?{...e,content:b}:e)),D(`/api/studio/webcraft/file/write`,{projectName:a,path:Jt.name,content:b}),x(null))},children:b===null?`✏ Modifica`:`💾 Salva`}),(0,k.jsx)(`button`,{className:$.headerIconBtn,title:`Split view`,onClick:()=>A(ae===null?+(h===0&&p.length>1):null),children:`⫼`}),(0,k.jsx)(`button`,{className:`${$.headerIconBtn} ${ie?$.headerIconBtnActive:``}`,title:`Terminal`,onClick:()=>O(!ie),children:`⌨`}),(0,k.jsx)(`button`,{className:$.headerIconBtn,title:`Development Guide`,onClick:()=>se(!0),children:`📖`})]}),w&&(0,k.jsxs)(`div`,{className:$.findBar,children:[(0,k.jsx)(`input`,{className:$.findInput,value:te,onChange:e=>T(e.target.value),placeholder:`Find...`,autoFocus:!0}),(0,k.jsx)(`input`,{className:$.findInput,value:ne,onChange:e=>re(e.target.value),placeholder:`Replace...`}),(0,k.jsx)(`span`,{className:$.findCount,children:te?((Jt.content||``).match(new RegExp(te.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`gi`))?.length||0)+` found`:``}),(0,k.jsx)(`button`,{className:$.findBtn,onClick:()=>{!te||b===null||x(b.replace(new RegExp(te.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`i`),ne))},children:`Replace`}),(0,k.jsx)(`button`,{className:$.findBtn,onClick:()=>{!te||b===null||x(b.replace(new RegExp(te.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`gi`),ne))},children:`All`}),(0,k.jsx)(`button`,{className:$.findClose,onClick:()=>ee(!1),children:`×`})]}),Jt._error&&(0,k.jsx)(`div`,{className:$.fileError,children:`⚠ Generazione fallita — chiedi al modello di rigenerare questo file`}),Jt._syntaxError&&!Jt._error&&(0,k.jsxs)(`div`,{className:$.fileSyntaxError,children:[`⚠ Syntax error: `,Jt._syntaxError]}),be&&v!==null?(0,k.jsx)(`pre`,{className:$.streamingPre,ref:e=>{e&&pe.current&&(e.scrollTop=e.scrollHeight)},onScroll:e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<50?pe.current=!0:(pe.current=!1,me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{pe.current=!0},15e3))},dangerouslySetInnerHTML:{__html:LT(v||``,(Jt.name.split(`.`).pop()||`js`).toLowerCase())+`<span class="`+$.streamingCursor+`">▋</span>`}}):(0,k.jsx)(TT,{value:b===null?Jt.content||``:b,filename:Jt.name,readOnly:b===null,projectName:a,onChange:e=>{x(e),Jt&&C(e=>new Set(e).add(Jt.name))},onSave:e=>{m(t=>t.map((t,n)=>n===h?{...t,content:e}:t)),D(`/api/studio/webcraft/file/write`,{projectName:a,path:Jt.name,content:e}),x(null),C(e=>{let t=new Set(e);return t.delete(Jt.name),t})}})]})}),ae!==null&&p[ae]&&(0,k.jsxs)(`div`,{className:$.codeEditorWrap,children:[(0,k.jsxs)(`div`,{className:$.codeHeader,children:[(0,k.jsx)(`span`,{className:$.codeFileIcon,children:HT(p[ae].name)}),(0,k.jsx)(`span`,{className:$.codeFileName,children:p[ae].name}),(0,k.jsx)(`button`,{className:$.headerIconBtn,onClick:()=>A(null),children:`✕`})]}),(0,k.jsx)(TT,{value:p[ae].content||``,filename:p[ae].name,readOnly:!0})]})]}),ie&&(0,k.jsxs)(`div`,{className:$.terminalPanel,children:[(0,k.jsxs)(`div`,{className:$.terminalHeader,children:[(0,k.jsx)(`span`,{className:$.terminalTitle,children:`Terminal`}),(0,k.jsx)(`button`,{className:$.terminalClose,onClick:()=>O(!1),children:`✕`})]}),(0,k.jsx)(IT,{projectDir:a||void 0})]})]})})]})]})]})}),L&&t!==`projects`&&(0,k.jsxs)(`div`,{className:$.planBanner,children:[(0,k.jsx)(`div`,{className:$.planTitle,children:`📌 Piano proposto — approva per eseguire`}),(0,k.jsx)(`pre`,{className:$.planText,children:L.plan}),(0,k.jsxs)(`div`,{className:$.planActions,children:[(0,k.jsx)(`button`,{className:$.planApprove,onClick:U,children:`✓ Esegui`}),(0,k.jsx)(`button`,{className:$.planReject,onClick:()=>Be(null),children:`✕ Annulla`})]})]}),Ye&&t!==`projects`&&(0,k.jsxs)(`div`,{className:$.grepPanel,children:[(0,k.jsxs)(`div`,{className:$.grepRow,children:[(0,k.jsx)(`input`,{className:$.grepInput,value:Ze,onChange:e=>Qe(e.target.value),onKeyDown:e=>e.key===`Enter`&&Rt(),placeholder:`Cerca nel codice...`}),(0,k.jsx)(`button`,{className:$.grepBtn,onClick:Rt,children:`🔍`}),(0,k.jsx)(`button`,{className:$.grepClose,onClick:()=>Xe(!1),children:`×`})]}),$e.length>0&&(0,k.jsxs)(`div`,{className:$.grepCount,children:[$e.length,` risultati`]}),(0,k.jsx)(`div`,{className:$.grepResults,children:$e.length===0?(0,k.jsx)(`div`,{className:$.grepEmpty,children:`Nessun risultato.`}):$e.map((e,t)=>(0,k.jsxs)(`div`,{className:$.grepMatch,onClick:()=>zt(e.file),children:[(0,k.jsxs)(`span`,{className:$.grepMatchFile,children:[e.file,`:`,e.lineNum]}),(0,k.jsx)(`pre`,{className:$.grepMatchLine,children:e.line})]},t))})]}),tt.length>0&&t!==`projects`&&(0,k.jsxs)(`div`,{className:$.diffPanel,children:[(0,k.jsxs)(`div`,{className:$.diffHeader,children:[(0,k.jsxs)(`span`,{children:[`🔌 Diff — `,tt.length,` file modificati`]}),(0,k.jsx)(`button`,{className:$.diffClose,onClick:()=>nt([]),children:`✕ Chiudi`})]}),tt.map((e,t)=>{let n=e.after.split(`
783
783
  `).length-e.before.split(`
784
- `).length;return(0,k.jsxs)(`details`,{open:!0,className:$.diffFile,children:[(0,k.jsxs)(`summary`,{className:$.diffSummary,children:[(0,k.jsx)(`span`,{className:$.diffArrow,children:`▲`}),(0,k.jsx)(`span`,{className:$.diffFileName,children:e.file}),(0,k.jsxs)(`span`,{className:n>=0?$.diffAdded:$.diffRemoved,children:[n>=0?`+`:``,n,` linee`]})]}),(0,k.jsx)(`div`,{className:$.diffContent,children:(0,k.jsx)(YT,{before:e.before,after:e.after})})]},t)})]}),t!==`projects`&&(0,k.jsxs)(`div`,{className:$.chatPanel,children:[(0,k.jsxs)(`div`,{className:$.chatMessages,ref:vt,children:[Me.length===0&&qt&&(0,k.jsxs)(`div`,{className:$.chatWelcome,children:[`🤖 `,e(`webcraft.doctrine.title`),` — `,(0,k.jsx)(`button`,{className:$.doctrineOpenBtn,onClick:()=>se(!0),children:`📖 Open Guide`})]}),Me.map((e,t)=>(0,k.jsxs)(`div`,{className:e.role===`user`?$.chatUser:e.role===`system`?$.chatSystem:$.chatAgent,children:[e.role===`user`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:$.chatUserBubble,children:e.text}),e.attachments&&e.attachments.length>0&&(0,k.jsx)(`div`,{className:$.chatAttachPreviews,children:e.attachments.map((e,t)=>(0,k.jsxs)(`span`,{className:$.chatAttachBadge,children:[`📎 `,e.name]},t))})]}),e.role===`system`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:$.chatSystemBubble,children:e.text}),e.syntaxErrors?.map((e,t)=>(0,k.jsxs)(`div`,{className:$.chatSyntaxErr,children:[`✕ `,e.file,`: `,e.error]},t))]}),e.role===`agent`&&(()=>{let t=e.text.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/?>/g,``).trim(),n=(e.tools||[]).filter(e=>(e.op===`edit`||e.op===`write`)&&(e.result===`ok`||e.result===`ok_fuzzy`||e.result===`ok_repaired`)&&(e.oldSnippet||e.newSnippet)),r=(e.tools||[]).filter(e=>e.result?.includes(`not_found`)||e.result?.includes(`error`)||e.result===`blocked_use_edit`),a=t.match(/^(.{10,120}?)[.\n]/),o=a?a[1]+`.`:t.slice(0,120),s=t.length>130;return(0,k.jsxs)(`div`,{className:$.chatAgentCard,children:[n.map((e,t)=>(0,k.jsxs)(`div`,{style:{margin:`6px 0`,borderRadius:8,overflow:`hidden`,border:`1px solid rgba(255,255,255,0.08)`},children:[(0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 10px`,background:`rgba(99,102,241,0.1)`,fontSize:11},children:[(0,k.jsxs)(`span`,{style:{fontWeight:600,color:`#818cf8`,cursor:`pointer`},onClick:()=>{let t=p.findIndex(t=>t.name===e.path);t>=0&&(g(t),i(`files`))},children:[`✏ `,e.path]}),(0,k.jsx)(`span`,{style:{color:`#4ade80`,fontSize:10,fontWeight:600},children:e.result===`ok_fuzzy`?`applied (fuzzy)`:e.result===`ok_repaired`?`applied (repaired)`:`✓ applied`})]}),(0,k.jsx)(YT,{before:e.oldSnippet||``,after:e.newSnippet||``,contextLines:3})]},t)),r.length>0&&(0,k.jsx)(`div`,{style:{margin:`6px 0`,padding:`6px 10px`,background:`rgba(248,113,113,0.08)`,borderRadius:6,fontSize:11,color:`#f87171`},children:r.map((e,t)=>(0,k.jsxs)(`div`,{children:[`❌ `,e.op,` `,e.path,`: `,typeof e.result==`string`?e.result.slice(0,100):``]},t))}),t&&(s?(0,k.jsxs)(`details`,{style:{margin:`6px 0`,fontSize:11},children:[(0,k.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--dim)`,padding:`4px 0`,userSelect:`none`},children:o.slice(0,100)}),(0,k.jsx)(`div`,{className:$.chatAgentText,style:{fontSize:11,opacity:.8,marginTop:4},dangerouslySetInnerHTML:{__html:RT(t)}})]}):(0,k.jsx)(`div`,{className:$.chatAgentText,style:{fontSize:11,opacity:.8},dangerouslySetInnerHTML:{__html:RT(t)}}))]})})()]},t)),Ie&&(()=>{let e=Me[Me.length-1]?.tools??[],t=e[e.length-1],n=t?t.op===`read`?`Reading ${t.path}`:t.op===`edit`?`Editing ${t.path}`:t.op===`search`?`Searching...`:t.op===`lint`?`Linting ${t.path}`:t.op===`check`?`Checking ${t.path}`:t.op===`run`?`Running command...`:t.op===`sandbox`?`Starting sandbox...`:t.op:`Thinking...`;return(0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,fontSize:12,color:`#818cf8`},children:[(0,k.jsx)(`span`,{className:$.chatAgentRobotAnim,style:{fontSize:14},children:`⟳`}),(0,k.jsx)(`span`,{style:{fontWeight:500},children:n})]})})()]}),Re.length>0&&(0,k.jsx)(`div`,{className:$.attachPreviews,children:Re.map((e,t)=>(0,k.jsxs)(`span`,{className:$.attachBadge,children:[`📎 `,e.name,(0,k.jsx)(`button`,{className:$.removeAttachBtn,onClick:()=>ze(e=>e.filter((e,n)=>n!==t)),children:`×`})]},t))}),qt?(0,k.jsxs)(`div`,{className:$.projActiveRow,children:[`📄 `,(0,k.jsx)(`strong`,{className:$.projActiveName,children:a}),` — scrivi per modificare o migliorare il progetto`]}):(0,k.jsxs)(`div`,{className:$.projNameRow,children:[(0,k.jsx)(`span`,{className:$.projNameLabel,children:`Nome progetto:`}),(0,k.jsx)(`input`,{className:$.projNameInput,value:a,onChange:e=>o(e.target.value),placeholder:`MioProgetto`})]}),(0,k.jsxs)(`div`,{className:$.chatInputRow,children:[(0,k.jsxs)(`label`,{className:$.attachLabel,title:`Allega immagine o PDF`,children:[`📎`,(0,k.jsx)(`input`,{ref:yt,type:`file`,multiple:!0,accept:`image/*,.pdf`,style:{display:`none`},onChange:e=>Kt(e.target.files)})]}),(0,k.jsx)(`textarea`,{className:$.chatTextarea,value:Pe,onChange:e=>Fe(e.target.value),placeholder:qt?`Parla con il tuo agente: chiedi correzioni, migliorie, nuove funzionalità...`:`Descrivi il progetto da creare, poi premi Genera...`,disabled:Yt,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Dt())},rows:4}),(0,k.jsxs)(`div`,{className:$.chatSendCol,children:[(0,k.jsx)(`button`,{className:$.chatSendBtn,onClick:Dt,disabled:Yt,children:be?`⏳`:qt?`▶`:`▶ Genera`}),Yt&&!Se&&(0,k.jsx)(`button`,{className:$.chatStopBtn,onClick:At,children:`⏹ Stop`})]})]})]}),oe&&(0,k.jsx)(`div`,{className:$.modalOverlay,onClick:()=>se(!1),children:(0,k.jsxs)(`div`,{className:$.modal,onClick:e=>e.stopPropagation(),style:{width:720,maxHeight:`90vh`},children:[(0,k.jsxs)(`div`,{className:$.modalHeader,children:[(0,k.jsxs)(`span`,{className:$.modalTitle,children:[`📖 `,e(`webcraft.doctrine.title`)]}),(0,k.jsx)(`span`,{className:$.doctrineSubtitle,children:e(`webcraft.doctrine.subtitle`)}),(0,k.jsx)(`button`,{className:$.modalClose,onClick:()=>se(!1),children:`✕`})]}),(0,k.jsx)(`div`,{className:$.modalBody,style:{gap:0},children:[`phase1`,`phase2`,`phase3`,`phase4`,`phase5`,`tools`,`golden`].map(t=>(0,k.jsxs)(`div`,{className:$.doctrineSection,children:[(0,k.jsx)(`div`,{className:$.doctrineSectionTitle,children:e(`webcraft.doctrine.${t}.title`)}),(0,k.jsx)(`div`,{className:$.doctrineSectionBody,children:e(`webcraft.doctrine.${t}.desc`).split(`
784
+ `).length;return(0,k.jsxs)(`details`,{open:!0,className:$.diffFile,children:[(0,k.jsxs)(`summary`,{className:$.diffSummary,children:[(0,k.jsx)(`span`,{className:$.diffArrow,children:`▲`}),(0,k.jsx)(`span`,{className:$.diffFileName,children:e.file}),(0,k.jsxs)(`span`,{className:n>=0?$.diffAdded:$.diffRemoved,children:[n>=0?`+`:``,n,` linee`]})]}),(0,k.jsx)(`div`,{className:$.diffContent,children:(0,k.jsx)(YT,{before:e.before,after:e.after})})]},t)})]}),t!==`projects`&&(0,k.jsxs)(`div`,{className:$.chatPanel,children:[(0,k.jsxs)(`div`,{className:$.chatMessages,ref:vt,children:[Me.length===0&&qt&&(0,k.jsxs)(`div`,{className:$.chatWelcome,children:[`🤖 `,e(`webcraft.doctrine.title`),` — `,(0,k.jsx)(`button`,{className:$.doctrineOpenBtn,onClick:()=>se(!0),children:`📖 Open Guide`})]}),Me.map((e,t)=>(0,k.jsxs)(`div`,{className:e.role===`user`?$.chatUser:e.role===`system`?$.chatSystem:$.chatAgent,children:[e.role===`user`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:$.chatUserBubble,children:e.text}),e.attachments&&e.attachments.length>0&&(0,k.jsx)(`div`,{className:$.chatAttachPreviews,children:e.attachments.map((e,t)=>(0,k.jsxs)(`span`,{className:$.chatAttachBadge,children:[`📎 `,e.name]},t))})]}),e.role===`system`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:$.chatSystemBubble,children:e.text}),e.syntaxErrors?.map((e,t)=>(0,k.jsxs)(`div`,{className:$.chatSyntaxErr,children:[`✕ `,e.file,`: `,e.error]},t))]}),e.role===`agent`&&(()=>{let t=e.text.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/?>/g,``).trim(),n=(e.tools||[]).filter(e=>(e.op===`edit`||e.op===`write`)&&(e.result===`ok`||e.result===`ok_fuzzy`||e.result===`ok_repaired`)),r=(e.tools||[]).filter(e=>e.result?.includes(`not_found`)||e.result?.includes(`error`)||e.result===`blocked_use_edit`),a=t.match(/^(.{10,120}?)[.\n]/),o=a?a[1]+`.`:t.slice(0,120),s=t.length>130;return(0,k.jsxs)(`div`,{className:$.chatAgentCard,children:[n.map((e,t)=>(0,k.jsxs)(`div`,{style:{margin:`6px 0`,borderRadius:8,overflow:`hidden`,border:`1px solid rgba(255,255,255,0.08)`},children:[(0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 10px`,background:`rgba(99,102,241,0.1)`,fontSize:11},children:[(0,k.jsxs)(`span`,{style:{fontWeight:600,color:`#818cf8`,cursor:`pointer`},onClick:()=>{let t=p.findIndex(t=>t.name===e.path);t>=0&&(g(t),i(`files`))},children:[`✏ `,e.path]}),(0,k.jsx)(`span`,{style:{color:`#4ade80`,fontSize:10,fontWeight:600},children:e.result===`ok_fuzzy`?`applied (fuzzy)`:e.result===`ok_repaired`?`applied (repaired)`:`✓ applied`})]}),e.oldSnippet||e.newSnippet?(0,k.jsx)(YT,{before:e.oldSnippet||``,after:e.newSnippet||``,contextLines:3}):(0,k.jsx)(`div`,{style:{padding:`6px 10px`,fontSize:11,color:`#4ade80`,background:`rgba(74,222,128,0.05)`},children:`File modified successfully`})]},t)),r.length>0&&(0,k.jsx)(`div`,{style:{margin:`6px 0`,padding:`6px 10px`,background:`rgba(248,113,113,0.08)`,borderRadius:6,fontSize:11,color:`#f87171`},children:r.map((e,t)=>(0,k.jsxs)(`div`,{children:[`❌ `,e.op,` `,e.path,`: `,typeof e.result==`string`?e.result.slice(0,100):``]},t))}),t&&(s?(0,k.jsxs)(`details`,{style:{margin:`6px 0`,fontSize:11},children:[(0,k.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--dim)`,padding:`4px 0`,userSelect:`none`},children:o.slice(0,100)}),(0,k.jsx)(`div`,{className:$.chatAgentText,style:{fontSize:11,opacity:.8,marginTop:4},dangerouslySetInnerHTML:{__html:RT(t)}})]}):(0,k.jsx)(`div`,{className:$.chatAgentText,style:{fontSize:11,opacity:.8},dangerouslySetInnerHTML:{__html:RT(t)}}))]})})()]},t)),Ie&&(()=>{let e=Me[Me.length-1]?.tools??[],t=e[e.length-1],n=t?t.op===`read`?`Reading ${t.path}`:t.op===`edit`?`Editing ${t.path}`:t.op===`search`?`Searching...`:t.op===`lint`?`Linting ${t.path}`:t.op===`check`?`Checking ${t.path}`:t.op===`run`?`Running command...`:t.op===`sandbox`?`Starting sandbox...`:t.op:`Thinking...`;return(0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,fontSize:12,color:`#818cf8`},children:[(0,k.jsx)(`span`,{className:$.chatAgentRobotAnim,style:{fontSize:14},children:`⟳`}),(0,k.jsx)(`span`,{style:{fontWeight:500},children:n})]})})()]}),Re.length>0&&(0,k.jsx)(`div`,{className:$.attachPreviews,children:Re.map((e,t)=>(0,k.jsxs)(`span`,{className:$.attachBadge,children:[`📎 `,e.name,(0,k.jsx)(`button`,{className:$.removeAttachBtn,onClick:()=>ze(e=>e.filter((e,n)=>n!==t)),children:`×`})]},t))}),qt?(0,k.jsxs)(`div`,{className:$.projActiveRow,children:[`📄 `,(0,k.jsx)(`strong`,{className:$.projActiveName,children:a}),` — scrivi per modificare o migliorare il progetto`]}):(0,k.jsxs)(`div`,{className:$.projNameRow,children:[(0,k.jsx)(`span`,{className:$.projNameLabel,children:`Nome progetto:`}),(0,k.jsx)(`input`,{className:$.projNameInput,value:a,onChange:e=>o(e.target.value),placeholder:`MioProgetto`})]}),(0,k.jsxs)(`div`,{className:$.chatInputRow,children:[(0,k.jsxs)(`label`,{className:$.attachLabel,title:`Allega immagine o PDF`,children:[`📎`,(0,k.jsx)(`input`,{ref:yt,type:`file`,multiple:!0,accept:`image/*,.pdf`,style:{display:`none`},onChange:e=>Kt(e.target.files)})]}),(0,k.jsx)(`textarea`,{className:$.chatTextarea,value:Pe,onChange:e=>Fe(e.target.value),placeholder:qt?`Parla con il tuo agente: chiedi correzioni, migliorie, nuove funzionalità...`:`Descrivi il progetto da creare, poi premi Genera...`,disabled:Yt,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Dt())},rows:4}),(0,k.jsxs)(`div`,{className:$.chatSendCol,children:[(0,k.jsx)(`button`,{className:$.chatSendBtn,onClick:Dt,disabled:Yt,children:be?`⏳`:qt?`▶`:`▶ Genera`}),Yt&&!Se&&(0,k.jsx)(`button`,{className:$.chatStopBtn,onClick:At,children:`⏹ Stop`})]})]})]}),oe&&(0,k.jsx)(`div`,{className:$.modalOverlay,onClick:()=>se(!1),children:(0,k.jsxs)(`div`,{className:$.modal,onClick:e=>e.stopPropagation(),style:{width:720,maxHeight:`90vh`},children:[(0,k.jsxs)(`div`,{className:$.modalHeader,children:[(0,k.jsxs)(`span`,{className:$.modalTitle,children:[`📖 `,e(`webcraft.doctrine.title`)]}),(0,k.jsx)(`span`,{className:$.doctrineSubtitle,children:e(`webcraft.doctrine.subtitle`)}),(0,k.jsx)(`button`,{className:$.modalClose,onClick:()=>se(!1),children:`✕`})]}),(0,k.jsx)(`div`,{className:$.modalBody,style:{gap:0},children:[`phase1`,`phase2`,`phase3`,`phase4`,`phase5`,`tools`,`golden`].map(t=>(0,k.jsxs)(`div`,{className:$.doctrineSection,children:[(0,k.jsx)(`div`,{className:$.doctrineSectionTitle,children:e(`webcraft.doctrine.${t}.title`)}),(0,k.jsx)(`div`,{className:$.doctrineSectionBody,children:e(`webcraft.doctrine.${t}.desc`).split(`
785
785
  `).map((e,t)=>(0,k.jsx)(`p`,{className:e.startsWith(`•`)||e.startsWith(`1.`)||e.startsWith(`2.`)||e.startsWith(`3.`)||e.startsWith(`4.`)||e.startsWith(`5.`)||e.startsWith(`6.`)?$.doctrineBullet:``,children:e},t))})]},t))}),(0,k.jsx)(`div`,{className:$.modalFooter,children:(0,k.jsx)(`button`,{className:$.modalSaveBtn,onClick:()=>se(!1),style:{padding:`10px 28px`,fontSize:14},children:e(`webcraft.doctrine.close`)})})]})}),Ge&&(0,k.jsx)(XT,{modal:Ge,skills:Ve,projectName:a,onClose:()=>Ke(null),onSave:(e,t,n)=>H(Ge,e,t,n)})]})}function KT(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===r&&e.every((e,n)=>e===t[n]))return e.map((e,t)=>({type:`same`,text:e,oldLine:t+1,newLine:t+1}));if(n+r>8e3)return qT(e,t);let i=n+r,a=2*i+1,o=new Int32Array(a).fill(-1);new Int32Array(a).fill(-1);let s=i;o[s+1]=0;let c=[];outer:for(let l=0;l<=i;l++){let i=new Int32Array(a);i.set(o),c.push(i);for(let i=-l;i<=l;i+=2){let a;a=i===-l||i!==l&&o[s+i-1]<o[s+i+1]?o[s+i+1]:o[s+i-1]+1;let c=a-i;for(;a<n&&c<r&&e[a]===t[c];)a++,c++;if(o[s+i]=a,a>=n&&c>=r)break outer}}let l=[],u=n,d=r;for(let n=c.length-1;n>0;n--){let r=c[n-1],i=u-d,a;a=i===-n||i!==n&&r[s+i-1]<r[s+i+1]?i+1:i-1;let o=r[s+a],f=o-a;for(;u>o&&d>f;)u--,d--,l.push({type:`same`,text:e[u],oldLine:u+1,newLine:d+1});u>o?(u--,l.push({type:`rem`,text:e[u],oldLine:u+1})):d>f&&(d--,l.push({type:`add`,text:t[d],newLine:d+1}))}for(;u>0&&d>0;)u--,d--,l.push({type:`same`,text:e[u],oldLine:u+1,newLine:d+1});return l.reverse(),l}function qT(e,t){let n=[],r=0,i=0;for(;(r<e.length||i<t.length)&&(r>=e.length?(n.push({type:`add`,text:t[i],newLine:i+1}),i++):i>=t.length?(n.push({type:`rem`,text:e[r],oldLine:r+1}),r++):e[r]===t[i]?(n.push({type:`same`,text:e[r],oldLine:r+1,newLine:i+1}),r++,i++):(n.push({type:`rem`,text:e[r],oldLine:r+1}),n.push({type:`add`,text:t[i],newLine:i+1}),r++,i++),!(n.length>4e3)););return n}function JT(e,t){let n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=n.length,a=r.length;if(i+a>400)return{old:(0,k.jsx)(k.Fragment,{children:e}),new:(0,k.jsx)(k.Fragment,{children:t})};let o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],c=[],l=i,u=a,d=[],f=[];for(;l>0||u>0;)l>0&&u>0&&n[l-1]===r[u-1]?(d.push({text:n[l-1],changed:!1}),f.push({text:r[u-1],changed:!1}),l--,u--):u>0&&(l===0||o[l][u-1]>=o[l-1][u])?(f.push({text:r[u-1],changed:!0}),u--):(d.push({text:n[l-1],changed:!0}),l--);return d.reverse().forEach(e=>s.push(e)),f.reverse().forEach(e=>c.push(e)),{old:(0,k.jsx)(k.Fragment,{children:s.map((e,t)=>e.changed?(0,k.jsx)(`span`,{style:{background:`rgba(248,113,113,0.3)`,borderRadius:2},children:e.text},t):(0,k.jsx)(`span`,{children:e.text},t))}),new:(0,k.jsx)(k.Fragment,{children:c.map((e,t)=>e.changed?(0,k.jsx)(`span`,{style:{background:`rgba(74,222,128,0.3)`,borderRadius:2},children:e.text},t):(0,k.jsx)(`span`,{children:e.text},t))})}}function YT({before:e,after:t,contextLines:n=3}){let r=KT(e.split(`
786
786
  `),t.split(`
787
787
  `)),i=new Set;r.forEach((e,t)=>{e.type!==`same`&&i.add(t)});let a=new Set;if(i.forEach(e=>{for(let t=Math.max(0,e-n);t<=Math.min(r.length-1,e+n);t++)a.add(t)}),i.size===0)for(let e=0;e<Math.min(5,r.length);e++)a.add(e);let o=new Map;for(let e=0;e<r.length-1;e++)r[e].type===`rem`&&r[e+1].type===`add`&&o.set(e,JT(r[e].text,r[e+1].text));let s=[],c=-1;for(let e=0;e<r.length;e++){if(!a.has(e))continue;if(c>=0&&e-c>1){let t=e-c-1;s.push((0,k.jsxs)(`div`,{style:{padding:`2px 8px`,background:`rgba(99,102,241,0.08)`,color:`#6366f1`,fontSize:9,textAlign:`center`,borderTop:`1px solid rgba(99,102,241,0.15)`,borderBottom:`1px solid rgba(99,102,241,0.15)`,userSelect:`none`},children:[`@@ `,t,` righe nascoste @@`]},`fold-${e}`))}c=e;let t=r[e],n=t.type===`add`?`rgba(74,222,128,0.08)`:t.type===`rem`?`rgba(248,113,113,0.08)`:`transparent`,i=t.type===`add`?`3px solid #4ade80`:t.type===`rem`?`3px solid #f87171`:`3px solid transparent`,l=t.type===`add`?`#4ade80`:t.type===`rem`?`#f87171`:`var(--dim)`,u=t.type===`add`?`+`:t.type===`rem`?`-`:` `,d=t.text,f=o.get(e);f&&t.type===`rem`&&(d=f.old);let p=o.get(e-1);p&&t.type===`add`&&(d=p.new),s.push((0,k.jsxs)(`div`,{style:{display:`flex`,alignItems:`stretch`,background:n,borderLeft:i,fontFamily:`var(--mono)`,fontSize:11,lineHeight:`18px`},children:[(0,k.jsx)(`span`,{style:{width:36,textAlign:`right`,padding:`0 4px`,color:`rgba(255,255,255,0.2)`,fontSize:10,flexShrink:0,userSelect:`none`},children:t.oldLine??``}),(0,k.jsx)(`span`,{style:{width:36,textAlign:`right`,padding:`0 4px`,color:`rgba(255,255,255,0.2)`,fontSize:10,flexShrink:0,userSelect:`none`},children:t.newLine??``}),(0,k.jsx)(`span`,{style:{width:14,textAlign:`center`,color:l,fontWeight:700,flexShrink:0,userSelect:`none`},children:u}),(0,k.jsx)(`span`,{style:{flex:1,padding:`0 4px`,color:l,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:d})]},e))}return(0,k.jsx)(`div`,{style:{overflow:`auto`,maxHeight:400},children:s})}function XT({modal:e,skills:t,projectName:n,onClose:r,onSave:i}){let[a,o]=(0,_.useState)(e.name),[s,c]=(0,_.useState)(e.content),[l,u]=(0,_.useState)(e.type),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!1),h=l===`skill`?6e3:4e3,g=s.length>h;async function v(){if(!d.trim())return;m(!0);let e={skill:`Sei un esperto di sviluppo web fullstack. Genera un file Markdown "skill" per il WebCraft Agent. Deve contenere istruzioni, pattern di codice, best practice e snippet pronti all uso come contesto persistente. Scrivi SOLO il contenuto Markdown, niente altro.`,memory:`Sei un assistente tecnico. Genera un file Markdown "memory" per il WebCraft Agent. Deve riassumere decisioni architetturali, preferenze dello sviluppatore e contesto generale del progetto. Scrivi SOLO il Markdown.`,provider:`Sei un esperto di prompt engineering. Genera un file Markdown con istruzioni specifiche per calibrare il comportamento del modello AI. Scrivi SOLO il Markdown.`},t=await D(`/api/studio/webcraft`,{system:e[l]??e.skill,user:`Progetto: ${n}\n\n${d}`,max_tokens:2048});t?.text&&(c(t.text),a||o(l===`memory`?`memory.md`:l===`provider`?`liara.md`:d.toLowerCase().replace(/[^a-z0-9]+/g,`-`).slice(0,30)+`.md`)),m(!1)}function y(){if(!a.trim()){alert(`Inserisci un nome per il file.`);return}let n=a.endsWith(`.md`)?a:a+`.md`;if((l===`memory`||l===`provider`)&&e.mode===`new`&&t.findIndex(e=>e.type===l)>=0){alert(`Esiste già un file di tipo "${l}". Modificalo direttamente.`);return}i(n,s,l)}return(0,k.jsx)(`div`,{className:$.modalOverlay,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,k.jsxs)(`div`,{className:$.modal,children:[(0,k.jsxs)(`div`,{className:$.modalHeader,children:[(0,k.jsxs)(`span`,{className:$.modalTitle,children:[WT(l),` `,e.mode===`new`?`Nuovo file di contesto`:`Modifica ${e.name}`]}),(0,k.jsx)(`button`,{className:$.modalClose,onClick:r,children:`×`})]}),(0,k.jsx)(`div`,{className:$.modalBody,children:e.mode===`view`?(0,k.jsx)(`pre`,{className:$.logView,children:s}):(0,k.jsxs)(k.Fragment,{children:[e.mode===`new`&&(0,k.jsxs)(`div`,{className:$.modalRow,children:[(0,k.jsxs)(`div`,{className:$.modalField,children:[(0,k.jsx)(`div`,{className:$.modalLabel,children:`TIPO`}),(0,k.jsx)(`select`,{value:l,onChange:e=>{let t=e.target.value;u(t),t===`memory`?o(`memory.md`):t===`provider`&&o(`liara.md`)},className:$.modalSelect,children:[`skill`,`memory`,`provider`].map(e=>{let n=(e===`memory`||e===`provider`)&&t.some(t=>t.type===e);return(0,k.jsxs)(`option`,{value:e,disabled:n,children:[e,n?` (esiste già)`:``]},e)})})]}),(0,k.jsxs)(`div`,{className:$.modalField,style:{flex:2},children:[(0,k.jsx)(`div`,{className:$.modalLabel,children:`NOME FILE`}),(0,k.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:l===`memory`?`memory.md`:l===`provider`?`liara.md`:`nome-skill.md`,className:$.modalInput})]})]}),(0,k.jsxs)(`div`,{className:$.modalHint,children:[`💡 `,l===`skill`?`Istruzioni tecniche, snippet, pattern di codice specifici. Max ~6000 caratteri.`:l===`memory`?`Note persistenti sul progetto: decisioni architetturali, preferenze. Solo UN file. Max ~4000 caratteri.`:`Istruzioni specifiche per il modello AI (tono, formato, vincoli). Solo UN file. Max ~4000 caratteri.`]}),(0,k.jsxs)(`div`,{className:$.modalAiBox,children:[(0,k.jsx)(`div`,{className:$.modalLabel,children:`🤖 GENERA CON AI`}),(0,k.jsxs)(`div`,{className:$.modalAiRow,children:[(0,k.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:2,placeholder:`Descrivi cosa deve contenere questo file...`,className:$.modalAiDesc}),(0,k.jsx)(`button`,{onClick:v,disabled:p,className:$.modalAiBtn,children:p?`⏳ ...`:`▶ Genera`})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:$.modalLabelRow,children:[(0,k.jsx)(`span`,{children:`CONTENUTO (markdown)`}),(0,k.jsxs)(`span`,{style:{color:g?`#e05050`:`var(--dim)`},children:[s.length,` car.`,g?` ⚠ Troppo lungo`:``]})]}),(0,k.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:14,placeholder:`# Titolo
@@ -8,7 +8,7 @@
8
8
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
10
  <title>NHA — NotHumanAllowed</title>
11
- <script type="module" crossorigin src="/assets/index-LxkP8L2q.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-BMu5zk4J.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-CIozt-VX.css">
13
13
  </head>
14
14
  <body>