nothumanallowed 14.1.16 → 14.1.18
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.1.
|
|
3
|
+
"version": "14.1.18",
|
|
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": {
|
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.1.
|
|
8
|
+
export const VERSION = '14.1.18';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
package/src/server/index.mjs
CHANGED
|
@@ -290,32 +290,32 @@ async function handleRequest(req, res) {
|
|
|
290
290
|
export async function startServer({ port = 3847, host = '127.0.0.1', noBrowser = false } = {}) {
|
|
291
291
|
_router = await buildRouter();
|
|
292
292
|
const { setupWebSocket } = await import('./ws.mjs');
|
|
293
|
+
const { execSync } = await import('child_process');
|
|
294
|
+
|
|
295
|
+
// Kill any existing process on the port before binding
|
|
296
|
+
try {
|
|
297
|
+
const pids = execSync(`lsof -ti tcp:${port} 2>/dev/null || true`).toString().trim();
|
|
298
|
+
if (pids) {
|
|
299
|
+
pids.split('\n').filter(Boolean).forEach((p) => {
|
|
300
|
+
try { process.kill(parseInt(p), 'SIGTERM'); } catch {}
|
|
301
|
+
});
|
|
302
|
+
await new Promise((r) => setTimeout(r, 900));
|
|
303
|
+
}
|
|
304
|
+
} catch {}
|
|
293
305
|
|
|
294
306
|
const server = http.createServer(handleRequest);
|
|
295
|
-
setupWebSocket(server);
|
|
296
307
|
|
|
297
|
-
//
|
|
308
|
+
// Attach WebSocket AFTER HTTP server is listening to avoid WS error events
|
|
298
309
|
await new Promise((resolve, reject) => {
|
|
299
|
-
server.once('error',
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
// Find and kill the process holding the port
|
|
304
|
-
const pid = execSync(`lsof -ti tcp:${port} 2>/dev/null || true`).toString().trim();
|
|
305
|
-
if (pid) {
|
|
306
|
-
pid.split('\n').forEach((p) => { try { process.kill(parseInt(p), 'SIGTERM'); } catch {} });
|
|
307
|
-
await new Promise((r) => setTimeout(r, 800));
|
|
308
|
-
}
|
|
309
|
-
} catch {}
|
|
310
|
-
// Retry
|
|
311
|
-
server.listen(port, host, (e) => e ? reject(e) : resolve(undefined));
|
|
312
|
-
} else {
|
|
313
|
-
reject(err);
|
|
314
|
-
}
|
|
310
|
+
server.once('error', reject);
|
|
311
|
+
server.listen(port, host, () => {
|
|
312
|
+
server.removeListener('error', reject);
|
|
313
|
+
resolve(undefined);
|
|
315
314
|
});
|
|
316
|
-
server.listen(port, host, () => resolve(undefined));
|
|
317
315
|
});
|
|
318
316
|
|
|
317
|
+
setupWebSocket(server);
|
|
318
|
+
|
|
319
319
|
const G = '\x1b[0;32m', NC = '\x1b[0m', D = '\x1b[2m', BOLD = '\x1b[1m';
|
|
320
320
|
const { VERSION } = await import('../constants.mjs');
|
|
321
321
|
console.log(`\n ${BOLD}${G}NHA${NC} ${D}v${VERSION}${NC}`);
|
|
@@ -560,13 +560,21 @@ ${authDesc}
|
|
|
560
560
|
|
|
561
561
|
Design a COMPLETE production-ready file structure. Include ALL files needed for a fully working site: server, routes, middleware, models, public HTML/CSS/JS pages, config files, README. Minimum 20 files.`;
|
|
562
562
|
|
|
563
|
-
//
|
|
563
|
+
// Emit immediately so the browser connection stays alive and the UI shows activity
|
|
564
|
+
emit({ type: 'processing', msg: 'Planning file structure...' });
|
|
565
|
+
|
|
566
|
+
// Round 1: plan files — stream so the client gets bytes immediately
|
|
564
567
|
let filePlan = [];
|
|
565
568
|
let planTokensIn = countTokens(FILE_PLAN_SYSTEM) + countTokens(planPrompt);
|
|
566
569
|
let planTokensOut = 0;
|
|
567
570
|
try {
|
|
568
|
-
|
|
569
|
-
|
|
571
|
+
let planRaw = '';
|
|
572
|
+
await callLLMStream(config, FILE_PLAN_SYSTEM, planPrompt, (chunk) => {
|
|
573
|
+
planRaw += chunk;
|
|
574
|
+
planTokensOut += countTokens(chunk);
|
|
575
|
+
// Emit heartbeat tokens so browser doesn't timeout
|
|
576
|
+
emit({ type: 'planning', chunk });
|
|
577
|
+
}, { max_tokens: 4096 });
|
|
570
578
|
const clean = planRaw.replace(/<think>[\s\S]*?<\/think>/g, '').trim()
|
|
571
579
|
.replace(/^```[\w]*\n?/, '').replace(/\n?```$/, '').trim();
|
|
572
580
|
const arr = JSON.parse(clean.match(/\[[\s\S]*\]/)?.[0] ?? clean);
|
|
@@ -529,11 +529,11 @@ ${u}
|
|
|
529
529
|
Your job: examine all agent responses to a user's question, identify agreements, disagreements, complementary insights, and deliver a unified, high-quality synthesis.
|
|
530
530
|
Be concise. Highlight what each agent contributed uniquely. Give your own synthesis verdict at the end.`},e=>{i+=e,g(i)})}catch{}finally{y(!1)}},he=e=>{let t=window.SpeechRecognition??window.webkitSpeechRecognition;if(!t){alert(`Speech recognition not supported.`);return}let n=T.current.get(e);if(l.find(t=>t.agent.id===e)?.voiceActive&&n){n.stop(),N(e,{voiceActive:!1});return}let r=new t;T.current.set(e,r),r.lang=`it-IT`,r.continuous=!1,r.interimResults=!1,r.onresult=t=>{let n=t.results[0][0].transcript;N(e,{input:(l.find(t=>t.agent.id===e)?.input??``)+(l.find(t=>t.agent.id===e)?.input?` `:``)+n})},r.onend=()=>N(e,{voiceActive:!1}),r.onerror=()=>N(e,{voiceActive:!1}),r.start(),N(e,{voiceActive:!0})},ge=(e,t)=>{if(!t)return;let n=t.name.toLowerCase().endsWith(`.pdf`)||t.type===`application/pdf`,r=new FileReader;n?(r.onload=n=>{let r=(n.target?.result).split(`,`)[1];N(e,{attachedFile:{name:t.name,size:t.size,base64:r,mimeType:`application/pdf`,isPDF:!0},attachedImage:null})},r.readAsDataURL(t)):(r.onload=n=>{N(e,{attachedFile:{name:t.name,size:t.size,content:n.target?.result},attachedImage:null})},r.readAsText(t))},_e=(e,t)=>{if(!t)return;let n=new FileReader;n.onload=n=>{let r=(n.target?.result).split(`,`)[1];N(e,{attachedImage:{name:t.name,size:t.size,base64:r,mimeType:t.type||`image/jpeg`},attachedFile:null})},n.readAsDataURL(t)},ve=()=>{x({name:``,tagline:``,systemPrompt:``}),C(`create`),ee(``)},F=async e=>{let t=await E(`/api/agents/${e.id}`).catch(()=>null);x({name:e.id,tagline:t?.tagline??e.description,systemPrompt:t?.systemPrompt??``}),C(`edit`),ee(``)},ye=async()=>{if(b){if(!b.tagline.trim()||!b.systemPrompt.trim()){ee(`Tagline and system prompt are required.`);return}ne(!0),ee(``);try{if(S===`create`){let e=b.name.toLowerCase().replace(/[^a-z0-9_-]/g,``);if(!e){ee(`Agent name required (lowercase, no spaces).`),ne(!1);return}let t=await D(`/api/agents`,{name:e,tagline:b.tagline,systemPrompt:b.systemPrompt});if(t?.error){ee(`Error: `+t.error),ne(!1);return}}else await D(`/api/agents/${b.name}`,{tagline:b.tagline,systemPrompt:b.systemPrompt,category:`custom`},`PUT`);x(null),oe()}catch(e){ee(`Error: `+e.message)}finally{ne(!1)}}},be=e=>{confirm(`Delete agent "${e.label}"?`)&&D(`/api/agents/${e.id}`,{},`DELETE`).then(()=>oe())};return r?(0,k.jsx)(`div`,{className:K.root,children:(0,k.jsx)(`div`,{className:K.loading,children:(0,k.jsx)(`div`,{className:`spinner`})})}):(0,k.jsxs)(`div`,{className:K.root,children:[(0,k.jsxs)(`div`,{className:K.gridSection,children:[(0,k.jsxs)(`div`,{className:K.gridHeader,children:[(0,k.jsxs)(`div`,{className:K.headerRow,children:[(0,k.jsx)(`input`,{className:K.search,value:a,onChange:e=>o(e.target.value),placeholder:`Search agents…`}),(0,k.jsx)(`button`,{className:K.createBtn,onClick:ve,children:`+ Create`})]}),(0,k.jsx)(`div`,{className:K.catTabs,children:se.map(e=>(0,k.jsxs)(`button`,{className:`${K.catTab} ${s===e?K.catActive:``}`,onClick:()=>c(e),children:[e,` (`,e===`All`?t.length:t.filter(t=>t.category===e).length,`)`]},e))})]}),(0,k.jsx)(`div`,{className:K.grid,children:ce.map(e=>{let t=l.some(t=>t.agent.id===e.id);return(0,k.jsxs)(`div`,{className:`${K.agentCard} ${t?K.agentActive:``}`,onClick:()=>le(e),children:[(0,k.jsxs)(`div`,{className:K.agentCardTop,children:[(0,k.jsx)(`div`,{className:K.agentIcon,children:e.icon}),e.isCustom&&(0,k.jsxs)(`div`,{className:K.agentActions,children:[(0,k.jsx)(`button`,{className:K.agentEditBtn,onClick:t=>{t.stopPropagation(),F(e)},children:`✏️`}),(0,k.jsx)(`button`,{className:K.agentDelBtn,onClick:t=>{t.stopPropagation(),be(e)},children:`🗑`})]})]}),(0,k.jsx)(`div`,{className:K.agentLabel,children:e.label}),(0,k.jsx)(`div`,{className:K.agentDesc,children:e.description}),(0,k.jsx)(`div`,{className:K.agentCat,children:e.category})]},e.id)})})]}),(0,k.jsx)(`div`,{className:K.chatArea,children:l.length===0?(0,k.jsxs)(`div`,{className:K.emptyChat,children:[(0,k.jsx)(`span`,{children:`Click an agent above to open a chat`}),(0,k.jsx)(`span`,{className:K.emptyChatHint,children:`Open multiple agents to run them in parallel`})]}):l.map(e=>{let{agent:t}=e,n=e.attachedFile?`📎 ${e.attachedFile.name}`:e.attachedImage?`🖼 ${e.attachedImage.name}`:null;return(0,k.jsxs)(`div`,{className:K.chatPanel,children:[(0,k.jsxs)(`div`,{className:K.chatHeader,children:[(0,k.jsx)(`span`,{className:K.chatIcon,children:t.icon}),(0,k.jsxs)(`div`,{className:K.chatHeaderInfo,children:[(0,k.jsx)(`div`,{className:K.chatAgentName,children:t.label}),(0,k.jsx)(`div`,{className:K.chatAgentDesc,children:t.description})]}),(0,k.jsx)(`button`,{className:K.closeChat,onClick:()=>ue(t.id),children:`✕`})]}),(0,k.jsxs)(`div`,{className:K.chatMessages,ref:e=>{O.current.set(t.id,e)},children:[e.history.length===0&&(0,k.jsxs)(`div`,{className:K.chatEmpty,children:[`Ask `,t.label,` anything…`]}),e.history.map((e,t)=>(0,k.jsx)(`div`,{className:`${K.chatMsg} ${e.role===`user`?K.msgUser:K.msgAgent}`,children:e.role===`assistant`?(0,k.jsx)(`div`,{dangerouslySetInnerHTML:{__html:me(e.content||`…`)}}):(0,k.jsx)(`span`,{children:e.content})},t)),e.streaming&&e.history[e.history.length-1]?.role===`assistant`&&e.history[e.history.length-1]?.content===``&&(0,k.jsxs)(`div`,{className:K.thinking,children:[(0,k.jsx)(`span`,{className:K.dot}),(0,k.jsx)(`span`,{className:K.dot}),(0,k.jsx)(`span`,{className:K.dot})]})]}),n&&(0,k.jsxs)(`div`,{className:K.attachBar,children:[(0,k.jsx)(`span`,{children:n}),(0,k.jsx)(`button`,{className:K.attachClear,onClick:()=>N(t.id,{attachedFile:null,attachedImage:null}),children:`×`})]}),(0,k.jsxs)(`div`,{className:K.chatInput,children:[(0,k.jsxs)(`div`,{className:K.chatTools,children:[(0,k.jsx)(`button`,{className:`${K.toolBtn} ${e.voiceActive?K.toolBtnActive:``}`,onClick:()=>he(t.id),title:`Voice`,children:`🎤`}),(0,k.jsx)(`button`,{className:K.toolBtn,onClick:()=>ae.current.get(t.id)?.click(),title:`Attach file`,children:`📎`}),(0,k.jsx)(`button`,{className:K.toolBtn,onClick:()=>A.current.get(t.id)?.click(),title:`Attach image`,children:`🖼`}),(0,k.jsx)(`input`,{type:`file`,style:{display:`none`},ref:e=>{ae.current.set(t.id,e)},onChange:e=>ge(t.id,e.target.files?.[0])}),(0,k.jsx)(`input`,{type:`file`,accept:`image/*`,style:{display:`none`},ref:e=>{A.current.set(t.id,e)},onChange:e=>_e(t.id,e.target.files?.[0])})]}),(0,k.jsxs)(`div`,{className:K.chatInputRow,children:[(0,k.jsx)(`textarea`,{className:K.chatTextarea,value:e.input,onChange:e=>N(t.id,{input:e.target.value}),placeholder:`Message ${t.label}…`,rows:2,onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),pe(e,e.input,e.attachedFile,e.attachedImage))}}),(0,k.jsx)(`button`,{className:K.sendBtn,onClick:()=>pe(e,e.input,e.attachedFile,e.attachedImage),disabled:e.streaming||!e.input.trim()&&!e.attachedFile&&!e.attachedImage,children:e.streaming?`…`:`→`})]})]})]},t.id)})}),l.length>=2&&(0,k.jsxs)(`div`,{className:K.orchBar,children:[(0,k.jsxs)(`div`,{className:K.orchLabel,children:[`🎼 Conductor · `,l.map(e=>`${e.agent.icon} ${e.agent.label}`).join(` · `)]}),(0,k.jsxs)(`div`,{className:K.orchRow,children:[(0,k.jsx)(`textarea`,{ref:j,className:K.orchInput,value:d,onChange:e=>f(e.target.value),placeholder:`Ask all agents — Conductor will synthesize a unified response…`,rows:1,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),P())}}),(0,k.jsx)(`button`,{className:K.orchBtn,onClick:P,disabled:p||v||!d.trim(),children:p?`⏳`:v?`🔄`:`🎼 Run`})]}),(v||h)&&(0,k.jsxs)(`div`,{className:K.orchSynthesis,children:[(0,k.jsxs)(`div`,{className:K.orchSynthHeader,children:[(0,k.jsx)(`span`,{children:`🎼 Conductor Synthesis`}),v&&(0,k.jsx)(`span`,{className:K.orchSynthSpinner,children:`synthesizing…`})]}),(0,k.jsx)(`div`,{className:K.orchSynthBody,dangerouslySetInnerHTML:{__html:me(h||`…`)}})]})]}),b&&(0,k.jsx)(`div`,{className:K.modalOverlay,onClick:e=>{e.target===e.currentTarget&&x(null)},children:(0,k.jsxs)(`div`,{className:K.modal,children:[(0,k.jsx)(`div`,{className:K.modalTitle,children:S===`create`?`+ New Agent`:`✏️ Edit Agent`}),S===`create`&&(0,k.jsxs)(`div`,{className:K.formField,children:[(0,k.jsx)(`label`,{className:K.formLabel,children:`Agent name (lowercase, no spaces)`}),(0,k.jsx)(`input`,{className:K.formInput,placeholder:`my-agent`,value:b.name,onChange:e=>x(t=>t&&{...t,name:e.target.value})})]}),(0,k.jsxs)(`div`,{className:K.formField,children:[(0,k.jsx)(`label`,{className:K.formLabel,children:`Tagline`}),(0,k.jsx)(`input`,{className:K.formInput,placeholder:`Short description`,value:b.tagline,onChange:e=>x(t=>t&&{...t,tagline:e.target.value})})]}),(0,k.jsxs)(`div`,{className:K.formField,children:[(0,k.jsx)(`label`,{className:K.formLabel,children:`System Prompt`}),(0,k.jsx)(`textarea`,{className:K.formTextarea,placeholder:`You are an expert in…`,value:b.systemPrompt,onChange:e=>x(t=>t&&{...t,systemPrompt:e.target.value})})]}),w&&(0,k.jsx)(`div`,{className:K.formError,children:w}),(0,k.jsxs)(`div`,{className:K.modalBtns,children:[(0,k.jsx)(`button`,{className:K.cancelBtn,onClick:()=>x(null),children:e(`common.cancel`)}),(0,k.jsx)(`button`,{className:K.modalSaveBtn,onClick:ye,disabled:te,children:te?`…`:S===`create`?`Create Agent`:`Save`})]})]})})]})}var q={root:`_root_1mam6_1`,error:`_error_1mam6_10`,errorHint:`_errorHint_1mam6_16`,quotaBar:`_quotaBar_1mam6_29`,quotaText:`_quotaText_1mam6_37`,quotaUsed:`_quotaUsed_1mam6_43`,quotaPct:`_quotaPct_1mam6_44`,quotaTrack:`_quotaTrack_1mam6_46`,quotaFill:`_quotaFill_1mam6_53`,actionBar:`_actionBar_1mam6_59`,filterBtn:`_filterBtn_1mam6_67`,filterActive:`_filterActive_1mam6_79`,spacer:`_spacer_1mam6_85`,newBtn:`_newBtn_1mam6_87`,uploadBtn:`_uploadBtn_1mam6_98`,searchRow:`_searchRow_1mam6_108`,searchInput:`_searchInput_1mam6_114`,searchBtn:`_searchBtn_1mam6_126`,loading:`_loading_1mam6_136`,empty:`_empty_1mam6_141`,fileList:`_fileList_1mam6_151`,fileRow:`_fileRow_1mam6_159`,fileIcon:`_fileIcon_1mam6_172`,fileInfo:`_fileInfo_1mam6_174`,fileName:`_fileName_1mam6_176`,fileMeta:`_fileMeta_1mam6_184`,fileBtns:`_fileBtns_1mam6_190`,editBtn:`_editBtn_1mam6_196`,viewBtn:`_viewBtn_1mam6_197`,pdfBtn:`_pdfBtn_1mam6_198`,openBtn:`_openBtn_1mam6_199`,delBtn:`_delBtn_1mam6_200`,editorRoot:`_editorRoot_1mam6_204`,editorToolbar:`_editorToolbar_1mam6_211`,backBtn:`_backBtn_1mam6_221`,editorName:`_editorName_1mam6_231`,saveBtn:`_saveBtn_1mam6_238`,editorArea:`_editorArea_1mam6_251`,editorMeta:`_editorMeta_1mam6_266`,viewerRoot:`_viewerRoot_1mam6_276`,imgContainer:`_imgContainer_1mam6_283`,imgView:`_imgView_1mam6_292`,pdfFrame:`_pdfFrame_1mam6_298`};function Gt(e,t){return e===`folder`?`📁`:e===`image`?`🖼`:e===`pdf`||t.includes(`pdf`)?`📕`:e===`video`?`🎬`:e===`audio`?`🎵`:t.includes(`spreadsheet`)||t.includes(`excel`)?`📊`:t.includes(`presentation`)||t.includes(`powerpoint`)?`📽`:t.includes(`document`)||t.includes(`word`)?`📄`:t.includes(`zip`)||t.includes(`archive`)?`📦`:`📄`}function Kt(e){let t=e.mimeType;return e.type===`text`||e.type===`doc`||t.includes(`text`)||t.includes(`json`)||t.includes(`javascript`)||t.includes(`xml`)||t.includes(`csv`)||t.includes(`yaml`)||t.includes(`markdown`)||t.includes(`html`)||t.includes(`css`)||t.includes(`python`)||t.includes(`vnd.google-apps.document`)}function qt(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`list`),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),w=(0,_.useRef)(null),ee=(e=s,t=l)=>{i(!0);let r=`/api/drive`;e&&(r+=`?filter=${e}`),t&&(r+=`${e?`&`:`?`}search=${encodeURIComponent(t)}`),E(r).then(e=>{n(e??{files:[]}),i(!1)}).catch(e=>{o(e.message??`Error`),i(!1)})};(0,_.useEffect)(()=>{ee()},[]);let te=e=>{c(e),ee(e,l)},ne=()=>{u(d),ee(s,d)},T=(e,t)=>{i(!0),E(`/api/drive/read/${e}`).then(n=>{g({id:e,name:t,content:n?.content??``}),y(n?.content??``),m(`editor`),i(!1)}).catch(()=>i(!1))},re=async()=>{if(h&&confirm(`Save changes to "${h.name}" on Drive?`)){C(!0);try{await D(`/api/drive/update/${h.id}`,{content:v}),g(e=>e&&{...e,content:v}),alert(`Saved!`)}catch(e){alert(`Save failed: `+e.message)}finally{C(!1)}}},ie=(e,t)=>{i(!0),E(`/api/drive/download/${e}`).then(n=>{x({id:e,name:t,src:`data:${n?.mimeType??`image/jpeg`};base64,${n?.base64}`,mode:`image`}),m(`image`),i(!1)}).catch(()=>i(!1))},O=(e,t)=>{i(!0),E(`/api/drive/download/${e}`).then(n=>{x({id:e,name:t,src:`data:application/pdf;base64,${n?.base64}`,mode:`pdf`}),m(`pdf`),i(!1)}).catch(()=>i(!1))},ae=(e,t)=>{confirm(`Delete "${t}" from Drive? (moved to trash)`)&&D(`/api/drive/delete/${e}`,{}).then(()=>{n(null),ee()})},A=()=>{let e=prompt(`File name (e.g. notes.txt, script.py):`);e&&D(`/api/drive/upload`,{name:e,content:``,mimeType:`text/plain`}).then(t=>{t?.id?T(t.id,e):ee()}).catch(e=>alert(`Error: `+e.message))},j=()=>{w.current?.click()},oe=e=>{if(!e)return;let t=new FileReader;t.onload=t=>{let r=(t.target?.result).split(`,`)[1]??``;D(`/api/drive/upload`,{name:e.name,content:r,mimeType:e.type||`application/octet-stream`,encoding:`base64`}).then(()=>{n(null),ee()}).catch(e=>alert(`Upload error: `+e.message))},t.readAsDataURL(e)};if(a)return(0,k.jsxs)(`div`,{className:q.error,children:[(0,k.jsx)(`div`,{children:a}),(0,k.jsxs)(`div`,{className:q.errorHint,children:[`Run: `,(0,k.jsx)(`code`,{children:`nha google revoke`}),` then `,(0,k.jsx)(`code`,{children:`nha google auth`})]})]});if(p===`editor`&&h)return(0,k.jsxs)(`div`,{className:q.editorRoot,children:[(0,k.jsxs)(`div`,{className:q.editorToolbar,children:[(0,k.jsx)(`button`,{className:q.backBtn,onClick:()=>m(`list`),children:`← Back`}),(0,k.jsx)(`span`,{className:q.editorName,children:h.name}),(0,k.jsx)(`button`,{className:q.saveBtn,onClick:re,disabled:S,children:S?`Saving…`:`Save to Drive`})]}),(0,k.jsx)(`textarea`,{className:q.editorArea,value:v,onChange:e=>y(e.target.value),spellCheck:!1,onKeyDown:e=>{if(e.key===`Tab`){e.preventDefault();let t=e.currentTarget.selectionStart,n=e.currentTarget.selectionEnd,r=e.currentTarget.value;e.currentTarget.value=r.slice(0,t)+` `+r.slice(n),e.currentTarget.selectionStart=e.currentTarget.selectionEnd=t+2}}}),(0,k.jsxs)(`div`,{className:q.editorMeta,children:[`File ID: `,h.id,` · Tab = 2 spaces · Not auto-saved`]})]});if(p===`image`&&b)return(0,k.jsxs)(`div`,{className:q.viewerRoot,children:[(0,k.jsxs)(`div`,{className:q.editorToolbar,children:[(0,k.jsx)(`button`,{className:q.backBtn,onClick:()=>m(`list`),children:`← Back`}),(0,k.jsx)(`span`,{className:q.editorName,children:b.name})]}),(0,k.jsx)(`div`,{className:q.imgContainer,children:(0,k.jsx)(`img`,{src:b.src,alt:b.name,className:q.imgView})})]});if(p===`pdf`&&b)return(0,k.jsxs)(`div`,{className:q.viewerRoot,children:[(0,k.jsxs)(`div`,{className:q.editorToolbar,children:[(0,k.jsx)(`button`,{className:q.backBtn,onClick:()=>m(`list`),children:`← Back`}),(0,k.jsx)(`span`,{className:q.editorName,children:b.name})]}),(0,k.jsx)(`iframe`,{className:q.pdfFrame,src:b.src,title:b.name})]});let se=t?.files??[],ce=t?.quota;return(0,k.jsxs)(`div`,{className:q.root,children:[ce&&(0,k.jsxs)(`div`,{className:q.quotaBar,children:[(0,k.jsxs)(`div`,{className:q.quotaText,children:[(0,k.jsxs)(`span`,{className:q.quotaUsed,children:[ce.usage,` of `,ce.limit,` used`]}),(0,k.jsxs)(`span`,{className:q.quotaPct,children:[ce.percentUsed,`%`]})]}),(0,k.jsx)(`div`,{className:q.quotaTrack,children:(0,k.jsx)(`div`,{className:q.quotaFill,style:{width:`${Math.min(ce.percentUsed,100)}%`,background:ce.percentUsed>90?`var(--red)`:ce.percentUsed>70?`var(--amber)`:`var(--green)`}})})]}),(0,k.jsxs)(`div`,{className:q.actionBar,children:[[``,`recent`,`starred`,`shared`].map(e=>(0,k.jsx)(`button`,{className:`${q.filterBtn} ${s===e?q.filterActive:``}`,onClick:()=>te(e),children:e?e.charAt(0).toUpperCase()+e.slice(1):`All Files`},e)),(0,k.jsx)(`div`,{className:q.spacer}),(0,k.jsx)(`button`,{className:q.newBtn,onClick:A,children:`+ New File`}),(0,k.jsx)(`button`,{className:q.uploadBtn,onClick:j,children:e(`drive.upload`)}),(0,k.jsx)(`input`,{ref:w,type:`file`,style:{display:`none`},onChange:e=>oe(e.target.files?.[0])})]}),(0,k.jsxs)(`div`,{className:q.searchRow,children:[(0,k.jsx)(`input`,{className:q.searchInput,value:d,onChange:e=>f(e.target.value),placeholder:`Search files…`,onKeyDown:e=>e.key===`Enter`&&ne()}),(0,k.jsx)(`button`,{className:q.searchBtn,onClick:ne,children:`Search`})]}),r&&(0,k.jsx)(`div`,{className:q.loading,children:(0,k.jsx)(`div`,{className:`spinner`})}),!r&&se.length===0&&(0,k.jsxs)(`div`,{className:q.empty,children:[e(`drive.noFiles`),` found`]}),(0,k.jsx)(`div`,{className:q.fileList,children:se.map(e=>{let t=Kt(e),n=e.type===`image`,r=e.type===`pdf`||e.mimeType.includes(`pdf`);return(0,k.jsxs)(`div`,{className:q.fileRow,onClick:()=>{t?T(e.id,e.name):n?ie(e.id,e.name):r?O(e.id,e.name):e.webViewLink&&window.open(e.webViewLink,`_blank`)},style:{cursor:t||n||r||e.webViewLink?`pointer`:`default`},children:[(0,k.jsx)(`span`,{className:q.fileIcon,children:Gt(e.type,e.mimeType)}),(0,k.jsxs)(`div`,{className:q.fileInfo,children:[(0,k.jsx)(`div`,{className:q.fileName,children:e.name}),(0,k.jsxs)(`div`,{className:q.fileMeta,children:[e.modifiedTime?new Date(e.modifiedTime).toLocaleDateString():``,e.size?` · ${e.size}`:``,e.shared?` · Shared`:``,e.starred?` ★`:``]})]}),(0,k.jsxs)(`div`,{className:q.fileBtns,children:[t&&(0,k.jsx)(`button`,{className:q.editBtn,onClick:t=>{t.stopPropagation(),T(e.id,e.name)},children:`Edit`}),n&&(0,k.jsx)(`button`,{className:q.viewBtn,onClick:t=>{t.stopPropagation(),ie(e.id,e.name)},children:`View`}),r&&(0,k.jsx)(`button`,{className:q.pdfBtn,onClick:t=>{t.stopPropagation(),O(e.id,e.name)},children:`PDF`}),e.webViewLink&&(0,k.jsx)(`a`,{className:q.openBtn,href:e.webViewLink,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),children:`Open ↗`}),(0,k.jsx)(`button`,{className:q.delBtn,onClick:t=>{t.stopPropagation(),ae(e.id,e.name)},children:`Del`})]})]},e.id)})})]})}var J={root:`_root_a0x57_1`,loading:`_loading_a0x57_10`,errorBox:`_errorBox_a0x57_12`,errorHint:`_errorHint_a0x57_13`,userRow:`_userRow_a0x57_16`,avatar:`_avatar_a0x57_27`,userLogin:`_userLogin_a0x57_29`,userName:`_userName_a0x57_30`,disconnectBtn:`_disconnectBtn_a0x57_32`,repoBar:`_repoBar_a0x57_43`,repoInput:`_repoInput_a0x57_49`,issuesBtn:`_issuesBtn_a0x57_61`,prsBtn:`_prsBtn_a0x57_72`,repoPills:`_repoPills_a0x57_83`,repoPill:`_repoPill_a0x57_83`,issueCount:`_issueCount_a0x57_106`,tabs:`_tabs_a0x57_112`,tab:`_tab_a0x57_112`,tabActive:`_tabActive_a0x57_131`,markRead:`_markRead_a0x57_137`,content:`_content_a0x57_148`,empty:`_empty_a0x57_150`,notifRow:`_notifRow_a0x57_152`,issueRow:`_issueRow_a0x57_152`,prRow:`_prRow_a0x57_152`,notifRepo:`_notifRepo_a0x57_166`,notifType:`_notifType_a0x57_167`,notifTitle:`_notifTitle_a0x57_168`,notifMeta:`_notifMeta_a0x57_169`,issueNum:`_issueNum_a0x57_171`,issueTitle:`_issueTitle_a0x57_172`,issueMeta:`_issueMeta_a0x57_173`,issueLabel:`_issueLabel_a0x57_174`,prNum:`_prNum_a0x57_176`,prTitle:`_prTitle_a0x57_177`,prAuthor:`_prAuthor_a0x57_178`,prDraft:`_prDraft_a0x57_179`,prMeta:`_prMeta_a0x57_180`};function Jt(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`notifs`),d=(e=``)=>{i(!0),E(e?`/api/github?repo=${encodeURIComponent(e)}`:`/api/github`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))};(0,_.useEffect)(()=>{d()},[]);let f=()=>{let e=s.trim();o(e),d(e),u(`issues`)},p=()=>{let e=s.trim();o(e),d(e),u(`prs`)},m=()=>D(`/api/github/mark-read`,{}).then(()=>d(a)),h=()=>{confirm(`Remove GitHub connection? You can reconnect anytime.`)&&D(`/api/config`,{key:`github-token`,value:``}).then(()=>{n(null),i(!1)})};if(r)return(0,k.jsx)(`div`,{className:J.loading,children:(0,k.jsx)(`div`,{className:`spinner`})});if(t?.error)return(0,k.jsxs)(`div`,{className:J.errorBox,children:[(0,k.jsx)(`div`,{children:t.error}),(0,k.jsxs)(`div`,{className:J.errorHint,children:[`Run: `,(0,k.jsx)(`code`,{children:`nha config set github-token YOUR_PAT`})]})]});let g=t?.user,v=t?.notifications??[],y=t?.issues??[],b=t?.prs??[];return(0,k.jsxs)(`div`,{className:J.root,children:[g?.login&&(0,k.jsxs)(`div`,{className:J.userRow,children:[g.avatar&&(0,k.jsx)(`img`,{src:g.avatar,className:J.avatar,alt:g.login}),(0,k.jsxs)(`div`,{style:{flex:1},children:[(0,k.jsxs)(`div`,{className:J.userLogin,children:[`@`,g.login]}),g.name&&(0,k.jsx)(`div`,{className:J.userName,children:g.name})]}),(0,k.jsx)(`button`,{className:J.disconnectBtn,onClick:h,children:`Disconnect`})]}),(0,k.jsxs)(`div`,{className:J.repoBar,children:[(0,k.jsx)(`input`,{className:J.repoInput,value:s,onChange:e=>c(e.target.value),placeholder:`owner/repo`,onKeyDown:e=>e.key===`Enter`&&f()}),(0,k.jsx)(`button`,{className:J.issuesBtn,onClick:f,children:`Issues`}),(0,k.jsx)(`button`,{className:J.prsBtn,onClick:p,children:`PRs`})]}),g?.repos&&g.repos.length>0&&(0,k.jsx)(`div`,{className:J.repoPills,children:g.repos.slice(0,12).map(e=>(0,k.jsxs)(`button`,{className:J.repoPill,onClick:()=>{c(e.full_name),o(e.full_name),d(e.full_name),u(`issues`)},title:e.description??``,children:[e.private?`🔒 `:``,e.full_name,e.open_issues?(0,k.jsx)(`span`,{className:J.issueCount,children:e.open_issues}):null]},e.full_name))}),(0,k.jsxs)(`div`,{className:J.tabs,children:[(0,k.jsxs)(`button`,{className:`${J.tab} ${l===`notifs`?J.tabActive:``}`,onClick:()=>u(`notifs`),children:[`Notifications `,v.length>0?`(${v.length})`:``]}),y.length>0&&(0,k.jsxs)(`button`,{className:`${J.tab} ${l===`issues`?J.tabActive:``}`,onClick:()=>u(`issues`),children:[`Issues (`,y.length,`)`]}),b.length>0&&(0,k.jsxs)(`button`,{className:`${J.tab} ${l===`prs`?J.tabActive:``}`,onClick:()=>u(`prs`),children:[`PRs (`,b.length,`)`]}),l===`notifs`&&v.length>0&&(0,k.jsx)(`button`,{className:J.markRead,onClick:m,children:`Mark all read`})]}),(0,k.jsxs)(`div`,{className:J.content,children:[l===`notifs`&&(v.length===0?(0,k.jsx)(`div`,{className:J.empty,children:`No notifications`}):v.map((e,t)=>(0,k.jsxs)(`a`,{className:J.notifRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,k.jsx)(`span`,{className:J.notifRepo,children:e.repo}),(0,k.jsxs)(`span`,{className:J.notifType,children:[`[`,e.type,`]`]}),(0,k.jsx)(`div`,{className:J.notifTitle,children:e.title}),(0,k.jsxs)(`div`,{className:J.notifMeta,children:[e.reason,` · `,e.updated]})]},t))),l===`issues`&&(y.length===0?(0,k.jsxs)(`div`,{className:J.empty,children:[e(`github.noIssues`),` for `,a]}):y.map((e,t)=>(0,k.jsxs)(`a`,{className:J.issueRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,k.jsxs)(`span`,{className:J.issueNum,children:[`#`,e.number]}),(0,k.jsx)(`span`,{className:J.issueTitle,children:e.title}),e.assignee&&(0,k.jsxs)(`span`,{className:J.issueMeta,children:[`→ `,e.assignee]}),e.labels&&(0,k.jsxs)(`span`,{className:J.issueLabel,children:[`[`,e.labels,`]`]}),(0,k.jsx)(`div`,{className:J.issueMeta,children:e.updated})]},t))),l===`prs`&&(b.length===0?(0,k.jsxs)(`div`,{className:J.empty,children:[`No PRs for `,a]}):b.map((e,t)=>(0,k.jsxs)(`a`,{className:J.prRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,k.jsxs)(`span`,{className:J.prNum,children:[`#`,e.number]}),(0,k.jsx)(`span`,{className:J.prTitle,children:e.title}),(0,k.jsxs)(`span`,{className:J.prAuthor,children:[`by `,e.author]}),e.draft&&(0,k.jsx)(`span`,{className:J.prDraft,children:`DRAFT`}),(0,k.jsx)(`div`,{className:J.prMeta,children:e.updated})]},t)))]})]})}var Y={loading:`_loading_1h5ss_1`,errorBox:`_errorBox_1h5ss_3`,errorHint:`_errorHint_1h5ss_4`,twoPane:`_twoPane_1h5ss_7`,sidebar:`_sidebar_1h5ss_13`,sidebarTitle:`_sidebarTitle_1h5ss_24`,workspace:`_workspace_1h5ss_36`,searchRow:`_searchRow_1h5ss_42`,searchInput:`_searchInput_1h5ss_50`,searchBtn:`_searchBtn_1h5ss_63`,channelItem:`_channelItem_1h5ss_73`,channelActive:`_channelActive_1h5ss_83`,pageTitle:`_pageTitle_1h5ss_89`,pageMeta:`_pageMeta_1h5ss_97`,disconnectBtn:`_disconnectBtn_1h5ss_99`,empty:`_empty_1h5ss_110`,messagePane:`_messagePane_1h5ss_112`,channelHeader:`_channelHeader_1h5ss_120`,emptyPane:`_emptyPane_1h5ss_129`,message:`_message_1h5ss_112`,msgUser:`_msgUser_1h5ss_146`,msgText:`_msgText_1h5ss_147`,msgTs:`_msgTs_1h5ss_148`,openLink:`_openLink_1h5ss_150`,pageBody:`_pageBody_1h5ss_160`};function Yt(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)([]),l=()=>{i(!0),E(`/api/slack/channels`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))},u=e=>{o(e),E(`/api/slack/messages?channel=${e.id}`).then(e=>c(e?.messages??[]))};if((0,_.useEffect)(()=>{l()},[]),r)return(0,k.jsxs)(`div`,{className:Y.loading,children:[(0,k.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]});if(t?.error)return(0,k.jsxs)(`div`,{className:Y.errorBox,children:[(0,k.jsx)(`div`,{children:t.error}),(0,k.jsxs)(`div`,{className:Y.errorHint,children:[`Run: `,(0,k.jsx)(`code`,{children:`nha config set slack-token xoxb-YOUR-TOKEN`})]})]});let d=t?.channels??[];return(0,k.jsxs)(`div`,{className:Y.twoPane,children:[(0,k.jsxs)(`div`,{className:Y.sidebar,children:[(0,k.jsxs)(`div`,{className:Y.sidebarTitle,children:[(0,k.jsx)(`span`,{children:`💬 Slack`}),t?.workspace&&(0,k.jsx)(`span`,{className:Y.workspace,children:t.workspace})]}),d.length===0&&(0,k.jsx)(`div`,{className:Y.empty,children:`No channels`}),d.map(e=>(0,k.jsxs)(`div`,{className:`${Y.channelItem} ${a?.id===e.id?Y.channelActive:``}`,onClick:()=>u(e),children:[`# `,e.name]},e.id)),(0,k.jsx)(`button`,{className:Y.disconnectBtn,onClick:()=>D(`/api/config`,{key:`slack-token`,value:``}).then(l),children:`Disconnect`})]}),(0,k.jsx)(`div`,{className:Y.messagePane,children:a?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:Y.channelHeader,children:[`#`,a.name]}),s.length===0&&(0,k.jsx)(`div`,{className:Y.empty,children:`No messages`}),s.map((e,t)=>(0,k.jsxs)(`div`,{className:Y.message,children:[(0,k.jsx)(`span`,{className:Y.msgUser,children:e.username||e.user||`Unknown`}),(0,k.jsx)(`span`,{className:Y.msgText,children:e.text}),(0,k.jsx)(`span`,{className:Y.msgTs,children:new Date(parseFloat(e.ts)*1e3).toLocaleTimeString()})]},t))]}):(0,k.jsx)(`div`,{className:Y.emptyPane,children:`Select a channel`})})]})}function Xt(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(e=``)=>{i(!0),E(e?`/api/notion/search?q=${encodeURIComponent(e)}`:`/api/notion`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))},f=e=>{o(e),E(`/api/notion/page?id=${encodeURIComponent(e.id)}`).then(e=>c(e?.content??``))};(0,_.useEffect)(()=>{d()},[]);let p=()=>d(l);if(r)return(0,k.jsxs)(`div`,{className:Y.loading,children:[(0,k.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]});if(t?.error)return(0,k.jsxs)(`div`,{className:Y.errorBox,children:[(0,k.jsx)(`div`,{children:t.error}),(0,k.jsxs)(`div`,{className:Y.errorHint,children:[`Run: `,(0,k.jsx)(`code`,{children:`nha config set notion-token secret_YOUR_TOKEN`})]})]});let m=t?.pages??[];return(0,k.jsxs)(`div`,{className:Y.twoPane,children:[(0,k.jsxs)(`div`,{className:Y.sidebar,children:[(0,k.jsx)(`div`,{className:Y.sidebarTitle,children:`📋 Notion`}),(0,k.jsxs)(`div`,{className:Y.searchRow,children:[(0,k.jsx)(`input`,{className:Y.searchInput,value:l,onChange:e=>u(e.target.value),placeholder:`Search pages…`,onKeyDown:e=>e.key===`Enter`&&p()}),(0,k.jsx)(`button`,{className:Y.searchBtn,onClick:p,children:`Go`})]}),m.length===0&&(0,k.jsx)(`div`,{className:Y.empty,children:`No pages found`}),m.map(e=>(0,k.jsxs)(`div`,{className:`${Y.channelItem} ${a?.id===e.id?Y.channelActive:``}`,onClick:()=>f(e),children:[(0,k.jsx)(`div`,{className:Y.pageTitle,children:e.title||`Untitled`}),e.last_edited&&(0,k.jsx)(`div`,{className:Y.pageMeta,children:e.last_edited.slice(0,10)})]},e.id)),(0,k.jsx)(`button`,{className:Y.disconnectBtn,onClick:()=>D(`/api/config`,{key:`notion-token`,value:``}).then(()=>d()),children:`Disconnect`})]}),(0,k.jsx)(`div`,{className:Y.messagePane,children:a?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:Y.channelHeader,children:a.title}),a.url&&(0,k.jsx)(`a`,{className:Y.openLink,href:a.url,target:`_blank`,rel:`noreferrer`,children:`Open in Notion ↗`}),(0,k.jsx)(`div`,{className:Y.pageBody,dangerouslySetInnerHTML:{__html:me(s||`Loading…`)}})]}):(0,k.jsx)(`div`,{className:Y.emptyPane,children:`Select a page`})})]})}var X={root:`_root_1l3ll_1`,sidebar:`_sidebar_1l3ll_8`,sidebarHeader:`_sidebarHeader_1l3ll_18`,sidebarTitle:`_sidebarTitle_1l3ll_19`,sidebarBtns:`_sidebarBtns_1l3ll_21`,createBtn:`_createBtn_1l3ll_22`,joinBtn:`_joinBtn_1l3ll_23`,noChannels:`_noChannels_1l3ll_25`,channelItem:`_channelItem_1l3ll_27`,channelActive:`_channelActive_1l3ll_29`,channelName:`_channelName_1l3ll_30`,channelMeta:`_channelMeta_1l3ll_31`,channelCode:`_channelCode_1l3ll_32`,channelDel:`_channelDel_1l3ll_34`,main:`_main_1l3ll_38`,chatHeader:`_chatHeader_1l3ll_41`,chatChannelName:`_chatChannelName_1l3ll_50`,chatChannelId:`_chatChannelId_1l3ll_51`,statusDot:`_statusDot_1l3ll_52`,connected:`_connected_1l3ll_53`,disconnected:`_disconnected_1l3ll_54`,statusText:`_statusText_1l3ll_55`,messages:`_messages_1l3ll_58`,emptyMsgs:`_emptyMsgs_1l3ll_66`,msg:`_msg_1l3ll_68`,msgSelf:`_msgSelf_1l3ll_69`,msgOther:`_msgOther_1l3ll_70`,msgSender:`_msgSender_1l3ll_71`,msgContent:`_msgContent_1l3ll_72`,msgTime:`_msgTime_1l3ll_82`,inputRow:`_inputRow_1l3ll_85`,textInput:`_textInput_1l3ll_86`,sendBtn:`_sendBtn_1l3ll_88`,welcome:`_welcome_1l3ll_92`,welcomeIcon:`_welcomeIcon_1l3ll_103`,welcomeTitle:`_welcomeTitle_1l3ll_104`,welcomeSub:`_welcomeSub_1l3ll_105`,welcomeBox:`_welcomeBox_1l3ll_106`,welcomeBoxTitle:`_welcomeBoxTitle_1l3ll_107`,welcomeStep:`_welcomeStep_1l3ll_108`,welcomeHint:`_welcomeHint_1l3ll_109`,cliCmd:`_cliCmd_1l3ll_110`};function Zt(e){return e.content||e.plaintext||e.message||``}function Qt(e){return e.senderName||e.senderFingerprint?.slice(0,8)||e.sender||`unknown`}function $t(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d]=(0,_.useState)(()=>`nha-ui-${Math.random().toString(36).slice(2,8)}`),f=(0,_.useRef)(null),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{E(`/api/collab/channels`).then(e=>{n(e?.channels??[])}).catch(()=>{})},[]),(0,_.useEffect)(()=>{if(r)return m(r),h(r),()=>{f.current?.close(),u(!1)}},[r]);let m=e=>{E(`/api/collab/messages?channelId=${e}`).then(e=>{e?.messages&&(o(e.messages),setTimeout(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},50))}).catch(()=>{})},h=e=>{f.current?.close();let t=window.location.protocol===`https:`?`wss:`:`ws:`,n=window.location.port===`3030`||window.location.port===`3031`?`3020`:window.location.port||`3020`,r=`${t}//${window.location.hostname}:${n}/ws/alexandria?channel=${e}&agentId=${encodeURIComponent(d)}`,i=new WebSocket(r);f.current=i,i.onopen=()=>u(!0),i.onclose=()=>u(!1),i.onmessage=e=>{try{let t=JSON.parse(e.data);if(!t)return;o(e=>[...e,{...t,id:t.id||Date.now().toString(),type:`message`}]),p.current&&(p.current.scrollTop=p.current.scrollHeight)}catch{}}},g=async()=>{let e=prompt(`Channel name:`);if(!e)return;let t=await D(`/api/collab/create`,{name:e}).catch(()=>null);if(!t||t.error){alert(t?.error||`Error creating channel`);return}let r=t.id;await D(`/api/collab/channels`,{id:r,name:e,role:`creator`}).catch(()=>{});let a={id:r,name:e,role:`creator`};n(e=>[...e,a]),i(r),prompt(`Share this invite code with collaborators:`,r)},v=async()=>{let e=prompt(`Invite code:`);if(!e)return;let t=await D(`/api/collab/join`,{channelId:e}).catch(()=>null);if(!t||t.error){alert(t?.error||`Error joining channel`);return}let r=t.name||e.slice(0,8);await D(`/api/collab/channels`,{id:e,name:r,role:`member`}).catch(()=>{}),n(t=>[...t,{id:e,name:r,role:`member`}]),i(e)},y=async e=>{confirm(`Delete this channel? Messages will be lost.`)&&(D(`/api/collab/delete`,{channelId:e}).catch(()=>{}),n(t=>t.filter(t=>t.id!==e)),r===e&&(i(null),o([]),f.current?.close(),u(!1)))},b=async()=>{let e=s.trim();if(!e||!r)return;c(``);let t=await D(`/api/collab/send`,{channelId:r,message:e}).catch(()=>null);t?.error&&alert(t.error),l||m(r)},x=e=>{navigator.clipboard.writeText(e).catch(()=>{})};return(0,k.jsxs)(`div`,{className:X.root,children:[(0,k.jsxs)(`div`,{className:X.sidebar,children:[(0,k.jsx)(`div`,{className:X.sidebarHeader,children:(0,k.jsx)(`div`,{className:X.sidebarTitle,children:`Alexandria`})}),(0,k.jsxs)(`div`,{className:X.sidebarBtns,children:[(0,k.jsx)(`button`,{className:X.createBtn,onClick:g,children:`+ Create`}),(0,k.jsx)(`button`,{className:X.joinBtn,onClick:v,children:`Join`})]}),t.length===0?(0,k.jsxs)(`div`,{className:X.noChannels,children:[e(`collab.noChannels`),` yet`]}):t.map(e=>(0,k.jsxs)(`div`,{className:`${X.channelItem} ${r===e.id?X.channelActive:``}`,onClick:()=>i(e.id),children:[(0,k.jsx)(`div`,{className:X.channelName,children:e.name}),(0,k.jsxs)(`div`,{className:X.channelMeta,children:[(0,k.jsxs)(`span`,{className:X.channelCode,onClick:t=>{t.stopPropagation(),x(e.id)},title:`Click to copy invite code`,children:[e.id.slice(0,8),`…`]}),(0,k.jsx)(`button`,{className:X.channelDel,onClick:t=>{t.stopPropagation(),y(e.id)},children:`del`})]})]},e.id))]}),(0,k.jsx)(`div`,{className:X.main,children:r?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:X.chatHeader,children:[(0,k.jsx)(`div`,{className:X.chatChannelName,children:t.find(e=>e.id===r)?.name??r.slice(0,12)}),(0,k.jsx)(`div`,{className:X.chatChannelId,children:r}),(0,k.jsx)(`div`,{className:`${X.statusDot} ${l?X.connected:X.disconnected}`}),(0,k.jsx)(`span`,{className:X.statusText,children:l?`Live`:`HTTP`})]}),(0,k.jsxs)(`div`,{className:X.messages,ref:p,children:[a.length===0&&(0,k.jsx)(`div`,{className:X.emptyMsgs,children:`No messages yet`}),a.map((e,t)=>{let n=Qt(e),r=Zt(e),i=n===d;return(0,k.jsxs)(`div`,{className:`${X.msg} ${i?X.msgSelf:X.msgOther}`,children:[!i&&(0,k.jsx)(`div`,{className:X.msgSender,children:n}),(0,k.jsx)(`div`,{className:X.msgContent,children:r}),(0,k.jsx)(`div`,{className:X.msgTime,children:new Date(e.timestamp).toLocaleTimeString()})]},e.id||t)})]}),(0,k.jsxs)(`div`,{className:X.inputRow,children:[(0,k.jsx)(`input`,{className:X.textInput,value:s,onChange:e=>c(e.target.value),placeholder:`Send an encrypted message…`,onKeyDown:e=>e.key===`Enter`&&!e.shiftKey&&b()}),(0,k.jsx)(`button`,{className:X.sendBtn,onClick:b,disabled:!s.trim(),children:e(`collab.send`)})]})]}):(0,k.jsxs)(`div`,{className:X.welcome,children:[(0,k.jsx)(`div`,{className:X.welcomeIcon,children:`🔐`}),(0,k.jsx)(`div`,{className:X.welcomeTitle,children:`Alexandria`}),(0,k.jsx)(`div`,{className:X.welcomeSub,children:`E2E encrypted messaging for AI agents and teams`}),(0,k.jsxs)(`div`,{className:X.welcomeBox,children:[(0,k.jsx)(`div`,{className:X.welcomeBoxTitle,children:`HOW TO USE`}),(0,k.jsxs)(`div`,{className:X.welcomeStep,children:[(0,k.jsx)(`strong`,{children:`1. Create a channel`}),` — Click [+ Create] in the sidebar. Give it a name.`]}),(0,k.jsx)(`div`,{className:X.welcomeHint,children:`You get an invite code. Share it with your team or another AI session.`}),(0,k.jsxs)(`div`,{className:X.welcomeStep,children:[(0,k.jsx)(`strong`,{children:`2. Others join`}),` — They click [Join] and paste the invite code.`]}),(0,k.jsx)(`div`,{className:X.welcomeHint,children:`Works from this web UI, the Android app, or the CLI.`}),(0,k.jsxs)(`div`,{className:X.welcomeStep,children:[(0,k.jsx)(`strong`,{children:`3. Chat encrypted`}),` — All messages are E2E encrypted. The server sees only ciphertext.`]})]}),(0,k.jsxs)(`div`,{className:X.welcomeBox,children:[(0,k.jsx)(`div`,{className:X.welcomeBoxTitle,children:`FROM CLI (same channels)`}),(0,k.jsx)(`div`,{className:X.cliCmd,children:`nha collab create "Project X"`}),(0,k.jsx)(`div`,{className:X.cliCmd,children:`nha collab join <invite-code>`}),(0,k.jsx)(`div`,{className:X.cliCmd,children:`nha collab send "Hello from CLI"`}),(0,k.jsx)(`div`,{className:X.cliCmd,children:`nha collab read`})]})]})})]})}var Z={root:`_root_1xa21_2`,header:`_header_1xa21_10`,title:`_title_1xa21_21`,subtitle:`_subtitle_1xa21_28`,headerTabs:`_headerTabs_1xa21_34`,tabBtn:`_tabBtn_1xa21_40`,tabActive:`_tabActive_1xa21_51`,body:`_body_1xa21_58`,editor:`_editor_1xa21_67`,examples:`_examples_1xa21_75`,sectionLabel:`_sectionLabel_1xa21_81`,examplePills:`_examplePills_1xa21_89`,examplePill:`_examplePill_1xa21_89`,editorCols:`_editorCols_1xa21_109`,leftSidebar:`_leftSidebar_1xa21_119`,panel:`_panel_1xa21_128`,panelHeader:`_panelHeader_1xa21_135`,panelTitle:`_panelTitle_1xa21_142`,addBtn:`_addBtn_1xa21_149`,blockLabel:`_blockLabel_1xa21_160`,blockCheck:`_blockCheck_1xa21_170`,authField:`_authField_1xa21_173`,authFieldInput:`_authFieldInput_1xa21_183`,authFieldSelect:`_authFieldSelect_1xa21_193`,authFieldReq:`_authFieldReq_1xa21_204`,removeFieldBtn:`_removeFieldBtn_1xa21_205`,skillsList:`_skillsList_1xa21_208`,skillRow:`_skillRow_1xa21_210`,skillIcon:`_skillIcon_1xa21_218`,skillName:`_skillName_1xa21_220`,skillBadge:`_skillBadge_1xa21_229`,skillBadge_skill:`_skillBadge_skill_1xa21_237`,skillBadge_memory:`_skillBadge_memory_1xa21_238`,skillBadge_provider:`_skillBadge_provider_1xa21_239`,skillBadge_log:`_skillBadge_log_1xa21_240`,skillEmpty:`_skillEmpty_1xa21_242`,skillBtn:`_skillBtn_1xa21_244`,skillsEmpty:`_skillsEmpty_1xa21_246`,snapshotRow:`_snapshotRow_1xa21_249`,snapshotTs:`_snapshotTs_1xa21_258`,snapshotCount:`_snapshotCount_1xa21_259`,snapshotBtn:`_snapshotBtn_1xa21_260`,genStatus:`_genStatus_1xa21_263`,repairStatus:`_repairStatus_1xa21_265`,repairStatusTitle:`_repairStatusTitle_1xa21_266`,repairStatusProg:`_repairStatusProg_1xa21_267`,repairStatusFile:`_repairStatusFile_1xa21_268`,actionRow:`_actionRow_1xa21_271`,actionBtn:`_actionBtn_1xa21_273`,actionBtnIcon:`_actionBtnIcon_1xa21_275`,actionBtnActive:`_actionBtnActive_1xa21_276`,repairBtn:`_repairBtn_1xa21_278`,sandboxBtn:`_sandboxBtn_1xa21_280`,statsBar:`_statsBar_1xa21_282`,rightPanel:`_rightPanel_1xa21_285`,rightTabBar:`_rightTabBar_1xa21_296`,rightTab:`_rightTab_1xa21_296`,rightTabActive:`_rightTabActive_1xa21_313`,repairBar:`_repairBar_1xa21_316`,repairBarRow:`_repairBarRow_1xa21_326`,repairBarIcon:`_repairBarIcon_1xa21_327`,repairBarLabel:`_repairBarLabel_1xa21_328`,repairBarFile:`_repairBarFile_1xa21_329`,repairBarCounter:`_repairBarCounter_1xa21_330`,repairBarTime:`_repairBarTime_1xa21_331`,genBar:`_genBar_1xa21_333`,genBarRow:`_genBarRow_1xa21_343`,genBarRobot:`_genBarRobot_1xa21_344`,robotBob:`_robotBob_1xa21_1`,genBarLabel:`_genBarLabel_1xa21_345`,genBarFile:`_genBarFile_1xa21_346`,genBarCounter:`_genBarCounter_1xa21_347`,genBarTime:`_genBarTime_1xa21_348`,progressTrack:`_progressTrack_1xa21_350`,repairProgress:`_repairProgress_1xa21_351`,genProgress:`_genProgress_1xa21_352`,genDots:`_genDots_1xa21_355`,dot:`_dot_1xa21_356`,dot1:`_dot1_1xa21_357`,dotBounce:`_dotBounce_1xa21_1`,dot2:`_dot2_1xa21_358`,dot3:`_dot3_1xa21_359`,stopBtn:`_stopBtn_1xa21_362`,codeArea:`_codeArea_1xa21_365`,sandboxWrap:`_sandboxWrap_1xa21_366`,sandboxFrame:`_sandboxFrame_1xa21_367`,sandboxEmpty:`_sandboxEmpty_1xa21_368`,sandboxStartBtn:`_sandboxStartBtn_1xa21_369`,noFiles:`_noFiles_1xa21_371`,noFilesHero:`_noFilesHero_1xa21_381`,noFilesIcon:`_noFilesIcon_1xa21_388`,noFilesTitle:`_noFilesTitle_1xa21_390`,noFilesTagline:`_noFilesTagline_1xa21_397`,noFilesSteps:`_noFilesSteps_1xa21_402`,noFilesStep:`_noFilesStep_1xa21_402`,noFilesStepNum:`_noFilesStepNum_1xa21_419`,noFilesExamplesHint:`_noFilesExamplesHint_1xa21_433`,noFilesExampleBtn:`_noFilesExampleBtn_1xa21_443`,codeLayout:`_codeLayout_1xa21_455`,codeViewer:`_codeViewer_1xa21_457`,codeHeader:`_codeHeader_1xa21_465`,codeFileIcon:`_codeFileIcon_1xa21_478`,codeFileName:`_codeFileName_1xa21_479`,codeFileMeta:`_codeFileMeta_1xa21_480`,fileError:`_fileError_1xa21_482`,fileSyntaxError:`_fileSyntaxError_1xa21_483`,filePending:`_filePending_1xa21_484`,code:`_code_1xa21_365`,codeError:`_codeError_1xa21_499`,codeSyntaxError:`_codeSyntaxError_1xa21_500`,fileSidebar:`_fileSidebar_1xa21_503`,fileSidebarHeader:`_fileSidebarHeader_1xa21_512`,fileTab:`_fileTab_1xa21_522`,fileTabActive:`_fileTabActive_1xa21_538`,fileTabError:`_fileTabError_1xa21_539`,fileTabRow:`_fileTabRow_1xa21_541`,fileTabIcon:`_fileTabIcon_1xa21_542`,fileTabName:`_fileTabName_1xa21_543`,fileTabDir:`_fileTabDir_1xa21_544`,fileTabMeta:`_fileTabMeta_1xa21_545`,projectsList:`_projectsList_1xa21_548`,emptyProjects:`_emptyProjects_1xa21_550`,emptyIcon:`_emptyIcon_1xa21_551`,emptyHint:`_emptyHint_1xa21_552`,projectCard:`_projectCard_1xa21_554`,projectInfo:`_projectInfo_1xa21_555`,projectName:`_projectName_1xa21_556`,projectDesc:`_projectDesc_1xa21_557`,projectMeta:`_projectMeta_1xa21_558`,openBtn:`_openBtn_1xa21_559`,deleteBtn:`_deleteBtn_1xa21_560`,planBanner:`_planBanner_1xa21_563`,planTitle:`_planTitle_1xa21_572`,planText:`_planText_1xa21_573`,planActions:`_planActions_1xa21_574`,planApprove:`_planApprove_1xa21_575`,planReject:`_planReject_1xa21_576`,grepPanel:`_grepPanel_1xa21_579`,grepRow:`_grepRow_1xa21_588`,grepInput:`_grepInput_1xa21_589`,grepBtn:`_grepBtn_1xa21_591`,grepClose:`_grepClose_1xa21_592`,grepCount:`_grepCount_1xa21_593`,grepResults:`_grepResults_1xa21_594`,grepEmpty:`_grepEmpty_1xa21_595`,grepMatch:`_grepMatch_1xa21_596`,grepMatchFile:`_grepMatchFile_1xa21_598`,grepMatchLine:`_grepMatchLine_1xa21_599`,diffPanel:`_diffPanel_1xa21_602`,diffHeader:`_diffHeader_1xa21_611`,diffClose:`_diffClose_1xa21_612`,diffFile:`_diffFile_1xa21_613`,diffSummary:`_diffSummary_1xa21_614`,diffArrow:`_diffArrow_1xa21_615`,diffFileName:`_diffFileName_1xa21_616`,diffAdded:`_diffAdded_1xa21_617`,diffRemoved:`_diffRemoved_1xa21_618`,diffContent:`_diffContent_1xa21_619`,diffInline:`_diffInline_1xa21_622`,diffInlineHeader:`_diffInlineHeader_1xa21_623`,diffRemLine:`_diffRemLine_1xa21_624`,diffAddLine:`_diffAddLine_1xa21_625`,chatPanel:`_chatPanel_1xa21_628`,chatMessages:`_chatMessages_1xa21_637`,chatWelcome:`_chatWelcome_1xa21_639`,chatUser:`_chatUser_1xa21_641`,chatUserBubble:`_chatUserBubble_1xa21_642`,chatAttachPreviews:`_chatAttachPreviews_1xa21_643`,chatAttachBadge:`_chatAttachBadge_1xa21_644`,chatSystem:`_chatSystem_1xa21_646`,chatSystemBubble:`_chatSystemBubble_1xa21_647`,chatSyntaxErr:`_chatSyntaxErr_1xa21_648`,chatAgent:`_chatAgent_1xa21_650`,chatAgentCard:`_chatAgentCard_1xa21_651`,chatAgentHeader:`_chatAgentHeader_1xa21_652`,chatAgentRobot:`_chatAgentRobot_1xa21_653`,chatAgentRobotAnim:`_chatAgentRobotAnim_1xa21_654`,chatAgentLabel:`_chatAgentLabel_1xa21_655`,chatRunningDots:`_chatRunningDots_1xa21_656`,chatAgentText:`_chatAgentText_1xa21_657`,chatToolBadges:`_chatToolBadges_1xa21_658`,toolBadge:`_toolBadge_1xa21_659`,toolBadgeOk:`_toolBadgeOk_1xa21_660`,toolBadgeErr:`_toolBadgeErr_1xa21_661`,cursor:`_cursor_1xa21_663`,blink:`_blink_1xa21_1`,attachPreviews:`_attachPreviews_1xa21_666`,attachBadge:`_attachBadge_1xa21_667`,removeAttachBtn:`_removeAttachBtn_1xa21_668`,projNameRow:`_projNameRow_1xa21_671`,projNameLabel:`_projNameLabel_1xa21_672`,projNameInput:`_projNameInput_1xa21_673`,projActiveRow:`_projActiveRow_1xa21_674`,projActiveName:`_projActiveName_1xa21_675`,chatInputRow:`_chatInputRow_1xa21_678`,attachLabel:`_attachLabel_1xa21_679`,chatTextarea:`_chatTextarea_1xa21_680`,chatSendCol:`_chatSendCol_1xa21_683`,chatSendBtn:`_chatSendBtn_1xa21_684`,chatStopBtn:`_chatStopBtn_1xa21_686`,modalOverlay:`_modalOverlay_1xa21_689`,modal:`_modal_1xa21_689`,modalHeader:`_modalHeader_1xa21_711`,modalTitle:`_modalTitle_1xa21_712`,modalClose:`_modalClose_1xa21_713`,modalBody:`_modalBody_1xa21_715`,modalRow:`_modalRow_1xa21_717`,modalField:`_modalField_1xa21_718`,modalLabel:`_modalLabel_1xa21_719`,modalLabelRow:`_modalLabelRow_1xa21_720`,modalSelect:`_modalSelect_1xa21_722`,modalInput:`_modalInput_1xa21_723`,modalHint:`_modalHint_1xa21_726`,modalAiBox:`_modalAiBox_1xa21_728`,modalAiRow:`_modalAiRow_1xa21_729`,modalAiDesc:`_modalAiDesc_1xa21_730`,modalAiBtn:`_modalAiBtn_1xa21_731`,modalContentArea:`_modalContentArea_1xa21_734`,logView:`_logView_1xa21_737`,modalFooter:`_modalFooter_1xa21_739`,modalCancelBtn:`_modalCancelBtn_1xa21_740`,modalSaveBtn:`_modalSaveBtn_1xa21_741`},en=[{name:`MySaaS`,desc:`SaaS product landing page. Hero: large headline, subheadline, two CTA buttons (Start free trial / Watch demo), animated gradient background. Features section: 3-column grid with icon, title, description for 6 features. Pricing section: 3 cards (Free / Pro $29/mo / Enterprise). Testimonials: 3 customer quotes. FAQ accordion: 5 questions. Footer with links and social icons. Sticky nav.`},{name:`MyShop`,desc:`E-commerce storefront homepage. Nav with logo, search bar, cart badge, hamburger mobile menu. Hero banner. Category strip: 6 cards. Featured products grid: 8 cards with rating, price, Add to Cart, wishlist. Promo banner. Newsletter signup. Responsive.`},{name:`MyBlog`,desc:`Blog platform homepage. Nav with category links. Hero: featured article card. Article grid: 6 cards. Sidebar: recent posts, tags cloud, newsletter widget. Pagination. Author bio section. Minimal footer.`},{name:`MyPortfolio`,desc:`Developer portfolio. Nav with scroll hide/show. Hero: typewriter role subtitle, CTA buttons. Work section: 6 project cards. Skills grouped by category with bars. About: timeline of milestones. Contact form. Scroll entrance animations via Intersection Observer.`},{name:`MyRestaurant`,desc:`Restaurant website. Nav: logo center, transparent→solid on scroll. Hero: full-viewport with overlay. Menu preview: tabbed (Starters/Mains/Desserts/Drinks). Reservation form. Gallery 3x3 mosaic. Chef section. Testimonials horizontal scroll.`},{name:`MyJobBoard`,desc:`Job board homepage. Hero search widget. Stats strip. Featured jobs list: 8 cards with company, location badge, salary, Quick Apply. Filter sidebar. Top companies section. Category cards. Newsletter.`}],tn=[{key:`auth`,label:`Auth (register/login/JWT)`,icon:`🔒`},{key:`cookieBanner`,label:`GDPR Cookie Banner`,icon:`🍪`},{key:`securityMiddleware`,label:`Security Middleware`,icon:`🛡️`},{key:`emailVerification`,label:`Email Verification`,icon:`✉️`}],nn={js:`📄`,ts:`📄`,css:`🎨`,html:`🌐`,json:`{`,md:`📑`,sql:`🗂`,env:`🔐`,conf:`⚙`,lock:`🔒`};function rn(e){return nn[e.split(`.`).pop()?.toLowerCase()??``]??`📄`}function an(e){let t=new TextEncoder().encode(e).length;return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function on(e){return e===`memory`?`🧠`:e===`provider`?`🤖`:e===`log`?`📄`:`📋`}function sn(){let e=M(),[t,n]=(0,_.useState)(`new`),[r,i]=(0,_.useState)(`files`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)({auth:!0,cookieBanner:!0,securityMiddleware:!0,emailVerification:!0}),[d,f]=(0,_.useState)([{label:`Email`,type:`email`,required:!0},{label:`Password`,type:`password`,required:!0},{label:`Name`,type:`text`,required:!0}]),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(0),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(0),[w,ee]=(0,_.useState)(0),[te,ne]=(0,_.useState)(``),[T,re]=(0,_.useState)({fi:0,total:0,name:``}),[ie,O]=(0,_.useState)(null),[ae,A]=(0,_.useState)([]),[j,oe]=(0,_.useState)(``),[se,ce]=(0,_.useState)(!1),[le,ue]=(0,_.useState)([]),[N,de]=(0,_.useState)(null),[fe,pe]=(0,_.useState)([]),[me,P]=(0,_.useState)(!1),[he,ge]=(0,_.useState)(null),[_e,ve]=(0,_.useState)([]),[F,ye]=(0,_.useState)(!1),[be,xe]=(0,_.useState)(``),[I,L]=(0,_.useState)([]),[Se,Ce]=(0,_.useState)([]),[we,Te]=(0,_.useState)([]),[Ee,De]=(0,_.useState)(null),[Oe,ke]=(0,_.useState)(`0s`),[Ae,je]=(0,_.useState)(`0s`),R=(0,_.useRef)(0),Me=(0,_.useRef)(0),Ne=(0,_.useRef)(null),Pe=(0,_.useRef)(null),Fe=(0,_.useRef)(null),Ie=(0,_.useRef)(null),Le=(0,_.useRef)(null),Re=(0,_.useRef)(null);function ze(e){let t=Math.floor((Date.now()-e)/1e3),n=Math.floor(t/60);return(n>0?`${n}m `:``)+`${t%60}s`}(0,_.useEffect)(()=>(v||b?Ne.current=setInterval(()=>{v&&ke(ze(R.current)),b&&je(ze(Me.current))},1e3):Ne.current&&=(clearInterval(Ne.current),null),()=>{Ne.current&&clearInterval(Ne.current)}),[v,b]);function Be(){Fe.current&&(Fe.current.scrollTop=Fe.current.scrollHeight)}(0,_.useEffect)(()=>{Be()},[ae]),(0,_.useEffect)(()=>{a&&p.length>0&&!me&&(P(!0),E(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`).then(e=>{e?.skills&&pe(e.skills)}).catch(()=>{}))},[a,p.length,me]);async function Ve(e,t){if(v||!e||e.length<5)return;y(!0),m([]),g(0),re({fi:0,total:0,name:``}),R.current=Date.now(),ke(`0s`),Pe.current=new AbortController;let n=Date.now();try{let r=await fetch(`/api/studio/webcraft/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:Pe.current.signal,body:JSON.stringify({projectName:t,description:e,blocks:l,authFields:d})});if(!r.ok||!r.body){y(!1);return}let i=r.body.getReader(),a=new TextDecoder,o=``,s=[];for(;;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0});let r=o.split(`
|
|
531
531
|
|
|
532
|
-
`);o=r.pop()??``;for(let e of r){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);if(e.type===`file_start`)s.push({name:e.name,content:``,_pending:!0}),m([...s]),re({fi:e.fi,total:e.total,name:e.name}),g(s.length-1);else if(e.type===`file_chunk`){let t=s.find(t=>t.name===e.name);t&&(t.content+=e.chunk,t._pending=!1),m([...s])}else if(e.type===`file_done`){let t=s.find(t=>t.name===e.name);t&&(t._pending=!1,e.syntaxError&&(t._syntaxError=e.syntaxError)),m([...s]),re({fi:e.fi,total:e.total,name:e.name})}else if(e.type===`file_error`){let t=s.find(t=>t.name===e.name);t&&(t._error=!0,t._pending=!1),m([...s])}else e.type===`done`&&(O({seconds:Math.round((Date.now()-n)/1e3),tokIn:e.tokIn??0,tokOut:e.tokOut??0,files:s.length}),y(!1),P(!1),pe([]),s.some(e=>e._error||e._syntaxError)?setTimeout(()=>Le.current?.(),800):setTimeout(()=>Re.current?.(),800))}catch{}}}}catch(e){e.name!==`AbortError`&&A(t=>[...t,{role:`system`,text:`Errore generazione: `+e.message}]),y(!1)}}async function He(){let e=j.trim();if(!(a&&p.length>0)){if(!e||e.length<5)return;let t=a||`MyProject`;o(t),c(e),oe(``),await Ve(e,t);return}if(!e&&le.length===0||se||v)return;let t=[...le];if(ue([]),oe(``),e.toLowerCase().startsWith(`/plan `)||e.toLowerCase().startsWith(`piano: `)){let t=e.replace(/^\/plan[ ]*/i,``).replace(/^piano:[ ]*/i,``);A(t=>[...t,{role:`user`,text:e}]),await Ue(`[MODALITA PIANO] Descrivi cosa modificheresti per: "${t}". Elenca i file e cosa faresti. NON applicare modifiche ancora. Rispondi con il piano in bullet list.`,t,[]);return}A(n=>[...n,{role:`user`,text:e,attachments:t}]),await Ue(e,null,t)}async function Ue(e,t,n){if(se)return;ce(!0);let r={};p.forEach(e=>{r[e.name]=e.content});try{let i=await fetch(`/api/studio/webcraft/agent`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:a,message:e,attachments:n.map(e=>({name:e.name,mimeType:e.mimeType,base64:e.base64}))})});if(!i.ok||!i.body){A(e=>[...e,{role:`agent`,text:`Errore: ${i.status}`,tools:[]}]),ce(!1);return}let o={role:`agent`,text:``,tools:[]};A(e=>[...e,o]);let s=i.body.getReader(),c=new TextDecoder,l=``,u=!1;for(;;){let{done:e,value:n}=await s.read();if(e)break;l+=c.decode(n,{stream:!0});let i=l.split(`
|
|
532
|
+
`);o=r.pop()??``;for(let e of r){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);if(e.type===`processing`||e.type===`planning`)re(t=>({...t,name:e.type===`planning`?`📋 Pianificazione struttura...`:e.msg||`Avvio...`}));else if(e.type===`file_start`)s.push({name:e.name,content:``,_pending:!0}),m([...s]),re({fi:e.fi,total:e.total,name:e.name}),g(s.length-1);else if(e.type===`file_chunk`){let t=s.find(t=>t.name===e.name);t&&(t.content+=e.chunk,t._pending=!1),m([...s])}else if(e.type===`file_done`){let t=s.find(t=>t.name===e.name);t&&(t._pending=!1,e.syntaxError&&(t._syntaxError=e.syntaxError)),m([...s]),re({fi:e.fi,total:e.total,name:e.name})}else if(e.type===`file_error`){let t=s.find(t=>t.name===e.name);t&&(t._error=!0,t._pending=!1),m([...s])}else e.type===`done`&&(O({seconds:Math.round((Date.now()-n)/1e3),tokIn:e.tokIn??0,tokOut:e.tokOut??0,files:s.length}),y(!1),P(!1),pe([]),s.some(e=>e._error||e._syntaxError)?setTimeout(()=>Le.current?.(),800):setTimeout(()=>Re.current?.(),800))}catch{}}}}catch(e){e.name!==`AbortError`&&A(t=>[...t,{role:`system`,text:`Errore generazione: `+e.message}]),y(!1)}}async function He(){let e=j.trim();if(!(a&&p.length>0)){if(!e||e.length<5)return;let t=a||`MyProject`;o(t),c(e),oe(``),await Ve(e,t);return}if(!e&&le.length===0||se||v)return;let t=[...le];if(ue([]),oe(``),e.toLowerCase().startsWith(`/plan `)||e.toLowerCase().startsWith(`piano: `)){let t=e.replace(/^\/plan[ ]*/i,``).replace(/^piano:[ ]*/i,``);A(t=>[...t,{role:`user`,text:e}]),await Ue(`[MODALITA PIANO] Descrivi cosa modificheresti per: "${t}". Elenca i file e cosa faresti. NON applicare modifiche ancora. Rispondi con il piano in bullet list.`,t,[]);return}A(n=>[...n,{role:`user`,text:e,attachments:t}]),await Ue(e,null,t)}async function Ue(e,t,n){if(se)return;ce(!0);let r={};p.forEach(e=>{r[e.name]=e.content});try{let i=await fetch(`/api/studio/webcraft/agent`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:a,message:e,attachments:n.map(e=>({name:e.name,mimeType:e.mimeType,base64:e.base64}))})});if(!i.ok||!i.body){A(e=>[...e,{role:`agent`,text:`Errore: ${i.status}`,tools:[]}]),ce(!1);return}let o={role:`agent`,text:``,tools:[]};A(e=>[...e,o]);let s=i.body.getReader(),c=new TextDecoder,l=``,u=!1;for(;;){let{done:e,value:n}=await s.read();if(e)break;l+=c.decode(n,{stream:!0});let i=l.split(`
|
|
533
533
|
|
|
534
534
|
`);l=i.pop()??``;for(let e of i){let n=e.replace(/^data: /,``).trim();if(n)try{let e=JSON.parse(n);e.type===`text`?(o.text+=e.token,A(e=>{let t=[...e];return t[t.length-1]={...o},t})):e.type===`tool`?(o.tools.push({op:e.op,path:e.path,result:e.result,oldSnippet:e.oldSnippet??``,newSnippet:e.newSnippet??``}),(e.op===`edit`||e.op===`write`)&&e.result===`ok`&&(u=!0),A(e=>{let t=[...e];return t[t.length-1]={...o},t})):e.type===`done`?(t&&!u&&de({plan:o.text,originalMessage:t}),ce(!1),e.changed&&await We((o.tools??[]).filter(e=>e.op===`edit`||e.op===`write`).map(e=>e.path),r)):e.type===`error`&&(o.text+=`
|
|
535
535
|
Errore: `+e.msg,ce(!1))}catch{}}}}catch(e){A(t=>[...t,{role:`agent`,text:`Errore di rete: `+e.message,tools:[]}])}ce(!1)}async function We(e,t){if(!a)return;let n=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(a)}`);if(n?.files&&(m(n.files),e.length>0)){let r=e.map(e=>{let r=n.files.find(t=>t.name===e);return r?{file:e,before:t[e]??``,after:r.content}:null}).filter(Boolean);Ce(e=>[...e,...r])}}function Ge(){Pe.current&&=(Pe.current.abort(),null),y(!1),ce(!1),A(e=>[...e,{role:`system`,text:`⏹ Generazione interrotta.`}])}async function Ke(){return a?(await D(`/api/studio/webcraft/snapshot`,{projectName:a}))?.snapshot??null:null}async function qe(){let e=await Ke();e&&(A(t=>[...t,{role:`system`,text:`💾 Snapshot salvato (${e.slice(0,16).replace(`T`,` `)})`}]),Je())}async function Je(){if(!a)return;let e=await E(`/api/studio/webcraft/snapshots/${encodeURIComponent(a)}`);e?.snapshots&&ve(e.snapshots)}async function Ye(e){confirm(`Ripristinare lo snapshot del ${e.replace(`T`,` `).slice(0,16)}? I file attuali verranno sovrascritti.`)&&await D(`/api/studio/webcraft/restore`,{projectName:a,ts:e})!==null&&(A(t=>[...t,{role:`agent`,text:`Snapshot ripristinato (${e}). Ricarico i file...`}]),We([],{}))}async function Xe(){if(!a)return;let e=await D(`/api/studio/webcraft/syntax-check`,{projectName:a});if(e?.results){let t=e.results.filter(e=>!e.ok);t.length>0?A(e=>[...e,{role:`system`,text:`⚠ Syntax check: ${t.length} errore/i trovato/i.`,syntaxErrors:t}]):A(e=>[...e,{role:`system`,text:`✓ Syntax check: tutti i file JS sono validi.`}])}}async function Ze(){let e=p.filter(e=>e._error||e._syntaxError);if(e.length===0){Re.current?.();return}x(!0),C(0),ee(e.length),Me.current=Date.now(),je(`0s`);for(let t=0;t<e.length;t++){let n=e[t];ne(n.name),C(t),await Ue(`REPAIR FILE: ${n.name}\nErrore: ${n._syntaxError??`generazione fallita`}\nRigenera il file correttamente. Output SOLO il contenuto del file, nessuna spiegazione.`,null,[])}C(e.length),ne(``),x(!1),setTimeout(()=>Re.current?.(),500)}async function Qe(){if(a)try{let e=await D(`/api/studio/webcraft/sandbox/start`,{projectName:a});e?.port&&(De(e.port),i(`preview`))}catch{}}(0,_.useEffect)(()=>{Le.current=Ze,Re.current=Qe});async function $e(){if(!be||!a)return;let e=await D(`/api/studio/webcraft/grep`,{projectName:a,query:be});e?.matches&&L(e.matches)}function et(e){let t=p.findIndex(t=>t.name===e);t>=0&&(g(t),i(`files`))}function tt(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(a)}`,`_blank`)}async function nt(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},o;o=e.mode===`edit`&&e.idx!==null?fe.map((t,n)=>n===e.idx?i:t):[...fe,i],pe(o),ge(null),await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:o})}async function rt(e){let t=fe[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}/delete`,{name:t.name}),pe(fe.filter((t,n)=>n!==e)))}async function it(e){let t=fe[e];if(!t||!confirm(`Svuotare "${t.name}"? Il file rimane ma il contenuto viene cancellato.`))return;let n=fe.map((t,n)=>n===e?{...t,content:``}:t);pe(n),await D(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:n})}async function z(){let e=await E(`/api/studio/webcraft/projects`);e?.projects&&Te(e.projects)}async function at(e){let t=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(e.name)}`);if(!t)return;o(t.projectName??e.name),c(t.description??``),m(t.files??[]),g(0),n(`new`),i(`files`),A([]),pe([]),P(!1);let r=await E(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(t.projectName??e.name)}`);r?.chat&&A(r.chat);let a=await E(`/api/studio/webcraft/skills/${encodeURIComponent(t.projectName??e.name)}`);a?.skills&&(pe(a.skills),P(!0))}async function ot(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await D(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),Te(we.filter(t=>t.name!==e.name)),a===e.name&&(o(``),m([]),A([]),c(``)))}async function st(){if(!N)return;let e=N.originalMessage;de(null),await Ue(e+`
|
|
536
|
-
[Piano approvato — procedi con le modifiche]`,null,[])}function ct(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];ue(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let lt=a&&p.length>0,B=p[h],ut=se||v;return(0,k.jsxs)(`div`,{className:Z.root,children:[(0,k.jsxs)(`div`,{className:Z.header,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:Z.title,children:`⚙ WebCraft`}),(0,k.jsx)(`div`,{className:Z.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,k.jsxs)(`div`,{className:Z.headerTabs,children:[(0,k.jsx)(`button`,{className:`${Z.tabBtn} ${t===`new`?Z.tabActive:``}`,onClick:()=>n(`new`),children:`+ Nuovo`}),(0,k.jsx)(`button`,{className:`${Z.tabBtn} ${t===`projects`?Z.tabActive:``}`,onClick:()=>{n(`projects`),z()},children:`📁 Progetti`})]})]}),(0,k.jsx)(`div`,{className:Z.body,children:t===`projects`?(0,k.jsx)(`div`,{className:Z.projectsList,children:we.length===0?(0,k.jsxs)(`div`,{className:Z.emptyProjects,children:[(0,k.jsx)(`span`,{className:Z.emptyIcon,children:`📁`}),(0,k.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,k.jsx)(`span`,{className:Z.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):we.map(e=>(0,k.jsxs)(`div`,{className:Z.projectCard,children:[(0,k.jsxs)(`div`,{className:Z.projectInfo,children:[(0,k.jsx)(`div`,{className:Z.projectName,children:e.name}),(0,k.jsx)(`div`,{className:Z.projectDesc,children:e.description}),(0,k.jsxs)(`div`,{className:Z.projectMeta,children:[(0,k.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,k.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,k.jsx)(`button`,{className:Z.openBtn,onClick:()=>at(e),children:`↗ Apri`}),(0,k.jsx)(`button`,{className:Z.deleteBtn,onClick:()=>ot(e),children:`🗑`})]},e.name))}):(0,k.jsxs)(`div`,{className:Z.editor,children:[(0,k.jsxs)(`div`,{className:Z.examples,children:[(0,k.jsx)(`div`,{className:Z.sectionLabel,children:`Esempi`}),(0,k.jsx)(`div`,{className:Z.examplePills,children:en.map(e=>(0,k.jsx)(`button`,{className:Z.examplePill,onClick:()=>{o(e.name),c(e.desc),oe(e.desc)},children:e.name},e.name))})]}),(0,k.jsxs)(`div`,{className:Z.editorCols,children:[(0,k.jsxs)(`div`,{className:Z.leftSidebar,children:[(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`Blocchi`}),tn.map(e=>(0,k.jsxs)(`label`,{className:Z.blockLabel,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:l[e.key],onChange:t=>u(n=>({...n,[e.key]:t.target.checked})),className:Z.blockCheck}),(0,k.jsx)(`span`,{children:e.icon}),(0,k.jsx)(`span`,{children:e.label})]},e.key))]}),l.auth&&(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsxs)(`div`,{className:Z.panelHeader,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`Campi Auth`}),(0,k.jsx)(`button`,{className:Z.addBtn,onClick:()=>f(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),d.map((e,t)=>(0,k.jsxs)(`div`,{className:Z.authField,children:[(0,k.jsx)(`input`,{value:e.label,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:Z.authFieldInput}),(0,k.jsx)(`select`,{value:e.type,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:Z.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,required:e.target.checked}:n)),title:`Required`,className:Z.authFieldReq}),(0,k.jsx)(`button`,{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:Z.removeFieldBtn,children:`×`})]},t))]}),(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsxs)(`div`,{className:Z.panelHeader,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`🗂 Contesto AI`}),lt&&(0,k.jsx)(`button`,{className:Z.addBtn,onClick:()=>ge({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),fe.length>0?(0,k.jsx)(`div`,{className:Z.skillsList,children:fe.map((e,t)=>(0,k.jsxs)(`div`,{className:Z.skillRow,children:[(0,k.jsx)(`span`,{className:Z.skillIcon,children:on(e.type)}),(0,k.jsx)(`span`,{className:Z.skillName,title:e.name,children:e.name}),(0,k.jsx)(`span`,{className:`${Z.skillBadge} ${Z[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,k.jsx)(`span`,{className:Z.skillEmpty,children:`⚠`}),(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>ge({mode:e.type===`log`?`view`:`edit`,idx:t,name:e.name,content:e.content,type:e.type,generating:!1}),children:e.type===`log`?`👁`:`✏`}),e.type!==`memory`&&e.type!==`provider`&&e.type!==`log`&&(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>it(t),children:`🗑`}),e.type===`log`&&(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>rt(t),children:`🗑`})]},t))}):(0,k.jsx)(`div`,{className:Z.skillsEmpty,children:lt?`Caricamento...`:`Genera un progetto per attivare i file di contesto.`})]}),_e.length>0&&(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`💾 Snapshot`}),_e.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,k.jsxs)(`div`,{className:Z.snapshotRow,children:[(0,k.jsx)(`span`,{className:Z.snapshotTs,children:t}),(0,k.jsxs)(`span`,{className:Z.snapshotCount,children:[e.fileCount,`f`]}),(0,k.jsx)(`button`,{className:Z.snapshotBtn,onClick:()=>Ye(e.ts),children:`↺`})]},e.ts)})]}),v&&(0,k.jsx)(`div`,{className:Z.genStatus,children:`⏳ Generazione...`}),b&&(0,k.jsxs)(`div`,{className:Z.repairStatus,children:[(0,k.jsx)(`div`,{className:Z.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,k.jsxs)(`div`,{className:Z.repairStatusProg,children:[S,` / `,w,` file`]}),(0,k.jsx)(`div`,{className:Z.repairStatusFile,children:te})]}),p.length>0&&!v&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:Z.actionRow,children:[(0,k.jsx)(`button`,{className:Z.actionBtn,onClick:tt,children:`⬇ ZIP`}),(0,k.jsx)(`button`,{className:Z.actionBtnIcon,title:`Syntax check`,onClick:Xe,children:`✅`}),(0,k.jsx)(`button`,{className:`${Z.actionBtnIcon} ${F?Z.actionBtnActive:``}`,title:`Grep`,onClick:()=>ye(!F),children:`🔍`}),(0,k.jsx)(`button`,{className:Z.actionBtnIcon,title:`Snapshot`,onClick:qe,children:`💾`})]}),p.some(e=>e._error||e._syntaxError)&&!b&&(0,k.jsx)(`button`,{className:Z.repairBtn,onClick:Ze,children:`🔧 Correggi tutti i file rossi`}),(0,k.jsx)(`button`,{className:Z.sandboxBtn,onClick:()=>i(`preview`),children:`▶ Sandbox`}),ie&&(0,k.jsxs)(`div`,{className:Z.statsBar,children:[(0,k.jsxs)(`span`,{children:[`⏱ `,ie.seconds>=60?`${Math.floor(ie.seconds/60)}m ${ie.seconds%60}s`:`${ie.seconds}s`]}),(0,k.jsxs)(`span`,{children:[`↑ `,ie.tokIn.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`↓ `,ie.tokOut.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`📄 `,ie.files,` file`]})]})]})]}),(0,k.jsxs)(`div`,{className:Z.rightPanel,children:[(0,k.jsxs)(`div`,{className:Z.rightTabBar,children:[(0,k.jsx)(`button`,{className:`${Z.rightTab} ${r===`preview`?``:Z.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,k.jsx)(`button`,{className:`${Z.rightTab} ${r===`preview`?Z.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),b&&(0,k.jsxs)(`div`,{className:Z.repairBar,children:[(0,k.jsxs)(`div`,{className:Z.repairBarRow,children:[(0,k.jsx)(`span`,{className:Z.repairBarIcon,children:`🔧`}),(0,k.jsx)(`span`,{className:Z.repairBarLabel,children:`Auto-fix`}),(0,k.jsx)(`span`,{className:Z.repairBarFile,children:te}),(0,k.jsxs)(`span`,{className:Z.repairBarCounter,children:[S,` / `,w]}),(0,k.jsx)(`span`,{className:Z.repairBarTime,children:Ae}),(0,k.jsx)(`button`,{className:Z.stopBtn,onClick:Ge,children:`⏹ Stop`})]}),(0,k.jsx)(`div`,{className:Z.progressTrack,children:(0,k.jsx)(`div`,{className:Z.repairProgress,style:{width:w>0?`${Math.round(S/w*100)}%`:`0%`}})})]}),v&&(0,k.jsxs)(`div`,{className:Z.genBar,children:[(0,k.jsxs)(`div`,{className:Z.genBarRow,children:[(0,k.jsx)(`span`,{className:Z.genBarRobot,children:`🤖`}),(0,k.jsx)(`span`,{className:Z.genBarLabel,children:`Generazione`}),(0,k.jsx)(`span`,{className:Z.genBarFile,children:T.name.split(`,`)[0].trim()}),(0,k.jsxs)(`span`,{className:Z.genBarCounter,children:[T.fi,` / `,T.total]}),(0,k.jsx)(`span`,{className:Z.genBarTime,children:Oe}),(0,k.jsxs)(`span`,{className:Z.genDots,children:[(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot1}`}),(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot2}`}),(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot3}`})]})]}),(0,k.jsx)(`div`,{className:Z.progressTrack,children:(0,k.jsx)(`div`,{className:Z.genProgress,style:{width:T.total>0?`${Math.round(T.fi/T.total*100)}%`:`0%`}})})]}),r===`preview`?(0,k.jsx)(`div`,{className:Z.sandboxWrap,children:Ee?(0,k.jsx)(`iframe`,{src:`http://127.0.0.1:${Ee}`,className:Z.sandboxFrame,title:`WebCraft Sandbox`,sandbox:`allow-scripts allow-same-origin allow-forms`}):(0,k.jsxs)(`div`,{className:Z.sandboxEmpty,children:[(0,k.jsx)(`span`,{children:`🌐`}),(0,k.jsx)(`span`,{children:e(`webcraft.stopped`)}),(0,k.jsx)(`button`,{className:Z.sandboxStartBtn,onClick:()=>{D(`/api/studio/webcraft/sandbox/start`,{projectName:a}).then(e=>{e?.port&&De(e.port)})},children:`▶ Avvia Sandbox`})]})}):(0,k.jsx)(`div`,{className:Z.codeArea,children:p.length===0?(0,k.jsxs)(`div`,{className:Z.noFiles,children:[(0,k.jsxs)(`div`,{className:Z.noFilesHero,children:[(0,k.jsx)(`span`,{className:Z.noFilesIcon,children:`🔨`}),(0,k.jsx)(`span`,{className:Z.noFilesTitle,children:`WebCraft`}),(0,k.jsx)(`span`,{className:Z.noFilesTagline,children:`Genera progetti web completi con AI`})]}),(0,k.jsxs)(`div`,{className:Z.noFilesSteps,children:[(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`1`}),(0,k.jsx)(`span`,{children:`Scegli un esempio o scrivi una descrizione nel box in basso`})]}),(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`2`}),(0,k.jsxs)(`span`,{children:[`Premi `,(0,k.jsx)(`strong`,{children:`▶ Genera`}),` — l'AI crea tutti i file del progetto`]})]}),(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`3`}),(0,k.jsx)(`span`,{children:`Chiedi modifiche in chat, scarica lo ZIP o avvia il Sandbox`})]})]}),(0,k.jsxs)(`div`,{className:Z.noFilesExamplesHint,children:[`💡 Prova: `,(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[0];o(e.name),c(e.desc),oe(e.desc)},children:`MySaaS`}),(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[1];o(e.name),c(e.desc),oe(e.desc)},children:`MyShop`}),(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[3];o(e.name),c(e.desc),oe(e.desc)},children:`MyPortfolio`})]})]}):(0,k.jsxs)(`div`,{className:Z.codeLayout,children:[(0,k.jsx)(`div`,{className:Z.codeViewer,children:B&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:Z.codeHeader,children:[(0,k.jsx)(`span`,{className:Z.codeFileIcon,children:rn(B.name)}),(0,k.jsx)(`span`,{className:Z.codeFileName,children:B.name}),!B._pending&&!B._error&&(0,k.jsxs)(`span`,{className:Z.codeFileMeta,children:[B.content.split(`
|
|
536
|
+
[Piano approvato — procedi con le modifiche]`,null,[])}function ct(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];ue(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let lt=a&&p.length>0,B=p[h],ut=se||v;return(0,k.jsxs)(`div`,{className:Z.root,children:[(0,k.jsxs)(`div`,{className:Z.header,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:Z.title,children:`⚙ WebCraft`}),(0,k.jsx)(`div`,{className:Z.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,k.jsxs)(`div`,{className:Z.headerTabs,children:[(0,k.jsx)(`button`,{className:`${Z.tabBtn} ${t===`new`?Z.tabActive:``}`,onClick:()=>n(`new`),children:`+ Nuovo`}),(0,k.jsx)(`button`,{className:`${Z.tabBtn} ${t===`projects`?Z.tabActive:``}`,onClick:()=>{n(`projects`),z()},children:`📁 Progetti`})]})]}),(0,k.jsx)(`div`,{className:Z.body,children:t===`projects`?(0,k.jsx)(`div`,{className:Z.projectsList,children:we.length===0?(0,k.jsxs)(`div`,{className:Z.emptyProjects,children:[(0,k.jsx)(`span`,{className:Z.emptyIcon,children:`📁`}),(0,k.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,k.jsx)(`span`,{className:Z.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):we.map(e=>(0,k.jsxs)(`div`,{className:Z.projectCard,children:[(0,k.jsxs)(`div`,{className:Z.projectInfo,children:[(0,k.jsx)(`div`,{className:Z.projectName,children:e.name}),(0,k.jsx)(`div`,{className:Z.projectDesc,children:e.description}),(0,k.jsxs)(`div`,{className:Z.projectMeta,children:[(0,k.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,k.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,k.jsx)(`button`,{className:Z.openBtn,onClick:()=>at(e),children:`↗ Apri`}),(0,k.jsx)(`button`,{className:Z.deleteBtn,onClick:()=>ot(e),children:`🗑`})]},e.name))}):(0,k.jsxs)(`div`,{className:Z.editor,children:[(0,k.jsxs)(`div`,{className:Z.examples,children:[(0,k.jsx)(`div`,{className:Z.sectionLabel,children:`Esempi`}),(0,k.jsx)(`div`,{className:Z.examplePills,children:en.map(e=>(0,k.jsx)(`button`,{className:Z.examplePill,onClick:()=>{o(e.name),c(e.desc),oe(e.desc)},children:e.name},e.name))})]}),(0,k.jsxs)(`div`,{className:Z.editorCols,children:[(0,k.jsxs)(`div`,{className:Z.leftSidebar,children:[(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`Blocchi`}),tn.map(e=>(0,k.jsxs)(`label`,{className:Z.blockLabel,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:l[e.key],onChange:t=>u(n=>({...n,[e.key]:t.target.checked})),className:Z.blockCheck}),(0,k.jsx)(`span`,{children:e.icon}),(0,k.jsx)(`span`,{children:e.label})]},e.key))]}),l.auth&&(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsxs)(`div`,{className:Z.panelHeader,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`Campi Auth`}),(0,k.jsx)(`button`,{className:Z.addBtn,onClick:()=>f(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),d.map((e,t)=>(0,k.jsxs)(`div`,{className:Z.authField,children:[(0,k.jsx)(`input`,{value:e.label,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:Z.authFieldInput}),(0,k.jsx)(`select`,{value:e.type,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:Z.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,required:e.target.checked}:n)),title:`Required`,className:Z.authFieldReq}),(0,k.jsx)(`button`,{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:Z.removeFieldBtn,children:`×`})]},t))]}),(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsxs)(`div`,{className:Z.panelHeader,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`🗂 Contesto AI`}),lt&&(0,k.jsx)(`button`,{className:Z.addBtn,onClick:()=>ge({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),fe.length>0?(0,k.jsx)(`div`,{className:Z.skillsList,children:fe.map((e,t)=>(0,k.jsxs)(`div`,{className:Z.skillRow,children:[(0,k.jsx)(`span`,{className:Z.skillIcon,children:on(e.type)}),(0,k.jsx)(`span`,{className:Z.skillName,title:e.name,children:e.name}),(0,k.jsx)(`span`,{className:`${Z.skillBadge} ${Z[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,k.jsx)(`span`,{className:Z.skillEmpty,children:`⚠`}),(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>ge({mode:e.type===`log`?`view`:`edit`,idx:t,name:e.name,content:e.content,type:e.type,generating:!1}),children:e.type===`log`?`👁`:`✏`}),e.type!==`memory`&&e.type!==`provider`&&e.type!==`log`&&(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>it(t),children:`🗑`}),e.type===`log`&&(0,k.jsx)(`button`,{className:Z.skillBtn,onClick:()=>rt(t),children:`🗑`})]},t))}):(0,k.jsx)(`div`,{className:Z.skillsEmpty,children:lt?`Caricamento...`:`Genera un progetto per attivare i file di contesto.`})]}),_e.length>0&&(0,k.jsxs)(`div`,{className:Z.panel,children:[(0,k.jsx)(`div`,{className:Z.panelTitle,children:`💾 Snapshot`}),_e.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,k.jsxs)(`div`,{className:Z.snapshotRow,children:[(0,k.jsx)(`span`,{className:Z.snapshotTs,children:t}),(0,k.jsxs)(`span`,{className:Z.snapshotCount,children:[e.fileCount,`f`]}),(0,k.jsx)(`button`,{className:Z.snapshotBtn,onClick:()=>Ye(e.ts),children:`↺`})]},e.ts)})]}),v&&(0,k.jsx)(`div`,{className:Z.genStatus,children:`⏳ Generazione...`}),b&&(0,k.jsxs)(`div`,{className:Z.repairStatus,children:[(0,k.jsx)(`div`,{className:Z.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,k.jsxs)(`div`,{className:Z.repairStatusProg,children:[S,` / `,w,` file`]}),(0,k.jsx)(`div`,{className:Z.repairStatusFile,children:te})]}),p.length>0&&!v&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:Z.actionRow,children:[(0,k.jsx)(`button`,{className:Z.actionBtn,onClick:tt,children:`⬇ ZIP`}),(0,k.jsx)(`button`,{className:Z.actionBtnIcon,title:`Syntax check`,onClick:Xe,children:`✅`}),(0,k.jsx)(`button`,{className:`${Z.actionBtnIcon} ${F?Z.actionBtnActive:``}`,title:`Grep`,onClick:()=>ye(!F),children:`🔍`}),(0,k.jsx)(`button`,{className:Z.actionBtnIcon,title:`Snapshot`,onClick:qe,children:`💾`})]}),p.some(e=>e._error||e._syntaxError)&&!b&&(0,k.jsx)(`button`,{className:Z.repairBtn,onClick:Ze,children:`🔧 Correggi tutti i file rossi`}),(0,k.jsx)(`button`,{className:Z.sandboxBtn,onClick:()=>i(`preview`),children:`▶ Sandbox`}),ie&&(0,k.jsxs)(`div`,{className:Z.statsBar,children:[(0,k.jsxs)(`span`,{children:[`⏱ `,ie.seconds>=60?`${Math.floor(ie.seconds/60)}m ${ie.seconds%60}s`:`${ie.seconds}s`]}),(0,k.jsxs)(`span`,{children:[`↑ `,ie.tokIn.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`↓ `,ie.tokOut.toLocaleString(),` tok`]}),(0,k.jsxs)(`span`,{children:[`📄 `,ie.files,` file`]})]})]})]}),(0,k.jsxs)(`div`,{className:Z.rightPanel,children:[(0,k.jsxs)(`div`,{className:Z.rightTabBar,children:[(0,k.jsx)(`button`,{className:`${Z.rightTab} ${r===`preview`?``:Z.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,k.jsx)(`button`,{className:`${Z.rightTab} ${r===`preview`?Z.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),b&&(0,k.jsxs)(`div`,{className:Z.repairBar,children:[(0,k.jsxs)(`div`,{className:Z.repairBarRow,children:[(0,k.jsx)(`span`,{className:Z.repairBarIcon,children:`🔧`}),(0,k.jsx)(`span`,{className:Z.repairBarLabel,children:`Auto-fix`}),(0,k.jsx)(`span`,{className:Z.repairBarFile,children:te}),(0,k.jsxs)(`span`,{className:Z.repairBarCounter,children:[S,` / `,w]}),(0,k.jsx)(`span`,{className:Z.repairBarTime,children:Ae}),(0,k.jsx)(`button`,{className:Z.stopBtn,onClick:Ge,children:`⏹ Stop`})]}),(0,k.jsx)(`div`,{className:Z.progressTrack,children:(0,k.jsx)(`div`,{className:Z.repairProgress,style:{width:w>0?`${Math.round(S/w*100)}%`:`0%`}})})]}),v&&(0,k.jsxs)(`div`,{className:Z.genBar,children:[(0,k.jsxs)(`div`,{className:Z.genBarRow,children:[(0,k.jsx)(`span`,{className:Z.genBarRobot,children:`🤖`}),(0,k.jsx)(`span`,{className:Z.genBarLabel,children:T.total===0?`Pianificazione...`:`Generazione`}),(0,k.jsx)(`span`,{className:Z.genBarFile,children:T.name.split(`,`)[0].trim()}),(0,k.jsx)(`span`,{className:Z.genBarCounter,children:T.total>0?`${T.fi} / ${T.total}`:``}),(0,k.jsx)(`span`,{className:Z.genBarTime,children:Oe}),(0,k.jsxs)(`span`,{className:Z.genDots,children:[(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot1}`}),(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot2}`}),(0,k.jsx)(`span`,{className:`${Z.dot} ${Z.dot3}`})]})]}),(0,k.jsx)(`div`,{className:Z.progressTrack,children:(0,k.jsx)(`div`,{className:Z.genProgress,style:{width:T.total>0?`${Math.round(T.fi/T.total*100)}%`:`0%`}})})]}),r===`preview`?(0,k.jsx)(`div`,{className:Z.sandboxWrap,children:Ee?(0,k.jsx)(`iframe`,{src:`http://127.0.0.1:${Ee}`,className:Z.sandboxFrame,title:`WebCraft Sandbox`,sandbox:`allow-scripts allow-same-origin allow-forms`}):(0,k.jsxs)(`div`,{className:Z.sandboxEmpty,children:[(0,k.jsx)(`span`,{children:`🌐`}),(0,k.jsx)(`span`,{children:e(`webcraft.stopped`)}),(0,k.jsx)(`button`,{className:Z.sandboxStartBtn,onClick:()=>{D(`/api/studio/webcraft/sandbox/start`,{projectName:a}).then(e=>{e?.port&&De(e.port)})},children:`▶ Avvia Sandbox`})]})}):(0,k.jsx)(`div`,{className:Z.codeArea,children:p.length===0?(0,k.jsxs)(`div`,{className:Z.noFiles,children:[(0,k.jsxs)(`div`,{className:Z.noFilesHero,children:[(0,k.jsx)(`span`,{className:Z.noFilesIcon,children:`🔨`}),(0,k.jsx)(`span`,{className:Z.noFilesTitle,children:`WebCraft`}),(0,k.jsx)(`span`,{className:Z.noFilesTagline,children:`Genera progetti web completi con AI`})]}),(0,k.jsxs)(`div`,{className:Z.noFilesSteps,children:[(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`1`}),(0,k.jsx)(`span`,{children:`Scegli un esempio o scrivi una descrizione nel box in basso`})]}),(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`2`}),(0,k.jsxs)(`span`,{children:[`Premi `,(0,k.jsx)(`strong`,{children:`▶ Genera`}),` — l'AI crea tutti i file del progetto`]})]}),(0,k.jsxs)(`div`,{className:Z.noFilesStep,children:[(0,k.jsx)(`span`,{className:Z.noFilesStepNum,children:`3`}),(0,k.jsx)(`span`,{children:`Chiedi modifiche in chat, scarica lo ZIP o avvia il Sandbox`})]})]}),(0,k.jsxs)(`div`,{className:Z.noFilesExamplesHint,children:[`💡 Prova: `,(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[0];o(e.name),c(e.desc),oe(e.desc)},children:`MySaaS`}),(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[1];o(e.name),c(e.desc),oe(e.desc)},children:`MyShop`}),(0,k.jsx)(`button`,{className:Z.noFilesExampleBtn,onClick:()=>{let e=en[3];o(e.name),c(e.desc),oe(e.desc)},children:`MyPortfolio`})]})]}):(0,k.jsxs)(`div`,{className:Z.codeLayout,children:[(0,k.jsx)(`div`,{className:Z.codeViewer,children:B&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:Z.codeHeader,children:[(0,k.jsx)(`span`,{className:Z.codeFileIcon,children:rn(B.name)}),(0,k.jsx)(`span`,{className:Z.codeFileName,children:B.name}),!B._pending&&!B._error&&(0,k.jsxs)(`span`,{className:Z.codeFileMeta,children:[B.content.split(`
|
|
537
537
|
`).length,` righe · `,an(B.content)]})]}),B._error&&(0,k.jsx)(`div`,{className:Z.fileError,children:`⚠ Generazione fallita — chiedi al modello di rigenerare questo file`}),B._syntaxError&&!B._error&&(0,k.jsxs)(`div`,{className:Z.fileSyntaxError,children:[`⚠ Syntax error: `,B._syntaxError]}),B._pending?(0,k.jsx)(`div`,{className:Z.filePending,children:`⌛ In generazione...`}):(0,k.jsx)(`pre`,{className:`${Z.code} ${B._error?Z.codeError:B._syntaxError?Z.codeSyntaxError:``}`,children:B.content})]})}),(0,k.jsxs)(`div`,{className:Z.fileSidebar,children:[(0,k.jsxs)(`div`,{className:Z.fileSidebarHeader,children:[p.length,` file`]}),p.map((e,t)=>{let n=e._error||!!e._syntaxError,r=t===h;return(0,k.jsxs)(`button`,{className:`${Z.fileTab} ${r?Z.fileTabActive:``} ${n?Z.fileTabError:``}`,onClick:()=>g(t),children:[(0,k.jsxs)(`div`,{className:Z.fileTabRow,children:[(0,k.jsx)(`span`,{className:Z.fileTabIcon,children:e._pending?`⌛`:n?`⚠`:rn(e.name)}),(0,k.jsx)(`span`,{className:Z.fileTabName,children:e.name.split(`/`).pop()})]}),e.name.includes(`/`)&&(0,k.jsx)(`div`,{className:Z.fileTabDir,children:e.name.split(`/`).slice(0,-1).join(`/`)}),!e._pending&&(0,k.jsxs)(`div`,{className:Z.fileTabMeta,children:[e.content.split(`
|
|
538
538
|
`).length,` righe · `,an(e.content)]})]},t)})]})]})})]})]})]})}),N&&t!==`projects`&&(0,k.jsxs)(`div`,{className:Z.planBanner,children:[(0,k.jsx)(`div`,{className:Z.planTitle,children:`📌 Piano proposto — approva per eseguire`}),(0,k.jsx)(`pre`,{className:Z.planText,children:N.plan}),(0,k.jsxs)(`div`,{className:Z.planActions,children:[(0,k.jsx)(`button`,{className:Z.planApprove,onClick:st,children:`✓ Esegui`}),(0,k.jsx)(`button`,{className:Z.planReject,onClick:()=>de(null),children:`✕ Annulla`})]})]}),F&&t!==`projects`&&(0,k.jsxs)(`div`,{className:Z.grepPanel,children:[(0,k.jsxs)(`div`,{className:Z.grepRow,children:[(0,k.jsx)(`input`,{className:Z.grepInput,value:be,onChange:e=>xe(e.target.value),onKeyDown:e=>e.key===`Enter`&&$e(),placeholder:`Cerca nel codice...`}),(0,k.jsx)(`button`,{className:Z.grepBtn,onClick:$e,children:`🔍`}),(0,k.jsx)(`button`,{className:Z.grepClose,onClick:()=>ye(!1),children:`×`})]}),I.length>0&&(0,k.jsxs)(`div`,{className:Z.grepCount,children:[I.length,` risultati`]}),(0,k.jsx)(`div`,{className:Z.grepResults,children:I.length===0?(0,k.jsx)(`div`,{className:Z.grepEmpty,children:`Nessun risultato.`}):I.map((e,t)=>(0,k.jsxs)(`div`,{className:Z.grepMatch,onClick:()=>et(e.file),children:[(0,k.jsxs)(`span`,{className:Z.grepMatchFile,children:[e.file,`:`,e.lineNum]}),(0,k.jsx)(`pre`,{className:Z.grepMatchLine,children:e.line})]},t))})]}),Se.length>0&&t!==`projects`&&(0,k.jsxs)(`div`,{className:Z.diffPanel,children:[(0,k.jsxs)(`div`,{className:Z.diffHeader,children:[(0,k.jsxs)(`span`,{children:[`🔌 Diff — `,Se.length,` file modificati`]}),(0,k.jsx)(`button`,{className:Z.diffClose,onClick:()=>Ce([]),children:`✕ Chiudi`})]}),Se.map((e,t)=>{let n=e.after.split(`
|
|
539
539
|
`).length-e.before.split(`
|
package/src/ui-dist/index.html
CHANGED
|
@@ -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-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-0A39dq-W.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-6pTX3Jyj.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|