nothumanallowed 14.3.0 → 14.3.2

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.3.0",
3
+ "version": "14.3.2",
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.3.0';
8
+ export const VERSION = '14.3.2';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -1172,6 +1172,10 @@ Continue from here:`;
1172
1172
  }
1173
1173
 
1174
1174
  // ── Post-generation integrity check ──────────────────────────────────────
1175
+ if (abortSignal?.aborted) {
1176
+ emit({ type: 'done', tokIn: totalTokensIn, tokOut: totalTokensOut });
1177
+ return;
1178
+ }
1175
1179
  const brokenFiles = generatedFiles.filter((f) => {
1176
1180
  if (!f.content || f.content.length < 20) return true;
1177
1181
  if (f.name.endsWith('.html') && !f.content.includes('</html>')) return true;
@@ -716,19 +716,19 @@ FRONTEND:
716
716
  - index.html: Job board homepage — (1) Hero: gradient background, large search widget (keyword input + location input + category select + Search button), quick stats bar (12,847 Jobs / 3,420 Companies / 45K Candidates). (2) Featured jobs: horizontal scroll row of 4 "Featured" cards with company logo (colored emoji), job title, company name, location + type badge + salary range + "Easy Apply" button. (3) Main layout: left sidebar filters (Job Type checkboxes, Salary Range slider, Category checkboxes, Location input, Posted Within select, Remote Only toggle) + right: jobs list (job row cards with company logo/title/company/location/type/salary/time-ago posted/Save bookmark/Apply button). (4) "Load More" button + results count "Showing 12 of 247 jobs". (5) Top companies section: 8 company cards with logo/name/industry/openings count. (6) Category browsing: 6 category cards with icon/name/count/link. (7) Job seeker CTA banner. (8) Newsletter.
717
717
  - job.html: Job detail page — company header (logo + name + industry + website + size + "Follow" button), job title + badges (Remote, Senior, Urgent), salary + location + posted date, Apply Now button (sticky on scroll), job description (markdown-rendered sections: About/Responsibilities/Requirements/Nice-to-Have/Benefits), company sidebar card (description + stats), similar jobs list (4 cards)
718
718
  - apply.html: Application modal/page — job summary header, form (Full Name / Email / Phone / LinkedIn URL / Portfolio URL / Cover Letter textarea with character count / Resume paste textarea), Submit button with loading state, success page with application reference number
719
- - public/css/main.css: Modern job board design — tag/badge system (Remote=blue, Onsite=green, Urgent=red), salary range display, company logo placeholder styles, filter sidebar collapse on mobile, job card hover effects, application form validation styles`}],FT=[{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:`✉️`}],IT={js:`📄`,ts:`📄`,css:`🎨`,html:`🌐`,json:`📋`,md:`📑`,sql:`🗂`,env:`🔐`,conf:`⚙`,lock:`🔒`};function LT(e){return IT[e.split(`.`).pop()?.toLowerCase()??``]??`📄`}function RT(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 zT(e){return e===`memory`?`🧠`:e===`provider`?`🤖`:e===`log`?`📄`:`📋`}function BT(){let e=j(),[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)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(new Set),[w,ee]=(0,_.useState)(!1),[te,ne]=(0,_.useState)(``),[re,ie]=(0,_.useState)(``),[ae,D]=(0,_.useState)(!1),[oe,k]=(0,_.useState)([]),[A,se]=(0,_.useState)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),[de,fe]=(0,_.useState)(null),[pe,me]=(0,_.useState)(!1),[he,ge]=(0,_.useState)(!1),[_e,ve]=(0,_.useState)(0),[ye,be]=(0,_.useState)(0),[xe,Se]=(0,_.useState)(``),[Ce,M]=(0,_.useState)({fi:0,total:0,name:``}),[we,Te]=(0,_.useState)({tokIn:0,tokOut:0}),[Ee,De]=(0,_.useState)(null),[N,Oe]=(0,_.useState)([]),[ke,Ae]=(0,_.useState)(``),[P,F]=(0,_.useState)(!1),[je,Me]=(0,_.useState)([]),[Ne,Pe]=(0,_.useState)(null),[Fe,Ie]=(0,_.useState)([]),[Le,Re]=(0,_.useState)(!1),[ze,Be]=(0,_.useState)(null),[I,Ve]=(0,_.useState)([]),[He,Ue]=(0,_.useState)(!1),[We,Ge]=(0,_.useState)(``),[Ke,qe]=(0,_.useState)([]),[Je,Ye]=(0,_.useState)([]),[Xe,Ze]=(0,_.useState)([]),[Qe,$e]=(0,_.useState)(null),[et,tt]=(0,_.useState)(!1),[nt,rt]=(0,_.useState)([]),[it,at]=(0,_.useState)(null),[ot,st]=(0,_.useState)(!0),ct=(0,_.useRef)(null),[lt,ut]=(0,_.useState)(`0s`),[dt,ft]=(0,_.useState)(`0s`),pt=(0,_.useRef)(0),L=(0,_.useRef)(0),mt=(0,_.useRef)(null),ht=(0,_.useRef)(null),gt=(0,_.useRef)(null),_t=(0,_.useRef)(null),vt=(0,_.useRef)(null),yt=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),ee(e=>!e)),(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),b!==null&&p[h])){let e=p[h];m(e=>e.map((e,t)=>t===h?{...e,content:b}:e)),E(`/api/studio/webcraft/file/write`,{projectName:a,path:e.name,content:b}),x(null),C(t=>{let n=new Set(t);return n.delete(e.name),n})}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,h,p,a]),(0,_.useEffect)(()=>{let e=()=>{let e=b===null?le.current:ce.current;e&&ue.current&&(ue.current.scrollTop=e.scrollTop)},t=b===null?le.current:ce.current;return t&&t.addEventListener(`scroll`,e),()=>{t&&t.removeEventListener(`scroll`,e)}},[b,h]);function bt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){let t=Math.floor((Date.now()-e)/1e3),n=Math.floor(t/60);return(n>0?`${n}m `:``)+`${t%60}s`}(0,_.useEffect)(()=>(pe||he?mt.current=setInterval(()=>{pe&&ut(R(pt.current)),he&&ft(R(L.current))},1e3):mt.current&&=(clearInterval(mt.current),null),()=>{mt.current&&clearInterval(mt.current)}),[pe,he]);function xt(){gt.current&&(gt.current.scrollTop=gt.current.scrollHeight)}(0,_.useEffect)(()=>{xt()},[N]),(0,_.useEffect)(()=>{a&&!Le&&(Re(!0),T(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`).then(e=>{e?.skills&&Ie(e.skills)}).catch(()=>{}))},[a,Le]);async function St(e,t){if(pe||!e||e.length<5)return;me(!0),m([]),g(0),y(null),M({fi:0,total:0,name:``}),Te({tokIn:0,tokOut:0}),pt.current=Date.now(),ut(`0s`),ht.current=new AbortController;let n=Date.now();try{let r=await fetch(`/api/studio/webcraft/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:ht.current.signal,body:JSON.stringify({projectName:t,description:e,blocks:l,authFields:d})});if(!r.ok||!r.body){me(!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(`
719
+ - public/css/main.css: Modern job board design — tag/badge system (Remote=blue, Onsite=green, Urgent=red), salary range display, company logo placeholder styles, filter sidebar collapse on mobile, job card hover effects, application form validation styles`}],FT=[{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:`✉️`}],IT={js:`📄`,ts:`📄`,css:`🎨`,html:`🌐`,json:`📋`,md:`📑`,sql:`🗂`,env:`🔐`,conf:`⚙`,lock:`🔒`};function LT(e){return IT[e.split(`.`).pop()?.toLowerCase()??``]??`📄`}function RT(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 zT(e){return e===`memory`?`🧠`:e===`provider`?`🤖`:e===`log`?`📄`:`📋`}function BT(){let e=j(),[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)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(new Set),[w,ee]=(0,_.useState)(!1),[te,ne]=(0,_.useState)(``),[re,ie]=(0,_.useState)(``),[ae,D]=(0,_.useState)(!1),[oe,k]=(0,_.useState)([]),[A,se]=(0,_.useState)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),[de,fe]=(0,_.useState)(null),[pe,me]=(0,_.useState)(!1),[he,ge]=(0,_.useState)(!1),[_e,ve]=(0,_.useState)(0),[ye,be]=(0,_.useState)(0),[xe,Se]=(0,_.useState)(``),[Ce,M]=(0,_.useState)({fi:0,total:0,name:``}),[we,Te]=(0,_.useState)({tokIn:0,tokOut:0}),[Ee,De]=(0,_.useState)(null),[N,Oe]=(0,_.useState)([]),[ke,Ae]=(0,_.useState)(``),[P,F]=(0,_.useState)(!1),[je,Me]=(0,_.useState)([]),[Ne,Pe]=(0,_.useState)(null),[Fe,Ie]=(0,_.useState)([]),[Le,Re]=(0,_.useState)(!1),[ze,Be]=(0,_.useState)(null),[I,Ve]=(0,_.useState)([]),[He,Ue]=(0,_.useState)(!1),[We,Ge]=(0,_.useState)(``),[Ke,qe]=(0,_.useState)([]),[Je,Ye]=(0,_.useState)([]),[Xe,Ze]=(0,_.useState)([]),[Qe,$e]=(0,_.useState)(null),[et,tt]=(0,_.useState)(!1),[nt,rt]=(0,_.useState)([]),[it,at]=(0,_.useState)(null),[ot,st]=(0,_.useState)(!0),ct=(0,_.useRef)(null),[lt,ut]=(0,_.useState)(`0s`),[dt,ft]=(0,_.useState)(`0s`),pt=(0,_.useRef)(0),L=(0,_.useRef)(0),mt=(0,_.useRef)(null),ht=(0,_.useRef)(null),gt=(0,_.useRef)(null),_t=(0,_.useRef)(null),vt=(0,_.useRef)(null),yt=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),ee(e=>!e)),(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),b!==null&&p[h])){let e=p[h];m(e=>e.map((e,t)=>t===h?{...e,content:b}:e)),E(`/api/studio/webcraft/file/write`,{projectName:a,path:e.name,content:b}),x(null),C(t=>{let n=new Set(t);return n.delete(e.name),n})}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,h,p,a]),(0,_.useEffect)(()=>{let e=()=>{let e=b===null?le.current:ce.current;e&&ue.current&&(ue.current.scrollTop=e.scrollTop)},t=b===null?le.current:ce.current;return t&&t.addEventListener(`scroll`,e),()=>{t&&t.removeEventListener(`scroll`,e)}},[b,h]);function bt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){let t=Math.floor((Date.now()-e)/1e3),n=Math.floor(t/60);return(n>0?`${n}m `:``)+`${t%60}s`}(0,_.useEffect)(()=>(pe||he?mt.current=setInterval(()=>{pe&&ut(R(pt.current)),he&&ft(R(L.current))},1e3):mt.current&&=(clearInterval(mt.current),null),()=>{mt.current&&clearInterval(mt.current)}),[pe,he]);function xt(){gt.current&&(gt.current.scrollTop=gt.current.scrollHeight)}(0,_.useEffect)(()=>{xt()},[N]),(0,_.useEffect)(()=>{a&&!Le&&(Re(!0),T(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`).then(e=>{e?.skills&&Ie(e.skills)}).catch(()=>{}))},[a,Le]);async function St(e,t){if(pe||!e||e.length<5)return;me(!0),m([]),g(0),y(null),M({fi:0,total:0,name:``}),Te({tokIn:0,tokOut:0}),pt.current=Date.now(),ut(`0s`),ht.current=new AbortController;let n=Date.now();try{let r=await fetch(`/api/studio/webcraft/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:ht.current.signal,body:JSON.stringify({projectName:t,description:e,blocks:l,authFields:d})});if(!r.ok||!r.body){me(!1);return}let i=r.body.getReader(),a=ht.current,o=new TextDecoder,s=``,c=[];for(;;){if(a?.signal?.aborted){try{i.cancel()}catch{}break}let{done:e,value:t}=await i.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.split(`
720
720
 
721
- `);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`)M(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]),M({fi:e.fi,total:e.total,name:e.name}),g(s.length-1),y(``);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]),y(t?t.content:null)}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]),M({fi:e.fi,total:e.total,name:e.name}),(e.cumTokIn||e.cumTokOut)&&Te({tokIn:e.cumTokIn||0,tokOut:e.cumTokOut||0})}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===`phase`||e.type===`status`&&!e.op?M(t=>({...t,name:e.msg||e.phase||``})):e.type===`done`&&(De({seconds:Math.round((Date.now()-n)/1e3),tokIn:e.tokIn??0,tokOut:e.tokOut??0,files:s.length}),y(null),me(!1),Re(!1),Ie([]),s.some(e=>e._error||e._syntaxError)?setTimeout(()=>vt.current?.(),800):setTimeout(()=>yt.current?.(),800))}catch{}}}}catch(e){e.name!==`AbortError`&&Oe(t=>[...t,{role:`system`,text:`Errore generazione: `+e.message}]),me(!1)}}async function Ct(){let e=ke.trim();if(!(a&&p.length>0)){if(!e||e.length<5)return;let t=a||`MyProject`;o(t),c(e),Ae(``),await St(e,t);return}if(!e&&je.length===0||P||pe)return;let t=[...je];if(Me([]),Ae(``),e.toLowerCase().startsWith(`/plan `)||e.toLowerCase().startsWith(`piano: `)){let t=e.replace(/^\/plan[ ]*/i,``).replace(/^piano:[ ]*/i,``);Oe(t=>[...t,{role:`user`,text:e}]),await wt(`[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}Oe(n=>[...n,{role:`user`,text:e,attachments:t}]),await wt(e,null,t)}async function wt(e,t,n){if(P)return;F(!0),a&&p.length>0&&E(`/api/studio/webcraft/snapshot`,{projectName:a}).catch(()=>{});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){Oe(e=>[...e,{role:`agent`,text:`Errore: ${i.status}`,tools:[]}]),F(!1);return}let o={role:`agent`,text:``,tools:[]};Oe(e=>[...e,o]);let s=i.body.getReader(),c=new TextDecoder,l=``,u=!1,d=``;for(;;){let{done:e,value:n}=await s.read();if(e)break;l+=c.decode(n,{stream:!0});let i=l.split(`
721
+ `);s=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`)M(t=>({...t,name:e.type===`planning`?`📋 Pianificazione struttura...`:e.msg||`Avvio...`}));else if(e.type===`file_start`)c.push({name:e.name,content:``,_pending:!0}),m([...c]),M({fi:e.fi,total:e.total,name:e.name}),g(c.length-1),y(``);else if(e.type===`file_chunk`){let t=c.find(t=>t.name===e.name);t&&(t.content+=e.chunk,t._pending=!1),m([...c]),y(t?t.content:null)}else if(e.type===`file_done`){let t=c.find(t=>t.name===e.name);t&&(t._pending=!1,e.syntaxError&&(t._syntaxError=e.syntaxError)),m([...c]),M({fi:e.fi,total:e.total,name:e.name}),(e.cumTokIn||e.cumTokOut)&&Te({tokIn:e.cumTokIn||0,tokOut:e.cumTokOut||0})}else if(e.type===`file_error`){let t=c.find(t=>t.name===e.name);t&&(t._error=!0,t._pending=!1),m([...c])}else e.type===`phase`||e.type===`status`&&!e.op?M(t=>({...t,name:e.msg||e.phase||``})):e.type===`done`&&(De({seconds:Math.round((Date.now()-n)/1e3),tokIn:e.tokIn??0,tokOut:e.tokOut??0,files:c.length}),y(null),me(!1),Re(!1),Ie([]),c.some(e=>e._error||e._syntaxError)?setTimeout(()=>vt.current?.(),800):setTimeout(()=>yt.current?.(),800))}catch{}}}}catch(e){e.name!==`AbortError`&&Oe(t=>[...t,{role:`system`,text:`Errore generazione: `+e.message}]),me(!1)}}async function Ct(){let e=ke.trim();if(!(a&&p.length>0)){if(!e||e.length<5)return;let t=a||`MyProject`;o(t),c(e),Ae(``),await St(e,t);return}if(!e&&je.length===0||P||pe)return;let t=[...je];if(Me([]),Ae(``),e.toLowerCase().startsWith(`/plan `)||e.toLowerCase().startsWith(`piano: `)){let t=e.replace(/^\/plan[ ]*/i,``).replace(/^piano:[ ]*/i,``);Oe(t=>[...t,{role:`user`,text:e}]),await wt(`[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}Oe(n=>[...n,{role:`user`,text:e,attachments:t}]),await wt(e,null,t)}async function wt(e,t,n){if(P)return;F(!0),a&&p.length>0&&E(`/api/studio/webcraft/snapshot`,{projectName:a}).catch(()=>{});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){Oe(e=>[...e,{role:`agent`,text:`Errore: ${i.status}`,tools:[]}]),F(!1);return}let o={role:`agent`,text:``,tools:[]};Oe(e=>[...e,o]);let s=i.body.getReader(),c=new TextDecoder,l=``,u=!1,d=``;for(;;){let{done:e,value:n}=await s.read();if(e)break;l+=c.decode(n,{stream:!0});let i=l.split(`
722
722
 
723
723
  `);l=i.pop()??``;for(let e of i){let n=e.replace(/^data: /,``).trim();if(n)try{let e=JSON.parse(n);if(e.type===`text`){d+=e.token;let t=d.lastIndexOf(`<`),n;t>=0&&!d.slice(t).includes(`>`)?(n=d.slice(0,t),d=d.slice(t)):(n=d.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/>/g,``),d=``),n&&(o.text+=n,Oe(e=>{let t=[...e];return t[t.length-1]={...o},t}))}else if(e.type===`step`)o.text+=`\n\n**[Step ${e.step}/${e.max}]** `,Oe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(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`||e.result===`ok_repaired`)&&(u=!0),Oe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`files_changed`)e.files?.length&&await Tt(e.files,r);else if(e.type===`syntax_errors`)e.errors?.length&&(o.syntaxErrors=e.errors,Oe(e=>{let t=[...e];return t[t.length-1]={...o},t}));else if(e.type===`sandbox_restart`)o.text+=`
724
724
 
725
725
  🔄 `+(e.msg||`Restarting sandbox...`),k(t=>[...t,`[sandbox] ${e.msg||`Restarting...`}`]),Oe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`sandbox_ready`)$e(e.port),o.text+=`
726
726
  ✅ Sandbox ready on port `+e.port,Oe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`sandbox_error`)o.text+=`
727
727
  ❌ Sandbox error: `+e.msg,Oe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`done`){if(d){let e=d.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/>/g,``);e&&(o.text+=e),d=``}t&&!u&&Pe({plan:o.text,originalMessage:t}),F(!1),e.changed&&await Tt((o.tools??[]).filter(e=>e.op===`edit`||e.op===`write`).map(e=>e.path),r)}else e.type===`error`&&(o.text+=`
728
- Errore: `+e.msg,F(!1))}catch{}}}}catch(e){Oe(t=>[...t,{role:`agent`,text:`Errore di rete: `+e.message,tools:[]}])}F(!1)}async function Tt(e,t){if(!a)return;let n=await T(`/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);Ye(e=>[...e,...r])}}function z(){ht.current&&=(ht.current.abort(),null),me(!1),F(!1),Oe(e=>[...e,{role:`system`,text:`⏹ Generazione interrotta.`}])}async function Et(){return a?(await E(`/api/studio/webcraft/snapshot`,{projectName:a}))?.snapshot??null:null}async function Dt(){let e=await Et();e&&(Oe(t=>[...t,{role:`system`,text:`💾 Snapshot salvato (${e.slice(0,16).replace(`T`,` `)})`}]),Ot())}async function Ot(){if(!a)return;let e=await T(`/api/studio/webcraft/snapshots/${encodeURIComponent(a)}`);e?.snapshots&&Ve(e.snapshots)}async function kt(e){confirm(`Ripristinare lo snapshot del ${e.replace(`T`,` `).slice(0,16)}? I file attuali verranno sovrascritti.`)&&await E(`/api/studio/webcraft/restore`,{projectName:a,ts:e})!==null&&(Oe(t=>[...t,{role:`agent`,text:`Snapshot ripristinato (${e}). Ricarico i file...`}]),Tt([],{}))}async function At(){if(!a)return;let e=await E(`/api/studio/webcraft/syntax-check`,{projectName:a});if(e?.results){let t=e.results.filter(e=>!e.ok);t.length>0?Oe(e=>[...e,{role:`system`,text:`⚠ Syntax check: ${t.length} errore/i trovato/i.`,syntaxErrors:t}]):Oe(e=>[...e,{role:`system`,text:`✓ Syntax check: tutti i file JS sono validi.`}])}}async function jt(){let e=p.filter(e=>e._error||e._syntaxError);if(e.length===0){yt.current?.();return}ge(!0),ve(0),be(e.length),L.current=Date.now(),ft(`0s`);for(let t=0;t<e.length;t++){let n=e[t];Se(n.name),ve(t),await wt(`REPAIR FILE: ${n.name}\nErrore: ${n._syntaxError??`generazione fallita`}\nRigenera il file correttamente. Output SOLO il contenuto del file, nessuna spiegazione.`,null,[])}ve(e.length),Se(``),ge(!1),setTimeout(()=>yt.current?.(),500)}let Mt={cleanup:`🧹`,shims:`🔌`,deps:`📦`,start:`🚀`,autofix:`🔧`,ready:`✅`};function Nt(e,t=`info`){let n=new Date().toLocaleTimeString();rt(r=>[...r,`${t===`phase`?`
728
+ Errore: `+e.msg,F(!1))}catch{}}}}catch(e){Oe(t=>[...t,{role:`agent`,text:`Errore di rete: `+e.message,tools:[]}])}F(!1)}async function Tt(e,t){if(!a)return;let n=await T(`/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);Ye(e=>[...e,...r])}}function z(){ht.current&&=(ht.current.abort(),null),me(!1),F(!1),y(null),Oe(e=>[...e,{role:`system`,text:`⏹ Generazione interrotta.`}])}async function Et(){return a?(await E(`/api/studio/webcraft/snapshot`,{projectName:a}))?.snapshot??null:null}async function Dt(){let e=await Et();e&&(Oe(t=>[...t,{role:`system`,text:`💾 Snapshot salvato (${e.slice(0,16).replace(`T`,` `)})`}]),Ot())}async function Ot(){if(!a)return;let e=await T(`/api/studio/webcraft/snapshots/${encodeURIComponent(a)}`);e?.snapshots&&Ve(e.snapshots)}async function kt(e){confirm(`Ripristinare lo snapshot del ${e.replace(`T`,` `).slice(0,16)}? I file attuali verranno sovrascritti.`)&&await E(`/api/studio/webcraft/restore`,{projectName:a,ts:e})!==null&&(Oe(t=>[...t,{role:`agent`,text:`Snapshot ripristinato (${e}). Ricarico i file...`}]),Tt([],{}))}async function At(){if(!a)return;let e=await E(`/api/studio/webcraft/syntax-check`,{projectName:a});if(e?.results){let t=e.results.filter(e=>!e.ok);t.length>0?Oe(e=>[...e,{role:`system`,text:`⚠ Syntax check: ${t.length} errore/i trovato/i.`,syntaxErrors:t}]):Oe(e=>[...e,{role:`system`,text:`✓ Syntax check: tutti i file JS sono validi.`}])}}async function jt(){let e=p.filter(e=>e._error||e._syntaxError);if(e.length===0){yt.current?.();return}ge(!0),ve(0),be(e.length),L.current=Date.now(),ft(`0s`);for(let t=0;t<e.length;t++){let n=e[t];Se(n.name),ve(t),await wt(`REPAIR FILE: ${n.name}\nErrore: ${n._syntaxError??`generazione fallita`}\nRigenera il file correttamente. Output SOLO il contenuto del file, nessuna spiegazione.`,null,[])}ve(e.length),Se(``),ge(!1),setTimeout(()=>yt.current?.(),500)}let Mt={cleanup:`🧹`,shims:`🔌`,deps:`📦`,start:`🚀`,autofix:`🔧`,ready:`✅`};function Nt(e,t=`info`){let n=new Date().toLocaleTimeString();rt(r=>[...r,`${t===`phase`?`
729
729
  `:``}[${n}] ${e}`]),setTimeout(()=>{ct.current?.scrollTo(0,ct.current.scrollHeight)},50)}async function Pt(e){if(!et){tt(!0),at(null),$e(null),rt([]),st(!0),i(`preview`);try{let t=await fetch(`/api/studio/webcraft/sandbox/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:e})});if(!t.ok||!t.body){let e=t.ok?`No response body`:`HTTP ${t.status}`;Nt(`ERROR: ${e}`,`error`),at(e),tt(!1);return}let n=t.body.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,{stream:!0});let a=i.split(`
730
730
 
731
- `);i=a.pop()??``;for(let e of a){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);e.type===`phase`?Nt(`${Mt[e.phase]||`▸`} ${e.msg}`,`phase`):e.type===`ready`&&e.port?(Nt(`✅ Server ready on port ${e.port}`,`ok`),$e(e.port),tt(!1),setTimeout(()=>st(!1),1500)):e.type===`status`?Nt(` ${e.msg||`Processing...`}`,`info`):e.type===`log`?Nt(` ${e.msg||``}`,`log`):e.type===`warn`?Nt(`⚠ ${e.msg}`,`warn`):e.type===`error`?(Nt(`❌ ${e.msg}`,`error`),at(e.msg)):e.type===`exit`&&e.code!==0&&Nt(`💥 Process crashed (exit code ${e.code})`,`error`)}catch{}}}}catch(e){let t=e.message||`Connection failed`;Nt(`❌ ${t}`,`error`),at(t)}tt(!1)}}async function B(){a&&await Pt(a)}(0,_.useEffect)(()=>{vt.current=jt,yt.current=B});async function Ft(){if(!We||!a)return;let e=await E(`/api/studio/webcraft/grep`,{projectName:a,query:We});e?.matches&&qe(e.matches)}function It(e){let t=p.findIndex(t=>t.name===e);t>=0&&(g(t),i(`files`))}function Lt(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(a)}`,`_blank`)}async function Rt(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},s;s=e.mode===`edit`&&e.idx!==null?Fe.map((t,n)=>n===e.idx?i:t):[...Fe,i],Ie(s),Be(null);let c=a||`MyProject`;a||o(c),await E(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`,{skills:s})}async function zt(e){let t=Fe[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await E(`/api/studio/webcraft/skills/${encodeURIComponent(a)}/delete`,{name:t.name}),Ie(Fe.filter((t,n)=>n!==e)))}async function Bt(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);Ie(n),await E(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:n})}async function Vt(){let e=await T(`/api/studio/webcraft/projects`);e?.projects&&Ze(e.projects)}async function V(e){let t=await T(`/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`),Oe([]),Ie([]),Re(!1);let r=await T(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(t.projectName??e.name)}`);r?.chat&&Oe(r.chat);let a=await T(`/api/studio/webcraft/skills/${encodeURIComponent(t.projectName??e.name)}`);a?.skills&&(Ie(a.skills),Re(!0))}async function Ht(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await E(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),Ze(Xe.filter(t=>t.name!==e.name)),a===e.name&&(o(``),m([]),Oe([]),c(``)))}async function Ut(){if(!Ne)return;let e=Ne.originalMessage;Pe(null),await wt(e+`
731
+ `);i=a.pop()??``;for(let e of a){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);if(e.type===`phase`){let t=Mt[e.phase]||`▸`;Nt(`${t} ${e.msg}`,`phase`),k(n=>[...n,`${t} ${e.msg}`]),D(!0)}else e.type===`ready`&&e.port?(Nt(`✅ Server ready on port ${e.port}`,`ok`),$e(e.port),tt(!1),k(t=>[...t,`\x1b[32m✓ Server ready on port ${e.port}\x1b[0m`]),setTimeout(()=>st(!1),1500)):e.type===`status`?(Nt(` ${e.msg||`Processing...`}`,`info`),k(t=>[...t,e.msg||``])):e.type===`log`?(Nt(` ${e.msg||``}`,`log`),k(t=>[...t,e.msg||``])):e.type===`warn`?Nt(`⚠ ${e.msg}`,`warn`):e.type===`error`?(Nt(`❌ ${e.msg}`,`error`),at(e.msg)):e.type===`exit`&&e.code!==0&&Nt(`💥 Process crashed (exit code ${e.code})`,`error`)}catch{}}}}catch(e){let t=e.message||`Connection failed`;Nt(`❌ ${t}`,`error`),at(t)}tt(!1)}}async function B(){a&&await Pt(a)}(0,_.useEffect)(()=>{vt.current=jt,yt.current=B});async function Ft(){if(!We||!a)return;let e=await E(`/api/studio/webcraft/grep`,{projectName:a,query:We});e?.matches&&qe(e.matches)}function It(e){let t=p.findIndex(t=>t.name===e);t>=0&&(g(t),i(`files`))}function Lt(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(a)}`,`_blank`)}async function Rt(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},s;s=e.mode===`edit`&&e.idx!==null?Fe.map((t,n)=>n===e.idx?i:t):[...Fe,i],Ie(s),Be(null);let c=a||`MyProject`;a||o(c),await E(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`,{skills:s})}async function zt(e){let t=Fe[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await E(`/api/studio/webcraft/skills/${encodeURIComponent(a)}/delete`,{name:t.name}),Ie(Fe.filter((t,n)=>n!==e)))}async function Bt(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);Ie(n),await E(`/api/studio/webcraft/skills/${encodeURIComponent(a)}`,{skills:n})}async function Vt(){let e=await T(`/api/studio/webcraft/projects`);e?.projects&&Ze(e.projects)}async function V(e){let t=await T(`/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`),Oe([]),Ie([]),Re(!1);let r=await T(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(t.projectName??e.name)}`);r?.chat&&Oe(r.chat);let a=await T(`/api/studio/webcraft/skills/${encodeURIComponent(t.projectName??e.name)}`);a?.skills&&(Ie(a.skills),Re(!0))}async function Ht(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await E(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),Ze(Xe.filter(t=>t.name!==e.name)),a===e.name&&(o(``),m([]),Oe([]),c(``)))}async function Ut(){if(!Ne)return;let e=Ne.originalMessage;Pe(null),await wt(e+`
732
732
  [Piano approvato — procedi con le modifiche]`,null,[])}function Wt(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];Me(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let Gt=a&&p.length>0,Kt=p[h],H=P||pe;return(0,O.jsxs)(`div`,{className:Q.root,children:[(0,O.jsxs)(`div`,{className:Q.header,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:Q.title,children:`⚙ WebCraft`}),(0,O.jsx)(`div`,{className:Q.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,O.jsxs)(`div`,{className:Q.headerTabs,children:[(0,O.jsx)(`button`,{className:`${Q.tabBtn} ${t===`new`?Q.tabActive:``}`,onClick:()=>n(`new`),children:`+ Nuovo`}),(0,O.jsx)(`button`,{className:`${Q.tabBtn} ${t===`projects`?Q.tabActive:``}`,onClick:()=>{n(`projects`),Vt()},children:`📁 Progetti`})]})]}),(0,O.jsx)(`div`,{className:Q.body,children:t===`projects`?(0,O.jsx)(`div`,{className:Q.projectsList,children:Xe.length===0?(0,O.jsxs)(`div`,{className:Q.emptyProjects,children:[(0,O.jsx)(`span`,{className:Q.emptyIcon,children:`📁`}),(0,O.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,O.jsx)(`span`,{className:Q.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):Xe.map(e=>(0,O.jsxs)(`div`,{className:Q.projectCard,children:[(0,O.jsxs)(`div`,{className:Q.projectInfo,children:[(0,O.jsx)(`div`,{className:Q.projectName,children:e.name}),(0,O.jsx)(`div`,{className:Q.projectDesc,children:e.description}),(0,O.jsxs)(`div`,{className:Q.projectMeta,children:[(0,O.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,O.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,O.jsx)(`button`,{className:Q.openBtn,onClick:()=>V(e),children:`↗ Apri`}),(0,O.jsx)(`button`,{className:Q.deleteBtn,onClick:()=>Ht(e),children:`🗑`})]},e.name))}):(0,O.jsxs)(`div`,{className:Q.editor,children:[(0,O.jsxs)(`div`,{className:Q.examples,children:[(0,O.jsx)(`div`,{className:Q.sectionLabel,children:`Esempi`}),(0,O.jsx)(`div`,{className:Q.examplePills,children:PT.map(e=>(0,O.jsx)(`button`,{className:Q.examplePill,onClick:()=>{o(e.name),c(e.desc),Ae(e.desc)},children:e.name},e.name))})]}),(0,O.jsxs)(`div`,{className:Q.editorCols,children:[(0,O.jsxs)(`div`,{className:Q.leftSidebar,children:[(0,O.jsxs)(`div`,{className:Q.panel,children:[(0,O.jsx)(`div`,{className:Q.panelTitle,children:`Blocchi`}),FT.map(e=>(0,O.jsxs)(`label`,{className:Q.blockLabel,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:l[e.key],onChange:t=>u(n=>({...n,[e.key]:t.target.checked})),className:Q.blockCheck}),(0,O.jsx)(`span`,{children:e.icon}),(0,O.jsx)(`span`,{children:e.label})]},e.key))]}),l.auth&&(0,O.jsxs)(`div`,{className:Q.panel,children:[(0,O.jsxs)(`div`,{className:Q.panelHeader,children:[(0,O.jsx)(`div`,{className:Q.panelTitle,children:`Campi Auth`}),(0,O.jsx)(`button`,{className:Q.addBtn,onClick:()=>f(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),d.map((e,t)=>(0,O.jsxs)(`div`,{className:Q.authField,children:[(0,O.jsx)(`input`,{value:e.label,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:Q.authFieldInput}),(0,O.jsx)(`select`,{value:e.type,onChange:e=>f(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:Q.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))}),(0,O.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:Q.authFieldReq}),(0,O.jsx)(`button`,{onClick:()=>f(e=>e.filter((e,n)=>n!==t)),className:Q.removeFieldBtn,children:`×`})]},t))]}),(0,O.jsxs)(`div`,{className:Q.panel,children:[(0,O.jsxs)(`div`,{className:Q.panelHeader,children:[(0,O.jsx)(`div`,{className:Q.panelTitle,children:`🗂 Contesto AI`}),(0,O.jsx)(`button`,{className:Q.addBtn,onClick:()=>Be({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),Fe.length>0?(0,O.jsx)(`div`,{className:Q.skillsList,children:Fe.map((e,t)=>(0,O.jsxs)(`div`,{className:Q.skillRow,children:[(0,O.jsx)(`span`,{className:Q.skillIcon,children:zT(e.type)}),(0,O.jsx)(`span`,{className:Q.skillName,title:e.name,children:e.name}),(0,O.jsx)(`span`,{className:`${Q.skillBadge} ${Q[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,O.jsx)(`span`,{className:Q.skillEmpty,children:`⚠`}),(0,O.jsx)(`button`,{className:Q.skillBtn,onClick:()=>Be({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,O.jsx)(`button`,{className:Q.skillBtn,onClick:()=>Bt(t),children:`🗑`}),e.type===`log`&&(0,O.jsx)(`button`,{className:Q.skillBtn,onClick:()=>zt(t),children:`🗑`})]},t))}):(0,O.jsx)(`div`,{className:Q.skillsEmpty,children:Le?`Nessun file di contesto. Clicca "+ Skill" per aggiungerne uno.`:`Crea o carica un progetto per i file di contesto.`})]}),I.length>0&&(0,O.jsxs)(`div`,{className:Q.panel,children:[(0,O.jsx)(`div`,{className:Q.panelTitle,children:`💾 Snapshot`}),I.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,O.jsxs)(`div`,{className:Q.snapshotRow,children:[(0,O.jsx)(`span`,{className:Q.snapshotTs,children:t}),(0,O.jsxs)(`span`,{className:Q.snapshotCount,children:[e.fileCount,`f`]}),(0,O.jsx)(`button`,{className:Q.snapshotBtn,onClick:()=>kt(e.ts),children:`↺`})]},e.ts)})]}),pe&&(0,O.jsx)(`div`,{className:Q.genStatus,children:`⏳ Generazione...`}),he&&(0,O.jsxs)(`div`,{className:Q.repairStatus,children:[(0,O.jsx)(`div`,{className:Q.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,O.jsxs)(`div`,{className:Q.repairStatusProg,children:[_e,` / `,ye,` file`]}),(0,O.jsx)(`div`,{className:Q.repairStatusFile,children:xe})]}),p.length>0&&!pe&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:Q.actionRow,children:[(0,O.jsx)(`button`,{className:Q.actionBtn,onClick:Lt,children:`⬇ ZIP`}),(0,O.jsx)(`button`,{className:Q.actionBtnIcon,title:`Syntax check`,onClick:At,children:`✅`}),(0,O.jsx)(`button`,{className:`${Q.actionBtnIcon} ${He?Q.actionBtnActive:``}`,title:`Grep`,onClick:()=>Ue(!He),children:`🔍`}),(0,O.jsx)(`button`,{className:Q.actionBtnIcon,title:`Snapshot`,onClick:Dt,children:`💾`})]}),p.some(e=>e._error||e._syntaxError)&&!he&&(0,O.jsx)(`button`,{className:Q.repairBtn,onClick:jt,children:`🔧 Correggi tutti i file rossi`}),(0,O.jsx)(`button`,{className:Q.sandboxBtn,onClick:()=>{a?Pt(a):i(`preview`)},children:et?`⏳ Starting...`:Qe?`🌐 Sandbox Live`:`▶ Sandbox`}),Ee&&(0,O.jsxs)(`div`,{className:Q.statsBar,children:[(0,O.jsxs)(`span`,{children:[`⏱ `,Ee.seconds>=60?`${Math.floor(Ee.seconds/60)}m ${Ee.seconds%60}s`:`${Ee.seconds}s`]}),(0,O.jsxs)(`span`,{children:[`↑ `,Ee.tokIn.toLocaleString(),` tok`]}),(0,O.jsxs)(`span`,{children:[`↓ `,Ee.tokOut.toLocaleString(),` tok`]}),(0,O.jsxs)(`span`,{children:[`📄 `,Ee.files,` file`]})]})]})]}),(0,O.jsxs)(`div`,{className:Q.rightPanel,children:[(0,O.jsxs)(`div`,{className:Q.rightTabBar,children:[(0,O.jsx)(`button`,{className:`${Q.rightTab} ${r===`preview`?``:Q.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,O.jsx)(`button`,{className:`${Q.rightTab} ${r===`preview`?Q.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),he&&(0,O.jsxs)(`div`,{className:Q.repairBar,children:[(0,O.jsxs)(`div`,{className:Q.repairBarRow,children:[(0,O.jsx)(`span`,{className:Q.repairBarIcon,children:`🔧`}),(0,O.jsx)(`span`,{className:Q.repairBarLabel,children:`Auto-fix`}),(0,O.jsx)(`span`,{className:Q.repairBarFile,children:xe}),(0,O.jsxs)(`span`,{className:Q.repairBarCounter,children:[_e,` / `,ye]}),(0,O.jsx)(`span`,{className:Q.repairBarTime,children:dt}),(0,O.jsx)(`button`,{className:Q.stopBtn,onClick:z,children:`⏹ Stop`})]}),(0,O.jsx)(`div`,{className:Q.progressTrack,children:(0,O.jsx)(`div`,{className:Q.repairProgress,style:{width:ye>0?`${Math.round(_e/ye*100)}%`:`0%`}})})]}),pe&&(0,O.jsxs)(`div`,{className:Q.genBar,children:[(0,O.jsxs)(`div`,{className:Q.genBarRow,children:[(0,O.jsx)(`span`,{className:Q.genBarRobot,children:`🤖`}),(0,O.jsx)(`span`,{className:Q.genBarLabel,children:Ce.total===0?`Pianificazione...`:`Generazione`}),(0,O.jsx)(`span`,{className:Q.genBarFile,children:Ce.name.split(`,`)[0].trim()}),(0,O.jsx)(`span`,{className:Q.genBarCounter,children:Ce.total>0?`${Ce.fi} / ${Ce.total}`:``}),(0,O.jsx)(`span`,{className:Q.genBarCounter,children:we.tokIn+we.tokOut>0?`↑${bt(we.tokIn)} ↓${bt(we.tokOut)}`:``}),(0,O.jsx)(`span`,{className:Q.genBarTime,children:lt}),(0,O.jsxs)(`span`,{className:Q.genDots,children:[(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot1}`}),(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot2}`}),(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot3}`})]})]}),(0,O.jsx)(`div`,{className:Q.progressTrack,children:(0,O.jsx)(`div`,{className:Q.genProgress,style:{width:Ce.total>0?`${Math.round(Ce.fi/Ce.total*100)}%`:`0%`}})})]}),r===`preview`?(0,O.jsxs)(`div`,{className:Q.sandboxWrap,children:[nt.length>0&&(0,O.jsxs)(`div`,{className:`${Q.sandboxConsole} ${ot?``:Q.sandboxConsoleCollapsed}`,children:[(0,O.jsxs)(`div`,{className:Q.sandboxConsoleHeader,onClick:()=>st(!ot),children:[(0,O.jsxs)(`span`,{className:Q.sandboxConsoleTitle,children:[et?`⏳`:it?`❌`:Qe?`✅`:`🌐`,` Console`]}),Qe&&(0,O.jsxs)(`span`,{className:Q.sandboxConsolePort,children:[`:`,Qe]}),et&&(0,O.jsxs)(`span`,{className:Q.sandboxConsoleDots,children:[(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot1}`}),(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot2}`}),(0,O.jsx)(`span`,{className:`${Q.dot} ${Q.dot3}`})]}),(0,O.jsx)(`span`,{className:Q.sandboxConsoleToggle,children:ot?`▼`:`▶`}),Qe&&(0,O.jsx)(`button`,{className:Q.sandboxReloadBtn,onClick:e=>{e.stopPropagation();let t=document.querySelector(`iframe[title="WebCraft Sandbox"]`);t&&(t.src=t.src)},children:`↻`}),Qe&&(0,O.jsx)(`button`,{className:Q.sandboxStopBtn,onClick:e=>{e.stopPropagation(),fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`}),$e(null),rt([])},children:`⏹`})]}),ot&&(0,O.jsx)(`div`,{className:Q.sandboxConsoleBody,ref:ct,children:nt.map((e,t)=>(0,O.jsx)(`div`,{className:`${Q.sandboxLogLine} ${e.includes(`❌`)||e.includes(`💥`)?Q.sandboxLogError:e.includes(`⚠`)?Q.sandboxLogWarn:e.includes(`✅`)?Q.sandboxLogOk:e.includes(`🔌`)||e.includes(`📦`)||e.includes(`🚀`)||e.includes(`🔧`)||e.includes(`🧹`)?Q.sandboxLogPhase:``}`,children:e},t))})]}),Qe?(0,O.jsx)(`iframe`,{src:`http://127.0.0.1:${Qe}`,className:Q.sandboxFrame,title:`WebCraft Sandbox`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`}):(0,O.jsxs)(`div`,{className:Q.sandboxEmpty,children:[(0,O.jsx)(`span`,{style:{fontSize:40},children:et?`⏳`:it?`❌`:`🌐`}),(0,O.jsx)(`span`,{style:{fontWeight:600},children:et?`Avvio sandbox in corso...`:it?`Errore sandbox`:`Sandbox`}),it&&(0,O.jsx)(`span`,{style:{fontSize:11,maxWidth:400,textAlign:`center`},children:it}),!et&&(0,O.jsxs)(`button`,{className:Q.sandboxStartBtn,onClick:()=>{a&&Pt(a)},children:[`▶ `,it?`Riprova`:`Avvia Sandbox`]})]})]}):(0,O.jsx)(`div`,{className:Q.codeArea,children:p.length===0&&pe?(0,O.jsx)(`div`,{className:Q.noFiles,children:(0,O.jsxs)(`div`,{className:Q.noFilesHero,children:[(0,O.jsx)(`span`,{className:Q.noFilesIcon,children:`⏳`}),(0,O.jsx)(`span`,{className:Q.noFilesTitle,children:`Pianificazione...`}),(0,O.jsx)(`span`,{className:Q.noFilesTagline,children:Ce.name||`Analisi della struttura del progetto in corso`})]})}):p.length===0?(0,O.jsxs)(`div`,{className:Q.noFiles,children:[(0,O.jsxs)(`div`,{className:Q.noFilesHero,children:[(0,O.jsx)(`span`,{className:Q.noFilesIcon,children:`🔨`}),(0,O.jsx)(`span`,{className:Q.noFilesTitle,children:`WebCraft`}),(0,O.jsx)(`span`,{className:Q.noFilesTagline,children:`Genera progetti web completi con AI`})]}),(0,O.jsxs)(`div`,{className:Q.noFilesSteps,children:[(0,O.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,O.jsx)(`span`,{className:Q.noFilesStepNum,children:`1`}),(0,O.jsx)(`span`,{children:`Scegli un esempio o scrivi una descrizione nel box in basso`})]}),(0,O.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,O.jsx)(`span`,{className:Q.noFilesStepNum,children:`2`}),(0,O.jsxs)(`span`,{children:[`Premi `,(0,O.jsx)(`strong`,{children:`▶ Genera`}),` — l'AI crea tutti i file del progetto`]})]}),(0,O.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,O.jsx)(`span`,{className:Q.noFilesStepNum,children:`3`}),(0,O.jsx)(`span`,{children:`Chiedi modifiche in chat, scarica lo ZIP o avvia il Sandbox`})]})]}),(0,O.jsxs)(`div`,{className:Q.noFilesExamplesHint,children:[`💡 Prova: `,(0,O.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=PT[0];o(e.name),c(e.desc),Ae(e.desc)},children:`MySaaS`}),(0,O.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=PT[1];o(e.name),c(e.desc),Ae(e.desc)},children:`MyShop`}),(0,O.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=PT[3];o(e.name),c(e.desc),Ae(e.desc)},children:`MyPortfolio`})]})]}):(0,O.jsxs)(`div`,{className:Q.codeLayout,children:[(0,O.jsx)(`div`,{className:Q.ideTabBar,children:p.map((e,t)=>{let n=e._error||!!e._syntaxError,r=t===h;return(0,O.jsxs)(`button`,{className:`${Q.ideTab} ${r?Q.ideTabActive:``} ${n?Q.ideTabError:``} ${e._pending?Q.ideTabPending:``}`,onClick:()=>{g(t),x(null),y(null)},title:e.name,children:[(0,O.jsx)(`span`,{className:Q.ideTabIcon,children:e._pending?`⌛`:n?`⚠`:LT(e.name)}),(0,O.jsx)(`span`,{className:Q.ideTabName,children:e.name.split(`/`).pop()}),S.has(e.name)&&(0,O.jsx)(`span`,{className:Q.ideTabUnsaved,children:`●`}),n&&(0,O.jsx)(`span`,{className:Q.ideTabDot})]},t)})}),de&&(0,O.jsxs)(`div`,{className:Q.diffOverlay,children:[(0,O.jsxs)(`div`,{className:Q.diffOverlayHeader,children:[(0,O.jsxs)(`span`,{children:[`✏ Modifica proposta — `,(0,O.jsx)(`strong`,{children:de.file})]}),(0,O.jsxs)(`div`,{className:Q.diffOverlayActions,children:[(0,O.jsx)(`button`,{className:Q.diffAcceptBtn,onClick:()=>{m(e=>e.map(e=>e.name===de.file?{...e,content:de.after}:e)),fe(null)},children:`✓ Accetta`}),(0,O.jsx)(`button`,{className:Q.diffRejectBtn,onClick:()=>fe(null),children:`✕ Rifiuta`})]})]}),(0,O.jsxs)(`div`,{className:Q.diffOverlayBody,children:[de.before.split(`
733
733
  `).map((e,t)=>e===(de.after.split(`
734
734
  `)[t]??``)?(0,O.jsxs)(`div`,{className:Q.diffSame,children:[`\xA0`,e||` `]},t):(0,O.jsxs)(`div`,{className:Q.diffRem,children:[`- `,e]},`r${t}`)),de.after.split(`
@@ -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-QFXhoDBT.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-CAYbIByt.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-CVtta8J-.css">
13
13
  </head>
14
14
  <body>