@ui-workflow/core 0.1.0 → 0.1.1
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/layout-capture.mjs +14 -0
- package/package.json +3 -3
- package/studio-dist/assets/{AccountModal-BCsGPvx4.js → AccountModal-C415mM4f.js} +1 -1
- package/studio-dist/assets/{Connections-C9b3n4ss.js → Connections-BD_LstwM.js} +1 -1
- package/studio-dist/assets/Diagnostics-CuRX-uAp.js +10 -0
- package/studio-dist/assets/{Repositories-BPQd02x8.js → Repositories-DH7YyDwk.js} +1 -1
- package/studio-dist/assets/{ReviewStage-bicZ-iOy.js → ReviewStage-DJ1oRAkT.js} +1 -1
- package/studio-dist/assets/{Settings-CITjwtGY.js → Settings-8mMKFnYf.js} +1 -1
- package/studio-dist/assets/WorkflowVisualizer-CdwGjUIL.js +4 -0
- package/studio-dist/assets/{account-modal--3DWt5me.js → account-modal-Cm9Rsqyi.js} +1 -1
- package/studio-dist/assets/{index-KY1IHp8L.js → index-Dp8CdAV4.js} +27 -27
- package/studio-dist/assets/index-jTfIlhhN.css +1 -0
- package/studio-dist/index.html +2 -2
- package/studio-routes-projects.mjs +22 -5
- package/studio-server.mjs +31 -1
- package/studio-settings.mjs +83 -0
- package/ui-workflow-cli.mjs +37 -28
- package/windows-native.mjs +88 -9
- package/workflow-runner.mjs +33 -2
- package/studio-dist/assets/Diagnostics-D9o9AHSf.js +0 -10
- package/studio-dist/assets/WorkflowVisualizer-6llBlI2i.js +0 -4
- package/studio-dist/assets/index-Cv4BVYXJ.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Settings-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Settings-8mMKFnYf.js","assets/react-vendor-CH5vucNG.js","assets/rolldown-runtime-4tVxZq34.js","assets/account-modal-Cm9Rsqyi.js","assets/account-modal-C4b9Kh0w.css","assets/Connections-BD_LstwM.js","assets/Connections-CN1s_ggX.css","assets/AccountModal-C415mM4f.js","assets/Repositories-DH7YyDwk.js","assets/Repositories-C6z4FS8l.css","assets/ReviewStage-DJ1oRAkT.js","assets/ReviewStage-DGdIgmvq.css","assets/visual-diff-rubric-Cj3IhKLX.css","assets/WorkflowVisualizer-CdwGjUIL.js","assets/WorkflowVisualizer-BW2662Az.css","assets/Diagnostics-CuRX-uAp.js","assets/Diagnostics-B10aw9h3.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{i as e,n as t,r as n,t as r}from"./react-vendor-CH5vucNG.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var i=e(),a=t(),o=``,s=null;async function c(){return s||=(async()=>{await fetch(`/`,{cache:`no-store`});let e=await fetch(`/api/session`,{cache:`no-store`}),t=await e.json();if(!e.ok||!t||typeof t!=`object`||!(`key`in t)||typeof t.key!=`string`)throw Error(`Open Studio locally to establish a session.`);o=t.key})().finally(()=>{s=null}),s}var l=null;async function u(){return l||=(async()=>{let e=await fetch(`/api/session`,{cache:`no-store`});if(e.status===403){await c();return}let t=await e.json();if(!e.ok||!t||typeof t!=`object`||!(`key`in t)||typeof t.key!=`string`)throw Error(`Open Studio locally to establish a session.`);o=t.key})().finally(()=>{l=null}),l}async function d(e,t,n){o||await u();let r=()=>fetch(e,{method:t===void 0?`GET`:`POST`,headers:{"content-type":`application/json`,"x-studio-key":o},body:t===void 0?void 0:JSON.stringify(t),signal:n}),i=await r(),a=await i.json();if(i.status===403&&typeof a?.error==`string`&&/session key required|start a session/i.test(a.error))try{await c(),i=await r(),a=await i.json()}catch{throw Object.assign(Error(`Studio restarted in the background. Refresh the page to reconnect.`),a)}if(!i.ok){let e=i.status===404&&/Studio operation not found/i.test(String(a?.error??``))?"Your running Studio server is older than the UI. Run `npm run studio -- --restart` to load the latest routes.":a.error??`Local operation failed. Refresh status to recover.`;throw Object.assign(Error(e),a)}if(a.apiVersion!==1)throw Error(`Unsupported Studio API version. Refresh the workspace.`);return a}async function f(e,t){return p(`/api/runs/${e}/download?kind=${t}`,`studio-${t}.zip`)}async function p(e,t){let n=await fetch(e,{headers:{"x-studio-key":o}});if(!n.ok)throw Error((await n.json()).error);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=n.headers.get(`content-disposition`)?.match(/filename="([^"]+)"/)?.[1]??t,i.click(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var m={get(e){try{return JSON.parse(localStorage.getItem(e)??`null`)}catch{return null}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},h={auto:[{tag:`path`,attributes:{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`}},{tag:`path`,attributes:{d:`M20 2v4`}},{tag:`path`,attributes:{d:`M22 4h-4`}},{tag:`circle`,attributes:{cx:`4`,cy:`20`,r:`2`}}],settings:[{tag:`path`,attributes:{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}},{tag:`circle`,attributes:{cx:`12`,cy:`12`,r:`3`}}],folder:[{tag:`path`,attributes:{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}}],plus:[{tag:`path`,attributes:{d:`M5 12h14`}},{tag:`path`,attributes:{d:`M12 5v14`}}],arrow:[{tag:`path`,attributes:{d:`M5 12h14`}},{tag:`path`,attributes:{d:`m12 5 7 7-7 7`}}],menu:[{tag:`rect`,attributes:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}},{tag:`path`,attributes:{d:`M9 3v18`}}],palette:[{tag:`path`,attributes:{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`}},{tag:`circle`,attributes:{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`}},{tag:`circle`,attributes:{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`}},{tag:`circle`,attributes:{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`}},{tag:`circle`,attributes:{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}}],image:[{tag:`path`,attributes:{d:`M16 5h6`}},{tag:`path`,attributes:{d:`M19 2v6`}},{tag:`path`,attributes:{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`}},{tag:`path`,attributes:{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}},{tag:`circle`,attributes:{cx:`9`,cy:`9`,r:`2`}}],website:[{tag:`rect`,attributes:{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}},{tag:`path`,attributes:{d:`M3 9h18`}},{tag:`path`,attributes:{d:`M9 21V9`}}],app:[{tag:`rect`,attributes:{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`}},{tag:`rect`,attributes:{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`}},{tag:`rect`,attributes:{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`}},{tag:`rect`,attributes:{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`}}],component:[{tag:`path`,attributes:{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`}},{tag:`path`,attributes:{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`}},{tag:`path`,attributes:{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`}}],check:[{tag:`path`,attributes:{d:`M20 6 9 17l-5-5`}}],chevron:[{tag:`path`,attributes:{d:`m6 9 6 6 6-6`}}],external:[{tag:`path`,attributes:{d:`M15 3h6v6`}},{tag:`path`,attributes:{d:`M10 14 21 3`}},{tag:`path`,attributes:{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}}],search:[{tag:`path`,attributes:{d:`m8 11 2 2 4-4`}},{tag:`circle`,attributes:{cx:`11`,cy:`11`,r:`8`}},{tag:`path`,attributes:{d:`m21 21-4.3-4.3`}}],graph:[{tag:`rect`,attributes:{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`}},{tag:`path`,attributes:{d:`M7 11v4a2 2 0 0 0 2 2h4`}},{tag:`rect`,attributes:{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`}}],shield:[{tag:`path`,attributes:{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}},{tag:`path`,attributes:{d:`m9 12 2 2 4-4`}}],capture:[{tag:`path`,attributes:{d:`M3 7V5a2 2 0 0 1 2-2h2`}},{tag:`path`,attributes:{d:`M17 3h2a2 2 0 0 1 2 2v2`}},{tag:`path`,attributes:{d:`M21 17v2a2 2 0 0 1-2 2h-2`}},{tag:`path`,attributes:{d:`M7 21H5a2 2 0 0 1-2-2v-2`}},{tag:`circle`,attributes:{cx:`12`,cy:`12`,r:`1`}},{tag:`path`,attributes:{d:`M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0`}}],measure:[{tag:`path`,attributes:{d:`m12 14 4-4`}},{tag:`path`,attributes:{d:`M3.34 19a10 10 0 1 1 17.32 0`}}],assets:[{tag:`path`,attributes:{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`}},{tag:`path`,attributes:{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`}},{tag:`circle`,attributes:{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`}},{tag:`rect`,attributes:{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`}}],motion:[{tag:`path`,attributes:{d:`m12.296 3.464 3.02 3.956`}},{tag:`path`,attributes:{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`}},{tag:`path`,attributes:{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}},{tag:`path`,attributes:{d:`m6.18 5.276 3.1 3.899`}}],copy:[{tag:`rect`,attributes:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attributes:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],close:[{tag:`path`,attributes:{d:`M18 6 6 18`}},{tag:`path`,attributes:{d:`m6 6 12 12`}}],minus:[{tag:`path`,attributes:{d:`M5 12h14`}}],clock:[{tag:`circle`,attributes:{cx:`12`,cy:`12`,r:`10`}},{tag:`path`,attributes:{d:`M12 6v6l4 2`}}],terminal:[{tag:`path`,attributes:{d:`M12 19h8`}},{tag:`path`,attributes:{d:`m4 17 6-6-6-6`}}],mic:[{tag:`path`,attributes:{d:`M12 19v3`}},{tag:`path`,attributes:{d:`M19 10v2a7 7 0 0 1-14 0v-2`}},{tag:`rect`,attributes:{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`}}]},g=`/assets/claude-BlO01lbX.svg`,_=`/assets/openai-L0iksW7i.svg`,v=`/assets/mcp-CjNBmnSC.svg`,y=`/assets/aistudio-DSa_EsoU.svg`,b=`/assets/openrouter-BJJMcwbh.svg`,x=`/assets/groq-CT__qXjF.svg`,S=`/assets/cursor-C8SqxUwb.svg`,C=`/assets/antigravity-CzscE6sW.svg`,w=r();function T({name:e,className:t=``}){if(e===`figma`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-figma `+t,viewBox:`0 0 38 57`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#1ABCFE`,d:`M19 28.5a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0Z`}),(0,w.jsx)(`path`,{fill:`#0ACF83`,d:`M0 47.5A9.5 9.5 0 0 1 9.5 38H19v9.5a9.5 9.5 0 1 1-19 0Z`}),(0,w.jsx)(`path`,{fill:`#FF7262`,d:`M19 0v19h9.5a9.5 9.5 0 1 0 0-19H19Z`}),(0,w.jsx)(`path`,{fill:`#F24E1E`,d:`M0 9.5A9.5 9.5 0 0 0 9.5 19H19V0H9.5A9.5 9.5 0 0 0 0 9.5Z`}),(0,w.jsx)(`path`,{fill:`#A259FF`,d:`M0 28.5A9.5 9.5 0 0 0 9.5 38H19V19H9.5A9.5 9.5 0 0 0 0 28.5Z`})]});if(e===`github`)return(0,w.jsx)(`svg`,{className:`studio-icon studio-brand-svg brand-github `+t,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.53 1.032 1.53 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844a9.59 9.59 0 0 1 2.504.337c1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2Z`})});if(e===`gitlab`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-gitlab `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#E24329`,d:`M12 21.4 15.8 9.8H8.2L12 21.4Z`}),(0,w.jsx)(`path`,{fill:`#FC6D26`,d:`M12 21.4 8.2 9.8H2.8L12 21.4Z`}),(0,w.jsx)(`path`,{fill:`#FCA326`,d:`M2.8 9.8 1.6 13.4a.8.8 0 0 0 .3.9L12 21.4 2.8 9.8Z`}),(0,w.jsx)(`path`,{fill:`#E24329`,d:`M2.8 9.8h5.4L5.9 2.7a.4.4 0 0 0-.8 0L2.8 9.8Z`}),(0,w.jsx)(`path`,{fill:`#FC6D26`,d:`M12 21.4 15.8 9.8h5.4L12 21.4Z`}),(0,w.jsx)(`path`,{fill:`#FCA326`,d:`M21.2 9.8l1.2 3.6a.8.8 0 0 1-.3.9L12 21.4l9.2-11.6Z`}),(0,w.jsx)(`path`,{fill:`#E24329`,d:`M21.2 9.8h-5.4l2.3-7.1a.4.4 0 0 1 .8 0l2.3 7.1Z`})]});if(e===`storybook`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-storybook `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#FF4785`,d:`M4.2 3.4 19.6 2.4c.8-.05 1.4.57 1.4 1.36v16.5c0 .77-.61 1.4-1.38 1.4l-14.8-.68a1.4 1.4 0 0 1-1.33-1.38l-.62-14.8a1.4 1.4 0 0 1 1.33-1.4Z`}),(0,w.jsx)(`path`,{fill:`#FFFFFF`,d:`M16.2 2.6v3.1l1.2-.85 1.2.85V2.45l-2.4.15Z`}),(0,w.jsx)(`path`,{fill:`#FFFFFF`,d:`M15.4 10.2c-.1-1.8-1.4-2.8-3.3-2.8-2 0-3.4 1.1-3.4 2.8 0 1.4.8 2.2 2.5 2.7l1.2.35c.85.25 1.15.6 1.15 1.15 0 .68-.6 1.1-1.5 1.1-1 0-1.6-.55-1.65-1.55H8.4c.05 2 1.4 3.25 3.65 3.25 2.2 0 3.6-1.15 3.6-2.95 0-1.4-.75-2.2-2.4-2.7l-1.3-.38c-.85-.25-1.15-.55-1.15-1.08 0-.6.5-1 1.3-1 .82 0 1.35.42 1.4 1.21h1.9Z`})]});if(e===`vercel`)return(0,w.jsx)(`svg`,{className:`studio-icon studio-brand-svg brand-vercel `+t,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M12 3.2 22 20.5H2L12 3.2Z`})});if(e===`cloudflare`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-cloudflare `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#F38020`,d:`M16.9 17.5H6.1a3.4 3.4 0 0 1-.4-6.78 5.2 5.2 0 0 1 10.02-1.22 3.9 3.9 0 0 1 1.18 8Z`}),(0,w.jsx)(`path`,{fill:`#FAAD3F`,d:`M17.4 11.4a3.1 3.1 0 0 1 2.7 4.62c-.47.9-1.4 1.48-2.42 1.48h-1.8a4.2 4.2 0 0 0 1.52-6.1Z`})]});if(e===`netlify`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-netlify `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#00C7B7`,d:`M12 2.2 21.8 12 12 21.8 2.2 12 12 2.2Z`,opacity:`0.18`}),(0,w.jsx)(`path`,{fill:`#00C7B7`,d:`M12 3.4 20.6 12 12 20.6 3.4 12 12 3.4Zm0 3.1L6.5 12l5.5 5.5 5.5-5.5L12 6.5Z`}),(0,w.jsx)(`path`,{fill:`#05BDBA`,d:`M12 8.7 15.3 12 12 15.3 8.7 12 12 8.7Z`})]});if(e===`linear`)return(0,w.jsx)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-linear `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{fill:`#5E6AD2`,d:`M3.1 13.7a9 9 0 0 0 7.2 7.2l-7.2-7.2Zm-.1-2.6 9.9 9.9a9 9 0 0 0 2-.4L3.4 9.1a9 9 0 0 0-.4 2Zm1.3-3.7 12.3 12.3a9 9 0 0 0 1.4-1L5.3 6a9 9 0 0 0-1 1.4Zm2.2-2.3L19 17.5A9 9 0 0 0 6.5 5.1Z`})});if(e===`slack`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-slack `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#E01E5A`,d:`M6.2 14.8a1.9 1.9 0 1 1-1.9-1.9h1.9v1.9Zm.95 0a1.9 1.9 0 0 1 3.8 0v4.75a1.9 1.9 0 0 1-3.8 0V14.8Z`}),(0,w.jsx)(`path`,{fill:`#36C5F0`,d:`M9.05 6.2a1.9 1.9 0 1 1 1.9-1.9v1.9h-1.9Zm0 .95a1.9 1.9 0 0 1 0 3.8H4.3a1.9 1.9 0 0 1 0-3.8h4.75Z`}),(0,w.jsx)(`path`,{fill:`#2EB67D`,d:`M17.8 9.05a1.9 1.9 0 1 1 1.9 1.9h-1.9v-1.9Zm-.95 0a1.9 1.9 0 0 1-3.8 0V4.3a1.9 1.9 0 0 1 3.8 0v4.75Z`}),(0,w.jsx)(`path`,{fill:`#ECB22E`,d:`M14.95 17.8a1.9 1.9 0 1 1-1.9 1.9v-1.9h1.9Zm0-.95a1.9 1.9 0 0 1 0-3.8h4.75a1.9 1.9 0 0 1 0 3.8h-4.75Z`})]});if(e===`playwright`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-playwright `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#E2574C`,d:`M3.2 7.2c2.5-1.1 5.4-1.3 8-.5l-.7 5.9c-.4 3-2.6 5.2-5 5.1-2.5-.1-4-2.8-3.6-5.9l1.3-4.6Z`}),(0,w.jsx)(`path`,{fill:`#2EAD33`,d:`M12.2 6.6c2.9-.8 6.1-.4 8.7 1l-1.4 5.7c-.8 3.2-3.4 5.6-6.2 5.2-2.7-.4-4.2-3.3-3.5-6.6l2.4-5.3Z`}),(0,w.jsx)(`circle`,{cx:`14.5`,cy:`11.2`,r:`1`,fill:`#FFFFFF`}),(0,w.jsx)(`circle`,{cx:`17.8`,cy:`11.9`,r:`1`,fill:`#FFFFFF`}),(0,w.jsx)(`path`,{fill:`#FFFFFF`,d:`M13.6 14.3c.8 1.2 2.4 1.6 3.7.8.2-.1.3.1.2.3-.7 1.3-2.5 1.8-3.8.9-.6-.4-.9-1.1-.7-1.8.1-.2.4-.4.6-.2Z`})]});if(e===`gitleaks`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-gitleaks `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#F59E0B`,opacity:`0.18`,d:`M12 2.5 4.5 5.6v5.9c0 4.9 3.2 9.1 7.5 10.4 4.3-1.3 7.5-5.5 7.5-10.4V5.6L12 2.5Z`}),(0,w.jsx)(`path`,{stroke:`#F59E0B`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 2.8 4.8 5.8v5.7c0 4.6 3 8.6 7.2 9.9 4.2-1.3 7.2-5.3 7.2-9.9V5.8L12 2.8Z`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`10.5`,r:`2.2`,fill:`#F59E0B`}),(0,w.jsx)(`path`,{stroke:`#F59E0B`,strokeWidth:`1.8`,strokeLinecap:`round`,d:`M12 12.7v3.4`})]});if(e===`osv`)return(0,w.jsxs)(`svg`,{className:`studio-icon studio-brand-svg brand-color brand-osv `+t,viewBox:`0 0 24 24`,fill:`none`,stroke:`none`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{fill:`#10B981`,opacity:`0.18`,d:`M12 2.6 4.2 7v10L12 21.4l7.8-4.4V7L12 2.6Z`}),(0,w.jsx)(`path`,{stroke:`#10B981`,strokeWidth:`1.8`,strokeLinejoin:`round`,d:`M12 3 4.6 7.2v9.6L12 21l7.4-4.2V7.2L12 3Z`}),(0,w.jsx)(`path`,{stroke:`#10B981`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`m9 12.2 2 2 4.2-4.2`})]});if(e===`groq`)return(0,w.jsx)(`span`,{className:`studio-icon groq-mark `+t,"aria-hidden":`true`,children:(0,w.jsx)(`img`,{src:x,width:`16`,height:`16`,alt:``})});let n=e===`codex`?_:e===`claude`?g:e===`mcp`?v:e===`google`?y:e===`openrouter`?b:e===`cursor`?S:e===`antigravity`?C:null;return n?(0,w.jsx)(`img`,{className:`studio-icon client-logo `+([`claude`,`antigravity`,`cursor`].includes(e)?`brand-color brand-${e} `:`brand-monochrome `)+t,src:n,width:`20`,height:`20`,decoding:`async`,alt:``,"aria-hidden":`true`}):(0,w.jsx)(`svg`,{className:`studio-icon `+t,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.65`,strokeLinecap:`round`,strokeLinejoin:`round`,children:h[e]?.map((e,t)=>(0,i.createElement)(e.tag,{...e.attributes,key:t}))})}function E({notice:e,onDismiss:t}){return!e||!e.text?null:e.kind===`error`?(0,w.jsxs)(`div`,{className:`error-box wb-notice-dismissible wb-error-toast`,role:`alert`,children:[(0,w.jsx)(`span`,{children:e.text}),e.action&&(0,w.jsx)(`button`,{type:`button`,className:`button primary`,onClick:e.action.onClick,children:e.action.label}),(0,w.jsx)(`button`,{type:`button`,className:`wb-status-dismiss`,"aria-label":`Dismiss error message`,onClick:t,children:(0,w.jsx)(T,{name:`close`})})]}):(0,w.jsxs)(`div`,{className:`wb-status-banner${e.kind===`success`?` is-success`:` is-info`}`,role:`status`,children:[(0,w.jsx)(`span`,{children:e.text}),e.action&&(0,w.jsx)(`button`,{type:`button`,className:`button primary`,onClick:e.action.onClick,children:e.action.label}),(0,w.jsx)(`button`,{type:`button`,className:`wb-status-dismiss`,"aria-label":`Dismiss notification`,onClick:t,children:(0,w.jsx)(T,{name:`close`})})]})}var D={productTitle:`UI Design Studio`,shortName:`UI Studio`,cliName:`ui-workflow`,mcpName:`ui-workflow-mcp`,packageName:`@ui-workflow/core`,mcpServerName:`ui-design-workflow`,tagline:`Catch visual, accessibility, and UI security bugs before you merge.`,themeColor:`#111318`,accentColor:`#c80909`};function O(e){return new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,minimumFractionDigits:e>0&&e<.01?4:2,maximumFractionDigits:6}).format(e)}function k({firstEstimate:e,ceiling:t,settled:n}){return(0,w.jsxs)(`dl`,{className:`wb-billing-breakdown`,"aria-label":`Cost and usage summary`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Estimated first request`}),(0,w.jsx)(`dd`,{children:!e||e.status===`unavailable`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`strong`,{children:`Unavailable`}),e?.inputTokens!==null&&e?.inputTokens!==void 0?` (~${e.inputTokens.toLocaleString()} input tokens)`:``,e?.reason?` — ${e.reason}`:``]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`strong`,{children:O(e.costUsd??0)}),` (~`,e.inputTokens?.toLocaleString()??`?`,` in /`,` `,e.maxOutputTokens?.toLocaleString()??`?`,` max output tokens) ·`,` `,e.reason]})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Run budget & limits`}),(0,w.jsx)(`dd`,{children:t?t.billingMode===`free-tier-confirmed`?`Confirmed free tier ($0 cap) · up to ${t.maxModelTurns??`—`} turns · ${t.maxOutputTokens.toLocaleString()} max output tokens`:t.billingMode===`free-tier-unconfirmed`?`Free-tier confirmation needed · up to ${t.maxModelTurns??`—`} turns`:`${O(t.maxCostUsd)} max · up to ${t.maxModelTurns??`—`} turns · ${t.maxOutputTokens.toLocaleString()} max output tokens`:`Unavailable`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`dt`,{children:`Usage so far`}),(0,w.jsx)(`dd`,{children:!n||n.status===`none`?`No requests sent yet ($0.00)`:n.costUsd===null?`Unavailable across ${n.dispatchCount} request${n.dispatchCount===1?``:`s`} (${n.note})${n.promptTokens!==null&&n.completionTokens!==null?` · ${n.promptTokens.toLocaleString()} in${n.cachedTokens==null?``:` · ${n.cachedTokens.toLocaleString()} cached`} / ${n.completionTokens.toLocaleString()} out tokens`:``}${n.estimated?.allowanceUsd?` · Estimated max cost: ${O(n.estimated.allowanceUsd)}`:``}`:`${O(n.costUsd)} across ${n.dispatchCount} request${n.dispatchCount===1?``:`s`}${n.promptTokens!==null&&n.completionTokens!==null?` (${n.promptTokens.toLocaleString()} in${n.cachedTokens==null?``:` · ${n.cachedTokens.toLocaleString()} cached`} / ${n.completionTokens.toLocaleString()} out tokens)`:``}${n.timingMs?.dispatchDurationMs?` · ${(n.timingMs.dispatchDurationMs/1e3).toFixed(1)}s`:``}`})]})]})}function A(e){let t=(e.name||e.username||`?`).trim(),n=t.split(/[\s._-]+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function ee(e){let t=e?.detectedModules,n=t?.motion?.engines??[];return[...t?.framework===`nextjs-app`?[`Next.js App Router`]:t?.framework===`nextjs-pages`?[`Next.js Pages Router`]:t?.framework?.startsWith(`nextjs`)?[`Next.js`]:[],...t?.tailwind?.enabled?[`Tailwind CSS${t.tailwind.version?` `+t.tailwind.version:``}`]:[],...t?.shadcnUi?.enabled?[`shadcn/ui`]:[],...t?.motion?.hasCssMotion?[`CSS motion`]:[],...n.some(e=>[`motion`,`framer-motion`].includes(e))?[`Motion`]:[],...n.includes(`gsap`)?[`GSAP`]:[]]}function j(){return(0,w.jsx)(`span`,{className:`studio-brand-mark`,"aria-hidden":`true`,children:(0,w.jsxs)(`svg`,{viewBox:`0 0 32 32`,fill:`none`,children:[(0,w.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`29`,height:`29`,rx:`7.5`,fill:`#111318`}),(0,w.jsx)(`rect`,{x:`2.25`,y:`2.25`,width:`27.5`,height:`27.5`,rx:`6.75`,stroke:`var(--action, #c80909)`,strokeWidth:`1.5`}),(0,w.jsx)(`rect`,{x:`8.2`,y:`9.4`,width:`15.6`,height:`2.6`,rx:`1.3`,fill:`#f8fafc`}),(0,w.jsx)(`rect`,{x:`8.2`,y:`14.7`,width:`9.2`,height:`2.6`,rx:`1.3`,fill:`#f8fafc`,fillOpacity:`0.92`}),(0,w.jsx)(`rect`,{x:`8.2`,y:`20`,width:`13`,height:`2.6`,rx:`1.3`,fill:`#f8fafc`,fillOpacity:`0.72`}),(0,w.jsx)(`circle`,{cx:`22.1`,cy:`16`,r:`2.7`,fill:`var(--action, #c80909)`})]})})}function M({dark:e,onClick:t,collapsed:n}){return(0,w.jsxs)(`button`,{className:`wb-theme-toggle`,type:`button`,"data-dark":e,"aria-label":`Toggle light and dark appearance`,"aria-pressed":e,title:e?`Switch to light appearance`:`Switch to dark appearance`,onClick:t,children:[(0,w.jsxs)(`span`,{className:`theme-orbit`,"aria-hidden":`true`,children:[(0,w.jsxs)(`svg`,{className:`theme-sun`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,w.jsx)(`path`,{d:`M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.4 1.4m11.2 11.2L19 19M5 19l1.4-1.4M17.6 6.4 19 5`})]}),(0,w.jsxs)(`svg`,{className:`theme-moon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:[(0,w.jsx)(`path`,{d:`M20.8 14A9 9 0 0 1 10 3.2 9 9 0 1 0 20.8 14Z`}),(0,w.jsx)(`path`,{d:`m18 3 .5 1.5L20 5l-1.5.5L18 7l-.5-1.5L16 5l1.5-.5Z`})]})]}),(0,w.jsxs)(`span`,{className:`wb-rail-label`,"aria-hidden":n||void 0,children:[`Appearance`,(0,w.jsx)(`span`,{className:`theme-track`,children:(0,w.jsx)(`span`,{})})]})]})}function N(e){let t=(e||`Project`).trim();return t.replace(/(?:[-_\s]+studio[-_\s]?copy|\s*\(copy\))(?:\s*\d+)?$/i,``).trim()||t}function P(e){let t=(e.brief??``).split(`
|
|
3
3
|
|
|
4
4
|
Build/work intent:`)[0].split(`
|
|
@@ -8,48 +8,48 @@ Follow-up instruction:`)[0].split(`
|
|
|
8
8
|
`)[0]?.trim()||n} — ${t.title??`Project`}`,u=r===t.id&&e===`workspace`,d=F(t,u&&s,u&&a),f=new Date(t.updatedAt).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`wb-history-row`,children:[(0,w.jsxs)(`button`,{className:`wb-history-open`,title:l,disabled:s||c!==null,"aria-current":u||o===t.id?`page`:void 0,onClick:()=>b(t.id),children:[(0,w.jsxs)(`span`,{className:`wb-history-title-row`,children:[(0,w.jsx)(`span`,{className:`wb-state-dot`,"data-state":d.state,role:`img`,"aria-label":d.label}),(0,w.jsx)(`span`,{className:`wb-history-title`,children:n})]}),(0,w.jsxs)(`small`,{className:`wb-history-meta`,children:[(0,w.jsx)(`span`,{className:`wb-history-project`,children:i}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{children:f}),d.short&&(0,w.jsx)(`span`,{className:`wb-history-badge`,"data-state":d.state,children:d.short})]})]}),(0,w.jsx)(`button`,{type:`button`,className:`wb-history-delete`,"aria-label":`Delete chat: ${n}`,title:s?`Stop the revision before deleting a chat`:`Delete chat`,disabled:s||c!==null,"aria-busy":c===t.id,onClick:()=>x(t),children:(0,w.jsx)(`svg`,{className:`studio-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.65`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M3 6h18M9 6V4h6v2M5 6l1 14h12l1-14M10 10v6M14 10v6`})})})]},t.id)}),V.length===0&&(0,w.jsx)(`p`,{children:`Your revisions will appear here.`}),V.length>0&&H.length===0&&(0,w.jsx)(`p`,{children:`No matching revisions.`})]})]}),(0,w.jsxs)(`div`,{className:`wb-rail-bottom`,children:[(0,w.jsxs)(`div`,{ref:le,className:`wb-account-anchor`,children:[C&&U&&(0,w.jsxs)(`div`,{className:`wb-account-popover`,role:`menu`,"aria-label":`Account actions`,children:[(0,w.jsxs)(`div`,{className:`wb-account-popover-head`,children:[(0,w.jsx)(`strong`,{children:U.name||U.username}),(0,w.jsxs)(`small`,{children:[`@`,U.username,` ·`,` `,U.provider===`google`?`Google`:U.provider===`github`?`GitHub`:`GitLab`,` `,`(`,U.method===`onetap`?`One Tap`:U.method===`oauth`?`OAuth`:U.method===`cli`?`CLI`:`PAT`,`)`]})]}),(0,w.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{E(!1),m(`repositories`)},children:[(0,w.jsx)(T,{name:`folder`}),`Repositories`]}),(0,w.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{E(!1),_()},children:[(0,w.jsx)(T,{name:`settings`}),`Account details`]}),(0,w.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`is-danger`,onClick:()=>{E(!1),v()},children:[(0,w.jsx)(T,{name:`close`}),`Sign out`]})]}),(0,w.jsxs)(`button`,{ref:B,type:`button`,className:`wb-account-trigger`,title:U?`${U.name||U.username} (@${U.username})`:`Sign in with Google, GitHub, or GitLab`,"aria-label":U?`Account menu for ${U.name||U.username}`:`Sign in`,"aria-expanded":U&&!u?C:void 0,"aria-haspopup":U&&!u?`menu`:`dialog`,onClick:()=>{!U||u?(E(!1),u&&U&&y(),_()):E(e=>!e)},children:[(0,w.jsx)(`span`,{className:`wb-account-mini-avatar`+(U?` is-signed-in`:``),"aria-hidden":`true`,children:U?A(U):(0,w.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,w.jsx)(`path`,{d:`M5 20a7 7 0 0 1 14 0`})]})}),(0,w.jsxs)(`span`,{className:`wb-rail-label wb-account-trigger-copy`,children:[(0,w.jsx)(`strong`,{children:U?U.name||U.username:`Sign in`}),(0,w.jsx)(`small`,{children:U?`${U.provider===`google`?`Google`:U.provider===`github`?`GitHub`:`GitLab`} · ${U.method===`onetap`?`One Tap`:U.method===`oauth`?`OAuth`:U.method.toUpperCase()}`:`Google · GitHub · GitLab`})]})]})]}),(0,w.jsxs)(`div`,{className:`wb-rail-footer-row`,children:[(0,w.jsx)(M,{dark:l,collapsed:u,onClick:S}),(0,w.jsxs)(`div`,{className:`wb-local wb-rail-label`,children:[(0,w.jsxs)(`span`,{className:`wb-local-state`,children:[(0,w.jsx)(`span`,{className:`wb-state-dot`,"data-state":z?`error`:f?`ready`:`error`,"aria-hidden":`true`}),z?`Stopped`:f?`Online`:`Offline`]}),!z&&(0,w.jsxs)(`button`,{type:`button`,className:`wb-shutdown-btn${oe?` is-confirm`:``}`,title:oe?`Click again to shut down the local Studio server`:`Shut down local Studio server (or run npm run studio:stop)`,"aria-label":oe?`Confirm shut down Studio server`:`Shut down local Studio server`,disabled:R,onBlur:()=>L(!1),onClick:async()=>{if(!oe)L(!0);else{se(!0),L(!1);try{await d(`/api/studio/shutdown`,{}),ce(!0)}catch{ce(!0)}finally{se(!1)}}},children:[(0,w.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,w.jsx)(`path`,{d:`M12 2v10`}),(0,w.jsx)(`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`})]}),oe&&(0,w.jsx)(`span`,{children:`Stop?`})]})]})]})]})]})}var ne=[`hallmark`,`topo`,`isometric`,`crosshair`,`mesh`,`orbit`,`horizon`,`minimal`],re=[`indigo`,`crimson`,`orange`,`emerald`,`custom`],ie=[`manrope`,`editorial`,`system`,`grotesk`,`mono`,`handwritten`],I=[`default`,`strong`],ae=[`compact`,`default`,`large`],oe=`#4f46e5`,L=`#ec4899`,R=/^#[0-9a-f]{6}$/i;function se(e,t){return typeof e==`string`&&R.test(e.trim())?e.trim().toLowerCase():t}function z(e){let t=se(e,oe).slice(1),n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t.slice(0,2),16)),i=n(parseInt(t.slice(2,4),16)),a=n(parseInt(t.slice(4,6),16));return .2126*r+.7152*i+.0722*a>.42?`#0f172a`:`#ffffff`}function ce(e,t,n){let r=document.documentElement.style;if(e===`custom`){let e=se(t,oe),i=se(n,L);r.setProperty(`--custom-accent`,e),r.setProperty(`--custom-highlight`,i),r.setProperty(`--on-custom-action`,z(e))}else r.removeProperty(`--custom-accent`),r.removeProperty(`--custom-highlight`),r.removeProperty(`--on-custom-action`)}function le(e,t,n){let r=m.get(e);return r&&t.includes(r)?r:n}function B(){let e=m.get(`studio-backdrop`);return e===`aurora`?`mesh`:e===`prism`||e===`grid`?`isometric`:e===`spotlight`?`horizon`:e&&ne.includes(e)?e:`hallmark`}function V(){let e=m.get(`studio-typography`);return e===`swiss`?`grotesk`:e&&ie.includes(e)?e:`manrope`}function H(){let e=m.get(`studio-accent`);return e===`cobalt`?`crimson`:e&&re.includes(e)?e:`crimson`}function U(){let e=document.documentElement.dataset;e.theme=m.get(`studio-theme`)??`system`,e.contrast=le(`studio-contrast`,I,`default`),e.textScale=le(`studio-text-scale`,ae,`default`),e.motion=m.get(`studio-motion`)??m.get(`studio-workspace-motion-v2`)??!0?`on`:`off`,e.hoverEffects=m.get(`studio-hover-effects`)??!0?`on`:`off`,e.pageTransitions=m.get(`studio-page-transitions`)??!0?`on`:`off`,e.backdrop=B();let t=H();e.accent=t,e.typography=V(),ce(t,se(m.get(`studio-custom-accent`),oe),se(m.get(`studio-custom-highlight`),L))}function ue(e){let[t,n]=(0,i.useState)(()=>matchMedia(`(max-width:700px)`).matches?!0:m.get(`studio-sidebar-collapsed`)??!1),[r,a]=(0,i.useState)(()=>m.get(`studio-theme`)??`system`),[o,s]=(0,i.useState)(()=>matchMedia(`(prefers-color-scheme: dark)`).matches),[c,l]=(0,i.useState)(()=>m.get(`studio-motion`)??m.get(`studio-workspace-motion-v2`)??!0),[u,d]=(0,i.useState)(()=>m.get(`studio-hover-effects`)??!0),[f,p]=(0,i.useState)(()=>m.get(`studio-page-transitions`)??!0),[h,g]=(0,i.useState)(()=>B()),[_,v]=(0,i.useState)(()=>H()),[y,b]=(0,i.useState)(()=>se(m.get(`studio-custom-accent`),oe)),[x,S]=(0,i.useState)(()=>se(m.get(`studio-custom-highlight`),L)),C=e=>b(se(e,oe)),w=e=>S(se(e,L)),[T,E]=(0,i.useState)(()=>V()),[D,O]=(0,i.useState)(()=>le(`studio-contrast`,I,`default`)),[k,A]=(0,i.useState)(()=>le(`studio-text-scale`,ae,`default`)),ee=r===`dark`||r===`system`&&o;function j(){a(`system`),O(`default`),A(`default`),l(!0),d(!0),p(!0),g(`hallmark`),v(`crimson`),b(oe),S(L),E(`manrope`)}(0,i.useEffect)(()=>{m.set(`studio-sidebar-collapsed`,t)},[t]),(0,i.useEffect)(()=>{let e=matchMedia(`(max-width:700px)`),t=e=>{e.matches&&n(!0)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=matchMedia(`(max-width:700px)`),n,r=()=>{if(n?.(),n=void 0,e.matches&&!t){let e=window.scrollY,t=document.body.style.cssText;document.body.style.position=`fixed`,document.body.style.top=`-`+e+`px`,document.body.style.width=`100%`,document.body.style.overflow=`hidden`,n=()=>{document.body.style.cssText=t,window.scrollTo({top:e,behavior:`instant`})}}};return r(),e.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),n?.()}},[t]),(0,i.useEffect)(()=>{let e=matchMedia(`(prefers-color-scheme: dark)`),t=()=>s(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{document.documentElement.dataset.view=e?`review`:`prepare`;let t=()=>document.documentElement.dataset.pageHidden=String(document.hidden);t(),document.addEventListener(`visibilitychange`,t);let n=new IntersectionObserver(e=>{document.documentElement.dataset.auraVisible=String(e[0]?.isIntersecting??!1)}),r=document.querySelector(`.welcome-aura`);return r&&n.observe(r),()=>{n.disconnect(),document.removeEventListener(`visibilitychange`,t)}},[e]),(0,i.useEffect)(()=>{let e=e=>{e.key===`Escape`&&matchMedia(`(max-width:700px)`).matches&&!document.querySelector(`dialog[open]`)&&(n(!0),document.querySelector(`.wb-topbar .icon-button`)?.focus())};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[]);let M=(0,i.useRef)(!1);return(0,i.useLayoutEffect)(()=>{let e=document.documentElement;if(M.current&&e.dataset.theme!==r&&(e.dataset.themeSwitching=`true`),M.current=!0,e.dataset.theme=r,m.set(`studio-theme`,r),e.dataset.themeSwitching===`true`){let t=0,n=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{delete e.dataset.themeSwitching})});return()=>{cancelAnimationFrame(n),t&&cancelAnimationFrame(t),delete e.dataset.themeSwitching}}},[r]),(0,i.useLayoutEffect)(()=>{m.set(`studio-motion`,c),document.documentElement.dataset.motion=c?`on`:`off`},[c]),(0,i.useLayoutEffect)(()=>{m.set(`studio-hover-effects`,u),document.documentElement.dataset.hoverEffects=u?`on`:`off`},[u]),(0,i.useLayoutEffect)(()=>{m.set(`studio-page-transitions`,f),document.documentElement.dataset.pageTransitions=f?`on`:`off`},[f]),(0,i.useLayoutEffect)(()=>{m.set(`studio-backdrop`,h),document.documentElement.dataset.backdrop=h},[h]),(0,i.useLayoutEffect)(()=>{m.set(`studio-accent`,_),m.set(`studio-custom-accent`,y),m.set(`studio-custom-highlight`,x),document.documentElement.dataset.accent=_,ce(_,y,x)},[_,y,x]),(0,i.useLayoutEffect)(()=>{m.set(`studio-typography`,T),document.documentElement.dataset.typography=T},[T]),(0,i.useLayoutEffect)(()=>{m.set(`studio-contrast`,D),document.documentElement.dataset.contrast=D},[D]),(0,i.useLayoutEffect)(()=>{m.set(`studio-text-scale`,k),document.documentElement.dataset.textScale=k},[k]),{collapsed:t,setCollapsed:n,theme:r,setTheme:a,contrast:D,setContrast:O,textScale:k,setTextScale:A,motion:c,setMotion:l,hoverEffects:u,setHoverEffects:d,pageTransitions:f,setPageTransitions:p,resolvedDark:ee,backdrop:h,setBackdrop:g,accent:_,setAccent:v,customAccent:y,setCustomAccent:C,customHighlight:x,setCustomHighlight:w,typography:T,setTypography:E,resetAppearance:j}}function W(e){return e.phase===`model`?`auto`:e.phase===`validation`?`shield`:e.phase===`checking`?`capture`:e.tool===`read_file`?`component`:e.tool===`get_project_map`?`graph`:e.tool?.includes(`image`)||e.tool?.includes(`screenshot`)?`image`:e.tool===`check_color_contrast`?`palette`:`measure`}function G(e){return e.tool===`check_color_contrast`?`palette`:e.tool?.includes(`screenshot`)||e.tool?.includes(`image`)?`image`:e.tool===`read_file`||e.tool===`read_granted_file`||e.tool===`read_file_range`?`component`:e.tool===`get_project_map`||e.tool===`search_project`?`graph`:e.phase===`validate`||e.phase===`submit`?`shield`:e.phase===`check`?`capture`:e.source===`mcp`?`mcp`:`auto`}function de(e){let t=e.reduce((e,t)=>e+t.added,0),n=e.reduce((e,t)=>e+t.removed,0);return(0,w.jsxs)(`details`,{className:`activity-live-diff`,children:[(0,w.jsxs)(`summary`,{children:[(0,w.jsxs)(`span`,{children:[`Inspect live diff · `,e.length,` `,e.length===1?`file`:`files`]}),(0,w.jsxs)(`span`,{className:`activity-diff-totals`,children:[(0,w.jsxs)(`span`,{className:`activity-diff-add`,children:[`+`,t]}),(0,w.jsxs)(`span`,{className:`activity-diff-del`,children:[`-`,n]})]})]}),(0,w.jsx)(`div`,{className:`activity-diff-list`,children:e.map(e=>(0,w.jsxs)(`div`,{className:`activity-diff-file`,children:[(0,w.jsxs)(`div`,{className:`activity-diff-file-head`,children:[(0,w.jsx)(`code`,{children:e.path}),(0,w.jsxs)(`span`,{className:`activity-diff-meta`,children:[e.operation!==`replace`&&(0,w.jsx)(`span`,{className:`activity-diff-op`,children:e.operation}),e.binary?(0,w.jsx)(`span`,{children:`binary`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`activity-diff-add`,children:[`+`,e.added]}),(0,w.jsxs)(`span`,{className:`activity-diff-del`,children:[`-`,e.removed]})]})]})]}),e.lines.length>0&&(0,w.jsxs)(`pre`,{className:`activity-diff-code`,children:[e.lines.map((e,t)=>{let n=e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`;return(0,w.jsx)(`span`,{className:`activity-diff-line is-${n}`,children:e},t)}),e.truncated&&(0,w.jsx)(`span`,{className:`activity-diff-line is-ctx`,children:`… additional lines truncated`})]})]},e.path))})]})}function fe({record:e,attempt:t,liveFeed:n,draftPreview:r}){let[a,o]=(0,i.useState)(!0),[s,c]=(0,i.useState)(`desktop`),[l,u]=(0,i.useState)({loading:!1,proposalHash:null,url:null,reason:null}),f=(0,i.useRef)(null),p=e?.runId,m=!!e?.trustProject,h=r?.proposalHash??null,g=!!(r?.ready&&m&&p&&h);(0,i.useEffect)(()=>{f.current=null,u({loading:!1,proposalHash:null,url:null,reason:null})},[p]),(0,i.useEffect)(()=>{if(!g||!p||!h||f.current===h)return;f.current=h;let e=!1;return u(e=>({...e,loading:!0,proposalHash:h,reason:null})),d(`/api/workspace/${p}/draft-preview`,{}).then(t=>{e||(t.status===`ready`&&t.url?u({loading:!1,proposalHash:t.proposalHash??h,url:t.url,reason:null}):u({loading:!1,proposalHash:h,url:null,reason:t.reason??`Sandbox draft preview is not ready yet.`}))}).catch(t=>{e||u({loading:!1,proposalHash:h,url:null,reason:t instanceof Error?t.message:`Unable to refresh sandbox preview.`})}),()=>{e=!0}},[g,p,h]);let _=e?.stage===`checking`,v=[`failed`,`interrupted`,`cancelled`].includes(e?.stage??``),y=e?.execution===`mcp`,b=Array.isArray(n)?n:[],x=b.length>0,S=[...t?.steps??[]];_&&S.push({phase:`checking`,label:e?.progress??`Checking the local revision`}),S.length||S.push({phase:`preparing`,label:`Preparing your project context`});let C=S.at(-1),E=x?b.at(-1):null,D=[...S].reverse().find(e=>e.turn)?.turn,O=!x&&C.phase===`waiting`&&!v,k=E?E.phase===`validate`||E.phase===`check`||E.phase===`submit`||_:C.phase===`validation`||_,A=E?E.phase===`inspect`:C.tool===`read_file`||C.tool===`get_project_map`||C.tool===`get_workflow`||C.tool===`get_project_context`,ee=k?2:A?0:E||Number(D)>1?1:0,j=v?`Revision needs attention`:E?E.label:C.label,M=x?b.length:S.length,N=x?b.find(e=>typeof e.at==`number`)?.at:S.find(e=>typeof e.at==`number`)?.at,P=b.slice(0,-5),F=b.slice(-5),te=Math.max(0,b.length-F.length),ne=S.slice(0,-4),re=S.slice(-4),ie=Math.max(0,S.length-re.length);function I(e,t,n,r=!1){let i=typeof e.at==`number`&&typeof N==`number`&&e.at>=N?((e.at-N)/1e3).toFixed(1)+`s`:null;return(0,w.jsxs)(`li`,{"data-current":r||void 0,"data-status":e.status,children:[(0,w.jsx)(`span`,{className:`activity-step-icon`,children:(0,w.jsx)(T,{name:r||e.diffs?.length?G(e):`check`})}),(0,w.jsxs)(`div`,{className:`activity-step-body`,children:[(0,w.jsxs)(`div`,{className:`activity-step-head`,children:[(0,w.jsx)(`span`,{className:`activity-step-num`,"aria-hidden":`true`,children:String(n).padStart(2,`0`)}),(0,w.jsx)(`strong`,{children:e.label}),(0,w.jsx)(`span`,{className:`activity-source-pill`,children:e.source===`mcp`?`MCP`:e.source===`studio`?`Studio`:`Auto`}),e.tool&&(0,w.jsx)(`code`,{className:`activity-tool-badge`,children:e.tool})]}),(e.path||e.detail)&&(0,w.jsx)(`small`,{children:e.path?(0,w.jsx)(`code`,{className:`activity-step-path`,children:e.path}):e.detail}),e.diffs&&e.diffs.length>0&&de(e.diffs)]}),r?(0,w.jsx)(`span`,{className:`activity-now`,children:v?`Stopped`:`Live`}):i&&(0,w.jsxs)(`span`,{className:`activity-step-time`,"aria-hidden":`true`,children:[`+`,i]})]},e.id||t)}function ae(e,t,n,r=!1){let i=typeof e.at==`number`&&typeof N==`number`&&e.at>=N?((e.at-N)/1e3).toFixed(1)+`s`:null;return(0,w.jsxs)(`li`,{"data-current":r||void 0,children:[(0,w.jsx)(`span`,{className:`activity-step-icon`,children:(0,w.jsx)(T,{name:r?W(e):`check`})}),(0,w.jsxs)(`div`,{className:`activity-step-body`,children:[(0,w.jsxs)(`div`,{className:`activity-step-head`,children:[(0,w.jsx)(`span`,{className:`activity-step-num`,"aria-hidden":`true`,children:String(n).padStart(2,`0`)}),(0,w.jsx)(`strong`,{children:e.label}),e.tool&&(0,w.jsx)(`code`,{className:`activity-tool-badge`,children:e.tool})]}),(0,w.jsx)(`small`,{children:e.phase===`waiting`?e.retryAt?`Next request no earlier than ${new Intl.DateTimeFormat(void 0,{timeStyle:`medium`}).format(e.retryAt)}`:`Sharing this provider with another local request`:e.path?(0,w.jsx)(`code`,{className:`activity-step-path`,children:e.path}):e.turn?`Model turn ${e.turn}`:e.phase===`validation`?`Paths, source hashes and proposal format`:e.phase===`checking`?`Only the checks enabled for this project`:`Scoped workflow tool`})]}),r?(0,w.jsx)(`span`,{className:`activity-now`,children:v?`Stopped`:O?`Waiting`:`Now`}):i&&(0,w.jsxs)(`span`,{className:`activity-step-time`,"aria-hidden":`true`,children:[`+`,i]})]},t)}return(0,w.jsxs)(`section`,{className:`wb-activity`,"data-stopped":v||void 0,"aria-label":`Revision activity`,"aria-busy":!v&&e?.stage!==`waiting-client`,children:[(0,w.jsxs)(`header`,{children:[(0,w.jsx)(`span`,{className:`activity-live-icon`,children:(0,w.jsx)(T,{name:v?`shield`:_?`capture`:y?`mcp`:`auto`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{"aria-live":`polite`,children:j}),(0,w.jsxs)(`p`,{className:`activity-meta`,children:[v?`Model activity stopped`:_?`Local verification`:y?`Live MCP collaborator stream`:`Live model stream`,t?.model?` · ${t.model}`:``,` · ${M} ${M===1?`action`:`actions`}`]})]}),(0,w.jsx)(`span`,{className:`activity-turn`,children:v?`Needs attention`:O?`Waiting`:_?`Local checks`:y?`MCP live`:D?`Turn ${D}${e?.request?.maxModelTurns?` / ${e.request.maxModelTurns}`:``}`:`Live`})]}),(0,w.jsx)(`ol`,{className:`activity-stages`,"aria-label":`Revision stages`,children:[{label:`Understand`,icon:`graph`},{label:`Create`,icon:`auto`},{label:`Validate`,icon:`shield`}].map((e,t)=>(0,w.jsxs)(`li`,{"data-state":t<ee?`done`:t===ee?`active`:`next`,"aria-current":t===ee?`step`:void 0,children:[(0,w.jsx)(T,{name:t<ee?`check`:e.icon}),(0,w.jsx)(`span`,{children:e.label})]},e.label))}),x?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`ol`,{className:`activity-timeline`,"aria-label":`Live collaborator actions`,children:F.map((e,t)=>I(e,t,te+t+1,t===F.length-1))}),P.length>0&&(0,w.jsxs)(`details`,{className:`activity-earlier`,children:[(0,w.jsxs)(`summary`,{children:[`Earlier activity · `,P.length,` `,P.length===1?`action`:`actions`]}),(0,w.jsx)(`ol`,{className:`activity-timeline`,children:P.map((e,t)=>I(e,t,t+1))})]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`ol`,{className:`activity-timeline`,"aria-label":`Recent model actions`,children:re.map((e,t)=>ae(e,t,ie+t+1,t===re.length-1))}),ne.length>0&&(0,w.jsxs)(`details`,{className:`activity-earlier`,children:[(0,w.jsxs)(`summary`,{children:[`Earlier activity · `,ne.length,` `,ne.length===1?`action`:`actions`]}),(0,w.jsx)(`ol`,{className:`activity-timeline`,children:ne.map((e,t)=>ae(e,t,t+1))})]})]}),r&&(0,w.jsxs)(`section`,{className:`activity-draft-preview`,"aria-label":`Live sandbox draft preview`,children:[(0,w.jsxs)(`div`,{className:`activity-draft-preview-head`,children:[(0,w.jsxs)(`div`,{className:`activity-draft-preview-title`,children:[(0,w.jsx)(T,{name:`capture`}),(0,w.jsx)(`strong`,{children:`Live sandbox preview`}),(0,w.jsx)(`span`,{className:`activity-draft-badge`,children:`Originals untouched`}),(0,w.jsxs)(`span`,{className:`activity-diff-totals`,children:[(0,w.jsxs)(`span`,{className:`activity-diff-add`,children:[`+`,r.added]}),(0,w.jsxs)(`span`,{className:`activity-diff-del`,children:[`-`,r.removed]})]})]}),g&&(0,w.jsxs)(`div`,{className:`activity-draft-preview-controls`,children:[(0,w.jsxs)(`div`,{className:`activity-width-toggle`,role:`group`,"aria-label":`Preview viewport`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-pressed":s===`desktop`,onClick:()=>c(`desktop`),children:`Desktop`}),(0,w.jsx)(`button`,{type:`button`,"aria-pressed":s===`phone`,onClick:()=>c(`phone`),children:`Phone`})]}),(0,w.jsx)(`button`,{type:`button`,className:`activity-preview-toggle`,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Hide`:`Show`})]})]}),g?a&&(0,w.jsx)(`div`,{className:`activity-draft-stage`,"data-width":s,children:l.loading&&!l.url?(0,w.jsx)(`p`,{className:`activity-draft-note`,children:`Refreshing sandbox preview…`}):l.url?(0,w.jsx)(`iframe`,{src:l.url,title:`Live sandbox draft preview`,sandbox:`allow-scripts`,className:`activity-draft-iframe`},l.proposalHash??l.url):l.reason?(0,w.jsx)(`p`,{className:`activity-draft-note`,children:l.reason}):null}):(0,w.jsxs)(`p`,{className:`activity-draft-note`,children:[`Draft validated (`,r.filesChanged,` `,r.filesChanged===1?`file`:`files`,`). Trust this local project to auto-render validated drafts in an isolated sandbox preview.`]})]}),(0,w.jsxs)(`footer`,{children:[(0,w.jsx)(T,{name:`shield`}),(0,w.jsx)(`span`,{children:O?`Your context is saved. Stop generation cancels the wait.`:`Changes stay staged in a separate sandbox until you review and apply them.`})]})]})}var K=n();function pe({id:e,label:t,value:n,options:r,onChange:a,disabled:o=!1,searchable:s=!1,compact:c=!1,fitContent:l=!1}){let u=(0,i.useId)(),d=e??`choice-`+u,f=d+`-options`,p=(0,i.useRef)(null),m=(0,i.useRef)(null),h=(0,i.useRef)(null),g=(0,i.useRef)(null),[_,v]=(0,i.useState)(!1),[y,b]=(0,i.useState)(``),[x,S]=(0,i.useState)(0),[C,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(!1),[k,A]=(0,i.useState)(null),ee=(0,i.useRef)({text:``,at:0}),j=(0,i.useMemo)(()=>r.find(e=>e.value===n),[r,n]),M=y.toLowerCase(),N=(0,i.useMemo)(()=>s&&M?r.filter(e=>(e.label+` `+(e.description??``)).toLowerCase().includes(M)):r,[r,s,M]),P=(0,i.useMemo)(()=>N.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[N]),F=(0,i.useCallback)(()=>{let e=m.current?.getBoundingClientRect();if(!e)return;let t=Math.max(0,window.innerHeight-e.bottom-12),n=Math.max(0,e.top-12),r=t<290&&n>t,i=Math.min(Math.max(e.width,272),Math.min(400,window.innerWidth-24)),a=e.left+i>window.innerWidth-12&&e.right>240,o=a?Math.max(12,e.right-i):Math.min(e.left,window.innerWidth-i-12),s=Math.max(120,(r?n:t)-8);E(r),O(a),A({position:`fixed`,left:`${Math.round(o)}px`,width:`${Math.round(i)}px`,...r?{bottom:`${Math.round(window.innerHeight-e.top+8)}px`,top:`auto`}:{top:`${Math.round(e.bottom+8)}px`,bottom:`auto`},"--select-max-h":`${Math.min(300,Math.floor(s-16))}px`})},[]);function te(e=!1){v(!1),b(``),e&&m.current?.focus()}function ne(e){S(e),requestAnimationFrame(()=>{let t=document.getElementById(f+`-`+e);t?.focus(),t?.scrollIntoView({block:`nearest`})})}function re(){o||(F(),b(``),S(Math.max(0,r.findIndex(e=>e.value===n))),v(!0))}(0,i.useEffect)(()=>{if(!_)return;F();let e=Math.max(0,r.findIndex(e=>e.value===n));s?g.current?.focus():ne(e);let t=e=>{let t=e.target;!p.current?.contains(t)&&!h.current?.contains(t)&&te()},i=()=>F();return document.addEventListener(`pointerdown`,t),window.addEventListener(`resize`,i,{passive:!0}),window.addEventListener(`scroll`,i,{passive:!0,capture:!0}),()=>{document.removeEventListener(`pointerdown`,t),window.removeEventListener(`resize`,i),window.removeEventListener(`scroll`,i,!0)}},[_,F]),(0,i.useEffect)(()=>{o&&te()},[o]);function ie(e){e.disabled||(a(e.value),te(!0))}function I(e){if(e.key===`Tab`)te();else if(e.key===`Escape`&&_)e.preventDefault(),e.stopPropagation(),te(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&!(e.target===g.current&&[`Home`,`End`].includes(e.key))){if(e.preventDefault(),!_){re();return}let t=P.indexOf(x),n=e.key===`Home`?P[0]:e.key===`End`?P.at(-1):P[(t+(e.key===`ArrowDown`?1:-1)+P.length)%P.length];n!==void 0&&ne(n)}else if(_&&e.key===`Enter`)e.preventDefault(),N[x]&&ie(N[x]);else if(e.target!==g.current){if(e.key===` `)e.preventDefault(),_&&N[x]?ie(N[x]):re();else if(e.key.length===1&&!e.ctrlKey&&!e.metaKey){e.preventDefault();let t=Date.now(),n=(t-ee.current.at>700?``:ee.current.text)+e.key.toLowerCase();ee.current={text:n,at:t};let i=(_?N:r).findIndex(e=>!e.disabled&&e.label.toLowerCase().startsWith(n));i>=0&&(_?ne(i):a(r[i].value))}}}return(0,w.jsxs)(`div`,{className:`select-control `+(c?`is-compact `:``)+(l?`is-fit`:``),ref:p,onKeyDown:I,"data-open":_,"data-side":C?`above`:`below`,"data-align":D?`end`:`start`,children:[(0,w.jsxs)(`button`,{type:`button`,id:d,ref:m,role:`combobox`,"aria-label":t,"aria-haspopup":`listbox`,"aria-expanded":_,"aria-controls":f,disabled:o,className:`select-trigger`,onClick:()=>_?te():re(),children:[j?.icon,(0,w.jsx)(`span`,{children:j?.label??`Choose…`}),(0,w.jsx)(T,{name:`chevron`})]}),_&&k&&(0,K.createPortal)((0,w.jsxs)(`div`,{ref:h,className:`select-popover`,"data-side":C?`above`:`below`,"data-align":D?`end`:`start`,style:k,onKeyDown:I,children:[s&&(0,w.jsx)(`div`,{className:`select-search`,children:(0,w.jsx)(`input`,{ref:g,type:`search`,name:d+`-filter`,autoComplete:`off`,"aria-label":`Filter `+t,placeholder:`Filter ${t.toLowerCase()}…`,value:y,onChange:e=>{b(e.target.value),S(0)}})}),(0,w.jsxs)(`div`,{role:`listbox`,id:f,"aria-label":t,className:`select-options`,children:[N.map((e,t)=>(0,w.jsxs)(`button`,{type:`button`,role:`option`,id:f+`-`+t,"aria-selected":e.value===n,"aria-disabled":e.disabled||void 0,tabIndex:-1,className:`select-option`,"data-active":t===x,onPointerMove:()=>S(t),onClick:()=>ie(e),children:[e.icon,(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.label}),e.description&&(0,w.jsx)(`small`,{children:e.description})]}),e.value===n&&(0,w.jsx)(T,{name:`check`})]},e.value)),!N.length&&(0,w.jsx)(`p`,{className:`select-empty`,role:`status`,children:`No matching options.`})]})]}),m.current?.closest(`dialog`)??document.body)]})}var me=[`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`,`audio/mp4`];function he(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=()=>n(Error(`Could not read the recording. Try again.`)),r.readAsDataURL(e)})}function ge(e){return e.replace(/\s+/g,` `).replace(/\s+([,.;:!?])/g,`$1`).trim()}function _e(e,t){let n=(0,i.useRef)(null),[r,a]=(0,i.useState)(`idle`),[o,s]=(0,i.useState)(``),[c,l]=(0,i.useState)(!1),[u,f]=(0,i.useState)(0),[p,m]=(0,i.useState)(0),[h,g]=(0,i.useState)(``),[_,v]=(0,i.useState)(),y=()=>n.current?.cancel();(0,i.useEffect)(()=>()=>n.current?.cancel(),[]);async function b(r=!1){if(n.current)return;let i=window,o=i.SpeechRecognition??i.webkitSpeechRecognition;if(!r&&!o){v(void 0),g(e?`Browser dictation is unavailable. You can record with your connected provider.`:`Browser dictation is unavailable. Connect Groq or Google AI Studio in Settings.`);return}let c=r;if(c&&(!e||!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`)){g(`Voice input is unavailable. Use a browser with speech recognition or connect Groq or Google AI Studio in Settings.`);return}g(``),s(``),m(0),f(0),v(c?e:void 0),a(`starting`);let u=new AbortController,p,h,_,y,b=0,x,S,C=``,w=``,T=!1,E=()=>n.current===k,D=()=>{window.clearInterval(S);let e=Date.now();S=window.setInterval(()=>{E()&&!T&&m(Math.floor((Date.now()-e)/1e3))},500)},O=(e=``,r=``)=>{if(!E())return;n.current=null,window.clearTimeout(x),window.clearInterval(S),window.cancelAnimationFrame(b),u.abort();try{p?.abort()}catch{}if(h?.state===`recording`)try{h.stop()}catch{}_?.getTracks().forEach(e=>e.stop()),y&&y.close().catch(()=>{});let i=ge(e);i&&t(i),l(!1),f(0),m(0),s(``),g(r),a(`idle`)},k={cancel:()=>O(),stop:()=>{if(!T){if(!p&&!h)O();else{T=!0,window.clearInterval(S),l(!1),f(0),a(c?`transcribing`:`finishing`),window.clearTimeout(x),x=window.setTimeout(()=>O(C||w,`Voice input timed out. Try again.`),c?3e4:3e3);try{p?.stop(),h?.state===`recording`&&h.stop()}catch{O(C||w,`Voice input ended unexpectedly. Try again.`)}}}}};n.current=k,x=window.setTimeout(()=>O(``,`The microphone did not start. Check permissions and try again.`),15e3);try{if(!c&&o){p=new o,p.continuous=!0,p.interimResults=!0,p.lang=navigator.language||`en-US`,p.onstart=()=>{E()&&!T&&(window.clearTimeout(x),D(),a(`listening`))},p.onsoundstart=()=>{E()&&!T&&l(!0)},p.onsoundend=()=>{E()&&l(!1)},p.onresult=({results:e})=>{if(!E())return;let t=Array.from(e);C=ge(t.filter(e=>e.isFinal).map(e=>e[0].transcript.trim()).filter(Boolean).join(` `)),w=ge(t.map(e=>e[0].transcript.trim()).filter(Boolean).join(` `)),s(w)},p.onerror=({error:e})=>{O(C,e===`not-allowed`||e===`service-not-allowed`?`Microphone access was blocked. Check browser permissions or try a connected provider.`:e===`no-speech`?`No speech detected. Try again.`:e===`network`?`Browser speech service could not be reached. Try recording with your connected provider.`:`Browser speech recognition stopped. Try again or use a connected provider.`)},p.onend=()=>{let e=C||(T?w:``);O(e,e?``:`No speech detected. Try again.`)},p.start();return}let t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});if(!E()){t.getTracks().forEach(e=>e.stop());return}_=t;let n=me.find(e=>MediaRecorder.isTypeSupported(e));h=new MediaRecorder(_,n?{mimeType:n,audioBitsPerSecond:48e3}:void 0);let r=[];h.ondataavailable=({data:e})=>{e.size&&r.push(e)},h.onerror=()=>O(``,`Recording failed. Check the microphone and try again.`),h.onstop=async()=>{if(_?.getTracks().forEach(e=>e.stop()),!E())return;if(!T){O(``,`Recording ended unexpectedly. Try again.`);return}let t=h?.mimeType.split(`;`)[0]||r[0]?.type.split(`;`)[0]||`audio/webm`,n=new Blob(r,{type:t});if(!n.size)O(``,`No audio recorded. Try again.`);else try{let r=await he(n);if(!E())return;let{text:i}=await d(`/api/workspace/transcribe`,{base64:r,mimeType:t,providerId:e,language:navigator.language||void 0},u.signal),a=ge(i);O(a,a?``:`No speech detected. Try again.`)}catch(e){O(``,e instanceof Error?e.message:`Transcription failed. Try again.`)}},h.start(250),window.clearTimeout(x),D(),x=window.setTimeout(k.stop,9e4),a(`listening`);try{y=new AudioContext;let e=y.createAnalyser();e.fftSize=256,y.createMediaStreamSource(_).connect(e);let t=new Uint8Array(e.fftSize),n=!1,r=0,i=()=>{if(!E()||T)return;e.getByteTimeDomainData(t);let a=t.reduce((e,t)=>e+((t-128)/128)**2,0),o=Math.sqrt(a/t.length),s=o>(n?.016:.028);s!==n&&l(n=s);let c=Math.min(1,o*6.5);r+=(c-r)*.25,f(Number(r.toFixed(2))),b=window.requestAnimationFrame(i)};y.resume().catch(()=>{}),i()}catch{}}catch(e){O(``,e instanceof DOMException&&e.name===`NotAllowedError`?`Microphone access was blocked. Check browser permissions and try again.`:`Could not start voice input. Check the microphone and try again.`)}}return{phase:r,transcript:o,speaking:c,level:u,elapsedSec:p,error:h,recordingProvider:_,start:b,cancel:y,stop:()=>n.current?.stop(),busy:r!==`idle`}}var ve=`/assets/favicon-DEEp3F3I.svg`,ye=`/assets/favicon-dark-DTt3EXps.svg`,be=`/assets/favicon-working-light-FSpvvqYX.svg`,xe=`/assets/favicon-working-dark-Cnqu2E1n.svg`,Se=`/assets/favicon-ready-light-CXR6IkJ-.svg`,Ce=`/assets/favicon-ready-dark-Co62sn6D.svg`,we=`/assets/favicon-attention-light-5AVmcTNE.svg`,Te=`/assets/favicon-attention-dark-CqGmRsW4.svg`;function Ee({dark:e,stage:t,opening:n}){(0,i.useEffect)(()=>{let r=[`preparing`,`generating`,`checking`].includes(t??``),i=[`ready`,`applied`,`rolled-back`].includes(t??``),a=t===`failed`,o=r?e?xe:be:i?e?Ce:Se:a?e?Te:we:e?ye:ve,s=document.querySelector(`link[rel="icon"]`);s&&(s.href=o,s.dataset.taskState=r?`working`:i?`ready`:a?`attention`:`idle`,s.dataset.theme=e?`dark`:`light`);let c=document.querySelector(`meta[name="theme-color"]`);c&&(c.content=e?`#15151a`:`#f5f5f7`),document.title=(n?`Opening revision…`:r?`Working…`:i?t===`applied`?`Changes applied`:t===`rolled-back`?`Changes undone`:`Ready for review`:a?`Needs attention`:t===`waiting-client`?`Waiting for MCP`:`Your design workspace`)+` · Studio`},[e,t,n])}function De(e){let t=e-Date.now();if(t<=0)return{label:`Expired`,state:`expired`};let n=Math.ceil(t/6e4);if(n<=15)return{label:`Expiring soon · ${n}m left`,state:`expiring`};let r=Math.floor(n/60),i=n%60;return{label:r>0?`Scope active · ${r}h ${i}m left`:`Scope active · ${i}m left`,state:`active`}}function Oe(e,t,n){return n?`done`:t.state===`waiting`?e===0?`active`:`pending`:t.state===`publishing`?e===0?`done`:e===1?`active`:`pending`:t.state===`checking`?e<2?`done`:e===2?`active`:`pending`:t.state===`blocked`||t.state===`interrupted`?e<2?`done`:e===2?`blocked`:`pending`:t.state===`passed`?e<3?`done`:`active`:`pending`}function ke({live:e,liveActive:t,checkedBatch:n,previewAvailable:r,dependenciesMissing:a,installingDeps:o,files:s,busy:c,previewOpen:l,clientConnection:u,blockedReason:d,repairHints:f,copiedKind:p,canUndoBatch:m,onUndoBatch:h,onViewChanges:g,onCopyPrompt:_,onCopyHandoff:v,onConnectClient:y,onTogglePreview:b,onNextBatch:x,onRecheckLive:S,onInstallAndRecheck:C,onRevoke:E}){let[D,O]=(0,i.useState)(!1),k=t&&(e.state===`publishing`||e.state===`checking`),A=e.revoked?{label:`Access revoked`,state:`revoked`}:De(e.expiresAt),ee=(f??[]).slice(0,5),j=[{key:`submit`,label:`Client sends`},{key:`publish`,label:`Write & back up`},{key:`check`,label:`Build & check`},{key:`next`,label:`Next batch`}];async function M(){let t=[`Fix the check failure on live batch ${e.batch}:`,...d?[`Error: ${d}`]:[],...ee.map((e,t)=>`${t+1}. [${e.code}] ${e.path?`${e.path}${e.line?`:${e.line}`:``} — `:``}${e.hint}`)];await navigator.clipboard?.writeText(t.join(`
|
|
9
9
|
`)).catch(()=>{}),O(!0),window.setTimeout(()=>O(!1),1800)}return(0,w.jsxs)(`section`,{className:`wb-task-recovery wb-live-batch`,"aria-label":`Live editing`,children:[(0,w.jsxs)(`div`,{className:`wb-live-heading`,children:[(0,w.jsx)(`span`,{className:`wb-live-indicator`,"data-active":k,"data-state":e.revoked?`revoked`:n?`passed`:e.state,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:n?`check`:`graph`})}),(0,w.jsxs)(`div`,{className:`wb-live-heading-copy`,children:[(0,w.jsxs)(`h2`,{children:[`Live editing · Batch `,e.batch]}),(0,w.jsx)(`p`,{className:`wb-live-status`,"data-status":n&&t?`published`:e.state===`blocked`?`blocked`:void 0,role:`status`,children:e.revoked?`Live access revoked.`:t?n?e.nextRunId?`Published · next batch opened`:`Published · ready for next batch`:{waiting:`Ready for your AI client to send this batch.`,publishing:`Writing files with automatic undo backups…`,checking:`Running build and browser checks on the updated files…`,passed:`Batch was changed or undone.`,blocked:`Checks failed. Fix and recheck, or undo this batch below.`,interrupted:`Studio stopped before this batch finished.`}[e.state]:`Live access expired.`})]})]}),(0,w.jsxs)(`div`,{className:`wb-live-meta`,"aria-label":`Live connection and scope status`,children:[(0,w.jsxs)(`span`,{className:`wb-live-pill`,"data-tone":u?u.taskAccessed?`ready`:`active`:`warn`,children:[(0,w.jsx)(T,{name:`mcp`}),u?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`strong`,{children:u.clientName}),(0,w.jsx)(`code`,{translate:`no`,children:u.serverName}),(0,w.jsx)(`span`,{children:u.taskAccessed?`· active`:`· attached`})]}):(0,w.jsx)(`span`,{children:`No Design client attached`})]}),(0,w.jsxs)(`span`,{className:`wb-live-pill`,"data-tone":A.state,children:[(0,w.jsx)(T,{name:`shield`}),(0,w.jsx)(`span`,{children:A.label})]})]}),(0,w.jsx)(`ol`,{className:`wb-live-timeline`,"aria-label":`Batch progress`,children:j.map((t,r)=>{let i=Oe(r,e,n);return(0,w.jsxs)(`li`,{"data-step-state":i,children:[(0,w.jsx)(`span`,{className:`wb-live-step-num`,"aria-hidden":`true`,children:r+1}),(0,w.jsx)(`span`,{children:t.label})]},t.key)})}),n&&(0,w.jsxs)(`div`,{className:`wb-live-guidance is-ready`,children:[(0,w.jsx)(`p`,{className:`wb-live-check-note`,children:`Batch verified — build and checks passed.`}),(0,w.jsx)(`p`,{className:`field-help`,children:e.nextRunId?`Batch ${e.batch+1} is already open. Switch to it below or keep inspecting this preview.`:`Open the next batch below to keep iterating, or let your AI client advance automatically.`})]}),t&&e.state===`waiting`&&(0,w.jsx)(`div`,{className:`wb-live-guidance`,children:(0,w.jsx)(`p`,{className:`field-help`,children:u?`Copy the prompt below and paste it into ${u.clientName}. Studio writes, checks, and backs up each batch automatically.`:`Connect a local AI client (Cursor, Antigravity, Claude Desktop, Claude Code, or Codex) to edit these files live.`})}),e.state===`blocked`&&(0,w.jsxs)(`div`,{className:`wb-live-recovery-card`,role:`region`,"aria-label":`Batch recovery details`,children:[(0,w.jsxs)(`div`,{className:`wb-live-recovery-head`,children:[(0,w.jsx)(`strong`,{children:a?`Dependencies missing for local checks`:`Checks failed — review before continuing`}),d&&(0,w.jsx)(`p`,{children:d})]}),ee.length>0&&(0,w.jsx)(`ul`,{className:`wb-live-hints`,"aria-label":`Actionable repair hints`,children:ee.map((e,t)=>(0,w.jsxs)(`li`,{"data-severity":e.severity,children:[(0,w.jsx)(`span`,{className:`wb-live-hint-code`,children:e.code}),e.path&&(0,w.jsxs)(`code`,{translate:`no`,children:[e.path,e.line?`:${e.line}`:``]}),(0,w.jsx)(`span`,{children:e.hint})]},`${e.code}-${t}`))}),(0,w.jsxs)(`div`,{className:`wb-live-recovery-foot`,children:[(0,w.jsx)(`p`,{className:`field-help`,children:`Originals are backed up. Fix and recheck, copy the error prompt to your AI client, or undo this batch.`}),(ee.length>0||d)&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>void M(),children:D?`Copied fix prompt`:`Copy fix prompt`})]})]}),s.length>0&&(0,w.jsx)(`ul`,{className:`wb-live-files`,"aria-label":`Batch file activity`,children:s.map(({path:e,status:t,summary:n})=>(0,w.jsxs)(`li`,{"data-file-status":t,title:n,children:[g?(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:g,children:(0,w.jsx)(`code`,{translate:`no`,children:e})}):(0,w.jsx)(`code`,{translate:`no`,children:e}),(0,w.jsx)(`span`,{children:t})]},e))}),(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsxs)(`summary`,{children:[`Editable files · `,e.paths.length,` `,e.paths.length===1?`file`:`files`]}),(0,w.jsx)(`ul`,{className:`wb-paths`,children:e.paths.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsx)(`code`,{translate:`no`,children:e})},e))})]}),(t||n||r||v||m)&&(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[n&&(t||e.nextRunId)&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:c,onClick:()=>x(!1),children:e.nextRunId?`Open batch ${e.batch+1}`:`Open next batch`}),u&&!e.nextRunId&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:c,onClick:()=>x(!0),children:`Next batch & copy prompt`})]}),r&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:c,"aria-expanded":l,"aria-controls":`review-content`,onClick:b,children:l?`Hide batch preview`:`Preview published batch`}),e.state===`blocked`&&t&&(C||S)&&(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:c||o,onClick:a&&C?C:S,children:o?`Installing dependencies…`:a?`Install deps & recheck`:`Recheck live`}),t&&u&&_&&(0,w.jsx)(`button`,{type:`button`,className:e.state===`waiting`?`button primary`:`button subtle`,disabled:c,onClick:_,children:`Copy task prompt`}),t&&!u&&y&&(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:c,onClick:y,children:`Connect AI client`}),m&&h&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:c,onClick:h,children:`Undo batch`}),v&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,disabled:c,onClick:v,children:`Copy handoff`}),t&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,disabled:c,onClick:E,children:`Revoke live access`})]}),p&&(0,w.jsx)(`p`,{className:`wb-live-copy-status`,role:`status`,children:p===`prompt`?`Client task prompt copied.`:`Run handoff copied.`})]})}var Ae=[`Keep existing content and navigation`,`Keep keyboard controls working`,`Preserve saved state and storage fallback`,`Keep forms and validation working`,`Preserve URLs, filters and deep links`,`Keep mobile layouts usable`,`Preserve accessibility labels and focus order`,`Keep existing dependencies unchanged`],je=[{label:`Click -> state`,value:`click: button -> [role="dialog"]`},{label:`Hover -> menu`,value:`hover: nav a`},{label:`Type input`,value:`type: input = "demo"`},{label:`Tab focus`,value:`keyboard: button`},{label:`Anchor jump`,value:`anchor: #details`},{label:`Text match`,value:`text: h1 *= "Overview"`}];function Me(e,t){let n=e.split(`
|
|
10
10
|
`).map(e=>e.trim()).filter(Boolean);return(n.includes(t)?n.filter(e=>e!==t):n.length<30?[...n,t]:n).join(`
|
|
11
|
-
`)}var Ne=[`Give your interface a new direction.`,`Refine the details. Keep the behavior.`,`Make your next idea feel finished.`],Pe=(0,i.memo)(function({motion:e,active:t}){let[n,r]=(0,i.useState)(Ne[0]),a=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let n=matchMedia(`(prefers-reduced-motion: reduce)`),i,o=!0,s=0,c=0,l=`type`,u=!1,d=()=>e&&t&&!n.matches&&!document.hidden&&o;function f(){if(u||!d())return;let e=Ne[s],t=45;l===`type`?(c++,r(e.slice(0,c)),c>=e.length&&(l=`hold`,t=2400)):l===`hold`?(l=`erase`,t=28):(c--,r(e.slice(0,Math.max(c,0))),t=22,c<=0&&(s=(s+1)%Ne.length,l=`type`,t=220)),i=setTimeout(f,t)}function p(){clearTimeout(i),!e||!t||n.matches?r(Ne[0]):d()&&(i=setTimeout(f,180))}let m=new IntersectionObserver(e=>{o=e[0]?.isIntersecting??!1,a.current&&(a.current.dataset.inView=String(o)),p()});return a.current&&m.observe(a.current),n.addEventListener(`change`,p),document.addEventListener(`visibilitychange`,p),e&&t&&!n.matches&&r(``),p(),()=>{u=!0,clearTimeout(i),m.disconnect(),n.removeEventListener(`change`,p),document.removeEventListener(`visibilitychange`,p)}},[e,t]),(0,w.jsxs)(`div`,{className:`welcome-heading`,ref:a,"data-active":e&&t,children:[(0,w.jsxs)(`h1`,{className:`studio-hero-title`,children:[`What’s your next `,(0,w.jsx)(`span`,{className:`welcome-accent`,children:`revision`}),`?`]}),(0,w.jsxs)(`p`,{className:`welcome-subtitle page-reveal page-reveal--support`,children:[(0,w.jsx)(`span`,{className:`sr-only`,children:`Give your interface a new direction. Keep what makes it work.`}),(0,w.jsxs)(`span`,{className:`typed-copy`,"aria-hidden":`true`,children:[n,(0,w.jsx)(`span`,{className:`typing-caret`})]})]})]})});function Fe(e,t,n){if(!t)return n;try{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return[n[0],n[1],n[2]]}catch{return n}}var Ie=(0,i.memo)(function({motion:e=!0,hoverEffects:t=!0,variant:n=`backdrop`,spacing:r=24,offsetX:a=0,offsetY:o=0}){let s=(0,i.useRef)(null),c=(0,i.useRef)({x:a,y:o});c.current.x=a,c.current.y=o;let l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{l.current?.()},[a,o]),(0,i.useEffect)(()=>{let i=s.current,a=i?.parentElement;if(!i||!a)return;let o=document.documentElement,u=window.matchMedia(`(prefers-reduced-motion: reduce)`),d=window.matchMedia(`(pointer: coarse)`),f=i.getContext(`2d`);if(!f)return;let p=document.createElement(`canvas`);p.width=1,p.height=1;let m=p.getContext(`2d`,{willReadFrequently:!0}),h=document.createElement(`canvas`),g=h.getContext(`2d`),_=``,v=0,y=0,b=1,x=null,S=0,C=!1,w=!1,T=0,E=0,D=0,O=0,k=0,A=0,ee=0,j=[],M=[148,163,184],N=[200,9,9],P=[194,0,48],F=!1,te=new Set([`hallmark`,`isometric`,`crosshair`,`mesh`,`orbit`,`horizon`]),ne=`hallmark`,re=!1,ie=!1,I=()=>n===`canvas`?`hallmark`:o.dataset.backdrop||`hallmark`,ae=()=>(ne=I(),n===`canvas`?u.matches||d.matches||!e||o.dataset.motion===`off`?!1:(re=!1,ie=!0,!0):te.has(ne)?ne===`hallmark`?u.matches||d.matches||!t||o.dataset.hoverEffects===`off`?!1:(re=!1,ie=!0,!0):(re=e&&o.dataset.motion!==`off`&&!u.matches,ie=t&&o.dataset.hoverEffects!==`off`&&!u.matches&&!d.matches,!0):!1),oe=()=>{let e=window.getComputedStyle(i),t=o.dataset.theme;F=t===`dark`||t!==`light`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,m&&(N=Fe(m,e.color,[200,9,9]),P=Fe(m,e.borderTopColor,[194,0,48]),M=Fe(m,e.caretColor,F?[226,232,240]:[15,23,42])),_=``},L=()=>{x=i.getBoundingClientRect()},R=()=>{let e=a.getBoundingClientRect();x=e;let t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height)),r=Math.min(window.devicePixelRatio||1,2);if(t===v&&n===y&&r===b)return!1;v=t,y=n,b=r;let o=Math.round(v*b),s=Math.round(y*b);return i.width=o,i.height=s,f.setTransform(b,0,0,b,0,0),h.width=o,h.height=s,g?.setTransform(b,0,0,b,0,0),_=``,!0},se=(e,t,n,i)=>{if(!g)return;let a=`${v}x${y}@${b}:${e.toFixed(1)},${t.toFixed(1)}:${M.join(`,`)}:${i}`;if(a!==_){_=a,g.clearRect(0,0,v,y),g.beginPath();for(let i=t;i<=y+r;i+=r)for(let t=e;t<=v+r;t+=r)g.moveTo(t+n,i),g.arc(t,i,n,0,Math.PI*2);g.fillStyle=`rgba(${M[0]}, ${M[1]}, ${M[2]}, ${i})`,g.fill()}},z=(e,t,n)=>Math.round(e+(t-e)*n),ce=e=>{f.clearRect(0,0,v,y);let t=re?e*.001:1.85,n=N[0],r=N[1],i=N[2],a=P[0],o=P[1],s=P[2],c=M[0],l=M[1],u=M[2],d=ie&&k>.01,p=ie&&j.length>0,m=(e,t)=>{let n=(e-v*.5)/Math.max(1,v*.34),r=(t-y*.44)/Math.max(1,y*.28);return Math.min(1,Math.max(.22,(Math.hypot(n,r)-.35)/.85))};if(ne===`isometric`){let h=27.7,g=Math.ceil(v/48)+2,_=Math.ceil(y/h)+2;f.lineWidth=1,f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.095:.085})`,f.beginPath();for(let e=-1;e<=_;e++){let t=e*h,n=(e&1)*24;for(let e=-1;e<=g;e++){let r=e*48+n;f.moveTo(r,t-h*.5),f.lineTo(r+24,t),f.lineTo(r,t+h*.5),f.lineTo(r-24,t),f.closePath()}}f.stroke();for(let c=0;c<=_;c++){let l=c*h,u=(c&1)*24;for(let _=0;_<=g;_++){let g=_*48+u,v=Math.abs(Math.sin(_*12.9898+c*78.233)*43758.5453)%1,y=.5+.5*Math.sin(_*.42+c*.31-t*.85+v*Math.PI*2),b=m(g,l),x=v>.77?(.045+y*.095)*b:0,S=0;if(d){let e=Math.hypot(T-g,E-l);if(e<225){let t=1-e/225;S=Math.max(S,t*t*(3-2*t)*k)}}if(p)for(let t=0;t<j.length;t++){let n=j[t],r=(e-n.start)/680,i=Math.abs(Math.hypot(g-n.x,l-n.y)-r*340);i<40&&(S=Math.max(S,(1-i/40)*(1-r)*.8))}let C=x+S*(F?.34:.24);if(C>.02){let e=v>.89,t=e?a:n,c=e?o:r,u=e?s:i;f.beginPath(),f.moveTo(g,l-h*.5),f.lineTo(g+24,l),f.lineTo(g,l+h*.5),f.lineTo(g-24,l),f.closePath(),f.fillStyle=`rgba(${t}, ${c}, ${u}, ${Math.min(.45,C).toFixed(3)})`,f.fill(),(S>.14||C>.11)&&(f.strokeStyle=`rgba(${t}, ${c}, ${u}, ${Math.min(.68,C*1.9).toFixed(3)})`,f.lineWidth=S>.3?1.35:1,f.stroke())}}}}else if(ne===`crosshair`){let t=Math.max(48,Math.min(110,Math.round(v*.068))),x=Math.ceil(v/38),S=Math.ceil(y/38),C=Math.round((v-x*38)*.5+19),w=Math.round((y-S*38)*.5+19),D=`cross:${v}x${y}@${b}:${+!!F}:${M.join(`,`)}:${n},${r},${i}`;if(g&&_!==D){_=D,g.clearRect(0,0,v,y),g.lineCap=`round`,g.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.13:.12})`,g.lineWidth=1,g.beginPath(),g.moveTo(t+.5,0),g.lineTo(t+.5,y),g.moveTo(v-t+.5,0),g.lineTo(v-t+.5,y);for(let e=32;e<y;e+=76)g.moveTo(t-4,e+.5),g.lineTo(t+5,e+.5),g.moveTo(v-t-4,e+.5),g.lineTo(v-t+5,e+.5);g.stroke(),g.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.16:.15})`,g.lineWidth=1,g.beginPath();for(let e=0;e<=S;e++){let t=w+e*38;for(let n=0;n<=x;n++){if(n%4==0&&e%4==0)continue;let r=C+n*38;m(r,t)<.32||(g.moveTo(r-3.5,t+.5),g.lineTo(r+3.5,t+.5),g.moveTo(r+.5,t-3.5),g.lineTo(r+.5,t+3.5))}}g.stroke(),g.strokeStyle=`rgba(${z(c,n,.5)}, ${z(l,r,.5)}, ${z(u,i,.5)}, ${F?.38:.34})`,g.lineWidth=1.25,g.beginPath();for(let e=0;e<=S;e+=4){let t=w+e*38;for(let e=0;e<=x;e+=4){let n=C+e*38;m(n,t)<.28||(g.moveTo(n-5.2,t+.5),g.lineTo(n+5.2,t+.5),g.moveTo(n+.5,t-5.2),g.lineTo(n+.5,t+5.2))}}g.stroke()}if(f.drawImage(h,0,0,v,y),d||p){let t=v+38,m=-38,h=y+38,g=-38;if(d){t=Math.min(t,T-215),m=Math.max(m,T+215),h=Math.min(h,E-215),g=Math.max(g,E+215);let e=f.createRadialGradient(T,E,0,T,E,215);e.addColorStop(0,`rgba(${n}, ${r}, ${i}, ${(F?.13:.085)*k})`),e.addColorStop(.55,`rgba(${a}, ${o}, ${s}, ${(F?.045:.03)*k})`),e.addColorStop(1,`rgba(0,0,0,0)`),f.fillStyle=e,f.fillRect(T-215,E-215,430,430)}for(let n=0;n<j.length;n++){let r=j[n],i=(e-r.start)/680*340+40;t=Math.min(t,r.x-i),m=Math.max(m,r.x+i),h=Math.min(h,r.y-i),g=Math.max(g,r.y+i)}let _=Math.max(0,Math.floor((t-C)/38)),b=Math.min(x,Math.ceil((m-C)/38)),D=Math.max(0,Math.floor((h-w)/38)),O=Math.min(S,Math.ceil((g-w)/38));f.lineCap=`round`;for(let t=D;t<=O;t++){let m=w+t*38;for(let h=_;h<=b;h++){let g=C+h*38,_=0;if(d){let e=Math.hypot(T-g,E-m);if(e<215){let t=1-e/215;_=t*t*(3-2*t)*k}}if(p)for(let t=0;t<j.length;t++){let n=j[t],r=(e-n.start)/680,i=Math.abs(Math.hypot(g-n.x,m-n.y)-r*340);i<38&&(_=Math.max(_,(1-i/38)*(1-r)*.85))}if(_<=.025)continue;let y=h%4==0&&t%4==0,b=(y?5.4:3.7)+_*3.2,x=Math.PI*.25*_,S=Math.cos(x)*b,w=Math.sin(x)*b;f.clearRect(g-7,m-7,14,14);let D=g/Math.max(1,v)*.55,O=z(c,z(n,a,D),Math.min(1,_*1.25)),A=z(l,z(r,o,D),Math.min(1,_*1.25)),ee=z(u,z(i,s,D),Math.min(1,_*1.25)),M=Math.min(.96,.28+_*.68);f.strokeStyle=`rgba(${O}, ${A}, ${ee}, ${M.toFixed(3)})`,f.lineWidth=y||_>.35?1.5:1.15,f.beginPath(),f.moveTo(g-S,m-w),f.lineTo(g+S,m+w),f.moveTo(g+w,m-S),f.lineTo(g-w,m+S),f.stroke()}}}}else if(ne===`mesh`){let e=[{yBase:.21,amp:56,freq:.0022,speed:.42,thick:155,c1:[n,r,i],c2:[a,o,s],alpha:F?.24:.16},{yBase:.4,amp:68,freq:.0018,speed:-.34,thick:185,c1:[a,o,s],c2:[n,r,i],alpha:F?.21:.14},{yBase:.64,amp:54,freq:.0021,speed:.38,thick:165,c1:[n,r,i],c2:[z(n,a,.6),z(r,o,.6),z(i,s,.6)],alpha:F?.2:.13},{yBase:.81,amp:44,freq:.0025,speed:-.29,thick:125,c1:[a,o,s],c2:[n,r,i],alpha:F?.19:.12}],c=v/22,l=e=>{f.beginPath(),f.moveTo(e[0][0],e[0][1]);for(let t=1;t<e.length-1;t++){let n=(e[t][0]+e[t+1][0])*.5,r=(e[t][1]+e[t+1][1])*.5;f.quadraticCurveTo(e[t][0],e[t][1],n,r)}f.lineTo(e[e.length-1][0],e[e.length-1][1])};for(let n=0;n<e.length;n++){let r=e[n],i=[],a=[],o=[],s=y,u=0;for(let e=0;e<=22;e++){let l=e*c,f=l*r.freq+t*r.speed+n*1.65,p=y*r.yBase+Math.sin(f)*r.amp+Math.cos(f*.58-n*.9)*(r.amp*.42);if(d){let e=Math.hypot(T-l,E-p);if(e<270){let t=(1-e/270)**2*32*k;p+=E>p?-t:t}}let m=r.thick*(.68+.32*Math.sin(f*.65+.9));i.push([l,p]),a.push([l,p+m*.36]),o.push([l,p+m]),p<s&&(s=p),p+m>u&&(u=p+m)}f.beginPath(),f.moveTo(i[0][0],i[0][1]);for(let e=1;e<i.length-1;e++)f.quadraticCurveTo(i[e][0],i[e][1],(i[e][0]+i[e+1][0])*.5,(i[e][1]+i[e+1][1])*.5);f.lineTo(i[22][0],i[22][1]),f.lineTo(o[22][0],o[22][1]);for(let e=21;e>0;e--)f.quadraticCurveTo(o[e][0],o[e][1],(o[e][0]+o[e-1][0])*.5,(o[e][1]+o[e-1][1])*.5);f.lineTo(o[0][0],o[0][1]),f.closePath();let p=f.createLinearGradient(0,s,0,u);p.addColorStop(0,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, 0)`),p.addColorStop(.24,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, ${r.alpha.toFixed(3)})`),p.addColorStop(.62,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${(r.alpha*.72).toFixed(3)})`),p.addColorStop(1,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, 0)`),f.fillStyle=p,f.fill();let m=f.createLinearGradient(0,0,v,0);m.addColorStop(0,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, 0.04)`),m.addColorStop(.25,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, ${F?.56:.38})`),m.addColorStop(.75,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${F?.5:.34})`),m.addColorStop(1,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, 0.04)`),l(i),f.strokeStyle=m,f.lineWidth=1.25,f.stroke(),l(a),f.strokeStyle=`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${F?.18:.12})`,f.lineWidth=.85,f.stroke()}}else if(ne===`orbit`){let e=v*.5,a=y*.42,o=[160,280,420,575];f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.055:.05})`,f.lineWidth=1,f.beginPath();for(let n=0;n<12;n++){let r=n*Math.PI/6+(re?t*.015:0);f.moveTo(e+Math.cos(r)*115,a+Math.sin(r)*115),f.lineTo(e+Math.cos(r)*640,a+Math.sin(r)*640)}f.stroke(),o.forEach((t,o)=>{f.beginPath(),f.arc(e,a,t,0,Math.PI*2),f.strokeStyle=o%2==0?`rgba(${n}, ${r}, ${i}, ${F?.24:.18})`:`rgba(${c}, ${l}, ${u}, ${F?.12:.1})`,f.lineWidth=o===0?1.2:1,f.stroke()});let s=[];for(let e=0;e<56;e++){let n=(Math.sin(e*19.31+1.7)+1)*.5,r=(Math.cos(e*31.17+.9)+1)*.5,i=.22+e%5*.08,a=(.04+n*.92)*v,o=(.06+r*.88)*y,c=a+Math.sin(t*i+e*1.3)*18,l=o+Math.cos(t*i*.85+e*2.1)*14;if(d){let e=T-c,t=E-l,n=Math.hypot(e,t);if(n<210&&n>1){let r=(1-n/210)*14*k;c+=e/n*r,l+=t/n*r}}s.push({x:c,y:l,r:e%7==0?2.5:1.55,accent:e%3==0})}for(let e=0;e<s.length;e++)for(let t=e+1;t<s.length;t++){let a=Math.hypot(s[e].x-s[t].x,s[e].y-s[t].y);if(a<170){let o=(1-a/170)*(F?.34:.25),d=s[e].accent||s[t].accent;f.strokeStyle=d?`rgba(${n}, ${r}, ${i}, ${(o*1.15).toFixed(3)})`:`rgba(${c}, ${l}, ${u}, ${o.toFixed(3)})`,f.lineWidth=.9,f.beginPath(),f.moveTo(s[e].x,s[e].y),f.lineTo(s[t].x,s[t].y),f.stroke()}}if(d)for(let e=0;e<s.length;e++){let t=Math.hypot(T-s[e].x,E-s[e].y);if(t<195){let a=(1-t/195)*(F?.56:.42)*k;f.strokeStyle=`rgba(${n}, ${r}, ${i}, ${a.toFixed(3)})`,f.lineWidth=1.15,f.beginPath(),f.moveTo(T,E),f.lineTo(s[e].x,s[e].y),f.stroke()}}for(let e=0;e<s.length;e++){let t=s[e];t.accent&&(f.beginPath(),f.arc(t.x,t.y,t.r*3.1,0,Math.PI*2),f.fillStyle=`rgba(${n}, ${r}, ${i}, ${F?.2:.15})`,f.fill()),f.beginPath(),f.arc(t.x,t.y,t.r,0,Math.PI*2),f.fillStyle=t.accent?`rgba(${n}, ${r}, ${i}, ${F?.92:.82})`:`rgba(${c}, ${l}, ${u}, ${F?.58:.44})`,f.fill()}}else if(ne===`horizon`){let e=Math.round(y*.44),p=d?(T/Math.max(1,v)-.5)*44*k:0;[{xTop:.24,xBot:.14,wTop:65,wBot:190,col:[a,o,s],baseA:F?.14:.1},{xTop:.39,xBot:.34,wTop:80,wBot:230,col:[n,r,i],baseA:F?.2:.14},{xTop:.5,xBot:.5,wTop:110,wBot:290,col:[n,r,i],baseA:F?.26:.18},{xTop:.61,xBot:.66,wTop:80,wBot:230,col:[a,o,s],baseA:F?.18:.13},{xTop:.76,xBot:.86,wTop:65,wBot:190,col:[n,r,i],baseA:F?.13:.09}].forEach((n,r)=>{let i=re?.84+.16*Math.sin(t*.7+r*1.3):1,a=v*n.xTop+p*.4,o=v*n.xBot+p*.9,s=f.createLinearGradient(a,0,o,e+30);s.addColorStop(0,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, ${(n.baseA*i).toFixed(3)})`),s.addColorStop(.68,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, ${(n.baseA*.35*i).toFixed(3)})`),s.addColorStop(1,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, 0)`),f.beginPath(),f.moveTo(a-n.wTop*.5,0),f.lineTo(a+n.wTop*.5,0),f.lineTo(o+n.wBot*.5,e+24),f.lineTo(o-n.wBot*.5,e+24),f.closePath(),f.fillStyle=s,f.fill()});let m=v*.5+p*1.1,h=y-e,g=f.createRadialGradient(m,e,4,m,e+60,v*.52);g.addColorStop(0,`rgba(${n}, ${r}, ${i}, ${F?.24:.15})`),g.addColorStop(.55,`rgba(${a}, ${o}, ${s}, ${F?.07:.04})`),g.addColorStop(1,`rgba(0,0,0,0)`),f.fillStyle=g,f.fillRect(0,e,v,h);for(let t=1;t<=11;t++){let n=(t/11)**2.05,r=e+n*h,i=(.06+n*.14)*(F?1:.9);f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${i.toFixed(3)})`,f.lineWidth=1,f.beginPath(),f.moveTo(0,r),f.lineTo(v,r),f.stroke()}for(let t=-16;t<=16;t++){let a=m+v/22*t,o=m+v/4.2*t,s=Math.max(.18,1-Math.abs(t)/16.8);f.strokeStyle=`rgba(${z(c,n,s*.45)}, ${z(l,r,s*.45)}, ${z(u,i,s*.45)}, ${(s*(F?.22:.16)).toFixed(3)})`,f.lineWidth=1,f.beginPath(),f.moveTo(a,e),f.lineTo(o,y),f.stroke()}let _=f.createLinearGradient(0,e,v,e);_.addColorStop(0,`rgba(0,0,0,0)`),_.addColorStop(.22,`rgba(${n}, ${r}, ${i}, ${F?.48:.36})`),_.addColorStop(.5,`rgba(${z(n,255,F?.45:.15)}, ${z(r,255,F?.45:.15)}, ${z(i,255,F?.45:.15)}, ${F?.88:.65})`),_.addColorStop(.78,`rgba(${a}, ${o}, ${s}, ${F?.48:.36})`),_.addColorStop(1,`rgba(0,0,0,0)`),f.strokeStyle=_,f.lineWidth=1.5,f.beginPath(),f.moveTo(0,e+.5),f.lineTo(v,e+.5),f.stroke()}},le=e=>{if(S=0,!C||v<=1||y<=1)return;let t=+!!w;k+=(t-k)*(w?.18:.12),Math.abs(t-k)<.004&&(k=t);let i=D-T,a=O-E,o=Math.hypot(i,a);o<.25?(T=D,E=O):(T+=i*.22,E+=a*.22);let s=Math.min(1,o/42);A+=(s-A)*.18,A<.005&&(A=0);let l=n===`backdrop`?300:240;if(j=j.filter(t=>e-t.start<620),ne!==`hallmark`){ce(e);let n=ie&&w&&e-ee<180;(re||j.length>0||n||ie&&(Math.abs(t-k)>=.004||Math.hypot(D-T,O-E)>=.25))&&!document.hidden&&(S=window.requestAnimationFrame(le));return}let u=n===`backdrop`?215:175,d=u*u,p=n===`backdrop`?1.15:1.05,m=n===`backdrop`?2.65+A*.35:2.35+A*.25,g=n===`backdrop`?2.85:2.15,_=n===`backdrop`?F?.22:.2:F?.2:.18,b=(c.current.x%r+r)%r,x=(c.current.y%r+r)%r,te=b>0?b-r:0,I=x>0?x-r:0;se(te,I,p,_),f.clearRect(0,0,v,y),f.drawImage(h,0,0,v,y);let ae=k>.01,oe=j.length>0;if(ae||oe){let t=v+r,n=-r,i=y+r,a=-r;ae&&(t=Math.min(t,T-u),n=Math.max(n,T+u),i=Math.min(i,E-u),a=Math.max(a,E+u));for(let r=0;r<j.length;r++){let o=j[r],s=(e-o.start)/620*l+36;t=Math.min(t,o.x-s),n=Math.max(n,o.x+s),i=Math.min(i,o.y-s),a=Math.max(a,o.y+s)}let o=Math.max(0,Math.floor((t-te)/r)),s=Math.min(Math.ceil((v+r-te)/r),Math.ceil((n-te)/r)),c=Math.max(0,Math.floor((i-I)/r)),h=Math.min(Math.ceil((y+r-I)/r),Math.ceil((a-I)/r)),b=[];for(let t=c;t<=h;t++){let n=I+t*r;for(let i=o;i<=s;i++){let a=te+i*r,o=0,s=0,c=0;if(ae){let e=T-a,t=E-n,r=e*e+t*t;if(r<d){let n=Math.sqrt(r),i=1-n/u,a=i*i*(3-2*i);if(o=a*k,n>.5){let r=Math.sin(a*Math.PI)*g*k;s=e/n*r,c=t/n*r}}}let f=0;for(let t=0;t<j.length;t++){let r=j[t],i=(e-r.start)/620,o=i*l,s=Math.hypot(a-r.x,n-r.y),c=Math.abs(s-o);if(c<34){let e=(1-c/34)*(1-i);e>f&&(f=e)}}let h=Math.min(1,o+f*.72);if(h>.015){let r=(i*19+t*37)%97,o=.9+.1*Math.sin(e*.0042+r*.41),l=p+(m-p)*h**1.08,u=Math.min(1,Math.max(0,a/Math.max(1,v)*.45+(1-h)*.55)),d=Math.min(.96,(_+(.94-_)*h)*o);b.push({gx:a,gy:n,x:a+s,y:n+c,r:l,t:h,blend:u,alpha:d})}}}let x=p+1;for(let e=0;e<b.length;e++){let t=b[e];f.clearRect(t.gx-x,t.gy-x,x*2,x*2)}if(ae){let e=f.createRadialGradient(T,E,0,T,E,u*1.15),t=(F?.13:.095)*k,n=(F?.055:.04)*k;e.addColorStop(0,`rgba(${N[0]}, ${N[1]}, ${N[2]}, ${t.toFixed(3)})`),e.addColorStop(.45,`rgba(${P[0]}, ${P[1]}, ${P[2]}, ${n.toFixed(3)})`),e.addColorStop(1,`rgba(0, 0, 0, 0)`),f.fillStyle=e,f.fillRect(Math.max(0,T-u*1.2),Math.max(0,E-u*1.2),u*2.4,u*2.4)}for(let e=0;e<b.length;e++){let t=b[e],n=z(N[0],P[0],t.blend),r=z(N[1],P[1],t.blend),i=z(N[2],P[2],t.blend),a=Math.min(1,t.t*1.18),o=z(M[0],n,a),s=z(M[1],r,a),c=z(M[2],i,a);if(t.t>.36){let e=(t.t-.36)*(F?.34:.24);f.beginPath(),f.arc(t.x,t.y,t.r*2.25,0,Math.PI*2),f.fillStyle=`rgba(${n}, ${r}, ${i}, ${e.toFixed(3)})`,f.fill()}f.beginPath(),f.arc(t.x,t.y,t.r,0,Math.PI*2),f.fillStyle=`rgba(${o}, ${s}, ${c}, ${t.alpha.toFixed(3)})`,f.fill()}}let L=w&&e-ee<180;(j.length>0||L||Math.abs(t-k)>=.004||Math.hypot(D-T,O-E)>=.25||A>=.005)&&!document.hidden&&(S=window.requestAnimationFrame(le))},B=()=>{C&&!S&&(S=window.requestAnimationFrame(le))},V=()=>{C=ae(),C?(a.dataset.interactiveDots=`ready`,R(),oe(),B()):(S&&=(window.cancelAnimationFrame(S),0),delete a.dataset.interactiveDots,f.clearRect(0,0,v,y))};l.current=B;let H=n===`backdrop`?a.parentElement??a:a,U=e=>{if(!C)return;let t=x??i.getBoundingClientRect();if(!t.width||!t.height)return;let n=e.clientX-t.left,r=e.clientY-t.top;w||(T=n,E=r),D=n,O=r,w=!0,ee=performance.now(),B()},ue=()=>{w&&(w=!1,B())},W=e=>{if(!C)return;let t=x??i.getBoundingClientRect();t.width&&t.height&&(j.push({x:e.clientX-t.left,y:e.clientY-t.top,start:performance.now()}),j.length>3&&j.shift(),B())},G=new ResizeObserver(()=>{C&&R()&&B()});G.observe(a);let de=new MutationObserver(()=>{V()});de.observe(o,{attributes:!0,attributeFilter:[`data-theme`,`data-accent`,`data-backdrop`,`data-motion`,`data-hover-effects`]});let fe=()=>V(),K=()=>{!document.hidden&&C&&B()};return u.addEventListener(`change`,fe),d.addEventListener(`change`,fe),document.addEventListener(`visibilitychange`,K),window.addEventListener(`scroll`,L,{passive:!0,capture:!0}),window.addEventListener(`resize`,L,{passive:!0}),H.addEventListener(`pointermove`,U,{passive:!0}),H.addEventListener(`pointerleave`,ue,{passive:!0}),H.addEventListener(`pointerdown`,W,{passive:!0}),V(),()=>{l.current=null,S&&window.cancelAnimationFrame(S),G.disconnect(),de.disconnect(),u.removeEventListener(`change`,fe),d.removeEventListener(`change`,fe),document.removeEventListener(`visibilitychange`,K),window.removeEventListener(`scroll`,L,!0),window.removeEventListener(`resize`,L),H.removeEventListener(`pointermove`,U),H.removeEventListener(`pointerleave`,ue),H.removeEventListener(`pointerdown`,W),delete a.dataset.interactiveDots}},[e,t,n,r]),(0,w.jsx)(`canvas`,{ref:s,className:`interactive-dot-grid`,"aria-hidden":`true`})}),Le=[{id:`static-public-v1`,title:`Static public folder`,description:`HTML, CSS, JavaScript & assets`,path:`M4 4h16v16H4zM4 9h16M9 9v11`},{id:`react-vite-v1`,title:`React / Vite / Next.js project`,description:`App/Pages Router, components, TypeScript & staged builds`,path:`m8 5-6 7 6 7m8-14 6 7-6 7m-3-15-2 16`}];function Re({value:e,onChange:t}){let[n,r]=(0,i.useState)(!1),a=(0,i.useRef)(null),o=(0,i.useRef)(null),s=Le.find(t=>t.id===e)??Le[0];function c(e){o.current?.querySelectorAll(`[role=option]`)[e]?.focus()}function l(){setTimeout(()=>c(Le.findIndex(t=>t.id===e)),0)}return(0,w.jsxs)(`div`,{className:`project-type`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},children:[(0,w.jsxs)(`button`,{ref:a,id:`adapter`,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":n,"aria-controls":`project-types`,"aria-labelledby":`project-type-label adapter-value`,onClick:()=>{r(!n),n||l()},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),r(!0),l())},children:[(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:s.path})}),(0,w.jsxs)(`span`,{id:`adapter-value`,children:[(0,w.jsx)(`strong`,{children:s.title}),(0,w.jsx)(`small`,{children:s.description})]}),(0,w.jsx)(`svg`,{className:`dropdown-chevron`,viewBox:`0 0 20 20`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m5 8 5 5 5-5`})})]}),(0,w.jsx)(`div`,{id:`project-types`,role:`listbox`,"aria-labelledby":`project-type-label`,ref:o,hidden:!n,children:Le.map((n,i)=>(0,w.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e===n.id,tabIndex:-1,onClick:()=>{t(n.id),r(!1),a.current?.focus()},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r(!1),a.current?.focus()):[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(e.key===`Home`?0:e.key===`End`?Le.length-1:(i+(e.key===`ArrowDown`?1:Le.length-1))%Le.length))},children:[(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:n.path})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:n.title}),(0,w.jsx)(`small`,{children:n.description})]})]},n.id))})]})}var ze=[`Navigation & links`,`Mobile layout`,`Keyboard focus & controls`,`Forms & validation`,`Saved state & URL filters`,`Existing content & attribution`];function Be({value:e,onChange:t}){let n=e.split(`
|
|
12
|
-
`).map(e=>e.trim()).filter(Boolean);return(0,w.jsx)(`div`,{className:`preserve-suggestions`,"aria-label":`Common preserved behaviors`,children:
|
|
11
|
+
`)}var Ne=(0,i.memo)(function({motion:e,active:t,compact:n=!1}){let r=(0,i.useRef)(null);return(0,w.jsxs)(`div`,{className:`welcome-heading${n?` is-compact`:``}`,ref:r,"data-active":e&&t,children:[(0,w.jsxs)(`h1`,{className:`studio-hero-title`,children:[`What’s your next `,(0,w.jsx)(`span`,{className:`welcome-accent`,children:`revision`}),`?`]}),(0,w.jsx)(`p`,{className:`welcome-subtitle page-reveal page-reveal--support`,children:`Audit, visually diff, and safely revise React, Next.js, and static web apps — read-only until you review and click Apply.`})]})});function Pe(e,t,n){if(!t)return n;try{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return[n[0],n[1],n[2]]}catch{return n}}var Fe=(0,i.memo)(function({motion:e=!0,hoverEffects:t=!0,variant:n=`backdrop`,spacing:r=24,offsetX:a=0,offsetY:o=0}){let s=(0,i.useRef)(null),c=(0,i.useRef)({x:a,y:o});c.current.x=a,c.current.y=o;let l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{l.current?.()},[a,o]),(0,i.useEffect)(()=>{let i=s.current,a=i?.parentElement;if(!i||!a)return;let o=document.documentElement,u=window.matchMedia(`(prefers-reduced-motion: reduce)`),d=window.matchMedia(`(pointer: coarse)`),f=i.getContext(`2d`);if(!f)return;let p=document.createElement(`canvas`);p.width=1,p.height=1;let m=p.getContext(`2d`,{willReadFrequently:!0}),h=document.createElement(`canvas`),g=h.getContext(`2d`),_=``,v=0,y=0,b=1,x=null,S=0,C=!1,w=!1,T=0,E=0,D=0,O=0,k=0,A=0,ee=0,j=[],M=[148,163,184],N=[200,9,9],P=[194,0,48],F=!1,te=new Set([`hallmark`,`isometric`,`crosshair`,`mesh`,`orbit`,`horizon`]),ne=`hallmark`,re=!1,ie=!1,I=()=>n===`canvas`?`hallmark`:o.dataset.backdrop||`hallmark`,ae=()=>(ne=I(),n===`canvas`?u.matches||d.matches||!e||o.dataset.motion===`off`?!1:(re=!1,ie=!0,!0):te.has(ne)?ne===`hallmark`?u.matches||d.matches||!t||o.dataset.hoverEffects===`off`?!1:(re=!1,ie=!0,!0):(re=e&&o.dataset.motion!==`off`&&!u.matches,ie=t&&o.dataset.hoverEffects!==`off`&&!u.matches&&!d.matches,!0):!1),oe=()=>{let e=window.getComputedStyle(i),t=o.dataset.theme;F=t===`dark`||t!==`light`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches,m&&(N=Pe(m,e.color,[200,9,9]),P=Pe(m,e.borderTopColor,[194,0,48]),M=Pe(m,e.caretColor,F?[226,232,240]:[15,23,42])),_=``},L=()=>{x=i.getBoundingClientRect()},R=()=>{let e=a.getBoundingClientRect();x=e;let t=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height)),r=Math.min(window.devicePixelRatio||1,2);if(t===v&&n===y&&r===b)return!1;v=t,y=n,b=r;let o=Math.round(v*b),s=Math.round(y*b);return i.width=o,i.height=s,f.setTransform(b,0,0,b,0,0),h.width=o,h.height=s,g?.setTransform(b,0,0,b,0,0),_=``,!0},se=(e,t,n,i)=>{if(!g)return;let a=`${v}x${y}@${b}:${e.toFixed(1)},${t.toFixed(1)}:${M.join(`,`)}:${i}`;if(a!==_){_=a,g.clearRect(0,0,v,y),g.beginPath();for(let i=t;i<=y+r;i+=r)for(let t=e;t<=v+r;t+=r)g.moveTo(t+n,i),g.arc(t,i,n,0,Math.PI*2);g.fillStyle=`rgba(${M[0]}, ${M[1]}, ${M[2]}, ${i})`,g.fill()}},z=(e,t,n)=>Math.round(e+(t-e)*n),ce=e=>{f.clearRect(0,0,v,y);let t=re?e*.001:1.85,n=N[0],r=N[1],i=N[2],a=P[0],o=P[1],s=P[2],c=M[0],l=M[1],u=M[2],d=ie&&k>.01,p=ie&&j.length>0,m=(e,t)=>{let n=(e-v*.5)/Math.max(1,v*.34),r=(t-y*.44)/Math.max(1,y*.28);return Math.min(1,Math.max(.22,(Math.hypot(n,r)-.35)/.85))};if(ne===`isometric`){let h=27.7,g=Math.ceil(v/48)+2,_=Math.ceil(y/h)+2;f.lineWidth=1,f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.095:.085})`,f.beginPath();for(let e=-1;e<=_;e++){let t=e*h,n=(e&1)*24;for(let e=-1;e<=g;e++){let r=e*48+n;f.moveTo(r,t-h*.5),f.lineTo(r+24,t),f.lineTo(r,t+h*.5),f.lineTo(r-24,t),f.closePath()}}f.stroke();for(let c=0;c<=_;c++){let l=c*h,u=(c&1)*24;for(let _=0;_<=g;_++){let g=_*48+u,v=Math.abs(Math.sin(_*12.9898+c*78.233)*43758.5453)%1,y=.5+.5*Math.sin(_*.42+c*.31-t*.85+v*Math.PI*2),b=m(g,l),x=v>.77?(.045+y*.095)*b:0,S=0;if(d){let e=Math.hypot(T-g,E-l);if(e<225){let t=1-e/225;S=Math.max(S,t*t*(3-2*t)*k)}}if(p)for(let t=0;t<j.length;t++){let n=j[t],r=(e-n.start)/680,i=Math.abs(Math.hypot(g-n.x,l-n.y)-r*340);i<40&&(S=Math.max(S,(1-i/40)*(1-r)*.8))}let C=x+S*(F?.34:.24);if(C>.02){let e=v>.89,t=e?a:n,c=e?o:r,u=e?s:i;f.beginPath(),f.moveTo(g,l-h*.5),f.lineTo(g+24,l),f.lineTo(g,l+h*.5),f.lineTo(g-24,l),f.closePath(),f.fillStyle=`rgba(${t}, ${c}, ${u}, ${Math.min(.45,C).toFixed(3)})`,f.fill(),(S>.14||C>.11)&&(f.strokeStyle=`rgba(${t}, ${c}, ${u}, ${Math.min(.68,C*1.9).toFixed(3)})`,f.lineWidth=S>.3?1.35:1,f.stroke())}}}}else if(ne===`crosshair`){let t=Math.max(48,Math.min(110,Math.round(v*.068))),x=Math.ceil(v/38),S=Math.ceil(y/38),C=Math.round((v-x*38)*.5+19),w=Math.round((y-S*38)*.5+19),D=`cross:${v}x${y}@${b}:${+!!F}:${M.join(`,`)}:${n},${r},${i}`;if(g&&_!==D){_=D,g.clearRect(0,0,v,y),g.lineCap=`round`,g.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.13:.12})`,g.lineWidth=1,g.beginPath(),g.moveTo(t+.5,0),g.lineTo(t+.5,y),g.moveTo(v-t+.5,0),g.lineTo(v-t+.5,y);for(let e=32;e<y;e+=76)g.moveTo(t-4,e+.5),g.lineTo(t+5,e+.5),g.moveTo(v-t-4,e+.5),g.lineTo(v-t+5,e+.5);g.stroke(),g.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.16:.15})`,g.lineWidth=1,g.beginPath();for(let e=0;e<=S;e++){let t=w+e*38;for(let n=0;n<=x;n++){if(n%4==0&&e%4==0)continue;let r=C+n*38;m(r,t)<.32||(g.moveTo(r-3.5,t+.5),g.lineTo(r+3.5,t+.5),g.moveTo(r+.5,t-3.5),g.lineTo(r+.5,t+3.5))}}g.stroke(),g.strokeStyle=`rgba(${z(c,n,.5)}, ${z(l,r,.5)}, ${z(u,i,.5)}, ${F?.38:.34})`,g.lineWidth=1.25,g.beginPath();for(let e=0;e<=S;e+=4){let t=w+e*38;for(let e=0;e<=x;e+=4){let n=C+e*38;m(n,t)<.28||(g.moveTo(n-5.2,t+.5),g.lineTo(n+5.2,t+.5),g.moveTo(n+.5,t-5.2),g.lineTo(n+.5,t+5.2))}}g.stroke()}if(f.drawImage(h,0,0,v,y),d||p){let t=v+38,m=-38,h=y+38,g=-38;if(d){t=Math.min(t,T-215),m=Math.max(m,T+215),h=Math.min(h,E-215),g=Math.max(g,E+215);let e=f.createRadialGradient(T,E,0,T,E,215);e.addColorStop(0,`rgba(${n}, ${r}, ${i}, ${(F?.13:.085)*k})`),e.addColorStop(.55,`rgba(${a}, ${o}, ${s}, ${(F?.045:.03)*k})`),e.addColorStop(1,`rgba(0,0,0,0)`),f.fillStyle=e,f.fillRect(T-215,E-215,430,430)}for(let n=0;n<j.length;n++){let r=j[n],i=(e-r.start)/680*340+40;t=Math.min(t,r.x-i),m=Math.max(m,r.x+i),h=Math.min(h,r.y-i),g=Math.max(g,r.y+i)}let _=Math.max(0,Math.floor((t-C)/38)),b=Math.min(x,Math.ceil((m-C)/38)),D=Math.max(0,Math.floor((h-w)/38)),O=Math.min(S,Math.ceil((g-w)/38));f.lineCap=`round`;for(let t=D;t<=O;t++){let m=w+t*38;for(let h=_;h<=b;h++){let g=C+h*38,_=0;if(d){let e=Math.hypot(T-g,E-m);if(e<215){let t=1-e/215;_=t*t*(3-2*t)*k}}if(p)for(let t=0;t<j.length;t++){let n=j[t],r=(e-n.start)/680,i=Math.abs(Math.hypot(g-n.x,m-n.y)-r*340);i<38&&(_=Math.max(_,(1-i/38)*(1-r)*.85))}if(_<=.025)continue;let y=h%4==0&&t%4==0,b=(y?5.4:3.7)+_*3.2,x=Math.PI*.25*_,S=Math.cos(x)*b,w=Math.sin(x)*b;f.clearRect(g-7,m-7,14,14);let D=g/Math.max(1,v)*.55,O=z(c,z(n,a,D),Math.min(1,_*1.25)),A=z(l,z(r,o,D),Math.min(1,_*1.25)),ee=z(u,z(i,s,D),Math.min(1,_*1.25)),M=Math.min(.96,.28+_*.68);f.strokeStyle=`rgba(${O}, ${A}, ${ee}, ${M.toFixed(3)})`,f.lineWidth=y||_>.35?1.5:1.15,f.beginPath(),f.moveTo(g-S,m-w),f.lineTo(g+S,m+w),f.moveTo(g+w,m-S),f.lineTo(g-w,m+S),f.stroke()}}}}else if(ne===`mesh`){let e=[{yBase:.21,amp:56,freq:.0022,speed:.42,thick:155,c1:[n,r,i],c2:[a,o,s],alpha:F?.24:.16},{yBase:.4,amp:68,freq:.0018,speed:-.34,thick:185,c1:[a,o,s],c2:[n,r,i],alpha:F?.21:.14},{yBase:.64,amp:54,freq:.0021,speed:.38,thick:165,c1:[n,r,i],c2:[z(n,a,.6),z(r,o,.6),z(i,s,.6)],alpha:F?.2:.13},{yBase:.81,amp:44,freq:.0025,speed:-.29,thick:125,c1:[a,o,s],c2:[n,r,i],alpha:F?.19:.12}],c=v/22,l=e=>{f.beginPath(),f.moveTo(e[0][0],e[0][1]);for(let t=1;t<e.length-1;t++){let n=(e[t][0]+e[t+1][0])*.5,r=(e[t][1]+e[t+1][1])*.5;f.quadraticCurveTo(e[t][0],e[t][1],n,r)}f.lineTo(e[e.length-1][0],e[e.length-1][1])};for(let n=0;n<e.length;n++){let r=e[n],i=[],a=[],o=[],s=y,u=0;for(let e=0;e<=22;e++){let l=e*c,f=l*r.freq+t*r.speed+n*1.65,p=y*r.yBase+Math.sin(f)*r.amp+Math.cos(f*.58-n*.9)*(r.amp*.42);if(d){let e=Math.hypot(T-l,E-p);if(e<270){let t=(1-e/270)**2*32*k;p+=E>p?-t:t}}let m=r.thick*(.68+.32*Math.sin(f*.65+.9));i.push([l,p]),a.push([l,p+m*.36]),o.push([l,p+m]),p<s&&(s=p),p+m>u&&(u=p+m)}f.beginPath(),f.moveTo(i[0][0],i[0][1]);for(let e=1;e<i.length-1;e++)f.quadraticCurveTo(i[e][0],i[e][1],(i[e][0]+i[e+1][0])*.5,(i[e][1]+i[e+1][1])*.5);f.lineTo(i[22][0],i[22][1]),f.lineTo(o[22][0],o[22][1]);for(let e=21;e>0;e--)f.quadraticCurveTo(o[e][0],o[e][1],(o[e][0]+o[e-1][0])*.5,(o[e][1]+o[e-1][1])*.5);f.lineTo(o[0][0],o[0][1]),f.closePath();let p=f.createLinearGradient(0,s,0,u);p.addColorStop(0,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, 0)`),p.addColorStop(.24,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, ${r.alpha.toFixed(3)})`),p.addColorStop(.62,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${(r.alpha*.72).toFixed(3)})`),p.addColorStop(1,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, 0)`),f.fillStyle=p,f.fill();let m=f.createLinearGradient(0,0,v,0);m.addColorStop(0,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, 0.04)`),m.addColorStop(.25,`rgba(${r.c1[0]}, ${r.c1[1]}, ${r.c1[2]}, ${F?.56:.38})`),m.addColorStop(.75,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${F?.5:.34})`),m.addColorStop(1,`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, 0.04)`),l(i),f.strokeStyle=m,f.lineWidth=1.25,f.stroke(),l(a),f.strokeStyle=`rgba(${r.c2[0]}, ${r.c2[1]}, ${r.c2[2]}, ${F?.18:.12})`,f.lineWidth=.85,f.stroke()}}else if(ne===`orbit`){let e=v*.5,a=y*.42,o=[160,280,420,575];f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${F?.055:.05})`,f.lineWidth=1,f.beginPath();for(let n=0;n<12;n++){let r=n*Math.PI/6+(re?t*.015:0);f.moveTo(e+Math.cos(r)*115,a+Math.sin(r)*115),f.lineTo(e+Math.cos(r)*640,a+Math.sin(r)*640)}f.stroke(),o.forEach((t,o)=>{f.beginPath(),f.arc(e,a,t,0,Math.PI*2),f.strokeStyle=o%2==0?`rgba(${n}, ${r}, ${i}, ${F?.24:.18})`:`rgba(${c}, ${l}, ${u}, ${F?.12:.1})`,f.lineWidth=o===0?1.2:1,f.stroke()});let s=[];for(let e=0;e<56;e++){let n=(Math.sin(e*19.31+1.7)+1)*.5,r=(Math.cos(e*31.17+.9)+1)*.5,i=.22+e%5*.08,a=(.04+n*.92)*v,o=(.06+r*.88)*y,c=a+Math.sin(t*i+e*1.3)*18,l=o+Math.cos(t*i*.85+e*2.1)*14;if(d){let e=T-c,t=E-l,n=Math.hypot(e,t);if(n<210&&n>1){let r=(1-n/210)*14*k;c+=e/n*r,l+=t/n*r}}s.push({x:c,y:l,r:e%7==0?2.5:1.55,accent:e%3==0})}for(let e=0;e<s.length;e++)for(let t=e+1;t<s.length;t++){let a=Math.hypot(s[e].x-s[t].x,s[e].y-s[t].y);if(a<170){let o=(1-a/170)*(F?.34:.25),d=s[e].accent||s[t].accent;f.strokeStyle=d?`rgba(${n}, ${r}, ${i}, ${(o*1.15).toFixed(3)})`:`rgba(${c}, ${l}, ${u}, ${o.toFixed(3)})`,f.lineWidth=.9,f.beginPath(),f.moveTo(s[e].x,s[e].y),f.lineTo(s[t].x,s[t].y),f.stroke()}}if(d)for(let e=0;e<s.length;e++){let t=Math.hypot(T-s[e].x,E-s[e].y);if(t<195){let a=(1-t/195)*(F?.56:.42)*k;f.strokeStyle=`rgba(${n}, ${r}, ${i}, ${a.toFixed(3)})`,f.lineWidth=1.15,f.beginPath(),f.moveTo(T,E),f.lineTo(s[e].x,s[e].y),f.stroke()}}for(let e=0;e<s.length;e++){let t=s[e];t.accent&&(f.beginPath(),f.arc(t.x,t.y,t.r*3.1,0,Math.PI*2),f.fillStyle=`rgba(${n}, ${r}, ${i}, ${F?.2:.15})`,f.fill()),f.beginPath(),f.arc(t.x,t.y,t.r,0,Math.PI*2),f.fillStyle=t.accent?`rgba(${n}, ${r}, ${i}, ${F?.92:.82})`:`rgba(${c}, ${l}, ${u}, ${F?.58:.44})`,f.fill()}}else if(ne===`horizon`){let e=Math.round(y*.44),p=d?(T/Math.max(1,v)-.5)*44*k:0;[{xTop:.24,xBot:.14,wTop:65,wBot:190,col:[a,o,s],baseA:F?.14:.1},{xTop:.39,xBot:.34,wTop:80,wBot:230,col:[n,r,i],baseA:F?.2:.14},{xTop:.5,xBot:.5,wTop:110,wBot:290,col:[n,r,i],baseA:F?.26:.18},{xTop:.61,xBot:.66,wTop:80,wBot:230,col:[a,o,s],baseA:F?.18:.13},{xTop:.76,xBot:.86,wTop:65,wBot:190,col:[n,r,i],baseA:F?.13:.09}].forEach((n,r)=>{let i=re?.84+.16*Math.sin(t*.7+r*1.3):1,a=v*n.xTop+p*.4,o=v*n.xBot+p*.9,s=f.createLinearGradient(a,0,o,e+30);s.addColorStop(0,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, ${(n.baseA*i).toFixed(3)})`),s.addColorStop(.68,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, ${(n.baseA*.35*i).toFixed(3)})`),s.addColorStop(1,`rgba(${n.col[0]}, ${n.col[1]}, ${n.col[2]}, 0)`),f.beginPath(),f.moveTo(a-n.wTop*.5,0),f.lineTo(a+n.wTop*.5,0),f.lineTo(o+n.wBot*.5,e+24),f.lineTo(o-n.wBot*.5,e+24),f.closePath(),f.fillStyle=s,f.fill()});let m=v*.5+p*1.1,h=y-e,g=f.createRadialGradient(m,e,4,m,e+60,v*.52);g.addColorStop(0,`rgba(${n}, ${r}, ${i}, ${F?.24:.15})`),g.addColorStop(.55,`rgba(${a}, ${o}, ${s}, ${F?.07:.04})`),g.addColorStop(1,`rgba(0,0,0,0)`),f.fillStyle=g,f.fillRect(0,e,v,h);for(let t=1;t<=11;t++){let n=(t/11)**2.05,r=e+n*h,i=(.06+n*.14)*(F?1:.9);f.strokeStyle=`rgba(${c}, ${l}, ${u}, ${i.toFixed(3)})`,f.lineWidth=1,f.beginPath(),f.moveTo(0,r),f.lineTo(v,r),f.stroke()}for(let t=-16;t<=16;t++){let a=m+v/22*t,o=m+v/4.2*t,s=Math.max(.18,1-Math.abs(t)/16.8);f.strokeStyle=`rgba(${z(c,n,s*.45)}, ${z(l,r,s*.45)}, ${z(u,i,s*.45)}, ${(s*(F?.22:.16)).toFixed(3)})`,f.lineWidth=1,f.beginPath(),f.moveTo(a,e),f.lineTo(o,y),f.stroke()}let _=f.createLinearGradient(0,e,v,e);_.addColorStop(0,`rgba(0,0,0,0)`),_.addColorStop(.22,`rgba(${n}, ${r}, ${i}, ${F?.48:.36})`),_.addColorStop(.5,`rgba(${z(n,255,F?.45:.15)}, ${z(r,255,F?.45:.15)}, ${z(i,255,F?.45:.15)}, ${F?.88:.65})`),_.addColorStop(.78,`rgba(${a}, ${o}, ${s}, ${F?.48:.36})`),_.addColorStop(1,`rgba(0,0,0,0)`),f.strokeStyle=_,f.lineWidth=1.5,f.beginPath(),f.moveTo(0,e+.5),f.lineTo(v,e+.5),f.stroke()}},le=e=>{if(S=0,!C||v<=1||y<=1)return;let t=+!!w;k+=(t-k)*(w?.18:.12),Math.abs(t-k)<.004&&(k=t);let i=D-T,a=O-E,o=Math.hypot(i,a);o<.25?(T=D,E=O):(T+=i*.22,E+=a*.22);let s=Math.min(1,o/42);A+=(s-A)*.18,A<.005&&(A=0);let l=n===`backdrop`?300:240;if(j=j.filter(t=>e-t.start<620),ne!==`hallmark`){ce(e);let n=ie&&w&&e-ee<180;(re||j.length>0||n||ie&&(Math.abs(t-k)>=.004||Math.hypot(D-T,O-E)>=.25))&&!document.hidden&&(S=window.requestAnimationFrame(le));return}let u=n===`backdrop`?215:175,d=u*u,p=n===`backdrop`?1.15:1.05,m=n===`backdrop`?2.65+A*.35:2.35+A*.25,g=n===`backdrop`?2.85:2.15,_=n===`backdrop`?F?.22:.2:F?.2:.18,b=(c.current.x%r+r)%r,x=(c.current.y%r+r)%r,te=b>0?b-r:0,I=x>0?x-r:0;se(te,I,p,_),f.clearRect(0,0,v,y),f.drawImage(h,0,0,v,y);let ae=k>.01,oe=j.length>0;if(ae||oe){let t=v+r,n=-r,i=y+r,a=-r;ae&&(t=Math.min(t,T-u),n=Math.max(n,T+u),i=Math.min(i,E-u),a=Math.max(a,E+u));for(let r=0;r<j.length;r++){let o=j[r],s=(e-o.start)/620*l+36;t=Math.min(t,o.x-s),n=Math.max(n,o.x+s),i=Math.min(i,o.y-s),a=Math.max(a,o.y+s)}let o=Math.max(0,Math.floor((t-te)/r)),s=Math.min(Math.ceil((v+r-te)/r),Math.ceil((n-te)/r)),c=Math.max(0,Math.floor((i-I)/r)),h=Math.min(Math.ceil((y+r-I)/r),Math.ceil((a-I)/r)),b=[];for(let t=c;t<=h;t++){let n=I+t*r;for(let i=o;i<=s;i++){let a=te+i*r,o=0,s=0,c=0;if(ae){let e=T-a,t=E-n,r=e*e+t*t;if(r<d){let n=Math.sqrt(r),i=1-n/u,a=i*i*(3-2*i);if(o=a*k,n>.5){let r=Math.sin(a*Math.PI)*g*k;s=e/n*r,c=t/n*r}}}let f=0;for(let t=0;t<j.length;t++){let r=j[t],i=(e-r.start)/620,o=i*l,s=Math.hypot(a-r.x,n-r.y),c=Math.abs(s-o);if(c<34){let e=(1-c/34)*(1-i);e>f&&(f=e)}}let h=Math.min(1,o+f*.72);if(h>.015){let r=(i*19+t*37)%97,o=.9+.1*Math.sin(e*.0042+r*.41),l=p+(m-p)*h**1.08,u=Math.min(1,Math.max(0,a/Math.max(1,v)*.45+(1-h)*.55)),d=Math.min(.96,(_+(.94-_)*h)*o);b.push({gx:a,gy:n,x:a+s,y:n+c,r:l,t:h,blend:u,alpha:d})}}}let x=p+1;for(let e=0;e<b.length;e++){let t=b[e];f.clearRect(t.gx-x,t.gy-x,x*2,x*2)}if(ae){let e=f.createRadialGradient(T,E,0,T,E,u*1.15),t=(F?.13:.095)*k,n=(F?.055:.04)*k;e.addColorStop(0,`rgba(${N[0]}, ${N[1]}, ${N[2]}, ${t.toFixed(3)})`),e.addColorStop(.45,`rgba(${P[0]}, ${P[1]}, ${P[2]}, ${n.toFixed(3)})`),e.addColorStop(1,`rgba(0, 0, 0, 0)`),f.fillStyle=e,f.fillRect(Math.max(0,T-u*1.2),Math.max(0,E-u*1.2),u*2.4,u*2.4)}for(let e=0;e<b.length;e++){let t=b[e],n=z(N[0],P[0],t.blend),r=z(N[1],P[1],t.blend),i=z(N[2],P[2],t.blend),a=Math.min(1,t.t*1.18),o=z(M[0],n,a),s=z(M[1],r,a),c=z(M[2],i,a);if(t.t>.36){let e=(t.t-.36)*(F?.34:.24);f.beginPath(),f.arc(t.x,t.y,t.r*2.25,0,Math.PI*2),f.fillStyle=`rgba(${n}, ${r}, ${i}, ${e.toFixed(3)})`,f.fill()}f.beginPath(),f.arc(t.x,t.y,t.r,0,Math.PI*2),f.fillStyle=`rgba(${o}, ${s}, ${c}, ${t.alpha.toFixed(3)})`,f.fill()}}let L=w&&e-ee<180;(j.length>0||L||Math.abs(t-k)>=.004||Math.hypot(D-T,O-E)>=.25||A>=.005)&&!document.hidden&&(S=window.requestAnimationFrame(le))},B=()=>{C&&!S&&(S=window.requestAnimationFrame(le))},V=()=>{C=ae(),C?(a.dataset.interactiveDots=`ready`,R(),oe(),B()):(S&&=(window.cancelAnimationFrame(S),0),delete a.dataset.interactiveDots,f.clearRect(0,0,v,y))};l.current=B;let H=n===`backdrop`?a.parentElement??a:a,U=e=>{if(!C)return;let t=x??i.getBoundingClientRect();if(!t.width||!t.height)return;let n=e.clientX-t.left,r=e.clientY-t.top;w||(T=n,E=r),D=n,O=r,w=!0,ee=performance.now(),B()},ue=()=>{w&&(w=!1,B())},W=e=>{if(!C)return;let t=x??i.getBoundingClientRect();t.width&&t.height&&(j.push({x:e.clientX-t.left,y:e.clientY-t.top,start:performance.now()}),j.length>3&&j.shift(),B())},G=new ResizeObserver(()=>{C&&R()&&B()});G.observe(a);let de=new MutationObserver(()=>{V()});de.observe(o,{attributes:!0,attributeFilter:[`data-theme`,`data-accent`,`data-backdrop`,`data-motion`,`data-hover-effects`]});let fe=()=>V(),K=()=>{!document.hidden&&C&&B()};return u.addEventListener(`change`,fe),d.addEventListener(`change`,fe),document.addEventListener(`visibilitychange`,K),window.addEventListener(`scroll`,L,{passive:!0,capture:!0}),window.addEventListener(`resize`,L,{passive:!0}),H.addEventListener(`pointermove`,U,{passive:!0}),H.addEventListener(`pointerleave`,ue,{passive:!0}),H.addEventListener(`pointerdown`,W,{passive:!0}),V(),()=>{l.current=null,S&&window.cancelAnimationFrame(S),G.disconnect(),de.disconnect(),u.removeEventListener(`change`,fe),d.removeEventListener(`change`,fe),document.removeEventListener(`visibilitychange`,K),window.removeEventListener(`scroll`,L,!0),window.removeEventListener(`resize`,L),H.removeEventListener(`pointermove`,U),H.removeEventListener(`pointerleave`,ue),H.removeEventListener(`pointerdown`,W),delete a.dataset.interactiveDots}},[e,t,n,r]),(0,w.jsx)(`canvas`,{ref:s,className:`interactive-dot-grid`,"aria-hidden":`true`})}),Ie=[{id:`static-public-v1`,title:`Static public folder`,description:`HTML, CSS, JavaScript & assets`,path:`M4 4h16v16H4zM4 9h16M9 9v11`},{id:`react-vite-v1`,title:`React / Vite / Next.js project`,description:`App/Pages Router, components, TypeScript & staged builds`,path:`m8 5-6 7 6 7m8-14 6 7-6 7m-3-15-2 16`}];function Le({value:e,onChange:t}){let[n,r]=(0,i.useState)(!1),a=(0,i.useRef)(null),o=(0,i.useRef)(null),s=Ie.find(t=>t.id===e)??Ie[0];function c(e){o.current?.querySelectorAll(`[role=option]`)[e]?.focus()}function l(){setTimeout(()=>c(Ie.findIndex(t=>t.id===e)),0)}return(0,w.jsxs)(`div`,{className:`project-type`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},children:[(0,w.jsxs)(`button`,{ref:a,id:`adapter`,type:`button`,"aria-haspopup":`listbox`,"aria-expanded":n,"aria-controls":`project-types`,"aria-labelledby":`project-type-label adapter-value`,onClick:()=>{r(!n),n||l()},onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),r(!0),l())},children:[(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:s.path})}),(0,w.jsxs)(`span`,{id:`adapter-value`,children:[(0,w.jsx)(`strong`,{children:s.title}),(0,w.jsx)(`small`,{children:s.description})]}),(0,w.jsx)(`svg`,{className:`dropdown-chevron`,viewBox:`0 0 20 20`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m5 8 5 5 5-5`})})]}),(0,w.jsx)(`div`,{id:`project-types`,role:`listbox`,"aria-labelledby":`project-type-label`,ref:o,hidden:!n,children:Ie.map((n,i)=>(0,w.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e===n.id,tabIndex:-1,onClick:()=>{t(n.id),r(!1),a.current?.focus()},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r(!1),a.current?.focus()):[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),c(e.key===`Home`?0:e.key===`End`?Ie.length-1:(i+(e.key===`ArrowDown`?1:Ie.length-1))%Ie.length))},children:[(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:n.path})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:n.title}),(0,w.jsx)(`small`,{children:n.description})]})]},n.id))})]})}var Re=[`Navigation & links`,`Mobile layout`,`Keyboard focus & controls`,`Forms & validation`,`Saved state & URL filters`,`Existing content & attribution`];function ze({value:e,onChange:t}){let n=e.split(`
|
|
12
|
+
`).map(e=>e.trim()).filter(Boolean);return(0,w.jsx)(`div`,{className:`preserve-suggestions`,"aria-label":`Common preserved behaviors`,children:Re.map(e=>(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":n.includes(e),onClick:()=>t(n.includes(e)?n.filter(t=>t!==e).join(`
|
|
13
13
|
`):[...n,e].join(`
|
|
14
|
-
`)),children:[n.includes(e)?(0,w.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m3 8 3 3 7-8`})}):(0,w.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M8 3v10M3 8h10`})}),e]},e))})}var
|
|
14
|
+
`)),children:[n.includes(e)?(0,w.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m3 8 3 3 7-8`})}):(0,w.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M8 3v10M3 8h10`})}),e]},e))})}var Be={ready:`Ready`,installed:`Installed`,configured:`Configured`,missing:`Missing`,available:`Available`,"not-installed":`Available`,"partial-builtin-only":`Built-in guides`,"builtin-only":`Built-in guides`,unavailable:`Unavailable`},Ve={core:`component`,playwright:`capture`,skills:`terminal`,media:`motion`,figmasync:`palette`,visualdiff:`measure`,designsystemlock:`shield`},He=[{id:`visual-qa`,title:`Visual & Runtime QA`,description:`Automated viewport renders, contrast audits, and perceptual layout comparison.`,icon:`capture`,moduleIds:[`playwright`,`visualdiff`]},{id:`design-system`,title:`Design System & Guardrails`,description:`Design blueprints, component manifest locking, and AI drift prevention.`,icon:`shield`,moduleIds:[`skills`,`designsystemlock`]},{id:`integrations`,title:`Integrations & External Formats`,description:`Figma token and asset sync, presentation deck builders, and video workspaces.`,icon:`palette`,moduleIds:[`figmasync`,`media`]}];function Ue(e){return e.flatMap(e=>e&&typeof e==`object`&&`description`in e&&typeof e.description==`string`?[e.description]:[])}function We({initialInspection:e=null,onInstalled:t}){let[n,r]=(0,i.useState)(e),[a,o]=(0,i.useState)(()=>e?e.modules.filter(e=>e.defaultSelected).map(e=>e.id):[]),[s,c]=(0,i.useState)(null),[l,u]=(0,i.useState)(),[f,p]=(0,i.useState)(``),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(0),v=(0,i.useRef)(null),y=(0,i.useRef)(null);(0,i.useEffect)(()=>{e&&!n&&(r(e),o(e.modules.filter(e=>e.defaultSelected).map(e=>e.id)))},[e,n]),(0,i.useEffect)(()=>{let e=new AbortController;return d(`/api/setup/modules`,void 0,e.signal).then(e=>{r(e),o(e.modules.filter(e=>e.defaultSelected).map(e=>e.id)),p(``)}).catch(t=>{e.signal.aborted||p(t.message)}),()=>e.abort()},[g]);async function b(e){if(l)return;u(e?`planning`:`installing`),p(``),h(``);let n={modules:e?a:s?.selectedModules??a,dryRun:e,approved:!e};try{let e=await d(`/api/setup/modules`,n);r(e.inspection),e.dryRun?c(e):(h(`Setup finished. Module status is up to date.`),t())}catch(t){if(p(t.message),!e){let e=await d(`/api/setup/modules`).catch(()=>null);e&&r(e)}}finally{e||(document.activeElement===y.current&&v.current?.focus(),c(null)),u(void 0)}}let x=n?.modules.find(e=>e.id===`core`),S=e=>(0,w.jsxs)(`label`,{className:`settings-module-row`,"data-module-id":e.id,"data-module-required":e.required?`true`:`false`,"data-module-status":e.status,children:[(0,w.jsx)(`input`,{type:`checkbox`,"aria-labelledby":`setup-module-label-`+e.id,"aria-describedby":`setup-module-description-`+e.id,checked:e.required||a.includes(e.id),disabled:e.required,onChange:t=>{let n=t.target.checked;o(t=>n?[...t,e.id]:t.filter(t=>t!==e.id)),c(null),h(``),p(``)}}),(0,w.jsx)(`span`,{className:`settings-module-mark`,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:Ve[e.id]})}),(0,w.jsxs)(`span`,{className:`settings-module-copy`,children:[(0,w.jsx)(`strong`,{id:`setup-module-label-`+e.id,children:e.label}),(0,w.jsx)(`small`,{id:`setup-module-description-`+e.id,children:e.description})]}),(0,w.jsxs)(`span`,{className:`settings-module-status`,children:[(0,w.jsxs)(`span`,{className:`settings-module-status-label`,children:[(0,w.jsx)(`span`,{className:`settings-module-status-dot`,"aria-hidden":`true`}),Be[e.status]??e.status]}),(0,w.jsx)(`small`,{children:e.required?`Required`:e.sizeHint})]})]},e.id);return(0,w.jsxs)(`section`,{className:`settings-setup-modules`,"aria-labelledby":`setup-modules-title`,children:[(0,w.jsxs)(`div`,{className:`settings-module-top-bar`,children:[(0,w.jsxs)(`div`,{className:`settings-section-heading settings-module-heading`,children:[(0,w.jsx)(`span`,{className:`settings-module-heading-mark`,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:`component`})}),(0,w.jsxs)(`div`,{className:`settings-module-heading-copy`,children:[(0,w.jsx)(`h3`,{id:`setup-modules-title`,tabIndex:-1,children:`Local tools & checks`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Install optional browser rendering, visual diff, and design-system tools on this computer.`})]})]}),n&&(0,w.jsxs)(`div`,{className:`settings-module-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,ref:v,disabled:!a.some(e=>e!==`core`),"aria-disabled":!!l,onClick:()=>void b(!0),children:l===`planning`?`Preparing plan…`:`Review setup plan`}),s&&(0,w.jsx)(`button`,{type:`button`,className:`button primary`,ref:y,"aria-disabled":!!l,onClick:()=>void b(!1),children:l===`installing`?`Installing selected tools…`:`Install selected tools`})]})]}),n?(0,w.jsxs)(w.Fragment,{children:[s&&(0,w.jsxs)(`div`,{className:`settings-module-plan`,role:`region`,"aria-label":`Setup plan`,children:[(0,w.jsxs)(`h4`,{children:[(0,w.jsx)(T,{name:`check`}),` Setup plan`]}),(0,w.jsx)(`ul`,{children:Ue(s.plan.steps).map(e=>(0,w.jsx)(`li`,{children:e},e))})]}),(0,w.jsxs)(`fieldset`,{className:`settings-module-list`,disabled:!!l,children:[(0,w.jsx)(`legend`,{className:`sr-only`,children:`Local setup modules`}),x&&(0,w.jsx)(`div`,{className:`settings-module-core-wrapper`,children:S(x)}),(0,w.jsx)(`div`,{className:`settings-module-categories`,children:He.map(e=>{let t=e.moduleIds.map(e=>n.modules.find(t=>t.id===e)).filter(e=>!!e);return t.length===0?null:(0,w.jsxs)(`div`,{className:`settings-module-category`,role:`group`,"aria-labelledby":`category-title-`+e.id,children:[(0,w.jsxs)(`div`,{className:`settings-module-category-header`,children:[(0,w.jsx)(`span`,{className:`settings-module-category-icon`,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:e.icon})}),(0,w.jsxs)(`div`,{className:`settings-module-category-copy`,children:[(0,w.jsx)(`h4`,{id:`category-title-`+e.id,children:e.title}),(0,w.jsx)(`p`,{className:`field-help`,children:e.description})]})]}),(0,w.jsx)(`div`,{className:`settings-module-category-grid`,children:t.map(e=>S(e))})]},e.id)})})]})]}):f?(0,w.jsx)(`button`,{className:`button subtle`,type:`button`,onClick:()=>{p(``),_(e=>e+1)},children:`Retry loading modules`}):(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:`Checking local tools…`}),m&&(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:m}),f&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:f})]})}function Ge({project:e,preserve:t,disabled:n,onExport:r}){let[a,o]=(0,i.useState)(!1),[s,c]=(0,i.useState)(null),[l,u]=(0,i.useState)(null),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(``),v=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!a||!e)return;let t=new AbortController;return d(`/api/project-rules?`+new URLSearchParams({project:e}),void 0,t.signal).then(e=>{c(e),h(``)}).catch(e=>{t.signal.aborted||h(e.message)}),()=>t.abort()},[a,e]);async function y(t){p(!0),h(``),_(``),u(null);try{if(t.size>32768)throw Error(`Choose a .ui-workflow.json file of 32 KiB or less.`);let n=await d(`/api/project-rules/import`,{project:e,rules:JSON.parse((await t.text()).replace(/^\uFEFF/,``))});u(n.rules),_(`Rules validated. Export them to use them in this project.`)}catch(e){h(e instanceof SyntaxError?`The selected file contains invalid JSON.`:e.message)}finally{p(!1)}}async function b(){if(s&&e){p(!0),h(``),_(``);try{let n=await r(e,l??{version:1,pinnedSkills:[],mustPreserve:t.split(`
|
|
15
15
|
`).map(e=>e.trim()).filter(Boolean),designGuide:null,includeDirs:[]});c(n),u(null),_(`Workflow rules saved to the project.`)}catch(e){h(e.message)}finally{p(!1)}}}function x(){if(!s?.rules)return;let e=URL.createObjectURL(new Blob([JSON.stringify(s.rules,null,2)+`
|
|
16
|
-
`],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`.ui-workflow.json`,t.click(),window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}return(0,w.jsxs)(`details`,{className:`wb-project-rules`,onToggle:e=>o(e.currentTarget.open),children:[(0,w.jsxs)(`summary`,{children:[(0,w.jsx)(T,{name:`terminal`}),(0,w.jsxs)(`span`,{children:[`Import / Export `,(0,w.jsx)(`code`,{translate:`no`,children:`.ui-workflow.json`})]})]}),e?(0,w.jsxs)(`div`,{className:`wb-project-rules-body`,children:[(0,w.jsx)(`p`,{className:`field-help`,children:s?.exists?`Project rules are included in future revisions. Imported rules replace this file only when you export them.`:s?`Save your current behavior prompts as project rules, or import a rules file before exporting.`:m?`Check the project’s rules file and reopen this section to retry.`:`Reading project rules…`}),(0,w.jsx)(`input`,{ref:v,type:`file`,hidden:!0,accept:`.json,application/json`,"aria-label":`Choose workflow rules file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&y(t)}}),l&&(0,w.jsxs)(`details`,{className:`wb-project-rules-preview`,children:[(0,w.jsx)(`summary`,{children:`Review imported rules`}),(0,w.jsx)(`pre`,{translate:`no`,children:JSON.stringify(l,null,2)})]}),(0,w.jsxs)(`div`,{className:`wb-project-rules-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:!s||n||f,onClick:()=>v.current?.click(),children:`Import rules`}),s?.rules&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:n||f,onClick:x,children:`Download project rules`}),s&&(!s.exists||l)&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:n||f,onClick:()=>void b(),children:s.exists?`Replace project rules`:`Export to project`})]}),f&&(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:`Working with project rules…`}),g&&(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:g}),m&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:m})]}):(0,w.jsx)(`p`,{className:`field-help`,children:`Inspect a project folder to manage its workflow rules.`})]})}function q(e,t,n,r,i,a){return{id:e,name:t,category:n,mode:r,tokens:i,colors:[i.card,i.border,i.secondary,i.accent,i.primary],tags:a}}var qe=[{id:`preserve`,name:`Keep project colors`,colors:[]},q(`blue`,`Cobalt & cloud`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#0f172a`,card:`#f1f5f9`,border:`#cbd5e1`,secondary:`#dbeafe`,accent:`#0284c7`,primary:`#1d4ed8`},`software saas dashboard product blue neutral crisp`),q(`emerald-mint`,`Emerald Mint`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#111827`,card:`#f9fafb`,border:`#dcfce7`,secondary:`#bbf7d0`,accent:`#6ee7b7`,primary:`#10b981`},`saas database backend developer white soft mint light mint pale mint emerald green`),q(`graphite-mono`,`Graphite Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#111318`,card:`#f5f6f8`,border:`#d9dde3`,secondary:`#9ca3af`,accent:`#374151`,primary:`#18181b`},`minimal monochrome documentation clean white off-white light gray medium gray dark slate charcoal black`),q(`azure-mono`,`Azure Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f172a`,card:`#eff6ff`,border:`#bfdbfe`,secondary:`#93c5fd`,accent:`#2563eb`,primary:`#1e40af`},`saas cloud white ice blue pale sky soft blue royal blue deep cobalt`),q(`indigo-mono`,`Indigo Mono`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#172554`,card:`#eef2ff`,border:`#c7d2fe`,secondary:`#a5b4fc`,accent:`#4f46e5`,primary:`#1e1b4b`},`saas workspace off-white pale blue soft periwinkle light indigo slate blue deep navy`),q(`ocean-breeze`,`Ocean Breeze`,`Clean SaaS`,`light`,{background:`#f0f9ff`,foreground:`#0f2933`,card:`#e0f2fe`,border:`#d1d5db`,secondary:`#99f6e4`,accent:`#475569`,primary:`#059669`},`saas ice blue pale cyan light gray soft teal slate emerald green calm`),q(`cerulean-pro`,`Cerulean Pro`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f1d2d`,card:`#f0f7ff`,border:`#d8dee9`,secondary:`#bae6fd`,accent:`#475569`,primary:`#0284c7`},`saas assistant pure white ice blue light gray soft sky slate blue cerulean blue`),q(`mint-signal`,`Mint Signal`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0b221a`,card:`#f8faf9`,border:`#e2e8e6`,secondary:`#d1fae5`,accent:`#2dd4bf`,primary:`#00c896`},`saas analytics white off-white light gray pale mint soft teal neon mint green`),q(`clean-slate`,`Clean Slate`,`Clean SaaS`,`light`,{background:`#f7f9fc`,foreground:`#141926`,card:`#eef2f7`,border:`#d5dce6`,secondary:`#cbd5e1`,accent:`#818cf8`,primary:`#4338ca`},`saas cool off-white pale blue-gray light gray silver soft periwinkle royal indigo`),q(`amber-minimal`,`Amber Minimal`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#1f1b14`,card:`#fafaf9`,border:`#e5e7eb`,secondary:`#fef3c7`,accent:`#9ca3af`,primary:`#d97706`},`saas clean white off-white light gray pale cream soft gray golden amber`),q(`sage-mist`,`Sage Mist`,`Clean SaaS`,`light`,{background:`#f8faf8`,foreground:`#16241b`,card:`#f1f5f1`,border:`#dbe2db`,secondary:`#d9ead9`,accent:`#1f4d36`,primary:`#57534e`},`saas calm off-white light gray pale sage deep forest warm gray`),q(`perpetuity`,`Perpetuity`,`Clean SaaS`,`light`,{background:`#eef8f8`,foreground:`#0e2a2c`,card:`#ddf2f2`,border:`#bae6e8`,secondary:`#bfdbfe`,accent:`#14b8a6`,primary:`#0f766e`},`saas pale ice-teal soft aqua light cyan pale blue medium teal deep teal`),q(`cobalt-mono`,`Cobalt Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c1b3a`,card:`#eff6ff`,border:`#dbeafe`,secondary:`#93c5fd`,accent:`#3b82f6`,primary:`#1d4ed8`},`saas pure white ice blue pale sky soft blue bright blue electric cobalt`),q(`indigo-frost`,`Indigo Frost`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#121c3b`,card:`#eff4ff`,border:`#dbeafe`,secondary:`#a5b4fc`,accent:`#2563eb`,primary:`#1e3a8a`},`saas pure white pale blue soft sky periwinkle royal blue deep navy`),q(`harbor-steel`,`Harbor Steel`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#132234`,card:`#eef4fa`,border:`#d6dee8`,secondary:`#cbd5e1`,accent:`#475569`,primary:`#1e3a5f`},`saas enterprise off-white ice blue light gray silver slate blue deep steel blue`),q(`chalk-slate`,`Chalk Slate`,`Clean SaaS`,`light`,{background:`#f6f8fa`,foreground:`#111827`,card:`#eaeff5`,border:`#d1d9e4`,secondary:`#cbd5e1`,accent:`#64748b`,primary:`#111827`},`saas docs cool off-white pale blue-gray light gray silver slate gray near-black`),q(`emerald-spring`,`Emerald Spring`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c271d`,card:`#ecfdf5`,border:`#d1fae5`,secondary:`#a7f3d0`,accent:`#34d399`,primary:`#059669`},`saas fresh pure white pale mint soft sage light teal mint green emerald green`),q(`azure-pro`,`Azure Pro`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0d1b36`,card:`#f0f7ff`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#60a5fa`,primary:`#1d4ed8`},`saas pure white ice blue light gray pale sky soft blue royal azure`),q(`slate-haze`,`Slate Haze`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f172a`,card:`#f8fafc`,border:`#e2e8f0`,secondary:`#cbd5e1`,accent:`#64748b`,primary:`#0f294a`},`saas b2b pure white off-white light gray silver cool gray deep navy`),q(`verdant-sky`,`Verdant Sky`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c2920`,card:`#f0f9ff`,border:`#d1fae5`,secondary:`#99f6e4`,accent:`#10b981`,primary:`#14532d`},`saas climate pure white ice blue pale mint soft teal emerald green forest green`),q(`slate-minimal`,`Slate Minimal`,`Clean SaaS`,`light`,{background:`#e9f2fc`,foreground:`#0f1e36`,card:`#f3f8fe`,border:`#c7ddf5`,secondary:`#7da2cc`,accent:`#475569`,primary:`#172554`},`saas soft sky-blue ice blue pale sky steel blue slate blue deep navy`),q(`meridian-blue`,`Meridian Blue`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0e1d3d`,card:`#eff6ff`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#475569`,primary:`#1e3a8a`},`saas pure white ice blue light gray pale sky slate blue deep royal blue`),q(`teal-mist`,`Teal Mist`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0b2b2c`,card:`#f5fbfa`,border:`#d1fae5`,secondary:`#99f6e4`,accent:`#14b8a6`,primary:`#0f766e`},`saas pure white off-white pale mint soft aqua medium teal deep emerald teal`),q(`cobalt-steel`,`Cobalt Steel`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#10203a`,card:`#f0f6ff`,border:`#e2e8f0`,secondary:`#cbd5e1`,accent:`#93c5fd`,primary:`#1d4ed8`},`saas pure white ice blue light gray silver pale blue royal cobalt`),q(`forest`,`Forest & ivory`,`Warm Editorial`,`light`,{background:`#f6f4ec`,foreground:`#1d2b22`,card:`#ece8da`,border:`#c9c4b1`,secondary:`#d8e2cf`,accent:`#6b8f5e`,primary:`#2a543c`},`editorial organic botanical magazine green warm ivory`),q(`vintage-paper`,`Vintage Paper`,`Warm Editorial`,`light`,{background:`#faf4e8`,foreground:`#2b2016`,card:`#f4ead8`,border:`#e3d2b4`,secondary:`#d9c3a3`,accent:`#b68f64`,primary:`#6f4e37`},`editorial warm cream sand warm beige tan coffee brown paper book`),q(`solar-dusk`,`Solar Dusk`,`Warm Editorial`,`light`,{background:`#fdf8f1`,foreground:`#291e19`,card:`#f8efe2`,border:`#efe0cb`,secondary:`#dfd0ba`,accent:`#8a817c`,primary:`#c85a32`},`editorial warm ivory pale cream soft sand warm gray terracotta orange`),q(`onyx`,`Onyx & brass`,`Warm Editorial`,`light`,{background:`#f7f3ea`,foreground:`#1f1d1c`,card:`#ede6d6`,border:`#d3c6ab`,secondary:`#e6d8b8`,accent:`#a17a36`,primary:`#785a29`},`editorial luxury hospitality watches heritage gold brass`),q(`nature`,`Nature`,`Warm Editorial`,`light`,{background:`#faf9f4`,foreground:`#1d291a`,card:`#f4f0e4`,border:`#dce5d4`,secondary:`#c4d6b0`,accent:`#6b8e23`,primary:`#2d5a27`},`editorial warm off-white cream sage tint light moss olive green forest green`),q(`amber-hearth`,`Amber Hearth`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1f2326`,card:`#fdf6ea`,border:`#e2e4e6`,secondary:`#4a6b73`,accent:`#374151`,primary:`#b44c1e`},`editorial pure white pale cream soft gray slate teal charcoal rust orange`),q(`kodama-grove`,`Kodama Grove`,`Warm Editorial`,`light`,{background:`#ece4d0`,foreground:`#232b1e`,card:`#e3d8be`,border:`#c8c8a2`,secondary:`#c5b089`,accent:`#839d78`,primary:`#4b6b3c`},`editorial warm khaki tan sand light olive sage green moss green botanical`),q(`notebook`,`Notebook`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#18181b`,card:`#27272a`,border:`#71717a`,secondary:`#d4d4d8`,accent:`#334155`,primary:`#b08968`},`editorial writing journal pure white charcoal medium gray light gray dark slate warm tan`),q(`caffeine`,`Caffeine`,`Warm Editorial`,`light`,{background:`#fbf9f5`,foreground:`#261a14`,card:`#f5efe6`,border:`#e3d5c3`,secondary:`#b8a391`,accent:`#8b5e3c`,primary:`#4a2c1d`},`editorial coffee warm off-white cream sand taupe warm brown espresso brown`),q(`camel-linen`,`Camel Linen`,`Warm Editorial`,`light`,{background:`#fcf8f0`,foreground:`#291e14`,card:`#f5ebd9`,border:`#e3d1b3`,secondary:`#d2b48c`,accent:`#a97442`,primary:`#7c4d1f`},`editorial luxury warm ivory cream sand tan camel brown deep bronze`),q(`mocha-mousse`,`Mocha Mousse`,`Warm Editorial`,`light`,{background:`#f3e9df`,foreground:`#2a1d19`,card:`#f8f1ea`,border:`#e2d2c3`,secondary:`#d8a7a7`,accent:`#8c5e4d`,primary:`#4e2f24`},`editorial warm beige cream sand dusty rose mocha brown deep cocoa`),q(`terracotta-clay`,`Terracotta Clay`,`Warm Editorial`,`light`,{background:`#fbf7f2`,foreground:`#2b1c15`,card:`#f5ece1`,border:`#f6d5c3`,secondary:`#e29578`,accent:`#c9976b`,primary:`#a44a2a`},`editorial warm off-white cream pale peach soft terracotta warm tan rust terracotta`),q(`rosewood-clay`,`Rosewood Clay`,`Warm Editorial`,`light`,{background:`#fcf6ef`,foreground:`#2c181a`,card:`#f5ebe0`,border:`#e3d2bf`,secondary:`#d9a1a0`,accent:`#c96846`,primary:`#7a2e34`},`editorial warm ivory cream sand dusty rose terracotta deep rosewood`),q(`rose-pine`,`Rosé Pine`,`Warm Editorial`,`light`,{background:`#faf4ed`,foreground:`#26233a`,card:`#f2e9e1`,border:`#dfdad9`,secondary:`#c4a7b7`,accent:`#907aa9`,primary:`#2e2a45`},`editorial warm peach-cream cream sand dusty mauve muted plum deep charcoal-indigo`),q(`linen-stone`,`Linen Stone`,`Warm Editorial`,`light`,{background:`#f1eadf`,foreground:`#24211a`,card:`#f8f4ec`,border:`#e5dac7`,secondary:`#c8baa5`,accent:`#8c8376`,primary:`#4f4832`},`editorial architecture warm sand-beige cream light sand warm taupe stone gray deep olive-brown`),q(`burgundy-wine`,`Burgundy Wine`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#281219`,card:`#faf7f8`,border:`#f5d0da`,secondary:`#d89ca8`,accent:`#be123c`,primary:`#6b122b`},`editorial wine culture pure white off-white pale pink dusty rose crimson deep burgundy`),q(`honey-sandstone`,`Honey Sandstone`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1f1a14`,card:`#faf9f5`,border:`#e5e7eb`,secondary:`#fde68a`,accent:`#1f2937`,primary:`#d97706`},`editorial pure white off-white light gray pale gold charcoal black warm honey amber`),q(`copper-linen`,`Copper Linen`,`Warm Editorial`,`light`,{background:`#faf6f0`,foreground:`#291c15`,card:`#f4ede2`,border:`#e2ddd6`,secondary:`#f6cab2`,accent:`#c96f49`,primary:`#9a431d`},`editorial warm off-white cream light gray soft peach warm terracotta burnt copper`),q(`sage-moss`,`Sage Moss`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1a201b`,card:`#f6f8f5`,border:`#dce8d7`,secondary:`#b7c9a6`,accent:`#5f7d47`,primary:`#232825`},`editorial pure white off-white pale sage soft olive moss green deep charcoal`),q(`copper-clay`,`Copper Clay`,`Warm Editorial`,`light`,{background:`#fbf7f2`,foreground:`#2c1912`,card:`#f4eadf`,border:`#e2cfb9`,secondary:`#f2bfa0`,accent:`#c85e37`,primary:`#7c2d12`},`editorial warm off-white cream sand warm peach terracotta deep rust brown`),q(`obsidian`,`Obsidian & cyan`,`Dark DevTools`,`dark`,{background:`#090b10`,foreground:`#f1f5f9`,card:`#121621`,border:`#273043`,secondary:`#1c2638`,accent:`#22d3ee`,primary:`#38bdf8`},`devtools dark oled api cloud console terminal cyan blue`),q(`matrix-green`,`Matrix Green`,`Dark DevTools`,`dark`,{background:`#050806`,foreground:`#e6ffe9`,card:`#0b120d`,border:`#132a1a`,secondary:`#14532d`,accent:`#16a34a`,primary:`#22c55e`},`devtools terminal hacker pure black pitch black dark forest deep green medium green neon matrix green`),q(`neon-onyx`,`Neon Onyx`,`Dark DevTools`,`dark`,{background:`#060708`,foreground:`#f3f7f2`,card:`#141619`,border:`#262930`,secondary:`#3f4552`,accent:`#6b7280`,primary:`#84cc16`},`devtools oled pure black dark charcoal deep gray slate gray medium gray neon lime green`),q(`gilded-obsidian`,`Gilded Obsidian`,`Dark DevTools`,`dark`,{background:`#080809`,foreground:`#f7f3e9`,card:`#121215`,border:`#232329`,secondary:`#373741`,accent:`#b08b4f`,primary:`#f59e0b`},`devtools luxury dark pitch black near-black dark charcoal deep gray muted gold warm amber gold`),q(`electric-midnight`,`Electric Midnight`,`Dark DevTools`,`dark`,{background:`#070b18`,foreground:`#eef4ff`,card:`#0f172a`,border:`#1e2948`,secondary:`#1e3a8a`,accent:`#475569`,primary:`#3b82f6`},`devtools cloud deep navy-black dark navy midnight blue deep royal slate blue electric blue`),q(`liquid-neon`,`Liquid Neon`,`Dark DevTools`,`dark`,{background:`#05090b`,foreground:`#ecfeff`,card:`#0c1418`,border:`#113038`,secondary:`#0e7490`,accent:`#22d3ee`,primary:`#06f6ff`},`devtools cyber pitch black near-black dark teal deep cyan bright aqua neon cyan`),q(`amber-dark`,`Amber Dark`,`Dark DevTools`,`dark`,{background:`#09090b`,foreground:`#faf6ee`,card:`#141418`,border:`#26262e`,secondary:`#3f3f46`,accent:`#64748b`,primary:`#f59e0b`},`devtools cli pitch black near-black dark charcoal deep gray slate warm amber`),q(`carbon`,`Carbon & emerald`,`Dark DevTools`,`dark`,{background:`#0a0c0b`,foreground:`#eef3ef`,card:`#131715`,border:`#28322d`,secondary:`#1b2923`,accent:`#34d399`,primary:`#10b981`},`devtools dark database observability infra emerald green`),q(`midnight`,`Midnight & violet`,`Dark DevTools`,`dark`,{background:`#0c0a14`,foreground:`#f3f1ff`,card:`#161224`,border:`#2e2747`,secondary:`#241c3d`,accent:`#c084fc`,primary:`#8b5cf6`},`devtools dark ai platform sdk graph purple violet`),q(`amber-slate`,`Amber Slate`,`Dark DevTools`,`light`,{background:`#eef1f5`,foreground:`#141d2b`,card:`#e2e6ec`,border:`#c7cfd9`,secondary:`#cbd5e1`,accent:`#1e3a5f`,primary:`#c2410c`},`devtools engineering cool light gray silver pale blue-gray navy blue burnt orange`),q(`darkmatter`,`Darkmatter`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#15202b`,card:`#f7f8fa`,border:`#e2e6ec`,secondary:`#fed7aa`,accent:`#0f766e`,primary:`#c2410c`},`devtools pure white off-white light gray pale peach teal blue burnt orange`),q(`crimson-terminal`,`Crimson Terminal`,`Dark DevTools`,`light`,{background:`#eceff3`,foreground:`#16161a`,card:`#18181b`,border:`#c5cbd4`,secondary:`#dc2626`,accent:`#7f1d1d`,primary:`#78716c`},`devtools terminal cool light gray pitch black silver crimson red deep burgundy warm gray`),q(`pine-terminal`,`Pine Terminal`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#14241b`,card:`#f8f8f5`,border:`#e4dac8`,secondary:`#c2b6a4`,accent:`#6b705c`,primary:`#14532d`},`devtools pure white off-white sand warm taupe olive gray deep pine green`),q(`onyx-mono`,`Onyx Mono`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#09090b`,card:`#f8f9fa`,border:`#e4e7eb`,secondary:`#cbd2d9`,accent:`#323f4b`,primary:`#09090b`},`devtools minimal pure white off-white light gray silver dark charcoal pitch black`),q(`cobalt-field`,`Cobalt Field`,`Dark DevTools`,`light`,{background:`#f8fafc`,foreground:`#0f172a`,card:`#ecfdf5`,border:`#e2e8f0`,secondary:`#10b981`,accent:`#09090b`,primary:`#1d4ed8`},`devtools off-white pale mint light gray emerald green pitch black electric cobalt`),q(`cyan-dawn`,`Cyan Dawn`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#0b1824`,card:`#f0f9ff`,border:`#e2e8f0`,secondary:`#cffafe`,accent:`#111827`,primary:`#06b6d4`},`devtools pure white ice blue light gray pale cyan pitch black bright cyan`),q(`berry-lilac`,`Berry Lilac`,`Bold Consumer`,`light`,{background:`#fdf2f8`,foreground:`#331127`,card:`#fce7f3`,border:`#f3d5f7`,secondary:`#c08497`,accent:`#86198f`,primary:`#9d174d`},`consumer chat pale lavender-pink soft pink pastel lilac mauve plum deep berry`),q(`lavender-sky`,`Lavender Sky`,`Bold Consumer`,`light`,{background:`#f7f8fc`,foreground:`#1f2335`,card:`#ede9fe`,border:`#c7d2fe`,secondary:`#7dd3fc`,accent:`#14b8a6`,primary:`#7c3aed`},`consumer pastel off-white pale lavender periwinkle sky blue teal vibrant violet`),q(`candyland`,`Candyland`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#2b1629`,card:`#fef9c3`,border:`#fbcfe8`,secondary:`#bae6fd`,accent:`#a7f3d0`,primary:`#ec4899`},`consumer playful pure white pale yellow soft pink sky blue mint bubblegum pink`),q(`cyberpunk`,`Cyberpunk`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#141226`,card:`#f1f5f9`,border:`#cffafe`,secondary:`#e2e8f0`,accent:`#06b6d4`,primary:`#e11d90`},`consumer neon pure white ice gray pale cyan light gray electric cyan neon magenta`),q(`neo-brutalism`,`Neo Brutalism`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#0a0a0a`,card:`#0a0a0a`,border:`#38bdf8`,secondary:`#facc15`,accent:`#ffffff`,primary:`#ef4444`},`consumer graphic pure white pure black sky blue bright yellow vivid red brutalist`),q(`bubblegum`,`Bubblegum`,`Bold Consumer`,`light`,{background:`#ffeaf4`,foreground:`#361326`,card:`#fef3c7`,border:`#fed7aa`,secondary:`#bae6fd`,accent:`#d8b4fe`,primary:`#ec4899`},`consumer pastel pink soft yellow peach sky blue lavender hot pink playful`),q(`retro-arcade`,`Retro Arcade`,`Bold Consumer`,`light`,{background:`#fdf7e7`,foreground:`#1c2434`,card:`#99f6e4`,border:`#64748b`,secondary:`#facc15`,accent:`#f97316`,primary:`#d946ef`},`consumer gaming pale cream soft teal slate blue golden yellow coral red magenta`),q(`violet-bloom`,`Violet Bloom`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#1e1633`,card:`#f5f3ff`,border:`#e5e7eb`,secondary:`#ddd6fe`,accent:`#818cf8`,primary:`#7c3aed`},`consumer modern pure white pale lavender light gray soft lilac periwinkle electric violet`),q(`amethyst-haze`,`Amethyst Haze`,`Bold Consumer`,`light`,{background:`#faf7fb`,foreground:`#2b1c2e`,card:`#fce7f3`,border:`#e9d5ff`,secondary:`#d8a7b1`,accent:`#a78bfa`,primary:`#7e22ce`},`consumer off-white pale pink soft lilac dusty rose mauve muted purple`),q(`sunset-horizon`,`Sunset Horizon`,`Bold Consumer`,`light`,{background:`#fff7f2`,foreground:`#2f1812`,card:`#ffedd5`,border:`#fed7aa`,secondary:`#fca5a5`,accent:`#ea580c`,primary:`#f95738`},`consumer warm peach-white pale apricot soft peach warm coral terracotta vibrant coral-orange`),q(`cosmic-night`,`Cosmic Night`,`Bold Consumer`,`light`,{background:`#f6f3fc`,foreground:`#201836`,card:`#ede9fe`,border:`#dbe4ff`,secondary:`#d8b4fe`,accent:`#6366f1`,primary:`#7c3aed`},`consumer pale lavender-white soft lilac pale periwinkle pastel purple slate violet medium purple`),q(`northern-lights`,`Northern Lights`,`Bold Consumer`,`light`,{background:`#f5faf9`,foreground:`#0c2720`,card:`#e0f2fe`,border:`#d1fae5`,secondary:`#5eead4`,accent:`#10b981`,primary:`#14532d`},`consumer aurora off-white ice blue pale mint soft teal emerald deep forest green`),q(`tangerine`,`Tangerine`,`Bold Consumer`,`light`,{background:`#f7f9fc`,foreground:`#1f1c18`,card:`#eef2f6`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#475569`,primary:`#ea580c`},`consumer cool off-white pale blue-gray light gray soft sky slate burnt tangerine`),q(`quantum-rose`,`Quantum Rose`,`Bold Consumer`,`light`,{background:`#fff0f5`,foreground:`#331122`,card:`#fce7f3`,border:`#fbcfe8`,secondary:`#f9a8d4`,accent:`#ec4899`,primary:`#be185d`},`consumer beauty soft blush pink pastel pink light rose bubblegum hot pink deep magenta`),q(`soft-pop`,`Soft Pop`,`Bold Consumer`,`light`,{background:`#fcfbf7`,foreground:`#18181b`,card:`#18181b`,border:`#22d3ee`,secondary:`#facc15`,accent:`#e9d5ff`,primary:`#9333ea`},`consumer playful warm off-white charcoal black bright cyan golden yellow pale lavender electric purple`),q(`swiss-red`,`Swiss Red`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#111111`,card:`#111111`,border:`#64748b`,secondary:`#facc15`,accent:`#ef4444`,primary:`#b91c1c`},`consumer editorial swiss poster pure white pure black slate gray golden yellow vivid red crimson`),q(`violet-disco`,`Violet Disco`,`Bold Consumer`,`light`,{background:`#fcf6ec`,foreground:`#1e132b`,card:`#111115`,border:`#ede9fe`,secondary:`#c4b5fd`,accent:`#a78bfa`,primary:`#7c3aed`},`consumer music warm cream pitch black pale lilac soft purple bright lavender vivid violet`),q(`sakura-dawn`,`Sakura Dawn`,`Bold Consumer`,`light`,{background:`#fff8f9`,foreground:`#331621`,card:`#fce7f3`,border:`#ffd6e0`,secondary:`#fda4af`,accent:`#fb7185`,primary:`#e11d48`},`consumer blossom warm off-white pale pink soft blush pastel rose coral pink sakura pink`),q(`violet-pulse`,`Violet Pulse`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#1c1538`,card:`#eff6ff`,border:`#ede9fe`,secondary:`#ddd6fe`,accent:`#818cf8`,primary:`#6d28d9`},`consumer pure white ice blue pale lavender soft lilac periwinkle vivid violet`),q(`pastel-dreams`,`Pastel Dreams`,`Bold Consumer`,`light`,{background:`#f9f6ff`,foreground:`#271b38`,card:`#fce7f3`,border:`#ede9fe`,secondary:`#ddd6fe`,accent:`#a5b4fc`,primary:`#8b5cf6`},`consumer pale lilac-white soft pink pastel lavender lilac periwinkle soft violet`)],Je=new Set([`preserve`,`blue`,`emerald-mint`,`forest`,`vintage-paper`,`obsidian`]),Ye=[`All`,`Clean SaaS`,`Warm Editorial`,`Dark DevTools`,`Bold Consumer`],Xe=[`--card / --muted`,`--border / --input`,`--secondary`,`--accent`,`--primary`];function Ze(e){let t=qe.find(t=>t.id===e);if(!t?.tokens)return``;let n=t.tokens;return`Project palette direction: ${t.name} (${t.category}, ${t.mode} mode). 5-token semantic theme: --background ${n.background}; --foreground ${n.foreground}; --card/--muted ${n.card}; --border/--input ${n.border}; --secondary ${n.secondary}; --accent ${n.accent}; --primary ${n.primary}. Apply coherently with WCAG AA contrast; preserve the product identity and important behavior.`}var Qe=[{id:`editorial-contrast`,name:`Editorial`,summary:`A larger heading and more space around the content.`},{id:`compact-surface`,name:`Compact`,summary:`A tighter row for scanning items and actions quickly.`}];function $e(e){let t=Qe.find(t=>t.id===e);return t?`Design comparison direction (${t.id} — ${t.name}): ${t.summary} Preserve all existing content, reference permissions, editable paths and required interactions.`:``}function et({value:e,paletteId:t,onChange:n}){let r=qe.find(e=>e.id===t)?.tokens,i=r?.primary??`var(--action)`,a=r?.secondary??`var(--selected)`,o=r?.foreground??`var(--ink)`,s=r?.background??`var(--surface)`,c=r?.border??`var(--line)`;return(0,w.jsxs)(`div`,{className:`wb-direction-compare-picker`,role:`group`,"aria-label":`Layout examples`,children:[(0,w.jsxs)(`div`,{className:`wb-direction-intro`,children:[(0,w.jsx)(`p`,{className:`field-help`,children:`These examples show how much space and emphasis the same content can have. Choosing one adds layout guidance to your brief.`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":!e,onClick:()=>n(``),children:`Use project layout`})]}),(0,w.jsx)(`div`,{className:`wb-direction-candidates`,children:Qe.map(t=>{let r=e===t.id;return(0,w.jsxs)(`article`,{className:`wb-direction-card`+(r?` is-selected`:``),children:[(0,w.jsx)(`h3`,{children:t.name}),(0,w.jsxs)(`div`,{className:`wb-direction-specimen is-`+t.id,style:{background:s,color:o,borderColor:c},"aria-hidden":`true`,children:[(0,w.jsx)(`strong`,{children:`Review queue`}),(0,w.jsxs)(`div`,{className:`wb-specimen-row`,children:[(0,w.jsx)(`span`,{children:`Draft navigation`}),(0,w.jsx)(`span`,{className:`wb-specimen-pill`,style:{background:a,color:o},children:`Ready`}),(0,w.jsx)(`span`,{className:`wb-specimen-cta`,style:{color:i,borderColor:i},children:`Open`})]})]}),(0,w.jsx)(`p`,{children:t.summary}),(0,w.jsxs)(`button`,{type:`button`,className:`button `+(r?`primary`:`subtle`),"aria-pressed":r,onClick:()=>n(t.id),children:[`Use `,t.name.toLowerCase(),` layout`]})]},t.id)})})]})}function tt(e){let t=e.replace(`#`,``);if(t.length!==6)return 0;let n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=n(parseInt(t.slice(0,2),16)/255),i=n(parseInt(t.slice(2,4),16)/255),a=n(parseInt(t.slice(4,6),16)/255);return .2126*r+.7152*i+.0722*a}function nt(e,t){let n=tt(e),r=tt(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function rt(e,t){if(t&&nt(e,t)>=4.5)return t;let n=`#0f172a`,r=`#f8fafc`;return nt(e,n)>=nt(e,r)?n:r}function it(e,t){return nt(e,t)>=1.65?t:tt(e)>.4?`rgba(15, 23, 42, 0.22)`:`rgba(248, 250, 252, 0.26)`}function at({palette:e,selected:t,onChoose:n,onPreview:r}){let i=e.tokens,a=i?{"--theme-bg":i.background,"--theme-fg":rt(i.background,i.foreground),"--theme-card":i.card,"--theme-border":it(i.background,i.border),"--theme-primary":i.primary}:void 0;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-palette-card`+(i?` is-themed`:` is-preserve`),"data-mode":e.mode??`system`,"aria-pressed":t,"aria-label":e.name,title:i?`${e.name} · ${e.category} (${e.mode}) · ${Xe.map((t,n)=>`${t} ${e.colors[n]}`).join(`, `)}`:`Preserve the project’s current colors`,style:a,onMouseEnter:r,onFocus:r,onClick:n,children:[(0,w.jsxs)(`span`,{className:`wb-palette-card-top`,"aria-hidden":`true`,children:[(0,w.jsx)(`span`,{className:`wb-palette-mode-pill`,children:t?`Selected`:i?e.mode===`dark`?`Dark`:`Light`:`Default`}),i?(0,w.jsx)(`span`,{className:`wb-palette-swatches`,children:e.colors.map((e,t)=>(0,w.jsx)(`span`,{className:`wb-palette-swatch`,style:{backgroundColor:e}},Xe[t]))}):(0,w.jsxs)(`span`,{className:`wb-palette-swatches is-preserve`,children:[(0,w.jsx)(`span`,{className:`wb-palette-swatch`}),(0,w.jsx)(`span`,{className:`wb-palette-swatch`}),(0,w.jsx)(`span`,{className:`wb-palette-swatch`})]})]}),(0,w.jsx)(`span`,{className:`wb-palette-title`,children:e.name}),(0,w.jsx)(`span`,{className:`wb-palette-meta`,"aria-hidden":`true`,children:i?`${e.category} · ${i.primary}`:`Keep existing CSS tokens intact`})]})}function ot({value:e,onChange:t}){let[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(``),[s,c]=(0,i.useState)(`All`),[l,u]=(0,i.useState)(`all`),[d,f]=(0,i.useState)(null),p=(0,i.useRef)(null),m=(0,i.useRef)(null),h=(0,i.useRef)(!1);(0,i.useEffect)(()=>{n?(p.current?.focus({preventScroll:!0}),p.current?.scrollIntoView({block:`start`})):h.current&&(h.current=!1,m.current?.focus())},[n]);function g(){h.current=!0,r(!1)}let _=a.toLowerCase().trim().split(/\s+/).filter(Boolean),v=qe.filter(t=>{if(!n)return Je.has(t.id)||e===t.id;if(!t.tokens||s!==`All`&&t.category!==s||l!==`all`&&t.mode!==l)return!1;if(!_.length)return!0;let r=[t.name,t.category??``,t.mode??``,t.tags??``,t.tokens.background,t.tokens.foreground,...t.colors].join(` `).toLowerCase();return _.every(e=>r.includes(e))});return(0,w.jsxs)(`div`,{className:`wb-palette-picker`,onKeyDown:e=>{n&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g())},children:[n&&(0,w.jsxs)(`div`,{className:`wb-palette-library-tools`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-library-head`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:g,children:`Back to quick palettes`}),(0,w.jsx)(`span`,{className:`wb-palette-token-legend`,"aria-hidden":`true`,children:`Swatches: card · border · secondary · accent · primary`})]}),(0,w.jsxs)(`label`,{className:`wb-palette-search`,children:[(0,w.jsx)(T,{name:`search`}),(0,w.jsx)(`input`,{ref:p,type:`search`,name:`palette-search`,autoComplete:`off`,spellCheck:!1,"aria-label":`Search palettes`,placeholder:`Search 80 themes by name, vibe, dark/light, or hex…`,value:a,onChange:e=>o(e.target.value)})]}),(0,w.jsxs)(`div`,{className:`wb-palette-filter-bar`,children:[(0,w.jsx)(`div`,{className:`wb-palette-filters`,role:`group`,"aria-label":`Palette categories`,children:Ye.map(e=>(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":s===e,onClick:()=>c(e),children:e},e))}),(0,w.jsx)(`div`,{className:`wb-palette-mode-filter`,role:`group`,"aria-label":`Palette mode`,children:[`all`,`light`,`dark`].map(e=>(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":l===e,onClick:()=>u(e),children:e===`all`?`All modes`:e===`light`?`Light`:`Dark`},e))})]}),(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:v.length?`${v.length} ${v.length===1?`theme`:`themes`} · hover any card to preview tokens, click to select`:`No themes match. Try another color, category, or light/dark mode.`}),(()=>{let t=(d?v.find(e=>e.id===d):null)??v.find(t=>t.id===e)??v[0];if(!t?.tokens)return null;let n=t.tokens,r=rt(n.background,n.foreground),i=rt(n.card,n.foreground),a=rt(n.secondary,n.foreground),o=rt(n.primary,`#ffffff`),s={"--theme-bg":n.background,"--theme-fg":r,"--theme-card":n.card,"--theme-on-card":i,"--theme-border":it(n.background,n.border),"--theme-card-border":it(n.card,n.border),"--theme-secondary":n.secondary,"--theme-on-secondary":a,"--theme-accent":n.accent,"--theme-accent-border":it(n.card,n.accent),"--theme-primary":n.primary,"--theme-on-primary":o};return(0,w.jsxs)(`div`,{className:`wb-palette-preview-card`,style:s,"aria-label":`Live preview of ${t.name}`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-preview-copy`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-preview-head`,children:[(0,w.jsx)(`strong`,{children:t.name}),(0,w.jsxs)(`span`,{className:`wb-palette-preview-badge`,children:[t.mode===`dark`?`Dark`:`Light`,` · `,t.category]})]}),(0,w.jsx)(`div`,{className:`wb-palette-preview-tokens`,"aria-label":`Theme color swatches`,children:[[`Background`,n.background],[`Card`,n.card],[`Border`,n.border],[`Secondary`,n.secondary],[`Accent`,n.accent],[`Primary`,n.primary]].map(([e,t])=>{let r=rt(t);return(0,w.jsxs)(`span`,{className:`wb-palette-preview-block`,style:{backgroundColor:t,color:r,borderColor:it(n.background,t)},children:[(0,w.jsx)(`span`,{className:`wb-palette-preview-block-label`,children:e}),(0,w.jsx)(`span`,{className:`wb-palette-preview-block-hex`,children:t})]},e)})})]}),(0,w.jsxs)(`div`,{className:`wb-palette-preview-sample`,"aria-hidden":`true`,children:[(0,w.jsx)(`span`,{className:`wb-palette-preview-accent`,children:`Outline`}),(0,w.jsx)(`span`,{className:`wb-palette-preview-cta`,children:`Primary CTA`})]})]})})()]}),(0,w.jsx)(`div`,{className:`wb-palettes`+(n?` wb-palette-results`:``),role:`group`,"aria-label":n?`Palette library results`:`Project color palettes`,children:v.map(r=>(0,w.jsx)(at,{palette:r,selected:e===r.id,onPreview:n?()=>f(r.id):void 0,onChoose:()=>{t(r.id),n&&g()}},r.id))}),!n&&(0,w.jsxs)(`div`,{className:`wb-palette-quick-footer`,children:[(0,w.jsxs)(`button`,{ref:m,type:`button`,className:`button subtle wb-palette-browse`,onClick:()=>r(!0),children:[(0,w.jsx)(T,{name:`plus`}),` Browse more palettes`]}),(0,w.jsx)(`span`,{className:`wb-palette-token-legend`,"aria-hidden":`true`,children:`5-token swatches: card · border · secondary · accent · primary`})]})]})}function st({references:e,selected:t,onChange:n,onUpload:r,directions:a={},onDirection:o}){let[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(``);return(0,w.jsxs)(`div`,{className:`wb-reference-picker`,children:[(0,w.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,w.jsx)(`p`,{children:`Choose up to eight images as visual direction.`}),(0,w.jsxs)(`label`,{className:`button subtle wb-upload`,children:[s?`Adding…`:`Upload reference`,(0,w.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp`,disabled:s||t.length>=8,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){c(!0),u(``);try{await r(t)}catch(e){u(e.message)}finally{c(!1)}}}})]})]}),l&&(0,w.jsx)(`p`,{role:`alert`,className:`error-box`,children:l}),(0,w.jsx)(`div`,{className:`wb-reference-grid`,children:e.filter(e=>e.available).map(e=>(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":t.includes(e.id),disabled:!t.includes(e.id)&&t.length>=8,onClick:()=>n(t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,w.jsx)(`img`,{src:e.imageURL,width:`160`,height:`100`,loading:`lazy`,decoding:`async`,alt:e.title}),(0,w.jsx)(`span`,{children:e.title}),t.includes(e.id)&&(0,w.jsx)(`span`,{className:`wb-reference-selected`,children:`Selected`})]},e.id))}),o&&e.filter(e=>t.includes(e.id)).map(e=>(0,w.jsxs)(`section`,{className:`wb-reference-direction`,children:[(0,w.jsx)(`h3`,{children:e.title}),(0,w.jsxs)(`label`,{children:[`Focus on`,(0,w.jsx)(`input`,{maxLength:300,placeholder:`For example, hero composition and typography`,value:a[e.id]?.focus??``,onChange:t=>o(e.id,{...a[e.id],focus:t.target.value})})]}),(0,w.jsxs)(`label`,{children:[`Reference view`,(0,w.jsx)(pe,{label:`Reference view for `+e.title,value:a[e.id]?.view??`full`,onChange:t=>o(e.id,{...a[e.id],view:t}),options:[{value:`full`,label:`Full image`},{value:`top`,label:`Top half`},{value:`center`,label:`Center half`},{value:`bottom`,label:`Bottom half`}]})]})]},e.id)),(0,w.jsx)(`p`,{className:`field-help`,children:`Images are sent only with your Generate action and an image-capable model. Use PNG, JPEG or WebP up to 2 MiB each. Selection does not grant production reuse rights.`})]})}function ct(e,t){return d(`/api/style-direction-guide`,{styleId:e,context:t})}var lt=[{id:`editorial`,name:`Editorial`,subtitle:`Condensed display heads, serif standfirsts, hairline rules`,referenceId:`creative-portfolio`,motionTreatment:`Reveal figures in reading order. Keep the typography steady.`},{id:`minimalism`,name:`Minimalism`,subtitle:`Generous negative space, quiet scale contrast, fine construction hairlines`,referenceId:`minimalist-pitch`,motionTreatment:`Use brief transitions for state changes. Give content a stable resting state.`},{id:`brutalism`,name:`Brutalism`,subtitle:`3px structural frames, uppercase black display, zero radius, shared grid seams`,referenceId:`orange-grunge`,motionTreatment:`Use direct press and selection feedback with crisp state changes.`},{id:`maximal`,name:`Maximal`,subtitle:`Poster-scale condensed type, crisp offset depth, dense compartmentalized register`,referenceId:`bold-portfolio`,motionTreatment:`Use one focal reveal to direct attention through the composition.`},{id:`bento-product`,name:`Product showcase`,subtitle:`Asymmetric feature compartments, clean UI framing, scannable specs`,referenceId:`landing-pages`,motionTreatment:`Use state transitions to show cause and effect in the actual product UI.`},{id:`swiss-technical`,name:`Technical / Swiss`,subtitle:`Modular hairline grid, tabular readouts, crisp spec-sheet precision`,referenceId:`refero-teenage-engineering`,motionTreatment:`Animate state changes within the grid and keep measurement labels stable.`},{id:`quiet-luxury`,name:`Quiet luxury`,subtitle:`Art-directed photography, precise typography, a quiet purchase path`,motionTreatment:`Use a short image dissolve only when the user changes views.`},{id:`commerce-catalog`,name:`Commerce catalog`,subtitle:`Comparable product views, clear variants, practical filters`,motionTreatment:`Keep filter results and product options stable during updates.`},{id:`data-workbench`,name:`Data workbench`,subtitle:`Clear table hierarchy, dense controls, visible status`,motionTreatment:`Use brief feedback after actions and keep rows anchored.`}],ut=`Keep motion brief and scoped to transform and opacity. Honor prefers-reduced-motion and preserve visible focus.`;function dt(e,t,n){if(!(!e?.referenceId||n.length>=8&&!n.includes(e.referenceId)))return t.some(t=>t.id===e.referenceId&&t.available)?e.referenceId:void 0}function ft(e,t,n){let r=lt.find(t=>t.id===e);return r?[`[Hallmark Style Direction: ${r.name}]`,n,`- Motion: ${r.motionTreatment} ${ut}`,t?`Attached style visual reference (${r.referenceId}): study layout rhythm, typographic scale, spacing, and surface framing only; do NOT copy literal colors from the screenshot.`:``].filter(Boolean).join(`
|
|
17
|
-
`):``}function
|
|
18
|
-
`)}function J({styleId:e,styleContext:t,attachStyleImage:n,onSelectStyle:r,onSelectStyleContext:a,onToggleAttachStyleImage:o,references:s,inspection:c,selectedIds:l,photoSettings:u,onPhotoSetting:d,selectedProjectPhotos:f,onToggleProjectPhoto:p,onUploadPhoto:m}){let[h,g]=(0,i.useState)(!1),[_,v]=(0,i.useState)(``),[y,b]=(0,i.useState)(``),[x,S]=(0,i.useState)(``),[C,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(!1),[k,A]=(0,i.useState)(``),j=lt.find(t=>t.id===e);(0,i.useEffect)(()=>{if(!j){v(``),b(``),S(``);return}let e=!0;return E(!0),S(``),ct(j.id,t).then(t=>{e&&(v(t.content),b(t.sourcePath))}).catch(t=>{e&&(v(``),b(``),S(t instanceof Error?t.message:`Could not load style guidance.`))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},[j?.id,t]);let M=dt(j,s,l),N=ee(c),P=c?.files.find(e=>/(?:^|\/)DESIGN\.md$/i.test(e.path))?.path,F=(c?.files??[]).filter(e=>e.kind===`asset`&&/\.(png|jpe?g|webp|avif|gif|svg)$/i.test(e.path)).map(e=>e.path),te=l.map(e=>s.find(t=>t.id===e)).filter(e=>!!e?.id.startsWith(`upload-`));return(0,w.jsxs)(`div`,{className:`wb-style-photo-stack`,children:[(0,w.jsxs)(`section`,{className:`wb-style-section`,"aria-label":`Style directions`,children:[(0,w.jsxs)(`div`,{className:`wb-subsection-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{children:`Style direction`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Shape composition, typography and motion within your project colors.`})]}),j&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>r(``),children:`Clear style`})]}),(0,w.jsxs)(`div`,{className:`wb-style-provenance`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(T,{name:`palette`}),(0,w.jsx)(`span`,{children:P?(0,w.jsxs)(w.Fragment,{children:[`Project guide detected · `,(0,w.jsx)(`code`,{translate:`no`,children:P})]}):(0,w.jsxs)(w.Fragment,{children:[`Hallmark reference · `,(0,w.jsx)(`code`,{translate:`no`,children:`docs/workflow-hallmark-styles.md`})]})})]}),N.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(T,{name:`motion`}),(0,w.jsxs)(`span`,{children:[`Project capabilities · `,N.join(` · `)]})]})]}),(0,w.jsx)(`div`,{className:`wb-style-grid`,children:lt.map(t=>{let n=s.find(e=>e.id===t.referenceId),i=e===t.id;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-card`,"aria-pressed":i,onClick:()=>r(i?``:t.id),children:[(0,w.jsx)(`div`,{className:`wb-style-thumb`,"aria-hidden":`true`,children:n?.available?(0,w.jsx)(`img`,{src:n.imageURL,alt:``,loading:`lazy`,decoding:`async`}):(0,w.jsx)(`div`,{className:`wb-style-fallback`,children:(0,w.jsx)(`span`,{children:t.name})})}),(0,w.jsxs)(`div`,{className:`wb-style-meta`,children:[(0,w.jsx)(`strong`,{children:t.name}),(0,w.jsx)(`small`,{children:t.subtitle})]})]},t.id)})}),j&&(0,w.jsxs)(`div`,{className:`wb-style-controls`,children:[(0,w.jsxs)(`div`,{className:`wb-style-context-picker`,role:`group`,"aria-label":`Style guide detail`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-context-option${t===`efficient`?` is-selected`:``}`,"aria-pressed":t===`efficient`,onClick:()=>a(`efficient`),children:[(0,w.jsx)(`strong`,{children:`Efficient`}),(0,w.jsx)(`span`,{children:`Shorter guide to save tokens with whichever model you connect.`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-context-option${t===`detailed`?` is-selected`:``}`,"aria-pressed":t===`detailed`,onClick:()=>a(`detailed`),children:[(0,w.jsx)(`strong`,{children:`Detailed`}),(0,w.jsx)(`span`,{children:`Richer design guidance for stronger results from your connected model.`})]})]}),(0,w.jsxs)(`p`,{className:`wb-style-motion-note`,children:[(0,w.jsx)(T,{name:`motion`}),(0,w.jsx)(`span`,{children:j.motionTreatment})]}),j.referenceId&&(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:n&&!!M,disabled:!M,onChange:e=>o(e.target.checked)}),(0,w.jsx)(`span`,{children:M?(0,w.jsxs)(w.Fragment,{children:[`Attach matching reference screenshot (`,(0,w.jsx)(`code`,{children:M}),`) for composition and scale.`]}):`The matching reference screenshot is unavailable or the eight-reference limit is reached.`})]}),(0,w.jsx)(`div`,{className:`wb-style-prompt-bar`,children:(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide style design prompt`:`Inspect style design prompt`})}),h&&(0,w.jsxs)(w.Fragment,{children:[!C&&y&&(0,w.jsxs)(`small`,{className:`wb-style-document-source`,children:[`Loaded from `,(0,w.jsx)(`code`,{translate:`no`,children:y})]}),(0,w.jsx)(`pre`,{className:`wb-style-prompt-preview`,children:C?`Loading selected design guide…`:x||ft(j.id,n&&!!M,_)})]})]})]}),(0,w.jsxs)(`section`,{className:`wb-photo-section`,"aria-label":`Use photos in your design`,children:[(0,w.jsxs)(`div`,{className:`wb-subsection-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{children:`Use your photos`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Upload a photo or select existing project images to feature directly on the page rather than using generic placeholders.`})]}),(0,w.jsxs)(`label`,{className:`button subtle wb-photo-upload-btn`,children:[(0,w.jsx)(T,{name:`image`}),D?`Uploading…`:`Upload photo`,(0,w.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/avif`,hidden:!0,disabled:D,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){O(!0),A(``);try{let e=await m(t);typeof e==`string`&&d(e,{usage:`page-photo`,slot:`Hero showcase`,projectPath:``})}catch(e){A(e.message)}finally{O(!1)}}}})]})]}),k&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:k}),F.length>0&&(0,w.jsxs)(`div`,{className:`wb-project-photos`,children:[(0,w.jsx)(`span`,{className:`wb-photo-sublabel`,children:`Photos found in project folder:`}),(0,w.jsx)(`div`,{className:`wb-project-photo-chips`,children:F.map(e=>{let t=f.includes(e),n=`project:`+e;return(0,w.jsxs)(`div`,{className:`wb-project-photo-item`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":t,onClick:()=>p(e),children:[(0,w.jsx)(T,{name:`assets`}),(0,w.jsx)(`span`,{children:e})]}),t&&(0,w.jsx)(pe,{compact:!0,label:`Placement for `+e,value:u[n]?.slot??`Hero showcase`,onChange:t=>d(n,{usage:`page-photo`,slot:t,projectPath:e}),options:[{value:`Hero showcase`,label:`Hero showcase`},{value:`Product / feature card`,label:`Product / feature card`},{value:`Portrait / team section`,label:`Portrait / team section`},{value:`Full-width image band`,label:`Full-width image band`}]})]},e)})})]}),te.length>0&&(0,w.jsx)(`div`,{className:`wb-uploaded-photo-rules`,children:te.map(e=>{let t=u[e.id]??{usage:`inspiration`,slot:`Hero showcase`,projectPath:``};return(0,w.jsxs)(`div`,{className:`wb-uploaded-photo-card`,children:[(0,w.jsx)(`img`,{src:e.imageURL,alt:``,loading:`lazy`,decoding:`async`}),(0,w.jsxs)(`div`,{className:`wb-uploaded-photo-fields`,children:[(0,w.jsx)(`strong`,{children:e.title}),(0,w.jsxs)(`div`,{className:`wb-photo-usage-row`,children:[(0,w.jsx)(pe,{compact:!0,label:`How to use `+e.title,value:t.usage,onChange:n=>d(e.id,{...t,usage:n}),options:[{value:`inspiration`,label:`Layout / mood inspiration only`},{value:`page-photo`,label:`Feature photo on page`}]}),t.usage===`page-photo`&&(0,w.jsx)(pe,{compact:!0,label:`Placement for `+e.title,value:t.slot||`Hero showcase`,onChange:n=>d(e.id,{...t,slot:n}),options:[{value:`Hero showcase`,label:`Hero showcase`},{value:`Product / feature card`,label:`Product / feature card`},{value:`Portrait / team section`,label:`Portrait / team section`},{value:`Full-width image band`,label:`Full-width image band`}]})]}),t.usage===`page-photo`&&(0,w.jsxs)(`label`,{className:`wb-photo-path-field`,children:[(0,w.jsx)(`span`,{children:`Local asset path in project (if saved inside project folder)`}),(0,w.jsx)(`input`,{value:t.projectPath,placeholder:`For example, assets/hero.jpg`,onChange:n=>d(e.id,{...t,projectPath:n.target.value})})]})]})]},e.id)})})]})]})}var mt=[{id:`audit`,icon:`shield`,badge:`No API key`,title:`Run Audit`,description:`Check security, contrast, accessibility, and desktop/mobile layouts on any frontend project.`,actionLabel:`Start local audit`},{id:`diff`,icon:`capture`,badge:`No API key`,title:`Branch Visual Diff`,description:`Compare current edits against main, a saved baseline, or a preview URL with an interactive Diff Slider.`,actionLabel:`Compare visual diff`},{id:`mcp`,icon:`mcp`,badge:`Cursor · Claude · Codex`,title:`Connect AI Client`,description:`Link Cursor, Antigravity, Claude Code, or Codex once to fix findings and review changes with 1-click Undo.`,actionLabel:`Connect AI client`}];function ht({surface:e,disabled:t=!1,onSelect:n,onDismiss:r}){let i=`starter-setup-heading-${e}`;return(0,w.jsxs)(`section`,{className:`wb-starter-setup wb-starter-setup--${e}`,"aria-labelledby":i,children:[(0,w.jsxs)(`div`,{className:`wb-starter-header`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:i,className:`wb-starter-title`,children:`Start with zero API keys`}),(0,w.jsx)(`p`,{className:`wb-starter-subtitle`,children:`Run local audits, inspect branch visual diffs, or connect your coding assistant. Direct AI model keys are optional.`})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-starter-dismiss`,onClick:r,"aria-label":`Dismiss starter setup`,children:`Dismiss`})]}),(0,w.jsx)(`div`,{className:`wb-starter-grid`,role:`list`,children:mt.map(e=>(0,w.jsxs)(`article`,{className:`wb-starter-card`,role:`listitem`,children:[(0,w.jsxs)(`div`,{className:`wb-starter-card-top`,children:[(0,w.jsx)(`span`,{className:`wb-starter-icon`,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:e.icon})}),(0,w.jsx)(`span`,{className:`wb-starter-badge`,children:e.badge})]}),(0,w.jsx)(`h3`,{className:`wb-starter-card-title`,children:e.title}),(0,w.jsx)(`p`,{className:`wb-starter-card-desc`,children:e.description}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-starter-card-cta`,disabled:t,onClick:()=>n(e.id),children:[(0,w.jsx)(`span`,{children:e.actionLabel}),(0,w.jsx)(T,{name:`arrow`})]})]},e.id))})]})}function gt({quickAudit:e,onPrefillAuditFix:t,onOpenWorkflows:n,onClearQuickAudit:r}){return(0,w.jsxs)(`section`,{className:`wb-quick-audit-card`,"aria-label":`Project audit summary`,children:[(0,w.jsxs)(`div`,{className:`wb-quick-audit-head`,children:[(0,w.jsxs)(`div`,{className:`wb-quick-audit-title`,children:[(0,w.jsxs)(`strong`,{children:[`Audit Score: `,e.securityReport.score,`/100`]}),(0,w.jsx)(`span`,{className:`wb-wf-scanner-pill ${e.gatePassed?`status-ready`:`status-optional`}`,children:e.gatePassed?`Passed`:`Needs review`}),(0,w.jsxs)(`span`,{className:`wb-quick-audit-meta`,children:[e.securityReport.filesAudited,` files · `,e.totalDurationMs,`ms`]})]}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-actions`,children:[(e.securityReport.findings.length>0||(e.designSystemLock?.violationCount??0)>0)&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>t(e),children:`Fix findings`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:n,children:`Full details`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:r,children:`Dismiss`})]})]}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-pillars`,children:[e.securityReport.scoreBreakdown&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[`Security:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.securitySurface.score,`/30`]})]}),(0,w.jsxs)(`span`,{children:[`Tests:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.testIntegrity.score,`/25`]})]}),(0,w.jsxs)(`span`,{children:[`UI & A11y:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.uiCraftAndA11y.score,`/25`]})]})]}),(0,w.jsxs)(`span`,{children:[`Findings: `,(0,w.jsx)(`strong`,{children:e.securityReport.findings.length})]})]}),e.securityReport.findings.length>0?(0,w.jsx)(`ul`,{className:`wb-quick-audit-list`,children:e.securityReport.findings.slice(0,6).map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`wb-sev-badge sev-${e.severity}`,children:e.severity}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-item-body`,children:[(0,w.jsx)(`strong`,{children:e.message}),(0,w.jsxs)(`small`,{children:[e.path?(0,w.jsxs)(`code`,{translate:`no`,children:[e.path,e.line?`:${e.line}`:``]}):null,e.path&&e.action?` · `:``,e.action]})]})]},`${e.code}-${e.path??t}-${t}`))}):(0,w.jsx)(`p`,{className:`wb-quick-audit-clean`,children:`No security or accessibility issues found.`})]})}function _t({project:e,onClose:t}){let[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(`git`),[s,c]=(0,i.useState)(`main`),[l,u]=(0,i.useState)(`default`),[f,p]=(0,i.useState)(``),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(``),[v,y]=(0,i.useState)(`/`),[b,x]=(0,i.useState)(!0),[S,C]=(0,i.useState)(!1),[E,D]=(0,i.useState)(!0),[O,k]=(0,i.useState)(!1),[A,ee]=(0,i.useState)(!1),[j,M]=(0,i.useState)(``),[N,P]=(0,i.useState)(``),[F,te]=(0,i.useState)(null),[ne,re]=(0,i.useState)(``),[ie,I]=(0,i.useState)(`slider`),[ae,oe]=(0,i.useState)(50),[L,R]=(0,i.useState)(!0),[se,z]=(0,i.useState)(!1),[ce,le]=(0,i.useState)(!1),[B,V]=(0,i.useState)(null),[H,U]=(0,i.useState)(!1),ue=(0,i.useRef)(0),W=(0,i.useCallback)(async()=>{let t=++ue.current;D(!0),M(``);try{let n=e?`?project=${encodeURIComponent(e)}`:``,[i,a]=await Promise.all([d(`/api/visual-diff/baselines${n}`),d(`/api/project/autodetect${n}`).catch(()=>null)]);if(t!==ue.current)return;r(i),V(a),i.routes?.length&&y(i.routes.join(`,`)),i.git?.isRepo&&i.git.defaultBase?(c(i.git.defaultBase),o(`git`)):(i.baselines.length>0&&u(i.baselines[0].name),o(`baseline`)),i.baselines.length>0&&u(i.baselines[0].name),i.devServer?.found&&i.devServer.url&&h(e=>e||i.devServer.url);try{let e=await d(`/api/connections`);if(t!==ue.current)return;let n=e.externalConnectors?.find(e=>[`vercel`,`cloudflare`,`netlify`].includes(e.id)&&e.endpointUrl);n?.endpointUrl&&h(e=>e||n.endpointUrl),n?.baseUrl&&_(e=>e||n.baseUrl)}catch{}}catch(e){t===ue.current&&M(e.message)}finally{t===ue.current&&D(!1)}},[e]);(0,i.useEffect)(()=>{W()},[W]);async function G(){ee(!0),M(``),P(``);try{let t=await d(`/api/visual-diff/baseline`,{project:e,name:f.trim()||void 0,routes:v,render:b,trustBuild:S});p(``),u(t.name),P(`Saved baseline "${t.name}" (Score ${t.score}/100, ${t.screenshotsCount} capture${t.screenshotsCount===1?``:`s`}).`),await W()}catch(e){M(e.message)}finally{ee(!1)}}async function de(){U(!0),M(``),P(``);try{let t=await d(`/api/project/autodetect/vercel-preview`,{project:e,approved:!0});t.latestPreviewUrl?(h(t.latestPreviewUrl),t.productionCandidateUrl&&!g&&_(t.productionCandidateUrl),P(`Found latest Vercel preview: ${t.latestPreviewUrl}`)):P(t.message)}catch(e){M(e.message)}finally{U(!1)}}async function fe(){k(!0),M(``),P(``);try{let t={project:e,mode:a,routes:v,render:b,trustBuild:S};a===`git`?t.baseRef=s.trim()||`main`:a===`baseline`?t.baselineName=l.trim()||`default`:(t.url=m.trim(),t.baseUrl=g.trim());let n=await d(`/api/visual-diff/compare`,t);te(n),n.visualDiff.viewports.length>0&&re(n.visualDiff.viewports[0].name),P(`Compared ${n.comparisonLabel} in ${n.durationMs}ms.`)}catch(e){M(e.message)}finally{k(!1)}}let K=F?.visualDiff.viewports.find(e=>e.name===ne)??F?.visualDiff.viewports[0]??null;return(0,w.jsxs)(`section`,{className:`wb-branch-diff-card page-reveal page-reveal--content`,"aria-label":`Branch and baseline visual diff`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-title-row`,children:[(0,w.jsx)(`h3`,{children:`Branch & Baseline Visual Diff`}),(0,w.jsx)(`span`,{className:`wb-branch-diff-pill`,children:`No API key required`}),n?.devServer?.found&&n.devServer.url&&(0,w.jsxs)(`span`,{className:`wb-branch-diff-pill is-live`,children:[`Dev server: `,n.devServer.url]})]}),(0,w.jsx)(`p`,{className:`wb-branch-diff-sub`,children:`Compare your current edits against a Git branch (read-only worktree), a saved local baseline, or two preview URLs — then copy a ready-to-paste fix prompt for Cursor, Claude Code, Codex, or Antigravity.`})]}),t&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:t,children:`Close`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-controls`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-modes`,role:`group`,"aria-label":`Comparison source`,children:[(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`git`,onClick:()=>o(`git`),children:`Git branch`}),(0,w.jsxs)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`baseline`,onClick:()=>o(`baseline`),children:[`Saved baseline (`,n?.baselines.length??0,`)`]}),(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`url`,onClick:()=>o(`url`),children:`Preview URLs`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-fields`,children:[a===`git`&&(0,w.jsxs)(`label`,{children:[`Base branch or ref`,(0,w.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`main`})]}),a===`baseline`&&(0,w.jsxs)(`label`,{children:[`Saved baseline`,n&&n.baselines.length>0?(0,w.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),children:n.baselines.map(e=>(0,w.jsxs)(`option`,{value:e.name,children:[e.name,` (Score `,e.score??`—`,`/100 · `,e.screenshotsCount,` shots)`]},e.name))}):(0,w.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`Baseline name (e.g. before-redesign)`})]}),a===`url`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{children:[`Before URL (production or base)`,(0,w.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`https://your-app.vercel.app`})]}),(0,w.jsxs)(`label`,{children:[`After URL (PR preview or localhost)`,(0,w.jsx)(`input`,{type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:`https://pr-42-your-app.vercel.app`})]}),(B?.vercel?.linked||B?.vercel?.cliInstalled)&&(0,w.jsxs)(`div`,{className:`wb-branch-vercel-detect`,children:[B.vercel.projectName&&(0,w.jsxs)(`span`,{className:`field-help`,children:[`Linked Vercel project: `,(0,w.jsx)(`strong`,{children:B.vercel.projectName})]}),B.vercel.cliInstalled&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H||O,onClick:()=>void de(),children:H?`Finding preview…`:`Find latest Vercel preview`})]})]}),(0,w.jsxs)(`label`,{children:[`Routes (comma-separated, up to 8)`,(0,w.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`/,/pricing`})]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-action-row`,children:[(0,w.jsx)(`div`,{className:`wb-branch-diff-checks`,children:a!==`url`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),(0,w.jsx)(`span`,{children:`Capture screenshots (desktop, mobile, dark)`})]}),(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked)}),(0,w.jsx)(`span`,{children:`Allow local build for React/Next.js`})]})]})}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-buttons`,children:[a!==`url`&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:A||O||E,onClick:()=>void G(),children:A?`Saving baseline…`:`Save baseline`}),(0,w.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:O||A||E||a===`url`&&(!g.trim()||!m.trim()),onClick:()=>void fe(),children:[(0,w.jsx)(T,{name:`capture`}),O?`Comparing…`:`Run Visual Diff`]})]})]})]}),j&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:j}),N&&(0,w.jsx)(`p`,{className:`connection-success`,role:`status`,children:N}),F&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-results`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-kpis`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Quality Score`}),(0,w.jsxs)(`strong`,{children:[F.delta.beforeScore,` → `,F.delta.afterScore,` (`,F.delta.scoreDelta>=0?`+`:``,F.delta.scoreDelta,`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Max Pixel Diff`}),(0,w.jsxs)(`strong`,{children:[F.visualDiff.maxMismatchPercentage,`% (`,F.visualDiff.totalBoundingBoxes,` `,`region`,F.visualDiff.totalBoundingBoxes===1?``:`s`,`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`New Findings`}),(0,w.jsx)(`strong`,{children:F.delta.introducedCount})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Resolved`}),(0,w.jsx)(`strong`,{children:F.delta.resolvedCount})]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-prompt-bar`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>{navigator.clipboard?.writeText(F.aiFixPrompt).catch(()=>{}),z(!0),window.setTimeout(()=>z(!1),1800)},children:se?`Copied AI fix prompt`:`Copy AI fix prompt`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>{navigator.clipboard?.writeText(F.prProofMarkdown).catch(()=>{}),le(!0),window.setTimeout(()=>le(!1),1800)},children:ce?`Copied PR Proof Markdown`:`Copy PR Proof Markdown`})]}),K&&K.beforeUrl&&K.afterUrl&&(0,w.jsxs)(`div`,{className:`wb-branch-slider-box`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-slider-toolbar`,children:[(0,w.jsx)(`div`,{className:`wb-branch-vp-tabs`,role:`group`,"aria-label":`Captured viewports`,children:F.visualDiff.viewports.map(e=>(0,w.jsxs)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":K.name===e.name,onClick:()=>re(e.name),children:[e.name,` (`,e.mismatchPercentage??0,`%)`]},e.name))}),(0,w.jsxs)(`div`,{className:`wb-branch-vp-tabs`,role:`group`,"aria-label":`Diff view mode`,children:[[`slider`,`2up`,`1up`].map(e=>(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":ie===e,onClick:()=>I(e),children:e===`slider`?`Diff Slider`:e===`2up`?`Side by Side`:`After`},e)),(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:L,onChange:e=>R(e.target.checked)}),(0,w.jsxs)(`span`,{children:[`Changed regions (`,K.boundingBoxes.length,`)`]})]})]})]}),ie===`slider`&&(0,w.jsxs)(`div`,{className:`wb-branch-slider-stage`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-slider-frame`,style:{"--split":`${ae}%`},children:[(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After capture (${K.name})`}),(0,w.jsx)(`div`,{className:`wb-branch-slider-before`,children:(0,w.jsx)(`img`,{src:K.beforeUrl,alt:`Before capture (${K.name})`})}),L&&K.width>0&&K.height>0&&K.boundingBoxes.map((e,t)=>(0,w.jsx)(`div`,{className:`wb-branch-bbox`,style:{left:`${e.x/K.width*100}%`,top:`${e.y/K.height*100}%`,width:`${Math.max(1.5,e.width/K.width*100)}%`,height:`${Math.max(1.5,e.height/K.height*100)}%`}},`${e.x}-${e.y}-${t}`)),(0,w.jsx)(`span`,{className:`wb-branch-slider-handle`,"aria-hidden":`true`})]}),(0,w.jsxs)(`label`,{className:`wb-branch-scrubber`,children:[(0,w.jsxs)(`span`,{children:[`Before (`,ae,`%)`]}),(0,w.jsx)(`input`,{type:`range`,min:0,max:100,value:ae,"aria-label":`Before and after visual diff split`,onChange:e=>oe(Number(e.target.value))}),(0,w.jsxs)(`span`,{children:[`After (`,100-ae,`%)`]})]})]}),ie===`2up`&&(0,w.jsxs)(`div`,{className:`wb-branch-pair-grid`,children:[(0,w.jsxs)(`figure`,{children:[(0,w.jsx)(`figcaption`,{children:`Before`}),(0,w.jsx)(`img`,{src:K.beforeUrl,alt:`Before (${K.name})`})]}),(0,w.jsxs)(`figure`,{children:[(0,w.jsx)(`figcaption`,{children:`After`}),(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After (${K.name})`})]})]}),ie===`1up`&&(0,w.jsx)(`div`,{className:`wb-branch-single`,children:(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After (${K.name})`})})]}),F.delta.layoutShifts&&F.delta.layoutShifts.length>0&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-section`,children:[(0,w.jsxs)(`strong`,{children:[`Layout Shifts (`,F.delta.layoutShifts.length,`)`]}),(0,w.jsx)(`ul`,{children:F.delta.layoutShifts.map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`code`,{children:e.selector}),` — `,e.summary]},`${e.selector}-${t}`))})]}),F.delta.introduced.length>0&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-section`,children:[(0,w.jsxs)(`strong`,{children:[`Newly Introduced Findings (`,F.delta.introducedCount,`)`]}),(0,w.jsx)(`ul`,{children:F.delta.introduced.slice(0,8).map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`wb-sev-badge sev-${e.severity}`,children:e.severity}),` `,(0,w.jsx)(`code`,{children:e.code}),` at `,(0,w.jsx)(`code`,{children:e.location})]},`${e.code}-${t}`))})]})]})]})}function vt(e){return!e||e===`auto`||e===`ui`}var yt={project:``,brief:``,intent:`Website`,palette:`preserve`,styleDirection:``,styleContext:`efficient`,attachStyleImage:!0,photoSettings:{},projectPhotos:[],directionCandidate:``,selected:[],preserve:`Keep existing content and navigation
|
|
16
|
+
`],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`.ui-workflow.json`,t.click(),window.setTimeout(()=>URL.revokeObjectURL(e),1e3)}return(0,w.jsxs)(`details`,{className:`wb-project-rules`,onToggle:e=>o(e.currentTarget.open),children:[(0,w.jsxs)(`summary`,{children:[(0,w.jsx)(T,{name:`terminal`}),(0,w.jsxs)(`span`,{children:[`Import / Export `,(0,w.jsx)(`code`,{translate:`no`,children:`.ui-workflow.json`})]})]}),e?(0,w.jsxs)(`div`,{className:`wb-project-rules-body`,children:[(0,w.jsx)(`p`,{className:`field-help`,children:s?.exists?`Project rules are included in future revisions. Imported rules replace this file only when you export them.`:s?`Save your current behavior prompts as project rules, or import a rules file before exporting.`:m?`Check the project’s rules file and reopen this section to retry.`:`Reading project rules…`}),(0,w.jsx)(`input`,{ref:v,type:`file`,hidden:!0,accept:`.json,application/json`,"aria-label":`Choose workflow rules file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&y(t)}}),l&&(0,w.jsxs)(`details`,{className:`wb-project-rules-preview`,children:[(0,w.jsx)(`summary`,{children:`Review imported rules`}),(0,w.jsx)(`pre`,{translate:`no`,children:JSON.stringify(l,null,2)})]}),(0,w.jsxs)(`div`,{className:`wb-project-rules-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:!s||n||f,onClick:()=>v.current?.click(),children:`Import rules`}),s?.rules&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:n||f,onClick:x,children:`Download project rules`}),s&&(!s.exists||l)&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:n||f,onClick:()=>void b(),children:s.exists?`Replace project rules`:`Export to project`})]}),f&&(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:`Working with project rules…`}),g&&(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:g}),m&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:m})]}):(0,w.jsx)(`p`,{className:`field-help`,children:`Inspect a project folder to manage its workflow rules.`})]})}function q(e,t,n,r,i,a){return{id:e,name:t,category:n,mode:r,tokens:i,colors:[i.card,i.border,i.secondary,i.accent,i.primary],tags:a}}var Ke=[{id:`preserve`,name:`Keep project colors`,colors:[]},q(`blue`,`Cobalt & cloud`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#0f172a`,card:`#f1f5f9`,border:`#cbd5e1`,secondary:`#dbeafe`,accent:`#0284c7`,primary:`#1d4ed8`},`software saas dashboard product blue neutral crisp`),q(`emerald-mint`,`Emerald Mint`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#111827`,card:`#f9fafb`,border:`#dcfce7`,secondary:`#bbf7d0`,accent:`#6ee7b7`,primary:`#10b981`},`saas database backend developer white soft mint light mint pale mint emerald green`),q(`graphite-mono`,`Graphite Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#111318`,card:`#f5f6f8`,border:`#d9dde3`,secondary:`#9ca3af`,accent:`#374151`,primary:`#18181b`},`minimal monochrome documentation clean white off-white light gray medium gray dark slate charcoal black`),q(`azure-mono`,`Azure Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f172a`,card:`#eff6ff`,border:`#bfdbfe`,secondary:`#93c5fd`,accent:`#2563eb`,primary:`#1e40af`},`saas cloud white ice blue pale sky soft blue royal blue deep cobalt`),q(`indigo-mono`,`Indigo Mono`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#172554`,card:`#eef2ff`,border:`#c7d2fe`,secondary:`#a5b4fc`,accent:`#4f46e5`,primary:`#1e1b4b`},`saas workspace off-white pale blue soft periwinkle light indigo slate blue deep navy`),q(`ocean-breeze`,`Ocean Breeze`,`Clean SaaS`,`light`,{background:`#f0f9ff`,foreground:`#0f2933`,card:`#e0f2fe`,border:`#d1d5db`,secondary:`#99f6e4`,accent:`#475569`,primary:`#059669`},`saas ice blue pale cyan light gray soft teal slate emerald green calm`),q(`cerulean-pro`,`Cerulean Pro`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f1d2d`,card:`#f0f7ff`,border:`#d8dee9`,secondary:`#bae6fd`,accent:`#475569`,primary:`#0284c7`},`saas assistant pure white ice blue light gray soft sky slate blue cerulean blue`),q(`mint-signal`,`Mint Signal`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0b221a`,card:`#f8faf9`,border:`#e2e8e6`,secondary:`#d1fae5`,accent:`#2dd4bf`,primary:`#00c896`},`saas analytics white off-white light gray pale mint soft teal neon mint green`),q(`clean-slate`,`Clean Slate`,`Clean SaaS`,`light`,{background:`#f7f9fc`,foreground:`#141926`,card:`#eef2f7`,border:`#d5dce6`,secondary:`#cbd5e1`,accent:`#818cf8`,primary:`#4338ca`},`saas cool off-white pale blue-gray light gray silver soft periwinkle royal indigo`),q(`amber-minimal`,`Amber Minimal`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#1f1b14`,card:`#fafaf9`,border:`#e5e7eb`,secondary:`#fef3c7`,accent:`#9ca3af`,primary:`#d97706`},`saas clean white off-white light gray pale cream soft gray golden amber`),q(`sage-mist`,`Sage Mist`,`Clean SaaS`,`light`,{background:`#f8faf8`,foreground:`#16241b`,card:`#f1f5f1`,border:`#dbe2db`,secondary:`#d9ead9`,accent:`#1f4d36`,primary:`#57534e`},`saas calm off-white light gray pale sage deep forest warm gray`),q(`perpetuity`,`Perpetuity`,`Clean SaaS`,`light`,{background:`#eef8f8`,foreground:`#0e2a2c`,card:`#ddf2f2`,border:`#bae6e8`,secondary:`#bfdbfe`,accent:`#14b8a6`,primary:`#0f766e`},`saas pale ice-teal soft aqua light cyan pale blue medium teal deep teal`),q(`cobalt-mono`,`Cobalt Mono`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c1b3a`,card:`#eff6ff`,border:`#dbeafe`,secondary:`#93c5fd`,accent:`#3b82f6`,primary:`#1d4ed8`},`saas pure white ice blue pale sky soft blue bright blue electric cobalt`),q(`indigo-frost`,`Indigo Frost`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#121c3b`,card:`#eff4ff`,border:`#dbeafe`,secondary:`#a5b4fc`,accent:`#2563eb`,primary:`#1e3a8a`},`saas pure white pale blue soft sky periwinkle royal blue deep navy`),q(`harbor-steel`,`Harbor Steel`,`Clean SaaS`,`light`,{background:`#f8fafc`,foreground:`#132234`,card:`#eef4fa`,border:`#d6dee8`,secondary:`#cbd5e1`,accent:`#475569`,primary:`#1e3a5f`},`saas enterprise off-white ice blue light gray silver slate blue deep steel blue`),q(`chalk-slate`,`Chalk Slate`,`Clean SaaS`,`light`,{background:`#f6f8fa`,foreground:`#111827`,card:`#eaeff5`,border:`#d1d9e4`,secondary:`#cbd5e1`,accent:`#64748b`,primary:`#111827`},`saas docs cool off-white pale blue-gray light gray silver slate gray near-black`),q(`emerald-spring`,`Emerald Spring`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c271d`,card:`#ecfdf5`,border:`#d1fae5`,secondary:`#a7f3d0`,accent:`#34d399`,primary:`#059669`},`saas fresh pure white pale mint soft sage light teal mint green emerald green`),q(`azure-pro`,`Azure Pro`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0d1b36`,card:`#f0f7ff`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#60a5fa`,primary:`#1d4ed8`},`saas pure white ice blue light gray pale sky soft blue royal azure`),q(`slate-haze`,`Slate Haze`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0f172a`,card:`#f8fafc`,border:`#e2e8f0`,secondary:`#cbd5e1`,accent:`#64748b`,primary:`#0f294a`},`saas b2b pure white off-white light gray silver cool gray deep navy`),q(`verdant-sky`,`Verdant Sky`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0c2920`,card:`#f0f9ff`,border:`#d1fae5`,secondary:`#99f6e4`,accent:`#10b981`,primary:`#14532d`},`saas climate pure white ice blue pale mint soft teal emerald green forest green`),q(`slate-minimal`,`Slate Minimal`,`Clean SaaS`,`light`,{background:`#e9f2fc`,foreground:`#0f1e36`,card:`#f3f8fe`,border:`#c7ddf5`,secondary:`#7da2cc`,accent:`#475569`,primary:`#172554`},`saas soft sky-blue ice blue pale sky steel blue slate blue deep navy`),q(`meridian-blue`,`Meridian Blue`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0e1d3d`,card:`#eff6ff`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#475569`,primary:`#1e3a8a`},`saas pure white ice blue light gray pale sky slate blue deep royal blue`),q(`teal-mist`,`Teal Mist`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#0b2b2c`,card:`#f5fbfa`,border:`#d1fae5`,secondary:`#99f6e4`,accent:`#14b8a6`,primary:`#0f766e`},`saas pure white off-white pale mint soft aqua medium teal deep emerald teal`),q(`cobalt-steel`,`Cobalt Steel`,`Clean SaaS`,`light`,{background:`#ffffff`,foreground:`#10203a`,card:`#f0f6ff`,border:`#e2e8f0`,secondary:`#cbd5e1`,accent:`#93c5fd`,primary:`#1d4ed8`},`saas pure white ice blue light gray silver pale blue royal cobalt`),q(`forest`,`Forest & ivory`,`Warm Editorial`,`light`,{background:`#f6f4ec`,foreground:`#1d2b22`,card:`#ece8da`,border:`#c9c4b1`,secondary:`#d8e2cf`,accent:`#6b8f5e`,primary:`#2a543c`},`editorial organic botanical magazine green warm ivory`),q(`vintage-paper`,`Vintage Paper`,`Warm Editorial`,`light`,{background:`#faf4e8`,foreground:`#2b2016`,card:`#f4ead8`,border:`#e3d2b4`,secondary:`#d9c3a3`,accent:`#b68f64`,primary:`#6f4e37`},`editorial warm cream sand warm beige tan coffee brown paper book`),q(`solar-dusk`,`Solar Dusk`,`Warm Editorial`,`light`,{background:`#fdf8f1`,foreground:`#291e19`,card:`#f8efe2`,border:`#efe0cb`,secondary:`#dfd0ba`,accent:`#8a817c`,primary:`#c85a32`},`editorial warm ivory pale cream soft sand warm gray terracotta orange`),q(`onyx`,`Onyx & brass`,`Warm Editorial`,`light`,{background:`#f7f3ea`,foreground:`#1f1d1c`,card:`#ede6d6`,border:`#d3c6ab`,secondary:`#e6d8b8`,accent:`#a17a36`,primary:`#785a29`},`editorial luxury hospitality watches heritage gold brass`),q(`nature`,`Nature`,`Warm Editorial`,`light`,{background:`#faf9f4`,foreground:`#1d291a`,card:`#f4f0e4`,border:`#dce5d4`,secondary:`#c4d6b0`,accent:`#6b8e23`,primary:`#2d5a27`},`editorial warm off-white cream sage tint light moss olive green forest green`),q(`amber-hearth`,`Amber Hearth`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1f2326`,card:`#fdf6ea`,border:`#e2e4e6`,secondary:`#4a6b73`,accent:`#374151`,primary:`#b44c1e`},`editorial pure white pale cream soft gray slate teal charcoal rust orange`),q(`kodama-grove`,`Kodama Grove`,`Warm Editorial`,`light`,{background:`#ece4d0`,foreground:`#232b1e`,card:`#e3d8be`,border:`#c8c8a2`,secondary:`#c5b089`,accent:`#839d78`,primary:`#4b6b3c`},`editorial warm khaki tan sand light olive sage green moss green botanical`),q(`notebook`,`Notebook`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#18181b`,card:`#27272a`,border:`#71717a`,secondary:`#d4d4d8`,accent:`#334155`,primary:`#b08968`},`editorial writing journal pure white charcoal medium gray light gray dark slate warm tan`),q(`caffeine`,`Caffeine`,`Warm Editorial`,`light`,{background:`#fbf9f5`,foreground:`#261a14`,card:`#f5efe6`,border:`#e3d5c3`,secondary:`#b8a391`,accent:`#8b5e3c`,primary:`#4a2c1d`},`editorial coffee warm off-white cream sand taupe warm brown espresso brown`),q(`camel-linen`,`Camel Linen`,`Warm Editorial`,`light`,{background:`#fcf8f0`,foreground:`#291e14`,card:`#f5ebd9`,border:`#e3d1b3`,secondary:`#d2b48c`,accent:`#a97442`,primary:`#7c4d1f`},`editorial luxury warm ivory cream sand tan camel brown deep bronze`),q(`mocha-mousse`,`Mocha Mousse`,`Warm Editorial`,`light`,{background:`#f3e9df`,foreground:`#2a1d19`,card:`#f8f1ea`,border:`#e2d2c3`,secondary:`#d8a7a7`,accent:`#8c5e4d`,primary:`#4e2f24`},`editorial warm beige cream sand dusty rose mocha brown deep cocoa`),q(`terracotta-clay`,`Terracotta Clay`,`Warm Editorial`,`light`,{background:`#fbf7f2`,foreground:`#2b1c15`,card:`#f5ece1`,border:`#f6d5c3`,secondary:`#e29578`,accent:`#c9976b`,primary:`#a44a2a`},`editorial warm off-white cream pale peach soft terracotta warm tan rust terracotta`),q(`rosewood-clay`,`Rosewood Clay`,`Warm Editorial`,`light`,{background:`#fcf6ef`,foreground:`#2c181a`,card:`#f5ebe0`,border:`#e3d2bf`,secondary:`#d9a1a0`,accent:`#c96846`,primary:`#7a2e34`},`editorial warm ivory cream sand dusty rose terracotta deep rosewood`),q(`rose-pine`,`Rosé Pine`,`Warm Editorial`,`light`,{background:`#faf4ed`,foreground:`#26233a`,card:`#f2e9e1`,border:`#dfdad9`,secondary:`#c4a7b7`,accent:`#907aa9`,primary:`#2e2a45`},`editorial warm peach-cream cream sand dusty mauve muted plum deep charcoal-indigo`),q(`linen-stone`,`Linen Stone`,`Warm Editorial`,`light`,{background:`#f1eadf`,foreground:`#24211a`,card:`#f8f4ec`,border:`#e5dac7`,secondary:`#c8baa5`,accent:`#8c8376`,primary:`#4f4832`},`editorial architecture warm sand-beige cream light sand warm taupe stone gray deep olive-brown`),q(`burgundy-wine`,`Burgundy Wine`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#281219`,card:`#faf7f8`,border:`#f5d0da`,secondary:`#d89ca8`,accent:`#be123c`,primary:`#6b122b`},`editorial wine culture pure white off-white pale pink dusty rose crimson deep burgundy`),q(`honey-sandstone`,`Honey Sandstone`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1f1a14`,card:`#faf9f5`,border:`#e5e7eb`,secondary:`#fde68a`,accent:`#1f2937`,primary:`#d97706`},`editorial pure white off-white light gray pale gold charcoal black warm honey amber`),q(`copper-linen`,`Copper Linen`,`Warm Editorial`,`light`,{background:`#faf6f0`,foreground:`#291c15`,card:`#f4ede2`,border:`#e2ddd6`,secondary:`#f6cab2`,accent:`#c96f49`,primary:`#9a431d`},`editorial warm off-white cream light gray soft peach warm terracotta burnt copper`),q(`sage-moss`,`Sage Moss`,`Warm Editorial`,`light`,{background:`#ffffff`,foreground:`#1a201b`,card:`#f6f8f5`,border:`#dce8d7`,secondary:`#b7c9a6`,accent:`#5f7d47`,primary:`#232825`},`editorial pure white off-white pale sage soft olive moss green deep charcoal`),q(`copper-clay`,`Copper Clay`,`Warm Editorial`,`light`,{background:`#fbf7f2`,foreground:`#2c1912`,card:`#f4eadf`,border:`#e2cfb9`,secondary:`#f2bfa0`,accent:`#c85e37`,primary:`#7c2d12`},`editorial warm off-white cream sand warm peach terracotta deep rust brown`),q(`obsidian`,`Obsidian & cyan`,`Dark DevTools`,`dark`,{background:`#090b10`,foreground:`#f1f5f9`,card:`#121621`,border:`#273043`,secondary:`#1c2638`,accent:`#22d3ee`,primary:`#38bdf8`},`devtools dark oled api cloud console terminal cyan blue`),q(`matrix-green`,`Matrix Green`,`Dark DevTools`,`dark`,{background:`#050806`,foreground:`#e6ffe9`,card:`#0b120d`,border:`#132a1a`,secondary:`#14532d`,accent:`#16a34a`,primary:`#22c55e`},`devtools terminal hacker pure black pitch black dark forest deep green medium green neon matrix green`),q(`neon-onyx`,`Neon Onyx`,`Dark DevTools`,`dark`,{background:`#060708`,foreground:`#f3f7f2`,card:`#141619`,border:`#262930`,secondary:`#3f4552`,accent:`#6b7280`,primary:`#84cc16`},`devtools oled pure black dark charcoal deep gray slate gray medium gray neon lime green`),q(`gilded-obsidian`,`Gilded Obsidian`,`Dark DevTools`,`dark`,{background:`#080809`,foreground:`#f7f3e9`,card:`#121215`,border:`#232329`,secondary:`#373741`,accent:`#b08b4f`,primary:`#f59e0b`},`devtools luxury dark pitch black near-black dark charcoal deep gray muted gold warm amber gold`),q(`electric-midnight`,`Electric Midnight`,`Dark DevTools`,`dark`,{background:`#070b18`,foreground:`#eef4ff`,card:`#0f172a`,border:`#1e2948`,secondary:`#1e3a8a`,accent:`#475569`,primary:`#3b82f6`},`devtools cloud deep navy-black dark navy midnight blue deep royal slate blue electric blue`),q(`liquid-neon`,`Liquid Neon`,`Dark DevTools`,`dark`,{background:`#05090b`,foreground:`#ecfeff`,card:`#0c1418`,border:`#113038`,secondary:`#0e7490`,accent:`#22d3ee`,primary:`#06f6ff`},`devtools cyber pitch black near-black dark teal deep cyan bright aqua neon cyan`),q(`amber-dark`,`Amber Dark`,`Dark DevTools`,`dark`,{background:`#09090b`,foreground:`#faf6ee`,card:`#141418`,border:`#26262e`,secondary:`#3f3f46`,accent:`#64748b`,primary:`#f59e0b`},`devtools cli pitch black near-black dark charcoal deep gray slate warm amber`),q(`carbon`,`Carbon & emerald`,`Dark DevTools`,`dark`,{background:`#0a0c0b`,foreground:`#eef3ef`,card:`#131715`,border:`#28322d`,secondary:`#1b2923`,accent:`#34d399`,primary:`#10b981`},`devtools dark database observability infra emerald green`),q(`midnight`,`Midnight & violet`,`Dark DevTools`,`dark`,{background:`#0c0a14`,foreground:`#f3f1ff`,card:`#161224`,border:`#2e2747`,secondary:`#241c3d`,accent:`#c084fc`,primary:`#8b5cf6`},`devtools dark ai platform sdk graph purple violet`),q(`amber-slate`,`Amber Slate`,`Dark DevTools`,`light`,{background:`#eef1f5`,foreground:`#141d2b`,card:`#e2e6ec`,border:`#c7cfd9`,secondary:`#cbd5e1`,accent:`#1e3a5f`,primary:`#c2410c`},`devtools engineering cool light gray silver pale blue-gray navy blue burnt orange`),q(`darkmatter`,`Darkmatter`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#15202b`,card:`#f7f8fa`,border:`#e2e6ec`,secondary:`#fed7aa`,accent:`#0f766e`,primary:`#c2410c`},`devtools pure white off-white light gray pale peach teal blue burnt orange`),q(`crimson-terminal`,`Crimson Terminal`,`Dark DevTools`,`light`,{background:`#eceff3`,foreground:`#16161a`,card:`#18181b`,border:`#c5cbd4`,secondary:`#dc2626`,accent:`#7f1d1d`,primary:`#78716c`},`devtools terminal cool light gray pitch black silver crimson red deep burgundy warm gray`),q(`pine-terminal`,`Pine Terminal`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#14241b`,card:`#f8f8f5`,border:`#e4dac8`,secondary:`#c2b6a4`,accent:`#6b705c`,primary:`#14532d`},`devtools pure white off-white sand warm taupe olive gray deep pine green`),q(`onyx-mono`,`Onyx Mono`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#09090b`,card:`#f8f9fa`,border:`#e4e7eb`,secondary:`#cbd2d9`,accent:`#323f4b`,primary:`#09090b`},`devtools minimal pure white off-white light gray silver dark charcoal pitch black`),q(`cobalt-field`,`Cobalt Field`,`Dark DevTools`,`light`,{background:`#f8fafc`,foreground:`#0f172a`,card:`#ecfdf5`,border:`#e2e8f0`,secondary:`#10b981`,accent:`#09090b`,primary:`#1d4ed8`},`devtools off-white pale mint light gray emerald green pitch black electric cobalt`),q(`cyan-dawn`,`Cyan Dawn`,`Dark DevTools`,`light`,{background:`#ffffff`,foreground:`#0b1824`,card:`#f0f9ff`,border:`#e2e8f0`,secondary:`#cffafe`,accent:`#111827`,primary:`#06b6d4`},`devtools pure white ice blue light gray pale cyan pitch black bright cyan`),q(`berry-lilac`,`Berry Lilac`,`Bold Consumer`,`light`,{background:`#fdf2f8`,foreground:`#331127`,card:`#fce7f3`,border:`#f3d5f7`,secondary:`#c08497`,accent:`#86198f`,primary:`#9d174d`},`consumer chat pale lavender-pink soft pink pastel lilac mauve plum deep berry`),q(`lavender-sky`,`Lavender Sky`,`Bold Consumer`,`light`,{background:`#f7f8fc`,foreground:`#1f2335`,card:`#ede9fe`,border:`#c7d2fe`,secondary:`#7dd3fc`,accent:`#14b8a6`,primary:`#7c3aed`},`consumer pastel off-white pale lavender periwinkle sky blue teal vibrant violet`),q(`candyland`,`Candyland`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#2b1629`,card:`#fef9c3`,border:`#fbcfe8`,secondary:`#bae6fd`,accent:`#a7f3d0`,primary:`#ec4899`},`consumer playful pure white pale yellow soft pink sky blue mint bubblegum pink`),q(`cyberpunk`,`Cyberpunk`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#141226`,card:`#f1f5f9`,border:`#cffafe`,secondary:`#e2e8f0`,accent:`#06b6d4`,primary:`#e11d90`},`consumer neon pure white ice gray pale cyan light gray electric cyan neon magenta`),q(`neo-brutalism`,`Neo Brutalism`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#0a0a0a`,card:`#0a0a0a`,border:`#38bdf8`,secondary:`#facc15`,accent:`#ffffff`,primary:`#ef4444`},`consumer graphic pure white pure black sky blue bright yellow vivid red brutalist`),q(`bubblegum`,`Bubblegum`,`Bold Consumer`,`light`,{background:`#ffeaf4`,foreground:`#361326`,card:`#fef3c7`,border:`#fed7aa`,secondary:`#bae6fd`,accent:`#d8b4fe`,primary:`#ec4899`},`consumer pastel pink soft yellow peach sky blue lavender hot pink playful`),q(`retro-arcade`,`Retro Arcade`,`Bold Consumer`,`light`,{background:`#fdf7e7`,foreground:`#1c2434`,card:`#99f6e4`,border:`#64748b`,secondary:`#facc15`,accent:`#f97316`,primary:`#d946ef`},`consumer gaming pale cream soft teal slate blue golden yellow coral red magenta`),q(`violet-bloom`,`Violet Bloom`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#1e1633`,card:`#f5f3ff`,border:`#e5e7eb`,secondary:`#ddd6fe`,accent:`#818cf8`,primary:`#7c3aed`},`consumer modern pure white pale lavender light gray soft lilac periwinkle electric violet`),q(`amethyst-haze`,`Amethyst Haze`,`Bold Consumer`,`light`,{background:`#faf7fb`,foreground:`#2b1c2e`,card:`#fce7f3`,border:`#e9d5ff`,secondary:`#d8a7b1`,accent:`#a78bfa`,primary:`#7e22ce`},`consumer off-white pale pink soft lilac dusty rose mauve muted purple`),q(`sunset-horizon`,`Sunset Horizon`,`Bold Consumer`,`light`,{background:`#fff7f2`,foreground:`#2f1812`,card:`#ffedd5`,border:`#fed7aa`,secondary:`#fca5a5`,accent:`#ea580c`,primary:`#f95738`},`consumer warm peach-white pale apricot soft peach warm coral terracotta vibrant coral-orange`),q(`cosmic-night`,`Cosmic Night`,`Bold Consumer`,`light`,{background:`#f6f3fc`,foreground:`#201836`,card:`#ede9fe`,border:`#dbe4ff`,secondary:`#d8b4fe`,accent:`#6366f1`,primary:`#7c3aed`},`consumer pale lavender-white soft lilac pale periwinkle pastel purple slate violet medium purple`),q(`northern-lights`,`Northern Lights`,`Bold Consumer`,`light`,{background:`#f5faf9`,foreground:`#0c2720`,card:`#e0f2fe`,border:`#d1fae5`,secondary:`#5eead4`,accent:`#10b981`,primary:`#14532d`},`consumer aurora off-white ice blue pale mint soft teal emerald deep forest green`),q(`tangerine`,`Tangerine`,`Bold Consumer`,`light`,{background:`#f7f9fc`,foreground:`#1f1c18`,card:`#eef2f6`,border:`#e2e8f0`,secondary:`#bae6fd`,accent:`#475569`,primary:`#ea580c`},`consumer cool off-white pale blue-gray light gray soft sky slate burnt tangerine`),q(`quantum-rose`,`Quantum Rose`,`Bold Consumer`,`light`,{background:`#fff0f5`,foreground:`#331122`,card:`#fce7f3`,border:`#fbcfe8`,secondary:`#f9a8d4`,accent:`#ec4899`,primary:`#be185d`},`consumer beauty soft blush pink pastel pink light rose bubblegum hot pink deep magenta`),q(`soft-pop`,`Soft Pop`,`Bold Consumer`,`light`,{background:`#fcfbf7`,foreground:`#18181b`,card:`#18181b`,border:`#22d3ee`,secondary:`#facc15`,accent:`#e9d5ff`,primary:`#9333ea`},`consumer playful warm off-white charcoal black bright cyan golden yellow pale lavender electric purple`),q(`swiss-red`,`Swiss Red`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#111111`,card:`#111111`,border:`#64748b`,secondary:`#facc15`,accent:`#ef4444`,primary:`#b91c1c`},`consumer editorial swiss poster pure white pure black slate gray golden yellow vivid red crimson`),q(`violet-disco`,`Violet Disco`,`Bold Consumer`,`light`,{background:`#fcf6ec`,foreground:`#1e132b`,card:`#111115`,border:`#ede9fe`,secondary:`#c4b5fd`,accent:`#a78bfa`,primary:`#7c3aed`},`consumer music warm cream pitch black pale lilac soft purple bright lavender vivid violet`),q(`sakura-dawn`,`Sakura Dawn`,`Bold Consumer`,`light`,{background:`#fff8f9`,foreground:`#331621`,card:`#fce7f3`,border:`#ffd6e0`,secondary:`#fda4af`,accent:`#fb7185`,primary:`#e11d48`},`consumer blossom warm off-white pale pink soft blush pastel rose coral pink sakura pink`),q(`violet-pulse`,`Violet Pulse`,`Bold Consumer`,`light`,{background:`#ffffff`,foreground:`#1c1538`,card:`#eff6ff`,border:`#ede9fe`,secondary:`#ddd6fe`,accent:`#818cf8`,primary:`#6d28d9`},`consumer pure white ice blue pale lavender soft lilac periwinkle vivid violet`),q(`pastel-dreams`,`Pastel Dreams`,`Bold Consumer`,`light`,{background:`#f9f6ff`,foreground:`#271b38`,card:`#fce7f3`,border:`#ede9fe`,secondary:`#ddd6fe`,accent:`#a5b4fc`,primary:`#8b5cf6`},`consumer pale lilac-white soft pink pastel lavender lilac periwinkle soft violet`)],qe=new Set([`preserve`,`blue`,`emerald-mint`,`forest`,`vintage-paper`,`obsidian`]),Je=[`All`,`Clean SaaS`,`Warm Editorial`,`Dark DevTools`,`Bold Consumer`],Ye=[`--card / --muted`,`--border / --input`,`--secondary`,`--accent`,`--primary`];function Xe(e){let t=Ke.find(t=>t.id===e);if(!t?.tokens)return``;let n=t.tokens;return`Project palette direction: ${t.name} (${t.category}, ${t.mode} mode). 5-token semantic theme: --background ${n.background}; --foreground ${n.foreground}; --card/--muted ${n.card}; --border/--input ${n.border}; --secondary ${n.secondary}; --accent ${n.accent}; --primary ${n.primary}. Apply coherently with WCAG AA contrast; preserve the product identity and important behavior.`}var Ze=[{id:`editorial-contrast`,name:`Editorial`,summary:`A larger heading and more space around the content.`},{id:`compact-surface`,name:`Compact`,summary:`A tighter row for scanning items and actions quickly.`}];function Qe(e){let t=Ze.find(t=>t.id===e);return t?`Design comparison direction (${t.id} — ${t.name}): ${t.summary} Preserve all existing content, reference permissions, editable paths and required interactions.`:``}function $e({value:e,paletteId:t,onChange:n}){let r=Ke.find(e=>e.id===t)?.tokens,i=r?.primary??`var(--action)`,a=r?.secondary??`var(--selected)`,o=r?.foreground??`var(--ink)`,s=r?.background??`var(--surface)`,c=r?.border??`var(--line)`;return(0,w.jsxs)(`div`,{className:`wb-direction-compare-picker`,role:`group`,"aria-label":`Layout examples`,children:[(0,w.jsxs)(`div`,{className:`wb-direction-intro`,children:[(0,w.jsx)(`p`,{className:`field-help`,children:`These examples show how much space and emphasis the same content can have. Choosing one adds layout guidance to your brief.`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":!e,onClick:()=>n(``),children:`Use project layout`})]}),(0,w.jsx)(`div`,{className:`wb-direction-candidates`,children:Ze.map(t=>{let r=e===t.id;return(0,w.jsxs)(`article`,{className:`wb-direction-card`+(r?` is-selected`:``),children:[(0,w.jsx)(`h3`,{children:t.name}),(0,w.jsxs)(`div`,{className:`wb-direction-specimen is-`+t.id,style:{background:s,color:o,borderColor:c},"aria-hidden":`true`,children:[(0,w.jsx)(`strong`,{children:`Review queue`}),(0,w.jsxs)(`div`,{className:`wb-specimen-row`,children:[(0,w.jsx)(`span`,{children:`Draft navigation`}),(0,w.jsx)(`span`,{className:`wb-specimen-pill`,style:{background:a,color:o},children:`Ready`}),(0,w.jsx)(`span`,{className:`wb-specimen-cta`,style:{color:i,borderColor:i},children:`Open`})]})]}),(0,w.jsx)(`p`,{children:t.summary}),(0,w.jsxs)(`button`,{type:`button`,className:`button `+(r?`primary`:`subtle`),"aria-pressed":r,onClick:()=>n(t.id),children:[`Use `,t.name.toLowerCase(),` layout`]})]},t.id)})})]})}function et(e){let t=e.replace(`#`,``);if(t.length!==6)return 0;let n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4,r=n(parseInt(t.slice(0,2),16)/255),i=n(parseInt(t.slice(2,4),16)/255),a=n(parseInt(t.slice(4,6),16)/255);return .2126*r+.7152*i+.0722*a}function tt(e,t){let n=et(e),r=et(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function nt(e,t){if(t&&tt(e,t)>=4.5)return t;let n=`#0f172a`,r=`#f8fafc`;return tt(e,n)>=tt(e,r)?n:r}function rt(e,t){return tt(e,t)>=1.65?t:et(e)>.4?`rgba(15, 23, 42, 0.22)`:`rgba(248, 250, 252, 0.26)`}function it({palette:e,selected:t,onChoose:n,onPreview:r}){let i=e.tokens,a=i?{"--theme-bg":i.background,"--theme-fg":nt(i.background,i.foreground),"--theme-card":i.card,"--theme-border":rt(i.background,i.border),"--theme-primary":i.primary}:void 0;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-palette-card`+(i?` is-themed`:` is-preserve`),"data-mode":e.mode??`system`,"aria-pressed":t,"aria-label":e.name,title:i?`${e.name} · ${e.category} (${e.mode}) · ${Ye.map((t,n)=>`${t} ${e.colors[n]}`).join(`, `)}`:`Preserve the project’s current colors`,style:a,onMouseEnter:r,onFocus:r,onClick:n,children:[(0,w.jsxs)(`span`,{className:`wb-palette-card-top`,"aria-hidden":`true`,children:[(0,w.jsx)(`span`,{className:`wb-palette-mode-pill`,children:t?`Selected`:i?e.mode===`dark`?`Dark`:`Light`:`Default`}),i?(0,w.jsx)(`span`,{className:`wb-palette-swatches`,children:e.colors.map((e,t)=>(0,w.jsx)(`span`,{className:`wb-palette-swatch`,style:{backgroundColor:e}},Ye[t]))}):(0,w.jsxs)(`span`,{className:`wb-palette-swatches is-preserve`,children:[(0,w.jsx)(`span`,{className:`wb-palette-swatch`}),(0,w.jsx)(`span`,{className:`wb-palette-swatch`}),(0,w.jsx)(`span`,{className:`wb-palette-swatch`})]})]}),(0,w.jsx)(`span`,{className:`wb-palette-title`,children:e.name}),(0,w.jsx)(`span`,{className:`wb-palette-meta`,"aria-hidden":`true`,children:i?`${e.category} · ${i.primary}`:`Keep existing CSS tokens intact`})]})}function at({value:e,onChange:t}){let[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(``),[s,c]=(0,i.useState)(`All`),[l,u]=(0,i.useState)(`all`),[d,f]=(0,i.useState)(null),p=(0,i.useRef)(null),m=(0,i.useRef)(null),h=(0,i.useRef)(!1);(0,i.useEffect)(()=>{n?(p.current?.focus({preventScroll:!0}),p.current?.scrollIntoView({block:`start`})):h.current&&(h.current=!1,m.current?.focus())},[n]);function g(){h.current=!0,r(!1)}let _=a.toLowerCase().trim().split(/\s+/).filter(Boolean),v=Ke.filter(t=>{if(!n)return qe.has(t.id)||e===t.id;if(!t.tokens||s!==`All`&&t.category!==s||l!==`all`&&t.mode!==l)return!1;if(!_.length)return!0;let r=[t.name,t.category??``,t.mode??``,t.tags??``,t.tokens.background,t.tokens.foreground,...t.colors].join(` `).toLowerCase();return _.every(e=>r.includes(e))});return(0,w.jsxs)(`div`,{className:`wb-palette-picker`,onKeyDown:e=>{n&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g())},children:[n&&(0,w.jsxs)(`div`,{className:`wb-palette-library-tools`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-library-head`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:g,children:`Back to quick palettes`}),(0,w.jsx)(`span`,{className:`wb-palette-token-legend`,"aria-hidden":`true`,children:`Swatches: card · border · secondary · accent · primary`})]}),(0,w.jsxs)(`label`,{className:`wb-palette-search`,children:[(0,w.jsx)(T,{name:`search`}),(0,w.jsx)(`input`,{ref:p,type:`search`,name:`palette-search`,autoComplete:`off`,spellCheck:!1,"aria-label":`Search palettes`,placeholder:`Search 80 themes by name, vibe, dark/light, or hex…`,value:a,onChange:e=>o(e.target.value)})]}),(0,w.jsxs)(`div`,{className:`wb-palette-filter-bar`,children:[(0,w.jsx)(`div`,{className:`wb-palette-filters`,role:`group`,"aria-label":`Palette categories`,children:Je.map(e=>(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":s===e,onClick:()=>c(e),children:e},e))}),(0,w.jsx)(`div`,{className:`wb-palette-mode-filter`,role:`group`,"aria-label":`Palette mode`,children:[`all`,`light`,`dark`].map(e=>(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":l===e,onClick:()=>u(e),children:e===`all`?`All modes`:e===`light`?`Light`:`Dark`},e))})]}),(0,w.jsx)(`p`,{className:`field-help`,role:`status`,children:v.length?`${v.length} ${v.length===1?`theme`:`themes`} · hover any card to preview tokens, click to select`:`No themes match. Try another color, category, or light/dark mode.`}),(()=>{let t=(d?v.find(e=>e.id===d):null)??v.find(t=>t.id===e)??v[0];if(!t?.tokens)return null;let n=t.tokens,r=nt(n.background,n.foreground),i=nt(n.card,n.foreground),a=nt(n.secondary,n.foreground),o=nt(n.primary,`#ffffff`),s={"--theme-bg":n.background,"--theme-fg":r,"--theme-card":n.card,"--theme-on-card":i,"--theme-border":rt(n.background,n.border),"--theme-card-border":rt(n.card,n.border),"--theme-secondary":n.secondary,"--theme-on-secondary":a,"--theme-accent":n.accent,"--theme-accent-border":rt(n.card,n.accent),"--theme-primary":n.primary,"--theme-on-primary":o};return(0,w.jsxs)(`div`,{className:`wb-palette-preview-card`,style:s,"aria-label":`Live preview of ${t.name}`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-preview-copy`,children:[(0,w.jsxs)(`div`,{className:`wb-palette-preview-head`,children:[(0,w.jsx)(`strong`,{children:t.name}),(0,w.jsxs)(`span`,{className:`wb-palette-preview-badge`,children:[t.mode===`dark`?`Dark`:`Light`,` · `,t.category]})]}),(0,w.jsx)(`div`,{className:`wb-palette-preview-tokens`,"aria-label":`Theme color swatches`,children:[[`Background`,n.background],[`Card`,n.card],[`Border`,n.border],[`Secondary`,n.secondary],[`Accent`,n.accent],[`Primary`,n.primary]].map(([e,t])=>{let r=nt(t);return(0,w.jsxs)(`span`,{className:`wb-palette-preview-block`,style:{backgroundColor:t,color:r,borderColor:rt(n.background,t)},children:[(0,w.jsx)(`span`,{className:`wb-palette-preview-block-label`,children:e}),(0,w.jsx)(`span`,{className:`wb-palette-preview-block-hex`,children:t})]},e)})})]}),(0,w.jsxs)(`div`,{className:`wb-palette-preview-sample`,"aria-hidden":`true`,children:[(0,w.jsx)(`span`,{className:`wb-palette-preview-accent`,children:`Outline`}),(0,w.jsx)(`span`,{className:`wb-palette-preview-cta`,children:`Primary CTA`})]})]})})()]}),(0,w.jsx)(`div`,{className:`wb-palettes`+(n?` wb-palette-results`:``),role:`group`,"aria-label":n?`Palette library results`:`Project color palettes`,children:v.map(r=>(0,w.jsx)(it,{palette:r,selected:e===r.id,onPreview:n?()=>f(r.id):void 0,onChoose:()=>{t(r.id),n&&g()}},r.id))}),!n&&(0,w.jsxs)(`div`,{className:`wb-palette-quick-footer`,children:[(0,w.jsxs)(`button`,{ref:m,type:`button`,className:`button subtle wb-palette-browse`,onClick:()=>r(!0),children:[(0,w.jsx)(T,{name:`plus`}),` Browse more palettes`]}),(0,w.jsx)(`span`,{className:`wb-palette-token-legend`,"aria-hidden":`true`,children:`5-token swatches: card · border · secondary · accent · primary`})]})]})}function ot({references:e,selected:t,onChange:n,onUpload:r,directions:a={},onDirection:o}){let[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(``);return(0,w.jsxs)(`div`,{className:`wb-reference-picker`,children:[(0,w.jsxs)(`div`,{className:`wb-section-heading`,children:[(0,w.jsx)(`p`,{children:`Choose up to eight images as visual direction.`}),(0,w.jsxs)(`label`,{className:`button subtle wb-upload`,children:[s?`Adding…`:`Upload reference`,(0,w.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp`,disabled:s||t.length>=8,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){c(!0),u(``);try{await r(t)}catch(e){u(e.message)}finally{c(!1)}}}})]})]}),l&&(0,w.jsx)(`p`,{role:`alert`,className:`error-box`,children:l}),(0,w.jsx)(`div`,{className:`wb-reference-grid`,children:e.filter(e=>e.available).map(e=>(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":t.includes(e.id),disabled:!t.includes(e.id)&&t.length>=8,onClick:()=>n(t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id]),children:[(0,w.jsx)(`img`,{src:e.imageURL,width:`160`,height:`100`,loading:`lazy`,decoding:`async`,alt:e.title}),(0,w.jsx)(`span`,{children:e.title}),t.includes(e.id)&&(0,w.jsx)(`span`,{className:`wb-reference-selected`,children:`Selected`})]},e.id))}),o&&e.filter(e=>t.includes(e.id)).map(e=>(0,w.jsxs)(`section`,{className:`wb-reference-direction`,children:[(0,w.jsx)(`h3`,{children:e.title}),(0,w.jsxs)(`label`,{children:[`Focus on`,(0,w.jsx)(`input`,{maxLength:300,placeholder:`For example, hero composition and typography`,value:a[e.id]?.focus??``,onChange:t=>o(e.id,{...a[e.id],focus:t.target.value})})]}),(0,w.jsxs)(`label`,{children:[`Reference view`,(0,w.jsx)(pe,{label:`Reference view for `+e.title,value:a[e.id]?.view??`full`,onChange:t=>o(e.id,{...a[e.id],view:t}),options:[{value:`full`,label:`Full image`},{value:`top`,label:`Top half`},{value:`center`,label:`Center half`},{value:`bottom`,label:`Bottom half`}]})]})]},e.id)),(0,w.jsx)(`p`,{className:`field-help`,children:`Images are sent only with your Generate action and an image-capable model. Use PNG, JPEG or WebP up to 2 MiB each. Selection does not grant production reuse rights.`})]})}function st(e,t){return d(`/api/style-direction-guide`,{styleId:e,context:t})}var ct=[{id:`editorial`,name:`Editorial`,subtitle:`Condensed display heads, serif standfirsts, hairline rules`,referenceId:`creative-portfolio`,motionTreatment:`Reveal figures in reading order. Keep the typography steady.`},{id:`minimalism`,name:`Minimalism`,subtitle:`Generous negative space, quiet scale contrast, fine construction hairlines`,referenceId:`minimalist-pitch`,motionTreatment:`Use brief transitions for state changes. Give content a stable resting state.`},{id:`brutalism`,name:`Brutalism`,subtitle:`3px structural frames, uppercase black display, zero radius, shared grid seams`,referenceId:`orange-grunge`,motionTreatment:`Use direct press and selection feedback with crisp state changes.`},{id:`maximal`,name:`Maximal`,subtitle:`Poster-scale condensed type, crisp offset depth, dense compartmentalized register`,referenceId:`bold-portfolio`,motionTreatment:`Use one focal reveal to direct attention through the composition.`},{id:`bento-product`,name:`Product showcase`,subtitle:`Asymmetric feature compartments, clean UI framing, scannable specs`,referenceId:`landing-pages`,motionTreatment:`Use state transitions to show cause and effect in the actual product UI.`},{id:`swiss-technical`,name:`Technical / Swiss`,subtitle:`Modular hairline grid, tabular readouts, crisp spec-sheet precision`,referenceId:`refero-teenage-engineering`,motionTreatment:`Animate state changes within the grid and keep measurement labels stable.`},{id:`quiet-luxury`,name:`Quiet luxury`,subtitle:`Art-directed photography, precise typography, a quiet purchase path`,motionTreatment:`Use a short image dissolve only when the user changes views.`},{id:`commerce-catalog`,name:`Commerce catalog`,subtitle:`Comparable product views, clear variants, practical filters`,motionTreatment:`Keep filter results and product options stable during updates.`},{id:`data-workbench`,name:`Data workbench`,subtitle:`Clear table hierarchy, dense controls, visible status`,motionTreatment:`Use brief feedback after actions and keep rows anchored.`}],lt=`Keep motion brief and scoped to transform and opacity. Honor prefers-reduced-motion and preserve visible focus.`;function ut(e,t,n){if(!(!e?.referenceId||n.length>=8&&!n.includes(e.referenceId)))return t.some(t=>t.id===e.referenceId&&t.available)?e.referenceId:void 0}function dt(e,t,n){let r=ct.find(t=>t.id===e);return r?[`[Hallmark Style Direction: ${r.name}]`,n,`- Motion: ${r.motionTreatment} ${lt}`,t?`Attached style visual reference (${r.referenceId}): study layout rhythm, typographic scale, spacing, and surface framing only; do NOT copy literal colors from the screenshot.`:``].filter(Boolean).join(`
|
|
17
|
+
`):``}function ft(e,t,n,r){let i=[];for(let r of e){let e=n[r];if(!e||e.usage!==`page-photo`)continue;let a=t.find(e=>e.id===r)?.title||r,o=e.slot||`Hero showcase`,s=e.projectPath?.trim();i.push(s?`Page photo (${a}): feature this user photo in "${o}" using local project path "${s}" (<img src="${s}" ...>) with responsive sizing and authentic aspect ratio.`:`Page photo (${a}): design a dedicated "${o}" image slot matching this photo’s composition and aspect ratio; reference its uploaded filename (${a}) or preserve existing local assets.`)}for(let e of r){let t=n[`project:`+e]?.slot||`Featured section image`;i.push(`Project photo to feature (${e}): display "${e}" prominently in "${t}" with clean framing, explicit width/height or aspect-ratio, and descriptive alt text.`)}return i.join(`
|
|
18
|
+
`)}function pt({styleId:e,styleContext:t,attachStyleImage:n,onSelectStyle:r,onSelectStyleContext:a,onToggleAttachStyleImage:o,references:s,inspection:c,selectedIds:l,photoSettings:u,onPhotoSetting:d,selectedProjectPhotos:f,onToggleProjectPhoto:p,onUploadPhoto:m}){let[h,g]=(0,i.useState)(!1),[_,v]=(0,i.useState)(``),[y,b]=(0,i.useState)(``),[x,S]=(0,i.useState)(``),[C,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(!1),[k,A]=(0,i.useState)(``),j=ct.find(t=>t.id===e);(0,i.useEffect)(()=>{if(!j){v(``),b(``),S(``);return}let e=!0;return E(!0),S(``),st(j.id,t).then(t=>{e&&(v(t.content),b(t.sourcePath))}).catch(t=>{e&&(v(``),b(``),S(t instanceof Error?t.message:`Could not load style guidance.`))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},[j?.id,t]);let M=ut(j,s,l),N=ee(c),P=c?.files.find(e=>/(?:^|\/)DESIGN\.md$/i.test(e.path))?.path,F=(c?.files??[]).filter(e=>e.kind===`asset`&&/\.(png|jpe?g|webp|avif|gif|svg)$/i.test(e.path)).map(e=>e.path),te=l.map(e=>s.find(t=>t.id===e)).filter(e=>!!e?.id.startsWith(`upload-`));return(0,w.jsxs)(`div`,{className:`wb-style-photo-stack`,children:[(0,w.jsxs)(`section`,{className:`wb-style-section`,"aria-label":`Style directions`,children:[(0,w.jsxs)(`div`,{className:`wb-subsection-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{children:`Style direction`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Shape composition, typography and motion within your project colors.`})]}),j&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>r(``),children:`Clear style`})]}),(0,w.jsxs)(`div`,{className:`wb-style-provenance`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(T,{name:`palette`}),(0,w.jsx)(`span`,{children:P?(0,w.jsxs)(w.Fragment,{children:[`Project guide detected · `,(0,w.jsx)(`code`,{translate:`no`,children:P})]}):(0,w.jsxs)(w.Fragment,{children:[`Hallmark reference · `,(0,w.jsx)(`code`,{translate:`no`,children:`docs/workflow-hallmark-styles.md`})]})})]}),N.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(T,{name:`motion`}),(0,w.jsxs)(`span`,{children:[`Project capabilities · `,N.join(` · `)]})]})]}),(0,w.jsx)(`div`,{className:`wb-style-grid`,children:ct.map(t=>{let n=s.find(e=>e.id===t.referenceId),i=e===t.id;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-card`,"aria-pressed":i,onClick:()=>r(i?``:t.id),children:[(0,w.jsx)(`div`,{className:`wb-style-thumb`,"aria-hidden":`true`,children:n?.available?(0,w.jsx)(`img`,{src:n.imageURL,alt:``,loading:`lazy`,decoding:`async`}):(0,w.jsx)(`div`,{className:`wb-style-fallback`,children:(0,w.jsx)(`span`,{children:t.name})})}),(0,w.jsxs)(`div`,{className:`wb-style-meta`,children:[(0,w.jsx)(`strong`,{children:t.name}),(0,w.jsx)(`small`,{children:t.subtitle})]})]},t.id)})}),j&&(0,w.jsxs)(`div`,{className:`wb-style-controls`,children:[(0,w.jsxs)(`div`,{className:`wb-style-context-picker`,role:`group`,"aria-label":`Style guide detail`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-context-option${t===`efficient`?` is-selected`:``}`,"aria-pressed":t===`efficient`,onClick:()=>a(`efficient`),children:[(0,w.jsx)(`strong`,{children:`Efficient`}),(0,w.jsx)(`span`,{children:`Shorter guide to save tokens with whichever model you connect.`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`wb-style-context-option${t===`detailed`?` is-selected`:``}`,"aria-pressed":t===`detailed`,onClick:()=>a(`detailed`),children:[(0,w.jsx)(`strong`,{children:`Detailed`}),(0,w.jsx)(`span`,{children:`Richer design guidance for stronger results from your connected model.`})]})]}),(0,w.jsxs)(`p`,{className:`wb-style-motion-note`,children:[(0,w.jsx)(T,{name:`motion`}),(0,w.jsx)(`span`,{children:j.motionTreatment})]}),j.referenceId&&(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:n&&!!M,disabled:!M,onChange:e=>o(e.target.checked)}),(0,w.jsx)(`span`,{children:M?(0,w.jsxs)(w.Fragment,{children:[`Attach matching reference screenshot (`,(0,w.jsx)(`code`,{children:M}),`) for composition and scale.`]}):`The matching reference screenshot is unavailable or the eight-reference limit is reached.`})]}),(0,w.jsx)(`div`,{className:`wb-style-prompt-bar`,children:(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide style design prompt`:`Inspect style design prompt`})}),h&&(0,w.jsxs)(w.Fragment,{children:[!C&&y&&(0,w.jsxs)(`small`,{className:`wb-style-document-source`,children:[`Loaded from `,(0,w.jsx)(`code`,{translate:`no`,children:y})]}),(0,w.jsx)(`pre`,{className:`wb-style-prompt-preview`,children:C?`Loading selected design guide…`:x||dt(j.id,n&&!!M,_)})]})]})]}),(0,w.jsxs)(`section`,{className:`wb-photo-section`,"aria-label":`Use photos in your design`,children:[(0,w.jsxs)(`div`,{className:`wb-subsection-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{children:`Use your photos`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Upload a photo or select existing project images to feature directly on the page rather than using generic placeholders.`})]}),(0,w.jsxs)(`label`,{className:`button subtle wb-photo-upload-btn`,children:[(0,w.jsx)(T,{name:`image`}),D?`Uploading…`:`Upload photo`,(0,w.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/avif`,hidden:!0,disabled:D,onChange:async e=>{let t=e.target.files?.[0];if(e.target.value=``,t){O(!0),A(``);try{let e=await m(t);typeof e==`string`&&d(e,{usage:`page-photo`,slot:`Hero showcase`,projectPath:``})}catch(e){A(e.message)}finally{O(!1)}}}})]})]}),k&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:k}),F.length>0&&(0,w.jsxs)(`div`,{className:`wb-project-photos`,children:[(0,w.jsx)(`span`,{className:`wb-photo-sublabel`,children:`Photos found in project folder:`}),(0,w.jsx)(`div`,{className:`wb-project-photo-chips`,children:F.map(e=>{let t=f.includes(e),n=`project:`+e;return(0,w.jsxs)(`div`,{className:`wb-project-photo-item`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle`,"aria-pressed":t,onClick:()=>p(e),children:[(0,w.jsx)(T,{name:`assets`}),(0,w.jsx)(`span`,{children:e})]}),t&&(0,w.jsx)(pe,{compact:!0,label:`Placement for `+e,value:u[n]?.slot??`Hero showcase`,onChange:t=>d(n,{usage:`page-photo`,slot:t,projectPath:e}),options:[{value:`Hero showcase`,label:`Hero showcase`},{value:`Product / feature card`,label:`Product / feature card`},{value:`Portrait / team section`,label:`Portrait / team section`},{value:`Full-width image band`,label:`Full-width image band`}]})]},e)})})]}),te.length>0&&(0,w.jsx)(`div`,{className:`wb-uploaded-photo-rules`,children:te.map(e=>{let t=u[e.id]??{usage:`inspiration`,slot:`Hero showcase`,projectPath:``};return(0,w.jsxs)(`div`,{className:`wb-uploaded-photo-card`,children:[(0,w.jsx)(`img`,{src:e.imageURL,alt:``,loading:`lazy`,decoding:`async`}),(0,w.jsxs)(`div`,{className:`wb-uploaded-photo-fields`,children:[(0,w.jsx)(`strong`,{children:e.title}),(0,w.jsxs)(`div`,{className:`wb-photo-usage-row`,children:[(0,w.jsx)(pe,{compact:!0,label:`How to use `+e.title,value:t.usage,onChange:n=>d(e.id,{...t,usage:n}),options:[{value:`inspiration`,label:`Layout / mood inspiration only`},{value:`page-photo`,label:`Feature photo on page`}]}),t.usage===`page-photo`&&(0,w.jsx)(pe,{compact:!0,label:`Placement for `+e.title,value:t.slot||`Hero showcase`,onChange:n=>d(e.id,{...t,slot:n}),options:[{value:`Hero showcase`,label:`Hero showcase`},{value:`Product / feature card`,label:`Product / feature card`},{value:`Portrait / team section`,label:`Portrait / team section`},{value:`Full-width image band`,label:`Full-width image band`}]})]}),t.usage===`page-photo`&&(0,w.jsxs)(`label`,{className:`wb-photo-path-field`,children:[(0,w.jsx)(`span`,{children:`Local asset path in project (if saved inside project folder)`}),(0,w.jsx)(`input`,{value:t.projectPath,placeholder:`For example, assets/hero.jpg`,onChange:n=>d(e.id,{...t,projectPath:n.target.value})})]})]})]},e.id)})})]})]})}var J=[{id:`audit`,icon:`shield`,badge:`No API key`,title:`Run Audit`,description:`Check security, contrast, accessibility, and desktop/mobile layouts on any frontend project.`,actionLabel:`Start local audit`},{id:`diff`,icon:`capture`,badge:`No API key`,title:`Branch Visual Diff`,description:`Compare current edits against main, a saved baseline, or a preview URL with an interactive Diff Slider.`,actionLabel:`Compare visual diff`},{id:`mcp`,icon:`mcp`,badge:`Cursor · Claude · Codex`,title:`Connect AI Client`,description:`Link Cursor, Antigravity, Claude Code, or Codex once to fix findings and review changes with 1-click Undo.`,actionLabel:`Connect AI client`}];function mt({surface:e,disabled:t=!1,onSelect:n,onDismiss:r}){let i=`starter-setup-heading-${e}`;return(0,w.jsxs)(`section`,{className:`wb-starter-setup wb-starter-setup--${e}`,"aria-labelledby":i,children:[(0,w.jsxs)(`div`,{className:`wb-starter-header`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:i,className:`wb-starter-title`,children:`Start with zero API keys`}),(0,w.jsx)(`p`,{className:`wb-starter-subtitle`,children:`Run local audits, inspect branch visual diffs, or connect your coding assistant. Direct AI model keys are optional.`})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-starter-dismiss`,onClick:r,"aria-label":`Dismiss starter setup`,children:`Dismiss`})]}),(0,w.jsx)(`div`,{className:`wb-starter-grid`,role:`list`,children:J.map(e=>(0,w.jsxs)(`article`,{className:`wb-starter-card`,role:`listitem`,children:[(0,w.jsxs)(`div`,{className:`wb-starter-card-top`,children:[(0,w.jsx)(`span`,{className:`wb-starter-icon`,"aria-hidden":`true`,children:(0,w.jsx)(T,{name:e.icon})}),(0,w.jsx)(`span`,{className:`wb-starter-badge`,children:e.badge})]}),(0,w.jsx)(`h3`,{className:`wb-starter-card-title`,children:e.title}),(0,w.jsx)(`p`,{className:`wb-starter-card-desc`,children:e.description}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-starter-card-cta`,disabled:t,onClick:()=>n(e.id),children:[(0,w.jsx)(`span`,{children:e.actionLabel}),(0,w.jsx)(T,{name:`arrow`})]})]},e.id))})]})}function ht({quickAudit:e,onPrefillAuditFix:t,onOpenWorkflows:n,onClearQuickAudit:r}){return(0,w.jsxs)(`section`,{className:`wb-quick-audit-card`,"aria-label":`Project audit summary`,children:[(0,w.jsxs)(`div`,{className:`wb-quick-audit-head`,children:[(0,w.jsxs)(`div`,{className:`wb-quick-audit-title`,children:[(0,w.jsxs)(`strong`,{children:[`Audit Score: `,e.securityReport.score,`/100`]}),(0,w.jsx)(`span`,{className:`wb-wf-scanner-pill ${e.gatePassed?`status-ready`:`status-optional`}`,children:e.gatePassed?`Passed`:`Needs review`}),(0,w.jsxs)(`span`,{className:`wb-quick-audit-meta`,children:[e.securityReport.filesAudited,` files · `,e.totalDurationMs,`ms`]})]}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-actions`,children:[(e.securityReport.findings.length>0||(e.designSystemLock?.violationCount??0)>0)&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>t(e),children:`Fix findings`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:n,children:`Full details`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:r,children:`Dismiss`})]})]}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-pillars`,children:[e.securityReport.scoreBreakdown&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[`Security:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.securitySurface.score,`/30`]})]}),(0,w.jsxs)(`span`,{children:[`Tests:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.testIntegrity.score,`/25`]})]}),(0,w.jsxs)(`span`,{children:[`UI & A11y:`,` `,(0,w.jsxs)(`strong`,{children:[e.securityReport.scoreBreakdown.uiCraftAndA11y.score,`/25`]})]})]}),(0,w.jsxs)(`span`,{children:[`Findings: `,(0,w.jsx)(`strong`,{children:e.securityReport.findings.length})]})]}),e.securityReport.findings.length>0?(0,w.jsx)(`ul`,{className:`wb-quick-audit-list`,children:e.securityReport.findings.slice(0,6).map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`wb-sev-badge sev-${e.severity}`,children:e.severity}),(0,w.jsxs)(`div`,{className:`wb-quick-audit-item-body`,children:[(0,w.jsx)(`strong`,{children:e.message}),(0,w.jsxs)(`small`,{children:[e.path?(0,w.jsxs)(`code`,{translate:`no`,children:[e.path,e.line?`:${e.line}`:``]}):null,e.path&&e.action?` · `:``,e.action]})]})]},`${e.code}-${e.path??t}-${t}`))}):(0,w.jsx)(`p`,{className:`wb-quick-audit-clean`,children:`No security or accessibility issues found.`})]})}function gt({project:e,onClose:t}){let[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(`git`),[s,c]=(0,i.useState)(`main`),[l,u]=(0,i.useState)(`default`),[f,p]=(0,i.useState)(``),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(``),[v,y]=(0,i.useState)(`/`),[b,x]=(0,i.useState)(!0),[S,C]=(0,i.useState)(!1),[E,D]=(0,i.useState)(!0),[O,k]=(0,i.useState)(!1),[A,ee]=(0,i.useState)(!1),[j,M]=(0,i.useState)(``),[N,P]=(0,i.useState)(``),[F,te]=(0,i.useState)(null),[ne,re]=(0,i.useState)(``),[ie,I]=(0,i.useState)(`slider`),[ae,oe]=(0,i.useState)(50),[L,R]=(0,i.useState)(!0),[se,z]=(0,i.useState)(!1),[ce,le]=(0,i.useState)(!1),[B,V]=(0,i.useState)(null),[H,U]=(0,i.useState)(!1),ue=(0,i.useRef)(0),W=(0,i.useCallback)(async()=>{let t=++ue.current;D(!0),M(``);try{let n=e?`?project=${encodeURIComponent(e)}`:``,[i,a]=await Promise.all([d(`/api/visual-diff/baselines${n}`),d(`/api/project/autodetect${n}`).catch(()=>null)]);if(t!==ue.current)return;r(i),V(a),i.routes?.length&&y(i.routes.join(`,`)),i.git?.isRepo&&i.git.defaultBase?(c(i.git.defaultBase),o(`git`)):(i.baselines.length>0&&u(i.baselines[0].name),o(`baseline`)),i.baselines.length>0&&u(i.baselines[0].name),i.devServer?.found&&i.devServer.url&&h(e=>e||i.devServer.url);try{let e=await d(`/api/connections`);if(t!==ue.current)return;let n=e.externalConnectors?.find(e=>[`vercel`,`cloudflare`,`netlify`].includes(e.id)&&e.endpointUrl);n?.endpointUrl&&h(e=>e||n.endpointUrl),n?.baseUrl&&_(e=>e||n.baseUrl)}catch{}}catch(e){t===ue.current&&M(e.message)}finally{t===ue.current&&D(!1)}},[e]);(0,i.useEffect)(()=>{W()},[W]);async function G(){ee(!0),M(``),P(``);try{let t=await d(`/api/visual-diff/baseline`,{project:e,name:f.trim()||void 0,routes:v,render:b,trustBuild:S});p(``),u(t.name),P(`Saved baseline "${t.name}" (Score ${t.score}/100, ${t.screenshotsCount} capture${t.screenshotsCount===1?``:`s`}).`),await W()}catch(e){M(e.message)}finally{ee(!1)}}async function de(){U(!0),M(``),P(``);try{let t=await d(`/api/project/autodetect/vercel-preview`,{project:e,approved:!0});t.latestPreviewUrl?(h(t.latestPreviewUrl),t.productionCandidateUrl&&!g&&_(t.productionCandidateUrl),P(`Found latest Vercel preview: ${t.latestPreviewUrl}`)):P(t.message)}catch(e){M(e.message)}finally{U(!1)}}async function fe(){k(!0),M(``),P(``);try{let t={project:e,mode:a,routes:v,render:b,trustBuild:S};a===`git`?t.baseRef=s.trim()||`main`:a===`baseline`?t.baselineName=l.trim()||`default`:(t.url=m.trim(),t.baseUrl=g.trim());let n=await d(`/api/visual-diff/compare`,t);te(n),n.visualDiff.viewports.length>0&&re(n.visualDiff.viewports[0].name),P(`Compared ${n.comparisonLabel} in ${n.durationMs}ms.`)}catch(e){M(e.message)}finally{k(!1)}}let K=F?.visualDiff.viewports.find(e=>e.name===ne)??F?.visualDiff.viewports[0]??null;return(0,w.jsxs)(`section`,{className:`wb-branch-diff-card page-reveal page-reveal--content`,"aria-label":`Branch and baseline visual diff`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-title-row`,children:[(0,w.jsx)(`h3`,{children:`Branch & Baseline Visual Diff`}),(0,w.jsx)(`span`,{className:`wb-branch-diff-pill`,children:`No API key required`}),n?.devServer?.found&&n.devServer.url&&(0,w.jsxs)(`span`,{className:`wb-branch-diff-pill is-live`,children:[`Dev server: `,n.devServer.url]})]}),(0,w.jsx)(`p`,{className:`wb-branch-diff-sub`,children:`Compare your current edits against a Git branch (read-only worktree), a saved local baseline, or two preview URLs — then copy a ready-to-paste fix prompt for Cursor, Claude Code, Codex, or Antigravity.`})]}),t&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:t,children:`Close`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-controls`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-modes`,role:`group`,"aria-label":`Comparison source`,children:[(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`git`,onClick:()=>o(`git`),children:`Git branch`}),(0,w.jsxs)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`baseline`,onClick:()=>o(`baseline`),children:[`Saved baseline (`,n?.baselines.length??0,`)`]}),(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":a===`url`,onClick:()=>o(`url`),children:`Preview URLs`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-fields`,children:[a===`git`&&(0,w.jsxs)(`label`,{children:[`Base branch or ref`,(0,w.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`main`})]}),a===`baseline`&&(0,w.jsxs)(`label`,{children:[`Saved baseline`,n&&n.baselines.length>0?(0,w.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),children:n.baselines.map(e=>(0,w.jsxs)(`option`,{value:e.name,children:[e.name,` (Score `,e.score??`—`,`/100 · `,e.screenshotsCount,` shots)`]},e.name))}):(0,w.jsx)(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`Baseline name (e.g. before-redesign)`})]}),a===`url`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{children:[`Before URL (production or base)`,(0,w.jsx)(`input`,{type:`url`,value:g,onChange:e=>_(e.target.value),placeholder:`https://your-app.vercel.app`})]}),(0,w.jsxs)(`label`,{children:[`After URL (PR preview or localhost)`,(0,w.jsx)(`input`,{type:`url`,value:m,onChange:e=>h(e.target.value),placeholder:`https://pr-42-your-app.vercel.app`})]}),(B?.vercel?.linked||B?.vercel?.cliInstalled)&&(0,w.jsxs)(`div`,{className:`wb-branch-vercel-detect`,children:[B.vercel.projectName&&(0,w.jsxs)(`span`,{className:`field-help`,children:[`Linked Vercel project: `,(0,w.jsx)(`strong`,{children:B.vercel.projectName})]}),B.vercel.cliInstalled&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H||O,onClick:()=>void de(),children:H?`Finding preview…`:`Find latest Vercel preview`})]})]}),(0,w.jsxs)(`label`,{children:[`Routes (comma-separated, up to 8)`,(0,w.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`/,/pricing`})]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-action-row`,children:[(0,w.jsx)(`div`,{className:`wb-branch-diff-checks`,children:a!==`url`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked)}),(0,w.jsx)(`span`,{children:`Capture screenshots (desktop, mobile, dark)`})]}),(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked)}),(0,w.jsx)(`span`,{children:`Allow local build for React/Next.js`})]})]})}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-buttons`,children:[a!==`url`&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:A||O||E,onClick:()=>void G(),children:A?`Saving baseline…`:`Save baseline`}),(0,w.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:O||A||E||a===`url`&&(!g.trim()||!m.trim()),onClick:()=>void fe(),children:[(0,w.jsx)(T,{name:`capture`}),O?`Comparing…`:`Run Visual Diff`]})]})]})]}),j&&(0,w.jsx)(`p`,{className:`error-box`,role:`alert`,children:j}),N&&(0,w.jsx)(`p`,{className:`connection-success`,role:`status`,children:N}),F&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-results`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-diff-kpis`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Quality Score`}),(0,w.jsxs)(`strong`,{children:[F.delta.beforeScore,` → `,F.delta.afterScore,` (`,F.delta.scoreDelta>=0?`+`:``,F.delta.scoreDelta,`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Max Pixel Diff`}),(0,w.jsxs)(`strong`,{children:[F.visualDiff.maxMismatchPercentage,`% (`,F.visualDiff.totalBoundingBoxes,` `,`region`,F.visualDiff.totalBoundingBoxes===1?``:`s`,`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`New Findings`}),(0,w.jsx)(`strong`,{children:F.delta.introducedCount})]}),(0,w.jsxs)(`div`,{className:`wb-branch-kpi`,children:[(0,w.jsx)(`small`,{children:`Resolved`}),(0,w.jsx)(`strong`,{children:F.delta.resolvedCount})]})]}),(0,w.jsxs)(`div`,{className:`wb-branch-diff-prompt-bar`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>{navigator.clipboard?.writeText(F.aiFixPrompt).catch(()=>{}),z(!0),window.setTimeout(()=>z(!1),1800)},children:se?`Copied AI fix prompt`:`Copy AI fix prompt`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>{navigator.clipboard?.writeText(F.prProofMarkdown).catch(()=>{}),le(!0),window.setTimeout(()=>le(!1),1800)},children:ce?`Copied PR Proof Markdown`:`Copy PR Proof Markdown`})]}),K&&K.beforeUrl&&K.afterUrl&&(0,w.jsxs)(`div`,{className:`wb-branch-slider-box`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-slider-toolbar`,children:[(0,w.jsx)(`div`,{className:`wb-branch-vp-tabs`,role:`group`,"aria-label":`Captured viewports`,children:F.visualDiff.viewports.map(e=>(0,w.jsxs)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":K.name===e.name,onClick:()=>re(e.name),children:[e.name,` (`,e.mismatchPercentage??0,`%)`]},e.name))}),(0,w.jsxs)(`div`,{className:`wb-branch-vp-tabs`,role:`group`,"aria-label":`Diff view mode`,children:[[`slider`,`2up`,`1up`].map(e=>(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":ie===e,onClick:()=>I(e),children:e===`slider`?`Diff Slider`:e===`2up`?`Side by Side`:`After`},e)),(0,w.jsxs)(`label`,{className:`wb-branch-check`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:L,onChange:e=>R(e.target.checked)}),(0,w.jsxs)(`span`,{children:[`Changed regions (`,K.boundingBoxes.length,`)`]})]})]})]}),ie===`slider`&&(0,w.jsxs)(`div`,{className:`wb-branch-slider-stage`,children:[(0,w.jsxs)(`div`,{className:`wb-branch-slider-frame`,style:{"--split":`${ae}%`},children:[(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After capture (${K.name})`}),(0,w.jsx)(`div`,{className:`wb-branch-slider-before`,children:(0,w.jsx)(`img`,{src:K.beforeUrl,alt:`Before capture (${K.name})`})}),L&&K.width>0&&K.height>0&&K.boundingBoxes.map((e,t)=>(0,w.jsx)(`div`,{className:`wb-branch-bbox`,style:{left:`${e.x/K.width*100}%`,top:`${e.y/K.height*100}%`,width:`${Math.max(1.5,e.width/K.width*100)}%`,height:`${Math.max(1.5,e.height/K.height*100)}%`}},`${e.x}-${e.y}-${t}`)),(0,w.jsx)(`span`,{className:`wb-branch-slider-handle`,"aria-hidden":`true`})]}),(0,w.jsxs)(`label`,{className:`wb-branch-scrubber`,children:[(0,w.jsxs)(`span`,{children:[`Before (`,ae,`%)`]}),(0,w.jsx)(`input`,{type:`range`,min:0,max:100,value:ae,"aria-label":`Before and after visual diff split`,onChange:e=>oe(Number(e.target.value))}),(0,w.jsxs)(`span`,{children:[`After (`,100-ae,`%)`]})]})]}),ie===`2up`&&(0,w.jsxs)(`div`,{className:`wb-branch-pair-grid`,children:[(0,w.jsxs)(`figure`,{children:[(0,w.jsx)(`figcaption`,{children:`Before`}),(0,w.jsx)(`img`,{src:K.beforeUrl,alt:`Before (${K.name})`})]}),(0,w.jsxs)(`figure`,{children:[(0,w.jsx)(`figcaption`,{children:`After`}),(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After (${K.name})`})]})]}),ie===`1up`&&(0,w.jsx)(`div`,{className:`wb-branch-single`,children:(0,w.jsx)(`img`,{src:K.afterUrl,alt:`After (${K.name})`})})]}),F.delta.layoutShifts&&F.delta.layoutShifts.length>0&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-section`,children:[(0,w.jsxs)(`strong`,{children:[`Layout Shifts (`,F.delta.layoutShifts.length,`)`]}),(0,w.jsx)(`ul`,{children:F.delta.layoutShifts.map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`code`,{children:e.selector}),` — `,e.summary]},`${e.selector}-${t}`))})]}),F.delta.introduced.length>0&&(0,w.jsxs)(`div`,{className:`wb-branch-diff-section`,children:[(0,w.jsxs)(`strong`,{children:[`Newly Introduced Findings (`,F.delta.introducedCount,`)`]}),(0,w.jsx)(`ul`,{children:F.delta.introduced.slice(0,8).map((e,t)=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`wb-sev-badge sev-${e.severity}`,children:e.severity}),` `,(0,w.jsx)(`code`,{children:e.code}),` at `,(0,w.jsx)(`code`,{children:e.location})]},`${e.code}-${t}`))})]})]})]})}function _t(e){return!e||e===`auto`||e===`ui`}var vt={project:``,brief:``,intent:`Website`,palette:`preserve`,styleDirection:``,styleContext:`efficient`,attachStyleImage:!0,photoSettings:{},projectPhotos:[],directionCandidate:``,selected:[],preserve:`Keep existing content and navigation
|
|
19
19
|
Keep keyboard controls working
|
|
20
|
-
Preserve saved state and storage fallback`,trust:!1,allowCreate:!0,figmaUrl:``,referenceDirections:{},workflow:`auto`};function
|
|
21
|
-
`).map(e=>e.trim()).filter(Boolean).length,Ct=x.project.trim().split(/[/\\]/).filter(Boolean).at(-1)||``,Y=D?.detectedModules?.framework===`nextjs-app`?`Next.js App`:D?.detectedModules?.framework===`nextjs-pages`?`Next.js Pages`:D?.detectedModules?.framework===`react-vite`?`React / Vite`:D?`Static HTML`:``,wt={idle:``,starting:`Starting microphone…`,listening:`Listening…`,finishing:`Finishing dictation…`,transcribing:`Transcribing recording…`}[F.phase],Tt=B??(Ye?q:null),Et=Tt===`palette`?`Project palette`:Tt===`references`?`Styles, photos & visual references`:Tt===`behaviors`?`Behaviors & interaction checks`:`Project scope & preview`,Dt=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=Dt.current,n=e?.parentElement;if(!e||!n||!t||typeof window<`u`&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||window.matchMedia(`(pointer: coarse)`).matches))return;let r=0,i=!1,a=0,o=0,s=0,c=0,l=()=>{r=0;let t=s-a,n=c-o;Math.hypot(t,n)<.35?(a=s,o=c):(a+=t*.24,o+=n*.24,r=window.requestAnimationFrame(l)),e.style.setProperty(`--mx`,`${a.toFixed(1)}px`),e.style.setProperty(`--my`,`${o.toFixed(1)}px`)},u=t=>{let n=e.getBoundingClientRect();n.width&&n.height&&(s=t.clientX-n.left,c=t.clientY-n.top,i||(i=!0,a=s,o=c,e.style.setProperty(`--mx`,`${a.toFixed(1)}px`),e.style.setProperty(`--my`,`${o.toFixed(1)}px`)),e.dataset.pointer=`active`,r||=window.requestAnimationFrame(l))},d=()=>{i=!1,delete e.dataset.pointer};return n.addEventListener(`pointermove`,u,{passive:!0}),n.addEventListener(`pointerleave`,d,{passive:!0}),()=>{r&&window.cancelAnimationFrame(r),n.removeEventListener(`pointermove`,u),n.removeEventListener(`pointerleave`,d),delete e.dataset.pointer}},[t]),(0,i.useEffect)(()=>{if(!B)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`dialog[open], .settings-page`)||(e.preventDefault(),mt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{ref:Dt,className:`welcome-aura`,"aria-hidden":`true`,children:[(0,w.jsx)(Ie,{motion:e,hoverEffects:t,variant:`backdrop`,spacing:24}),(0,w.jsx)(`span`,{className:`welcome-aurora-shimmer`}),(0,w.jsx)(`span`,{className:`welcome-aurora-curtain`}),(0,w.jsx)(`span`,{className:`welcome-pointer-sheen`})]}),(0,w.jsx)(Pe,{motion:e,active:!n}),(0,w.jsxs)(`form`,{onSubmit:r,className:`wb-form wb-form-calm`,children:[(0,w.jsxs)(`div`,{className:`wb-project-bar page-reveal page-reveal--controls`,children:[(0,w.jsxs)(`div`,{className:`wb-project-pill-row`,children:[(0,w.jsxs)(`div`,{className:`wb-project-selection`,children:[x.project.trim()?(0,w.jsxs)(`div`,{className:`wb-active-project-pill`,title:x.project,children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`strong`,{className:`wb-active-project-name`,children:Ct}),Y&&(0,w.jsx)(`span`,{className:`wb-active-project-tag`,children:Y}),D&&(0,w.jsxs)(`span`,{className:`wb-active-project-count`,children:[D.editablePaths.length,` files`]})]}):(0,w.jsxs)(`button`,{type:`button`,className:`wb-active-project-pill is-empty`,disabled:s||b,onClick:C,children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`span`,{children:`Select repository or project`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`button primary wb-browse-button`,disabled:b||s,"aria-label":b?`Opening folder picker`:`Browse for project folder`,onClick:S,children:[(0,w.jsx)(T,{name:`folder`}),b?`Opening…`:`Browse folder`]})]}),(0,w.jsxs)(`div`,{className:`wb-project-pill-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||b,onClick:C,children:`Repositories`}),!x.project.trim()&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||b,onClick:()=>void E(),children:`Try sample`}),x.project.trim()&&D?.project===x.project.trim()&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||De,onClick:()=>void Oe(),children:[(0,w.jsx)(T,{name:`shield`}),De?`Auditing…`:`Audit`]}),Re&&(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,"aria-pressed":Le,disabled:s,onClick:Re,children:[(0,w.jsx)(T,{name:`capture`}),Le?`Close diff`:`Visual Diff`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||re,onClick:()=>ie?I(``):void ae(oe),children:[(0,w.jsx)(T,{name:`image`}),re?`Preparing…`:ie?`Close preview`:`Preview`]})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-pill-text-btn`,"aria-expanded":He,onClick:()=>Ue(e=>!e),children:He?`Hide path`:`Paste path`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-pill-text-btn wb-create-trigger`,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Close starter`:`New project`})]})]}),He&&(0,w.jsxs)(`div`,{className:`wb-project-path-drawer`,children:[(0,w.jsx)(`label`,{className:`sr-only`,htmlFor:`project`,children:`Project folder`}),(0,w.jsxs)(`div`,{className:`wb-project-picker-row`,children:[(0,w.jsx)(`input`,{id:`project`,name:`project`,value:x.project,autoComplete:`off`,placeholder:`Paste an absolute project folder path…`,onChange:e=>fe(e.target.value),onBlur:he}),x.project.trim()&&D?.project!==x.project.trim()&&(0,w.jsxs)(`button`,{className:`button subtle wb-inspect-trigger`,type:`button`,disabled:b||s,onClick:K,children:[(0,w.jsx)(T,{name:`search`}),`Inspect`]})]}),de.length>0&&(0,w.jsxs)(`div`,{className:`wb-quick-projects`,"aria-label":`Quick project folders`,children:[(0,w.jsx)(`span`,{children:`Recent:`}),de.map(e=>{let t=e.split(/[/\\]/).filter(Boolean).at(-1)||e;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-quick-project-chip`,title:e,disabled:b||s,onClick:()=>me(e),children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`span`,{children:t})]},e)})]})]}),a&&(0,w.jsxs)(`section`,{className:`wb-create-project`,"aria-label":`Create new project`,children:[(0,w.jsxs)(`div`,{className:`wb-create-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{children:`Create a starter project`}),(0,w.jsx)(`p`,{children:`Create a clean Static HTML, React + Vite, or Next.js (App Router + Tailwind v4) folder without modifying existing projects.`})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>o(!1),children:`Cancel`})]}),(0,w.jsxs)(`div`,{className:`wb-create-grid`,children:[(0,w.jsxs)(`label`,{htmlFor:`new-project-template`,children:[`Project type`,(0,w.jsxs)(`select`,{id:`new-project-template`,name:`new-project-template`,value:f,onChange:e=>{let t=e.target.value;p(t===`react-vite`||t===`nextjs-app`?t:`static`)},children:[(0,w.jsx)(`option`,{value:`static`,children:`Static HTML / CSS / JS`}),(0,w.jsx)(`option`,{value:`react-vite`,children:`React + Vite + TypeScript`}),(0,w.jsx)(`option`,{value:`nextjs-app`,children:`Next.js (App Router + Tailwind v4)`})]})]}),(0,w.jsxs)(`label`,{htmlFor:`new-project-name`,children:[`Project name`,(0,w.jsx)(`input`,{id:`new-project-name`,name:`new-project-name`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:`my-new-website`})]}),(0,w.jsxs)(`div`,{className:`wb-create-row`,children:[(0,w.jsxs)(`label`,{htmlFor:`new-project-parent`,children:[`Parent folder`,(0,w.jsx)(`input`,{id:`new-project-parent`,name:`new-project-parent`,autoComplete:`off`,value:u,onChange:e=>d(e.target.value),placeholder:`Choose where to create it…`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-create-choose-parent`,disabled:s,onClick:v,children:[(0,w.jsx)(T,{name:`folder`}),`Choose parent`]})]})]}),(f===`react-vite`||f===`nextjs-app`)&&(0,w.jsxs)(`label`,{className:`check-row`,style:{marginTop:`0.5rem`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:m,disabled:s||g,onChange:e=>h(e.target.checked)}),(0,w.jsxs)(`span`,{children:[`Install dependencies after creation (`,(0,w.jsx)(`code`,{children:f===`nextjs-app`?`npm install --ignore-scripts`:`npm ci --ignore-scripts`}),`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-create-footer`,children:[u.trim()||c.trim()?(0,w.jsxs)(`p`,{className:`wb-create-preview`,children:[`Folder path:`,` `,(0,w.jsxs)(`code`,{children:[u.trim()||`<parent>`,/[\\/]$/.test(u.trim())?``:u.includes(`\\`)?`\\`:`/`,c.trim()||`<project-name>`]})]}):(0,w.jsx)(`span`,{className:`wb-create-preview-hint`,children:`No packages or scripts run automatically unless checked above.`}),(0,w.jsx)(`div`,{className:`wb-create-actions`,children:(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||!c.trim()||!u.trim(),onClick:y,children:s?`Creating…`:`Create project folder`})})]})]}),D?.adapter===`react-vite-v1`&&D.dependencies&&!D.dependencies.installed&&(0,w.jsxs)(`section`,{className:`wb-normalize-banner`,"aria-label":`Install project dependencies`,children:[(0,w.jsxs)(`p`,{children:[`Missing`,` `,(0,w.jsx)(`code`,{children:D.dependencies.missingTools.join(`, `)||`node_modules`}),`.`,` `,D.dependencies.usesTypeScript===!1?`Local preview and builds need `:`Local preview, typechecks, and builds need `,(0,w.jsx)(`code`,{children:D.dependencies.installCommand}),`. Audits still work right now.`]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||g,onClick:()=>void _(D.project),children:g?`Installing…`:`Install dependencies`})]}),O&&(0,w.jsxs)(`section`,{className:`wb-normalize-banner`,"aria-label":`Normalize website folder for Studio`,children:[(0,w.jsxs)(`p`,{children:[`Detected a `,O.detectedKind,` root under`,` `,(0,w.jsx)(`code`,{children:O.detectedRoot}),`. Import a clean copy into`,` `,(0,w.jsx)(`code`,{children:`work/`}),` (your original files stay untouched).`]}),(0,w.jsxs)(`div`,{className:`wb-create-row`,children:[(0,w.jsxs)(`label`,{htmlFor:`normalize-target-name`,children:[`Copy folder name`,(0,w.jsx)(`input`,{id:`normalize-target-name`,value:A,onChange:e=>ee(e.target.value),placeholder:`website-studio-copy`})]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||!A.trim(),onClick:j,children:`Import clean copy`})]})]})]}),ge&&(0,w.jsxs)(`section`,{className:`wb-review-feedback`,children:[(0,w.jsx)(`h2`,{children:`Continue from your review`}),(0,w.jsx)(`p`,{children:`The earlier proposal stays intact. This revision uses the current source and your feedback.`}),(0,w.jsxs)(`label`,{htmlFor:`review-feedback`,children:[`What should change?`,(0,w.jsx)(`textarea`,{id:`review-feedback`,maxLength:4e3,required:!0,rows:3,value:ge.reviewFeedback,onChange:e=>_e(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:ve,children:`Remove review link`})]}),(0,w.jsxs)(`div`,{className:`brief-composer wb-composer page-reveal page-reveal--content`,children:[(0,w.jsxs)(`div`,{className:`wb-focus-bar`,role:`group`,"aria-label":`Task focus`,children:[[{id:`auto`,label:`UI Design`},{id:`audit`,label:`Audit`},{id:`seo-ai-search`,label:`SEO & AI`},{id:`architecture`,label:`Project Map`}].map(e=>{let t=e.id===`auto`?$e===`auto`||$e===`ui`:e.id===`audit`?it:e.id===`seo-ai-search`?$e===`seo-ai-search`||$e===`seo`||$e===`ai-search`:$e===e.id;return(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":t,onClick:()=>P({workflow:e.id}),children:e.label},e.id)}),!tt&&(0,w.jsxs)(`span`,{className:`wb-focus-hint`,children:[`Palettes & references hidden for`,` `,it?`Audit`:$e===`architecture`?`Project Map`:`SEO & AI`]})]}),(0,w.jsx)(`label`,{className:`sr-only`,htmlFor:`brief`,children:`What would you like to build or improve?`}),(0,w.jsx)(`textarea`,{id:`brief`,name:`brief`,required:!nt,rows:3,maxLength:12e3,ref:N,value:x.brief,onChange:e=>P({brief:e.target.value}),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),nt?Oe(We===`ai-assisted`):e.currentTarget.form?.requestSubmit())},placeholder:nt?We===`ai-assisted`?`Optional: note what to focus on — Scan + AI review runs local checks first, then builds an editable AI fix brief from cited findings…`:`Optional: note what to focus on — or click Run Audit to scan security, accessibility, and code quality right now…`:rt?`Review the local findings below, then generate a focused AI-assisted fix…`:$e===`architecture`?`Ask for a component map, route overview, or dependency check…`:tt?`Describe what you want to change or improve…`:`Describe the pages, headings, metadata, or search structure you want to improve…`}),(F.busy||F.error)&&(0,w.jsxs)(`div`,{className:`wb-dictation`,"aria-label":`Voice input status`,children:[(0,w.jsxs)(`div`,{className:`wb-dictation-status`,children:[F.phase===`listening`&&(0,w.jsxs)(`span`,{className:`wb-voice-wave`,"data-speaking":F.speaking,style:{"--voice-level":String(F.level)},"aria-hidden":`true`,children:[(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{})]}),F.busy&&(0,w.jsxs)(`span`,{role:`status`,children:[wt,F.recordingProvider&&(F.recordingProvider===`groq`?` · Groq`:` · Google AI Studio`),F.phase===`listening`&&(0,w.jsxs)(`span`,{className:`wb-voice-timer`,"aria-hidden":`true`,children:[` `,`· `,Math.floor(F.elapsedSec/60),`:`,String(F.elapsedSec%60).padStart(2,`0`)]})]}),F.error&&(0,w.jsx)(`span`,{role:`alert`,children:F.error}),(0,w.jsxs)(`div`,{className:`wb-dictation-actions`,children:[F.phase===`listening`&&!F.recordingProvider&&ne&&(0,w.jsxs)(`button`,{type:`button`,className:`text-button`,onClick:()=>{F.cancel(),F.start(!0)},children:[`Use `,te]}),F.busy&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:F.cancel,children:`Cancel voice input`}),F.error&&!F.recordingProvider&&ne&&(0,w.jsxs)(`button`,{type:`button`,className:`text-button`,onClick:()=>void F.start(!0),children:[`Record with `,te]})]})]}),F.transcript&&(0,w.jsx)(`p`,{className:`wb-dictation-transcript`,children:F.transcript})]}),ie&&(0,w.jsxs)(`div`,{className:`wb-source-preview-inline`,children:[(0,w.jsxs)(`div`,{className:`wb-source-preview-actions`,children:[(0,w.jsx)(`a`,{href:ie,target:`_blank`,rel:`noreferrer`,children:`Open preview in new tab`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>I(``),children:`Close preview`})]}),(0,w.jsx)(`iframe`,{className:`wb-source-preview-frame`,title:`Current project preview`,src:ie})]}),(0,w.jsxs)(`div`,{className:`wb-composer-tools`,children:[tt&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{ref:ct,type:`button`,"aria-pressed":B===`palette`,onClick:()=>V(B===`palette`?null:`palette`),children:[(0,w.jsx)(T,{name:`palette`}),`Palette`,at?.tokens?(0,w.jsx)(`span`,{className:`wb-pill-dot`,"aria-hidden":`true`}):null]}),(0,w.jsxs)(`button`,{ref:ut,type:`button`,"aria-pressed":B===`references`,onClick:()=>V(B===`references`?null:`references`),children:[(0,w.jsx)(T,{name:`image`}),`References`,x.selected.length||yt?` (${x.selected.length+ +!!yt})`:``]})]}),(0,w.jsxs)(`button`,{ref:dt,type:`button`,"aria-pressed":B===`behaviors`,onClick:()=>V(B===`behaviors`?null:`behaviors`),children:[(0,w.jsx)(T,{name:`shield`}),`Behaviors & Checks`,St?` (${St})`:``]}),(0,w.jsxs)(`button`,{ref:ft,type:`button`,"aria-pressed":B===`scope`,onClick:()=>V(B===`scope`?null:`scope`),children:[(0,w.jsx)(T,{name:`settings`}),`Scope`,x.trust?` · Trusted`:``]}),it&&(0,w.jsxs)(`div`,{className:`wb-audit-mode`,role:`group`,"aria-label":`Audit mode`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-pressed":!rt&&We===`deterministic`,title:`Run local deterministic checks only. No AI provider is called.`,onClick:()=>{Ge(`deterministic`),rt&&P({workflow:`audit`})},children:`Deterministic`}),(0,w.jsx)(`button`,{type:`button`,"aria-pressed":rt||We===`ai-assisted`,title:`Run local checks, then prepare a focused AI review from the findings.`,onClick:()=>Ge(`ai-assisted`),children:`AI-assisted`})]}),(0,w.jsxs)(`div`,{className:`wb-composer-actions`,children:[(!nt||We===`ai-assisted`)&&(0,w.jsxs)(`div`,{className:`wb-mode-switch`,role:`group`,"aria-label":`Execution mode`,children:[(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":L===`auto`,title:`Use your connected model`,onClick:()=>{R(`auto`),W(null)},children:[(0,w.jsx)(T,{name:`auto`}),`Auto`]}),(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":L===`mcp`,title:`Use Codex, Claude, Cursor, or Antigravity`,onClick:()=>{R(`mcp`),W(null)},children:[(0,w.jsx)(T,{name:`mcp`}),`AI client`]})]}),(0,w.jsx)(`button`,{type:`button`,className:`wb-mic-button`,"aria-pressed":F.phase===`listening`,"aria-label":F.phase===`listening`?`Stop voice input`:`Voice input`,title:F.phase===`listening`?`Stop and add dictation`:`Dictate your brief`,disabled:s||F.busy&&F.phase!==`listening`,onClick:()=>F.phase===`listening`?F.stop():void F.start(),children:(0,w.jsx)(T,{name:F.phase===`listening`?`close`:`mic`})}),nt?(0,w.jsxs)(`button`,{type:`button`,className:`button primary wb-composer-run`,disabled:s||b||De,onClick:()=>void Oe(We===`ai-assisted`),title:We===`ai-assisted`?L===`mcp`?`Run the local scan first; review its findings, then choose Prepare client task to send an AI-assisted audit brief.`:`Run the local scan first; review its findings, then choose Generate revision to prepare an AI-assisted fix.`:`Run local deterministic checks without an AI provider.`,children:[De?`Auditing…`:We===`ai-assisted`?`Scan + AI review`:`Run Audit`,(0,w.jsx)(T,{name:`arrow`})]}):(0,w.jsxs)(`button`,{type:L===`auto`&&(!se||!ce?.model)?`button`:`submit`,onClick:L===`auto`&&(!se||!ce?.model)?()=>le():void 0,className:`button primary wb-composer-run`,disabled:s||b||!M||ue?.length===0||F.busy,children:[s?`Preparing…`:L===`mcp`?ue?`Prepare live task`:`Prepare client task`:ce?.model&&se?`Generate revision`:`Connect a model`,(0,w.jsx)(T,{name:`arrow`})]})]})]})]}),Ee&&(0,w.jsx)(gt,{quickAudit:Ee,onPrefillAuditFix:Fe,onOpenWorkflows:Ne,onClearQuickAudit:ke}),Le&&(0,w.jsx)(_t,{project:x.project,onClose:Re}),(0,w.jsxs)(`div`,{className:`wb-composer-meta-strip`,children:[(0,w.jsx)(`span`,{children:nt?We===`ai-assisted`?`Runs a fast local scan first, then drafts an editable fix brief from the findings`:`Local audit runs right away — no API key or npm install required`:rt?`AI-assisted audit · local findings and cited files only`:L===`mcp`?ue?`Live edit · ${ue.length} files selected`:`AI client mode · files stay untouched until you click Apply`:z&&ce?`${xe(ce.providerId)} · ${ce.model}`:se?ce?.model?`Confirm ${xe(ce.providerId)} free tier in Connections`:`Choose a model in Connections`:`No API key required — run Audit, open Visual Diff, or use AI client (optional API keys in Connections)`}),Se&&!Ce&&(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-clear-draft-inline`,disabled:s,onClick:Te,children:`Clear saved draft`})]}),Ce&&(0,w.jsxs)(`div`,{className:`wb-draft-privacy`,role:`note`,"aria-label":`Browser draft storage`,children:[(0,w.jsx)(`span`,{children:`Draft brief, path, and mode save in this browser (never API keys or tokens).`}),(0,w.jsxs)(`span`,{className:`wb-draft-privacy-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-clear-draft-button`,disabled:s,onClick:Te,children:`Clear saved draft`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:we,children:`Got it`})]})]}),!B&&(tt&&(x.palette!==`preserve`||x.selected.length>0||!!yt||(x.projectPhotos?.length??0)>0||!!bt)||x.trust)&&(0,w.jsxs)(`div`,{className:`wb-selection-feedback`,role:`status`,"aria-live":`polite`,children:[tt&&yt&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected style `+yt.name,children:[(0,w.jsx)(T,{name:`component`}),(0,w.jsxs)(`span`,{children:[`Style · `,yt.name]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected style direction`,onClick:()=>P({styleDirection:``}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),tt&&at?.tokens&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`palette`),"aria-label":`Edit selected palette `+at.name,children:[(0,w.jsx)(`span`,{className:`wb-selection-swatches`,"aria-hidden":`true`,children:at.colors.map((e,t)=>(0,w.jsx)(`span`,{className:`wb-selection-swatch`,style:{backgroundColor:e}},t))}),(0,w.jsx)(`span`,{children:at.name})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected palette`,onClick:()=>P({palette:`preserve`}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),tt&&bt&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>V(`behaviors`),children:(0,w.jsx)(`span`,{children:bt.name})}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected direction`,onClick:()=>P({directionCandidate:``}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),tt&&x.selected.length>0&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected references`,children:[(0,w.jsx)(`span`,{className:`selection-thumbnails`,children:xt.map(e=>(0,w.jsx)(`img`,{src:e.imageURL,width:`24`,height:`24`,decoding:`async`,alt:``},e.id))}),(0,w.jsxs)(`span`,{children:[x.selected.length,` `,x.selected.length===1?`reference`:`references`,` selected`]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected references`,onClick:()=>P({selected:[]}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),tt&&(x.projectPhotos?.length??0)>0&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected project photos`,children:[(0,w.jsx)(T,{name:`assets`}),(0,w.jsxs)(`span`,{children:[x.projectPhotos.length,` project`,` `,x.projectPhotos.length===1?`photo`:`photos`]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected project photos`,onClick:()=>P({projectPhotos:[]}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),x.trust&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`scope`),children:[(0,w.jsx)(T,{name:`shield`}),(0,w.jsx)(`span`,{children:`Trusted checks enabled`})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Disable trusted local checks`,onClick:()=>{P({trust:!1}),W(null)},children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]})]}),(0,w.jsx)(`div`,{className:`wb-composer-drawer-shell`+(B?` is-open`:Ye?` is-closing`:``),"data-open":B?`true`:`false`,"aria-hidden":!B,children:(0,w.jsx)(`div`,{className:`wb-composer-drawer-inner`,children:Tt&&(0,w.jsxs)(`section`,{className:`wb-direction wb-composer-drawer`,"aria-labelledby":`composer-direction-title`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),mt())},children:[(0,w.jsxs)(`div`,{className:`wb-section-heading wb-direction-heading`,children:[(0,w.jsx)(`h2`,{ref:pt,id:`composer-direction-title`,tabIndex:-1,children:Et}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:mt,children:`Done`})]}),(0,w.jsxs)(`div`,{className:`wb-composer-drawer-content`,children:[Tt===`palette`&&(0,w.jsx)(ot,{value:x.palette,onChange:e=>P({palette:e})}),Tt===`references`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(J,{styleId:x.styleDirection??``,attachStyleImage:x.attachStyleImage??!0,styleContext:x.styleContext??`efficient`,onSelectStyle:e=>P({styleDirection:e,styleContext:`efficient`}),onSelectStyleContext:e=>P({styleContext:e}),onToggleAttachStyleImage:e=>P({attachStyleImage:e}),references:M?.references??[],inspection:D?.project===x.project.trim()?D:null,selectedIds:x.selected,photoSettings:x.photoSettings??{},onPhotoSetting:(e,t)=>P({photoSettings:{...x.photoSettings??{},[e]:t}}),selectedProjectPhotos:x.projectPhotos??[],onToggleProjectPhoto:e=>{let t=x.projectPhotos??[];P({projectPhotos:t.includes(e)?t.filter(t=>t!==e):[...t,e]})},onUploadPhoto:H}),(0,w.jsx)(st,{references:M?.references??[],selected:x.selected,onChange:e=>P({selected:e}),onUpload:async e=>{await H(e)},directions:x.referenceDirections,onDirection:(e,t)=>P({referenceDirections:{...x.referenceDirections,[e]:t}})})]}),Tt===`behaviors`&&(0,w.jsxs)(`div`,{className:`wb-drawer-stack`,children:[(0,w.jsxs)(`p`,{className:`field-help`,children:[`Add one requirement or browser interaction test per line (`,(0,w.jsx)(`code`,{children:`selector: #details`}),`, `,(0,w.jsx)(`code`,{children:`keyboard: #menu-button`}),`,`,` `,(0,w.jsx)(`code`,{children:`click: #open -> #dialog`}),`,`,` `,(0,w.jsx)(`code`,{children:`text: h1 *= "Title"`}),`). Plain-language notes stay flagged for manual review before Apply.`]}),(0,w.jsx)(`div`,{className:`wb-preservation-suggestions`,role:`group`,"aria-label":`Interaction test templates`,children:je.map(e=>(0,w.jsx)(`button`,{type:`button`,title:`Insert "${e.value}"`,"aria-pressed":x.preserve.split(`
|
|
20
|
+
Preserve saved state and storage fallback`,trust:!1,allowCreate:!0,figmaUrl:``,referenceDirections:{},workflow:`auto`};function yt({motion:e,hoverEffects:t=!0,settings:n,generate:r,creating:a,setCreating:o,busy:s,newName:c,setNewName:l,newParent:u,setNewParent:d,newTemplate:f,setNewTemplate:p,newInstallDeps:m,setNewInstallDeps:h,installingDeps:g,onInstallDependencies:_,chooseParent:v,createProject:y,picking:b,draft:x,browse:S,onOpenRepositories:C,onTrySample:E,inspection:D,normalizeOffer:O,normalizeTargetName:A,setNormalizeTargetName:ee,importCleanWebsiteCopy:j,context:M,briefRef:N,change:P,voice:F,cloudVoiceName:te,cloudVoiceProvider:ne,sourcePreviewLoading:re,sourcePreview:ie,setSourcePreview:I,task:ae,previewSelectedProject:oe,execution:L,setExecution:R,autoHasKey:se,autoReady:z,prefs:ce,openConnections:le,panel:B,setPanel:V,upload:H,preserveRef:U,livePaths:ue,setLiveSelection:W,dispatchEstimate:G,quickProjects:de,onProjectChange:fe,onInspect:K,onQuickProject:me,onInspectOnBlur:he,iteration:ge,onIterationFeedback:_e,onRemoveIteration:ve,onExportProjectRules:ye,figmaConnector:be,providerDisplayName:xe,hasSavedDraft:Se,showFirstTimeDraftNotice:Ce,onDismissDraftNotice:we,onClearSavedDraft:Te,quickAudit:Ee,quickAuditLoading:De,onRunQuickAudit:Oe,onClearQuickAudit:ke,onOpenWorkflows:Pe,onPrefillAuditFix:Ie,branchDiffOpen:Le=!1,onToggleBranchDiff:Re,showStarterSetup:ze=!1,onStarterSelect:Be,onDismissStarter:Ve,hasNotice:He=!1,pathInputFallbackSignal:Ue,suggestedSubfolders:We=[]}){let[q,qe]=(0,i.useState)(!1),[Je,Ye]=(0,i.useState)(``),[Xe,Qe]=(0,i.useState)(!1),[et,tt]=(0,i.useState)(`deterministic`),[nt,rt]=(0,i.useState)(`palette`),[it,st]=(0,i.useState)(!1),lt=(0,i.useRef)(null),ut=(0,i.useRef)(null),dt=x.workflow??`auto`,ft=_t(dt),J=dt===`audit`,vt=dt===`audit-ai`,yt=J||vt,bt=Ke.find(e=>e.id===x.palette),xt=(0,i.useRef)(null),St=(0,i.useRef)(null),Ct=(0,i.useRef)(null),wt=(0,i.useRef)(null),Y=(0,i.useRef)(null);(0,i.useEffect)(()=>{Ue?.count&&(qe(!0),Ye(Ue.hint),window.requestAnimationFrame(()=>{ut.current?.focus(),ut.current?.select()}))},[Ue?.count,Ue?.hint]),(0,i.useEffect)(()=>{ft||B!==`palette`&&B!==`references`||V(null)},[ft,B,V]),(0,i.useEffect)(()=>{vt&&tt(`ai-assisted`)},[vt]),(0,i.useEffect)(()=>(B?(lt.current&&=(window.clearTimeout(lt.current),null),rt(B),st(!1),Y.current?.focus({preventScroll:!0}),Y.current?.parentElement?.scrollIntoView({block:`nearest`,behavior:e?`smooth`:`auto`})):e?(st(!0),lt.current=window.setTimeout(()=>{st(!1),lt.current=null},320)):st(!1),()=>{lt.current&&=(window.clearTimeout(lt.current),null)}),[B,e]);function Tt(){let e=B;V(null);let t={preventScroll:!0};e===`palette`?xt.current?.focus(t):e===`references`?St.current?.focus(t):e===`behaviors`?Ct.current?.focus(t):e===`scope`&&wt.current?.focus(t)}let Et=ct.find(e=>e.id===x.styleDirection),Dt=Ze.find(e=>e.id===x.directionCandidate),X=M?.references.filter(e=>x.selected.includes(e.id))??[],Ot=x.preserve.split(`
|
|
21
|
+
`).map(e=>e.trim()).filter(Boolean).length,kt=x.project.trim().split(/[/\\]/).filter(Boolean).at(-1)||``,At=D?.detectedModules?.framework===`nextjs-app`?`Next.js App`:D?.detectedModules?.framework===`nextjs-pages`?`Next.js Pages`:D?.detectedModules?.framework===`react-vite`?`React / Vite`:D?`Static HTML`:``,jt={idle:``,starting:`Starting microphone…`,listening:`Listening…`,finishing:`Finishing dictation…`,transcribing:`Transcribing recording…`}[F.phase],Mt=B??(it?nt:null),Nt=Mt===`palette`?`Project palette`:Mt===`references`?`Styles, photos & visual references`:Mt===`behaviors`?`Behaviors & interaction checks`:`Project scope & preview`,Pt=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=Pt.current,n=e?.parentElement;if(!e||!n||!t||typeof window<`u`&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||window.matchMedia(`(pointer: coarse)`).matches))return;let r=0,i=!1,a=0,o=0,s=0,c=0,l=()=>{r=0;let t=s-a,n=c-o;Math.hypot(t,n)<.35?(a=s,o=c):(a+=t*.24,o+=n*.24,r=window.requestAnimationFrame(l)),e.style.setProperty(`--mx`,`${a.toFixed(1)}px`),e.style.setProperty(`--my`,`${o.toFixed(1)}px`)},u=t=>{let n=e.getBoundingClientRect();n.width&&n.height&&(s=t.clientX-n.left,c=t.clientY-n.top,i||(i=!0,a=s,o=c,e.style.setProperty(`--mx`,`${a.toFixed(1)}px`),e.style.setProperty(`--my`,`${o.toFixed(1)}px`)),e.dataset.pointer=`active`,r||=window.requestAnimationFrame(l))},d=()=>{i=!1,delete e.dataset.pointer};return n.addEventListener(`pointermove`,u,{passive:!0}),n.addEventListener(`pointerleave`,d,{passive:!0}),()=>{r&&window.cancelAnimationFrame(r),n.removeEventListener(`pointermove`,u),n.removeEventListener(`pointerleave`,d),delete e.dataset.pointer}},[t]),(0,i.useEffect)(()=>{if(!B)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`dialog[open], .settings-page`)||(e.preventDefault(),Tt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B]);let Ft=!!(x.project.trim()&&D?.project===x.project.trim()),It=!J&&L===`auto`&&(!se||!ce?.model),Lt=!!B||ft&&(x.palette!==`preserve`||x.selected.length>0||!!Et||(x.projectPhotos?.length??0)>0)||x.trust,Z=Xe||Lt;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{ref:Pt,className:`welcome-aura`,"aria-hidden":`true`,children:[(0,w.jsx)(Fe,{motion:e,hoverEffects:t,variant:`backdrop`,spacing:24}),(0,w.jsx)(`span`,{className:`welcome-aurora-shimmer`}),(0,w.jsx)(`span`,{className:`welcome-aurora-curtain`}),(0,w.jsx)(`span`,{className:`welcome-pointer-sheen`})]}),(0,w.jsx)(Ne,{motion:e,active:!n,compact:!!(He||q||a)}),(0,w.jsxs)(`form`,{onSubmit:r,className:`wb-form wb-form-calm`,children:[(0,w.jsxs)(`div`,{className:`wb-project-bar page-reveal page-reveal--controls`,children:[(0,w.jsxs)(`div`,{className:`wb-project-pill-row`,children:[(0,w.jsxs)(`div`,{className:`wb-project-selection`,children:[x.project.trim()?(0,w.jsxs)(`div`,{className:`wb-active-project-pill`,title:x.project,children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`strong`,{className:`wb-active-project-name`,children:kt}),At&&(0,w.jsx)(`span`,{className:`wb-active-project-tag`,children:At}),D&&(0,w.jsxs)(`span`,{className:`wb-active-project-count`,children:[D.editablePaths.length,` files`]})]}):(0,w.jsxs)(`button`,{type:`button`,className:`wb-active-project-pill is-empty`,disabled:s||b,onClick:S,children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`span`,{children:`Pick a web project folder or click New project`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`button primary wb-browse-button`,disabled:b||s,"aria-label":b?`Opening folder picker`:`Browse for project folder`,onClick:S,children:[(0,w.jsx)(T,{name:`folder`}),b?`Opening…`:`Browse folder`]})]}),(0,w.jsxs)(`div`,{className:`wb-project-pill-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||b,onClick:C,children:`Repositories`}),!x.project.trim()&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||b,onClick:()=>void E(),children:`Try sample`}),x.project.trim()&&D?.project===x.project.trim()&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||De,onClick:()=>void Oe(),children:[(0,w.jsx)(T,{name:`shield`}),De?`Auditing…`:`Audit`]}),Re&&(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,"aria-pressed":Le,disabled:s,onClick:Re,children:[(0,w.jsx)(T,{name:`capture`}),Le?`Close diff`:`Visual Diff`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:s||re,onClick:()=>ie?I(``):void ae(oe),children:[(0,w.jsx)(T,{name:`image`}),re?`Preparing…`:ie?`Close preview`:`Preview`]})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-pill-text-btn`,"aria-expanded":q,onClick:()=>qe(e=>!e),children:q?`Hide path`:`Paste path`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-pill-text-btn wb-create-trigger`,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Close starter`:`New project`})]})]}),q&&(0,w.jsxs)(`div`,{className:`wb-project-path-drawer`,children:[Je&&(0,w.jsx)(`p`,{className:`wb-path-fallback-hint`,role:`status`,children:Je}),(0,w.jsx)(`label`,{className:`sr-only`,htmlFor:`project`,children:`Project folder`}),(0,w.jsxs)(`div`,{className:`wb-project-picker-row`,children:[(0,w.jsx)(`input`,{ref:ut,id:`project`,name:`project`,value:x.project,autoComplete:`off`,placeholder:`Paste an absolute project folder path…`,onChange:e=>{Je&&Ye(``),fe(e.target.value)},onBlur:he}),x.project.trim()&&D?.project!==x.project.trim()&&(0,w.jsxs)(`button`,{className:`button subtle wb-inspect-trigger`,type:`button`,disabled:b||s,onClick:K,children:[(0,w.jsx)(T,{name:`search`}),`Inspect`]})]}),de.length>0&&(0,w.jsxs)(`div`,{className:`wb-quick-projects`,"aria-label":`Quick project folders`,children:[(0,w.jsx)(`span`,{children:`Recent:`}),de.map(e=>{let t=e.split(/[/\\]/).filter(Boolean).at(-1)||e;return(0,w.jsxs)(`button`,{type:`button`,className:`wb-quick-project-chip`,title:e,disabled:b||s,onClick:()=>me(e),children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsx)(`span`,{children:t})]},e)})]})]}),a&&(0,w.jsxs)(`section`,{className:`wb-create-project`,"aria-label":`Create new project`,children:[(0,w.jsxs)(`div`,{className:`wb-create-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{children:`Create a starter project`}),(0,w.jsx)(`p`,{children:`Create a clean Static HTML, React + Vite, or Next.js (App Router + Tailwind v4) folder without modifying existing projects.`})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>o(!1),children:`Cancel`})]}),(0,w.jsxs)(`div`,{className:`wb-create-grid`,children:[(0,w.jsxs)(`label`,{htmlFor:`new-project-template`,children:[`Project type`,(0,w.jsxs)(`select`,{id:`new-project-template`,name:`new-project-template`,value:f,onChange:e=>{let t=e.target.value;p(t===`react-vite`||t===`nextjs-app`?t:`static`)},children:[(0,w.jsx)(`option`,{value:`static`,children:`Static HTML / CSS / JS`}),(0,w.jsx)(`option`,{value:`react-vite`,children:`React + Vite + TypeScript`}),(0,w.jsx)(`option`,{value:`nextjs-app`,children:`Next.js (App Router + Tailwind v4)`})]})]}),(0,w.jsxs)(`label`,{htmlFor:`new-project-name`,children:[`Project name`,(0,w.jsx)(`input`,{id:`new-project-name`,name:`new-project-name`,autoComplete:`off`,value:c,onChange:e=>l(e.target.value),placeholder:`my-new-website`})]}),(0,w.jsxs)(`div`,{className:`wb-create-row`,children:[(0,w.jsxs)(`label`,{htmlFor:`new-project-parent`,children:[`Parent folder`,(0,w.jsx)(`input`,{id:`new-project-parent`,name:`new-project-parent`,autoComplete:`off`,value:u,onChange:e=>d(e.target.value),placeholder:`Choose where to create it…`})]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-create-choose-parent`,disabled:s,onClick:v,children:[(0,w.jsx)(T,{name:`folder`}),`Choose parent`]})]})]}),(f===`react-vite`||f===`nextjs-app`)&&(0,w.jsxs)(`label`,{className:`check-row`,style:{marginTop:`0.5rem`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:m,disabled:s||g,onChange:e=>h(e.target.checked)}),(0,w.jsxs)(`span`,{children:[`Install dependencies after creation (`,(0,w.jsx)(`code`,{children:f===`nextjs-app`?`npm install --ignore-scripts`:`npm ci --ignore-scripts`}),`)`]})]}),(0,w.jsxs)(`div`,{className:`wb-create-footer`,children:[u.trim()||c.trim()?(0,w.jsxs)(`p`,{className:`wb-create-preview`,children:[`Folder path:`,` `,(0,w.jsxs)(`code`,{children:[u.trim()||`<parent>`,/[\\/]$/.test(u.trim())?``:u.includes(`\\`)?`\\`:`/`,c.trim()||`<project-name>`]})]}):(0,w.jsx)(`span`,{className:`wb-create-preview-hint`,children:`No packages or scripts run automatically unless checked above.`}),(0,w.jsx)(`div`,{className:`wb-create-actions`,children:(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||!c.trim()||!u.trim(),onClick:y,children:s?`Creating…`:`Create project folder`})})]})]}),D?.adapter===`react-vite-v1`&&D.dependencies&&!D.dependencies.installed&&(0,w.jsxs)(`section`,{className:`wb-normalize-banner`,"aria-label":`Install project dependencies`,children:[(0,w.jsxs)(`p`,{children:[`Missing`,` `,(0,w.jsx)(`code`,{children:D.dependencies.missingTools.join(`, `)||`node_modules`}),`.`,` `,D.dependencies.usesTypeScript===!1?`Local preview and builds need `:`Local preview, typechecks, and builds need `,(0,w.jsx)(`code`,{children:D.dependencies.installCommand}),`. Audits still work right now.`]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||g,onClick:()=>void _(D.project),children:g?`Installing…`:`Install dependencies`})]}),We.length>0&&(0,w.jsxs)(`section`,{className:`wb-normalize-banner wb-subfolder-hints`,"aria-label":`Detected web subfolders`,children:[(0,w.jsxs)(`p`,{children:[`Found web app subfolder`,We.length===1?``:`s`,` inside this directory. Pick one to open it directly, or click `,(0,w.jsx)(`strong`,{children:`New project`}),`:`]}),(0,w.jsxs)(`div`,{className:`wb-quick-projects`,children:[We.map(e=>(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-pill-btn`,disabled:b||s,onClick:()=>me(e.fullPath),children:[(0,w.jsx)(T,{name:`folder`}),(0,w.jsxs)(`span`,{children:[e.relativePath,`/ (`,e.kind,`)`]})]},e.fullPath)),(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-pill-text-btn`,disabled:b||s,onClick:()=>o(!0),children:`New project`})]})]}),O&&(0,w.jsxs)(`section`,{className:`wb-normalize-banner`,"aria-label":`Normalize website folder for Studio`,children:[(0,w.jsxs)(`p`,{children:[`Detected a `,O.detectedKind,` root under`,` `,(0,w.jsx)(`code`,{children:O.detectedRoot}),`. Import a clean copy into`,` `,(0,w.jsx)(`code`,{children:`work/`}),` (your original files stay untouched).`]}),(0,w.jsxs)(`div`,{className:`wb-create-row`,children:[(0,w.jsxs)(`label`,{htmlFor:`normalize-target-name`,children:[`Copy folder name`,(0,w.jsx)(`input`,{id:`normalize-target-name`,value:A,onChange:e=>ee(e.target.value),placeholder:`website-studio-copy`})]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:s||!A.trim(),onClick:j,children:`Import clean copy`})]})]})]}),ge&&(0,w.jsxs)(`section`,{className:`wb-review-feedback`,children:[(0,w.jsx)(`h2`,{children:`Continue from your review`}),(0,w.jsx)(`p`,{children:`The earlier proposal stays intact. This revision uses the current source and your feedback.`}),(0,w.jsxs)(`label`,{htmlFor:`review-feedback`,children:[`What should change?`,(0,w.jsx)(`textarea`,{id:`review-feedback`,maxLength:4e3,required:!0,rows:3,value:ge.reviewFeedback,onChange:e=>_e(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}})]}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:ve,children:`Remove review link`})]}),(0,w.jsxs)(`div`,{className:`brief-composer wb-composer page-reveal page-reveal--content`,children:[(0,w.jsxs)(`div`,{className:`wb-focus-bar`,role:`group`,"aria-label":`Task focus`,children:[[{id:`auto`,label:`UI Design`},{id:`audit`,label:`Audit`},{id:`seo-ai-search`,label:`SEO & AI`},{id:`architecture`,label:`Project Map`}].map(e=>{let t=e.id===`auto`?dt===`auto`||dt===`ui`:e.id===`audit`?yt:e.id===`seo-ai-search`?dt===`seo-ai-search`||dt===`seo`||dt===`ai-search`:dt===e.id;return(0,w.jsx)(`button`,{type:`button`,className:`wb-focus-pill`,"aria-pressed":t,onClick:()=>P({workflow:e.id}),children:e.label},e.id)}),!ft&&(0,w.jsxs)(`span`,{className:`wb-focus-hint`,children:[`Palettes & references hidden for`,` `,yt?`Audit`:dt===`architecture`?`Project Map`:`SEO & AI`]})]}),(0,w.jsx)(`label`,{className:`sr-only`,htmlFor:`brief`,children:`What would you like to build or improve?`}),(0,w.jsx)(`textarea`,{id:`brief`,name:`brief`,required:!J,rows:3,maxLength:12e3,ref:N,value:x.brief,onChange:e=>P({brief:e.target.value}),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&(e.preventDefault(),J?Oe(et===`ai-assisted`):e.currentTarget.form?.requestSubmit())},placeholder:J?et===`ai-assisted`?`Optional: note what to focus on — Scan + AI review runs local checks first, then builds an editable AI fix brief from cited findings…`:`Optional: note what to focus on — or click Run Audit to scan security, accessibility, and code quality right now…`:vt?`Review the local findings below, then generate a focused AI-assisted fix…`:dt===`architecture`?`Ask for a component map, route overview, or dependency check…`:ft?`Describe what you want to change or improve…`:`Describe the pages, headings, metadata, or search structure you want to improve…`}),(F.busy||F.error)&&(0,w.jsxs)(`div`,{className:`wb-dictation`,"aria-label":`Voice input status`,children:[(0,w.jsxs)(`div`,{className:`wb-dictation-status`,children:[F.phase===`listening`&&(0,w.jsxs)(`span`,{className:`wb-voice-wave`,"data-speaking":F.speaking,style:{"--voice-level":String(F.level)},"aria-hidden":`true`,children:[(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{}),(0,w.jsx)(`i`,{})]}),F.busy&&(0,w.jsxs)(`span`,{role:`status`,children:[jt,F.recordingProvider&&(F.recordingProvider===`groq`?` · Groq`:` · Google AI Studio`),F.phase===`listening`&&(0,w.jsxs)(`span`,{className:`wb-voice-timer`,"aria-hidden":`true`,children:[` `,`· `,Math.floor(F.elapsedSec/60),`:`,String(F.elapsedSec%60).padStart(2,`0`)]})]}),F.error&&(0,w.jsx)(`span`,{role:`alert`,children:F.error}),(0,w.jsxs)(`div`,{className:`wb-dictation-actions`,children:[F.phase===`listening`&&!F.recordingProvider&&ne&&(0,w.jsxs)(`button`,{type:`button`,className:`text-button`,onClick:()=>{F.cancel(),F.start(!0)},children:[`Use `,te]}),F.busy&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:F.cancel,children:`Cancel voice input`}),F.error&&!F.recordingProvider&&ne&&(0,w.jsxs)(`button`,{type:`button`,className:`text-button`,onClick:()=>void F.start(!0),children:[`Record with `,te]})]})]}),F.transcript&&(0,w.jsx)(`p`,{className:`wb-dictation-transcript`,children:F.transcript})]}),ie&&(0,w.jsxs)(`div`,{className:`wb-source-preview-inline`,children:[(0,w.jsxs)(`div`,{className:`wb-source-preview-actions`,children:[(0,w.jsx)(`a`,{href:ie,target:`_blank`,rel:`noreferrer`,children:`Open preview in new tab`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>I(``),children:`Close preview`})]}),(0,w.jsx)(`iframe`,{className:`wb-source-preview-frame`,title:`Current project preview`,src:ie})]}),(0,w.jsxs)(`div`,{className:`wb-composer-tools`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`wb-options-toggle`,"aria-expanded":Z,onClick:()=>{Z&&B&&V(null),Qe(e=>!e)},children:[(0,w.jsx)(T,{name:`settings`}),Z?`Hide options`:`Options`]}),Z&&(0,w.jsxs)(w.Fragment,{children:[ft&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{ref:xt,type:`button`,"aria-pressed":B===`palette`,onClick:()=>V(B===`palette`?null:`palette`),children:[(0,w.jsx)(T,{name:`palette`}),`Palette`,bt?.tokens?(0,w.jsx)(`span`,{className:`wb-pill-dot`,"aria-hidden":`true`}):null]}),(0,w.jsxs)(`button`,{ref:St,type:`button`,"aria-pressed":B===`references`,onClick:()=>V(B===`references`?null:`references`),children:[(0,w.jsx)(T,{name:`image`}),`References`,x.selected.length||Et?` (${x.selected.length+ +!!Et})`:``]})]}),(0,w.jsxs)(`button`,{ref:Ct,type:`button`,"aria-pressed":B===`behaviors`,onClick:()=>V(B===`behaviors`?null:`behaviors`),children:[(0,w.jsx)(T,{name:`shield`}),`Behaviors & Checks`,Ot?` (${Ot})`:``]}),(0,w.jsxs)(`button`,{ref:wt,type:`button`,"aria-pressed":B===`scope`,onClick:()=>V(B===`scope`?null:`scope`),children:[(0,w.jsx)(T,{name:`settings`}),`Scope`,x.trust?` · Trusted`:``]})]}),yt&&(0,w.jsxs)(`div`,{className:`wb-audit-mode`,role:`group`,"aria-label":`Audit mode`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-pressed":!vt&&et===`deterministic`,title:`Run local deterministic checks only. No AI provider is called.`,onClick:()=>{tt(`deterministic`),vt&&P({workflow:`audit`})},children:`Deterministic`}),(0,w.jsx)(`button`,{type:`button`,"aria-pressed":vt||et===`ai-assisted`,title:`Run local checks, then prepare a focused AI review from the findings.`,onClick:()=>tt(`ai-assisted`),children:`AI-assisted`})]}),(0,w.jsxs)(`div`,{className:`wb-composer-actions`,children:[(!J||et===`ai-assisted`)&&(0,w.jsxs)(`div`,{className:`wb-mode-switch`,role:`group`,"aria-label":`Execution mode`,children:[(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":L===`auto`,title:`Use your connected model`,onClick:()=>{R(`auto`),W(null)},children:[(0,w.jsx)(T,{name:`auto`}),`Auto`]}),(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":L===`mcp`,title:`Use Codex, Claude, Cursor, or Antigravity`,onClick:()=>{R(`mcp`),W(null)},children:[(0,w.jsx)(T,{name:`mcp`}),`AI client`]})]}),(0,w.jsx)(`button`,{type:`button`,className:`wb-mic-button`,"aria-pressed":F.phase===`listening`,"aria-label":F.phase===`listening`?`Stop voice input`:`Voice input`,title:F.phase===`listening`?`Stop and add dictation`:`Dictate your brief`,disabled:s||F.busy&&F.phase!==`listening`,onClick:()=>F.phase===`listening`?F.stop():void F.start(),children:(0,w.jsx)(T,{name:F.phase===`listening`?`close`:`mic`})}),J?(0,w.jsxs)(`button`,{type:`button`,className:`button primary wb-composer-run`,disabled:s||b||De,onClick:()=>void Oe(et===`ai-assisted`),title:et===`ai-assisted`?L===`mcp`?`Run the local scan first; review its findings, then choose Prepare client task to send an AI-assisted audit brief.`:`Run the local scan first; review its findings, then choose Generate revision to prepare an AI-assisted fix.`:`Run local deterministic checks without an AI provider.`,children:[De?`Auditing…`:et===`ai-assisted`?`Scan + AI review`:`Run Free Audit`,(0,w.jsx)(T,{name:`arrow`})]}):Ft&&It?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`button primary wb-composer-run`,disabled:s||b||De,onClick:()=>void Oe(!1),title:`Run local accessibility, contrast, layout, and security checks right now — no API key needed.`,children:[(0,w.jsx)(T,{name:`shield`}),De?`Auditing…`:`Run Free Audit`]}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-composer-secondary`,disabled:s||b||!M,onClick:()=>le(),children:`Connect model`})]}):(0,w.jsxs)(`button`,{type:It?`button`:`submit`,onClick:It?()=>le():void 0,className:`button primary wb-composer-run`,disabled:s||b||!M||ue?.length===0||F.busy,children:[s?`Preparing…`:L===`mcp`?ue?`Prepare live task`:`Prepare client task`:ce?.model&&se?`Generate revision`:`Connect a model`,(0,w.jsx)(T,{name:`arrow`})]})]})]})]}),Ee&&(0,w.jsx)(ht,{quickAudit:Ee,onPrefillAuditFix:Ie,onOpenWorkflows:Pe,onClearQuickAudit:ke}),Le&&(0,w.jsx)(gt,{project:x.project,onClose:Re}),(0,w.jsxs)(`div`,{className:`wb-composer-meta-strip`,children:[(0,w.jsx)(`span`,{children:J?et===`ai-assisted`?`Runs a fast local scan first, then drafts an editable fix brief from the findings`:`Local audit runs right away — no API key or npm install required`:vt?`AI-assisted audit · local findings and cited files only`:L===`mcp`?ue?`Live edit · ${ue.length} files selected`:`AI client mode · files stay untouched until you click Apply`:z&&ce?`${xe(ce.providerId)} · ${ce.model}`:se?ce?.model?`Confirm ${xe(ce.providerId)} free tier in Connections`:`Choose a model in Connections`:`No API key required — run Audit, open Visual Diff, or use AI client (optional API keys in Connections)`}),Se&&!Ce&&(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-clear-draft-inline`,disabled:s,onClick:Te,children:`Clear saved draft`})]}),Ce&&(0,w.jsxs)(`div`,{className:`wb-draft-privacy`,role:`note`,"aria-label":`Browser draft storage`,children:[(0,w.jsx)(`span`,{children:`Draft brief, path, and mode save in this browser (never API keys or tokens).`}),(0,w.jsxs)(`span`,{className:`wb-draft-privacy-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-clear-draft-button`,disabled:s,onClick:Te,children:`Clear saved draft`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:we,children:`Got it`})]})]}),!B&&(ft&&(x.palette!==`preserve`||x.selected.length>0||!!Et||(x.projectPhotos?.length??0)>0||!!Dt)||x.trust)&&(0,w.jsxs)(`div`,{className:`wb-selection-feedback`,role:`status`,"aria-live":`polite`,children:[ft&&Et&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected style `+Et.name,children:[(0,w.jsx)(T,{name:`component`}),(0,w.jsxs)(`span`,{children:[`Style · `,Et.name]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected style direction`,onClick:()=>P({styleDirection:``}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),ft&&bt?.tokens&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`palette`),"aria-label":`Edit selected palette `+bt.name,children:[(0,w.jsx)(`span`,{className:`wb-selection-swatches`,"aria-hidden":`true`,children:bt.colors.map((e,t)=>(0,w.jsx)(`span`,{className:`wb-selection-swatch`,style:{backgroundColor:e}},t))}),(0,w.jsx)(`span`,{children:bt.name})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected palette`,onClick:()=>P({palette:`preserve`}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),ft&&Dt&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>V(`behaviors`),children:(0,w.jsx)(`span`,{children:Dt.name})}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected direction`,onClick:()=>P({directionCandidate:``}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),ft&&x.selected.length>0&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected references`,children:[(0,w.jsx)(`span`,{className:`selection-thumbnails`,children:X.map(e=>(0,w.jsx)(`img`,{src:e.imageURL,width:`24`,height:`24`,decoding:`async`,alt:``},e.id))}),(0,w.jsxs)(`span`,{children:[x.selected.length,` `,x.selected.length===1?`reference`:`references`,` selected`]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected references`,onClick:()=>P({selected:[]}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),ft&&(x.projectPhotos?.length??0)>0&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`references`),"aria-label":`Edit selected project photos`,children:[(0,w.jsx)(T,{name:`assets`}),(0,w.jsxs)(`span`,{children:[x.projectPhotos.length,` project`,` `,x.projectPhotos.length===1?`photo`:`photos`]})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Remove selected project photos`,onClick:()=>P({projectPhotos:[]}),children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]}),x.trust&&(0,w.jsxs)(`div`,{className:`wb-selection-chip`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>V(`scope`),children:[(0,w.jsx)(T,{name:`shield`}),(0,w.jsx)(`span`,{children:`Trusted checks enabled`})]}),(0,w.jsx)(`button`,{type:`button`,"aria-label":`Disable trusted local checks`,onClick:()=>{P({trust:!1}),W(null)},children:(0,w.jsx)(T,{name:`plus`,className:`selection-remove`})})]})]}),(0,w.jsx)(`div`,{className:`wb-composer-drawer-shell`+(B?` is-open`:it?` is-closing`:``),"data-open":B?`true`:`false`,"aria-hidden":!B,children:(0,w.jsx)(`div`,{className:`wb-composer-drawer-inner`,children:Mt&&(0,w.jsxs)(`section`,{className:`wb-direction wb-composer-drawer`,"aria-labelledby":`composer-direction-title`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),Tt())},children:[(0,w.jsxs)(`div`,{className:`wb-section-heading wb-direction-heading`,children:[(0,w.jsx)(`h2`,{ref:Y,id:`composer-direction-title`,tabIndex:-1,children:Nt}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:Tt,children:`Done`})]}),(0,w.jsxs)(`div`,{className:`wb-composer-drawer-content`,children:[Mt===`palette`&&(0,w.jsx)(at,{value:x.palette,onChange:e=>P({palette:e})}),Mt===`references`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(pt,{styleId:x.styleDirection??``,attachStyleImage:x.attachStyleImage??!0,styleContext:x.styleContext??`efficient`,onSelectStyle:e=>P({styleDirection:e,styleContext:`efficient`}),onSelectStyleContext:e=>P({styleContext:e}),onToggleAttachStyleImage:e=>P({attachStyleImage:e}),references:M?.references??[],inspection:D?.project===x.project.trim()?D:null,selectedIds:x.selected,photoSettings:x.photoSettings??{},onPhotoSetting:(e,t)=>P({photoSettings:{...x.photoSettings??{},[e]:t}}),selectedProjectPhotos:x.projectPhotos??[],onToggleProjectPhoto:e=>{let t=x.projectPhotos??[];P({projectPhotos:t.includes(e)?t.filter(t=>t!==e):[...t,e]})},onUploadPhoto:H}),(0,w.jsx)(ot,{references:M?.references??[],selected:x.selected,onChange:e=>P({selected:e}),onUpload:async e=>{await H(e)},directions:x.referenceDirections,onDirection:(e,t)=>P({referenceDirections:{...x.referenceDirections,[e]:t}})})]}),Mt===`behaviors`&&(0,w.jsxs)(`div`,{className:`wb-drawer-stack`,children:[(0,w.jsxs)(`p`,{className:`field-help`,children:[`Add one requirement or browser interaction test per line (`,(0,w.jsx)(`code`,{children:`selector: #details`}),`, `,(0,w.jsx)(`code`,{children:`keyboard: #menu-button`}),`,`,` `,(0,w.jsx)(`code`,{children:`click: #open -> #dialog`}),`,`,` `,(0,w.jsx)(`code`,{children:`text: h1 *= "Title"`}),`). Plain-language notes stay flagged for manual review before Apply.`]}),(0,w.jsx)(`div`,{className:`wb-preservation-suggestions`,role:`group`,"aria-label":`Interaction test templates`,children:je.map(e=>(0,w.jsx)(`button`,{type:`button`,title:`Insert "${e.value}"`,"aria-pressed":x.preserve.split(`
|
|
22
22
|
`).map(e=>e.trim()).includes(e.value),onClick:()=>P({preserve:Me(x.preserve,e.value)}),children:(0,w.jsx)(`code`,{children:e.label})},e.value))}),(0,w.jsx)(`div`,{className:`wb-preservation-suggestions`,role:`group`,"aria-label":`Preservation suggestions`,children:Ae.map(e=>(0,w.jsx)(`button`,{type:`button`,"aria-pressed":x.preserve.split(`
|
|
23
|
-
`).map(e=>e.trim()).includes(e),onClick:()=>P({preserve:Me(x.preserve,e)}),children:e},e))}),(0,w.jsxs)(`label`,{htmlFor:`preserve`,children:[`One behavior or selector per line`,(0,w.jsx)(`textarea`,{id:`preserve`,rows:3,ref:U,value:x.preserve,onChange:e=>P({preserve:e.target.value})})]}),tt&&(0,w.jsxs)(`details`,{className:`wb-drawer-subdetails`,children:[(0,w.jsxs)(`summary`,{children:[`Optional layout direction comparison`,bt?` · ${bt.name}`:``]}),(0,w.jsx)(et,{value:x.directionCandidate,paletteId:x.palette,onChange:e=>P({directionCandidate:e})})]})]}),Tt===`scope`&&(0,w.jsxs)(`div`,{className:`wb-drawer-stack`,children:[(0,w.jsxs)(`div`,{className:`wb-scope-grid`,children:[(0,w.jsxs)(`label`,{htmlFor:`project-intent`,children:[`What are we working on?`,(0,w.jsx)(pe,{id:`project-intent`,label:`What are we working on?`,value:x.intent,onChange:e=>P({intent:e}),options:[{value:`Website`,label:`Website`,icon:(0,w.jsx)(T,{name:`website`})},{value:`App`,label:`App`,icon:(0,w.jsx)(T,{name:`app`})},{value:`Component`,label:`Component`,icon:(0,w.jsx)(T,{name:`component`})},{value:`Something else`,label:`Something else`,icon:(0,w.jsx)(T,{name:`auto`})}]})]}),(0,w.jsxs)(`label`,{htmlFor:`workflow`,children:[`Workflow focus`,(0,w.jsx)(pe,{id:`workflow`,label:`Workflow focus`,value:x.workflow??`auto`,onChange:e=>P({workflow:e}),options:[{value:`auto`,label:`UI Design`},{value:`audit`,label:`Audit (security & UI checks)`},{value:`seo-ai-search`,label:`SEO & AI search`},{value:`architecture`,label:`Project map`}]})]})]}),(0,w.jsxs)(`label`,{className:`check-row wb-trust`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:x.trust,onChange:e=>{P({trust:e.target.checked}),e.target.checked||W(null)}}),(0,w.jsxs)(`span`,{children:[`Enable local preview and build checks`,(0,w.jsx)(`small`,{className:`wb-trust-warning`,children:`Runs local build and preview scripts on your machine. Only enable this for projects you trust.`})]})]}),(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,disabled:!D||L===`mcp`&&ue!==null,checked:x.allowCreate&&(L!==`mcp`||ue===null),onChange:e=>P({allowCreate:e.target.checked})}),(0,w.jsx)(`span`,{children:L===`mcp`&&ue!==null?`Live editing uses the selected existing files.`:D?.adapter===`static-public-v1`?`Allow new HTML, CSS, and JavaScript files in reviewed revisions.`:`Allow new source files in supported React / Next.js folders.`})]}),L===`mcp`&&(0,w.jsxs)(`div`,{className:`wb-live-scope`,children:[(0,w.jsxs)(`label`,{className:`check-row wb-trust`,children:[(0,w.jsx)(`input`,{type:`checkbox`,name:`live-edit`,disabled:!x.trust||!D?.directEditPaths?.length,checked:ue!==null,onChange:e=>W(e.target.checked&&D?{project:D.project,paths:[]}:null)}),(0,w.jsxs)(`span`,{children:[`Allow live editing for this task`,(0,w.jsx)(`small`,{children:D?D.directEditPaths?.length?x.trust?`Submitted batches write selected originals with automatic Undo.`:`Enable trusted local checks above first.`:`No eligible existing files detected for live editing.`:`Inspect a project to see files eligible for live editing.`})]})]}),ue&&(0,w.jsxs)(`fieldset`,{className:`wb-live-paths`,children:[(0,w.jsx)(`legend`,{children:`Files Studio may replace`}),D?.directEditPaths.map(e=>(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,name:`live-edit-path`,value:e,checked:ue.includes(e),disabled:ue.length>=30&&!ue.includes(e),onChange:t=>{let n=t.target.checked;W(t=>t?{...t,paths:n?[...t.paths,e]:t.paths.filter(t=>t!==e)}:null)}}),(0,w.jsx)(`code`,{translate:`no`,children:e})]},e))]})]}),(0,w.jsxs)(`label`,{htmlFor:`figma-link`,children:[`Figma frame or file URL (optional)`,(0,w.jsx)(`input`,{id:`figma-link`,type:`url`,disabled:s,value:x.figmaUrl,onChange:e=>P({figmaUrl:e.target.value}),placeholder:be?.endpointUrl||`https://www.figma.com/design/...`})]}),D&&(0,w.jsxs)(`details`,{className:`wb-paths-disclosure`,children:[(0,w.jsxs)(`summary`,{children:[`View `,D.editablePaths.length,` editable source paths`,D.scoping?.autoScoped&&D.scoping.totalCandidates?` (scoped from ${D.scoping.totalCandidates})`:``]}),(0,w.jsx)(`ul`,{className:`wb-paths`,children:D.editablePaths.map(e=>(0,w.jsx)(`li`,{children:e},e))})]}),(0,w.jsx)(Ke,{project:D?.project,preserve:x.preserve,disabled:s,onExport:ye},D?.project),L===`auto`&&z&&G&&(0,w.jsxs)(`details`,{className:`wb-estimate-details`,children:[(0,w.jsx)(`summary`,{children:`Cost estimate & run limits`}),(0,w.jsx)(k,{firstEstimate:G.firstRequestEstimate,ceiling:G.configuredRunCeiling,settled:G.settledBilling})]})]})]},Tt)]})})})]}),ze&&Be&&Ve&&!x.project.trim()&&!x.brief.trim()&&!a&&!ge&&!B&&(0,w.jsx)(ht,{surface:`workspace`,disabled:s||b,onSelect:Be,onDismiss:Ve})]})}function xt({draft:e,change:t,changeProjectBase:n,context:r,draftNoticeSeen:a,dismissDraftNotice:o,hasActiveRun:s,resetRun:c,currentRunRef:l,setLiveSelection:u,setPrimaryView:f,setNotice:p,task:h}){let[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)(!1),[b,x]=(0,i.useState)(``),[S,C]=(0,i.useState)(!1),[w,T]=(0,i.useState)(null),[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)(!1),[A,ee]=(0,i.useState)(``),[j,M]=(0,i.useState)(``),[N,P]=(0,i.useState)(`static`),[F,te]=(0,i.useState)(!0),[ne,re]=(0,i.useState)(!1),[ie,I]=(0,i.useState)(null),[ae,oe]=(0,i.useState)(``),L=(0,i.useRef)(0);function R(t){t!==e.project&&(x(``),I(null)),n(t)}async function se(n=e.project){let r=L.current,i;try{i=await d(`/api/workspace/inspect`,{project:n.trim()})}catch(e){let t=e;if(t?.canNormalizeSnapshot&&n.trim()){let e=n.trim().split(/[/\\]/).filter(Boolean).at(-1)?.replace(/[^A-Za-z0-9._-]+/g,`-`)||`website`;I({sourcePath:n.trim(),detectedRoot:t.detectedRoot??`.`,detectedKind:t.detectedKind??`static-html`}),oe(`${e.slice(0,48)}-studio-copy`)}else I(null);throw e}if(r!==L.current)throw Error(`Project selection changed. Refresh the selected folder before generating.`);I(null),_(i),x(``),t({project:i.project});let a=m.get(`studio-recent-projects`)??[];return m.set(`studio-recent-projects`,[i.project,...a.filter(e=>e!==i.project)].slice(0,6)),i}async function z(){ie&&await h(async()=>{let e=await d(`/api/connectors/intake/website`,{sourcePath:ie.sourcePath,targetName:ae.trim()||`website-studio-copy`,approved:!0});if(!e.project)throw Error(`Normalized project path was not returned.`);I(null),L.current++,R(e.project),t({trust:!1}),_(null),await se(e.project),p({kind:`success`,text:`Imported ${e.copiedCount} supported files (${e.adapter}) to work/${e.projectName??``}${e.scriptsStripped?`; repo scripts stripped`:``}.`})})}async function ce(e,t){let n=L.current,r=g?.sourceFingerprint,i=await d(`/api/project-rules/export`,{project:e,rules:t,approved:!0});if(L.current===n&&!l.current)try{(await se(e)).sourceFingerprint!==r&&u(null)}catch(e){L.current===n&&!l.current&&(_(null),u(null),p({kind:`error`,text:`Workflow rules were saved. Inspect the project again to refresh source access. `+e.message}))}return i}async function le(t=e.project){let n=t.trim();n&&await h(async()=>{R(n),_(null),await se(n)})}async function B(e,t){C(!0);try{let n=await d(`/api/project-preview`,{project:e,trust:t});x(n.url)}finally{C(!1)}}async function V(){a||o();let n=e.project.trim();if(!n)return;let r=g;r&&r.project===n||(r=await se(n)),r?.adapter===`react-vite-v1`&&!e.trust?p({kind:`info`,text:`Allow local preview so Studio can safely build a read-only preview of this app.`,action:{label:`Allow local preview & start`,onClick:()=>{t({trust:!0}),p(null),h(()=>B(n,!0))}}}):await B(n,e.trust)}async function H(){let t=L.current;y(!0),p(null);try{let n=await d(`/api/select-folder`,{initialPath:e.project});if(n.path){if(t!==L.current){p({kind:`info`,text:`Folder choice ignored because you changed the path while the window was open.`});return}R(n.path),_(null),await se(n.path)}}catch(e){p({kind:`error`,text:e.message})}finally{y(!1)}}async function U(){D(!0),p(null);try{let t=await d(`/api/workflow-graph/execute`,{project:e.project.trim(),profile:e.workflow===`architecture`?`architecture`:e.workflow===`seo-ai-search`||e.workflow===`seo`?`seo`:e.workflow===`ai-search`?`ai-search`:`audit`,enableExternalScanners:!0});return T(t),t}catch(e){return p({kind:`error`,text:e.message||`Could not run project audit.`}),null}finally{D(!1)}}async function ue(){await h(async()=>{let e=await d(`/api/workspace/create-project`,{parentPath:j.trim(),name:A.trim(),template:N,installDependencies:(N===`react-vite`||N===`nextjs-app`)&&F,approved:!0});L.current++,R(e.project),t({trust:!1}),_(null),await se(e.project),k(!1);let n=e.framework===`nextjs-app`||N===`nextjs-app`,r=n?`Next.js (App Router + Tailwind v4)`:`React + Vite`,i=n?`npm install --ignore-scripts`:`npm ci --ignore-scripts`;e.adapter===`react-vite-v1`&&e.dependencyInstallError?p({kind:`error`,text:`New ${r} project created, but dependency install failed: ${e.dependencyInstallError}`}):p({kind:`success`,text:e.adapter===`react-vite-v1`?e.dependenciesInstalled?`New ${r} project created with dependencies installed. Describe what you want to build to start.`:`New ${r} project created. Click "Install dependencies" or run ${i} inside the folder for local builds and preview.`:`New static project created. Describe what you want to build to start.`})})}async function W(t){re(!0);try{await h(async()=>{let n=await d(`/api/workspace/install-dependencies`,{project:t,approved:!0});(e.project.trim()===n.project||g?.project===n.project)&&_(n.inspection),p({kind:`success`,text:`Project dependencies installed.`})})}finally{re(!1)}}async function G(){await h(async()=>{let e=await d(`/api/select-folder`,{initialPath:j});e.path&&M(e.path)})}async function de(){await h(async()=>{let e=await d(`/api/workspace/try-sample`,{approved:!0});L.current++,R(e.project),_(e.inspection),f(`workspace`),s&&c(),p({kind:`info`,text:`Sample project loaded. Describe a change to get started.`})})}async function fe(e,t){if(L.current++,R(e),s&&c(),f(`workspace`),t){_(t);let e=m.get(`studio-recent-projects`)??[];m.set(`studio-recent-projects`,[t.project,...e.filter(e=>e!==t.project)].slice(0,6))}else _(null),await h(()=>se(e))}return{inspection:g,setInspection:_,picking:v,sourcePreview:b,setSourcePreview:x,sourcePreviewLoading:S,quickAudit:w,setQuickAudit:T,quickAuditLoading:E,creating:O,setCreating:k,newName:A,setNewName:ee,newParent:j,setNewParent:M,newTemplate:N,setNewTemplate:P,newInstallDeps:F,setNewInstallDeps:te,installingDeps:ne,setInstallingDeps:re,normalizeOffer:ie,setNormalizeOffer:I,normalizeTargetName:ae,setNormalizeTargetName:oe,pathVersion:L,quickProjects:[...(m.get(`studio-recent-projects`)??[]).filter(e=>typeof e==`string`&&e.trim().length>0),...r?.demoProject?[r.demoProject]:[]].filter((t,n,r)=>r.indexOf(t)===n&&t!==e.project.trim()).slice(0,4),changeProject:R,inspect:se,importCleanWebsiteCopy:z,exportProjectRules:ce,inspectFolder:le,previewSelectedProject:V,browse:H,runQuickAudit:U,createProject:ue,installProjectDependencies:W,chooseParent:G,trySampleProject:de,openProjectFromRepositories:fe}}function St(e){return[`preparing`,`generating`,`checking`,`ready`,`waiting-client`,`cancelled`,`failed`,`interrupted`].includes(e)}function Ct(e,t){let n=e?.workspace;return n?.runId!==t.runId||!St(t.stage)?e:{...e,...Array.isArray(t.liveFeed)?{liveFeed:t.liveFeed}:{},...t.draftPreview===void 0?{}:{draftPreview:t.draftPreview},workspace:{...n,stage:t.stage,error:t.error,checks:{build:t.checks?.build??n.checks.build,layout:t.checks?.layout??n.checks.layout},directEdit:t.directEdit?{...t.directEdit,batchStatus:t.batchStatus??t.directEdit.batchStatus,liveActivity:t.liveActivity}:void 0}}}function Y(e,t){let n=(0,i.useEffectEvent)(t);(0,i.useEffect)(()=>{if(!e||typeof EventSource>`u`)return;let t=new EventSource(`/api/workspace/`+e+`/events`);function r(t){try{let r=JSON.parse(t.data);r.apiVersion===1&&r.runId===e&&n(r)}catch{}}return t.addEventListener(`snapshot`,r),t.addEventListener(`telemetry`,r),t.addEventListener(`close`,()=>t.close()),()=>t.close()},[e])}function wt({activeRef:e,connected:t,tab:n,setTab:r,variant:a,setVariant:o,previewSize:s,setPreviewSize:c,defaultPreviewSize:l=`fit`,defaultCompareMode:u=`1up`,setPrimaryView:f,setPreview:p,setBeforePreview:m,setAfterPreview:h,setCompareMode:g,setPublishedPreview:_,setPreviewFullscreen:v,setPreviewLoading:y,setNotice:b,onSelectRunReset:x,onFullReset:S,task:C}){let[w,T]=(0,i.useState)([]),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,ee]=(0,i.useState)(null),[j,M]=(0,i.useState)(null),[N,P]=(0,i.useState)(()=>new URL(location.href).searchParams.get(`run`)),[F,te]=(0,i.useState)(null),[ne,re]=(0,i.useState)(null),[ie,I]=(0,i.useState)(null),[ae,oe]=(0,i.useState)(null),[L,R]=(0,i.useState)(null),[se,z]=(0,i.useState)([]),[ce,le]=(0,i.useState)(null),[B,V]=(0,i.useState)(!1),[H,U]=(0,i.useState)(null),[ue,W]=(0,i.useState)(``),G=(0,i.useRef)(null),de=(0,i.useRef)(null),fe=(0,i.useRef)(null),K=(0,i.useRef)(``),pe=(0,i.useRef)(``),me=(0,i.useRef)(null),he=(0,i.useRef)(0),ge=(0,i.useRef)(0),_e=(0,i.useRef)(0),ve=(0,i.useRef)(0),ye=(0,i.useRef)(new Map),be=!!F?.workspace&&[`preparing`,`generating`,`checking`].includes(F.workspace.stage),xe=F?.workspace,Se=xe?.directEdit??j?.live;async function Ce(){let t=++he.current,{runs:n}=await d(`/api/runs`);e.current&&t===he.current&&T(n)}function we(e,t){let n=t.message;return t.code!==`REVIEW_CONFLICT`&&n!==`Original source or request inputs changed since review`?!1:(G.current===e&&(oe(null),R({runId:e,detail:n}),r(`changes`),p(``),m(``),h(``),g(`1up`),v(!1),y(!1)),!0)}async function Te(t){if(de.current===t){fe.current=t;return}de.current=t;let n=++ge.current,r=()=>e.current&&G.current===t&&ge.current===n,i=me.current;try{let[e,n,a]=await Promise.all([d(`/api/runs/`+t),d(`/api/workspace/`+t),d(`/api/applications?run=`+t)]);if(!r())return;M(e),P(null);let o=me.current;if(te(o?.runId===t&&o!==i?Ct(n,o):n),z(a.applications),e.status===`invalidated`&&!a.applications.length&&(oe(null),e.revisionId||I(null),p(``)),e.revisionId){let i=`${t}:${e.revisionId}:${e.status===`invalidated`?`historical`:`current`}`;if(K.current!==i){let e=await d(`/api/runs/${t}/content`);if(!r())return;K.current=i,I(e)}if(e.status===`awaiting-human-review`&&n.workspace?.stage===`ready`)try{let n=await d(`/api/applications/prepare`,{runId:t,revisionId:e.revisionId});r()&&(oe(n),R(null))}catch(e){if(r()&&!we(t,e))throw e}else r()&&oe(null)}}catch(e){if(r())throw P(null),e}finally{ge.current===n&&(de.current=null),r()&&fe.current===t&&(fe.current=null,Te(t).catch(e=>b({kind:`error`,text:e.message})))}}function Ee(){_e.current++,le(null),V(!1),U(null),W(``)}function De(e,t=!0){ve.current++,Ee(),x(),G.current=e,P(e);let n=ye.current.get(e);f(`workspace`),r(n?.tab??`preview`),o(n?.variant??`after`),c(n?.size??l),M(null),I(null),oe(null),R(null),te(null),z([]),p(``),m(``),h(``),g(u),_(null),y(!1),K.current=``,pe.current=``;let i=new URL(location.href);i.searchParams.delete(`settings`),i.searchParams.set(`run`,e),t&&history.pushState(null,``,i)}function Oe(e,t=!0){return G.current!==e&&De(e,t),C(()=>Te(e))}function ke(){ve.current++,Ee(),S(),G.current=null,P(null),M(null),te(null),I(null),oe(null),R(null),f(`workspace`),r(`preview`),z([]),p(``),m(``),h(``),g(`1up`),_(null),y(!1),b(null),K.current=``,pe.current=``;let e=new URL(location.href);e.search=``,history.pushState(null,``,e)}async function Ae(e){if(!(E||be)){D(e),ee(null);try{await C(async()=>{await d(`/api/runs/${e}/delete`,{approved:!0}),he.current++,(G.current===e||new URL(location.href).searchParams.get(`run`)===e)&&ke(),T(t=>t.filter(t=>t.id!==e)),k(e)})}finally{D(null)}}}async function je(){O&&await C(async()=>{await d(`/api/runs/${O}/restore`,{}),await Ce(),k(null)})}async function Me(e){j&&await C(async()=>{let t=await d(`/api/runs/${e}/export-report`,{}),n=new Blob([t.reportHtml],{type:`text/html;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`ui-workflow-before-after-${e.slice(0,8)}.html`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e4);let a=typeof t.delta?.scoreDelta==`number`?t.delta.scoreDelta:null,o=a===null?``:`, delta ${a>=0?`+${a}`:`${a}`}`,s=typeof t.embeddedScreenshots==`number`&&t.embeddedScreenshots>0?`, ${t.embeddedScreenshots} embedded screenshot${t.embeddedScreenshots===1?``:`s`}`:``;b({kind:`success`,text:`Before/After HTML report downloaded (score ${t.score}/100${o}${s}).`})})}async function Ne(e){let t=_e.current;await C(async()=>{let n=await d(`/api/workspace/diagnostic-export?runId=${encodeURIComponent(e)}`);_e.current===t&&(le(n),V(!0))})}function Pe(){if(!ce)return;let e=new Blob([JSON.stringify(ce,null,2)+`
|
|
24
|
-
`],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`studio-redacted-diagnostics.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e4)}async function Fe(e){if(!j)return;let t=_e.current;await C(async()=>{let n=await d(`/api/runs/${e}/export-branch`,{revisionId:j.revisionId,branchName:ue.trim()||`review/studio-${e.slice(0,8)}`,approved:!0});_e.current===t&&(U(n),b({kind:`success`,text:`Exported Git branch ${n.branchName} (${n.commitSha.slice(0,8)}) without changing your working tree.`}))})}async function Ie(e){await C(async()=>{await d(`/api/workspace/${e}/recheck-live`,{approved:!0}),G.current===e&&await Te(e)})}(0,i.useEffect)(()=>{if(!A)return;let e=e=>{e.key===`Escape`&&ee(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A]),(0,i.useEffect)(()=>{if(!t)return;let e=()=>void Ce().catch(e=>b({kind:`error`,text:e.message}));return addEventListener(`focus`,e),()=>removeEventListener(`focus`,e)},[t]),(0,i.useEffect)(()=>{j?.id&&Ce().catch(e=>{G.current===j.id&&b({kind:`error`,text:e.message})})},[j?.id,j?.status,xe?.stage,Se?.nextRunId]),(0,i.useEffect)(()=>{if(j?.id&&G.current===j.id){let e=ye.current;if(e.delete(j.id),e.set(j.id,{tab:n,variant:a,size:s}),e.size>50){let t=e.keys().next().value;t&&e.delete(t)}}},[j?.id,n,a,s]);let Le=!!Se&&!Se.revoked&&Se.batchStatus!==`revoked`&&(ne?.scopeId!==Se.scopeId||ne.expiresAt!==Se.expiresAt)&&Se.expiresAt>Date.now();(0,i.useEffect)(()=>{if(!Le||!Se)return;let{scopeId:e,expiresAt:t}=Se,n=window.setTimeout(()=>re({scopeId:e,expiresAt:t}),Math.max(0,t-Date.now()));return()=>window.clearTimeout(n)},[Le,Se?.scopeId,Se?.expiresAt]);let Re=xe?.grant,ze=Re&&Re.expiresAt>Date.now()&&(!Se||Le)&&!j?.grants?.some(e=>e.id===Re.id&&e.revoked)?Re:void 0,Be=xe?.stage===`waiting-client`&&!!ze;return Y(t&&(be||Be||Le)?xe?.runId:void 0,e=>{G.current===e.runId&&(me.current=e,te(t=>Ct(t,e)),(e.stage!==xe?.stage||e.batchStatus!==(Se?.batchStatus??null))&&Te(e.runId).catch(t=>{G.current===e.runId&&b({kind:`error`,text:t.message})}))}),(0,i.useEffect)(()=>{let e=xe?.runId;if(!e||!be&&!Be&&!Le)return;let t=setInterval(()=>{G.current===e&&Te(e).catch(t=>{G.current===e&&b({kind:`error`,text:t.message})})},be||Be?1100:5e3);return()=>clearInterval(t)},[be,Be,Le,xe?.runId]),{recent:w,setRecent:T,deletingChat:E,deletedChat:O,setDeletedChat:k,confirmDeleteRun:A,setConfirmDeleteRun:ee,run:j,setRun:M,opening:N,setOpening:P,status:F,setStatus:te,content:ie,setContent:I,plan:ae,setPlan:oe,reviewConflict:L,setReviewConflict:R,applications:se,setApplications:z,diagnosticExport:ce,diagnosticOpen:B,setDiagnosticOpen:V,branchResult:H,branchName:ue,setBranchName:W,current:G,contentRevision:K,previewRevision:pe,previewRequest:ve,working:be,record:xe,live:Se,liveActive:Le,clientGrant:Re,activeClientGrant:ze,clientWaiting:Be,refreshRecent:Ce,deleteChat:Ae,restoreChat:je,showReviewConflict:we,load:Te,resetReviewExports:Ee,selectRun:De,open:Oe,reset:ke,exportBeforeAfterReport:Me,loadDiagnosticExport:Ne,downloadDiagnosticJson:Pe,exportGitBranch:Fe,recheckLiveBatch:Ie}}var Tt=`modulepreload`,Et=function(e){return`/`+e},Dt={},X=function(e){return e.pathname.endsWith(`.css`)},Ot=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Z=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Et(t,n);let r=s(t),i=X(r);return Ot(Dt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Tt,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function kt(e){return e.match(/^Figma reference:[ \t]*(https:\/\/\S+)[ \t]*$/m)?.[1]??``}function At(e){let t=kt(e);return t?` Inspect the linked Figma design (${t}) using your client's Figma MCP server if needed.`:``}var jt=(0,i.lazy)(()=>Z(()=>import(`./Settings-CITjwtGY.js`),__vite__mapDeps([0,1,2,3,4,5,6]))),Mt=(0,i.lazy)(()=>Z(()=>import(`./AccountModal-BCsGPvx4.js`),__vite__mapDeps([7,1,2,3,4]))),Nt=(0,i.lazy)(()=>Z(()=>import(`./Repositories-BPQd02x8.js`),__vite__mapDeps([8,1,2,9]))),Pt=(0,i.lazy)(()=>Z(()=>import(`./Connections-C9b3n4ss.js`).then(e=>e.n),__vite__mapDeps([5,2,1,6]))),Ft=(0,i.lazy)(()=>Z(()=>import(`./ReviewStage-bicZ-iOy.js`),__vite__mapDeps([10,1,2,11,12]))),It=(0,i.lazy)(()=>Z(()=>import(`./WorkflowVisualizer-6llBlI2i.js`),__vite__mapDeps([13,1,2,14,12])));function Lt({motion:e=!0}){let[t,n]=(0,i.useState)(()=>!e||matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,i.useEffect)(()=>{if(t)return;let e=window.setTimeout(()=>n(!0),560);return()=>window.clearTimeout(e)},[t]),t?null:(0,w.jsx)(`div`,{className:`page-curtain`,"aria-hidden":`true`,onAnimationEnd:e=>{e.target===e.currentTarget&&n(!0)}})}function Rt(){let[e,t]=(0,i.useState)(()=>({...yt,...m.get(`studio-workspace-draft`),trust:!1,allowCreate:m.get(`studio-allow-source-create`)??!0})),[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(()=>m.get(`studio-workspace-execution`)===`mcp`?`mcp`:`auto`),[l,p]=(0,i.useState)(null),[h,g]=(0,i.useState)(()=>{let e=new URL(location.href).searchParams.get(`view`);return e===`workflows`?`workflows`:e===`repositories`?`repositories`:e===`connections`?`connections`:`workspace`}),[_,v]=(0,i.useState)(null),[y,b]=(0,i.useState)(!1),[x,S]=(0,i.useState)(!1),[C,A]=(0,i.useState)(`overview`),[ee,j]=(0,i.useState)(0),[M,N]=(0,i.useState)(),[P,F]=(0,i.useState)(``),[ne,re]=(0,i.useState)(()=>m.get(`studio-starter-setup-dismissed`)===!0),[ie,I]=(0,i.useState)(!1),[ae,oe]=(0,i.useState)(null),[L,R]=(0,i.useState)(null),[se,z]=(0,i.useState)(!1),[ce,le]=(0,i.useState)(!1),[B,V]=(0,i.useState)(),[H,U]=(0,i.useState)(!1),[W,G]=(0,i.useState)(null),[de,K]=(0,i.useState)(`preview`),[me,he]=(0,i.useState)(``),[ge,ve]=(0,i.useState)(``),[ye,be]=(0,i.useState)(``),[xe,Se]=(0,i.useState)(()=>{let e=m.get(`studio-default-compare-mode`);return e===`2up`||e===`slider`?e:`1up`}),[Ce,we]=(0,i.useState)(()=>{let e=m.get(`studio-default-preview-size`);return e===`tablet`||e===`phone`?e:`fit`}),[Te,De]=(0,i.useState)(()=>{let e=m.get(`studio-default-compare-mode`);return e===`2up`||e===`slider`?e:`1up`}),[Oe,Ae]=(0,i.useState)(null),[je,Me]=(0,i.useState)(`after`),[Ne,Pe]=(0,i.useState)(()=>{let e=m.get(`studio-default-preview-size`);return e===`tablet`||e===`phone`?e:`fit`}),[Fe,Ie]=(0,i.useState)(!1),[Le,Re]=(0,i.useState)(``),[ze,Be]=(0,i.useState)(`auto`),[Ve,He]=(0,i.useState)(!1),[Ue,We]=(0,i.useState)(!1),[Ge,Ke]=(0,i.useState)(null),[q,qe]=(0,i.useState)(null),Je=(0,i.useRef)(!0),Ye=(0,i.useRef)(null),Xe=(0,i.useRef)(null),Qe=(0,i.useRef)(null),et=(0,i.useRef)(null),tt=(0,i.useRef)(null),nt=(0,i.useRef)(null),rt=(0,i.useRef)(!1),it=(0,i.useRef)(()=>{}),at=e=>t(t=>({...t,...e,...e.project!==void 0&&e.project!==t.project?{trust:!1}:{}})),ot=a?.keys.some(e=>e.providerId===`groq`&&!e.fallback)?`groq`:a?.keys.some(e=>e.providerId===`gemini`&&!e.fallback)?`gemini`:void 0,st=ot===`groq`?`Groq`:`Google AI Studio`,ut=_e(ot,e=>{t(t=>({...t,brief:[t.brief.trimEnd(),e].filter(Boolean).join(` `).slice(0,12e3)}))});async function J(e){U(!0),R(null);try{await e()}catch(e){R({kind:`error`,text:e.message})}finally{Je.current&&U(!1)}}let{recent:mt,deletingChat:ht,deletedChat:gt,setDeletedChat:_t,confirmDeleteRun:St,setConfirmDeleteRun:Ct,run:Y,setRun:Tt,opening:Et,setOpening:Dt,status:X,setStatus:Ot,content:Z,setContent:Rt,plan:zt,setPlan:Bt,reviewConflict:Vt,applications:Ht,setApplications:Ut,diagnosticExport:Wt,diagnosticOpen:Gt,setDiagnosticOpen:Kt,branchResult:qt,branchName:Jt,setBranchName:Yt,current:Xt,contentRevision:Zt,previewRevision:Qt,previewRequest:$t,working:en,record:Q,live:$,liveActive:tn,clientGrant:nn,activeClientGrant:rn,refreshRecent:an,deleteChat:on,restoreChat:sn,showReviewConflict:cn,load:ln,resetReviewExports:un,selectRun:dn,open:fn,reset:pn,exportBeforeAfterReport:mn,loadDiagnosticExport:hn,downloadDiagnosticJson:gn,exportGitBranch:_n,recheckLiveBatch:vn}=wt({activeRef:Je,connected:Ve,tab:de,setTab:K,variant:je,setVariant:Me,previewSize:Ne,setPreviewSize:Pe,defaultPreviewSize:Ce,defaultCompareMode:xe,setPrimaryView:g,setPreview:he,setBeforePreview:ve,setAfterPreview:be,setCompareMode:De,setPublishedPreview:Ae,setPreviewFullscreen:Ie,setPreviewLoading:We,setNotice:R,onSelectRunReset:()=>{F(``),rt.current=!1,ut.cancel(),G(null),Ie(!1),Re(``)},onFullReset:()=>{rt.current=!1,ut.cancel(),p(null),G(null),qe(null),Ie(!1),Re(``),it.current()},task:J}),{collapsed:yn,setCollapsed:bn,theme:xn,setTheme:Sn,contrast:Cn,setContrast:wn,textScale:Tn,setTextScale:En,motion:Dn,setMotion:On,hoverEffects:kn,setHoverEffects:An,pageTransitions:jn,setPageTransitions:Mn,resolvedDark:Nn,backdrop:Pn,setBackdrop:Fn,accent:In,setAccent:Ln,customAccent:Rn,setCustomAccent:zn,customHighlight:Bn,setCustomHighlight:Vn,typography:Hn,setTypography:Un,resetAppearance:Wn}=ue(!!Y);(0,i.useEffect)(()=>{m.set(`studio-default-compare-mode`,xe)},[xe]),(0,i.useEffect)(()=>{m.set(`studio-default-preview-size`,Ce)},[Ce]);let[Gn,Kn]=(0,i.useState)(()=>m.get(`studio-draft-notice-seen`)===!0);function qn(){Kn(!0),m.set(`studio-draft-notice-seen`,!0)}let{inspection:Jn,setInspection:Yn,picking:Xn,sourcePreview:Zn,setSourcePreview:Qn,sourcePreviewLoading:$n,quickAudit:er,setQuickAudit:tr,quickAuditLoading:nr,creating:rr,setCreating:ir,newName:ar,setNewName:or,newParent:sr,setNewParent:cr,newTemplate:lr,setNewTemplate:ur,newInstallDeps:dr,setNewInstallDeps:fr,installingDeps:pr,setInstallingDeps:mr,normalizeOffer:hr,setNormalizeOffer:gr,normalizeTargetName:_r,setNormalizeTargetName:vr,pathVersion:yr,quickProjects:br,changeProject:xr,inspect:Sr,importCleanWebsiteCopy:Cr,exportProjectRules:wr,inspectFolder:Tr,previewSelectedProject:Er,browse:Dr,runQuickAudit:Or,createProject:kr,installProjectDependencies:Ar,chooseParent:jr,trySampleProject:Mr,openProjectFromRepositories:Nr}=xt({draft:e,change:at,changeProjectBase:t=>{t!==e.project&&ut.cancel(),at({project:t})},context:n,draftNoticeSeen:Gn,dismissDraftNotice:qn,hasActiveRun:!!Y,resetRun:pn,currentRunRef:Xt,setLiveSelection:p,setPrimaryView:g,setNotice:R,task:J});it.current=()=>Qn(``),(0,i.useEffect)(()=>{W&&et.current?.focus()},[W]),(0,i.useLayoutEffect)(()=>{let e=Xe.current;e&&(e.style.height=`auto`,e.style.height=`${e.value?Math.min(Math.max(e.scrollHeight,118),320):118}px`)},[e.brief,Y,Et]),(0,i.useLayoutEffect)(()=>{let e=Qe.current;e&&(e.style.height=`auto`,e.style.height=`${e.value?Math.min(Math.max(e.scrollHeight,84),220):84}px`)},[e.preserve,Y,Et]);let Pr=e.project.trim()!==``||e.brief.trim()!==``||e.intent!==yt.intent||e.palette!==yt.palette||e.styleDirection!==``||e.directionCandidate!==``||e.selected.length>0||(e.projectPhotos?.length??0)>0||e.figmaUrl.trim()!==``||e.preserve!==yt.preserve||(e.workflow??`auto`)!==`auto`||e.allowCreate!==yt.allowCreate||s!==`auto`;(0,i.useEffect)(()=>{let t=()=>{Pr?(m.set(`studio-workspace-draft`,{...e,trust:!1}),m.set(`studio-allow-source-create`,e.allowCreate),m.set(`studio-workspace-execution`,s)):(m.remove(`studio-workspace-draft`),m.remove(`studio-allow-source-create`),m.remove(`studio-workspace-execution`))},n=window.setTimeout(t,220);return window.addEventListener(`pagehide`,t),()=>{window.clearTimeout(n),window.removeEventListener(`pagehide`,t)}},[e,s,Pr]);function Fr(){ut.cancel(),yr.current++,m.remove(`studio-workspace-draft`),m.remove(`studio-allow-source-create`),m.remove(`studio-workspace-execution`),m.remove(`studio-recent-projects`),t({...yt}),c(`auto`),Yn(null),p(null),Qn(``),gr(null),oe(null),qe(null),Ke(null),R({kind:`info`,text:`Saved draft cleared.`})}function Ir(){re(!0),m.set(`studio-starter-setup-dismissed`,!0)}function Lr(t){t===`mcp`?(c(`mcp`),Rr(void 0,`mcp-clients`)):(Vr(`workspace`),t===`diff`?(I(!0),e.project.trim()||Mr()):t===`audit`&&(at({workflow:`audit`}),e.project.trim()?Jn?.project===e.project.trim()&&Or():Mr()))}function Rr(e,t=e?`mcp-clients`:`ai-models`){Vr(`connections`),N(e),A(t),j(e=>e+1);let n=new URL(location.href);n.searchParams.delete(`settings`),n.searchParams.delete(`panel`),n.searchParams.set(`view`,`connections`),t===`overview`?n.searchParams.delete(`tab`):n.searchParams.set(`tab`,t),history.replaceState(null,``,n)}async function zr(){let e=await d(`/api/auth/status`);Je.current&&v(e)}async function Br(){await J(async()=>{await d(`/api/auth/signout`,{}),await zr(),R({kind:`info`,text:`Signed out.`})})}function Vr(e){h===`connections`&&e!==`connections`&&Wr().catch(e=>R({kind:`error`,text:e.message})),S(!1),N(void 0),e===`connections`&&A(`overview`),g(e),typeof window<`u`&&window.innerWidth<=700&&bn(!0);let t=new URL(location.href);t.searchParams.delete(`settings`),t.searchParams.delete(`panel`),t.searchParams.delete(`tab`),e===`workspace`?t.searchParams.delete(`view`):t.searchParams.set(`view`,e),history.replaceState(null,``,t)}function Hr(e,t){en||H?t?.():(Y&&pn(),at({workflow:e}),requestAnimationFrame(()=>{Xe.current?Xe.current.focus():t?.()}))}(0,i.useEffect)(()=>{let e=!0,t=()=>{document.hidden||u().then(()=>{e&&He(!0)}).catch(()=>{e&&He(!1)})},n=setInterval(t,15e3),r=()=>He(!1);return window.addEventListener(`offline`,r),window.addEventListener(`online`,t),()=>{e=!1,clearInterval(n),window.removeEventListener(`offline`,r),window.removeEventListener(`online`,t)}},[]);async function Ur(t,n){mr(!0);try{await J(async()=>{let r=await d(`/api/workspace/install-dependencies`,{project:t,approved:!0});(e.project.trim()===r.project||Jn?.project===r.project)&&Yn(r.inspection),await d(`/api/workspace/${n}/recheck-live`,{approved:!0}),Xt.current===n&&await ln(n)})}finally{mr(!1)}}async function Wr(){o(await d(`/api/connections`))}(0,i.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await fetch(`/api/studio/version`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();e&&n.stale===!0&&z(!0)}catch{}};t();let n=()=>void t();return window.addEventListener(`focus`,n),()=>{e=!1,window.removeEventListener(`focus`,n)}},[]);async function Gr(){le(!0);try{await d(`/api/studio/shutdown`,{}),z(!1),R({kind:`info`,text:`Stopped the older ${D.productTitle} server. Run \`${D.cliName} studio\` (or \`npm run studio\`) to start the updated version, then reload this tab.`})}catch(e){R({kind:`error`,text:e.message||`Could not stop the older Studio server.`})}finally{le(!1)}}function Kr(){typeof window<`u`&&window.innerWidth<=700&&bn(!0),S(!0)}function qr(){S(!1),N(void 0);let e=new URL(location.href);e.searchParams.delete(`settings`),e.searchParams.delete(`panel`),e.searchParams.delete(`tab`),e.searchParams.get(`view`)===`settings`&&e.searchParams.delete(`view`),history.replaceState(null,``,e),Wr().catch(e=>R({kind:`error`,text:e.message})),Xt.current&&ln(Xt.current).catch(()=>{})}(0,i.useEffect)(()=>{Je.current=!0;let t=yr.current,n=new URL(location.href).searchParams.get(`project`)?.trim()||``,i=n||e.project;if(n){xr(n);let e=new URL(location.href);e.searchParams.delete(`project`),history.replaceState(null,``,e)}u().then(async()=>{He(!0);let e=new URL(location.href).searchParams,n=e.get(`run`),a=[`general`,`account`,`media`,`appearance`,`workflows`,`setup-modules`,`guide`].includes(e.get(`settings`)??``);if(e.get(`settings`)===`connections`||e.get(`view`)===`connections`){let t=e.get(`tab`);if(A(t===`client`||t===`mcp-clients`?`mcp-clients`:t===`auto`||t===`ai-models`?`ai-models`:t===`visual-testing`?`visual-testing`:`overview`),g(`connections`),a?Kr():S(!1),e.get(`settings`)===`connections`){let e=new URL(location.href);e.searchParams.delete(`settings`),e.searchParams.delete(`panel`),e.searchParams.set(`view`,`connections`),history.replaceState(null,``,e)}}else(e.get(`panel`)===`settings`||e.get(`view`)===`settings`||a)&&Kr();if(e.get(`auth`)===`connected`){R({kind:`success`,text:`Account connected.`});let e=new URL(location.href);e.searchParams.delete(`auth`),history.replaceState(null,``,e)}else if(e.get(`auth`)===`error`){R({kind:`error`,text:`Sign-in did not complete. Try again or use a local CLI / scoped token.`});let e=new URL(location.href);e.searchParams.delete(`auth`),history.replaceState(null,``,e)}if(e.get(`figma`)===`connected`){R({kind:`success`,text:`Figma connected.`});let e=new URL(location.href);e.searchParams.delete(`figma`),history.replaceState(null,``,e)}else if(e.get(`figma`)===`error`){R({kind:`error`,text:`Figma sign-in did not complete. Check your OAuth settings and try again.`});let e=new URL(location.href);e.searchParams.delete(`figma`),history.replaceState(null,``,e)}n&&(Xt.current=n);let[o]=await Promise.all([d(`/api/context`),Wr(),zr().catch(()=>{}),an().catch(e=>R({kind:`error`,text:e.message})),n?ln(n).catch(e=>R({kind:`error`,text:e.message})):i.trim()&&yr.current===t?Sr(i).catch(e=>{yr.current===t&&R({kind:`error`,text:e.message})}):Promise.resolve()]);Je.current&&(r(o),!n&&!i.trim()&&o.initialProject&&yr.current===t&&(xr(o.initialProject),Sr(o.initialProject).catch(e=>{yr.current===t&&R({kind:`error`,text:e.message})})))}).catch(e=>R({kind:`error`,text:e.message}));let a=()=>{let e=new URL(location.href).searchParams.get(`run`);e?fn(e,!1):($t.current++,un(),Xt.current=null,Dt(null),Tt(null),Ot(null),Rt(null),Bt(null),Ut([]),he(``),Ae(null),Zt.current=``,Qt.current=``)};return addEventListener(`popstate`,a),()=>{Je.current=!1,removeEventListener(`popstate`,a)}},[]);function Jr(t){let n={critical:0,high:1,medium:2,low:3,info:4},r=t.securityReport.findings,i=[...r].filter(e=>e.path).sort((e,t)=>(n[e.severity]??4)-(n[t.severity]??4)),a=i.slice(0,8).map((e,t)=>[`${t+1}. [${[e.severity.toUpperCase(),e.code,e.proof].filter(Boolean).join(` · `)}]`,e.path?`${e.path}${e.line?`:${e.line}`:``}`:``,e.message,e.action?`Suggested action: ${e.action}`:``].filter(Boolean).join(` — `)),o=(t.designSystemLock?.violations??[]).filter(e=>e.path).slice(0,4).map((e,t)=>`${t+1}. [DESIGN SYSTEM · ${e.rule}] ${e.path??`project`}${e.line?`:${e.line}`:``} — ${e.message}`),c=r.length+(t.designSystemLock?.violationCount??0);if(!c){R({kind:`info`,text:`Local scan found no issues to send for AI review.`});return}let l=[...a,...o];if(!l.length){R({kind:`info`,text:`The scan findings have no cited file paths, so an AI fix brief was not prepared. Open Full details to review them locally.`});return}let u=Math.max(0,c-l.length),d=e.brief.trim(),f=[`AI-assisted audit follow-up. First verify each selected deterministic finding against the cited source; some findings may be false positives or need human review. Prioritize critical and high severity, then propose only supported fixes. Preserve unrelated layout and behavior. Do not claim that a scanner ran again or that fixes passed checks.`,d&&!d.startsWith(`AI-assisted audit follow-up.`)?`User focus note: ${d}`:``,`Local audit score: ${t.securityReport.score}/100. Findings: ${i.length}; design-system violations: ${t.designSystemLock?.violationCount??0}.`,`Selected findings (${l.length}${u?` of ${c}; ${u} omitted`:``}):\n${l.join(`
|
|
23
|
+
`).map(e=>e.trim()).includes(e),onClick:()=>P({preserve:Me(x.preserve,e)}),children:e},e))}),(0,w.jsxs)(`label`,{htmlFor:`preserve`,children:[`One behavior or selector per line`,(0,w.jsx)(`textarea`,{id:`preserve`,rows:3,ref:U,value:x.preserve,onChange:e=>P({preserve:e.target.value})})]}),ft&&(0,w.jsxs)(`details`,{className:`wb-drawer-subdetails`,children:[(0,w.jsxs)(`summary`,{children:[`Optional layout direction comparison`,Dt?` · ${Dt.name}`:``]}),(0,w.jsx)($e,{value:x.directionCandidate,paletteId:x.palette,onChange:e=>P({directionCandidate:e})})]})]}),Mt===`scope`&&(0,w.jsxs)(`div`,{className:`wb-drawer-stack`,children:[(0,w.jsxs)(`div`,{className:`wb-scope-grid`,children:[(0,w.jsxs)(`label`,{htmlFor:`project-intent`,children:[`What are we working on?`,(0,w.jsx)(pe,{id:`project-intent`,label:`What are we working on?`,value:x.intent,onChange:e=>P({intent:e}),options:[{value:`Website`,label:`Website`,icon:(0,w.jsx)(T,{name:`website`})},{value:`App`,label:`App`,icon:(0,w.jsx)(T,{name:`app`})},{value:`Component`,label:`Component`,icon:(0,w.jsx)(T,{name:`component`})},{value:`Something else`,label:`Something else`,icon:(0,w.jsx)(T,{name:`auto`})}]})]}),(0,w.jsxs)(`label`,{htmlFor:`workflow`,children:[`Workflow focus`,(0,w.jsx)(pe,{id:`workflow`,label:`Workflow focus`,value:x.workflow??`auto`,onChange:e=>P({workflow:e}),options:[{value:`auto`,label:`UI Design`},{value:`audit`,label:`Audit (security & UI checks)`},{value:`seo-ai-search`,label:`SEO & AI search`},{value:`architecture`,label:`Project map`}]})]})]}),(0,w.jsxs)(`label`,{className:`check-row wb-trust`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:x.trust,onChange:e=>{P({trust:e.target.checked}),e.target.checked||W(null)}}),(0,w.jsxs)(`span`,{children:[`Enable local preview and build checks`,(0,w.jsx)(`small`,{className:`wb-trust-warning`,children:`Runs local build and preview scripts on your machine. Only enable this for projects you trust.`})]})]}),(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,disabled:!D||L===`mcp`&&ue!==null,checked:x.allowCreate&&(L!==`mcp`||ue===null),onChange:e=>P({allowCreate:e.target.checked})}),(0,w.jsx)(`span`,{children:L===`mcp`&&ue!==null?`Live editing uses the selected existing files.`:D?.adapter===`static-public-v1`?`Allow new HTML, CSS, and JavaScript files in reviewed revisions.`:`Allow new source files in supported React / Next.js folders.`})]}),L===`mcp`&&(0,w.jsxs)(`div`,{className:`wb-live-scope`,children:[(0,w.jsxs)(`label`,{className:`check-row wb-trust`,children:[(0,w.jsx)(`input`,{type:`checkbox`,name:`live-edit`,disabled:!x.trust||!D?.directEditPaths?.length,checked:ue!==null,onChange:e=>W(e.target.checked&&D?{project:D.project,paths:[]}:null)}),(0,w.jsxs)(`span`,{children:[`Allow live editing for this task`,(0,w.jsx)(`small`,{children:D?D.directEditPaths?.length?x.trust?`Submitted batches write selected originals with automatic Undo.`:`Enable trusted local checks above first.`:`No eligible existing files detected for live editing.`:`Inspect a project to see files eligible for live editing.`})]})]}),ue&&(0,w.jsxs)(`fieldset`,{className:`wb-live-paths`,children:[(0,w.jsx)(`legend`,{children:`Files Studio may replace`}),D?.directEditPaths.map(e=>(0,w.jsxs)(`label`,{className:`check-row`,children:[(0,w.jsx)(`input`,{type:`checkbox`,name:`live-edit-path`,value:e,checked:ue.includes(e),disabled:ue.length>=30&&!ue.includes(e),onChange:t=>{let n=t.target.checked;W(t=>t?{...t,paths:n?[...t.paths,e]:t.paths.filter(t=>t!==e)}:null)}}),(0,w.jsx)(`code`,{translate:`no`,children:e})]},e))]})]}),(0,w.jsxs)(`label`,{htmlFor:`figma-link`,children:[`Figma frame or file URL (optional)`,(0,w.jsx)(`input`,{id:`figma-link`,type:`url`,disabled:s,value:x.figmaUrl,onChange:e=>P({figmaUrl:e.target.value}),placeholder:be?.endpointUrl||`https://www.figma.com/design/...`})]}),D&&(0,w.jsxs)(`details`,{className:`wb-paths-disclosure`,children:[(0,w.jsxs)(`summary`,{children:[`View `,D.editablePaths.length,` editable source paths`,D.scoping?.autoScoped&&D.scoping.totalCandidates?` (scoped from ${D.scoping.totalCandidates})`:``]}),(0,w.jsx)(`ul`,{className:`wb-paths`,children:D.editablePaths.map(e=>(0,w.jsx)(`li`,{children:e},e))})]}),(0,w.jsx)(Ge,{project:D?.project,preserve:x.preserve,disabled:s,onExport:ye},D?.project),L===`auto`&&z&&G&&(0,w.jsxs)(`details`,{className:`wb-estimate-details`,children:[(0,w.jsx)(`summary`,{children:`Cost estimate & run limits`}),(0,w.jsx)(k,{firstEstimate:G.firstRequestEstimate,ceiling:G.configuredRunCeiling,settled:G.settledBilling})]})]})]},Mt)]})})})]}),ze&&Be&&Ve&&!x.project.trim()&&!x.brief.trim()&&!a&&!ge&&!B&&(0,w.jsx)(mt,{surface:`workspace`,disabled:s||b,onSelect:Be,onDismiss:Ve})]})}function bt({draft:e,change:t,changeProjectBase:n,context:r,draftNoticeSeen:a,dismissDraftNotice:o,hasActiveRun:s,resetRun:c,currentRunRef:l,setLiveSelection:u,setPrimaryView:f,setNotice:p,onFolderPickerFallback:h,task:g}){let[_,v]=(0,i.useState)(null),[y,b]=(0,i.useState)(!1),[x,S]=(0,i.useState)(``),[C,w]=(0,i.useState)(!1),[T,E]=(0,i.useState)(null),[D,O]=(0,i.useState)(!1),[k,A]=(0,i.useState)(!1),[ee,j]=(0,i.useState)(``),[M,N]=(0,i.useState)(``),[P,F]=(0,i.useState)(`static`),[te,ne]=(0,i.useState)(!0),[re,ie]=(0,i.useState)(!1),[I,ae]=(0,i.useState)(null),[oe,L]=(0,i.useState)(``),[R,se]=(0,i.useState)([]),z=(0,i.useRef)(0);function ce(t){t!==e.project&&(S(``),ae(null),se([])),n(t)}async function le(n=e.project){let r=z.current,i;try{i=await d(`/api/workspace/inspect`,{project:n.trim()})}catch(e){let t=e;if(t?.canNormalizeSnapshot&&n.trim()){let e=n.trim().split(/[/\\]/).filter(Boolean).at(-1)?.replace(/[^A-Za-z0-9._-]+/g,`-`)||`website`;ae({sourcePath:n.trim(),detectedRoot:t.detectedRoot??`.`,detectedKind:t.detectedKind??`static-html`}),L(`${e.slice(0,48)}-studio-copy`),se([])}else ae(null),se(Array.isArray(t?.suggestedSubfolders)?t.suggestedSubfolders:[]);throw e}if(r!==z.current)throw Error(`Project selection changed. Refresh the selected folder before generating.`);ae(null),se([]),v(i),S(``),t({project:i.project});let a=m.get(`studio-recent-projects`)??[];return m.set(`studio-recent-projects`,[i.project,...a.filter(e=>e!==i.project)].slice(0,6)),i}async function B(){I&&await g(async()=>{let e=await d(`/api/connectors/intake/website`,{sourcePath:I.sourcePath,targetName:oe.trim()||`website-studio-copy`,approved:!0});if(!e.project)throw Error(`Normalized project path was not returned.`);ae(null),z.current++,ce(e.project),t({trust:!1}),v(null),await le(e.project),p({kind:`success`,text:`Imported ${e.copiedCount} supported files (${e.adapter}) to work/${e.projectName??``}${e.scriptsStripped?`; repo scripts stripped`:``}.`})})}async function V(e,t){let n=z.current,r=_?.sourceFingerprint,i=await d(`/api/project-rules/export`,{project:e,rules:t,approved:!0});if(z.current===n&&!l.current)try{(await le(e)).sourceFingerprint!==r&&u(null)}catch(e){z.current===n&&!l.current&&(v(null),u(null),p({kind:`error`,text:`Workflow rules were saved. Inspect the project again to refresh source access. `+e.message}))}return i}async function H(t=e.project){let n=t.trim();n&&await g(async()=>{ce(n),v(null),await le(n)})}async function U(e,t){w(!0);try{let n=await d(`/api/project-preview`,{project:e,trust:t});S(n.url)}finally{w(!1)}}async function ue(){a||o();let n=e.project.trim();if(!n)return;let r=_;r&&r.project===n||(r=await le(n)),r?.adapter===`react-vite-v1`&&!e.trust?p({kind:`info`,text:`Allow local preview so Studio can safely build a read-only preview of this app.`,action:{label:`Allow local preview & start`,onClick:()=>{t({trust:!0}),p(null),g(()=>U(n,!0))}}}):await U(n,e.trust)}async function W(){let t=z.current;b(!0),p(null);try{let n=await d(`/api/select-folder`,{initialPath:e.project});if(n.fallbackRequired){let e=n.reason||`No graphical folder picker is available on this host. Paste your project folder path below.`;h?h(e):p({kind:`info`,text:e});return}if(n.path){if(t!==z.current){p({kind:`info`,text:`Folder choice ignored because you changed the path while the window was open.`});return}ce(n.path),v(null),await le(n.path)}}catch(e){p({kind:`error`,text:e.message})}finally{b(!1)}}async function G(){O(!0),p(null);try{let t=await d(`/api/workflow-graph/execute`,{project:e.project.trim(),profile:e.workflow===`architecture`?`architecture`:e.workflow===`seo-ai-search`||e.workflow===`seo`?`seo`:e.workflow===`ai-search`?`ai-search`:`audit`,enableExternalScanners:!0});return E(t),t}catch(e){return p({kind:`error`,text:e.message||`Could not run project audit.`}),null}finally{O(!1)}}async function de(){await g(async()=>{let e=await d(`/api/workspace/create-project`,{parentPath:M.trim(),name:ee.trim(),template:P,installDependencies:(P===`react-vite`||P===`nextjs-app`)&&te,approved:!0});z.current++,ce(e.project),t({trust:!1}),v(null),await le(e.project),A(!1);let n=e.framework===`nextjs-app`||P===`nextjs-app`,r=n?`Next.js (App Router + Tailwind v4)`:`React + Vite`,i=n?`npm install --ignore-scripts`:`npm ci --ignore-scripts`;e.adapter===`react-vite-v1`&&e.dependencyInstallError?p({kind:`error`,text:`New ${r} project created, but dependency install failed: ${e.dependencyInstallError}`}):p({kind:`success`,text:e.adapter===`react-vite-v1`?e.dependenciesInstalled?`New ${r} project created with dependencies installed. Describe what you want to build to start.`:`New ${r} project created. Click "Install dependencies" or run ${i} inside the folder for local builds and preview.`:`New static project created. Describe what you want to build to start.`})})}async function fe(t){ie(!0);try{await g(async()=>{let n=await d(`/api/workspace/install-dependencies`,{project:t,approved:!0});(e.project.trim()===n.project||_?.project===n.project)&&v(n.inspection),p({kind:`success`,text:`Project dependencies installed.`})})}finally{ie(!1)}}async function K(){await g(async()=>{let e=await d(`/api/select-folder`,{initialPath:M});e.fallbackRequired?p({kind:`info`,text:e.reason||`No graphical folder picker is available on this host. Type or paste the parent folder path directly.`}):e.path&&N(e.path)})}async function pe(){await g(async()=>{let e=await d(`/api/workspace/try-sample`,{approved:!0});z.current++,ce(e.project),v(e.inspection),f(`workspace`),s&&c(),p({kind:`info`,text:`Sample project loaded. Describe a change to get started.`})})}async function me(e,t){if(z.current++,ce(e),s&&c(),f(`workspace`),t){v(t);let e=m.get(`studio-recent-projects`)??[];m.set(`studio-recent-projects`,[t.project,...e.filter(e=>e!==t.project)].slice(0,6))}else v(null),await g(()=>le(e))}return{inspection:_,setInspection:v,picking:y,sourcePreview:x,setSourcePreview:S,sourcePreviewLoading:C,quickAudit:T,setQuickAudit:E,quickAuditLoading:D,creating:k,setCreating:A,newName:ee,setNewName:j,newParent:M,setNewParent:N,newTemplate:P,setNewTemplate:F,newInstallDeps:te,setNewInstallDeps:ne,installingDeps:re,setInstallingDeps:ie,normalizeOffer:I,setNormalizeOffer:ae,normalizeTargetName:oe,setNormalizeTargetName:L,suggestedSubfolders:R,pathVersion:z,quickProjects:[...(m.get(`studio-recent-projects`)??[]).filter(e=>typeof e==`string`&&e.trim().length>0),...r?.demoProject?[r.demoProject]:[]].filter((t,n,r)=>r.indexOf(t)===n&&t!==e.project.trim()).slice(0,4),changeProject:ce,inspect:le,importCleanWebsiteCopy:B,exportProjectRules:V,inspectFolder:H,previewSelectedProject:ue,browse:W,runQuickAudit:G,createProject:de,installProjectDependencies:fe,chooseParent:K,trySampleProject:pe,openProjectFromRepositories:me}}function xt(e){return[`preparing`,`generating`,`checking`,`ready`,`waiting-client`,`cancelled`,`failed`,`interrupted`].includes(e)}function St(e,t){let n=e?.workspace;return n?.runId!==t.runId||!xt(t.stage)?e:{...e,...Array.isArray(t.liveFeed)?{liveFeed:t.liveFeed}:{},...t.draftPreview===void 0?{}:{draftPreview:t.draftPreview},workspace:{...n,stage:t.stage,error:t.error,checks:{build:t.checks?.build??n.checks.build,layout:t.checks?.layout??n.checks.layout},directEdit:t.directEdit?{...t.directEdit,batchStatus:t.batchStatus??t.directEdit.batchStatus,liveActivity:t.liveActivity}:void 0}}}function Ct(e,t){let n=(0,i.useEffectEvent)(t);(0,i.useEffect)(()=>{if(!e||typeof EventSource>`u`)return;let t=new EventSource(`/api/workspace/`+e+`/events`);function r(t){try{let r=JSON.parse(t.data);r.apiVersion===1&&r.runId===e&&n(r)}catch{}}return t.addEventListener(`snapshot`,r),t.addEventListener(`telemetry`,r),t.addEventListener(`close`,()=>t.close()),()=>t.close()},[e])}function wt({activeRef:e,connected:t,tab:n,setTab:r,variant:a,setVariant:o,previewSize:s,setPreviewSize:c,defaultPreviewSize:l=`fit`,defaultCompareMode:u=`1up`,setPrimaryView:f,setPreview:p,setBeforePreview:m,setAfterPreview:h,setCompareMode:g,setPublishedPreview:_,setPreviewFullscreen:v,setPreviewLoading:y,setNotice:b,onSelectRunReset:x,onFullReset:S,task:C}){let[w,T]=(0,i.useState)([]),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,ee]=(0,i.useState)(null),[j,M]=(0,i.useState)(null),[N,P]=(0,i.useState)(()=>new URL(location.href).searchParams.get(`run`)),[F,te]=(0,i.useState)(null),[ne,re]=(0,i.useState)(null),[ie,I]=(0,i.useState)(null),[ae,oe]=(0,i.useState)(null),[L,R]=(0,i.useState)(null),[se,z]=(0,i.useState)([]),[ce,le]=(0,i.useState)(null),[B,V]=(0,i.useState)(!1),[H,U]=(0,i.useState)(null),[ue,W]=(0,i.useState)(``),G=(0,i.useRef)(null),de=(0,i.useRef)(null),fe=(0,i.useRef)(null),K=(0,i.useRef)(``),pe=(0,i.useRef)(``),me=(0,i.useRef)(null),he=(0,i.useRef)(0),ge=(0,i.useRef)(0),_e=(0,i.useRef)(0),ve=(0,i.useRef)(0),ye=(0,i.useRef)(new Map),be=!!F?.workspace&&[`preparing`,`generating`,`checking`].includes(F.workspace.stage),xe=F?.workspace,Se=xe?.directEdit??j?.live;async function Ce(){let t=++he.current,{runs:n}=await d(`/api/runs`);e.current&&t===he.current&&T(n)}function we(e,t){let n=t.message;return t.code!==`REVIEW_CONFLICT`&&n!==`Original source or request inputs changed since review`?!1:(G.current===e&&(oe(null),R({runId:e,detail:n}),r(`changes`),p(``),m(``),h(``),g(`1up`),v(!1),y(!1)),!0)}async function Te(t){if(de.current===t){fe.current=t;return}de.current=t;let n=++ge.current,r=()=>e.current&&G.current===t&&ge.current===n,i=me.current;try{let[e,n,a]=await Promise.all([d(`/api/runs/`+t),d(`/api/workspace/`+t),d(`/api/applications?run=`+t)]);if(!r())return;M(e),P(null);let o=me.current;if(te(o?.runId===t&&o!==i?St(n,o):n),z(a.applications),e.status===`invalidated`&&!a.applications.length&&(oe(null),e.revisionId||I(null),p(``)),e.revisionId){let i=`${t}:${e.revisionId}:${e.status===`invalidated`?`historical`:`current`}`;if(K.current!==i){let e=await d(`/api/runs/${t}/content`);if(!r())return;K.current=i,I(e)}if(e.status===`awaiting-human-review`&&n.workspace?.stage===`ready`)try{let n=await d(`/api/applications/prepare`,{runId:t,revisionId:e.revisionId});r()&&(oe(n),R(null))}catch(e){if(r()&&!we(t,e))throw e}else r()&&oe(null)}}catch(e){if(r())throw P(null),e}finally{ge.current===n&&(de.current=null),r()&&fe.current===t&&(fe.current=null,Te(t).catch(e=>b({kind:`error`,text:e.message})))}}function Ee(){_e.current++,le(null),V(!1),U(null),W(``)}function De(e,t=!0){ve.current++,Ee(),x(),G.current=e,P(e);let n=ye.current.get(e);f(`workspace`),r(n?.tab??`preview`),o(n?.variant??`after`),c(n?.size??l),M(null),I(null),oe(null),R(null),te(null),z([]),p(``),m(``),h(``),g(u),_(null),y(!1),K.current=``,pe.current=``;let i=new URL(location.href);i.searchParams.delete(`settings`),i.searchParams.set(`run`,e),t&&history.pushState(null,``,i)}function Oe(e,t=!0){return G.current!==e&&De(e,t),C(()=>Te(e))}function ke(){ve.current++,Ee(),S(),G.current=null,P(null),M(null),te(null),I(null),oe(null),R(null),f(`workspace`),r(`preview`),z([]),p(``),m(``),h(``),g(`1up`),_(null),y(!1),b(null),K.current=``,pe.current=``;let e=new URL(location.href);e.search=``,history.pushState(null,``,e)}async function Ae(e){if(!(E||be)){D(e),ee(null);try{await C(async()=>{await d(`/api/runs/${e}/delete`,{approved:!0}),he.current++,(G.current===e||new URL(location.href).searchParams.get(`run`)===e)&&ke(),T(t=>t.filter(t=>t.id!==e)),k(e)})}finally{D(null)}}}async function je(){O&&await C(async()=>{await d(`/api/runs/${O}/restore`,{}),await Ce(),k(null)})}async function Me(e){j&&await C(async()=>{let t=await d(`/api/runs/${e}/export-report`,{}),n=new Blob([t.reportHtml],{type:`text/html;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`ui-workflow-before-after-${e.slice(0,8)}.html`,i.click(),setTimeout(()=>URL.revokeObjectURL(r),1e4);let a=typeof t.delta?.scoreDelta==`number`?t.delta.scoreDelta:null,o=a===null?``:`, delta ${a>=0?`+${a}`:`${a}`}`,s=typeof t.embeddedScreenshots==`number`&&t.embeddedScreenshots>0?`, ${t.embeddedScreenshots} embedded screenshot${t.embeddedScreenshots===1?``:`s`}`:``;b({kind:`success`,text:`Before/After HTML report downloaded (score ${t.score}/100${o}${s}).`})})}async function Ne(e){let t=_e.current;await C(async()=>{let n=await d(`/api/workspace/diagnostic-export?runId=${encodeURIComponent(e)}`);_e.current===t&&(le(n),V(!0))})}function Pe(){if(!ce)return;let e=new Blob([JSON.stringify(ce,null,2)+`
|
|
24
|
+
`],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`studio-redacted-diagnostics.json`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e4)}async function Fe(e){if(!j)return;let t=_e.current;await C(async()=>{let n=await d(`/api/runs/${e}/export-branch`,{revisionId:j.revisionId,branchName:ue.trim()||`review/studio-${e.slice(0,8)}`,approved:!0});_e.current===t&&(U(n),b({kind:`success`,text:`Exported Git branch ${n.branchName} (${n.commitSha.slice(0,8)}) without changing your working tree.`}))})}async function Ie(e){await C(async()=>{await d(`/api/workspace/${e}/recheck-live`,{approved:!0}),G.current===e&&await Te(e)})}(0,i.useEffect)(()=>{if(!A)return;let e=e=>{e.key===`Escape`&&ee(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A]),(0,i.useEffect)(()=>{if(!t)return;let e=()=>void Ce().catch(e=>b({kind:`error`,text:e.message}));return addEventListener(`focus`,e),()=>removeEventListener(`focus`,e)},[t]),(0,i.useEffect)(()=>{j?.id&&Ce().catch(e=>{G.current===j.id&&b({kind:`error`,text:e.message})})},[j?.id,j?.status,xe?.stage,Se?.nextRunId]),(0,i.useEffect)(()=>{if(j?.id&&G.current===j.id){let e=ye.current;if(e.delete(j.id),e.set(j.id,{tab:n,variant:a,size:s}),e.size>50){let t=e.keys().next().value;t&&e.delete(t)}}},[j?.id,n,a,s]);let Le=!!Se&&!Se.revoked&&Se.batchStatus!==`revoked`&&(ne?.scopeId!==Se.scopeId||ne.expiresAt!==Se.expiresAt)&&Se.expiresAt>Date.now();(0,i.useEffect)(()=>{if(!Le||!Se)return;let{scopeId:e,expiresAt:t}=Se,n=window.setTimeout(()=>re({scopeId:e,expiresAt:t}),Math.max(0,t-Date.now()));return()=>window.clearTimeout(n)},[Le,Se?.scopeId,Se?.expiresAt]);let Re=xe?.grant,ze=Re&&Re.expiresAt>Date.now()&&(!Se||Le)&&!j?.grants?.some(e=>e.id===Re.id&&e.revoked)?Re:void 0,Be=xe?.stage===`waiting-client`&&!!ze;return Ct(t&&(be||Be||Le)?xe?.runId:void 0,e=>{G.current===e.runId&&(me.current=e,te(t=>St(t,e)),(e.stage!==xe?.stage||e.batchStatus!==(Se?.batchStatus??null))&&Te(e.runId).catch(t=>{G.current===e.runId&&b({kind:`error`,text:t.message})}))}),(0,i.useEffect)(()=>{let e=xe?.runId;if(!e||!be&&!Be&&!Le)return;let t=setInterval(()=>{G.current===e&&Te(e).catch(t=>{G.current===e&&b({kind:`error`,text:t.message})})},be||Be?1100:5e3);return()=>clearInterval(t)},[be,Be,Le,xe?.runId]),{recent:w,setRecent:T,deletingChat:E,deletedChat:O,setDeletedChat:k,confirmDeleteRun:A,setConfirmDeleteRun:ee,run:j,setRun:M,opening:N,setOpening:P,status:F,setStatus:te,content:ie,setContent:I,plan:ae,setPlan:oe,reviewConflict:L,setReviewConflict:R,applications:se,setApplications:z,diagnosticExport:ce,diagnosticOpen:B,setDiagnosticOpen:V,branchResult:H,branchName:ue,setBranchName:W,current:G,contentRevision:K,previewRevision:pe,previewRequest:ve,working:be,record:xe,live:Se,liveActive:Le,clientGrant:Re,activeClientGrant:ze,clientWaiting:Be,refreshRecent:Ce,deleteChat:Ae,restoreChat:je,showReviewConflict:we,load:Te,resetReviewExports:Ee,selectRun:De,open:Oe,reset:ke,exportBeforeAfterReport:Me,loadDiagnosticExport:Ne,downloadDiagnosticJson:Pe,exportGitBranch:Fe,recheckLiveBatch:Ie}}var Y=`modulepreload`,Tt=function(e){return`/`+e},Et={},Dt=function(e){return e.pathname.endsWith(`.css`)},X=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Ot=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Tt(t,n);let r=s(t),i=Dt(r);return X(Et,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Y,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function kt(e){return e.match(/^Figma reference:[ \t]*(https:\/\/\S+)[ \t]*$/m)?.[1]??``}function At(e){let t=kt(e);return t?` Inspect the linked Figma design (${t}) using your client's Figma MCP server if needed.`:``}var jt=(0,i.lazy)(()=>Ot(()=>import(`./Settings-8mMKFnYf.js`),__vite__mapDeps([0,1,2,3,4,5,6]))),Mt=(0,i.lazy)(()=>Ot(()=>import(`./AccountModal-C415mM4f.js`),__vite__mapDeps([7,1,2,3,4]))),Nt=(0,i.lazy)(()=>Ot(()=>import(`./Repositories-DH7YyDwk.js`),__vite__mapDeps([8,1,2,9]))),Pt=(0,i.lazy)(()=>Ot(()=>import(`./Connections-BD_LstwM.js`).then(e=>e.n),__vite__mapDeps([5,2,1,6]))),Ft=(0,i.lazy)(()=>Ot(()=>import(`./ReviewStage-DJ1oRAkT.js`),__vite__mapDeps([10,1,2,11,12]))),It=(0,i.lazy)(()=>Ot(()=>import(`./WorkflowVisualizer-CdwGjUIL.js`),__vite__mapDeps([13,1,2,14,12])));function Lt({motion:e=!0}){let[t,n]=(0,i.useState)(()=>!e||matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,i.useEffect)(()=>{if(t)return;let e=window.setTimeout(()=>n(!0),560);return()=>window.clearTimeout(e)},[t]),t?null:(0,w.jsx)(`div`,{className:`page-curtain`,"aria-hidden":`true`,onAnimationEnd:e=>{e.target===e.currentTarget&&n(!0)}})}function Z(){let[e,t]=(0,i.useState)(()=>({...vt,...m.get(`studio-workspace-draft`),trust:!1,allowCreate:m.get(`studio-allow-source-create`)??!0})),[n,r]=(0,i.useState)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(()=>m.get(`studio-workspace-execution`)===`mcp`?`mcp`:`auto`),[l,p]=(0,i.useState)(null),[h,g]=(0,i.useState)(()=>{let e=new URL(location.href).searchParams.get(`view`);return e===`workflows`?`workflows`:e===`repositories`?`repositories`:e===`connections`?`connections`:`workspace`}),[_,v]=(0,i.useState)(null),[y,b]=(0,i.useState)(!1),[x,S]=(0,i.useState)(!1),[C,A]=(0,i.useState)(`overview`),[ee,j]=(0,i.useState)(0),[M,N]=(0,i.useState)(),[P,F]=(0,i.useState)(``),[ne,re]=(0,i.useState)(()=>m.get(`studio-starter-setup-dismissed`)===!0),[ie,I]=(0,i.useState)(!1),[ae,oe]=(0,i.useState)(null),[L,R]=(0,i.useState)(null),[se,z]=(0,i.useState)(!1),[ce,le]=(0,i.useState)(!1),[B,V]=(0,i.useState)(),[H,U]=(0,i.useState)(!1),[W,G]=(0,i.useState)(null),[de,K]=(0,i.useState)(`preview`),[me,he]=(0,i.useState)(``),[ge,ve]=(0,i.useState)(``),[ye,be]=(0,i.useState)(``),[xe,Se]=(0,i.useState)(()=>{let e=m.get(`studio-default-compare-mode`);return e===`2up`||e===`slider`?e:`1up`}),[Ce,we]=(0,i.useState)(()=>{let e=m.get(`studio-default-preview-size`);return e===`tablet`||e===`phone`?e:`fit`}),[Te,De]=(0,i.useState)(()=>{let e=m.get(`studio-default-compare-mode`);return e===`2up`||e===`slider`?e:`1up`}),[Oe,Ae]=(0,i.useState)(null),[je,Me]=(0,i.useState)(`after`),[Ne,Pe]=(0,i.useState)(()=>{let e=m.get(`studio-default-preview-size`);return e===`tablet`||e===`phone`?e:`fit`}),[Fe,Ie]=(0,i.useState)(!1),[Le,Re]=(0,i.useState)(``),[ze,Be]=(0,i.useState)(`auto`),[Ve,He]=(0,i.useState)(!1),[Ue,We]=(0,i.useState)(!1),[Ge,q]=(0,i.useState)(null),[Ke,qe]=(0,i.useState)(null),Je=(0,i.useRef)(!0),Ye=(0,i.useRef)(null),Ze=(0,i.useRef)(null),$e=(0,i.useRef)(null),et=(0,i.useRef)(null),tt=(0,i.useRef)(null),nt=(0,i.useRef)(null),rt=(0,i.useRef)(!1),it=(0,i.useRef)(()=>{}),at=e=>t(t=>({...t,...e,...e.project!==void 0&&e.project!==t.project?{trust:!1}:{}})),ot=a?.keys.some(e=>e.providerId===`groq`&&!e.fallback)?`groq`:a?.keys.some(e=>e.providerId===`gemini`&&!e.fallback)?`gemini`:void 0,lt=ot===`groq`?`Groq`:`Google AI Studio`,pt=_e(ot,e=>{t(t=>({...t,brief:[t.brief.trimEnd(),e].filter(Boolean).join(` `).slice(0,12e3)}))});async function J(e){U(!0),R(null);try{await e()}catch(e){R({kind:`error`,text:e.message})}finally{Je.current&&U(!1)}}let{recent:mt,deletingChat:ht,deletedChat:gt,setDeletedChat:xt,confirmDeleteRun:St,setConfirmDeleteRun:Ct,run:Y,setRun:Tt,opening:Et,setOpening:Dt,status:X,setStatus:Ot,content:Z,setContent:Rt,plan:zt,setPlan:Bt,reviewConflict:Vt,applications:Ht,setApplications:Ut,diagnosticExport:Wt,diagnosticOpen:Gt,setDiagnosticOpen:Kt,branchResult:qt,branchName:Jt,setBranchName:Yt,current:Xt,contentRevision:Zt,previewRevision:Qt,previewRequest:$t,working:en,record:Q,live:$,liveActive:tn,clientGrant:nn,activeClientGrant:rn,refreshRecent:an,deleteChat:on,restoreChat:sn,showReviewConflict:cn,load:ln,resetReviewExports:un,selectRun:dn,open:fn,reset:pn,exportBeforeAfterReport:mn,loadDiagnosticExport:hn,downloadDiagnosticJson:gn,exportGitBranch:_n,recheckLiveBatch:vn}=wt({activeRef:Je,connected:Ve,tab:de,setTab:K,variant:je,setVariant:Me,previewSize:Ne,setPreviewSize:Pe,defaultPreviewSize:Ce,defaultCompareMode:xe,setPrimaryView:g,setPreview:he,setBeforePreview:ve,setAfterPreview:be,setCompareMode:De,setPublishedPreview:Ae,setPreviewFullscreen:Ie,setPreviewLoading:We,setNotice:R,onSelectRunReset:()=>{F(``),rt.current=!1,pt.cancel(),G(null),Ie(!1),Re(``)},onFullReset:()=>{rt.current=!1,pt.cancel(),p(null),G(null),qe(null),Ie(!1),Re(``),it.current()},task:J}),{collapsed:yn,setCollapsed:bn,theme:xn,setTheme:Sn,contrast:Cn,setContrast:wn,textScale:Tn,setTextScale:En,motion:Dn,setMotion:On,hoverEffects:kn,setHoverEffects:An,pageTransitions:jn,setPageTransitions:Mn,resolvedDark:Nn,backdrop:Pn,setBackdrop:Fn,accent:In,setAccent:Ln,customAccent:Rn,setCustomAccent:zn,customHighlight:Bn,setCustomHighlight:Vn,typography:Hn,setTypography:Un,resetAppearance:Wn}=ue(!!Y);(0,i.useEffect)(()=>{m.set(`studio-default-compare-mode`,xe)},[xe]),(0,i.useEffect)(()=>{m.set(`studio-default-preview-size`,Ce)},[Ce]);let[Gn,Kn]=(0,i.useState)(()=>m.get(`studio-draft-notice-seen`)===!0);function qn(){Kn(!0),m.set(`studio-draft-notice-seen`,!0)}let[Jn,Yn]=(0,i.useState)({count:0,hint:``}),{inspection:Xn,setInspection:Zn,picking:Qn,sourcePreview:$n,setSourcePreview:er,sourcePreviewLoading:tr,quickAudit:nr,setQuickAudit:rr,quickAuditLoading:ir,creating:ar,setCreating:or,newName:sr,setNewName:cr,newParent:lr,setNewParent:ur,newTemplate:dr,setNewTemplate:fr,newInstallDeps:pr,setNewInstallDeps:mr,installingDeps:hr,setInstallingDeps:gr,normalizeOffer:_r,setNormalizeOffer:vr,normalizeTargetName:yr,setNormalizeTargetName:br,suggestedSubfolders:xr,pathVersion:Sr,quickProjects:Cr,changeProject:wr,inspect:Tr,importCleanWebsiteCopy:Er,exportProjectRules:Dr,inspectFolder:Or,previewSelectedProject:kr,browse:Ar,runQuickAudit:jr,createProject:Mr,installProjectDependencies:Nr,chooseParent:Pr,trySampleProject:Fr,openProjectFromRepositories:Ir}=bt({draft:e,change:at,changeProjectBase:t=>{t!==e.project&&pt.cancel(),at({project:t})},context:n,draftNoticeSeen:Gn,dismissDraftNotice:qn,hasActiveRun:!!Y,resetRun:pn,currentRunRef:Xt,setLiveSelection:p,setPrimaryView:g,setNotice:R,onFolderPickerFallback:e=>{Yn(t=>({count:t.count+1,hint:e}))},task:J});it.current=()=>er(``),(0,i.useEffect)(()=>{W&&et.current?.focus()},[W]),(0,i.useLayoutEffect)(()=>{let e=Ze.current;e&&(e.style.height=`auto`,e.style.height=`${e.value?Math.min(Math.max(e.scrollHeight,118),320):118}px`)},[e.brief,Y,Et]),(0,i.useLayoutEffect)(()=>{let e=$e.current;e&&(e.style.height=`auto`,e.style.height=`${e.value?Math.min(Math.max(e.scrollHeight,84),220):84}px`)},[e.preserve,Y,Et]);let Lr=e.project.trim()!==``||e.brief.trim()!==``||e.intent!==vt.intent||e.palette!==vt.palette||e.styleDirection!==``||e.directionCandidate!==``||e.selected.length>0||(e.projectPhotos?.length??0)>0||e.figmaUrl.trim()!==``||e.preserve!==vt.preserve||(e.workflow??`auto`)!==`auto`||e.allowCreate!==vt.allowCreate||s!==`auto`;(0,i.useEffect)(()=>{let t=()=>{Lr?(m.set(`studio-workspace-draft`,{...e,trust:!1}),m.set(`studio-allow-source-create`,e.allowCreate),m.set(`studio-workspace-execution`,s)):(m.remove(`studio-workspace-draft`),m.remove(`studio-allow-source-create`),m.remove(`studio-workspace-execution`))},n=window.setTimeout(t,220);return window.addEventListener(`pagehide`,t),()=>{window.clearTimeout(n),window.removeEventListener(`pagehide`,t)}},[e,s,Lr]);function Rr(){pt.cancel(),Sr.current++,m.remove(`studio-workspace-draft`),m.remove(`studio-allow-source-create`),m.remove(`studio-workspace-execution`),m.remove(`studio-recent-projects`),t({...vt}),c(`auto`),Zn(null),p(null),er(``),vr(null),oe(null),qe(null),q(null),R({kind:`info`,text:`Saved draft cleared.`})}function zr(){re(!0),m.set(`studio-starter-setup-dismissed`,!0)}function Br(t){t===`mcp`?(c(`mcp`),Vr(void 0,`mcp-clients`)):(Wr(`workspace`),t===`diff`?(I(!0),e.project.trim()||Fr()):t===`audit`&&(at({workflow:`audit`}),e.project.trim()?Xn?.project===e.project.trim()&&jr():Fr()))}function Vr(e,t=e?`mcp-clients`:`ai-models`){Wr(`connections`),N(e),A(t),j(e=>e+1);let n=new URL(location.href);n.searchParams.delete(`settings`),n.searchParams.delete(`panel`),n.searchParams.set(`view`,`connections`),t===`overview`?n.searchParams.delete(`tab`):n.searchParams.set(`tab`,t),history.replaceState(null,``,n)}async function Hr(){let e=await d(`/api/auth/status`);Je.current&&v(e)}async function Ur(){await J(async()=>{await d(`/api/auth/signout`,{}),await Hr(),R({kind:`info`,text:`Signed out.`})})}function Wr(e){h===`connections`&&e!==`connections`&&qr().catch(e=>R({kind:`error`,text:e.message})),S(!1),N(void 0),e===`connections`&&A(`overview`),g(e),typeof window<`u`&&window.innerWidth<=700&&bn(!0);let t=new URL(location.href);t.searchParams.delete(`settings`),t.searchParams.delete(`panel`),t.searchParams.delete(`tab`),e===`workspace`?t.searchParams.delete(`view`):t.searchParams.set(`view`,e),history.replaceState(null,``,t)}function Gr(e,t){en||H?t?.():(Y&&pn(),at({workflow:e}),requestAnimationFrame(()=>{Ze.current?Ze.current.focus():t?.()}))}(0,i.useEffect)(()=>{let e=!0,t=()=>{document.hidden||u().then(()=>{e&&He(!0)}).catch(()=>{e&&He(!1)})},n=setInterval(t,15e3),r=()=>He(!1);return window.addEventListener(`offline`,r),window.addEventListener(`online`,t),()=>{e=!1,clearInterval(n),window.removeEventListener(`offline`,r),window.removeEventListener(`online`,t)}},[]);async function Kr(t,n){gr(!0);try{await J(async()=>{let r=await d(`/api/workspace/install-dependencies`,{project:t,approved:!0});(e.project.trim()===r.project||Xn?.project===r.project)&&Zn(r.inspection),await d(`/api/workspace/${n}/recheck-live`,{approved:!0}),Xt.current===n&&await ln(n)})}finally{gr(!1)}}async function qr(){o(await d(`/api/connections`))}(0,i.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await fetch(`/api/studio/version`,{cache:`no-store`});if(!t.ok)return;let n=await t.json();e&&n.stale===!0&&z(!0)}catch{}};t();let n=()=>void t();return window.addEventListener(`focus`,n),()=>{e=!1,window.removeEventListener(`focus`,n)}},[]);async function Jr(){le(!0);try{await d(`/api/studio/shutdown`,{}),z(!1),R({kind:`info`,text:`Stopped the older ${D.productTitle} server. Run \`${D.cliName} studio\` (or \`npm run studio\`) to start the updated version, then reload this tab.`})}catch(e){R({kind:`error`,text:e.message||`Could not stop the older Studio server.`})}finally{le(!1)}}function Yr(){typeof window<`u`&&window.innerWidth<=700&&bn(!0),S(!0)}function Xr(){S(!1),N(void 0);let e=new URL(location.href);e.searchParams.delete(`settings`),e.searchParams.delete(`panel`),e.searchParams.delete(`tab`),e.searchParams.get(`view`)===`settings`&&e.searchParams.delete(`view`),history.replaceState(null,``,e),qr().catch(e=>R({kind:`error`,text:e.message})),Xt.current&&ln(Xt.current).catch(()=>{})}(0,i.useEffect)(()=>{Je.current=!0;let t=Sr.current,n=new URL(location.href).searchParams.get(`project`)?.trim()||``,i=n||e.project;if(n){wr(n);let e=new URL(location.href);e.searchParams.delete(`project`),history.replaceState(null,``,e)}u().then(async()=>{He(!0);let e=new URL(location.href).searchParams,n=e.get(`run`),a=[`general`,`account`,`media`,`appearance`,`workflows`,`setup-modules`,`guide`].includes(e.get(`settings`)??``);if(e.get(`settings`)===`connections`||e.get(`view`)===`connections`){let t=e.get(`tab`);if(A(t===`client`||t===`mcp-clients`?`mcp-clients`:t===`auto`||t===`ai-models`?`ai-models`:t===`visual-testing`?`visual-testing`:`overview`),g(`connections`),a?Yr():S(!1),e.get(`settings`)===`connections`){let e=new URL(location.href);e.searchParams.delete(`settings`),e.searchParams.delete(`panel`),e.searchParams.set(`view`,`connections`),history.replaceState(null,``,e)}}else(e.get(`panel`)===`settings`||e.get(`view`)===`settings`||a)&&Yr();if(e.get(`auth`)===`connected`){R({kind:`success`,text:`Account connected.`});let e=new URL(location.href);e.searchParams.delete(`auth`),history.replaceState(null,``,e)}else if(e.get(`auth`)===`error`){R({kind:`error`,text:`Sign-in did not complete. Try again or use a local CLI / scoped token.`});let e=new URL(location.href);e.searchParams.delete(`auth`),history.replaceState(null,``,e)}if(e.get(`figma`)===`connected`){R({kind:`success`,text:`Figma connected.`});let e=new URL(location.href);e.searchParams.delete(`figma`),history.replaceState(null,``,e)}else if(e.get(`figma`)===`error`){R({kind:`error`,text:`Figma sign-in did not complete. Check your OAuth settings and try again.`});let e=new URL(location.href);e.searchParams.delete(`figma`),history.replaceState(null,``,e)}n&&(Xt.current=n);let[o]=await Promise.all([d(`/api/context`),qr(),Hr().catch(()=>{}),an().catch(e=>R({kind:`error`,text:e.message})),n?ln(n).catch(e=>R({kind:`error`,text:e.message})):i.trim()&&Sr.current===t?Tr(i).catch(e=>{Sr.current===t&&R({kind:`error`,text:e.message})}):Promise.resolve()]);Je.current&&(r(o),!n&&!i.trim()&&o.initialProject&&Sr.current===t&&(wr(o.initialProject),Tr(o.initialProject).catch(e=>{Sr.current===t&&R({kind:`error`,text:e.message})})))}).catch(e=>R({kind:`error`,text:e.message}));let a=()=>{let e=new URL(location.href).searchParams.get(`run`);e?fn(e,!1):($t.current++,un(),Xt.current=null,Dt(null),Tt(null),Ot(null),Rt(null),Bt(null),Ut([]),he(``),Ae(null),Zt.current=``,Qt.current=``)};return addEventListener(`popstate`,a),()=>{Je.current=!1,removeEventListener(`popstate`,a)}},[]);function Zr(t){let n={critical:0,high:1,medium:2,low:3,info:4},r=t.securityReport.findings,i=[...r].filter(e=>e.path).sort((e,t)=>(n[e.severity]??4)-(n[t.severity]??4)),a=i.slice(0,8).map((e,t)=>[`${t+1}. [${[e.severity.toUpperCase(),e.code,e.proof].filter(Boolean).join(` · `)}]`,e.path?`${e.path}${e.line?`:${e.line}`:``}`:``,e.message,e.action?`Suggested action: ${e.action}`:``].filter(Boolean).join(` — `)),o=(t.designSystemLock?.violations??[]).filter(e=>e.path).slice(0,4).map((e,t)=>`${t+1}. [DESIGN SYSTEM · ${e.rule}] ${e.path??`project`}${e.line?`:${e.line}`:``} — ${e.message}`),c=r.length+(t.designSystemLock?.violationCount??0);if(!c){R({kind:`info`,text:`Local scan found no issues to send for AI review.`});return}let l=[...a,...o];if(!l.length){R({kind:`info`,text:`The scan findings have no cited file paths, so an AI fix brief was not prepared. Open Full details to review them locally.`});return}let u=Math.max(0,c-l.length),d=e.brief.trim(),f=[`AI-assisted audit follow-up. First verify each selected deterministic finding against the cited source; some findings may be false positives or need human review. Prioritize critical and high severity, then propose only supported fixes. Preserve unrelated layout and behavior. Do not claim that a scanner ran again or that fixes passed checks.`,d&&!d.startsWith(`AI-assisted audit follow-up.`)?`User focus note: ${d}`:``,`Local audit score: ${t.securityReport.score}/100. Findings: ${i.length}; design-system violations: ${t.designSystemLock?.violationCount??0}.`,`Selected findings (${l.length}${u?` of ${c}; ${u} omitted`:``}):\n${l.join(`
|
|
25
25
|
`)}`].filter(Boolean).join(`
|
|
26
26
|
|
|
27
|
-
`);at({workflow:`audit-ai`,brief:f}),R({kind:`info`,text:s===`mcp`?`Local findings are ready. Review the brief, then prepare the AI client task to fix them.`:`Local findings are ready. Review the brief, then generate a staged fix for review.`}),requestAnimationFrame(()=>
|
|
27
|
+
`);at({workflow:`audit-ai`,brief:f}),R({kind:`info`,text:s===`mcp`?`Local findings are ready. Review the brief, then prepare the AI client task to fix them.`:`Local findings are ready. Review the brief, then generate a staged fix for review.`}),requestAnimationFrame(()=>Ze.current?.focus())}async function Qr(e=!1){let t=await jr();t&&e&&Zr(t)}async function $r(t){t.preventDefault(),!pt.busy&&(e.workflow===`audit`?await jr():s===`auto`&&!Vi?(fi?.model&&zi&&Bi&&R({kind:`info`,text:`Confirm ${Hi(fi.providerId)} free-tier eligibility in Connections before generating.`}),Vr()):await J(async()=>{let t=Xn?.project===e.project?Xn:await Tr(),r=_t(e.workflow),i=r?ct.find(t=>t.id===e.styleDirection):void 0,a=r&&e.attachStyleImage?ut(i,n?.references??[],e.selected):void 0,o=r&&i?await st(i.id,e.styleContext??`efficient`):void 0,c=r?a&&!e.selected.includes(a)?[...e.selected,a]:e.selected:[],u=(e.figmaUrl||``).trim(),f=``;if(r&&u){let e;try{e=new URL(u)}catch{throw Error(`Figma frame or file URL must be a valid https:// URL.`)}if(e.protocol!==`https:`)throw Error(`Figma frame or file URL must use https://.`);f=`Figma reference: ${e.toString()}`}else r&&ai?.endpointUrl&&ai.endpointUrl.startsWith(`https://`)&&(f=`Figma reference: ${ai.endpointUrl}`);let m=[e.brief.trim(),e.workflow===`audit-ai`?``:`Build/work intent: ${e.intent}.`,r?Xe(e.palette):``,r&&o?dt(e.styleDirection,!!a,o.content):``,r?ft(c,n?.references??[],e.photoSettings??{},e.projectPhotos??[]):``,r?Qe(e.directionCandidate):``,f,...r?e.selected.map(t=>e.referenceDirections[t]?.focus?`Reference `+t+` focus: `+e.referenceDirections[t].focus:``):[],Ke&&e.workflow!==`audit-ai`?`Reviewer feedback: `+Ke.reviewFeedback:``].filter(Boolean).join(`
|
|
28
28
|
|
|
29
29
|
`),h=s===`mcp`&&l?.project===t.project?l.paths:void 0;if(h&&(!e.trust||!h.length))throw Error(`Choose the files Studio can edit live.`);let g=e.workflow===`audit`?`auto`:e.workflow===`audit-ai`?`audit`:e.workflow,_=t=>({version:1,requestKey:`workspace-`+crypto.randomUUID(),adapter:t.adapter,workflowProfile:g,project:t.project,brief:m,mustPreserve:e.preserve.split(`
|
|
30
|
-
`).map(e=>e.trim()).filter(Boolean),mode:`manual`,references:c.map(t=>{let r=n?.references.find(e=>e.id===t),i=e.referenceDirections[t],o=a===t,s=r?Math.max(1,Math.floor(r.height/2)):0,c=i?.view??`full`;return{selectionId:t,attach:!0,focus:i?.focus||(o?`Layout, typography scale, grid rhythm, and surface framing only (ignore colors in this image).`:void 0),...c!==`full`&&r?{region:{x:0,y:c===`top`?0:c===`bottom`?r.height-s:Math.floor((r.height-s)/2),width:r.width,height:s}}:{}}}),guidance:[],...t.adapter===`react-vite-v1`?{projectPolicy:{editablePaths:t.editablePaths,createPaths:[],...e.allowCreate?{createRoots:t.suggestedCreateRoots?.length?t.suggestedCreateRoots:[`src`]}:{}}}:{allowStaticCreate:e.allowCreate},limits:{maxAttempts:3,packetBytes:8e5}}),v;try{v=await d(`/api/workspace/start`,{approved:!0,execution:s,model:`auto`,spec:_(t),expectedSourceFingerprint:t.sourceFingerprint,trustProject:e.trust,...h?{directEditPaths:h}:{},...
|
|
31
|
-
`).map(e=>e.trim()).filter(Boolean),imageCount:i,...a===void 0?{}:{textBytes:a}}).then(e=>{t||
|
|
32
|
-
`),
|
|
33
|
-
`)||void 0}]:[],...
|
|
30
|
+
`).map(e=>e.trim()).filter(Boolean),mode:`manual`,references:c.map(t=>{let r=n?.references.find(e=>e.id===t),i=e.referenceDirections[t],o=a===t,s=r?Math.max(1,Math.floor(r.height/2)):0,c=i?.view??`full`;return{selectionId:t,attach:!0,focus:i?.focus||(o?`Layout, typography scale, grid rhythm, and surface framing only (ignore colors in this image).`:void 0),...c!==`full`&&r?{region:{x:0,y:c===`top`?0:c===`bottom`?r.height-s:Math.floor((r.height-s)/2),width:r.width,height:s}}:{}}}),guidance:[],...t.adapter===`react-vite-v1`?{projectPolicy:{editablePaths:t.editablePaths,createPaths:[],...e.allowCreate?{createRoots:t.suggestedCreateRoots?.length?t.suggestedCreateRoots:[`src`]}:{}}}:{allowStaticCreate:e.allowCreate},limits:{maxAttempts:3,packetBytes:8e5}}),v;try{v=await d(`/api/workspace/start`,{approved:!0,execution:s,model:`auto`,spec:_(t),expectedSourceFingerprint:t.sourceFingerprint,trustProject:e.trust,...h?{directEditPaths:h}:{},...Ke??{}})}catch(t){if(t.code!==`PROJECT_CHANGED`)throw t;if(h)throw p(null),await Tr(e.project),Error(`Project files changed. Studio refreshed the file list. Review the live edit scope again.`);let n=await Tr(e.project);v=await d(`/api/workspace/start`,{approved:!0,execution:s,model:`auto`,spec:_(n),expectedSourceFingerprint:n.sourceFingerprint,trustProject:e.trust,...Ke??{}})}p(null),dn(v.runId),await ln(v.runId),await an()}))}async function ei(t){if(t.size>2097152)throw Error(`Choose an image up to 2 MiB.`);let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result).split(`,`)[1]),r.onerror=()=>n(Error(`Could not read this image.`)),r.readAsDataURL(t)}),i=await d(`/api/references`,{name:t.name,base64:n});return r(e=>e&&{...e,references:[...e.references,i]}),at({selected:[...e.selected,i.id].slice(0,8)}),i.id}async function ti(e){if(!Y||me&&je===e&&Te===`1up`)return;let t=++$t.current,n=()=>Xt.current===Y.id&&$t.current===t;We(!0);try{let t=await d(`/api/runs/${Y.id}/preview`,{variant:e});if(!n())return;he(t.url),e===`before`?ve(t.url):be(t.url),Me(e)}catch(e){if(n())throw We(!1),e}}async function ni(e){if(De(e),!Y||e===`1up`)return;let t=++$t.current,n=()=>Xt.current===Y.id&&$t.current===t;if(!(ge&&ye)){We(!0);try{let[e,t]=await Promise.all([ge?Promise.resolve({url:ge}):d(`/api/runs/${Y.id}/preview`,{variant:`before`}),ye?Promise.resolve({url:ye}):d(`/api/runs/${Y.id}/preview`,{variant:`after`})]);if(!n())return;ve(e.url),be(t.url),me||he(t.url)}catch(e){if(n())throw We(!1),e}}}async function ri(){if(!Y)return;let e=++$t.current,t=()=>Xt.current===Y.id&&$t.current===e;We(!0);try{let e=await d(`/api/workspace/`+Y.id+`/live-preview`,{});if(!t())return;Ae({runId:Y.id,url:e.url})}catch(e){if(t())throw We(!1),e}}Ee({dark:Nn,stage:Ht[0]?.status===`applied`?`applied`:Ht[0]?.status===`rolled-back`?`rolled-back`:X?.workspace?.stage??null,opening:!!Et}),(0,i.useEffect)(()=>{if(!Fe){delete document.documentElement.dataset.previewFullscreen;return}document.documentElement.dataset.previewFullscreen=`true`;let e=e=>{e.key===`Escape`&&Ie(!1)};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e),delete document.documentElement.dataset.previewFullscreen}},[Fe]),(0,i.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||document.querySelector(`dialog[open]`))return;let t=!!e.target?.closest(`input, textarea, select, [contenteditable="true"]`);(e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()===`b`?!t&&!x&&(e.preventDefault(),bn(e=>!e)):(e.ctrlKey||e.metaKey)&&!e.altKey&&e.key===`,`?(e.preventDefault(),x?S(!1):Yr()):e.key===`Escape`&&ie&&!x&&(e.preventDefault(),I(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ie,x]);let ii=ct.find(t=>t.id===e.styleDirection),ai=a?.externalConnectors?.find(e=>e.id===`figma`&&e.status===`configured`)??null,oi=n?.pilotProject,si=Ht.find(e=>e.status!==`rolled-back`)??Ht[0],ci=l&&Xn?.project===l.project?l.paths:null,li=Y?.status===`awaiting-human-review`,ui=!!si&&si.status!==`rolled-back`,di=!!Y&&!Q,fi=a?.preferences,pi=(a?.keys?.length??0)>0||!!_?.authenticated||!!P,mi=!ne&&mt.length===0&&!pi,hi=!(!$||si?.status!==`applied`||$.batchStatus!==`published-ready`&&$.state!==`passed`),gi=!!($&&si?.status===`applied`&&X?.livePreviewAvailable),_i=gi?Oe?.runId===Y?.id?Oe?.url:void 0:me,vi=gi&&de===`preview`&&!!_i;(0,i.useLayoutEffect)(()=>{vi&&rt.current&&(rt.current=!1,nt.current?.focus())},[vi]);let yi=($?.liveActivity?.length?$.liveActivity:void 0)??(si?.files.length?si.files.map(e=>({path:e.path,status:e.status===`applied`?hi?`checked`:`applied`:`staged`})):($?.paths??[]).map(e=>({path:e,status:$?.state===`publishing`?`writing`:`staged`}))),bi=Z?.proposal?.changes.length??si?.files.length??0,xi=Vt?.runId===Y?.id?Vt:null,Si=!!(xi||Z?.historical||Y?.status===`invalidated`),Ci=!(!Y?.revisionId||Q?.stage!==`ready`||!Q.trustProject||Q.checks.layout===`not-run`||hi||[`publishing`,`checking`,`passed`].includes($?.state??``)),wi=Ci?Y?.id+`:`+Y?.revisionId:``,Ti=gi?Y?.id+`:published`:``;(0,i.useEffect)(()=>{let e=Ti||wi;if(!e||de!==`preview`||_i||Qt.current===e)return;Qt.current=e;let t=Xt.current;(Ti?ri():ti(Si?`after`:je)).catch(e=>{Xt.current===t&&R({kind:`error`,text:e.message})})},[Ti,wi,de,_i,je,Si]),(0,i.useEffect)(()=>{if(!Ve||Y)return;let t=!1,r=window.setTimeout(()=>{let r=e.attachStyleImage?ut(ii,n?.references??[],e.selected):void 0,i=e.selected.length+(r&&!e.selected.includes(r)?1:0),a=Xn&&Xn.project===e.project.trim()?Xn.files.reduce((e,t)=>e+(t.kind===`text`?t.bytes:0),0):void 0;d(`/api/workspace/estimate`,{execution:s,model:fi?.model??``,brief:e.brief,mustPreserve:e.preserve.split(`
|
|
31
|
+
`).map(e=>e.trim()).filter(Boolean),imageCount:i,...a===void 0?{}:{textBytes:a}}).then(e=>{t||q(e)}).catch(()=>{t||q(null)})},120);return()=>{t=!0,window.clearTimeout(r)}},[Ve,Y,s,fi?.providerId,fi?.model,fi?.budgetUsd,fi?.maxOutputTokens,fi?.maxModelTurns,fi?.freeTierConfirmed,fi?.groqFreeTierConfirmed,fi?.openrouterFreeOnly,Xn,e.project,e.brief,e.preserve,e.selected,ii,n?.references,e.attachStyleImage]);let Ei=ui?3:Z?.proposal?2:1;function Di(e){Y&&si&&J(async()=>{await d(`/api/applications/${si.applicationId}/rollback`,{approved:!0,...e?{writeId:e}:{}}),Xt.current===Y.id&&(await ln(Y.id),Xt.current===Y.id&&e&&requestAnimationFrame(()=>tt.current?.focus()))})}let Oi=Y?.checks.structural.status??`not-run`,ki=Q?.checks.build??`not-run`,Ai=Q?.checks.layout??`not-run`,ji=(Q?.layout?.states??[]).map(e=>`${e.name} (${e.width}×${e.height}): overflow=${e.overflow?`yes`:`no`}, scriptErrors=${e.scriptErrors}${e.diagnostics.length?` — ${e.diagnostics.join(` | `)}`:``}`),Mi=Q?.layout?.accessibility,Ni=Q?.layout?.renderedContrast,Pi=Q?.layout?.interaction,Fi=Q?.layout?.preservation,Ii=Q?.layout?.motion,Li=[Mi?`DOM accessibility: ${Mi.passed?`passed`:`${Mi.issueCount} issue(s)`}${Mi.issues.length?` (${Mi.issues.join(`; `)})`:``}`:``,Ni?`Rendered contrast: light failures=${Ni.failureCount}${typeof Ni.darkFailureCount==`number`?`, dark failures=${Ni.darkFailureCount}`:``}, overlap=${Ni.overlapCount}, text-over-image=${Ni.textOverImageCount}`:``,Pi?`Focus & media states: Tab=${Pi.tabAdvanced?`moves`:`none`}, focus ring=${Pi.focusRingVisible?`visible`:`subtle/none`}, :hover=${Pi.hasHoverRules?`yes`:`no`}, :focus-visible=${Pi.hasFocusVisibleRules?`yes`:`no`}, reduced-motion=${Pi.hasReducedMotionRules?`yes`:`no`}, dark-mode=${Pi.hasDarkModeRules?`yes`:`no`}`:``,Ii?`Startup animations observed in motion: ${Ii.normal.progressed} normal, ${Ii.reduced.progressed} reduced.`:``,...(Q?.layout?.designChecks??[]).filter(e=>e.status===`conflict`).map(e=>e.rule===`no-gradients`?`Brief conflict: ${e.matches} rendered element(s) use a gradient.`:`Brief conflict: expected heading weights of 800–900, measured ${e.weights?.join(`, `)}.`)].filter(Boolean),Ri=[Y?.checks.browser?.reason??Y?.checks.browser?.note??Q?.layout?.reason??Q?.error,...ji,...Li].filter(Boolean).join(`
|
|
32
|
+
`),zi=!!a?.keys.some(e=>e.providerId===fi?.providerId&&!e.fallback),Bi=!!fi&&(fi.providerId===`gemini`&&!fi.freeTierConfirmed||fi.providerId===`groq`&&!fi.groqFreeTierConfirmed),Vi=!!fi?.model&&zi&&!Bi,Hi=e=>e===`gemini`?`Google AI Studio`:e===`groq`?`Groq`:e===`openrouter`?`OpenRouter`:e??`Provider`,Ui=Gt&&Wt&&(0,w.jsxs)(`section`,{className:`wb-diagnostic-preview`,"aria-label":`Redacted diagnostic export preview`,children:[(0,w.jsxs)(`div`,{className:`wb-diagnostic-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{children:`Redacted diagnostic export`}),(0,w.jsx)(`p`,{className:`field-help`,children:`Omits source code, file paths, briefs, credentials, grant tokens, and raw model responses.`})]}),(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>void navigator.clipboard?.writeText(JSON.stringify(Wt,null,2)).then(()=>R({kind:`success`,text:`Copied redacted diagnostics JSON to clipboard.`})).catch(()=>{}),children:`Copy JSON`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:gn,children:`Download JSON`}),(0,w.jsx)(`button`,{type:`button`,className:`text-button`,onClick:()=>Kt(!1),children:`Hide`})]})]}),(0,w.jsx)(`pre`,{className:`wb-diagnostic-json`,children:JSON.stringify(Wt,null,2)})]}),Wi=!Mi&&!Ni?`not-run`:Mi?.passed!==!1&&(Ni?.failureCount??0)===0&&(Ni?.darkFailureCount??0)===0&&(Ni?.overlapCount??0)===0?`passed`:`warning`,Gi=[...hi&&Oi===`invalidated`?[]:[{label:`Source validation`,status:xi?`stale`:Oi,detail:xi?.detail??(Oi===`failed`||Oi===`invalidated`?Y?.checks.structural.reason??Y?.checks.structural.note??Y?.error??void 0:Y?.checks.structural.note??void 0)}],{label:`Build`,status:ki,detail:ki===`failed`||ki===`invalidated`?Q?.error??Y?.error??`Build reported an error during local verification.`:void 0},{label:`Desktop / phone layout`,status:Ai,detail:Ai===`failed`||Ai===`invalidated`||Ai===`unavailable`||Li.length>0||Q?.layout?.states?.some(e=>e.scriptErrors>0||e.overflow)?Ri||`Desktop or mobile viewport check reported an issue.`:void 0},...Mi||Ni?[{label:`Accessibility, contrast & focus`,status:Wi,detail:Li.join(`
|
|
33
|
+
`)||void 0}]:[],...Fi?[{label:`Preservation`,status:Fi.passed?!Fi.manualReview||Fi.manualReview.length||Fi.invalidSelectors?.length?`review needed`:`passed`:`failed`,detail:[Fi.manualReview?`Browser checks passed: `+Fi.matchedCount+`/`+Fi.checkedCount+` on the desktop preview.`:`Review the behavior checklist alongside this saved result.`,...(Fi.failedSelectors??[]).map(e=>`Missing selector: `+e),...(Fi.failedBehaviors??[]).map(e=>`Behavior failed: `+e),...(Fi.invalidSelectors??[]).map(e=>`Invalid selector: `+e),...(Fi.manualReview??[]).map(e=>`Check manually: `+e)].join(`
|
|
34
34
|
`)}]:[],...Z?.securityAndCraftAudit?[{label:`UI security & lint`,status:Z.securityAndCraftAudit.status===`passed`?`passed`:Z.securityAndCraftAudit.status===`failed`?`failed`:`warning`,detail:`Automated score ${Z.securityAndCraftAudit.score}/100 · ${Z.securityAndCraftAudit.summary.securityFindings} security, ${Z.securityAndCraftAudit.summary.craftFindings} UI ${Z.securityAndCraftAudit.summary.craftFindings===1?`issue`:`issues`}. Review visual quality against the brief.`+(Z.securityAndCraftAudit.repairHints.length?`
|
|
35
35
|
`+Z.securityAndCraftAudit.repairHints.slice(0,6).map(e=>`[${e.severity}] ${e.code}${e.path?` @ ${e.path}${e.line?`:${e.line}`:``}`:``}: ${e.hint}`).join(`
|
|
36
|
-
`):``)}]:[]],
|
|
37
|
-
`):`No task plan has been saved.`;function
|
|
38
|
-
`)),V({runId:Y.id,kind:`handoff`})})}function
|
|
36
|
+
`):``)}]:[]],Ki=Z?.securityAndCraftAudit?.signals,qi=(Q?.layout?.states??[]).reduce((e,t)=>e+(t.scriptErrors||0),0),Ji=[{id:`build`,label:`Build`,status:Ki?.build?.status??(ki===`passed`?`passed`:ki===`failed`||ki===`invalidated`?`failed`:`not-run`),detail:Ki?.build?.detail},{id:`security`,label:`Security`,status:Ki?.security?.status??(Z?.securityAndCraftAudit?Z.securityAndCraftAudit.summary.securityFindings>0?`failed`:`passed`:`not-run`),detail:Ki?.security?.detail??(Z?.securityAndCraftAudit?`${Z.securityAndCraftAudit.summary.securityFindings} security ${Z.securityAndCraftAudit.summary.securityFindings===1?`issue`:`issues`}`:void 0)},{id:`layout`,label:`Layout`,status:Ki?.layout?.status??(Ai===`passed`?`passed`:Ai===`failed`||Ai===`invalidated`?`failed`:`not-run`),detail:Ki?.layout?.detail},{id:`contrast`,label:`Contrast`,status:Ki?.contrast?.status??(Ni?(Ni.failureCount??0)===0&&(Ni.darkFailureCount??0)===0?`passed`:`warning`:`not-run`),detail:Ki?.contrast?.detail},{id:`accessibility`,label:`Accessibility`,status:Ki?.accessibility?.status??(Mi?Mi.passed?`passed`:`warning`:`not-run`),detail:Ki?.accessibility?.detail},{id:`runtime`,label:`Runtime`,status:Ki?.runtime?.status??(Q?.layout?.states?.length?qi>0?`failed`:`passed`:`not-run`),detail:Ki?.runtime?.detail??(Q?.layout?.states?.length?`${qi} script error(s)`:void 0)}],Yi=X?.draftChecks??[],Xi=X?.designConnections??[],Zi=Xi.find(({serverName:e})=>e===P)??Xi[0],Qi=Xi.some(({taskAccessed:e})=>e),$i=X?.task?.plan?.steps??[],ea=$i.length?[`Saved plan (model-reported, verify before relying on it):`,...$i.map(e=>`- ${e.status}: ${e.text}`)].join(`
|
|
37
|
+
`):`No task plan has been saved.`;function ta(){Y&&Zi&&J(async()=>{let e=$?`Use the attached Studio MCP server "${Zi.serverName}" with runId "${Y.id}".`:`Use Studio MCP server "${Zi.serverName}" (or fall back to "ui-design-workflow" if "${Zi.serverName}" is not connected) with runId "${Y.id}".`;await navigator.clipboard.writeText(`${e} Start with get_run_context({runId, compact:true}). Use get_workflow for detailed guidance and check_color_contrast if changing colors. If get_draft_check is available, inspect existing draft checks before starting approved checks. Read the files you change and validate the proposal.${At(Y.brief)} ${$?`Submit the batch and follow its nextAction to open the next batch when publication checks pass.`:`Submit the revision for review in Studio.`}`),V({runId:Y.id,kind:`prompt`})})}let na=Z?.securityAndCraftAudit?.repairHints??Z?.reviewSummary?.audit?.repairHints??[],ra=B&&B.runId===Y?.id&&(0,w.jsx)(`p`,{role:`status`,children:B.kind===`prompt`?`Client task prompt copied.`:`Run handoff copied.`});function ia(){if(!Y)return;let e=new URL(`/`,location.origin);e.searchParams.set(`run`,Y.id);let t=new Set([...(Y.grants??[]).map(e=>e.id),nn?.id].filter(e=>!!(e&&e!==Y.id))),n=e=>{for(let n of t)e=e.replaceAll(n,`[grant omitted]`);return e.replace(/\b[a-f0-9]{64}\b/gi,`[private value omitted]`).replace(/\b[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}\b/gi,`[identifier omitted]`)},r=X?.recovery,i=Yi[0],a=i&&(i.serverName?`Reconnect to "${i.serverName}". Use get_draft_check with runId "${Y.id}" and jobId "${i.id}" before choosing any new work.`:`Reconnect using the original owner-authorized enrollment and inspect the retained job with get_draft_check. Open this run in Studio if that connection is unavailable.`),o=$?.nextRunId?`Batch ${$.batch+1} is open as run ${$.nextRunId}. Open that run in Studio.`:Q?.stage===`waiting-client`&&!rn?`Open this run in Studio and choose Prepare a fresh client task. The existing connection can be reused.`:Y.revisionId?`Open the staged revision and review its actual checks and diff.`:a??(r?.sourceConflict?`Open the project again with current files. The retained draft and context belong to the earlier inputs.`:r?.draftAvailable?`Recover the saved draft locally for review before starting more work.`:r?.canRetry?`Review the source, destination and budget for a fresh attempt in Studio.`:r?.canContinue?`Review continuation in Studio and approve the new request before sending anything.`:rn?`Open this run, copy its current task prompt, and connect the replacement client if needed. Read the current context and verify the saved plan before continuing.`:`Open this run in Studio and review its current permissions and activity before starting another task.`);J(async()=>{await navigator.clipboard.writeText([`Studio run handoff`,`Open on this machine: ${e.href}`,`Run: ${Y.id}`,`Stage: ${Q?.stage??Y.status}`,`Staged revision: ${Y.revisionId??`None`}`,...r?.unknownOutcome?[`Upstream outcome and usage are unknown. Do not replay the prior request.`]:[],...r?.draftSavedAt?[`Validated draft ${r.draftHash?.slice(0,12)??``} saved ${new Date(r.draftSavedAt).toISOString()}`]:[],...r?.checkpointSavedAt?[`Private checkpoint saved ${new Date(r.checkpointSavedAt).toISOString()}`]:[],...Y.brief.includes(`Design comparison direction (`)?[`Direction candidate: ${Y.brief.match(/Design comparison direction \(([^)]+)\)/)?.[1]??`selected`}`]:[],...Gi.map(({label:e,status:t})=>`${e}: ${t}`),...Yi.map(e=>`Draft check ${e.id}: ${e.status}${e.serverName?` · ${e.serverName}`:``} (confirmed ${new Date(e.updatedAt).toISOString()})`),`Next step: ${o}`,`Saved brief`,n(Y.brief),...Y.mustPreserve.map(e=>`Keep working · ${n(e)}`),n(ea)].join(`
|
|
38
|
+
`)),V({runId:Y.id,kind:`handoff`})})}function aa(e=!1){if(!Y||!e&&!Y.revisionId)return;let t=Y.revisionId?{parentRunId:Y.id,parentRevisionId:Y.revisionId,reviewFeedback:``}:null,r=Y.project,i=Y.brief.split(`
|
|
39
39
|
|
|
40
40
|
Build/work intent:`)[0],a=new Set((n?.references??[]).map(e=>e.id)),o=(Y.references??Z?.request?.images??[]).filter(e=>e?.id&&e.attach!==!1&&a.has(e.id)).map(e=>e.id);pn(),at({project:r,brief:i,figmaUrl:kt(Y.brief),preserve:Y.mustPreserve.join(`
|
|
41
|
-
`),trust:!1,selected:o.slice(0,8),...e?{referenceDirections:{},photoSettings:{},projectPhotos:[]}:{}}),Q?.execution&&c(Q.execution),
|
|
41
|
+
`),trust:!1,selected:o.slice(0,8),...e?{referenceDirections:{},photoSettings:{},projectPhotos:[]}:{}}),Q?.execution&&c(Q.execution),Zn(null),qe(e?null:t),requestAnimationFrame(()=>document.getElementById(e?`brief`:`review-feedback`)?.focus())}function oa(e){Re(e),requestAnimationFrame(()=>{let e=document.getElementById(`wb-chat-input`);e?.scrollIntoView({behavior:`smooth`,block:`center`}),e?.focus()})}async function sa(t){t?.preventDefault();let n=Le.trim();if(!Y||!Q||!n){R({kind:`info`,text:`Write a follow-up instruction first.`});return}let r=ze===`auto`&&!Vi&&Q.execution===`mcp`?`mcp`:ze;r===`auto`&&!Vi?Vr(void 0,`ai-models`):await J(async()=>{let t=await d(`/api/workspace/inspect`,{project:Y.project}),i=Y.brief.split(`
|
|
42
42
|
|
|
43
43
|
Follow-up instruction:`)[0].trim(),a=(Array.isArray(Y.references)?Y.references:Z?.request?.images??[]).filter(e=>!!(e?.id&&e.attach!==!1)).filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t).slice(0,8).map(e=>({selectionId:e.id,attach:!0})),o={version:1,requestKey:`workspace-`+crypto.randomUUID(),adapter:t.adapter,workflowProfile:e.workflow===`audit`?`auto`:e.workflow===`audit-ai`?`audit`:e.workflow,project:t.project,brief:[i,`Follow-up instruction: ${n}`].filter(Boolean).join(`
|
|
44
44
|
|
|
45
|
-
`),mustPreserve:Y.mustPreserve,mode:`manual`,references:a,guidance:[],...t.adapter===`react-vite-v1`?{projectPolicy:{editablePaths:t.editablePaths,createPaths:[],...e.allowCreate?{createRoots:t.suggestedCreateRoots?.length?t.suggestedCreateRoots:[`src`]}:{}}}:{allowStaticCreate:e.allowCreate},limits:{maxAttempts:3,packetBytes:8e5}},s=await d(`/api/workspace/start`,{approved:!0,execution:r,model:`auto`,spec:o,expectedSourceFingerprint:t.sourceFingerprint,refreshSourceOnStart:!0,referenceRunId:Y.id,trustProject:Q.trustProject??e.trust,...Y.revisionId?{parentRunId:Y.id,parentRevisionId:Y.revisionId,reviewFeedback:n}:{}});Xt.current===Y.id&&(dn(s.runId),await ln(s.runId),await an())})}let aa=(0,w.jsxs)(w.Fragment,{children:[X?.task?.plan&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Task plan · model-reported progress`}),(0,w.jsx)(`ol`,{children:X.task.plan.steps.map((e,t)=>(0,w.jsxs)(`li`,{children:[e.text,` — `,e.status.replace(`-`,` `)]},t))})]}),!!X?.task?.capabilityRequests.length&&(0,w.jsxs)(`section`,{className:`wb-capability-requests`,"aria-label":`Requested project access`,children:[(0,w.jsx)(`h2`,{children:`Additional access requested`}),(0,w.jsx)(`p`,{children:`These requests have not changed this run’s permissions. To grant access, stop this run and start a new revision with the required files or checks selected.`}),(0,w.jsx)(`ul`,{children:X.task.capabilityRequests.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{children:e.capability.replaceAll(`-`,` `)}),`: `,e.reason,!!e.paths.length&&(0,w.jsx)(`p`,{children:e.paths.join(`, `)})]},e.id))})]})]});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`a`,{className:`skip`,href:x?`#settings-title`:`#workspace`,children:[`Skip to `,x?`settings`:`workspace`]}),(0,w.jsxs)(`div`,{className:`wb-shell `+(yn?`is-collapsed `:``)+(x?`is-settings-open`:``),children:[(0,w.jsx)(te,{activeView:h,settingsOpen:x,recent:mt,runId:Y?.id,published:fi,opening:Et,working:en||H,deleting:ht,resolvedDark:Nn,collapsed:yn,connected:Ve,auth:_,onSelectView:Vr,onNewRevision:()=>{S(!1),N(void 0),pn()},onSettings:()=>{Kr()},onOpenAccount:()=>b(!0),onSignOut:Br,onExpandSidebar:()=>bn(!1),onOpenRun:e=>{S(!1),N(void 0),fn(e)},onDeleteRun:e=>Ct(e),onToggleTheme:()=>Sn(Nn?`light`:`dark`)}),!x&&(0,w.jsx)(`button`,{type:`button`,className:`wb-sidebar-handle`,"aria-label":yn?`Expand sidebar`:`Collapse sidebar`,"aria-controls":`workspace-sidebar`,"aria-expanded":!yn,onClick:()=>bn(e=>!e),children:(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m9 6 6 6-6 6`})})}),(0,w.jsx)(`button`,{type:`button`,className:`wb-sidebar-backdrop`+(yn?``:` is-active`),"aria-label":`Close sidebar`,"aria-hidden":yn,tabIndex:yn?-1:0,onClick:()=>bn(!0)}),(0,w.jsxs)(`div`,{className:`wb-main`,children:[(0,w.jsxs)(`header`,{className:`wb-topbar`,children:[(0,w.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":yn?`Open navigation menu`:`Close navigation menu`,"aria-controls":`workspace-sidebar`,"aria-expanded":!yn,onClick:()=>bn(e=>!e),children:(0,w.jsx)(T,{name:`menu`})}),(0,w.jsxs)(`span`,{children:[x?(0,w.jsxs)(w.Fragment,{children:[`Studio `,(0,w.jsx)(`span`,{className:`wb-muted`,children:`/ Settings`})]}):h===`workflows`?`Workflow Studio`:h===`repositories`?`Repositories`:h===`connections`?`Connections`:`Workspace`,!x&&h===`workspace`&&(0,w.jsxs)(`span`,{className:`wb-muted`,children:[`/ `,Y||Et?`Revision`:`New revision`]})]}),(0,w.jsxs)(`div`,{className:`wb-topbar-shortcuts`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut wb-workflows-shortcut`,onClick:()=>Vr(`workflows`),children:[(0,w.jsx)(T,{name:`graph`}),`Workflow Studio`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut`,onClick:()=>Rr(void 0,`ai-models`),children:[(0,w.jsx)(T,{name:`google`}),a?.keys.length?`API connections`:`Add API key`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut wb-ai-client-shortcut`,onClick:()=>Rr(void 0,`mcp-clients`),children:[(0,w.jsx)(T,{name:`mcp`}),`AI Clients`]})]})]}),(0,w.jsxs)(`main`,{id:`workspace`,className:`wb-workspace `+(!x&&h===`workspace`&&!Y&&!Et?`wb-compose-view`:``),tabIndex:-1,children:[se&&(0,w.jsxs)(`div`,{className:`wb-status-banner is-info`,role:`status`,children:[(0,w.jsxs)(`span`,{children:[`A newer version of `,D.productTitle,` is built on disk than the running local server.`]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:ce,onClick:()=>void Gr(),children:ce?`Restarting…`:`Restart Studio`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-status-dismiss`,"aria-label":`Dismiss update notice`,onClick:()=>z(!1),children:(0,w.jsx)(T,{name:`close`})})]}),(0,w.jsx)(E,{notice:L,onDismiss:()=>R(null)}),gt&&(0,w.jsxs)(`div`,{className:`wb-history-notice`,role:`status`,children:[(0,w.jsx)(`span`,{children:`Chat deleted from History. Recovery records retained.`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:sn,children:`Undo`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-label":`Dismiss chat deletion message`,onClick:()=>_t(null),children:`Dismiss`})]}),h===`workflows`&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(It,{project:e.project.trim(),picking:Xn,onBrowse:Dr,onOpenRepositories:()=>Vr(`repositories`),onOpenComposer:()=>Vr(`workspace`),onFixFindings:e=>{Jr(e),Vr(`workspace`)},onRulesSaved:e=>Yn(t=>t?{...t,projectRules:e}:null)})}),h===`repositories`&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Nt,{auth:_,activeProject:e.project,onOpenAccount:()=>b(!0),onBrowseLocal:async()=>{await Dr(),e.project.trim()&&g(`workspace`)},onTrySample:Mr,onOpenProject:Nr})}),h===`connections`&&(0,w.jsx)(`section`,{className:`wb-connections-page`,children:(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Pt,{project:e.project,initialTab:C,initialTabRequestId:ee,auth:_,clientSetupTask:M,showStarterSetup:di,onStarterSelect:Lr,onDismissStarter:Ir,onClientConnected:e=>F(e),onOpenAccount:()=>b(!0),onDone:()=>{Vr(`workspace`)},onMedia:()=>{let e=new URL(location.href);e.searchParams.set(`settings`,`media`),history.replaceState(null,``,e),Kr()}})})}),h===`workspace`&&Et&&!Y&&(0,w.jsxs)(`section`,{className:`wb-opening`,"aria-busy":`true`,children:[(0,w.jsx)(`div`,{className:`wb-opening-heading`}),(0,w.jsx)(`div`,{className:`wb-opening-panel`}),(0,w.jsx)(`p`,{role:`status`,children:L?.kind===`error`?`The saved revision could not be loaded.`:`Opening your revision…`}),L?.kind===`error`&&(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>J(()=>ln(Et)),children:`Retry opening revision`})]}),h===`workspace`&&!Y&&!Et&&(0,w.jsx)(bt,{motion:Dn,hoverEffects:kn,settings:x,generate:Xr,creating:rr,setCreating:ir,busy:H,newName:ar,setNewName:or,newParent:sr,setNewParent:cr,newTemplate:lr,setNewTemplate:ur,newInstallDeps:dr,setNewInstallDeps:fr,installingDeps:pr,onInstallDependencies:Ar,chooseParent:jr,createProject:kr,picking:Xn,draft:e,browse:Dr,onOpenRepositories:()=>Vr(`repositories`),onTrySample:Mr,inspection:Jn,normalizeOffer:hr,normalizeTargetName:_r,setNormalizeTargetName:vr,importCleanWebsiteCopy:Cr,context:n,briefRef:Xe,change:at,voice:ut,cloudVoiceName:st,cloudVoiceProvider:ot,sourcePreviewLoading:$n,sourcePreview:Zn,setSourcePreview:Qn,task:J,previewSelectedProject:Er,execution:s,setExecution:c,autoHasKey:Ii,autoReady:Ri,prefs:li,openConnections:Rr,panel:ae,setPanel:oe,upload:Zr,preserveRef:Qe,livePaths:ai,setLiveSelection:p,dispatchEstimate:Ge,quickProjects:br,onProjectChange:e=>{yr.current++,xr(e),Yn(null)},onInspect:()=>void Tr().catch(e=>R({kind:`error`,text:e.message})),onInspectOnBlur:()=>{e.project.trim()&&!Jn&&Sr().catch(e=>R({kind:`error`,text:e.message}))},onQuickProject:e=>{yr.current++,xr(e),Yn(null),Sr(e).catch(e=>R({kind:`error`,text:e.message}))},iteration:q,onIterationFeedback:e=>qe(t=>t&&{...t,reviewFeedback:e}),onRemoveIteration:()=>qe(null),onExportProjectRules:wr,figmaConnector:ni,providerDisplayName:zi,hasSavedDraft:Pr,showFirstTimeDraftNotice:!Gn&&(e.brief.trim()!==``||e.project.trim()!==``),onDismissDraftNotice:qn,onClearSavedDraft:Fr,quickAudit:er,quickAuditLoading:nr,onRunQuickAudit:Yr,onClearQuickAudit:()=>tr(null),onOpenWorkflows:()=>Vr(`workflows`),onPrefillAuditFix:Jr,branchDiffOpen:ie,onToggleBranchDiff:()=>I(e=>!e),showStarterSetup:di,onStarterSelect:Lr,onDismissStarter:Ir}),h===`workspace`&&Y&&(0,w.jsxs)(`section`,{className:`wb-result`,children:[!oi&&!si&&!Y.revisionId&&(0,w.jsx)(`ol`,{className:`wb-journey`,"aria-label":`Revision journey`,children:[`Brief`,`Generate`,`Review`,`Apply`].map((e,t)=>(0,w.jsxs)(`li`,{"aria-current":t===Ci?`step`:void 0,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),e]},e))}),(0,w.jsxs)(`div`,{className:`wb-result-heading${Q?.stage===`waiting-client`&&rn?` wb-result-heading--client-ready`:``}${oi?` wb-result-heading--review`:``}`,children:[(0,w.jsxs)(`div`,{children:[!(Q?.stage===`waiting-client`&&rn)&&(0,w.jsx)(`h1`,{className:`page-reveal page-reveal--title`,"aria-live":ii?`polite`:void 0,children:si?ii?.status===`applied`?`Changes applied to your project`:ii?.status===`partially-rolled-back`?`Selected changes undone`:`Application needs attention`:ii?.status===`rolled-back`?`Changes undone`:en?$?.state===`publishing`?`Publishing the live batch…`:$?.state===`checking`?`Checking the published batch…`:Q?.stage===`checking`?`Checking your revision…`:X?.attempt?.steps.at(-1)?.phase===`waiting`?`Waiting to send the next request…`:`Your model is working…`:Q?.stage===`waiting-client`?`Client task access ended`:Q?.stage===`interrupted`?`Your task was interrupted`:Q?.stage===`cancelled`?`Your task is stopped`:Q?.stage===`failed`?`Generation needs attention`:Y.status===`rejected`?`Revision discarded`:oi?`Review your revision`:`Revision details`}),(0,w.jsxs)(`p`,{className:`wb-model-label page-reveal page-reveal--support`,children:[(0,w.jsx)(`span`,{className:`wb-project-name`,children:Y.project.split(/[\\/]/).filter(Boolean).at(-1)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),Q?.model??(Q?.execution===`mcp`?`External MCP client`:`Saved revision`)]}),Q?.stage===`waiting-client`?(0,w.jsxs)(`section`,{className:`wb-client-brief-card`,"aria-label":`Task brief`,children:[(0,w.jsx)(`div`,{className:`wb-client-brief-heading`,children:(0,w.jsx)(`span`,{children:`Task brief`})}),(0,w.jsx)(`p`,{className:`wb-run-brief page-reveal page-reveal--support`,children:Z?.proposal?.summary??(Y.brief.split(`
|
|
45
|
+
`),mustPreserve:Y.mustPreserve,mode:`manual`,references:a,guidance:[],...t.adapter===`react-vite-v1`?{projectPolicy:{editablePaths:t.editablePaths,createPaths:[],...e.allowCreate?{createRoots:t.suggestedCreateRoots?.length?t.suggestedCreateRoots:[`src`]}:{}}}:{allowStaticCreate:e.allowCreate},limits:{maxAttempts:3,packetBytes:8e5}},s=await d(`/api/workspace/start`,{approved:!0,execution:r,model:`auto`,spec:o,expectedSourceFingerprint:t.sourceFingerprint,refreshSourceOnStart:!0,referenceRunId:Y.id,trustProject:Q.trustProject??e.trust,...Y.revisionId?{parentRunId:Y.id,parentRevisionId:Y.revisionId,reviewFeedback:n}:{}});Xt.current===Y.id&&(dn(s.runId),await ln(s.runId),await an())})}let ca=(0,w.jsxs)(w.Fragment,{children:[X?.task?.plan&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Task plan · model-reported progress`}),(0,w.jsx)(`ol`,{children:X.task.plan.steps.map((e,t)=>(0,w.jsxs)(`li`,{children:[e.text,` — `,e.status.replace(`-`,` `)]},t))})]}),!!X?.task?.capabilityRequests.length&&(0,w.jsxs)(`section`,{className:`wb-capability-requests`,"aria-label":`Requested project access`,children:[(0,w.jsx)(`h2`,{children:`Additional access requested`}),(0,w.jsx)(`p`,{children:`These requests have not changed this run’s permissions. To grant access, stop this run and start a new revision with the required files or checks selected.`}),(0,w.jsx)(`ul`,{children:X.task.capabilityRequests.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{children:e.capability.replaceAll(`-`,` `)}),`: `,e.reason,!!e.paths.length&&(0,w.jsx)(`p`,{children:e.paths.join(`, `)})]},e.id))})]})]});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`a`,{className:`skip`,href:x?`#settings-title`:`#workspace`,children:[`Skip to `,x?`settings`:`workspace`]}),(0,w.jsxs)(`div`,{className:`wb-shell `+(yn?`is-collapsed `:``)+(x?`is-settings-open`:``),children:[(0,w.jsx)(te,{activeView:h,settingsOpen:x,recent:mt,runId:Y?.id,published:hi,opening:Et,working:en||H,deleting:ht,resolvedDark:Nn,collapsed:yn,connected:Ve,auth:_,onSelectView:Wr,onNewRevision:()=>{S(!1),N(void 0),pn()},onSettings:()=>{Yr()},onOpenAccount:()=>b(!0),onSignOut:Ur,onExpandSidebar:()=>bn(!1),onOpenRun:e=>{S(!1),N(void 0),fn(e)},onDeleteRun:e=>Ct(e),onToggleTheme:()=>Sn(Nn?`light`:`dark`)}),!x&&(0,w.jsx)(`button`,{type:`button`,className:`wb-sidebar-handle`,"aria-label":yn?`Expand sidebar`:`Collapse sidebar`,"aria-controls":`workspace-sidebar`,"aria-expanded":!yn,onClick:()=>bn(e=>!e),children:(0,w.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`m9 6 6 6-6 6`})})}),(0,w.jsx)(`button`,{type:`button`,className:`wb-sidebar-backdrop`+(yn?``:` is-active`),"aria-label":`Close sidebar`,"aria-hidden":yn,tabIndex:yn?-1:0,onClick:()=>bn(!0)}),(0,w.jsxs)(`div`,{className:`wb-main`,children:[(0,w.jsxs)(`header`,{className:`wb-topbar`,children:[(0,w.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":yn?`Open navigation menu`:`Close navigation menu`,"aria-controls":`workspace-sidebar`,"aria-expanded":!yn,onClick:()=>bn(e=>!e),children:(0,w.jsx)(T,{name:`menu`})}),(0,w.jsxs)(`span`,{children:[x?(0,w.jsxs)(w.Fragment,{children:[`Studio `,(0,w.jsx)(`span`,{className:`wb-muted`,children:`/ Settings`})]}):h===`workflows`?`Workflow Studio`:h===`repositories`?`Repositories`:h===`connections`?`Connections`:`Workspace`,!x&&h===`workspace`&&(0,w.jsxs)(`span`,{className:`wb-muted`,children:[`/ `,Y||Et?`Revision`:`New revision`]})]}),(0,w.jsxs)(`div`,{className:`wb-topbar-shortcuts`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut wb-workflows-shortcut`,onClick:()=>Wr(`workflows`),children:[(0,w.jsx)(T,{name:`graph`}),`Workflow Studio`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut`,onClick:()=>Vr(void 0,`ai-models`),children:[(0,w.jsx)(T,{name:`google`}),a?.keys.length?`API connections`:`Add API key`]}),(0,w.jsxs)(`button`,{type:`button`,className:`button subtle wb-api-shortcut wb-ai-client-shortcut`,onClick:()=>Vr(void 0,`mcp-clients`),children:[(0,w.jsx)(T,{name:`mcp`}),`AI Clients`]})]})]}),(0,w.jsxs)(`main`,{id:`workspace`,className:`wb-workspace `+(!x&&h===`workspace`&&!Y&&!Et?`wb-compose-view`:``),tabIndex:-1,children:[se&&(0,w.jsxs)(`div`,{className:`wb-status-banner is-info`,role:`status`,children:[(0,w.jsxs)(`span`,{children:[`A newer version of `,D.productTitle,` is built on disk than the running local server.`]}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:ce,onClick:()=>void Jr(),children:ce?`Restarting…`:`Restart Studio`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-status-dismiss`,"aria-label":`Dismiss update notice`,onClick:()=>z(!1),children:(0,w.jsx)(T,{name:`close`})})]}),(0,w.jsx)(E,{notice:L,onDismiss:()=>R(null)}),gt&&(0,w.jsxs)(`div`,{className:`wb-history-notice`,role:`status`,children:[(0,w.jsx)(`span`,{children:`Chat deleted from History. Recovery records retained.`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:sn,children:`Undo`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,"aria-label":`Dismiss chat deletion message`,onClick:()=>xt(null),children:`Dismiss`})]}),h===`workflows`&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(It,{project:e.project.trim(),picking:Qn,onBrowse:Ar,onOpenRepositories:()=>Wr(`repositories`),onOpenComposer:()=>Wr(`workspace`),onFixFindings:e=>{Zr(e),Wr(`workspace`)},onRulesSaved:e=>Zn(t=>t?{...t,projectRules:e}:null)})}),h===`repositories`&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Nt,{auth:_,activeProject:e.project,onOpenAccount:()=>b(!0),onBrowseLocal:async()=>{await Ar(),e.project.trim()&&g(`workspace`)},onTrySample:Fr,onOpenProject:Ir})}),h===`connections`&&(0,w.jsx)(`section`,{className:`wb-connections-page`,children:(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Pt,{project:e.project,initialTab:C,initialTabRequestId:ee,auth:_,clientSetupTask:M,showStarterSetup:mi,onStarterSelect:Br,onDismissStarter:zr,onClientConnected:e=>F(e),onOpenAccount:()=>b(!0),onDone:()=>{Wr(`workspace`)},onMedia:()=>{let e=new URL(location.href);e.searchParams.set(`settings`,`media`),history.replaceState(null,``,e),Yr()}})})}),h===`workspace`&&Et&&!Y&&(0,w.jsxs)(`section`,{className:`wb-opening`,"aria-busy":`true`,children:[(0,w.jsx)(`div`,{className:`wb-opening-heading`}),(0,w.jsx)(`div`,{className:`wb-opening-panel`}),(0,w.jsx)(`p`,{role:`status`,children:L?.kind===`error`?`The saved revision could not be loaded.`:`Opening your revision…`}),L?.kind===`error`&&(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>J(()=>ln(Et)),children:`Retry opening revision`})]}),h===`workspace`&&!Y&&!Et&&(0,w.jsx)(yt,{motion:Dn,hoverEffects:kn,settings:x,generate:$r,creating:ar,setCreating:or,busy:H,newName:sr,setNewName:cr,newParent:lr,setNewParent:ur,newTemplate:dr,setNewTemplate:fr,newInstallDeps:pr,setNewInstallDeps:mr,installingDeps:hr,onInstallDependencies:Nr,chooseParent:Pr,createProject:Mr,picking:Qn,draft:e,browse:Ar,onOpenRepositories:()=>Wr(`repositories`),onTrySample:Fr,inspection:Xn,normalizeOffer:_r,normalizeTargetName:yr,setNormalizeTargetName:br,importCleanWebsiteCopy:Er,context:n,briefRef:Ze,change:at,voice:pt,cloudVoiceName:lt,cloudVoiceProvider:ot,sourcePreviewLoading:tr,sourcePreview:$n,setSourcePreview:er,task:J,previewSelectedProject:kr,execution:s,setExecution:c,autoHasKey:zi,autoReady:Vi,prefs:fi,openConnections:Vr,panel:ae,setPanel:oe,upload:ei,preserveRef:$e,livePaths:ci,setLiveSelection:p,dispatchEstimate:Ge,quickProjects:Cr,onProjectChange:e=>{Sr.current++,wr(e),Zn(null)},onInspect:()=>void Or().catch(e=>R({kind:`error`,text:e.message})),onInspectOnBlur:()=>{e.project.trim()&&!Xn&&Tr().catch(e=>R({kind:`error`,text:e.message}))},onQuickProject:e=>{Sr.current++,wr(e),Zn(null),Tr(e).catch(e=>R({kind:`error`,text:e.message}))},iteration:Ke,onIterationFeedback:e=>qe(t=>t&&{...t,reviewFeedback:e}),onRemoveIteration:()=>qe(null),onExportProjectRules:Dr,figmaConnector:ai,providerDisplayName:Hi,hasSavedDraft:Lr,showFirstTimeDraftNotice:!Gn&&(e.brief.trim()!==``||e.project.trim()!==``),onDismissDraftNotice:qn,onClearSavedDraft:Rr,quickAudit:nr,quickAuditLoading:ir,onRunQuickAudit:Qr,onClearQuickAudit:()=>rr(null),onOpenWorkflows:()=>Wr(`workflows`),onPrefillAuditFix:Zr,branchDiffOpen:ie,onToggleBranchDiff:()=>I(e=>!e),showStarterSetup:mi,onStarterSelect:Br,onDismissStarter:zr,hasNotice:!!L,pathInputFallbackSignal:Jn,suggestedSubfolders:xr}),h===`workspace`&&Y&&(0,w.jsxs)(`section`,{className:`wb-result`,children:[!li&&!ui&&!Y.revisionId&&(0,w.jsx)(`ol`,{className:`wb-journey`,"aria-label":`Revision journey`,children:[`Brief`,`Generate`,`Review`,`Apply`].map((e,t)=>(0,w.jsxs)(`li`,{"aria-current":t===Ei?`step`:void 0,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),e]},e))}),(0,w.jsxs)(`div`,{className:`wb-result-heading${Q?.stage===`waiting-client`&&rn?` wb-result-heading--client-ready`:``}${li?` wb-result-heading--review`:``}`,children:[(0,w.jsxs)(`div`,{children:[!(Q?.stage===`waiting-client`&&rn)&&(0,w.jsx)(`h1`,{className:`page-reveal page-reveal--title`,"aria-live":si?`polite`:void 0,children:ui?si?.status===`applied`?`Changes applied to your project`:si?.status===`partially-rolled-back`?`Selected changes undone`:`Application needs attention`:si?.status===`rolled-back`?`Changes undone`:en?$?.state===`publishing`?`Publishing the live batch…`:$?.state===`checking`?`Checking the published batch…`:Q?.stage===`checking`?`Checking your revision…`:X?.attempt?.steps.at(-1)?.phase===`waiting`?`Waiting to send the next request…`:`Your model is working…`:Q?.stage===`waiting-client`?`Client task access ended`:Q?.stage===`interrupted`?`Your task was interrupted`:Q?.stage===`cancelled`?`Your task is stopped`:Q?.stage===`failed`?`Generation needs attention`:Y.status===`rejected`?`Revision discarded`:li?`Review your revision`:`Revision details`}),(0,w.jsxs)(`p`,{className:`wb-model-label page-reveal page-reveal--support`,children:[(0,w.jsx)(`span`,{className:`wb-project-name`,children:Y.project.split(/[\\/]/).filter(Boolean).at(-1)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),Q?.model??(Q?.execution===`mcp`?`External MCP client`:`Saved revision`)]}),Q?.stage===`waiting-client`?(0,w.jsxs)(`section`,{className:`wb-client-brief-card`,"aria-label":`Task brief`,children:[(0,w.jsx)(`div`,{className:`wb-client-brief-heading`,children:(0,w.jsx)(`span`,{children:`Task brief`})}),(0,w.jsx)(`p`,{className:`wb-run-brief page-reveal page-reveal--support`,children:Z?.proposal?.summary??(Y.brief.split(`
|
|
46
46
|
|
|
47
|
-
Build/work intent:`)[0]||`Revision task`)}),Y.brief.trim()&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`View full prompt and brief`}),(0,w.jsx)(`p`,{children:Y.brief})]})]}):(0,w.jsxs)(w.Fragment,{children:[
|
|
47
|
+
Build/work intent:`)[0]||`Revision task`)}),Y.brief.trim()&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`View full prompt and brief`}),(0,w.jsx)(`p`,{children:Y.brief})]})]}):(0,w.jsxs)(w.Fragment,{children:[li&&Z?.proposal?.summary?(0,w.jsxs)(`section`,{className:`wb-ai-revision-summary`,"aria-label":`AI revision summary`,children:[(0,w.jsx)(`span`,{className:`wb-ai-revision-summary-label`,children:`AI revision summary`}),(0,w.jsx)(`p`,{className:`wb-run-brief page-reveal page-reveal--support`,children:Z.proposal.summary})]}):(0,w.jsx)(`p`,{className:`wb-run-brief page-reveal page-reveal--support`,children:Z?.proposal?.summary??(Y.brief.split(`
|
|
48
48
|
|
|
49
|
-
Build/work intent:`)[0]||`Revision task`)}),Y.brief.trim()&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Prompt & brief`}),(0,w.jsx)(`p`,{children:Y.brief})]})]})]}),en&&(0,w.jsxs)(`button`,{className:`button subtle`,onClick:()=>J(async()=>{await d(`/api/workspace/${Y.id}/cancel`,{}),await ln(Y.id)}),children:[`Stop `,Q?.stage===`checking`?`checks`:`generation`]})]}),Q?.error&&(0,w.jsx)(`p`,{className:`error-box`,role:`status`,children:Q.error}),!
|
|
49
|
+
Build/work intent:`)[0]||`Revision task`)}),Y.brief.trim()&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Prompt & brief`}),(0,w.jsx)(`p`,{children:Y.brief})]})]})]}),en&&(0,w.jsxs)(`button`,{className:`button subtle`,onClick:()=>J(async()=>{await d(`/api/workspace/${Y.id}/cancel`,{}),await ln(Y.id)}),children:[`Stop `,Q?.stage===`checking`?`checks`:`generation`]})]}),Q?.error&&(0,w.jsx)(`p`,{className:`error-box`,role:`status`,children:Q.error}),!si&&(xi||Y.status===`invalidated`&&Y.revisionId)&&(0,w.jsxs)(`section`,{className:`wb-task-recovery`,"aria-label":`Project files changed`,children:[(0,w.jsx)(`h2`,{children:`Project files changed`}),(0,w.jsx)(`p`,{children:xi?.detail??`Files in this project changed after this revision was prepared.`}),(0,w.jsx)(`button`,{type:`button`,className:`button primary`,disabled:H,onClick:()=>aa(!0),children:`Start from current files`})]}),$&&(0,w.jsx)(ke,{live:$,liveActive:tn,checkedBatch:hi,previewAvailable:gi,dependenciesMissing:X?.dependencies?.installed===!1,installingDeps:hr,files:yi,busy:H,previewOpen:vi,clientConnection:Zi,blockedReason:Q?.error,repairHints:na,copiedKind:B?.runId===Y.id?B.kind:void 0,canUndoBatch:!!(ui&&si?.recoveryAvailable),onUndoBatch:ui&&si?.recoveryAvailable?()=>void Di():void 0,onViewChanges:Z?.proposal?()=>K(`changes`):void 0,onCopyPrompt:Zi?ta:void 0,onCopyHandoff:ia,onConnectClient:()=>Vr({runId:Y.id,project:Y.project}),onRecheckLive:()=>void vn(Y.id),onInstallAndRecheck:Y.project?()=>void Kr(Y.project,Y.id):void 0,onTogglePreview:()=>{vi?(K(`changes`),Ie(!1),We(!1)):J(async()=>{if(rt.current=!0,K(`preview`),!_i)try{await ri()}catch(e){throw rt.current=!1,e}})},onNextBatch:e=>J(async()=>{let t=$.nextRunId??(await d(`/api/workspace/${Y.id}/next-live-batch`,{})).runId;if(e&&Zi){let e=`Continue live editing "${Y.project.split(/[\\/]/).filter(Boolean).at(-1)||`this project`}" on ${Zi.serverName} with runId "${t}". Call get_run_context({runId: "${t}", compact: true}), make the next batch of UI improvements, and submit with submit_revision.`;await navigator.clipboard?.writeText(e).catch(()=>{}),R({kind:`success`,text:`Opened batch ${$.batch+1} and copied its prompt.`})}Xt.current===Y.id&&await fn(t)}),onRevoke:()=>J(async()=>{await d(`/api/workspace/${Y.id}/revoke-live-scope`,{}),await ln(Y.id)})}),X?.recovery&&!Y.revisionId&&(0,w.jsxs)(`section`,{className:`wb-task-recovery`,"aria-label":`Task recovery`,children:[(0,w.jsx)(`h2`,{children:`Saved work`}),(0,w.jsx)(`p`,{children:X.recovery.reason}),X.recovery.unknownOutcome&&(0,w.jsx)(`p`,{role:`status`,children:`Upstream outcome and usage are unknown. Studio will not replay this request.`}),X.recovery.draftAvailable&&(0,w.jsx)(`button`,{className:`button primary`,disabled:H,onClick:()=>J(async()=>{await d(`/api/workspace/${Y.id}/recover-draft`,{approved:!0}),G(null),await ln(Y.id)}),children:`Recover draft for review`}),X.recovery.canContinue&&W?.runId!==Y.id&&(0,w.jsx)(`button`,{className:X.recovery.draftAvailable?`button subtle`:`button primary`,disabled:H,onClick:()=>J(async()=>{let e=await d(`/api/workspace/${Y.id}/continue-preview`,{});Xt.current===Y.id&&G(e)}),children:`Review continuation`}),X.recovery.canRetry&&W?.runId!==Y.id&&(0,w.jsx)(`button`,{className:X.recovery.canContinue?`button subtle`:`button primary`,disabled:H,onClick:()=>J(async()=>{let e=await d(`/api/workspace/${Y.id}/retry-preview`,{});Xt.current===Y.id&&G(e)}),children:`Review fresh attempt`}),X.recovery.sourceConflict&&(0,w.jsx)(`button`,{className:`button primary`,onClick:()=>{pn(),at({...vt,project:Y.project,brief:Y.brief,preserve:Y.mustPreserve.join(`
|
|
50
50
|
`)})},children:`Start revision with current files`}),Q?.execution===`auto`&&!X.recovery.sourceConflict&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>{let e=Y.brief.split(`
|
|
51
51
|
|
|
52
|
-
Build/work intent:`)[0];pn(),c(`mcp`),at({...
|
|
53
|
-
`)})},children:`Prepare in MCP instead`}),(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Saved brief, decisions and progress`}),[[`Brief and decisions`,X.recovery.briefSavedAt],[`Model-reported task plan`,X.task?.plan?.at],[`Private conversation checkpoint`,X.recovery.checkpointSavedAt],[`Validated draft`,X.recovery.draftSavedAt]].map(([e,t])=>typeof t==`number`&&(0,w.jsxs)(`p`,{children:[e,` saved`,` `,(0,w.jsx)(`time`,{dateTime:new Date(t).toISOString(),children:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}).format(t)})]},e)),(0,w.jsx)(`p`,{children:Y.brief}),Y.mustPreserve.map((e,t)=>(0,w.jsxs)(`p`,{children:[`Keep working · `,e]},t))]}),(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:ta,children:`Copy run handoff`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void hn(Y.id),children:`Diagnostic export (redacted)`})]}),ea,Bi,W?.runId===Y.id&&(0,w.jsxs)(`section`,{className:`wb-continuation-consent`,"aria-label":W.approvalHash?`Fresh attempt consent`:`Continuation consent`,children:[(0,w.jsx)(`h3`,{ref:et,tabIndex:-1,children:W.approvalHash?`Approve a fresh attempt`:`Approve another provider request`}),(0,w.jsxs)(`p`,{children:[W.approvalHash?`Send the saved brief, decisions and selected source context to `:`Send this project’s brief, selected context and saved conversation to `,zi(W.providerId),` · `,W.model,`.`]}),(0,w.jsx)(`p`,{className:`muted`,children:W.destination}),W.paths&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsxs)(`summary`,{children:[`Source scope · `,W.paths.length,` files ·`,` `,W.imageCount,` attached images`]}),(0,w.jsx)(`p`,{children:W.project}),W.paths.map(e=>(0,w.jsx)(`p`,{children:e},e))]}),W.providerId===`openrouter`&&(0,w.jsxs)(`p`,{children:[W.requireZdr?`Zero data retention is required for this request.`:`Your provider account’s data-retention policy applies.`,W.requireZeroPrice?` Only zero-priced routes are allowed.`:``]}),(0,w.jsxs)(`p`,{children:[`New allowance: up to `,W.limits.maxModelTurns,` turns,`,` `,W.limits.maxTools,` tools, `,W.limits.timeoutMinutes,` `,`minutes and `,W.maxOutputTokens.toLocaleString(),` output tokens per turn.`,` `,W.limits.maxTotalTokens?`${W.limits.maxTotalTokens.toLocaleString()} total tokens.`:`No additional total-token cap.`,` `,W.billingMode===`free-tier-confirmed`?`Your confirmed ${W.providerId===`groq`?`Groq`:`Google`} free account is required.`:`Budget: ${new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`}).format(W.maxCostUsd)}.`,` `,`Earlier usage stays recorded separately.`]}),(0,w.jsx)(k,{firstEstimate:W.firstRequestEstimate,ceiling:W.configuredRunCeiling??{maxCostUsd:W.maxCostUsd,maxOutputTokens:W.maxOutputTokens,maxModelTurns:W.limits.maxModelTurns,billingMode:W.billingMode},settled:W.settledBilling}),(0,w.jsxs)(`p`,{children:[W.approvalHash?`This starts a new conversation. Studio checks model availability and pricing after approval, before sending project content. `:`Continue from completed tool results. `,W.allowAuthFallback&&`An approved backup connection may be used if authentication fails. `,`Cancellation may not stop upstream billing.`]}),(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[(0,w.jsx)(`button`,{className:`button primary`,disabled:H,onClick:()=>J(async()=>{let e=W.approvalHash;await d(`/api/workspace/${Y.id}/${e?`retry`:`continue`}`,e?{approvalHash:e,approved:!0}:{consentId:W.consentId,approved:!0}),G(null),await ln(Y.id)}),children:W.approvalHash?`Approve & start fresh attempt`:`Approve & continue task`}),(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>G(null),children:`Keep task stopped`})]})]})]}),(en||Q?.stage===`waiting-client`&&((X?.liveFeed?.length??0)>0||!!X?.draftPreview)||[`failed`,`interrupted`,`cancelled`].includes(Q?.stage??``)&&!Y.revisionId&&!!(X?.attempt?.steps.length||X?.liveFeed?.length))&&(0,w.jsx)(fe,{record:Q,attempt:X?.attempt,liveFeed:X?.liveFeed,draftPreview:X?.draftPreview}),Q?.stage===`waiting-client`&&(!$||!rn||qi.length>1||Ki.length>0)&&(0,w.jsxs)(`div`,{className:`wb-empty wb-client-handoff`,children:[(0,w.jsxs)(`div`,{className:`wb-client-handoff-heading`,children:[(0,w.jsx)(`span`,{className:`wb-client-handoff-eyebrow`,children:`External MCP client`}),(0,w.jsx)(`h2`,{children:rn?$?`Client connections & draft checks`:`Ready for your AI client`:`Prepare to reconnect`})]}),rn?(0,w.jsxs)(w.Fragment,{children:[!$&&(0,w.jsx)(`p`,{className:`wb-client-handoff-intro`,children:Ji?`Follow the steps below to give your client the right project context and start this task.`:`Connect an AI client with Design access to “${Y.project.split(/[\\/]/).filter(Boolean).at(-1)||`this project`}”. Then copy the task prompt so it knows what to do.`}),qi.length>1&&Ji&&(0,w.jsx)(pe,{id:`task-client-server`,label:`Design connection`,value:Ji.serverName,onChange:F,options:qi.map(({clientName:e,serverName:t,taskAccessed:n})=>({label:`${e} (${t})${n?` · opened this task`:``}`,value:t}))}),qi.length>1&&Ji&&(0,w.jsx)(`p`,{className:`field-help`,children:`Every Design connection for this project can open the task. This choice only changes the server name written into the copied prompt.`}),!$&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`section`,{className:`wb-client-access`,"aria-label":`Client access expiry`,children:[(0,w.jsx)(`span`,{className:`wb-client-access-label`,children:`Temporary access ends`}),(0,w.jsx)(`time`,{dateTime:new Date(rn.expiresAt).toISOString(),children:new Date(rn.expiresAt).toLocaleString()})]}),Ji&&(0,w.jsxs)(`p`,{className:`wb-client-connection-status`,role:`status`,children:[(0,w.jsx)(`span`,{className:`wb-client-status-dot`,"aria-hidden":`true`}),Yi?`Your client has opened this task.`:`Waiting for your client to open this task.`]}),(0,w.jsxs)(`div`,{className:`wb-client-steps`,"aria-label":`Next steps`,children:[(0,w.jsxs)(`section`,{className:`wb-client-step`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`1`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:Ji?`Open your connected client`:`Connect your AI client`}),(0,w.jsx)(`p`,{children:Ji?(0,w.jsxs)(w.Fragment,{children:[`Open `,(0,w.jsx)(`code`,{children:Ji.serverName}),` in your AI client, then reopen the client so it loads the connection.`]}):`Choose a client and grant it Design access to this project.`})]}),(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>Rr({runId:Y.id,project:Y.project}),children:Ji?`Connection settings`:`Connect a client`})]}),(0,w.jsxs)(`section`,{className:`wb-client-step`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`2`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:`Check the Studio tools`}),(0,w.jsxs)(`p`,{children:[`In your client, confirm the `,(0,w.jsx)(`code`,{children:`get_draft_check`}),` tool is available.`]})]})]}),(0,w.jsxs)(`section`,{className:`wb-client-step wb-client-step--last`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`3`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:`Copy and send the task prompt`}),(0,w.jsx)(`p`,{children:`Paste it into your client to provide the run context and instructions.`})]}),Ji&&(0,w.jsx)(`button`,{className:`button primary`,disabled:H,onClick:Qi,children:`Copy task prompt`})]})]})]}),!$&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Standalone client`}),(0,w.jsxs)(`p`,{children:[`Use this prompt with the standalone server and this run ID (or omit`,` `,(0,w.jsx)(`code`,{children:`runId`}),` to target the latest active run). Draft job recovery requires the attached connection.`]}),(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>J(async()=>{await navigator.clipboard.writeText(`Use the standalone ui-design-workflow tools with runId "${Y.id}". Start with get_run_context({runId, compact:true}). Use get_workflow for detailed guidance and check_color_contrast if changing colors, then validate and submit the proposal for Studio review.${At(Y.brief)}`),V({runId:Y.id,kind:`prompt`})}),children:`Copy standalone prompt`})]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{children:`This task’s access has expired or was revoked. You can reuse your project’s Design connection and confirm fresh access from the composer.`}),(0,w.jsx)(`button`,{className:`button primary`,type:`button`,onClick:()=>na(!0),children:`Prepare a fresh client task`})]}),Ki.length>0&&(0,w.jsxs)(`div`,{"aria-label":`Draft checks`,role:`region`,children:[(0,w.jsx)(`h3`,{children:`Draft checks`}),Ki.map(e=>(0,w.jsxs)(`p`,{className:`wb-draft-check-row`,children:[(0,w.jsxs)(`span`,{role:`status`,children:[`Draft check `,e.id.slice(0,8),` · `,e.status]}),[`queued`,`running`].includes(e.status)&&(0,w.jsx)(`button`,{className:`text-button`,disabled:H,"aria-label":`Cancel draft check ${e.id.slice(0,8)}`,onClick:t=>{let n=t.currentTarget,r=document.activeElement===n;J(async()=>{await d(`/api/workspace/${Y.id}/draft-checks/${e.id}/cancel`,{}),await ln(Y.id),r&&Xt.current===Y.id&&(document.activeElement===n||document.activeElement===document.body)&&Ye.current?.focus()})},children:`Cancel check`})]},e.id))]}),!$&&(0,w.jsxs)(`div`,{className:`wb-recovery-actions wb-client-secondary-actions`,children:[(0,w.jsx)(`button`,{ref:Ye,className:`button subtle`,onClick:ta,children:`Copy run summary`}),(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>J(()=>ln(Y.id)),children:`Refresh task status`})]}),!$&&ea]}),!Y.revisionId&&aa,ci&&(0,w.jsx)(`p`,{className:`wb-archive-note`,children:`Saved history from the earlier workflow. Samples and recorded acceptance do not prove AI generation or application. Start a new revision to use the connected model and current Apply flow.`}),si&&!(Z?.proposal||pi)&&(0,w.jsxs)(`div`,{className:`wb-application page-reveal page-reveal--content`,children:[ii.error&&(0,w.jsx)(`p`,{role:`status`,children:ii.error}),ii.recoveryAvailable&&(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>wi(),children:`Undo these changes`}),(0,w.jsxs)(`details`,{children:[(0,w.jsxs)(`summary`,{ref:tt,children:[`Applied files · `,ii.files.length]}),(0,w.jsx)(`ul`,{children:ii.files.map(e=>(0,w.jsxs)(`li`,{children:[e.path,` `,(0,w.jsx)(`span`,{children:e.status.replaceAll(`-`,` `)}),e.writeId&&(e.status===`applied`||e.status===`conflict`)&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-label":`Undo change to ${e.path}`,disabled:H,onClick:()=>wi(e.writeId),children:`Undo file`}),e.error&&(0,w.jsx)(`p`,{children:e.error})]},e.path))})]})]}),(Z?.proposal||pi)&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Ft,{runId:Y?.id,tab:de,onTabChange:e=>{K(e),Ie(!1)},panelRef:nt,reviewFileCount:_i,content:Z,receipt:ii,conflict:!!vi,frameUrl:mi,beforeFrameUrl:ge,afterFrameUrl:ye||me,compareMode:Te,onCompareMode:e=>void J(()=>$r(e)),checkedBatch:pi,previewFullscreen:Fe,onToggleFullscreen:()=>Ie(e=>!e),variant:je,busy:H,onPreviewVariant:e=>J(()=>Qr(e)),previewSize:Ne,onPreviewSize:Pe,previewLoading:Ue,onPreviewLoad:()=>We(!1),checking:Q?.stage===`checking`,canPreview:bi||pi,onOpenPreview:()=>J(()=>pi?ei():Qr(`after`)),canEnablePreview:!en&&oi,liveBlocked:!!($&&$.state===`blocked`&&ii?.status===`applied`),liveBlockedReason:Q?.error,repairHints:$i,dependenciesMissing:X?.dependencies?.installed===!1,installingDeps:pr,onRecheckLive:()=>void vn(Y.id),onInstallAndRecheck:Y.project?()=>void Ur(Y.project,Y.id):void 0,onEnablePreview:()=>J(async()=>{let e=await d(`/api/workspace/${Y.id}/enable-preview`,{approved:!0});Xt.current===Y.id&&(Ot(t=>({...t,workspace:e.workspace})),await ln(Y.id))}),checks:Hi,qaSignals:Gi,interactionSteps:Q?.layout?.preservation?.interactionSteps,landmarks:Q?.layout?.landmarks,onExportReport:()=>void mn(Y.id),onStartFreshRevision:()=>na(!0),onFixFinding:ra,mustPreserve:Y.mustPreserve,actionBar:oi&&!si&&!ci&&!vi?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:H||en||!zt,onClick:()=>J(async()=>{if(!zt)return;let e;try{e=await d(`/api/applications/apply`,{runId:Y.id,revisionId:Y.revisionId,changeSetHash:zt.changeSetHash,approved:!0})}catch(e){if(!cn(Y.id,e))throw e;return}Xt.current===Y.id&&(Ut(t=>[e,...t]),await ln(Y.id),await an())}),children:[`Apply `,zt?.changes.length??``,` `,zt?.changes.length===1?`file`:`files`]}),!en&&Y.revisionId&&Q&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-request-changes`,onClick:()=>na(),children:`Request changes`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H||en,onClick:()=>J(async()=>{await d(`/api/runs/${Y.id}/decision`,{revisionId:Y.revisionId,decision:`rejected`,reason:`Discarded from Studio review.`}),await ln(Y.id)}),children:`Discard`})]}):si&&ii?.recoveryAvailable?(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>wi(),children:`Undo these changes`}):null,diagnosticsContent:(0,w.jsxs)(`div`,{className:`wb-diagnostics-tab-body`,children:[si&&ii&&(0,w.jsxs)(`section`,{className:`wb-review-detail-block`,children:[(0,w.jsxs)(`h3`,{children:[`Applied files · `,ii.files.length]}),ii.error&&(0,w.jsx)(`p`,{role:`status`,children:ii.error}),(0,w.jsx)(`ul`,{className:`wb-applied-files-list`,children:ii.files.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`code`,{translate:`no`,children:e.path}),` `,(0,w.jsx)(`span`,{children:e.status.replaceAll(`-`,` `)}),e.writeId&&(e.status===`applied`||e.status===`conflict`)&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-label":`Undo change to ${e.path}`,disabled:H,onClick:()=>wi(e.writeId),children:`Undo file`}),e.error&&(0,w.jsx)(`p`,{children:e.error})]},e.path))})]}),aa,Z?.modelNotes&&Object.values(Z.modelNotes).some(e=>e.length>0)&&(0,w.jsxs)(`details`,{className:`wb-export`,children:[(0,w.jsx)(`summary`,{children:`Model notes & uncertainties`}),[{key:`assumptions`,label:`Assumptions`},{key:`uncertainties`,label:`Uncertainties`},{key:`checksNotRun`,label:`Checks the model did not run`}].map(({key:e,label:t})=>Z.modelNotes[e]?.length?(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`h3`,{children:t}),(0,w.jsx)(`ul`,{children:Z.modelNotes[e].map((e,t)=>(0,w.jsx)(`li`,{children:e},t))})]},e):null)]}),(0,w.jsxs)(`div`,{className:`wb-export-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>J(()=>f(Y.id,`patch`)),children:`Download patch`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>J(()=>f(Y.id,`review`)),children:`Download review zip`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void _n(Y.id),children:`Export git branch`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void hn(Y.id),children:`Diagnostic export (redacted)`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-export`,children:[(0,w.jsx)(`label`,{htmlFor:`review-branch-name`,className:`field-help`,children:`Optional review branch name (leaves your checked-out working tree untouched)`}),(0,w.jsx)(`input`,{id:`review-branch-name`,value:Jt,onChange:e=>Yt(e.target.value),placeholder:`review/studio-${Y.id.slice(0,8)}`}),qt&&(0,w.jsxs)(`p`,{className:`field-help`,children:[`Branch `,(0,w.jsx)(`code`,{children:qt.branchName}),` created at`,` `,(0,w.jsx)(`code`,{children:qt.commitSha.slice(0,8)}),` (`,qt.fileCount,` files staged; HEAD unchanged).`]})]}),Bi,(0,w.jsxs)(`p`,{className:`field-help`,children:[`Run `,(0,w.jsx)(`code`,{children:Y.id}),` · `,Y.status,` · settled usage`,` `,X?.attempt?.usage?.costUsd==null?`Unavailable`:O(X.attempt.usage.costUsd),X?.attempt?.usage?.cachedTokens==null?``:` · ${X.attempt.usage.cachedTokens.toLocaleString()} cached input tokens`]})]})})}),!en&&Q&&!ci&&(0,w.jsxs)(`section`,{className:`wb-chatbox`,"aria-label":`Follow-up prompt`,children:[(0,w.jsxs)(`div`,{className:`wb-chatbox-head`,children:[(0,w.jsxs)(`div`,{className:`wb-chatbox-title-row`,children:[(0,w.jsx)(`h2`,{children:`Continue`}),qi.length>0?(0,w.jsxs)(`span`,{className:`wb-chatbox-status`,children:[qi.length,` `,qi.length===1?`AI client`:`AI clients`,` ready`]}):Ri?(0,w.jsxs)(`span`,{className:`wb-chatbox-status`,children:[zi(li?.providerId),` · `,li?.model]}):(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-chatbox-connect`,onClick:()=>Rr({runId:Y.id,project:Y.project}),children:`Connect model or AI client`})]}),(0,w.jsxs)(`div`,{className:`wb-chatbox-mode`,role:`group`,"aria-label":`Follow-up mode`,children:[(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-mode-pill`,"aria-pressed":ze===`auto`,onClick:()=>Be(`auto`),children:`Auto`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-mode-pill`,"aria-pressed":ze===`mcp`,onClick:()=>Be(`mcp`),children:`AI client`})]})]}),(Q.reviewFeedback||Z?.proposal)&&(0,w.jsxs)(`div`,{className:`wb-chatbox-context`,"aria-label":`Revision context`,children:[Z?.proposal&&(0,w.jsxs)(`span`,{className:`wb-chat-context-pill`,children:[si?`Applied`:$?.state===`passed`?`Batch ${$.batch}`:`Draft`,`: `,Z.proposal.changes.length,` `,Z.proposal.changes.length===1?`file`:`files`,` —`,` `,Z.proposal.summary]}),Q.reviewFeedback&&(0,w.jsxs)(`span`,{className:`wb-chat-context-pill`,children:[`Last follow-up: `,Q.reviewFeedback]})]}),(0,w.jsxs)(`div`,{className:`wb-chatbox-chips`,"aria-label":`Quick follow-up prompts`,children:[$i.length>0&&(0,w.jsxs)(`button`,{type:`button`,className:`wb-chat-chip is-highlight`,onClick:()=>ra(`Fix these ${$i.length} audit issue${$i.length===1?``:`s`}:\n`+$i.slice(0,6).map((e,t)=>`${t+1}. [${e.code}] ${e.path?`${e.path}${e.line?`:${e.line}`:``} — `:``}${e.hint}`).join(`
|
|
54
|
-
`)),children:[`Fix
|
|
55
|
-
`)[0]?.trim()||St.title||St.requestKey}),(0,w.jsx)(`span`,{children:St.title||`Project`})]}),(0,w.jsx)(`p`,{id:`wb-confirm-delete-desc`,className:`field-help`,children:`Local revision snapshots and recovery receipts are preserved on this machine so any applied changes can still be undone.`}),(0,w.jsxs)(`div`,{className:`wb-confirm-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,autoFocus:!0,disabled:ht!==null,onClick:()=>Ct(null),children:`Cancel`}),(0,w.jsx)(`button`,{type:`button`,className:`button wb-danger-button`,disabled:ht!==null,onClick:()=>void on(St.id),children:ht===St.id?`Deleting…`:`Delete chat`})]})]})}),y&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Mt,{open:y,auth:_,onClose:()=>b(!1),onUpdated:
|
|
52
|
+
Build/work intent:`)[0];pn(),c(`mcp`),at({...vt,project:Y.project,brief:e,preserve:Y.mustPreserve.join(`
|
|
53
|
+
`)})},children:`Prepare in MCP instead`}),(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Saved brief, decisions and progress`}),[[`Brief and decisions`,X.recovery.briefSavedAt],[`Model-reported task plan`,X.task?.plan?.at],[`Private conversation checkpoint`,X.recovery.checkpointSavedAt],[`Validated draft`,X.recovery.draftSavedAt]].map(([e,t])=>typeof t==`number`&&(0,w.jsxs)(`p`,{children:[e,` saved`,` `,(0,w.jsx)(`time`,{dateTime:new Date(t).toISOString(),children:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}).format(t)})]},e)),(0,w.jsx)(`p`,{children:Y.brief}),Y.mustPreserve.map((e,t)=>(0,w.jsxs)(`p`,{children:[`Keep working · `,e]},t))]}),(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:ia,children:`Copy run handoff`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void hn(Y.id),children:`Diagnostic export (redacted)`})]}),ra,Ui,W?.runId===Y.id&&(0,w.jsxs)(`section`,{className:`wb-continuation-consent`,"aria-label":W.approvalHash?`Fresh attempt consent`:`Continuation consent`,children:[(0,w.jsx)(`h3`,{ref:et,tabIndex:-1,children:W.approvalHash?`Approve a fresh attempt`:`Approve another provider request`}),(0,w.jsxs)(`p`,{children:[W.approvalHash?`Send the saved brief, decisions and selected source context to `:`Send this project’s brief, selected context and saved conversation to `,Hi(W.providerId),` · `,W.model,`.`]}),(0,w.jsx)(`p`,{className:`muted`,children:W.destination}),W.paths&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsxs)(`summary`,{children:[`Source scope · `,W.paths.length,` files ·`,` `,W.imageCount,` attached images`]}),(0,w.jsx)(`p`,{children:W.project}),W.paths.map(e=>(0,w.jsx)(`p`,{children:e},e))]}),W.providerId===`openrouter`&&(0,w.jsxs)(`p`,{children:[W.requireZdr?`Zero data retention is required for this request.`:`Your provider account’s data-retention policy applies.`,W.requireZeroPrice?` Only zero-priced routes are allowed.`:``]}),(0,w.jsxs)(`p`,{children:[`New allowance: up to `,W.limits.maxModelTurns,` turns,`,` `,W.limits.maxTools,` tools, `,W.limits.timeoutMinutes,` `,`minutes and `,W.maxOutputTokens.toLocaleString(),` output tokens per turn.`,` `,W.limits.maxTotalTokens?`${W.limits.maxTotalTokens.toLocaleString()} total tokens.`:`No additional total-token cap.`,` `,W.billingMode===`free-tier-confirmed`?`Your confirmed ${W.providerId===`groq`?`Groq`:`Google`} free account is required.`:`Budget: ${new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`}).format(W.maxCostUsd)}.`,` `,`Earlier usage stays recorded separately.`]}),(0,w.jsx)(k,{firstEstimate:W.firstRequestEstimate,ceiling:W.configuredRunCeiling??{maxCostUsd:W.maxCostUsd,maxOutputTokens:W.maxOutputTokens,maxModelTurns:W.limits.maxModelTurns,billingMode:W.billingMode},settled:W.settledBilling}),(0,w.jsxs)(`p`,{children:[W.approvalHash?`This starts a new conversation. Studio checks model availability and pricing after approval, before sending project content. `:`Continue from completed tool results. `,W.allowAuthFallback&&`An approved backup connection may be used if authentication fails. `,`Cancellation may not stop upstream billing.`]}),(0,w.jsxs)(`div`,{className:`wb-recovery-actions`,children:[(0,w.jsx)(`button`,{className:`button primary`,disabled:H,onClick:()=>J(async()=>{let e=W.approvalHash;await d(`/api/workspace/${Y.id}/${e?`retry`:`continue`}`,e?{approvalHash:e,approved:!0}:{consentId:W.consentId,approved:!0}),G(null),await ln(Y.id)}),children:W.approvalHash?`Approve & start fresh attempt`:`Approve & continue task`}),(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>G(null),children:`Keep task stopped`})]})]})]}),(en||Q?.stage===`waiting-client`&&((X?.liveFeed?.length??0)>0||!!X?.draftPreview)||[`failed`,`interrupted`,`cancelled`].includes(Q?.stage??``)&&!Y.revisionId&&!!(X?.attempt?.steps.length||X?.liveFeed?.length))&&(0,w.jsx)(fe,{record:Q,attempt:X?.attempt,liveFeed:X?.liveFeed,draftPreview:X?.draftPreview}),Q?.stage===`waiting-client`&&(!$||!rn||Xi.length>1||Yi.length>0)&&(0,w.jsxs)(`div`,{className:`wb-empty wb-client-handoff`,children:[(0,w.jsxs)(`div`,{className:`wb-client-handoff-heading`,children:[(0,w.jsx)(`span`,{className:`wb-client-handoff-eyebrow`,children:`External MCP client`}),(0,w.jsx)(`h2`,{children:rn?$?`Client connections & draft checks`:`Ready for your AI client`:`Prepare to reconnect`})]}),rn?(0,w.jsxs)(w.Fragment,{children:[!$&&(0,w.jsx)(`p`,{className:`wb-client-handoff-intro`,children:Zi?`Follow the steps below to give your client the right project context and start this task.`:`Connect an AI client with Design access to “${Y.project.split(/[\\/]/).filter(Boolean).at(-1)||`this project`}”. Then copy the task prompt so it knows what to do.`}),Xi.length>1&&Zi&&(0,w.jsx)(pe,{id:`task-client-server`,label:`Design connection`,value:Zi.serverName,onChange:F,options:Xi.map(({clientName:e,serverName:t,taskAccessed:n})=>({label:`${e} (${t})${n?` · opened this task`:``}`,value:t}))}),Xi.length>1&&Zi&&(0,w.jsx)(`p`,{className:`field-help`,children:`Every Design connection for this project can open the task. This choice only changes the server name written into the copied prompt.`}),!$&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`section`,{className:`wb-client-access`,"aria-label":`Client access expiry`,children:[(0,w.jsx)(`span`,{className:`wb-client-access-label`,children:`Temporary access ends`}),(0,w.jsx)(`time`,{dateTime:new Date(rn.expiresAt).toISOString(),children:new Date(rn.expiresAt).toLocaleString()})]}),Zi&&(0,w.jsxs)(`p`,{className:`wb-client-connection-status`,role:`status`,children:[(0,w.jsx)(`span`,{className:`wb-client-status-dot`,"aria-hidden":`true`}),Qi?`Your client has opened this task.`:`Waiting for your client to open this task.`]}),(0,w.jsxs)(`div`,{className:`wb-client-steps`,"aria-label":`Next steps`,children:[(0,w.jsxs)(`section`,{className:`wb-client-step`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`1`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:Zi?`Open your connected client`:`Connect your AI client`}),(0,w.jsx)(`p`,{children:Zi?(0,w.jsxs)(w.Fragment,{children:[`Open `,(0,w.jsx)(`code`,{children:Zi.serverName}),` in your AI client, then reopen the client so it loads the connection.`]}):`Choose a client and grant it Design access to this project.`})]}),(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>Vr({runId:Y.id,project:Y.project}),children:Zi?`Connection settings`:`Connect a client`})]}),(0,w.jsxs)(`section`,{className:`wb-client-step`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`2`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:`Check the Studio tools`}),(0,w.jsxs)(`p`,{children:[`In your client, confirm the `,(0,w.jsx)(`code`,{children:`get_draft_check`}),` tool is available.`]})]})]}),(0,w.jsxs)(`section`,{className:`wb-client-step wb-client-step--last`,children:[(0,w.jsx)(`span`,{className:`wb-client-step-number`,"aria-hidden":`true`,children:`3`}),(0,w.jsxs)(`div`,{className:`wb-client-step-copy`,children:[(0,w.jsx)(`h3`,{children:`Copy and send the task prompt`}),(0,w.jsx)(`p`,{children:`Paste it into your client to provide the run context and instructions.`})]}),Zi&&(0,w.jsx)(`button`,{className:`button primary`,disabled:H,onClick:ta,children:`Copy task prompt`})]})]})]}),!$&&(0,w.jsxs)(`details`,{className:`wb-brief-details`,children:[(0,w.jsx)(`summary`,{children:`Standalone client`}),(0,w.jsxs)(`p`,{children:[`Use this prompt with the standalone server and this run ID (or omit`,` `,(0,w.jsx)(`code`,{children:`runId`}),` to target the latest active run). Draft job recovery requires the attached connection.`]}),(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>J(async()=>{await navigator.clipboard.writeText(`Use the standalone ui-design-workflow tools with runId "${Y.id}". Start with get_run_context({runId, compact:true}). Use get_workflow for detailed guidance and check_color_contrast if changing colors, then validate and submit the proposal for Studio review.${At(Y.brief)}`),V({runId:Y.id,kind:`prompt`})}),children:`Copy standalone prompt`})]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{children:`This task’s access has expired or was revoked. You can reuse your project’s Design connection and confirm fresh access from the composer.`}),(0,w.jsx)(`button`,{className:`button primary`,type:`button`,onClick:()=>aa(!0),children:`Prepare a fresh client task`})]}),Yi.length>0&&(0,w.jsxs)(`div`,{"aria-label":`Draft checks`,role:`region`,children:[(0,w.jsx)(`h3`,{children:`Draft checks`}),Yi.map(e=>(0,w.jsxs)(`p`,{className:`wb-draft-check-row`,children:[(0,w.jsxs)(`span`,{role:`status`,children:[`Draft check `,e.id.slice(0,8),` · `,e.status]}),[`queued`,`running`].includes(e.status)&&(0,w.jsx)(`button`,{className:`text-button`,disabled:H,"aria-label":`Cancel draft check ${e.id.slice(0,8)}`,onClick:t=>{let n=t.currentTarget,r=document.activeElement===n;J(async()=>{await d(`/api/workspace/${Y.id}/draft-checks/${e.id}/cancel`,{}),await ln(Y.id),r&&Xt.current===Y.id&&(document.activeElement===n||document.activeElement===document.body)&&Ye.current?.focus()})},children:`Cancel check`})]},e.id))]}),!$&&(0,w.jsxs)(`div`,{className:`wb-recovery-actions wb-client-secondary-actions`,children:[(0,w.jsx)(`button`,{ref:Ye,className:`button subtle`,onClick:ia,children:`Copy run summary`}),(0,w.jsx)(`button`,{className:`button subtle`,onClick:()=>J(()=>ln(Y.id)),children:`Refresh task status`})]}),!$&&ra]}),!Y.revisionId&&ca,di&&(0,w.jsx)(`p`,{className:`wb-archive-note`,children:`Saved history from the earlier workflow. Samples and recorded acceptance do not prove AI generation or application. Start a new revision to use the connected model and current Apply flow.`}),ui&&!(Z?.proposal||gi)&&(0,w.jsxs)(`div`,{className:`wb-application page-reveal page-reveal--content`,children:[si.error&&(0,w.jsx)(`p`,{role:`status`,children:si.error}),si.recoveryAvailable&&(0,w.jsx)(`button`,{className:`button subtle`,disabled:H,onClick:()=>Di(),children:`Undo these changes`}),(0,w.jsxs)(`details`,{children:[(0,w.jsxs)(`summary`,{ref:tt,children:[`Applied files · `,si.files.length]}),(0,w.jsx)(`ul`,{children:si.files.map(e=>(0,w.jsxs)(`li`,{children:[e.path,` `,(0,w.jsx)(`span`,{children:e.status.replaceAll(`-`,` `)}),e.writeId&&(e.status===`applied`||e.status===`conflict`)&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-label":`Undo change to ${e.path}`,disabled:H,onClick:()=>Di(e.writeId),children:`Undo file`}),e.error&&(0,w.jsx)(`p`,{children:e.error})]},e.path))})]})]}),(Z?.proposal||gi)&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Ft,{runId:Y?.id,tab:de,onTabChange:e=>{K(e),Ie(!1)},panelRef:nt,reviewFileCount:bi,content:Z,receipt:si,conflict:!!xi,frameUrl:_i,beforeFrameUrl:ge,afterFrameUrl:ye||me,compareMode:Te,onCompareMode:e=>void J(()=>ni(e)),checkedBatch:gi,previewFullscreen:Fe,onToggleFullscreen:()=>Ie(e=>!e),variant:je,busy:H,onPreviewVariant:e=>J(()=>ti(e)),previewSize:Ne,onPreviewSize:Pe,previewLoading:Ue,onPreviewLoad:()=>We(!1),checking:Q?.stage===`checking`,canPreview:Ci||gi,onOpenPreview:()=>J(()=>gi?ri():ti(`after`)),canEnablePreview:!en&&li,liveBlocked:!!($&&$.state===`blocked`&&si?.status===`applied`),liveBlockedReason:Q?.error,repairHints:na,dependenciesMissing:X?.dependencies?.installed===!1,installingDeps:hr,onRecheckLive:()=>void vn(Y.id),onInstallAndRecheck:Y.project?()=>void Kr(Y.project,Y.id):void 0,onEnablePreview:()=>J(async()=>{let e=await d(`/api/workspace/${Y.id}/enable-preview`,{approved:!0});Xt.current===Y.id&&(Ot(t=>({...t,workspace:e.workspace})),await ln(Y.id))}),checks:Gi,qaSignals:Ji,interactionSteps:Q?.layout?.preservation?.interactionSteps,landmarks:Q?.layout?.landmarks,onExportReport:()=>void mn(Y.id),onStartFreshRevision:()=>aa(!0),onFixFinding:oa,mustPreserve:Y.mustPreserve,actionBar:li&&!ui&&!di&&!xi?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:H||en||!zt,onClick:()=>J(async()=>{if(!zt)return;let e;try{e=await d(`/api/applications/apply`,{runId:Y.id,revisionId:Y.revisionId,changeSetHash:zt.changeSetHash,approved:!0})}catch(e){if(!cn(Y.id,e))throw e;return}Xt.current===Y.id&&(Ut(t=>[e,...t]),await ln(Y.id),await an())}),children:[`Apply `,zt?.changes.length??``,` `,zt?.changes.length===1?`file`:`files`]}),!en&&Y.revisionId&&Q&&(0,w.jsx)(`button`,{type:`button`,className:`button subtle wb-request-changes`,onClick:()=>aa(),children:`Request changes`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H||en,onClick:()=>J(async()=>{await d(`/api/runs/${Y.id}/decision`,{revisionId:Y.revisionId,decision:`rejected`,reason:`Discarded from Studio review.`}),await ln(Y.id)}),children:`Discard`})]}):ui&&si?.recoveryAvailable?(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>Di(),children:`Undo these changes`}):null,diagnosticsContent:(0,w.jsxs)(`div`,{className:`wb-diagnostics-tab-body`,children:[ui&&si&&(0,w.jsxs)(`section`,{className:`wb-review-detail-block`,children:[(0,w.jsxs)(`h3`,{children:[`Applied files · `,si.files.length]}),si.error&&(0,w.jsx)(`p`,{role:`status`,children:si.error}),(0,w.jsx)(`ul`,{className:`wb-applied-files-list`,children:si.files.map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`code`,{translate:`no`,children:e.path}),` `,(0,w.jsx)(`span`,{children:e.status.replaceAll(`-`,` `)}),e.writeId&&(e.status===`applied`||e.status===`conflict`)&&(0,w.jsx)(`button`,{type:`button`,className:`text-button`,"aria-label":`Undo change to ${e.path}`,disabled:H,onClick:()=>Di(e.writeId),children:`Undo file`}),e.error&&(0,w.jsx)(`p`,{children:e.error})]},e.path))})]}),ca,Z?.modelNotes&&Object.values(Z.modelNotes).some(e=>e.length>0)&&(0,w.jsxs)(`details`,{className:`wb-export`,children:[(0,w.jsx)(`summary`,{children:`Model notes & uncertainties`}),[{key:`assumptions`,label:`Assumptions`},{key:`uncertainties`,label:`Uncertainties`},{key:`checksNotRun`,label:`Checks the model did not run`}].map(({key:e,label:t})=>Z.modelNotes[e]?.length?(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`h3`,{children:t}),(0,w.jsx)(`ul`,{children:Z.modelNotes[e].map((e,t)=>(0,w.jsx)(`li`,{children:e},t))})]},e):null)]}),(0,w.jsxs)(`div`,{className:`wb-export-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>J(()=>f(Y.id,`patch`)),children:`Download patch`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,onClick:()=>J(()=>f(Y.id,`review`)),children:`Download review zip`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void _n(Y.id),children:`Export git branch`}),(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,disabled:H,onClick:()=>void hn(Y.id),children:`Diagnostic export (redacted)`})]}),(0,w.jsxs)(`div`,{className:`wb-branch-export`,children:[(0,w.jsx)(`label`,{htmlFor:`review-branch-name`,className:`field-help`,children:`Optional review branch name (leaves your checked-out working tree untouched)`}),(0,w.jsx)(`input`,{id:`review-branch-name`,value:Jt,onChange:e=>Yt(e.target.value),placeholder:`review/studio-${Y.id.slice(0,8)}`}),qt&&(0,w.jsxs)(`p`,{className:`field-help`,children:[`Branch `,(0,w.jsx)(`code`,{children:qt.branchName}),` created at`,` `,(0,w.jsx)(`code`,{children:qt.commitSha.slice(0,8)}),` (`,qt.fileCount,` files staged; HEAD unchanged).`]})]}),Ui,(0,w.jsxs)(`p`,{className:`field-help`,children:[`Run `,(0,w.jsx)(`code`,{children:Y.id}),` · `,Y.status,` · settled usage`,` `,X?.attempt?.usage?.costUsd==null?`Unavailable`:O(X.attempt.usage.costUsd),X?.attempt?.usage?.cachedTokens==null?``:` · ${X.attempt.usage.cachedTokens.toLocaleString()} cached input tokens`]})]})})}),!en&&Q&&!di&&(0,w.jsxs)(`section`,{className:`wb-chatbox`,"aria-label":`Follow-up prompt`,children:[(0,w.jsxs)(`div`,{className:`wb-chatbox-head`,children:[(0,w.jsxs)(`div`,{className:`wb-chatbox-title-row`,children:[(0,w.jsx)(`h2`,{children:`Continue`}),Xi.length>0?(0,w.jsxs)(`span`,{className:`wb-chatbox-status`,children:[Xi.length,` `,Xi.length===1?`AI client`:`AI clients`,` ready`]}):Vi?(0,w.jsxs)(`span`,{className:`wb-chatbox-status`,children:[Hi(fi?.providerId),` · `,fi?.model]}):(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-chatbox-connect`,onClick:()=>Vr({runId:Y.id,project:Y.project}),children:`Connect model or AI client`})]}),(0,w.jsxs)(`div`,{className:`wb-chatbox-mode`,role:`group`,"aria-label":`Follow-up mode`,children:[(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-mode-pill`,"aria-pressed":ze===`auto`,onClick:()=>Be(`auto`),children:`Auto`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-mode-pill`,"aria-pressed":ze===`mcp`,onClick:()=>Be(`mcp`),children:`AI client`})]})]}),(Q.reviewFeedback||Z?.proposal)&&(0,w.jsxs)(`div`,{className:`wb-chatbox-context`,"aria-label":`Revision context`,children:[Z?.proposal&&(0,w.jsxs)(`span`,{className:`wb-chat-context-pill`,children:[ui?`Applied`:$?.state===`passed`?`Batch ${$.batch}`:`Draft`,`: `,Z.proposal.changes.length,` `,Z.proposal.changes.length===1?`file`:`files`,` —`,` `,Z.proposal.summary]}),Q.reviewFeedback&&(0,w.jsxs)(`span`,{className:`wb-chat-context-pill`,children:[`Last follow-up: `,Q.reviewFeedback]})]}),(0,w.jsxs)(`div`,{className:`wb-chatbox-chips`,"aria-label":`Quick follow-up prompts`,children:[na.length>0&&(0,w.jsxs)(`button`,{type:`button`,className:`wb-chat-chip is-highlight`,onClick:()=>oa(`Fix these ${na.length} audit issue${na.length===1?``:`s`}:\n`+na.slice(0,6).map((e,t)=>`${t+1}. [${e.code}] ${e.path?`${e.path}${e.line?`:${e.line}`:``} — `:``}${e.hint}`).join(`
|
|
54
|
+
`)),children:[`Fix `,na.length,` `,na.length===1?`issue`:`issues`]}),Si&&(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-chip`,onClick:()=>oa(`Re-apply the same design direction cleanly on top of the current project files.`),children:`Re-run on current files`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-chip`,onClick:()=>oa(`Polish mobile responsiveness at 390px: prevent horizontal overflow, improve tap targets, and keep spacing clean.`),children:`Polish mobile`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-chip`,onClick:()=>oa(`Audit and strengthen text contrast, focus rings, and dark/light parity across all interactive controls.`),children:`Improve contrast & focus`}),(0,w.jsx)(`button`,{type:`button`,className:`wb-chat-chip`,onClick:()=>oa(`Tighten visual hierarchy, spacing rhythm, and typography alignment while keeping all existing behaviors intact.`),children:`Tighten spacing`})]}),(0,w.jsxs)(`form`,{className:`wb-chatbox-form`,onSubmit:sa,children:[(0,w.jsx)(`label`,{className:`sr-only`,htmlFor:`wb-chat-input`,children:`Follow-up prompt`}),(0,w.jsx)(`textarea`,{id:`wb-chat-input`,rows:2,value:Le,disabled:H,onChange:e=>Re(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&Le.trim()&&(e.preventDefault(),sa())},placeholder:Y.revisionId?`Ask for tweaks, fixes, or the next pass… (Ctrl+Enter to send)`:`Send the next instruction for this project… (Ctrl+Enter to send)`}),(0,w.jsxs)(`div`,{className:`wb-chatbox-actions`,children:[(0,w.jsx)(`button`,{type:`submit`,className:`button primary`,disabled:H||!Le.trim(),children:`Send`}),(0,w.jsxs)(`span`,{className:`wb-chat-kbd-hint`,"aria-hidden":`true`,children:[(0,w.jsx)(`kbd`,{children:`Ctrl`}),`+`,(0,w.jsx)(`kbd`,{children:`Enter`})]}),Y.revisionId&&(0,w.jsx)(`button`,{type:`button`,className:`text-button wb-chat-edit-brief`,onClick:()=>aa(),children:`Edit full brief`})]})]})]}),!en&&Q?.stage===`failed`&&(0,w.jsx)(`button`,{className:`button primary`,onClick:pn,children:`Return to brief`})]}),(0,w.jsx)(Lt,{motion:Dn&&jn},h===`workspace`?Y?`workspace:run:${Y.id}`:`workspace:compose`:h)]}),x&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(jt,{project:Y?.project,inspection:Xn?.project===e.project.trim()?Xn:null,theme:xn,onTheme:Sn,contrast:Cn,onContrast:wn,textScale:Tn,onTextScale:En,motion:Dn,onMotion:On,hoverEffects:kn,onHoverEffects:An,pageTransitions:jn,onPageTransitions:Mn,backdrop:Pn,onBackdrop:Fn,accent:In,onAccent:Ln,customAccent:Rn,onCustomAccent:zn,customHighlight:Bn,onCustomHighlight:Vn,typography:Hn,onTypography:Un,onResetAppearance:()=>{Wn(),R({kind:`info`,text:`Appearance reset to defaults.`})},execution:s,onExecution:c,allowCreate:e.allowCreate,onAllowCreate:e=>at({allowCreate:e}),defaultCompareMode:xe,onDefaultCompareMode:e=>{Se(e),Y||De(e)},defaultPreviewSize:Ce,onDefaultPreviewSize:e=>{we(e),Y||Pe(e)},hasSavedDraft:Lr,onClearSavedDraft:Rr,connected:Ve,connectionsSummary:{modelKeys:a?.keys.length??0,activeModel:fi?.model??``,activeProvider:fi?.providerId?Hi(fi.providerId):``},auth:_,onOpenAccount:()=>b(!0),onSignOut:Ur,onClose:Xr,onConnections:e=>Vr(void 0,e),onWorkflow:en||H?void 0:e=>{Gr(e),Xr()},onPilot:oi?()=>{pn(),Sr.current++,wr(oi),Zn(null),S(!1),Tr(oi).catch(e=>R({kind:`error`,text:e.message}))}:void 0})})]})]}),St&&(0,w.jsx)(`div`,{className:`wb-confirm-backdrop`,role:`presentation`,onClick:e=>{e.target===e.currentTarget&&!ht&&Ct(null)},children:(0,w.jsxs)(`section`,{className:`wb-confirm-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`wb-confirm-delete-title`,"aria-describedby":`wb-confirm-delete-desc`,onKeyDown:e=>{e.key===`Escape`&&!ht&&Ct(null)},children:[(0,w.jsx)(`h2`,{id:`wb-confirm-delete-title`,children:`Delete this chat from History?`}),(0,w.jsxs)(`p`,{className:`wb-confirm-target`,children:[(0,w.jsx)(`strong`,{children:St.brief?.split(`
|
|
55
|
+
`)[0]?.trim()||St.title||St.requestKey}),(0,w.jsx)(`span`,{children:St.title||`Project`})]}),(0,w.jsx)(`p`,{id:`wb-confirm-delete-desc`,className:`field-help`,children:`Local revision snapshots and recovery receipts are preserved on this machine so any applied changes can still be undone.`}),(0,w.jsxs)(`div`,{className:`wb-confirm-actions`,children:[(0,w.jsx)(`button`,{type:`button`,className:`button subtle`,autoFocus:!0,disabled:ht!==null,onClick:()=>Ct(null),children:`Cancel`}),(0,w.jsx)(`button`,{type:`button`,className:`button wb-danger-button`,disabled:ht!==null,onClick:()=>void on(St.id),children:ht===St.id?`Deleting…`:`Delete chat`})]})]})}),y&&(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Mt,{open:y,auth:_,onClose:()=>b(!1),onUpdated:Hr})})]})}var Rt=(0,i.lazy)(()=>Ot(()=>import(`./Diagnostics-CuRX-uAp.js`),__vite__mapDeps([15,1,2,0,3,4,5,6,16])));document.title=`${D.productTitle} — Local Workspace`;var zt=`studio-chunk-reload-ts`;function Bt(){try{let e=Number(sessionStorage.getItem(zt)||`0`);if(Date.now()-e<15e3)return;sessionStorage.setItem(zt,String(Date.now()))}catch{}window.location.reload()}window.addEventListener(`vite:preloadError`,e=>{e.preventDefault(),Bt()}),window.addEventListener(`unhandledrejection`,e=>{let t=String(e.reason?.message??e.reason??``);/Failed to fetch dynamically imported module|Importing a module script failed/i.test(t)&&(e.preventDefault(),Bt())}),U(),(0,a.createRoot)(document.getElementById(`root`)).render(new URL(location.href).searchParams.has(`diagnostics`)?(0,w.jsx)(i.Suspense,{fallback:(0,w.jsx)(`p`,{children:`Opening diagnostics…`}),children:(0,w.jsx)(Rt,{})}):(0,w.jsx)(Z,{}));export{m as _,We as a,pe as c,ee as d,T as f,p as g,f as h,Le as i,j as l,u as m,mt as n,Fe as o,d as p,ze as r,Ne as s,gt as t,A as u};
|