@codeyam-editor/codeyam-editor 0.1.6 → 0.1.8
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/npm/cloud.js +308 -52
- package/npm/compose-conflict.js +59 -0
- package/npm/fleet-add-failure.js +174 -18
- package/npm/fleet-cleanup.js +129 -0
- package/npm/fleet-job-badge.js +28 -12
- package/npm/fleet-memory.js +73 -4
- package/npm/fleet-probe-transport.js +155 -0
- package/npm/fleet-queue.js +141 -0
- package/npm/fleet-revision.js +104 -0
- package/npm/fleet-running-plan.js +37 -7
- package/npm/fleet-vm-access.js +162 -0
- package/npm/ingress-invoke.js +46 -2
- package/npm/launch-config.js +163 -4
- package/npm/scenario-check.js +63 -19
- package/npm/scenario-handlers.js +18 -0
- package/npm/scenario-issues.js +11 -0
- package/npm/scenario-mocks.js +245 -39
- package/npm/scenario-playwright.js +114 -22
- package/package.json +5 -5
- package/ui/dist/assets/{ContainerInspector-DgM0pTAx.js → ContainerInspector-DSVZvEkB.js} +1 -1
- package/ui/dist/assets/EditorShell-DnXdHrar.js +256 -0
- package/ui/dist/assets/EditorShell-FvbXyqqD.css +1 -0
- package/ui/dist/assets/ProjectLauncherScreen-E0NYYiwy.js +1 -0
- package/ui/dist/assets/ScenarioDataPanel-6qJE-0lA.js +15 -0
- package/ui/dist/assets/{ScenarioDataPanelFullPage-BLqRCxQX.js → ScenarioDataPanelFullPage-Cyk6efiI.js} +1 -1
- package/ui/dist/assets/ScenarioRenderer-Uyt54vHI.js +21 -0
- package/ui/dist/assets/{index-DCHqRrwO.js → index-BPLKgwon.js} +9 -9
- package/ui/dist/assets/index-DKpgJLo3.css +1 -0
- package/ui/dist/assets/useServerIdentity-CVuHTzjg.js +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/EditorShell-B7Q06uJ_.js +0 -252
- package/ui/dist/assets/EditorShell-DP5UY20G.css +0 -1
- package/ui/dist/assets/ProjectLauncherScreen-BRrEr8Ng.js +0 -1
- package/ui/dist/assets/ScenarioDataPanel-BeQfa28g.js +0 -9
- package/ui/dist/assets/ScenarioRenderer-CIAxfHPh.js +0 -21
- package/ui/dist/assets/index-BygCiJSb.css +0 -1
- package/ui/dist/assets/useServerIdentity-B7rI0u3O.js +0 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
var Ew=Object.defineProperty;var Mw=(t,n,s)=>n in t?Ew(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var At=(t,n,s)=>Mw(t,typeof n!="symbol"?n+"":n,s);import{j as e}from"./markdown-C9tbsVHX.js";import{b as l,c as bn,R as st}from"./react-nrLBr15I.js";import{i as To,n as Oo,a as wt,r as Iw,b as _r,c as pa,d as ma,s as Dw}from"./useEvents-S3Qk1Y_d.js";import{q as kr,S as Lw,bj as _t,bk as at,aj as wn,bl as Fw,bm as zw,bn as dr,bo as $w,bp as gd,bq as Ia,br as Da,bs as bd,u as Bw,bt as Ao,bu as Ro,bv as Eo,bw as Mo,bx as qw,by as $l,ae as Hw,bz as Ww,bA as Gw,bB as Uw,bC as Yw,bD as Io,bE as Vw,af as Kw,bF as Jw,bG as Bl,bH as Xw,f as La,bI as Qw,e as Do,bJ as xd,bK as Zw,bL as e_,i as t_,bM as ql,bN as n_,bO as s_,ak as r_,ai as a_,bP as o_,bQ as i_,bR as l_,A as c_,bS as d_}from"./ScenarioDataPanel-6qJE-0lA.js";import{e as u_,a as h_,i as yd,g as Lo,d as p_,l as se,p as Dn,t as m_,P as xn,u as f_}from"./index-BPLKgwon.js";import{C as Qe,c as Fo,a as Ze,u as zo,d as g_}from"./useServerIdentity-CVuHTzjg.js";import{M as Ht}from"./Markdown-Chgdf3PW.js";function vd({onDismiss:t}){return e.jsx(kr,{severity:"warning",testId:"preview-dedicated-origin-notice",className:"flex w-full flex-col gap-3 border-b border-l-4 px-4 py-3 text-sm",headline:"No dedicated preview origin is provisioned",explanation:"This app is set to preview from its own origin, but this host has none that your browser can reach — so the preview is still being served from the /__codeyam_preview subpath. It works, but deep links and reloads may mis-route.",nextAction:"Not something you can change from here: a dedicated preview host has to be provisioned for this machine — a preview subdomain alongside the editor's — and the preview will move to it on its own. Copy this report and send it to whoever set the machine up.",actions:[{label:"Dismiss",onClick:t,variant:"secondary",ariaLabel:"Dismiss preview origin notice",testId:"preview-dedicated-origin-notice-dismiss"}]})}const $6=Object.freeze(Object.defineProperty({__proto__:null,PreviewDedicatedOriginNotice:vd},Symbol.toStringTag,{value:"Module"}));function jd({restartCount:t}){return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-bold text-primary",children:t>0?`#${t}`:""})]})}const B6=Object.freeze(Object.defineProperty({__proto__:null,RestartSpinner:jd},Symbol.toStringTag,{value:"Module"}));function wd({title:t,body:n,spinner:s,restartCount:r,variant:a}){return e.jsx("div",{"data-testid":"preview-unhealthy-overlay","data-variant":a,className:"absolute inset-0 bg-white/90 dark:bg-gray-900/90 backdrop-blur-sm flex flex-col items-center justify-center z-50 animate-in fade-in duration-300",children:e.jsxs("div",{className:"flex flex-col items-center space-y-4 text-center max-w-md p-6",children:[s?e.jsx(jd,{restartCount:r}):e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6 text-gray-500 dark:text-gray-400","aria-hidden":"true",children:[e.jsx("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),e.jsx("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:n})]})]})})}const q6=Object.freeze(Object.defineProperty({__proto__:null,PreviewWaitingOverlay:wd},Symbol.toStringTag,{value:"Module"}));function Ue({widthPct:t,heightPx:n,variant:s="surface"}){const r=s==="overlay"?"linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.12) 45%, rgba(255,255,255,0.04) 90%)":"linear-gradient(90deg, var(--bg-surface) 0%, var(--border-default) 45%, var(--bg-surface) 90%)";return e.jsx("div",{style:{width:`${t}%`,height:n,borderRadius:4,background:r,backgroundSize:"200% 100%",animation:"mockup-skeleton-shimmer 1.6s linear infinite",opacity:s==="surface"?.85:1}})}const H6=Object.freeze(Object.defineProperty({__proto__:null,SkeletonBar:Ue},Symbol.toStringTag,{value:"Module"}));function Sr(){return e.jsx("style",{children:`
|
|
2
|
+
@keyframes mockup-skeleton-shimmer {
|
|
3
|
+
0% { background-position: -200% 0; }
|
|
4
|
+
100% { background-position: 200% 0; }
|
|
5
|
+
}
|
|
6
|
+
`})}const W6=Object.freeze(Object.defineProperty({__proto__:null,SkeletonShimmerKeyframes:Sr},Symbol.toStringTag,{value:"Module"}));function _d(){return e.jsx("li",{"aria-hidden":"true",className:"border border-[var(--border-subtle)] rounded-lg bg-[var(--bg-surface,transparent)]",children:e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Ue,{widthPct:42,heightPx:14})}),e.jsx(Ue,{widthPct:6,heightPx:12})]})})}function $o({count:t,testId:n,label:s="Loading plans"}){return e.jsxs(e.Fragment,{children:[e.jsx(Sr,{}),e.jsxs("div",{role:"status","aria-busy":"true",children:[e.jsx("span",{className:"sr-only",children:s}),e.jsx("ul",{className:"mt-3 flex flex-col gap-2","data-testid":n??"plan-row-skeleton-list",children:Array.from({length:Math.max(t,1)},(r,a)=>e.jsx(_d,{},a))})]})]})}const G6=Object.freeze(Object.defineProperty({__proto__:null,PlanRowSkeleton:_d,PlanRowSkeletonList:$o},Symbol.toStringTag,{value:"Module"}));function kd({count:t}){return e.jsx("div",{style:{fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)"},children:t===1?"1 file queued":`${t} files queued`})}const U6=Object.freeze(Object.defineProperty({__proto__:null,PendingFileCountLine:kd},Symbol.toStringTag,{value:"Module"})),b_={webkitdirectory:""};function Sd({folderInputRef:t,onFolderPick:n}){return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:t,type:"file",...b_,onChange:n,style:{display:"none"}}),e.jsx("button",{type:"button",onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},style:{display:"block",marginTop:"var(--spacing-xs, 4px)",marginBottom:"var(--spacing-sm, 8px)",padding:0,fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer",textDecoration:"underline"},children:"or choose a folder"})]})}const Y6=Object.freeze(Object.defineProperty({__proto__:null,ChooseFolderButton:Sd},Symbol.toStringTag,{value:"Module"}));function Nd({value:t}){const[n,s]=l.useState(!1),r=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(t),s(!0),setTimeout(()=>s(!1),2e3)}catch{}};return e.jsx("button",{type:"button",onClick:r,"data-testid":"copy-path-button",title:n?"Copied":`Copy ${t}`,"aria-label":n?"Copied":`Copy ${t}`,className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded border border-[var(--border-default)] bg-[var(--bg-card)] text-[10px] leading-none text-[var(--text-dim)] hover:text-[var(--text-primary)] cursor-pointer transition-colors",children:n?"✓":"⧉"})}const V6=Object.freeze(Object.defineProperty({__proto__:null,CopyPathButton:Nd},Symbol.toStringTag,{value:"Module"}));function Cd({slug:t,count:n,tooltip:s}){return n<=0?null:e.jsxs("span",{"data-testid":`plan-row-blocked-${t}`,title:s,className:"text-[10px] whitespace-nowrap px-1.5 py-0.5 rounded border border-[var(--border-subtle)] text-[var(--text-dim)] inline-flex items-center gap-1",children:["🔒 blocked · ",n," dep",n===1?"":"s"]})}const K6=Object.freeze(Object.defineProperty({__proto__:null,PlanRowBlockedChip:Cd},Symbol.toStringTag,{value:"Module"}));function Bo({children:t,testId:n}){return e.jsx("span",{"data-testid":n,className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border border-[var(--border-default)] bg-[var(--bg-card)] text-[var(--text-dim)]",children:t})}const J6=Object.freeze(Object.defineProperty({__proto__:null,PlanRowTag:Bo},Symbol.toStringTag,{value:"Module"}));function qo({mode:t}){return e.jsx(Bo,{children:t})}const X6=Object.freeze(Object.defineProperty({__proto__:null,PlanModeBadge:qo},Symbol.toStringTag,{value:"Module"}));function Ho({expanded:t,testId:n}){return e.jsx("span",{"aria-hidden":"true","data-testid":n,className:"inline-block shrink-0 text-xs leading-none text-[var(--text-dim)] transition-transform "+(t?"rotate-180":"rotate-0"),children:"⌄"})}const Q6=Object.freeze(Object.defineProperty({__proto__:null,PlanDisclosureChevron:Ho},Symbol.toStringTag,{value:"Module"}));function yn(t,n=Date.now()){if(!t)return"unknown";const s=Date.parse(t);if(Number.isNaN(s))return t;const r=Math.round((n-s)/1e3);if(r<60)return"just now";const a=Math.round(r/60);if(a<60)return`${a}m ago`;const o=Math.round(a/60);return o<24?`${o}h ago`:`${Math.round(o/24)}d ago`}function Wo({title:t,timestamp:n,tone:s="primary"}){return e.jsxs("span",{className:"flex items-baseline gap-2 min-w-0",children:[e.jsx("span",{className:"min-w-0 truncate text-sm "+(s==="muted"?"text-[var(--text-muted)]":"text-[var(--text-primary)]"),children:t}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-dim)] whitespace-nowrap",children:yn(n)})]})}const Z6=Object.freeze(Object.defineProperty({__proto__:null,PlanRowTitleWithAge:Wo},Symbol.toStringTag,{value:"Module"}));function Pd({slug:t,handleRef:n,attributes:s,listeners:r}){return e.jsx("span",{ref:n,"data-testid":`plan-drag-${t}`,"aria-label":"Reorder plan",...s??{},...r??{},onClick:a=>a.stopPropagation(),className:"cursor-grab active:cursor-grabbing text-[var(--text-dim)] select-none leading-none px-1 -ml-1",children:"⋮⋮"})}const eA=Object.freeze(Object.defineProperty({__proto__:null,PlanRowDragHandle:Pd},Symbol.toStringTag,{value:"Module"})),Hl=["#7a4f6d","#4f6a7a","#6d7a4f","#7a5f4f","#5f4f7a","#4f7a63"];function Td(t){const n=t.trim().toLowerCase();let s=0;for(let r=0;r<n.length;r+=1)s=(s+n.charCodeAt(r)*(r+1))%1e5;return Hl[s%Hl.length]}function Go({author:t}){const n=t.email?`${t.name} <${t.email}>`:t.name;return e.jsx("span",{"data-testid":"plan-author-avatar",title:n,"aria-label":`Author: ${n}`,style:{backgroundColor:Td(t.email)},className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[10px] font-medium uppercase tracking-tight text-white/90 select-none",children:t.initials})}const tA=Object.freeze(Object.defineProperty({__proto__:null,PlanAuthorAvatar:Go,avatarTone:Td},Symbol.toStringTag,{value:"Module"}));function ws({title:t,count:n,expanded:s,onToggle:r,testId:a}){return e.jsxs("button",{type:"button",onClick:r,"aria-expanded":s,"data-testid":a,className:"flex w-full items-center gap-2 bg-transparent py-1 text-left cursor-pointer group",children:[e.jsx("span",{"aria-hidden":"true",className:"text-[var(--text-dim)] text-xs leading-none transition-transform group-hover:text-[var(--text-primary)] "+(s?"rotate-0":"-rotate-90"),children:"⌄"}),e.jsx("span",{className:"text-sm text-[var(--text-primary)] "+(s?"font-medium":"font-normal"),children:t}),e.jsxs("span",{className:"text-sm text-[var(--text-dim)]",children:["(",n,")"]})]})}const nA=Object.freeze(Object.defineProperty({__proto__:null,PlanSectionHeader:ws},Symbol.toStringTag,{value:"Module"}));function Od({slug:t,identity:n,step:s,age:r,dead:a}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{"data-testid":`plan-claim-identity-${t}`,children:["claimed by ",n]}),s&&e.jsx("span",{"data-testid":`plan-claim-step-${t}`,children:s}),e.jsxs("span",{"data-testid":`plan-claim-started-${t}`,children:["started ",r]}),a&&e.jsx("span",{className:"text-[var(--text-muted)]",children:"(inactive)"})]})}const sA=Object.freeze(Object.defineProperty({__proto__:null,InFlightPlanRowMeta:Od},Symbol.toStringTag,{value:"Module"}));function Ad({slug:t,title:n,timestamp:s,position:r,author:a,dragHandleRef:o,dragHandleAttributes:i,dragHandleListeners:c}){return e.jsxs(e.Fragment,{children:[o&&e.jsx(Pd,{slug:t,handleRef:o,attributes:i,listeners:c}),typeof r=="number"&&e.jsxs("span",{className:"text-xs text-[var(--text-dim)] tabular-nums min-w-[1.25rem]",children:[r,"."]}),a&&e.jsx(Go,{author:a}),e.jsx("span",{className:"flex-1 min-w-0",children:e.jsx(Wo,{title:n,timestamp:s})})]})}const rA=Object.freeze(Object.defineProperty({__proto__:null,PlanRowIdentity:Ad},Symbol.toStringTag,{value:"Module"}));function Wn(){const[t,n]=l.useState(()=>Date.now());return l.useEffect(()=>{const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[]),t}function Rd(t){return{dead:t.sessionAlive===!1}}function Ed({claim:t,staleFetch:n=!1}){const s=Wn(),{dead:r}=Rd(t),a=t.claimedBy.agentProvider??"agent",o=r?" (inactive)":"",i=yn(t.claimedBy.startedAt,s),c=t.source==="local"?`● this session · started ${i}`:t.source==="same-machine"?`claimed by ${a}@${t.claimedBy.machine} (same machine) · ${i}`:`claimed by ${a}@${t.claimedBy.machine} · ${i}`;return e.jsxs("span",{"data-testid":`plan-row-claim-badge-${t.slug}`,title:`Source: ${t.source}${o}${n?" (data may be stale)":""}`,className:"text-[10px] font-medium whitespace-nowrap px-1.5 py-0.5 rounded border",style:{borderColor:"var(--accent-orange)",backgroundColor:"color-mix(in srgb, var(--accent-orange) 12%, transparent)",color:"var(--text-primary)"},children:[c,o]})}const aA=Object.freeze(Object.defineProperty({__proto__:null,PlanRowClaimBadge:Ed},Symbol.toStringTag,{value:"Module"})),Md="You'll be able to run a plan once the current build finishes.",x_="This plan is waiting on earlier plans that haven't finished yet.",y_="Another session is already working on this plan.";function v_(t){switch(t){case"building":return Md;case"dependencies":return x_;case"claimed":return y_}}function Id({message:t}){return e.jsx("span",{"aria-hidden":"true","data-testid":"plan-run-blocked-tooltip",className:"absolute bottom-full right-0 z-20 mb-2 w-max max-w-[15rem] rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-card)] px-3 py-2 text-left text-[11px] normal-case tracking-normal leading-snug text-[var(--text-secondary)] shadow-lg",children:t})}const oA=Object.freeze(Object.defineProperty({__proto__:null,PlanRunBlockedTooltip:Id},Symbol.toStringTag,{value:"Module"}));function Dd({slug:t,onRun:n,launching:s=!1,blockedReason:r=null}){const a=g=>{g.stopPropagation(),!s&&n(t)},o="text-[10px] uppercase tracking-wide px-2 py-0.5 rounded border cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed transition",i=" border-[var(--accent-primary)] text-[var(--accent-primary)] hover:bg-[var(--accent-primary)] hover:text-[var(--surface-bg)]",c=" border-[var(--border-default)] text-[var(--text-dim)] cursor-not-allowed hover:bg-transparent",d=s,u=r!==null&&!s,[h,p]=l.useState(!1),f=r?v_(r):null,m=u&&h;return e.jsxs("button",{type:"button",onClick:a,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocus:()=>p(!0),onBlur:()=>p(!1),disabled:d,"data-testid":`plan-run-${t}`,"aria-label":u&&f?`Run — ${f}`:void 0,className:"relative "+o+(u?c:i),children:[s?"Launching…":"Run",m&&f?e.jsx(Id,{message:f}):null]})}const iA=Object.freeze(Object.defineProperty({__proto__:null,PlanRunButton:Dd},Symbol.toStringTag,{value:"Module"}));function j_({isAgentBuilding:t=!1,unsatisfiedDepCount:n=0,claim:s}){return t?"building":n>0?"dependencies":s&&s.source!=="local"?"claimed":null}function Ld({slug:t,mode:n,expanded:s,onRun:r,launching:a=!1,blocked:o=!1,unsatisfiedDepCount:i=0,unsatisfiedDepTooltip:c,claim:d,staleFetch:u=!1}){return e.jsxs(e.Fragment,{children:[e.jsx(qo,{mode:n}),e.jsx(Cd,{slug:t,count:i,tooltip:c}),d&&e.jsx(Ed,{claim:d,staleFetch:u}),r&&e.jsx(Dd,{slug:t,onRun:r,launching:a,blockedReason:j_({isAgentBuilding:o,unsatisfiedDepCount:i,claim:d})}),e.jsx(Ho,{expanded:s,testId:`plan-row-chevron-${t}`})]})}const lA=Object.freeze(Object.defineProperty({__proto__:null,PlanRowControls:Ld},Symbol.toStringTag,{value:"Module"}));function Fa({children:t,tone:n,spacing:s="normal",testId:r}){const a=n==="error"?"text-[var(--accent-red)]":"text-[var(--text-muted)]",o=s==="tight"?"mt-2":"mt-3";return e.jsx("p",{"data-testid":r,className:`${o} text-sm ${a}`,children:t})}const cA=Object.freeze(Object.defineProperty({__proto__:null,PlanSectionStatus:Fa},Symbol.toStringTag,{value:"Module"}));function Uo({value:t,onChange:n,testId:s,placeholder:r="Describe the change you want"}){return e.jsx("textarea",{value:t,onChange:a=>n(a.target.value),placeholder:r,rows:4,"data-testid":s,"aria-label":r,className:"mt-4 w-full resize-y rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] px-3 py-2.5 text-sm text-[var(--text-primary)] placeholder:text-[var(--text-dim)] focus:border-[var(--accent-active)] focus:outline-none"})}const dA=Object.freeze(Object.defineProperty({__proto__:null,ChangeDescriptionInput:Uo},Symbol.toStringTag,{value:"Module"})),Yo=e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})}),Fd=e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2.5c.35 3.1.9 5 2 6.1s3 1.65 6.1 2c-3.1.35-5 .9-6.1 2s-1.65 3-2 6.1c-.35-3.1-.9-5-2-6.1s-3-1.65-6.1-2c3.1-.35 5-.9 6.1-2s1.65-3 2-6.1z"})}),zd=e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M6 9.5l6 6 6-6"})}),$d=e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),Bd=e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),qd=e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M3 3l18 18M10.6 10.6a3 3 0 0 0 4.2 4.2M9.9 5.2A9.6 9.6 0 0 1 12 5c6.5 0 10 7 10 7a15.4 15.4 0 0 1-3.3 4M6.2 6.2A15.5 15.5 0 0 0 2 12s3.5 7 10 7a9.7 9.7 0 0 0 3.1-.5"})}),Hd=e.jsxs("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 3a9 9 0 1 0 9 9"}),e.jsx("path",{d:"M12 3v9l6 3"}),e.jsx("path",{d:"M16 4h5V9"})]}),uA=Object.freeze(Object.defineProperty({__proto__:null,CHAT_ICON:$d,CHEVRON_ICON:zd,EMPTY_MARK_ICON:Hd,EYE_ICON:Bd,EYE_OFF_ICON:qd,SEND_ICON:Yo,SPARKLE_ICON:Fd},Symbol.toStringTag,{value:"Module"})),w_=[{prompt:"Import my services from .env",label:"Import from .env"},{prompt:"Scan package.json and Cargo.toml for services",label:e.jsx(e.Fragment,{children:"Scan package.json & Cargo.toml"})},{prompt:"Help me add a service manually",label:"Add one manually"}];function Wd({draft:t,onDraftChange:n,onSubmit:s,onAsk:r}){return e.jsx("div",{className:"xsvc-empty-wrap",children:e.jsxs("div",{className:"xsvc-empty-card",children:[e.jsx("div",{className:"xsvc-empty-mark","aria-hidden":"true",children:Hd}),e.jsx("h2",{children:"No external services mapped yet"}),e.jsx("p",{children:"Tell the AI what this project relies on and it keeps everything organized: it tracks renewals, flags missing keys, and answers questions about your stack."}),e.jsxs("div",{className:"xsvc-chat-hero",children:[e.jsxs("div",{className:"xsvc-lead",children:[$d,"Chat with the AI"]}),e.jsxs("form",{className:"xsvc-composer",onSubmit:s,children:[e.jsx("input",{className:"xsvc-cinput",type:"text",value:t,onChange:a=>n(a.target.value),placeholder:"e.g. We use Anthropic for the AI, Vercel for hosting, and our domain is codeyam.com"}),e.jsx("button",{type:"submit",className:"send","aria-label":"Send to the AI",children:Yo})]}),e.jsx("div",{className:"xsvc-chips",children:w_.map(a=>e.jsxs("button",{type:"button",className:"xsvc-chip",onClick:()=>r==null?void 0:r(a.prompt),children:[e.jsx("span",{className:"g",children:"↳"}),a.label]},a.prompt))})]})]})})}const hA=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesEmptyState:Wd},Symbol.toStringTag,{value:"Module"})),ke=({children:t})=>e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),Wl={vercel:e.jsx(ke,{children:e.jsx("path",{d:"M12 4l8 14H4z",fill:"currentColor",stroke:"none"})}),netlify:e.jsxs(ke,{children:[e.jsx("path",{d:"M12 3l9 9-9 9-9-9z"}),e.jsx("path",{d:"M12 8v8M8 12h8"})]}),cloudflare:e.jsx(ke,{children:e.jsx("path",{d:"M6 16h11a3 3 0 0 0 .3-6A5 5 0 0 0 8 9.2 4 4 0 0 0 6 16z"})}),fly:e.jsxs(ke,{children:[e.jsx("circle",{cx:"12",cy:"10",r:"6"}),e.jsx("path",{d:"M9 15l-1 5 4-2 4 2-1-5"})]}),github:e.jsxs(ke,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"8"}),e.jsx("path",{d:"M9 20v-3c0-1 .5-1.6 1-2-2.3-.3-3.8-1.2-3.8-4a3 3 0 0 1 .8-2 2.8 2.8 0 0 1 .1-2s.8-.2 2.2.9a8 8 0 0 1 4 0c1.4-1.1 2.2-.9 2.2-.9a2.8 2.8 0 0 1 .1 2 3 3 0 0 1 .8 2c0 2.8-1.5 3.7-3.8 4 .5.4 1 1 1 2v3"})]}),anthropic:e.jsx(ke,{children:e.jsx("path",{d:"M12 4v16M4 12h16M6.3 6.3l11.4 11.4M17.7 6.3L6.3 17.7"})}),neon:e.jsx(ke,{children:e.jsx("path",{d:"M5 19V5l14 14V5"})}),stripe:e.jsx(ke,{children:e.jsx("path",{d:"M6 8.5c0-1.4 1.5-2.5 3.5-2.5S13 6.8 13.4 8M6 15.5c0 1.4 1.5 2.5 3.5 2.5S13 17.2 13.4 16M9.5 6v12"})})},Gl={"Code hosting":e.jsxs(ke,{children:[e.jsx("circle",{cx:"6",cy:"7",r:"2.4"}),e.jsx("circle",{cx:"6",cy:"17",r:"2.4"}),e.jsx("circle",{cx:"17",cy:"9",r:"2.4"}),e.jsx("path",{d:"M6 9.4v5.2M17 11.4c0 3-3 3.6-6 4.2"})]}),"Package registry":e.jsxs(ke,{children:[e.jsx("path",{d:"M12 3l8 4.2v9.6L12 21l-8-4.2V7.2z"}),e.jsx("path",{d:"M4 7.2l8 4.3 8-4.3M12 11.5V21"})]}),"Cloud platform":e.jsx(ke,{children:e.jsx("path",{d:"M7 18h10a3.6 3.6 0 0 0 .3-7.2A5.6 5.6 0 0 0 6.8 9.6 3.9 3.9 0 0 0 7 18z"})}),"AI provider":e.jsxs(ke,{children:[e.jsx("path",{d:"M12 3v3.5M12 17.5V21M3 12h3.5M17.5 12H21"}),e.jsx("path",{d:"M6.3 6.3l2.5 2.5M15.2 15.2l2.5 2.5M17.7 6.3l-2.5 2.5M8.8 15.2l-2.5 2.5"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Cache & queue":e.jsxs(ke,{children:[e.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),e.jsx("circle",{cx:"8",cy:"7",r:"1.3",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"14",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"10",cy:"17",r:"1.3",fill:"currentColor",stroke:"none"})]}),"Storage & media":e.jsxs(ke,{children:[e.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"2"}),e.jsx("circle",{cx:"9",cy:"10",r:"1.8"}),e.jsx("path",{d:"M4 17l4.5-4.5L13 17M13 14l2.5-2.5L20 16"})]}),Messaging:e.jsx(ke,{children:e.jsx("path",{d:"M21 14a2 2 0 0 1-2 2H8l-4 4V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2z"})}),Search:e.jsxs(ke,{children:[e.jsx("circle",{cx:"10.5",cy:"10.5",r:"6"}),e.jsx("path",{d:"M15 15l5 5"})]}),Containers:e.jsxs(ke,{children:[e.jsx("rect",{x:"3",y:"10",width:"5",height:"5",rx:"0.8"}),e.jsx("rect",{x:"9.5",y:"10",width:"5",height:"5",rx:"0.8"}),e.jsx("rect",{x:"9.5",y:"4.5",width:"5",height:"5",rx:"0.8"}),e.jsx("path",{d:"M3 17.5c3 2.5 12 2.5 15.5-3a3.4 3.4 0 0 0 2.5.4"})]}),"CI/CD":e.jsxs(ke,{children:[e.jsx("path",{d:"M4 12a8 8 0 0 1 13.7-5.6M20 12a8 8 0 0 1-13.7 5.6"}),e.jsx("path",{d:"M17 3v4h-4M7 21v-4h4"})]}),Domain:e.jsxs(ke,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),e.jsx("path",{d:"M3.5 12h17M12 3.5c2.5 2.3 2.5 14.7 0 17M12 3.5c-2.5 2.3-2.5 14.7 0 17"})]}),Hosting:e.jsxs(ke,{children:[e.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"6",rx:"1.5"}),e.jsx("rect",{x:"3.5",y:"13.5",width:"17",height:"6",rx:"1.5"}),e.jsx("path",{d:"M7 7.5h.01M7 16.5h.01"})]}),Payments:e.jsxs(ke,{children:[e.jsx("rect",{x:"3",y:"5.5",width:"18",height:"13",rx:"2"}),e.jsx("path",{d:"M3 9.5h18"})]}),Database:e.jsxs(ke,{children:[e.jsx("ellipse",{cx:"12",cy:"6",rx:"7",ry:"2.8"}),e.jsx("path",{d:"M5 6v12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8V6"}),e.jsx("path",{d:"M5 12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8"})]}),"Database ORM":e.jsxs(ke,{children:[e.jsx("ellipse",{cx:"12",cy:"6",rx:"7",ry:"2.8"}),e.jsx("path",{d:"M5 6v12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8V6"}),e.jsx("path",{d:"M5 12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8"})]}),"Backend platform":e.jsxs(ke,{children:[e.jsx("ellipse",{cx:"12",cy:"6",rx:"7",ry:"2.8"}),e.jsx("path",{d:"M5 6v12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8V6"}),e.jsx("path",{d:"M5 12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8"})]}),Authentication:e.jsxs(ke,{children:[e.jsx("circle",{cx:"9",cy:"9",r:"4"}),e.jsx("path",{d:"M12 12l7 7M16 16l2-2M18.5 13.5l1.5 1.5"})]}),"Transactional email":e.jsxs(ke,{children:[e.jsx("rect",{x:"3",y:"5.5",width:"18",height:"13",rx:"2"}),e.jsx("path",{d:"M3.5 7l8.5 6 8.5-6"})]}),"Product analytics":e.jsxs(ke,{children:[e.jsx("path",{d:"M4 20V4M4 20h16"}),e.jsx("path",{d:"M8 16v-3M12 16V8M16 16v-6"})]}),"Error monitoring":e.jsxs(ke,{children:[e.jsx("path",{d:"M12 3l8 4v5c0 5-3.5 8-8 9-4.5-1-8-4-8-9V7z"}),e.jsx("path",{d:"M12 8.5v4M12 15.5h.01"})]})},__={vercel:{fg:"#ffffff",bg:"rgba(255,255,255,0.10)"},github:{fg:"#ffffff",bg:"rgba(255,255,255,0.10)"},resend:{fg:"#ffffff",bg:"rgba(255,255,255,0.10)"},anthropic:{fg:"#d97757",bg:"rgba(217,119,87,0.14)"},neon:{fg:"#00e599",bg:"rgba(0,229,153,0.13)"},stripe:{fg:"#635bff",bg:"rgba(99,91,255,0.15)"},netlify:{fg:"#32e6e2",bg:"rgba(50,230,226,0.13)"},cloudflare:{fg:"#f38020",bg:"rgba(243,128,32,0.14)"},fly:{fg:"#8b5cf6",bg:"rgba(139,92,246,0.14)"},gitlab:{fg:"#fc6d26",bg:"rgba(252,109,38,0.14)"},openai:{fg:"#ffffff",bg:"rgba(255,255,255,0.10)"},aws:{fg:"#ff9900",bg:"rgba(255,153,0,0.13)"},gcp:{fg:"#4285f4",bg:"rgba(66,133,244,0.14)"},supabase:{fg:"#3ecf8e",bg:"rgba(62,207,142,0.13)"},firebase:{fg:"#ffca28",bg:"rgba(255,202,40,0.13)"},mongodb:{fg:"#00ed64",bg:"rgba(0,237,100,0.12)"},redis:{fg:"#ff4438",bg:"rgba(255,68,56,0.13)"},docker:{fg:"#2496ed",bg:"rgba(36,150,237,0.14)"},twilio:{fg:"#f22f46",bg:"rgba(242,47,70,0.13)"},slack:{fg:"#e01e5a",bg:"rgba(224,30,90,0.13)"},algolia:{fg:"#5468ff",bg:"rgba(84,104,255,0.14)"},cloudinary:{fg:"#3448c5",bg:"rgba(52,72,197,0.16)"},sentry:{fg:"#a07cff",bg:"rgba(160,124,255,0.14)"},posthog:{fg:"#f9bd2b",bg:"rgba(249,189,43,0.13)"},clerk:{fg:"#6c47ff",bg:"rgba(108,71,255,0.15)"}};function Gd(t){return t&&__[t]||null}function Ud({providerId:t,category:n}){return t&&Wl[t]?Wl[t]:n&&Gl[n]?Gl[n]:null}const pA=Object.freeze(Object.defineProperty({__proto__:null,G:ke,ProviderLogo:Ud,providerBrand:Gd},Symbol.toStringTag,{value:"Module"}));function Yd(t){return t.length<=10?"•".repeat(Math.max(t.length,6)):`${t.slice(0,6)}••••••••••${t.slice(-4)}`}function Vo({apiKey:t}){const[n,s]=l.useState(!1);return e.jsxs("div",{className:"xsvc-detrow",children:[e.jsx("span",{className:"xsvc-detlabel",children:"API key"}),e.jsxs("button",{type:"button",className:"xsvc-keyval",onClick:()=>s(r=>!r),"aria-label":n?"Hide API key":"Reveal API key",title:n?"Click to hide":"Click to reveal",children:[e.jsx("span",{className:"mono",children:n?t:Yd(t)}),e.jsx("span",{className:"eye","aria-hidden":"true",children:n?qd:Bd})]})]})}const mA=Object.freeze(Object.defineProperty({__proto__:null,ApiKeyField:Vo,maskKey:Yd},Symbol.toStringTag,{value:"Module"}));function Ko({svc:t,expanded:n,onToggle:s,onAction:r}){var i,c,d;const a=Ud({providerId:t.providerId,category:t.category}),o=Gd(t.providerId);return e.jsxs("div",{className:`xsvc-rowwrap${n?" open":""}`,children:[e.jsxs("div",{className:`xsvc-row${t.attn?" attn":""}${t.pending?" pending":""}`,role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s())},children:[e.jsx("div",{className:`xsvc-tile t-${t.tone??"lime"}`,style:o?{background:o.bg,color:o.fg}:void 0,children:a??t.monogram??t.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"xsvc-rmain",children:[e.jsxs("div",{className:"xsvc-rname",children:[t.name,(i=t.tags)==null?void 0:i.map((u,h)=>e.jsx("span",{className:`xsvc-tag ${u.kind}`,children:u.text},h))]}),e.jsx("div",{className:"xsvc-rdesc",children:t.desc})]}),e.jsxs("div",{className:"xsvc-rright",children:[t.actionLabel?e.jsx("button",{type:"button",className:"xsvc-addkey",onClick:u=>{u.stopPropagation(),t.actionKey&&r&&r(t.actionKey)},children:t.actionLabel}):e.jsxs("div",{className:"xsvc-rmeta",children:[t.metaBig?e.jsx("div",{className:"big",children:t.metaBig}):null,t.metaLil?e.jsx("div",{className:"lil",children:t.metaLil}):null]}),e.jsx("span",{className:`xsvc-arr${n?" down":""}`,"aria-hidden":"true",children:zd})]})]}),n?e.jsxs("div",{className:"xsvc-detail",children:[(c=t.detail)==null?void 0:c.map((u,h)=>e.jsxs("div",{className:"xsvc-detrow",children:[e.jsx("span",{className:"xsvc-detlabel",children:u.label}),e.jsx("span",{className:`xsvc-detval${u.mono?" mono":""}`,children:u.value})]},h)),t.apiKey?e.jsx(Vo,{apiKey:t.apiKey}):null,!((d=t.detail)!=null&&d.length)&&!t.apiKey?e.jsx("div",{className:"xsvc-detrow",children:e.jsx("span",{className:"xsvc-detval",children:t.desc})}):null]}):null]})}const fA=Object.freeze(Object.defineProperty({__proto__:null,ServiceRow:Ko},Symbol.toStringTag,{value:"Module"}));function Vd({groups:t,onAction:n}){const[s,r]=l.useState(null);return e.jsx("div",{className:"xsvc-groups",children:t.map(a=>e.jsxs("div",{className:"xsvc-group",children:[e.jsxs("div",{className:"xsvc-group-head",children:[e.jsx("span",{className:"xsvc-seclabel",children:a.label}),e.jsx("span",{className:"xsvc-seccount",children:a.items.length})]}),e.jsx("div",{className:"xsvc-rows",children:a.items.map((o,i)=>{const c=`${a.label}:${o.name}:${i}`;return e.jsx(Ko,{svc:o,expanded:s===c,onToggle:()=>r(d=>d===c?null:c),onAction:n},c)})})]},a.label))})}const gA=Object.freeze(Object.defineProperty({__proto__:null,ExternalServiceGroupList:Vd},Symbol.toStringTag,{value:"Module"}));function Jo({sort:t,onSortChange:n}){return e.jsxs("div",{className:"xsvc-toolbar",children:[e.jsx("span",{className:"xsvc-sortlbl",children:"Sort by"}),e.jsxs("div",{className:"xsvc-seg",children:[e.jsx("button",{type:"button",className:t==="type"?"on":"",onClick:()=>n("type"),children:"Type"}),e.jsx("button",{type:"button",className:t==="provider"?"on":"",onClick:()=>n("provider"),children:"Provider"})]})]})}const bA=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesSortToolbar:Jo},Symbol.toStringTag,{value:"Module"})),k_=["When does codeyam.com renew?","What's my monthly spend?","Anything missing a key?"];function Kd({onPick:t}){return e.jsx("span",{className:"xsvc-chips",children:k_.map(n=>e.jsx("button",{type:"button",className:"xsvc-chip",onClick:()=>t(n),children:n},n))})}const xA=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesSuggestionChips:Kd},Symbol.toStringTag,{value:"Module"}));function Jd({draft:t,onDraftChange:n,onSubmit:s,onAsk:r,chatSlot:a,bare:o=!1}){const i=!a&&t.trim()==="";return e.jsxs("div",{className:o?"xsvc-askcard xsvc-askcard-bare":"xsvc-askcard",children:[e.jsxs("form",{className:"xsvc-ask-composer",onSubmit:s,children:[e.jsx("span",{className:"ai","aria-hidden":"true",children:Fd}),e.jsx("input",{className:"xsvc-cinput",type:"text",value:t,onChange:c=>n(c.target.value),placeholder:"Ask the AI about your domains, keys, subscriptions…"}),i?e.jsx(Kd,{onPick:c=>{n(c),r==null||r(c)}}):null,e.jsx("button",{type:"submit",className:"send","aria-label":"Send to the AI",children:Yo})]}),a?e.jsx("div",{className:"xsvc-ask-chat",children:a}):null]})}const yA=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesAskCard:Jd},Symbol.toStringTag,{value:"Module"}));function Xd(){const t="M2 2 h4.5 v1.6 h-2.9 v2.9 h-1.6 z";return e.jsx("svg",{viewBox:"0 0 16 16",className:"w-[15px] h-[15px]",fill:"currentColor","aria-hidden":"true",children:[0,90,180,270].map(n=>e.jsx("path",{d:t,transform:`rotate(${n} 8 8)`},n))})}const vA=Object.freeze(Object.defineProperty({__proto__:null,FullScreenIcon:Xd},Symbol.toStringTag,{value:"Module"}));function _n(t,n){if(t.startsWith("http"))return t;const s=`/api/screenshots/${t}`;return typeof n=="number"?`${s}?cb=${n}`:s}function kt({screenshotPath:t,cacheBuster:n,alt:s,className:r="",title:a}){const[o,i]=l.useState("loading"),[c,d]=l.useState(!1),u=l.useRef(null),h=t?_n(t,n):"",p=()=>{i("success"),d(!0)},f=()=>{i("error"),d(!1)};return l.useEffect(()=>{i("loading"),d(!1);const m=u.current;m!=null&&m.complete&&(m.naturalHeight!==0?(i("success"),d(!0)):(i("error"),d(!1)))},[h]),t?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",title:a,children:[e.jsx("img",{ref:u,src:h,alt:s,onLoad:p,onError:f,className:r||"max-w-full max-h-full object-contain",style:{opacity:c?1:0,position:c?"relative":"absolute"}}),o==="loading"&&e.jsx("div",{className:"absolute inset-0 bg-[var(--bg-card)] animate-pulse rounded flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-[var(--text-dim)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),o==="error"&&e.jsxs("div",{className:"absolute inset-0 border border-[var(--border-subtle)] bg-[var(--bg-card)] rounded flex flex-col items-center justify-center text-xs gap-1",children:[e.jsx("span",{className:"text-2xl opacity-40 grayscale",children:"📷"}),e.jsx("span",{className:"text-[var(--text-dim)] whitespace-nowrap",children:"No Screenshot"})]})]}):e.jsx("div",{className:"w-full h-full border border-[var(--border-subtle)] bg-[var(--bg-card)] rounded flex flex-col items-center justify-center text-xs gap-1",title:a,children:e.jsx("span",{className:"text-2xl opacity-40 grayscale",children:"📷"})})}const jA=Object.freeze(Object.defineProperty({__proto__:null,SafeScreenshot:kt},Symbol.toStringTag,{value:"Module"}));function Qd({shots:t,initialIndex:n=0,onSelect:s,onClose:r}){const a=t.length-1,o=l.useCallback(g=>Math.max(0,Math.min(a,g)),[a]),[i,c]=l.useState(()=>o(n)),d=l.useCallback(g=>c(b=>o(b+g)),[o]),u=l.useCallback(g=>{g.key==="Escape"?(g.preventDefault(),r()):g.key==="ArrowLeft"?(g.preventDefault(),d(-1)):g.key==="ArrowRight"&&(g.preventDefault(),d(1))},[r,d]);if(l.useEffect(()=>(window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)),[u]),t.length===0)return null;const h=t[i],p=i===0,f=i===a,m="flex h-14 w-14 flex-none items-center justify-center rounded-full border-2 border-[var(--border-subtle)] bg-[var(--bg-card)] text-3xl text-[var(--text-primary)] transition hover:border-[var(--text-primary)] hover:bg-[var(--bg-surface)] disabled:cursor-default disabled:opacity-25 disabled:hover:border-[var(--border-subtle)] disabled:hover:bg-[var(--bg-card)]";return e.jsx("div",{className:"fixed inset-0 z-[70] flex flex-col",style:{background:"rgba(30, 30, 30, 0.90)"},role:"dialog","aria-label":"Scenario gallery","data-testid":"scenario-gallery-modal",onClick:r,children:e.jsxs("div",{className:"flex flex-1 min-h-0 flex-col px-6 py-4",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"mb-4 flex items-center gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[11px] font-semibold tracking-widest uppercase text-[var(--text-dim)]",children:h.routeLabel}),e.jsx("p",{className:"truncate text-lg font-semibold text-[var(--text-primary)]",children:h.name})]}),e.jsxs("span",{className:"flex-none text-xs font-semibold tracking-widest uppercase text-[var(--text-dim)]",children:[i+1," / ",t.length]}),e.jsx("button",{type:"button",onClick:r,"aria-label":"Close gallery",className:"flex-none text-sm text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"✕"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 items-center gap-4",children:[e.jsx("button",{type:"button",onClick:()=>d(-1),disabled:p,"aria-label":"Previous scenario",className:m,children:"‹"}),e.jsx("button",{type:"button",onClick:()=>{s(h.slug),r()},"aria-label":`Open ${h.name} live`,className:"flex min-h-0 flex-1 cursor-pointer items-center justify-center self-stretch",children:e.jsx("div",{className:"flex max-h-[80vh] max-w-[90vw] items-center justify-center",children:e.jsx(kt,{screenshotPath:h.screenshotPath??void 0,cacheBuster:h.screenshotCapturedAtMs??void 0,alt:h.name,className:"max-h-[80vh] max-w-[90vw] object-contain"})})}),e.jsx("button",{type:"button",onClick:()=>d(1),disabled:f,"aria-label":"Next scenario",className:m,children:"›"})]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>{s(h.slug),r()},className:"rounded bg-[var(--lime-300)] px-4 py-2 font-semibold text-black transition hover:brightness-110",children:"Open Live Preview"})})]})})}const wA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioGalleryModal:Qd},Symbol.toStringTag,{value:"Module"}));function Zd({reason:t}){const{headline:n,detail:s}=eu(t);return e.jsxs("div",{className:"py-4 text-sm text-[var(--text-dim)]",children:[e.jsx("p",{className:"text-[var(--text-secondary)]",children:n}),s?e.jsx("p",{className:"mt-1",children:s}):null]})}function eu(t){switch(t.kind){case"no-component-scenarios":return{headline:"No components yet.",detail:"Capture a component scenario and it will appear here — a scenario is what marks a component as browsable."};case"missing-from-glossary":return{headline:`${t.count} component ${En(t.count,"scenario")} name ${En(t.count,"a component","components")} not in the glossary${Ul(t.examples)}.`,detail:"Deconstruct or register those components so they can be surfaced here."};case"not-visual-components":return{headline:`${t.count} ${En(t.count,"component")} matched glossary ${En(t.count,"entry","entries")} but ${En(t.count,"is","are")} not recognized as visual ${En(t.count,"component","components")}${Ul(t.examples)}.`,detail:"Check `components.fileExtensions` in .codeyam/stack.json — a stack whose components are not .tsx/.jsx must list its own extensions."}}}function En(t,n,s){return t===1?n:s??`${n}s`}function Ul(t){return t.length===0?"":` (e.g. ${t.join(", ")})`}const _A=Object.freeze(Object.defineProperty({__proto__:null,ComponentSurfaceReasonNote:Zd,describeReason:eu},Symbol.toStringTag,{value:"Module"})),S_="Good question. We'll explain this plainly as we go, and you can ask anything at any step. Nothing happens until you say go.",N_=[{keywords:["free","cost","pay","price"],answer:"Yes, it's genuinely free to start. Vercel's free tier comfortably covers an app like yours with no credit card. If it ever grew into heavy traffic we'd tell you long before any cost."},{keywords:["domain","url","address","name"],answer:"You can. You'll launch on a free link like your-app.vercel.app today, then connect your own address whenever you're ready. We'll walk you through it."},{keywords:["move","switch","leave","lock"],answer:"You're never locked in. Your app and its code stay yours, and you can move to another host at any time."},{keywords:["safe","secure","break","data"],answer:"It's safe. Going live doesn't change your app or your data, it just makes a copy reachable by a link. You can take it offline again anytime."}];function C_(t){const n=t.toLowerCase();for(const s of N_)if(s.keywords.some(r=>n.includes(r)))return s.answer;return S_}const P_={"clerk.freeTier":{value:"50,000 monthly active users free (Clerk bills by MAU)",verified:"2026-06",source:"https://clerk.com/pricing",staleness:"high"},"auth0.freeTier":{value:"25,000 monthly active users free, then paid from ~$35/mo",verified:"2026-06",source:"https://auth0.com/pricing",staleness:"med"},"resend.free":{value:"3,000 emails/mo and 100/day free",verified:"2026-06",source:"https://resend.com/pricing",staleness:"med"},"vercel.hobby":{value:"Hobby is free for non-commercial use; commercial needs Pro (~$20/user/mo)",verified:"2026-06",source:"https://vercel.com/pricing",staleness:"med"},"supabase.free":{value:"Free projects pause after ~1 week idle and have no automatic backups (Pro adds 7-day)",verified:"2026-06",source:"https://supabase.com/pricing",staleness:"med"},"netlify.free":{value:"New accounts use a monthly-credit model (legacy accounts: ~100GB/mo bandwidth)",verified:"2026-06",source:"https://www.netlify.com/pricing/",staleness:"med"},"cloudflarePages.free":{value:"Unlimited static bandwidth and requests on the free plan",verified:"2026-06",source:"https://pages.cloudflare.com/",staleness:"med"},"netlifyForms.free":{value:"100 submissions/mo",verified:"2026-06",source:"https://www.netlify.com/pricing/",staleness:"med"},"flyio.pricing":{value:"Pay-as-you-go; no standing always-free allowance since Oct 2024",verified:"2026-06",source:"https://fly.io/docs/about/pricing/",staleness:"low"},"stripe.usCardFee":{value:"2.9% + 30¢",verified:"2026-06",source:"https://stripe.com/pricing",staleness:"low"},"appleDeveloper.fee":{value:"$99 / year",verified:"2026-06",source:"https://developer.apple.com/support/compare-memberships/",staleness:"low"},"googlePlay.fee":{value:"$25 once",verified:"2026-06",source:"https://support.google.com/googleplay/android-developer/answer/6112435",staleness:"low"},"appStore.commission":{value:"15–30% (15% under the Small Business Program and on subscriptions after year one)",verified:"2026-06",source:"https://developer.apple.com/app-store/small-business-program/",staleness:"med"},"googlePlay.commission":{value:"15–30% (15% on the first $1M/year and on all subscriptions)",verified:"2026-06",source:"https://support.google.com/googleplay/android-developer/answer/112622",staleness:"med"},"chromeStore.fee":{value:"$5",verified:"2026-06",source:"https://developer.chrome.com/docs/webstore/register/",staleness:"low"},"playStore.closedTestGate":{value:"Personal accounts (created after 2023-11-13) need ≥12 testers opted in for 14 continuous days before production",verified:"2026-06",source:"https://support.google.com/googleplay/android-developer/answer/14151465",staleness:"med"},"appleScreenshots.iphone":{value:"6.9″ 1320×2868 (older 6.7″/6.5″ accepted as a fallback)",verified:"2026-06",source:"https://developer.apple.com/help/app-store-connect/reference/screenshot-specifications/",staleness:"med"},"appleScreenshots.ipad":{value:"13″ 2064×2752 (legacy 12.9″ 2048×2732 accepted)",verified:"2026-06",source:"https://developer.apple.com/help/app-store-connect/reference/screenshot-specifications/",staleness:"med"},"registry.twoFactor":{value:"npm enforces 2FA for publishing (required on high-impact packages); crates.io, PyPI, and RubyGems all support 2FA and increasingly require it for publishing",verified:"2026-06",source:"https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification",staleness:"med"},"registry.oidc":{value:"PyPI and npm support OIDC “trusted publishing” — CI authenticates with a short-lived identity, no long-lived token. Caveat: npm trusted publishing cannot perform a package's first publish; that initial release still needs a token",verified:"2026-06",source:"https://docs.pypi.org/trusted-publishers/",staleness:"med"},"supplyChain.signedReleases":{value:"npm publishes provenance attestations (Sigstore) for packages built in trusted CI, and PyPI attaches PEP 740 attestations on trusted-publisher uploads — both verifiable back to the source commit and workflow",verified:"2026-06",source:"https://docs.npmjs.com/generating-provenance-statements",staleness:"med"}};function me(t){return P_[t]}const T_=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O_(t){const n=/^(\d{4})-(\d{2})$/.exec(t);if(!n)return t;const s=Number(n[2])-1;return s<0||s>11?t:`${T_[s]} ${n[1]}`}function A_(t,n){const s=/^(\d{4})-(\d{2})$/.exec(t);if(!s)return 0;const r=Number(s[1]),a=Number(s[2])-1,o=(n.getFullYear()-r)*12+(n.getMonth()-a);return o<0?0:o}const R_=12;function E_(t,n){return t.staleness==="low"?!1:A_(t.verified,n)>R_}function sn({fact:t,asOf:n=new Date}){if(t.staleness==="low")return null;const s=E_(t,n);return e.jsxs("span",{className:"fact-fresh"+(s?" stale":""),title:`Source: ${t.source}`,children:[s?"needs re-check · ":"verified ",O_(t.verified)]})}const kA=Object.freeze(Object.defineProperty({__proto__:null,FactFreshness:sn},Symbol.toStringTag,{value:"Module"}));function Be({size:t=15,color:n="var(--green-300)"}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",stroke:n,strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M3 8.4l3 3 7-7.4"})})}function Nr(){return e.jsx("div",{className:"pv-logo",children:e.jsx("svg",{width:"26",height:"22",viewBox:"0 0 26 22",fill:"#0a0a0a","aria-hidden":"true",children:e.jsx("path",{d:"M13 0l13 22H0z"})})})}function tu(){return e.jsx("div",{className:"journey",children:e.jsxs("div",{className:"jrow",children:[e.jsxs("div",{className:"jcol",children:[e.jsx("div",{className:"jtile",children:"💻"}),e.jsx("div",{className:"jlbl",children:"Your computer"}),e.jsx("div",{className:"jsub",children:"Only you can see it"})]}),e.jsxs("div",{className:"jconn",children:[e.jsx("span",{className:"jpacket"}),e.jsx("span",{children:"→"})]}),e.jsxs("div",{className:"jcol",children:[e.jsx("div",{className:"jtile lime",children:"☁️"}),e.jsx("div",{className:"jlbl",children:"Hosting"}),e.jsx("div",{className:"jsub",children:"A home on the internet"})]}),e.jsxs("div",{className:"jconn",children:[e.jsx("span",{className:"jpacket",style:{animationDelay:"1.8s"}}),e.jsx("span",{children:"→"})]}),e.jsxs("div",{className:"jcol",children:[e.jsx("div",{className:"jtile",children:"🌍"}),e.jsx("div",{className:"jlbl",children:"Anyone, anywhere"}),e.jsx("div",{className:"jsub",children:"Opens with a link"})]})]})})}function nu(){const t=me("vercel.hobby");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"reasons",children:[e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:"Free to start."})," No credit card, no surprise bills for an app this size."]})]}),e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:"Built for how your app is made."})," It deploys the way your app already works, so it just runs."]})]}),e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:"Your own web address later."})," Launch on a free link today, add a custom domain whenever you like."]})]})]}),e.jsxs("p",{className:"reason-foot",children:["One catch worth knowing: ",t.value,". So the free link is perfect for trying it out and sharing, but once your app is charging money you'll want the paid tier.",e.jsx(sn,{fact:t})]})]})}function su(){return e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"Free tier"}),e.jsx("span",{className:"chip",children:"Custom domain later"}),e.jsx("span",{className:"chip",children:"~5 min to set up"})]})}function ru(){const[t,n]=l.useState(!1);return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:"alt-toggle",onClick:()=>n(s=>!s),children:[t?"Hide other options":"Vercel not for you? See other options",e.jsx("span",{className:"chev",style:{transform:t?"rotate(180deg)":"none"},children:"⌄"})]}),t?e.jsxs("div",{className:"alts",children:[e.jsxs("div",{className:"altcard",children:[e.jsx("div",{className:"altmark",style:{background:"linear-gradient(140deg,#16a3a3,#0d6e6e)"},children:"N"}),e.jsxs("div",{className:"altbody",children:[e.jsx("div",{className:"altname",children:"Netlify"}),e.jsx("div",{className:"altdesc",children:"Also free to start and very similar to set up. A solid pick if you'd rather use it."})]}),e.jsx("button",{type:"button",className:"altpick",children:"Use this"})]}),e.jsxs("div",{className:"altcard",children:[e.jsx("div",{className:"altmark",style:{background:"linear-gradient(140deg,#f6821f,#c25e0a)"},children:"C"}),e.jsxs("div",{className:"altbody",children:[e.jsx("div",{className:"altname",children:"Cloudflare Pages"}),e.jsx("div",{className:"altdesc",children:"Best if you expect heavy worldwide traffic. A little more to learn up front."})]}),e.jsx("button",{type:"button",className:"altpick",children:"Use this"})]})]}):null]})}const M_=[{t:'What does "going live" actually do?',a:"It puts a copy of your app on the internet at a web address, so anyone you share the link with can open it. Your version on your computer keeps working exactly as before."},{t:"Can I undo it or take it offline?",a:"Anytime. You can unpublish with one click, and it goes back to running only on your computer. Nothing is permanent."},{t:"Do I need to understand servers?",a:"No. That's the whole point of letting us set it up. We handle the technical parts and explain each step in plain language as it happens."}];function au(){const[t,n]=l.useState(-1);return e.jsx("div",{className:"faq",children:M_.map((s,r)=>e.jsxs("div",{className:"faqitem",children:[e.jsxs("button",{type:"button",className:"faqq"+(t===r?" open":""),onClick:()=>n(t===r?-1:r),children:[s.t,e.jsx("span",{className:"chev",children:"⌄"})]}),t===r?e.jsx("div",{className:"faqa",children:s.a}):null]},s.t))})}function ou(){const[t,n]=l.useState(""),[s,r]=l.useState(null),a=o=>{r(C_(o)),n("")};return e.jsxs("div",{className:"ask",children:[e.jsxs("div",{className:"askrow",children:[e.jsx("input",{value:t,onChange:o=>n(o.target.value),onKeyDown:o=>{o.key==="Enter"&&t.trim()&&a(t)},placeholder:'Ask anything, e.g. "Is it really free?" or "Can I use my own domain?"'}),e.jsx("button",{type:"button",onClick:()=>t.trim()&&a(t),"aria-label":"Ask",children:"↑"})]}),e.jsx("div",{className:"asknote",children:"Ask before you commit to anything."}),s?e.jsxs("div",{className:"askans",children:[e.jsx("span",{className:"askav",children:"‹Y"}),e.jsx("div",{className:"at",children:s})]}):null]})}const SA=Object.freeze(Object.defineProperty({__proto__:null,Alts:ru,AskBox:ou,Check:Be,Chips:su,Faq:au,Journey:tu,Reasons:nu,VercelMark:Nr},Symbol.toStringTag,{value:"Module"})),I_={"chrome.devConsole":{url:"https://chrome.google.com/webstore/devconsole",label:"Open the Chrome Web Store developer dashboard"},"chrome.register":{url:me("chromeStore.fee").source,label:"Chrome Web Store registration guide"},"google.oauthConsent":{url:"https://console.cloud.google.com/apis/credentials/consent",label:"Open the OAuth consent screen (Google Cloud console)"},"firefox.amoDevHub":{url:"https://addons.mozilla.org/developers/",label:"Firefox Add-ons (AMO) developer hub"},"edge.partnerDashboard":{url:"https://partner.microsoft.com/dashboard/microsoftedge",label:"Edge Add-ons partner dashboard"}};function D_(t){return I_[t]}function yt({linkKey:t,label:n}){const s=D_(t);return e.jsxs("a",{className:"setup-extlink",href:s.url,target:"_blank",rel:"noreferrer noopener",children:[e.jsx("span",{className:"setup-extlink-label",children:n??s.label}),e.jsx("span",{className:"setup-extlink-glyph","aria-hidden":"true",children:"↗"})]})}function ce({children:t}){return e.jsx("div",{className:"reasons",children:t})}function R({lead:t,children:n}){return e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:t})," ",n]})]})}function Xo({spaced:t=!1,children:n}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"seclabel",style:t?{marginTop:24}:void 0,children:"Keep a changelog"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"One CHANGELOG.md, grouped by version.",children:["Follow the ",e.jsx("b",{children:"Keep a Changelog"})," convention: Added / Changed / Fixed / Removed under each release, newest first. Write it for the person deciding whether to upgrade."]}),e.jsxs(R,{lead:"Or generate it from your commits.",children:["If you write ",e.jsx("b",{children:"Conventional Commits"})," (",e.jsx("code",{children:"feat:"}),","," ",e.jsx("code",{children:"fix:"}),", ",e.jsx("code",{children:"feat!:"})," for breaking), tools like release-please or git-cliff assemble the changelog — and even the next version number — for you."]}),n]})]})}function Cr(){return e.jsxs("div",{className:"setup-note",style:{marginTop:14},children:[e.jsxs("p",{children:["Publishing to ",e.jsx("b",{children:"Firefox Add-ons (AMO)"})," or ",e.jsx("b",{children:"Edge Add-ons"})," ","follows an analogous path — a developer account, store assets, and a review — with its own console. The steps below are written for the Chrome Web Store."]}),e.jsxs("p",{children:[e.jsx("b",{children:"Fees differ:"})," the"," ",e.jsx("b",{children:me("chromeStore.fee").value})," registration fee is Chrome-only and one-time — Firefox AMO and Edge Add-ons charge no developer fee."]}),e.jsxs("div",{className:"setup-note-links",children:[e.jsx(yt,{linkKey:"firefox.amoDevHub"}),e.jsx(yt,{linkKey:"edge.partnerDashboard"})]})]})}const NA=Object.freeze(Object.defineProperty({__proto__:null,ChangelogSection:Xo,ReqItem:R,ReqList:ce,SetupExternalLink:yt,StoreAlternativesNote:Cr},Symbol.toStringTag,{value:"Module"}));function fa(t){const n=u_(t);if(n)return{selectedAppDir:n,selectedEntityHash:null};const s=h_(t);return s?{selectedAppDir:null,selectedEntityHash:s}:{selectedAppDir:null,selectedEntityHash:null}}function ga(t){return`/apps/${t}`}function L_(t){return`/entities/${t}`}function _s(t,n){const s=`${t}:${n}`;let r=2166136261;for(let a=0;a<s.length;a++)r^=s.charCodeAt(a),r=Math.imul(r,16777619);return(r>>>0).toString(16).padStart(8,"0")}function kn(t){return(t.split("/").pop()??t).replace(/\.[^.]+$/,"")}function za(t){if(!t.pageFilePath)return null;const n=t.entityName??kn(t.pageFilePath);return _s(t.pageFilePath,n)}function iu(t){const n=za(t);return n===null?null:L_(n)}function ur({href:t,onNavigate:n,children:s,...r}){return e.jsx("a",{...r,href:t,onClick:a=>{a.button===0&&!a.metaKey&&!a.ctrlKey&&!a.shiftKey&&!a.altKey&&(a.preventDefault(),n())},children:s})}const CA=Object.freeze(Object.defineProperty({__proto__:null,NavLink:ur},Symbol.toStringTag,{value:"Module"}));function lu({scenario:t,onSelect:n}){const s=t.screenshotPaths[0]??null;return e.jsxs("button",{type:"button",onClick:n,className:`relative text-left w-full${n?" cursor-pointer group/thumb":""}`,children:[e.jsx("div",{className:"aspect-[16/10] w-full flex items-center justify-center overflow-hidden rounded border border-[var(--border-subtle)] bg-[var(--bg-card)] transition group-hover/thumb:border-[var(--text-dim)]",children:e.jsx(kt,{screenshotPath:s??void 0,alt:t.name})}),t.dimensions.length>0?e.jsx("span",{className:"absolute bottom-1 right-1 rounded bg-black/60 px-1 py-0.5 text-[8px] text-white",children:t.dimensions[0]}):null,e.jsx("p",{className:"mt-1.5 truncate text-[13px] text-[var(--text-dim)]",children:t.name})]})}const PA=Object.freeze(Object.defineProperty({__proto__:null,RouteListCardThumbnail:lu},Symbol.toStringTag,{value:"Module"}));function cu({routeEntity:t,variant:n}){const s=t.scenarios.length;return n==="explore"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm font-bold uppercase tracking-wider text-[var(--text-primary)] group-hover:underline",children:t.displayName}),s>0?e.jsxs("span",{className:"text-sm text-[var(--text-dim)]",children:["(",s,")"]}):null]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)] group-hover:text-[var(--text-primary)] transition",children:t.displayName}),e.jsx("span",{className:"font-mono text-xs text-[var(--text-dim)]",children:t.route}),s>0?e.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:["[",s,"]"]}):null,e.jsx("span",{className:"ml-auto text-xs text-[var(--text-dim)] group-hover:text-[var(--text-muted)] transition",children:"›"})]})}const TA=Object.freeze(Object.defineProperty({__proto__:null,RouteListCardHeading:cu},Symbol.toStringTag,{value:"Module"}));function du({collapsed:t,onToggle:n,disclosable:s}){return s?e.jsx("button",{type:"button",onClick:n,"aria-label":t?"Expand group":"Collapse group",className:"shrink-0 w-5 text-[var(--text-dim)] hover:text-[var(--text-primary)] transition text-xs",children:t?"▸":"▾"}):e.jsx("span",{className:"shrink-0 w-5"})}const OA=Object.freeze(Object.defineProperty({__proto__:null,RouteGroupDisclosure:du},Symbol.toStringTag,{value:"Module"})),Yl={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5"};function Qo({routeEntity:t,onSelectRoute:n,onSelectScenario:s,columns:r=4,defaultCollapsed:a=!1,headingVariant:o="default"}){const i=t.scenarios.length,[c,d]=l.useState(a),u=iu(t),h=o==="explore",p=h?"group flex min-w-0 cursor-pointer items-baseline gap-2 text-left":"group flex flex-1 min-w-0 cursor-pointer items-center gap-2 text-left",f=e.jsx(cu,{routeEntity:t,variant:o}),m=e.jsx(du,{collapsed:c,onToggle:()=>d(b=>!b),disclosable:i>0}),g=u?e.jsx(ur,{href:u,onNavigate:()=>n(t.route),className:p,children:f}):e.jsx("button",{onClick:()=>n(t.route),className:p,type:"button",children:f});return e.jsxs("div",{className:"mb-10 border-b border-[var(--border-subtle)] pb-8",children:[e.jsx("div",{className:"flex items-center gap-2",children:h?e.jsxs(e.Fragment,{children:[g,m]}):e.jsxs(e.Fragment,{children:[m,g]})}),i>0&&!c?e.jsx("div",{className:`mt-4 grid gap-x-5 gap-y-9 ${Yl[r]??Yl[4]}`,children:t.scenarios.map(b=>e.jsx(lu,{scenario:b,onSelect:s?()=>s(b.slug):void 0},b.slug))}):i===0?e.jsx("p",{className:`mt-1 text-[10px] text-[var(--text-dim)]${h?"":" pl-7"}`,children:"No scenarios yet"}):null]})}const AA=Object.freeze(Object.defineProperty({__proto__:null,RouteListCard:Qo},Symbol.toStringTag,{value:"Module"}));function uu({active:t,onChange:n}){const s=r=>`rounded-lg px-5 py-1.5 text-sm font-medium transition ${r?"bg-[var(--bg-card)] text-[var(--text-primary)]":"text-[var(--text-dim)] hover:text-[var(--text-secondary)]"}`;return e.jsxs("div",{role:"tablist","aria-label":"Simulation kind",className:"flex items-center gap-1 rounded-xl bg-[var(--bg-surface,transparent)] border border-[var(--border-subtle)] p-1 shrink-0",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":t==="pages",onClick:()=>n("pages"),className:s(t==="pages"),children:"Pages"}),e.jsx("button",{type:"button",role:"tab","aria-selected":t==="components",onClick:()=>n("components"),className:s(t==="components"),children:"Components"})]})}const RA=Object.freeze(Object.defineProperty({__proto__:null,RouteKindToggle:uu},Symbol.toStringTag,{value:"Module"}));function hu(){return e.jsxs("svg",{viewBox:"0 0 16 16",className:"w-[15px] h-[15px]",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),e.jsx("path",{d:"M10.4 10.4 L14 14"})]})}const EA=Object.freeze(Object.defineProperty({__proto__:null,SearchIcon:hu},Symbol.toStringTag,{value:"Module"}));function pu({value:t,onChange:n,scopeLabel:s}){return e.jsxs("div",{className:"relative ml-auto w-full max-w-sm min-w-0",children:[e.jsx("span",{className:"pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 text-[var(--text-dim)]",children:e.jsx(hu,{})}),e.jsx("input",{type:"search",value:t,onChange:r=>n(r.target.value),placeholder:"Search","aria-label":`Search ${s}`,className:"w-full rounded-xl border border-[var(--border-subtle)] bg-[var(--bg-surface,transparent)] py-2.5 pl-11 pr-4 text-sm text-[var(--text-secondary)] placeholder:text-[var(--text-dim)] focus:border-[var(--lime-300)] focus:outline-none"})]})}const MA=Object.freeze(Object.defineProperty({__proto__:null,RouteSearchField:pu},Symbol.toStringTag,{value:"Module"}));function mu({columns:t}){const a=(12-(t-1)*1.6)/t;return e.jsx("svg",{viewBox:"0 0 16 16",className:"w-[15px] h-[15px]",fill:"currentColor","aria-hidden":"true",children:Array.from({length:t},(o,i)=>e.jsx("rect",{x:2+i*(a+1.6),y:3,width:a,height:10,rx:.7},i))})}const IA=Object.freeze(Object.defineProperty({__proto__:null,GridColumnsIcon:mu},Symbol.toStringTag,{value:"Module"}));function fu({columns:t,onChange:n,options:s=[2,3,4,5]}){return e.jsxs("div",{className:"flex items-center gap-1.5",title:"Thumbnails per row",children:[e.jsx("span",{className:"text-[11px] font-semibold tracking-widest uppercase text-[var(--text-dim)] mr-0.5",children:"Grid"}),s.map(r=>e.jsx("button",{type:"button",onClick:()=>n(r),"aria-label":`${r} per row`,"aria-pressed":t===r,className:`w-7 h-6 rounded flex items-center justify-center transition ${t===r?"bg-[var(--lime-300)] text-black":"text-[var(--text-dim)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-card)]"}`,children:e.jsx(mu,{columns:r})},r))]})}const DA=Object.freeze(Object.defineProperty({__proto__:null,GridDensityControl:fu},Symbol.toStringTag,{value:"Module"}));function gu({columns:t,onColumnsChange:n,onOpenGallery:s}){return e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[s?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:s,"aria-label":"Full screen",title:"Full screen",className:"w-7 h-6 rounded flex items-center justify-center transition text-[var(--text-dim)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-card)]",children:e.jsx(Xd,{})}),e.jsx("div",{className:"h-5 w-px bg-[var(--border-subtle)]"})]}):null,e.jsx(fu,{columns:t,onChange:n})]})}const LA=Object.freeze(Object.defineProperty({__proto__:null,RouteViewControls:gu},Symbol.toStringTag,{value:"Module"}));function F_(t){const n=[];for(const s of t)for(const r of s.scenarios)n.push({slug:r.slug,name:r.name,routeLabel:s.route||s.displayName,screenshotPath:r.screenshotPaths[0]??null,screenshotCapturedAtMs:r.screenshotCapturedAtMs??null});return n}function bu({pages:t,components:n,componentSurfaceReason:s=null,onSelectRoute:r,onSelectScenario:a}){const[o,i]=l.useState("pages"),[c,d]=l.useState(4),[u,h]=l.useState(""),[p,f]=l.useState(!1),m=o==="components",g=m?n:t,b=l.useMemo(()=>F_(g),[g]),x=b.length>0&&!!a,y=l.useMemo(()=>{const v=u.trim().toLowerCase();return v?g.filter(w=>w.displayName.toLowerCase().includes(v)):g},[g,u]);return e.jsxs("div",{children:[p&&x?e.jsx(Qd,{shots:b,onSelect:v=>a==null?void 0:a(v),onClose:()=>f(!1)}):null,e.jsxs("div",{className:"flex items-center gap-5 mb-9",children:[e.jsx(uu,{active:o,onChange:i}),e.jsx(pu,{value:u,onChange:h,scopeLabel:m?"components":"pages"}),e.jsx(gu,{columns:c,onColumnsChange:d,onOpenGallery:x?()=>f(!0):void 0})]}),y.length>0?y.map((v,w)=>e.jsx(Qo,{routeEntity:v,onSelectRoute:r,onSelectScenario:a,columns:c,defaultCollapsed:m,headingVariant:"explore"},v.route??v.displayName??w)):g.length>0?e.jsxs("p",{className:"text-sm text-[var(--text-dim)] py-4",children:["No ",m?"components":"pages"," match “",u.trim(),"”."]}):m&&s?e.jsx(Zd,{reason:s}):e.jsxs("p",{className:"text-sm text-[var(--text-dim)] py-4",children:["No ",m?"components":"pages"," yet."]})]})}const FA=Object.freeze(Object.defineProperty({__proto__:null,RouteListTabs:bu},Symbol.toStringTag,{value:"Module"}));function Zo(t,n){const s=t.url??"Uncategorized",r=n.find(o=>o.route===s),a=(r==null?void 0:r.scenarios)??[t];if(!t.url&&t.componentName){const o=a.filter(i=>i.componentName===t.componentName);return o.length?o:[t]}return a}function $a(t){const n=t.replace(/\s*\[[^\]]*\]\s*$/,""),s=n.indexOf(" - ");return s===-1?{pageName:null,stateName:n}:{pageName:n.slice(0,s),stateName:n.slice(s+3)}}function xu(t){return To(t)?t.componentName??$a(t.name).pageName:$a(t.name).pageName}function Pr(t){return $a(t.name).stateName}function yu({currentScenario:t,scenarioGroups:n,onSelect:s,onCreateNew:r,onClose:a}){const[i,c]=l.useState(()=>({x:typeof window<"u"?Math.max(16,window.innerWidth-320-24):800,y:64})),d=l.useRef(null),u=m=>{d.current={dx:m.clientX-i.x,dy:m.clientY-i.y},m.currentTarget.setPointerCapture(m.pointerId)},h=m=>{d.current&&c({x:m.clientX-d.current.dx,y:m.clientY-d.current.dy})},p=m=>{d.current=null,m.currentTarget.releasePointerCapture(m.pointerId)},f=l.useMemo(()=>Zo(t,n),[t,n]);return e.jsxs("div",{className:"fixed z-50 flex flex-col rounded-xl border border-[#3d3d3d] bg-[#1b1b1b] shadow-2xl",style:{left:i.x,top:i.y,width:320,maxHeight:"70vh"},role:"dialog","aria-label":"Scenarios",children:[e.jsxs("div",{onPointerDown:u,onPointerMove:h,onPointerUp:p,className:"flex items-center justify-between px-3 py-2 border-b border-[#3d3d3d] cursor-move select-none",children:[e.jsx("span",{className:"text-[11px] font-mono font-semibold tracking-widest text-gray-300",children:"SCENARIOS"}),e.jsx("button",{type:"button",onClick:a,onPointerDown:m=>m.stopPropagation(),"aria-label":"Close scenarios",className:"text-gray-400 hover:text-white text-lg leading-none px-1 cursor-pointer",children:"×"})]}),e.jsx("div",{className:"overflow-y-auto p-2 flex flex-col gap-2 flex-1 min-h-0",children:f.map(m=>{const g=m.slug===t.slug,b=m.screenshotPaths[0];return e.jsxs("button",{type:"button",onClick:()=>s(m.slug),className:`flex items-center gap-3 w-full p-2 rounded-lg text-left transition-colors cursor-pointer border ${g?"border-[var(--lime-300)] bg-[#1a2a30]":"border-[#333] hover:bg-[#242424]"}`,children:[e.jsx("div",{className:"w-24 h-16 shrink-0 rounded-md overflow-hidden border border-[#3d3d3d] bg-[#0f0f0f] flex items-center justify-center",children:b?e.jsx("img",{src:_n(b),alt:"",className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-[10px] text-gray-600",children:"No preview"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[11px] text-gray-500 truncate",children:m.url??"component"}),e.jsx("div",{className:`text-sm font-medium truncate ${g?"text-white":"text-gray-200"}`,children:Pr(m)})]})]},m.slug)})}),e.jsx("button",{type:"button",onClick:r,className:"border-t border-[#3d3d3d] px-3 py-2.5 text-left text-[11px] font-mono tracking-wide text-[var(--accent-active)] hover:bg-[var(--accent-active)]/10 cursor-pointer",children:"+ CREATE NEW STATE"})]})}const zA=Object.freeze(Object.defineProperty({__proto__:null,LivePageScenariosModal:yu},Symbol.toStringTag,{value:"Module"})),Sn={apps:[],isSingleApp:!1,onSelectApps:()=>{},onSelectApp:()=>{},onSelectRoute:()=>{}};function Nn(){const[t,n]=l.useState({}),s=l.useRef({});return l.useEffect(()=>{let r=!1;const a=async()=>{try{const i=await fetch("/api/editor-dev-server");if(!i.ok)return;const c=await i.json();if(r)return;const d=typeof c.scenariosVersion=="number"?c.scenariosVersion:void 0,u=typeof c.plansVersion=="number"?c.plansVersion:void 0,h=typeof c.testsVersion=="number"?c.testsVersion:void 0,p=typeof c.claimsVersion=="number"?c.claimsVersion:void 0,f=typeof c.sourceVersion=="number"?c.sourceVersion:void 0,m=typeof c.liveReloadEnabled=="boolean"?c.liveReloadEnabled:void 0;(d!==s.current.scenariosVersion||u!==s.current.plansVersion||h!==s.current.testsVersion||p!==s.current.claimsVersion||f!==s.current.sourceVersion||m!==s.current.liveReloadEnabled)&&(s.current={scenariosVersion:d,plansVersion:u,testsVersion:h,claimsVersion:p,sourceVersion:f,liveReloadEnabled:m},n(s.current))}catch{}};a();const o=setInterval(a,500);return()=>{r=!0,clearInterval(o)}},[]),t}function z_(t){const[n,s]=l.useState({status:"idle"}),{scenariosVersion:r}=Nn();return l.useEffect(()=>{if(!t){s({status:"idle"});return}let a=!1;return s({status:"loading"}),(async()=>{try{const o=await fetch(`/api/entities/${t}`);if(a)return;if(o.status===404){s({status:"not-found"});return}if(!o.ok){s({status:"error",message:`HTTP ${o.status}`});return}const i=await o.json(),c={...i,scenarios:Array.isArray(i.scenarios)?i.scenarios.map(Oo):[]};s({status:"loaded",entity:c})}catch(o){if(a)return;s({status:"error",message:o instanceof Error?o.message:"Failed to load entity"})}})(),()=>{a=!0}},[t,r]),n}function Xs({message:t}){return e.jsx("div",{className:"px-5 py-8",children:e.jsx(Qe,{text:t,className:"text-sm text-[var(--accent-red)]",rowClassName:"justify-center"})})}const $A=Object.freeze(Object.defineProperty({__proto__:null,AppDetailContentError:Xs},Symbol.toStringTag,{value:"Module"}));function Ba(){return e.jsx("div",{className:"px-5 py-8 text-center text-[var(--text-dim)]",children:"Loading routes..."})}const BA=Object.freeze(Object.defineProperty({__proto__:null,AppDetailContentLoading:Ba},Symbol.toStringTag,{value:"Module"}));function $_(t){return t.kind==="function"?"Functions don't have visual scenarios. Coverage for this function lives in its unit tests.":t.kind==="component"?`No component scenarios for ${t.displayName}. Create one with \`codeyam-editor editor register\` or capture from the live preview.`:"No scenarios for this entity yet."}function vu({entityRef:t,onNavigate:n}){return e.jsxs("button",{type:"button",onClick:()=>n(t.hash),className:"w-full rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-card)] p-3 text-left transition hover:border-[var(--border-default)]",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"rounded-md border border-[var(--border-subtle)] bg-[var(--bg-page)] px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-[var(--text-dim)]",children:t.kind}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.name})]}),e.jsx("p",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:t.filePath})]})}const qA=Object.freeze(Object.defineProperty({__proto__:null,EntityRefCard:vu},Symbol.toStringTag,{value:"Module"}));function Qs({refs:t,onNavigate:n}){return e.jsx("ul",{className:"grid grid-cols-1 gap-1",children:t.map(s=>e.jsx("li",{children:e.jsx(vu,{entityRef:s,onNavigate:n})},s.hash))})}const HA=Object.freeze(Object.defineProperty({__proto__:null,EntityRefList:Qs},Symbol.toStringTag,{value:"Module"}));function B_(t,n,s){const[r,a]=l.useState(!1),[o,i]=l.useState(""),[c,d]=l.useState(!1),u=l.useCallback(()=>{a(!0),i(n)},[n]),h=l.useCallback(()=>{a(!1)},[]),p=l.useCallback(async()=>{if(!(!o.trim()||c)){d(!0);try{const f=await fetch(`/api/scenarios/${encodeURIComponent(t)}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);const m=await f.json();m.name=o.trim(),await fetch(`/api/scenarios/${encodeURIComponent(t)}`,{method:"DELETE"}),await fetch("/api/scenarios",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),a(!1),s()}catch{}finally{d(!1)}}},[o,c,t,s]);return{renaming:r,renameName:o,renameSaving:c,setRenameName:i,startRename:u,cancelRename:h,submitRename:p}}function q_(t,n,s){const[r,a]=l.useState(!1),o=l.useCallback(async i=>{if(i.stopPropagation(),!!confirm(`Delete scenario "${n}"?`)){a(!0);try{await fetch(`/api/scenarios/${encodeURIComponent(t)}`,{method:"DELETE"}),s()}catch{}finally{a(!1)}}},[n,t,s]);return{deleting:r,handleDelete:o}}function H_({mocks:t,seeds:n}){const s=[];return t>0&&s.push(`${t} ${t===1?"mock":"mocks"} overridden`),n>0&&s.push(`${n} ${n===1?"seed":"seeds"} overridden`),s.length===0?null:s.join(" · ")}function ju({overrideCounts:t}){const n=t?H_(t):null;return n?e.jsx("div",{className:"text-xs text-[var(--text-dim)] mt-1",children:n}):null}const WA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRowOverrideBadge:ju},Symbol.toStringTag,{value:"Module"})),W_=new Set(["Desktop"]);function wu(t){var n,s;return(n=t.componentName)!=null&&n.trim()?`Isolated ${t.componentName.trim()} component`:(s=t.url)!=null&&s.trim()?`Renders ${t.url.trim()}`:t.scenarioType==="component"?"Component scenario":"Application scenario"}function _u({scenario:t,isSelected:n}){var r;const s=t.dimensions.length>0&&!(t.dimensions.length===1&&W_.has(t.dimensions[0]));return e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:`text-base font-medium truncate ${n?"text-[var(--accent-active)]":"text-[var(--text-primary)]"}`,children:t.name}),(r=t.description)!=null&&r.trim()?e.jsx("div",{className:"text-sm text-[var(--text-secondary)] mt-1 whitespace-pre-line",children:t.description}):e.jsx("div",{className:"text-sm text-[var(--text-dim)] italic mt-1",children:wu(t)}),e.jsx(ju,{overrideCounts:t.overrideCounts}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s?e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:t.dimensions.join(", ")}):null,t.componentName?e.jsx("span",{className:"text-xs text-[var(--accent-purple)]",children:t.componentName}):null]})]})}const GA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRowMeta:_u,deriveRowLabel:wu},Symbol.toStringTag,{value:"Module"}));function ku({screenshotPath:t,cacheBuster:n}){return e.jsx("div",{className:"h-[180px] w-[288px] shrink-0 flex items-center justify-center overflow-hidden rounded border border-[var(--border-subtle)] bg-[var(--bg-surface)]",children:e.jsx(kt,{screenshotPath:t??void 0,cacheBuster:n??void 0,alt:""})})}const UA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRowThumbnail:ku},Symbol.toStringTag,{value:"Module"}));function Su({onViewData:t,onRename:n,onDelete:s,deleting:r}){return e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsx("button",{onClick:t,className:"text-xs text-[var(--accent-active)] hover:opacity-70 cursor-pointer bg-transparent border-none p-0",children:"View / Edit Data"}),e.jsx("button",{onClick:n,className:"text-xs text-[var(--text-dim)] hover:text-[var(--text-primary)] cursor-pointer bg-transparent border-none p-0",children:"Rename"}),e.jsx("button",{onClick:s,disabled:r,className:"text-xs text-red-400/60 hover:text-red-400 cursor-pointer bg-transparent border-none p-0 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:text-red-400/60",children:"Delete"})]})}const YA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRowActions:Su},Symbol.toStringTag,{value:"Module"}));function Nu({name:t,saving:n,onChange:s,onSubmit:r,onCancel:a}){return e.jsxs("form",{className:"flex items-center gap-2",onSubmit:r,onClick:o=>o.stopPropagation(),children:[e.jsx("input",{type:"text",value:t,onChange:o=>s(o.target.value),className:"flex-1 px-2 py-1.5 text-sm bg-[var(--bg-input)] text-[var(--text-primary)] border border-[var(--border-default)] rounded outline-none focus:border-[var(--accent-active)] min-w-0",autoFocus:!0,disabled:n}),e.jsx("button",{type:"submit",disabled:n||!t.trim(),className:"px-3 py-1.5 text-xs bg-[var(--accent-active)] text-[var(--bg-base)] rounded hover:opacity-90 disabled:opacity-40 cursor-pointer border-none",children:n?"...":"Save"}),e.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-xs text-[var(--text-dim)] hover:text-[var(--text-primary)] cursor-pointer bg-transparent border-none",children:"Cancel"})]})}const VA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRenameForm:Nu},Symbol.toStringTag,{value:"Module"}));function Cu({scenario:t,isSelected:n,onSelect:s,onViewData:r,onScenariosChanged:a,children:o}){const i=B_(t.slug,t.name,a),{deleting:c,handleDelete:d}=q_(t.slug,t.name,a);return e.jsxs("div",{onClick:i.renaming?void 0:s,className:`rounded-lg p-3 text-left transition cursor-pointer ${n?"bg-[#1a2e1a] border border-[var(--accent-active)]/40":"bg-[var(--bg-card)] border border-transparent hover:bg-[var(--bg-input)]"}`,style:{opacity:c?.4:1},children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(ku,{screenshotPath:t.screenshotPaths[0]??null,cacheBuster:t.screenshotCapturedAtMs}),e.jsx("div",{className:"flex-1 min-w-0",children:i.renaming?e.jsx(Nu,{name:i.renameName,saving:i.renameSaving,onChange:i.setRenameName,onSubmit:u=>{u.preventDefault(),i.submitRename()},onCancel:i.cancelRename}):e.jsxs(e.Fragment,{children:[e.jsx(_u,{scenario:t,isSelected:n}),n&&e.jsx(Su,{onViewData:u=>{u.stopPropagation(),r()},onRename:u=>{u.stopPropagation(),i.startRename()},onDelete:d,deleting:c})]})})]}),o&&e.jsx("div",{className:"mt-3 cursor-default",onClick:u=>u.stopPropagation(),children:o})]})}const KA=Object.freeze(Object.defineProperty({__proto__:null,ScenarioRow:Cu},Symbol.toStringTag,{value:"Module"}));function Pu(){return e.jsx("div",{className:"rounded-xl border border-dashed border-[var(--border-default)] px-4 py-5 text-sm text-[var(--text-dim)]",children:"No scenarios registered for this route yet."})}const JA=Object.freeze(Object.defineProperty({__proto__:null,RouteScenarioEmptyState:Pu},Symbol.toStringTag,{value:"Module"}));function ei({scenarios:t,selectedSlug:n,onSelectScenario:s,onScenariosChanged:r}){const[a,o]=l.useState(null);return t.length===0?e.jsx(Pu,{}):e.jsx("div",{className:"grid grid-cols-1 gap-2",children:t.map(i=>e.jsx(Cu,{scenario:i,isSelected:i.slug===n,onSelect:()=>{a&&a!==i.slug&&o(null),s(i.slug)},onViewData:()=>o(a===i.slug?null:i.slug),onScenariosChanged:r,children:a===i.slug&&e.jsx(Lw,{variant:"inline",slug:i.slug,scenarioName:i.name,onClose:()=>o(null)})},i.slug))})}const XA=Object.freeze(Object.defineProperty({__proto__:null,RouteScenarioList:ei},Symbol.toStringTag,{value:"Module"})),G_="This component renders no other tracked components.",U_="This component imports no tracked functions.",Y_="Not called from any tracked entity. This may be a public export, an unused function, or a function whose callers haven't been re-analyzed yet.";function Tu({activeTab:t,entity:n,componentRefs:s,functionRefs:r,selectedSlug:a,onSelectScenario:o,onNavigateToEntity:i,onScenariosChanged:c}){return e.jsxs("div",{className:"flex-1 overflow-auto px-5 py-4",children:[t==="scenarios"&&(n.scenarios.length===0?e.jsx(as,{copy:$_(n)}):e.jsx(ei,{scenarios:n.scenarios,selectedSlug:a,onSelectScenario:o,onScenariosChanged:c})),t==="components"&&(s.length===0?e.jsx(as,{copy:G_}):e.jsx(Qs,{refs:s,onNavigate:i})),t==="functions"&&(r.length===0?e.jsx(as,{copy:U_}):e.jsx(Qs,{refs:r,onNavigate:i})),t==="callers"&&(n.callers.length===0?e.jsx(as,{copy:Y_}):e.jsx(Qs,{refs:n.callers,onNavigate:i}))]})}function as({copy:t}){return e.jsx("p",{className:"text-xs italic text-[var(--text-dim)]",children:t})}const QA=Object.freeze(Object.defineProperty({__proto__:null,EmptyTabCopy:as,EntityDetailContent:Tu},Symbol.toStringTag,{value:"Module"}));function V_(t){return typeof t!="string"&&typeof t.onClick=="function"}function K_(t){return typeof t=="string"?t:t.label}function J_(t,n){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),n())}function Ou({segments:t}){if(t.length===0)return null;const n=t.length-1;return e.jsx("span",{className:"text-sm",style:{color:"var(--text-muted)"},children:t.map((s,r)=>{const a=K_(s),o=r===n,i=!o&&V_(s);return e.jsxs("span",{children:[e.jsx("span",{style:{color:"var(--text-dim)"},children:" / "}),i?e.jsx("button",{type:"button",onClick:s.onClick,onKeyDown:c=>J_(c,s.onClick),className:"cursor-pointer hover:text-[var(--text-primary)] transition",style:{color:"inherit",background:"none",padding:0},children:a}):e.jsx("span",{style:o?{color:"var(--text-primary)"}:void 0,children:a})]},r)})})}const ZA=Object.freeze(Object.defineProperty({__proto__:null,BreadcrumbNav:Ou},Symbol.toStringTag,{value:"Module"}));function Tr({apps:t,selectedApp:n,selectedRouteEntity:s,currentEntity:r,isSingleApp:a,onSelectApps:o,onSelectApp:i,onSelectRoute:c}){const d=[];if(!a&&t.length>0&&d.push({label:"Apps",onClick:o}),n){const h=s!==null||r!=null;a&&!h||d.push({label:n.name,onClick:()=>i(n.dir)})}return s!==null&&r!=null&&s?d.push({label:s.displayName,onClick:()=>c(s.route)}):s&&d.push({label:s.displayName}),r&&d.push({label:r.displayName}),e.jsx(Ou,{segments:d})}const eR=Object.freeze(Object.defineProperty({__proto__:null,EntityBreadcrumb:Tr},Symbol.toStringTag,{value:"Module"}));function Au({entity:t,app:n=null,routeEntity:s=null,navContext:r=Sn}){var o;const a=t.kind==="component"?"Component":"Function";return e.jsxs("header",{className:"border-b border-[var(--border-subtle)] px-5 py-3",children:[e.jsx("div",{className:"mb-1",children:e.jsx(Tr,{apps:r.apps,selectedApp:n,selectedRouteEntity:s,currentEntity:t,isSingleApp:r.isSingleApp,onSelectApps:r.onSelectApps,onSelectApp:r.onSelectApp,onSelectRoute:r.onSelectRoute})}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"rounded-md border border-[var(--border-subtle)] bg-[var(--bg-card)] px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-[var(--text-dim)]",children:a}),e.jsx("h2",{className:"text-base font-semibold text-[var(--text-primary)]",children:t.displayName})]}),e.jsx("p",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:t.filePath}),((o=t.glossaryEntry)==null?void 0:o.description)&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-secondary)]",children:t.glossaryEntry.description})]})}const tR=Object.freeze(Object.defineProperty({__proto__:null,EntityDetailHeader:Au},Symbol.toStringTag,{value:"Module"})),X_=["scenarios","components","functions"];function ti({activeTab:t,onTabChange:n,scenarioCount:s,componentCount:r=0,functionCount:a=0,callersCount:o=0,tabs:i=X_}){const c={scenarios:"Scenarios",components:"Components",functions:"Functions",callers:"Callers"},d={scenarios:s,components:r,functions:a,callers:o};return e.jsx("div",{className:"flex w-full border-t border-b border-[var(--border-default)]",children:i.map(u=>e.jsxs("button",{onClick:()=>n(u),className:`cursor-pointer px-4 py-2 font-mono text-xs font-medium uppercase tracking-wider transition border-b-2 ${t===u?"text-[var(--accent-active)] border-[var(--accent-active)]":"text-[var(--text-dim)] border-transparent hover:text-[var(--text-muted)]"}`,type:"button",children:[c[u]," (",d[u],")"]},u))})}const nR=Object.freeze(Object.defineProperty({__proto__:null,RouteEntityTabs:ti},Symbol.toStringTag,{value:"Module"})),Q_=["scenarios","components","functions"],Z_=["scenarios","callers"];function Ru({app:t=null,navContext:n=Sn,routeEntity:s=null,entity:r,selectedSlug:a,onSelectScenario:o,onNavigateToEntity:i,onScenariosChanged:c}){const[d,u]=l.useState("scenarios"),{componentRefs:h,functionRefs:p}=l.useMemo(()=>{const m=[],g=[];for(const b of r.directImports)b.kind==="function"?g.push(b):m.push(b);return{componentRefs:m,functionRefs:g}},[r.directImports]),f=r.kind==="function"?Z_:Q_;return e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Au,{app:t,navContext:n,routeEntity:s,entity:r}),e.jsx(ti,{activeTab:d,onTabChange:u,scenarioCount:r.scenarios.length,componentCount:h.length,functionCount:p.length,callersCount:r.callers.length,tabs:f}),e.jsx(Tu,{activeTab:d,entity:r,componentRefs:h,functionRefs:p,selectedSlug:a,onSelectScenario:o,onNavigateToEntity:i,onScenariosChanged:c})]})}const sR=Object.freeze(Object.defineProperty({__proto__:null,EntityDetail:Ru},Symbol.toStringTag,{value:"Module"}));function e1(t){const n=[],s=[];for(const r of t)yd(r.url)||(r.scenarioType==="component"?s.push(r):n.push(r));return{application:n,component:s}}function Eu({scenario:t,onPreview:n}){const s=t.screenshotPaths.length>0,[r,a]=l.useState(!1),o=s&&!r;return e.jsxs("div",{className:`rounded-lg border border-[var(--border-default)] bg-[var(--bg-surface)] p-3 ${n?"cursor-pointer hover:border-[var(--border-subtle)]":""}`,onClick:n,children:[o?e.jsx("img",{src:_n(t.screenshotPaths[0],t.screenshotCapturedAtMs),alt:t.name,className:"mb-2 w-full rounded border border-[var(--border-default)]",onError:()=>a(!0)}):e.jsx("div",{className:"mb-2 flex h-32 items-center justify-center rounded border border-dashed border-[var(--border-default)] text-sm text-[var(--text-dim)]",children:"No screenshot"}),e.jsx("p",{className:"text-sm font-medium text-[var(--text-secondary)]",children:t.name}),e.jsxs("div",{className:"mt-1 flex gap-1",children:[t.hasMocks&&e.jsx("span",{className:"rounded bg-[var(--accent-blue)]/20 px-1.5 py-0.5 text-xs text-[var(--accent-blue)]",children:"mocks"}),t.hasSeed&&e.jsx("span",{className:"rounded bg-[var(--accent-purple)]/20 px-1.5 py-0.5 text-xs text-[var(--accent-purple)]",children:"seed"}),t.dimensions.map(i=>e.jsx("span",{className:"rounded bg-[var(--bg-input)] px-1.5 py-0.5 text-xs text-[var(--text-muted)]",children:i},i))]})]})}const rR=Object.freeze(Object.defineProperty({__proto__:null,ScenarioCard:Eu},Symbol.toStringTag,{value:"Module"}));function qa({label:t,scenarios:n,onSelectScenario:s,className:r}){return e.jsxs("section",{className:r,children:[e.jsx("h3",{className:"mb-3 text-xs font-semibold uppercase tracking-wide text-[var(--text-muted)]",children:t}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(a=>e.jsx(Eu,{scenario:a,onPreview:()=>s(a.slug)},a.slug))})]})}const aR=Object.freeze(Object.defineProperty({__proto__:null,ScenarioTypeSection:qa},Symbol.toStringTag,{value:"Module"}));function Mu({feature:t,passed:n,failed:s,total:r}){return e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:t}),e.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:[r," test",r!==1?"s":""]}),r>0&&e.jsxs("span",{className:`text-xs font-medium ${s>0?"text-[var(--accent-red)]":"text-[var(--accent-green)]"}`,children:[n,"/",r]})]})}const oR=Object.freeze(Object.defineProperty({__proto__:null,TestGroupHeader:Mu},Symbol.toStringTag,{value:"Module"}));function Iu({test:t}){const n=(t.description??"").length>0,s=t.status==="passed"?"text-[var(--accent-green)]":t.status==="failed"?"text-[var(--accent-red)]":"text-[var(--text-dim)]",r=t.status==="passed"?"✓":t.status==="failed"?"✗":"○";return e.jsxs("div",{className:"flex items-start gap-2 py-1 px-3",children:[e.jsx("span",{className:`text-xs leading-5 ${s}`,children:r}),e.jsx("div",{className:"min-w-0",children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-[var(--text-secondary)] truncate",children:t.description}),e.jsx("p",{className:"font-mono text-[10px] text-[var(--text-dim)] truncate",children:t.key})]}):e.jsx("p",{className:"text-xs text-[var(--text-secondary)] truncate",children:t.key})})]})}const iR=Object.freeze(Object.defineProperty({__proto__:null,TestGroupRow:Iu},Symbol.toStringTag,{value:"Module"}));function Du({groups:t}){return t.length===0?e.jsx("div",{className:"px-5 py-8 text-center text-[var(--text-dim)]",children:"No tests found."}):e.jsx("div",{className:"py-3",children:t.map(n=>{const s=n.tests.filter(o=>o.status==="passed").length,r=n.tests.filter(o=>o.status==="failed").length,a=n.tests.length;return e.jsxs("div",{className:"mb-1",children:[e.jsx(Mu,{feature:n.feature,passed:s,failed:r,total:a}),e.jsx("div",{className:"px-5 pb-2",children:n.tests.map((o,i)=>e.jsx(Iu,{test:o},`${o.file}-${o.key??o.line??i}`))})]},n.feature)})})}const lR=Object.freeze(Object.defineProperty({__proto__:null,TestGroupList:Du},Symbol.toStringTag,{value:"Module"}));function Lu({allScenarios:t,testGroups:n,onSelectScenario:s}){const{application:r,component:a}=e1(t),o=r.length>0||a.length>0;return e.jsxs("div",{className:"px-5 py-5",children:[o?e.jsxs(e.Fragment,{children:[r.length>0&&e.jsx(qa,{label:"Application",scenarios:r,onSelectScenario:s}),a.length>0&&e.jsx(qa,{label:"Component",scenarios:a,onSelectScenario:s,className:r.length>0?"mt-8":void 0})]}):e.jsx("p",{className:"text-sm text-[var(--text-dim)]",children:"No scenarios yet"}),e.jsx("div",{className:"mt-8",children:e.jsx(Du,{groups:n})})]})}const cR=Object.freeze(Object.defineProperty({__proto__:null,NonWebAppDetail:Lu},Symbol.toStringTag,{value:"Module"}));function t1(t,n){const s=[],r=[];for(const a of t){const o=kn(a);/^[A-Z]/.test(o)&&!o.startsWith("use")?s.push(a):r.push(a)}return{componentImports:s,functionImports:r}}function Fu({ancestor:t,onNavigateToEntity:n}){const s=n?()=>n(_s(t.filePath,kn(t.filePath))):void 0;return e.jsxs("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:r=>{s&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),s())},className:"cursor-pointer rounded-md border border-[var(--border-subtle)] bg-[var(--bg-card)] px-3 py-2 transition hover:border-[var(--border-default)]",children:[e.jsx("p",{className:"text-sm font-medium text-[var(--text-primary)]",children:t.displayName}),e.jsx("p",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:t.filePath})]})}const dR=Object.freeze(Object.defineProperty({__proto__:null,LayoutChainCard:Fu},Symbol.toStringTag,{value:"Module"}));function zu({layoutChain:t,onNavigateToEntity:n}){return t.length===0?null:e.jsxs("section",{className:"border-b border-[var(--border-subtle)] px-5 py-3",children:[e.jsx("h3",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-[var(--text-dim)]",children:"Layout chain"}),e.jsx("div",{className:"flex flex-col gap-1",children:t.map(s=>e.jsx(Fu,{ancestor:s,onNavigateToEntity:n},`${s.kind}:${s.filePath}`))})]})}const uR=Object.freeze(Object.defineProperty({__proto__:null,LayoutChainSection:zu},Symbol.toStringTag,{value:"Module"}));function n1({importPath:t,derivedName:n,allScenarios:s,routeEntities:r}){const a=s.filter(i=>i.scenarioType==="component"&&(i.pageFilePath===t||i.componentName===n)),o=r.filter(i=>i.directImports.length===1&&i.directImports[0]===t&&kn(i.directImports[0])===n);if(o.length===1){const i=o[0].scenarios,c=[...a];for(const d of i)c.some(u=>u.slug===d.slug)||c.push(d);return c}return a}function Zs(t){const n=[];for(const s of t.split("/"))s===""||s==="."||(s===".."?n.pop():n.push(s));return n.join("/")}function s1(t){const n=new Map;for(const[s,r]of Object.entries(t)){const a=Zs(s),o=kn(a),i=_s(a,o);n.has(i)||n.set(i,{hash:i,filePath:a,entityName:o,imports:r.imports.map(Zs),importedBy:r.importedBy.map(Zs)})}return n}function r1(t,n){if(!t)return null;const s=Zs(n);for(const r of t.values())if(r.filePath===s)return r;return null}function $u(t,n){if(!t)return[];const s=[];for(const r of n){const a=r1(t,r);a&&s.push(a)}return s}function a1(t,n){return t.find(s=>s.pageFilePath===n)??null}function Bu(t){const n=t.split("/"),s=n.pop()??t,r=n.join("/");return{fileName:s,dirPath:r}}function qu({displayName:t,entity:n,isNavigable:s}){return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg font-semibold text-[var(--text-secondary)]",children:t}),n?e.jsx("span",{className:"rounded bg-[var(--bg-input)] px-1.5 py-0.5 font-mono text-[9px] text-[var(--text-dim)]",children:n.hash.slice(0,8)}):null,s?e.jsx("span",{className:"ml-auto text-[10px] text-[var(--text-dim)]",children:"→"}):null]})}const hR=Object.freeze(Object.defineProperty({__proto__:null,RouteDependencyCardHeader:qu},Symbol.toStringTag,{value:"Module"}));function Hu({scenarios:t,onSelectScenario:n}){return t.length===0?e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-dim)]",children:"No scenarios"}):e.jsxs("div",{className:"mt-2 flex flex-row gap-1.5",children:[t.slice(0,4).map(s=>{const r=s.screenshotPaths[0]??null;return e.jsxs("button",{type:"button",onClick:a=>{a.stopPropagation(),n(s.slug)},className:"flex w-[192px] shrink-0 flex-col gap-1 transition",children:[e.jsx("div",{className:"flex h-[120px] w-[192px] items-center justify-center overflow-hidden rounded border border-[var(--border-subtle)] bg-[var(--bg-card)] transition hover:border-[var(--border-default)]",children:e.jsx(kt,{screenshotPath:r??void 0,alt:s.name})}),e.jsx("span",{className:"w-full truncate text-center text-[10px] text-[var(--text-secondary)]",children:s.name})]},s.slug)}),t.length>4&&e.jsx("div",{className:"flex h-[120px] items-center px-1",children:e.jsxs("span",{className:"text-[10px] text-[var(--text-dim)]",children:["+",t.length-4]})})]})}const pR=Object.freeze(Object.defineProperty({__proto__:null,RouteDependencyScenarioStrip:Hu},Symbol.toStringTag,{value:"Module"}));function Wu({importPath:t,entity:n,scenarios:s,onNavigate:r,onSelectScenario:a}){const{fileName:o,dirPath:i}=Bu(t),c=(n==null?void 0:n.entityName)??o.replace(/\.[^.]+$/,"");return e.jsxs("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r??void 0,onKeyDown:r?d=>{(d.key==="Enter"||d.key===" ")&&r()}:void 0,className:`rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-card)] p-3 transition hover:border-[var(--border-default)] ${r?"cursor-pointer":""}`,children:[e.jsx(qu,{displayName:c,entity:n,isNavigable:r!==null}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:[i,"/"]}),e.jsx(Hu,{scenarios:s,onSelectScenario:a})]})}const mR=Object.freeze(Object.defineProperty({__proto__:null,RouteDependencyCard:Wu},Symbol.toStringTag,{value:"Module"}));function Gu(){return e.jsx("p",{className:"py-4 text-center text-xs text-[var(--text-dim)]",children:"No dependencies found"})}const fR=Object.freeze(Object.defineProperty({__proto__:null,RouteDependencyEmptyState:Gu},Symbol.toStringTag,{value:"Module"}));function Uu({directImports:t,entityLookup:n,allScenarios:s,routeEntities:r,onNavigateToRoute:a,onNavigateToEntity:o,onSelectScenario:i}){const c=l.useMemo(()=>$u(n,t),[n,t]);return t.length===0?e.jsx(Gu,{}):e.jsx("div",{className:"grid grid-cols-1 gap-1",children:t.map(d=>{const u=c.find(b=>b.filePath===d)??null,h=(u==null?void 0:u.entityName)??kn(d),p=n1({importPath:d,derivedName:h,allScenarios:s??[],routeEntities:r??[]}),f=a1(r??[],d),m=_s(d,h),g=f?()=>a(f.route):o?()=>o(m):null;return e.jsx(Wu,{importPath:d,entity:u,scenarios:p,onNavigate:g,onSelectScenario:i},d)})})}const gR=Object.freeze(Object.defineProperty({__proto__:null,RouteDependencyList:Uu},Symbol.toStringTag,{value:"Module"}));function o1(t,n,s){const r=new Set,a=t.replace(/\.(ts|tsx)$/,"");r.add(`${a}.test.ts`),r.add(`${a}.test.tsx`);const o=n.get(t);if(o!=null&&o.importedBy)for(const c of o.importedBy)/\.test\.(ts|tsx)$/.test(c)&&r.add(c);return s.flatMap(c=>c.tests).filter(c=>r.has(c.file))}function Yu({status:t}){return t==="passed"?e.jsx("span",{className:"mt-0.5 text-xs text-[var(--accent-green)]",children:"✓"}):t==="failed"?e.jsx("span",{className:"mt-0.5 text-xs text-[var(--accent-red)]",children:"✗"}):e.jsx("span",{className:"mt-0.5 text-xs text-[var(--text-dim)]",children:"○"})}const bR=Object.freeze(Object.defineProperty({__proto__:null,TestStatusIcon:Yu},Symbol.toStringTag,{value:"Module"}));function Vu({test:t}){const n=t.description.length>0;return e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx(Yu,{status:t.status}),e.jsx("div",{children:n?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:t.description}),e.jsx("p",{className:"font-mono text-xs text-[var(--text-dim)]",children:t.key})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:t.key}),e.jsx("p",{className:"text-xs italic text-[var(--text-dim)]",children:"no description"})]})})]})}const xR=Object.freeze(Object.defineProperty({__proto__:null,TestItem:Vu},Symbol.toStringTag,{value:"Module"}));function Ku({importPath:t,entityName:n,tests:s,onNavigate:r}){const{dirPath:a}=Bu(t);return e.jsxs("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r??void 0,onKeyDown:r?o=>{(o.key==="Enter"||o.key===" ")&&r()}:void 0,className:`rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-card)] p-3 transition hover:border-[var(--border-default)] ${r?"cursor-pointer":""}`,children:[e.jsx("p",{className:"text-sm font-medium text-[var(--text-primary)]",children:n}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:[a,"/"]}),e.jsx("div",{className:"mt-2",children:s.length>0?e.jsx("div",{className:"space-y-0.5",children:s.map((o,i)=>e.jsx(Vu,{test:o},`${o.file}:${o.key??o.line??i}`))}):e.jsx("p",{className:"text-xs text-[var(--text-dim)] italic",children:"No tests"})})]})}const yR=Object.freeze(Object.defineProperty({__proto__:null,RouteFunctionCard:Ku},Symbol.toStringTag,{value:"Module"}));function Ju(){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No function imports found"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-dim)]",children:"This component only imports other components"})]})}const vR=Object.freeze(Object.defineProperty({__proto__:null,RouteFunctionEmptyState:Ju},Symbol.toStringTag,{value:"Module"}));function Xu({functionImports:t,entityLookup:n,testGroups:s,onNavigateToEntity:r}){const a=l.useMemo(()=>$u(n,t),[n,t]);return t.length===0?e.jsx(Ju,{}):e.jsx("div",{className:"grid grid-cols-1 gap-1",children:t.map(o=>{const i=a.find(h=>h.filePath===o)??null,c=(i==null?void 0:i.entityName)??kn(o),d=o1(o,n,s),u=r?()=>r(_s(o,c)):null;return e.jsx(Ku,{importPath:o,entityName:c,tests:d,onNavigate:u},o)})})}const jR=Object.freeze(Object.defineProperty({__proto__:null,RouteFunctionList:Xu},Symbol.toStringTag,{value:"Module"}));function Qu({activeTab:t,routeEntity:n,componentImports:s,functionImports:r,testGroups:a,selectedSlug:o,entityLookup:i,allScenarios:c,routeEntities:d,onSelectScenario:u,onNavigateToRoute:h,onNavigateToEntity:p,onScenariosChanged:f}){return e.jsxs("div",{className:"flex-1 overflow-auto px-5 py-4",children:[t==="scenarios"&&e.jsx(ei,{scenarios:n.scenarios,selectedSlug:o,onSelectScenario:u,onScenariosChanged:f}),t==="components"&&e.jsx(Uu,{directImports:s,entityLookup:i,allScenarios:c,routeEntities:d,onNavigateToRoute:h,onNavigateToEntity:p,onSelectScenario:u}),t==="functions"&&e.jsx(Xu,{functionImports:r,entityLookup:i,testGroups:a,onNavigateToEntity:p})]})}const wR=Object.freeze(Object.defineProperty({__proto__:null,RouteEntityDetailContent:Qu},Symbol.toStringTag,{value:"Module"}));function Zu({displayName:t,pageFilePath:n,app:s=null,routeEntity:r=null,navContext:a=Sn}){return e.jsxs("div",{className:"px-5 py-4",children:[e.jsx("div",{className:"mb-2",children:e.jsx(Tr,{apps:a.apps,selectedApp:s,selectedRouteEntity:r,isSingleApp:a.isSingleApp,onSelectApps:a.onSelectApps,onSelectApp:a.onSelectApp,onSelectRoute:a.onSelectRoute})}),e.jsx("h2",{className:"text-xl font-medium text-[var(--text-primary)]",children:t}),n?e.jsx("p",{className:"mt-1 font-mono text-xs text-[var(--text-dim)]",children:n}):null]})}const _R=Object.freeze(Object.defineProperty({__proto__:null,RouteEntityDetailHeader:Zu},Symbol.toStringTag,{value:"Module"}));function eh({app:t=null,navContext:n=Sn,routeEntity:s,selectedSlug:r,entityLookup:a,allScenarios:o,routeEntities:i,testGroups:c,onSelectScenario:d,onNavigateToRoute:u,onNavigateToEntity:h,onScenariosChanged:p}){const[f,m]=l.useState("scenarios"),{componentImports:g,functionImports:b}=l.useMemo(()=>t1(s.directImports),[s.directImports]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx(Zu,{app:t,navContext:n,routeEntity:s,displayName:s.displayName,pageFilePath:s.pageFilePath}),e.jsx(zu,{layoutChain:s.layoutChain??[],onNavigateToEntity:h}),e.jsx(ti,{activeTab:f,onTabChange:m,scenarioCount:s.scenarios.length,componentCount:g.length,functionCount:b.length}),e.jsx(Qu,{activeTab:f,routeEntity:s,componentImports:g,functionImports:b,testGroups:c,selectedSlug:r,entityLookup:a,allScenarios:o,routeEntities:i,onSelectScenario:d,onNavigateToRoute:u,onNavigateToEntity:h,onScenariosChanged:p})]})}const kR=Object.freeze(Object.defineProperty({__proto__:null,RouteEntityDetail:eh},Symbol.toStringTag,{value:"Module"}));function th(){return e.jsx("div",{className:"px-5 py-8 text-center text-[var(--text-dim)]",children:"No routes discovered yet."})}const SR=Object.freeze(Object.defineProperty({__proto__:null,RouteListEmptyState:th},Symbol.toStringTag,{value:"Module"}));function nh({label:t="Pages"}={}){return e.jsx("div",{className:"mb-3",children:e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-dim)]",children:t})})}const NR=Object.freeze(Object.defineProperty({__proto__:null,RouteListSectionHeader:nh},Symbol.toStringTag,{value:"Module"}));function Ha({label:t,routeEntities:n,onSelectRoute:s,onSelectScenario:r,className:a}){return e.jsxs("div",{className:a,children:[e.jsx(nh,{label:t}),e.jsx("div",{children:n.map(o=>e.jsx(Qo,{routeEntity:o,onSelectRoute:s,onSelectScenario:r},o.route))})]})}const CR=Object.freeze(Object.defineProperty({__proto__:null,RouteListSection:Ha},Symbol.toStringTag,{value:"Module"}));function sh({providerLabel:t,chatOpen:n,onToggleChat:s}){const r=n?"border-[var(--accent-active)] bg-[var(--accent-active)]/15 text-[var(--accent-active)]":"border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40";return e.jsxs("button",{type:"button",onClick:s,className:`shrink-0 flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors ${r}`,title:`Open a chat with ${t} to investigate why this page is not shown`,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),n?"Close":`Investigate with ${t}`]})}const PR=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPageInvestigateButton:sh},Symbol.toStringTag,{value:"Module"}));function rh({displayName:t,path:n}){return e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--text-primary)] truncate",children:t}),e.jsx("p",{className:"text-xs font-mono text-[var(--text-dim)] truncate",children:n})]})}const TR=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPageRowSummary:rh},Symbol.toStringTag,{value:"Module"}));function i1(t,n){return n==="scaffold"?[`The page \`${t}\` is marked \`untestabilityReason.kind = scaffold\` in the glossary, so it is intentionally excluded from the App tab's product route list.`,"Confirm that marking is correct: read the file and decide whether it is genuinely a scaffold / dev-only shim rather than product surface.","If it IS a real product route, remove the scaffold marking and register it properly (deconstruct it into the glossary and capture at least one scenario for it). If the marking is correct, say so and explain in one line why — no changes needed."].join(`
|
|
7
|
+
|
|
8
|
+
`):[`The page \`${t}\` is discovered on disk but has NO glossary entry, so codeyam cannot tell whether it is product surface — it is excluded from the App tab's route list until it is registered.`,"Investigate whether it is a real product route.","If it IS product surface, deconstruct and register it in the glossary and capture at least one scenario for it so it appears in the route list. If it is instead a scaffold or dev-only shim, add it to the glossary marked `untestabilityReason.kind = scaffold` with a justification."].join(`
|
|
9
|
+
|
|
10
|
+
`)}function l1({path:t,reason:n}){return["You are helping inside the user's actual codeyam project — this is real work in a real repository, not a hypothetical.","Before doing anything, read `.codeyam/stack.json` and the page file itself so your fix fits this project's stack.",i1(t,n),"Propose the concrete change and, once the user agrees, make it. Prefer real edits and commands over generic advice."].join(`
|
|
11
|
+
|
|
12
|
+
`)}function ah(t){return t.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")}function oh({page:t}){const[n,s]=l.useState(!1),{config:r}=_t(),a=at(r==null?void 0:r.provider);return e.jsxs("div",{className:"border border-[var(--border-subtle)] rounded mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[e.jsx(rh,{displayName:t.displayName,path:t.path}),e.jsx(sh,{providerLabel:a,chatOpen:n,onToggleChat:()=>s(o=>!o)})]}),n&&e.jsx("div",{className:"px-3 py-2 border-t border-[var(--border-subtle)]",children:e.jsx(wn,{chatName:`fix-unsurfaced-${ah(t.path)}`,prompt:l1({path:t.path,reason:t.reason}),height:360,onClose:()=>s(!1)})})]})}const OR=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPageRow:oh,chatSlug:ah},Symbol.toStringTag,{value:"Module"}));function ih({label:t,pages:n}){return n.length===0?null:e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"mb-2 text-xs text-[var(--text-dim)]",children:t}),n.map(s=>e.jsx(oh,{page:s},s.path))]})}const AR=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPageGroup:ih},Symbol.toStringTag,{value:"Module"}));function lh({count:t,collapsed:n,onToggle:s}){return e.jsxs("button",{type:"button",onClick:s,className:"mb-3 flex items-center gap-2 cursor-pointer group","aria-expanded":!n,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`text-[var(--text-dim)] transition-transform ${n?"":"rotate-90"}`,children:e.jsx("path",{d:"M9 18l6-6-6-6"})}),e.jsxs("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-[var(--text-dim)] group-hover:text-[var(--text-primary)]",children:["Not shown (",t,")"]})]})}const RR=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPagesSectionHeader:lh},Symbol.toStringTag,{value:"Module"})),c1=[{reason:"missing-from-glossary",label:"Missing from glossary"},{reason:"scaffold",label:"Marked as scaffold"}];function ch({pages:t}){const[n,s]=l.useState(!0);return t.length===0?null:e.jsxs("div",{className:"mt-8",children:[e.jsx(lh,{count:t.length,collapsed:n,onToggle:()=>s(r=>!r)}),!n&&e.jsx("div",{children:c1.map(({reason:r,label:a})=>e.jsx(ih,{label:a,pages:t.filter(o=>o.reason===r)},r))})]})}const ER=Object.freeze(Object.defineProperty({__proto__:null,UnsurfacedPagesSection:ch},Symbol.toStringTag,{value:"Module"}));function dh({routeEntities:t,unsurfacedPages:n=[],componentSurfaceReason:s=null,onSelectRoute:r,onSelectScenario:a,tabbed:o=!1}){if(t.length===0&&n.length===0)return e.jsx(th,{});const i=t.filter(d=>(d.kind??"application")==="application"),c=t.filter(d=>d.kind==="component");return o?e.jsx("div",{className:"px-5 pb-5",children:e.jsx(bu,{pages:i,components:c,componentSurfaceReason:s,onSelectRoute:r,onSelectScenario:a})}):e.jsxs("div",{className:"px-5 py-5",children:[t.length===0&&e.jsx("p",{className:"text-sm text-[var(--text-dim)]",children:"No routes are being shown — every discovered page was excluded. See below."}),i.length>0&&e.jsx(Ha,{label:"Pages",routeEntities:i,onSelectRoute:r,onSelectScenario:a}),c.length>0&&e.jsx(Ha,{label:"Components",routeEntities:c,onSelectRoute:r,onSelectScenario:a,className:i.length>0?"mt-8":void 0}),e.jsx(ch,{pages:n})]})}const MR=Object.freeze(Object.defineProperty({__proto__:null,RouteList:dh},Symbol.toStringTag,{value:"Module"}));function ni({app:t=null,navContext:n=Sn,isWeb:s,routeEntities:r,unsurfacedPages:a,componentSurfaceReason:o,routesLoading:i,routesError:c,selectedEntityHash:d,selectedRouteEntity:u,testGroups:h,selectedSlug:p,entityLookup:f,allScenarios:m,onSelectScenario:g,onSelectRoute:b,onSelectEntity:x,onBackToRoutes:y,onScenariosChanged:v,routeListTabbed:w=!1}){const j=z_(d&&!u?d:null);return s?i?e.jsx(Ba,{}):c?e.jsx(Xs,{message:c}):u?e.jsx(eh,{app:t,navContext:n,routeEntity:u,selectedSlug:p,entityLookup:f,allScenarios:m,routeEntities:r,testGroups:h,onSelectScenario:g,onNavigateToRoute:b,onNavigateToEntity:x,onScenariosChanged:v}):d?j.status==="loading"||j.status==="idle"?e.jsx(Ba,{}):j.status==="not-found"?e.jsx(Xs,{message:"Entity not found. The dependency graph may need to be refreshed."}):j.status==="error"?e.jsx(Xs,{message:j.message}):e.jsx(Ru,{app:t,navContext:n,routeEntity:u,entity:j.entity,selectedSlug:p,onSelectScenario:g,onNavigateToEntity:x??(()=>{}),onScenariosChanged:v}):e.jsx(dh,{routeEntities:r,unsurfacedPages:a,componentSurfaceReason:o,onSelectRoute:b,onSelectScenario:g,tabbed:w}):e.jsx(Lu,{allScenarios:m,testGroups:h,onSelectScenario:g})}const IR=Object.freeze(Object.defineProperty({__proto__:null,AppDetailContent:ni},Symbol.toStringTag,{value:"Module"}));function d1(t){const n=(t??"").split("·").map(a=>a.trim()).filter(Boolean);if(n.length===0)return{tally:"",attention:null};const[s,...r]=n;return{tally:s,attention:r.length>0?r.join(" · "):null}}function uh({summary:t}){const{tally:n,attention:s}=d1(t);return n?e.jsxs("p",{className:"xsvc-count xsvc-count-row",children:[e.jsx("b",{children:n}),s?e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{className:"attn",children:s})]}):null]}):null}const DR=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesSummary:uh},Symbol.toStringTag,{value:"Module"}));function hh({summary:t,sort:n,onSortChange:s}){return e.jsxs("div",{className:"xsvc-listbar",children:[e.jsx(uh,{summary:t}),e.jsx(Jo,{sort:n,onSortChange:s})]})}const LR=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesListBar:hh},Symbol.toStringTag,{value:"Module"})),u1="All providers";function h1(t,n){const s=t??[];return n==="type"?s.filter(r=>r.items.length>0):[{label:u1,items:s.flatMap(r=>r.items).slice().sort((r,a)=>r.name.localeCompare(a.name))}]}function ph({groups:t,summary:n,onBack:s,onOpenChat:r,onAction:a,defaultSort:o="type",chatSlot:i,embedded:c=!1}){const d=Array.isArray(t)&&t.some(b=>b.items.length>0),[u,h]=l.useState(o),[p,f]=l.useState(""),m=b=>{b.preventDefault(),r==null||r(p.trim()||void 0)},g=d?h1(t,u):[];return e.jsx("div",{className:c?"xsvc xsvc-embedded":"xsvc",children:e.jsxs("div",{className:"xsvc-scroll",children:[c?null:e.jsx("div",{className:"xsvc-crumbs",children:e.jsx("button",{type:"button",className:"xsvc-back",onClick:s,"aria-label":"Back to Home",children:"‹ Home"})}),e.jsxs("div",{className:"xsvc-head",children:[c?null:e.jsxs("div",{className:"xsvc-titlerow",children:[e.jsx("h1",{children:"External Services"}),d?e.jsx("span",{className:"xsvc-count",children:n??"Every outside service, in one place."}):null]}),c||!d?e.jsx("p",{className:c?"xsvc-sub xsvc-sub-lead":"xsvc-sub",children:"Every outside service this project depends on: domains, hosting, API keys, payments, and the database. Anything it talks to that lives beyond its own code."}):null]}),d?e.jsxs(e.Fragment,{children:[e.jsx(Jd,{draft:p,onDraftChange:f,onSubmit:m,onAsk:r,chatSlot:i,bare:c}),e.jsx("div",{className:"xsvc-divider",role:"presentation"}),c?e.jsx(hh,{summary:n,sort:u,onSortChange:h}):e.jsx(Jo,{sort:u,onSortChange:h}),e.jsx(Vd,{groups:g,onAction:a})]}):e.jsx(Wd,{draft:p,onDraftChange:f,onSubmit:m,onAsk:r})]})})}const FR=Object.freeze(Object.defineProperty({__proto__:null,ApiKeyField:Vo,ExternalServicesScreen:ph,ServiceRow:Ko},Symbol.toStringTag,{value:"Module"}));function Or({target:t,onStored:n,onClose:s}){const[r,a]=l.useState(""),[o,i]=l.useState(!1),[c,d]=l.useState(null),[u,h]=l.useState(!1),p=l.useCallback(async()=>{if(r.trim()){i(!0),d(null),h(!1);try{const f=await fetch("/api/setup/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:t.topic,provider:"passthrough",credential:r.trim(),credential_fields:{envVar:t.envVar}})});if(!f.ok){if(Fw(f.status)==="transient"){h(!0),d(`The editor was briefly unreachable (HTTP ${f.status}). Your key wasn't rejected — try again.`);return}const g=await f.json().catch(()=>({}));d(g.error??`Could not store the key (HTTP ${f.status}).`);return}const m=await f.json().catch(()=>({}));if(m.success===!1||m.status==="error"){d(m.message??m.error??"The key was rejected.");return}a(""),n()}catch{h(!0),d("Could not reach the editor to store the key. Try again.")}finally{i(!1)}}},[r,t,n]);return e.jsx("div",{"data-testid":"app-service-credential-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:e.jsxs("div",{className:"w-[28rem] max-w-[90vw] rounded-lg border border-[#3A3A3A] bg-[#161616] p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("h2",{className:"text-base font-semibold text-white",children:["Add your ",t.serviceName," API key"]}),e.jsx("button",{"data-testid":"app-service-credential-close",onClick:s,className:"text-[#8E8E8E] hover:text-white cursor-pointer","aria-label":"Close",children:"✕"})]}),e.jsxs("p",{className:"text-sm text-[#8E8E8E]",children:["The key is stored in",e.jsx("code",{className:"mx-1 text-[#D7FF63]",children:".codeyam/setup-connections.json"}),"(owner-only, gitignored) and injected into your app as",e.jsx("code",{className:"mx-1 text-[#D7FF63]",children:t.envVar})," — never committed."]}),t.docsUrl?e.jsx("a",{href:t.docsUrl,target:"_blank",rel:"noreferrer",className:"inline-block text-sm text-[#7EA6FF] hover:underline",children:"Where to find this key →"}):null,e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"password",value:r,onChange:f=>a(f.target.value),placeholder:`${t.serviceName} API key`,className:"flex-1 min-w-0 px-2 py-1.5 rounded bg-black border border-[#3A3A3A] text-white text-sm"}),e.jsx("button",{onClick:()=>void p(),disabled:o||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:o?"Saving…":"Save"})]}),c?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-[#FF8B43]",children:c}),u?e.jsx("button",{"data-testid":"app-service-credential-retry",onClick:()=>void p(),disabled:o||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md border border-[#3A3A3A] text-white font-medium cursor-pointer disabled:opacity-50",children:o?"Saving…":"Retry"}):null]}):null]})})}const zR=Object.freeze(Object.defineProperty({__proto__:null,AppServiceCredentialModal:Or},Symbol.toStringTag,{value:"Module"}));function si(){const[t,n]=l.useState(null),s=l.useCallback(async()=>{try{const a=await fetch("/api/setup-services");if(!a.ok)throw new Error(`HTTP ${a.status}`);const o=await a.json();n(Array.isArray(o)?o:[])}catch{n([])}},[]);l.useEffect(()=>{s()},[s]);const r=l.useCallback(a=>{n(o=>o&&o.map(i=>i.key===a?{...i,status:"dismissed"}:i)),fetch(`/api/setup-services/${encodeURIComponent(a)}/dismiss`,{method:"POST"}).catch(()=>{s()})},[s]);return{services:t,dismiss:r,refetch:s}}const p1={Domain:"blue",Hosting:"blue","Code hosting":"indigo","Package registry":"indigo","Cloud platform":"blue",Payments:"green",Database:"indigo","Database ORM":"indigo","Backend platform":"indigo","Cache & queue":"indigo",Authentication:"amber","AI provider":"lime","Transactional email":"lime","Product analytics":"lime","Storage & media":"lime",Messaging:"lime",Search:"lime",Containers:"indigo","CI/CD":"indigo","Error monitoring":"amber"},Vl=["Domain","Hosting","Cloud platform","Code hosting","Package registry","Database","Database ORM","Backend platform","Cache & queue","Authentication","Payments","AI provider","Transactional email","Messaging","Storage & media","Search","Containers","CI/CD","Product analytics","Error monitoring"];function Ar(t){return t.source==="pending"||t.confidence==="suggested"}function mh(t){var s;if(Ar(t))return"suggested";if(t.confidence==="inferred")return"found in code";const n=(s=t.evidence[0])==null?void 0:s.source;return n?n==="git remote"?"from git remote":n==="config file"?"from config":`from ${n}`:"declared"}function m1(t){var s;const n=t.trim().split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():(((s=n[0])==null?void 0:s[0])??"?").toUpperCase()}function fh(t){return t.envVars.length>0&&!t.credentialPresent}function f1(t){if(t.note)return t.note;const n=t.evidence[0];if(!n)return t.category;const s=t.evidence.length>1?` · +${t.evidence.length-1} more`:"";return`${n.value} in ${n.source}${s}`}function g1(t){const n=[{label:"Category",value:t.category}];if(Ar(t))return n.push({label:"Status",value:"Not set up yet"}),n.push({label:"Source",value:"Suggested — no evidence in this repo"}),n;n.push({label:"Origin",value:mh(t)}),t.envVars.length>0&&n.push({label:"Env vars",value:t.envVars.join(", "),mono:!0}),n.push({label:t.credentialPresent?"Key":"Key status",value:t.credentialPresent?"Configured":"Not set yet"});for(const s of t.evidence.slice(0,4))n.push({label:"Detected in",value:`${s.value} · ${s.source}`,mono:!0});return t.docsUrl&&n.push({label:"Docs",value:t.docsUrl}),n}function b1(t){const n=[],s=Ar(t);n.push({text:mh(t),kind:"origin"}),s&&n.push({text:"not set up",kind:"miss"});const r=t.envVars[0];r&&n.push({text:r,kind:"env"}),t.envVars.length>0&&t.credentialPresent&&n.push({text:"Key set",kind:"set"});const a=fh(t),o=s?"Set up":a?"Add key":void 0;return{monogram:m1(t.name),providerId:t.key,category:t.category,tone:p1[t.category]??"lime",name:t.name,desc:f1(t),tags:n.length?n:void 0,actionLabel:o,actionKey:o?t.key:void 0,attn:a,pending:s,detail:g1(t)}}function Kl(t){const n=Vl.indexOf(t);return n===-1?Vl.length:n}function x1(t){const n=(t??[]).filter(h=>h.status!=="dismissed");if(n.length===0)return{groups:[],summary:""};const s=new Map;for(const h of n){const p=s.get(h.category);p?p.push(h):s.set(h.category,[h])}const r=[...s.entries()].sort(([h],[p])=>Kl(h)-Kl(p)||h.localeCompare(p)).map(([h,p])=>({label:h,items:p.slice().sort((f,m)=>f.name.localeCompare(m.name)).map(b1)})),a=n.filter(h=>!Ar(h)),o=n.length-a.length,i=a.filter(fh).length,c=a.length===1?"service":"services",d=i>0?`${a.length} ${c} · ${i} need${i===1?"s":""} your attention`:`${a.length} ${c} detected`,u=o>0?`${d} · ${o} not set up yet`:d;return{groups:r,summary:u}}function y1(t){return t.credentialPresent?" (key configured)":t.envVars.length>0?" (needs a key)":""}function v1(t,n){const s=(t??[]).filter(o=>o.status!=="dismissed"),r=s.length?`
|
|
13
|
+
|
|
14
|
+
Detected in this project so far:
|
|
15
|
+
${s.map(o=>`- ${o.name} (${o.category})${y1(o)}`).join(`
|
|
16
|
+
`)}`:`
|
|
17
|
+
|
|
18
|
+
No external services have been auto-detected in this project yet.`,a=n!=null&&n.trim()?`
|
|
19
|
+
|
|
20
|
+
The user opened this chat with the following message. Respond to it directly and helpfully as your FIRST reply, before anything else:
|
|
21
|
+
"${n.trim()}"`:`
|
|
22
|
+
|
|
23
|
+
Greet the user briefly and ask what they'd like to know or change about their external services.`;return["You are helping the user understand and manage this project's EXTERNAL SERVICES, ","the outside things it depends on: domains, hosting, API keys, payments (e.g. Stripe), ","databases, auth, transactional email, analytics, error monitoring, and any paid subscriptions.",r,`
|
|
24
|
+
|
|
25
|
+
Help with whatever they want here: what's wired up, what's missing an API key, `,"how to add or remove a service, and renewals or monthly cost. Those last two are NOT in ","the repo, so ASK the user rather than guessing. Be concise and concrete.",a].join("")}function gh({onBack:t,embedded:n=!1}){const{services:s,refetch:r}=si(),[a,o]=l.useState(!1),[i,c]=l.useState(void 0),[d,u]=l.useState(null),{groups:h,summary:p}=l.useMemo(()=>x1(s),[s]),f=m=>{var x;const g=(s??[]).find(y=>y.key===m);if(!g)return;const b=(x=g.envVars)==null?void 0:x[0];if(!b){c(`Help me set up ${g.category.toLowerCase()} for this project`),o(!0);return}u({serviceName:g.name,envVar:b,topic:g.topic,docsUrl:g.docsUrl})};return e.jsxs("div",{className:"xsvc-connected",children:[e.jsx(ph,{groups:h,summary:p,onBack:t,embedded:n,onOpenChat:m=>{c(m),o(!0)},onAction:f,chatSlot:a?e.jsxs("div",{role:"dialog","aria-label":"Chat about external services",children:[e.jsxs("div",{className:"xsvc-chatdock-head",children:[e.jsx("span",{children:"Chat about your external services"}),e.jsx("button",{type:"button",className:"xsvc-chatdock-close",onClick:()=>o(!1),children:"Close ✕"})]}),e.jsx(wn,{chatName:"external-services",prompt:v1(s,i),height:380,onClose:()=>o(!1)})]}):void 0}),d?e.jsx(Or,{target:d,onStored:()=>{u(null),r()},onClose:()=>u(null)}):null]})}const $R=Object.freeze(Object.defineProperty({__proto__:null,ExternalServicesScreenConnected:gh},Symbol.toStringTag,{value:"Module"}));function bh({children:t}){return e.jsx("h2",{style:{fontSize:27,fontWeight:700,letterSpacing:"-0.02em",color:"var(--text-strong)",margin:"0 0 20px"},children:t})}const BR=Object.freeze(Object.defineProperty({__proto__:null,ExploreSectionHeading:bh},Symbol.toStringTag,{value:"Module"})),Jl=[{id:"simulations",label:"Simulations"},{id:"external-services",label:"External Services"}],j1={id:"setup",label:"Setup"};function xh({active:t,onChange:n,showSetup:s=!1,children:r}){const a=s?[...Jl,j1]:Jl;return e.jsxs("div",{children:[e.jsx("div",{role:"tablist","aria-label":"Explore your app",className:"flex items-center gap-6 border-b border-[var(--border-subtle)] mb-5",children:a.map(o=>{const i=o.id===t;return e.jsx("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>n(o.id),className:`font-sans text-xs font-semibold tracking-wide uppercase pb-2 -mb-px border-b-2 transition ${i?"text-[var(--text-primary)] border-[var(--text-primary)]":"text-[var(--text-dim)] border-transparent hover:text-[var(--text-secondary)]"}`,children:o.label},o.id)})}),e.jsx("div",{role:"tabpanel",children:r})]})}const qR=Object.freeze(Object.defineProperty({__proto__:null,HomeExploreTabs:xh},Symbol.toStringTag,{value:"Module"}));function yh({appDetailProps:t,selectedApp:n,setupSlot:s}){const[r,a]=l.useState("simulations");return e.jsx("div",{style:{padding:"8px 10% 50px"},children:e.jsxs("div",{style:{width:"100%",maxWidth:2200,marginInline:"auto"},children:[e.jsx(bh,{children:"Explore your app"}),e.jsxs(xh,{active:r,onChange:a,showSetup:!!s,children:[r==="simulations"?e.jsx("div",{className:"-mx-5",children:e.jsx(ni,{...t,app:n,isWeb:(n==null?void 0:n.type)==="web",selectedEntityHash:t.selectedEntityHash??null,routeListTabbed:!0})}):null,r==="external-services"?e.jsx(gh,{embedded:!0}):null,r==="setup"?s:null]})]})})}const HR=Object.freeze(Object.defineProperty({__proto__:null,HomeExploreSection:yh},Symbol.toStringTag,{value:"Module"}));function pe({icon:t,title:n,meta:s,onBack:r,crumbLabel:a,assistKey:o}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:r,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:r,children:"Home"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("button",{type:"button",onClick:r,children:"Setup"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:a??n})]}),e.jsxs("div",{className:"htitle",children:[e.jsx("div",{className:"hic",children:t}),e.jsxs("div",{children:[e.jsx("div",{className:"h",children:n}),e.jsx("div",{className:"hmeta",children:s})]})]})]})}function Qt({topic:t,step:n,onBack:s}){return e.jsxs("div",{className:"crumbs",children:[s?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"back",onClick:s,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:s,children:t})]}):e.jsx("span",{children:t}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:n})]})}function $t({steps:t,currentKey:n}){const s=t.findIndex(r=>r.key===n);return e.jsx("div",{className:"flowbar",children:t.map((r,a)=>e.jsxs("span",{style:{display:"contents"},children:[a>0?e.jsx("span",{className:"fsep"}):null,e.jsxs("span",{className:"fstep"+(a<s?" done":a===s?" active":""),children:[e.jsx("span",{className:"fn",children:a<s?"✓":a+1}),r.label]})]},r.key))})}function ge({label:t,note:n,status:s,onComplete:r,onRevert:a,onBack:o,doneLabel:i="Completed"}){const[c,d]=l.useState(!1);return s==="done"||c?e.jsx("div",{className:"cta-wrap",children:e.jsxs("div",{className:"cta-done",children:[e.jsxs("span",{className:"cta-done-check",children:[e.jsx("span",{className:"ce",children:"✓"})," ",i]}),e.jsxs("div",{className:"cta-done-actions",children:[o?e.jsx("button",{type:"button",className:"lf-back",onClick:o,children:"Back to Setup"}):null,a?e.jsx("button",{type:"button",className:"cta-revert",onClick:()=>{a(),d(!1)},children:"Mark as not complete"}):null]})]})}):e.jsxs("div",{className:"cta-wrap",children:[e.jsxs("button",{type:"button",className:"cta",onClick:()=>{r(),d(!0)},children:[e.jsx("span",{className:"ce",children:"✓"})," ",t]}),e.jsx("div",{className:"cta-note",children:n})]})}const WR=Object.freeze(Object.defineProperty({__proto__:null,SetupCompleteCta:ge,SetupDetailHeader:pe,SetupFlowBar:$t,SetupSubCrumb:Qt},Symbol.toStringTag,{value:"Module"}));function Rr({initial:t,color:n}){return e.jsx("div",{className:"altmark",style:{background:n,width:46,height:46},children:t})}function ri({provider:t}){return e.jsxs("div",{className:"provcard"+(t.bestFit?" best":""),children:[e.jsx(Rr,{initial:t.initial,color:t.color}),e.jsxs("div",{className:"provbody",children:[e.jsxs("div",{className:"provtop",children:[e.jsx("span",{className:"provname",children:t.name}),t.bestFit?e.jsx("span",{className:"bestfit",children:"Best fit"}):null]}),e.jsx("div",{className:"provdesc",children:t.description}),e.jsx("div",{className:"reasons",children:t.reasons.map(n=>e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:n.lead})," ",n.rest]})]},n.lead))}),e.jsx("div",{className:"chips",children:t.chips.map(n=>e.jsx("span",{className:"chip",children:n},n))})]})]})}function vh({alts:t}){const[n,s]=l.useState(!1);return t.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:"alt-toggle",onClick:()=>s(r=>!r),children:[n?"Hide other options":"Not for you? See other options",e.jsx("span",{className:"chev",style:{transform:n?"rotate(180deg)":"none"},children:"⌄"})]}),n?e.jsx("div",{className:"alts",children:t.map(r=>e.jsxs("div",{className:"altcard",children:[e.jsx("div",{className:"altmark",style:{background:r.color},children:r.initial}),e.jsxs("div",{className:"altbody",children:[e.jsx("div",{className:"altname",children:r.name}),e.jsx("div",{className:"altdesc",children:r.description})]}),e.jsx("button",{type:"button",className:"altpick",children:"Use this"})]},r.name))}):null]})}function Ve({items:t}){return t.length===0?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"seclabel",style:{marginTop:34},children:"FAQ"}),e.jsx(jh,{items:t})]})}function jh({items:t}){const[n,s]=l.useState(-1);return t.length===0?null:e.jsx("div",{className:"faq",children:t.map((r,a)=>e.jsxs("div",{className:"faqitem",children:[e.jsxs("button",{type:"button",className:"faqq"+(n===a?" open":""),onClick:()=>s(n===a?-1:a),children:[r.q,e.jsx("span",{className:"chev",children:"⌄"})]}),n===a?e.jsx("div",{className:"faqa",children:r.a}):null]},r.q))})}const GR=Object.freeze(Object.defineProperty({__proto__:null,Alternatives:vh,FaqSection:Ve,ProviderCard:ri,ProviderMark:Rr,TopicFaq:jh},Symbol.toStringTag,{value:"Module"}));function ai({icon:t,title:n,meta:s,crumbLabel:r,assistKey:a,onBack:o,lead:i,illustration:c,chatPrompt:d,onChatWithAI:u,faqs:h}){return e.jsxs("div",{className:"hosting-screen setup-topic",children:[e.jsx(pe,{icon:t,title:n,meta:s,crumbLabel:r,onBack:o,assistKey:a}),e.jsx("div",{className:"lead",children:i}),c,e.jsx("div",{className:"cta-wrap",children:e.jsx("button",{type:"button",className:"cta",onClick:()=>u==null?void 0:u(d),children:"Chat with the AI about this"})}),e.jsx(Ve,{items:h})]})}const UR=Object.freeze(Object.defineProperty({__proto__:null,SetupTopicPage:ai},Symbol.toStringTag,{value:"Module"}));function mn({before:t,after:n}){return e.jsxs("div",{className:"setup-ill ill-split",children:[e.jsxs("div",{className:"isplit",children:[e.jsx("div",{className:"isplit-tag",children:t.tag}),t.items.map(s=>e.jsxs("div",{className:"isplit-row",children:[e.jsx("span",{className:"mk",children:"✕"}),e.jsx("span",{children:s})]},s))]}),e.jsx("div",{className:"isplit-arrow",children:"→"}),e.jsxs("div",{className:"isplit after",children:[e.jsx("div",{className:"isplit-tag",children:n.tag}),n.items.map(s=>e.jsxs("div",{className:"isplit-row",children:[e.jsx("span",{className:"mk",children:"✓"}),e.jsx("span",{children:s})]},s))]})]})}function fn({rows:t}){return e.jsx("div",{className:"setup-ill",children:e.jsx("div",{className:"ill-stack",children:t.map(n=>e.jsxs("div",{className:n.lime?"istack-row lime":"istack-row",children:[e.jsx("span",{className:"istack-emoji",children:n.emoji}),e.jsx("span",{className:"istack-lbl",children:n.label}),n.sub?e.jsx("span",{className:"istack-sub",children:n.sub}):null]},n.label))})})}function gn({center:t,satellites:n}){return e.jsx("div",{className:"setup-ill",children:e.jsxs("div",{className:"ill-orbit",children:[e.jsxs("div",{className:"iorbit-center",children:[e.jsx("div",{className:"iorbit-tile",children:t.emoji}),e.jsx("div",{className:"iorbit-lbl",children:t.label})]}),e.jsx("div",{className:"iorbit-sats",children:n.map(s=>e.jsx("div",{className:"iorbit-sat",children:s},s))})]})})}function er({bars:t}){return e.jsx("div",{className:"setup-ill",children:e.jsx("div",{className:"ill-bars",children:t.map(n=>e.jsxs("div",{className:n.lime?"ibar lime":"ibar",children:[e.jsx("div",{className:"ibar-fill",style:{height:`${n.pct}%`}}),e.jsx("div",{className:"ibar-lbl",children:n.label})]},n.label))})})}function Ut({emoji:t,caption:n,chips:s}){return e.jsxs("div",{className:"setup-ill",children:[e.jsxs("div",{className:"ill-emblem",children:[e.jsx("div",{className:"iemblem-tile",children:t}),e.jsx("div",{className:"iemblem-chips",children:s.map(r=>e.jsx("span",{className:"iemblem-chip",children:r},r))})]}),e.jsx("div",{className:"ill-cap",children:n})]})}function Wa({channels:t}){return e.jsx("div",{className:"setup-ill",children:e.jsx("div",{className:"ill-channels",children:t.map(n=>e.jsxs("div",{className:n.on?"ichan on":"ichan",children:[e.jsx("div",{className:"ichan-lbl",children:n.label}),e.jsx("div",{className:"ichan-track",children:Array.from({length:n.dots}).map((s,r)=>e.jsxs(l.Fragment,{children:[r>0?e.jsx("span",{className:"ichan-line"}):null,e.jsx("span",{className:"ichan-dot"})]},r))})]},n.label))})})}const YR=Object.freeze(Object.defineProperty({__proto__:null,SetupBars:er,SetupChannels:Wa,SetupEmblem:Ut,SetupOrbit:gn,SetupSplit:mn,SetupStack:fn},Symbol.toStringTag,{value:"Module"}));function Yt({nodes:t}){return e.jsx("div",{className:"journey",children:e.jsx("div",{className:"jrow",children:t.map((n,s)=>e.jsxs(l.Fragment,{children:[e.jsxs("div",{className:"jcol",children:[e.jsx("div",{className:n.lime?"jtile lime":"jtile",children:n.emoji}),e.jsx("div",{className:"jlbl",children:n.label}),e.jsx("div",{className:"jsub",children:n.sub})]}),s===t.length-1?null:e.jsxs("div",{className:"jconn",children:[e.jsx("span",{className:"jpacket"}),e.jsx("span",{children:"→"})]})]},n.label))})})}const VR=Object.freeze(Object.defineProperty({__proto__:null,SetupJourney:Yt},Symbol.toStringTag,{value:"Module"}));function wh(t){var a;const n=Object.values(((a=t.tests)==null?void 0:a.byRunner)??{}),s=n.reduce((o,i)=>o+(i.passed??0),0),r=n.reduce((o,i)=>o+(i.failed??0),0);return{total:s+r,passed:s,failed:r}}function _h(t){const n=t??[];return{changed:n.filter(s=>s.status==="changed"),created:n.filter(s=>s.status==="new"),unchanged:n.filter(s=>s.status!=="changed"&&s.status!=="new")}}const w1=5e3,Xl={headSha:null,branch:null};function _1(){const[t,n]=l.useState([]),[s,r]=l.useState(Xl),[a,o]=l.useState(!0),[i,c]=l.useState(null),d=l.useRef(!1),u=l.useCallback(async p=>{if(!d.current){d.current=!0,p&&o(!0);try{const f=await fetch("/api/reviews");if(!f.ok)throw new Error(`HTTP ${f.status}`);const m=await f.json();n(m.reviews??[]),r(m.repoState??Xl),c(m.error??null)}catch(f){c(f instanceof Error?f.message:"Failed to load reviews")}finally{p&&o(!1),d.current=!1}}},[]),h=l.useCallback(()=>u(!0),[u]);return l.useEffect(()=>{u(!0);const p=setInterval(()=>{u(!1)},w1);return()=>clearInterval(p)},[u]),{reviews:t,repoState:s,loading:a,error:i,reload:h}}function k1(t,n){var r;const s=(r=t.pr)==null?void 0:r.headRef;return!!s&&!!n.branch&&n.branch===s}const S1=192;function Er({children:t,variant:n="compact",maxHeight:s=S1,moreLabel:r="Show more",lessLabel:a="Show less",fadeColor:o="var(--bg-card)"}){const i=l.useRef(null),[c,d]=l.useState(!1),[u,h]=l.useState(!1);return l.useEffect(()=>{const p=i.current;if(!p)return;const f=()=>h(p.scrollHeight>s);f();const m=new ResizeObserver(f);return m.observe(p),()=>m.disconnect()},[t,s]),e.jsxs("div",{children:[e.jsxs("div",{ref:i,style:{maxHeight:c?"none":`${s}px`,overflow:"hidden",position:"relative"},children:[e.jsx(Ht,{variant:n,children:t}),!c&&u&&e.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2rem",background:`linear-gradient(transparent, ${o})`,pointerEvents:"none"}})]}),u&&e.jsx("button",{onClick:()=>d(p=>!p),className:"text-xs cursor-pointer mt-1",style:{color:"var(--accent-blue)",background:"none",border:"none",padding:0},children:c?a:r})]})}const KR=Object.freeze(Object.defineProperty({__proto__:null,CollapsibleMarkdown:Er},Symbol.toStringTag,{value:"Module"}));function Jt({label:t,children:n}){return e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-xs font-medium mb-1",style:{color:"var(--text-muted)"},children:t}),e.jsx("div",{className:"mt-0.5",children:n})]})}const JR=Object.freeze(Object.defineProperty({__proto__:null,LabeledSection:Jt},Symbol.toStringTag,{value:"Module"}));function Mr({status:t}){const n=t==="added"?"var(--accent-green)":t==="deleted"?"var(--accent-red)":"var(--accent-blue)",s=t==="added"?"+":t==="deleted"?"-":"~";return e.jsx("span",{className:"font-mono text-xs font-semibold",style:{color:n,minWidth:"0.75rem",textAlign:"center"},children:s})}const XR=Object.freeze(Object.defineProperty({__proto__:null,FileStatusIndicator:Mr},Symbol.toStringTag,{value:"Module"}));function kh({files:t}){return t.length===0?null:e.jsx("div",{className:"max-h-32 overflow-y-auto",children:t.map(n=>e.jsxs("p",{className:"font-mono text-xs text-[var(--text-muted)]",children:[e.jsx(Mr,{status:n.status})," ",n.path]},n.path))})}const QR=Object.freeze(Object.defineProperty({__proto__:null,ModifiedFilesList:kh},Symbol.toStringTag,{value:"Module"}));function N1(t){switch(t){case"blocker":return{bg:"var(--accent-red)",fg:"#fff"};case"concern":return{bg:"var(--accent-orange)",fg:"#111"};case"praise":return{bg:"var(--accent-green)",fg:"#111"};case"nit":default:return{bg:"var(--bg-subtle)",fg:"var(--text-muted)"}}}function Sh({finding:t}){const n=N1(t.severity),s=t.file&&(t.line!=null?`${t.file}:${t.line}`:t.file);return e.jsxs("div",{className:"flex flex-col gap-1 rounded border px-3 py-2",style:{borderColor:"var(--border-subtle)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:n.bg,color:n.fg},children:t.severity}),s&&e.jsx("span",{className:"font-mono text-xs truncate",style:{color:"var(--text-secondary)"},children:s})]}),e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t.comment})]})}const ZR=Object.freeze(Object.defineProperty({__proto__:null,ReviewFindingRow:Sh},Symbol.toStringTag,{value:"Module"}));function C1(t){switch(t){case"changed":return{bg:"var(--accent-orange)",fg:"#111",label:"changed"};case"new":return{bg:"var(--accent-green)",fg:"#111",label:"new"};case"unchanged":default:return{bg:"var(--bg-subtle)",fg:"var(--text-muted)",label:t}}}function Ga({label:t,path:n,onPreview:s}){const r=`${t} capture`,a=!!n&&!!s;return e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide",style:{color:"var(--text-dim)"},children:t}),e.jsx("button",{type:"button",disabled:!a,onClick:a?()=>s(n,r):void 0,className:"relative h-32 w-full overflow-hidden rounded border p-0",style:{borderColor:"var(--border-subtle)",background:"var(--bg-subtle)",cursor:a?"zoom-in":"default"},title:a?"Click to view full size":void 0,children:e.jsx(kt,{screenshotPath:n,alt:r})})]})}function Nh({pair:t,walkable:n,headRef:s,prNumber:r,onPreviewImage:a}){const o=C1(t.status),i=t.status==="new",c=t.diffRatio!=null?`${(t.diffRatio*100).toFixed(1)}% changed`:null;return e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border p-3",style:{borderColor:"var(--border-default)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium",style:{color:"var(--text-primary)"},children:t.slug}),e.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",style:{background:o.bg,color:o.fg},children:o.label}),t.beforeStale&&e.jsx("span",{"data-testid":"before-stale-badge",className:"rounded px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--bg-subtle)",color:"var(--accent-orange)"},title:"The before capture was already stale at the merge base — treat the comparison with caution.",children:"before stale"}),c&&e.jsx("span",{className:"text-[10px]",style:{color:"var(--text-dim)"},children:c})]}),e.jsxs("div",{className:"flex gap-2",children:[!i&&e.jsx(Ga,{label:"Before",path:t.beforePath,onPreview:a}),e.jsx(Ga,{label:"After",path:t.afterPath,onPreview:a})]}),t.note&&e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t.note}),n?e.jsx("a",{href:`/scenario/${encodeURIComponent(t.slug)}`,"data-testid":"view-live-link",className:"self-start rounded border px-2 py-1 text-xs",style:{borderColor:"var(--border-default)",color:"var(--accent-blue)"},children:"View live →"}):e.jsxs("p",{"data-testid":"walk-hint",className:"text-[11px]",style:{color:"var(--text-dim)"},children:["Check out the PR to walk this scenario live",r!=null?e.jsxs(e.Fragment,{children:[" — ",e.jsxs("span",{className:"font-mono",children:["gh pr checkout ",r]})]}):s?e.jsxs(e.Fragment,{children:[" — ",e.jsxs("span",{className:"font-mono",children:["git checkout ",s]})]}):null]})]})}const eE=Object.freeze(Object.defineProperty({__proto__:null,CapturePane:Ga,ScenarioComparisonRow:Nh},Symbol.toStringTag,{value:"Module"}));function Ch({scenarios:t,walkable:n,headRef:s,prNumber:r,onPreviewImage:a}){const[o,i]=l.useState(!1),{changed:c,created:d,unchanged:u}=_h(t);if((t??[]).length===0)return e.jsx(Jt,{label:"Impacted scenarios",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-dim)"},children:"No UI-impacting scenarios — this digest leads with tests and blast radius below."})});const h=p=>e.jsx(Nh,{pair:p,walkable:n,headRef:s,prNumber:r,onPreviewImage:a},p.slug);return e.jsx(Jt,{label:"Impacted scenarios",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[c.map(h),d.map(h),u.length>0&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(p=>!p),"data-testid":"toggle-unchanged",className:"self-start text-xs",style:{color:"var(--accent-blue)"},children:[o?"Hide":"Show"," ",u.length," unchanged downstream scenario",u.length===1?"":"s"]}),o&&u.map(h)]})]})})}const tE=Object.freeze(Object.defineProperty({__proto__:null,ScenarioImpactSection:Ch},Symbol.toStringTag,{value:"Module"}));function Ir({total:t,passed:n,failed:s}){if(t===0)return null;const r=s>0?"text-[var(--accent-red)]":"text-[var(--accent-green)]";return e.jsxs("span",{className:`text-xs ${r}`,children:[n,"/",t," passed"]})}const nE=Object.freeze(Object.defineProperty({__proto__:null,TestResultsBadge:Ir},Symbol.toStringTag,{value:"Module"}));function Ph({review:t,repoState:n,onPreviewImage:s}){var d,u,h,p,f,m,g,b,x;const r=wh(t),a=k1(t,n),o=t.findings??[],i=((d=t.tests)==null?void 0:d.added)??[],c=(((u=t.blastRadius)==null?void 0:u.changedFiles)??[]).map(y=>({path:y,status:"modified"}));return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[((h=t.pr)==null?void 0:h.number)!=null&&e.jsxs("span",{className:"font-mono text-xs",style:{color:"var(--text-secondary)"},children:["#",t.pr.number]}),((p=t.pr)==null?void 0:p.author)&&e.jsxs("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:["by ",t.pr.author]}),((f=t.pr)==null?void 0:f.url)&&e.jsx("a",{href:t.pr.url,target:"_blank",rel:"noreferrer",className:"text-xs",style:{color:"var(--accent-blue)"},children:"View PR ↗"}),t.postedCommentUrl&&e.jsx("a",{href:t.postedCommentUrl,target:"_blank",rel:"noreferrer",className:"text-xs",style:{color:"var(--accent-blue)"},children:"Posted comment ↗"})]}),((m=t.pr)==null?void 0:m.title)&&e.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:t.pr.title})]}),e.jsx(Ch,{scenarios:t.scenarios??[],walkable:a,headRef:(g=t.pr)==null?void 0:g.headRef,prNumber:(b=t.pr)==null?void 0:b.number,onPreviewImage:s}),t.narrative&&e.jsx(Jt,{label:"What this PR does",children:e.jsx(Er,{children:t.narrative})}),e.jsx(Jt,{label:"Tests",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ir,{total:r.total,passed:r.passed,failed:r.failed}),i.length>0?e.jsx("ul",{className:"flex flex-col gap-1.5",children:i.map((y,v)=>e.jsxs("li",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-secondary)"},children:y.name??y.file??"test"}),y.description&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:y.description})]},y.file??y.name??v))}):e.jsx("p",{className:"text-xs",style:{color:"var(--text-dim)"},children:"No new tests added."})]})}),o.length>0&&e.jsx(Jt,{label:`Findings (${o.length})`,children:e.jsx("div",{className:"flex flex-col gap-2",children:o.map((y,v)=>e.jsx(Sh,{finding:y},`${y.file??"f"}-${v}`))})}),((x=t.alignment)==null?void 0:x.summary)&&e.jsx(Jt,{label:"Codeyam alignment",children:e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t.alignment.summary})}),c.length>0&&e.jsx(Jt,{label:"Changed files",children:e.jsx(kh,{files:c})})]})}const sE=Object.freeze(Object.defineProperty({__proto__:null,ReviewDetailCard:Ph},Symbol.toStringTag,{value:"Module"}));function P1(t){const n=t.findings??[];return{blocker:n.filter(s=>s.severity==="blocker").length,concern:n.filter(s=>s.severity==="concern").length,total:n.length}}function T1(t){return t==null?null:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Th({review:t,repoState:n,expanded:s,onToggle:r}){var d,u,h;if(t.parseError)return e.jsxs("div",{className:"rounded-lg border p-4",style:{borderColor:"var(--accent-red)",background:"var(--bg-card)"},children:[e.jsxs("p",{className:"text-sm font-medium",style:{color:"var(--accent-red)"},children:[t.id,": could not read digest"]}),e.jsx(Qe,{text:t.parseError,copyText:`${t.id}: could not read digest
|
|
26
|
+
${t.parseError??""}`,className:"text-xs text-[var(--text-dim)]",rowClassName:"mt-1"})]});const a=_h(t.scenarios),o=P1(t),i=wh(t),c=T1(t.createdAtMs);return e.jsxs("div",{className:"rounded-lg border",style:{borderColor:"var(--border-default)",background:"var(--bg-card)"},children:[e.jsxs("button",{type:"button",onClick:r,className:"flex w-full flex-col gap-2 px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[((d=t.pr)==null?void 0:d.number)!=null&&e.jsxs("span",{className:"font-mono text-xs",style:{color:"var(--text-secondary)"},children:["#",t.pr.number]}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:((u=t.pr)==null?void 0:u.title)??t.id}),((h=t.pr)==null?void 0:h.author)&&e.jsxs("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:["by ",t.pr.author]}),c&&e.jsxs("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:["· ",c]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[e.jsxs("span",{style:{color:"var(--accent-orange)"},children:[a.changed.length," changed"]}),e.jsxs("span",{style:{color:"var(--accent-green)"},children:[a.created.length," new"]}),e.jsxs("span",{style:{color:"var(--text-dim)"},children:[a.unchanged.length," unchanged"]}),o.total>0&&e.jsxs("span",{style:{color:"var(--text-muted)"},children:[o.blocker>0&&`${o.blocker} blocker · `,o.concern>0&&`${o.concern} concern · `,o.total," finding",o.total===1?"":"s"]}),i.total>0&&e.jsxs("span",{style:{color:i.failed>0?"var(--accent-red)":"var(--accent-green)"},children:[i.passed,"/",i.total," passed"]})]})]}),s&&e.jsx("div",{className:"px-4 pb-4 pt-1",style:{borderTop:"1px solid var(--border-subtle)"},children:e.jsx(Ph,{review:t,repoState:n})})]})}const rE=Object.freeze(Object.defineProperty({__proto__:null,ReviewCard:Th},Symbol.toStringTag,{value:"Module"}));function Oh({deviceLabel:t,actions:n}){return e.jsxs("div",{role:"note",className:"flex items-center gap-2 border-b border-l-4 px-3 py-2 text-sm",style:{background:"var(--bg-surface)",borderColor:"var(--border-default)",borderLeftColor:"var(--accent-primary)",color:"var(--text-primary)"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"2",y1:"9",x2:"22",y2:"9"}),e.jsx("line",{x1:"8",y1:"22",x2:"16",y2:"22"}),e.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"})]}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"font-semibold",children:["Web preview — no ",t," running."]})," ",e.jsx("span",{style:{color:"var(--text-dim)"},children:"Boot a simulator for native fidelity (gestures, haptics, native storage)."})]}),n?e.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:n}):null]})}const aE=Object.freeze(Object.defineProperty({__proto__:null,WebFallbackNotice:Oh},Symbol.toStringTag,{value:"Module"}));function Ah({previewOrigin:t,onRecheck:n}){const s=()=>{window.open(t,"_blank","noopener")};return e.jsx("div",{role:"dialog","aria-label":"Preview sign-in required",className:"absolute inset-0 z-40 flex items-center justify-center p-8",style:{background:"var(--bg-surface)"},children:e.jsxs("div",{className:"flex max-w-md flex-col items-start gap-4 rounded-lg border border-l-4 p-6",style:{background:"var(--bg-base)",borderColor:"var(--border-default)",borderLeftColor:"var(--accent-primary)",color:"var(--text-primary)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),e.jsx("span",{className:"text-base font-semibold",children:"Sign in to see the Live Preview"})]}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-dim)"},children:"This preview runs on a separate secured host that needs its own sign-in. Sign-in can’t happen inside this frame, so open the preview host in a new tab, sign in, then reload."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{type:"button",onClick:s,className:"rounded px-3 py-2 text-sm font-medium",style:{background:"var(--accent-primary)",color:"var(--bg-base)"},children:"Open preview to sign in"}),e.jsx("button",{type:"button",onClick:n,className:"rounded border px-3 py-2 text-sm",style:{borderColor:"var(--border-default)",color:"var(--text-primary)"},children:"I’ve signed in — reload preview"})]})]})})}const oE=Object.freeze(Object.defineProperty({__proto__:null,PreviewSignInNotice:Ah},Symbol.toStringTag,{value:"Module"}));function oi(){return e.jsxs("div",{style:{padding:"var(--spacing-lg, 16px)"},children:[e.jsx("h3",{style:{margin:0,color:"var(--text-primary)"},children:"Design exploration"}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"var(--text-sm, 14px)",lineHeight:1.5,marginTop:"var(--spacing-sm, 8px)"},children:"Generating mockups — they'll appear here as the agent writes them."})]})}const iE=Object.freeze(Object.defineProperty({__proto__:null,MockupGridEmptyState:oi},Symbol.toStringTag,{value:"Module"}));function Ua({onRunTests:t,disabled:n,currentRunner:s}){return n?e.jsxs("span",{className:"text-xs font-medium text-[var(--text-dim)] inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-current border-r-transparent"}),s?`Running ${s}…`:"Running…"]}):e.jsx("span",{role:"button",tabIndex:0,onClick:r=>{r.stopPropagation(),t()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.stopPropagation(),t())},className:"text-xs font-medium text-[var(--accent-active)] hover:underline cursor-pointer",children:"Run Tests"})}const lE=Object.freeze(Object.defineProperty({__proto__:null,RunTestsButton:Ua},Symbol.toStringTag,{value:"Module"}));function Rh({passed:t,failed:n,notRun:s}){const r=t+n+s;if(r===0)return null;const a=2,o=[{count:t,color:"var(--accent-green)"},{count:n,color:"var(--accent-red)"},{count:s,color:"var(--text-dim)"}].filter(u=>u.count>0),i=o.map(u=>Math.max(u.count/r*100,a)),c=i.reduce((u,h)=>u+h,0),d=i.map(u=>u/c*100);return e.jsx("div",{className:"h-1.5 flex-1 rounded-full bg-[var(--bg-input)] overflow-hidden max-w-32",children:e.jsx("div",{className:"h-full flex",children:o.map((u,h)=>e.jsx("div",{className:"h-full transition-all",style:{width:`${d[h]}%`,background:u.color}},u.color))})})}const cE=Object.freeze(Object.defineProperty({__proto__:null,TestBar:Rh},Symbol.toStringTag,{value:"Module"}));function ii({tests:t,loading:n,refreshing:s,onRunTests:r,currentRunner:a}){const o=t.total>0,i=t.discovered>0,c=t.discovered>t.total?t.discovered-t.total:0;return n?e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("div",{className:"h-1.5 w-16 rounded-full bg-[var(--bg-input)] animate-pulse"}),e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:s?"Running tests…":"Loading tests…"})]}):o?e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx(Rh,{passed:t.passed,failed:t.failed,notRun:c}),e.jsxs("span",{className:"text-xs font-medium text-[var(--accent-green)]",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-xs font-medium text-[var(--accent-red)]",children:["· ",t.failed," failed"]}),t.ignored>0&&e.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:["· ",t.ignored," skipped"]}),c>0&&e.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:["· ",c," not run"]}),r&&e.jsx(Ua,{onRunTests:r,disabled:s,currentRunner:a})]}):i?e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsxs("span",{className:"text-xs text-[var(--text-dim)]",children:[t.discovered," ",t.discovered===1?"test":"tests"," (not run)"]}),r&&e.jsx(Ua,{onRunTests:r})]}):e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:"No tests"})}const dE=Object.freeze(Object.defineProperty({__proto__:null,AppTestSummary:ii},Symbol.toStringTag,{value:"Module"}));function Eh({tests:t,loading:n,refreshing:s,onRunTests:r,currentRunner:a}){return e.jsxs("div",{className:"px-5 pb-5 pt-2 flex items-center gap-5 border-t border-[var(--border-default)]",children:[e.jsx(ii,{tests:t,loading:n,refreshing:s,onRunTests:r,currentRunner:a}),e.jsx("span",{className:"text-[var(--text-dim)] group-hover:text-[var(--accent-active)] transition ml-auto text-sm",children:"→"})]})}const uE=Object.freeze(Object.defineProperty({__proto__:null,AppCardFooter:Eh},Symbol.toStringTag,{value:"Module"}));function li({type:t}){const n=t==="web";return e.jsx("span",{className:`rounded px-1.5 py-0.5 text-xs font-medium ${n?"bg-[var(--accent-blue)]/20 text-[var(--accent-blue)]":"bg-[var(--accent-purple)]/20 text-[var(--accent-purple)]"}`,children:n?"web":"backend"})}const hE=Object.freeze(Object.defineProperty({__proto__:null,AppTypeBadge:li},Symbol.toStringTag,{value:"Module"}));function Mh({app:t}){return e.jsxs("div",{className:"px-5 pt-5 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-[var(--text-primary)]",children:t.name}),e.jsx(li,{type:t.type})]}),t.description?e.jsx("p",{className:"text-sm text-[var(--text-muted)] leading-relaxed",children:t.description}):null]})}const pE=Object.freeze(Object.defineProperty({__proto__:null,AppCardHeader:Mh},Symbol.toStringTag,{value:"Module"}));function Ih({thumbnails:t}){return e.jsx("div",{className:"flex gap-2 overflow-hidden",children:t.map((n,s)=>e.jsx("div",{className:"h-20 w-32 shrink-0 flex items-center justify-center overflow-hidden rounded border border-[var(--border-default)] bg-[var(--bg-surface)]",children:e.jsx(kt,{screenshotPath:n.path,cacheBuster:n.cacheBuster??void 0,alt:""})},`${n.path}:${s}`))})}const mE=Object.freeze(Object.defineProperty({__proto__:null,ThumbnailStrip:Ih},Symbol.toStringTag,{value:"Module"}));function Dh({thumbnails:t}){return e.jsx("div",{className:"px-5 py-3 flex-1",children:t.length>0?e.jsx(Ih,{thumbnails:t.slice(0,4)}):e.jsx("div",{className:"h-20"})})}const fE=Object.freeze(Object.defineProperty({__proto__:null,AppCardScenarioStrip:Dh},Symbol.toStringTag,{value:"Module"}));function Lh({stats:t,onClick:n,testsLoading:s,testsRefreshing:r,onRunTests:a,currentRunner:o}){const{app:i,tests:c,scenarios:d}=t;return e.jsxs("button",{onClick:n,className:"group flex w-full cursor-pointer flex-col rounded-lg border border-[var(--border-default)] bg-[var(--bg-card)] text-left transition hover:border-[var(--accent-active)]/40 hover:bg-[var(--bg-surface)]",children:[e.jsx(Mh,{app:i}),e.jsx(Dh,{thumbnails:d.thumbnails}),e.jsx(Eh,{tests:c,loading:s,refreshing:r,onRunTests:a,currentRunner:o})]})}const gE=Object.freeze(Object.defineProperty({__proto__:null,AppCard:Lh},Symbol.toStringTag,{value:"Module"}));function ci({coverage:t,prefix:n,testId:s,className:r,onClick:a}){if(!t||t.totalLines===0)return null;const o=`${Math.round(t.percent)}% coverage`,i=e.jsxs(e.Fragment,{children:[n??"",o]}),c=`${t.hitLines}/${t.totalLines} lines covered`;return a?e.jsx("span",{role:"button",tabIndex:0,className:r??"text-xs font-medium text-[var(--accent-active)] hover:underline cursor-pointer","data-testid":s??"coverage-badge",title:c,onClick:d=>{d.stopPropagation(),a()},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.stopPropagation(),d.preventDefault(),a())},children:i}):e.jsx("span",{className:r??"text-xs font-medium text-[var(--text-secondary)]","data-testid":s??"coverage-badge",title:c,children:i})}const bE=Object.freeze(Object.defineProperty({__proto__:null,CoverageBadge:ci},Symbol.toStringTag,{value:"Module"}));function Fh({app:t,showDetail:n,navContext:s=Sn,stats:r,testsLoading:a,testsRefreshing:o,onRunTests:i,currentRunner:c,coverage:d,onCoverageClick:u}){if(n)return null;const h=!!(d&&d.totalLines>0);return e.jsxs("div",{className:"px-5 py-4 border-b border-[var(--border-default)]",children:[e.jsx("div",{className:"mb-2",children:e.jsx(Tr,{apps:s.apps,selectedApp:t,selectedRouteEntity:null,isSingleApp:s.isSingleApp,onSelectApps:s.onSelectApps,onSelectApp:s.onSelectApp,onSelectRoute:s.onSelectRoute})}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-lg font-medium text-[var(--text-primary)]",children:t.name}),e.jsx(li,{type:t.type})]}),h?e.jsx(ci,{coverage:d,testId:"app-detail-coverage",onClick:u}):null]}),t.description?e.jsx("p",{className:"text-sm text-[var(--text-muted)] mt-1",children:t.description}):null,r?e.jsx("div",{className:"mt-3",children:e.jsx(ii,{tests:r.tests,loading:a,refreshing:o,onRunTests:i,currentRunner:c})}):null]})}const xE=Object.freeze(Object.defineProperty({__proto__:null,AppDetailHeader:Fh},Symbol.toStringTag,{value:"Module"}));function zh({name:t,id:n,capabilitiesTally:s,expanded:r,onToggle:a}){const o=t??n;return e.jsxs("button",{type:"button",onClick:a,className:"flex w-full items-center gap-2 text-left text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]","data-testid":"stack-summary","aria-expanded":r,children:[e.jsx("span",{className:`inline-block transition-transform ${r?"rotate-90":""}`,children:"▶"}),e.jsxs("span",{className:"font-medium text-[var(--text-primary)]",children:["Stack",o?` — ${o}`:""]}),t&&n?e.jsxs("span",{className:"text-[var(--text-dim)]",children:["(",n,")"]}):null,e.jsxs("span",{className:"text-[var(--text-dim)]",children:["— ",s]})]})}const yE=Object.freeze(Object.defineProperty({__proto__:null,AppStackPanelSummary:zh},Symbol.toStringTag,{value:"Module"})),Ya=["layout-web","interactions-click","interactions-touch-gestures","native-haptics","native-geolocation","native-clipboard","native-network","native-storage","routing","http-mocks","real-device"],$h={"layout-web":{label:"Web layout",description:"Visual layout and styling rendered in the web preview"},"interactions-click":{label:"Click interactions",description:"Pointer / click-driven UI behavior"},"interactions-touch-gestures":{label:"Touch gestures",description:"Swipe, pinch, and other multi-touch gestures"},"native-haptics":{label:"Haptic feedback",description:"Vibration / tactile feedback APIs"},"native-geolocation":{label:"Geolocation",description:"Device location APIs"},"native-clipboard":{label:"Clipboard",description:"Native copy / paste access"},"native-network":{label:"Network status",description:"Connectivity / reachability APIs"},"native-storage":{label:"Persistent storage",description:"On-device persistence (preferences, local DB, secure store). A 'manual' state here flags real-device verification — it does NOT mean the web preview can't be seeded; the editor still seeds storage from the adapter"},routing:{label:"Routing",description:"Navigation between screens / pages"},"http-mocks":{label:"HTTP mocking",description:"Network requests intercepted and replayed from scenarios"},"real-device":{label:"Real-device behavior",description:"Behavior that only manifests on a physical device or native build"}},Bh={verified:{label:"Verified",badgeClass:"bg-[var(--accent-green)]/20 text-[var(--accent-green)]",meaning:"The editor's scenarios actually exercise this — a regression fails a test."},stubbed:{label:"Stubbed",badgeClass:"bg-[var(--accent-orange)]/20 text-[var(--accent-orange)]",meaning:"No-op'd in web preview (e.g. a native API logged to console). Tests don't fail, but nothing is really verified — check on a real device."},manual:{label:"Manual",badgeClass:"bg-[var(--accent-blue)]/20 text-[var(--accent-blue)]",meaning:"Must be checked by hand on a real device or native build target. This is orthogonal to seeding: the editor still seeds this into the web preview — 'manual' only flags the real-device check."},"not-applicable":{label:"N/A",badgeClass:"bg-[var(--bg-subtle)] text-[var(--text-dim)]",meaning:"This stack doesn't expose the capability."}};function O1(t){var n;return((n=$h[t])==null?void 0:n.label)??t}function A1(t,n){var a,o;const s=(a=$h[t])==null?void 0:a.description,r=((o=Bh[n])==null?void 0:o.meaning)??"";return s?`${s}. ${r}`:r}function qh({capabilities:t,defaultExpanded:n=!1}){const[s,r]=l.useState(n),a=Ya.filter(c=>c in t),o=Object.keys(t).filter(c=>!Ya.includes(c)),i={verified:0,stubbed:0,manual:0,"not-applicable":0};for(const c of a){const d=t[c];d in i&&(i[d]+=1)}return e.jsxs("div",{className:"px-5 py-2","data-testid":"capabilities-panel",children:[e.jsxs("button",{type:"button",onClick:()=>r(c=>!c),className:"flex w-full items-center gap-2 text-left text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]","data-testid":"capabilities-summary","aria-expanded":s,children:[e.jsx("span",{className:`inline-block transition-transform ${s?"rotate-90":""}`,children:"▶"}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:"Stack capabilities"}),e.jsxs("span",{className:"text-[var(--text-dim)]",children:["— ",i.verified," verified · ",i.stubbed," stubbed ·"," ",i.manual," manual · ",i["not-applicable"]," n/a"]})]}),s?e.jsxs("div",{className:"mt-2 space-y-1","data-testid":"capabilities-rows",children:[a.map(c=>e.jsx(Va,{token:c,state:t[c]},c)),o.length>0?e.jsxs("div",{className:"mt-3","data-testid":"capabilities-unknown-group",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs font-medium text-[var(--accent-warn)]",children:[e.jsx("span",{title:"These tokens aren't recognized — likely typos",children:"⚠"}),"Unknown capabilities"]}),o.map(c=>e.jsx(Va,{token:c,state:t[c],unknown:!0},c))]}):null]}):null]})}function Va({token:t,state:n,unknown:s}){const r=Bh[n],a=s?"This token isn't recognized — may be a typo.":A1(t,n);return e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs","data-testid":`capability-row-${t}`,children:[e.jsxs("span",{className:"flex items-center gap-1 text-[var(--text-secondary)]",children:[O1(t),e.jsx("span",{className:"cursor-help text-[var(--text-dim)]",title:a,"aria-label":a,children:"ⓘ"})]}),e.jsx("span",{className:`rounded px-1.5 py-0.5 ${(r==null?void 0:r.badgeClass)??"bg-[var(--bg-subtle)] text-[var(--text-dim)]"}`,children:(r==null?void 0:r.label)??n})]})}const vE=Object.freeze(Object.defineProperty({__proto__:null,AppCapabilitiesPanel:qh,CapabilityRow:Va},Symbol.toStringTag,{value:"Module"}));function Hh({capabilities:t}){return t&&Object.keys(t).length>0?e.jsx(qh,{capabilities:t,defaultExpanded:!1}):e.jsxs("div",{className:"text-xs text-[var(--text-dim)]","data-testid":"stack-capabilities-empty-hint",children:["Capabilities not declared. Run"," ",e.jsx("code",{className:"rounded bg-[var(--bg-subtle)] px-1 py-0.5 text-[var(--text-secondary)]",children:"codeyam-editor editor capabilities-list"})," ","to learn more."]})}const jE=Object.freeze(Object.defineProperty({__proto__:null,AppStackCapabilitiesSlot:Hh},Symbol.toStringTag,{value:"Module"}));function Wh({fields:t,capabilities:n}){return e.jsxs("div",{className:"mt-2 space-y-2","data-testid":"stack-body",children:[t.description?e.jsx("p",{className:"text-xs text-[var(--text-secondary)]","data-testid":"stack-description",children:t.description}):null,t.technologies.length>0?e.jsx("ul",{className:"flex flex-wrap gap-1","data-testid":"stack-technologies",children:t.technologies.map(s=>e.jsx("li",{className:"rounded bg-[var(--bg-subtle)] px-1.5 py-0.5 text-[10px] text-[var(--text-secondary)]",children:s},s))}):null,t.commands.length>0?e.jsx("dl",{className:"space-y-0.5 text-xs","data-testid":"stack-commands",children:t.commands.map(({key:s,value:r})=>e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("dt",{className:"w-10 text-[var(--text-dim)]",children:s}),e.jsx("dd",{className:"text-[var(--text-secondary)]",children:e.jsx("code",{className:"rounded bg-[var(--bg-subtle)] px-1 py-0.5",children:r})})]},s))}):null,t.routingSummary?e.jsxs("div",{className:"text-xs text-[var(--text-secondary)]","data-testid":"stack-routing",children:[e.jsx("span",{className:"text-[var(--text-dim)]",children:"routing"})," ",t.routingSummary]}):null,e.jsx("div",{className:"border-t border-[var(--border-subtle)] pt-2",children:e.jsx(Hh,{capabilities:n})})]})}const wE=Object.freeze(Object.defineProperty({__proto__:null,AppStackPanelBody:Wh},Symbol.toStringTag,{value:"Module"}));function Gh({skip:t=!1}={}){const[n,s]=l.useState(null);return l.useEffect(()=>{if(t)return;let r=!1;return fetch("/api/project-stack").then(a=>a.ok?a.json():{}).then(a=>{r||s(a&&typeof a=="object"&&!Array.isArray(a)?a:{})}).catch(()=>{r||s({})}),()=>{r=!0}},[t]),n}const R1=["dev","test","build"];function Zt(t){return typeof t=="string"&&t.length>0?t:null}function Uh(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function E1(t){return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}function M1(t){const n=Uh(t);if(!n)return[];const s=[];for(const r of R1){const a=Zt(n[r]);a&&s.push({key:r,value:a})}return s}function I1(t){const n=Uh(t);if(!n)return null;const s=Zt(n.type);if(!s)return null;const r=Zt(n.pagesDir)??Zt(n.isolationRoute)??Zt(n.componentManifest);return r?`${s} (${r})`:s}function D1(t){const n=t.capabilities;return!n||typeof n!="object"||Array.isArray(n)?null:n}function L1(t){if(!t||Object.keys(t).length===0)return"capabilities not declared";const n={verified:0,stubbed:0,manual:0,"not-applicable":0};for(const s of Ya){const r=t[s];r&&r in n&&(n[r]+=1)}return`${n.verified} verified · ${n.stubbed} stubbed · ${n.manual} manual · ${n["not-applicable"]} n/a`}function F1(t){return t?{id:Zt(t.id),name:Zt(t.name),description:Zt(t.description),technologies:E1(t.technologies),commands:M1(t.commands),routingSummary:I1(t.routing)}:{id:null,name:null,description:null,technologies:[],commands:[],routingSummary:null}}function Yh({stack:t,defaultExpanded:n=!1}){const s=t!==void 0,[r,a]=l.useState(n),o=Gh({skip:s}),i=s?t:o;if(!i||Object.keys(i).length===0)return null;const c=F1(i),d=D1(i);return e.jsxs("div",{className:"px-5 py-2","data-testid":"stack-panel",children:[e.jsx(zh,{name:c.name,id:c.id,capabilitiesTally:L1(d),expanded:r,onToggle:()=>a(u=>!u)}),r?e.jsx(Wh,{fields:c,capabilities:d}):null]})}const _E=Object.freeze(Object.defineProperty({__proto__:null,AppStackPanel:Yh},Symbol.toStringTag,{value:"Module"}));function Vh({app:t,navContext:n=Sn,routeEntities:s,unsurfacedPages:r,componentSurfaceReason:a,routesLoading:o,routesError:i,selectedEntityHash:c,selectedRouteEntity:d,testGroups:u,selectedSlug:h,entityLookup:p,allScenarios:f,onSelectScenario:m,onSelectRoute:g,onSelectEntity:b,onBackToRoutes:x,onScenariosChanged:y,coverage:v,showProjectBand:w,onCoverageClick:j,stats:_,testsLoading:k,testsRefreshing:S,onRunTests:N,currentRunner:T}){const A=t.type==="web",M=!!w&&!d;return e.jsxs("div",{children:[M?e.jsx(Yh,{}):null,e.jsx(Fh,{app:t,showDetail:!!(d||c),navContext:n,stats:_,testsLoading:k,testsRefreshing:S,onRunTests:N,currentRunner:T,coverage:M?v:void 0,onCoverageClick:j}),e.jsx(ni,{app:t,navContext:n,isWeb:A,routeEntities:s,unsurfacedPages:r,componentSurfaceReason:a,routesLoading:o,routesError:i,selectedEntityHash:c??null,selectedRouteEntity:d,testGroups:u,selectedSlug:h,entityLookup:p,allScenarios:f,onSelectScenario:m,onSelectRoute:g,onSelectEntity:b,onBackToRoutes:x,onScenariosChanged:y})]})}const kE=Object.freeze(Object.defineProperty({__proto__:null,AppDetail:Vh},Symbol.toStringTag,{value:"Module"}));function Kh(t){const n=new Date(t);if(isNaN(n.getTime()))return t;const s=new Date,r=s.getTime()-n.getTime(),a=Math.floor(r/6e4),o=Math.floor(r/36e5),i=Math.floor(r/864e5);return a<1?"just now":a<60?`${a}m ago`:o<24?`${o}h ago`:i<7?`${i}d ago`:n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:n.getFullYear()!==s.getFullYear()?"numeric":void 0})}function Jh(t){switch(t){case"feature":return"text-[#D7FF63]";case"fix":return"text-red-400";case"refactor":return"text-purple-400";case"milestone":return"text-yellow-400";default:return"text-gray-400"}}function SE(t){let n=0,s=0,r=0;for(const a of t)a.status==="added"?n++:a.status==="deleted"?r++:s++;return{added:n,modified:s,deleted:r}}function di({screenshots:t,onSelect:n}){return t.length===0?null:e.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((s,r)=>{const a=!!n&&!!s.screenshotPath,o=e.jsx("div",{className:"flex h-16 w-24 items-center justify-center overflow-hidden rounded border border-[var(--border-default)] bg-[var(--bg-surface)]",children:e.jsx(kt,{screenshotPath:s.screenshotPath,cacheBuster:s.screenshotCapturedAtMs??void 0,alt:s.name})});return e.jsxs("div",{className:"text-center",children:[a?e.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(s),"aria-label":`Preview ${s.name}`,className:"block cursor-pointer rounded transition hover:ring-2 hover:ring-[var(--accent-primary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent-primary)]",children:o}):o,e.jsx("p",{className:"mt-0.5 text-xs text-[var(--text-dim)] truncate w-24",children:s.name})]},`${s.screenshotPath??"missing"}:${s.name}:${r}`)})})}const NE=Object.freeze(Object.defineProperty({__proto__:null,ScenarioThumbnailGrid:di},Symbol.toStringTag,{value:"Module"}));function en({children:t,testId:n}){return e.jsx("div",{className:"overflow-y-auto px-4 py-4",style:{maxHeight:"calc(100vh - 110px)"},"data-testid":n,children:t})}const CE=Object.freeze(Object.defineProperty({__proto__:null,TabScrollPanel:en},Symbol.toStringTag,{value:"Module"}));function Xh(){const{reviews:t,repoState:n,loading:s,error:r}=_1(),[a,o]=l.useState(null);return s?e.jsx(en,{children:e.jsx("div",{className:"py-12 text-center text-[var(--text-muted)]",children:"Loading reviews..."})}):r&&t.length===0?e.jsx(en,{children:e.jsx("div",{className:"py-12",children:e.jsx(Qe,{text:`Failed to load reviews: ${r}`,className:"text-sm text-[var(--accent-red)]",rowClassName:"justify-center"})})}):t.length===0?e.jsx(en,{children:e.jsxs("div",{className:"py-12 text-center text-[var(--text-dim)]",children:[e.jsx("p",{children:"No PR digests yet."}),e.jsxs("p",{className:"mt-2 text-sm",children:["Run"," ",e.jsx("span",{className:"font-mono",style:{color:"var(--text-secondary)"},children:"/codeyam-review-pr"})," ","to digest an incoming pull request."]})]})}):e.jsx(en,{children:e.jsx("div",{className:"flex flex-col gap-3",children:t.map(i=>e.jsx(Th,{review:i,repoState:n,expanded:a===i.id,onToggle:()=>o(c=>c===i.id?null:i.id)},i.id))})})}const PE=Object.freeze(Object.defineProperty({__proto__:null,ReviewsTab:Xh},Symbol.toStringTag,{value:"Module"}));function z1({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]})}function $1({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),e.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),e.jsx("path",{d:"M9 12h6"}),e.jsx("path",{d:"M9 16h6"})]})}function vn({size:t=20}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"})})}function ks({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),e.jsx("path",{d:"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"}),e.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"})]})}function Me({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function Gn({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]})}function $e({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function ui({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})}function $n({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("polyline",{points:"4 17 10 11 4 5"}),e.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function qt({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2"}),e.jsx("line",{x1:"2",y1:"10",x2:"22",y2:"10"})]})}function vt({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),e.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),e.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function Ee({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),e.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]})}function tn({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function rt({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),e.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),e.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})}function hi({size:t=20}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"}),e.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})}const TE=Object.freeze(Object.defineProperty({__proto__:null,BellIcon:hi,BoxIcon:rt,CardIcon:qt,ChartIcon:vt,CloudIcon:vn,DatabaseIcon:ks,DocIcon:Ee,ExploreIcon:z1,GlobeIcon:tn,LockIcon:Me,MailIcon:Gn,PlansIcon:$1,RocketIcon:$e,SetupIcon:ui,TerminalIcon:$n},Symbol.toStringTag,{value:"Module"})),B1=[{key:"box",label:"General"},{key:"cloud",label:"Hosting"},{key:"database",label:"Data"},{key:"lock",label:"Accounts / security"},{key:"mail",label:"Email"},{key:"card",label:"Payments"},{key:"chart",label:"Analytics"},{key:"doc",label:"Docs / legal"},{key:"globe",label:"Domain / web"},{key:"bell",label:"Notifications"},{key:"rocket",label:"Release"}],q1={add:{title:"Add a setup topic",lead:"Have something this list doesn't cover yet? Add it and it becomes part of your setup checklist.",submit:"Add topic",submitting:"Adding…"},ask:{title:"Ask about a service or topic",lead:"Tell us what you're curious about. We'll add it to your setup list so the assistant can explain it and help you set it up.",submit:"Add & ask",submitting:"Adding…"}};function Qh({intent:t="add",onSubmit:n,onCancel:s}){const r=q1[t],[a,o]=l.useState(""),[i,c]=l.useState(""),[d,u]=l.useState("box"),[h,p]=l.useState(!1),[f,m]=l.useState(null),g=a.trim(),b=g.length>0&&!h,x=async y=>{if(y.preventDefault(),!b){g.length===0&&m("Please enter a name.");return}p(!0),m(null);try{await n({name:g,desc:i.trim(),icon:d})}catch(v){m(v instanceof Error?v.message:"Something went wrong."),p(!1)}};return e.jsxs("div",{className:"learn-screen",children:[e.jsx("div",{className:"atf-backdrop",role:"presentation",onClick:s}),e.jsxs("div",{className:"atf-modal",role:"dialog","aria-modal":"true","aria-label":r.title,children:[e.jsx("div",{className:"atf-title",children:r.title}),e.jsx("p",{className:"atf-lead",children:r.lead}),e.jsxs("form",{onSubmit:x,children:[e.jsxs("label",{className:"atf-field",children:[e.jsx("span",{className:"atf-label",children:"Name"}),e.jsx("input",{className:"atf-input",type:"text",value:a,autoFocus:!0,placeholder:t==="ask"?"e.g. Cloudflare, a regional payment processor…":"e.g. Error monitoring, a custom step…",onChange:y=>o(y.target.value)})]}),e.jsxs("label",{className:"atf-field",children:[e.jsxs("span",{className:"atf-label",children:["What is it for? ",e.jsx("span",{className:"atf-optional",children:"(optional)"})]}),e.jsx("textarea",{className:"atf-input atf-textarea",value:i,rows:2,placeholder:"One line on what this is for.",onChange:y=>c(y.target.value)})]}),e.jsxs("label",{className:"atf-field",children:[e.jsx("span",{className:"atf-label",children:"Icon"}),e.jsx("select",{className:"atf-input",value:d,onChange:y=>u(y.target.value),children:B1.map(y=>e.jsx("option",{value:y.key,children:y.label},y.key))})]}),f?e.jsx("div",{className:"atf-error",children:e.jsx(Qe,{text:f,className:""})}):null,e.jsxs("div",{className:"atf-actions",children:[e.jsx("button",{type:"button",className:"atf-btn atf-btn-ghost",onClick:s,disabled:h,children:"Cancel"}),e.jsx("button",{type:"submit",className:"atf-btn atf-btn-primary",disabled:!b,children:h?r.submitting:r.submit})]})]})]})]})}const OE=Object.freeze(Object.defineProperty({__proto__:null,AddTopicForm:Qh},Symbol.toStringTag,{value:"Module"}));function Zh({onAdd:t,onAsk:n}){return e.jsxs("div",{className:"setup-addrow",children:[e.jsx("div",{className:"setup-addrow-copy",children:"Don't see what you need? Add an off-list service or topic — or ask the assistant about one."}),e.jsxs("div",{className:"setup-addrow-btns",children:[e.jsx("button",{type:"button",className:"setup-addbtn",onClick:t,children:"+ Add a topic"}),e.jsx("button",{type:"button",className:"setup-addbtn setup-addbtn-ask",onClick:n,children:"Ask the AI about a service"})]})]})}const AE=Object.freeze(Object.defineProperty({__proto__:null,SetupAddTopicRow:Zh},Symbol.toStringTag,{value:"Module"}));function H1(){const[t,n]=l.useState(null);l.useEffect(()=>{let r=!1;return(async()=>{try{const a=await fetch("/api/setup-concepts");if(!a.ok)throw new Error(`HTTP ${a.status}`);const o=await a.json();r||n(Array.isArray(o)?o:[])}catch{r||n([])}})(),()=>{r=!0}},[]);const s=l.useMemo(()=>{const r=new Map;for(const a of t??[])r.set(a.key,a);return r},[t]);return{concepts:t,byKey:r=>s.get(r)}}const W1={concepts:[],byKey:()=>{}},Dr=l.createContext(W1);function ep({children:t}){const n=H1();return e.jsx(Dr.Provider,{value:n,children:t})}function tp(){return l.useContext(Dr)}function np(t){return l.useContext(Dr).byKey(t)}const RE=Object.freeze(Object.defineProperty({__proto__:null,ConceptsContext:Dr,ConceptsProvider:ep,useConcept:np,useConceptIndex:tp},Symbol.toStringTag,{value:"Module"}));function tr({k:t,children:n}){const s=np(t),[r,a]=l.useState(null),o=l.useRef(null),i=l.useRef(null),c=l.useId(),d=r!==null,u=()=>{var p;const h=(p=o.current)==null?void 0:p.getBoundingClientRect();h&&a({top:h.bottom+6,left:h.left})};return l.useEffect(()=>{if(!d)return;const h=f=>{var g,b;const m=f.target;!((g=o.current)!=null&&g.contains(m))&&!((b=i.current)!=null&&b.contains(m))&&a(null)},p=f=>{f.key==="Escape"&&a(null)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p)}},[d]),s?e.jsxs("span",{className:"concept-term-wrap",children:[e.jsx("button",{type:"button",ref:o,className:"concept-term","aria-expanded":d,"aria-controls":d?c:void 0,onClick:()=>d?a(null):u(),children:n}),d&&r?bn.createPortal(e.jsxs("div",{ref:i,className:"concept-popover",id:c,role:"dialog",style:{top:r.top,left:r.left},children:[e.jsx("span",{className:"concept-popover-term",children:s.term}),s.category?e.jsx("span",{className:"concept-popover-cat",children:s.category}):null,e.jsx("div",{className:"concept-popover-body",children:e.jsx(Ht,{variant:"compact",children:s.body})})]}),document.body):null]}):e.jsx(e.Fragment,{children:n})}const EE=Object.freeze(Object.defineProperty({__proto__:null,ConceptTerm:tr},Symbol.toStringTag,{value:"Module"}));function sp(t){const n=t.evidence[0];return n?`found ${n.value} in ${n.source}`:t.source==="declared"?"declared by the agent":"detected in this project"}function rp({service:t,onDismiss:n,onAddCredential:s}){var i;const r=(((i=t.envVars)==null?void 0:i.length)??0)>0,a=r&&!t.credentialPresent,o=r&&t.credentialPresent;return e.jsxs("div",{className:"detected-service",children:[e.jsx("span",{className:"ds-tag",children:t.source}),e.jsx("span",{className:"ds-name",children:t.name}),e.jsx("span",{className:"ds-why",children:sp(t)}),o?e.jsx("span",{className:"ds-key-set","data-testid":`ds-key-set-${t.key}`,children:"Key set"}):null,a&&s?e.jsx("button",{type:"button",className:"ds-add-key",onClick:()=>s(t),"aria-label":`Add key for ${t.name}`,children:"Add key"}):null,n?e.jsx("button",{type:"button",className:"ds-dismiss",onClick:()=>n(t.key),"aria-label":`Dismiss ${t.name}`,children:"Dismiss"}):null]})}const ME=Object.freeze(Object.defineProperty({__proto__:null,DetectedServiceRow:rp,evidenceSummary:sp},Symbol.toStringTag,{value:"Module"})),G1={terminal:$n,cloud:vn,database:ks,lock:Me,mail:Gn,card:qt,chart:vt,doc:Ee,globe:tn,box:rt,bell:hi,rocket:$e};function U1(t){return G1[t]??ui}function Y1(t){return t==="done"?"trow done":t==="next"||t==="in-progress"?"trow next":"trow soon"}function V1(t){return t==="done"?"set up":t==="in-progress"?"in progress":t==="next"?"next":"explore"}function nr({topics:t,detectedServices:n,onBack:s,onOpenHosting:r,onOpenTopic:a,onOpenLibraries:o,onDismissService:i,onAddCredential:c,onCreateTopic:d,onOpenConcepts:u}){const h=b=>{b.key==="hosting"?r():a==null||a(b.key)},p=new Map;for(const b of n??[]){if(b.status==="dismissed")continue;const x=p.get(b.topic)??[];x.push(b),p.set(b.topic,x)}const[f,m]=l.useState(null),g=async b=>{if(!d)return;const x=await d(b);m(null),a==null||a(x.key)};return e.jsxs("div",{className:"learn-screen",children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:s,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:s,children:"Home"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Setup"})]}),e.jsx("div",{className:"h",children:"Setup"}),e.jsx("div",{className:"hsub",children:"The things this kind of app eventually needs, explained simply. Learn about each, set it up here, and see what's already configured. No rush."}),u?e.jsxs("div",{className:"concepts-nudge",children:["New to terms like ",e.jsx(tr,{k:"hosting",children:"hosting"}),", a"," ",e.jsx(tr,{k:"domain",children:"domain"}),", or"," ",e.jsx(tr,{k:"ssl-https",children:"HTTPS"}),"? Tap any underlined word for a plain-language explainer, or"," ",e.jsx("button",{type:"button",className:"concepts-nudge-link",onClick:u,children:"browse what these words mean"}),"."]}):null,e.jsx("div",{className:"tlist",children:t===null?Array.from({length:5}).map((b,x)=>e.jsxs("div",{className:"trow soon","aria-hidden":"true",children:[e.jsx("div",{className:"tic"}),e.jsxs("div",{className:"tbody",children:[e.jsx("div",{className:"tn",children:" "}),e.jsx("div",{className:"td",children:" "})]})]},x)):t.map(b=>{const x=U1(b.icon),y=p.get(b.key)??[];return e.jsxs("div",{className:"trow-group",children:[e.jsxs("button",{type:"button",className:Y1(b.status),onClick:()=>h(b),children:[e.jsx("div",{className:"tic",children:e.jsx(x,{size:20})}),e.jsxs("div",{className:"tbody",children:[e.jsx("div",{className:"tn",children:b.name}),e.jsx("div",{className:"td",children:b.desc})]}),e.jsx("span",{className:"tt",children:V1(b.status)}),e.jsx("span",{className:"arrow",children:"→"})]}),y.length>0?e.jsx("div",{className:"detected-services",children:y.map(v=>e.jsx(rp,{service:v,onDismiss:i,onAddCredential:c},v.key))}):null]},b.key)})}),o&&e.jsxs("div",{className:"setup-libraries-section",children:[e.jsx("div",{className:"seclabel",children:"Libraries"}),e.jsxs("button",{type:"button",className:"trow",onClick:o,children:[e.jsx("div",{className:"tic",children:e.jsx(rt,{size:20})}),e.jsxs("div",{className:"tbody",children:[e.jsx("div",{className:"tn",children:"Libraries you depend on"}),e.jsx("div",{className:"td",children:"Every third-party library your app pulls in — what it is, its version, and how to update it."})]}),e.jsx("span",{className:"tt",children:"auto"}),e.jsx("span",{className:"arrow",children:"→"})]})]}),d?e.jsx(Zh,{onAdd:()=>m("add"),onAsk:()=>m("ask")}):null,f&&d?e.jsx(Qh,{intent:f,onSubmit:g,onCancel:()=>m(null)}):null]})}const IE=Object.freeze(Object.defineProperty({__proto__:null,LearnSetupScreen:nr},Symbol.toStringTag,{value:"Module"}));function ls({command:t,writer:n}){const{copied:s,copy:r}=Fo({writer:n});return e.jsxs("div",{className:"rl-cmd",children:[e.jsx("code",{className:"rl-cmd-text",children:t}),e.jsx("button",{type:"button",className:"rl-copy",onClick:()=>{r(t).catch(()=>{})},"aria-label":`Copy command: ${t}`,children:s?"Copied!":"Copy"})]})}const DE=Object.freeze(Object.defineProperty({__proto__:null,RunLocallyCommandRow:ls},Symbol.toStringTag,{value:"Module"}));function K1(t){return t==="dev"?"dev":t==="transitive"?"transitive":"direct"}function ap({lib:t,copyWriter:n}){return e.jsxs("div",{className:"lib-row",children:[e.jsxs("div",{className:"lib-head",children:[e.jsx("span",{className:"lib-name",children:t.name}),e.jsx("span",{className:"lib-version",children:t.version||"—"}),e.jsx("span",{className:`lib-kind ${t.kind}`,children:K1(t.kind)}),t.outdated&&e.jsx("span",{className:"lib-outdated",title:"A newer version is available",children:"outdated"})]}),t.description?e.jsx("div",{className:"lib-desc",children:t.description}):e.jsx("div",{className:"lib-desc muted",children:"A library this project depends on. No description on file yet."}),e.jsxs("div",{className:"lib-meta",children:[t.category&&e.jsx("span",{className:"lib-tag",children:t.category}),t.license&&e.jsxs("span",{className:"lib-license",children:["License: ",t.license]}),t.homepage&&e.jsx("a",{className:"lib-docs",href:t.homepage,target:"_blank",rel:"noreferrer",children:"Docs ↗"})]}),e.jsx(ls,{command:t.updateCommand,writer:n})]})}const LE=Object.freeze(Object.defineProperty({__proto__:null,LibraryRow:ap},Symbol.toStringTag,{value:"Module"}));function J1(t,n){return n?`${t.name} ${t.description??""} ${t.category??""}`.toLowerCase().includes(n):!0}function op({group:t,query:n,forceOpen:s,copyWriter:r}){const[a,o]=l.useState(t.libraries.length<=8),i=t.libraries.filter(d=>J1(d,n));if(n&&i.length===0)return null;const c=s||a;return e.jsxs("section",{className:"lib-group",children:[e.jsxs("button",{type:"button",className:"lib-group-head","aria-expanded":c,onClick:()=>o(d=>!d),children:[e.jsx("span",{className:"lib-group-icon",children:e.jsx(rt,{size:18})}),e.jsx("span",{className:"lib-group-title",children:t.ecosystem}),e.jsxs("span",{className:"lib-group-count",children:[i.length," ",i.length===1?"library":"libraries"]}),e.jsx("span",{className:"lib-group-path",children:t.manifestPath}),e.jsx("span",{className:"lib-group-chevron",children:c?"▾":"▸"})]}),c&&e.jsx("div",{className:"lib-rows",children:i.map(d=>e.jsx(ap,{lib:d,copyWriter:r},d.name))})]})}const FE=Object.freeze(Object.defineProperty({__proto__:null,LibraryGroupSection:op},Symbol.toStringTag,{value:"Module"}));function ip({groups:t,onBack:n,copyWriter:s}){const[r,a]=l.useState(""),o=r.trim().toLowerCase(),i=l.useMemo(()=>(t??[]).reduce((c,d)=>c+d.libraries.length,0),[t]);return e.jsxs("div",{className:"learn-screen libraries-screen",children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:n,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:n,children:"Home"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("button",{type:"button",onClick:n,children:"Setup"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Libraries"})]}),e.jsx("div",{className:"h",children:"Libraries"}),e.jsx("div",{className:"hsub",children:"These are the third-party libraries your app uses — code other people wrote that you depend on instead of building it yourself. You didn't configure most of these; they came along with the tools you're using. This list is read straight from your project's manifests, so it's always up to date."}),t===null?e.jsx("div",{className:"lib-loading","aria-hidden":"true",children:"Reading your project's libraries…"}):t.length===0?e.jsxs("div",{className:"lib-empty",children:[e.jsx("div",{className:"lib-empty-title",children:"No libraries yet"}),e.jsx("div",{className:"lib-empty-body",children:"This project doesn't declare any third-party libraries in a manifest we recognize (package.json, Cargo.toml, requirements.txt, Podfile). When it does, they'll show up here automatically."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"lib-searchbar",children:e.jsx("input",{type:"search",className:"lib-search",placeholder:`Search ${i} libraries…`,value:r,onChange:c=>a(c.target.value),"aria-label":"Search libraries"})}),e.jsx("div",{className:"lib-groups",children:t.map(c=>e.jsx(op,{group:c,query:o,forceOpen:o.length>0,copyWriter:s},c.manifestPath))})]})]})}const zE=Object.freeze(Object.defineProperty({__proto__:null,LibrariesCatalogScreen:ip},Symbol.toStringTag,{value:"Module"}));function pi(t){switch(t){case"real-data":return e.jsx(mn,{before:{tag:"Now · in the code",items:["Resets on refresh","A developer must edit"]},after:{tag:"After · in a database",items:["Saved for good","You edit it yourself"]}});case"performance-images":return e.jsx(mn,{before:{tag:"Heavy",items:["Full-size images","Slow first paint"]},after:{tag:"Optimized",items:["Right-sized & lazy","Fast on any device"]}});case"cli-ux":return e.jsx(mn,{before:{tag:"Cryptic",items:["Confusing errors","Guess the flags"]},after:{tag:"Polished",items:["Clear help & output","Helpful messages"]}});case"forms":return e.jsx(mn,{before:{tag:"Without setup",items:["Submissions lost","Spam gets through"]},after:{tag:"With setup",items:["Reliably delivered","Spam filtered out"]}});case"custom-domain":return e.jsx(mn,{before:{tag:"Default link",items:["Generic address","Hard to remember"]},after:{tag:"Your domain",items:["yourname.com","Secure & trusted"]}});case"accounts":return e.jsx(gn,{center:{emoji:"🔑",label:"Sign-in"},satellites:["✉️ Email link","🔵 Google","🍎 Apple","🔒 Password"]});case"emails":return e.jsx(gn,{center:{emoji:"✉️",label:"Your app sends"},satellites:["👋 Welcome","🔑 Password reset","🧾 Receipt","🔔 Notification"]});case"api-auth":return e.jsx(gn,{center:{emoji:"🛡️",label:"Your API"},satellites:["🎟️ API key","🪪 Token","⛔ Revoke anytime"]});case"cors-origins":return e.jsx(gn,{center:{emoji:"🚦",label:"Your API"},satellites:["✅ your-site.com","✅ app.your-site.com","⛔ everyone else"]});case"comments-search":return e.jsx(gn,{center:{emoji:"📚",label:"Your content"},satellites:["🔍 Fast search","💬 Comments","🛡️ Moderation"]});case"analytics-monitoring":return e.jsx(er,{bars:[{label:"Visits",pct:62},{label:"Signups",pct:40},{label:"Active",pct:78,lime:!0},{label:"Errors",pct:16}]});case"analytics-seo":return e.jsx(er,{bars:[{label:"Search",pct:70,lime:!0},{label:"Direct",pct:45},{label:"Social",pct:30},{label:"Referral",pct:22}]});case"logging-monitoring":return e.jsx(er,{bars:[{label:"Mon",pct:30},{label:"Tue",pct:44},{label:"Wed",pct:88,lime:!0},{label:"Thu",pct:36},{label:"Fri",pct:52}]});case"database-backups":return e.jsx(fn,{rows:[{emoji:"🗄️",label:"Live data",sub:"The real thing"},{emoji:"💾",label:"Daily backup",sub:"Safe copy",lime:!0},{emoji:"💾",label:"Yesterday",sub:"Restore point"},{emoji:"💾",label:"Last week",sub:"Restore point"}]});case"release-builds":return e.jsx(fn,{rows:[{emoji:"🧾",label:"Your source",sub:"One codebase"},{emoji:"🍎",label:"macOS build",sub:"Ready to run",lime:!0},{emoji:"🪟",label:"Windows build",sub:"Ready to run"},{emoji:"🐧",label:"Linux build",sub:"Ready to run"}]});case"staging-environment":return e.jsx(fn,{rows:[{emoji:"🏭",label:"Production",sub:"Real users"},{emoji:"🏗️",label:"Staging",sub:"Rehearse here",lime:!0},{emoji:"💻",label:"Local",sub:"Your machine"}]});case"publish-registry":return e.jsx(fn,{rows:[{emoji:"📦",label:"your-package",sub:"v1.2.0",lime:!0},{emoji:"🏷️",label:"Registry",sub:"Public listing"},{emoji:"⬇️",label:"npm install",sub:"One command"}]});case"semver-policy":return e.jsx(fn,{rows:[{emoji:"🟥",label:"Major · 2.0.0",sub:"May break"},{emoji:"🟨",label:"Minor · 1.3.0",sub:"New features"},{emoji:"🟩",label:"Patch · 1.2.1",sub:"Safe fix",lime:!0}]});case"versioning-changelog":return e.jsx(fn,{rows:[{emoji:"🆕",label:"v1.3.0",sub:"Added, fixed",lime:!0},{emoji:"📝",label:"v1.2.0",sub:"Changed"},{emoji:"📝",label:"v1.1.0",sub:"Fixed"}]});case"pre-release-channel":return e.jsx(Wa,{channels:[{label:"Stable",dots:5},{label:"Beta",dots:5,on:!0}]});case"pre-release-versions":return e.jsx(Wa,{channels:[{label:"latest",dots:4},{label:"next",dots:4,on:!0}]});case"legal":return e.jsx(Ut,{emoji:"⚖️",caption:"Clear, honest, above board",chips:["Privacy policy","Terms of service","Plain language"]});case"data-safety":return e.jsx(Ut,{emoji:"🛡️",caption:"Collect less, protect the rest",chips:["Minimize","Encrypt","Declare clearly"]});case"supply-chain":return e.jsx(Ut,{emoji:"🔗",caption:"Trust the code you depend on",chips:["Scan for risk","Pin versions","Verify builds"]});case"secrets":return e.jsx(Ut,{emoji:"🔑",caption:"Out of the code, in a safe store",chips:["Never committed","Easy to rotate","Per-environment"]});case"readme-license":return e.jsx(Ut,{emoji:"📖",caption:"The first things visitors read",chips:["What it is","How to use it","What's allowed"]});case"install-docs":return e.jsx(Ut,{emoji:"📘",caption:"From zero to running, fast",chips:["Install","First example","Common task"]});case"examples":return e.jsx(Ut,{emoji:"🧩",caption:"Show it solving real tasks",chips:["Runnable","Real use cases","Copy & tweak"]});case"publish":return e.jsx(Yt,{nodes:[{emoji:"💻",label:"Your computer",sub:"Only you see it"},{emoji:"☁️",label:"Published",sub:"A home online",lime:!0},{emoji:"🌍",label:"Anyone, anywhere",sub:"Opens with a link"}]});case"deploy-target":return e.jsx(Yt,{nodes:[{emoji:"📦",label:"Your app",sub:"Ready to ship"},{emoji:"🎯",label:"Deploy target",sub:"Where it runs",lime:!0},{emoji:"🔁",label:"Ship anytime",sub:"One repeatable step"}]});case"deploy-previews":return e.jsx(Yt,{nodes:[{emoji:"✏️",label:"A change",sub:"Not public yet"},{emoji:"🔗",label:"Preview link",sub:"See it live",lime:!0},{emoji:"🚀",label:"Publish",sub:"Once it's right"}]});case"staging-preview":return e.jsx(Yt,{nodes:[{emoji:"🧪",label:"A change",sub:"Not public yet"},{emoji:"🔗",label:"Preview link",sub:"Share & try it",lime:!0},{emoji:"🚀",label:"Ship it",sub:"Only once it's right"}]});case"background-jobs":return e.jsx(Yt,{nodes:[{emoji:"⏳",label:"Slow work",sub:"Blocks the user"},{emoji:"📮",label:"Queued",sub:"Runs in the background",lime:!0},{emoji:"✅",label:"Done later",sub:"App stays fast"}]});case"changelog-ci":return e.jsx(Yt,{nodes:[{emoji:"🧑💻",label:"You merge",sub:"That's the trigger"},{emoji:"🤖",label:"CI runs",sub:"Build · test · notes",lime:!0},{emoji:"🚀",label:"Released",sub:"Every time"}]});case"payments":return e.jsx(gn,{center:{emoji:"💳",label:"Secure checkout"},satellites:["💳 One-off","🔁 Subscriptions","🧾 Receipts","↩️ Refunds"]});case"shell-completions":return e.jsx(mn,{before:{tag:"Without",items:["Memorize flags","Typos & retries"]},after:{tag:"With completions",items:["Tab to complete","Commands & options"]}});default:return null}}const $E=Object.freeze(Object.defineProperty({__proto__:null,illustrationForTopic:pi},Symbol.toStringTag,{value:"Module"})),X1="Right now your app's information lives inside the code, so anything people enter disappears when they reload. A real database gives your app a memory: what people save stays saved — safely, and for good.",Q1=[{q:"What is a database, really?",a:"A labelled place your app remembers things — like a spreadsheet it can read from and write to instantly. Instead of resetting when someone reloads, everything they saved is still there next time."},{q:"Do I have to run or manage a server?",a:"No. The database is hosted for you, so there's nothing to install, patch, or keep online. You connect it once and codeyam holds the keys — you never touch a server."},{q:"Is people's data kept private?",a:"Yes. Access rules decide who can see and change what, so one person can't read another person's information. You set the rules in plain terms and the database enforces them."},{q:"What does it cost to start?",a:"You can start on a free tier that comfortably covers a new app — no card needed. You only pay once the app grows popular, and you'll see it coming before you do."},{q:"Can I move my data somewhere else later?",a:"Yes. Your core data lives in a standard database, so it's yours to export and move whenever you like — you're never locked in."}],Z1=["You are helping inside my actual codeyam project — this is real work in a real repository, not a hypothetical.","Before doing anything, read `.codeyam/stack.json` and the relevant source and config files so your help fits this project's stack. Prefer concrete edits and commands over generic advice.","","I want to set up **real data** — move my app's information out of the code and into a real database so it's saved for good, with private per-user access.","","Walk me through it and make the changes you safely can in my project: pick a suitable database for my stack, wire the connection, define the tables my app needs, and set up basic access rules. Ask me before anything destructive."].join(`
|
|
27
|
+
`);function lp({onBack:t,onChatWithAI:n}){return e.jsx(ai,{icon:e.jsx(ks,{size:26}),title:"Use real data",crumbLabel:"Real data",meta:"Foundation · about 10 minutes",assistKey:"real-data",onBack:t,lead:X1,illustration:pi("real-data"),chatPrompt:Z1,onChatWithAI:n,faqs:Q1})}const BE=Object.freeze(Object.defineProperty({__proto__:null,RealDataScreen:lp},Symbol.toStringTag,{value:"Module"})),Lr={entitySingular:"item",entityPlural:"items",savedThings:"saved items",purchaseNoun:"purchase"},ek=800;function Ql(t){switch(t){case"ready":return"ready";case"error":return"error";case"connected":case"provisioning":return"provisioning";default:return"provisioning"}}function mi(t,n){const[s,r]=l.useState("idle"),[a,o]=l.useState(null),[i,c]=l.useState(null),d=l.useRef(null),u=l.useCallback(()=>{d.current!==null&&(clearInterval(d.current),d.current=null)},[]),h=l.useCallback(g=>{var x,y;const b=Ql(g.status);b==="ready"?(u(),o({label:((x=g.result)==null?void 0:x.label)??"",value:((y=g.result)==null?void 0:y.value)??""}),r("ready")):b==="error"?(u(),c(g.message??"Connection failed."),r("error")):r("provisioning")},[u]),p=l.useCallback(async()=>{try{const g=await fetch(`/api/setup/connection-status?topic=${encodeURIComponent(t)}`);if(!g.ok)return;h(await g.json())}catch{}},[t,h]),f=l.useCallback(g=>{u(),c(null),o(null),r("connecting"),(async()=>{try{const x=await(await fetch("/api/setup/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:t,provider:n,credential:g})})).json().catch(()=>({}));h(x),Ql(x.status)==="provisioning"&&(d.current=setInterval(()=>void p(),ek))}catch(b){u(),c(b instanceof Error?b.message:"Connection failed."),r("error")}})()},[t,n,h,p,u]),m=l.useCallback(()=>{u(),r("idle"),o(null),c(null)},[u]);return l.useEffect(()=>u,[u]),{stage:s,result:a,error:i,connect:f,reset:m}}const tk="accounts";function nk(t){switch(t){case"clerk":return"Clerk";case"supabase_auth":return"Supabase Auth";default:return t}}function cp({provider:t,app:n=Lr,startedOn:s="recently",onComplete:r}){const{stage:a,result:o,error:i,connect:c,reset:d}=mi(tk,t),[u,h]=l.useState(""),p=nk(t);return a==="ready"?e.jsxs(e.Fragment,{children:[o&&(o.label||o.value)&&e.jsxs("div",{className:"url-card",role:"status",children:[e.jsx("span",{className:"ucglobe",children:"✅"}),e.jsxs("div",{children:[e.jsx("div",{className:"uc-l",children:o.label||"Connected"}),e.jsx("div",{className:"uc-u",children:o.value})]})]}),e.jsx(vi,{app:n,startedOn:s,onComplete:r})]}):a==="error"?e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"real-error",role:"alert",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"real-error-title",children:["Couldn’t connect ",p]}),e.jsx(Ze,{variant:"icon",text:`Couldn’t connect ${p}: ${i}`})]}),e.jsx("div",{className:"real-error-msg",children:i})]}),e.jsx("button",{type:"button",className:"auth-btn",onClick:()=>{h(""),d()},children:"Try again"})]}):a==="connecting"||a==="provisioning"?e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"deploy-head",children:[e.jsx("div",{className:"deploy-spin"}),e.jsxs("div",{children:[e.jsxs("div",{className:"deploy-t",children:["Setting up ",p]}),e.jsx("div",{className:"deploy-d",children:a==="connecting"?`Connecting to ${p}…`:"Provisioning your sign-in keys…"})]})]}),e.jsx("div",{className:"dep-bar",children:e.jsx("div",{className:"dep-bar-indeterminate"})})]}):e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"ph",children:["Connect ",p]}),e.jsxs("div",{className:"psub",children:["Paste your ",p," secret key to wire real accounts into your app. CodeYam holds the key and injects it into the running app — you never touch a server."]}),e.jsxs("div",{className:"connect-box",children:[e.jsxs("label",{className:"real-token-label",htmlFor:"accounts-secret-key",children:[p," secret key"]}),e.jsx("input",{id:"accounts-secret-key",type:"password",className:"real-token-input",placeholder:`Paste your ${p} secret key`,value:u,onChange:f=>h(f.target.value)}),e.jsxs("button",{type:"button",className:"auth-btn",disabled:u.trim().length===0,onClick:()=>c(u.trim()),children:["Connect ",p]})]}),e.jsx("div",{className:"reassure",children:"🔒 Your key is stored locally and never shown."})]})}const qE=Object.freeze(Object.defineProperty({__proto__:null,AccountsRealConnect:cp},Symbol.toStringTag,{value:"Module"}));function Mt(t,n,s){return e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",children:s})}function Bn({size:t=16}){return Mt(t,1.9,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 2 4 5v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V5z"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]}))}function fi({size:t=16}){return Mt(t,2,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}))}function gi({size:t=16}){return Mt(t,1.8,e.jsx("path",{d:"M4 7h16M4 12h16M4 17h10"}))}function bi({size:t=16}){return Mt(t,1.8,e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),e.jsx("path",{d:"M3 9h18"})]}))}function sk({size:t=16}){return Mt(t,2,e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 16v-4M12 8h.01"})]}))}function rk({size:t=16}){return Mt(t,2,e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-4 4V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2z"}))}function ak({size:t=16}){return Mt(t,2,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 2 3 7v10l9 5 9-5V7z"}),e.jsx("path",{d:"M3 7l9 5 9-5M12 12v10"})]}))}function ok({size:t=16}){return Mt(t,2,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 7v5l3 2"}),e.jsx("circle",{cx:"12",cy:"12",r:"9"})]}))}function ik({size:t=13}){return Mt(t,2,e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m15 9-6 6M9 9l6 6"})]}))}function jn({size:t=13}){return Mt(t,2.5,e.jsx("path",{d:"m5 12 5 5L20 6"}))}function dp({size:t=16}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:2,className:"rd-spin",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",strokeOpacity:".3"}),e.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",strokeLinecap:"round"})]})}const HE=Object.freeze(Object.defineProperty({__proto__:null,ChatIcon:rk,CheckGlyph:jn,ClockIcon:ok,CubeIcon:ak,InfoCircleIcon:sk,LinkIcon:fi,ListLinesIcon:gi,ScreenIcon:bi,ShieldCheckIcon:Bn,SpinnerIcon:dp,XCircleIcon:ik},Symbol.toStringTag,{value:"Module"})),lk={"real-data":[{id:"wire-real-database",label:"Wire up a real database",body:"Help me move off seed/mock data onto a real persistence layer. Read `.codeyam/stack.json` and the current data shapes, recommend a database that fits this stack (and my hosting), then scaffold the connection, the schema/migrations matching my existing data shapes, and the data-access layer. Offer to migrate the current seeded data over so nothing is lost."}],accounts:[{id:"add-auth",label:"Add authentication",body:"Help me add real sign-in. Recommend an auth approach for this stack (hosted provider vs. self-rolled), wire the sign-up/sign-in/sign-out flow, protect the routes that need a session, and expose the current user to the app. Tell me which provider/console steps I must do myself."}],emails:[{id:"setup-transactional-email",label:"Set up transactional email",body:"Help me send real transactional email (verification, password reset, receipts). Pick a provider that fits the stack, wire the send API with the key in env/secrets (never hard-coded), template the messages, and give me a way to fire a test send. Note the DNS/domain-verification steps I'll complete with my provider."}],payments:[{id:"integrate-payments",label:"Integrate payments",body:"Help me accept payments. Wire the checkout flow for a provider that fits the stack (Stripe is the usual default), handle the webhook that confirms payment server-side, and gate the paid outcome on it. Keep keys in secrets and use test mode first; I'll connect my real account."}],"analytics-monitoring":[{id:"add-analytics-monitoring",label:"Add analytics & monitoring",body:"Help me add product analytics and uptime/error monitoring. Install and initialize tools that fit the stack, instrument a few key events and the error boundary, and confirm data is flowing. Keep any keys in env/secrets and respect the privacy choices the app already makes."}],legal:[{id:"draft-legal-pages",label:"Draft privacy & terms pages",body:"Draft a privacy policy and terms of service grounded in what the app actually does — scan the code for what data is collected and which third parties (analytics, payments, email) receive it. Render them as real pages/routes in the app and link them from the footer."}],"data-safety":[{id:"complete-data-safety",label:"Complete the data-safety review",body:"Inventory what data this app and its dependencies collect, store, and transmit, and to whom. Produce an honest data-safety summary I can use for a disclosure form or privacy page, and flag anything collected that the app doesn't actually need."}],publish:[{id:"publish-static-site",label:"Deploy the static site",body:"Help me publish this static build. Confirm the production build command and output directory, pick a static host that fits, wire the deploy (config file or CLI), and do a first deploy so I get a live URL. Note any account/DNS steps I complete in the host's dashboard."}],"custom-domain":[{id:"setup-custom-domain",label:"Set up a custom domain",body:"Help me put the app on a custom domain. Tell me exactly which DNS records to add for my host (A/AAAA/CNAME), update any in-app config that hard-codes the URL, and make sure HTTPS/cert provisioning is handled. I'll add the records at my registrar; give me the precise values."}],forms:[{id:"wire-form-handling",label:"Wire up form handling",body:"Help me make the site's forms actually submit. Pick an approach that fits a static/SSR site (a forms service or a serverless endpoint), wire the submission, add validation and a success/error state, and add basic spam protection. Confirm a test submission arrives where I expect."}],"analytics-seo":[{id:"improve-seo-analytics",label:"Improve SEO & analytics",body:"Help me improve SEO and add analytics. Audit and fix per-page titles, meta descriptions, Open Graph tags, a sitemap and robots.txt, then wire a privacy-respecting analytics tool. Show me before/after on the key pages."}],"staging-preview":[{id:"setup-preview-deploys",label:"Set up preview deploys",body:"Help me get a prod-like preview URL for changes before they hit prod. Wire per-branch / per-PR preview deploys on my host (or a shared staging environment if previews aren't available), and make sure previews use safe, non-prod data and secrets. Tell me the host dashboard step I do myself."}]},ck={"deploy-target":[{id:"setup-deploy-target",label:"Set up a deploy target",body:"Help me deploy this service. Read stack.json, recommend a target that fits (container host, PaaS, serverless), write the deploy config (Dockerfile/Procfile/platform file), wire required env/secrets, and do a first deploy that passes a health check. Note which dashboard/billing steps I do myself."}],"database-backups":[{id:"configure-db-backups",label:"Configure database backups",body:"Help me make the database recoverable. Set up automated backups (provider-managed if available, else a scheduled dump), define a retention window, and — critically — give me a documented, tested RESTORE procedure. A backup nobody has restored isn't a backup; walk me through one restore."}],secrets:[{id:"setup-secrets",label:"Set up secrets management",body:"Audit the repo for hard-coded secrets and any committed to git history, move them to a proper secrets mechanism for this stack/host, wire the app to read them from the environment, and add a committed `.env.example` documenting the required keys without their values."}],"api-auth":[{id:"add-api-auth",label:"Add API authentication",body:"Help me secure the API. Pick an auth scheme that fits (API keys, JWT, OAuth/session), add the middleware that enforces it, protect the routes that need it while leaving public ones open, and return correct 401/403 responses. Add a quick way for me to test an authed request."}],"cors-origins":[{id:"configure-cors",label:"Configure CORS",body:"Help me set CORS correctly. Identify which front-end origins must call this API, configure an allow-list (not a blanket wildcard when credentials are involved), set the allowed methods/headers, and verify a preflight request succeeds from an allowed origin and is rejected from an unlisted one."}],"background-jobs":[{id:"add-background-jobs",label:"Add background jobs",body:"Help me move slow or scheduled work off the request path. Pick a queue/worker approach that fits the stack, wire a worker process, move one real slow operation into a job as the worked example, and add retry and failure handling."}],"logging-monitoring":[{id:"setup-logging-monitoring",label:"Set up logging & monitoring",body:"Help me make this service observable. Add structured logging with request ids, wire error tracking and an uptime/health check, and set up at least one alert for the failure I'd most want to know about. Keep any keys in secrets."}],"api-docs":[{id:"generate-api-docs",label:"Generate API reference docs",body:"Help me produce API reference docs. Read stack.json to tell which shape this is: for a running HTTP service, generate/curate an OpenAPI (Swagger) spec from the routes and serve a docs UI; for a published library, generate reference docs from the public API and doc comments. Wire it so the docs regenerate as the API changes."}],"staging-environment":[{id:"standup-staging",label:"Stand up a staging environment",body:"Help me create a prod-like staging environment with its own data and secrets, a way to rehearse migrations before prod, and a clear promote-to-prod path. Wire the config so deploys can target staging first."}]},dk={"redirects-404":[{id:"configure-redirects-404",label:"Configure redirects & a 404 page",body:"Help me handle redirects and not-found. Add the redirect rules in the form my host expects (e.g. `_redirects`, `netlify.toml`, `vercel.json`, or framework config — read stack.json/host), migrate any old paths I tell you about, and add a real styled 404 page wired to the site's layout."}],"performance-images":[{id:"optimize-images",label:"Optimize images & performance",body:"Audit the site's images and obvious performance wins: convert/serve modern formats, add width/height and lazy-loading, generate responsive sizes where the framework supports it, and flag oversized assets. Make the changes and tell me the rough before/after weight."}],"comments-search":[{id:"add-comments-search",label:"Add comments or search",body:"Help me add a comments widget and/or client-side search to the static site. Pick an approach that needs no backend (a hosted comments service; a prebuilt search index), wire it into the relevant pages/layout, and confirm it renders and works in the preview."}],"deploy-previews":[{id:"setup-deploy-previews",label:"Set up deploy previews",body:"Help me get a preview URL for every branch/PR of this static site. Wire the host's deploy-preview feature (or equivalent config), confirm the build runs for previews, and make sure preview builds don't leak production-only config."}]},uk={"publish-registry":[{id:"prepare-registry-publish",label:"Prepare a registry publish",body:"Help me publish to the right registry for this stack (npm, crates.io, PyPI, …). Verify the package metadata (name, version, license, description, entry points), make sure only the intended files ship (ignore/include lists), do a dry-run pack and show me what's in it, and outline the auth/token step I do myself before the real publish."}],"versioning-changelog":[{id:"setup-versioning-changelog",label:"Set up versioning & changelog",body:"Help me adopt a clear versioning + changelog workflow. Establish semver for this project, set up a changelog (Keep a Changelog or a conventional-commits generator), and give me a single command to cut a release that bumps the version, updates the changelog, and tags."}],"install-docs":[{id:"write-install-docs",label:"Write install docs",body:"Write clear install/quick-start docs for this tool: the one-line install per supported method (the registry, a binary download, from source), a copy-pasteable first-run example, and the prerequisites. Put it in the README (and docs site if there is one) and verify the commands actually work as written."}],"release-builds":[{id:"setup-release-builds",label:"Set up cross-platform builds",body:"Help me produce release binaries. Set up the build matrix for the targets I care about (OS/arch), wire it into CI so a tag produces attached artifacts, and add checksums. Tell me about any signing/notarization steps (esp. macOS/Windows) I must do with my own credentials."}],"shell-completions":[{id:"generate-completions",label:"Generate shell completions",body:"Help me ship shell completions. Generate completion scripts for bash, zsh, and fish from the CLI's argument definitions (most arg frameworks can emit these), wire a command or build step that regenerates them, and document where users install each."}],"cli-ux":[{id:"polish-cli-ux",label:"Polish the CLI UX",body:"Audit the command-line UX and improve it: consistent and helpful `--help` output, clear actionable error messages with non-zero exit codes, `--version`, sensible defaults, and respect for NO_COLOR / piped output. Make the changes and show me a few before/after invocations."}],"supply-chain":[{id:"harden-supply-chain",label:"Harden the supply chain",body:"Help me harden the release supply chain: pin and audit dependencies, add a lockfile-checked CI step, generate an SBOM, and set up artifact signing/provenance for releases. Walk me through any key-management step that has to be mine."}],"pre-release-channel":[{id:"setup-prerelease-channel",label:"Set up a pre-release channel",body:"Help me offer a pre-release (next/beta) channel testers can opt into WITHOUT moving the stable `latest`. Set up the pre-release version scheme and the publish flag/tag for it on this registry, and document the one command to cut a pre-release and how users install it."}]},hk={"readme-license":[{id:"write-readme-license",label:"Write the README & pick a license",body:"Help me give this package a strong README and a license. Write a README with a one-line description, install, a minimal usage example, and a features/API summary drawn from the actual public API. Recommend a license that fits my intent (permissive vs. copyleft), add the LICENSE file, and set the license field in the package manifest."}],"changelog-ci":[{id:"setup-changelog-ci",label:"Set up changelog & release CI",body:"Help me automate releases. Add a changelog workflow and a CI pipeline that, on a version tag, runs tests, builds, and publishes to the registry. Keep the publish token in CI secrets and show me the one action I take to trigger a release."}],"semver-policy":[{id:"document-semver-policy",label:"Document a versioning policy",body:"Help me define and document a semver policy: what counts as a breaking change for THIS package's public API, the deprecation path before removals, and the support window. Write it into the docs and, if feasible, add a public-API surface check that flags an accidental breaking change in review."}],examples:[{id:"add-examples-doctests",label:"Add runnable examples & doctests",body:"Help me add examples that can't rot. Write runnable examples for the main entry points, turn the key README snippets into doctests/tested examples where the language supports it, and wire them into CI so a broken example fails the build."}],"pre-release-versions":[{id:"setup-prerelease-versions",label:"Set up pre-release versions",body:"Help me publish pre-release versions (alpha/beta/rc) that early adopters opt into WITHOUT moving the stable `latest`. Set up the pre-release version scheme and the registry tag/flag for it, and document the cut command and how users install a pre-release."}]},pk={"dev-accounts":[{id:"guide-dev-enrollment",label:"Guide me through developer enrollment",body:"Guide me through enrolling as a developer with Apple and/or Google — advice and a checklist, not performing the paid identity work for me. Help me decide individual vs. organisation enrollment; walk the Apple D-U-N-S lookup/registration and how long it takes (issuance can run up to ~2 weeks); plan the timeline so identity/business verification isn't the launch blocker; and explain the Google Play closed-testing gate (12 testers opted in for 14 continuous days, for personal accounts created after 2023-11-13). Produce a checklist and the decisions I need to make, and be explicit that I complete the actual paid enrollment and identity verification myself in the Apple/Google consoles."}],"store-assets":[{id:"generate-mobile-store-assets",label:"Generate store screenshots & icon",body:"Help me produce the App Store / Play Store assets: the app icon at the required sizes, device-frame screenshots for each required display size, and the feature graphic. Use the app's existing icon/branding as the source and generate or resize to the EXACT per-store dimensions; flag any size I'll need to capture from a running device."}],"store-listing":[{id:"draft-mobile-listing",label:"Draft the store listing copy",body:"Draft the store listing from what the app actually does: title, subtitle, the short and full descriptions, keywords, and the what's-new text. Keep within each store's character limits and avoid the copy patterns (keyword stuffing, competitor names) that draw rejections."}],"testing-distribution":[{id:"prep-testflight",label:"Prep a TestFlight upload",body:"Help me get a build to TestFlight. Before any iOS build, run the MOBILE_SETUP.md iOS pre-flight checks (a missing platform SDK surfaces in seconds via `xcrun simctl list devices available`; surface the 8–12 GB / 10–30 min `xcodebuild -downloadPlatform iOS` cost to me BEFORE kicking it off). Then produce the archive, confirm the bundle id / signing, and walk me through the App Store Connect upload and adding internal testers."},{id:"prep-play-internal",label:"Set up Play internal testing",body:"Help me ship an internal-testing track on Google Play. Produce a signed AAB, confirm the applicationId and version code are bumped, and prepare the internal-testing release notes and the tester list. I'll create the track in the Play Console myself; prep the artifact and metadata."},{id:"prep-store-review",label:"Get ready for store review",body:"Run a pre-review checklist across both stores: privacy/data-safety answers match the code, required usage-description strings are present (iOS Info.plist), no debug/placeholder content ships, deep links and permissions actually work, and the listing matches the build. Give me a pass/fail list so I submit only when it's clean."}],"push-notifications":[{id:"wire-push",label:"Wire up push notifications",body:"Help me add push notifications end to end for this stack: register for the OS push token, wire the credentials (APNs key for iOS, FCM for Android), add the client-side receive/handle code, and give me a way to send a test notification. Note which credential steps I must do in the Apple/Firebase consoles myself."}],"crash-reporting":[{id:"add-crash-reporting",label:"Add a crash reporter",body:"Help me add crash and error reporting (e.g. Sentry/Crashlytics — pick what fits the stack). Install and initialize the SDK, wire source-map / dSYM upload so stack traces symbolicate, and trigger a test crash to confirm it lands in the dashboard."}],"in-app-purchases":[{id:"scaffold-iap",label:"Scaffold in-app purchases",body:"Help me scaffold in-app purchases/subscriptions for this stack: add the purchasing library, define the product ids, wire the buy + restore + receipt-validation flow, and gate the paid feature behind entitlement. I'll create the products in App Store Connect / Play Console myself; build the client and server-side pieces."}],"app-privacy":[{id:"fill-privacy-form",label:"Fill out the data-safety form",body:"Help me answer Apple's App Privacy and Google's Data Safety questionnaires accurately. Scan the code and dependencies (SDKs frequently collect data you didn't write code for) to determine what data is actually collected, why, and whether it's linked to identity or used for tracking, then give me the exact answers to enter."}],"app-review":[{id:"pre-review-checklist",label:"Run a pre-review checklist",body:"Audit the app against the guideline issues that most often cause rejection: a working demo account if login is required, no broken links, permission prompts with clear purpose strings, no private APIs, and a complete privacy answer set. Give me a checklist with what's done and what still needs fixing."}]},mk={"share-testing":[{id:"zip-load-unpacked",label:"Zip a load-unpacked build",body:'Help me hand a tester an unpacked build they can side-load. Produce the production build, confirm `manifest.json` sits at the ROOT of the zipped output (not nested under a build folder — that is the #1 load-unpacked mistake), zip the build directory, and write a two-line tester instruction: open chrome://extensions, enable Developer mode, click "Load unpacked" (or drag the zip). Call out that this build does NOT auto-update — testers re-load a new zip each time.'},{id:"unlisted-listing",label:"Set up an unlisted listing",body:"Help me prepare an unlisted (private-link) Chrome Web Store upload. Assemble everything that can be readied before the manual upload: the packaged zip, a version bump in `manifest.json`, the icon set and screenshots the listing requires, and a short description. Explain the one-time paid developer-account requirement and that an unlisted item STILL goes through Google's review — unlisted only hides it from search, it is not an instant private channel. I'll do the actual upload and account steps myself; prep the rest."},{id:"self-host-crx",label:"Self-host a .crx + update_url",body:"Help me self-host a packed `.crx` with auto-updates. Pack the `.crx`, generate the `update.xml` update manifest, and wire `update_url` into `manifest.json` pointing at where I'll host it. Be explicit that this path is really for MANAGED / enterprise force-install (via policy): Chrome blocks off-store `.crx` installs for ordinary user profiles, so this is not a substitute for the Web Store for normal users."}],"store-accounts":[{id:"prep-developer-account",label:"Prep my developer account",body:"Help me get ready to register as a Chrome Web Store developer. I'll pay the one-time fee and verify my identity myself — you can't do those. What you CAN do: draft a short public developer display name and the contact-email blurb the profile asks for, based on this project; explain individual vs group publisher and recommend one for my situation; and lay out the registration steps in order with the exact console URL so I can click through and complete them. Be explicit about which steps are manual."}],"extension-store-assets":[{id:"generate-store-assets",label:"Prepare the store assets",body:"Help me assemble the Chrome Web Store listing assets: the 128px store icon, the screenshots (1280×800 or 640×400), and any promo tiles. Use the extension's existing icons/branding as the source, generate or resize what's missing to the exact required dimensions, and draft the short + detailed listing descriptions from what the extension actually does."}],"permissions-justification":[{id:"draft-permission-justifications",label:"Draft permission justifications",body:'Read the `permissions` and `host_permissions` in `manifest.json`, then for EACH one draft the single-sentence justification the Web Store review requires ("why does this extension need it"). Flag any permission you can\'t tie to actual code — an unused permission is a common rejection reason, so propose removing it.'}],"oauth-verification":[{id:"prep-oauth-consent",label:"Prep the OAuth consent materials",body:"Help me get ready for Google's OAuth verification. Inventory the OAuth scopes the extension requests, separate sensitive/restricted scopes from basic ones, and draft the scope-justification text and the data-usage explanation the consent-screen review asks for. I'll submit in the Cloud console myself; prepare everything that goes into it."}],"privacy-policy":[{id:"draft-privacy-policy",label:"Draft a privacy policy",body:'Draft a privacy policy for this extension grounded in what it ACTUALLY does: scan the code for what data it reads, stores, or transmits and to where. Write a policy that honestly reflects that (including "collects nothing" if true), and save it somewhere I can host and link from the store listing.'}],"single-purpose-listing":[{id:"write-single-purpose",label:"Write the single-purpose description",body:"The Web Store requires a clear single purpose. From the code and manifest, articulate the extension's one narrow purpose in a sentence, then write a listing description that stays consistent with it. Flag any feature that reads as scope-creep beyond that single purpose (a common rejection reason) so I can decide whether to cut or re-frame it."}],"manifest-versioning":[{id:"bump-and-version",label:"Bump the version & set a scheme",body:"Help me manage the extension version. Bump the `version` in `manifest.json` correctly (4-part dot-separated, monotonically increasing — the store rejects a re-used or lower version), and if I don't have one, propose a simple versioning convention and a one-command way to bump it for each submission."}],"submit-review":[{id:"pre-submission-audit",label:"Run a pre-submission audit",body:`Before I submit, audit the package against the common rejection causes: manifest at the zip root, version bumped, every permission justified and used, a reachable privacy policy, listing assets at the right dimensions, and the single-purpose description consistent. Give me a checked/failed list so I only hit "Submit" when it's clean.`}]},fk={hosting:[{id:"deploy-and-go-live",label:"Deploy & go live",body:"Help me deploy this app and get a live URL. Read stack.json to find the build command and output, recommend a host that fits the stack, wire the deploy config (and any required env/secrets), and do a first deploy. Confirm the deployed URL actually serves the app, and tell me which account/billing steps I complete in the host's dashboard."}]},gk={"run-locally":[{id:"get-it-running",label:"Get it running on my machine",body:"Help me run this app on my own machine, outside the Live Preview. Read `.codeyam/stack.json` to learn the stack, confirm or install the prerequisites it needs, run the install step and then the project's configured run/build command, and fix any errors that come up so it actually starts. If it serves on a port, tell me the URL to open. If this project is a browser extension, build it and walk me through loading it unpacked (open chrome://extensions, enable Developer mode, and Load unpacked on the built output directory)."}]},bk={...lk,...ck,...dk,...uk,...hk,...pk,...mk,...fk,...gk};function up(t){return bk[t]??[]}function xk({topicName:t,goal:n}){const s=[];return s.push("You are helping inside the user's actual codeyam project — this is real work in a real repository, not a hypothetical."),s.push("Before doing anything, read `.codeyam/stack.json` and the relevant source and config files so your help fits this project's stack. Prefer concrete edits and commands over generic advice."),s.push(""),s.push(`You're helping with **${t}** — specifically: **${n.label}**.`),s.push(""),s.push(n.body),s.push(""),s.push("Walk me through it and make the changes you safely can in my project, asking before anything destructive."),s.join(`
|
|
28
|
+
`)}function nn({assistKey:t,topicName:n,goalId:s,buttonLabel:r}){const a=up(t).find(c=>c.id===s),[o,i]=l.useState(!1);return a?e.jsxs("div",{className:"setup-goal-assist mt-4",children:[e.jsx("button",{type:"button",className:"w-full rounded-lg bg-[var(--blue-300)] px-4 py-2.5 text-sm font-semibold text-[var(--text-on-accent)] transition-opacity hover:opacity-90","aria-pressed":o,onClick:()=>i(c=>!c),children:r}),o&&e.jsx("div",{className:"mt-3 rounded-md border border-[var(--border-subtle)] bg-[var(--bg-deep)]",children:e.jsx(wn,{chatName:`setup-${t}-${a.id}`,prompt:xk({topicName:n,goal:a}),height:360,onClose:()=>i(!1)})})]}):null}const WE=Object.freeze(Object.defineProperty({__proto__:null,SetupGoalAssist:nn},Symbol.toStringTag,{value:"Module"}));function fe({assistKey:t,topicName:n}){const s=up(t);return s.length===0?null:e.jsx(e.Fragment,{children:s.map(r=>e.jsx(nn,{assistKey:t,topicName:n,goalId:r.id,buttonLabel:`Ask AI to help: ${r.label}`},r.id))})}const GE=Object.freeze(Object.defineProperty({__proto__:null,SetupGoalAssistList:fe},Symbol.toStringTag,{value:"Module"})),yk=1800;function Fr({config:t,onConnect:n}){const[s,r]=l.useState(!1),[a,o]=l.useState(!1),[i,c]=l.useState(null),d=()=>{s||(r(!0),window.setTimeout(n,yk))},u=t.connectColor==="green"?{"--connect":"var(--green)"}:void 0;return e.jsxs("div",{className:"su-wrap",children:[e.jsxs("div",{className:"su-shead",children:[e.jsx("div",{className:"su-badge",children:t.badge}),e.jsxs("div",{children:[e.jsxs("h1",{className:"su-title",children:[t.title," ",e.jsx("span",{className:"su-chip notset",children:"Not set up"})]}),e.jsxs("div",{className:"su-via",children:["powered by ",e.jsx("b",{children:t.providerName})]}),e.jsx("p",{className:"su-lead",children:t.lead})]})]}),e.jsxs("div",{className:"su-explain",children:[e.jsxs("div",{className:"su-eh",children:[e.jsx("span",{className:"su-q",children:"?"}),t.explainerHeading]}),e.jsx("div",{className:"su-lede",children:t.lede}),e.jsx("div",{className:"su-erows",children:t.explainerRows.map(h=>e.jsxs("div",{className:"su-erow",children:[e.jsx("div",{className:"su-en",children:h.icon}),e.jsxs("div",{className:"su-et",children:[e.jsx("b",{children:h.title}),e.jsx("span",{children:h.desc})]})]},h.title))}),e.jsxs("div",{className:"su-why",children:[e.jsxs("div",{className:"su-wh",children:[e.jsx(Bn,{size:15}),t.whyHeading]}),t.whyRows.map(h=>e.jsxs("div",{className:"su-whyrow",children:[e.jsx("span",{className:"su-wc",children:e.jsx(jn,{size:11})}),e.jsxs("p",{children:[e.jsx("b",{children:h.lead})," ",h.rest]})]},h.lead))]})]}),e.jsxs("div",{className:"su-connect",style:u,children:[e.jsx("div",{className:"su-ct",children:t.connectTitle}),e.jsx("div",{className:"su-cd",children:t.connectDesc}),e.jsx("button",{type:"button",className:"su-cbtn",onClick:d,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx(dp,{size:16}),"Opening ",t.providerName,"…"]}):e.jsxs(e.Fragment,{children:[e.jsx(fi,{size:16}),t.connectButtonLabel]})}),e.jsx("div",{className:"su-reassure",children:t.reassure.map(h=>e.jsxs("span",{children:[e.jsx(jn,{size:13}),h]},h))})]}),t.alternatives&&t.alternatives.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"su-alt-toggle",onClick:()=>o(h=>!h),children:[a?"Hide other options":t.altToggleLabel," ",e.jsx("span",{className:"su-chev"+(a?" open":""),children:"⌄"})]}),a?e.jsx("div",{className:"su-alts",children:t.alternatives.map(h=>e.jsxs("div",{className:"su-altrow",children:[e.jsx("div",{className:"su-altmark",style:{background:h.color},children:h.monogram}),e.jsxs("div",{className:"su-altbody",children:[e.jsx("div",{className:"su-altname",children:h.name}),e.jsx("div",{className:"su-altdesc",children:h.desc}),h.factKey?e.jsxs("div",{className:"su-altfact",children:[me(h.factKey).value,e.jsx(sn,{fact:me(h.factKey)})]}):null]}),e.jsx("button",{type:"button",className:"su-altpick"+(i===h.name?" picked":""),onClick:()=>c(h.name),children:i===h.name?"Selected ✓":"Use this"})]},h.name))}):null]}):null,e.jsx("div",{className:"su-uplabel",children:t.lockedLabel}),e.jsx("div",{className:"su-locked",children:t.lockedSteps.map(h=>e.jsxs("div",{className:"su-lrow",children:[e.jsx("div",{className:"su-ln",children:h.icon}),e.jsxs("div",{className:"su-lt",children:[e.jsx("b",{children:h.title}),e.jsx("span",{children:h.desc})]}),e.jsx("span",{className:"su-lk",children:e.jsx(Me,{size:15})})]},h.title))}),t.faq&&t.faq.length>0?e.jsx(Ve,{items:t.faq}):null,t.assistKey?e.jsx(fe,{assistKey:t.assistKey,topicName:t.title}):null]})}const UE=Object.freeze(Object.defineProperty({__proto__:null,SetupNotConnected:Fr},Symbol.toStringTag,{value:"Module"}));function zr({children:t}){return e.jsx("div",{className:"su-steps",children:t})}function Rt({state:t,num:n,title:s,pill:r,desc:a,children:o}){return e.jsxs("div",{className:"su-step",children:[e.jsxs("div",{className:"su-rail",children:[e.jsx("div",{className:"su-node "+t,children:t==="done"?e.jsx(jn,{size:15}):n}),e.jsx("div",{className:"su-line"})]}),e.jsxs("div",{className:"su-scon",children:[e.jsxs("div",{className:"su-stitle",children:[s,r?e.jsx("span",{className:"su-pill",children:r}):null]}),e.jsx("div",{className:"su-sdesc",children:a}),o]})]})}function xi({monogram:t,name:n,detail:s,monogramStyle:r}){return e.jsxs("div",{className:"su-acct",children:[e.jsx("div",{className:"su-av",style:r,children:t}),e.jsxs("div",{className:"su-ainfo",children:[e.jsx("b",{children:n}),e.jsx("span",{children:s})]}),e.jsx("button",{type:"button",className:"su-chg",children:"Change"})]})}function hp({methods:t,initialSelected:n}){const[s,r]=l.useState(()=>new Set(n)),a=o=>r(i=>{const c=new Set(i);return c.has(o)?c.delete(o):c.add(o),c});return e.jsx("div",{className:"su-methods",children:t.map(o=>e.jsxs("button",{type:"button",className:"su-mchip"+(s.has(o.key)?" on":""),onClick:()=>a(o.key),"aria-pressed":s.has(o.key),children:[e.jsx("span",{className:"su-ck",children:e.jsx(jn,{size:11})}),o.icon,o.label]},o.key))})}function $r({children:t}){return e.jsxs("div",{className:"su-field",children:[e.jsx("span",{className:"su-edit",children:"Edit"}),t]})}function pp({examples:t}){const[n,s]=l.useState(new Set),r=a=>s(o=>{const i=new Set(o);return i.has(a)?i.delete(a):i.add(a),i});return e.jsx("div",{className:"su-examples",children:t.map((a,o)=>e.jsxs("button",{type:"button",className:"su-ex"+(n.has(o)?" added":""),onClick:()=>r(o),children:[e.jsx("span",{className:"su-plus",children:n.has(o)?"✓":"+"}),a]},a))})}function Br({items:t}){return e.jsx("div",{className:"su-builds",children:t.map(n=>e.jsxs("div",{className:"su-bitem",children:[e.jsx("div",{className:"su-bx",children:e.jsx(jn,{size:13})}),e.jsxs("div",{className:"su-bmain",children:[e.jsx("b",{children:n.title}),e.jsx("span",{children:n.caption})]}),e.jsx("span",{className:"su-where",children:n.where})]},n.title))})}function qr({accent:t,icon:n,children:s}){const r={"--note-accent":t==="amber"?"var(--amber)":"var(--blue)"};return e.jsxs("div",{className:"su-note",style:r,children:[n,e.jsx("p",{children:s})]})}function Hr({label:t,note:n,onPlan:s}){const[r,a]=l.useState(!1),o=()=>{r||(a(!0),s==null||s())};return e.jsxs("div",{className:"su-foot",children:[e.jsx("button",{type:"button",className:"su-cta",onClick:o,disabled:r,children:r?"Added to your plans ✓":e.jsxs(e.Fragment,{children:[t," ",e.jsx("span",{className:"su-ar",children:"→"})]})}),e.jsx("div",{className:"su-fnote",children:n})]})}const YE=Object.freeze(Object.defineProperty({__proto__:null,BuildList:Br,ControlNote:qr,EditableField:$r,ExampleChips:pp,MethodChips:hp,SetupAccountRow:xi,SetupPlanFooter:Hr,SetupStep:Rt,SetupStepper:zr},Symbol.toStringTag,{value:"Module"}));function Un(t,n,s){return e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round",children:s})}function hr({size:t=16}){return Un(t,1.7,e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),e.jsx("path",{d:"M5 20a7 7 0 0 1 14 0"})]}))}function mp({size:t=16}){return Un(t,1.8,e.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"}))}function yi({size:t=16}){return Un(t,1.8,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M22 2 11 13"}),e.jsx("path",{d:"M22 2 15 22l-4-9-9-4z"})]}))}function fp({size:t=16}){return Un(t,1.8,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 9v4M12 17h.01"}),e.jsx("path",{d:"M10.3 4.3 2.6 18a1.5 1.5 0 0 0 1.3 2.2h16.2a1.5 1.5 0 0 0 1.3-2.2L13.7 4.3a1.5 1.5 0 0 0-2.6 0z"})]}))}function Ka({size:t=16}){return Un(t,1.8,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"m22 7-10 6L2 7"}),e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2"})]}))}function gp({size:t=16}){return e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor",children:e.jsx("path",{d:"M21.35 11.1H12v2.9h5.35c-.25 1.45-1.7 4.25-5.35 4.25-3.2 0-5.85-2.65-5.85-5.9s2.65-5.9 5.85-5.9c1.85 0 3.05.8 3.75 1.45l2.55-2.45C16.6 3.6 14.55 2.7 12 2.7 6.95 2.7 2.9 6.75 2.9 12s4.05 9.3 9.1 9.3c5.25 0 8.7-3.7 8.7-8.9 0-.6-.05-1.05-.35-1.3z"})})}function bp({size:t=16}){return e.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor",children:e.jsx("path",{d:"M16.4 12.8c0-2.2 1.8-3.3 1.9-3.3-1-1.5-2.6-1.7-3.2-1.7-1.4-.1-2.6.8-3.3.8-.7 0-1.7-.8-2.8-.8-1.4 0-2.8.8-3.5 2.1-1.5 2.6-.4 6.5 1.1 8.6.7 1 1.6 2.2 2.7 2.1 1.1 0 1.5-.7 2.8-.7s1.6.7 2.8.7c1.1 0 1.9-1 2.6-2.1.8-1.2 1.2-2.3 1.2-2.4-.1 0-2.3-.9-2.3-3.4zM14.2 6.3c.6-.7 1-1.7.9-2.7-.9 0-2 .6-2.6 1.3-.6.6-1.1 1.6-.9 2.6 1 .1 2-.5 2.6-1.2z"})})}function xp({size:t=16}){return Un(t,1.8,e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 3 3 8l9 5 9-5-9-5z"}),e.jsx("path",{d:"M3 8v5l9 5 9-5V8"})]}))}const VE=Object.freeze(Object.defineProperty({__proto__:null,AppleGlyph:bp,ArrowRightIcon:mp,GoogleGlyph:gp,GraduationIcon:xp,MagicLinkIcon:Ka,PaperPlaneIcon:yi,PersonIcon:hr,WarningTriangleIcon:fp},Symbol.toStringTag,{value:"Module"}));function Wr({topic:t}){const{services:n}=si();if(!n)return null;const s=n.find(a=>a.topic===t&&a.status!=="dismissed");if(!s)return null;const r=s.evidence.map(a=>a.value).join(", ");return e.jsxs("div",{className:"wired-provider",role:"note",children:[e.jsxs("div",{className:"wired-provider-title",children:[e.jsx("b",{children:s.name})," is already wired in this project"]}),e.jsx("div",{className:"wired-provider-detail",children:r?`We found ${r} in your project — here's how to finish setting it up.`:"Here's how to finish setting it up."})]})}const KE=Object.freeze(Object.defineProperty({__proto__:null,WiredProviderBanner:Wr},Symbol.toStringTag,{value:"Module"}));function vk(t){return{accent:"blue",assistKey:"accounts",badge:e.jsx(hr,{size:25}),title:"Let people sign in",providerName:"Supabase",connectColor:"lime",lead:`Right now everyone using your app is anonymous, so a ${t.entitySingular} they save vanishes the moment they close the tab. Give people their own account and their ${t.savedThings} and settings follow them on any device. CodeYam uses Supabase.`,explainerHeading:"New to accounts? Here's the short version",lede:e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"An account is how your app knows who someone is."})," Instead of every visitor being a stranger, each person gets a private space — their"," ",t.savedThings,", their profile — that they can reach from any phone or laptop by signing in. Supabase is the secure tech that handles the signing-in part for you."]}),explainerRows:[{icon:e.jsx(hr,{size:16}),title:"Everything stays tied to them",desc:e.jsxs(e.Fragment,{children:["Their ",t.savedThings," and profile are remembered"," ",e.jsx("em",{children:"even after they close the app"}),", instead of resetting."]})},{icon:e.jsx(mp,{size:16}),title:"It follows them across devices",desc:e.jsxs(e.Fragment,{children:["Sign in on a phone, see the same ",t.savedThings," on a laptop,"," ",e.jsx("em",{children:"anywhere they sign in"}),"."]})},{icon:e.jsx(Me,{size:16}),title:"It keeps private things private",desc:e.jsxs(e.Fragment,{children:["Accounts let you say ",e.jsx("em",{children:'"only this person can see their data,"'})," ","which you'll want before real money or personal info is involved."]})}],whyHeading:"Why CodeYam picks Supabase for you",whyRows:[{lead:"Free to start, no card needed.",rest:"A generous free tier covers a new app comfortably. You only pay once you have a lot of users, and you'll see it coming."},{lead:"Security handled for you.",rest:"Passwords, Google and Apple sign-in, and resets are managed by Supabase, so the risky parts aren't yours to get right. Social logins do need a one-time developer setup with each provider — see the FAQ below."},{lead:"Nothing for you to manage.",rest:"No servers, no security patches. CodeYam handles the wiring, you just decide who gets to sign in."}],connectTitle:"Connect or create your Supabase project",connectDesc:"A new window opens on Supabase. If you already have an account, sign in. If not, you'll make one — it's free and takes a few minutes. CodeYam links to it and holds the keys, so you never touch a server.",connectButtonLabel:"Connect Supabase",reassure:["Free to start, no card needed","Takes about 3 minutes","Disconnect any time"],altToggleLabel:"Supabase not for you? See other options",alternatives:[{monogram:"C",color:"linear-gradient(140deg,#6c47ff,#4b2fcc)",name:"Clerk",desc:"Polished sign-in screens and user management out of the box. A great pick if you want the slickest ready-made experience.",factKey:"clerk.freeTier"},{monogram:"A",color:"linear-gradient(140deg,#eb5424,#b53a13)",name:"Auth0",desc:"A long-established choice with deep enterprise controls. Worth it if you'll need that later, a little more to set up.",factKey:"auth0.freeTier"}],lockedLabel:"Then, once you're connected",lockedSteps:[{icon:e.jsx(gi,{size:15}),title:"Choose how people sign in",desc:`Google, Apple, email, magic link — pick as many as you like. Then say when to ask, like "only when someone saves an ${t.entitySingular}."`},{icon:e.jsx(bi,{size:15}),title:"CodeYam builds your sign-in screens",desc:`A sign-in screen, a "sign in to save" prompt, per-person ${t.savedThings}, and a profile menu — each a plan you preview before it ships.`}],faq:[{q:"Do Google and Apple sign-in need extra setup?",a:`Yes — each social login is registered with that provider, so Google and Apple sign-in need OAuth credentials created in the provider's developer console (a one-time setup CodeYam walks you through). "Sign in with Apple" also requires a paid Apple Developer account (${me("appleDeveloper.fee").value}). Email and magic-link sign-in have no such requirement, so they're the quickest way to launch.`},{q:"Can I add more sign-in options later?",a:"Yes. You can start with just email or a magic link and add Google, Apple, or others whenever you're ready — each is its own small plan you preview before it ships."}]}}const jk=[{key:"google",label:"Google",icon:e.jsx(gp,{size:15})},{key:"apple",label:"Apple",icon:e.jsx(bp,{size:15})},{key:"email",label:"Email",icon:e.jsx(Ka,{size:15})},{key:"magic",label:"Magic link",icon:e.jsx(Ka,{size:15})}];function vi({app:t,startedOn:n,onComplete:s}){const r=[{title:"A sign-in & sign-up screen",caption:"Google, Apple, and email, matched to your app's look.",where:"/signin"},{title:'A "sign in to save" prompt',caption:"Shown the first time someone taps save or buy, never before.",where:`/${t.entitySingular}`},{title:`Each person's own ${t.savedThings}`,caption:"Their list follows them on phone, laptop, anywhere they sign in.",where:"/saved"},{title:"A profile & sign-out menu",caption:"So people can manage their account and leave safely.",where:"/profile"}];return e.jsxs("div",{className:"su-wrap",children:[e.jsxs("div",{className:"su-shead",children:[e.jsx("div",{className:"su-badge",children:e.jsx(hr,{size:25})}),e.jsxs("div",{children:[e.jsx("h1",{className:"su-title",children:"Let people sign in"}),e.jsxs("div",{className:"su-via",children:["powered by ",e.jsx("b",{children:"Supabase"})," · the sign-in tech behind modern apps"]}),e.jsxs("p",{className:"su-lead",children:["Give people their own account so their ",t.savedThings," and settings follow them on any device. CodeYam builds the screens and handles the security, you just decide who gets in."]})]})]}),e.jsxs("div",{className:"su-remember",children:[e.jsx("span",{className:"su-rdot"}),e.jsxs("div",{className:"su-widget-body",children:[e.jsxs("b",{children:["You started this on ",n,"."]}),e.jsx("span",{children:"Sign-in methods are chosen — one step left before you can plan it."})]}),e.jsx("span",{className:"su-ago",children:"resumed today"})]}),e.jsxs("div",{className:"su-learn",children:[e.jsxs("div",{className:"su-lhd",children:[e.jsx(xp,{size:15}),'What "accounts" actually means']}),e.jsxs("p",{children:["Right now everyone using your app is ",e.jsx("b",{children:"anonymous"})," — nothing they do is tied to them, so a saved ",t.entitySingular," disappears when they close the tab."]}),e.jsxs("p",{children:["Accounts give each person a ",e.jsx("b",{children:"private space"}),": their own"," ",t.savedThings,`, their profile. It also lets you say "only this person can see their data," which you'll want before real money or personal info is involved.`]})]}),e.jsx("div",{className:"su-seclabel",children:"Set it up"}),e.jsxs(zr,{children:[e.jsx(Rt,{state:"done",num:1,title:"How should people sign in?",pill:"Chosen",desc:"Pick as many as you like. Most apps offer one tap with Google or Apple, plus email as a fallback.",children:e.jsx(hp,{methods:jk,initialSelected:["google","apple","email"]})}),e.jsx(Rt,{state:"done",num:2,title:"When should people be asked to sign in?",desc:"Plain language is fine — this is the instruction CodeYam follows.",children:e.jsxs($r,{children:["Let people ",e.jsx("b",{children:"browse freely"})," without an account. Only ask them to sign in when they ",e.jsxs("b",{children:["save an ",t.entitySingular]})," or"," ",e.jsxs("b",{children:["buy a ",t.purchaseNoun]}),"."]})}),e.jsx(Rt,{state:"todo",num:3,title:"What CodeYam will build",desc:"Four changes. Each becomes a plan you can preview, reorder, or drop before it ships.",children:e.jsx(Br,{items:r})})]}),e.jsxs(qr,{accent:"blue",icon:e.jsx(Me,{size:17}),children:[e.jsx("b",{children:"Nothing is locked down yet."})," People keep using your app exactly as they do now until you plan and build these. You can preview every screen first."]}),e.jsx(Hr,{label:"Plan these 4 changes",note:e.jsxs(e.Fragment,{children:["They'll land in your ",e.jsx("b",{children:"Plan"})," tab, ready to build after your current session."]}),onPlan:s})]})}function yp({onBack:t,onComplete:n,app:s=Lr,initialConnected:r=!1,startedOn:a="recently",connector:o}){const[i,c]=l.useState(r),d=!!o&&!i;return e.jsxs("div",{className:"setup-screen accent-blue",children:[e.jsxs("div",{className:"su-crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:t,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:t,children:"Setup"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("b",{children:"Accounts & sign-in"})]}),e.jsx(Wr,{topic:"accounts"}),i?e.jsx(vi,{app:s,startedOn:a,onComplete:n}):d?e.jsx(cp,{provider:o.provider,app:s,startedOn:a,onComplete:n}):e.jsx(Fr,{config:vk(s),onConnect:()=>c(!0)})]})}const JE=Object.freeze(Object.defineProperty({__proto__:null,AccountsConnected:vi,AccountsScreen:yp},Symbol.toStringTag,{value:"Module"})),wk="hello@your-app.com",_k={monogram:"R",name:"Your app",detail:"you@your-app.com · re_live_…"};function kk(t){return{accent:"amber",assistKey:"emails",badge:e.jsx(Gn,{size:25}),title:"Send emails from your app",providerName:"Resend",connectColor:"green",lead:"Right now your app can't email anyone. To send things like receipts, sign-in links, and welcome notes, it needs an email service — the part that actually delivers messages. CodeYam uses Resend.",explainerHeading:"New to Resend? Here's the short version",lede:e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Resend is the part that actually sends your email."})," When your app needs to email someone, Resend takes the message and makes sure it lands in their inbox, not the spam folder, from an address that looks like you."]}),explainerRows:[{icon:e.jsx(yi,{size:16}),title:"It sends reliably",desc:e.jsxs(e.Fragment,{children:["Receipts, password resets, and welcome notes go out"," ",e.jsx("em",{children:"the instant your app asks"}),", from your own address."]})},{icon:e.jsx(Bn,{size:16}),title:"It stays out of spam",desc:e.jsxs(e.Fragment,{children:["Resend handles the technical reputation work behind the scenes, so your emails ",e.jsx("em",{children:"actually arrive"})," instead of vanishing."]})},{icon:e.jsx(vt,{size:16}),title:"It shows you what happened",desc:e.jsxs(e.Fragment,{children:["See what was sent, delivered, or opened ",e.jsx("em",{children:"in one simple log"}),", so you're never guessing if a message went through."]})}],whyHeading:"Why CodeYam picks Resend for you",whyRows:[{lead:"Free to start, no card needed.",rest:`Resend's free tier gives you ${me("resend.free").value} — plenty for a new app, and the daily cap is the one to watch on launch day. You only pay once you send more.`},{lead:"Use your own address.",rest:"Send from your own domain so it looks like you, not a robot or a no-reply. This needs a one-time domain verification (a few DNS records) — see the steps below."},{lead:"Nothing to wire up.",rest:"CodeYam connects it and writes the emails for you. You just say what each one should say."}],connectTitle:"Connect or create your Resend account",connectDesc:"A new window opens on Resend. If you already have an account, sign in. If not, you'll make one — it's free and takes a few minutes. CodeYam links to it and holds the keys, so you never touch a server.",connectButtonLabel:"Connect Resend",reassure:["Free to start, no card needed","Connecting takes minutes — verifying your domain in DNS can take longer","Disconnect any time"],altToggleLabel:"Resend not for you? See other options",alternatives:[{monogram:"P",color:"#ffd400",name:"Postmark",desc:"Built for receipts and sign-in links, with a reputation for landing in the inbox fast. A great pick if reliable delivery matters most."},{monogram:"SG",color:"#1a82e2",name:"SendGrid",desc:"A long-established service that scales to very high volume. Handy if you already have an account you'd rather reuse."},{monogram:"SES",color:"#ff9900",name:"Amazon SES",desc:"The cheapest once you're sending a lot, with a little more setup. Best for high volume when you want to trim cost."}],lockedLabel:"Then, once you're connected",lockedSteps:[{icon:e.jsx(Bn,{size:15}),title:"Verify your sending domain",desc:"Add a few DNS records (SPF, DKIM, DMARC) so providers trust your mail. This can take from a few minutes to a few hours to take effect — until it does, you can only send from Resend's test address, not your own domain."},{icon:e.jsx(gi,{size:15}),title:"Tell us which emails to send",desc:`Plain language, like "a receipt after each ${t.purchaseNoun}, and a welcome note on sign-up."`},{icon:e.jsx(bi,{size:15}),title:"CodeYam writes and wires each email",desc:"The wording, the design, and when it sends — each a plan you preview before a single message goes out."}],faq:[{q:"Why are my emails going to spam?",a:"Almost always because your sending domain isn't verified yet. Until you add the SPF, DKIM, and DMARC DNS records Resend gives you, inbox providers can't confirm the mail is really from you, so they filter it. Verifying your own domain — and sending from it rather than a free inbox address like gmail.com — is what gets you reliably into the inbox."},{q:"Do I need my own domain to send email?",a:"To send from your own address (hello@your-app.com) and stay out of spam, yes — you verify a domain you own. Before that's set up you can still send from Resend's shared test address to try the flow, but real launch email should go from your verified domain."}]}}function vp({app:t,verifiedAddress:n,account:s,onComplete:r}){const a=[{title:"A welcome email",caption:"Sent the moment someone signs up, in your voice.",where:"on sign-up"},{title:`A receipt & ${t.purchaseNoun} email`,caption:`With the ${t.entitySingular} details and a ${t.purchaseNoun}, after each purchase.`,where:"on purchase"},{title:"A password reset link",caption:"A secure, single-use link when someone asks to reset.",where:"on request"},{title:"A simple sent log",caption:"See what was sent, delivered, or opened, in one screen.",where:"/emails"}];return e.jsxs("div",{className:"su-wrap",children:[e.jsxs("div",{className:"su-shead",children:[e.jsx("div",{className:"su-badge",children:e.jsx(Gn,{size:25})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"su-title",children:["Send emails from your app"," ",e.jsxs("span",{className:"su-chip connected",children:[e.jsx(jn,{size:11}),"Connected"]})]}),e.jsxs("div",{className:"su-via",children:["powered by ",e.jsx("b",{children:"Resend"})]}),e.jsx("p",{className:"su-lead",children:"Your app can send email now. Tell CodeYam which emails to send, in plain language, and it writes and wires each one. You preview every message before a single one goes out."})]})]}),e.jsxs("div",{className:"su-statusbar",children:[e.jsx("div",{className:"su-widget-ic",children:e.jsx(Bn,{size:16})}),e.jsxs("div",{className:"su-widget-body",children:[e.jsx("b",{children:"Your sending address is verified"}),e.jsxs("span",{children:["Emails go out from ",e.jsx("code",{children:n}),", so they look like you, not a robot."]})]}),e.jsx("button",{type:"button",className:"su-chg",children:"Manage"})]}),e.jsxs(zr,{children:[e.jsx(Rt,{state:"done",num:1,title:"Connect your Resend account",pill:"Connected",desc:"CodeYam holds the keys and does the wiring — you never touch a server or a config file.",children:e.jsx(xi,{monogram:s.monogram,name:s.name,detail:s.detail,monogramStyle:{background:"#ffd400",color:"#1a1a1a"}})}),e.jsxs(Rt,{state:"done",num:2,title:"Which emails should your app send?",desc:"Plain language is fine — this is what shapes the emails below.",children:[e.jsxs($r,{children:["A ",e.jsx("b",{children:"welcome note"})," when someone signs up, a"," ",e.jsxs("b",{children:["receipt with their ",t.purchaseNoun]})," after a purchase, and a"," ",e.jsx("b",{children:"password reset link"})," when they ask for one."]}),e.jsx(pp,{examples:[`A reminder the day before an ${t.entitySingular}`,`A note when an ${t.entitySingular} is cancelled`,`A monthly "what's on" roundup`]})]}),e.jsx(Rt,{state:"todo",num:3,title:"What CodeYam will build",desc:"Four emails, each a plan you can preview, reword, or drop before it ever sends.",children:e.jsx(Br,{items:a})})]}),e.jsxs(qr,{accent:"amber",icon:e.jsx(yi,{size:17}),children:[e.jsx("b",{children:"No email sends yet."})," These four are built as drafts so you can read every word and see how each looks. When it feels right, turn them on and your app starts emailing."]}),e.jsx(Hr,{label:"Plan these 4 emails",note:e.jsxs(e.Fragment,{children:["They'll land in your ",e.jsx("b",{children:"Plan"})," tab, previewable before anything sends, and easy to reword anytime."]}),onPlan:r})]})}function jp({onBack:t,onComplete:n,app:s=Lr,initialConnected:r=!1,verifiedAddress:a=wk,account:o=_k}){const[i,c]=l.useState(r);return e.jsxs("div",{className:"setup-screen accent-amber",children:[e.jsxs("div",{className:"su-crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:t,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:t,children:"Setup"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("b",{children:"Sending emails"})]}),e.jsx(Wr,{topic:"emails"}),i?e.jsx(vp,{app:s,verifiedAddress:a,account:o,onComplete:n}):e.jsx(Fr,{config:kk(s),onConnect:()=>c(!0)})]})}const XE=Object.freeze(Object.defineProperty({__proto__:null,EmailsConnected:vp,EmailsScreen:jp},Symbol.toStringTag,{value:"Module"}));function Bs(t){return[{key:"connect",label:t.flowLabels[0]},{key:"provision",label:t.flowLabels[1]},{key:"ready",label:t.flowLabels[2]}]}function ji({config:t,provider:n,onBack:s,onComplete:r,onRevert:a}){const{stage:o,result:i,error:c,connect:d,reset:u}=mi(t.key,n),[h,p]=l.useState("");return o==="idle"?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[0],onBack:s}),e.jsx($t,{steps:Bs(t),currentKey:"connect"}),e.jsxs("div",{className:"panel",children:[e.jsx("div",{className:"ph",children:t.connect.heading}),e.jsx("div",{className:"psub",children:t.connect.sub}),e.jsxs("div",{className:"connect-box",children:[e.jsxs("div",{className:"cbtitle",children:[e.jsx(Rr,{initial:t.recommended.initial,color:t.recommended.color}),e.jsxs("div",{children:[e.jsxs("div",{className:"cbt",children:["Connect ",t.recommended.name]}),e.jsxs("div",{className:"cbd",children:["Paste a ",t.recommended.name," API token to connect your real account."]})]})]}),e.jsx("label",{className:"real-token-label",htmlFor:"real-token",children:"API token"}),e.jsx("input",{id:"real-token",type:"password",className:"real-token-input",placeholder:`Paste your ${t.recommended.name} token`,value:h,onChange:f=>p(f.target.value)}),e.jsx("button",{type:"button",className:"auth-btn",disabled:h.trim().length===0,onClick:()=>d(h.trim()),children:t.connect.continueLabel})]}),e.jsxs("div",{className:"reassure",children:["🔒 ",t.connect.reassure]})]})]}):o==="error"?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[0],onBack:s}),e.jsx($t,{steps:Bs(t),currentKey:"connect"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"real-error",role:"alert",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"real-error-title",children:"Couldn’t connect"}),e.jsx(Ze,{variant:"icon",text:`Couldn’t connect: ${c}`})]}),e.jsx("div",{className:"real-error-msg",children:c})]}),e.jsx("button",{type:"button",className:"auth-btn",onClick:()=>{p(""),u()},children:"Try again"})]})]}):o==="ready"?e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[2]}),e.jsx($t,{steps:Bs(t),currentKey:"ready"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"live-hero",children:[e.jsx("div",{className:"lh-em",children:"🎉"}),e.jsx("div",{className:"lh-t",children:t.ready.title}),e.jsx("div",{className:"lh-d",children:t.ready.desc})]}),e.jsxs("div",{className:"url-card",children:[e.jsx("span",{className:"ucglobe",children:"✅"}),e.jsxs("div",{children:[e.jsx("div",{className:"uc-l",children:(i==null?void 0:i.label)||t.ready.resultLabel}),e.jsx("div",{className:"uc-u",children:(i==null?void 0:i.value)||t.ready.resultValue})]})]}),e.jsxs("div",{className:"live-foot",children:[e.jsxs("span",{className:"done-pill",children:[e.jsx(Be,{})," ",t.ready.donePill]}),e.jsx("button",{type:"button",className:"lf-back",onClick:()=>r==null?void 0:r(),children:"Back to Setup"}),a?e.jsx("button",{type:"button",className:"lf-revert",onClick:a,children:"Mark as not complete"}):null]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[1]}),e.jsx($t,{steps:Bs(t),currentKey:"provision"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"deploy-head",children:[e.jsx("div",{className:"deploy-spin"}),e.jsxs("div",{children:[e.jsx("div",{className:"deploy-t",children:t.provisionTitle}),e.jsx("div",{className:"deploy-d",children:o==="connecting"?`Connecting to ${t.recommended.name}…`:t.provisionDesc})]})]}),e.jsx("div",{className:"dep-bar",children:e.jsx("div",{className:"dep-bar-indeterminate"})})]})]})}const QE=Object.freeze(Object.defineProperty({__proto__:null,RealSetupFlow:ji},Symbol.toStringTag,{value:"Module"})),Sk={monogram:"AC",name:"Your app",detail:"you@your-app.com · acct_…"};function Nk(t){return{accent:"indigo",assistKey:"payments",badge:e.jsx(qt,{size:25}),title:"Accept payments",providerName:"Stripe",connectColor:"lime",lead:"You'd like people to be able to pay inside your app. To move money safely, apps don't handle cards themselves — they hand that part to a trusted service. CodeYam uses Stripe.",explainerHeading:"New to Stripe? Here's the short version",lede:e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Stripe is the part that actually moves the money."})," Think of it as the card machine and the bank, run by someone else, so you never have to touch a customer's card details yourself."]}),explainerRows:[{icon:e.jsx(Me,{size:16}),title:"It takes the payment safely",desc:e.jsxs(e.Fragment,{children:["The buyer types their card into ",e.jsx("em",{children:"Stripe's"})," secure screen, not yours. Sensitive numbers never sit in your app."]})},{icon:e.jsx(qt,{size:16}),title:"It charges the card",desc:e.jsxs(e.Fragment,{children:["Stripe talks to the banks and approves the payment in"," ",e.jsx("em",{children:"a few seconds"}),", then tells your app it went through."]})},{icon:e.jsx(vt,{size:16}),title:"It pays you",desc:e.jsxs(e.Fragment,{children:["The money lands in ",e.jsx("em",{children:"your bank account"}),", usually within a couple of days. You can watch every sale from your dashboard."]})}],whyHeading:"What it costs",whyRows:[{lead:"It's free to start.",rest:`No monthly fee. Stripe keeps a small cut of each sale (${me("stripe.usCardFee").value} for US cards; international cards and currency conversion cost more, and a disputed charge carries a fee), so you only pay when you actually get paid. It's trusted by millions of businesses, from corner shops to Amazon.`}],connectTitle:"Connect or create your Stripe account",connectDesc:"A new window opens on Stripe. If you already have an account, sign in. If not, you'll make one — it's free and takes a few minutes. CodeYam links to it; we never see card numbers.",connectButtonLabel:"Connect Stripe",reassure:["Start in test mode, no real card or bank details needed yet","Connecting takes minutes — activating live payments takes longer","Disconnect any time"],altToggleLabel:"Selling internationally or digital goods? See tax-handling options",alternatives:[{monogram:"LS",color:"linear-gradient(140deg,#ffc233,#e0a000)",name:"Lemon Squeezy",desc:"Acts as the merchant of record, so it collects and remits sales tax/VAT for you worldwide. A strong pick for digital goods or selling outside the US, in exchange for a higher per-sale fee."},{monogram:"P",color:"linear-gradient(140deg,#1b6dff,#0b46c4)",name:"Paddle",desc:"Also a merchant of record handling global tax compliance and invoicing. Built for software and subscriptions where you'd rather not track tax rules in dozens of countries."}],lockedLabel:"Then, once you're connected",lockedSteps:[{icon:e.jsx(Bn,{size:15}),title:"Activate live payments",desc:"Test mode works right away, but before you can charge a real card Stripe has to verify your business: legal entity, a bank account to pay out to, and sometimes tax info. That review can take a day or two, so it's worth starting early — going live is not just flipping a switch."},{icon:e.jsx(fi,{size:15}),title:"Tell us what you're selling",desc:`A sentence in plain language, like "${t.entitySingular} ${t.purchaseNoun}s, $10 to $45."`},{icon:e.jsx(qt,{size:15}),title:"CodeYam builds your checkout",desc:`A "Get ${t.purchaseNoun}s" button, a payment screen, and an emailed receipt — each one a plan you preview before it ships.`}]}}function Ck(t){return{key:"payments",connector:{provider:"stripe"},Icon:qt,title:"Accept payments",crumbLabel:"Payments",meta:"Foundation · about 10 minutes",leads:[{text:"Connect a real Stripe Sandbox so you can run the whole purchase flow against test cards."}],recommendLabel:"Recommended for your app",recommended:{...{initial:"S",color:"linear-gradient(140deg,#635bff,#4b45c6)",name:"Stripe"},bestFit:!0,description:"The payments tech behind millions of apps. Start in a Sandbox with test cards, go live once your business is activated.",reasons:[],chips:["Test cards","Sample products","No real money in Sandbox"]},alternatives:[],ctaLabel:"Set up payments with Stripe",ctaNote:"Nothing charges a real card in a Sandbox.",faq:[],flowLabels:["Connect","Provision","Ready"],connect:{heading:"Connect your Stripe Sandbox",sub:"Create or open a Sandbox in your Stripe Dashboard, then paste that Sandbox's restricted test key (rk_test_…).",grants:["Create sample test products and prices in the Sandbox","Read back the Sandbox so we can link you to it"],continueLabel:"Connect Stripe Sandbox",reassure:"We only accept a test key (rk_test_…). Live keys are rejected — live needs Stripe business activation first."},provisionTitle:"Setting up your Sandbox store",provisionDesc:`Creating sample ${t.purchaseNoun} products and prices in your Stripe Sandbox…`,provisionSteps:["Validating your Sandbox key","Creating sample products","Adding test prices"],ready:{title:"Your Stripe Sandbox is ready",desc:"Sample products and prices are set up. Open the Sandbox to see them and run a test purchase.",resultLabel:"Stripe sandbox",resultValue:"dashboard.stripe.com/test/products",donePill:"Payments connected in test mode"}}}function wp(){const[t,n]=l.useState("test");return e.jsxs("div",{className:"su-modebar",children:[e.jsx("div",{className:"su-widget-ic",children:e.jsx(fp,{size:16})}),e.jsxs("div",{className:"su-widget-body",children:[e.jsx("b",{children:t==="test"?"You're in test mode":"You're live"}),e.jsx("span",{children:t==="test"?"Use test cards to try the whole flow. No real money moves until you switch to live — and live needs Stripe to verify your business first (legal entity, bank account, sometimes tax info), which can take a day or two.":"Real cards are charged now. Every sale moves real money to your account."})]}),e.jsxs("div",{className:"su-seg",children:[e.jsx("button",{type:"button",className:t==="test"?"on":"",onClick:()=>n("test"),children:"Test"}),e.jsx("button",{type:"button",className:"live"+(t==="live"?" on":""),onClick:()=>n("live"),children:"Live"})]})]})}function _p({app:t,account:n,onComplete:s}){const r=[{title:`A "Get ${t.purchaseNoun}s" button`,caption:`Added to each ${t.entitySingular} so people can buy in one tap.`,where:`/${t.entitySingular}`},{title:"A checkout screen",caption:"Card payment, Apple Pay, and Google Pay, hosted by Stripe.",where:"/checkout"},{title:`An emailed receipt & ${t.purchaseNoun}`,caption:`Stripe sends the card payment receipt automatically; CodeYam adds your own branded confirmation with the ${t.purchaseNoun} (this is the Sending-emails topic, not Stripe).`,where:"email"},{title:"A simple sales view",caption:"See what sold and refund with one click, in your dashboard.",where:"/sales"}];return e.jsxs("div",{className:"su-wrap",children:[e.jsxs("div",{className:"su-shead",children:[e.jsx("div",{className:"su-badge",children:e.jsx(qt,{size:25})}),e.jsxs("div",{children:[e.jsx("h1",{className:"su-title",children:"Accept payments"}),e.jsxs("div",{className:"su-via",children:["powered by ",e.jsx("b",{children:"Stripe"})," · the payments tech behind millions of apps"]}),e.jsxs("p",{className:"su-lead",children:["Let people pay inside your app — buy a ",t.purchaseNoun,", leave a tip, subscribe. CodeYam handles the wiring; you just describe what you're selling and preview every screen before it goes live."]})]})]}),e.jsx(wp,{}),e.jsxs(zr,{children:[e.jsx(Rt,{state:"done",num:1,title:"Connect your Stripe account",pill:"Connected",desc:"CodeYam never sees your customers' card numbers — Stripe handles that part.",children:e.jsx(xi,{monogram:n.monogram,name:n.name,detail:n.detail})}),e.jsx(Rt,{state:"done",num:2,title:"What are you selling?",desc:"Plain language is fine — this is what shapes the screens below.",children:e.jsxs($r,{children:[t.entitySingular," ",t.purchaseNoun,"s, one-off purchases from"," ",e.jsx("b",{children:"$10 to $45"}),". Buyers get a ",t.purchaseNoun," by email."]})}),e.jsx(Rt,{state:"todo",num:3,title:"What CodeYam will build",desc:"Four small changes. Each becomes a plan you can preview, reorder, or drop before it ships.",children:e.jsx(Br,{items:r})})]}),e.jsxs(qr,{accent:"amber",icon:e.jsx(Me,{size:17}),children:[e.jsx("b",{children:"Nothing charges a real card yet."})," These four changes build in test mode so you can click through the whole purchase. When it feels right, switch to live and your store is open."]}),e.jsx(Hr,{label:"Plan these 4 changes",note:e.jsxs(e.Fragment,{children:["They'll land in your ",e.jsx("b",{children:"Plan"})," tab, ready to build after your current session, and previewable before anything ships."]}),onPlan:s})]})}function kp({onBack:t,onComplete:n,onRevert:s,app:r=Lr,initialConnected:a=!1,account:o=Sk,connector:i}){const[c,d]=l.useState(a);let u;return i&&c?u=e.jsx(ji,{config:Ck(r),provider:i.provider,onBack:()=>d(!1),onComplete:n,onRevert:s}):c?u=e.jsx(_p,{app:r,account:o,onComplete:n}):u=e.jsx(Fr,{config:Nk(r),onConnect:()=>d(!0)}),e.jsxs("div",{className:"setup-screen accent-indigo",children:[e.jsxs("div",{className:"su-crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:t,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:t,children:"Setup"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("b",{children:"Payments"})]}),e.jsx(Wr,{topic:"payments"}),u]})}const ZE=Object.freeze(Object.defineProperty({__proto__:null,ModeBar:wp,PaymentsConnected:_p,PaymentsScreen:kp},Symbol.toStringTag,{value:"Module"}));function et({config:t,onBack:n,onComplete:s,status:r,onRevert:a}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(t.Icon,{size:26}),title:t.title,crumbLabel:t.crumbLabel,meta:t.meta,onBack:n,assistKey:t.key}),t.leads.map(o=>e.jsx("p",{className:"lead"+(o.dim?" dim":""),children:o.text},o.text)),t.sections.map(o=>e.jsxs("div",{children:[e.jsx("div",{className:"seclabel",children:o.heading}),o.body?e.jsx("p",{className:"lead dim",children:o.body}):null,o.bullets?e.jsx("div",{className:"reasons",children:o.bullets.map(i=>e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[i.lead?e.jsxs("b",{children:[i.lead," "]}):null,i.text]})]},i.text))}):null]},o.heading)),t.options&&t.options.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"seclabel",children:t.optionsLabel??"Your options"}),t.options.map(o=>e.jsx(ri,{provider:o},o.name))]}):null,e.jsx(Ve,{items:t.faq}),e.jsx(fe,{assistKey:t.key,topicName:t.title}),e.jsx(ge,{label:t.doneLabel,note:t.doneNote??"You can revisit this anytime.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const eM=Object.freeze(Object.defineProperty({__proto__:null,TeachSetupScreen:et},Symbol.toStringTag,{value:"Module"})),Pk={key:"analytics-monitoring",Icon:vt,title:"Analytics & monitoring",crumbLabel:"Analytics",meta:"Recommended · about 10 minutes",leads:[{text:"Two different questions, two different tools. Analytics tells you what people do in your app — which pages they visit, where they drop off. Monitoring tells you when something breaks — the errors real users hit before they email you."},{text:"You don't need both on day one, but adding them early means you're never flying blind once people show up.",dim:!0}],sections:[{heading:"Analytics — understand usage",bullets:[{lead:"See what's used.",text:"Which features people actually open, and which they ignore."},{lead:"Find drop-off.",text:"Where people get stuck or leave, so you know what to fix."},{lead:"Privacy-first options exist.",text:"Lightweight analytics can skip cookies entirely and respect visitors."}]},{heading:"Monitoring — catch errors early",bullets:[{lead:"Know before they tell you.",text:"Get alerted when real users hit an error, with the details to fix it."},{lead:"See the full picture.",text:"What the user did, on what device, and the exact line that failed."}]}],optionsLabel:"Popular tools",options:[{initial:"P",color:"linear-gradient(140deg,#1d4ed8,#1e3a8a)",name:"PostHog",bestFit:!0,description:"Product analytics, session replay, and feature flags in one free-to-start tool. A great all-rounder for understanding usage.",reasons:[{lead:"Generous free tier.",rest:"Plenty for a new app's traffic."},{lead:"More than page views.",rest:"Funnels, replays, and flags when you're ready."},{lead:"Session replay is metered.",rest:"Its free quota of recordings is modest — fine for spot-checking, but it's billed past the cap, so leave always-on replay off until you need it."}],chips:["Analytics","Free tier","Privacy options"]},{initial:"S",color:"linear-gradient(140deg,#362d59,#1b1633)",name:"Sentry",description:"The standard for error monitoring. Catches exceptions with the context to reproduce and fix them fast.",reasons:[{lead:"Real-user errors.",rest:"See failures as they happen in production."},{lead:"Free to start.",rest:"A free tier that covers early traffic."}],chips:["Monitoring","Free tier","Alerts"]}],faq:[{q:"Do I need analytics AND monitoring?",a:"They answer different questions. Analytics is about behavior (what people do); monitoring is about health (what's breaking). Many apps add a lightweight analytics tool first, then error monitoring as traffic grows."},{q:"Will this slow my app down or hurt privacy?",a:"Modern tools are tiny and load in the background. Privacy-first analytics options avoid cookies and personal data entirely — a good default if you'd rather not show a consent banner."}],doneLabel:"Mark analytics & monitoring as set up"};function Sp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Pk,onBack:t,onComplete:n,status:s,onRevert:r})}const tM=Object.freeze(Object.defineProperty({__proto__:null,AnalyticsMonitoringScreen:Sp},Symbol.toStringTag,{value:"Module"})),Tk={key:"legal",Icon:Ee,title:"Privacy & legal",crumbLabel:"Legal",meta:"Recommended · about 20 minutes",leads:[{text:"Once real people use your app, a little legal groundwork protects both them and you. The good news: for most apps it's two short documents and a couple of small habits — not a lawyer on retainer."},{text:"This is guidance, not legal advice. If you handle sensitive data or money at scale, it's worth a professional review.",dim:!0}],sections:[{heading:"The two documents most apps need",bullets:[{lead:"Privacy policy —",text:"what information you collect, why, and what you do with it. Required the moment you collect emails or use analytics."},{lead:"Terms of service —",text:"the rules for using your app: what's allowed, what you promise, and what you don't. It sets expectations and limits your liability."}]},{heading:"Good habits that matter",bullets:[{lead:"Collect only what you need.",text:"Less data means less risk and a simpler policy."},{lead:"Say it in plain language.",text:"A clear, honest policy beats dense legalese for trust and compliance."},{lead:"Add a cookie/consent notice",text:"if you use analytics or tracking, especially for visitors in the EU. You can often skip the banner entirely by picking a cookieless analytics tool — see Analytics & monitoring."},{lead:"Honor data requests.",text:"Under GDPR and CCPA, people can ask to see, export, or delete the data you hold on them. Keep a simple way to remove an account and its data — this is where Accounts, Payments, and your database meet."}]},{heading:"Getting the documents",body:"You don't have to write these from scratch. Generators produce a solid starting policy from a short questionnaire — but check what's actually free. GetTerms and privacypolicies.com have genuinely free basic tiers; Termly and iubenda are freemium and gate some clauses (or removal of their attribution) behind a paid plan. Paste the result into a /privacy and /terms page and link them in your footer."}],faq:[{q:"Do I really need this for a small app?",a:"If you collect any personal data — even just email sign-ups or analytics — a privacy policy is expected and often legally required. Terms are optional but strongly recommended once people rely on your app."},{q:"Where do the pages go?",a:"Add two simple pages, usually /privacy and /terms, and link them from your footer and your sign-up screen. They don't need fancy design — clarity is what counts."}],doneLabel:"Mark privacy & legal as handled"};function Np({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Tk,onBack:t,onComplete:n,status:s,onRevert:r})}const nM=Object.freeze(Object.defineProperty({__proto__:null,LegalScreen:Np},Symbol.toStringTag,{value:"Module"}));function Cp({config:t,onBack:n,onSetup:s}){return e.jsxs(e.Fragment,{children:[e.jsx(pe,{icon:e.jsx(t.Icon,{size:26}),title:t.title,crumbLabel:t.crumbLabel,meta:t.meta,onBack:n,assistKey:t.key}),t.leads.map(r=>e.jsx("p",{className:"lead"+(r.dim?" dim":""),children:r.text},r.text)),e.jsx("div",{className:"seclabel",children:t.recommendLabel}),e.jsx(ri,{provider:t.recommended}),e.jsx(vh,{alts:t.alternatives}),e.jsxs("div",{className:"cta-wrap",children:[e.jsx("button",{type:"button",className:"cta",onClick:s,children:t.ctaLabel}),e.jsx("div",{className:"cta-note",children:t.ctaNote})]}),e.jsx(Ve,{items:t.faq}),e.jsx(fe,{assistKey:t.key,topicName:t.title})]})}const sM=Object.freeze(Object.defineProperty({__proto__:null,SimulatedSetupOverview:Cp},Symbol.toStringTag,{value:"Module"})),Zl=1100,Ok=700;function wi(t){return[{key:"connect",label:t.flowLabels[0]},{key:"provision",label:t.flowLabels[1]},{key:"ready",label:t.flowLabels[2]}]}function Pp({config:t,onBack:n,onContinue:s}){return e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[0],onBack:n}),e.jsx($t,{steps:wi(t),currentKey:"connect"}),e.jsxs("div",{className:"panel",children:[e.jsx("div",{className:"ph",children:t.connect.heading}),e.jsx("div",{className:"psub",children:t.connect.sub}),e.jsxs("div",{className:"connect-box",children:[e.jsxs("div",{className:"cbtitle",children:[e.jsx(Rr,{initial:t.recommended.initial,color:t.recommended.color}),e.jsxs("div",{children:[e.jsxs("div",{className:"cbt",children:["Sign in with ",t.recommended.name]}),e.jsxs("div",{className:"cbd",children:["We'll open ",t.recommended.name," in a new tab and bring you right back."]})]})]}),e.jsx("div",{className:"grant",children:t.connect.grants.map(r=>e.jsxs("div",{className:"grantrow",children:[e.jsx(Be,{color:"var(--blue-300)"}),e.jsx("span",{children:r})]},r))}),e.jsx("button",{type:"button",className:"auth-btn",onClick:s,children:t.connect.continueLabel}),e.jsxs("div",{className:"auth-row",children:[e.jsx("button",{type:"button",className:"auth-ghost",onClick:s,children:"I already have an account"}),e.jsx("button",{type:"button",className:"auth-ghost",onClick:s,children:"Create one for me"})]})]}),e.jsxs("div",{className:"reassure",children:["🔒 ",t.connect.reassure]})]})]})}function Tp({config:t,onDone:n}){const s=t.provisionSteps,[r,a]=l.useState(0),o=l.useRef(n);o.current=n,l.useEffect(()=>{const c=[];for(let d=1;d<=s.length;d++)c.push(setTimeout(()=>a(d),d*Zl));return c.push(setTimeout(()=>o.current(),s.length*Zl+Ok)),()=>c.forEach(clearTimeout)},[s.length]);const i=Math.round(r/s.length*100);return e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[1]}),e.jsx($t,{steps:wi(t),currentKey:"provision"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"deploy-head",children:[e.jsx("div",{className:"deploy-spin"}),e.jsxs("div",{children:[e.jsx("div",{className:"deploy-t",children:t.provisionTitle}),e.jsx("div",{className:"deploy-d",children:t.provisionDesc})]})]}),e.jsx("div",{className:"dep-bar",children:e.jsx("div",{style:{width:i+"%"}})}),e.jsx("div",{className:"dep-steps",children:s.map((c,d)=>e.jsxs("div",{className:"dep-step "+(d<r?"done":d===r?"active":"todo"),children:[e.jsx("div",{className:"dot",children:d<r?e.jsx(Be,{size:12,color:"#0a0a0a"}):null}),e.jsx("div",{className:"sl",children:c})]},c))})]})]})}function Op({config:t,onFinish:n,onRevert:s}){return e.jsxs(e.Fragment,{children:[e.jsx(Qt,{topic:t.crumbLabel??t.title,step:t.flowLabels[2]}),e.jsx($t,{steps:wi(t),currentKey:"ready"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"live-hero",children:[e.jsx("div",{className:"lh-em",children:"🎉"}),e.jsx("div",{className:"lh-t",children:t.ready.title}),e.jsx("div",{className:"lh-d",children:t.ready.desc})]}),e.jsxs("div",{className:"url-card",children:[e.jsx("span",{className:"ucglobe",children:"✅"}),e.jsxs("div",{children:[e.jsx("div",{className:"uc-l",children:t.ready.resultLabel}),e.jsx("div",{className:"uc-u",children:t.ready.resultValue})]})]}),e.jsxs("div",{className:"live-foot",children:[e.jsxs("span",{className:"done-pill",children:[e.jsx(Be,{})," ",t.ready.donePill]}),e.jsx("button",{type:"button",className:"lf-back",onClick:n,children:"Back to Setup"}),s?e.jsx("button",{type:"button",className:"lf-revert",onClick:s,children:"Mark as not complete"}):null]})]})]})}const rM=Object.freeze(Object.defineProperty({__proto__:null,SimulatedConnect:Pp,SimulatedProvision:Tp,SimulatedReady:Op},Symbol.toStringTag,{value:"Module"}));function Ss({config:t,onBack:n,onComplete:s,onRevert:r}){const[a,o]=l.useState("overview");let i;return a==="overview"?i=e.jsx(Cp,{config:t,onBack:n,onSetup:()=>o("connect")}):t.connector?i=e.jsx(ji,{config:t,provider:t.connector.provider,onBack:()=>o("overview"),onComplete:()=>{s==null||s(),n()},onRevert:r?()=>{r(),n()}:void 0}):a==="connect"?i=e.jsx(Pp,{config:t,onBack:()=>o("overview"),onContinue:()=>o("provision")}):a==="provision"?i=e.jsx(Tp,{config:t,onDone:()=>o("ready")}):i=e.jsx(Op,{config:t,onFinish:()=>{s==null||s(),n()},onRevert:r?()=>{r(),n()}:void 0}),e.jsx("div",{className:"hosting-screen",children:i})}const aM=Object.freeze(Object.defineProperty({__proto__:null,SimulatedSetupScreen:Ss},Symbol.toStringTag,{value:"Module"})),Ak={key:"publish",Icon:vn,title:"Publish the site",crumbLabel:"Publish",meta:"Foundation · about 10 minutes",leads:[{text:"Your site is a set of files that, right now, live on your computer. Publishing builds those files and copies them to the internet, so anyone with the link can open your pages."},{text:"Static sites are perfect for this — there's no server to run, just files served fast from everywhere. Hosting them is usually free.",dim:!0}],recommendLabel:"Recommended for your site",recommended:{initial:"C",color:"linear-gradient(140deg,#f6821f,#c25e0a)",name:"Cloudflare Pages",bestFit:!0,description:"Built for static sites: connect once, and every change you push is built and published automatically. Free with no bandwidth ceiling.",reasons:[{lead:"Free, with no traffic ceiling.",rest:`${me("cloudflarePages.free").value}, so a sudden traffic spike won't cost you.`},{lead:"Auto-publish on every change.",rest:"Push an update and it rebuilds and goes live on its own."},{lead:"Fast everywhere.",rest:"Your pages are served from Cloudflare's global network, close to your visitors."}],chips:["Free tier","Unlimited bandwidth","Global CDN"]},alternatives:[{initial:"N",color:"linear-gradient(140deg,#16a3a3,#0d6e6e)",name:"Netlify",description:`Also built for static sites with automatic publishing. ${me("netlify.free").value} — plenty for a personal or small site.`},{initial:"V",color:"linear-gradient(140deg,#0a0a0a,#000)",name:"Vercel",description:"Also free and excellent for static sites, especially if you later add dynamic pages. Very similar to set up."},{initial:"G",color:"linear-gradient(140deg,#24292f,#0d1117)",name:"GitHub Pages",description:"Free hosting straight from a GitHub repo. Great if your code already lives there and your needs are simple — but it has no built-in form handling and a stricter build environment."}],ctaLabel:"☁️ Publish with Cloudflare Pages",ctaNote:"We'll publish this site only. Nothing goes live until the build finishes.",faq:[{q:'What does "building" the site mean?',a:"Building turns your source files into the finished pages a browser shows — combining templates, optimizing images, and bundling styles. The host does this for you each time you publish."},{q:"Do I have to republish every time I change something?",a:"No. Once connected, the host watches for changes and republishes automatically. You make an edit, and a minute later it's live."},{q:"Is it really free?",a:`For a typical static site, yes. Cloudflare Pages: ${me("cloudflarePages.free").value.toLowerCase()}, so traffic spikes won't cost you. Netlify's free tier: ${me("netlify.free").value.toLowerCase()}. You'd only pay if you needed advanced features.`}],flowLabels:["Connect","Build","Live"],connect:{heading:"🔗 Connect your Cloudflare account",sub:"This free account hosts your live site. You'll create it in a few clicks if you don't have one.",grants:["Publish this one site","Rebuild it when you make changes","Nothing else — your other sites stay untouched"],continueLabel:"Continue with Cloudflare",reassure:"We only publish this site. You can unpublish or disconnect anytime."},provisionTitle:"Building and publishing…",provisionDesc:"This usually takes under a minute. You can keep working — we'll let you know.",provisionSteps:["Building your pages","Optimizing images and styles","Uploading to the network","Giving it a web address"],ready:{title:"Your site is live",desc:"Anyone with this link can open your site right now.",resultLabel:"Your link",resultValue:"your-site.pages.dev",donePill:"Publishing is now set up"}};function Ap({onBack:t,onComplete:n,onRevert:s}){return e.jsx(Ss,{config:Ak,onBack:t,onComplete:n,onRevert:s})}const oM=Object.freeze(Object.defineProperty({__proto__:null,PublishScreen:Ap},Symbol.toStringTag,{value:"Module"})),Rk={key:"custom-domain",Icon:tn,title:"Custom domain",crumbLabel:"Domain",meta:"Optional · about 15 minutes",leads:[{text:"Right now your site lives at a free address like your-site.netlify.app. A custom domain swaps that for your own — yourname.com — which looks more professional and is easier to remember."},{text:"You buy a domain once a year, then point it at your site. We'll handle the technical part (DNS) and turn on the padlock (HTTPS) for you.",dim:!0}],recommendLabel:"Recommended registrar",recommended:{initial:"C",color:"linear-gradient(140deg,#f6821f,#c25e0a)",name:"Cloudflare Registrar",bestFit:!0,description:"Buy your domain at cost with no markup, with DNS that's fast and easy to point at your site.",reasons:[{lead:"At-cost pricing.",rest:"No upsells or inflated renewal fees — you pay what the domain costs."},{lead:"Easy to point at your site.",rest:"A couple of records and your domain shows your pages."},{lead:"Free HTTPS.",rest:"The padlock that tells visitors your site is secure, set up for you."}],chips:["At-cost","Free HTTPS","~15 min to set up"]},alternatives:[{initial:"N",color:"linear-gradient(140deg,#1a1a1a,#000)",name:"Namecheap",description:"A popular, affordable registrar with a friendly dashboard. A solid alternative if you prefer it."},{initial:"P",color:"linear-gradient(140deg,#00a98f,#007a68)",name:"Porkbun",description:"Low prices and free extras like WHOIS privacy. Great value for a personal site."}],ctaLabel:"🌐 Set up a custom domain",ctaNote:"We'll guide you through buying and connecting your domain.",faq:[{q:"What is DNS?",a:`DNS is the internet's address book. It maps your domain name (yourname.com) to where your site actually lives. "Pointing" your domain means adding a couple of records so the address book sends visitors to your pages. You'll usually set up both the root (yourname.com, via an A or ALIAS record) and the www version (www.yourname.com, via a CNAME) — most registrars cover both in a couple of clicks.`},{q:"What is HTTPS / the padlock?",a:"HTTPS encrypts the connection between your visitors and your site, and shows a padlock in the browser. It's expected today, and your host turns it on automatically once your domain is connected."},{q:"How much does a domain cost?",a:"Most common domains run roughly $10–15 per year. You renew yearly to keep it. Some endings (.io, .ai) cost more; a plain .com is usually the safe, affordable pick."}],flowLabels:["Choose","Connect","Live"],connect:{heading:"🔗 Point your domain at your site",sub:"We'll add the DNS records that connect your new domain to your published site, then turn on HTTPS.",grants:["Add records that point this domain at your site","Request a free HTTPS certificate","Nothing else — we won't change your other domains"],continueLabel:"Connect my domain",reassure:"You own the domain. We only add the records needed to show your site."},provisionTitle:"Connecting your domain…",provisionDesc:"DNS can take a few minutes to spread, but usually it's quick. We'll let you know.",provisionSteps:["Adding your DNS records","Waiting for them to take effect","Issuing your HTTPS certificate","Pointing the domain at your site"],ready:{title:"Your domain is live",desc:"Your site now opens at your own secure web address.",resultLabel:"Your address",resultValue:"https://your-name.com",donePill:"Custom domain is now set up"}};function Rp({onBack:t,onComplete:n,onRevert:s}){return e.jsx(Ss,{config:Rk,onBack:t,onComplete:n,onRevert:s})}const iM=Object.freeze(Object.defineProperty({__proto__:null,CustomDomainScreen:Rp},Symbol.toStringTag,{value:"Module"})),Ek={key:"data-safety",Icon:ks,title:"Data backups & deletion",crumbLabel:"Data safety",meta:"Recommended · about 15 minutes",leads:[{text:"Once real people trust your app with their data, two responsibilities follow: keep it safe so a bad day doesn't lose it, and give people control over it. Both are small, one-time habits — not a second job."},{text:"This is guidance, not legal advice. If you handle sensitive data or operate at scale, a professional review is worth it.",dim:!0}],sections:[{heading:"Back up your data",bullets:[{lead:"Turn on automated backups.",text:"Most managed databases take daily snapshots on paid tiers — switch them on and confirm the retention window. A backup you've never restored is a guess, so test a restore once."},{lead:"Mind the free tier.",text:"Free database tiers often pause or expire after inactivity and may not back up at all. If real users depend on the data, that's the signal to move to a paid plan."},{lead:"Keep a copy you control.",text:"An occasional export you store yourself protects you even if the provider's account or project goes away."}]},{heading:"Honor delete & export requests",body:"Under GDPR and CCPA, people can ask to see, export, or permanently delete the data you hold on them — and you're expected to be able to do it. This is where Accounts, Payments, and your database meet.",bullets:[{lead:"Make deletion possible.",text:"Have one reliable way to remove an account and the records tied to it — orders, profile, analytics identifiers. Remember backups and third-party tools (email, payments) hold copies too."},{lead:"Make export easy.",text:"Be able to hand someone a copy of their data in a common format. A simple admin action or even a manual query is enough to start."},{lead:"Write down your retention.",text:"Decide how long you keep data and say so in your privacy policy — see Privacy & legal."}]}],faq:[{q:"Isn't my database already backed up?",a:"Don't assume so. Paid tiers usually offer daily snapshots but they're often off by default; free tiers frequently have none and can pause. Check the dashboard and turn backups on explicitly."},{q:"Do small apps really get deletion requests?",a:"It only takes one. The obligation applies the moment you store personal data, so it's far easier to build a simple delete-and-export path early than to scramble when the first request arrives."}],doneLabel:"Mark data backups & deletion as handled"};function Ep({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Ek,onBack:t,onComplete:n,status:s,onRevert:r})}const lM=Object.freeze(Object.defineProperty({__proto__:null,DataSafetyScreen:Ep},Symbol.toStringTag,{value:"Module"})),Mk={key:"forms",Icon:Gn,title:"Contact & forms",crumbLabel:"Forms",meta:"Optional · about 10 minutes",leads:[{text:"A static site has no server to receive a contact form, so the form needs somewhere to send messages. A form service catches submissions and emails them to you — no backend required."},{text:"You keep your simple, fast static site and still hear from visitors. Most services are free for the volume a small site sees.",dim:!0}],recommendLabel:"Recommended for your site",recommended:{initial:"F",color:"linear-gradient(140deg,#e5422b,#b02f1d)",name:"Formspree",bestFit:!0,description:"Point your form at a Formspree address and submissions arrive in your inbox. The simplest way to add a contact form.",reasons:[{lead:"No backend to build.",rest:"Your existing HTML form just works — only the destination changes."},{lead:"Spam filtering included.",rest:"Built-in protection so you're not flooded with junk."},{lead:"Free to start.",rest:"A monthly free allowance that suits a small site."}],chips:["Free tier","No backend","Spam protection"]},alternatives:[{initial:"N",color:"linear-gradient(140deg,#16a3a3,#0d6e6e)",name:"Netlify Forms",description:`Built in if you publish with Netlify — add one attribute to your form and you're done. Great if you're already there, though its free tier caps submissions at ${me("netlifyForms.free").value}.`},{initial:"W",color:"linear-gradient(140deg,#7c3aed,#5b21b6)",name:"Web3Forms",description:"A fully free, no-account form endpoint — paste an access key and submissions email straight to you. Good when you want zero cost and no dashboard."},{initial:"B",color:"linear-gradient(140deg,#3b82f6,#1d4ed8)",name:"Basin",description:"A privacy-friendly form backend with a clean dashboard. A solid alternative to Formspree."}],ctaLabel:"✉️ Set up forms with Formspree",ctaNote:"We'll connect your contact form only. Messages go straight to you.",faq:[{q:"How can a static site receive form submissions?",a:"The form posts to the service's address instead of a server you run. The service receives the message, screens it for spam, and forwards it to your email. Your site stays a set of static files."},{q:"Will I get spam?",a:"Far less than you'd fear. These services include spam filtering and a honeypot, and you can add a captcha if needed. Most junk is stopped before it reaches you."},{q:"Where do the messages go?",a:"To whatever email you choose. You can also forward them to a spreadsheet or a tool like Slack if you'd rather not use your inbox."}],flowLabels:["Connect","Verify","Ready"],connect:{heading:"🔗 Connect your Formspree account",sub:"This free account catches your form submissions. You'll create it in a few clicks if you don't have one.",grants:["Receive submissions from this site's form","Forward them to your email","Nothing else — no access to the rest of your site"],continueLabel:"Continue with Formspree",reassure:"We only connect this one form. You can disconnect it anytime."},provisionTitle:"Setting up your form…",provisionDesc:"This takes under a minute. We'll bring you right back.",provisionSteps:["Creating your form endpoint","Turning on spam protection","Pointing your contact form at it","Sending a test message"],ready:{title:"Your form is ready",desc:"Visitors can now message you, and submissions land in your inbox.",resultLabel:"Submissions go to",resultValue:"you@your-name.com",donePill:"Contact & forms are now set up"}};function Mp({onBack:t,onComplete:n,onRevert:s}){return e.jsx(Ss,{config:Mk,onBack:t,onComplete:n,onRevert:s})}const cM=Object.freeze(Object.defineProperty({__proto__:null,FormsScreen:Mp},Symbol.toStringTag,{value:"Module"})),Ik={key:"analytics-seo",Icon:vt,title:"Analytics & SEO",crumbLabel:"Analytics & SEO",meta:"Recommended · about 15 minutes",leads:[{text:"Two jobs that help people find and understand your site. Analytics tells you who's visiting and what they read. SEO — search engine optimization — helps your pages show up when someone searches for what you offer."},{text:"For a static site, most of this is a handful of one-time additions to your pages. Do them once and they keep working.",dim:!0}],sections:[{heading:"SEO — get found in search",bullets:[{lead:"Page titles and descriptions.",text:"Give each page a clear <title> and meta description — this is what shows in search results."},{lead:"A sitemap.",text:"A simple sitemap.xml lists your pages so search engines can find them all."},{lead:"Social cards.",text:"Open Graph tags make your links look great when shared on social media, with a title, image, and summary."},{lead:"Submit to Search Console.",text:"Tell Google your site exists and see which searches bring people in."}]},{heading:"Analytics — know your visitors",bullets:[{lead:"Count visits, respect privacy.",text:"A lightweight analytics script shows traffic without cookies or personal data."},{lead:"See what resonates.",text:"Which pages people read, where they come from, and what they ignore."}]}],optionsLabel:"Privacy-friendly analytics",options:[{initial:"C",color:"linear-gradient(140deg,#f6821f,#c25e0a)",name:"Cloudflare Web Analytics",bestFit:!0,description:"Free, cookie-free visitor analytics you can turn on without paying for a service. No consent banner, no personal data.",reasons:[{lead:"Genuinely free.",rest:"No trial clock — the core visitor analytics are free to use."},{lead:"Cookie-free.",rest:"Privacy-friendly by default, so no consent popup."}],chips:["Free","Cookie-free","No banner"]},{initial:"P",color:"linear-gradient(140deg,#5850ec,#3730a3)",name:"Plausible",description:"A tiny, cookie-free analytics script with a single clear dashboard. Paid after a free trial.",reasons:[{lead:"No cookies.",rest:"Privacy-friendly by default, so no annoying consent popup."},{lead:"Paid after a trial.",rest:"Free to try, then a monthly subscription — worth it for the polished dashboard."}],chips:["Cookie-free","Lightweight","Paid after trial"]},{initial:"F",color:"linear-gradient(140deg,#f59e0b,#b45309)",name:"Fathom",description:"Another privacy-first, fast analytics option with a clean dashboard. Paid after a free trial, like Plausible.",reasons:[{lead:"Privacy-first.",rest:"No personal data collected."},{lead:"Paid after a trial.",rest:"Free to try, then a flat monthly fee."}],chips:["Privacy-first","Fast","Paid after trial"]}],faq:[{q:"What's the single most important SEO step?",a:"Clear, unique page titles and descriptions. They're what search engines and people read first. After that, a sitemap and submitting to Google Search Console make the biggest difference."},{q:"Do I need analytics that uses cookies?",a:"No. Cookie-free tools count visits without cookies or personal data, so you get the insight without a consent banner or privacy headaches. Cloudflare Web Analytics is free; Plausible and Fathom are paid after a trial but add a more polished dashboard."}],doneLabel:"Mark analytics & SEO as set up"};function Ip({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Ik,onBack:t,onComplete:n,status:s,onRevert:r})}const dM=Object.freeze(Object.defineProperty({__proto__:null,AnalyticsSeoScreen:Ip},Symbol.toStringTag,{value:"Module"})),Dk={key:"redirects-404",Icon:tn,title:"Redirects & 404 page",crumbLabel:"Redirects & 404",meta:"Recommended · about 10 minutes",leads:[{text:"A static site serves files exactly as they're named, so a visitor who mistypes a URL or follows an old link hits a blank, unstyled error. A custom 404 page and a few redirect rules keep people on your site instead of bouncing."},{text:"These are one-time files you add to your project. Your host reads them at deploy and applies them to every request — nothing runs at request time.",dim:!0}],sections:[{heading:"A custom 404 page",bullets:[{lead:"Make the dead end friendly.",text:"Add a 404.html (Netlify, GitHub Pages) or a 404 route (most generators) with your site's header, a search box or link home, and a clear 'page not found' message."},{lead:"Match your brand.",text:"The default host error page looks broken. A styled 404 reassures visitors the site is fine — they just took a wrong turn."}]},{heading:"Redirects — don't break old links",bullets:[{lead:"Keep old URLs working.",text:"When you rename or move a page, add a redirect from the old path to the new one so bookmarks and search results still land somewhere useful."},{lead:"One rules file.",text:"A _redirects file (Netlify/Cloudflare Pages) or a netlify.toml / vercel.json block lists each from → to rule. A permanent move uses a 301 so search engines update."}]},{heading:"Trailing slashes & headers",bullets:[{lead:"Pick one URL shape.",text:"Decide whether pages live at /about or /about/ and redirect the other form to it — serving both splits your SEO and confuses analytics."},{lead:"Custom headers (optional).",text:"A _headers file lets you set caching and security headers per path without a server — useful once the basics are in place."}]}],faq:[{q:"Why doesn't my custom 404 show up?",a:"Each host has its own convention for the not-found file — a 404.html at the site root for GitHub Pages and Netlify, a 404 page/route for most generators. If yours isn't appearing, check your host's docs for the exact filename and location it expects."},{q:"When should a redirect be permanent (301) vs temporary (302)?",a:"Use a permanent 301 when a page has truly moved for good — search engines then transfer the old page's ranking to the new URL. Use a temporary 302 for short-lived redirects, like pointing to a promo page for a week."},{q:"Do I have to choose trailing slash or no trailing slash?",a:"It's worth deciding once. Serving the same page at both /about and /about/ means search engines may treat them as duplicates. Pick one and redirect the other — your generator usually has a single setting for this."}],doneLabel:"Mark redirects & 404 as set up"};function Dp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Dk,onBack:t,onComplete:n,status:s,onRevert:r})}const uM=Object.freeze(Object.defineProperty({__proto__:null,RedirectsNotFoundScreen:Dp},Symbol.toStringTag,{value:"Module"})),Lk={key:"performance-images",Icon:$e,title:"Performance & images",crumbLabel:"Performance",meta:"Recommended · about 15 minutes",leads:[{text:"A static site is already fast to serve, so its speed comes down to weight — and images are almost always the heaviest thing on the page. Get images right and most performance worries disappear."},{text:"Most of this is set up once: a build step that optimizes images and a host that caches them. After that every new page benefits automatically.",dim:!0}],sections:[{heading:"Images — the biggest win",bullets:[{lead:"Use modern formats.",text:"Serve WebP or AVIF instead of JPEG/PNG — often half the size at the same quality. Most generators have an image component or plugin that does this at build time."},{lead:"Size them to fit.",text:"Don't ship a 4000px photo into a 600px slot. Generate a few sizes and let the browser pick with srcset, so phones download a small version."},{lead:"Lazy-load below the fold.",text:`Add loading="lazy" to images that aren't visible on first paint so the page becomes interactive before they all download.`}]},{heading:"Caching & delivery",bullets:[{lead:"Let the CDN do the work.",text:"Static hosts like Netlify, Vercel, and Cloudflare Pages serve your files from a global edge network, so visitors download from a server near them."},{lead:"Cache static assets hard.",text:"Fingerprinted files (style.abc123.css) can be cached for a year — set long cache headers so repeat visits load instantly. Your generator usually fingerprints automatically."}]},{heading:"Check your work",bullets:[{lead:"Measure, don't guess.",text:"Run Lighthouse (built into Chrome DevTools) or PageSpeed Insights to see your real numbers and the few changes that would help most."}]}],faq:[{q:"What's the single biggest speed win for a static site?",a:"Optimizing images — converting to WebP/AVIF, sizing them for where they're shown, and lazy-loading the ones below the fold. Images are usually the heaviest part of a page, so this moves the needle more than anything else."},{q:"Do I need a separate CDN?",a:"Usually not. The major static hosts — Netlify, Vercel, Cloudflare Pages, GitHub Pages — already serve your site from a global edge network. A separate CDN only helps if you're hosting the files yourself on a single server."},{q:"How do I know if my site is fast enough?",a:"Run Lighthouse in Chrome DevTools or paste your URL into PageSpeed Insights. Both give you a score plus a prioritized list of fixes. Aim for the green range; chasing a perfect 100 rarely matters for visitors."}],doneLabel:"Mark performance & images as set up"};function Lp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Lk,onBack:t,onComplete:n,status:s,onRevert:r})}const hM=Object.freeze(Object.defineProperty({__proto__:null,PerformanceImagesScreen:Lp},Symbol.toStringTag,{value:"Module"})),Fk={key:"comments-search",Icon:Ee,title:"Comments & search",crumbLabel:"Comments & search",meta:"Optional · about 15 minutes",leads:[{text:"A static site has no server, but it can still feel interactive. A comments widget lets readers reply without you running anything, and a client-side search index lets them find pages instantly — both work as a drop-in script."},{text:"Neither needs a backend or a database. The comments live in a third-party service or your GitHub Discussions; the search index is built from your pages at deploy time.",dim:!0}],sections:[{heading:"Comments without a backend",bullets:[{lead:"A widget does the work.",text:"Drop a small script into your post template. The service stores and renders the thread; your page just hosts it."},{lead:"Decide who can post.",text:"GitHub-based options (Giscus, Utterances) ask readers to sign in with GitHub — great for a dev audience, less so for a general one. Hosted services accept anyone."}]},{heading:"Search across your pages",bullets:[{lead:"Build the index at deploy.",text:"A tool like Pagefind crawls your built HTML and produces a small static index. The search box loads it in the browser — no server query, no API."},{lead:"Keep it lightweight.",text:"Client-side search only loads the slice of the index it needs, so even a large site stays fast. For a huge catalog, a hosted search service is the next step up."}]}],optionsLabel:"Comment widgets",options:[{initial:"G",color:"linear-gradient(140deg,#6e40c9,#4c2889)",name:"Giscus",bestFit:!0,description:"Comments backed by your repo's GitHub Discussions — free, open-source, no ads, and no separate account to manage. Readers sign in with GitHub.",reasons:[{lead:"No service to pay for.",rest:"The threads live in your own GitHub Discussions, so there's no subscription and nothing to host."},{lead:"Privacy-friendly.",rest:"No tracking or ads — a clean fit for a personal or project site."}],chips:["Free","Open-source","GitHub login"]},{initial:"D",color:"linear-gradient(140deg,#2e9fff,#1f6fd0)",name:"Disqus",description:"The best-known hosted comments widget. Anyone can post and it's quick to add, but the free tier shows ads and loads more script.",reasons:[{lead:"Anyone can comment.",rest:"No GitHub account needed, so it suits a general audience."},{lead:"Ads on the free tier.",rest:"Removing ads and tracking means upgrading to a paid plan."}],chips:["Hosted","Open to all","Ads on free tier"]},{initial:"U",color:"linear-gradient(140deg,#24292f,#57606a)",name:"Utterances",description:"A tiny widget that stores each thread as a GitHub Issue. Even simpler than Giscus, though Discussions (Giscus) is the more modern home for comments.",reasons:[{lead:"Featherweight.",rest:"One script, threads stored as GitHub Issues."},{lead:"GitHub login.",rest:"Readers comment with their GitHub account."}],chips:["Free","Open-source","GitHub login"]}],faq:[{q:"How can a static site have comments with no backend?",a:"The comments aren't stored on your site — a third-party widget stores and renders them. Your page embeds a small script that talks to the service (or to your GitHub Discussions). Your site stays a set of static files."},{q:"Does search really work without a server?",a:"Yes. A tool like Pagefind builds a static search index from your pages when you deploy. The search box downloads just the part of the index it needs and runs the query in the browser — no server or API call."},{q:"Should I require GitHub sign-in to comment?",a:"It depends on your audience. For a developer or project site, GitHub-based comments (Giscus, Utterances) cut spam to near zero. For a general audience, a hosted widget that lets anyone post will get more participation."}],doneLabel:"Mark comments & search as set up"};function Fp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Fk,onBack:t,onComplete:n,status:s,onRevert:r})}const pM=Object.freeze(Object.defineProperty({__proto__:null,CommentsSearchScreen:Fp},Symbol.toStringTag,{value:"Module"})),Mn={crates:{kind:"crates",name:"crates.io",ecosystem:"Rust",publishCommand:"cargo publish",installCommand:"cargo add <name>",packagePage:"https://crates.io/crates/<name>"},npm:{kind:"npm",name:"npm",ecosystem:"Node.js",publishCommand:"npm publish",installCommand:"npm install <name>",packagePage:"https://www.npmjs.com/package/<name>"},pypi:{kind:"pypi",name:"PyPI",ecosystem:"Python",publishCommand:"python -m build && python -m twine upload dist/*",installCommand:"pip install <name>",packagePage:"https://pypi.org/project/<name>",note:"twine only uploads — `python -m build` has to produce the dist/ artifacts first. `uv build` then `uv publish` is the modern single-toolchain alternative."},rubygems:{kind:"rubygems",name:"RubyGems",ecosystem:"Ruby",publishCommand:"gem push <name>-<version>.gem",installCommand:"gem install <name>",packagePage:"https://rubygems.org/gems/<name>",note:"`gem build <name>.gemspec` packages the .gem first; `gem push` uploads it."},homebrew:{kind:"homebrew",name:"Homebrew",ecosystem:"macOS / Linux CLI",publishCommand:"open a formula PR to your tap (later: brew bump-formula-pr)",installCommand:"brew install <name>",packagePage:"https://formulae.brew.sh/formula/<name>",note:"Homebrew distributes binaries — it isn't a peer package registry. The initial release is a formula in your own tap repo (or a PR to homebrew-core); `brew bump-formula-pr` only bumps a formula that already exists."}},zk=[Mn.crates,Mn.npm,Mn.pypi,Mn.rubygems,Mn.homebrew];function zp(t){return Mn[t]}function $p({registry:t,onBack:n,onComplete:s,status:r,onRevert:a}){const o=t?zp(t):null;return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(rt,{size:26}),title:"Publish to a registry",meta:"Foundation · about 20 minutes",onBack:n,assistKey:"publish-registry"}),e.jsxs("p",{className:"lead",children:["This kind of project doesn't go live at a web address — it ships to a"," ",e.jsx("b",{children:"package registry"}),", where people install it with a single command or add it as a dependency. Publishing is how your work reaches its users."]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"seclabel",children:["Your registry: ",o.name," (",o.ecosystem,")"]}),e.jsxs(ce,{children:[e.jsxs(R,{lead:`Publish with \`${o.publishCommand}\`.`,children:["From a clean, committed working tree, this packages the release and uploads it to ",o.name,". Get an account and an API token first.",o.note?e.jsxs(e.Fragment,{children:[" ",o.note]}):null]}),e.jsx(R,{lead:`Users then run \`${o.installCommand}\`.`,children:"Once published, anyone can install your package with one command — no clone, no build from source."}),e.jsxs(R,{lead:"Your package gets a public page.",children:[o.name," hosts a page at"," ",e.jsx("code",{children:o.packagePage})," — the link you share so people can find, install, and trust the package."]})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Before your first publish"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Claim the name before someone else does.",children:["The package name is first-come, first-served and is your public identity — squatting is common on crates.io and PyPI. If the bare name is taken (or to protect a brand), publish under a namespace: an npm scope (",e.jsx("code",{children:"@you/tool"}),") or an org account."]}),e.jsxs(R,{lead:"Turn on two-factor auth — registries expect it.",children:[me("registry.twoFactor").value,"."," ",e.jsx(sn,{fact:me("registry.twoFactor")})," A token alone often isn't enough; set up 2FA before the release deadline, not during it."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:o.publishCommand}),e.jsx("span",{className:"chip",children:"Tokened account"}),e.jsx("span",{className:"chip",children:"Public package page"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"seclabel",children:"Pick your registry"}),e.jsx(ce,{children:zk.map(i=>e.jsxs(R,{lead:`${i.name} — ${i.ecosystem}.`,children:["Publish with ",e.jsx("code",{children:i.publishCommand}),"; users install with"," ",e.jsx("code",{children:i.installCommand}),".",i.note?e.jsxs(e.Fragment,{children:[" ",i.note]}):null]},i.kind))}),e.jsx("div",{className:"asknote",style:{marginTop:14},children:"Every registry follows the same shape: an account with an API token, one publish command, and a public package page you share. Match the registry to your toolchain."})]}),e.jsx(fe,{assistKey:"publish-registry",topicName:"Publish to a registry"}),e.jsx(ge,{label:"My package is published",note:"You can publish new versions anytime, but you can never re-publish a version once it's released — crates.io is yank-only (the release stays, just hidden from new resolves), and PyPI can delete a release but can never reuse that version number or filename. Get the first one right.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const mM=Object.freeze(Object.defineProperty({__proto__:null,PublishRegistryScreen:$p},Symbol.toStringTag,{value:"Module"}));function Bp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Versioning & changelog",meta:"About 20 minutes",onBack:t,assistKey:"versioning-changelog"}),e.jsxs("p",{className:"lead",children:["A version number is a promise. ",e.jsx("b",{children:"Semantic versioning"})," (MAJOR.MINOR.PATCH) lets people upgrade with confidence: a patch is safe, a minor adds features, a major may break them."]}),e.jsx("div",{className:"seclabel",children:"The three numbers"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"PATCH (1.2.x) — bug fixes only.",children:"Nothing user-visible changes except that something broken now works. Always safe to take."}),e.jsx(R,{lead:"MINOR (1.x.0) — new, backward-compatible features.",children:"Existing usage keeps working; there's just more available."}),e.jsx(R,{lead:"MAJOR (x.0.0) — breaking changes.",children:"You removed or changed something people relied on. Bumping major is how you warn them."}),e.jsxs(R,{lead:"Before 1.0.0 (0.x) — anything may break.",children:["The most-missed rule for new tools: while you're on a"," ",e.jsx("code",{children:"0.x"})," version, semver lets a ",e.jsx("i",{children:"minor"})," bump break things. Releasing 1.0.0 is the moment you commit to the stability promise above — don't ship it until you're ready to keep it."]})]}),e.jsx(Xo,{spaced:!0,children:e.jsxs(R,{lead:"Tag each release in git.",children:["A ",e.jsx("code",{children:"v1.2.0"}),' tag ties the version to the exact commit, so a report against "1.2.0" is reproducible. Make the tag the trigger: pushing it kicks off the CI release job that publishes that same version to the registry and attaches the binaries — so the git tag, the published version, and the release artifacts can never disagree.']})}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"MAJOR.MINOR.PATCH"}),e.jsx("span",{className:"chip",children:"CHANGELOG.md"}),e.jsx("span",{className:"chip",children:"git tag vX.Y.Z"})]}),e.jsx(fe,{assistKey:"versioning-changelog",topicName:"Versioning & changelog"}),e.jsx(ge,{label:"My versioning scheme is set",note:"Pick the scheme once; every future release just follows the same rules.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const fM=Object.freeze(Object.defineProperty({__proto__:null,VersioningChangelogScreen:Bp},Symbol.toStringTag,{value:"Module"}));function qp({registry:t,onBack:n,onComplete:s,status:r,onRevert:a}){const o=t?zp(t):null;return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Install docs",meta:"About 30 minutes · writing time",onBack:n,assistKey:"install-docs"}),e.jsxs("p",{className:"lead",children:["Your README is the front page of the package. A new user decides whether to try it in the first few lines, so lead with the"," ",e.jsx("b",{children:"install command"})," and a tiny working example."]}),e.jsx("div",{className:"seclabel",children:"A good README opens with"}),e.jsxs(ce,{children:[e.jsx(R,{lead:o?`The install command — \`${o.installCommand}\`.`:"The exact install command.",children:"One copy-pasteable line. Don't make people guess the package name or the registry it lives on."}),e.jsxs(R,{lead:"A real first command to run.",children:["For a CLI, show an actual invocation — a quickstart like"," ",e.jsx("code",{children:"yourtool init"})," and the always-works"," ",e.jsx("code",{children:"yourtool --help"})," — not a library-style code snippet. The smallest thing that does something real; people skim, so show, don't describe."]}),e.jsx(R,{lead:"Supported platforms or versions.",children:"Which OSes, language versions, or runtimes you support, so users know before they install whether it'll work for them."}),e.jsxs(R,{lead:"Badges and a link to the package page.",children:["A version / build / license badge row at the top signals the package is current and maintained, and a link to its"," ",o?o.name:"registry"," page (",e.jsx("code",{children:o?o.packagePage:"the registry listing"}),") gives readers the canonical source."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"Install line first"}),e.jsx("span",{className:"chip",children:"Real command, not a snippet"}),e.jsx("span",{className:"chip",children:"Badges + package link"}),e.jsx("span",{className:"chip",children:o?o.name:"Any registry"})]}),e.jsx(fe,{assistKey:"install-docs",topicName:"Install docs"}),e.jsx(ge,{label:"My install docs are ready",note:"Docs evolve with the project — update the README whenever the install or usage changes.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const gM=Object.freeze(Object.defineProperty({__proto__:null,InstallDocsScreen:qp},Symbol.toStringTag,{value:"Module"}));function Hp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Release builds",meta:"About 45 minutes · CI setup",onBack:t,assistKey:"release-builds"}),e.jsxs("p",{className:"lead",children:["Not everyone installs from a registry — many people just want a binary they can run. ",e.jsx("b",{children:"Cross-platform release builds"})," produce that binary for each operating system, so users download one file and go."]}),e.jsx("div",{className:"seclabel",children:"What to produce"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"One binary per target platform.",children:"Typically macOS (Intel + Apple Silicon), Linux (x86_64 + arm64), and Windows. Build each in its own job rather than cross-compiling blindly."}),e.jsx(R,{lead:"Sign and notarize the binaries.",children:"The biggest real-world gap: an unsigned download is quarantined by macOS Gatekeeper and flagged by Windows SmartScreen, so users see a scary warning instead of your tool. Sign (and notarize on macOS) as part of the release job, or distribute via Homebrew/winget where the channel handles trust."}),e.jsxs(R,{lead:"Build on a git tag, in CI.",children:["A push of ",e.jsx("code",{children:"v1.2.0"})," triggers the release workflow, so binaries always match a real, tagged version — no laptop builds. A tool like ",e.jsx("code",{children:"cargo-dist"}),", ",e.jsx("code",{children:"goreleaser"}),", or electron-builder wires up the whole matrix-build-sign-publish flow instead of you hand-writing it."]}),e.jsxs(R,{lead:"Attach them to a GitHub Release.",children:["Upload the binaries (and their checksums) to the tagged"," ",e.jsx("b",{children:"GitHub Release"})," — the common path — so the download links live next to the changelog. A package channel (Homebrew tap, winget) is the usual alternative."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"macOS · Linux · Windows"}),e.jsx("span",{className:"chip",children:"Signed + notarized"}),e.jsx("span",{className:"chip",children:"Tag-triggered CI"}),e.jsx("span",{className:"chip",children:"GitHub Releases"}),e.jsx("span",{className:"chip",children:"Checksums"})]}),e.jsx(fe,{assistKey:"release-builds",topicName:"Release builds"}),e.jsx(ge,{label:"My release builds are set up",note:"Once the workflow exists, every future tag produces binaries automatically.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const bM=Object.freeze(Object.defineProperty({__proto__:null,ReleaseBuildsScreen:Hp},Symbol.toStringTag,{value:"Module"}));function Wp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($n,{size:26}),title:"Shell completions",meta:"About 30 minutes · polish",onBack:t,assistKey:"shell-completions"}),e.jsx("p",{className:"lead",children:"Tab completion is the difference between a tool people tolerate and one they enjoy. Press Tab and the shell offers your subcommands and flags — no need to remember exact spellings."}),e.jsx("div",{className:"seclabel",children:"How it works"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Generate a completion script per shell.",children:["Most CLI frameworks emit completion scripts for ",e.jsx("code",{children:"bash"}),","," ",e.jsx("code",{children:"zsh"}),", ",e.jsx("code",{children:"fish"}),", and PowerShell from your command definitions — you don't hand-write them."]}),e.jsxs(R,{lead:"Ship a `completions` subcommand.",children:["A ",e.jsx("code",{children:"yourtool completions zsh"})," command lets users (and your install docs) print the script for their shell on demand."]}),e.jsx(R,{lead:"Document where each shell loads them.",children:"Each shell reads completions from its own directory. A short table in your README saves users the lookup."}),e.jsxs(R,{lead:"Generate a man page from the same source.",children:["The sibling polish step: most CLI frameworks also emit a"," ",e.jsx("code",{children:"man"})," page from your command definitions, so"," ",e.jsx("code",{children:"man yourtool"})," works the way completions do — generated, not hand-written."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"bash · zsh · fish"}),e.jsx("span",{className:"chip",children:"Generated, not hand-written"}),e.jsx("span",{className:"chip",children:"completions subcommand"})]}),e.jsx(fe,{assistKey:"shell-completions",topicName:"Shell completions"}),e.jsx(ge,{label:"My shell completions are ready",note:"Completions regenerate from your commands — they stay in sync as the CLI grows.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const xM=Object.freeze(Object.defineProperty({__proto__:null,ShellCompletionsScreen:Wp},Symbol.toStringTag,{value:"Module"}));function Gp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($n,{size:26}),title:"Command-line UX",meta:"About 30 minutes · the interface contract",onBack:t,assistKey:"cli-ux"}),e.jsx("p",{className:"lead",children:"A CLI's interface isn't its code — it's how it behaves at the prompt. The same four conventions show up in every tool people trust, because both a human and a shell script read your tool through them."}),e.jsx("div",{className:"seclabel",children:"The conventions every CLI follows"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"`--help` and `-h` always work, on every subcommand.",children:"The first thing anyone types at an unfamiliar tool. Each subcommand gets its own help with a one-line summary, usage, and examples — not just the top-level command."}),e.jsx(R,{lead:"`--version` prints a single line and exits 0.",children:"Scripts and bug reports parse it; keep it to just the version string so it stays machine-readable."}),e.jsxs(R,{lead:"Exit codes mean something.",children:[e.jsx("code",{children:"0"})," for success, non-zero for failure — and ideally distinct codes for distinct failures. This is how"," ",e.jsx("code",{children:"cmd && next"})," and CI know whether to continue, so an error that exits 0 silently breaks every script wrapping you."]}),e.jsx(R,{lead:"Results on stdout, diagnostics on stderr.",children:`Stdout is the data a user pipes into the next command; progress, warnings, and errors go to stderr so they don't corrupt that pipe. Getting this backwards is the most common reason a tool "doesn't work in a pipeline."`})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"--help · --version"}),e.jsx("span",{className:"chip",children:"Meaningful exit codes"}),e.jsx("span",{className:"chip",children:"stdout = data, stderr = noise"})]}),e.jsx(fe,{assistKey:"cli-ux",topicName:"Command-line UX"}),e.jsx(ge,{label:"My command-line UX is solid",note:"Nail the contract first; shell completions and man pages are the polish on top of it.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const yM=Object.freeze(Object.defineProperty({__proto__:null,CliUxScreen:Gp},Symbol.toStringTag,{value:"Module"}));function Up({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Me,{size:26}),title:"Security & supply chain",meta:"About 45 minutes · trust",onBack:t,assistKey:"supply-chain"}),e.jsx("p",{className:"lead",children:"The moment you publish, your code becomes a dependency in someone else's build — and your security becomes part of theirs. A few habits make what you ship trustworthy: audit what you depend on, catch known vulnerabilities before release, and sign the release so users can verify it's really yours."}),e.jsx("div",{className:"seclabel",children:"What a published artifact owes its users"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Audit your own dependencies.",children:["Run ",e.jsx("code",{children:"cargo audit"})," (Rust) or ",e.jsx("code",{children:"npm audit"})," /"," ",e.jsx("code",{children:"pip-audit"})," in CI so a known-vulnerable transitive dependency fails the build instead of shipping. Wire it into the same workflow that runs your tests."]}),e.jsx(R,{lead:"Scan continuously, not just once.",children:"New CVEs are disclosed against dependencies you already shipped. A scanner like Dependabot or Renovate opens update PRs as advisories land, so you're patching on the advisory's clock, not discovering it from a user's bug report."}),e.jsxs(R,{lead:"Publish an SBOM.",children:["A Software Bill of Materials lists every component and version in your release. Downstream users — especially in regulated shops — scan it to decide whether your release is safe to adopt. Most toolchains generate one (",e.jsx("code",{children:"cargo sbom"}),", ",e.jsx("code",{children:"npm sbom"}),","," ",e.jsx("code",{children:"syft"}),")."]}),e.jsxs(R,{lead:"Sign your releases so they can be verified.",children:[me("supplyChain.signedReleases").value,"."," ",e.jsx(sn,{fact:me("supplyChain.signedReleases")})," ","Pair that with published checksums (and a ",e.jsx("code",{children:"cosign"})," signature for binaries) so an install can prove it got exactly what you built."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"audit in CI"}),e.jsx("span",{className:"chip",children:"SBOM per release"}),e.jsx("span",{className:"chip",children:"Signed & verifiable"})]}),e.jsx(fe,{assistKey:"supply-chain",topicName:"Security & supply chain"}),e.jsx(ge,{label:"My supply chain is covered",note:"Wire audit + signing into CI once; every future release inherits it automatically.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const vM=Object.freeze(Object.defineProperty({__proto__:null,SupplyChainScreen:Up},Symbol.toStringTag,{value:"Module"}));function Yp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Examples & doctests",meta:"About 40 minutes · adoption",onBack:t,assistKey:"examples"}),e.jsxs("p",{className:"lead",children:["Reference docs say what each function does; ",e.jsx("b",{children:"examples"})," show how the pieces fit together to do something real. Most people copy a working example before they ever read the API reference — it's the single biggest thing you can add to make a library easy to adopt."]}),e.jsx("div",{className:"seclabel",children:"What to ship"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Runnable examples, not snippets in a README.",children:["Put complete programs in an ",e.jsx("code",{children:"examples/"})," directory that build and run as-is (",e.jsx("code",{children:"cargo run --example quickstart"}),"). A snippet a user has to assemble themselves is a snippet that's subtly wrong."]}),e.jsx(R,{lead:"Start with the one-minute quickstart.",children:"The first example should be the shortest path from install to a result. Show the 80% use case end to end before any advanced configuration — that's the example most people will actually run."}),e.jsxs(R,{lead:"Make the docs themselves runnable with doctests.",children:["A doctest is an example embedded in a doc comment that the test runner actually executes (",e.jsx("code",{children:"cargo test --doc"}),", Python's"," ",e.jsx("code",{children:"doctest"}),"). It means the snippet in your reference can't silently rot — if the API changes, the doctest fails CI."]}),e.jsxs(R,{lead:"Run examples and doctests in CI.",children:["An example that no longer compiles is worse than none — it tells users the library is unmaintained. Build the ",e.jsx("code",{children:"examples/"})," and run the doctests on every commit so a broken one fails the build."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"examples/ directory"}),e.jsx("span",{className:"chip",children:"One-minute quickstart"}),e.jsx("span",{className:"chip",children:"Doctests run in CI"})]}),e.jsx(fe,{assistKey:"examples",topicName:"Examples & doctests"}),e.jsx(ge,{label:"My examples & doctests are ready",note:"Tie them into CI once; a broken example then fails the build instead of misleading a new user.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const jM=Object.freeze(Object.defineProperty({__proto__:null,ExamplesScreen:Yp},Symbol.toStringTag,{value:"Module"}));function Vp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"API docs",meta:"Foundation · about 30 minutes",onBack:t,assistKey:"api-docs"}),e.jsxs("p",{className:"lead",children:["For a library, the public API ",e.jsx("i",{children:"is"})," the product — so its reference docs matter as much as the code. The trick is to"," ",e.jsx("b",{children:"generate docs from the source"}),", so they can't drift out of date."]}),e.jsx("div",{className:"seclabel",children:"Generate, don't hand-write"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Doc comments on every public item.",children:"Document each exported function, type, and field where it's defined. The generator turns those comments into the reference site."}),e.jsxs(R,{lead:"A generator for your language.",children:[e.jsx("code",{children:"docs.rs"})," for Rust, ",e.jsx("code",{children:"TypeDoc"})," for TypeScript,"," ",e.jsx("code",{children:"Sphinx"})," (or the more modern"," ",e.jsx("code",{children:"MkDocs + mkdocstrings"}),") for Python — each reads your source and produces a browsable site."]}),e.jsx(R,{lead:"Publish on every release.",children:"Many registries (docs.rs) build docs automatically on publish; for others, a CI step deploys them. Either way, the live docs track the released version."})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"docs.rs · TypeDoc · Sphinx"}),e.jsx("span",{className:"chip",children:"From doc comments"}),e.jsx("span",{className:"chip",children:"Auto-built on publish"})]}),e.jsx(fe,{assistKey:"api-docs",topicName:"API docs"}),e.jsx(ge,{label:"My API docs are published",note:"Because they're generated from source, the docs refresh themselves on every release.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const wM=Object.freeze(Object.defineProperty({__proto__:null,ApiDocsScreen:Vp},Symbol.toStringTag,{value:"Module"})),$k={key:"api-docs",Icon:Ee,title:"API docs",crumbLabel:"API docs",meta:"Foundation · about 8 minutes",leads:[{text:"Your service speaks HTTP, but a URL alone tells a caller nothing about which routes exist, what to send, or what comes back. API docs are that contract — one machine-readable description of every endpoint that humans can read and tools can consume."},{text:"The standard is OpenAPI (the spec format Swagger tools read). One OpenAPI document becomes browsable docs, a try-it console, and client code — all from the same source of truth.",dim:!0}],sections:[{heading:"What goes in the docs",bullets:[{lead:"Every route.",text:"The method and path (GET /orders, POST /orders/{id}/refund), what each one does, and which need authentication."},{lead:"Request & response shapes.",text:"The fields, types, and examples for what a caller sends and what they get back — including the error responses, not just the happy path."},{lead:"Auth.",text:"How a caller proves who they are — the API key header or bearer token your endpoints expect."}]},{heading:"Generate it, don't hand-maintain it",bullets:[{lead:"From your code.",text:"Most frameworks emit the OpenAPI spec from the routes you already wrote — FastAPI and NestJS produce it automatically; Express adds it with a plugin. The docs can't drift from the code because they come from the code."},{lead:"Or author it by hand.",text:"For a small or contract-first API you can write the OpenAPI YAML yourself. It's more work to keep in sync, so reserve it for when you're designing the API before building it."}]},{heading:"Serve it so people can use it",bullets:[{lead:"An interactive console.",text:"Swagger UI, Redoc, or Scalar turn the spec into a browsable page with a try-it form — a caller can hit a real endpoint without writing any code first."},{lead:"Keep it from drifting.",text:"Regenerate the spec in CI and fail the build if it changes unexpectedly, so the published docs always match the deployed API."}]}],faq:[{q:"Isn't this the same as the library 'API docs'?",a:"No. A library's API docs (docs.rs, TypeDoc, Sphinx) describe code others import into their own program. A service's API docs describe HTTP endpoints others call over the network — different audience, different format. OpenAPI/Swagger is the service one."},{q:"Swagger or OpenAPI — what's the difference?",a:"OpenAPI is the specification (the document format). Swagger is the family of tools — Swagger UI, Swagger Editor — that read and render an OpenAPI document. You write OpenAPI; you view it with Swagger UI (or Redoc, or Scalar)."},{q:"Do I have to write the spec by hand?",a:"Usually not. If your framework can emit OpenAPI from your route definitions, let it — generated docs stay in sync automatically. Hand-authoring is for contract-first designs where the spec comes before the implementation."}],doneLabel:"Mark API docs as set up",doneNote:"Generate the spec from your code where you can — auto-generated docs can't fall out of sync with the API."};function Kp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:$k,onBack:t,onComplete:n,status:s,onRevert:r})}const _M=Object.freeze(Object.defineProperty({__proto__:null,BackendApiDocsScreen:Kp},Symbol.toStringTag,{value:"Module"}));function Jp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Versioning policy",meta:"About 20 minutes · a decision",onBack:t,assistKey:"semver-policy"}),e.jsxs("p",{className:"lead",children:["Other people's code depends on yours. A breaking change you ship quietly breaks their builds. A written ",e.jsx("b",{children:"versioning policy"})," is the promise that makes your library safe to depend on."]}),e.jsx("div",{className:"seclabel",children:"Decide and write down"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"What counts as a breaking change.",children:"Removing or renaming a public item, changing a signature, tightening accepted input. Anything a user's code could rely on is part of the contract."}),e.jsx(R,{lead:"How you signal it.",children:"Breaking changes mean a MAJOR bump. Spell out that the public API is covered and what's explicitly *not* (internal modules, anything marked unstable)."}),e.jsx(R,{lead:"Your deprecation path.",children:"Mark an item deprecated for at least one minor release before removing it, so users get a warning and time to migrate — not a surprise."}),e.jsxs(R,{lead:"Let a tool catch breaks for you.",children:["You don't have to spot every breaking change by eye:"," ",e.jsx("code",{children:"cargo-semver-checks"})," (Rust) and"," ",e.jsx("code",{children:"api-extractor"})," (TypeScript) diff your public API against the last release and fail CI when a change needs a MAJOR bump."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"Public API = the contract"}),e.jsx("span",{className:"chip",children:"Breaking → MAJOR"}),e.jsx("span",{className:"chip",children:"Deprecate before removing"})]}),e.jsx(fe,{assistKey:"semver-policy",topicName:"Versioning policy"}),e.jsx(ge,{label:"My versioning policy is set",note:"Write it in the README once; it guides every release decision afterward.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const kM=Object.freeze(Object.defineProperty({__proto__:null,SemverPolicyScreen:Jp},Symbol.toStringTag,{value:"Module"}));function Xp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Readme & license",meta:"About 30 minutes",onBack:t,assistKey:"readme-license"}),e.jsxs("p",{className:"lead",children:["Two files decide whether someone adopts your library: the"," ",e.jsx("b",{children:"README"})," tells them what it does, and the ",e.jsx("b",{children:"license"}),` tells them whether they're allowed to use it. Skip the license and the legal default is "all rights reserved" — nobody can.`]}),e.jsx("div",{className:"seclabel",children:"A README that earns trust"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"One sentence: what it is and who it's for.",children:"The first line should let a reader decide in seconds whether to keep reading."}),e.jsx(R,{lead:"Install + a minimal example.",children:'The fastest path from "interested" to "it works on my machine".'})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Pick a license"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Permissive (MIT, Apache-2.0) — easiest to adopt.",children:"Lets people use your library in almost any project. Apache-2.0 also grants patent rights, which some companies require."}),e.jsxs(R,{lead:"Library copyleft (LGPL, MPL-2.0) — share changes, not callers.",children:["For a library, the relevant copyleft is ",e.jsx("b",{children:"LGPL"})," or"," ",e.jsx("b",{children:"MPL-2.0"}),": changes to your code stay open, but code that merely links to or imports it doesn't have to be. Full ",e.jsx("b",{children:"GPL"})," forces every consumer to be GPL too, which usually kills adoption for a library — reach for it only on purpose."]})]}),e.jsx(ce,{children:e.jsxs(R,{lead:"Declare the license in your package manifest, too.",children:["A LICENSE file alone isn't enough — set the ",e.jsx("code",{children:"license"})," field in your manifest (",e.jsx("code",{children:"Cargo.toml"}),", ",e.jsx("code",{children:"package.json"}),","," ",e.jsx("code",{children:"pyproject.toml"}),") so the registry detects and displays it on the package page."]})}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"README first line"}),e.jsx("span",{className:"chip",children:"LICENSE file + manifest field"}),e.jsx("span",{className:"chip",children:"MIT · Apache-2.0 · LGPL/MPL"})]}),e.jsx(fe,{assistKey:"readme-license",topicName:"Readme & license"}),e.jsx(ge,{label:"My readme & license are in place",note:"A LICENSE file is a one-time decision that unblocks everyone who wants to use your work.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const SM=Object.freeze(Object.defineProperty({__proto__:null,ReadmeLicenseScreen:Xp},Symbol.toStringTag,{value:"Module"}));function Qp({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(vt,{size:26}),title:"Changelog & CI",meta:"About 40 minutes · automation",onBack:t,assistKey:"changelog-ci"}),e.jsx("p",{className:"lead",children:"A changelog tells people what changed before they upgrade; CI makes sure every release is tested and published the same way. Together they turn releasing from a careful manual ritual into a tagged, repeatable step."}),e.jsx(Xo,{}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Automate the release"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"CI runs tests on every change.",children:"A green pipeline is the precondition for any release — no publishing from an untested commit."}),e.jsxs(R,{lead:"A tag triggers publish.",children:["Pushing ",e.jsx("code",{children:"v1.2.0"})," runs the release job: test, build, and publish to the registry. The version published always matches the tag."]}),e.jsxs(R,{lead:"Give CI a way to authenticate.",children:["The release job needs publish credentials. The classic path is a registry token in a CI secret (",e.jsx("code",{children:"CARGO_REGISTRY_TOKEN"}),","," ",e.jsx("code",{children:"NPM_TOKEN"}),"). The current best practice is"," ",e.jsx("b",{children:"OIDC trusted publishing"}),": ",me("registry.oidc").value,"."," ",e.jsx(sn,{fact:me("registry.oidc")})]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"CHANGELOG.md"}),e.jsx("span",{className:"chip",children:"Tests on every push"}),e.jsx("span",{className:"chip",children:"Tag → publish"}),e.jsx("span",{className:"chip",children:"OIDC or token"})]}),e.jsx(fe,{assistKey:"changelog-ci",topicName:"Changelog & CI"}),e.jsx(ge,{label:"My changelog & CI are set up",note:"Once the pipeline exists, releasing is just pushing a tag — the rest runs itself.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const NM=Object.freeze(Object.defineProperty({__proto__:null,ChangelogCiScreen:Qp},Symbol.toStringTag,{value:"Module"})),Bk=me("flyio.pricing"),qk={key:"deploy-target",connector:{provider:"render"},Icon:vn,title:"Deploy target",meta:"Foundation · about 10 minutes",leads:[{text:"Right now your service only runs on your machine. A deploy target is where it runs for real — always on, with a public endpoint other apps can call."},{text:"You don't need to manage servers. A container host runs your service the way it already works locally; we'll walk through each step.",dim:!0}],recommendLabel:"Recommended for your service",recommended:{initial:"F",color:"linear-gradient(140deg,#7c4dff,#5b2ecc)",name:"Fly.io",bestFit:!0,description:"A container host that runs your service close to your users — a good fit when low latency or running near your data matters. A simple, standard home for a long-running API.",reasons:[{lead:"Pricing.",rest:Bk.value},{lead:"Runs your container as-is.",rest:"It behaves just like it does locally — no proprietary runtime to learn."},{lead:"A public endpoint included.",rest:"Your service gets an HTTPS URL other apps can call right away."}],chips:["Edge / low-latency","Always-on","~5 min to set up"]},alternatives:[{initial:"R",color:"linear-gradient(140deg,#22c55e,#15803d)",name:"Render",description:"Beginner-friendly: connect your repo and every git push deploys. Managed Postgres lives in the same dashboard, so your DB and service sit side by side. A good first deploy if you don't need edge locality."},{initial:"R",color:"linear-gradient(140deg,#6366f1,#4338ca)",name:"Railway",description:"Also git-push to deploy with managed Postgres in-dashboard. Quick to wire up a service plus its database; usage-based pricing once you're past the starter allowance."},{initial:"S",color:"linear-gradient(140deg,#f59e0b,#b45309)",name:"Serverless",description:"Spins up per request and scales to zero. Cheapest when traffic is spiky — but a long-running, stateful service that holds database connection pools fits it poorly: each cold start reconnects, and execution limits cut off long requests."},{initial:"V",color:"linear-gradient(140deg,#16a3a3,#0d6e6e)",name:"Virtual machine",description:"A full server you control end to end. Most flexible, but you own patching, scaling, and uptime yourself."}],ctaLabel:"📦 Deploy to a container host",ctaNote:"We'll deploy this one service. Nothing else is touched.",faq:[{q:"What does deploying actually do?",a:"It packages your service into a container, runs it on an always-on host, and gives it a public endpoint. Your local copy keeps working exactly as before."},{q:"Do I need to understand servers?",a:"No. The container host handles the machines, networking, and restarts. You ship your service and get back a URL."},{q:"Can I take it down?",a:"Anytime. You can stop or delete the deployment with one action and it goes back to running only on your machine."},{q:"Will it reach my database once it's deployed?",a:"Only after you point it there. The deployed service reads DATABASE_URL from its host's secret store — set that to your managed database's connection string (see the Real data step), not the localhost URL you use on your machine."}],flowLabels:["Connect","Deploy","Go live"],connect:{heading:"🔗 Connect your container host",sub:"This account holds your running service. If you don't have one yet, you'll create it in a few clicks.",grants:["Create one app to run your service","Give it a public endpoint","Nothing else — we can't touch your other resources"],continueLabel:"Continue with Fly.io",reassure:"We only ask for what's needed to run this one service. You can disconnect anytime."},provisionTitle:"Putting your service online…",provisionDesc:"This usually takes under a minute. We'll let you know when the endpoint is live.",provisionSteps:["Building your container image","Pushing it to the host","Assigning a public endpoint","Starting the service"],ready:{title:"Your service is live",desc:"It's running on a container host and reachable at this endpoint.",resultLabel:"Service endpoint",resultValue:"your-service.onrender.com",donePill:"Deploy target is now set up"}};function Zp({onBack:t,onComplete:n,onRevert:s}){return e.jsx(Ss,{config:qk,onBack:t,onComplete:n,onRevert:s})}const CM=Object.freeze(Object.defineProperty({__proto__:null,DeployTargetScreen:Zp},Symbol.toStringTag,{value:"Module"})),Hk={key:"database-backups",Icon:ks,title:"Backups & migrations",crumbLabel:"Backups",meta:"Foundation · about 10 minutes",leads:[{text:"Once a real database holds data people care about, two things keep it safe: backups, so a bad deploy or a dropped table is recoverable, and migrations, so changing the database's shape never loses what's already stored."},{text:"Most managed databases take automated backups for you — your job is to know how far back they reach and to practice restoring one before you need it.",dim:!0}],sections:[{heading:"Backups: the safety net",bullets:[{lead:"Automated daily backups —",text:"your host snapshots the whole database on a schedule, with no action from you."},{lead:"Point-in-time recovery —",text:"rewind the database to any moment (e.g. just before a bad migration), not just to last night's snapshot."},{lead:"Test the restore —",text:"a backup you've never restored is a guess. Restore one into a scratch database once so you know the steps work."}]},{heading:"Migrations: changing the shape safely",bullets:[{lead:"Versioned, in source control —",text:"each change to the schema is a small, ordered file checked in with your code, so every environment applies the same steps."},{lead:"Run on deploy —",text:"the migration runs as part of shipping, before the new code serves traffic, so the database and the code always match."},{lead:"Forward-only and reversible —",text:"prefer additive changes (add a column, backfill, then drop the old one) so a rollback never strands data."}]}],faq:[{q:"Doesn't my database host already back up for me?",a:"Usually yes — but the retention window varies, and free tiers often keep little or nothing. Check how many days you can recover, and whether point-in-time recovery is included or a paid add-on."},{q:"What's the difference between a backup and a migration?",a:"A backup protects the data you already have. A migration changes the structure that holds it (new tables, new columns). You need both: migrations to evolve the schema, backups in case a migration — or anything else — goes wrong."},{q:"Can I just edit the database by hand when I need a change?",a:"It works once, then bites you: other environments drift, and there's no record of what changed. A migration file makes the change repeatable and reviewable, and runs the same way everywhere."}],doneLabel:"Mark backups & migrations as set up",doneNote:"Confirm your backup retention window and run your first migration on deploy — you can revisit both anytime."};function em({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Hk,onBack:t,onComplete:n,status:s,onRevert:r})}const PM=Object.freeze(Object.defineProperty({__proto__:null,DatabaseBackupsScreen:em},Symbol.toStringTag,{value:"Module"}));function Wk(){const[t,n]=l.useState(null);return l.useEffect(()=>{let s=!1;return(async()=>{try{const r=await fetch("/api/setup-env");if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();s||n(a)}catch{s||n(null)}})(),()=>{s=!0}},[]),{env:t}}const Gk={heading:"The secrets a service usually needs",bullets:[{lead:"DATABASE_URL —",text:"the connection string for your managed database."},{lead:"JWT_SECRET / API keys —",text:"the values that sign tokens and authenticate callers."},{lead:"Third-party keys —",text:"Stripe, email, or other provider credentials your service calls."}]};function tm(t,n){const s=[...t,...n];return s.length===0?Gk:{heading:"This project's secrets",bullets:s.map(r=>({lead:`${r} —`,text:n.includes(r)?"needed by a service this project already uses; set its value in your host's secret store.":"from your .env.example; set its value in your host's secret store, never in source control."}))}}function nm(t,n){return{key:"secrets",Icon:Me,title:"Secrets & config",crumbLabel:"Secrets",meta:"Foundation · about 5 minutes",leads:[{text:"Your service needs passwords, API keys, and connection strings to do its job — but those must never live in your code. You set them once per environment, and the host hands them to your service at runtime."},{text:"The names come from your .env.example; the real values stay in your host's secret store, never in source control.",dim:!0}],sections:[tm(t,n),{heading:"How it works",bullets:[{lead:"One set per environment.",text:"Development, staging, and production each get their own values, so a test key can't leak into production."},{lead:"Set, don't commit.",text:"You paste each value into the host's secret store once. Rotating a key later is a one-field change, no redeploy of code."}]}],faq:[{q:"Why not just put them in a config file?",a:"A committed secret is a leaked secret — anyone with repo access (or a fork, or git history) has it forever. Secret stores keep values out of source and let you rotate without a code change."},{q:"How does my service read them?",a:"The host injects each secret as an environment variable at runtime. Your code reads them the same way it reads your local .env — nothing app-side changes between environments."}],doneLabel:"Mark secrets as set up",doneNote:"You can add or rotate individual secrets anytime without touching code."}}function sm({onBack:t,onComplete:n,status:s,onRevert:r}){const{env:a}=Wk(),o=nm((a==null?void 0:a.envKeys)??[],(a==null?void 0:a.serviceEnvVars)??[]);return e.jsx(et,{config:o,onBack:t,onComplete:n,status:s,onRevert:r})}const TM=Object.freeze(Object.defineProperty({__proto__:null,SecretsScreen:sm,buildConfig:nm,secretsSection:tm},Symbol.toStringTag,{value:"Module"})),Uk={key:"api-auth",Icon:Me,title:"API authentication",crumbLabel:"API auth",meta:"Foundation · about 8 minutes",leads:[{text:"An open endpoint is a public endpoint. Authentication decides who may call your service, and rate limiting decides how often — together they keep your API from being abused or accidentally hammered."},{text:"A service authenticates callers — other services, scripts, partners — not interactive human logins.",dim:!0}],sections:[{heading:"Who may call — two kinds of credential",bullets:[{lead:"Static API keys.",text:"An opaque secret string each caller sends on every request. Simple to issue; you revoke a leaked one server-side. Best for trusted clients you control."},{lead:"Signed tokens (JWT).",text:"A bearer token that carries claims (who, what scope) and expires on its own, so a leaked one stops working without a server lookup. Best when callers come and go or need scoped access."}]},{heading:"How often — rate limiting",bullets:[{lead:"Per-key limits.",text:"Cap authenticated callers per window — e.g. 100 / minute. Fixed-window is simplest; token-bucket smooths bursts by refilling allowance steadily instead of resetting on a hard clock edge. Either way overflow gets a clean 429 Too Many Requests instead of taking the service down."},{lead:"Limit unauthenticated traffic too.",text:"Throttle by client IP before auth runs, so a flood of un-keyed requests can't exhaust the service trying to log in or hammer public routes."}]},{heading:"Verifying it's really them — request signing",bullets:[{lead:"HMAC signatures.",text:"For service-to-service and webhooks, the caller signs each request body with a shared secret (the Stripe-webhook / AWS-style scheme) and you verify the signature — proving the payload wasn't tampered with, not just that a key was presented."},{lead:"mTLS (optional).",text:"For high-trust internal calls, both sides present certificates so the connection itself authenticates the caller before any request is read."}]},{heading:"Sensible defaults",body:"Start with API keys or short-lived JWTs, per-key limits with an IP limit on unauthenticated routes, and a 429 on overflow. Keep keys and signing secrets in your secret store so you can rotate them without a redeploy."}],faq:[{q:"Keys or OAuth?",a:"For service-to-service calls, API keys or signed tokens are simpler and enough. Reach for OAuth when third parties act on behalf of your users, not just for machine callers."},{q:"Where do limits live?",a:"Usually at the edge or in middleware, keyed by the caller's API key. That way a noisy client is throttled before it reaches your handlers."}],doneLabel:"Mark API auth as set up",doneNote:"Start strict — loosening a limit later is easy; tightening one after launch is harder."};function rm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Uk,onBack:t,onComplete:n,status:s,onRevert:r})}const OM=Object.freeze(Object.defineProperty({__proto__:null,ApiAuthScreen:rm},Symbol.toStringTag,{value:"Module"})),Yk={key:"cors-origins",Icon:tn,title:"Allowed origins (CORS)",crumbLabel:"CORS",meta:"Common · about 5 minutes",leads:[{text:"If a website running in someone's browser calls your API, the browser first checks whether your API allows that website. CORS — Cross-Origin Resource Sharing — is how your API answers 'yes, this origin is allowed.' Get it wrong and the browser blocks the call before your code ever sees it."},{text:"This only affects browser calls. Requests from your own server, a mobile app, or a tool like curl aren't subject to CORS at all.",dim:!0}],sections:[{heading:"What an 'origin' is",bullets:[{lead:"Scheme + host + port —",text:"https://app.example.com is one origin; http://app.example.com and https://example.com are different origins."},{lead:"You list the ones you trust —",text:"your API replies with an Access-Control-Allow-Origin header naming the sites permitted to read its responses."},{lead:"Don't reflect everything —",text:"allowing every origin (a wildcard) defeats the point and breaks cookies/credentials. List the specific front-ends you control."}]},{heading:"Getting it right per environment",bullets:[{lead:"Local + production differ.",text:"http://localhost:5173 in development, https://your-app.com in production — both go on the allow-list, ideally read from config, not hard-coded."},{lead:"Credentials need extra care.",text:"If the browser sends cookies or an auth header, you must name the exact origin (no wildcard) and set the allow-credentials flag."},{lead:"Preflight is automatic.",text:"For anything beyond a simple GET, the browser sends an OPTIONS 'preflight' first. Your CORS layer answers it — you rarely write that by hand."}]}],faq:[{q:"I got a 'blocked by CORS policy' error — what does it mean?",a:"The browser asked your API whether the current website is allowed, and your API didn't say yes for that origin. Add the website's exact origin (scheme, host, and port) to your allow-list and the call will go through."},{q:"Why not just allow all origins with a wildcard?",a:"A wildcard lets any site on the internet call your API from a user's browser, and it can't be combined with cookies or credentials. List the specific front-ends you own instead."},{q:"My API works from curl but not the browser — why?",a:"CORS is a browser rule, not a server rule. curl and your own backend ignore it; only browser JavaScript is gated. That's why a missing origin shows up only once a web front-end calls the API."}],doneLabel:"Mark allowed origins as set up",doneNote:"Add each front-end's origin to the allow-list per environment — you can adjust the list anytime without a code change beyond config."};function am({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Yk,onBack:t,onComplete:n,status:s,onRevert:r})}const AM=Object.freeze(Object.defineProperty({__proto__:null,CorsOriginsScreen:am},Symbol.toStringTag,{value:"Module"})),Vk={key:"background-jobs",Icon:$e,title:"Background jobs",crumbLabel:"Background jobs",meta:"Common · about 10 minutes",leads:[{text:"Some work shouldn't happen while a user waits for a response — sending a welcome email, resizing an upload, calling a slow third-party API, or running a nightly cleanup. Background jobs move that work onto a queue so your API answers immediately and the work happens just after."},{text:"A job runner gives you three things a plain request can't: it retries on failure, it survives a restart, and it can run on a schedule.",dim:!0}],sections:[{heading:"What you'd push to the background",bullets:[{lead:"Anything slow —",text:"emails, webhooks, image/video processing, report generation. The user gets an instant 'on its way' instead of a spinner."},{lead:"Anything scheduled —",text:"nightly cleanup, daily digests, expiring old sessions. A cron-style timer enqueues the job for you."},{lead:"Anything that can fail and retry —",text:"a flaky external API is fine in a job: it retries with backoff instead of failing the user's request."}]},{heading:"How a job queue works",bullets:[{lead:"Enqueue, don't block.",text:"Your endpoint adds a job to the queue and returns. The caller doesn't wait for the work to finish."},{lead:"A worker picks it up.",text:"A separate worker process pulls jobs off the queue and runs them — you scale workers independently of your API."},{lead:"Retries with backoff.",text:"If a job throws, the runner re-runs it after a growing delay, up to a limit, then parks it in a dead-letter queue for you to inspect."}]}],faq:[{q:"Can't I just run the work in the request and not worry about a queue?",a:"For something instant, yes. But slow work makes every caller wait, and a crash mid-request loses the work with no retry. A queue keeps responses fast and makes the work durable."},{q:"Do I need a separate server for workers?",a:"Not necessarily — a worker can be a second process on the same host. What matters is that it's separate from the web process, so a burst of jobs doesn't slow down serving requests."},{q:"What happens if a job keeps failing?",a:"After the retry limit it lands in a dead-letter queue: it stops retrying, and you get a record to investigate instead of an infinite loop or silent loss."}],doneLabel:"Mark background jobs as set up",doneNote:"Start with one job — a welcome email is a good first move — then add scheduled and retrying jobs as you need them."};function om({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Vk,onBack:t,onComplete:n,status:s,onRevert:r})}const RM=Object.freeze(Object.defineProperty({__proto__:null,BackgroundJobsScreen:om},Symbol.toStringTag,{value:"Module"})),Kk={key:"logging-monitoring",Icon:vt,title:"Logging & monitoring",crumbLabel:"Monitoring",meta:"Foundation · about 8 minutes",leads:[{text:"A service has no screen to glance at — observability is how you know it's alive and well. You wire up logs, metrics, alerts, and uptime checks once, then you find out about problems before your users do."},{text:"You don't have to build this yourself — hosts and tools provide it; you decide what to watch.",dim:!0}],sections:[{heading:"The four things to watch",bullets:[{lead:"Logs.",text:"A searchable record of what happened — every request, error, and warning. The first place you look when something breaks."},{lead:"Metrics.",text:"Numbers over time: request rate, error rate, latency. They show trends a single log line can't."},{lead:"Alerts.",text:"Rules that page you when a metric crosses a line, so you don't have to stare at dashboards."},{lead:"Uptime checks.",text:"An outside service pings a health endpoint on a schedule and tells you the moment the service stops responding."}]},{heading:"Tools that do this for you",bullets:[{lead:"Errors —",text:"Sentry captures every exception with the stack trace and the request that caused it."},{lead:"Metrics & dashboards —",text:"Grafana + Prometheus (self-hosted), or Datadog / Better Stack (managed) for request-rate, error-rate, and latency graphs."},{lead:"Logs —",text:"Axiom or Loki to search structured logs, or your host's built-in log viewer to start."},{lead:"Uptime —",text:"UptimeRobot or Better Stack pings your /health endpoint and alerts you the moment it stops answering."}]},{heading:"One standard to instrument with",body:"Instrument your service with OpenTelemetry — the vendor-neutral standard for emitting logs, metrics, and traces. You add it once, then point it at whichever backend above you choose, and you can switch tools later without re-instrumenting your code."},{heading:"A good starting point",body:"Ship structured logs, expose request-rate / error-rate / latency metrics, add one error-rate alert, and point an uptime check at a /health endpoint. That covers the most common 3am surprises."}],faq:[{q:"Isn't this overkill for a small service?",a:"Even one error-rate alert and an uptime check pay for themselves the first time the service goes down while you're asleep. Start small; add detail as you grow."},{q:"What's a health endpoint?",a:"A tiny route (often /health) that returns 200 when the service can serve traffic. Uptime checks and load balancers ping it to decide if the service is alive."}],doneLabel:"Mark monitoring as set up",doneNote:"Start with logs, one alert, and an uptime check — you can always add more signals later."};function im({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsx(et,{config:Kk,onBack:t,onComplete:n,status:s,onRevert:r})}const EM=Object.freeze(Object.defineProperty({__proto__:null,LoggingMonitoringScreen:im},Symbol.toStringTag,{value:"Module"}));function Ja({onBack:t,onComplete:n,status:s,onRevert:r}){const a=[{q:"Is a preview the same build as production?",a:"If you wire it up right, yes — a preview deploy runs the same build command and the same framework output as production, just on a throwaway URL. That's the whole point: what you click on the preview is what ships. Where it can differ is data and secrets — a preview usually points at a staging database, not prod — so test behavior on the preview, but don't trust preview data as if it were live."},{q:"Can I share it without making it public?",a:"Yes. Most hosts let you password-protect a preview or restrict it to your team's accounts, so you can hand a reviewer or a client a working link before the production domain points anywhere. Protect previews by default if the build exposes anything you wouldn't want indexed — search engines and link unfurlers will otherwise crawl an open preview URL."},{q:"Do I need a separate staging environment too?",a:"Per-branch previews are throwaway and rebuilt on every push. A longer-lived staging environment is the complement: one stable URL, its own data, that behaves like prod and stays up between deploys — useful for QA sign-off, demos, and integrations that need a fixed address. Many teams use preview deploys for review and one staging environment as the final gate before production."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Staging & preview deploys",meta:"About 15 minutes · then automatic on every push",onBack:t,assistKey:"staging-preview"}),e.jsx("p",{className:"lead",children:"Before you point your real domain at anything, give yourself a prod-like URL to test on and share. Most hosts can build one for you on every push, so you and your reviewers see the exact build that will go live — without anyone touching production."}),e.jsx("div",{className:"seclabel",children:"Per-branch preview deploys"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Get a URL for every branch or pull request.",children:["Hosts like ",e.jsx("b",{children:"Vercel"})," and ",e.jsx("b",{children:"Netlify"})," build a fresh deploy each time you push and give it its own URL. The preview runs the same build as production, so it's the real thing on a throwaway address — not a local approximation."]}),e.jsx(R,{lead:"Review the change on the preview, not on prod.",children:"Open the preview URL for the branch, click through the actual change, and only merge once it looks right. This is where you catch a broken build or a layout regression before it can reach a visitor."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"A shared staging environment"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Keep one stable, prod-like URL with its own data.",children:"A longer-lived staging environment behaves like production — same build, its own database and config — but stays up between deploys. It's the fixed address QA, demos, and integrations point at while per-branch previews come and go."}),e.jsx(R,{lead:"Promote the same build to production.",children:"When staging looks right, promote that build to production rather than rebuilding from scratch. What you signed off on is what ships, so going live is a flip of the switch, not a fresh roll of the dice."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Share it privately"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Password-protect or restrict the preview.",children:"So you can hand a working link to a client or teammate before going public, protect the preview with a password or limit it to your team's accounts. Most hosts offer this as a one-click setting per deploy."}),e.jsx(R,{lead:"Keep previews out of search.",children:"A protected preview won't get indexed or unfurled. Turn protection on by default if the build shows anything you wouldn't want a crawler to find before launch day."})]}),e.jsx(Ve,{items:a}),e.jsx(fe,{assistKey:"staging-preview",topicName:"Staging & preview deploys"}),e.jsx(ge,{label:"I've set up staging & previews",note:"From here, every push gives you a prod-like URL to test and share before anything reaches your real domain.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const MM=Object.freeze(Object.defineProperty({__proto__:null,StagingPreviewScreen:Ja},Symbol.toStringTag,{value:"Module"}));function lm({onBack:t,onComplete:n,status:s,onRevert:r}){const a=[{q:"Why not just point staging at the production database?",a:"Because a staging environment exists to let you break things safely, and the fastest way to lose that is to share prod's data. A bad migration, a destructive test, or a runaway job on staging would then corrupt or leak real customer data. Staging gets its own database — ideally seeded from a sanitized copy of prod so it's realistic — and its own secrets, so nothing you do there can touch production."},{q:"What does staging actually catch that local doesn't?",a:"The things that only exist once you deploy: the real migration running against a populated database, environment variables and secrets resolved the production way, the actual platform's networking and timeouts, and the deploy pipeline itself. Local runs against a tiny dev database and your own machine's config — staging runs the same pipeline you'll run for prod, so a green deploy there is real evidence prod will be green too."},{q:"How do I get a build from staging to production?",a:"Promote the exact artifact you validated rather than rebuilding for prod. Run the migration on staging first, confirm the service is healthy, then promote that same build to production and run the same migration there. Because staging already rehearsed every step, the production deploy is a repeat of something that just worked — not a first attempt under pressure."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Staging environment",meta:"About 30 minutes · a one-time environment to stand up",onBack:t,assistKey:"staging-environment"}),e.jsx("p",{className:"lead",children:"A staging environment is a full, prod-like copy of your service you can deploy to and exercise before anything reaches real users. It runs the same pipeline as production but has its own data and secrets — so a deploy there is a rehearsal, not a gamble."}),e.jsx("div",{className:"seclabel",children:"Make it prod-like, but isolated"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Give staging its own database and secrets.",children:"Never point staging at production data. Stand up a separate database — ideally seeded from a sanitized copy of prod so it's realistic — and a separate set of secrets, so anything you break on staging can't touch a real customer."}),e.jsx(R,{lead:"Run the same deploy pipeline as production.",children:"Deploy to staging with the exact build and release steps you'll use for prod. The value is in the sameness: if the pipeline is green on staging, that's real evidence it'll be green on production."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Rehearse the risky parts"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Run schema migrations on staging first.",children:"A migration against a populated database is where deploys most often go wrong. Run it on staging — with prod-like data volume — and you find the slow lock or the bad backfill before it's holding up real traffic."}),e.jsx(R,{lead:"Spin up a per-branch environment when you need one.",children:"For a risky change, an ephemeral environment built just for that branch lets you test it in isolation and tear it down afterward — the backend analog of a per-branch preview deploy."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Promote to production"}),e.jsx(ce,{children:e.jsx(R,{lead:"Ship the build you already validated.",children:"When staging is healthy, promote that same build to production rather than rebuilding. Run the migration on prod just as you rehearsed on staging — going live becomes a repeat of something that just worked."})}),e.jsx(Ve,{items:a}),e.jsx(fe,{assistKey:"staging-environment",topicName:"Staging environment"}),e.jsx(ge,{label:"I've set up a staging environment",note:"From here, every change can be deployed and exercised on staging — migrations and all — before you promote it to production.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const IM=Object.freeze(Object.defineProperty({__proto__:null,StagingEnvironmentScreen:lm},Symbol.toStringTag,{value:"Module"}));function Xa({onBack:t,onComplete:n,status:s,onRevert:r}){const a=[{q:"Will a pre-release accidentally become what everyone installs?",a:"Not if you publish it correctly. A plain install (`install pkg`) resolves the `latest` tag, and a pre-release is published under a different tag — `next` or `beta` — so it never moves `latest`. On top of that, a semver pre-release version like `1.2.0-rc.1` is excluded from normal version ranges by default, so a dependent on `^1.1.0` won't auto-adopt it. You have to opt in twice to get a pre-release, which is the whole point."},{q:"How does a tester actually get the pre-release?",a:"They opt in explicitly. For a package, that's installing the tag — `install pkg@next` — or pinning the exact pre-release version. For a binary, it's downloading the build attached to a GitHub pre-release rather than the latest stable release. Either way it's a deliberate choice, so the people on the pre-release channel are exactly the people who asked to test it."},{q:"How do I promote a pre-release to stable?",a:"When the pre-release has held up, cut the stable version (drop the `-rc.1` suffix, e.g. `1.2.0`) and publish it to `latest` — or mark the GitHub release as the latest, not a pre-release. Everyone on a normal install picks it up from there. The pre-release channel keeps running for the next round; promoting one build to stable doesn't shut it down."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Pre-release channel",meta:"About 15 minutes · then one extra command per pre-release",onBack:t,assistKey:"pre-release-channel"}),e.jsxs("p",{className:"lead",children:["A pre-release lets people test the next version before it's stable — without changing what everyone gets by default. You publish it on a separate channel, testers opt in, and your ",e.jsx("code",{children:"latest"})," stays exactly where it is until you're ready to promote."]}),e.jsx("div",{className:"seclabel",children:"Publish on a separate channel"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Use a next / beta tag instead of latest.",children:["Publish the pre-release under a dist-tag like ",e.jsx("code",{children:"next"})," or"," ",e.jsx("code",{children:"beta"})," (npm), a ",e.jsx("code",{children:"--pre"})," flag on other registries, or a GitHub ",e.jsx("b",{children:"pre-release"})," for binaries. A normal install still resolves ",e.jsx("code",{children:"latest"}),", so the default install is untouched."]}),e.jsxs(R,{lead:"Tag a semver pre-release version.",children:["Version it with a pre-release identifier — ",e.jsx("code",{children:"1.2.0-rc.1"}),","," ",e.jsx("code",{children:"1.2.0-beta.2"}),". Semver excludes these from ordinary version ranges, so a dependent on ",e.jsx("code",{children:"^1.1.0"})," won't pull it in by accident. It takes a deliberate opt-in to land on a pre-release."]})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Let testers opt in"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Tell testers the one install command.",children:["A tester installs the channel explicitly — ",e.jsx("code",{children:"install pkg@next"})," ","— or downloads the build attached to the GitHub pre-release. The people on the channel are exactly the ones who asked to be there."]}),e.jsx(R,{lead:"Gather feedback before it's everyone's problem.",children:"Because the pre-release reaches only opt-in testers, a rough edge gets caught by people who expect a rough edge — not by your whole user base on a normal install."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Promote to stable"}),e.jsx(ce,{children:e.jsxs(R,{lead:"Cut the stable version when it holds up.",children:["Drop the pre-release suffix (",e.jsx("code",{children:"1.2.0-rc.1"})," →"," ",e.jsx("code",{children:"1.2.0"}),") and publish it to ",e.jsx("code",{children:"latest"}),", or mark the GitHub release as latest. Everyone on a normal install picks it up — and the channel stays open for the next round."]})}),e.jsx(Ve,{items:a}),e.jsx(fe,{assistKey:"pre-release-channel",topicName:"Pre-release channel"}),e.jsx(ge,{label:"I've set up a pre-release channel",note:"From here, testers can opt into the next version on its own tag while your latest stays stable until you promote.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const DM=Object.freeze(Object.defineProperty({__proto__:null,PreReleaseScreen:Xa},Symbol.toStringTag,{value:"Module"}));function be(t,n){return["You are helping inside my actual codeyam project — this is real work in a real repository, not a hypothetical.","Before doing anything, read `.codeyam/stack.json` and the relevant source and config files so your help fits this project's stack. Prefer concrete edits and commands over generic advice.","",`I want to set up **${t}**. ${n}`,"","Walk me through it and make the changes you safely can in my project, asking me before anything destructive."].join(`
|
|
29
|
+
`)}const Jk={"staging-preview":{Icon:$e,title:"Staging & preview deploys",crumbLabel:"Staging & previews",meta:"Recommended · about 5 minutes",lead:"Get a private link for every change before it goes public. You (or a teammate) can open the app exactly as it will ship, try it, and share it for feedback — without touching what real visitors see.",journey:[{emoji:"🧪",label:"A change",sub:"Not public yet"},{emoji:"🔗",label:"Preview link",sub:"Share and try it",lime:!0},{emoji:"🚀",label:"Ship it",sub:"Only once it's right"}],chatPrompt:be("staging & preview deploys","I want a private preview URL for each change and a staging environment I can share before anything goes public."),faqs:[{q:"How is a preview different from the live app?",a:"A preview is a private copy of one specific change, at its own link. Real visitors never see it — you use it to check and share a change before it becomes the live app everyone sees."},{q:"Do I need a separate staging environment too?",a:"A per-change preview covers most feedback. A longer-lived staging environment is useful when you want a stable, shareable place that mirrors production for testing over time — you can have both."},{q:"Will previews affect real data?",a:"No. Previews are isolated, so trying things in one can't change what real visitors see or the data they rely on."}]},"custom-domain":{Icon:tn,title:"Custom domain",meta:"Optional · about 10 minutes",lead:"Put your app on your own web address instead of the default link. Visitors see a name that's yours — easier to remember, trust, and share.",journey:[{emoji:"🔗",label:"Default link",sub:"Works, but generic"},{emoji:"🌐",label:"Your domain",sub:"yourname.com",lime:!0},{emoji:"🤝",label:"People trust it",sub:"Easy to remember"}],chatPrompt:be("a custom domain","I want my app to live on my own web address. Help me point a domain I own (or pick one) at my app and set it up so it loads securely."),faqs:[{q:"Do I need to buy a domain first?",a:"Yes — you register the name you want with any domain registrar (usually a few dollars a year). After that, you point it at your app once and it's live on your address."},{q:"Is it secure (https)?",a:"Yes. A security certificate is set up for your domain automatically, so visitors get the padlock and an encrypted connection with nothing to manage."},{q:"Can I keep the old link too?",a:"Yes. The default link keeps working; your custom domain is an additional, friendlier front door."}]},accounts:{Icon:Me,title:"Accounts & sign-in",meta:"Foundation · about 10 minutes",lead:"Let people create an account and sign in safely, so the app can remember who they are and keep each person's things private to them.",journey:[{emoji:"🙋",label:"A visitor",sub:"Anonymous"},{emoji:"🔑",label:"Signs in",sub:"Safely, once",lime:!0},{emoji:"🗂️",label:"Their own space",sub:"Private to them"}],chatPrompt:be("accounts & sign-in","I want people to be able to sign up and log in securely, so the app knows who each person is and keeps their data private."),faqs:[{q:"Do I have to handle passwords myself?",a:"No. Sign-in is handled by a trusted service, so passwords are stored and checked securely for you — you never keep raw passwords, and you can offer options like email links or Google sign-in."},{q:"How does the app keep one person's data private?",a:"Once someone signs in, the app knows which records are theirs and only shows those. Access rules enforce it, so one person can never see another's information."},{q:"Can people sign in with Google or email?",a:"Yes. You can offer several ways to sign in — email link, password, or providers like Google — and add more later without changing the rest of the app."}]},emails:{Icon:Gn,title:"Sending emails",meta:"Recommended · about 5 minutes",lead:"Send the everyday emails an app needs — a welcome, a password reset, a receipt — reliably, so they land in the inbox instead of spam.",journey:[{emoji:"⚡",label:"Something happens",sub:"A signup, a reset"},{emoji:"✉️",label:"An email is sent",sub:"Automatically",lime:!0},{emoji:"📥",label:"In their inbox",sub:"Not spam"}],chatPrompt:be("sending emails","I want my app to send transactional emails (welcome, password reset, receipts) reliably so they reach the inbox."),faqs:[{q:"Why not just send email from my own server?",a:"Mail sent that way usually lands in spam. A dedicated sending service builds the reputation and authentication that gets your emails delivered to the inbox."},{q:"What emails will my app actually send?",a:"The common ones: a welcome or verification message, password resets, and receipts or notifications. You add more as your app grows."},{q:"Can I design how the emails look?",a:"Yes. Emails use templates you can style to match your app, with the person's details filled in automatically."}]},payments:{Icon:qt,title:"Accept payments",meta:"Optional · about 15 minutes",lead:"Charge for your product or service safely. People pay with a card and the money reaches you — you never handle or store card numbers yourself.",journey:[{emoji:"🛒",label:"They want to buy",sub:"Product or plan"},{emoji:"💳",label:"Pay securely",sub:"Card handled for you",lime:!0},{emoji:"💰",label:"You get paid",sub:"Money reaches you"}],chatPrompt:be("accepting payments","I want to charge for my product or service — one-off payments or subscriptions — with card details handled securely by a payment provider."),faqs:[{q:"Is it safe to take card payments?",a:"Yes. A payment provider collects and stores the card details on secure, certified systems. Your app never sees or stores a card number, which keeps you safe and compliant."},{q:"One-off payments or subscriptions?",a:"Both. You can charge once for a purchase or set up recurring subscriptions — the provider handles renewals, receipts, and failed-payment retries."},{q:"What does it cost?",a:"Providers take a small percentage per transaction with no monthly fee to start, so you only pay when you actually get paid."}]},"analytics-monitoring":{Icon:vt,title:"Analytics & monitoring",crumbLabel:"Analytics",meta:"Recommended · about 5 minutes",lead:"See how people use your app and catch errors early. Instead of guessing, you get simple numbers on what's used — and an alert when something breaks.",journey:[{emoji:"👀",label:"People use the app",sub:"Every day"},{emoji:"📊",label:"You see what happens",sub:"Usage and errors",lime:!0},{emoji:"🛠️",label:"Fix it early",sub:"Before it spreads"}],chatPrompt:be("analytics & monitoring","I want to see how people use my app and get alerted when errors happen, so I can catch problems early."),faqs:[{q:"What's the difference between analytics and monitoring?",a:"Analytics tells you what people do — which pages and features they use. Monitoring watches for errors and slowdowns and alerts you when something breaks. You usually want both."},{q:"Is this respectful of privacy?",a:"You can use privacy-friendly analytics that measure usage without tracking individuals, and keep error reports free of personal data. It's about patterns, not spying."},{q:"Will it slow my app down?",a:"No. These tools are lightweight and load in the background, so visitors don't notice them."}]},"database-backups":{Icon:rt,title:"Data backups & deletion",crumbLabel:"Backups & deletion",meta:"Recommended · about 10 minutes",lead:"Keep safe copies of your data so nothing is lost, and be able to honor a person's request to export or delete their information.",journey:[{emoji:"🗄️",label:"Your data",sub:"The real thing"},{emoji:"💾",label:"Backed up",sub:"Safe copies",lime:!0},{emoji:"♻️",label:"Restore or delete",sub:"On request"}],chatPrompt:be("data backups & deletion","I want regular backups of my data plus a way to export or delete a person's information when they ask (GDPR/CCPA)."),faqs:[{q:"How often should I back up?",a:"Automatic daily backups cover most apps, with the ability to restore to a recent point if something goes wrong. Keep your own periodic export too, especially on free tiers."},{q:"Why do I need export and delete?",a:"Privacy laws like GDPR and CCPA give people the right to get a copy of their data or have it deleted. Being able to honor those requests keeps you compliant and trustworthy."},{q:"Does deleting one person's data break anything?",a:"Handled properly, no. Their records are removed while shared data stays intact, so the app keeps working for everyone else."}]},legal:{Icon:Ee,title:"Privacy & legal",meta:"Recommended · about 10 minutes",lead:"Give your app the basics it needs to be trustworthy and above-board: a privacy policy and terms, written in plain language, that say what you collect and how you use it.",journey:[{emoji:"❓",label:"What do you collect?",sub:"People wonder"},{emoji:"📄",label:"Privacy & terms",sub:"Clear answers",lime:!0},{emoji:"✅",label:"Trusted & compliant",sub:"Above board"}],chatPrompt:be("privacy & legal","I want a plain-language privacy policy and terms of service that match what my app actually collects and does."),faqs:[{q:"Do I really need a privacy policy?",a:"If your app collects any personal data — even just emails — most laws and app stores require one. It also builds trust by being upfront about what you do with people's information."},{q:"Can I just copy someone else's?",a:"It's better to generate one that matches what your app actually collects and uses. A copied policy that doesn't fit your app can be misleading and legally risky."},{q:"Is this legal advice?",a:"No — these are sensible defaults to get you started. For anything high-stakes, have a professional review the final wording."}]},forms:{Icon:Ee,title:"Forms",meta:"Optional · about 5 minutes",lead:"Collect what people type — a contact message, a signup, feedback — and make sure it actually reaches you, cleanly and without spam.",journey:[{emoji:"⌨️",label:"They fill it in",sub:"A message, a signup"},{emoji:"📨",label:"It reaches you",sub:"Clean, no spam",lime:!0},{emoji:"📬",label:"You follow up",sub:"Nothing lost"}],chatPrompt:be("forms","I want the forms in my app (contact, signup, feedback) to reliably deliver what people submit to me, with basic validation and spam protection."),faqs:[{q:"Where do form submissions go?",a:"You choose — an email to you, a saved record, or both. The important part is that nothing gets silently dropped."},{q:"How do I keep out spam?",a:"Basic protection like a hidden check or a light challenge blocks most automated spam without annoying real people."},{q:"Can I require certain fields?",a:"Yes. Validation makes sure required fields are filled and formatted correctly before a submission goes through, so you get usable information."}]},"data-safety":{Icon:Me,title:"Data safety",meta:"Recommended · about 10 minutes",lead:"Be clear and careful about the information your app handles: collect only what you need, keep it protected, and be able to explain exactly what you store and why.",journey:[{emoji:"📥",label:"You collect data",sub:"Only what's needed"},{emoji:"🔒",label:"Kept protected",sub:"Access controlled",lime:!0},{emoji:"📋",label:"Explained clearly",sub:"Nothing hidden"}],chatPrompt:be("data safety","I want to review what personal data my app collects and stores, minimize it, protect it, and be able to declare it clearly (e.g. for an app store data-safety form)."),faqs:[{q:"What counts as sensitive data?",a:"Anything that identifies a person — names, emails, location, payment details — plus anything private they share. The safest rule is to collect only what your app truly needs."},{q:"Why declare what I collect?",a:"App stores and privacy laws expect an honest summary of what you collect and why. A clear declaration builds trust and avoids removal or fines."},{q:"How is the data protected?",a:"It's encrypted in transit and at rest, and access rules limit who and what can read it — so even stored data isn't freely readable."}]},secrets:{Icon:Me,title:"Secrets & API keys",crumbLabel:"Secrets",meta:"Foundation · about 5 minutes",lead:"Keep the keys and passwords your app depends on out of the code and in a safe place, so they're never exposed and easy to rotate.",journey:[{emoji:"🔑",label:"Keys & passwords",sub:"Your app needs them"},{emoji:"🗝️",label:"In a safe store",sub:"Never in code",lime:!0},{emoji:"🔄",label:"Easy to rotate",sub:"One place to change"}],chatPrompt:be("secrets & API keys","I want my app's secrets (API keys, tokens, passwords) kept out of the code in a secure store, and easy to rotate."),faqs:[{q:"Why can't I just put keys in the code?",a:"Anything in the code can leak — through your repository, your build, or the browser. Secrets belong in a separate secure store the app reads at runtime, never in the source."},{q:"What is 'rotating' a key?",a:"Replacing a secret with a fresh one — routine hygiene, or urgent if one leaks. When secrets live in one store, rotating is a single change with no code edit."},{q:"Do different environments need different keys?",a:"Usually yes. Test and production use separate keys so a mistake in testing can't touch real data or real charges."}]},publish:{Icon:$e,title:"Publish & go live",meta:"Foundation · about 10 minutes",lead:"Take your app from running only on your machine to a real link anyone can open. You don't need to understand servers — it's set up for you.",journey:[{emoji:"💻",label:"Your computer",sub:"Only you can see it"},{emoji:"☁️",label:"Published",sub:"A home online",lime:!0},{emoji:"🌍",label:"Anyone, anywhere",sub:"Opens with a link"}],chatPrompt:be("publishing my app","I want to put my app online so anyone can open it with a link."),faqs:[{q:"Do I need to understand servers?",a:"No. Publishing is handled for you — you connect a host once and your app goes live on a link, with nothing to run or maintain yourself."},{q:"Is there a cost to publish?",a:"You can start on a free tier that comfortably covers a new app. You only pay once it grows, and you'll see it coming."},{q:"Can I use my own web address?",a:"Yes. You launch on a free link today and can add a custom domain whenever you like."}]},"analytics-seo":{Icon:tn,title:"Analytics & SEO",meta:"Recommended · about 10 minutes",lead:"Help people find your app and understand what they do once they arrive. Good SEO gets you into search results; analytics shows you what's working.",journey:[{emoji:"🔎",label:"People search",sub:"For what you offer"},{emoji:"📈",label:"Found & measured",sub:"Ranked and tracked",lime:!0},{emoji:"🎯",label:"You improve",sub:"Based on real data"}],chatPrompt:be("analytics & SEO","I want my app to show up well in search results and to see how visitors find and use it."),faqs:[{q:"What actually helps SEO?",a:"Clear titles and descriptions, fast pages, sensible links, and a sitemap search engines can read. Most of it is set-and-forget once configured."},{q:"How is this different from analytics-only?",a:"SEO is about being found; analytics is about understanding what happens after. Together they close the loop from discovery to improvement."},{q:"Can I do this privately?",a:"Yes. Privacy-friendly analytics measure traffic and behavior in aggregate without tracking individuals."}]},"comments-search":{Icon:rt,title:"Comments & search",meta:"Optional · about 15 minutes",lead:"Let people discuss your content and find things quickly. Comments add a conversation; search helps visitors get to what they want in seconds.",journey:[{emoji:"📚",label:"Lots of content",sub:"Hard to navigate"},{emoji:"🔍",label:"Search & comments",sub:"Find and discuss",lime:!0},{emoji:"💬",label:"People engage",sub:"And stick around"}],chatPrompt:be("comments & search","I want visitors to be able to search my content and leave comments."),faqs:[{q:"Do I have to build search myself?",a:"No. A search service indexes your content and returns fast, typo-tolerant results, which is far better than a hand-rolled search."},{q:"How do I keep comments civil?",a:"You can require sign-in, add moderation, and filter spam, so the conversation stays useful without constant babysitting."},{q:"Will search slow my app down?",a:"No. Search runs on a dedicated service, so results are fast even as your content grows."}]},"performance-images":{Icon:$e,title:"Performance & images",crumbLabel:"Performance",meta:"Recommended · about 10 minutes",lead:"Make your app fast, especially its images. Faster pages feel better, keep people around, and rank higher — and images are usually the biggest win.",journey:[{emoji:"🐌",label:"Heavy pages",sub:"Slow to load"},{emoji:"🗜️",label:"Optimized",sub:"Right-sized images",lime:!0},{emoji:"⚡",label:"Fast for everyone",sub:"On any device"}],chatPrompt:be("performance & images","I want my app to load fast — especially by optimizing and right-sizing images and cutting anything that slows pages down."),faqs:[{q:"Why are images such a big deal?",a:"Images are usually the heaviest thing on a page. Right-sizing and compressing them, and loading them only when needed, is the single biggest speed win."},{q:"How do I know if my app is slow?",a:"A quick performance check gives you a score plus a prioritized list of fixes. Aim for the green range; chasing a perfect score rarely matters."},{q:"Will optimizing hurt image quality?",a:"No, when done right. Modern formats keep images looking sharp at a fraction of the size."}]},"background-jobs":{Icon:rt,title:"Background jobs",meta:"Optional · about 15 minutes",lead:"Do slow or scheduled work out of the way of the person waiting — sending a batch of emails, resizing uploads, running a nightly task — so the app stays snappy.",journey:[{emoji:"⏳",label:"Slow work",sub:"Blocks the user"},{emoji:"📮",label:"Queued",sub:"Runs in the background",lime:!0},{emoji:"✅",label:"Done later",sub:"App stays fast"}],chatPrompt:be("background jobs","I want to run slow or scheduled work (emails, image processing, nightly tasks) in the background so requests stay fast."),faqs:[{q:"When do I need background jobs?",a:"Whenever work takes more than a moment — sending many emails, processing files, or anything on a schedule. Doing it inline makes people wait or times out."},{q:"What if a job fails?",a:"A queue retries failed jobs and keeps a record, so a temporary hiccup doesn't silently drop work."},{q:"Can I run tasks on a schedule?",a:"Yes. You can run jobs at set times — nightly cleanups, weekly digests — without anyone triggering them."}]},"logging-monitoring":{Icon:vt,title:"Logging & monitoring",crumbLabel:"Logging",meta:"Recommended · about 10 minutes",lead:"Know what your app is doing and hear about problems fast. Logs record what happened; monitoring alerts you when something breaks or slows down.",journey:[{emoji:"🌫️",label:"Something breaks",sub:"You don't know"},{emoji:"📡",label:"Logged & watched",sub:"Alerts you fast",lime:!0},{emoji:"🔧",label:"You fix it",sub:"Before users notice"}],chatPrompt:be("logging & monitoring","I want centralized logs and alerts so I hear about errors and slowdowns quickly and can trace what happened."),faqs:[{q:"Aren't logs just noise?",a:"Structured logs, searchable in one place, turn noise into answers — you can trace exactly what happened around an error instead of guessing."},{q:"What should alert me?",a:"Errors, crashes, and unusual slowness. Good alerting tells you about real problems without crying wolf."},{q:"Does this expose user data?",a:"It shouldn't. Logs are set up to avoid capturing personal or secret data, so they're safe to keep and search."}]},"cors-origins":{Icon:tn,title:"CORS & allowed origins",crumbLabel:"CORS",meta:"Foundation · about 5 minutes",lead:"Decide which websites are allowed to call your app's API. Set it too open and anyone can use your backend; too strict and your own site breaks.",journey:[{emoji:"🌐",label:"Requests arrive",sub:"From many sites"},{emoji:"🚦",label:"Origins checked",sub:"Allow the right ones",lime:!0},{emoji:"🛡️",label:"Safe & working",sub:"Your site only"}],chatPrompt:be("CORS & allowed origins","I want to configure which origins are allowed to call my API — permissive enough for my own site, strict enough to keep others out."),faqs:[{q:"What is an 'origin'?",a:"The website an API request comes from. CORS rules say which origins your API will answer, so only your app (and any you approve) can use it from a browser."},{q:"Why not just allow everything?",a:"Allowing every origin lets any site call your API from a user's browser, which can be abused. Listing the ones you actually use is safer."},{q:"My site's requests are being blocked — why?",a:"Usually the origin isn't on the allow list, or a preflight check isn't handled. Adding your origin and allowing the right methods fixes it."}]},"api-auth":{Icon:Me,title:"API authentication",crumbLabel:"API auth",meta:"Foundation · about 10 minutes",lead:"Make sure only the right callers can use your API. Each request proves who it is with a key or token, so your backend isn't open to the world.",journey:[{emoji:"📨",label:"A request",sub:"Who's calling?"},{emoji:"🎟️",label:"Proves identity",sub:"Key or token",lime:!0},{emoji:"✅",label:"Allowed in",sub:"Only if valid"}],chatPrompt:be("API authentication","I want my API to require a key or token so only authorized callers can use it, with a safe way to issue and revoke access."),faqs:[{q:"Keys or tokens — what's the difference?",a:"An API key is a simple secret for server-to-server use. Tokens (like JWTs) carry identity and expire, which fits user-facing apps. Many APIs use both."},{q:"How do I revoke access?",a:"Issue credentials you can turn off individually, so if one leaks you disable just that key without affecting everyone else."},{q:"Is an API key enough on its own?",a:"For internal use, often yes. For sensitive actions, combine it with per-user permissions so a valid key can't do more than it should."}]},"deploy-target":{Icon:vn,title:"Deploy target",meta:"Foundation · about 10 minutes",lead:"Choose where your app runs when it's live and wire it up once. After that, shipping an update is a single, repeatable step.",journey:[{emoji:"📦",label:"Your app",sub:"Ready to ship"},{emoji:"🎯",label:"A deploy target",sub:"Where it runs",lime:!0},{emoji:"🔁",label:"Ship anytime",sub:"One repeatable step"}],chatPrompt:be("a deploy target","I want to pick where my app runs in production for my stack and set up a repeatable way to deploy to it."),faqs:[{q:"How do I pick a target?",a:"It depends on your stack — some hosts specialize in certain frameworks or containers. The goal is a place that runs your app well with the least setup."},{q:"What makes deploys repeatable?",a:"Wiring the target once so every deploy runs the same build and release steps, which removes surprises and lets you ship confidently."},{q:"Can I move hosts later?",a:"Yes, especially if your app is packaged in a standard way. Choosing a portable setup keeps your options open."}]},"deploy-previews":{Icon:$e,title:"Deploy previews",meta:"Recommended · about 5 minutes",lead:"Get a private link for every change before it's public, so you can see the site exactly as it will ship and share it for feedback.",journey:[{emoji:"✏️",label:"A change",sub:"Not public yet"},{emoji:"🔗",label:"Preview link",sub:"See it live",lime:!0},{emoji:"🚀",label:"Publish",sub:"Once it's right"}],chatPrompt:be("deploy previews","I want a private preview link generated for each change so I can review and share the site before it goes public."),faqs:[{q:"How is a preview different from the live site?",a:"A preview is a private build of one change at its own link. Visitors never see it — it's for checking and sharing before it becomes the public site."},{q:"Do previews cost extra?",a:"Usually they're included with hosting and clean themselves up, so you get the safety net without ongoing cost or clutter."},{q:"Can I share a preview with a client?",a:"Yes. Send the preview link and they see the exact change, with no effect on the live site."}]},"staging-environment":{Icon:vn,title:"Staging environment",crumbLabel:"Staging",meta:"Recommended · about 15 minutes",lead:"A full, prod-like copy of your app with its own data, where you can rehearse changes and migrations safely before promoting them to production.",journey:[{emoji:"🧱",label:"A real change",sub:"Risky in prod"},{emoji:"🏗️",label:"Try it in staging",sub:"Prod-like, own data",lime:!0},{emoji:"⬆️",label:"Promote",sub:"Confidently to prod"}],chatPrompt:be("a staging environment","I want a production-like staging environment with its own data where I can rehearse changes and migrations before promoting to production."),faqs:[{q:"How is staging different from a preview?",a:"A preview is a throwaway link for one change. Staging is a stable, long-lived environment that mirrors production — ideal for testing data migrations and integrations over time."},{q:"Does staging need its own data?",a:"Yes. Separate, realistic data lets you rehearse safely without touching real users' information."},{q:"What does 'promote' mean?",a:"Moving a verified change from staging to production in a controlled step, so what you tested is exactly what ships."}]},"publish-registry":{Icon:rt,title:"Publish to a registry",crumbLabel:"Publish package",meta:"Foundation · about 10 minutes",lead:"Make your package installable by others. Publishing to a registry means anyone can add it to their project with a single install command.",journey:[{emoji:"📦",label:"Your package",sub:"On your machine"},{emoji:"🏷️",label:"Published",sub:"To a registry",lime:!0},{emoji:"⬇️",label:"Others install it",sub:"One command"}],chatPrompt:be("publishing to a registry","I want to publish my package to the right registry for my ecosystem so others can install it, with sensible metadata and access set up."),faqs:[{q:"Which registry should I use?",a:"The standard one for your language or ecosystem, so people can install with the tool they already use. codeyam can pick the right one for your stack."},{q:"What metadata matters?",a:"A clear name, description, version, license, and links. Good metadata helps people find and trust your package."},{q:"Can I publish privately?",a:"Yes. Registries support private or scoped packages when you only want your team to install it."}]},"readme-license":{Icon:Ee,title:"README & license",meta:"Foundation · about 10 minutes",lead:"Give your project the two things every visitor looks for first: a README that explains what it is and how to use it, and a license that says what people may do with it.",journey:[{emoji:"❓",label:"What is this?",sub:"Visitors wonder"},{emoji:"📖",label:"README & license",sub:"Clear answers",lime:!0},{emoji:"🤝",label:"People use it",sub:"With confidence"}],chatPrompt:be("a README & license","I want a clear README that explains what my project is and how to use it, plus an appropriate open-source license."),faqs:[{q:"What should a README cover?",a:"What the project does, how to install and use it, a quick example, and where to get help. First-time visitors decide in seconds, so lead with the essentials."},{q:"Which license should I pick?",a:"It depends on how open you want to be. Permissive licenses let people do almost anything; copyleft ones require sharing changes. codeyam can suggest one for your goals."},{q:"Do I really need a license?",a:"Yes — without one, others legally can't reuse your code. A license removes that doubt and sets clear terms."}]},"semver-policy":{Icon:rt,title:"Versioning policy",crumbLabel:"Versioning",meta:"Foundation · about 5 minutes",lead:"Number your releases so people know what to expect. A clear policy tells users when an update is safe and when it might break something.",journey:[{emoji:"🔢",label:"You release",sub:"Again and again"},{emoji:"📐",label:"Versioned clearly",sub:"Major.minor.patch",lime:!0},{emoji:"😌",label:"Users upgrade safely",sub:"No surprises"}],chatPrompt:be("a versioning policy","I want to adopt a clear version-numbering policy (like semver) so users know when an update is a safe fix versus a breaking change."),faqs:[{q:"What does major.minor.patch mean?",a:"Patch is a safe bug fix, minor adds features without breaking anything, and major may break existing use. The numbers set expectations at a glance."},{q:"When do I bump the major version?",a:"Only when you change or remove something people depend on. Reserving major bumps for real breaks keeps upgrades low-stress."},{q:"Do I have to follow semver exactly?",a:"It's the widely understood default, so following it means fewer surprises. You can adapt it, but document whatever policy you choose."}]},"versioning-changelog":{Icon:Ee,title:"Versioning & changelog",crumbLabel:"Changelog",meta:"Recommended · about 5 minutes",lead:"Keep a running list of what changed in each release, so users can see what's new, what's fixed, and what to watch out for before they upgrade.",journey:[{emoji:"🔁",label:"You ship changes",sub:"Every release"},{emoji:"📝",label:"Recorded",sub:"In a changelog",lime:!0},{emoji:"👀",label:"Users know",sub:"What changed & why"}],chatPrompt:be("a changelog","I want to maintain a clear changelog of what changes in each release so users can see what's new, fixed, or breaking."),faqs:[{q:"What goes in a changelog?",a:"Grouped notes per version — added, changed, fixed, and removed — written for the people who use your project, not raw commit messages."},{q:"Can it be generated automatically?",a:"Partly. Structured commits or release notes can draft the changelog for you; a human pass keeps it readable."},{q:"Why not just use commit history?",a:"Commits are for developers. A changelog is a curated, user-facing summary that's far easier to scan before upgrading."}]},"changelog-ci":{Icon:Ee,title:"Changelog & CI",meta:"Recommended · about 10 minutes",lead:"Automate the boring parts of releasing: let your pipeline build, test, and assemble release notes so shipping a version is reliable and repeatable.",journey:[{emoji:"🧑💻",label:"You merge a change",sub:"That's the trigger"},{emoji:"🤖",label:"CI runs",sub:"Build, test, notes",lime:!0},{emoji:"🚀",label:"Released",sub:"Reliably, every time"}],chatPrompt:be("changelog & CI","I want a CI pipeline that builds, tests, and helps assemble release notes so releasing a version is automated and reliable."),faqs:[{q:"What is CI, simply?",a:"Continuous integration: an automated pipeline that builds and tests every change, so problems are caught early and releases are consistent."},{q:"How does it help the changelog?",a:"CI can gather release notes from your changes and publish them alongside the build, so the changelog stays current without manual effort."},{q:"Is this overkill for a small project?",a:"Even a minimal pipeline that runs tests on every change pays off quickly by catching breakage before your users do."}]},"install-docs":{Icon:Ee,title:"Install & usage docs",crumbLabel:"Docs",meta:"Recommended · about 10 minutes",lead:"Show people how to install and use your project, with copy-paste steps and a working example. Good docs are the difference between adoption and abandonment.",journey:[{emoji:"🤔",label:"How do I use this?",sub:"Newcomers ask"},{emoji:"📘",label:"Clear docs",sub:"Install & examples",lime:!0},{emoji:"🚀",label:"Up and running",sub:"In minutes"}],chatPrompt:be("install & usage docs","I want clear installation and usage documentation with copy-paste steps and a working example so people can get started fast."),faqs:[{q:"What makes docs good?",a:"A fast path from zero to a working example, exact commands people can copy, and answers to the first questions they'll hit. Show, don't just tell."},{q:"How much is enough to start?",a:"Install, a minimal usage example, and one common task. You can expand as questions come in."},{q:"Where should docs live?",a:"Start in the README so they're the first thing visitors see; move to a docs site once there's more than a page or two."}]},examples:{Icon:rt,title:"Examples",meta:"Optional · about 10 minutes",lead:"Give people runnable examples that show your project solving real tasks. A working sample teaches faster than paragraphs of explanation.",journey:[{emoji:"📄",label:"Just docs",sub:"Abstract"},{emoji:"🧩",label:"Runnable examples",sub:"Real tasks",lime:!0},{emoji:"💡",label:"It clicks",sub:"People get it fast"}],chatPrompt:be("examples","I want a set of runnable examples that show my project solving real tasks, so people learn it by seeing it work."),faqs:[{q:"How many examples do I need?",a:"A few that cover the most common uses beat a dozen niche ones. Start with the tasks people ask about most."},{q:"Should examples be runnable?",a:"Ideally yes — a sample people can run and tweak teaches far faster than a snippet they have to assemble themselves."},{q:"Where do examples belong?",a:"In an examples folder or a docs section, linked from the README so newcomers find them immediately."}]},"release-builds":{Icon:$e,title:"Release builds",meta:"Foundation · about 10 minutes",lead:"Turn your source into the finished artifacts people actually download and run — for each platform — in a repeatable, trustworthy way.",journey:[{emoji:"🧾",label:"Your source",sub:"Not yet packaged"},{emoji:"🏭",label:"Built for release",sub:"Every platform",lime:!0},{emoji:"⬇️",label:"People run it",sub:"Ready to download"}],chatPrompt:be("release builds","I want a repeatable way to produce release artifacts for each platform my project targets, ready for people to download and run."),faqs:[{q:"Why not just share the source?",a:"Most users want something ready to run, not to build it themselves. Release builds give them a finished artifact for their platform."},{q:"How do I build for multiple platforms?",a:"An automated pipeline can produce builds for each target in one go, so you don't need every platform on your own machine."},{q:"How do people trust a build?",a:"Publishing checksums or signatures lets people verify a download is genuine and unmodified."}]},"shell-completions":{Icon:$n,title:"Shell completions",crumbLabel:"Completions",meta:"Optional · about 5 minutes",lead:"Let your command-line tool autocomplete its own commands and options, so users tab through it instead of memorizing flags.",journey:[{emoji:"⌨️",label:"They type",sub:"And guess flags"},{emoji:"⇥",label:"Tab completes",sub:"Commands & options",lime:!0},{emoji:"😎",label:"Faster, no memorizing",sub:"It just flows"}],chatPrompt:be("shell completions","I want my CLI to provide tab-completion for its commands and options across common shells, with simple install instructions."),faqs:[{q:"Which shells should I support?",a:"The common ones your users have — typically bash, zsh, and fish. Most CLI frameworks can generate completions for all of them."},{q:"How do users enable them?",a:"Usually one command that installs the completion file for their shell. Clear instructions make it a one-time step."},{q:"Do completions stay in sync with my commands?",a:"When generated from your CLI's own definitions, yes — they update as your commands change, so they never drift."}]},"cli-ux":{Icon:$n,title:"CLI experience",crumbLabel:"CLI UX",meta:"Recommended · about 10 minutes",lead:"Make your command-line tool a pleasure to use: clear help, helpful errors, sensible defaults, and output that reads well. Good CLI UX earns loyal users.",journey:[{emoji:"😕",label:"Cryptic tool",sub:"Confusing errors"},{emoji:"✨",label:"Polished CLI",sub:"Clear help & output",lime:!0},{emoji:"❤️",label:"Users love it",sub:"And recommend it"}],chatPrompt:be("the CLI experience","I want to polish my CLI's usability — clear help text, helpful error messages, sensible defaults, and readable output."),faqs:[{q:"What separates a good CLI from a bad one?",a:"Discoverable help, errors that say how to fix the problem, sensible defaults, and output that's easy to read or pipe. Small touches add up."},{q:"Should output be colored?",a:"Color helps readability but should degrade gracefully when piped or unsupported, so scripts and plain terminals still work."},{q:"How important are good error messages?",a:"Very. An error that names the problem and the fix turns a frustrated user into a productive one."}]},"supply-chain":{Icon:Me,title:"Supply-chain security",crumbLabel:"Supply chain",meta:"Recommended · about 10 minutes",lead:"Keep the code you depend on trustworthy. Know what's in your dependencies, catch known vulnerabilities, and make sure what you ship is what you built.",journey:[{emoji:"📥",label:"Dependencies",sub:"Code you didn't write"},{emoji:"🔍",label:"Checked & pinned",sub:"Scanned for risk",lime:!0},{emoji:"🛡️",label:"Trustworthy ship",sub:"What you built"}],chatPrompt:be("supply-chain security","I want to know what's in my dependencies, catch known vulnerabilities, pin versions, and verify that what I ship is what I built."),faqs:[{q:"Why worry about dependencies?",a:"Most of your app is code you didn't write. A vulnerability or tampered package upstream becomes your problem, so keeping an eye on them matters."},{q:"How do I catch vulnerabilities?",a:"Automated scanning flags known issues in your dependencies and suggests safe upgrades, ideally on every change."},{q:"What does 'pinning' mean?",a:"Locking exact dependency versions so builds are reproducible and a surprise update can't quietly change what you ship."}]},"pre-release-channel":{Icon:$e,title:"Pre-release channel",crumbLabel:"Pre-release",meta:"Optional · about 10 minutes",lead:"Give testers a next/beta version to opt into, so you can trial changes with willing users before they reach everyone on the stable release.",journey:[{emoji:"🧪",label:"A risky change",sub:"Needs real testing"},{emoji:"📡",label:"Beta channel",sub:"Opt-in testers",lime:!0},{emoji:"✅",label:"Then stable",sub:"For everyone"}],chatPrompt:be("a pre-release channel","I want a next/beta channel that testers can opt into, so I can trial changes before promoting them to the stable release."),faqs:[{q:"How is a beta channel different from just releasing?",a:"Only users who opt in get pre-releases, and the stable channel keeps moving separately — so testing new changes never disrupts everyone else."},{q:"Who uses pre-releases?",a:"Willing testers and power users who want early features and don't mind rough edges, giving you real feedback before a wide launch."},{q:"Does this move my 'latest'?",a:"No. Pre-releases are tagged separately, so people installing the default still get the stable version."}]},"pre-release-versions":{Icon:$e,title:"Pre-release versions",crumbLabel:"Pre-release",meta:"Optional · about 10 minutes",lead:"Publish next/beta versions of your package that testers can install on purpose, without moving the default that everyone else gets.",journey:[{emoji:"🧪",label:"A new version",sub:"Not ready for all"},{emoji:"🏷️",label:"Tagged pre-release",sub:"Opt-in install",lime:!0},{emoji:"✅",label:"Promote to latest",sub:"When it's proven"}],chatPrompt:be("pre-release versions","I want to publish beta/next versions of my package under a separate tag so testers can opt in without changing what the default install gets."),faqs:[{q:"How do testers get a pre-release?",a:"They install a specific tag (like `next` or `beta`) on purpose. The plain install keeps returning your stable version."},{q:"How do I mark a version as pre-release?",a:"Use a pre-release version number and publish it under a separate tag, so registries don't treat it as the latest stable."},{q:"When do I promote it?",a:"Once it's proven with testers, you republish it as the stable latest — the same build, now the default."}]}},Xk={"real-data":lp,accounts:yp,emails:jp,payments:kp,"analytics-monitoring":Sp,legal:Np,"data-safety":Ep,publish:Ap,"custom-domain":Rp,forms:Mp,"analytics-seo":Ip,"redirects-404":Dp,"performance-images":Lp,"comments-search":Fp,"publish-registry":$p,"versioning-changelog":Bp,"install-docs":qp,"release-builds":Hp,"shell-completions":Wp,"cli-ux":Gp,"api-docs":Vp,examples:Yp,"semver-policy":Jp,"readme-license":Xp,"supply-chain":Up,"changelog-ci":Qp,"deploy-target":Zp,"database-backups":em,secrets:sm,"api-auth":rm,"cors-origins":am,"background-jobs":om,"logging-monitoring":im,"staging-preview":Ja,"deploy-previews":Ja,"staging-environment":lm,"pre-release-channel":Xa,"pre-release-versions":Xa};function cm({onBack:t,topicKey:n,topicName:s,topicDesc:r}){const a=(s==null?void 0:s.trim())||"This setup step",o=(r==null?void 0:r.trim())||"There isn't a guided screen for this step here yet. You can still set it up — check the project's setup notes — and we'll add a walkthrough soon.";return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(ui,{size:26}),title:a,meta:"Guided screen coming soon",onBack:t,assistKey:n??""}),e.jsx("p",{className:"lead",children:o}),e.jsx("div",{className:"cta-wrap",children:e.jsx("button",{type:"button",className:"cta",onClick:t,children:"Back to Setup"})})]})}function dm({topicKey:t,topicName:n,topicDesc:s,isBackend:r=!1,onBack:a,onComplete:o,onChatWithAI:i}){const c=Jk[t];if(c)return e.jsx(ai,{icon:e.jsx(c.Icon,{size:26}),title:c.title,crumbLabel:c.crumbLabel,meta:c.meta,assistKey:t,onBack:a,lead:c.lead,illustration:pi(t)??e.jsx(Yt,{nodes:c.journey}),chatPrompt:c.chatPrompt,onChatWithAI:i,faqs:c.faqs});const d=t==="api-docs"&&r?Kp:Xk[t];return d?e.jsx(d,{onBack:a,onComplete:()=>o==null?void 0:o(t),onChatWithAI:i}):e.jsx(cm,{onBack:a,topicKey:t,topicName:n,topicDesc:s})}const LM=Object.freeze(Object.defineProperty({__proto__:null,SetupTopicPlaceholder:cm,SetupTopicRouter:dm},Symbol.toStringTag,{value:"Module"}));function um({onBack:t}){const{concepts:n}=tp(),[s,r]=l.useState(""),[a,o]=l.useState(null),i=l.useMemo(()=>{const c=s.trim().toLowerCase();return!c||!n?n??[]:n.filter(d=>[d.term,d.category,...d.aka].join(" ").toLowerCase().includes(c))},[n,s]);return e.jsxs("div",{className:"learn-screen concepts-glossary",children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:t,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:t,children:"Setup"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"What these words mean"})]}),e.jsx("div",{className:"h",children:"What these words mean"}),e.jsx("div",{className:"hsub",children:"Plain-language explainers for the terms you'll run into while setting up your app. No jargon — just what each thing is, whether you need it, and what it costs."}),e.jsx("input",{type:"search",className:"concept-search",placeholder:"Search terms…",value:s,onChange:c=>r(c.target.value),"aria-label":"Search terms"}),e.jsx("div",{className:"tlist",children:n===null?Array.from({length:6}).map((c,d)=>e.jsx("div",{className:"trow soon","aria-hidden":"true",children:e.jsxs("div",{className:"tbody",children:[e.jsx("div",{className:"tn",children:" "}),e.jsx("div",{className:"td",children:" "})]})},d)):i.length===0?e.jsxs("div",{className:"concept-empty",children:['No terms match "',s,'".']}):i.map(c=>{const d=a===c.key;return e.jsxs("div",{className:"concept-row",children:[e.jsxs("button",{type:"button",className:"trow soon","aria-expanded":d,onClick:()=>o(d?null:c.key),children:[e.jsxs("div",{className:"tbody",children:[e.jsx("div",{className:"tn",children:c.term}),c.category?e.jsx("div",{className:"td",children:c.category}):null]}),e.jsx("span",{className:"arrow",children:d?"−":"+"})]}),d?e.jsx("div",{className:"concept-row-body",children:e.jsx(Ht,{variant:"compact",children:c.body})}):null]},c.key)})})]})}const FM=Object.freeze(Object.defineProperty({__proto__:null,ConceptsGlossaryScreen:um},Symbol.toStringTag,{value:"Module"})),ps="your-app.vercel.app",Qk=[{key:"connect",label:"Connect"},{key:"deploying",label:"Deploy"},{key:"live",label:"Go live"}];function _i({onBack:t}){return e.jsx(pe,{icon:e.jsx(vn,{size:26}),title:"Hosting & going live",crumbLabel:"Hosting",meta:"Foundation · about 10 minutes",onBack:t,assistKey:"hosting"})}function qn({stage:t}){return e.jsx($t,{steps:Qk,currentKey:t})}const zM=Object.freeze(Object.defineProperty({__proto__:null,FlowBar:qn,HSHeader:_i,HS_URL:ps},Symbol.toStringTag,{value:"Module"}));function Zk(){const[t,n]=l.useState(null);return l.useEffect(()=>{let s=!1;return(async()=>{try{const r=await fetch("/api/hosting-target");if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();s||n(a)}catch{s||n(null)}})(),()=>{s=!0}},[]),{target:t}}function hm({onBack:t,onSetup:n}){const{target:s}=Zk(),r=(s==null?void 0:s.detectedHost)??null;return e.jsxs(e.Fragment,{children:[e.jsx(_i,{onBack:t}),e.jsxs("p",{className:"lead",children:["Right now your app only runs on ",e.jsx("b",{children:"your computer"}),". Hosting puts it online so anyone can open it with a link, like renting a small plot of land where your app lives."]}),e.jsx("p",{className:"lead dim",children:"You don't need to understand servers. We'll set it up for you and explain each step in plain language."}),e.jsx(tu,{}),r&&e.jsxs("div",{className:"hosting-detected",role:"note",children:[e.jsxs("div",{className:"hosting-detected-title",children:["This project is already configured for ",e.jsx("b",{children:r.name})]}),e.jsxs("div",{className:"hosting-detected-detail",children:["We found ",e.jsx("code",{children:r.evidence})," in your project — let's use"," ",r.name,".",(s==null?void 0:s.buildCommand)&&e.jsxs(e.Fragment,{children:[" ","It builds with ",e.jsx("code",{children:s.buildCommand}),s.outputDir&&e.jsxs(e.Fragment,{children:[" ","into ",e.jsx("code",{children:s.outputDir})]}),"."]})]})]}),e.jsx("div",{className:"seclabel",children:r?"Or start fresh with our recommendation":"Recommended for your app"}),e.jsxs("div",{className:"provcard best",children:[e.jsx(Nr,{}),e.jsxs("div",{className:"provbody",children:[e.jsxs("div",{className:"provtop",children:[e.jsx("span",{className:"provname",children:"Vercel"}),e.jsx("span",{className:"bestfit",children:"Best fit"})]}),e.jsx("div",{className:"provdesc",children:"Free to start, fast, and it works the way your app is already built. Most people in your spot pick this."}),e.jsx(nu,{}),e.jsx(su,{})]})]}),e.jsx(ru,{}),e.jsxs("div",{className:"cta-wrap",children:[e.jsxs("button",{type:"button",className:"cta",onClick:n,children:[e.jsx("span",{className:"ce",children:"☁️"})," Set up hosting with Vercel"]}),e.jsx("div",{className:"cta-note",children:"We'll walk you through every step. Nothing goes live until you say so."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:34},children:"FAQ"}),e.jsx(au,{}),e.jsx(ou,{}),e.jsx(fe,{assistKey:"hosting",topicName:"Hosting & going live"})]})}const $M=Object.freeze(Object.defineProperty({__proto__:null,HostingOverviewGuided:hm},Symbol.toStringTag,{value:"Module"}));function pm({onBack:t,onContinue:n,tokenMode:s=!1}){const[r,a]=l.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:t,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:t,children:"Hosting"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Connect Vercel"})]}),e.jsx(qn,{stage:"connect"}),e.jsxs("div",{className:"panel",children:[e.jsx("div",{className:"ph",children:"🔗 Connect your Vercel account"}),e.jsx("div",{className:"psub",children:"This is a free account that holds your live app. If you don't have one yet, you'll make it in a few clicks, no setup required."}),e.jsxs("div",{className:"connect-box",children:[e.jsxs("div",{className:"cbtitle",children:[e.jsx(Nr,{}),e.jsxs("div",{children:[e.jsx("div",{className:"cbt",children:"Sign in with Vercel"}),e.jsx("div",{className:"cbd",children:s?"Paste a Vercel access token to deploy your real app.":"We'll open Vercel in a new tab and bring you right back."})]})]}),s?e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"real-token-label",htmlFor:"hosting-token",children:"Vercel access token"}),e.jsx("input",{id:"hosting-token",type:"password",className:"real-token-input",placeholder:"Paste your Vercel token",value:r,onChange:o=>a(o.target.value)}),e.jsxs("button",{type:"button",className:"auth-btn",disabled:r.trim().length===0,onClick:()=>n(r.trim()),children:[e.jsx("svg",{width:"17",height:"15",viewBox:"0 0 26 22",fill:"#fff","aria-hidden":"true",children:e.jsx("path",{d:"M13 0l13 22H0z"})}),"Deploy with Vercel"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grant",children:[e.jsxs("div",{className:"grantrow",children:[e.jsx(Be,{color:"var(--blue-300)"}),e.jsx("span",{children:"Create one project to hold your app"})]}),e.jsxs("div",{className:"grantrow",children:[e.jsx(Be,{color:"var(--blue-300)"}),e.jsx("span",{children:"Publish updates when you choose to go live"})]}),e.jsxs("div",{className:"grantrow",children:[e.jsx(Be,{color:"var(--blue-300)"}),e.jsx("span",{children:"Nothing else. We can't touch your other accounts or files"})]})]}),e.jsxs("button",{type:"button",className:"auth-btn",onClick:()=>n(),children:[e.jsx("svg",{width:"17",height:"15",viewBox:"0 0 26 22",fill:"#fff","aria-hidden":"true",children:e.jsx("path",{d:"M13 0l13 22H0z"})}),"Continue with Vercel"]}),e.jsxs("div",{className:"auth-row",children:[e.jsx("button",{type:"button",className:"auth-ghost",onClick:()=>n(),children:"I already have an account"}),e.jsx("button",{type:"button",className:"auth-ghost",onClick:()=>n(),children:"Create one for me"})]})]})]}),e.jsx("div",{className:"reassure",children:"🔒 We only ask for what's needed to put this one app online. You can disconnect at any time from settings."})]})]})}const BM=Object.freeze(Object.defineProperty({__proto__:null,HostingConnectStep:pm},Symbol.toStringTag,{value:"Module"})),qs=["Packaging up your app","Uploading it to Vercel","Giving it a web address","Turning it on"],ec=1100,eS=700;function mm({onDone:t}){const[n,s]=l.useState(0),r=l.useRef(t);r.current=t,l.useEffect(()=>{const o=[];for(let i=1;i<=qs.length;i++)o.push(setTimeout(()=>s(i),i*ec));return o.push(setTimeout(()=>r.current(),qs.length*ec+eS)),()=>o.forEach(clearTimeout)},[]);const a=Math.round(n/qs.length*100);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("span",{children:"Hosting"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Going live"})]}),e.jsx(qn,{stage:"deploying"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"deploy-head",children:[e.jsx("div",{className:"deploy-spin"}),e.jsxs("div",{children:[e.jsx("div",{className:"deploy-t",children:"Putting your app online…"}),e.jsx("div",{className:"deploy-d",children:"This usually takes under a minute. You can keep working, we'll let you know."})]})]}),e.jsx("div",{className:"dep-bar",children:e.jsx("div",{style:{width:a+"%"}})}),e.jsx("div",{className:"dep-steps",children:qs.map((o,i)=>e.jsxs("div",{className:"dep-step "+(i<n?"done":i===n?"active":"todo"),children:[e.jsx("div",{className:"dot",children:i<n?e.jsx(Be,{size:12,color:"#0a0a0a"}):null}),e.jsx("div",{className:"sl",children:o})]},o))})]})]})}const qM=Object.freeze(Object.defineProperty({__proto__:null,HostingDeployStep:mm},Symbol.toStringTag,{value:"Module"})),tS="hosting";function fm({provider:t,credential:n,onDone:s,onRetry:r}){const{stage:a,result:o,error:i,connect:c}=mi(tS,t),d=l.useRef(!1);l.useEffect(()=>{d.current||(d.current=!0,c(n))},[c,n]);const u=l.useRef(s);return u.current=s,l.useEffect(()=>{a==="ready"&&o&&u.current(o.value)},[a,o]),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("span",{children:"Hosting"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Going live"})]}),e.jsx(qn,{stage:"deploying"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"real-error",role:"alert",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"real-error-title",children:"Couldn’t put your app online"}),e.jsx(Ze,{variant:"icon",text:`Couldn’t put your app online: ${i}`})]}),e.jsx("div",{className:"real-error-msg",children:i})]}),e.jsx("button",{type:"button",className:"auth-btn",onClick:r,children:"Try again"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("span",{children:"Hosting"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Going live"})]}),e.jsx(qn,{stage:"deploying"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"deploy-head",children:[e.jsx("div",{className:"deploy-spin"}),e.jsxs("div",{children:[e.jsx("div",{className:"deploy-t",children:"Putting your app online…"}),e.jsx("div",{className:"deploy-d",children:a==="connecting"?"Connecting to your hosting account…":"Building and publishing your app. This usually takes under a minute."})]})]}),e.jsx("div",{className:"dep-bar",children:e.jsx("div",{className:"dep-bar-indeterminate"})})]})]})}const HM=Object.freeze(Object.defineProperty({__proto__:null,HostingRealDeployStep:fm},Symbol.toStringTag,{value:"Module"})),nS=1600;function gm(t){const{copied:n,copy:s}=Fo({resetMs:nS}),r=l.useCallback(()=>{s(t)},[s,t]);return{copied:n,copy:r}}function bm({onFinish:t,liveUrl:n}){const s=n??ps,r=n??"https://"+ps,{copied:a,copy:o}=gm(r);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("span",{children:"Hosting"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Live"})]}),e.jsx(qn,{stage:"live"}),e.jsxs("div",{className:"panel",children:[e.jsxs("div",{className:"live-hero",children:[e.jsx("div",{className:"lh-em",children:"🎉"}),e.jsx("div",{className:"lh-t",children:"Your app is live"}),e.jsx("div",{className:"lh-d",children:"Anyone with this link can open your app right now."})]}),e.jsxs("div",{className:"url-card",children:[e.jsx("span",{className:"ucglobe",children:"🌍"}),e.jsxs("div",{children:[e.jsx("div",{className:"uc-l",children:"Your link"}),e.jsx("div",{className:"uc-u",children:s})]}),e.jsxs("div",{className:"uc-actions",children:[e.jsx("button",{type:"button",className:"btn-copy",onClick:o,children:a?"✓ Copied":"Copy link"}),e.jsx("button",{type:"button",className:"btn-visit",disabled:!n,onClick:n?()=>window.open(n,"_blank","noopener"):void 0,children:"Visit →"})]})]}),e.jsxs("div",{className:"domain-row",children:[e.jsx("span",{className:"dre",children:"🏷️"}),e.jsxs("div",{children:[e.jsx("div",{className:"drt",children:"Want your own web address?"}),e.jsx("div",{className:"drd",children:"Connect a custom domain. Optional, and you can do it anytime."})]}),e.jsx("button",{type:"button",className:"drbtn",children:"Add a domain"})]}),e.jsxs("div",{className:"live-foot",children:[e.jsxs("span",{className:"done-pill",children:[e.jsx(Be,{})," Hosting is now set up"]}),e.jsx("button",{type:"button",className:"lf-back",onClick:t,children:"Back to Setup"})]})]})]})}const WM=Object.freeze(Object.defineProperty({__proto__:null,HostingLiveStep:bm},Symbol.toStringTag,{value:"Module"}));function xm({onBack:t,onRedeploy:n}){const{copied:s,copy:r}=gm("https://"+ps),[a,o]=l.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(_i,{onBack:t}),e.jsxs("div",{className:"conn-card",children:[e.jsx(Nr,{}),e.jsxs("div",{className:"conn-body",children:[e.jsxs("div",{className:"conn-top",children:[e.jsx("span",{className:"conn-name",children:"Connected to Vercel"}),e.jsxs("span",{className:"conn-live",children:[e.jsx("span",{className:"lbdot"}),"Live"]})]}),e.jsxs("div",{className:"conn-acct",children:["Account ",e.jsx("b",{children:"your-app"})," · connected today"]})]}),e.jsx("button",{type:"button",className:"conn-disc",children:"Disconnect"})]}),e.jsx("div",{className:"seclabel",children:"Your live app"}),e.jsxs("div",{className:"url-card",children:[e.jsx("span",{className:"ucglobe",children:"🌍"}),e.jsxs("div",{children:[e.jsx("div",{className:"uc-l",children:"Your link"}),e.jsx("div",{className:"uc-u",children:ps})]}),e.jsxs("div",{className:"uc-actions",children:[e.jsx("button",{type:"button",className:"btn-copy",onClick:r,children:s?"✓ Copied":"Copy link"}),e.jsx("button",{type:"button",className:"btn-visit",children:"Visit →"})]})]}),e.jsx("div",{className:"seclabel",style:{marginTop:28},children:"Latest deploy"}),e.jsxs("div",{className:"dep-card",children:[e.jsxs("div",{className:"depc-row",children:[e.jsx("span",{className:"depc-dot"}),e.jsxs("div",{className:"depc-main",children:[e.jsx("div",{className:"depc-t",children:"Live · deployed 2 minutes ago"}),e.jsx("div",{className:"depc-d",children:"Built and published from your latest changes."})]}),e.jsx("button",{type:"button",className:"depc-btn",onClick:n,children:"Redeploy"})]}),e.jsxs("div",{className:"depc-toggle",children:[e.jsxs("div",{children:[e.jsx("div",{className:"depc-tt",children:"Publish changes automatically"}),e.jsx("div",{className:"depc-td",children:"When you make changes, we'll put them live for you. Turn this off to publish by hand."})]}),e.jsx("span",{className:"toggle"+(a?" on":""),onClick:()=>o(i=>!i),role:"switch","aria-checked":a,tabIndex:0,children:e.jsx("span",{})})]})]})]})}const GM=Object.freeze(Object.defineProperty({__proto__:null,HostingOverviewConnected:xm},Symbol.toStringTag,{value:"Module"}));function ym({direction:t="guided",onBack:n,onComplete:s,connector:r,onOpenSharedBrowser:a}){const[o,i]=l.useState("overview"),[c,d]=l.useState(""),[u,h]=l.useState(void 0),p=r!==void 0;let f;return o==="overview"?f=t==="connected"?e.jsx(xm,{onBack:n,onRedeploy:()=>i("deploying")}):e.jsx(hm,{onBack:n,onSetup:()=>i("connect")}):o==="connect"?f=e.jsx(pm,{onBack:()=>i("overview"),tokenMode:p,onContinue:m=>{p&&d(m??""),i("deploying")}}):o==="deploying"?f=p?e.jsx(fm,{provider:r.provider,credential:c,onDone:m=>{h(m),i(t==="connected"?"overview":"live")},onRetry:()=>i("connect")}):e.jsx(mm,{onDone:()=>i(t==="connected"?"overview":"live")}):f=e.jsx(bm,{liveUrl:u,onFinish:()=>{s==null||s(),n()}}),e.jsxs("div",{className:"hosting-screen",children:[f,a&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[12px]",children:[e.jsx("button",{type:"button",className:"rounded px-3 py-1.5",style:{background:"var(--bg-card)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",cursor:"pointer"},onClick:a,children:"Open shared browser →"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"Walk the hosting console together — you and the assistant both drive."})]})]})}const UM=Object.freeze(Object.defineProperty({__proto__:null,HostingScreen:ym},Symbol.toStringTag,{value:"Module"}));function vm({recipe:t,onBack:n,onMarkDone:s,status:r,onRevert:a,copyWriter:o}){return e.jsxs("div",{className:"learn-screen run-locally-screen",children:[e.jsxs("div",{className:"crumbs",children:[e.jsx("button",{type:"button",className:"back",onClick:n,"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:n,children:"Home"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("button",{type:"button",onClick:n,children:"Setup"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Run it locally"})]}),e.jsx("div",{className:"h",children:"Run it locally"}),e.jsx("div",{className:"hsub",children:"Right now your app runs inside this editor's Live Preview. Running it on your own machine lets you debug with your own tools, show it offline, or hand it to a teammate. Here's how, for this exact project."}),t===null?e.jsx("div",{className:"rl-loading","aria-hidden":"true",children:"Loading run instructions…"}):e.jsxs("div",{className:"rl-sections",children:[t.prereqs.length>0&&e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:"Prerequisites"}),e.jsx("ul",{className:"rl-prereqs",children:t.prereqs.map(i=>e.jsxs("li",{className:"rl-prereq",children:[e.jsx("span",{className:"rl-prereq-label",children:i.label}),e.jsx("span",{className:"rl-prereq-detail",children:i.detail})]},i.label))})]}),t.install&&e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:"Install"}),e.jsx(ls,{command:t.install,writer:o})]}),e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:t.runLabel||"Run"}),e.jsx(ls,{command:t.run,writer:o})]}),t.loadSteps&&e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:t.loadSteps.label}),e.jsx("ol",{className:"rl-load-steps",children:t.loadSteps.steps.map(i=>e.jsx("li",{className:"rl-load-step",children:i},i))}),t.loadTarget&&e.jsxs("div",{className:"rl-load-target",children:[e.jsx("div",{className:"rl-load-target-label",children:t.loadTarget.label}),e.jsx(ls,{command:t.loadTarget.path,writer:o})]})]}),t.reachableAt&&e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:"Open it"}),e.jsxs("div",{className:"rl-reachable",children:["Once it's running, open"," ",e.jsx("a",{className:"rl-url",href:t.reachableAt,target:"_blank",rel:"noreferrer",children:t.reachableAt}),"."]})]}),t.notes.length>0&&e.jsxs("section",{className:"rl-sec",children:[e.jsx("div",{className:"seclabel",children:"Notes"}),e.jsx("ul",{className:"rl-notes",children:t.notes.map(i=>e.jsx("li",{className:"rl-note",children:i},i))})]}),e.jsx(fe,{assistKey:"run-locally",topicName:"Run it locally"}),s&&e.jsx(ge,{label:"Got it — mark as done",note:"You can revisit these steps anytime.",status:r,onComplete:()=>s(),onRevert:a,onBack:n})]})]})}const YM=Object.freeze(Object.defineProperty({__proto__:null,RunLocallyScreen:vm},Symbol.toStringTag,{value:"Module"}));function jm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Me,{size:26}),title:"Store accounts",meta:"Foundation · about 15 minutes",onBack:t,assistKey:"store-accounts"}),e.jsxs("p",{className:"lead",children:["To publish your extension, you first register as a developer with the"," ",e.jsx("b",{children:"Chrome Web Store"}),". This is a one-time setup that gives you a dashboard for uploading, updating, and managing your listing."]}),e.jsx("p",{className:"lead dim",children:"It's not the same as a regular Google account upgrade — there's a one-time registration fee and a short profile to fill in."}),e.jsx(yt,{linkKey:"chrome.devConsole"}),e.jsx("div",{className:"seclabel",children:"What you'll do"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Pay the one-time developer fee.",children:["The Chrome Web Store charges a single"," ",e.jsx("b",{children:me("chromeStore.fee").value})," registration fee per account — not per extension. There's no recurring cost. The registration guide walks through the exact steps."]}),e.jsx(R,{lead:"Complete your developer profile.",children:"A public display name and a contact email. The email is verified and used for store communications and review notices."}),e.jsx(R,{lead:"Verify your identity and payment profile.",children:"Paying the fee requires a verified Google payment profile, and you must verify your contact information (email, and sometimes a phone number) before you can publish. Do this early — an unverified account can't push a listing live."}),e.jsx(R,{lead:"Decide on a publisher identity.",children:"You can publish under your own name or a group publisher. Group publishers are worth it if a team will manage the listing."})]}),e.jsx(yt,{linkKey:"chrome.register",label:"Read the Chrome Web Store registration guide"}),e.jsx(Cr,{}),e.jsx(fe,{assistKey:"store-accounts",topicName:"Store accounts"}),e.jsx(ge,{label:"I've registered my developer account",note:"You only need to do this once. The next steps reuse the same account.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const VM=Object.freeze(Object.defineProperty({__proto__:null,StoreAccountsScreen:jm},Symbol.toStringTag,{value:"Module"}));function wm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(rt,{size:26}),title:"Store assets",meta:"About 30 minutes · design time",onBack:t,assistKey:"extension-store-assets"}),e.jsxs("p",{className:"lead",children:["Your store listing needs a set of images at ",e.jsx("b",{children:"exact dimensions"}),". The store rejects assets that are the wrong size, so it's worth getting these right before you submit."]}),e.jsx("div",{className:"seclabel",children:"Required"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Store icon — 128×128 PNG.",children:"The icon shown in the store and in the user's toolbar. Use a transparent or solid background; avoid tiny text."}),e.jsx(R,{lead:"At least one screenshot — 1280×800 or 640×400.",children:"Show your extension in action. The first screenshot is the one most users actually look at, so lead with your strongest."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Recommended"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Small promo tile — 440×280.",children:"Shown in store listings and search results. A clean tile noticeably improves install rates."}),e.jsx(R,{lead:"Marquee promo tile — 1400×560.",children:"Only used if the store features your extension, but worth having ready."})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"PNG or JPEG"}),e.jsx("span",{className:"chip",children:"No misleading imagery"}),e.jsx("span",{className:"chip",children:"Up to 5 screenshots"})]}),e.jsx(yt,{linkKey:"chrome.devConsole",label:"Upload assets in the developer dashboard"}),e.jsx(fe,{assistKey:"extension-store-assets",topicName:"Store assets"}),e.jsx(ge,{label:"My store assets are ready",note:"You can update assets later — a new upload doesn't restart the whole review.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const KM=Object.freeze(Object.defineProperty({__proto__:null,ExtensionAssetsScreen:wm},Symbol.toStringTag,{value:"Module"})),_m={storage:"Save the user's settings and data between sessions.",activeTab:"Act on the current tab only when the user clicks your extension — no broad access. Prefer this over a host permission whenever the work starts from a user click; it sidesteps the host-permission review entirely.",scripting:"Inject the scripts that make your extension work on a page.",tabs:"Read tab titles and URLs to coordinate behaviour across open tabs.",cookies:"Read or set cookies for the sites your extension supports.",notifications:"Show desktop notifications the user has opted into.",contextMenus:"Add your own items to the right-click menu.",alarms:"Schedule background work at set intervals.",bookmarks:"Read or organise the user's bookmarks.",history:"Read or clear the user's browsing history.",downloads:"Start or manage file downloads on the user's behalf.",clipboardWrite:"Copy text to the clipboard when the user asks.",webRequest:"Observe network requests to filter or modify them.",webRequestBlocking:"Block or redirect requests synchronously. MV2-only — in Manifest V3 use declarativeNetRequest instead; this permission alone can fail the review on a new submission.",declarativeNetRequest:"Block or modify network requests via static rules — the MV3 replacement for blocking webRequest.",identity:"Sign the user in with their existing Google account. Heads-up: requesting OAuth scopes triggers a separate Google security/verification review that can take weeks — start it early.",debugger:"Attach to the DevTools protocol. High-risk: reviewers scrutinise this closely and it's rejected unless the core feature genuinely needs it.",nativeMessaging:"Talk to a companion app installed on the user's machine. Near-automatic deep review — expect extra scrutiny and a longer timeline.",offscreen:"Run an offscreen document for DOM work a service worker can't do (audio, clipboard, parsing).",management:"Read or manage the user's other installed extensions. High-risk — justify narrowly or reviewers reject it.",proxy:"Control the browser's proxy settings. High-risk; expect close review.",tabCapture:"Capture the visible tab's audio/video — only after the user starts capture from your UI.",desktopCapture:"Capture the screen, a window, or a tab the user picks. Must be user-initiated each time."};function ms(t){const n=t.trim();return n.includes("://")||n.startsWith("*")||n==="<all_urls>"}function sS(t){const n=t.trim();return n==="<all_urls>"?!0:ms(n)?n.replace(/^\*?:\/\//,"").split("/")[0]==="*":!1}function rS(t){const n=t.trim();return n==="<all_urls>"?"Run on every site the user visits. Only request this if your extension truly needs it — reviewers scrutinise it closely.":sS(n)?`Run on a very broad set of sites (${n}). Reviewers treat broad host access like <all_urls> — narrow it to the exact origins you need, or use activeTab instead.`:ms(n)?`Run only on the specific sites this pattern matches (${n}).`:_m[n]??"Explain, in one plain sentence, exactly what this permission lets your extension do for the user."}function aS(t){const n=t.trim();return ms(n)||n in _m}const oS=["storage","activeTab","scripting","https://api.example.com/*"];function Qa({perm:t}){return e.jsxs("div",{className:"reason",children:[e.jsx(Be,{}),e.jsxs("span",{children:[e.jsx("b",{children:e.jsx("code",{children:t})})," ",rS(t),aS(t)?null:e.jsx("span",{className:"bestfit",style:{marginLeft:8},children:"needs your wording"})]})]},t)}function km({permissions:t=oS,onBack:n,onComplete:s,status:r,onRevert:a}){const o=t.filter(ms),i=t.filter(c=>!ms(c));return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Me,{size:26}),title:"Permissions",meta:"About 20 minutes · often missed",onBack:n,assistKey:"permissions-justification"}),e.jsxs("p",{className:"lead",children:["The store asks you to justify ",e.jsx("b",{children:"every permission"})," your extension requests. A clear, honest reason for each one is the difference between a smooth review and a rejection."]}),e.jsxs("p",{className:"lead dim",children:["These are read from your ",e.jsx("code",{children:"manifest.json"}),". Review the suggested justification for each and tighten it to match what your extension actually does."]}),e.jsxs("div",{className:"asknote",style:{marginTop:4},children:[e.jsx("b",{children:"Single-purpose policy:"})," every permission must serve your extension's one stated purpose. Unrelated permissions get rejected even when each is individually justified — it's one of the top rejection causes."]}),e.jsx("div",{className:"seclabel",children:"API permissions you request"}),i.length===0?e.jsx("p",{className:"lead dim",children:"Your manifest requests no API permissions to justify here."}):e.jsx("div",{className:"reasons",children:i.map(c=>e.jsx(Qa,{perm:c},c))}),e.jsx("div",{className:"seclabel",children:"Host permissions"}),o.length===0?e.jsx("p",{className:"lead dim",children:"Your manifest requests no host permissions — the easiest possible review on this axis."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"lead dim",children:["Host permissions are submitted in a ",e.jsx("b",{children:"separate field"})," on the dashboard and scrutinised the hardest — narrow them to the exact origins you need."]}),e.jsx("div",{className:"reasons",children:o.map(c=>e.jsx(Qa,{perm:c},c))})]}),t.length===0&&e.jsx("p",{className:"lead dim",children:"Your manifest requests no special permissions — there's nothing to justify. That's the easiest possible review."}),e.jsx("div",{className:"asknote",style:{marginTop:14},children:"Rule of thumb: if you can't explain why a permission helps the user, remove it. Fewer permissions means a faster review and more installs."}),e.jsx(yt,{linkKey:"chrome.devConsole",label:"Submit justifications in the developer dashboard"}),e.jsx(fe,{assistKey:"permissions-justification",topicName:"Permissions"}),e.jsx(ge,{label:"My permissions are justified",note:"Reviewers read these. Vague or copy-pasted reasons are the most common rejection.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const JM=Object.freeze(Object.defineProperty({__proto__:null,PermissionRow:Qa,PermissionsJustificationScreen:km},Symbol.toStringTag,{value:"Module"}));function Sm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Privacy policy",meta:"About 20 minutes · disclosure required for every extension",onBack:t,assistKey:"privacy-policy"}),e.jsxs("p",{className:"lead",children:["A privacy policy at a public URL is required for any extension that accesses user data. Separately, ",e.jsx("b",{children:"every"})," extension must complete the data-use disclosure in the dashboard — even one that collects nothing has to declare that. Mismatches between the policy and the disclosure get flagged."]}),e.jsx("p",{className:"lead dim",children:`Even if you collect almost nothing, you still declare that — "we don't collect personal data" is a valid, common policy.`}),e.jsx("div",{className:"seclabel",children:'The "Privacy practices" tab'}),e.jsxs("p",{className:"lead dim",children:["The disclosure lives on the dashboard's ",e.jsx("b",{children:"Privacy practices"})," tab. You can't submit until you check its three mandatory certifications:"]}),e.jsxs(ce,{children:[e.jsx(R,{lead:"You don't sell or transfer data to third parties",children:"outside of approved use cases."}),e.jsx(R,{lead:"You don't use or transfer data for purposes unrelated",children:"to your extension's single purpose."}),e.jsx(R,{lead:"You don't use or transfer data to determine creditworthiness",children:"or for lending purposes."})]}),e.jsx("div",{className:"seclabel",children:"Your policy must cover"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"What you collect.",children:"List the categories of data — settings, content the user enters, usage analytics — in plain terms."}),e.jsx(R,{lead:"Why you collect it.",children:"Tie each category to a feature. The store cross-checks this against your permission justifications."}),e.jsx(R,{lead:"Where it goes.",children:"Whether data stays on the device, syncs to the user's account, or is sent to a server you run or a third party."}),e.jsx(R,{lead:"How users can reach you.",children:"A contact method for privacy questions or deletion requests."})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"Hosted at a public URL"}),e.jsx("span",{className:"chip",children:"Linked in the dashboard"}),e.jsx("span",{className:"chip",children:"Matches your data disclosure"})]}),e.jsx(fe,{assistKey:"privacy-policy",topicName:"Privacy policy"}),e.jsx(ge,{label:"My privacy policy is published and linked",note:"Keep the policy URL live — a dead link can get the listing taken down later.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const XM=Object.freeze(Object.defineProperty({__proto__:null,ExtensionPrivacyPolicyScreen:Sm},Symbol.toStringTag,{value:"Module"}));function Nm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Me,{size:26}),title:"OAuth & sign-in verification",meta:"Days to weeks · a separate review from the store listing",onBack:t,assistKey:"oauth-verification"}),e.jsxs("p",{className:"lead",children:["If your extension signs users in with Google, the OAuth"," ",e.jsx("b",{children:"consent screen"})," goes through its own verification — separate from, and slower than, the Chrome Web Store listing review. Plan for it early; it's the step that surprises people the week they hoped to launch."]}),e.jsx("p",{className:"lead dim",children:"This only applies if you request Google account access. Sign-in handled entirely by your own backend, or no sign-in at all, skips this gate completely."}),e.jsxs("div",{className:"asknote",style:{marginTop:4},children:[e.jsx("b",{children:"Two reviews, two timelines:"})," the store reviews your extension listing; Google separately reviews the ",e.jsx("b",{children:"OAuth consent screen"})," tied to your Cloud project. Approval on one is not approval on the other."]}),e.jsx("div",{className:"seclabel",children:"How long depends on the scopes you ask for"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Non-sensitive scopes (email, profile).",children:"Basic sign-in. No verification wait — your consent screen works for everyone as soon as you publish it."}),e.jsx(R,{lead:"Sensitive scopes (Gmail, Drive, Calendar).",children:"Require app verification. Expect a multi-day to multi-week review and a justification for why you need each scope."}),e.jsx(R,{lead:"Restricted scopes (full mailbox, all files).",children:"Pull in an annual third-party security assessment that can run weeks and cost real money. Avoid unless your product truly needs them."})]}),e.jsx("div",{className:"seclabel",children:"Before you submit for verification"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Request the narrowest scope that works.",children:"Drop from a restricted scope to a sensitive one, or a sensitive one to a non-sensitive one, wherever your feature allows — it's the single biggest lever on review time."}),e.jsx(R,{lead:"Verify your domain and publish a privacy policy.",children:"Verified ownership of every domain on the consent screen and a live policy URL are prerequisites — the same policy your listing needs."}),e.jsx(R,{lead:"Match scopes to your permission justifications.",children:"Reviewers cross-check the OAuth scopes against the case you make on the Permissions topic. Inconsistencies stall both reviews."})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"Separate from the store review"}),e.jsx("span",{className:"chip",children:"Sensitive scopes = verification"}),e.jsx("span",{className:"chip",children:"Restricted scopes = security assessment"})]}),e.jsx(yt,{linkKey:"google.oauthConsent"}),e.jsx(fe,{assistKey:"oauth-verification",topicName:"OAuth & sign-in verification"}),e.jsx(ge,{label:"My OAuth scopes and consent screen are ready",note:"Start verification as early as you can — it runs in parallel with everything else and is the most common launch-day surprise.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const QM=Object.freeze(Object.defineProperty({__proto__:null,OAuthVerificationScreen:Nm},Symbol.toStringTag,{value:"Module"}));function Cm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(Ee,{size:26}),title:"Single purpose & listing quality",meta:"About 30 minutes · two of the top rejection causes",onBack:t,assistKey:"single-purpose-listing"}),e.jsxs("p",{className:"lead",children:["Every extension must have a ",e.jsx("b",{children:"single, narrow purpose"}),", and your listing has to describe it clearly. Bundling unrelated features, or a vague/keyword-stuffed listing, are among the most common reasons a submission gets rejected — both before you ever reach a human reviewer and during manual review."]}),e.jsx("p",{className:"lead dim",children:"Write your one-sentence purpose first. Everything else — permissions, the description, the category — should follow from it."}),e.jsx("div",{className:"seclabel",children:"The single-purpose policy"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"One narrow purpose, stated in a sentence.",children:`"Save articles to read later," not "a toolkit for productivity." If you can't say it in one sentence, it's probably two extensions.`}),e.jsx(R,{lead:"No unrelated functionality.",children:"A second, tangential feature — even a useful one — gets the whole extension rejected. Ship it separately if it doesn't serve the one purpose."}),e.jsx(R,{lead:"Permissions trace back to that purpose.",children:"Every permission you request should obviously serve the stated purpose, which is exactly what the Permissions topic asks you to justify."})]}),e.jsx("div",{className:"seclabel",children:"Listing quality"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"A description that says what it does, not what it's like.",children:"Lead with the purpose and the concrete value. Reviewers and users both bounce off generic marketing copy."}),e.jsx(R,{lead:"The right category.",children:"Pick the category that matches the purpose. A mismatched category is a flag and hurts discovery."}),e.jsx(R,{lead:"No keyword stuffing or misleading claims.",children:`Repeated keywords in the title/description, fake "official" branding, or features you don't actually have are explicit policy violations.`})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"One sentence, one purpose"}),e.jsx("span",{className:"chip",children:"Description matches behavior"}),e.jsx("span",{className:"chip",children:"Honest title & category"})]}),e.jsx(yt,{linkKey:"chrome.devConsole",label:"Edit the listing description in the developer dashboard"}),e.jsx(fe,{assistKey:"single-purpose-listing",topicName:"Single purpose & listing quality"}),e.jsx(ge,{label:"My purpose is narrow and my listing reflects it",note:"Re-read your listing as a skeptical reviewer: does it promise exactly what the extension does, and nothing more?",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const ZM=Object.freeze(Object.defineProperty({__proto__:null,SinglePurposeListingScreen:Cm},Symbol.toStringTag,{value:"Module"}));function Pm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx(rt,{size:26}),title:"Manifest & versioning",meta:"About 15 minutes · enforced before review even starts",onBack:t,assistKey:"manifest-versioning"}),e.jsxs("p",{className:"lead",children:["Your ",e.jsx("code",{children:"manifest.json"})," has to satisfy a few hard rules before the store will accept an upload at all — these checks run"," ",e.jsx("b",{children:"before"})," any human review. Getting them right means your Submit step goes through on the first try instead of bouncing."]}),e.jsx("p",{className:"lead dim",children:"These are mechanical, not judgment calls — but each one rejects the upload outright, with an error that isn't always obvious."}),e.jsx("div",{className:"seclabel",children:"The rules the store enforces"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Manifest V3 is required.",children:[e.jsx("code",{children:'"manifest_version": 3'}),". V2 is no longer accepted for new uploads — a service worker replaces the old background page, and blocking ",e.jsx("code",{children:"webRequest"})," is gone."]}),e.jsxs(R,{lead:"The version must strictly increase on every upload.",children:["Bump ",e.jsx("code",{children:"version"})," for each upload — the store rejects a re-used or lower number. This is the most common upload failure: forgetting to bump after a fix."]}),e.jsxs(R,{lead:"Use a valid version format.",children:["One to four dot-separated integers (e.g. ",e.jsx("code",{children:"1.2.0"}),"). Each part is compared numerically, so ",e.jsx("code",{children:"1.10"})," is newer than"," ",e.jsx("code",{children:"1.9"}),"."]})]}),e.jsx("div",{className:"seclabel",children:"Worth setting deliberately"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"minimum_chrome_version.",children:"Set it to the oldest Chrome you actually support. The store won't offer the extension to older browsers — sparing those users a version that would break for them."}),e.jsxs(R,{lead:"Keep name, description, and icons in sync.",children:["The manifest's ",e.jsx("code",{children:"name"}),"/",e.jsx("code",{children:"description"})," seed your listing, and the icon set here is what the store and toolbar render."]})]}),e.jsxs("div",{className:"chips",children:[e.jsx("span",{className:"chip",children:"manifest_version: 3"}),e.jsx("span",{className:"chip",children:"version strictly increases"}),e.jsx("span",{className:"chip",children:"minimum_chrome_version set"})]}),e.jsx(fe,{assistKey:"manifest-versioning",topicName:"Manifest & versioning"}),e.jsx(ge,{label:"My manifest is MV3 and the version is bumped",note:"Bumping the version is the easiest step to forget — make it part of your build, not a manual afterthought.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const eI=Object.freeze(Object.defineProperty({__proto__:null,ManifestVersioningScreen:Pm},Symbol.toStringTag,{value:"Module"}));function Tm({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Submit for review",meta:"About 15 minutes · then a review wait",onBack:t,assistKey:"submit-review"}),e.jsx("p",{className:"lead",children:"Last step: package your extension, upload it, and submit for review. Once you submit, the Chrome Web Store checks your listing against its policies before it goes public."}),e.jsx("div",{className:"seclabel",children:"Packaging & submitting"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Build and zip the extension.",children:"Produce your production build and zip its folder — the zip is what you upload, not the source repository."}),e.jsxs(R,{lead:"Put manifest.json at the zip root.",children:["The ",e.jsx("code",{children:"manifest.json"})," must sit at the top level of the zip, not inside a nested folder. Zipping the parent directory instead of its contents is a top first-upload failure."]}),e.jsx(R,{lead:"Upload and fill in the listing.",children:"Drop the zip into the dashboard, then complete the description, category, assets, and the data-use disclosure."}),e.jsx(R,{lead:"Choose visibility and rollout.",children:"At submit time you pick the distribution — public, unlisted, or private — and can stage a percentage rollout to release gradually."}),e.jsx(R,{lead:"Submit for review.",children:"Once everything validates, submit. You can't edit a submission while it's under review — but you can keep developing and submit a new version, and a rejection doesn't lose your draft."})]}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"What to expect"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Timelines vary — hours to weeks.",children:"Many reviews clear in hours to a few days, but a new publisher account, broad host permissions, remote code, or OAuth scopes can push it to weeks. Plan for the longer end if any of those apply."}),e.jsx(R,{lead:"Rejections come with a reason.",children:"If it's rejected, the store says why. The usual culprits are permission justifications and the privacy policy — both covered in the earlier steps."})]}),e.jsx(yt,{linkKey:"chrome.devConsole",label:"Upload and submit in the developer dashboard"}),e.jsx(Cr,{}),e.jsx(fe,{assistKey:"submit-review",topicName:"Submit for review"}),e.jsx(ge,{label:"I've submitted for review",note:"Once approved, your store listing link is what you share to install the extension.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const tI=Object.freeze(Object.defineProperty({__proto__:null,SubmitReviewScreen:Tm},Symbol.toStringTag,{value:"Module"})),iS=[{q:"Can my testers just double-click a file to install it?",a:"Not for the load-unpacked path — Chrome blocks installing extensions from a double-clicked file outside the Web Store. Each tester opens the browser's extensions page, turns on Developer mode, and chooses “Load unpacked” on the folder. If you want a one-click install link, use an unlisted Web Store listing instead."},{q:"Will the extension update itself for my testers?",a:"Only the unlisted Web Store listing auto-updates — you upload a new version and Chrome pushes it to everyone with the link. A load-unpacked build never auto-updates: you re-send the zip and each tester reloads it. A self-hosted .crx can auto-update via its update_url, but that path is really for managed/enterprise installs."},{q:`Do I need the ${me("chromeStore.fee").value} developer account just to share with my team?`,a:`Not for the zip / load-unpacked handoff — that needs no account at all. You only need the one-time ${me("chromeStore.fee").value} developer account if you want the unlisted-listing path (link-shareable, auto-updating, and trusted by Chrome).`}];function Om({onBack:t,onComplete:n,status:s,onRevert:r}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{icon:e.jsx($e,{size:26}),title:"Share with testers",meta:"About 10 minutes · no public listing",onBack:t,assistKey:"share-testing"}),e.jsx("p",{className:"lead",children:"Want a few people to try your extension before it's public? You don't have to go through the Chrome Web Store review. There are three ways to hand a build to testers — from a zip you email today, to a private store listing that auto-updates, to a self-hosted package for managed fleets. Pick by how many testers you have and whether they need updates."}),e.jsx("div",{className:"seclabel",children:"Load unpacked (zip handoff)"}),e.jsxs(ce,{children:[e.jsx(R,{lead:"Build, zip, and send it.",children:"Produce your production build and zip the output folder. Each tester opens the browser's extensions page, enables Developer mode, and chooses “Load unpacked” on the unzipped folder. No account, no review — it works the moment they load it."}),e.jsxs(R,{lead:"Put manifest.json at the zip root.",children:["The ",e.jsx("code",{children:"manifest.json"})," must sit at the top level of the unzipped folder, not inside a nested directory — the same gotcha that trips up store uploads."]}),e.jsxs(R,{lead:"Know the trade-offs.",children:["There is ",e.jsx("b",{children:"no auto-update"})," — to ship a fix you re-send the zip and testers reload it. Chrome also shows a persistent “disable developer-mode extensions” warning, which can confuse non-technical testers. Best for a handful of trusted people on a short loop."]})]}),e.jsx(nn,{assistKey:"share-testing",topicName:"Share with testers",goalId:"zip-load-unpacked",buttonLabel:'Ask AI to help with the "Load Unpacked (Zip Handoff)" goal'}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Unlisted / private Web Store listing"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Upload to the store, but hide it.",children:["You still upload to the Chrome Web Store, but set visibility to"," ",e.jsx("b",{children:"Unlisted"})," (link-shareable, not discoverable in search) or"," ",e.jsx("b",{children:"Private"})," (restricted to named testers). Anyone with the link installs in one click — no Developer mode, no warning."]}),e.jsx(R,{lead:"It auto-updates and is trusted by Chrome.",children:"Push a new version and the store delivers it to every tester automatically. Because it's a real store install, Chrome trusts it — none of the unpacked-build friction."}),e.jsxs(R,{lead:"It still needs the one-time developer account.",children:["An unlisted listing requires the same"," ",e.jsx("b",{children:me("chromeStore.fee").value})," developer registration as a public one (see the ",e.jsx("b",{children:"Store accounts"})," topic). An unlisted listing also still goes through review — it just isn't publicly discoverable once approved."]})]}),e.jsx(yt,{linkKey:"chrome.devConsole",label:"Upload an unlisted build in the developer dashboard"}),e.jsx(nn,{assistKey:"share-testing",topicName:"Share with testers",goalId:"unlisted-listing",buttonLabel:'Ask AI to help with the "Unlisted / Private Web Store Listing" goal'}),e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Self-hosted .crx + update_url (advanced)"}),e.jsxs(ce,{children:[e.jsxs(R,{lead:"Host the packed .crx and an update manifest.",children:["Pack the extension to a ",e.jsx("code",{children:".crx"}),", host it alongside an update manifest, and point the manifest's ",e.jsx("code",{children:"update_url"})," at it. This is the only path that needs no store account at all."]}),e.jsxs(R,{lead:"Chrome blocks off-store .crx for ordinary users.",children:["For a normal browser profile, Chrome refuses to install an off-store",e.jsx("code",{children:".crx"}),". This path really exists for"," ",e.jsx("b",{children:"managed / enterprise"})," force-install via admin policy (e.g. a company's device management) — not for casual beta testers."]})]}),e.jsx(nn,{assistKey:"share-testing",topicName:"Share with testers",goalId:"self-host-crx",buttonLabel:'Ask AI to help with the "Self-Hosted .crx + update_url (Advanced)" goal'}),e.jsx(Ve,{items:iS}),e.jsx(Cr,{}),e.jsx(ge,{label:"I've shared a build with testers",note:"When you're ready for the public store, the store-accounts → submit-for-review chain takes it the rest of the way.",status:s,onComplete:()=>n==null?void 0:n(),onRevert:r,onBack:t})]})}const nI=Object.freeze(Object.defineProperty({__proto__:null,ExtensionDistributionScreen:Om},Symbol.toStringTag,{value:"Module"}));function rn({tone:t="cost",title:n,children:s}){const r=t==="wait"?"⏳":t==="size"?"⬇":"$";return e.jsxs("div",{className:"sd-callout "+t,children:[e.jsx("span",{className:"sd-callout-ic","aria-hidden":"true",children:r}),e.jsxs("div",{children:[e.jsx("div",{className:"sd-callout-t",children:n}),e.jsx("div",{className:"sd-callout-b",children:s})]})]})}function ct({store:t,badge:n,enrollUrl:s,enrollLabel:r,children:a}){const o=t==="ios"?"Apple App Store":"Google Play",i=t==="ios"?"":"▶";return e.jsxs("div",{className:"sd-store "+t,children:[e.jsx("div",{className:"sd-store-mark","aria-hidden":"true",children:i}),e.jsxs("div",{className:"sd-store-body",children:[e.jsxs("div",{className:"sd-store-top",children:[e.jsx("span",{className:"sd-store-name",children:o}),e.jsx("span",{className:"sd-store-badge",children:n})]}),e.jsx("div",{className:"sd-store-desc",children:a}),s&&e.jsx("a",{className:"sd-store-enroll",href:s,target:"_blank",rel:"noreferrer noopener",children:r??"Enrol →"})]})]})}function an({items:t}){return e.jsx("div",{className:"sd-checks",children:t.map((n,s)=>e.jsxs("div",{className:"sd-check",children:[e.jsx(Be,{}),e.jsx("span",{children:n})]},s))})}const sI=Object.freeze(Object.defineProperty({__proto__:null,CheckList:an,CostCallout:rn,StoreCard:ct},Symbol.toStringTag,{value:"Module"}));function Cn(t){return t==="ios"||t==="both"}function Yn(t){return t==="android"||t==="both"}const tc=["swift","swiftui","ios","uikit"],nc=["kotlin","android","jetpack-compose"];function sc(t,n){return t&&!n?"ios":n&&!t?"android":null}function lS(t){if(!t)return"both";const n=t.platforms;if(Array.isArray(n)){const a=n.some(i=>String(i).toLowerCase().includes("ios")),o=n.some(i=>String(i).toLowerCase().includes("android"));if(a&&!o)return"ios";if(o&&!a)return"android";if(a||o)return"both"}const s=String(t.framework??"").toLowerCase();if(s){const a=sc(tc.some(o=>s.includes(o)),nc.some(o=>s.includes(o)));if(a)return a}const r=String(t.id??"").toLowerCase().split("-");if(r.some(Boolean)){const a=sc(tc.some(o=>r.includes(o)),nc.some(o=>r.includes(o)));if(a)return a}return"both"}function Am({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t),c=[{q:"Do I really have to pay before I can ship?",a:"Yes — there's no free tier for publishing to the stores. Apple charges $99/year and Google a one-time $25. You can build and test for free; the fee is the gate to actually listing the app."},{q:"How long does verification take?",a:"Anywhere from a few hours to several days for identity checks. The slow part is organisation/business verification — and if you need a brand-new D-U-N-S number for Apple, that alone can take up to ~2 weeks. Start it well before your planned launch."},{q:"Why is my Play account stuck in closed testing?",a:"Personal Google Play accounts created after 2023-11-13 must run a closed test with at least 12 testers opted in for 14 continuous days before they can request production access. If your tester count drops below 12, the 14-day clock resets. Organisation accounts are generally not subject to this."},{q:"Do I need a Mac to ship an iOS app?",a:"Practically, yes — building, signing, and uploading an iOS build needs Xcode, which only runs on macOS. You can write the code anywhere, but the final build and submission step expects a Mac (or a cloud Mac/CI service)."},{q:"Can I publish to just one store first?",a:"Absolutely. Many teams ship to one platform to start. Enrol only in the account you need now — you can add the other later without redoing anything."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(Me,{size:26}),title:"Developer accounts",meta:"One-time setup · paid · about 20 minutes",assistKey:"dev-accounts"}),e.jsx("p",{className:"lead",children:"Before an app can reach the stores, you have to enrol as a developer with each company you ship to. This is the account that owns your app, signs your builds, and gets paid out — so it's worth doing carefully and once."}),e.jsxs(rn,{tone:"cost",title:"These accounts cost money up front",children:["Plan for this before you start — there's no free tier for publishing.",o&&i?" Together that's $99 the first year plus a one-time $25.":""]}),e.jsx("div",{className:"seclabel",children:"What to set up"}),o?e.jsxs(ct,{store:"ios",badge:me("appleDeveloper.fee").value,enrollUrl:"https://developer.apple.com/programs/enroll/",enrollLabel:"Enrol in the Apple Developer Program →",children:["Enrol in the ",e.jsx("b",{children:"Apple Developer Program"})," at developer.apple.com. The membership renews yearly; let it lapse and your apps are pulled from sale. Enrolling as an organisation needs a D-U-N-S number — if you don't already have one, issuance can take ",e.jsx("b",{children:"up to ~2 weeks"}),", so start this well before your planned launch."]}):null,i?e.jsxs(ct,{store:"android",badge:me("googlePlay.fee").value,enrollUrl:"https://play.google.com/console/signup",enrollLabel:"Open Google Play Console signup →",children:["Register for the ",e.jsx("b",{children:"Google Play Console"})," at play.google.com/console. The fee is one-time, not yearly. ",me("playStore.closedTestGate").value," ","— and if your tester count drops below 12, the 14-day clock resets. Organisation accounts are generally not subject to this gate. Factor the closed-test window into your timeline."]}):null,e.jsx(rn,{tone:"wait",title:"Verification isn't instant",children:"Identity and (for organisations) business verification can take anywhere from a few hours to several days. Get this out of the way before you're ready to ship, not the night before."}),e.jsx(Ve,{items:c}),e.jsx(fe,{assistKey:"dev-accounts",topicName:"Developer accounts"}),e.jsx(ge,{label:"Mark developer accounts as set up",note:"Do this once you've enrolled and your account is verified.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const rI=Object.freeze(Object.defineProperty({__proto__:null,DevAccountsScreen:Am},Symbol.toStringTag,{value:"Module"}));function Rm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t),c=[{q:"Do my screenshots have to be the exact pixel sizes?",a:"For the required sets, yes — App Store Connect rejects the wrong dimensions. Capture on the 6.9″ iPhone simulator (1320×2868) and Apple scales that master down for the smaller phones; the older 6.7″/6.5″ sizes are still accepted if that's all you have."},{q:"Why does my Google Play listing keep getting rejected?",a:"The most common cause is a missing feature graphic (1024×500) — it's mandatory and easy to forget — or placeholder/lorem-ipsum screens. Make sure the 512×512 icon, the feature graphic, and at least two real phone screenshots are all uploaded."},{q:"Do I need separate icons for each store?",a:"Yes, at different sizes: a 1024×1024 master for the App Store and a 512×512 icon for Google Play. Both must be square PNGs with no transparency and no pre-rounded corners — the stores round them for you."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(rt,{size:26}),title:"Store assets",meta:"Design work · about 1–2 hours",assistKey:"store-assets"}),e.jsx("p",{className:"lead",children:"Every store listing needs artwork: a high-resolution app icon, a set of screenshots, and some promo imagery. The stores reject submissions with the wrong sizes or placeholder art, so it's worth getting these right before you submit."}),e.jsx("div",{className:"seclabel",children:"The essentials, everywhere"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"App icon"})," — a square PNG with no transparency and no rounded corners (the stores round them for you). Apple wants a 1024×1024 master; Google Play wants a 512×512 icon — export both, not one size everywhere."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Screenshots"})," — captured on the exact device sizes each store asks for, not scaled-up phone shots."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"No placeholder art"}),' — "lorem ipsum" screens and stock icons are the most common rejection reason.']})]}),e.jsx("div",{className:"seclabel",children:"Per store"}),o?e.jsxs(ct,{store:"ios",badge:me("appleScreenshots.iphone").value,children:["The App Store's primary iPhone set is now the ",e.jsx("b",{children:"6.9″ (1320×2868)"})," ","size — capture on that simulator and Apple scales the master down for smaller phones. The older 6.7″/6.5″ sizes (1290×2796, 1242×2688) are still accepted as a fallback. If your app supports iPad, also provide the ",me("appleScreenshots.ipad").value," master. App previews (short videos) are optional but help conversion."]}):null,i?e.jsxs(ct,{store:"android",badge:"512×512 icon + feature graphic",children:["Google Play needs a ",e.jsx("b",{children:"512×512"})," icon (not the 1024×1024 iOS master), a 1024×500 ",e.jsx("b",{children:"feature graphic"})," (the banner at the top of your listing — easy to forget), and at least two phone screenshots. The feature graphic is mandatory; the listing won't publish without it."]}):null,e.jsx(Ve,{items:c}),e.jsx(fe,{assistKey:"store-assets",topicName:"Store assets"}),e.jsx(ge,{label:"Mark store assets as ready",note:"Do this once your icon and screenshots are exported at the right sizes.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const aI=Object.freeze(Object.defineProperty({__proto__:null,StoreAssetsScreen:Rm},Symbol.toStringTag,{value:"Module"}));function Em({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t);return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(Ee,{size:26}),title:"Store listing",meta:"Writing + forms · about 45 minutes",assistKey:"store-listing"}),e.jsx("p",{className:"lead",children:"The listing is how people decide whether to install. It's your title and subtitle, the description, a category, and a keyword set — plus the privacy disclosures the stores now require. The writing sells; the privacy form is a hard gate."}),e.jsx("div",{className:"seclabel",children:"Write these"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Title & subtitle"})," — clear over clever. The first few words are what shows in search results."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Description"})," — lead with what the app does and who it's for; keep the keyword-stuffing out, both stores penalise it."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Category"})," — pick the one your app actually fits; it affects where you rank."]})]}),e.jsx("div",{className:"seclabel",children:"Privacy is required now"}),o?e.jsxs(ct,{store:"ios",badge:"Nutrition labels",children:["Apple's ",e.jsx("b",{children:'privacy "nutrition labels"'})," ask you to declare exactly what data your app collects and how it's used. You fill these in App Store Connect; they show on your listing. Misdeclaring is grounds for removal, so answer them honestly."]}):null,i?e.jsxs(ct,{store:"android",badge:"Data safety form",children:["Google Play's ",e.jsx("b",{children:"Data safety"})," form covers the same ground — collection, sharing, and security practices. It's mandatory; the listing can't go live until it's complete and consistent with what your app actually does."]}):null,e.jsx(fe,{assistKey:"store-listing",topicName:"Store listing"}),e.jsx(ge,{label:"Mark store listing as drafted",note:"Do this once your copy is written and the privacy form is filled in.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const oI=Object.freeze(Object.defineProperty({__proto__:null,StoreListingScreen:Em},Symbol.toStringTag,{value:"Module"}));function Mm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t),c=[{q:"How long does the first store review really take?",a:"Once you're set up, per-update reviews are fast — Apple usually within a day, Google often within hours. The slow one is a new Google Play account's first production-access approval, which can take ~7 days on top of the closed-testing gate. Plan your launch date around that first approval, not the steady-state speed."},{q:"Why is my Play app stuck before I can go to production?",a:me("playStore.closedTestGate").value+" — and the 14-day clock resets if the tester count drops below 12. Organisation accounts are generally not subject to this gate."},{q:"How many testers can I have?",a:"On TestFlight, up to 100 internal testers (your team) and up to 10,000 external testers. On Google Play, internal testing is a small email list, while closed/open tracks scale much larger."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx($e,{size:26}),title:"Testing & distribution",meta:"Build + review · hours to days",assistKey:"testing-distribution"}),e.jsx("p",{className:"lead",children:"Before you release to everyone, you put a build in front of a small group of testers, then submit that build for the store's review. Both steps use the store's own tooling — you don't email APKs around."}),e.jsxs(rn,{tone:"size",title:"First native build pulls a large SDK",children:["Producing a real device build downloads the platform toolchain — often",e.jsx("b",{children:" 8–12 GB"})," and ",e.jsx("b",{children:"10–30 minutes"})," the first time. Run the iOS pre-flight checks in ",e.jsx("code",{children:"MOBILE_SETUP.md"})," before you kick it off so a missing platform SDK surfaces in seconds, not ten minutes in."]}),e.jsx("div",{className:"seclabel",children:"Get a build to testers"}),o?e.jsxs(e.Fragment,{children:[e.jsxs(ct,{store:"ios",badge:"TestFlight",children:["Upload to ",e.jsx("b",{children:"TestFlight"})," from Xcode or your CI. Internal testers (up to 100 on your team) get builds instantly; ",e.jsx("b",{children:"external testers go up to 10,000"}),` and go through a lighter "beta" review first. This is also how you sanity-check the exact binary you'll submit.`]}),e.jsx(nn,{assistKey:"testing-distribution",topicName:"Testing & distribution",goalId:"prep-testflight",buttonLabel:"Ask AI to help: Prep a TestFlight upload"})]}):null,i?e.jsxs(e.Fragment,{children:[e.jsxs(ct,{store:"android",badge:"Internal testing",children:["Use a Play Console ",e.jsx("b",{children:"internal testing"})," track for instant distribution to a list of tester emails. Promote the same build up through closed → open → production tracks as your confidence grows. Note the production gate: ",me("playStore.closedTestGate").value," ","(the 14-day clock resets below 12). Organisation accounts are generally not subject to this."]}),e.jsx(nn,{assistKey:"testing-distribution",topicName:"Testing & distribution",goalId:"prep-play-internal",buttonLabel:"Ask AI to help: Set up Play internal testing"})]}):null,e.jsx("div",{className:"seclabel",style:{marginTop:24},children:"Get ready for store review"}),e.jsx("p",{className:"lead",children:"Before you submit, run a pre-review pass across the stores you target: your privacy / data-safety answers match what the code actually does, the required usage-description strings are present, no debug or placeholder content ships, and deep links and permissions really work. Submitting a clean build is the fastest way through review."}),e.jsxs(rn,{tone:"wait",title:"Review takes real time",children:["Store review is a human process. Once you're established, per-update reviews are quick — Apple typically within a day, Google often within hours. The slow one is a ",e.jsx("b",{children:"new Google Play account's first production-access approval (~7 days)"}),", separate from and on top of the closed-testing gate. Build that first approval into your launch date — you can't rush it."]}),e.jsx(nn,{assistKey:"testing-distribution",topicName:"Testing & distribution",goalId:"prep-store-review",buttonLabel:"Ask AI to help: Get ready for store review"}),e.jsx(Ve,{items:c}),e.jsx(ge,{label:"Mark testing & distribution as set up",note:"Do this once a build is on a test track and you know the review path.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const iI=Object.freeze(Object.defineProperty({__proto__:null,TestingDistributionScreen:Mm},Symbol.toStringTag,{value:"Module"}));function Im({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t),c=[{q:"Can I test push on the iOS simulator?",a:"Partly. Xcode 14+/macOS 13+ simulators can receive a payload you drag onto them, but real end-to-end APNs delivery is unreliable on the simulator. Verify real delivery on a physical device before you rely on it."},{q:"Why aren't my notifications showing up?",a:"The most common reason is that the user never granted permission — on iOS notifications are off until they explicitly opt in, and Android 13+ also needs a runtime permission prompt. Check the permission state first, then your APNs key / FCM token wiring."},{q:"Do I have to add push before I launch?",a:"No — push is optional. If your app doesn't need to reach people while it's closed, skip it. You can add APNs/FCM later without resubmitting the rest of your setup."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(hi,{size:26}),title:"Push notifications",meta:"Optional · about 1 hour",assistKey:"push-notifications"}),e.jsx("p",{className:"lead",children:"Push lets your app reach people when it's closed. Each platform has its own delivery service you register with — you don't send notifications directly, you hand them to Apple or Google to deliver."}),e.jsx("div",{className:"seclabel",children:"The delivery services"}),o?e.jsxs(ct,{store:"ios",badge:"APNs",children:["Apple's ",e.jsx("b",{children:"Push Notification service (APNs)"}),". You create an APNs key or certificate in your developer account and register your app's capability in Xcode. On iOS the user must explicitly grant permission — notifications are off until they say yes."]}):null,i?e.jsxs(ct,{store:"android",badge:"FCM",children:["Google's ",e.jsx("b",{children:"Firebase Cloud Messaging (FCM)"}),". Add the Firebase config to your app and use the FCM token to target a device. Android 13+ also requires a runtime permission prompt, so don't assume delivery without it."]}):null,e.jsx("div",{className:"seclabel",children:"Get this right"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Ask at the right moment."})," Prompt for permission when the value is obvious, not on first launch — a denied prompt is hard to recover."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Make them opt-in and useful."})," Noisy notifications get your app muted or uninstalled."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Test on a real device."})," Push is unreliable on the iOS simulator — Xcode 14+/macOS 13+ can receive a dropped payload, but verify real delivery on a physical device."]})]}),e.jsx(Ve,{items:c}),e.jsx(fe,{assistKey:"push-notifications",topicName:"Push notifications"}),e.jsx(ge,{label:"Mark push notifications as set up",note:"Optional — skip it if your app doesn't need to reach people when closed.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const lI=Object.freeze(Object.defineProperty({__proto__:null,PushNotificationsScreen:Im},Symbol.toStringTag,{value:"Module"}));function Dm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(vt,{size:26}),title:"Crash reporting",meta:"Recommended · about 30 minutes",assistKey:"crash-reporting"}),e.jsx("p",{className:"lead",children:"Once real people run your app, some of them will hit crashes you never saw in testing — on devices and OS versions you don't own. Crash reporting captures those automatically so you find out before the one-star reviews do."}),e.jsx("div",{className:"seclabel",children:"What you'll get"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Stack traces"})," pointing at the exact line that failed, grouped so you see which crash hits the most people first."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Device context"})," — OS version, model, and steps — so you can reproduce instead of guessing."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Trends over time"})," so you can tell whether a release made things better or worse."]})]}),e.jsx("div",{className:"seclabel",children:"Common tools"}),e.jsxs("p",{className:"lead dim",children:[e.jsx("b",{children:"Firebase Crashlytics"})," (free, works on both platforms) and"," ",e.jsx("b",{children:"Sentry"})," (crashes plus broader error monitoring) are the usual starting points. Both drop in as an SDK; pick one and wire it once."]}),e.jsxs("div",{className:"sd-callout size",children:[e.jsx("span",{className:"sd-callout-ic","aria-hidden":"true",children:"⬇"}),e.jsxs("div",{children:[e.jsx("div",{className:"sd-callout-t",children:"Upload your symbols, or reports are noise"}),e.jsx("div",{className:"sd-callout-b",children:"Release builds are stripped, so a raw crash is unreadable hex. Upload the debug symbols (dSYMs on iOS, mapping files on Android) on every release — most SDKs automate this in CI — or your stack traces won't point at real code."})]})]}),e.jsx(fe,{assistKey:"crash-reporting",topicName:"Crash reporting"}),e.jsx(ge,{label:"Mark crash reporting as set up",note:"Do this once an SDK is wired in and symbol upload is part of your release.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const cI=Object.freeze(Object.defineProperty({__proto__:null,CrashReportingScreen:Dm},Symbol.toStringTag,{value:"Module"}));function Lm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=Yn(t),c=[{q:"Can't I just use Stripe like on the web?",a:"Not for digital goods consumed in the app — unlocking features, virtual currency, subscriptions. Those must go through the store's billing, and shipping a side payment link for them is one of the most common rejections. Stripe is fine for real-world goods and services (a ride, a physical product, an in-person class)."},{q:"Why is the commission lower in some cases?",a:"Both stores drop to 15% for most small developers — Apple's Small Business Program (under ~$1M/year) and Google's first $1M/year — and for subscriptions (Apple after the subscriber's first year, Google from day one). Above those thresholds the standard rate is 30%."},{q:"How do I test a purchase without being charged?",a:"Both stores have sandbox testers: Apple uses Sandbox Apple IDs in App Store Connect, Google uses license-test accounts in the Play Console. Purchases run end-to-end against test billing so you can verify the unlock flow without real money."},{q:"Do I have to verify the purchase on a server?",a:"For anything worth protecting, yes. Validate the store receipt / purchase token server-side before granting entitlements — a client-only check is trivially bypassed. Both platforms publish server-side verification APIs."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(qt,{size:26}),title:"In-app purchases & subscriptions",meta:"When you sell inside the app · about 30 minutes",assistKey:"in-app-purchases"}),e.jsxs("p",{className:"lead",children:["Selling anything digital inside your app — a subscription, a feature unlock, in-app currency — doesn't work like web checkout. The stores require you to use ",e.jsx("i",{children:"their"})," billing, take a cut, and reject apps that route around it. Getting this right early saves a painful rewrite later."]}),e.jsx(rn,{tone:"cost",title:"The store takes a commission on every sale",children:"Budget for it in your pricing from the start — the cut comes off the top of every transaction, before you see a cent."}),e.jsx("div",{className:"seclabel",children:"What you'll wire up"}),o?e.jsxs(ct,{store:"ios",badge:me("appStore.commission").value,children:["Use ",e.jsx("b",{children:"StoreKit"})," (StoreKit 2 is the current API) to define products in App Store Connect and present the native purchase sheet. Apple's cut is ",me("appStore.commission").value,"."," ",e.jsx(sn,{fact:me("appStore.commission")})]}):null,i?e.jsxs(ct,{store:"android",badge:me("googlePlay.commission").value,children:["Use the ",e.jsx("b",{children:"Google Play Billing Library"})," to define products in the Play Console and launch the billing flow. Google's service fee is"," ",me("googlePlay.commission").value,"."," ",e.jsx(sn,{fact:me("googlePlay.commission")})]}):null,e.jsx("div",{className:"seclabel",children:"The rule that gets apps rejected"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Digital goods must use store billing."}),' Subscriptions, feature unlocks, virtual currency — all of it goes through StoreKit / Play Billing. A Stripe link or "pay on our website" prompt for these is a rejection.']}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Physical goods and real-world services don't."})," A ride, a shipped product, an in-person class — bill those however you like; the stores explicitly don't want their cut of those."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Verify entitlements server-side."})," Validate the receipt or purchase token on your backend before unlocking — never trust the client alone."]})]}),e.jsx(Ve,{items:c}),e.jsx(fe,{assistKey:"in-app-purchases",topicName:"In-app purchases & subscriptions"}),e.jsx(ge,{label:"Mark in-app purchases as set up",note:"Do this once your products are defined and a sandbox purchase unlocks the right entitlement.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const dI=Object.freeze(Object.defineProperty({__proto__:null,InAppPurchasesScreen:Lm},Symbol.toStringTag,{value:"Module"}));function Fm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=Cn(t),i=[{q:"Do I need a privacy policy even if I collect almost nothing?",a:"Yes. Both stores require a reachable privacy policy URL for essentially every app — even a trivial one. It has to be live before you submit, and it must match what your app actually does. A dead link or a mismatch is a rejection."},{q:"Why do I have to let people delete their account in the app?",a:"Both Apple and Google require that apps which let you create an account also let you delete it — and the data tied to it — from inside the app (a web link is allowed alongside, but the in-app path must exist). It's a hard review gate, not a nicety."},{q:"What exactly counts as 'tracking' for the iOS prompt?",a:"Linking a user's data with data from other companies' apps or sites for advertising or sharing with data brokers. If you do that, you must show the App Tracking Transparency prompt and only track if they allow it. Plain first-party analytics usually isn't 'tracking' in Apple's sense — but the store privacy questionnaire still has to be answered honestly."},{q:"Is the privacy questionnaire the same as the privacy policy?",a:"No — they're two things. The store's privacy questionnaire (Apple's 'privacy nutrition label', Google's Data safety form) is a structured declaration you fill in at submission; the privacy policy is your own hosted page. Both have to agree with each other and with the app's real behavior."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(Me,{size:26}),title:"App privacy & tracking",meta:"Submission gate · about 30 minutes",assistKey:"app-privacy"}),e.jsx("p",{className:"lead",children:`A build that runs perfectly still gets held at review if its privacy story isn't in order. These gates are about what you tell users you do with their data — and the stores check them on every submission, so it's worth handling before you hit "submit," not after a rejection.`}),e.jsx("div",{className:"seclabel",children:"The gates that apply everywhere"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"A live privacy policy URL."})," Host a policy that matches what the app actually collects, and make sure the link resolves — a dead link is an instant rejection."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"In-app account deletion."})," If users can create an account, they must be able to delete it — and its data — from inside the app. Both stores require this path to exist."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"An honest privacy declaration."})," Fill in Apple's privacy label and Google's Data safety form to match reality; a mismatch with your policy or your code is a rejection."]})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"seclabel",children:"iOS only — the tracking prompt"}),e.jsxs(rn,{tone:"wait",title:"App Tracking Transparency is its own gate",children:["If your app tracks users across other companies' apps and sites — for ads or to share with data brokers — iOS requires the"," ",e.jsx("b",{children:"App Tracking Transparency"}),' prompt before any of it, and you may only track users who tap "Allow." Declare your tracking honestly; tracking without the prompt is a rejection (and, if shipped, an enforcement risk).']})]}):null,e.jsx(Ve,{items:i}),e.jsx(fe,{assistKey:"app-privacy",topicName:"App privacy & tracking"}),e.jsx(ge,{label:"Mark app privacy as set up",note:"Do this once your policy URL is live, account deletion works in-app, and the store privacy forms are filled in.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const uI=Object.freeze(Object.defineProperty({__proto__:null,AppPrivacyScreen:Fm},Symbol.toStringTag,{value:"Module"}));function zm({platform:t="both",onBack:n,onComplete:s,status:r,onRevert:a}){const o=[{q:"How long does review actually take?",a:"Apple is often a day or less now; Google can be a few hours to a few days, and longer for a brand-new account or a sensitive permission. The killer isn't the queue — it's the round-trips. Every rejection restarts the clock, so the way to ship fast is to not get rejected."},{q:"What's the most common avoidable rejection?",a:"Incomplete or inaccurate metadata and missing reviewer access. If a feature is behind a login, the reviewer needs a working demo account (or a documented way in) — otherwise they can't test it and they reject. Screenshots that don't match the app and broken support/privacy links are close behind."},{q:"What does 'minimum functionality' mean?",a:"Apple in particular rejects apps that are too thin — a repackaged website, a static brochure, or something that could just be a web page. The app needs to do something that justifies being an app. If it's borderline, add real native value before submitting."},{q:"I got rejected — now what?",a:"Read the exact guideline they cite, fix that specific thing, and reply in Resolution Center / the Play policy console with what you changed. Don't resubmit blind. If you genuinely disagree, you can respond or appeal — but a clean, targeted fix is almost always faster than arguing."}];return e.jsxs("div",{className:"hosting-screen",children:[e.jsx(pe,{onBack:n,icon:e.jsx(Ee,{size:26}),title:"Getting through review",meta:"Before you submit · about 20 minutes",assistKey:"app-review"}),e.jsx("p",{className:"lead",children:"Every store submission goes through a human (and automated) review, and it's where launches slip by weeks. The good news: almost every rejection is avoidable and predictable. Knock these out before you submit and most apps clear review on the first try."}),e.jsx(rn,{tone:"wait",title:"Rejections cost round-trips, not just time",children:"Each rejection sends you back to the end of the queue. Front-loading the common reasons is the single biggest thing you can do to ship on schedule."}),e.jsx("div",{className:"seclabel",children:"Clear these before submitting"}),e.jsx(an,{items:[e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Complete, accurate metadata."})," Real screenshots that match the current app, a truthful description, and working support and privacy URLs. Placeholder or mismatched assets get rejected."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"A demo account for the reviewer."})," Anything behind a login needs working credentials (or a documented bypass) in the review notes — otherwise the reviewer can't test it and rejects."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Enough functionality to be an app."})," Especially on iOS, a thin wrapper around a website or a static brochure gets rejected for minimum functionality. Make sure it does something app-worthy."]}),e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"Honest permissions and data use."})," Every permission you request needs a clear in-context reason, and your store privacy declaration has to match what the app does."]})]}),e.jsx(Ve,{items:o}),e.jsx(fe,{assistKey:"app-review",topicName:"Getting through review"}),e.jsx(ge,{label:"Mark review readiness as set up",note:"Do this once your metadata is complete, a reviewer demo account is in the notes, and permissions are all justified.",status:r,onComplete:()=>s==null?void 0:s(),onRevert:a,onBack:n})]})}const hI=Object.freeze(Object.defineProperty({__proto__:null,AppReviewScreen:zm},Symbol.toStringTag,{value:"Module"})),cS=5e3,rc=50;function dS(){const[t,n]=l.useState([]),[s,r]=l.useState(0),[a,o]=l.useState(null),[i,c]=l.useState(!0),[d,u]=l.useState(!1),[h,p]=l.useState(null),f=l.useRef("idle"),m=l.useRef([]),g=l.useRef(null);l.useEffect(()=>{m.current=t},[t]),l.useEffect(()=>{g.current=a},[a]);const b=l.useCallback(async()=>{if(f.current==="idle"){f.current="initial",c(!0),p(null);try{const v=await fetch(`/api/history?limit=${rc}`);if(!v.ok)throw new Error(`HTTP ${v.status}`);const w=await v.json();n(w.entries??[]),r(w.total??0),o(w.nextCursor??null),w.error&&p(w.error)}catch(v){p(v instanceof Error?v.message:"Failed to load history")}finally{c(!1),f.current="idle"}}},[]),x=l.useCallback(async()=>{var w;if(f.current!=="idle")return;const v=(w=m.current[0])==null?void 0:w.commit.sha;if(!v){await b();return}f.current="poll";try{const j=await fetch(`/api/history?since=${encodeURIComponent(v)}`);if(!j.ok)throw new Error(`HTTP ${j.status}`);const _=await j.json(),k=new Set(m.current.map(N=>N.commit.sha)),S=(_.entries??[]).filter(N=>!k.has(N.commit.sha));S.length>0&&(n(N=>[...S,...N]),r(N=>N+S.length))}catch(j){p(j instanceof Error?j.message:"Failed to poll history")}finally{f.current="idle"}},[b]),y=l.useCallback(async()=>{if(f.current!=="idle")return;const v=g.current;if(v){f.current="more",u(!0);try{const w=await fetch(`/api/history?limit=${rc}&before=${encodeURIComponent(v)}`);if(!w.ok)throw new Error(`HTTP ${w.status}`);const j=await w.json();n(_=>[..._,...j.entries??[]]),o(j.nextCursor??null),typeof j.total=="number"&&r(j.total)}catch(w){p(w instanceof Error?w.message:"Failed to load more commits")}finally{u(!1),f.current="idle"}}},[]);return l.useEffect(()=>{b();const v=setInterval(()=>{x()},cS);return()=>clearInterval(v)},[b,x]),{rows:t,total:s,hasMore:a!==null,loading:i,loadingMore:d,error:h,loadMore:y,reload:b}}const ba={rows:[],total:0,truncated:!1,repo:null,screenshotsRepoRelDir:"",loading:!1,error:null};function uS(t){const[n,s]=l.useState(ba),r=(t==null?void 0:t.from)??null,a=(t==null?void 0:t.to)??null;return l.useEffect(()=>{if(r===null||a===null){s(ba);return}let o=!1;s(c=>({...c,loading:!0,error:null}));const i=new URLSearchParams({from:r,to:a});return fetch(`/api/history?${i.toString()}`).then(async c=>{if(!c.ok)throw new Error(`HTTP ${c.status}`);return await c.json()}).then(c=>{o||s({rows:c.entries??[],total:c.total??0,truncated:!!c.truncated,repo:c.repo??null,screenshotsRepoRelDir:c.screenshotsRepoRelDir??"",loading:!1,error:c.error??null})}).catch(c=>{o||s({...ba,error:c instanceof Error?c.message:"Failed to load range"})}),()=>{o=!0}},[r,a]),n}function $m(t){const n=new Map;return t.forEach((s,r)=>{var o;const a=((o=s.entry)==null?void 0:o.scenarioScreenshots)??[];for(const i of a)n.has(i.name)||n.set(i.name,r)}),n}const hS=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/__tests__\//,/tests?\//];function ki(t){return t.filter(n=>hS.some(s=>s.test(n.path)))}function pS(t){const n={},s={total:0,passed:0,failed:0},r=new Set,a=new Set,o=new Set,i=[];let c=0,d=0;for(const u of t){if(!u.entry){d++;continue}c++;const h=u.entry.type||"other";n[h]=(n[h]??0)+1,u.commit.authorName&&r.add(u.commit.authorName),u.entry.testResults&&(s.total+=u.entry.testResults.total,s.passed+=u.entry.testResults.passed,s.failed+=u.entry.testResults.failed);for(const p of ki(u.entry.modifiedFiles??[]))o.add(p.path);for(const p of u.entry.scenarioScreenshots??[])a.has(p.name)||(a.add(p.name),i.push(p))}return{totalChanges:c,byType:n,testFilesTouched:o.size,testTotals:s,screenshots:i,contributors:[...r],hiddenCommitOnlyCount:d}}const mS=[{key:"all-time",label:"All time"},{key:"last-24h",label:"Last 24 hours"},{key:"last-3d",label:"Last 3 days"},{key:"last-week",label:"Last week"},{key:"last-month",label:"Last month"}],Hs=864e5;function fS(t,n){const s=n.toISOString();switch(t){case"last-24h":return{from:new Date(n.getTime()-Hs).toISOString(),to:s};case"last-3d":return{from:new Date(n.getTime()-3*Hs).toISOString(),to:s};case"last-week":return{from:new Date(n.getTime()-7*Hs).toISOString(),to:s};case"last-month":return{from:new Date(n.getTime()-30*Hs).toISOString(),to:s};case"all-time":case"custom":return null}}function gS(t){const n=new Date(t.from),s=new Date(t.to);if(isNaN(n.getTime())||isNaN(s.getTime()))return`${t.from} – ${t.to}`;const r=h=>h.toLocaleDateString("en-US",{month:"short"}),a=r(n),o=n.getDate(),i=n.getFullYear(),c=r(s),d=s.getDate(),u=s.getFullYear();return i===u&&n.getMonth()===s.getMonth()?`${a} ${o} – ${d}, ${u}`:i===u?`${a} ${o} – ${c} ${d}, ${u}`:`${a} ${o}, ${i} – ${c} ${d}, ${u}`}function Bm({commit:t}){return e.jsxs("div",{className:"rounded-lg border px-4 py-3",style:{borderColor:"var(--border-default)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--text-dim)"},children:[e.jsx("span",{className:"font-mono uppercase tracking-wide",style:{color:"var(--text-muted)"},children:"commit"}),e.jsx("span",{className:"font-mono",style:{color:"var(--text-secondary)"},children:t.shortSha}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:Kh(t.timestamp)}),t.authorName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:t.authorName})]})]}),e.jsx("p",{className:"mt-1 text-sm truncate",style:{color:"var(--text-primary)"},children:t.subject})]})}const pI=Object.freeze(Object.defineProperty({__proto__:null,CommitOnlyHistoryRow:Bm},Symbol.toStringTag,{value:"Module"}));function Gr({entry:t,commit:n,onSelectScreenshot:s}){const r=ki(t.modifiedFiles??[]);return e.jsxs("div",{className:"rounded-lg border",style:{borderColor:"var(--border-default)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3",style:{borderBottom:"1px solid var(--border-subtle)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`text-xs font-medium uppercase tracking-wide ${Jh(t.type)}`,children:t.type}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:Kh(t.timestamp)}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:"·"}),e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-secondary)"},children:n.shortSha}),n.authorName&&e.jsxs("span",{className:"text-xs",style:{color:"var(--text-dim)"},children:["· ",n.authorName]})]})]}),e.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:t.title})]}),e.jsxs("div",{className:"px-4 py-3 flex flex-col gap-3",children:[t.userRequest&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium mb-1",style:{color:"var(--text-muted)"},children:"Prompt"}),e.jsx(Er,{children:t.userRequest})]}),(t.scenarioScreenshots??[]).length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium mb-1",style:{color:"var(--text-muted)"},children:"Screenshots"}),e.jsx(di,{screenshots:t.scenarioScreenshots??[],onSelect:s})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"Tests"}),t.testResults&&e.jsx(Ir,{total:t.testResults.total,passed:t.testResults.passed,failed:t.testResults.failed})]}),r.length>0?e.jsx("ul",{className:"flex flex-col gap-0.5",children:r.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx(Mr,{status:a.status}),e.jsx("span",{className:"font-mono text-xs truncate",style:{color:"var(--text-secondary)"},children:a.path})]},a.path))}):e.jsx("p",{className:"text-xs",style:{color:"var(--text-dim)"},children:"No test files changed"})]})]})]})}const mI=Object.freeze(Object.defineProperty({__proto__:null,HistoryEntryCard:Gr},Symbol.toStringTag,{value:"Module"}));function qm({selection:t,onChange:n,now:s=new Date}){const[r,a]=l.useState(""),[o,i]=l.useState(""),c=u=>{n({preset:u,range:fS(u,s)})},d=(u,h)=>{a(u),i(h),u&&h&&n({preset:"custom",range:{from:new Date(`${u}T00:00:00Z`).toISOString(),to:new Date(`${h}T23:59:59Z`).toISOString()}})};return e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[mS.map(u=>{const h=t.preset===u.key;return e.jsx("button",{type:"button",onClick:()=>c(u.key),"aria-pressed":h,className:`rounded border px-2.5 py-1 text-xs transition ${h?"border-[var(--accent-primary)] text-[var(--text-primary)]":"border-[var(--border-default)] text-[var(--text-muted)] hover:bg-[var(--bg-subtle)]"}`,children:u.label},u.key)}),e.jsx("span",{className:"mx-1 text-xs text-[var(--text-dim)]",children:"or"}),e.jsxs("label",{className:"flex items-center gap-1 text-xs text-[var(--text-dim)]",children:["From",e.jsx("input",{type:"date","aria-label":"Custom range start",value:r,onChange:u=>d(u.target.value,o),className:"rounded border border-[var(--border-default)] bg-transparent px-1.5 py-0.5 text-xs text-[var(--text-primary)]"})]}),e.jsxs("label",{className:"flex items-center gap-1 text-xs text-[var(--text-dim)]",children:["To",e.jsx("input",{type:"date","aria-label":"Custom range end",value:o,onChange:u=>d(r,u.target.value),className:"rounded border border-[var(--border-default)] bg-transparent px-1.5 py-0.5 text-xs text-[var(--text-primary)]"})]})]})}const fI=Object.freeze(Object.defineProperty({__proto__:null,HistoryRangeSelector:qm},Symbol.toStringTag,{value:"Module"}));function bS(t){const{rangeLabel:n,summary:s,rows:r,repo:a,screenshotsRepoRelDir:o}=t,i=(a==null?void 0:a.rawUrlTemplate)??null,c=[];c.push(`# Change digest — ${n}`),c.push(""),c.push(xS(s)),s.hiddenCommitOnlyCount>0&&(c.push(""),c.push(`_${s.hiddenCommitOnlyCount} non-journaled commit${s.hiddenCommitOnlyCount===1?"":"s"} hidden._`));const d=r.filter(u=>u.entry!==null);for(const u of d){const h=u.entry;c.push(""),c.push(`## ${h.title}`),c.push(""),c.push(`- **Type:** ${h.type}`),c.push(`- **Commit:** \`${u.commit.shortSha}\``),h.description&&(c.push(""),c.push(h.description));const p=ki(h.modifiedFiles??[]);if(p.length>0){c.push(""),c.push("**Test files:**");for(const m of p)c.push(`- \`${m.path}\``)}const f=h.scenarioScreenshots??[];if(f.length>0)if(c.push(""),i)for(const m of f){if(!m.screenshotPath)continue;const g=i.replace("{sha}",u.commit.sha).replace("{path}",yS(o,m.screenshotPath));c.push(``)}else{c.push("**Screenshots (local only):**");for(const m of f)c.push(`- ${m.name}`)}}return c.join(`
|
|
30
|
+
`)}function xS(t){const n=[];n.push(`**${t.totalChanges}** change${t.totalChanges===1?"":"s"}`);const s=Object.entries(t.byType).map(([r,a])=>`${a} ${r}`);return s.length>0&&n.push(s.join(", ")),n.push(`${t.testFilesTouched} test file${t.testFilesTouched===1?"":"s"}`),t.testTotals.total>0&&n.push(`${t.testTotals.passed}/${t.testTotals.total} tests passed`),n.push(`${t.screenshots.length} screenshot${t.screenshots.length===1?"":"s"}`),n.join(" · ")}function yS(t,n){const s=t.replace(/\/+$/,""),r=n.replace(/^\/+/,"");return s?`${s}/${r}`:r}function Hm({summary:t}){return e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsxs("span",{className:"text-[var(--text-primary)]",children:[t.totalChanges," change",t.totalChanges===1?"":"s"]}),Object.entries(t.byType).map(([n,s])=>e.jsxs("span",{className:Jh(n),children:[s," ",n]},n)),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[t.testFilesTouched," test file",t.testFilesTouched===1?"":"s"]}),e.jsx(Ir,{total:t.testTotals.total,passed:t.testTotals.passed,failed:t.testTotals.failed}),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[t.screenshots.length," screenshot",t.screenshots.length===1?"":"s"]}),t.contributors.length>0&&e.jsx("span",{className:"text-[var(--text-dim)]",children:t.contributors.join(", ")})]})}const gI=Object.freeze(Object.defineProperty({__proto__:null,HistoryDigestStatRow:Hm},Symbol.toStringTag,{value:"Module"}));function Wm({rangeLabel:t,summary:n,rows:s,repo:r,screenshotsRepoRelDir:a,truncated:o,onPreviewScreenshot:i}){const[c,d]=l.useState(!1),u=$m(s),h=async()=>{const p=bS({rangeLabel:t,summary:n,rows:s,repo:r,screenshotsRepoRelDir:a});try{await navigator.clipboard.writeText(p),d(!0),setTimeout(()=>d(!1),2e3)}catch{}};return n.totalChanges===0?e.jsxs("div",{children:[e.jsx(Za,{rangeLabel:t,onCopy:h,copied:c}),e.jsxs("div",{className:"py-10 text-center text-[var(--text-dim)]",children:[e.jsx("p",{children:"No changes in this window."}),n.hiddenCommitOnlyCount>0&&e.jsxs("p",{className:"mt-2 text-xs",children:[n.hiddenCommitOnlyCount," non-journaled commit",n.hiddenCommitOnlyCount===1?"":"s"," hidden."]})]})]}):e.jsxs("div",{children:[e.jsx(Za,{rangeLabel:t,onCopy:h,copied:c}),e.jsx(Hm,{summary:n}),n.hiddenCommitOnlyCount>0&&e.jsxs("p",{className:"mb-3 text-xs text-[var(--text-dim)]",children:[n.hiddenCommitOnlyCount," non-journaled commit",n.hiddenCommitOnlyCount===1?"":"s"," hidden from this digest."]}),o&&e.jsxs("p",{className:"mb-3 text-xs text-[var(--accent-yellow,#eab308)]",children:["Showing the ",s.length," most recent changes in this window — narrow the range to see the rest."]}),n.screenshots.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-[var(--text-muted)]",children:"Screenshots"}),e.jsx(di,{screenshots:n.screenshots,onSelect:i?p=>i({...p,isLatest:u.get(p.name)===vS(s,p.name)}):void 0})]}),e.jsx("div",{className:"flex flex-col gap-3",children:s.map((p,f)=>p.entry?e.jsx(Gr,{entry:p.entry,commit:p.commit,onSelectScreenshot:i?m=>i({...m,isLatest:u.get(m.name)===f}):void 0},p.commit.sha):null)})]})}function Za({rangeLabel:t,onCopy:n,copied:s}){return e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-primary)]",children:t}),e.jsx("button",{type:"button",onClick:n,className:"rounded border border-[var(--border-default)] px-2.5 py-1 text-xs text-[var(--text-muted)] hover:bg-[var(--bg-subtle)]",children:s?"Copied!":"Copy summary"})]})}function vS(t,n){return t.findIndex(s=>{var r;return(((r=s.entry)==null?void 0:r.scenarioScreenshots)??[]).some(a=>a.name===n)})}const bI=Object.freeze(Object.defineProperty({__proto__:null,DigestHeader:Za,HistoryDigest:Wm},Symbol.toStringTag,{value:"Module"}));function Gm({onPreviewScreenshot:t}={}){const[n,s]=l.useState({preset:"all-time",range:null});return e.jsxs(en,{children:[e.jsx(qm,{selection:n,onChange:s}),n.range?e.jsx(jS,{range:n.range,onPreviewScreenshot:t}):e.jsx(wS,{onPreviewScreenshot:t})]})}function jS({range:t,onPreviewScreenshot:n}){const{rows:s,truncated:r,repo:a,screenshotsRepoRelDir:o,loading:i,error:c}=uS(t);if(i)return e.jsx("div",{className:"py-12 text-center text-[var(--text-muted)]",children:"Loading digest..."});if(c)return e.jsx("div",{className:"py-12",children:e.jsx(Qe,{text:`Failed to load digest: ${c}`,className:"text-sm text-[var(--accent-red)]",rowClassName:"justify-center"})});const d=pS(s);return e.jsx(Wm,{rangeLabel:gS(t),summary:d,rows:s,repo:a,screenshotsRepoRelDir:o,truncated:r,onPreviewScreenshot:n})}function wS({onPreviewScreenshot:t}){const{rows:n,total:s,hasMore:r,loading:a,loadingMore:o,error:i,loadMore:c}=dS();if(a)return e.jsx("div",{className:"py-12 text-center text-[var(--text-muted)]",children:"Loading history..."});if(i&&n.length===0)return e.jsx("div",{className:"py-12",children:e.jsx(Qe,{text:`Failed to load history: ${i}`,className:"text-sm text-[var(--accent-red)]",rowClassName:"justify-center"})});if(n.length===0)return e.jsxs("div",{className:"py-12 text-center text-[var(--text-dim)]",children:[e.jsx("p",{children:"No commits yet."}),e.jsx("p",{className:"mt-2 text-sm",children:"Commits and journal entries will appear here as you build features."})]});const d=Math.max(s,n.length),u=$m(n);return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-3 text-xs",style:{color:"var(--text-dim)"},children:[n.length," of ",d," commit",d===1?"":"s"]}),e.jsx("div",{className:"flex flex-col gap-3",children:n.map((h,p)=>h.entry?e.jsx(Gr,{entry:h.entry,commit:h.commit,onSelectScreenshot:t?f=>t({...f,isLatest:u.get(f.name)===p}):void 0},h.commit.sha):e.jsx(Bm,{commit:h.commit},h.commit.sha))}),r?e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>void c(),disabled:o,className:"rounded border border-[var(--border)] px-3 py-1 text-sm text-[var(--text-muted)] hover:bg-[var(--bg-subtle)] disabled:opacity-50",children:o?"Loading...":"Load older commits"})}):null]})}const xI=Object.freeze(Object.defineProperty({__proto__:null,HistoryTab:Gm},Symbol.toStringTag,{value:"Module"})),_S="I came to the Build tab to find the AI waiting for me but never saw any of the idle notifications — no sound, no orange dot on the Build tab, no idle banner. Please diagnose using the trace below.\n\nStart with the **UI idle trace** section: a single `debounce-cancelled` line with a `trigger` field identifies which silent path killed the 1500ms debounce before `debounce-resolved` could fire. Cross-reference with the **Rust idle trace** and **editor-server.log** sections to confirm the backend actually sent `agent-idle` and to see the timing.";function kS(){const t=typeof Notification<"u"?Notification.permission:"unknown",n=typeof document<"u"&&typeof document.hasFocus=="function"?document.hasFocus():!1,s=typeof document<"u"?document.hidden:!1;let r=null;try{r=typeof localStorage<"u"?localStorage.getItem("codeyam.idleDebug"):null}catch{}const a=typeof navigator<"u"?navigator.userAgent:"unknown";return{notificationPermission:t,hasFocus:n,hidden:s,idleDebug:r,userAgent:a}}function ac(t){return t.length===0?"_(no events in window)_":`\`\`\`jsonl
|
|
31
|
+
${t.map(s=>JSON.stringify(s)).join(`
|
|
32
|
+
`)}
|
|
33
|
+
\`\`\``}function xa(t,n){return t.trim().length===0?`_(${n} empty)_`:`\`\`\`
|
|
34
|
+
${t}
|
|
35
|
+
\`\`\``}function SS(t){var x,y,v;const{bundle:n,browser:s,uiBufferText:r,prompt:a,agentName:o}=t,i=(n==null?void 0:n.now)??new Date().toISOString(),c=(n==null?void 0:n.session)??Lo(),d=(n==null?void 0:n.windowMinutes)??10,u=((x=n==null?void 0:n.environment)==null?void 0:x.editorVersion)??"unknown",h=((y=n==null?void 0:n.environment)==null?void 0:y.platform)??"unknown",p=((v=n==null?void 0:n.environment)==null?void 0:v.projectDir)??"unknown",f=(a??_S).trim(),m=[`- Notification.permission: ${s.notificationPermission}`,`- document.hasFocus(): ${s.hasFocus}`,`- document.hidden: ${s.hidden}`,`- localStorage.codeyam.idleDebug: ${s.idleDebug===null?"(unset)":JSON.stringify(s.idleDebug)}`,`- userAgent: ${s.userAgent}`].join(`
|
|
36
|
+
`),g=n&&n.truncations.length>0?`> **Truncations:** ${n.truncations.join("; ")}`:"";return["# CodeYam Notification Debug Bundle","",f,"","---","",`**Captured:** ${i}`,`**UI session:** ${c} (window: last ${d} minutes)`,`**Editor version:** ${u}`,`**Platform:** ${h}`,`**Project:** ${p}`,o?`**Agent:** ${o}`:null,"","**Browser state:**",m,"",g,"","## UI idle trace (persisted)","",ac((n==null?void 0:n.uiTrace)??[]),"","## UI idle trace (in-memory ring buffer — may be ahead of persisted)","",xa(r,"in-memory buffer"),"","## Rust idle trace","",ac((n==null?void 0:n.rustTrace)??[]),"","## editor-server.log (filtered to idle= within window)","",xa((n==null?void 0:n.editorServerLog)??"","editor-server.log"),"","## dev-server.log (last lines)","",xa((n==null?void 0:n.devServerLog)??"","dev-server.log"),""].filter(w=>w!==null).join(`
|
|
37
|
+
`)}async function NS(t={}){const n=encodeURIComponent(Lo());let s=null,r=null;try{const c=await fetch(`/api/idle-trace/bundle?session=${n}&minutes=10`);c.ok?s=await c.json():r=`HTTP ${c.status}`}catch(c){r=c instanceof Error?c.message:String(c)}const a=kS(),o=p_({agentName:t.agentName});return{markdown:SS({bundle:s,browser:a,uiBufferText:o,prompt:t.prompt,agentName:t.agentName}),bundle:s,error:r}}const CS=1500;function PS(t=CS){const[n,s]=l.useState(null),r=l.useRef(null),a=l.useCallback((o,i)=>{r.current!==null&&clearTimeout(r.current),s(o),r.current=setTimeout(()=>{s(null),r.current=null},i??t)},[t]);return l.useEffect(()=>()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]),{label:n,flash:a}}const TS=2500;function Um({agentName:t}){const[n,s]=l.useState(!1),{label:r,flash:a}=PS(TS),o=async()=>{s(!0);const{markdown:i,bundle:c,error:d}=await NS({agentName:t});try{await navigator.clipboard.writeText(i);const u=((c==null?void 0:c.uiTrace.length)??0)+((c==null?void 0:c.rustTrace.length)??0),h=Math.round(i.length/1024*10)/10,p=d?`Copied (offline — ${u} events, ${h} KB)`:`Copied ${u} events · ${h} KB`;a(p)}catch{a("Copy failed")}finally{s(!1)}};return e.jsx("button",{onClick:()=>void o(),disabled:n,className:"text-left text-[11px] px-2 py-1 rounded cursor-pointer transition-colors font-medium",style:{background:"transparent",color:"var(--text-secondary)"},"data-testid":"notification-debug-copy",children:r??(n?"Gathering bundle…":"Debug Notifications")})}const yI=Object.freeze(Object.defineProperty({__proto__:null,DebugNotificationsButton:Um},Symbol.toStringTag,{value:"Module"})),ya={sound:"soft-double-tap",systemNotification:!0,idleOnStop:!1,idleOnNotification:!0},Ym=[{id:"soft-double-tap",label:"Soft double tap"},{id:"gentle-chime",label:"Gentle chime"},{id:"warm-ding",label:"Warm ding"},{id:"mellow-two-tone",label:"Mellow two-tone"},{id:"triangle-bell",label:"Triangle bell"},{id:"off",label:"No sound"}],Vm="codeyam-editor-notifications";function Km(){try{const t=localStorage.getItem(Vm);if(!t)return ya;const n=JSON.parse(t);return{...ya,...n}}catch{return ya}}function Jm(t){localStorage.setItem(Vm,JSON.stringify(t))}const OS={"soft-double-tap":t=>([0,.12].forEach(n=>{const s=t.createOscillator(),r=t.createGain();s.connect(r),r.connect(t.destination),s.type="sine",s.frequency.value=392,r.gain.setValueAtTime(.25,t.currentTime+n),r.gain.exponentialRampToValueAtTime(.01,t.currentTime+n+.1),s.start(t.currentTime+n),s.stop(t.currentTime+n+.1)}),{count:2,longestStopSec:.22}),"gentle-chime":t=>{const n=t.createOscillator(),s=t.createGain();return n.connect(s),s.connect(t.destination),n.type="sine",n.frequency.setValueAtTime(523,t.currentTime),n.frequency.setValueAtTime(659,t.currentTime+.15),s.gain.setValueAtTime(.3,t.currentTime),s.gain.exponentialRampToValueAtTime(.01,t.currentTime+.4),n.start(),n.stop(t.currentTime+.4),{count:1,longestStopSec:.4}},"warm-ding":t=>{const n=t.createOscillator(),s=t.createGain();return n.connect(s),s.connect(t.destination),n.type="sine",n.frequency.value=330,s.gain.setValueAtTime(.35,t.currentTime),s.gain.exponentialRampToValueAtTime(.01,t.currentTime+.6),n.start(),n.stop(t.currentTime+.6),{count:1,longestStopSec:.6}},"mellow-two-tone":t=>{const n=t.createOscillator(),s=t.createGain();return n.connect(s),s.connect(t.destination),n.type="sine",n.frequency.setValueAtTime(294,t.currentTime),n.frequency.setValueAtTime(440,t.currentTime+.18),s.gain.setValueAtTime(.3,t.currentTime),s.gain.exponentialRampToValueAtTime(.01,t.currentTime+.5),n.start(),n.stop(t.currentTime+.5),{count:1,longestStopSec:.5}},"triangle-bell":t=>{const n=t.createOscillator(),s=t.createGain();return n.connect(s),s.connect(t.destination),n.type="triangle",n.frequency.value=523,s.gain.setValueAtTime(.4,t.currentTime),s.gain.exponentialRampToValueAtTime(.01,t.currentTime+.8),n.start(),n.stop(t.currentTime+.8),{count:1,longestStopSec:.8}}};function va(t,n){const s=n;se(t,{name:s==null?void 0:s.name,message:s==null?void 0:s.message})}function Si(t){if(t==="off")return;se("audio-playsound-entered",{soundId:t});let n;try{n=new AudioContext}catch(r){va("audio-context-failed",r);return}se("audio-context-created",{state:n.state});const s=()=>{let r;try{r=OS[t](n)}catch(a){va("audio-context-failed",a),n.close().catch(()=>{});return}se("audio-oscillators-scheduled",{soundId:t,count:r.count,longestStopSec:r.longestStopSec}),setTimeout(()=>{n.close().then(()=>se("audio-context-closed")).catch(()=>{})},(r.longestStopSec+.1)*1e3)};n.state==="running"?s():n.state==="suspended"?(se("audio-context-resume-attempted"),n.resume().then(()=>{se("audio-context-resume-ok",{state:n.state}),s()},r=>{va("audio-context-resume-failed",r),n.close().catch(()=>{})})):(se("audio-context-failed",{name:"UnexpectedState",message:`AudioContext state "${n.state}"`}),n.close().catch(()=>{}))}function eo({label:t,checked:n,onChange:s,className:r}){return e.jsxs("label",{className:`flex items-center gap-2 cursor-pointer${r?` ${r}`:""}`,children:[e.jsx("input",{type:"checkbox",checked:n,onChange:a=>s(a.target.checked),className:"accent-green-500"}),e.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:t})]})}const vI=Object.freeze(Object.defineProperty({__proto__:null,IdleTriggerCheckbox:eo},Symbol.toStringTag,{value:"Module"}));function Xm({settings:t,onChange:n,providerLabel:s}){const r=t.idleOnStop??!1,a=t.idleOnNotification??!0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] mb-1.5",style:{color:"var(--text-muted)"},children:"Notification sound"}),e.jsx("div",{className:"flex flex-col gap-0.5",children:Ym.map(o=>e.jsx("button",{onClick:()=>{n({...t,sound:o.id}),o.id!=="off"&&Si(o.id)},className:"text-left text-[11px] px-2 py-1 rounded cursor-pointer transition-colors",style:{background:t.sound===o.id?"var(--bg-input)":"transparent",color:t.sound===o.id?"var(--text-primary)":"var(--text-secondary)"},children:o.label},o.id))})]}),e.jsxs("div",{className:"pt-2",style:{borderTop:"1px solid var(--border-default)"},children:[e.jsx("div",{className:"text-[11px] mb-1.5",style:{color:"var(--text-muted)"},children:"Trigger idle on"}),e.jsx(eo,{label:`${s} stops`,checked:r,onChange:o=>n({...t,idleOnStop:o})}),e.jsx(eo,{label:`${s} sends a notification`,checked:a,onChange:o=>n({...t,idleOnNotification:o}),className:"mt-1"})]}),e.jsxs("div",{className:"pt-2",style:{borderTop:"1px solid var(--border-default)"},children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.systemNotification,onChange:o=>{const i=o.target.checked;n({...t,systemNotification:i}),i&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},className:"accent-green-500"}),e.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"System notification"})]}),e.jsx("div",{className:"text-[10px] mt-1 ml-5",style:{color:"var(--text-dim)"},children:"Shows when tab is not visible"}),typeof Notification<"u"&&Notification.permission==="denied"&&e.jsx("div",{className:"text-[10px] mt-1 ml-5",style:{color:"var(--accent-red, #ef4444)"},children:"Notifications are blocked. Click the lock icon in your address bar → Site settings → Notifications → Allow"})]})]})}const jI=Object.freeze(Object.defineProperty({__proto__:null,NotificationSettingsControls:Xm},Symbol.toStringTag,{value:"Module"}));function Qm({settings:t,onChange:n,agentName:s,providerLabel:r}){const[a,o]=l.useState(!1),i=l.useRef(null),c=t.idleOnStop??!1,d=t.idleOnNotification??!0,u=t.sound!=="off"||t.systemNotification||c||d;return l.useEffect(()=>{if(!a)return;const h=p=>{i.current&&!i.current.contains(p.target)&&o(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),e.jsxs("div",{className:"h-7 flex items-center px-3 text-xs shrink-0",style:{background:"var(--bg-nav)",borderTop:"1px solid var(--border-default)"},children:[e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"relative",ref:i,children:[e.jsx("button",{onClick:()=>{o(!a),typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},className:"cursor-pointer transition-colors",style:{color:u?"var(--accent-green)":"var(--text-dim)",fontSize:"11px"},children:u?"Notifications On":"Notifications Off"}),a&&e.jsxs("div",{className:"absolute bottom-full right-0 mb-2 w-56 rounded-lg shadow-xl p-3 flex flex-col gap-3 z-50",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx(Xm,{settings:t,onChange:n,providerLabel:r}),e.jsx("div",{className:"pt-2",style:{borderTop:"1px solid var(--border-default)"},children:e.jsx(Um,{agentName:s})})]})]})]})}const wI=Object.freeze(Object.defineProperty({__proto__:null,NotificationSettingsPopover:Qm},Symbol.toStringTag,{value:"Module"})),Zm="codeyam-editor-notifications-prompted",AS="codeyam-editor-notifications";function ef(){try{localStorage.setItem(Zm,"1")}catch{}}function RS(){try{return localStorage.getItem(Zm)!==null||localStorage.getItem(AS)!==null}catch{return!0}}function tf({settings:t,onChange:n,providerLabel:s}){const[r,a]=l.useState(()=>!RS());if(!r)return null;const o=()=>{ef(),a(!1)},i=()=>{n({...t,systemNotification:!0}),typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission(),o()};return e.jsxs("div",{className:"rounded-lg px-4 py-2.5 mb-3 flex items-center gap-3",style:{background:"var(--surface-card)",border:"1px solid var(--lime-300)"},children:[e.jsx("span",{"aria-hidden":"true",style:{fontSize:15,lineHeight:1,color:"var(--lime-300)"},children:"🔔"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-strong)"},children:["Get notified when ",s," finishes"]}),e.jsx("span",{style:{fontSize:"12px",color:"var(--text-faint)",marginLeft:8},children:"We'll ping you when the agent stops or pauses."})]}),e.jsx("button",{onClick:i,className:"shrink-0 cursor-pointer transition-colors",style:{background:"var(--action-bg)",color:"var(--action-fg)",fontSize:"12.5px",fontWeight:600,borderRadius:9,padding:"7px 14px"},children:"Enable"}),e.jsx("button",{onClick:o,className:"shrink-0 cursor-pointer",style:{color:"var(--text-faint)",fontSize:"12px"},children:"Not now"})]})}const _I=Object.freeze(Object.defineProperty({__proto__:null,NotificationSetupBanner:tf},Symbol.toStringTag,{value:"Module"}));function nf(){const[t,n]=l.useState(null);return l.useEffect(()=>{fetch("/api/editor-setup-answers").then(s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{n(s!==null)}).catch(()=>{n(!1)})},[]),{saved:t}}function sf({appStatsLength:t,configLoading:n,scenariosLoading:s,setupAnswersSaved:r,hasStepState:a}){return t===0&&!n&&!s&&r===!1&&!a}function rf({projectDescription:t}){return e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Building your project…"}),e.jsx("blockquote",{className:"mt-4 border-l-2 border-[var(--accent-active)] pl-4 text-sm italic text-[var(--text-dim)]",children:t}),e.jsxs("p",{className:"mt-6 text-sm text-[var(--text-dim)]",children:["Your app will appear here as it’s built. The agent is scaffolding it now on the ",e.jsx("strong",{children:"Build"})," tab — open it to follow along."]})]})}const kI=Object.freeze(Object.defineProperty({__proto__:null,AppOverviewEmptyStateBuildingPanel:rf},Symbol.toStringTag,{value:"Module"}));function af(){return e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"No app scaffolded yet"}),e.jsxs("p",{className:"mt-4 text-sm text-[var(--text-dim)]",children:["Your project hasn’t been scaffolded yet. Open the"," ",e.jsx("strong",{children:"Build"})," tab to start building."]})]})}const SI=Object.freeze(Object.defineProperty({__proto__:null,AppOverviewEmptyStateNoAppPanel:af},Symbol.toStringTag,{value:"Module"}));function of({onClick:t}){return e.jsx("button",{type:"button",onClick:t,"data-testid":"app-overview-empty-open-build",className:"mt-6 inline-flex items-center gap-2 rounded border border-[var(--accent-active)] bg-[var(--accent-active)] px-4 py-2 text-xs font-medium uppercase tracking-wide text-black transition-colors hover:bg-[var(--accent-active)]/90 cursor-pointer",children:"Open Build tab"})}const NI=Object.freeze(Object.defineProperty({__proto__:null,OpenBuildTabButton:of},Symbol.toStringTag,{value:"Module"}));function lf({projectDescription:t,onOpenBuildTab:n}){const s=t!==null&&t.trim().length>0;return e.jsxs("div",{className:"mx-auto max-w-2xl px-5 py-12 text-[var(--text-primary)]",children:[s?e.jsx(rf,{projectDescription:t}):e.jsx(af,{}),e.jsx(of,{onClick:n})]})}const CI=Object.freeze(Object.defineProperty({__proto__:null,AppOverviewEmptyState:lf},Symbol.toStringTag,{value:"Module"}));function cf({stats:t,onSelectApp:n,testsLoading:s,testsRefreshing:r,onRunTests:a,currentRunner:o}){return e.jsx("div",{className:"flex flex-col gap-4",children:t.map(i=>e.jsx(Lh,{stats:i,onClick:()=>n(i.app.dir),testsLoading:s,testsRefreshing:r,onRunTests:a,currentRunner:o},i.app.dir))})}const PI=Object.freeze(Object.defineProperty({__proto__:null,AppOverviewGrid:cf},Symbol.toStringTag,{value:"Module"}));function df({projectTitle:t,coverage:n,onCoverageClick:s}){return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)]",children:t}),e.jsx(ci,{coverage:n,testId:"app-overview-coverage",onClick:s})]})}const TI=Object.freeze(Object.defineProperty({__proto__:null,AppOverviewHeader:df},Symbol.toStringTag,{value:"Module"}));function uf(){return e.jsxs("span",{className:"hbuild-dots","aria-hidden":"true",children:[e.jsx("span",{children:"."}),e.jsx("span",{children:"."}),e.jsx("span",{children:"."})]})}const OI=Object.freeze(Object.defineProperty({__proto__:null,AnimatedEllipsis:uf},Symbol.toStringTag,{value:"Module"}));function hf({screenshotPath:t}){return e.jsx("span",{className:"hbuild-thumb",children:t?e.jsx(kt,{screenshotPath:t,alt:""}):e.jsx("span",{className:"hbuild-nothumb",children:"No preview yet"})})}const AI=Object.freeze(Object.defineProperty({__proto__:null,BuildingCardThumbnail:hf},Symbol.toStringTag,{value:"Module"})),ES=28,MS=21,IS=4,DS=5,LS={1:"Plan",2:"Explore",3:"Confirm",4:"Prepare",5:"Seed Data",6:"Live Preview Loop",7:"Verify Prototype",8:"Confirm Mode",9:"Prepare Demo",10:"Approve Demo",11:"Deconstruct",12:"Extract TDD",13:"Glossary",14:"Dependency Graph",15:"Isolation Routes",16:"Component Coverage",17:"Register Scenarios",18:"Capture Scenarios",19:"Curate Scenarios",20:"App Scenarios",21:"Present",22:"Reconcile",23:"Journal",24:"Pre-Commit Sync",25:"Finalize",26:"Commit",27:"Push",28:"Feature Complete"},FS={1:"Plan",2:"Explore",3:"Confirm Plan",4:"Prepare",5:"Prototype",6:"Confirm Mode",7:"Approve Demo",8:"Deconstruct",9:"Extract TDD",10:"Test Tooling",11:"Glossary",12:"Dependency Graph",13:"Present",14:"Review",15:"Reconcile",16:"Journal",17:"Pre-Commit Sync",18:"Finalize",19:"Commit",20:"Push",21:"Feature Complete"},zS={1:"Triage",2:"Route",3:"Wrap Up",4:"Complete"},$S={1:"Ground",2:"Generate",3:"Iterate",4:"Resolve",5:"Return"},BS={1:"Plan the feature and confirm the approach with the user before writing any code.",2:"Map out all the files you'll need to read or modify; check for reference implementations.",3:"Repeat the plan back to the user and gate on explicit approval before any code is written.",4:"Prepare the project environment and dependencies for prototyping.",5:"Wire up API routes and seed the database with realistic, demo-rich data.",6:"Iterate on the prototype with the live preview — navigate, edit, verify.",7:"Verify the prototype's routes, images, and client errors before presenting.",8:"Confirm or switch the workflow mode before the demo.",9:"Capture and show a verified live-preview demonstration of the change.",10:"Hand the live preview to the user for interactive testing and get approval.",11:"Read the code and plan all component and function extractions.",12:"Extract components and functions via TDD; cover library functions with multiple tests.",13:"Register every new test and glossary entry produced in the prior step.",14:"Rebuild the dependency graph after extraction.",15:"Create isolation routes for every extracted visual component.",16:"Decide per-component scenario coverage (multi-state or untestability) for every isolated component.",17:"Register component-level scenarios (one per state) for every visual component.",18:"Capture and verify component-level scenarios; gate on visual coverage before advancing.",19:"Curate the existing app-scenario set — review, consolidate, dedup, and edit in place — before registering new scenarios.",20:"Create app-level scenarios that show full pages with realistic data.",21:"Final approval gate — recapture screenshots and present a summary of all work to the user.",22:"Run the audit gate, reconcile any registry/glossary drift until clean.",23:"Create or update the journal entry documenting what was built.",24:"Sync local state with the remote so the next commit lands on a merged tree.",25:"Finalize the session — run the full suite once.",26:"Commit all changes to git.",27:"Push the branch to the remote repository.",28:"Fire the feature-complete modal — the cycle ends here."},qS={1:"Plan the feature and confirm the approach with the user before writing any code.",2:"Map out all the files you'll need to read or modify; check for reference implementations.",3:"Repeat the plan back to the user and gate on explicit approval before any code is written.",4:"Prepare the project environment.",5:"Build the feature. Tests come at the Deconstruct cluster.",6:"Confirm or switch the workflow mode before the demo.",7:"Show the prototype results and gate on the user's yes/iterate decision before any verification work.",8:"Read the code and plan all function/method/helper extractions.",9:"Extract functions/methods/helpers via TDD; every change must have a red-if-reverted test.",10:"Test-runner and tooling discipline for the backend extract-TDD loop.",11:"Register every new test and glossary entry produced in the prior step.",12:"Rebuild the dependency graph after extraction.",13:"Author the session narrative in full, then present the /results page with the behavior gallery, tests, and changed files.",14:"Review the results page with the user — summary, ways-to-test, weakened-test flag, audit status — and gate on the Save / Fast-Commit / change decision.",15:"Run the audit gate, reconcile any registry/glossary drift until clean.",16:"Re-validate the session narrative, reconciling only what changed since Present, then create the journal entry.",17:"Sync local state with the remote so the next commit lands on a merged tree.",18:"Finalize the session — run the full suite once.",19:"Commit all changes to git.",20:"Push the branch to the remote repository.",21:"Fire the feature-complete modal — the cycle ends here."},HS={1:"Classify the request: does it change application source the project should test and capture scenarios for, or not?",2:"Route the classified request to the right workflow or into an open-ended session.",3:"Inventory what changed on disk and decide with the user what, if anything, to commit.",4:"Return the editor to the beginning state so a build or another assist request can start."},WS={1:"Establish what the surface being modified actually looks like today before generating any mockup.",2:"Generate the round's mockups as variations grounded in the current state.",3:"Dwell here: iterate with the user until they pick a direction or abandon the round.",4:"Resolve the round — attach the selected design to the work in flight, or archive and discard.",5:"Return control to the invoking context — the build session's prototype phase or the ad-hoc caller."},GS={ui:LS,backend:FS,assist:zS,design:$S},US={ui:BS,backend:qS,assist:HS,design:WS},YS={ui:ES,backend:MS,assist:IS,design:DS},VS={ui:"UI Flow",backend:"Backend Flow",assist:"Assist Flow",design:"Design Round"},KS=["ui","backend","assist","design"];function It(t){return KS.includes(t)?t:"ui"}function pf(t,n){return GS[It(n)][t]??"?"}function JS(t,n){return US[It(n)][t]??""}function Ni(t){return YS[It(t)]}function mf(t){return VS[It(t)]}function ff(t,n){const s=It(n);return{description:JS(t,s),label:pf(t,s),prefix:mf(s),totalSteps:Ni(s)}}const XS={1:"Understanding your idea",2:"Looking through your project",3:"Confirming the approach with you",4:"Preparing your workspace",5:"Adding sample data",6:"Building your app",7:"Checking the prototype",8:"Confirming the next step with you",9:"Showing you the result",10:"Trying it out together",11:"Reading the code carefully",12:"Adding tests",13:"Documenting the building blocks",14:"Mapping connections in your code",15:"Setting up isolation routes",16:"Checking component coverage",17:"Registering component snapshots",18:"Capturing component snapshots",19:"Curating existing snapshots",20:"Capturing whole-page snapshots",21:"Showing you the final review",22:"Reconciling everything",23:"Writing a journal entry",24:"Syncing with the latest",25:"Finalizing the build",26:"Saving your changes",27:"Pushing your work",28:"All done"},QS={1:"Understanding your idea",2:"Looking through your project",3:"Confirming the approach with you",4:"Preparing your workspace",5:"Building your app",6:"Confirming the next step with you",7:"Showing you the result",8:"Reading the code carefully",9:"Adding tests",10:"Setting up test tooling",11:"Documenting the building blocks",12:"Mapping connections in your code",13:"Putting together your results",14:"Showing you the final review",15:"Reconciling everything",16:"Writing a journal entry",17:"Syncing with the latest",18:"Finalizing the build",19:"Saving your changes",20:"Pushing your work",21:"All done"},ZS=[{phaseId:"understand",phaseLabel:"Understanding your idea",phaseSteps:[1,2,3]},{phaseId:"setup",phaseLabel:"Setting things up",phaseSteps:[4,5]},{phaseId:"build",phaseLabel:"Building your app",phaseSteps:[6,7,8,9,10]},{phaseId:"tidy",phaseLabel:"Making the code maintainable",phaseSteps:[11,12,13,14,15,16,17,18,19,20]},{phaseId:"review",phaseLabel:"Final Review",phaseSteps:[21,22,23,24,25]},{phaseId:"save",phaseLabel:"Saving your work",phaseSteps:[26,27,28]}],e2=[{phaseId:"understand",phaseLabel:"Understanding your idea",phaseSteps:[1,2,3]},{phaseId:"setup",phaseLabel:"Setting things up",phaseSteps:[4]},{phaseId:"build",phaseLabel:"Building your app",phaseSteps:[5,6,7]},{phaseId:"tidy",phaseLabel:"Making the code maintainable",phaseSteps:[8,9,10,11,12]},{phaseId:"review",phaseLabel:"Final Review",phaseSteps:[13,14,15,16,17,18]},{phaseId:"save",phaseLabel:"Saving your work",phaseSteps:[19,20,21]}];function t2(t,n){return(It(n)==="backend"?QS:XS)[t]??""}function n2(t){return It(t)==="backend"?e2:ZS}function gf({position:t,phase:n,mode:s}){return!s&&!t?null:e.jsxs("span",{className:"hbuild-step",children:[s?e.jsx("span",{className:"hbuild-flow",children:mf(s)}):null,t?e.jsxs("span",{className:"hbuild-pos",children:[t,":"]}):null,n?e.jsx("span",{className:"hbuild-phase",children:n}):null]})}const RI=Object.freeze(Object.defineProperty({__proto__:null,BuildingStepLine:gf},Symbol.toStringTag,{value:"Module"})),s2={building:{state:"Building",ellipsis:!0,attn:!1},"needs-input":{state:"Needs you",ellipsis:!1,attn:!0},waiting:{state:"Paused",ellipsis:!1,attn:!0}};function bf({feature:t,stepLabel:n,stepPosition:s=null,status:r="building",progress:a=null,mode:o,thumbnailPath:i=null,onOpen:c}){const d=s2[r],u=r==="building";return e.jsxs("button",{type:"button",className:"hbuild-card active"+(d.attn?" attn":""),onClick:c,children:[e.jsx(hf,{screenshotPath:i}),e.jsxs("span",{className:"hbuild-main",children:[e.jsxs("span",{className:"hbuild-title",children:[u?e.jsx("span",{className:"hbuild-spinner","aria-hidden":"true"}):null,t,e.jsxs("span",{className:"hbuild-state",children:[d.state,d.ellipsis?e.jsx(uf,{}):null]})]}),e.jsx(gf,{position:s,phase:n,mode:o}),u?e.jsx("span",{className:"hbuild-bar",children:e.jsx("span",{style:{width:a!=null?`${Math.round(a*100)}%`:"12%"}})}):null]}),e.jsxs("span",{className:"hbuild-cta",children:["Build ",e.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}const EI=Object.freeze(Object.defineProperty({__proto__:null,BuildingCardActive:bf},Symbol.toStringTag,{value:"Module"}));function xf({lastBuiltLabel:t,onStart:n}){return e.jsxs("button",{type:"button",className:"hbuild-card",onClick:n,children:[e.jsxs("span",{className:"hbuild-main",children:[e.jsx("span",{className:"hbuild-ready",children:"Ready to build?"}),t?e.jsxs("span",{className:"hbuild-last",children:["Your last build: ",e.jsx("b",{children:t})]}):null]}),e.jsxs("span",{className:"hbuild-cta",children:["Build ",e.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}const MI=Object.freeze(Object.defineProperty({__proto__:null,BuildingCardIdle:xf},Symbol.toStringTag,{value:"Module"}));function yf({onReset:t}){return e.jsxs("button",{type:"button","data-testid":"build-status-reset",onClick:t,className:"hbuild-reset",children:[e.jsx("span",{"aria-hidden":"true",children:"⊗"})," Reset build"]})}const II=Object.freeze(Object.defineProperty({__proto__:null,BuildResetLink:yf},Symbol.toStringTag,{value:"Module"}));function Ci({isBuilding:t,buildingLabel:n,buildingStepLabel:s,buildingStepPosition:r=null,buildingStatus:a="building",buildingProgress:o=null,buildingMode:i,thumbnailPath:c=null,lastBuiltLabel:d,onOpenBuilding:u,onStartNewFeature:h,onResetBuild:p}){return t?e.jsxs(e.Fragment,{children:[e.jsx(bf,{feature:n||"your latest change",stepLabel:s,stepPosition:r,status:a,progress:o,mode:i,thumbnailPath:c,onOpen:u}),p?e.jsx(yf,{onReset:p}):null]}):e.jsx(xf,{lastBuiltLabel:d,onStart:h??u})}const DI=Object.freeze(Object.defineProperty({__proto__:null,BuildingDoor:Ci},Symbol.toStringTag,{value:"Module"}));function vf({isBuilding:t,buildingLabel:n,buildingStepLabel:s,buildingStepPosition:r=null,buildingStatus:a="building",buildingProgress:o=null,buildingMode:i,onOpenBuilding:c,onResetBuild:d}){return t?e.jsx("section",{"data-testid":"home-build-status-section",className:"mt-6 mb-6",children:e.jsx(Ci,{isBuilding:t,buildingLabel:n,buildingStepLabel:s,buildingStepPosition:r,buildingStatus:a,buildingProgress:o,buildingMode:i,onOpenBuilding:c,onStartNewFeature:c,onResetBuild:d})}):null}const LI=Object.freeze(Object.defineProperty({__proto__:null,HomeBuildStatusSection:vf},Symbol.toStringTag,{value:"Module"}));async function r2(t){try{t.description&&await fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectDescription:t.description,allowOverwrite:!0})});const n={appFormats:t.appFormats,techStackId:t.techStackId,designApproach:t.designApproach};t.defaultDevice&&(n.defaultDevice=t.defaultDevice),await fetch("/api/editor-setup-answers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch{}}const oc=["prompt","reading","confirm","design-approach","notifications","done"];function ic(t){return t==="files"||t==="chat"?[...oc,"design-details"]:oc}const jf="codeyam.questionnaire.draft";function Pi(t){return`${jf}:${t}`}function a2(t){if(t===null||typeof t!="object")return!1;const n=t;if(typeof n.step!="number"||!Number.isFinite(n.step)||typeof n.savedAt!="string"||n.designChatLaunched!==void 0&&typeof n.designChatLaunched!="boolean")return!1;const s=n.answers;if(s===null||typeof s!="object")return!1;const r=s;return!(!Array.isArray(r.appFormats)||!r.appFormats.every(a=>typeof a=="string")||typeof r.description!="string"||r.techStackId!==null&&typeof r.techStackId!="string"||r.designApproach!==null&&typeof r.designApproach!="string"||r.defaultDevice!==null&&typeof r.defaultDevice!="string")}function ja(t){try{const n=localStorage.getItem(Pi(t));if(n===null)return null;const s=JSON.parse(n);return a2(s)?s:null}catch{return null}}function o2(t,n){try{localStorage.setItem(Pi(t),JSON.stringify(n))}catch{}}function i2(t){try{localStorage.removeItem(Pi(t))}catch{}}function l2(){try{localStorage.removeItem(jf)}catch{}}function c2(){const[t,n]=l.useState([]);return l.useEffect(()=>{fetch("/api/editor-stacks").then(s=>s.json()).then(n).catch(()=>{})},[]),{techStacks:t}}function d2(t){const n=t.toLowerCase();return/extension|chrome/.test(n)?"chrome-extension":/desktop|menu bar|mac app/.test(n)?"desktop":/\bapp\b|ios|android|phone|mobile/.test(n)?"mobile":"web"}function u2(t,n){const s=l.useRef(n);l.useEffect(()=>{s.current=n},[n]),l.useEffect(()=>{if(!t)return;let r=!1,a=null;const o=async()=>{try{const c=await(await fetch("/api/editor-design-state")).json();!r&&c.active&&s.current(c.active)}catch{}finally{r||(a=window.setTimeout(o,3e3))}};return o(),()=>{r=!0,a!==null&&window.clearTimeout(a)}},[t])}function wf({providerLabel:t,preparing:n,onLaunch:s,variant:r="chat"}){const a=r==="files"?e.jsxs(e.Fragment,{children:["Click the button below to start a design session with ",t,"."," ",t," will turn the assets you added above into HTML mockups you can compare and iterate on."]}):e.jsxs(e.Fragment,{children:["Click the button below to launch a chat window with ",t," so that ",t," can generate some design options for you to consider and iterate on."]}),o=r==="files"?e.jsxs(e.Fragment,{children:[t," reads the design assets you added in the"," ",e.jsx("strong",{children:"Add your design files"})," step above — keep adding more any time and ",t," will fold them in."]}):e.jsxs(e.Fragment,{children:[t," will ask whether you have any design assets — logos, screenshots, brand guides, or inspiration. You can add them any time from the ",e.jsx("strong",{children:"Add assets"})," panel on the right (drag-and-drop or browse)."]}),i=r==="files"?"Start a design session":`Launch ${t} Design Chat`;return e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 var(--spacing-md, 12px)",fontSize:"var(--text-md, 15px)",lineHeight:1.5,color:"var(--text-primary)"},children:a}),e.jsx("p",{style:{margin:"0 0 var(--spacing-lg, 16px)",fontSize:"var(--text-sm, 14px)",lineHeight:1.5,color:"var(--text-secondary)"},children:o}),e.jsx("button",{onClick:s,disabled:n,style:{background:n?"var(--bg-surface)":"var(--accent-active)",border:"none",color:n?"var(--text-dim)":"#000",padding:"var(--spacing-sm, 8px) var(--spacing-lg, 16px)",borderRadius:6,cursor:n?"not-allowed":"pointer",fontSize:"var(--text-sm, 14px)",fontWeight:600},children:n?"Preparing design moodboards…":i})]})}const FI=Object.freeze(Object.defineProperty({__proto__:null,QuestionnaireDesignChatLaunchPanel:wf},Symbol.toStringTag,{value:"Module"}));function _f({title:t,subtitle:n,children:s}){return e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:"var(--text-xl, 22px)",fontWeight:700,color:"var(--text-primary)",marginBottom:"var(--spacing-xs, 4px)"},children:t}),e.jsx("p",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-muted)",marginBottom:"var(--spacing-lg, 24px)"},children:n}),s]})}const zI=Object.freeze(Object.defineProperty({__proto__:null,QuestionnaireStepPanel:_f},Symbol.toStringTag,{value:"Module"}));function to({description:t,launched:n,onLaunched:s,onDesignSelected:r,onPreviewUrl:a,variant:o="chat"}){const[i,c]=l.useState({kind:"preparing"}),{config:d}=_t(),u=at(d==null?void 0:d.provider),h=l.useRef(n),p=o==="chat"||n;l.useEffect(()=>{if(p)return a==null||a("/design-exploration"),()=>{a==null||a(null)}},[a,p]),l.useEffect(()=>{let x=!1;return(async()=>{try{const y=!h.current,[v,w,j]=await Promise.all([fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectDescription:t,allowOverwrite:!0})}),fetch("/api/editor-design-systems-install",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}),y?fetch("/api/editor-design-reset",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}):Promise.resolve(null)]);if(!w.ok){const _=await w.text().catch(()=>`${w.status}`);throw new Error(_||`install failed: ${w.status}`)}if(j&&!j.ok){const _=await j.text().catch(()=>`${j.status}`);throw new Error(_||`design-reset failed: ${j.status}`)}v.ok||console.warn("[QuestionnaireDesignChatStep] editor-project-info failed; skill will prompt for description",v.status),x||c({kind:"ready"})}catch(y){x||c({kind:"error",message:y instanceof Error?y.message:String(y)})}})(),()=>{x=!0}},[t]),u2(n,r);const f=i.kind==="preparing",m=o==="files"?"Turn your assets into a mockup":"Explore design directions",g=o==="files"?"Start a design session and the agent will turn the assets you uploaded into HTML mockups — pick one from the panel on the right.":"Chat with the agent, share any design assets, then pick a mockup from the panel on the right.",b=o==="files"?"Try Skip instead, or keep uploading assets and try again.":"Try the Files or Skip approach instead.";return e.jsx(_f,{title:m,subtitle:g,children:n?e.jsx(wn,{chatName:"initial-design",slashCommand:"/codeyam-design",height:420}):i.kind==="error"?e.jsxs("div",{style:{padding:"var(--spacing-md, 12px)",marginBottom:"var(--spacing-sm, 8px)",borderRadius:8,background:"var(--bg-danger-soft, rgba(248,113,113,0.12))",color:"var(--accent-danger, #f87171)",fontSize:"var(--text-sm, 14px)"},children:["Couldn't prepare design moodboards: ",i.message,". ",b]}):e.jsx(wf,{providerLabel:u,preparing:f,onLaunch:s,variant:o})})}const $I=Object.freeze(Object.defineProperty({__proto__:null,QuestionnaireDesignChatStep:to},Symbol.toStringTag,{value:"Module"}));function kf(){return e.jsx("div",{style:{padding:"var(--spacing-sm, 8px) var(--spacing-lg, 16px)",background:"var(--bg-surface)",borderBottom:"1px solid var(--border-subtle)",fontSize:"var(--text-sm, 14px)",color:"var(--text-muted)"},children:"Before we dive in, help us comprehend what you want to build better."})}const BI=Object.freeze(Object.defineProperty({__proto__:null,QuestionnaireIntroBanner:kf},Symbol.toStringTag,{value:"Module"}));function Sf({step:t,canAdvance:n,isFinalStep:s,isAdvancing:r,onBack:a,onNext:o,onFinish:i}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-md, 12px)",marginTop:"var(--spacing-lg, 24px)"},children:[t>1&&e.jsx("button",{onClick:a,style:{background:"none",border:"1px solid var(--border-default)",color:"var(--text-secondary)",padding:"var(--spacing-sm, 8px) var(--spacing-lg, 16px)",borderRadius:6,cursor:"pointer",fontSize:"var(--text-sm, 14px)"},children:"← Back"}),s?e.jsx("button",{onClick:i,disabled:!n,style:{background:n?"var(--accent-active)":"var(--bg-surface)",border:"none",color:n?"#000":"var(--text-dim)",padding:"var(--spacing-sm, 8px) var(--spacing-lg, 16px)",borderRadius:6,cursor:n?"pointer":"not-allowed",fontSize:"var(--text-sm, 14px)",fontWeight:600},children:"FINISH →"}):e.jsx("button",{onClick:o,disabled:!n||r,style:{background:n?"var(--accent-active)":"var(--bg-surface)",border:"none",color:n?"#000":"var(--text-dim)",padding:"var(--spacing-sm, 8px) var(--spacing-lg, 16px)",borderRadius:6,cursor:n&&!r?"pointer":"not-allowed",fontSize:"var(--text-sm, 14px)",fontWeight:600,opacity:r?.7:1},children:r?"…":"NEXT →"})]})}const qI=Object.freeze(Object.defineProperty({__proto__:null,QuestionnaireNavButtons:Sf},Symbol.toStringTag,{value:"Module"})),h2=e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M5.50742 6.94462H6.6669C6.89825 6.94462 7.12013 6.85463 7.28372 6.69444C7.44731 6.53426 7.53921 6.317 7.53921 6.09047C7.53921 5.86394 7.44731 5.64668 7.28372 5.4865C7.12013 5.32631 6.89825 5.23633 6.6669 5.23633H5.51133C5.27997 5.23633 5.05809 5.32631 4.8945 5.4865C4.73091 5.64668 4.639 5.86394 4.639 6.09047C4.639 6.20264 4.61644 6.31372 4.57261 6.41735C4.52877 6.52098 4.46451 6.61513 4.38351 6.69444C4.3025 6.77376 4.20634 6.83668 4.1005 6.8796C3.99467 6.92253 3.88124 6.94462 3.76668 6.94462H2.61111C2.38009 6.94462 2.15851 7.03435 1.99498 7.19412C1.83144 7.35389 1.7393 7.57066 1.73878 7.79687C1.73878 8.02307 1.64715 8.24003 1.48398 8.40016C1.32081 8.56029 1.09944 8.6505 0.868421 8.65101C0.637744 8.65202 0.416859 8.74245 0.25411 8.90253C0.0913609 9.0626 -2.30897e-06 9.27929 0 9.50516C-5.79344e-07 9.73086 0.0914247 9.94733 0.254229 10.1071C0.417033 10.2669 0.637923 10.3569 0.868421 10.3574C1.09944 10.3579 1.32081 10.4481 1.48398 10.6082C1.64715 10.7684 1.73878 10.9853 1.73878 11.2115C1.73878 11.4381 1.83069 11.6553 1.99429 11.8155C2.15788 11.9757 2.37976 12.0657 2.61111 12.0657H3.76668C3.9977 12.0657 4.21928 12.1554 4.38282 12.3152C4.54635 12.475 4.63848 12.6917 4.639 12.9179C4.639 13.1445 4.73091 13.3617 4.8945 13.5219C5.05809 13.6821 5.27997 13.7721 5.51133 13.7721H6.6669C6.78136 13.7721 6.8947 13.75 7.00043 13.707C7.10615 13.6641 7.20218 13.6011 7.28303 13.5218C7.36388 13.4424 7.42794 13.3483 7.47157 13.2447C7.51519 13.141 7.53753 13.03 7.53727 12.9179C7.53727 12.6919 7.44556 12.4751 7.28234 12.3153C7.11911 12.1555 6.89773 12.0657 6.6669 12.0657H5.50937C5.27836 12.0652 5.05698 11.975 4.89381 11.8148C4.73064 11.6547 4.639 11.4377 4.639 11.2115C4.639 10.985 4.5471 10.7678 4.38351 10.6076C4.21991 10.4474 3.99804 10.3574 3.76668 10.3574H2.59745C2.36929 10.3574 2.15025 10.2697 1.98746 10.1132C1.82468 9.95667 1.73117 9.74381 1.72707 9.52044C1.72707 9.52044 1.72707 9.52045 1.72707 9.50516C1.72707 9.50516 1.72707 9.49369 1.72707 9.48796C1.73117 9.26459 1.82468 9.05173 1.98746 8.89519C2.15025 8.73866 2.36929 8.65097 2.59745 8.65101H3.76668C3.99804 8.65101 4.21991 8.56102 4.38351 8.40084C4.5471 8.24065 4.639 8.0234 4.639 7.79687C4.639 7.57117 4.73043 7.35468 4.89324 7.19491C5.05604 7.03514 5.27692 6.94513 5.50742 6.94462Z",fill:"currentColor"}),e.jsx("path",{d:"M17.1351 5.27098C16.9037 5.27098 16.6818 5.36096 16.5183 5.52115C16.3547 5.68133 16.2628 5.89859 16.2628 6.12512V7.83152C16.2628 7.94368 16.2402 8.05475 16.1964 8.15838C16.1525 8.26201 16.0883 8.35618 16.0073 8.43549C15.9263 8.51481 15.8301 8.57771 15.7243 8.62064C15.6184 8.66356 15.505 8.68566 15.3904 8.68566C15.1594 8.68616 14.938 8.77637 14.7749 8.9365C14.6117 9.09663 14.5201 9.31361 14.5201 9.53981C14.5196 9.76602 14.4274 9.98278 14.2639 10.1426C14.1003 10.3023 13.8788 10.392 13.6477 10.392C13.4167 10.392 13.1951 10.3023 13.0316 10.1426C12.8681 9.98278 12.7759 9.76602 12.7754 9.53981C12.7754 9.31361 12.6838 9.09663 12.5206 8.9365C12.3574 8.77637 12.1361 8.68616 11.9051 8.68566C11.7905 8.68566 11.6771 8.66356 11.5712 8.62064C11.4654 8.57771 11.3692 8.51481 11.2882 8.43549C11.2072 8.35618 11.143 8.26201 11.0991 8.15838C11.0553 8.05475 11.0327 7.94368 11.0327 7.83152V6.13086C11.0383 6.01542 11.0199 5.90007 10.9786 5.7918C10.9374 5.68352 10.8741 5.58458 10.7926 5.50095C10.7112 5.41732 10.6132 5.35074 10.5047 5.30526C10.3962 5.25977 10.2794 5.23633 10.1614 5.23633C10.0434 5.23633 9.92656 5.25977 9.81805 5.30526C9.70955 5.35074 9.61161 5.41732 9.53015 5.50095C9.44869 5.58458 9.38541 5.68352 9.34414 5.7918C9.30287 5.90007 9.28446 6.01542 9.29004 6.13086V7.83724C9.29004 8.06345 9.38168 8.28041 9.54485 8.44054C9.70802 8.60067 9.9294 8.69089 10.1604 8.6914C10.3918 8.6914 10.6136 8.78138 10.7772 8.94157C10.9408 9.10175 11.0327 9.31901 11.0327 9.54554C11.0332 9.77174 11.1254 9.98851 11.2889 10.1483C11.4525 10.308 11.674 10.3978 11.9051 10.3978C12.1351 10.3983 12.3556 10.4877 12.5186 10.6466C12.6816 10.8055 12.7739 11.021 12.7754 11.2462V12.966C12.7754 13.1922 12.8671 13.4091 13.0302 13.5693C13.1934 13.7294 13.4148 13.8196 13.6458 13.8201C13.8771 13.8201 14.099 13.7301 14.2626 13.5699C14.4262 13.4097 14.5181 13.1925 14.5181 12.966V11.2596C14.5181 11.0334 14.6097 10.8164 14.7729 10.6563C14.9361 10.4961 15.1575 10.4059 15.3885 10.4054C15.6195 10.4054 15.8411 10.3157 16.0046 10.1559C16.1682 9.99616 16.2603 9.77938 16.2608 9.55318C16.2608 9.32664 16.3527 9.10939 16.5163 8.9492C16.6799 8.78902 16.9018 8.69904 17.1331 8.69904C17.3641 8.69853 17.5855 8.60832 17.7487 8.44819C17.9119 8.28806 18.0035 8.07109 18.0035 7.84488V6.13086C18.0043 6.01853 17.9824 5.90715 17.9392 5.80311C17.8959 5.69907 17.8321 5.6044 17.7515 5.52453C17.6708 5.44466 17.5748 5.38115 17.4691 5.33764C17.3633 5.29414 17.2498 5.27148 17.1351 5.27098Z",fill:"currentColor"})]}),p2=e.jsx("path",{d:"M28.609 14.209C27.883 14.209 27.2597 14.0807 26.739 13.824C26.2183 13.5673 25.793 13.2337 25.463 12.823C25.1403 12.4123 24.902 11.965 24.748 11.481C24.594 10.997 24.517 10.5313 24.517 10.084V9.842C24.517 9.34333 24.594 8.852 24.748 8.368C24.9093 7.884 25.155 7.444 25.485 7.048C25.815 6.652 26.233 6.33667 26.739 6.102C27.2523 5.86 27.8573 5.739 28.554 5.739C29.28 5.739 29.9107 5.871 30.446 6.135C30.9887 6.39167 31.4213 6.75833 31.744 7.235C32.0667 7.70433 32.261 8.25433 32.327 8.885H30.754C30.6953 8.51833 30.5633 8.21033 30.358 7.961C30.16 7.70433 29.907 7.51367 29.599 7.389C29.291 7.257 28.9427 7.191 28.554 7.191C28.158 7.191 27.806 7.26067 27.498 7.4C27.19 7.532 26.9333 7.72267 26.728 7.972C26.5227 8.22133 26.365 8.51467 26.255 8.852C26.1523 9.18933 26.101 9.56333 26.101 9.974C26.101 10.37 26.1523 10.7367 26.255 11.074C26.365 11.4113 26.5263 11.7083 26.739 11.965C26.9517 12.2143 27.212 12.4087 27.52 12.548C27.8353 12.6873 28.1983 12.757 28.609 12.757C29.2103 12.757 29.7163 12.6103 30.127 12.317C30.545 12.0163 30.798 11.5983 30.886 11.063H32.459C32.3857 11.635 32.1913 12.1593 31.876 12.636C31.5607 13.1127 31.128 13.494 30.578 13.78C30.028 14.066 29.3717 14.209 28.609 14.209ZM36.5271 14.209C35.9991 14.209 35.5334 14.1247 35.1301 13.956C34.7268 13.7873 34.3858 13.56 34.1071 13.274C33.8284 12.9807 33.6158 12.6507 33.4691 12.284C33.3298 11.9173 33.2601 11.536 33.2601 11.14V10.909C33.2601 10.4983 33.3334 10.1097 33.4801 9.743C33.6341 9.369 33.8504 9.039 34.1291 8.753C34.4151 8.45967 34.7598 8.23233 35.1631 8.071C35.5664 7.90233 36.0211 7.818 36.5271 7.818C37.0331 7.818 37.4878 7.90233 37.8911 8.071C38.2944 8.23233 38.6354 8.45967 38.9141 8.753C39.2001 9.039 39.4164 9.369 39.5631 9.743C39.7098 10.1097 39.7831 10.4983 39.7831 10.909V11.14C39.7831 11.536 39.7098 11.9173 39.5631 12.284C39.4238 12.6507 39.2148 12.9807 38.9361 13.274C38.6574 13.56 38.3164 13.7873 37.9131 13.956C37.5098 14.1247 37.0478 14.209 36.5271 14.209ZM36.5271 12.9C36.9011 12.9 37.2164 12.8193 37.4731 12.658C37.7298 12.4893 37.9241 12.2657 38.0561 11.987C38.1881 11.701 38.2541 11.3783 38.2541 11.019C38.2541 10.6523 38.1844 10.3297 38.0451 10.051C37.9131 9.765 37.7151 9.54133 37.4511 9.38C37.1944 9.21133 36.8864 9.127 36.5271 9.127C36.1678 9.127 35.8561 9.21133 35.5921 9.38C35.3354 9.54133 35.1374 9.765 34.9981 10.051C34.8588 10.3297 34.7891 10.6523 34.7891 11.019C34.7891 11.3783 34.8551 11.701 34.9871 11.987C35.1264 12.2657 35.3244 12.4893 35.5811 12.658C35.8378 12.8193 36.1531 12.9 36.5271 12.9ZM43.5969 14.198C43.1789 14.198 42.7939 14.121 42.4419 13.967C42.0899 13.813 41.7856 13.5967 41.5289 13.318C41.2723 13.0393 41.0743 12.7167 40.9349 12.35C40.7956 11.976 40.7259 11.5727 40.7259 11.14V10.909C40.7259 10.4837 40.7919 10.084 40.9239 9.71C41.0633 9.336 41.2539 9.00967 41.4959 8.731C41.7453 8.45233 42.0423 8.236 42.3869 8.082C42.7389 7.92067 43.1276 7.84 43.5529 7.84C44.0223 7.84 44.4329 7.94267 44.7849 8.148C45.1443 8.346 45.4303 8.64667 45.6429 9.05C45.8556 9.45333 45.9729 9.95933 45.9949 10.568L45.5439 10.04V5.97H47.0729V14H45.8629V11.459H46.1269C46.1049 12.0677 45.9803 12.5773 45.7529 12.988C45.5256 13.3913 45.2249 13.6957 44.8509 13.901C44.4843 14.099 44.0663 14.198 43.5969 14.198ZM43.9379 12.911C44.2386 12.911 44.5136 12.845 44.7629 12.713C45.0123 12.5737 45.2103 12.3757 45.3569 12.119C45.5109 11.855 45.5879 11.547 45.5879 11.195V10.755C45.5879 10.403 45.5109 10.1097 45.3569 9.875C45.2029 9.633 45.0013 9.44967 44.7519 9.325C44.5026 9.193 44.2313 9.127 43.9379 9.127C43.6079 9.127 43.3146 9.20767 43.0579 9.369C42.8086 9.523 42.6106 9.743 42.4639 10.029C42.3246 10.315 42.2549 10.6487 42.2549 11.03C42.2549 11.4113 42.3283 11.745 42.4749 12.031C42.6216 12.3097 42.8196 12.526 43.0689 12.68C43.3256 12.834 43.6153 12.911 43.9379 12.911ZM51.4863 14.209C50.973 14.209 50.522 14.121 50.1333 13.945C49.752 13.769 49.433 13.5343 49.1763 13.241C48.927 12.9403 48.7363 12.6067 48.6043 12.24C48.4797 11.8733 48.4173 11.4993 48.4173 11.118V10.909C48.4173 10.513 48.4797 10.1317 48.6043 9.765C48.7363 9.391 48.927 9.061 49.1763 8.775C49.433 8.48167 49.7483 8.25067 50.1223 8.082C50.4963 7.906 50.929 7.818 51.4203 7.818C52.0657 7.818 52.6047 7.961 53.0373 8.247C53.4773 8.52567 53.8073 8.896 54.0273 9.358C54.2473 9.81267 54.3573 10.304 54.3573 10.832V11.382H49.0663V10.447H53.4003L52.9273 10.909C52.9273 10.5277 52.8723 10.2013 52.7623 9.93C52.6523 9.65867 52.4837 9.44967 52.2563 9.303C52.0363 9.15633 51.7577 9.083 51.4203 9.083C51.083 9.083 50.797 9.16 50.5623 9.314C50.3277 9.468 50.148 9.69167 50.0233 9.985C49.906 10.271 49.8473 10.6157 49.8473 11.019C49.8473 11.393 49.906 11.7267 50.0233 12.02C50.1407 12.306 50.3203 12.5333 50.5623 12.702C50.8043 12.8633 51.1123 12.944 51.4863 12.944C51.8603 12.944 52.1647 12.8707 52.3993 12.724C52.634 12.57 52.7843 12.383 52.8503 12.163H54.2583C54.1703 12.5737 54.0017 12.933 53.7523 13.241C53.503 13.549 53.184 13.7873 52.7953 13.956C52.414 14.1247 51.9777 14.209 51.4863 14.209ZM57.2956 10.931L54.8756 5.97H56.4816L58.3296 9.853L57.9776 9.743H59.0226L58.6486 9.853L60.3316 5.97H61.8496L59.6166 10.931H57.2956ZM57.6916 14V10.689H59.2206V14H57.6916ZM66.0534 14V12.229H65.8004V10.26C65.8004 9.91533 65.7161 9.65867 65.5474 9.49C65.3788 9.32133 65.1184 9.237 64.7664 9.237C64.5831 9.237 64.3631 9.24067 64.1064 9.248C63.8498 9.25533 63.5894 9.26633 63.3254 9.281C63.0688 9.28833 62.8378 9.29933 62.6324 9.314V8.016C62.8011 8.00133 62.9918 7.98667 63.2044 7.972C63.4171 7.95733 63.6334 7.95 63.8534 7.95C64.0808 7.94267 64.2934 7.939 64.4914 7.939C65.1074 7.939 65.6171 8.01967 66.0204 8.181C66.4311 8.34233 66.7391 8.59533 66.9444 8.94C67.1571 9.28467 67.2634 9.73567 67.2634 10.293V14H66.0534ZM64.1284 14.154C63.6958 14.154 63.3144 14.077 62.9844 13.923C62.6618 13.769 62.4088 13.549 62.2254 13.263C62.0494 12.977 61.9614 12.6323 61.9614 12.229C61.9614 11.789 62.0678 11.4297 62.2804 11.151C62.5004 10.8723 62.8048 10.6633 63.1934 10.524C63.5894 10.3847 64.0514 10.315 64.5794 10.315H65.9654V11.228H64.5574C64.2054 11.228 63.9341 11.316 63.7434 11.492C63.5601 11.6607 63.4684 11.8807 63.4684 12.152C63.4684 12.4233 63.5601 12.6433 63.7434 12.812C63.9341 12.9807 64.2054 13.065 64.5574 13.065C64.7701 13.065 64.9644 13.0283 65.1404 12.955C65.3238 12.8743 65.4741 12.7423 65.5914 12.559C65.7161 12.3683 65.7858 12.1117 65.8004 11.789L66.1744 12.218C66.1378 12.636 66.0351 12.988 65.8664 13.274C65.7051 13.56 65.4778 13.78 65.1844 13.934C64.8984 14.0807 64.5464 14.154 64.1284 14.154ZM68.9012 14V8.027H70.1112V10.59H70.0012C70.0012 9.98867 70.0782 9.48633 70.2322 9.083C70.3862 8.67233 70.6136 8.36433 70.9142 8.159C71.2222 7.94633 71.6036 7.84 72.0582 7.84H72.1242C72.5862 7.84 72.9676 7.94633 73.2682 8.159C73.5762 8.36433 73.8036 8.67233 73.9502 9.083C74.1042 9.48633 74.1812 9.98867 74.1812 10.59H73.7962C73.7962 9.98867 73.8732 9.48633 74.0272 9.083C74.1886 8.67233 74.4196 8.36433 74.7202 8.159C75.0282 7.94633 75.4096 7.84 75.8642 7.84H75.9302C76.3922 7.84 76.7772 7.94633 77.0852 8.159C77.3932 8.36433 77.6242 8.67233 77.7782 9.083C77.9396 9.48633 78.0202 9.98867 78.0202 10.59V14H76.4912V10.447C76.4912 10.073 76.3959 9.776 76.2052 9.556C76.0146 9.32867 75.7432 9.215 75.3912 9.215C75.0392 9.215 74.7569 9.33233 74.5442 9.567C74.3316 9.79433 74.2252 10.1023 74.2252 10.491V14H72.6962V10.447C72.6962 10.073 72.6009 9.776 72.4102 9.556C72.2196 9.32867 71.9482 9.215 71.5962 9.215C71.2442 9.215 70.9619 9.33233 70.7492 9.567C70.5366 9.79433 70.4302 10.1023 70.4302 10.491V14H68.9012Z",fill:"currentColor"});function Hn({className:t="h-5",markOnly:n=!1}){return e.jsxs("svg",{className:t,viewBox:n?"0 0 19 20":"0 0 79 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":n?"CodeYam":"CodeYam Editor",children:[h2,!n&&p2]})}const HI=Object.freeze(Object.defineProperty({__proto__:null,CyLogo:Hn},Symbol.toStringTag,{value:"Module"})),lc=42;function Nf(t){return t.length>lc?`${t.slice(0,lc)}…`:t}function Cf({chips:t,onChipClick:n,flashedChip:s}){return e.jsx("div",{style:{display:"flex",justifyContent:"center",gap:8,padding:"16px 26px 0",minHeight:50,flexShrink:0},children:t.map(r=>{const a=s===r.key;return e.jsxs("button",{type:"button",onClick:()=>n(r.target),style:{display:"inline-flex",alignItems:"center",gap:8,background:"var(--bg-input)",border:`1px solid ${a?"var(--accent-active)":"rgba(255,255,255,.09)"}`,borderRadius:999,padding:"6px 13px",fontSize:12.5,color:a?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer",transition:".16s"},children:[e.jsx("span",{style:{fontFamily:"'IBM Plex Mono', monospace",fontSize:10.5,letterSpacing:".06em",textTransform:"uppercase",color:"var(--text-dim)"},children:r.label}),Nf(r.value)]},r.key)})})}const WI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingBriefRail:Cf,truncateChipValue:Nf},Symbol.toStringTag,{value:"Module"}));function Pf({progress:t,chips:n,onChipClick:s,flashedChip:r,onBack:a,onNext:o,nextLabel:i="Next",nextEnabled:c=!0,hideFooter:d=!1,wide:u=!1,children:h}){return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:60,background:"var(--bg-deep)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",padding:"14px 26px",flexShrink:0,zIndex:4},children:[e.jsx("span",{style:{color:"var(--text-primary)",display:"flex"},children:e.jsx(Hn,{className:"h-3.5"})}),e.jsx("button",{type:"button",style:{marginLeft:"auto",background:"none",border:"none",padding:0,fontSize:13,color:"var(--text-muted)",cursor:"pointer"},children:"Help"}),e.jsx("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:1.5,background:"rgba(255,255,255,.06)"},children:e.jsx("i",{"data-testid":"onboarding-progress-fill",style:{display:"block",height:"100%",width:`${Math.round(t*100)}%`,background:"var(--accent-active)",transition:"width .5s cubic-bezier(.2,.8,.2,1)"}})})]}),e.jsx(Cf,{chips:n,onChipClick:s,flashedChip:r}),e.jsx("div",{style:{flex:1,minHeight:0,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"20px 26px 90px",overflowY:"auto",overscrollBehavior:"contain"},children:e.jsx("div",{style:{width:"100%",maxWidth:u?"none":940,textAlign:u?"left":"center",margin:u?0:"auto 0",flex:u?1:void 0,display:u?"flex":void 0,minHeight:0},children:h})}),!d&&e.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,display:"flex",alignItems:"center",padding:"34px 30px 22px",gap:14,pointerEvents:"none",background:"linear-gradient(to top, var(--bg-deep) 62%, rgba(30,30,30,0))"},children:[a&&e.jsx("button",{type:"button",onClick:a,style:{pointerEvents:"auto",background:"none",border:"none",padding:0,fontSize:13.5,color:"var(--text-dim)",cursor:"pointer"},children:"← Back"}),e.jsxs("button",{type:"button","data-testid":"onboarding-next",onClick:()=>{c&&o()},disabled:!c,style:{pointerEvents:"auto",marginLeft:"auto",background:c?"var(--accent-active)":"#2b2b2b",color:c?"var(--text-on-accent, #14170a)":"var(--text-dim)",border:"none",borderRadius:12,padding:"12px 20px",fontSize:14,fontWeight:700,cursor:c?"pointer":"not-allowed",transition:".18s"},children:[i," →"]})]})]})}const GI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingShell:Pf},Symbol.toStringTag,{value:"Module"})),m2=["a dashboard to keep track of my personal finances","an app to log my climbing sessions","a Chrome extension that saves quotes from articles"];function Tf({value:t,onChange:n,onSubmit:s}){const r=l.useRef(null);return l.useEffect(()=>{const a=r.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))},[]),e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:34,fontWeight:600,letterSpacing:"-.02em",color:"var(--text-primary)",marginBottom:10},children:"What do you want to build?"}),e.jsxs("p",{style:{fontSize:14.5,color:"var(--text-muted)",marginBottom:34},children:["Describe it in your own words."," ",e.jsx("kbd",{style:{fontFamily:"'IBM Plex Mono', monospace",fontSize:11,background:"#2b2b2b",border:"1px solid rgba(255,255,255,.09)",borderBottomWidth:2,borderRadius:5,padding:"2px 6px",color:"var(--text-secondary)"},children:"Enter"})," ","to continue."]}),e.jsxs("div",{style:{maxWidth:720,margin:"0 auto",textAlign:"left"},children:[e.jsx("textarea",{ref:r,value:t,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key!=="Enter"||a.shiftKey||(a.preventDefault(),t.trim().length>2&&s(t))},placeholder:"a dashboard to keep track of my personal finances…","aria-label":"Describe what you want to build",style:{width:"100%",height:132,resize:"none",background:"var(--bg-input)",border:"1px solid rgba(255,255,255,.09)",borderRadius:16,padding:"20px 22px",fontSize:17,lineHeight:1.5,fontFamily:"inherit",color:"var(--text-primary)",outline:"none"}}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:14},children:m2.map(a=>e.jsx("button",{type:"button",onClick:()=>{n(a),s(a)},style:{background:"transparent",border:"1px solid rgba(255,255,255,.09)",borderRadius:999,padding:"7px 14px",fontSize:12.5,color:"var(--text-muted)",cursor:"pointer",transition:".16s"},children:a},a))})]})]})}const UI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingPromptStep:Tf},Symbol.toStringTag,{value:"Module"})),Of=1200;function Af({onDone:t}){return l.useEffect(()=>{const n=setTimeout(t,Of);return()=>clearTimeout(n)},[t]),e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18,fontSize:15,color:"var(--text-muted)"},children:[e.jsx("div",{style:{display:"flex",gap:7},"aria-hidden":"true",children:[0,.15,.3].map(n=>e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"var(--accent-active)",animation:`onboardingBlink 1.1s ${n}s infinite`}},n))}),e.jsx("span",{role:"status",children:"Reading your idea…"})]})}const YI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingReadingStep:Af,READING_DURATION_MS:Of},Symbol.toStringTag,{value:"Module"}));function f2(t,n,s){if(n.length===0||n.includes("other"))return"Strong";let r=!1,a=!1;const o=(s||"").toLowerCase();["swift","swiftui","healthkit","jetpack","native ios","ios native","android native","kotlin native","objective-c"].some(c=>o.includes(c))&&(a=!0);for(const c of n)c==="web"?t.naturalShape==="web"&&t.id!=="chrome-extension-react"&&(r=!0):c==="static"?t.naturalShape==="static-site"&&(r=!0):c==="mobile"?(t.naturalShape==="mobile-hybrid"||t.naturalShape==="native-mobile")&&(r=!0):c==="chrome-extension"?t.id==="chrome-extension-react"&&(r=!0):c==="mcpb"?t.id==="go-web-mcpb"&&(r=!0):c==="desktop"&&t.naturalShape==="desktop"&&(r=!0);return r?a&&(t.id==="expo-react-native"||t.id==="capacitor-vite-react")?"Adjacent":"Strong":"Mismatch"}function sr({label:t,wrap:n=!1,trailing:s,children:r}){return e.jsxs("div",{style:{background:"var(--bg-input)",border:"1px solid rgba(255,255,255,.09)",borderRadius:14,padding:"16px 20px",display:"flex",alignItems:"flex-start",gap:18},children:[e.jsx("span",{style:{fontFamily:"'IBM Plex Mono', monospace",fontSize:10.5,letterSpacing:".08em",textTransform:"uppercase",color:"var(--text-dim)",width:130,flexShrink:0,whiteSpace:"nowrap",paddingTop:6,textAlign:"left"},children:t}),e.jsx("div",{style:{display:"flex",flexWrap:n?"wrap":"nowrap",gap:7,minWidth:0},children:r}),s&&e.jsx("div",{style:{marginLeft:"auto",alignSelf:"flex-start",paddingTop:6},children:s})]})}const VI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingConfirmRow:sr},Symbol.toStringTag,{value:"Module"}));function Ln({label:t,selected:n,title:s,onClick:r}){return e.jsx("button",{type:"button",onClick:r,title:s,"aria-pressed":n,style:{background:n?"var(--accent-active)":"transparent",border:"1px solid transparent",borderRadius:999,padding:"6px 13px",fontSize:13.5,fontWeight:n?600:400,color:n?"var(--text-on-accent, #14170a)":"var(--text-muted)",whiteSpace:"nowrap",cursor:"pointer",transition:".16s"},children:t})}const KI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingOptionPill:Ln},Symbol.toStringTag,{value:"Module"})),g2=[{id:"mobile",label:"Mobile App"},{id:"web",label:"Website"},{id:"desktop",label:"Desktop App"},{id:"chrome-extension",label:"Chrome Extension"},{id:"other",label:"Other"}],b2=["Desktop","Tablet","Mobile"];function Rf({appFormats:t,description:n,stacks:s=[],selectedStackId:r,defaultDevice:a,onToggleFormat:o,onSelectStack:i,onSelectDevice:c}){const[d,u]=l.useState(!1),h=s.map(m=>{const g=f2(m,t,n);return g==="Adjacent"?{stack:m,fit:g,label:`${m.name} (closest fit)`,reason:m.reasonAdjacent||m.description}:g==="Mismatch"?{stack:m,fit:g,label:`${m.name} (pivot required)`,reason:m.reasonMismatch||m.description}:{stack:m,fit:g,label:m.name,reason:m.reasonStrong||m.description}}),p=h.some(m=>m.fit==="Mismatch"),f=h.filter(m=>m.fit!=="Mismatch"||d);return e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:34,fontWeight:600,letterSpacing:"-.02em",color:"var(--text-primary)",marginBottom:10},children:"Here's what I got."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--text-muted)",marginBottom:34},children:"Change anything that's off. Everything else I'll figure out."}),e.jsxs("div",{style:{maxWidth:880,margin:"0 auto",textAlign:"left",display:"flex",flexDirection:"column",gap:10},children:[e.jsx(sr,{label:"Building",children:g2.map(m=>e.jsx(Ln,{label:m.label,selected:t.includes(m.id),onClick:()=>o(m.id)},m.id))}),e.jsxs(sr,{label:"Stack",wrap:d,trailing:p?e.jsx("button",{type:"button",onClick:()=>u(m=>!m),style:{background:"none",border:"none",padding:0,fontSize:12.5,color:"var(--accent-active)",cursor:"pointer",whiteSpace:"nowrap"},children:d?"Fewer":"All stacks"}):void 0,children:[e.jsx(Ln,{label:"Let CodeYam decide",selected:r===null,onClick:()=>i(null)}),f.map(({stack:m,label:g,reason:b})=>e.jsx(Ln,{label:g,title:b,selected:r===m.id,onClick:()=>i(m.id)},m.id))]}),e.jsx(sr,{label:"Mostly viewed on",children:b2.map(m=>e.jsx(Ln,{label:m,selected:a===m,onClick:()=>c(m)},m))})]})]})}const JI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingConfirmStep:Rf},Symbol.toStringTag,{value:"Module"}));function fs({badge:t,label:n,selected:s,dashed:r=!1,onClick:a,children:o}){return e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:a,"aria-pressed":s,style:{width:"100%",display:"flex",alignItems:"center",gap:14,background:r?"transparent":s?"#2b2b2b":"var(--bg-input)",border:`1px ${r?"dashed":"solid"} ${s?"var(--accent-active)":"rgba(255,255,255,.09)"}`,borderRadius:14,padding:"16px 20px",fontSize:15.5,color:s?"var(--text-primary)":"var(--text-secondary)",textAlign:"left",cursor:"pointer",transition:".16s"},children:[e.jsx("span",{style:{flexShrink:0,width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:"'IBM Plex Mono', monospace",fontSize:11,borderRadius:5,border:`1px solid ${s?"var(--accent-active)":"rgba(255,255,255,.09)"}`,background:s?"var(--accent-active)":"transparent",color:s?"var(--text-on-accent, #14170a)":"var(--text-dim)"},children:t}),n]}),o]})}const XI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingListItem:fs},Symbol.toStringTag,{value:"Module"}));function Ef({open:t,files:n,onAddFiles:s,onRemoveFile:r}){const a=l.useRef(null),[o,i]=l.useState(!1),c=o;return e.jsxs("div",{style:{maxHeight:t?320:0,opacity:t?1:0,overflow:"hidden",transition:"max-height .38s cubic-bezier(.2,.8,.2,1), opacity .28s"},children:[e.jsxs("div",{role:"button",tabIndex:t?0:-1,onClick:()=>{var d;return(d=a.current)==null?void 0:d.click()},onKeyDown:d=>{var u;(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),(u=a.current)==null||u.click())},onDragOver:d=>{d.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:d=>{d.preventDefault(),i(!1),s(Array.from(d.dataTransfer.files))},style:{marginTop:9,border:`1px dashed ${c?"var(--accent-active)":"rgba(255,255,255,.16)"}`,borderRadius:14,padding:26,textAlign:"center",fontSize:14,color:c?"var(--text-primary)":"var(--text-muted)",background:c?"rgba(199,240,74,.05)":"transparent",cursor:"pointer",transition:".16s"},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--text-primary)"},children:"Drop files here"})," ","or"," ",e.jsx("span",{style:{color:"var(--accent-active)",textDecoration:"underline"},children:"browse"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-dim)",marginTop:7},children:"PNG, JPG, SVG, PDF, Figma links"})]}),e.jsx("input",{ref:a,type:"file",multiple:!0,"aria-label":"Add design files",onChange:d=>{s(Array.from(d.target.files??[])),d.target.value=""},style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0}}),n.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:7,marginTop:9},children:n.map((d,u)=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,background:"#2b2b2b",border:"1px solid rgba(255,255,255,.09)",borderRadius:8,padding:"6px 8px 6px 12px",fontSize:12.5,color:"var(--text-secondary)"},children:[d.name,e.jsx("button",{type:"button","aria-label":`Remove ${d.name}`,onClick:h=>{h.stopPropagation(),r(u)},style:{background:"none",border:"none",padding:0,color:"var(--text-dim)",cursor:"pointer",fontSize:13},children:"×"})]},`${d.name}-${u}`))})]})}const QI=Object.freeze(Object.defineProperty({__proto__:null,OnboardingDropzone:Ef},Symbol.toStringTag,{value:"Module"}));function Mf(t,n){l.useEffect(()=>{function s(r){if(r.metaKey||r.ctrlKey||r.altKey)return;const a=r.target;if(a){const i=a.tagName;if(i==="INPUT"||i==="TEXTAREA"||a.isContentEditable)return}const o=Number(r.key);!Number.isInteger(o)||o<1||o>t||(r.preventDefault(),n(o))}return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,n])}const wa=[{id:"files",badge:"1",label:"Yes, I have some"},{id:"chat",badge:"2",label:"I'd like help with design"},{id:"skip",badge:"3",label:"I don't care, let's start building"}],If=260;function Df({selected:t,files:n,onSelect:s,onAddFiles:r,onRemoveFile:a,onOpenChat:o}){return Mf(wa.length,i=>{s(wa[i-1].id)}),e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:34,fontWeight:600,letterSpacing:"-.02em",color:"var(--text-primary)",marginBottom:10},children:"Do you have any design assets?"}),e.jsxs("p",{style:{fontSize:14.5,color:"var(--text-muted)",marginBottom:34},children:["Logos, screenshots, brand guides."," ",e.jsx("a",{href:"https://docs.codeyam.com/design-assets",target:"_blank",rel:"noreferrer",style:{color:"var(--accent-active)"},children:"Learn about design assets"})]}),e.jsxs("div",{style:{maxWidth:720,margin:"0 auto",display:"flex",flexDirection:"column",gap:9,textAlign:"left"},children:[wa.map(i=>e.jsx(fs,{badge:i.badge,label:i.label,selected:t===i.id,onClick:()=>s(i.id),children:i.id==="files"&&e.jsx(Ef,{open:t==="files",files:n,onAddFiles:r,onRemoveFile:a})},i.id)),e.jsx(fs,{badge:"↩",label:"Chat about this instead",selected:!1,dashed:!0,onClick:o})]})]})}const ZI=Object.freeze(Object.defineProperty({__proto__:null,ASSETS_AUTO_ADVANCE_MS:If,OnboardingDesignAssetsStep:Df},Symbol.toStringTag,{value:"Module"}));function Lf(){const[t,n]=l.useState(()=>Km());l.useEffect(()=>{ef()},[]);function s(i){n(i),Jm(i)}function r(){const i=t.sound==="off"?"soft-double-tap":t.sound;s({...t,systemNotification:!0,sound:i}),typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()}function a(){s({...t,systemNotification:!1,sound:"off"})}const o=t.systemNotification;return Mf(2,i=>{i===1?r():a()}),e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:34,fontWeight:600,letterSpacing:"-.02em",color:"var(--text-primary)",marginBottom:10},children:"Want to be notified when I'm done?"}),e.jsx("p",{style:{fontSize:14.5,color:"var(--text-muted)",marginBottom:34},children:"Building takes a few minutes. I'll ping you when I need you, so you can step away."}),e.jsxs("div",{style:{maxWidth:720,margin:"0 auto",display:"flex",flexDirection:"column",gap:9,textAlign:"left"},children:[e.jsx(fs,{badge:"1",label:"Yes, let me know",selected:o,onClick:r}),e.jsx(fs,{badge:"2",label:"No, I'll keep an eye on it",selected:!o,onClick:a}),o&&e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:7,padding:"14px 20px",background:"var(--bg-input)",border:"1px solid rgba(255,255,255,.09)",borderRadius:14},children:[e.jsx("span",{style:{fontFamily:"'IBM Plex Mono', monospace",fontSize:10.5,letterSpacing:".08em",textTransform:"uppercase",color:"var(--text-dim)",width:130,flexShrink:0},children:"Sound"}),Ym.map(i=>e.jsx(Ln,{label:i.label,selected:t.sound===i.id,onClick:()=>{s({...t,sound:i.id}),i.id!=="off"&&Si(i.id)}},i.id))]})]})]})}const e8=Object.freeze(Object.defineProperty({__proto__:null,OnboardingNotificationsStep:Lf},Symbol.toStringTag,{value:"Module"}));function Ff(t,n){return t==="chat"?"I'll start with the design and walk you through it before we build.":n>0?"I'll use your assets to set up the project and show you a first version in a minute.":"I'll set up the project and show you a first version in a minute."}function zf({summary:t,designApproach:n,fileCount:s}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26},children:[e.jsx("h1",{style:{fontSize:34,fontWeight:600,letterSpacing:"-.02em",color:"var(--text-primary)"},children:"Ready."}),e.jsx("p",{style:{fontSize:14.5,color:"var(--text-muted)",margin:0},children:Ff(n,s)}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:8,maxWidth:680},children:t.map(r=>e.jsx("span",{style:{background:"var(--bg-input)",border:"1px solid rgba(255,255,255,.09)",borderRadius:999,padding:"7px 14px",fontSize:13,color:"var(--text-secondary)"},children:r},r))})]})}const t8=Object.freeze(Object.defineProperty({__proto__:null,OnboardingDoneStep:zf,resolveDoneSubhead:Ff},Symbol.toStringTag,{value:"Module"})),cc={mobile:"Mobile App",web:"Website",desktop:"Desktop App","chrome-extension":"Chrome Extension",other:"Other"},dc={files:"Yes, I have some",chat:"I'd like help with design",skip:"No assets"};function $f(t){const{projectDir:n,loaded:s}=zo(),r=l.useRef(!1);return l.useEffect(()=>{s&&!r.current&&(r.current=!0,l2())},[s]),s?e.jsx(Bf,{...t,projectDir:n}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"auto"},children:e.jsx(kf,{})})}function Bf({onComplete:t,onPreviewUrl:n,projectDir:s}){const[r,a]=l.useState(()=>{const O=s?ja(s):null;return O?O.step:1}),[o,i]=l.useState(()=>{const O=s?ja(s):null;return(O==null?void 0:O.answers)??{appFormats:[],description:"",techStackId:null,designApproach:null,defaultDevice:"Desktop"}}),[c,d]=l.useState(null),[u,h]=l.useState([]),[p,f]=l.useState(null),[m,g]=l.useState(()=>{const O=s?ja(s):null;return(O==null?void 0:O.designChatLaunched)??!1}),b=l.useRef(m),{techStacks:x}=c2(),y=ic(o.designApproach),v=y[r-1],w=r===y.length;l.useEffect(()=>{r>y.length&&a(y.length)},[r,y.length]);const j=l.useRef(!0);l.useEffect(()=>{if(j.current){j.current=!1;return}s!==null&&o2(s,{step:r,answers:o,designChatLaunched:m,savedAt:new Date().toISOString()})},[r,o,m,s]);const _=l.useCallback(()=>{g(!0)},[]),[k,S]=l.useState(b.current?{state:"pending"}:{state:"ready",active:null});l.useEffect(()=>{if(!b.current)return;let O=!1;return(async()=>{try{const q=await(await fetch("/api/editor-design-state")).json();O||S({state:"ready",active:q.active??null})}catch{O||S({state:"ready",active:null})}})(),()=>{O=!0}},[]);const N=l.useCallback(O=>{i(L=>{const le=L.appFormats.includes(O)?L.appFormats.filter(de=>de!==O):[...L.appFormats,O];return{...L,appFormats:le,techStackId:null}}),f("type")},[]),T=l.useCallback(O=>{i(L=>({...L,defaultDevice:O}))},[]),A=l.useCallback(O=>{i(L=>({...L,techStackId:O})),f("stack")},[]),M=l.useCallback(O=>{i(L=>({...L,designApproach:O})),f("design")},[]),C=l.useCallback(O=>{h(L=>[...L,...O])},[]),H=l.useCallback(O=>{h(L=>L.filter((q,le)=>le!==O))},[]),J=l.useCallback(async()=>{await r2(o),s!==null&&i2(s),t==null||t(o)},[o,t,s]),Z=l.useRef(!1);l.useEffect(()=>{Z.current||k.state==="ready"&&v==="design-details"&&(o.designApproach==="chat"||o.designApproach==="files")&&c!==null&&c!==k.active&&(Z.current=!0,J())},[v,o.designApproach,c,J,k]);const F=l.useCallback(()=>{a(O=>O+1)},[]),$=l.useCallback(()=>{a(O=>{const L=O-1;return y[L-1]==="reading"?L-1:L})},[y]),P=(()=>{switch(v){case"prompt":return o.description.trim().length>2;case"notifications":return!0;case"design-approach":return o.designApproach!==null;case"design-details":return o.designApproach==="chat"?c!==null:!0;default:return!0}})(),I=l.useCallback(O=>{i(L=>({...L,description:O,appFormats:[d2(O)],techStackId:null})),f("idea"),a(L=>L+1)},[]),B=l.useCallback(O=>{if(M(O),O==="files")return;const L=setTimeout(()=>a(q=>q+1),If);X.current=L},[M]),X=l.useRef(null);l.useEffect(()=>()=>{X.current&&clearTimeout(X.current)},[r]);const W=(()=>{var de;const O=y.indexOf("prompt")+1,L=y.indexOf("confirm")+1,q=y.indexOf("design-approach")+1,le=[];return o.description&&r>O&&le.push({key:"idea",label:"Idea",value:o.description,target:O}),o.appFormats.length>0&&r>L&&(le.push({key:"type",label:"Type",value:o.appFormats.map(ee=>cc[ee]??ee).join(", "),target:L}),le.push({key:"stack",label:"Stack",value:((de=x.find(ee=>ee.id===o.techStackId))==null?void 0:de.name)??"Let CodeYam decide",target:L})),o.designApproach&&r>q&&le.push({key:"design",label:"Design",value:dc[o.designApproach],target:q}),le})(),ie=(()=>{var L;const O=[];return o.description&&O.push(o.description),o.appFormats.length>0&&O.push(o.appFormats.map(q=>cc[q]??q).join(", ")),O.push(((L=x.find(q=>q.id===o.techStackId))==null?void 0:L.name)??"Let CodeYam decide"),o.defaultDevice&&O.push(o.defaultDevice),u.length>0?O.push(`${u.length} asset${u.length===1?"":"s"}`):o.designApproach&&O.push(dc[o.designApproach]),O})(),Q=l.useCallback(()=>{i(L=>({...L,designApproach:"chat"}));const O=ic("chat");a(O.indexOf("design-details")+1)},[]);if(v){const O=v==="done",L=v==="design-details";if(L)return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"auto",padding:"var(--spacing-xl, 28px)"},children:[e.jsx(to,{description:o.description,launched:m,onLaunched:_,onDesignSelected:d,onPreviewUrl:n,variant:o.designApproach==="files"?"files":"chat"}),e.jsx(Sf,{step:r,canAdvance:P,isFinalStep:w,onBack:$,onNext:F,onFinish:J})]});const q=O?o.designApproach==="chat"?"Start with design":"Start building":"Next";return e.jsx(Pf,{progress:y.length>1?(r-1)/(y.length-1):0,chips:W,onChipClick:a,flashedChip:p,onBack:r>1&&v!=="reading"?$:void 0,onNext:w?J:F,nextLabel:q,nextEnabled:P,hideFooter:v==="reading",children:e.jsxs("div",{style:{animation:"onboardingSlideIn .44s cubic-bezier(.2,.8,.2,1) both"},children:[v==="prompt"&&e.jsx(Tf,{value:o.description,onChange:le=>i(de=>({...de,description:le})),onSubmit:I}),v==="reading"&&e.jsx(Af,{onDone:F}),v==="confirm"&&e.jsx(Rf,{appFormats:o.appFormats,description:o.description,stacks:x,selectedStackId:o.techStackId,defaultDevice:o.defaultDevice,onToggleFormat:N,onSelectStack:A,onSelectDevice:T}),v==="design-approach"&&e.jsx(Df,{selected:o.designApproach,files:u,onSelect:B,onAddFiles:C,onRemoveFile:H,onOpenChat:Q}),v==="notifications"&&e.jsx(Lf,{}),v==="done"&&e.jsx(zf,{summary:ie,designApproach:o.designApproach,fileCount:u.length}),L&&e.jsx(to,{description:o.description,launched:m,onLaunched:_,onDesignSelected:d,onPreviewUrl:n,variant:o.designApproach==="files"?"files":"chat"})]},v)})}return null}const n8=Object.freeze(Object.defineProperty({__proto__:null,NewProjectQuestionnaire:$f,NewProjectQuestionnaireInner:Bf},Symbol.toStringTag,{value:"Module"}));function qf({projectTitle:t,projectDescription:n,stats:s,coverage:r,onSelectApp:a,configLoading:o,scenariosLoading:i,testsLoading:c,testsRefreshing:d,onRunTests:u,currentRunner:h,stepState:p,onPreviewUrl:f,onComplete:m,onOpenBuildTab:g,onCoverageClick:b,isBuilding:x=!1,buildingLabel:y,buildingStepLabel:v,buildingStepPosition:w,buildingStatus:j,buildingProgress:_,onResetBuild:k}){const{saved:S}=nf();return s.length===0?o||i||S===null?null:sf({appStatsLength:s.length,configLoading:!!o,scenariosLoading:!!i,setupAnswersSaved:S,hasStepState:!!p})?e.jsx($f,{onPreviewUrl:f,onComplete:m}):e.jsx(lf,{projectDescription:n??null,onOpenBuildTab:g??(()=>{})}):e.jsx("div",{className:"px-5 py-5",children:e.jsxs("div",{style:{width:"100%",maxWidth:1e3,marginInline:"auto"},children:[e.jsx(df,{projectTitle:t,coverage:r,onCoverageClick:b}),e.jsx(vf,{isBuilding:x,buildingLabel:y,buildingStepLabel:v,buildingStepPosition:w,buildingStatus:j,buildingProgress:_,buildingMode:p==null?void 0:p.mode,onOpenBuilding:g??(()=>{}),onResetBuild:k??(()=>{})}),e.jsx(cf,{stats:s,onSelectApp:a,testsLoading:c,testsRefreshing:d,onRunTests:u,currentRunner:h})]})})}const s8=Object.freeze(Object.defineProperty({__proto__:null,AppOverview:qf},Symbol.toStringTag,{value:"Module"}));function Hf({sessionContent:t,stepIndicator:n}){return e.jsxs("div",{className:"flex flex-col h-full",children:[n,t]})}const r8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabLayout:Hf},Symbol.toStringTag,{value:"Module"}));function Wf({activeTab:t,buildTab:n,footer:s,resultsPanel:r,minimizedResults:a,resultsMode:o}){return e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:t==="build"?"visible":"hidden",pointerEvents:t==="build"?"auto":"none"},children:[e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx("div",{style:{flex:o==="full"?"0 0 50%":"1 1 auto",minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:n}),o==="full"?r:null,o==="minimized"?a:null]}),s]})}const a8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabPaneLayout:Wf},Symbol.toStringTag,{value:"Module"}));function x2(t=!1){return{title:"Session Ready to Resume",description:t?"CodeYam saved this build session while it was waiting on the next workflow action. Review the current feature and step below, then click resume when you're ready to continue.":"CodeYam found a saved build session for this feature. Review the current feature and step below, then click resume when you're ready to continue.",buttonLabel:"Resume Session",providersLabel:null}}function y2(t,n){const s=at(t),r=at(n);return{title:"Saved Handoff Ready",description:`A ${s} build session is still in progress for this feature. CodeYam saved the workflow state so ${r} can continue from the same step instead of starting over.`,buttonLabel:"Continue with Saved Handoff",providersLabel:`${s} to ${r}`}}function v2({resumeMode:t,previousProvider:n,currentProvider:s,awaitingUserInput:r=!1}){return t!=="handoff"||n==null||s==null||n===s?x2(r):y2(n,s)}function Gf({label:t,onContinue:n}){return e.jsx("button",{onClick:n,className:"w-full px-4 py-2 text-sm rounded transition-colors cursor-pointer font-medium",style:{background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #0F0F0F)"},children:t})}const o8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecoveryActionButton:Gf},Symbol.toStringTag,{value:"Module"}));function Uf({children:t}){return e.jsx("div",{className:"flex items-center justify-center h-full",role:"dialog","aria-modal":"true",style:{background:"var(--bg-deep)",color:"var(--text-secondary)"},children:e.jsx("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:t})})}const i8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecoveryDialog:Uf},Symbol.toStringTag,{value:"Module"}));function Yf({description:t,title:n}){return e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",style:{color:"var(--text-primary)"},children:n}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--text-muted)"},children:t})]})}const l8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecoveryHeader:Yf},Symbol.toStringTag,{value:"Module"}));function rr({label:t,rowClassName:n,value:s}){return e.jsxs("div",{className:n,children:[e.jsxs("span",{style:{color:"var(--text-muted)"},children:[t,":"]})," ",e.jsx("span",{style:{color:"var(--text-primary)"},children:s})]})}const c8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecoverySummaryRow:rr},Symbol.toStringTag,{value:"Module"}));function Vf({featureName:t,editorStep:n,editorStepLabel:s,providersLabel:r}){return e.jsxs("div",{className:"rounded p-3 mb-5 text-sm",style:{background:"var(--bg-deep)"},children:[t&&e.jsx(rr,{label:"Feature",value:t,rowClassName:"mb-1"}),n!=null&&s&&e.jsx(rr,{label:"Step",value:`${n} (${s})`}),r&&e.jsx(rr,{label:"Providers",value:r,rowClassName:"mt-1"})]})}const d8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecoverySummary:Vf},Symbol.toStringTag,{value:"Module"}));function j2(t){const n=l.useCallback(s=>{s.key==="Enter"&&(s.preventDefault(),t())},[t]);l.useEffect(()=>(window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)),[n])}function Kf({featureName:t,editorStep:n,workflowMode:s,previousProvider:r,currentProvider:a,resumeMode:o,awaitingUserInput:i=!1,onContinue:c}){const d=v2({resumeMode:o,previousProvider:r,currentProvider:a,awaitingUserInput:i}),u=n==null?null:pf(n,s);return j2(c),e.jsxs(Uf,{children:[e.jsx(Yf,{title:d.title,description:d.description}),e.jsx(Vf,{featureName:t,editorStep:n,editorStepLabel:u,providersLabel:d.providersLabel}),e.jsx(Gf,{label:d.buttonLabel,onContinue:c})]})}const u8=Object.freeze(Object.defineProperty({__proto__:null,EditorSessionRecovery:Kf},Symbol.toStringTag,{value:"Module"}));function Jf({awaitingUserInput:t,currentProvider:n,editorStep:s,featureName:r,onContinue:a,previousProvider:o,resumeMode:i,workflowMode:c}){return e.jsx(Kf,{featureName:r,editorStep:s,workflowMode:c,previousProvider:o,currentProvider:n,resumeMode:i,awaitingUserInput:t,onContinue:a})}const h8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabRecoveryPanel:Jf},Symbol.toStringTag,{value:"Module"}));function w2({sessionDecision:t,sessionInfo:n,buildLaunchGateArmed:s,stepState:r}){return{recoveryFeatureName:(r==null?void 0:r.feature)??(n==null?void 0:n.feature)??null,recoveryStep:(r==null?void 0:r.step)??(n==null?void 0:n.step)??null,recoveryMode:(r==null?void 0:r.mode)??(n==null?void 0:n.mode)??null,showTerminal:!s&&(t==="continue"||t==="fresh"||t==="no-session")&&(r!==null||n!==null),shouldResumeSameProvider:t==="continue"&&(n==null?void 0:n.resumeMode)==="resume"}}const ar=8e3,_2="agent-banner-ready",k2="agent-auth-required";let pr=!1,mr=!1,Bt=[],uc=!1,Vt=null,Xt=null,or=!1;function S2(){uc||typeof window>"u"||(uc=!0,window.addEventListener(_2,()=>{const t=!mr;if(t){mr=!0;const n=Bt;Bt=[];for(const s of n)s("banner")}if(or&&(or=!1,Xt&&Vt===null)){se("dispatch-rename-after-auth",{label:Xt.label,reason:"first-observed-frame-after-auth"}),Vt=Xt,dr(Xt.label,Xt.send);return}Vt&&(se("dispatch-rename-reapply",{label:Vt.label,reason:t?"first-observed-frame":"second-observed-frame"}),dr(Vt.label,Vt.send))}),window.addEventListener(k2,()=>{or=!0,se("agent-auth-required-observed",{});const t=Bt;Bt=[];for(const n of t)n("auth-required")}))}S2();function N2(){return mr?Promise.resolve("banner"):new Promise(t=>{let n=!1;const s=a=>{n||(n=!0,clearTimeout(r),t(a))};Bt.push(s);const r=setTimeout(()=>{if(n)return;n=!0;const a=Bt.indexOf(s);a>=0&&Bt.splice(a,1),t("fallback")},ar)})}async function Xf(t,n,s=0,r=zw,a=!1){if(pr){se("dispatch-rename-suppressed",{caller:n,label:t});return}pr=!0,Xt={label:t,send:r},se("dispatch-rename",{phase:"queued",caller:n,label:t,fallbackMs:ar,postReadyDelayMs:s});const o=await N2();if(o==="auth-required"){se("dispatch-rename-deferred-for-auth",{caller:n,label:t});return}if(a&&o==="fallback"){se("dispatch-rename-skipped-no-banner",{caller:n,label:t,fallbackMs:ar});return}s>0&&await new Promise(i=>setTimeout(i,s)),o==="fallback"&&se("dispatch-rename-fallback",{caller:n,label:t,fallbackMs:ar}),se("dispatch-rename",{phase:"fired",caller:n,label:t,source:o,postReadyDelayMs:s}),Vt={label:t,send:r},dr(t,r)}function C2(){pr=!1,mr=!1,Bt=[],Vt=null,Xt=null,or=!1}function P2(){pr=!1,Bt=[],Xt=null}const T2="Editor";function O2({provider:t,agentStartMode:n,currentFeature:s}){const r=l.useRef(!1);l.useEffect(()=>{if(!(r.current||!$w(t)||n!=="fresh")){if(s!==null){r.current=!0;return}r.current=!0,Xf(T2,"build-session-seed",gd,void 0,!0)}},[t,n,s])}function Qf({snippet:t,onRetry:n,onDismiss:s,providerLabel:r}){return e.jsx("div",{"data-testid":"build-tab-startup-error",className:"border-b border-red-500/30 bg-red-950/40 text-red-100 px-4 py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium text-sm mb-1",children:[r," didn't start"]}),e.jsx("pre",{"data-testid":"build-tab-startup-error-snippet",className:"font-mono text-xs whitespace-pre-wrap break-words bg-black/40 text-red-50 px-2 py-1 rounded max-h-40 overflow-auto",children:t})]}),e.jsxs("div",{className:"flex items-start gap-2 shrink-0",children:[e.jsx(Ze,{variant:"subtle",text:t,label:"Copy",className:"shrink-0 px-3 py-1.5 rounded border border-red-500/50 text-red-100 text-sm font-medium hover:bg-red-900/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"}),e.jsx("button",{type:"button",onClick:n,"data-testid":"build-tab-startup-error-retry",className:"px-3 py-1.5 rounded bg-red-500 text-white text-sm font-medium cursor-pointer hover:bg-red-400",children:"Retry"}),e.jsx("button",{type:"button",onClick:s,"data-testid":"build-tab-startup-error-dismiss","aria-label":"Dismiss",title:"Dismiss",className:"px-2 py-1.5 rounded text-red-200 text-sm cursor-pointer hover:bg-red-900/40",children:"×"})]})]})})}const p8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabStartupError:Qf},Symbol.toStringTag,{value:"Module"}));function Ti(t,n,s){l.useEffect(()=>{const r=o=>{const i=o.target;t.current&&t.current.contains(i)||s!=null&&s.current&&s.current.contains(i)||n()},a=o=>{o.key==="Escape"&&n()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a)}},[t,n,s])}function Zf(t=768){const n=`(max-width: ${t-.02}px)`,[s,r]=l.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(n).matches);return l.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(n);r(a.matches);const o=i=>r(i.matches);return a.addEventListener("change",o),()=>a.removeEventListener("change",o)},[n]),s}const eg=[{label:"Remote Control",send:"/remote-control",submit:!0},{label:"Codeyam Editor",send:"/codeyam-editor",submit:!0},{label:"Clear",send:"/clear",submit:!0},{label:"Cancel (ESC)",send:"\x1B",submit:!1}];function tg({defaultOpen:t=!1}){return Zf()?e.jsx(ng,{defaultOpen:t}):null}function ng({defaultOpen:t=!1}){const{config:n}=_t(),[s,r]=l.useState(t),a=l.useRef(null),o=l.useRef(null),i=l.useCallback(()=>r(!1),[]);Ti(a,i,o);const c=n&&n.mobileTerminalCommands.length>0?n.mobileTerminalCommands:eg,d=l.useCallback(u=>{u.submit?Ia(u.send):Da(u.send),r(!1)},[]);return e.jsxs("div",{className:"absolute top-2 right-2 z-20 flex flex-col items-end",children:[e.jsx("button",{ref:o,type:"button","data-testid":"mobile-command-menu-toggle","aria-haspopup":"menu","aria-expanded":s,"aria-label":"Terminal commands",onClick:()=>r(u=>!u),className:"rounded-full bg-gray-800/90 px-3 py-1.5 text-xs font-medium text-gray-100 shadow-lg ring-1 ring-white/10 backdrop-blur active:bg-gray-700",children:"⌨ Commands"}),s&&e.jsx("div",{ref:a,role:"menu","data-testid":"mobile-command-menu-popup",className:"mt-1 min-w-[10rem] overflow-hidden rounded-lg bg-gray-800 py-1 shadow-xl ring-1 ring-white/10",children:c.map((u,h)=>e.jsx("button",{type:"button",role:"menuitem","data-testid":`mobile-command-${h}`,onClick:()=>d(u),className:"block w-full px-4 py-2 text-left text-sm text-gray-100 active:bg-gray-700",children:u.label},`${u.label}-${h}`))})]})}const m8=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_MOBILE_TERMINAL_COMMANDS:eg,MobileTerminalCommandMenu:tg,MobileTerminalCommandMenuPanel:ng},Symbol.toStringTag,{value:"Module"}));function A2(t){const n=Math.floor(t/6e4);if(n<1)return"under a minute";if(n===1)return"1 minute";if(n<60)return`${n} minutes`;const s=Math.floor(n/60);return s===1?"over an hour":`over ${s} hours`}function sg({silentMs:t,onDismiss:n,providerLabel:s}){const{sendToAgent:r,agentReady:a}=bd();return e.jsx("div",{className:"bg-black border-t border-[#333] px-4 py-2",children:e.jsxs("div",{className:"flex items-start gap-3 px-3 py-2 rounded-lg border border-[#FF5A5A]/60 bg-[#2a0d0d]",children:[e.jsx("span",{className:"w-2.5 h-2.5 mt-1.5 rounded-full bg-[#FF5A5A] shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-sm text-[#FF8B8B]",children:[s," has been mid-turn with no output for"," ",e.jsx("span",{className:"font-medium",children:A2(t)}),"."]}),e.jsxs("p",{className:"text-xs text-[#FF8B8B]/70 mt-1",children:["There's no input box because ",s," still believes it's working. Interrupting returns the prompt so you can type again."]})]}),e.jsx("button",{type:"button",disabled:!a,onClick:()=>r(""),className:"shrink-0 px-3 py-1.5 rounded-md text-sm font-medium border border-[#FF5A5A]/60 text-[#FF8B8B] hover:bg-[#FF5A5A]/15 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer transition-colors",title:a?"Send Ctrl-C to interrupt the current turn":"No agent connected",children:"Interrupt (Ctrl-C)"}),e.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 mt-1 text-[#FF8B8B]/60 hover:text-[#FF8B8B] transition-colors cursor-pointer",title:"Dismiss",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M3 3l8 8M11 3l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}const f8=Object.freeze(Object.defineProperty({__proto__:null,StuckTurnBanner:sg},Symbol.toStringTag,{value:"Module"})),R2=1e3;let no=0;function Ws(){no=Date.now()}function E2(){return no===0?1/0:Date.now()-no}function M2(){return E2()<R2}function Oi(t,n,s=50){const r=l.useRef(n);r.current=n,l.useEffect(()=>{const a=t.current;if(!a)return;let o=null;const i=new ResizeObserver(c=>{o&&clearTimeout(o);const d=c[0];d&&(o=setTimeout(()=>{r.current(d)},s))});return i.observe(a),()=>{o&&clearTimeout(o),i.disconnect()}},[t,s])}const fr=20*1024*1024,I2=3e4,rg=3e3;function ag(t){return new Promise((n,s)=>{const r=new FileReader;r.onload=()=>{const a=r.result;if(typeof a!="string"){s(new Error("Unexpected FileReader result"));return}const o=a.indexOf(",");n(o===-1?a:a.slice(o+1))},r.onerror=()=>s(r.error??new Error("read failed")),r.readAsDataURL(t)})}function D2(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`drop-${Date.now()}-${Math.random().toString(36).slice(2)}`}function og(t){return/^[A-Za-z0-9._/\-]+$/.test(t)?t:`"${t.replace(/(["\\$`])/g,"\\$1")}"`}function ig(t){const n=t.items;if(!n||n.length===0||typeof n[0].webkitGetAsEntry!="function")return!1;for(const r of Array.from(n)){const a=r.webkitGetAsEntry();if(a&&a.isDirectory)return!0}return!1}function L2({wsRef:t,insertInput:n}){const[s,r]=l.useState(!1),[a,o]=l.useState(null),i=l.useRef(new Map),c=l.useRef(0);l.useEffect(()=>{if(a===null)return;const w=window.setTimeout(()=>o(null),rg);return()=>window.clearTimeout(w)},[a]);const d=l.useCallback(w=>{o(w)},[]),u=l.useCallback((w,j)=>{const _=i.current.get(w);_&&(i.current.delete(w),_.resolve(j))},[]),h=l.useCallback((w,j)=>{const _=i.current.get(w);_&&(i.current.delete(w),_.reject(j))},[]),p=l.useCallback(w=>{for(const[,j]of i.current)j.reject(w);i.current.clear()},[]),f=l.useCallback(async w=>{if(w.size>fr)throw new Error(`File too large (max ${fr/(1024*1024)} MB)`);const j=t.current;if(!j||j.readyState!==WebSocket.OPEN)throw new Error("Not connected — try again in a moment");const _=await ag(w),k=D2(),S=new Promise((N,T)=>{const A=window.setTimeout(()=>{i.current.delete(k)&&T(new Error("Timed out waiting for save to complete"))},I2);i.current.set(k,{resolve:M=>{window.clearTimeout(A),N(M)},reject:M=>{window.clearTimeout(A),T(new Error(M))}})});return j.send(JSON.stringify({type:"drop",id:k,name:w.name||"unnamed",mime:w.type||"application/octet-stream",data:_})),S},[t]),m=l.useCallback(async w=>{if(w.length===0)return;const j=[];for(const _ of w)try{j.push(await f(_))}catch(k){const S=k instanceof Error?k.message:String(k);d(`Attach failed: ${S}`);return}n(j.map(og).join(" ")+" ")},[f,d,n]),g=l.useCallback(w=>{w.dataTransfer.types.includes("Files")&&(w.preventDefault(),c.current+=1,r(!0))},[]),b=l.useCallback(w=>{w.dataTransfer.types.includes("Files")&&w.preventDefault()},[]),x=l.useCallback(w=>{w.dataTransfer.types.includes("Files")&&(c.current=Math.max(0,c.current-1),c.current===0&&r(!1))},[]),y=l.useCallback(async w=>{if(!w.dataTransfer.types.includes("Files"))return;if(w.preventDefault(),c.current=0,r(!1),ig(w.dataTransfer)){d("Folder drops are not supported — drag individual files instead");return}const j=Array.from(w.dataTransfer.files).filter(_=>_.size>0);await m(j)},[m,d]),v=l.useCallback(async w=>{var k;const j=(k=w.clipboardData)==null?void 0:k.items;if(!j)return;const _=[];for(const S of Array.from(j))if(S.kind==="file"&&S.type.startsWith("image/")){const N=S.getAsFile();N&&_.push(N)}_.length!==0&&(w.preventDefault(),await m(_))},[m]);return{dragActive:s,errorToast:a,dropHandlers:{onDragEnter:g,onDragOver:b,onDragLeave:x,onDrop:y},pasteHandler:v,resolveDrop:u,rejectDrop:h,cancelAllDrops:p,showError:d}}function Ai(t){const[n,s]=l.useState(0);l.useEffect(()=>{if(n===0)return;const a=window.setTimeout(()=>s(0),t);return()=>window.clearTimeout(a)},[n,t]);const r=l.useCallback(()=>{s(a=>a+1)},[]);return[n>0,r]}function F2(t=2e3){return new Promise(n=>{let s=!1,r=null;const a=i=>{if(!s){s=!0,clearTimeout(o);try{r==null||r.close()}catch{}n(i)}},o=setTimeout(()=>a(!1),t);try{const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/health`;r=new WebSocket(c),r.onmessage=()=>a(!0),r.onopen=()=>a(!0),r.onerror=()=>a(!1),r.onclose=()=>a(!1)}catch{a(!1)}})}function z2(t){return t>=200&&t<300?"valid":t===401?"stale":"unreachable"}async function lg(t=1500){try{const n=await fetch("/api/session-check",{credentials:"same-origin",cache:"no-store",signal:AbortSignal.timeout(t)});return z2(n.status)}catch{return"unreachable"}}async function $2(){try{await fetch("/build",{credentials:"same-origin",cache:"no-store"})}catch{return!1}return await lg()==="valid"}function B2({session:t,attempts:n,max:s}){return t!=="stale"?"check-transport":n<s?"reacquire":"give-up"}function cg(){return e.jsx("div",{"data-testid":"terminal-drop-overlay",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(30, 30, 30, 0.85)",color:"#D7FF63",fontFamily:"'IBM Plex Mono', monospace",fontSize:14,border:"2px dashed #D7FF63",borderRadius:6,pointerEvents:"none",zIndex:5},children:"Drop file to attach"})}const g8=Object.freeze(Object.defineProperty({__proto__:null,TerminalDropOverlay:cg},Symbol.toStringTag,{value:"Module"}));function dg({message:t}){return e.jsx("div",{"data-testid":"terminal-drop-toast",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",background:"#3a1f1f",color:"#ff9494",border:"1px solid #7a3939",borderRadius:4,padding:"6px 12px",fontFamily:"'IBM Plex Mono', monospace",fontSize:12,zIndex:6,pointerEvents:"none"},children:t})}const b8=Object.freeze(Object.defineProperty({__proto__:null,TerminalDropToast:dg},Symbol.toStringTag,{value:"Module"}));function Ur(){return e.jsx("div",{"data-testid":"terminal-copied-toast",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",background:"#1f3a23",color:"#94ff94",border:"1px solid #397a39",borderRadius:4,padding:"6px 12px",fontFamily:"'IBM Plex Mono', monospace",fontSize:12,zIndex:6,pointerEvents:"none"},children:"Copied"})}const x8=Object.freeze(Object.defineProperty({__proto__:null,TerminalCopiedToast:Ur},Symbol.toStringTag,{value:"Module"})),hc=15,q2=3,H2=2;function ug({provider:t,agentStartMode:n,sessionId:s,onAgentIdle:r,onAgentActive:a,onAgentStuckTurn:o,onUserInput:i,onStartupFailed:c,onStartupFailedCleared:d,suppressReconnectOnStopBuilding:u=!1,launchIntent:h=!1}){if(wt())return null;const p=l.useRef(null),f=l.useRef(null),m=l.useRef(null),g=l.useRef(null),b=l.useRef(!1),x=l.useRef(n??"fresh"),y=l.useRef(s??null),v=l.useRef(h),[w,j]=l.useState({kind:"connecting"}),[_,k]=l.useState(0),[S,N]=Ai(1200);l.useEffect(()=>{x.current=n??"fresh",y.current=s??null,v.current=h},[n,s,h]);const T=l.useRef(r);T.current=r;const A=l.useRef(a);A.current=a;const M=l.useRef(o);M.current=o;const C=l.useRef(i);C.current=i;const H=l.useRef(c);H.current=c;const J=l.useRef(d);J.current=d;const Z=L2({wsRef:g,insertInput:P=>{var I,B;((I=g.current)==null?void 0:I.readyState)===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"input",data:P})),Ws(),(B=C.current)==null||B.call(C)}}),F=l.useRef(Z);F.current=Z;const $=l.useCallback(P=>{var I;return((I=g.current)==null?void 0:I.readyState)===WebSocket.OPEN?(g.current.send(JSON.stringify({type:"input",data:P})),!0):!1},[]);return Bw($,w.kind==="open"),Oi(p,()=>{var P;m.current&&f.current&&(m.current.fit(),((P=g.current)==null?void 0:P.readyState)===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"resize",cols:f.current.cols,rows:f.current.rows})))}),l.useEffect(()=>{if(!p.current||b.current)return;b.current=!0;const P=new Ao.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', monospace",rightClickSelectsWord:!1,theme:{background:"#1e1e1e",foreground:"#cccccc",cursor:"#D7FF63",selectionBackground:"#264f78"}}),I=new Ro.FitAddon;P.loadAddon(I),P.open(p.current),f.current=P,m.current=I;const B=Eo(P,p.current,{onError:V=>F.current.showError(V),onCopy:()=>N()}),X=Mo(P,{sendInput:V=>{var te,oe;((te=g.current)==null?void 0:te.readyState)===WebSocket.OPEN&&g.current.send(JSON.stringify({type:"input",data:V})),Ws(),(oe=C.current)==null||oe.call(C)}});requestAnimationFrame(()=>{I.fit(),P.focus()});let W=!1,ie=0,Q=!1,O=0,L=0,q=null;function le(){Q=!1;try{const V=new WebSocket(Ww({provider:t,mode:x.current,sessionId:y.current??void 0,launch:v.current,cols:P.cols,rows:P.rows}));g.current=V,V.binaryType="arraybuffer",V.onmessage=te=>{var oe,he,G,ne,re;if(te.data instanceof ArrayBuffer)P.write(new Uint8Array(te.data));else if(typeof te.data=="string")try{const U=JSON.parse(te.data);if(U.type==="error"){W=!0,j({kind:"server-error",message:Gw(U)});return}if(U.type==="session-id")x.current="resume",y.current=U.sessionId??null;else if(U.type==="agent-idle"||U.type==="claude-idle"){const we=typeof U.source=="string"?U.source:void 0;se("ws-message-received",{type:U.type,source:we}),(oe=T.current)==null||oe.call(T,we)}else if(U.type==="agent-active"||U.type==="claude-active")se("ws-message-received-active",{type:U.type}),(he=A.current)==null||he.call(A);else if(U.type==="agent-stuck-turn"){const we=typeof U.silentMs=="number"?U.silentMs:0;se("ws-message-received-stuck-turn",{silentMs:we,source:typeof U.source=="string"?U.source:void 0}),(G=M.current)==null||G.call(M,we)}else if(U.type==="idle-diag"){const{site:we,event:_e,...Se}=U;se(`rust:${_e??"unknown"}`,{site:we,...Se})}else U.type==="drop-complete"?F.current.resolveDrop(String(U.id??""),String(U.path??"")):U.type==="drop-error"?F.current.rejectDrop(String(U.id??""),String(U.message??"drop failed")):U.type==="startup-failed"?(ne=H.current)==null||ne.call(H,String(U.snippet??"")):U.type==="startup-failed-cleared"?(re=J.current)==null||re.call(J):U.type==="agent-banner-ready"?(se("agent-banner-ready",{}),window.dispatchEvent(new CustomEvent("agent-banner-ready"))):U.type==="agent-auth-required"?(se("agent-auth-required",{}),window.dispatchEvent(new CustomEvent("agent-auth-required"))):U.type==="agent-auth-resolved"&&(se("agent-auth-resolved",{}),window.dispatchEvent(new CustomEvent("agent-auth-resolved")))}catch{}},V.onopen=()=>{ie=0,Q=!0,O=0,L=0,j({kind:"open"}),se("ws-open"),V.send(JSON.stringify({type:"resize",cols:P.cols,rows:P.rows}));try{typeof localStorage<"u"&&localStorage.getItem("codeyam.idleDebug")==="1"&&(V.send(JSON.stringify({type:"enable-idle-diag",sessionId:Lo()})),se("idle-diag-enabled"))}catch{}},V.onerror=()=>{},V.onclose=async()=>{if(se("ws-close",{reconnectAttempts:ie}),F.current.cancelAllDrops("Not connected"),W){j(oe=>oe.kind==="server-error"?oe:{kind:"ended"}),P.writeln(`\r
|
|
38
|
+
\x1B[90m[Terminal session ended]\x1B[0m`);return}const te=await Uw();if(!W){if(!te){j({kind:"server-stopped"}),q==null||q(),q=Yw(2e3,()=>{W||window.location.reload()});return}if(Q)O=0;else{O++;const oe=await lg();if(W)return;const he=B2({session:oe,attempts:L,max:H2});if(he==="reacquire"){L++,j({kind:"session-stale"});const ne=await $2();if(W)return;if(ne){O=0,le();return}j({kind:"session-stale",canRetry:!0});return}if(he==="give-up"){j({kind:"session-stale",canRetry:!0});return}const G=await F2();if(W)return;if(!G||O>=q2){j({kind:"edge-unreachable"});return}}if(ie<hc){const oe=ie<4?1e3*Math.pow(2,ie):1e4;ie++,j({kind:"reconnecting",attempt:ie,maxAttempts:hc}),setTimeout(()=>{W||le()},oe)}else j({kind:"failed"})}}}catch{j({kind:"failed"})}}try{I.fit()}catch{}le();let de=0;const ee=1e3;function D(){var te;const V=Date.now();V-de>=ee&&((te=g.current)==null?void 0:te.readyState)===WebSocket.OPEN&&(g.current.send(JSON.stringify({type:"browser-activity"})),de=V)}document.addEventListener("mousemove",D),document.addEventListener("keydown",D),document.addEventListener("mousedown",D),P.onData(V=>{var te,oe;((te=g.current)==null?void 0:te.readyState)===WebSocket.OPEN?g.current.send(JSON.stringify({type:"input",data:V})):k(he=>he+1),Ws(),(oe=C.current)==null||oe.call(C)});const z=p.current;function K(V){var re,U,we,_e;const te=V,oe=(re=te.clipboardData)==null?void 0:re.items;if(oe){for(const Se of Array.from(oe))if(Se.kind==="file"&&Se.type.startsWith("image/")){V.preventDefault(),V.stopPropagation(),F.current.pasteHandler(te);return}}const he=((U=te.clipboardData)==null?void 0:U.getData("text"))??"";if(!he)return;V.preventDefault(),V.stopPropagation();const G=he.replace(/\r\n/g,"\r").replace(/\n/g,"\r"),ne=P.modes.bracketedPasteMode?`\x1B[200~${G}\x1B[201~`:G;((we=g.current)==null?void 0:we.readyState)===WebSocket.OPEN?g.current.send(JSON.stringify({type:"input",data:ne})):k(Se=>Se+1),Ws(),(_e=C.current)==null||_e.call(C)}z.addEventListener("paste",K,!0);function ue(V){var he,G;const te=V.detail;if(!te)return;((he=g.current)==null?void 0:he.readyState)===WebSocket.OPEN?((G=g.current)==null||G.send(JSON.stringify({type:"input",data:te})),se("terminal-send-input",{len:te.length,firstChars:te.slice(0,16),wsOpen:!0,dropped:!1})):se("terminal-send-input",{len:te.length,firstChars:te.slice(0,16),wsOpen:!1,dropped:!0})}window.addEventListener("terminal-send-input",ue),qw();function ye(){Io(),P.focus()}window.addEventListener("terminal-focus",ye);function je(){var V;W=!0,(V=g.current)==null||V.close(),j({kind:"ended"}),P.reset()}return u&&window.addEventListener("build-session-stopped",je),()=>{var V;W=!0,q==null||q(),q=null,document.removeEventListener("mousemove",D),document.removeEventListener("keydown",D),document.removeEventListener("mousedown",D),window.removeEventListener("terminal-send-input",ue),Vw(),window.removeEventListener("terminal-focus",ye),u&&window.removeEventListener("build-session-stopped",je),z.removeEventListener("paste",K,!0),X(),(V=g.current)==null||V.close(),B(),P.dispose(),b.current=!1}},[t]),e.jsxs("div",{className:"relative flex-1 flex flex-col",style:{minHeight:0},"data-terminal-emulator":!0,onDragEnter:Z.dropHandlers.onDragEnter,onDragOver:Z.dropHandlers.onDragOver,onDragLeave:Z.dropHandlers.onDragLeave,onDrop:Z.dropHandlers.onDrop,onPaste:Z.pasteHandler,children:[e.jsx("div",{ref:p,className:"flex-1",tabIndex:-1,style:{background:"#1e1e1e",minHeight:0,paddingTop:3,paddingLeft:3,outline:"none"},onPointerDown:()=>{$l(p.current,()=>{var P;return(P=f.current)==null?void 0:P.focus()})},onClick:()=>{$l(p.current,()=>{var P;return(P=f.current)==null?void 0:P.focus()})}}),Z.dragActive&&e.jsx(cg,{}),Z.errorToast&&e.jsx(dg,{message:Z.errorToast}),S&&e.jsx(Ur,{}),e.jsx(Hw,{status:w,pulseKey:_,onRefresh:()=>window.location.reload()})]})}const y8=Object.freeze(Object.defineProperty({__proto__:null,TerminalEmulator:ug},Symbol.toStringTag,{value:"Module"}));function hg({onAgentActive:t,onAgentIdle:n,onUserInput:s,provider:r,sessionId:a,shouldResumeSameProvider:o,currentFeature:i}){const[c,d]=l.useState(null),[u,h]=l.useState(0),[p,f]=l.useState(null);O2({provider:r,agentStartMode:o?"resume":"fresh",currentFeature:i}),l.useEffect(()=>()=>{C2()},[]);const m=l.useCallback(w=>{d(w)},[]),g=l.useCallback(()=>{d(null)},[]),b=l.useCallback(()=>{d(null),h(w=>w+1)},[]),x=l.useCallback(()=>{f(null),n()},[n]),y=l.useCallback(()=>{f(null),t()},[t]),v=l.useCallback(()=>{f(null),s()},[s]);return e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[c!==null&&e.jsx(Qf,{snippet:c,onRetry:b,onDismiss:g,providerLabel:at(r)}),p!==null&&e.jsx(sg,{silentMs:p,onDismiss:()=>f(null),providerLabel:at(r)}),e.jsxs("div",{className:"relative flex flex-col flex-1 min-h-0",children:[e.jsx(ug,{provider:r,agentStartMode:o?"resume":"fresh",sessionId:o?a:null,onAgentIdle:x,onAgentActive:y,onAgentStuckTurn:f,onUserInput:v,onStartupFailed:m,onStartupFailedCleared:g,suppressReconnectOnStopBuilding:!0,launchIntent:!0},u),e.jsx(tg,{}),e.jsx("div",{className:"absolute top-2 left-2 z-20 md:left-auto md:right-2",children:e.jsx(Kw,{className:"rounded-full bg-gray-800/90 px-3 py-1.5 shadow-lg ring-1 ring-white/10 backdrop-blur"})})]})]})}const v8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabTerminalSession:hg},Symbol.toStringTag,{value:"Module"}));function W2(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return l.useMemo(()=>r=>{n.forEach(a=>a(r))},n)}const Yr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vn(t){const n=Object.prototype.toString.call(t);return n==="[object Window]"||n==="[object global]"}function Ri(t){return"nodeType"in t}function ot(t){var n,s;return t?Vn(t)?t:Ri(t)&&(n=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?n:window:window}function Ei(t){const{Document:n}=ot(t);return t instanceof n}function Ns(t){return Vn(t)?!1:t instanceof ot(t).HTMLElement}function pg(t){return t instanceof ot(t).SVGElement}function Kn(t){return t?Vn(t)?t.document:Ri(t)?Ei(t)?t:Ns(t)||pg(t)?t.ownerDocument:document:document:document}const Et=Yr?l.useLayoutEffect:l.useEffect;function Mi(t){const n=l.useRef(t);return Et(()=>{n.current=t}),l.useCallback(function(){for(var s=arguments.length,r=new Array(s),a=0;a<s;a++)r[a]=arguments[a];return n.current==null?void 0:n.current(...r)},[])}function G2(){const t=l.useRef(null),n=l.useCallback((r,a)=>{t.current=setInterval(r,a)},[]),s=l.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[n,s]}function gs(t,n){n===void 0&&(n=[t]);const s=l.useRef(t);return Et(()=>{s.current!==t&&(s.current=t)},n),s}function Cs(t,n){const s=l.useRef();return l.useMemo(()=>{const r=t(s.current);return s.current=r,r},[...n])}function gr(t){const n=Mi(t),s=l.useRef(null),r=l.useCallback(a=>{a!==s.current&&(n==null||n(a,s.current)),s.current=a},[]);return[s,r]}function so(t){const n=l.useRef();return l.useEffect(()=>{n.current=t},[t]),n.current}let _a={};function Ps(t,n){return l.useMemo(()=>{if(n)return n;const s=_a[t]==null?0:_a[t]+1;return _a[t]=s,t+"-"+s},[t,n])}function mg(t){return function(n){for(var s=arguments.length,r=new Array(s>1?s-1:0),a=1;a<s;a++)r[a-1]=arguments[a];return r.reduce((o,i)=>{const c=Object.entries(i);for(const[d,u]of c){const h=o[d];h!=null&&(o[d]=h+t*u)}return o},{...n})}}const Fn=mg(1),bs=mg(-1);function U2(t){return"clientX"in t&&"clientY"in t}function Ii(t){if(!t)return!1;const{KeyboardEvent:n}=ot(t.target);return n&&t instanceof n}function Y2(t){if(!t)return!1;const{TouchEvent:n}=ot(t.target);return n&&t instanceof n}function ro(t){if(Y2(t)){if(t.touches&&t.touches.length){const{clientX:n,clientY:s}=t.touches[0];return{x:n,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:n,clientY:s}=t.changedTouches[0];return{x:n,y:s}}}return U2(t)?{x:t.clientX,y:t.clientY}:null}const xs=Object.freeze({Translate:{toString(t){if(!t)return;const{x:n,y:s}=t;return"translate3d("+(n?Math.round(n):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:n,scaleY:s}=t;return"scaleX("+n+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[xs.Translate.toString(t),xs.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:n,duration:s,easing:r}=t;return n+" "+s+"ms "+r}}}),pc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function V2(t){return t.matches(pc)?t:t.querySelector(pc)}const K2={display:"none"};function J2(t){let{id:n,value:s}=t;return st.createElement("div",{id:n,style:K2},s)}function X2(t){let{id:n,announcement:s,ariaLiveType:r="assertive"}=t;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return st.createElement("div",{id:n,style:a,role:"status","aria-live":r,"aria-atomic":!0},s)}function Q2(){const[t,n]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&n(r)},[]),announcement:t}}const fg=l.createContext(null);function Z2(t){const n=l.useContext(fg);l.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n])}function eN(){const[t]=l.useState(()=>new Set),n=l.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[l.useCallback(r=>{let{type:a,event:o}=r;t.forEach(i=>{var c;return(c=i[a])==null?void 0:c.call(i,o)})},[t]),n]}const tN={draggable:`
|
|
39
|
+
To pick up a draggable item, press the space bar.
|
|
40
|
+
While dragging, use the arrow keys to move the item.
|
|
41
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
42
|
+
`},nN={onDragStart(t){let{active:n}=t;return"Picked up draggable item "+n.id+"."},onDragOver(t){let{active:n,over:s}=t;return s?"Draggable item "+n.id+" was moved over droppable area "+s.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(t){let{active:n,over:s}=t;return s?"Draggable item "+n.id+" was dropped over droppable area "+s.id:"Draggable item "+n.id+" was dropped."},onDragCancel(t){let{active:n}=t;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function sN(t){let{announcements:n=nN,container:s,hiddenTextDescribedById:r,screenReaderInstructions:a=tN}=t;const{announce:o,announcement:i}=Q2(),c=Ps("DndLiveRegion"),[d,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Z2(l.useMemo(()=>({onDragStart(p){let{active:f}=p;o(n.onDragStart({active:f}))},onDragMove(p){let{active:f,over:m}=p;n.onDragMove&&o(n.onDragMove({active:f,over:m}))},onDragOver(p){let{active:f,over:m}=p;o(n.onDragOver({active:f,over:m}))},onDragEnd(p){let{active:f,over:m}=p;o(n.onDragEnd({active:f,over:m}))},onDragCancel(p){let{active:f,over:m}=p;o(n.onDragCancel({active:f,over:m}))}}),[o,n])),!d)return null;const h=st.createElement(st.Fragment,null,st.createElement(J2,{id:r,value:a.draggable}),st.createElement(X2,{id:c,announcement:i}));return s?bn.createPortal(h,s):h}var Ie;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ie||(Ie={}));function br(){}function mc(t,n){return l.useMemo(()=>({sensor:t,options:n??{}}),[t,n])}function rN(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return l.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const jt=Object.freeze({x:0,y:0});function gg(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function bg(t,n){let{data:{value:s}}=t,{data:{value:r}}=n;return s-r}function aN(t,n){let{data:{value:s}}=t,{data:{value:r}}=n;return r-s}function fc(t){let{left:n,top:s,height:r,width:a}=t;return[{x:n,y:s},{x:n+a,y:s},{x:n,y:s+r},{x:n+a,y:s+r}]}function xg(t,n){if(!t||t.length===0)return null;const[s]=t;return s[n]}function gc(t,n,s){return n===void 0&&(n=t.left),s===void 0&&(s=t.top),{x:n+t.width*.5,y:s+t.height*.5}}const oN=t=>{let{collisionRect:n,droppableRects:s,droppableContainers:r}=t;const a=gc(n,n.left,n.top),o=[];for(const i of r){const{id:c}=i,d=s.get(c);if(d){const u=gg(gc(d),a);o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(bg)},iN=t=>{let{collisionRect:n,droppableRects:s,droppableContainers:r}=t;const a=fc(n),o=[];for(const i of r){const{id:c}=i,d=s.get(c);if(d){const u=fc(d),h=a.reduce((f,m,g)=>f+gg(u[g],m),0),p=Number((h/4).toFixed(4));o.push({id:c,data:{droppableContainer:i,value:p}})}}return o.sort(bg)};function lN(t,n){const s=Math.max(n.top,t.top),r=Math.max(n.left,t.left),a=Math.min(n.left+n.width,t.left+t.width),o=Math.min(n.top+n.height,t.top+t.height),i=a-r,c=o-s;if(r<a&&s<o){const d=n.width*n.height,u=t.width*t.height,h=i*c,p=h/(d+u-h);return Number(p.toFixed(4))}return 0}const cN=t=>{let{collisionRect:n,droppableRects:s,droppableContainers:r}=t;const a=[];for(const o of r){const{id:i}=o,c=s.get(i);if(c){const d=lN(c,n);d>0&&a.push({id:i,data:{droppableContainer:o,value:d}})}}return a.sort(aN)};function dN(t,n,s){return{...t,scaleX:n&&s?n.width/s.width:1,scaleY:n&&s?n.height/s.height:1}}function yg(t,n){return t&&n?{x:t.left-n.left,y:t.top-n.top}:jt}function uN(t){return function(s){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return a.reduce((i,c)=>({...i,top:i.top+t*c.y,bottom:i.bottom+t*c.y,left:i.left+t*c.x,right:i.right+t*c.x}),{...s})}}const hN=uN(1);function pN(t){if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function mN(t,n,s){const r=pN(n);if(!r)return t;const{scaleX:a,scaleY:o,x:i,y:c}=r,d=t.left-i-(1-a)*parseFloat(s),u=t.top-c-(1-o)*parseFloat(s.slice(s.indexOf(" ")+1)),h=a?t.width/a:t.width,p=o?t.height/o:t.height;return{width:h,height:p,top:u,right:d+h,bottom:u+p,left:d}}const fN={ignoreTransform:!1};function Jn(t,n){n===void 0&&(n=fN);let s=t.getBoundingClientRect();if(n.ignoreTransform){const{transform:u,transformOrigin:h}=ot(t).getComputedStyle(t);u&&(s=mN(s,u,h))}const{top:r,left:a,width:o,height:i,bottom:c,right:d}=s;return{top:r,left:a,width:o,height:i,bottom:c,right:d}}function bc(t){return Jn(t,{ignoreTransform:!0})}function gN(t){const n=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:n,bottom:s,width:n,height:s}}function bN(t,n){return n===void 0&&(n=ot(t).getComputedStyle(t)),n.position==="fixed"}function xN(t,n){n===void 0&&(n=ot(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=n[a];return typeof o=="string"?s.test(o):!1})}function Vr(t,n){const s=[];function r(a){if(n!=null&&s.length>=n||!a)return s;if(Ei(a)&&a.scrollingElement!=null&&!s.includes(a.scrollingElement))return s.push(a.scrollingElement),s;if(!Ns(a)||pg(a)||s.includes(a))return s;const o=ot(t).getComputedStyle(a);return a!==t&&xN(a,o)&&s.push(a),bN(a,o)?s:r(a.parentNode)}return t?r(t):s}function vg(t){const[n]=Vr(t,1);return n??null}function ka(t){return!Yr||!t?null:Vn(t)?t:Ri(t)?Ei(t)||t===Kn(t).scrollingElement?window:Ns(t)?t:null:null}function jg(t){return Vn(t)?t.scrollX:t.scrollLeft}function wg(t){return Vn(t)?t.scrollY:t.scrollTop}function ao(t){return{x:jg(t),y:wg(t)}}var ze;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ze||(ze={}));function _g(t){return!Yr||!t?!1:t===document.scrollingElement}function kg(t){const n={x:0,y:0},s=_g(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},a=t.scrollTop<=n.y,o=t.scrollLeft<=n.x,i=t.scrollTop>=r.y,c=t.scrollLeft>=r.x;return{isTop:a,isLeft:o,isBottom:i,isRight:c,maxScroll:r,minScroll:n}}const yN={x:.2,y:.2};function vN(t,n,s,r,a){let{top:o,left:i,right:c,bottom:d}=s;r===void 0&&(r=10),a===void 0&&(a=yN);const{isTop:u,isBottom:h,isLeft:p,isRight:f}=kg(t),m={x:0,y:0},g={x:0,y:0},b={height:n.height*a.y,width:n.width*a.x};return!u&&o<=n.top+b.height?(m.y=ze.Backward,g.y=r*Math.abs((n.top+b.height-o)/b.height)):!h&&d>=n.bottom-b.height&&(m.y=ze.Forward,g.y=r*Math.abs((n.bottom-b.height-d)/b.height)),!f&&c>=n.right-b.width?(m.x=ze.Forward,g.x=r*Math.abs((n.right-b.width-c)/b.width)):!p&&i<=n.left+b.width&&(m.x=ze.Backward,g.x=r*Math.abs((n.left+b.width-i)/b.width)),{direction:m,speed:g}}function jN(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:n,left:s,right:r,bottom:a}=t.getBoundingClientRect();return{top:n,left:s,right:r,bottom:a,width:t.clientWidth,height:t.clientHeight}}function Sg(t){return t.reduce((n,s)=>Fn(n,ao(s)),jt)}function wN(t){return t.reduce((n,s)=>n+jg(s),0)}function _N(t){return t.reduce((n,s)=>n+wg(s),0)}function kN(t,n){if(n===void 0&&(n=Jn),!t)return;const{top:s,left:r,bottom:a,right:o}=n(t);vg(t)&&(a<=0||o<=0||s>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const SN=[["x",["left","right"],wN],["y",["top","bottom"],_N]];class Di{constructor(n,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Vr(s),a=Sg(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[o,i,c]of SN)for(const d of i)Object.defineProperty(this,d,{get:()=>{const u=c(r),h=a[o]-u;return this.rect[d]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class cs{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...s)})},this.target=n}add(n,s,r){var a;(a=this.target)==null||a.addEventListener(n,s,r),this.listeners.push([n,s,r])}}function NN(t){const{EventTarget:n}=ot(t);return t instanceof n?t:Kn(t)}function Sa(t,n){const s=Math.abs(t.x),r=Math.abs(t.y);return typeof n=="number"?Math.sqrt(s**2+r**2)>n:"x"in n&&"y"in n?s>n.x&&r>n.y:"x"in n?s>n.x:"y"in n?r>n.y:!1}var mt;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(mt||(mt={}));function xc(t){t.preventDefault()}function CN(t){t.stopPropagation()}var xe;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(xe||(xe={}));const Ng={start:[xe.Space,xe.Enter],cancel:[xe.Esc],end:[xe.Space,xe.Enter,xe.Tab]},PN=(t,n)=>{let{currentCoordinates:s}=n;switch(t.code){case xe.Right:return{...s,x:s.x+25};case xe.Left:return{...s,x:s.x-25};case xe.Down:return{...s,y:s.y+25};case xe.Up:return{...s,y:s.y-25}}};class Li{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:s}}=n;this.props=n,this.listeners=new cs(Kn(s)),this.windowListeners=new cs(ot(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(mt.Resize,this.handleCancel),this.windowListeners.add(mt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(mt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:s}=this.props,r=n.node.current;r&&kN(r),s(jt)}handleKeyDown(n){if(Ii(n)){const{active:s,context:r,options:a}=this.props,{keyboardCodes:o=Ng,coordinateGetter:i=PN,scrollBehavior:c="smooth"}=a,{code:d}=n;if(o.end.includes(d)){this.handleEnd(n);return}if(o.cancel.includes(d)){this.handleCancel(n);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:jt;this.referenceCoordinates||(this.referenceCoordinates=h);const p=i(n,{active:s,context:r.current,currentCoordinates:h});if(p){const f=bs(p,h),m={x:0,y:0},{scrollableAncestors:g}=r.current;for(const b of g){const x=n.code,{isTop:y,isRight:v,isLeft:w,isBottom:j,maxScroll:_,minScroll:k}=kg(b),S=jN(b),N={x:Math.min(x===xe.Right?S.right-S.width/2:S.right,Math.max(x===xe.Right?S.left:S.left+S.width/2,p.x)),y:Math.min(x===xe.Down?S.bottom-S.height/2:S.bottom,Math.max(x===xe.Down?S.top:S.top+S.height/2,p.y))},T=x===xe.Right&&!v||x===xe.Left&&!w,A=x===xe.Down&&!j||x===xe.Up&&!y;if(T&&N.x!==p.x){const M=b.scrollLeft+f.x,C=x===xe.Right&&M<=_.x||x===xe.Left&&M>=k.x;if(C&&!f.y){b.scrollTo({left:M,behavior:c});return}C?m.x=b.scrollLeft-M:m.x=x===xe.Right?b.scrollLeft-_.x:b.scrollLeft-k.x,m.x&&b.scrollBy({left:-m.x,behavior:c});break}else if(A&&N.y!==p.y){const M=b.scrollTop+f.y,C=x===xe.Down&&M<=_.y||x===xe.Up&&M>=k.y;if(C&&!f.x){b.scrollTo({top:M,behavior:c});return}C?m.y=b.scrollTop-M:m.y=x===xe.Down?b.scrollTop-_.y:b.scrollTop-k.y,m.y&&b.scrollBy({top:-m.y,behavior:c});break}}this.handleMove(n,Fn(bs(p,this.referenceCoordinates),m))}}}handleMove(n,s){const{onMove:r}=this.props;n.preventDefault(),r(s)}handleEnd(n){const{onEnd:s}=this.props;n.preventDefault(),this.detach(),s()}handleCancel(n){const{onCancel:s}=this.props;n.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Li.activators=[{eventName:"onKeyDown",handler:(t,n,s)=>{let{keyboardCodes:r=Ng,onActivation:a}=n,{active:o}=s;const{code:i}=t.nativeEvent;if(r.start.includes(i)){const c=o.activatorNode.current;return c&&t.target!==c?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function yc(t){return!!(t&&"distance"in t)}function vc(t){return!!(t&&"delay"in t)}class Fi{constructor(n,s,r){var a;r===void 0&&(r=NN(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=s;const{event:o}=n,{target:i}=o;this.props=n,this.events=s,this.document=Kn(i),this.documentListeners=new cs(this.document),this.listeners=new cs(r),this.windowListeners=new cs(ot(i)),this.initialCoordinates=(a=ro(o))!=null?a:jt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:s,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(mt.Resize,this.handleCancel),this.windowListeners.add(mt.DragStart,xc),this.windowListeners.add(mt.VisibilityChange,this.handleCancel),this.windowListeners.add(mt.ContextMenu,xc),this.documentListeners.add(mt.Keydown,this.handleKeydown),s){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(vc(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(yc(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,s){const{active:r,onPending:a}=this.props;a(r,n,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:n}=this,{onStart:s}=this.props;n&&(this.activated=!0,this.documentListeners.add(mt.Click,CN,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(mt.SelectionChange,this.removeTextSelection),s(n))}handleMove(n){var s;const{activated:r,initialCoordinates:a,props:o}=this,{onMove:i,options:{activationConstraint:c}}=o;if(!a)return;const d=(s=ro(n))!=null?s:jt,u=bs(a,d);if(!r&&c){if(yc(c)){if(c.tolerance!=null&&Sa(u,c.tolerance))return this.handleCancel();if(Sa(u,c.distance))return this.handleStart()}if(vc(c)&&Sa(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}n.cancelable&&n.preventDefault(),i(d)}handleEnd(){const{onAbort:n,onEnd:s}=this.props;this.detach(),this.activated||n(this.props.active),s()}handleCancel(){const{onAbort:n,onCancel:s}=this.props;this.detach(),this.activated||n(this.props.active),s()}handleKeydown(n){n.code===xe.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const TN={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class zi extends Fi{constructor(n){const{event:s}=n,r=Kn(s.target);super(n,TN,r)}}zi.activators=[{eventName:"onPointerDown",handler:(t,n)=>{let{nativeEvent:s}=t,{onActivation:r}=n;return!s.isPrimary||s.button!==0?!1:(r==null||r({event:s}),!0)}}];const ON={move:{name:"mousemove"},end:{name:"mouseup"}};var oo;(function(t){t[t.RightClick=2]="RightClick"})(oo||(oo={}));class AN extends Fi{constructor(n){super(n,ON,Kn(n.event.target))}}AN.activators=[{eventName:"onMouseDown",handler:(t,n)=>{let{nativeEvent:s}=t,{onActivation:r}=n;return s.button===oo.RightClick?!1:(r==null||r({event:s}),!0)}}];const Na={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class RN extends Fi{constructor(n){super(n,Na)}static setup(){return window.addEventListener(Na.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(Na.move.name,n)};function n(){}}}RN.activators=[{eventName:"onTouchStart",handler:(t,n)=>{let{nativeEvent:s}=t,{onActivation:r}=n;const{touches:a}=s;return a.length>1?!1:(r==null||r({event:s}),!0)}}];var ds;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ds||(ds={}));var xr;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(xr||(xr={}));function EN(t){let{acceleration:n,activator:s=ds.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:i=5,order:c=xr.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:h,delta:p,threshold:f}=t;const m=IN({delta:p,disabled:!o}),[g,b]=G2(),x=l.useRef({x:0,y:0}),y=l.useRef({x:0,y:0}),v=l.useMemo(()=>{switch(s){case ds.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case ds.DraggableRect:return a}},[s,a,d]),w=l.useRef(null),j=l.useCallback(()=>{const k=w.current;if(!k)return;const S=x.current.x*y.current.x,N=x.current.y*y.current.y;k.scrollBy(S,N)},[]),_=l.useMemo(()=>c===xr.TreeOrder?[...u].reverse():u,[c,u]);l.useEffect(()=>{if(!o||!u.length||!v){b();return}for(const k of _){if((r==null?void 0:r(k))===!1)continue;const S=u.indexOf(k),N=h[S];if(!N)continue;const{direction:T,speed:A}=vN(k,N,v,n,f);for(const M of["x","y"])m[M][T[M]]||(A[M]=0,T[M]=0);if(A.x>0||A.y>0){b(),w.current=k,g(j,i),x.current=A,y.current=T;return}}x.current={x:0,y:0},y.current={x:0,y:0},b()},[n,j,r,b,o,i,JSON.stringify(v),JSON.stringify(m),g,u,_,h,JSON.stringify(f)])}const MN={x:{[ze.Backward]:!1,[ze.Forward]:!1},y:{[ze.Backward]:!1,[ze.Forward]:!1}};function IN(t){let{delta:n,disabled:s}=t;const r=so(n);return Cs(a=>{if(s||!r||!a)return MN;const o={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[ze.Backward]:a.x[ze.Backward]||o.x===-1,[ze.Forward]:a.x[ze.Forward]||o.x===1},y:{[ze.Backward]:a.y[ze.Backward]||o.y===-1,[ze.Forward]:a.y[ze.Forward]||o.y===1}}},[s,n,r])}function DN(t,n){const s=n!=null?t.get(n):void 0,r=s?s.node.current:null;return Cs(a=>{var o;return n==null?null:(o=r??a)!=null?o:null},[r,n])}function LN(t,n){return l.useMemo(()=>t.reduce((s,r)=>{const{sensor:a}=r,o=a.activators.map(i=>({eventName:i.eventName,handler:n(i.handler,r)}));return[...s,...o]},[]),[t,n])}var ys;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ys||(ys={}));var io;(function(t){t.Optimized="optimized"})(io||(io={}));const jc=new Map;function FN(t,n){let{dragging:s,dependencies:r,config:a}=n;const[o,i]=l.useState(null),{frequency:c,measure:d,strategy:u}=a,h=l.useRef(t),p=x(),f=gs(p),m=l.useCallback(function(y){y===void 0&&(y=[]),!f.current&&i(v=>v===null?y:v.concat(y.filter(w=>!v.includes(w))))},[f]),g=l.useRef(null),b=Cs(y=>{if(p&&!s)return jc;if(!y||y===jc||h.current!==t||o!=null){const v=new Map;for(let w of t){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){v.set(w.id,w.rect.current);continue}const j=w.node.current,_=j?new Di(d(j),j):null;w.rect.current=_,_&&v.set(w.id,_)}return v}return y},[t,o,s,p,d]);return l.useEffect(()=>{h.current=t},[t]),l.useEffect(()=>{p||m()},[s,p]),l.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),l.useEffect(()=>{p||typeof c!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},c))},[c,p,m,...r]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:o!=null};function x(){switch(u){case ys.Always:return!1;case ys.BeforeDragging:return s;default:return!s}}}function Cg(t,n){return Cs(s=>t?s||(typeof n=="function"?n(t):t):null,[n,t])}function zN(t,n){return Cg(t,n)}function $N(t){let{callback:n,disabled:s}=t;const r=Mi(n),a=l.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,s]);return l.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Kr(t){let{callback:n,disabled:s}=t;const r=Mi(n),a=l.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[s]);return l.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function BN(t){return new Di(Jn(t),t)}function wc(t,n,s){n===void 0&&(n=BN);const[r,a]=l.useState(null);function o(){a(d=>{if(!t)return null;if(t.isConnected===!1){var u;return(u=d??s)!=null?u:null}const h=n(t);return JSON.stringify(d)===JSON.stringify(h)?d:h})}const i=$N({callback(d){if(t)for(const u of d){const{type:h,target:p}=u;if(h==="childList"&&p instanceof HTMLElement&&p.contains(t)){o();break}}}}),c=Kr({callback:o});return Et(()=>{o(),t?(c==null||c.observe(t),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),i==null||i.disconnect())},[t]),r}function qN(t){const n=Cg(t);return yg(t,n)}const _c=[];function HN(t){const n=l.useRef(t),s=Cs(r=>t?r&&r!==_c&&t&&n.current&&t.parentNode===n.current.parentNode?r:Vr(t):_c,[t]);return l.useEffect(()=>{n.current=t},[t]),s}function WN(t){const[n,s]=l.useState(null),r=l.useRef(t),a=l.useCallback(o=>{const i=ka(o.target);i&&s(c=>c?(c.set(i,ao(i)),new Map(c)):null)},[]);return l.useEffect(()=>{const o=r.current;if(t!==o){i(o);const c=t.map(d=>{const u=ka(d);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,ao(u)]):null}).filter(d=>d!=null);s(c.length?new Map(c):null),r.current=t}return()=>{i(t),i(o)};function i(c){c.forEach(d=>{const u=ka(d);u==null||u.removeEventListener("scroll",a)})}},[a,t]),l.useMemo(()=>t.length?n?Array.from(n.values()).reduce((o,i)=>Fn(o,i),jt):Sg(t):jt,[t,n])}function kc(t,n){n===void 0&&(n=[]);const s=l.useRef(null);return l.useEffect(()=>{s.current=null},n),l.useEffect(()=>{const r=t!==jt;r&&!s.current&&(s.current=t),!r&&s.current&&(s.current=null)},[t]),s.current?bs(t,s.current):jt}function GN(t){l.useEffect(()=>{if(!Yr)return;const n=t.map(s=>{let{sensor:r}=s;return r.setup==null?void 0:r.setup()});return()=>{for(const s of n)s==null||s()}},t.map(n=>{let{sensor:s}=n;return s}))}function UN(t,n){return l.useMemo(()=>t.reduce((s,r)=>{let{eventName:a,handler:o}=r;return s[a]=i=>{o(i,n)},s},{}),[t,n])}function Pg(t){return l.useMemo(()=>t?gN(t):null,[t])}const Sc=[];function YN(t,n){n===void 0&&(n=Jn);const[s]=t,r=Pg(s?ot(s):null),[a,o]=l.useState(Sc);function i(){o(()=>t.length?t.map(d=>_g(d)?r:new Di(n(d),d)):Sc)}const c=Kr({callback:i});return Et(()=>{c==null||c.disconnect(),i(),t.forEach(d=>c==null?void 0:c.observe(d))},[t]),a}function VN(t){if(!t)return null;if(t.children.length>1)return t;const n=t.children[0];return Ns(n)?n:t}function KN(t){let{measure:n}=t;const[s,r]=l.useState(null),a=l.useCallback(u=>{for(const{target:h}of u)if(Ns(h)){r(p=>{const f=n(h);return p?{...p,width:f.width,height:f.height}:f});break}},[n]),o=Kr({callback:a}),i=l.useCallback(u=>{const h=VN(u);o==null||o.disconnect(),h&&(o==null||o.observe(h)),r(h?n(h):null)},[n,o]),[c,d]=gr(i);return l.useMemo(()=>({nodeRef:c,rect:s,setRef:d}),[s,c,d])}const JN=[{sensor:zi,options:{}},{sensor:Li,options:{}}],XN={current:{}},ir={draggable:{measure:bc},droppable:{measure:bc,strategy:ys.WhileDragging,frequency:io.Optimized},dragOverlay:{measure:Jn}};class us extends Map{get(n){var s;return n!=null&&(s=super.get(n))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:s}=n;return!s})}getNodeFor(n){var s,r;return(s=(r=this.get(n))==null?void 0:r.node.current)!=null?s:void 0}}const QN={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:br},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ir,measureDroppableContainers:br,windowRect:null,measuringScheduled:!1},ZN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:br,draggableNodes:new Map,over:null,measureDroppableContainers:br},Jr=l.createContext(ZN),Tg=l.createContext(QN);function eC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function tC(t,n){switch(n.type){case Ie.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Ie.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:n.coordinates.x-t.draggable.initialCoordinates.x,y:n.coordinates.y-t.draggable.initialCoordinates.y}}};case Ie.DragEnd:case Ie.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ie.RegisterDroppable:{const{element:s}=n,{id:r}=s,a=new us(t.droppable.containers);return a.set(r,s),{...t,droppable:{...t.droppable,containers:a}}}case Ie.SetDroppableDisabled:{const{id:s,key:r,disabled:a}=n,o=t.droppable.containers.get(s);if(!o||r!==o.key)return t;const i=new us(t.droppable.containers);return i.set(s,{...o,disabled:a}),{...t,droppable:{...t.droppable,containers:i}}}case Ie.UnregisterDroppable:{const{id:s,key:r}=n,a=t.droppable.containers.get(s);if(!a||r!==a.key)return t;const o=new us(t.droppable.containers);return o.delete(s),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function nC(t){let{disabled:n}=t;const{active:s,activatorEvent:r,draggableNodes:a}=l.useContext(Jr),o=so(r),i=so(s==null?void 0:s.id);return l.useEffect(()=>{if(!n&&!r&&o&&i!=null){if(!Ii(o)||document.activeElement===o.target)return;const c=a.get(i);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[d.current,u.current]){if(!h)continue;const p=V2(h);if(p){p.focus();break}}})}},[r,n,a,i,o]),null}function sC(t,n){let{transform:s,...r}=n;return t!=null&&t.length?t.reduce((a,o)=>o({transform:a,...r}),s):s}function rC(t){return l.useMemo(()=>({draggable:{...ir.draggable,...t==null?void 0:t.draggable},droppable:{...ir.droppable,...t==null?void 0:t.droppable},dragOverlay:{...ir.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function aC(t){let{activeNode:n,measure:s,initialRect:r,config:a=!0}=t;const o=l.useRef(!1),{x:i,y:c}=typeof a=="boolean"?{x:a,y:a}:a;Et(()=>{if(!i&&!c||!n){o.current=!1;return}if(o.current||!r)return;const u=n==null?void 0:n.node.current;if(!u||u.isConnected===!1)return;const h=s(u),p=yg(h,r);if(i||(p.x=0),c||(p.y=0),o.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){const f=vg(u);f&&f.scrollBy({top:p.y,left:p.x})}},[n,i,c,r,s])}const Og=l.createContext({...jt,scaleX:1,scaleY:1});var Kt;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Kt||(Kt={}));const oC=l.memo(function(n){var s,r,a,o;let{id:i,accessibility:c,autoScroll:d=!0,children:u,sensors:h=JN,collisionDetection:p=cN,measuring:f,modifiers:m,...g}=n;const b=l.useReducer(tC,void 0,eC),[x,y]=b,[v,w]=eN(),[j,_]=l.useState(Kt.Uninitialized),k=j===Kt.Initialized,{draggable:{active:S,nodes:N,translate:T},droppable:{containers:A}}=x,M=S!=null?N.get(S):null,C=l.useRef({initial:null,translated:null}),H=l.useMemo(()=>{var ve;return S!=null?{id:S,data:(ve=M==null?void 0:M.data)!=null?ve:XN,rect:C}:null},[S,M]),J=l.useRef(null),[Z,F]=l.useState(null),[$,P]=l.useState(null),I=gs(g,Object.values(g)),B=Ps("DndDescribedBy",i),X=l.useMemo(()=>A.getEnabled(),[A]),W=rC(f),{droppableRects:ie,measureDroppableContainers:Q,measuringScheduled:O}=FN(X,{dragging:k,dependencies:[T.x,T.y],config:W.droppable}),L=DN(N,S),q=l.useMemo(()=>$?ro($):null,[$]),le=cn(),de=zN(L,W.draggable.measure);aC({activeNode:S!=null?N.get(S):null,config:le.layoutShiftCompensation,initialRect:de,measure:W.draggable.measure});const ee=wc(L,W.draggable.measure,de),D=wc(L?L.parentElement:null),z=l.useRef({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),K=A.getNodeFor((s=z.current.over)==null?void 0:s.id),ue=KN({measure:W.dragOverlay.measure}),ye=(r=ue.nodeRef.current)!=null?r:L,je=k?(a=ue.rect)!=null?a:ee:null,V=!!(ue.nodeRef.current&&ue.rect),te=qN(V?null:ee),oe=Pg(ye?ot(ye):null),he=HN(k?K??L:null),G=YN(he),ne=sC(m,{transform:{x:T.x-te.x,y:T.y-te.y,scaleX:1,scaleY:1},activatorEvent:$,active:H,activeNodeRect:ee,containerNodeRect:D,draggingNodeRect:je,over:z.current.over,overlayNodeRect:ue.rect,scrollableAncestors:he,scrollableAncestorRects:G,windowRect:oe}),re=q?Fn(q,T):null,U=WN(he),we=kc(U),_e=kc(U,[ee]),Se=Fn(ne,we),dt=je?hN(je,ne):null,Ye=H&&dt?p({active:H,collisionRect:dt,droppableRects:ie,droppableContainers:X,pointerCoordinates:re}):null,ft=xg(Ye,"id"),[Ae,gt]=l.useState(null),ut=V?ne:Fn(ne,_e),on=dN(ut,(o=Ae==null?void 0:Ae.rect)!=null?o:null,ee),St=l.useRef(null),qe=l.useCallback((ve,Pe)=>{let{sensor:Te,options:Ce}=Pe;if(J.current==null)return;const Re=N.get(J.current);if(!Re)return;const E=ve.nativeEvent,Ke=new Te({active:J.current,activeNode:Re,event:E,options:Ce,context:z,onAbort(Oe){if(!N.get(Oe))return;const{onDragAbort:He}=I.current,De={id:Oe};He==null||He(De),v({type:"onDragAbort",event:De})},onPending(Oe,Je,He,De){if(!N.get(Oe))return;const{onDragPending:Xe}=I.current,Ne={id:Oe,constraint:Je,initialCoordinates:He,offset:De};Xe==null||Xe(Ne),v({type:"onDragPending",event:Ne})},onStart(Oe){const Je=J.current;if(Je==null)return;const He=N.get(Je);if(!He)return;const{onDragStart:De}=I.current,bt={activatorEvent:E,active:{id:Je,data:He.data,rect:C}};bn.unstable_batchedUpdates(()=>{De==null||De(bt),_(Kt.Initializing),y({type:Ie.DragStart,initialCoordinates:Oe,active:Je}),v({type:"onDragStart",event:bt}),F(St.current),P(E)})},onMove(Oe){y({type:Ie.DragMove,coordinates:Oe})},onEnd:ht(Ie.DragEnd),onCancel:ht(Ie.DragCancel)});St.current=Ke;function ht(Oe){return async function(){const{active:He,collisions:De,over:bt,scrollAdjustedTranslate:Xe}=z.current;let Ne=null;if(He&&Xe){const{cancelDrop:pt}=I.current;Ne={activatorEvent:E,active:He,collisions:De,delta:Xe,over:bt},Oe===Ie.DragEnd&&typeof pt=="function"&&await Promise.resolve(pt(Ne))&&(Oe=Ie.DragCancel)}J.current=null,bn.unstable_batchedUpdates(()=>{y({type:Oe}),_(Kt.Uninitialized),gt(null),F(null),P(null),St.current=null;const pt=Oe===Ie.DragEnd?"onDragEnd":"onDragCancel";if(Ne){const We=I.current[pt];We==null||We(Ne),v({type:pt,event:Ne})}})}}},[N]),Nt=l.useCallback((ve,Pe)=>(Te,Ce)=>{const Re=Te.nativeEvent,E=N.get(Ce);if(J.current!==null||!E||Re.dndKit||Re.defaultPrevented)return;const Ke={active:E};ve(Te,Pe.options,Ke)===!0&&(Re.dndKit={capturedBy:Pe.sensor},J.current=Ce,qe(Te,Pe))},[N,qe]),Ct=LN(h,Nt);GN(h),Et(()=>{ee&&j===Kt.Initializing&&_(Kt.Initialized)},[ee,j]),l.useEffect(()=>{const{onDragMove:ve}=I.current,{active:Pe,activatorEvent:Te,collisions:Ce,over:Re}=z.current;if(!Pe||!Te)return;const E={active:Pe,activatorEvent:Te,collisions:Ce,delta:{x:Se.x,y:Se.y},over:Re};bn.unstable_batchedUpdates(()=>{ve==null||ve(E),v({type:"onDragMove",event:E})})},[Se.x,Se.y]),l.useEffect(()=>{const{active:ve,activatorEvent:Pe,collisions:Te,droppableContainers:Ce,scrollAdjustedTranslate:Re}=z.current;if(!ve||J.current==null||!Pe||!Re)return;const{onDragOver:E}=I.current,Ke=Ce.get(ft),ht=Ke&&Ke.rect.current?{id:Ke.id,rect:Ke.rect.current,data:Ke.data,disabled:Ke.disabled}:null,Oe={active:ve,activatorEvent:Pe,collisions:Te,delta:{x:Re.x,y:Re.y},over:ht};bn.unstable_batchedUpdates(()=>{gt(ht),E==null||E(Oe),v({type:"onDragOver",event:Oe})})},[ft]),Et(()=>{z.current={activatorEvent:$,active:H,activeNode:L,collisionRect:dt,collisions:Ye,droppableRects:ie,draggableNodes:N,draggingNode:ye,draggingNodeRect:je,droppableContainers:A,over:Ae,scrollableAncestors:he,scrollAdjustedTranslate:Se},C.current={initial:je,translated:dt}},[H,L,Ye,dt,N,ye,je,ie,A,Ae,he,Se]),EN({...le,delta:T,draggingRect:dt,pointerCoordinates:re,scrollableAncestors:he,scrollableAncestorRects:G});const ln=l.useMemo(()=>({active:H,activeNode:L,activeNodeRect:ee,activatorEvent:$,collisions:Ye,containerNodeRect:D,dragOverlay:ue,draggableNodes:N,droppableContainers:A,droppableRects:ie,over:Ae,measureDroppableContainers:Q,scrollableAncestors:he,scrollableAncestorRects:G,measuringConfiguration:W,measuringScheduled:O,windowRect:oe}),[H,L,ee,$,Ye,D,ue,N,A,ie,Ae,Q,he,G,W,O,oe]),it=l.useMemo(()=>({activatorEvent:$,activators:Ct,active:H,activeNodeRect:ee,ariaDescribedById:{draggable:B},dispatch:y,draggableNodes:N,over:Ae,measureDroppableContainers:Q}),[$,Ct,H,ee,y,B,N,Ae,Q]);return st.createElement(fg.Provider,{value:w},st.createElement(Jr.Provider,{value:it},st.createElement(Tg.Provider,{value:ln},st.createElement(Og.Provider,{value:on},u)),st.createElement(nC,{disabled:(c==null?void 0:c.restoreFocus)===!1})),st.createElement(sN,{...c,hiddenTextDescribedById:B}));function cn(){const ve=(Z==null?void 0:Z.autoScrollEnabled)===!1,Pe=typeof d=="object"?d.enabled===!1:d===!1,Te=k&&!ve&&!Pe;return typeof d=="object"?{...d,enabled:Te}:{enabled:Te}}}),iC=l.createContext(null),Nc="button",lC="Draggable";function cC(t){let{id:n,data:s,disabled:r=!1,attributes:a}=t;const o=Ps(lC),{activators:i,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:h,draggableNodes:p,over:f}=l.useContext(Jr),{role:m=Nc,roleDescription:g="draggable",tabIndex:b=0}=a??{},x=(d==null?void 0:d.id)===n,y=l.useContext(x?Og:iC),[v,w]=gr(),[j,_]=gr(),k=UN(i,n),S=gs(s);Et(()=>(p.set(n,{id:n,key:o,node:v,activatorNode:j,data:S}),()=>{const T=p.get(n);T&&T.key===o&&p.delete(n)}),[p,n]);const N=l.useMemo(()=>({role:m,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&m===Nc?!0:void 0,"aria-roledescription":g,"aria-describedby":h.draggable}),[r,m,b,x,g,h.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:N,isDragging:x,listeners:r?void 0:k,node:v,over:f,setNodeRef:w,setActivatorNodeRef:_,transform:y}}function dC(){return l.useContext(Tg)}const uC="Droppable",hC={timeout:25};function pC(t){let{data:n,disabled:s=!1,id:r,resizeObserverConfig:a}=t;const o=Ps(uC),{active:i,dispatch:c,over:d,measureDroppableContainers:u}=l.useContext(Jr),h=l.useRef({disabled:s}),p=l.useRef(!1),f=l.useRef(null),m=l.useRef(null),{disabled:g,updateMeasurementsFor:b,timeout:x}={...hC,...a},y=gs(b??r),v=l.useCallback(()=>{if(!p.current){p.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),m.current=null},x)},[x]),w=Kr({callback:v,disabled:g||!i}),j=l.useCallback((N,T)=>{w&&(T&&(w.unobserve(T),p.current=!1),N&&w.observe(N))},[w]),[_,k]=gr(j),S=gs(n);return l.useEffect(()=>{!w||!_.current||(w.disconnect(),p.current=!1,w.observe(_.current))},[_,w]),l.useEffect(()=>(c({type:Ie.RegisterDroppable,element:{id:r,key:o,disabled:s,node:_,rect:f,data:S}}),()=>c({type:Ie.UnregisterDroppable,key:o,id:r})),[r]),l.useEffect(()=>{s!==h.current.disabled&&(c({type:Ie.SetDroppableDisabled,id:r,key:o,disabled:s}),h.current.disabled=s)},[r,o,s,c]),{active:i,rect:f,isOver:(d==null?void 0:d.id)===r,node:_,over:d,setNodeRef:k}}function vs(t,n,s){const r=t.slice();return r.splice(s<0?r.length+s:s,0,r.splice(n,1)[0]),r}function mC(t,n){return t.reduce((s,r,a)=>{const o=n.get(r);return o&&(s[a]=o),s},Array(t.length))}function Gs(t){return t!==null&&t>=0}function fC(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function gC(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Ag=t=>{let{rects:n,activeIndex:s,overIndex:r,index:a}=t;const o=vs(n,r,s),i=n[a],c=o[a];return!c||!i?null:{x:c.left-i.left,y:c.top-i.top,scaleX:c.width/i.width,scaleY:c.height/i.height}},Us={scaleX:1,scaleY:1},bC=t=>{var n;let{activeIndex:s,activeNodeRect:r,index:a,rects:o,overIndex:i}=t;const c=(n=o[s])!=null?n:r;if(!c)return null;if(a===s){const u=o[i];return u?{x:0,y:s<i?u.top+u.height-(c.top+c.height):u.top-c.top,...Us}:null}const d=xC(o,a,s);return a>s&&a<=i?{x:0,y:-c.height-d,...Us}:a<s&&a>=i?{x:0,y:c.height+d,...Us}:{x:0,y:0,...Us}};function xC(t,n,s){const r=t[n],a=t[n-1],o=t[n+1];return r?s<n?a?r.top-(a.top+a.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const Rg="Sortable",Eg=st.createContext({activeIndex:-1,containerId:Rg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ag,disabled:{draggable:!1,droppable:!1}});function yC(t){let{children:n,id:s,items:r,strategy:a=Ag,disabled:o=!1}=t;const{active:i,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:h}=dC(),p=Ps(Rg,s),f=c.rect!==null,m=l.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),g=i!=null,b=i?m.indexOf(i.id):-1,x=u?m.indexOf(u.id):-1,y=l.useRef(m),v=!fC(m,y.current),w=x!==-1&&b===-1||v,j=gC(o);Et(()=>{v&&g&&h(m)},[v,m,g,h]),l.useEffect(()=>{y.current=m},[m]);const _=l.useMemo(()=>({activeIndex:b,containerId:p,disabled:j,disableTransforms:w,items:m,overIndex:x,useDragOverlay:f,sortedRects:mC(m,d),strategy:a}),[b,p,j.draggable,j.droppable,w,m,x,d,f,a]);return st.createElement(Eg.Provider,{value:_},n)}const vC=t=>{let{id:n,items:s,activeIndex:r,overIndex:a}=t;return vs(s,r,a).indexOf(n)},jC=t=>{let{containerId:n,isSorting:s,wasDragging:r,index:a,items:o,newIndex:i,previousItems:c,previousContainerId:d,transition:u}=t;return!u||!r||c!==o&&a===i?!1:s?!0:i!==a&&n===d},wC={duration:200,easing:"ease"},Mg="transform",_C=xs.Transition.toString({property:Mg,duration:0,easing:"linear"}),kC={roleDescription:"sortable"};function SC(t){let{disabled:n,index:s,node:r,rect:a}=t;const[o,i]=l.useState(null),c=l.useRef(s);return Et(()=>{if(!n&&s!==c.current&&r.current){const d=a.current;if(d){const u=Jn(r.current,{ignoreTransform:!0}),h={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(h.x||h.y)&&i(h)}}s!==c.current&&(c.current=s)},[n,s,r,a]),l.useEffect(()=>{o&&i(null)},[o]),o}function NC(t){let{animateLayoutChanges:n=jC,attributes:s,disabled:r,data:a,getNewIndex:o=vC,id:i,strategy:c,resizeObserverConfig:d,transition:u=wC}=t;const{items:h,containerId:p,activeIndex:f,disabled:m,disableTransforms:g,sortedRects:b,overIndex:x,useDragOverlay:y,strategy:v}=l.useContext(Eg),w=CC(r,m),j=h.indexOf(i),_=l.useMemo(()=>({sortable:{containerId:p,index:j,items:h},...a}),[p,a,j,h]),k=l.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:S,node:N,isOver:T,setNodeRef:A}=pC({id:i,data:_,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...d}}),{active:M,activatorEvent:C,activeNodeRect:H,attributes:J,setNodeRef:Z,listeners:F,isDragging:$,over:P,setActivatorNodeRef:I,transform:B}=cC({id:i,data:_,attributes:{...kC,...s},disabled:w.draggable}),X=W2(A,Z),W=!!M,ie=W&&!g&&Gs(f)&&Gs(x),Q=!y&&$,O=Q&&ie?B:null,q=ie?O??(c??v)({rects:b,activeNodeRect:H,activeIndex:f,overIndex:x,index:j}):null,le=Gs(f)&&Gs(x)?o({id:i,items:h,activeIndex:f,overIndex:x}):j,de=M==null?void 0:M.id,ee=l.useRef({activeId:de,items:h,newIndex:le,containerId:p}),D=h!==ee.current.items,z=n({active:M,containerId:p,isDragging:$,isSorting:W,id:i,index:j,items:h,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:u,wasDragging:ee.current.activeId!=null}),K=SC({disabled:!z,index:j,node:N,rect:S});return l.useEffect(()=>{W&&ee.current.newIndex!==le&&(ee.current.newIndex=le),p!==ee.current.containerId&&(ee.current.containerId=p),h!==ee.current.items&&(ee.current.items=h)},[W,le,p,h]),l.useEffect(()=>{if(de===ee.current.activeId)return;if(de!=null&&ee.current.activeId==null){ee.current.activeId=de;return}const ye=setTimeout(()=>{ee.current.activeId=de},50);return()=>clearTimeout(ye)},[de]),{active:M,activeIndex:f,attributes:J,data:_,rect:S,index:j,newIndex:le,items:h,isOver:T,isSorting:W,isDragging:$,listeners:F,node:N,overIndex:x,over:P,setNodeRef:X,setActivatorNodeRef:I,setDroppableNodeRef:A,setDraggableNodeRef:Z,transform:K??q,transition:ue()};function ue(){if(K||D&&ee.current.newIndex===j)return _C;if(!(Q&&!Ii(C)||!u)&&(W||z))return xs.Transition.toString({...u,property:Mg})}}function CC(t,n){var s,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(s=t==null?void 0:t.draggable)!=null?s:n.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:n.droppable}}function yr(t){if(!t)return!1;const n=t.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const PC=[xe.Down,xe.Right,xe.Up,xe.Left],TC=(t,n)=>{let{context:{active:s,collisionRect:r,droppableRects:a,droppableContainers:o,over:i,scrollableAncestors:c}}=n;if(PC.includes(t.code)){if(t.preventDefault(),!s||!r)return;const d=[];o.getEnabled().forEach(p=>{if(!p||p!=null&&p.disabled)return;const f=a.get(p.id);if(f)switch(t.code){case xe.Down:r.top<f.top&&d.push(p);break;case xe.Up:r.top>f.top&&d.push(p);break;case xe.Left:r.left>f.left&&d.push(p);break;case xe.Right:r.left<f.left&&d.push(p);break}});const u=iN({collisionRect:r,droppableRects:a,droppableContainers:d});let h=xg(u,"id");if(h===(i==null?void 0:i.id)&&u.length>1&&(h=u[1].id),h!=null){const p=o.get(s.id),f=o.get(h),m=f?a.get(f.id):null,g=f==null?void 0:f.node.current;if(g&&m&&p&&f){const x=Vr(g).some((k,S)=>c[S]!==k),y=Ig(p,f),v=OC(p,f),w=x||!y?{x:0,y:0}:{x:v?r.width-m.width:0,y:v?r.height-m.height:0},j={x:m.left,y:m.top};return w.x&&w.y?j:bs(j,w)}}}};function Ig(t,n){return!yr(t)||!yr(n)?!1:t.data.current.sortable.containerId===n.data.current.sortable.containerId}function OC(t,n){return!yr(t)||!yr(n)||!Ig(t,n)?!1:t.data.current.sortable.index<n.data.current.sortable.index}function $i({title:t,filePath:n}){return e.jsxs("div",{className:"px-3 py-2 border-t border-[var(--border-subtle)]",children:[e.jsx("div",{className:"text-xs text-[var(--text-dim)] break-words",children:t}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2",children:[e.jsx("span",{"data-testid":"plan-expanded-header-file-path",className:"text-xs font-mono text-[var(--text-dim)] break-all",children:n}),e.jsx(Nd,{value:n})]})]})}const j8=Object.freeze(Object.defineProperty({__proto__:null,PlanExpandedHeader:$i},Symbol.toStringTag,{value:"Module"}));function AC(){const[t,n]=l.useState(!1),[s,r]=l.useState(null);return{updatePlan:l.useCallback(async(o,i)=>{n(!0),r(null);try{const c=await fetch(`/api/plans/${o}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(i)});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.error??`HTTP ${c.status}`)}}catch(c){const d=c instanceof Error?c.message:"Failed to save plan";throw r(d),c instanceof Error?c:new Error(d)}finally{n(!1)}},[]),saving:t,error:s}}function Dg({slug:t,onClose:n}){return e.jsx("div",{className:"px-3 py-2 border-t border-[var(--border-subtle)]",children:e.jsx(wn,{chatName:`edit-plan-${t}`,slashCommand:`/codeyam-edit-plan ${t}`,height:360,onClose:n})})}const w8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowExpandedChat:Dg},Symbol.toStringTag,{value:"Module"}));function Lg({titleDraft:t,bodyDraft:n,saving:s,error:r,onTitleChange:a,onBodyChange:o,onSave:i,onCancel:c}){const d=Math.min(20,Math.max(8,n.split(`
|
|
43
|
+
`).length));return e.jsxs("div",{className:"border-t border-[var(--border-subtle)] px-3 py-2 flex flex-col gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:u=>a(u.target.value),"aria-label":"Plan title",className:"w-full px-2 py-1 text-sm rounded border border-[var(--border-subtle)] bg-[var(--bg-input,transparent)] text-[var(--text-primary)]"}),e.jsx("textarea",{value:n,onChange:u=>o(u.target.value),"aria-label":"Plan body",rows:d,className:"w-full px-2 py-1 text-xs rounded border border-[var(--border-subtle)] bg-[var(--bg-input,transparent)] text-[var(--text-primary)] font-mono resize-y"}),r&&e.jsx(Qe,{text:r,className:"text-xs text-[var(--accent-red)]"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:c,disabled:s,className:"px-2.5 py-1 text-xs rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer disabled:opacity-60",children:"Cancel"}),e.jsx("button",{type:"button",onClick:i,disabled:s,className:"px-2.5 py-1 text-xs rounded border border-[var(--accent-active)] bg-[var(--accent-active)] text-black hover:bg-[var(--accent-active)]/90 cursor-pointer disabled:opacity-60",children:s?"Saving…":"Save"})]})]})}const _8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowExpandedEdit:Lg},Symbol.toStringTag,{value:"Module"}));function Fg({onClick:t}){return e.jsx("button",{type:"button",onClick:t,className:"px-2.5 py-1 text-xs rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"Edit"})}const k8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowEditButton:Fg},Symbol.toStringTag,{value:"Module"}));function zg({providerLabel:t,onClick:n}){return e.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40",title:`Open a chat with ${t} seeded with this plan's contents`,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),"Edit with ",t]})}const S8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowEditChatButton:zg},Symbol.toStringTag,{value:"Module"}));function $g({dep:t}){const n=!t.satisfied&&t.title===null,s=t.satisfied?"completed":n?"missing":"blocked",r=t.satisfied?{borderColor:"var(--border-subtle)",color:"var(--text-dim)"}:{borderColor:"var(--accent-warn, #c08a2c)",color:"var(--accent-warn, #c08a2c)"};return e.jsxs("li",{"data-testid":`plan-row-dep-${t.slug}`,className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded border whitespace-nowrap",style:r,children:s}),e.jsx("span",{className:t.satisfied?"text-[var(--text-dim)] truncate":"text-[var(--text-primary)] truncate",children:n?`missing: ${t.slug}`:t.title??t.slug})]})}const N8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowDependencyEntry:$g},Symbol.toStringTag,{value:"Module"}));function Bi({dependencies:t}){return e.jsxs("div",{"data-testid":"plan-row-deps",className:"px-3 py-2 border-b border-[var(--border-subtle)]",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-[var(--text-dim)] mb-1.5",children:"Depends on"}),e.jsx("ul",{className:"flex flex-col gap-1",children:t.map(n=>e.jsx($g,{dep:n},n.slug))})]})}const C8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowExpandedDependencies:Bi},Symbol.toStringTag,{value:"Module"}));function Bg({title:t,filePath:n,body:s,providerLabel:r,onEdit:a,onChat:o,dependencies:i}){return e.jsxs("div",{className:"border-t border-[var(--border-subtle)]",children:[e.jsx("div",{className:"px-3 py-2 max-h-[40vh] overflow-y-auto",children:e.jsx(Ht,{variant:"compact",children:s})}),i&&i.length>0&&e.jsx(Bi,{dependencies:i}),e.jsx($i,{title:t,filePath:n}),e.jsxs("div",{className:"flex gap-2 justify-end px-3 py-2 border-t border-[var(--border-subtle)]",children:[e.jsx(Fg,{onClick:a}),e.jsx(zg,{providerLabel:r,onClick:o})]})]})}const P8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowExpandedView:Bg},Symbol.toStringTag,{value:"Module"}));function qg({plan:t,dependencies:n}){const[s,r]=l.useState("view"),[a,o]=l.useState(t.title),[i,c]=l.useState(t.body),{updatePlan:d,saving:u,error:h}=AC(),{config:p}=_t(),f=at(p==null?void 0:p.provider);return l.useEffect(()=>{o(t.title),c(t.body),r("view")},[t.slug]),s==="chat"?e.jsx(Dg,{slug:t.slug,onClose:()=>r("view")}):s==="edit"?e.jsx(Lg,{titleDraft:a,bodyDraft:i,saving:u,error:h,onTitleChange:o,onBodyChange:c,onSave:async()=>{try{await d(t.slug,{title:a,body:i}),r("view")}catch{}},onCancel:()=>{o(t.title),c(t.body),r("view")}}):e.jsx(Bg,{title:t.title,filePath:t.filePath,body:t.body,providerLabel:f,onEdit:()=>r("edit"),onChat:()=>r("chat"),dependencies:n})}const T8=Object.freeze(Object.defineProperty({__proto__:null,PlanRowExpandedBody:qg},Symbol.toStringTag,{value:"Module"}));function qi({plan:t,expanded:n,onToggle:s,onRun:r,launching:a=!1,blocked:o=!1,position:i,dragHandleRef:c,dragHandleAttributes:d,dragHandleListeners:u,sortableRef:h,sortableStyle:p,isDragging:f=!1,unsatisfiedDepCount:m=0,unsatisfiedDepTooltip:g,dependencies:b,claim:x,staleFetch:y=!1,expandedBodyVariant:v="full",author:w}){const j=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),s())};return e.jsxs("li",{ref:h,style:p,className:`border border-[var(--border-subtle)] rounded-lg bg-[var(--bg-surface,transparent)] transition-colors hover:border-[var(--text-dim)] hover:bg-[var(--bg-card)] ${f?"opacity-60 shadow-lg":""}`,children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:j,className:"w-full text-left px-3 py-2 flex items-center justify-between gap-3 bg-transparent cursor-pointer",children:[e.jsx(Ad,{slug:t.slug,title:t.title,timestamp:t.createdAt,position:i,author:w,dragHandleRef:c,dragHandleAttributes:d,dragHandleListeners:u}),e.jsx(Ld,{slug:t.slug,mode:t.mode,expanded:n,onRun:r,launching:a,blocked:o,unsatisfiedDepCount:m,unsatisfiedDepTooltip:g,claim:x,staleFetch:y})]}),n&&(v==="view"?e.jsxs("div",{className:"border-t border-[var(--border-subtle)]",children:[e.jsx("div",{className:"px-3 py-2 max-h-[40vh] overflow-y-auto",children:e.jsx(Ht,{variant:"compact",children:t.body})}),b&&b.length>0&&e.jsx(Bi,{dependencies:b}),e.jsx($i,{title:t.title,filePath:t.filePath})]}):e.jsx(qg,{plan:t,dependencies:b}))]})}const O8=Object.freeze(Object.defineProperty({__proto__:null,PlanRow:qi},Symbol.toStringTag,{value:"Module"}));function Hg({plan:t,position:n,expanded:s,onToggle:r,onRun:a,launching:o,blocked:i,draggable:c,unsatisfiedDepCount:d,unsatisfiedDepTooltip:u,dependencies:h,claim:p,staleFetch:f,author:m}){const{attributes:g,listeners:b,setNodeRef:x,setActivatorNodeRef:y,transform:v,transition:w,isDragging:j}=NC({id:t.slug,disabled:!c}),_={transform:xs.Transform.toString(v),transition:w};return e.jsx(qi,{plan:t,expanded:s,onToggle:r,onRun:a,launching:o,blocked:i,position:n,sortableRef:x,sortableStyle:_,isDragging:j,dragHandleRef:c?y:void 0,dragHandleAttributes:c?g:void 0,dragHandleListeners:c?b:void 0,unsatisfiedDepCount:d,unsatisfiedDepTooltip:u,dependencies:h,claim:p,staleFetch:f,author:m})}const A8=Object.freeze(Object.defineProperty({__proto__:null,SortablePlanRow:Hg},Symbol.toStringTag,{value:"Module"}));function RC(t,n){const[s,r]=l.useState(null),[a,o]=l.useState(null);return l.useEffect(()=>{r(null)},[t]),{items:s??t,error:a,reorder:n?i=>{r(i),o(null),n(i).catch(c=>{r(null),o(c instanceof Error?c.message:"Unknown error")})}:null}}function Xr({plans:t,loading:n,error:s,onRun:r,launchingSlug:a,launchError:o,blocked:i=!1,onReorder:c,depAnnotationsBySlug:d,dependenciesBySlug:u,claimsBySlug:h,staleFetch:p,showAuthors:f=!1,skeletonCount:m=3}){const[g,b]=l.useState(null),{items:x,error:y,reorder:v}=RC(t,c?S=>c(S.map(N=>N.slug)):void 0),j=n&&x.length===0?m:x.length,[_,k]=l.useState(!0);return e.jsxs("div",{className:"mt-5 border-t border-[var(--border-subtle)] pt-5",children:[e.jsx(ws,{title:"Queued Plans",count:j,expanded:_,onToggle:()=>k(S=>!S),testId:"queued-plans-header"}),o&&e.jsxs(Fa,{tone:"error",spacing:"tight",children:["Failed to launch plan: ",o]}),y&&e.jsxs(Fa,{tone:"error",spacing:"tight",children:["Failed to reorder plans: ",y]}),_&&e.jsx(Hi,{plans:x,loading:n,error:s,expandedSlug:g,onToggle:S=>b(N=>N===S?null:S),onRun:r,launchingSlug:a??null,blocked:i,depAnnotationsBySlug:d,dependenciesBySlug:u,claimsBySlug:h,staleFetch:p,onReorder:v??void 0,showAuthors:f,skeletonCount:m})]})}function Hi({plans:t,loading:n,error:s,expandedSlug:r,onToggle:a,onRun:o,launchingSlug:i,blocked:c,onReorder:d,depAnnotationsBySlug:u,dependenciesBySlug:h,claimsBySlug:p,staleFetch:f,showAuthors:m=!1,skeletonCount:g=3}){const b=rN(mc(zi,{activationConstraint:{distance:4}}),mc(Li,{coordinateGetter:TC})),x=l.useMemo(()=>t.map(j=>j.slug),[t]),y=s?e.jsx(Qe,{text:`Failed to load plans: ${s}`,className:"text-sm text-[var(--accent-red)]",rowClassName:"mt-3"}):null;if(n&&t.length===0)return e.jsx($o,{count:g});if(t.length===0)return y;const v=j=>{const{active:_,over:k}=j;if(!k||_.id===k.id||!d)return;const S=t.findIndex(T=>T.slug===_.id),N=t.findIndex(T=>T.slug===k.id);S===-1||N===-1||d(vs(t,S,N))},w=e.jsx("ul",{className:"mt-3 flex flex-col gap-2","data-testid":"plan-list",children:t.map((j,_)=>{const k=u==null?void 0:u[j.slug],S=p==null?void 0:p.get(j.slug);return e.jsx(Hg,{plan:j,position:_+1,expanded:r===j.slug,onToggle:()=>a(j.slug),onRun:o,launching:i===j.slug,blocked:c,draggable:!!d,unsatisfiedDepCount:k==null?void 0:k.count,unsatisfiedDepTooltip:k==null?void 0:k.tooltip,dependencies:h==null?void 0:h[j.slug],claim:S,staleFetch:f,author:m?j.author:void 0},j.slug)})});return d?e.jsxs(e.Fragment,{children:[y,e.jsx(oC,{sensors:b,collisionDetection:oN,onDragEnd:v,children:e.jsx(yC,{items:x,strategy:bC,children:w})})]}):e.jsxs(e.Fragment,{children:[y,w]})}const R8=Object.freeze(Object.defineProperty({__proto__:null,QueuedChangesBody:Hi,QueuedChangesSection:Xr},Symbol.toStringTag,{value:"Module"}));function Wg({awaitingPlanLaunchChoice:t,configLoading:n,sessionLoading:s,sessionDecision:r,sessionInfo:a,buildLaunchGateArmed:o,stepState:i,provider:c,onContinueSession:d,onAgentIdle:u,onAgentActive:h,onUserInput:p,pendingPlans:f,pendingPlansLoading:m,pendingPlansError:g,onLaunchPlan:b,launchingSlug:x,launchError:y,onReorderPlans:v,isAgentBuilding:w}){const{recoveryFeatureName:j,recoveryStep:_,recoveryMode:k,showTerminal:S,shouldResumeSameProvider:N}=w2({sessionDecision:r,sessionInfo:a,buildLaunchGateArmed:o,stepState:i});return r==="pending"?e.jsx(Jf,{featureName:j,editorStep:_,workflowMode:k,currentProvider:c,previousProvider:(a==null?void 0:a.provider)??null,resumeMode:(a==null?void 0:a.resumeMode)??"fresh",awaitingUserInput:(a==null?void 0:a.awaitingUserInput)??!1,onContinue:d}):t&&f.length>0&&a===null&&i===null?e.jsx(en,{children:e.jsx(Xr,{plans:f,loading:m,error:g,onRun:T=>{var M;const A=((M=f.find(C=>C.slug===T))==null?void 0:M.title)??T;b(T,A)},launchingSlug:x,launchError:y,blocked:w,onReorder:v})}):S?e.jsx(hg,{provider:c,shouldResumeSameProvider:N,sessionId:(a==null?void 0:a.sessionId)??null,onAgentIdle:u,onAgentActive:h,onUserInput:p,currentFeature:(i==null?void 0:i.feature)??null}):r==="no-session"&&i===null?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-slate-500 space-y-4 px-10 text-center",children:[e.jsx("div",{className:"text-lg font-medium text-slate-400",children:"Ready to build"}),e.jsx("p",{className:"max-w-md",children:"Your first session will start automatically. You can queue changes or wait for the project to initialize."})]}):null}const E8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabSessionContent:Wg},Symbol.toStringTag,{value:"Module"}));function EC(t){return t?{step:t.step??0,feature:t.feature??null,startedAt:t.startedAt??"",mode:It(t.mode),slug:t.slug??null}:null}const MC=3e3;function Ts(){const[t,n]=l.useState(null),[s,r]=l.useState(!0),a=l.useRef(null),o=l.useRef(null),i=l.useCallback(()=>{fetch("/api/step").then(c=>c.json()).then(c=>{const d=EC(c),u=JSON.stringify(d);u!==o.current&&(o.current=u,n(d)),r(!1)}).catch(()=>{r(!1)})},[]);return l.useEffect(()=>(i(),a.current=setInterval(i,MC),()=>{a.current&&clearInterval(a.current)}),[i]),{stepState:t,loading:s,refetch:i}}const nt={hasSession:!1,resumeMode:"fresh",provider:null,feature:null,step:null,mode:null,label:null,sessionId:null,awaitingUserInput:!1,reopenResults:!1,preview:null,agentBrokerLive:!1,resultsShown:!1};function IC(t){return{hasSession:(t==null?void 0:t.hasSession)??nt.hasSession,resumeMode:(t==null?void 0:t.resumeMode)??nt.resumeMode,provider:(t==null?void 0:t.provider)??nt.provider,feature:(t==null?void 0:t.feature)??nt.feature,step:(t==null?void 0:t.step)??nt.step,mode:(t==null?void 0:t.mode)==null?nt.mode:It(t.mode),label:(t==null?void 0:t.label)??nt.label,sessionId:(t==null?void 0:t.sessionId)??nt.sessionId,awaitingUserInput:(t==null?void 0:t.awaitingUserInput)??nt.awaitingUserInput,reopenResults:(t==null?void 0:t.reopenResults)??nt.reopenResults,preview:(t==null?void 0:t.preview)??nt.preview,agentBrokerLive:(t==null?void 0:t.agentBrokerLive)??nt.agentBrokerLive,resultsShown:(t==null?void 0:t.resultsShown)??nt.resultsShown}}function Wi(t){const n=t==null?void 0:t.pollIntervalMs,[s,r]=l.useState(null),[a,o]=l.useState(!0),i=l.useCallback(async()=>{o(!0);try{const d=await(await fetch("/api/session-info")).json();r(IC(d))}catch{r(c=>c??nt)}finally{o(!1)}},[]);return l.useEffect(()=>{i()},[i]),l.useEffect(()=>{if(n==null||n<=0)return;const c=setInterval(()=>{i()},n);return()=>clearInterval(c)},[n,i]),{sessionInfo:s,loading:a,refetch:i}}const DC=5e3;function LC(){const[t,n]=l.useState(null),[s,r]=l.useState(!0),a=l.useRef(null);return l.useEffect(()=>{const o=()=>{fetch("/api/prompt").then(i=>i.json()).then(i=>{n(i.prompt??null),r(!1)}).catch(()=>r(!1))};return o(),a.current=setInterval(o,DC),()=>{a.current&&clearInterval(a.current)}},[]),{prompt:t,loading:s}}function FC({currentDecision:t,sessionInfo:n,sessionLoading:s,attachedSessionId:r=null}){return s||!n?t:t==="continue"&&n.hasSession?"continue":t==="fresh"&&n.hasSession&&n.resumeMode==="resume"?"fresh":n.resumeMode==="resume"&&n.hasSession&&r!=null&&n.sessionId===r?"continue":n.resumeMode==="resume"||n.resumeMode==="handoff"?"pending":"fresh"}let lr=null;const zC=1e4;function $C(){lr=Date.now()}function BC(){if(lr==null)return!1;const t=Date.now()-lr;return lr=null,t<=zC}const Gi="codeyam.buildTab.attachedSessionId";function qC(t){try{window.sessionStorage.setItem(Gi,t)}catch{}}function HC(){try{return window.sessionStorage.getItem(Gi)}catch{return null}}function WC(){try{window.sessionStorage.removeItem(Gi)}catch{}}function GC({sessionLoading:t,sessionInfo:n}){const s=l.useRef(void 0);s.current===void 0&&(s.current=HC());const[r,a]=l.useState(()=>BC()?"fresh":"no-session");l.useEffect(()=>{a(i=>FC({currentDecision:i,sessionInfo:n,sessionLoading:t,attachedSessionId:s.current??null}))},[t,n]),l.useEffect(()=>{if(n){if(!n.hasSession){WC(),s.current=null;return}n.sessionId&&(r==="continue"||r==="fresh")&&(qC(n.sessionId),s.current=n.sessionId)}},[r,n]);const o=l.useCallback(()=>{a("continue")},[]);return{sessionDecision:r,handleContinueSession:o}}function Cc(){const t=document.activeElement;return t===null||t===document.body||t===document.documentElement||t instanceof HTMLElement&&t.dataset.navTab==="true"}function Pc(t,n,s,r=0){return t>=s.left-r&&t<=s.right+r&&n>=s.top-r&&n<=s.bottom+r}function lt(){const t=()=>{typeof window<"u"&&window.dispatchEvent(new Event("terminal-focus"))};t();const n=requestAnimationFrame(t),s=setTimeout(t,50);return()=>{cancelAnimationFrame(n),clearTimeout(s)}}function Tc(t){Oc(t,!0);let n=!1;const s=()=>{n||(n=!0,Oc(t,!1))};typeof requestAnimationFrame=="function"?(requestAnimationFrame(s),setTimeout(s,100)):queueMicrotask(s)}function Oc(t,n){const s=t;if(typeof s.inert=="boolean"){s.inert=n;return}n?t.setAttribute("inert",""):t.removeAttribute("inert")}function Ca(t){Io(),Tc(t),t.blur(),lt(),queueMicrotask(()=>{document.activeElement===t&&(Tc(t),t.blur(),lt())})}function UC(t){const n=l.useRef(!1),s=l.useRef(null);l.useEffect(()=>{if(!t)return;function r(){if(!n.current&&Cc()){n.current=!0;try{Io(),window.dispatchEvent(new Event("terminal-focus"))}finally{n.current=!1}}}function a(){queueMicrotask(r)}function o(){const u=document.activeElement;u instanceof HTMLIFrameElement&&(s.current=u)}function i(u){const h=document.activeElement;if(h instanceof HTMLIFrameElement){if(u.target===h)return;Ca(h),d(h);return}const p=s.current;if(!p||u.target===p)return;const f=u;if(typeof f.clientX=="number"&&typeof f.clientY=="number"){const m=p.getBoundingClientRect();if(Pc(f.clientX,f.clientY,m,1))return}Ca(p),d(p)}function c(u){const h=document.activeElement;if(!(h instanceof HTMLIFrameElement))return;s.current=h;const p=h.getBoundingClientRect();Pc(u.clientX,u.clientY,p,1)||(Ca(h),d(h))}function d(u){requestAnimationFrame(()=>{document.activeElement!==u&&(Cc()||(s.current=null))})}return document.addEventListener("focusin",o),document.addEventListener("focusout",a),window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),document.addEventListener("mouseup",a),document.addEventListener("pointerdown",i,!0),document.addEventListener("mousedown",i,!0),document.addEventListener("click",i,!0),document.addEventListener("pointermove",c,{capture:!0,passive:!0}),()=>{document.removeEventListener("focusin",o),document.removeEventListener("focusout",a),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a),document.removeEventListener("mouseup",a),document.removeEventListener("pointerdown",i,!0),document.removeEventListener("mousedown",i,!0),document.removeEventListener("click",i,!0),document.removeEventListener("pointermove",c,{capture:!0})}},[t])}function YC({sessionLoading:t,sessionInfo:n,onRestorePreview:s}){const r=l.useRef(!1);l.useEffect(()=>{t||!(n!=null&&n.preview)||n.resumeMode!=="resume"&&n.resumeMode!=="handoff"||r.current||(r.current=!0,s==null||s(n.preview))},[s,n,t])}function VC(t){const n=l.useRef(t);l.useEffect(()=>{t&&t!==n.current&&(dr(t),n.current=t)},[t])}function KC(t,n,s){l.useEffect(()=>{if(!n)return;const r=a=>{t.current&&!t.current.contains(a.target)&&s()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t,n,s])}function Gg({displayName:t,hasPrompt:n,expanded:s,onToggle:r}){return n?e.jsxs("button",{onClick:r,className:"flex items-center gap-1 cursor-pointer transition-colors min-w-0",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{className:"font-medium truncate",children:t}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:`shrink-0 transition-transform ${s?"rotate-180":""}`,children:e.jsx("path",{d:"M2 4l3 3 3-3"})})]}):e.jsx("span",{className:"font-medium truncate",style:{color:"var(--text-secondary)"},children:t})}const M8=Object.freeze(Object.defineProperty({__proto__:null,FeatureNameButton:Gg},Symbol.toStringTag,{value:"Module"}));function Ug({prompt:t}){return e.jsx("div",{style:{background:"var(--bg-input)",borderBottom:"1px solid var(--border-default)",maxHeight:"16rem",overflowY:"auto",padding:"0 0.75rem 0.75rem"},children:e.jsx(Ht,{variant:"compact",children:t})})}const I8=Object.freeze(Object.defineProperty({__proto__:null,PromptDropdownPanel:Ug},Symbol.toStringTag,{value:"Module"}));function Yg({currentStep:t,isExpanded:n,mode:s,onToggle:r=()=>{},stepNum:a}){const o=a===t,i=a<t,{description:c,label:d}=ff(a,s);return e.jsxs("div",{onClick:r,className:"cursor-pointer",children:[e.jsxs("div",{className:"w-full px-3 py-0.5 flex items-center gap-2 text-left transition-colors",style:{color:o?"var(--accent-active)":i?"var(--text-secondary)":"var(--text-muted)",fontWeight:o?500:void 0},onMouseEnter:u=>u.currentTarget.style.background="var(--bg-input)",onMouseLeave:u=>u.currentTarget.style.background="transparent",children:[e.jsxs("span",{className:"w-5 text-right tabular-nums shrink-0",children:[a,"."]}),e.jsx("span",{className:"flex-1",children:d}),c&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:`shrink-0 opacity-40 transition-transform ${n?"rotate-180":""}`,children:e.jsx("path",{d:"M2 4l3 3 3-3"})})]}),n&&c&&e.jsx("div",{className:"px-3 pb-1.5 pl-10",children:e.jsx("p",{className:"text-[10px] m-0 leading-relaxed",style:{color:"var(--text-dim)"},children:c})})]},a)}const D8=Object.freeze(Object.defineProperty({__proto__:null,StepIndicatorDropdownItem:Yg},Symbol.toStringTag,{value:"Module"}));function Vg({step:t,feature:n,mode:s,projectTitle:r,userPrompt:a}){const[o,i]=l.useState(!1),[c,d]=l.useState(null),[u,h]=l.useState(!1),[p,f]=l.useState(null),m=l.useRef(null),g=l.useRef(null),b=l.useRef(null),x=l.useRef(null);l.useLayoutEffect(()=>{if(!o)return;const N=()=>{var A;const T=(A=g.current)==null?void 0:A.getBoundingClientRect();T&&f({top:T.bottom+4,right:window.innerWidth-T.right})};return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[o]),l.useEffect(()=>{if(!o)return;const N=T=>{var M,C;const A=T.target;(M=m.current)!=null&&M.contains(A)||(C=b.current)!=null&&C.contains(A)||i(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[o]),KC(x,u,l.useCallback(()=>h(!1),[]));const y=n&&t>0,v=n||"New Working Session",w=It(s),j=ff(t,w),_=y?j.label:null,k=j.totalSteps,S=j.prefix;return t===0?e.jsxs("div",{className:"h-8 flex items-center justify-between px-3 text-xs shrink-0 select-none",style:{background:"var(--bg-input)",borderBottom:"1px solid var(--border-default)"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"truncate",style:{color:"var(--text-dim)"},children:r||"New Project"}),e.jsx("span",{style:{color:"var(--text-dim)",opacity:.5},children:">"}),e.jsx("span",{className:"font-medium truncate",style:{color:"var(--text-muted)"},children:v})]}),e.jsx("span",{style:{color:"var(--text-dim)"},children:n?"Starting…":"Waiting for session"})]}):e.jsxs("div",{className:"shrink-0",ref:x,children:[e.jsxs("div",{className:"h-8 flex items-center justify-between px-3 text-xs select-none",style:{background:"var(--bg-input)",borderBottom:u?"none":"1px solid var(--border-default)"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"truncate",style:{color:"var(--text-dim)"},children:r||"New Project"}),e.jsx("span",{style:{color:"var(--text-dim)",opacity:.5},children:">"}),e.jsx(Gg,{displayName:v,hasPrompt:!!a,expanded:u,onToggle:()=>h(N=>!N)})]}),y&&e.jsxs("div",{className:"relative",ref:m,children:[e.jsxs("button",{ref:g,onClick:()=>i(N=>!N),className:"flex items-center gap-1.5 cursor-pointer transition-colors",style:{color:"var(--text-secondary)"},children:[e.jsx("span",{style:{color:"var(--text-dim)"},children:"::"}),e.jsxs("span",{children:[S," ",t,e.jsxs("span",{style:{color:"var(--text-dim)"},children:[" / ",k]}),": ",_]}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:`transition-transform ${o?"rotate-180":""}`,children:e.jsx("path",{d:"M2 4l3 3 3-3"})})]}),o&&p&&bn.createPortal(e.jsx("div",{ref:b,className:"w-52 rounded-lg shadow-lg py-1 text-xs max-h-[70vh] overflow-y-auto",style:{position:"fixed",top:p.top,right:p.right,zIndex:60,background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:Array.from({length:k},(N,T)=>T+1).map(N=>{const T=c===N;return e.jsx(Yg,{currentStep:t,isExpanded:T,mode:w,onToggle:()=>d(T?null:N),stepNum:N},N)})}),document.body)]})]}),u&&a&&e.jsx(Ug,{prompt:a})]})}const L8=Object.freeze(Object.defineProperty({__proto__:null,StepIndicatorBar:Vg},Symbol.toStringTag,{value:"Module"}));function Kg({awaitingPlanLaunchChoice:t,buildLaunchGateArmed:n,isActive:s,onAgentIdle:r,onAgentActive:a,onUserInput:o,provider:i,onRestorePreview:c,pendingPlans:d,pendingPlansLoading:u,pendingPlansError:h,onLaunchPlan:p,launchingSlug:f,launchError:m,onReorderPlans:g,isAgentBuilding:b}){const{stepState:x}=Ts(),{config:y,loading:v}=_t(),{prompt:w}=LC(),{sessionInfo:j,loading:_}=Wi(),{sessionDecision:k,handleContinueSession:S}=GC({sessionLoading:_,sessionInfo:j});return UC(s),YC({sessionLoading:_,sessionInfo:j,onRestorePreview:c}),VC((x==null?void 0:x.feature)??null),e.jsx(Hf,{stepIndicator:e.jsx(Vg,{step:(x==null?void 0:x.step)??0,feature:(x==null?void 0:x.feature)??null,mode:(x==null?void 0:x.mode)??"ui",projectTitle:(y==null?void 0:y.projectTitle)??null,userPrompt:w}),sessionContent:e.jsx(Wg,{awaitingPlanLaunchChoice:t,buildLaunchGateArmed:n,configLoading:v,sessionLoading:_,sessionDecision:k,sessionInfo:j,stepState:x,provider:i,onContinueSession:S,onAgentIdle:r,onAgentActive:a,onUserInput:o,pendingPlans:d,pendingPlansLoading:u,pendingPlansError:h,onLaunchPlan:p,launchingSlug:f,launchError:m,onReorderPlans:g,isAgentBuilding:b})})}const F8=Object.freeze(Object.defineProperty({__proto__:null,BuildTab:Kg},Symbol.toStringTag,{value:"Module"}));function Jg({refreshing:t,onRefresh:n,onClose:s,minimizeMode:r=!1}){return e.jsxs("div",{className:"shrink-0 px-4 py-2 bg-[var(--bg-card)] border-b border-[var(--border-default)] flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)] m-0",children:"Working Session Results"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:n,disabled:t,className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] text-xs leading-none px-2 py-1 border border-[var(--border-default)] rounded disabled:opacity-50",title:"Refresh session data",children:t?"…":"↻"}),e.jsx("button",{onClick:s,className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] text-lg leading-none px-1",title:r?"Minimize results panel":"Close results panel",children:r?"▾":"✕"})]})]})}const z8=Object.freeze(Object.defineProperty({__proto__:null,SessionResultsPanelHeader:Jg},Symbol.toStringTag,{value:"Module"}));function os(t,n){if(t.length===0)return{selectedIndex:-1,scenario:null};if("direction"in n){const r=n.direction==="next"?1:-1,a=(n.selectedIndex+r+t.length)%t.length;return{selectedIndex:a,scenario:t[a]}}if("slug"in n){const r=t.findIndex(a=>a.slug===n.slug);return r>=0?{selectedIndex:r,scenario:t[r]}:os(t,{defaultSelection:!0,selectedIndex:n.selectedIndex})}const s=Math.min(n.selectedIndex??0,t.length-1);return{selectedIndex:s,scenario:t[s]}}function vr(t,n){if(!n)return{headline:t,collapsed:[]};const s=[],r=[];for(const a of t)a.demonstratesNew?s.push(a):r.push(a);return{headline:s,collapsed:r}}function Ui(t){return t==null?"":typeof t=="string"?t:typeof t=="object"&&typeof t.name=="string"?t.name:String(t)}function JC(t){if(t!=null&&typeof t=="object"){const{description:n}=t;if(typeof n=="string"&&n.trim()!=="")return n}}function Yi({fn:t,testid:n}){return e.jsxs("div",{className:"flex items-start gap-2","data-testid":n,children:[e.jsx("span",{className:"text-[10px] text-[var(--text-muted)] mt-0.5 shrink-0",children:"fn"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium text-[var(--text-primary)]",children:t.name}),t.description&&e.jsx("div",{className:"text-[10px] text-[var(--text-muted)] mt-0.5",children:t.description}),e.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono mt-0.5",children:t.filePath})]})]})}const $8=Object.freeze(Object.defineProperty({__proto__:null,FunctionChangeRow:Yi},Symbol.toStringTag,{value:"Module"})),XC="no-isolation-harness";function Xg(t){var n;return t.coverageStatus==="reason"&&((n=t.untestabilityReason)==null?void 0:n.kind)===XC}const QC="/api/editor-session-summary",ZC=3e3;function Qg(t=ZC){const[n,s]=l.useState(null),[r,a]=l.useState(!0),[o,i]=l.useState(!1),c=l.useCallback(async()=>{i(!0);try{const d=await fetch(QC);d.ok&&s(await d.json())}catch{}i(!1),a(!1)},[]);return l.useEffect(()=>{c()},[c]),l.useEffect(()=>{if(t<=0)return;const d=window.setInterval(c,t);return()=>window.clearInterval(d)},[c,t]),{summary:n,loading:r,refreshing:o,refresh:c}}function Zg({onClose:t,onSelectScenario:n,previewSlug:s=null,minimizeMode:r=!1}){var j;const{summary:a,loading:o,refreshing:i,refresh:c}=Qg(),[d,u]=l.useState(0),h=l.useMemo(()=>a?[...a.application,...a.components]:[],[a]),p=l.useMemo(()=>s&&h.some(_=>_.slug===s)?s:null,[h,s]),f=p??((j=h[d])==null?void 0:j.slug);l.useEffect(()=>{if(!p)return;const _=h.findIndex(k=>k.slug===p);_>=0&&_!==d&&u(_)},[h,p,d]);const m=l.useCallback(_=>{h.length!==0&&(document.activeElement instanceof HTMLIFrameElement||M2()||(_.key==="ArrowRight"?(_.preventDefault(),u(k=>{const S=os(h,{direction:"next",selectedIndex:k});return S.scenario&&(n==null||n(S.scenario.slug,S.scenario.url)),S.selectedIndex})):_.key==="ArrowLeft"&&(_.preventDefault(),u(k=>{const S=os(h,{direction:"previous",selectedIndex:k});return S.scenario&&(n==null||n(S.scenario.slug,S.scenario.url)),S.selectedIndex}))))},[h,n]);l.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]);const g=l.useRef(!1);if(l.useEffect(()=>{if(g.current||h.length===0)return;g.current=!0;const _=os(h,{defaultSelection:!0,selectedIndex:d});_.scenario&&(n==null||n(_.scenario.slug,_.scenario.url))},[h,n,d]),o)return e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 bg-[var(--bg-deep)]",children:e.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-[var(--border-default)] border-t-[#005c75] rounded-full"})});if(!a)return e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 bg-[var(--bg-deep)]",children:e.jsx("div",{className:"text-sm text-[var(--text-muted)]",children:"No session data available."})});const b=a.application.length+a.components.length,x=a.hubDominated??!1,y=vr(a.application,x),v=vr(a.components,x),w=(_,k)=>{var N,T;const S=os(h,{slug:_,selectedIndex:d});S.selectedIndex>=0&&u(S.selectedIndex),n==null||n(((N=S.scenario)==null?void 0:N.slug)??_,((T=S.scenario)==null?void 0:T.url)??k)};return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col bg-[var(--bg-deep)]",style:{borderTop:"2px solid #005c75"},children:[e.jsx(Jg,{refreshing:i,onRefresh:c,onClose:t,minimizeMode:r}),e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[a.userPrompt&&e.jsx(eb,{text:a.userPrompt}),e.jsxs(is,{title:"Application",icon:"🌐",count:y.headline.length,impactedCount:y.collapsed.length,empty:b===0?"No scenarios in this session":void 0,children:[y.headline.length>0&&e.jsx(nb,{scenarios:y.headline,selectedSlug:f,onSelect:w}),e.jsx(lo,{scenarios:y.collapsed,selectedSlug:f,onSelect:w})]}),e.jsxs(is,{title:"Components",icon:"🧩",count:v.headline.length,impactedCount:v.collapsed.length,children:[v.headline.length>0&&e.jsx(tb,{scenarios:v.headline,selectedSlug:f,onSelect:w}),e.jsx(lo,{scenarios:v.collapsed,selectedSlug:f,onSelect:w})]}),e.jsx(is,{title:"Functions",icon:"⚙️",count:a.functions.length,children:a.functions.length>0&&e.jsx(rb,{functions:a.functions})}),e.jsx(is,{title:"Modified Files",icon:"📄",count:a.modifiedFiles.length,children:a.modifiedFiles.length>0&&e.jsx(ab,{files:a.modifiedFiles})})]})]})}function eb({text:t}){const[n,s]=l.useState(!1),r=t.split(`
|
|
44
|
+
`)[0],a=t.includes(`
|
|
45
|
+
`)||t.length>120;return e.jsxs("div",{className:"px-1 pb-2",children:[e.jsx("div",{className:"text-[10px] font-semibold text-[var(--text-muted)] uppercase tracking-wide mb-1",children:"User Request"}),n?e.jsxs("div",{children:[e.jsx(Ht,{variant:"compact",children:t}),a&&e.jsx("button",{onClick:()=>s(!1),className:"text-[#D7FF63] hover:underline text-xs mt-1",children:"Show less"})]}):e.jsxs("div",{className:"text-xs text-[var(--text-secondary)] leading-relaxed",children:[r.slice(0,120),a&&e.jsx("button",{onClick:()=>s(!0),className:"text-[#D7FF63] hover:underline ml-1 text-xs",children:"Read more..."})]})]})}function is({title:t,icon:n,count:s,impactedCount:r=0,empty:a,children:o}){const i=s+r;return e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-default)] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-[var(--border-subtle)] bg-[var(--bg-input)] flex items-center gap-2",children:[e.jsx("span",{className:"text-xs",children:n}),e.jsx("span",{className:"text-xs font-semibold text-[var(--text-primary)]",children:t}),e.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["(",s,r>0?` +${r} impacted`:"",")"]})]}),e.jsx("div",{className:"p-3",children:i===0?e.jsx("div",{className:"text-xs text-[var(--text-muted)] italic",children:a||`No ${t.toLowerCase()} in this session`}):o})]})}function js({scenarios:t,selectedSlug:n,onSelect:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("div",{className:"flex gap-2",style:{minWidth:"min-content"},children:t.map(r=>e.jsx(sb,{scenario:r,isSelected:r.slug===n,onSelect:s},r.slug))})})}function lo({scenarios:t,selectedSlug:n,onSelect:s}){const[r,a]=l.useState(!1);return t.length===0?null:e.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)]",children:[e.jsxs("button",{onClick:()=>a(o=>!o),className:"text-[11px] text-[var(--text-muted)] hover:text-[var(--text-secondary)] flex items-center gap-1",children:[e.jsx("span",{children:r?"▾":"▸"}),e.jsxs("span",{children:[t.length," more impacted by hub-file changes (not recaptured this session)"]})]}),r&&e.jsx("div",{className:"mt-2",children:e.jsx(js,{scenarios:t,selectedSlug:n,onSelect:s})})]})}function tb({scenarios:t,selectedSlug:n,onSelect:s}){const r={};for(const i of t){const c=i.componentName||"Unknown";r[c]||(r[c]=[]),r[c].push(i)}const a=Object.keys(r).sort(),o=t.some(Xg);return e.jsxs("div",{className:"space-y-3",children:[o&&e.jsx("div",{className:"text-[10px] leading-snug text-[var(--text-muted)] bg-[var(--bg-input)] border border-[var(--border-subtle)] rounded px-2 py-1.5",children:"This stack has no component isolation harness, so leaf components are verified inside the full app scenarios rather than in isolation."}),a.map(i=>e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-secondary)] mb-1",children:i}),e.jsx(js,{scenarios:r[i],selectedSlug:n,onSelect:s})]},i))]})}function nb({scenarios:t,selectedSlug:n,onSelect:s}){if(!t.some(i=>i.routeName))return e.jsx(js,{scenarios:t,selectedSlug:n,onSelect:s});const a={};for(const i of t){const c=i.routeName||"Other";a[c]||(a[c]=[]),a[c].push(i)}const o=Object.keys(a).sort();return e.jsx("div",{className:"space-y-3",children:o.map(i=>e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-secondary)] mb-1",children:i}),e.jsx(js,{scenarios:a[i],selectedSlug:n,onSelect:s})]},i))})}function sb({scenario:t,isSelected:n,onSelect:s}){var o;const r=t.name.replace(/\s*\[.*\]\s*$/,"").trim(),a=Xg(t);return e.jsxs("div",{className:"shrink-0 cursor-pointer group",onClick:()=>s==null?void 0:s(t.slug,t.url),title:t.name,children:[e.jsx("div",{className:`w-24 h-24 rounded overflow-hidden flex items-center justify-center bg-[var(--bg-surface)] transition-colors ${n?"border-2 border-[#005c75] shadow-md":"border border-[var(--border-default)] group-hover:border-[#005c75]"}`,children:t.screenshotPaths.length>0?e.jsx(kt,{screenshotPath:t.screenshotPaths[0],cacheBuster:t.screenshotCapturedAtMs??void 0,alt:t.name}):t.coverageStatus==="needs-isolated-scenario"?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-1 px-1 text-center",title:"Backed only by a unit test — capture an isolated scenario so this component is viewable in the editor.",children:[e.jsx("span",{className:"text-amber-500 text-lg leading-none",children:"⚠"}),e.jsx("span",{className:"text-[8px] leading-tight text-amber-700",children:"needs isolated scenario"})]}):t.coverageStatus==="reason"?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-1 px-1 text-center",title:t.untestabilityReason?`${t.untestabilityReason.kind}: ${t.untestabilityReason.justification}`:"Covered by a recorded untestability reason.",children:[e.jsx("span",{className:"text-[var(--text-muted)] text-lg leading-none",children:"🧪"}),e.jsx("span",{className:"text-[8px] leading-tight text-[var(--text-muted)]",children:((o=t.untestabilityReason)==null?void 0:o.kind)??"test-backed"})]}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-[var(--text-muted)] text-lg",children:"📷"})}),e.jsx("div",{className:`mt-1 text-[10px] truncate w-24 ${n?"text-[#005c75] font-medium":"text-[var(--text-secondary)] group-hover:text-[#005c75]"}`,children:r}),a&&e.jsx("div",{className:"mt-0.5 w-24 text-[9px] leading-tight text-[var(--text-muted)]",children:"Covered via app scenarios — no isolation harness"})]})}function rb({functions:t}){return e.jsx("div",{className:"divide-y divide-gray-100 -mx-3 -mb-3",children:t.map(n=>e.jsxs("div",{className:"px-3 py-2",children:[e.jsx(Yi,{fn:n}),n.tests.length>0&&e.jsx("div",{className:"ml-5 mt-1.5 space-y-0.5",children:n.tests.map((s,r)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-green-500 text-[10px]",children:"✓"}),e.jsx("span",{className:"text-[10px] text-[var(--text-secondary)]",children:Ui(s)})]},r))}),n.testFile&&n.tests.length===0&&e.jsx("div",{className:"ml-5 mt-1 text-[10px] text-[var(--text-muted)] font-mono",children:n.testFile})]},`${n.filePath}::${n.name}`))})}function ab({files:t}){return e.jsx("div",{className:"divide-y divide-gray-100 -mx-3 -mb-3",children:t.map(n=>e.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[e.jsx(Mr,{status:n.status}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)] font-mono truncate",children:n.path})]},n.path))})}const B8=Object.freeze(Object.defineProperty({__proto__:null,ApplicationGroups:nb,CollapsedImpactedScenarios:lo,ComponentGroups:tb,FilesList:ab,FunctionsList:rb,ScenarioThumbnail:sb,ScenarioThumbnailStrip:js,Section:is,SessionResultsPanel:Zg,UserPrompt:eb},Symbol.toStringTag,{value:"Module"}));function ob({onExpand:t}){const{summary:n}=Qg(),s=(n==null?void 0:n.hubDominated)??!1,r=vr((n==null?void 0:n.application)??[],s),a=vr((n==null?void 0:n.components)??[],s),o=r.headline.length+a.headline.length,i=r.collapsed.length+a.collapsed.length;return e.jsxs("button",{type:"button",onClick:t,title:"Expand working session results",className:"shrink-0 w-full flex items-center gap-2 px-4 py-1.5 text-left bg-[var(--bg-card)] hover:bg-[var(--bg-input)] transition-colors",style:{borderTop:"2px solid #005c75"},children:[e.jsx("span",{className:"text-[var(--text-muted)] text-xs leading-none",children:"▴"}),e.jsx("span",{className:"text-xs font-semibold text-[var(--text-primary)]",children:"Working Session Results"}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[o," new",i>0?` · ${i} impacted`:""]})]})}const q8=Object.freeze(Object.defineProperty({__proto__:null,MinimizedSessionResults:ob},Symbol.toStringTag,{value:"Module"}));function e5(t,n){return(t==null?void 0:t.mode)!=="ui"?!1:(t==null?void 0:t.slug)==="feature-complete"||!!n}const t5=new Set(["ui-present","backend-present"]);function ib(t){return!!(t!=null&&t.slug)&&t5.has(t.slug)}function n5({stepState:t,resultsShown:n,featureCompleteActive:s,userExpanded:r}){return s?"hidden":ib(t)?(t==null?void 0:t.mode)==="ui"?"full":"hidden":e5(t,n)?r?"full":"minimized":"hidden"}function lb({awaitingPlanLaunchChoice:t,buildLaunchGateArmed:n,buildActivated:s,activeTab:r,onSelectScenario:a,previewSlug:o=null,showResultsCommandKey:i,hideResultsCommandKey:c,onAgentIdle:d,onAgentActive:u,onUserInput:h,notifSettings:p,onSettingsChange:f,provider:m,onRestorePreview:g,pendingPlans:b,pendingPlansLoading:x,pendingPlansError:y,onLaunchPlan:v,launchingSlug:w,launchError:j,onReorderPlans:_,isAgentBuilding:k,featureCompleteActive:S}){const{stepState:N}=Ts(),{sessionInfo:T}=Wi({pollIntervalMs:15e3}),[A,M]=l.useState(!1),[C,H]=l.useState(!1),[J,Z]=l.useState(0),F=(T==null?void 0:T.resultsShown)??!1;l.useEffect(()=>{F||(H(!1),M(!1))},[F]),l.useEffect(()=>{i&&(H(!1),M(!0),Z(W=>W+1))},[i]),l.useEffect(()=>{c&&M(!1)},[c]);const $=ib(N),P=n5({stepState:N,resultsShown:F,featureCompleteActive:S,userExpanded:A}),I=$&&C?"hidden":P,B=l.useCallback(()=>{$?H(!0):M(!1)},[$]),X=l.useCallback(()=>{M(!0),Z(W=>W+1)},[]);return s?e.jsx(Wf,{activeTab:r,resultsMode:I,buildTab:e.jsx(Kg,{awaitingPlanLaunchChoice:t,buildLaunchGateArmed:n,isActive:r==="build",onAgentIdle:d,onAgentActive:u,onUserInput:h,provider:m,onRestorePreview:g,pendingPlans:b,pendingPlansLoading:x,pendingPlansError:y,onLaunchPlan:v,launchingSlug:w,launchError:j,onReorderPlans:_,isAgentBuilding:k}),resultsPanel:e.jsx(Zg,{onClose:B,onSelectScenario:a,previewSlug:o,minimizeMode:!$},J),minimizedResults:e.jsx(ob,{onExpand:X}),footer:e.jsx(Qm,{settings:p,onChange:f,agentName:m,providerLabel:at(m)})}):null}const H8=Object.freeze(Object.defineProperty({__proto__:null,BuildTabPane:lb},Symbol.toStringTag,{value:"Module"}));function cb({name:t}){const n={width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"},s=t.toLowerCase(),r=s.includes("landscape"),a=s.includes("iphone"),o=s.includes("ipad");return s.includes("laptop")?e.jsxs("svg",{...n,children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}):s.includes("desktop")||s.includes("monitor")?e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}):s.includes("tablet")||s.includes("ipad")?r?e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2"}),o?e.jsx("path",{d:"M5 12h.01"}):e.jsx("path",{d:"M18 12h.01"})]}):e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),o?e.jsx("path",{d:"M12 5h.01"}):e.jsx("path",{d:"M12 18h.01"})]}):s.includes("phone")||s.includes("iphone")||s.includes("mobile")?r?e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"2",y:"7",width:"20",height:"10",rx:a?3:2}),a?e.jsx("path",{d:"M5 9.5v5"}):e.jsx("path",{d:"M18 12h.01"})]}):e.jsxs("svg",{...n,children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:a?3:2}),a?e.jsx("path",{d:"M10 4.5h4"}):e.jsx("path",{d:"M12 18h.01"})]}):e.jsx("span",{className:"text-xs",children:t})}const W8=Object.freeze(Object.defineProperty({__proto__:null,DeviceIcon:cb},Symbol.toStringTag,{value:"Module"})),Ac=["·","✢","✳","✶","✻","✽"],s5=160;function jr({testId:t="nav-build-dot-active",ariaLabel:n="Build in progress"}={}){const[s,r]=l.useState(0);return l.useEffect(()=>{const a=window.setInterval(()=>r(o=>(o+1)%Ac.length),s5);return()=>window.clearInterval(a)},[]),e.jsx("span",{"data-testid":t,"aria-label":n,className:"mr-1 inline-block w-3 text-center text-[#D7FF63] leading-none text-[11px] tabular-nums",children:Ac[s]})}const G8=Object.freeze(Object.defineProperty({__proto__:null,BuildSpinner:jr},Symbol.toStringTag,{value:"Module"}));function db({size:t=16}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]})}const U8=Object.freeze(Object.defineProperty({__proto__:null,EnvelopeIcon:db},Symbol.toStringTag,{value:"Module"}));function ub({size:t=16}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}const Y8=Object.freeze(Object.defineProperty({__proto__:null,GearIcon:ub},Symbol.toStringTag,{value:"Module"}));function hb({onNavigateToBuild:t,onDismiss:n,providerLabel:s}){return l.useEffect(()=>(se("banner-mounted",{}),()=>{se("banner-unmounted",{})}),[]),e.jsx("div",{className:"bg-black border-t border-[#333] px-4 py-1.5 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg border border-[#FF8B43]/60 bg-[#2a1500] shrink-0",children:[e.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-[#FF8B43] shrink-0"}),e.jsxs("span",{className:"text-sm text-[#FF8B43]",children:[s," is waiting for you."," ",e.jsx("span",{className:"text-[#FF8B43] font-medium underline",children:"Build."})]})]}),e.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),n()},className:"p-0.5 text-[#FF8B43]/60 hover:text-[#FF8B43] transition-colors cursor-pointer",title:"Dismiss",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M3 3l8 8M11 3l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}const V8=Object.freeze(Object.defineProperty({__proto__:null,IdleBanner:hb},Symbol.toStringTag,{value:"Module"})),r5=[{key:"home",label:"Home"},{key:"plan",label:"Plan"},{key:"build",label:"Build"},{key:"history",label:"History"}];function Pa(){if(typeof document>"u")return;const t=document.activeElement;t instanceof HTMLElement&&t.blur()}function pb({activeTab:t,onTabChange:n,onSendTranscript:s,buildIdle:r=!1,isAgentBuilding:a=!1,planIdle:o=!1,planActive:i=!1,bannerVisible:c=!1,onDismissIdleBanner:d,buildDisabled:u=!1,showLogo:h=!0,providerLabel:p}){const f=c&&t!=="build",m=r,g=a&&!r,b=g?"green":m?"orange":"none",x=l.useRef(b);l.useEffect(()=>{x.current!==b&&(se("build-tab-dot-change",{from:x.current,to:b}),x.current=b)},[b]);const y=o,v=i&&!o,w=v?"green":y?"orange":"none",j=l.useRef(w);return l.useEffect(()=>{j.current!==w&&(se("plan-tab-dot-change",{from:j.current,to:w}),j.current=w)},[w]),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("div",{className:"@container bg-black h-10 flex items-center px-4 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[h&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(Hn,{className:"h-5 text-white shrink-0 @max-[440px]:hidden"}),e.jsx(Hn,{markOnly:!0,className:"h-5 text-white shrink-0 hidden @max-[440px]:block"})]}),e.jsx("span",{className:"text-[#8E8E8E] text-sm shrink-0",children:"/"})]}),e.jsx("div",{className:"flex items-center gap-1",children:r5.map(_=>_.key==="build"&&u?e.jsx("button",{type:"button","data-nav-tab":"true","data-testid":"nav-build-disabled",title:"Connect your provider account on the Home tab to enable Build",onClick:()=>{n("home"),Pa()},className:"px-2.5 py-2.5 text-sm text-[#5A5A5A] cursor-not-allowed font-light whitespace-nowrap",children:_.label},_.key):e.jsxs(ur,{href:Dn(_.key),"data-nav-tab":"true",onNavigate:()=>{n(_.key),Pa(),_.key==="build"&<()},className:`px-2.5 py-2.5 text-sm transition-colors cursor-pointer inline-flex items-center whitespace-nowrap ${t===_.key?"text-[#D7FF63] font-medium":"text-[#8E8E8E] hover:text-white font-light"}`,children:[_.key==="build"&&g&&e.jsx(jr,{}),_.key==="build"&&m&&e.jsx("span",{"data-testid":"nav-build-dot-idle",className:"mr-1 inline-block w-2 h-2 rounded-full bg-[#FF8B43]"}),_.key==="plan"&&v&&e.jsx(jr,{testId:"nav-plan-dot-active",ariaLabel:"Planning in progress"}),_.key==="plan"&&y&&e.jsx("span",{"data-testid":"nav-plan-dot-idle",className:"mr-1 inline-block w-2 h-2 rounded-full bg-[#FF8B43]"}),_.label]},_.key))})]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:s,className:"p-1.5 rounded-md transition-colors cursor-pointer text-[#8E8E8E] hover:text-white",title:"Send Session Feedback",children:e.jsx(db,{})}),e.jsx(ur,{href:Dn("settings"),"data-nav-tab":"true",onNavigate:()=>{n("settings"),Pa()},className:`p-1.5 rounded-md transition-colors cursor-pointer inline-flex items-center ${t==="settings"?"text-[#D7FF63]":"text-[#8E8E8E] hover:text-white"}`,title:"Settings",children:e.jsx(ub,{})})]}),f&&e.jsx(hb,{onNavigateToBuild:()=>n("build"),onDismiss:d??(()=>{}),providerLabel:p})]})}const K8=Object.freeze(Object.defineProperty({__proto__:null,EditorNavBar:pb},Symbol.toStringTag,{value:"Module"}));function mb({projectTitle:t}){const n=typeof t=="string"&&t.trim().length>0;return e.jsxs("div",{"data-tauri-drag-region":!0,"data-testid":"desktop-title-bar",className:"shrink-0 bg-black h-9 flex items-center justify-center gap-2 px-4 select-none",children:[e.jsx(Hn,{className:"h-5 text-white shrink-0"}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[#8E8E8E] text-sm shrink-0",children:"/"}),e.jsx("span",{className:"text-white text-sm truncate max-w-[60%]",children:t})]})]})}const J8=Object.freeze(Object.defineProperty({__proto__:null,DesktopTitleBar:mb},Symbol.toStringTag,{value:"Module"}));function a5(t,n){for(const s of t.filesByDirectory)for(const r of s.files)if(r.filePath===n)return r;return null}function fb(t){return t>=80?"#16a34a":t>=50?"#eab308":"#dc2626"}function Os({coverage:t}){const n=Math.max(0,Math.min(100,t.percent)),s=fb(n);return e.jsxs("div",{className:"flex items-center gap-2 min-w-[140px]","data-testid":"coverage-bar",children:[e.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-gray-200 overflow-hidden",children:e.jsx("div",{"data-testid":"coverage-bar-fill",className:"h-full rounded-full",style:{width:`${n}%`,backgroundColor:s}})}),e.jsxs("span",{className:"text-xs font-mono tabular-nums",style:{color:s},children:[Math.round(n),"%"]})]})}const X8=Object.freeze(Object.defineProperty({__proto__:null,CoverageBar:Os},Symbol.toStringTag,{value:"Module"}));function gb({file:t,onSelectFile:n}){return e.jsxs("li",{className:"flex items-center gap-3 py-2","data-testid":"coverage-details-directory-file-row",children:[e.jsx("button",{type:"button",onClick:()=>n(t),className:"flex-1 min-w-0 text-left text-xs text-gray-700 truncate hover:underline cursor-pointer",children:t.filePath}),e.jsx(Os,{coverage:t.coverage})]})}const Q8=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsDirectoryFileRow:gb},Symbol.toStringTag,{value:"Module"}));function bb({group:t,onSelectFile:n}){return e.jsxs("details",{"data-testid":"coverage-details-directory-group",children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium text-gray-800",children:[t.directory||"(root)"," ·"," ",e.jsxs("span",{className:"text-gray-500",children:[t.files.length," file",t.files.length===1?"":"s"]})]}),e.jsx("ul",{className:"divide-y divide-gray-100 mt-2",children:t.files.map(s=>e.jsx(gb,{file:s,onSelectFile:n},s.filePath))})]})}const Z8=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsDirectoryGroup:bb},Symbol.toStringTag,{value:"Module"}));function xb({directories:t,onSelectFile:n}){return t.length===0?null:e.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-4","data-testid":"coverage-details-directories-section",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 m-0 mb-2",children:"By directory"}),e.jsx("div",{className:"flex flex-col gap-3",children:t.map(s=>e.jsx(bb,{group:s,onSelectFile:n},s.directory||"(root)"))})]})}const e7=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsDirectoriesSection:xb},Symbol.toStringTag,{value:"Module"}));function yb({entry:t,onSelectFile:n}){return e.jsxs("li",{className:"flex items-center gap-3 py-2","data-testid":"coverage-details-entry-row",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("button",{type:"button",onClick:()=>n(t.filePath),className:"text-sm font-medium text-gray-900 truncate text-left hover:underline cursor-pointer",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:t.filePath}),t.linkedTests.length>0&&e.jsxs("div",{className:"text-xs text-gray-400 truncate",children:[t.linkedTests.length," linked test",t.linkedTests.length===1?"":"s"]})]}),e.jsx(Os,{coverage:{percent:t.percent,hitLines:t.hitLines,totalLines:t.totalLines}})]})}const t7=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsEntryRow:yb},Symbol.toStringTag,{value:"Module"}));function vb({entries:t,onSelectFile:n}){return e.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-4","data-testid":"coverage-details-entries-section",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 m-0 mb-2",children:"By glossary entry"}),t.length===0?e.jsx("p",{className:"text-xs text-gray-500","data-testid":"coverage-details-entries-empty",children:"No glossary entries have coverage data yet."}):e.jsx("ul",{className:"divide-y divide-gray-100",children:t.map(s=>e.jsx(yb,{entry:s,onSelectFile:n},`${s.filePath}::${s.name}`))})]})}const n7=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsEntriesSection:vb},Symbol.toStringTag,{value:"Module"}));function jb({file:t}){return e.jsxs("li",{className:"flex items-center gap-3 py-2","data-testid":"orphaned-file-row",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-xs text-gray-500 truncate",children:t.filePath})}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-gray-400",title:"Coverage at file level — no glossary entry maps to this file.",children:"file-level"}),e.jsx(Os,{coverage:t.coverage})]})}const s7=Object.freeze(Object.defineProperty({__proto__:null,OrphanedFileRow:jb},Symbol.toStringTag,{value:"Module"}));function wb({files:t,onSelectFile:n}){return t.length===0?null:e.jsxs("section",{className:"bg-white border border-gray-200 rounded-lg p-4","data-testid":"coverage-details-orphaned-section",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 m-0 mb-2",children:"Orphaned files"}),e.jsxs("div",{className:"text-xs text-gray-500 mb-2",children:[t.length," file",t.length===1?"":"s"," with coverage but no glossary entry."]}),e.jsx("ul",{className:"divide-y divide-gray-100",children:t.map(s=>e.jsx("div",{onClick:()=>n(s.filePath),role:"button",tabIndex:0,className:"cursor-pointer",onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n(s.filePath))},children:e.jsx(jb,{file:s})},s.filePath))})]})}const r7=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsOrphanedSection:wb},Symbol.toStringTag,{value:"Module"}));function _b({line:t,hits:n}){const s=n>0;return e.jsxs("li",{className:"flex items-center gap-3 py-1 font-mono text-xs","data-testid":s?"coverage-line-hit":"coverage-line-miss",children:[e.jsx("span",{className:"w-12 text-right text-gray-400",children:t}),e.jsx("span",{className:s?"px-2 py-0.5 rounded bg-green-100 text-green-800":"px-2 py-0.5 rounded bg-red-100 text-red-800",children:s?`×${n}`:"miss"})]})}const a7=Object.freeze(Object.defineProperty({__proto__:null,CoverageLineRow:_b},Symbol.toStringTag,{value:"Module"}));function kb({file:t,onBack:n}){const s=Object.entries(t.lines).map(([r,a])=>({line:Number(r),hits:a})).sort((r,a)=>r.line-a.line);return e.jsxs("div",{"data-testid":"coverage-file-drilldown",className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("button",{type:"button",onClick:n,className:"text-xs font-medium text-[var(--accent-active)] hover:underline cursor-pointer","data-testid":"coverage-file-drilldown-back",children:"← Back"}),e.jsx("div",{className:"text-sm font-medium text-gray-900 truncate mt-1",children:t.filePath})]}),e.jsx(Os,{coverage:t.coverage})]}),s.length===0?e.jsx("p",{className:"text-xs text-gray-500",children:"No instrumented lines in this file."}):e.jsx("ul",{className:"divide-y divide-gray-100 max-h-[50vh] overflow-y-auto","data-testid":"coverage-file-drilldown-lines",children:s.map(({line:r,hits:a})=>e.jsx(_b,{line:r,hits:a},r))})]})}const o7=Object.freeze(Object.defineProperty({__proto__:null,CoverageFileDrilldown:kb},Symbol.toStringTag,{value:"Module"}));function Sb({title:t,aggregate:n,aggregateTestId:s}){return e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900 m-0",children:t}),n&&n.totalLines>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:[n.hitLines,"/",n.totalLines," lines"]}),e.jsxs("span",{className:"text-xs font-semibold",style:{color:fb(n.percent)},"data-testid":s,children:[Math.round(n.percent),"% overall"]})]})]})}const i7=Object.freeze(Object.defineProperty({__proto__:null,CoverageSectionHeader:Sb},Symbol.toStringTag,{value:"Module"}));function Nb({warnings:t}){return t.length===0?null:e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4","data-testid":"coverage-warnings-banner",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 text-lg leading-none mt-0.5","aria-hidden":"true",children:"!"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 m-0",children:"Coverage Warnings"}),e.jsx(Ze,{variant:"subtle",text:t.join(`
|
|
46
|
+
`),label:"Copy",className:"shrink-0 px-2 py-1 text-xs font-medium rounded border border-amber-300 text-amber-800 hover:bg-amber-100 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"})]}),e.jsx("ul",{className:"mt-1 space-y-1 text-sm text-amber-700 list-none p-0 m-0",children:t.map((n,s)=>e.jsx("li",{className:"break-words",children:n},s))})]})]})})}const l7=Object.freeze(Object.defineProperty({__proto__:null,CoverageWarningsBanner:Nb},Symbol.toStringTag,{value:"Module"}));function Cb({onClose:t,fetchDetails:n=o5,initialData:s}){const[r,a]=l.useState(s??null),[o,i]=l.useState(null),[c,d]=l.useState(null);l.useEffect(()=>{if(s)return;let p=!1;return n().then(f=>{p||a(f)}).catch(f=>{p||i(f instanceof Error?f.message:String(f))}),()=>{p=!0}},[n,s]);const u=l.useCallback(p=>{p.key==="Escape"&&(p.preventDefault(),c?d(null):t())},[t,c]);l.useEffect(()=>(window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)),[u]);const h=p=>{if(!r)return;const f=a5(r,p);f&&d(f)};return e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},"data-testid":"coverage-details-modal",onClick:t,children:e.jsxs("div",{className:"max-w-3xl w-full mx-4 p-6 rounded-lg bg-[var(--bg-card)] max-h-[90vh] overflow-y-auto",onClick:p=>p.stopPropagation(),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] m-0",children:"Project coverage"}),e.jsx("button",{type:"button",onClick:t,className:"text-sm text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer","data-testid":"coverage-details-modal-close","aria-label":"Close",children:"✕"})]}),o&&e.jsx(Qe,{testId:"coverage-details-modal-error",text:`Failed to load coverage details: ${o}`,className:"text-sm text-red-700"}),!r&&!o&&e.jsx("p",{className:"text-sm text-[var(--text-muted)]","data-testid":"coverage-details-modal-loading",children:"Loading coverage details…"}),r&&c&&e.jsx(kb,{file:c,onBack:()=>d(null)}),r&&!c&&e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(Sb,{title:"Overall",aggregate:r.projectWide,aggregateTestId:"coverage-details-modal-aggregate"}),r.coverageWarnings.length>0&&e.jsx(Nb,{warnings:r.coverageWarnings}),e.jsx(vb,{entries:r.entries,onSelectFile:h}),e.jsx(wb,{files:r.orphanedFiles,onSelectFile:h}),e.jsx(xb,{directories:r.filesByDirectory,onSelectFile:d})]})]})})}function o5(){return fetch("/api/coverage/details").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()})}const c7=Object.freeze(Object.defineProperty({__proto__:null,CoverageDetailsModal:Cb},Symbol.toStringTag,{value:"Module"}));function i5({launcherUrl:t,projectCount:n=0,fallback:s}){const[r,a]=l.useState(!1),o=l.useCallback(async()=>{if(t){window.location.href=t;return}if(!r){a(!0);try{const c=await fetch("/api/launcher/ensure",{method:"POST"}),d=await c.json().catch(()=>({}));if(c.ok&&typeof d.url=="string"){window.location.href=d.url;return}a(!1)}catch{a(!1)}}},[t,r]);return{goBack:!!t||n>=2?()=>{o()}:s,busy:r}}function Pb({title:t,onBack:n,backBusy:s=!1}){return e.jsxs("div",{className:"home-head",children:[n?e.jsx("button",{type:"button",className:"hback",onClick:n,disabled:s,"aria-label":"All projects",title:"All projects",children:"←"}):null,e.jsx("span",{className:"hmark","aria-hidden":"true",children:e.jsx(Hn,{className:"h-4",markOnly:!0})}),e.jsx("h1",{className:"htitle",children:t})]})}const d7=Object.freeze(Object.defineProperty({__proto__:null,HomeHeader:Pb},Symbol.toStringTag,{value:"Module"}));function Vi({title:t,count:n,live:s=!1,attention:r=!1,onAdd:a,addLabel:o,children:i}){const c=n===0;return e.jsxs("div",{className:"home-sechead",children:[e.jsxs("h2",{className:"home-sectitle"+(c?" empty":""),children:[c?`No ${t}`:t,n!=null&&n>0?e.jsxs("span",{className:"count",children:[" (",n,")"]}):null]}),s?e.jsx("span",{className:"home-livedot"+(r?" warn":""),"data-testid":"home-section-live-dot"}):null,i,a?e.jsx("button",{type:"button",className:"home-secadd"+(c?"":" spacer"),onClick:a,"aria-label":o,title:o,children:"+"}):null]})}const u7=Object.freeze(Object.defineProperty({__proto__:null,HomeSectionHeading:Vi},Symbol.toStringTag,{value:"Module"}));function Tb({isBuilding:t,buildingLabel:n,buildingStepLabel:s,buildingStepPosition:r=null,buildingStatus:a="building",buildingProgress:o=null,thumbnailPath:i=null,lastBuiltLabel:c,onOpenBuilding:d,onStartNewFeature:u,onResetBuild:h}){return e.jsxs("section",{"data-testid":"home-building-section",children:[e.jsx(Vi,{title:"What's Building",live:t,attention:t&&a!=="building"}),e.jsx(Ci,{isBuilding:t,buildingLabel:n,buildingStepLabel:s,buildingStepPosition:r,buildingStatus:a,buildingProgress:o,thumbnailPath:i,lastBuiltLabel:c,onOpenBuilding:d,onStartNewFeature:u,onResetBuild:h})]})}const h7=Object.freeze(Object.defineProperty({__proto__:null,HomeBuildingSection:Tb},Symbol.toStringTag,{value:"Module"})),Ob=3;function Ab({plans:t,loading:n,error:s,onRun:r,launchingSlug:a=null,blocked:o=!1,depAnnotationsBySlug:i,dependenciesBySlug:c,claimsBySlug:d,staleFetch:u,showAuthors:h=!1,onOpenPlans:p}){const[f,m]=l.useState(null),g=t.slice(0,Ob),b=t.length>g.length;return e.jsxs("section",{className:"home-sec","data-testid":"home-queued-plans-section",children:[e.jsx(Vi,{title:"Queued Plans",count:t.length,onAdd:p,addLabel:"Plan a new change"}),e.jsx(Hi,{plans:g,loading:n,error:s,expandedSlug:f,onToggle:x=>m(y=>y===x?null:x),onRun:r,launchingSlug:a,blocked:o,depAnnotationsBySlug:i,dependenciesBySlug:c,claimsBySlug:d,staleFetch:u,showAuthors:h}),b?e.jsxs("button",{type:"button",className:"home-viewall",onClick:p,children:["View all ",e.jsx("span",{"aria-hidden":"true",children:"→"})]}):null]})}const p7=Object.freeze(Object.defineProperty({__proto__:null,HOME_QUEUED_PLAN_LIMIT:Ob,HomeQueuedPlansSection:Ab},Symbol.toStringTag,{value:"Module"}));function Rb({projectTitle:t,app:n,isBuilding:s,buildingLabel:r,buildingStepLabel:a,buildingStepPosition:o,buildingStatus:i,buildingProgress:c,buildingThumbnailPath:d,lastBuiltLabel:u,plans:h,plansLoading:p=!1,plansError:f=null,onRunPlan:m,launchingSlug:g,planDepAnnotationsBySlug:b,planDependenciesBySlug:x,planClaimsBySlug:y,planStaleFetch:v,showPlanAuthors:w,onOpenBuilding:j,onStartNewFeature:_,onResetBuild:k,onOpenPlans:S,onBackToProjects:N,launcherUrl:T,projectCount:A=0}){const{goBack:M,busy:C}=i5({launcherUrl:T,projectCount:A,fallback:N}),H=(t==null?void 0:t.trim())||n.name||"Your project";return e.jsxs("div",{className:"home-landing",children:[e.jsx(Pb,{title:H,onBack:M,backBusy:C}),e.jsx("div",{className:"home-sec",children:e.jsx(Tb,{isBuilding:s,buildingLabel:r,buildingStepLabel:a,buildingStepPosition:o,buildingStatus:i,buildingProgress:c,thumbnailPath:d,lastBuiltLabel:u,onOpenBuilding:j,onStartNewFeature:_,onResetBuild:k})}),e.jsx(Ab,{plans:h,loading:p,error:f,onRun:m,launchingSlug:g,blocked:s,depAnnotationsBySlug:b,dependenciesBySlug:x,claimsBySlug:y,staleFetch:v,showAuthors:w,onOpenPlans:S})]})}const m7=Object.freeze(Object.defineProperty({__proto__:null,HomeLanding:Rb},Symbol.toStringTag,{value:"Module"})),l5={provider:"vercel"},Eb={"dev-accounts":Am,"store-assets":Rm,"store-listing":Em,"testing-distribution":Mm,"push-notifications":Im,"crash-reporting":Dm,"in-app-purchases":Lm,"app-privacy":Fm,"app-review":zm};function Rc(t){return t in Eb}function c5(){const[t,n]=l.useState(null),s=l.useCallback(async()=>{try{const o=await fetch("/api/setup-topics");if(!o.ok)throw new Error(`HTTP ${o.status}`);const i=await o.json();n(Array.isArray(i)?i:[])}catch{n([])}},[]);l.useEffect(()=>{s()},[s]);const r=l.useCallback((o,i)=>{n(c=>c&&c.map(d=>d.key===o?{...d,status:i}:d)),fetch("/api/setup-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:o,status:i})}).catch(()=>{s()})},[s]),a=l.useCallback(async o=>{const i=await fetch("/api/setup-topics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o.name,desc:o.desc??"",icon:o.icon??""})});if(!i.ok){const d=await i.json().catch(()=>null);throw new Error(d&&typeof d.error=="string"&&d.error||`HTTP ${i.status}`)}const c=await i.json();return await s(),{key:c.key,existed:!!c.existed}},[s]);return{topics:t,setStatus:r,addTopic:a}}function d5(){const[t,n]=l.useState(null);return l.useEffect(()=>{let s=!1;return(async()=>{try{const r=await fetch("/api/setup-libraries");if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();s||n(Array.isArray(a)?a:[])}catch{s||n([])}})(),()=>{s=!0}},[]),{groups:t}}function u5(){const[t,n]=l.useState(null);return l.useEffect(()=>{let s=!1;return(async()=>{try{const r=await fetch("/api/local-run-recipe");if(!r.ok)throw new Error(`HTTP ${r.status}`);const a=await r.json();s||n(a)}catch{s||n(null)}})(),()=>{s=!0}},[]),{recipe:t}}function h5(t,n){if(n(),Xw()){Ia(t);return}Jw(Bl).then(s=>{s?Ia(t):console.warn(`[setup-chat] Build terminal did not attach within ${Bl}ms; prompt not sent`)})}const p5=new Set(["share-testing","store-accounts","store-assets","permissions-justification","oauth-verification","privacy-policy","single-purpose-listing","manifest-versioning","submit-review"]);function Mb({appDetailProps:t,appOverviewProps:n,selectedApp:s,projectTitle:r,admin:a,isBuilding:o,buildingLabel:i,buildingStepLabel:c,buildingStepPosition:d,buildingStatus:u,buildingProgress:h,buildingThumbnailPath:p,lastBuiltLabel:f,plans:m,plansLoading:g,plansError:b,onRunPlan:x,launchingSlug:y,planDepAnnotationsBySlug:v,planDependenciesBySlug:w,planClaimsBySlug:j,planStaleFetch:_,showPlanAuthors:k,onNavigateToPlan:S,onNavigateToBuild:N,onResetBuild:T,onBackToProjects:A,launcherUrl:M,projectCount:C,onOpenSetupBrowser:H}){const[J,Z]=l.useState(!1),F=()=>Z(!0),$=()=>Z(!1),[P,I]=l.useState("landing"),[B,X]=l.useState(null),[W,ie]=l.useState(null),{topics:Q,setStatus:O,addTopic:L}=c5();Q==null||Q.filter(ne=>ne.status==="done").length;const q=ne=>{var re;return((re=Q==null?void 0:Q.find(U=>U.key===ne))==null?void 0:re.status)??"available"},{services:le,dismiss:de,refetch:ee}=si(),[D,z]=l.useState(null),K=l.useCallback(ne=>{var U;const re=(U=ne.envVars)==null?void 0:U[0];re&&z({serviceName:ne.name,envVar:re,topic:ne.topic,docsUrl:ne.docsUrl})},[]),{recipe:ue}=u5(),ye=lS(Gh()),{groups:je}=d5(),V=(Q==null?void 0:Q.some(ne=>ne.key==="dev-accounts"))??!1,te=(Q==null?void 0:Q.some(ne=>ne.key==="deploy-target"))??!1,oe=ne=>{ne==="run-locally"?I("run-locally"):V&&Rc(ne)?(ie(ne),I("mobile-setup")):p5.has(ne)?I(ne):Rc(ne)?(ie(ne),I("mobile-setup")):(X(ne),I("topic"))},he=!!(t.selectedRouteEntity||t.selectedEntityHash);let G;if(!s)G=e.jsx(qf,{...n,onCoverageClick:F},"app-overview");else if(he||P==="detail"){const ne=P==="detail"&&!he;G=e.jsxs(e.Fragment,{children:[ne?e.jsx("div",{className:"home-landing",style:{padding:"20px 28px 0"},children:e.jsxs("div",{className:"crumbs",style:{marginBottom:0},children:[e.jsx("button",{type:"button",className:"back",onClick:()=>I("landing"),"aria-label":"Back",children:"←"}),e.jsx("button",{type:"button",onClick:()=>I("landing"),children:"Home"}),e.jsx("span",{className:"sep",children:"›"}),e.jsx("b",{children:"Explore your app"})]})}):null,e.jsx(Vh,{app:s,...t,onCoverageClick:F})]})}else if(P==="learn")G=e.jsx(nr,{topics:Q,detectedServices:le,onBack:()=>I("landing"),onOpenHosting:()=>I("hosting"),onOpenTopic:oe,onOpenLibraries:()=>I("libraries"),onDismissService:de,onAddCredential:K,onCreateTopic:L,onOpenConcepts:()=>I("concepts")});else if(P==="libraries")G=e.jsx(ip,{groups:je,onBack:()=>I("learn")});else if(P==="concepts")G=e.jsx(um,{onBack:()=>I("learn")});else if(P==="hosting")G=e.jsx(ym,{connector:l5,onBack:()=>I("learn"),onComplete:()=>O("hosting","done"),onOpenSharedBrowser:H});else if(P==="run-locally")G=e.jsx(vm,{recipe:ue,onBack:()=>I("learn"),status:q("run-locally"),onMarkDone:()=>O("run-locally","done"),onRevert:()=>O("run-locally","available")});else if(P==="share-testing")G=e.jsx(Om,{onBack:()=>I("learn"),status:q("share-testing"),onComplete:()=>O("share-testing","done"),onRevert:()=>O("share-testing","available")});else if(P==="store-accounts")G=e.jsx(jm,{onBack:()=>I("learn"),status:q("store-accounts"),onComplete:()=>O("store-accounts","done"),onRevert:()=>O("store-accounts","available")});else if(P==="store-assets")G=e.jsx(wm,{onBack:()=>I("learn"),status:q("store-assets"),onComplete:()=>O("store-assets","done"),onRevert:()=>O("store-assets","available")});else if(P==="permissions-justification")G=e.jsx(km,{onBack:()=>I("learn"),status:q("permissions-justification"),onComplete:()=>O("permissions-justification","done"),onRevert:()=>O("permissions-justification","available")});else if(P==="oauth-verification")G=e.jsx(Nm,{onBack:()=>I("learn"),status:q("oauth-verification"),onComplete:()=>O("oauth-verification","done"),onRevert:()=>O("oauth-verification","available")});else if(P==="privacy-policy")G=e.jsx(Sm,{onBack:()=>I("learn"),status:q("privacy-policy"),onComplete:()=>O("privacy-policy","done"),onRevert:()=>O("privacy-policy","available")});else if(P==="single-purpose-listing")G=e.jsx(Cm,{onBack:()=>I("learn"),status:q("single-purpose-listing"),onComplete:()=>O("single-purpose-listing","done"),onRevert:()=>O("single-purpose-listing","available")});else if(P==="manifest-versioning")G=e.jsx(Pm,{onBack:()=>I("learn"),status:q("manifest-versioning"),onComplete:()=>O("manifest-versioning","done"),onRevert:()=>O("manifest-versioning","available")});else if(P==="submit-review")G=e.jsx(Tm,{onBack:()=>I("learn"),status:q("submit-review"),onComplete:()=>O("submit-review","done"),onRevert:()=>O("submit-review","available")});else if(P==="topic"&&B){const ne=(Q==null?void 0:Q.find(re=>re.key===B))??null;G=e.jsx(dm,{topicKey:B,topicName:ne==null?void 0:ne.name,topicDesc:ne==null?void 0:ne.desc,isBackend:te,onBack:()=>I("learn"),onComplete:re=>O(re,"done"),onChatWithAI:re=>h5(re,N)})}else if(P==="mobile-setup"&&W){const ne=Eb[W];G=ne?e.jsx(ne,{platform:ye,onBack:()=>I("learn"),status:q(W),onComplete:()=>O(W,"done"),onRevert:()=>O(W,"available")}):e.jsx(nr,{topics:Q,detectedServices:le,onBack:()=>I("landing"),onOpenHosting:()=>I("hosting"),onOpenTopic:oe,onDismissService:de,onAddCredential:K})}else G=e.jsxs(e.Fragment,{children:[e.jsx(Rb,{app:s,projectTitle:r,isBuilding:o,buildingLabel:i,buildingStepLabel:c,buildingStepPosition:d,buildingStatus:u,buildingProgress:h,buildingThumbnailPath:p,lastBuiltLabel:f,plans:m,plansLoading:g,plansError:b,onRunPlan:x,launchingSlug:y,planDepAnnotationsBySlug:v,planDependenciesBySlug:w,planClaimsBySlug:j,planStaleFetch:_,showPlanAuthors:k,onOpenBuilding:N,onStartNewFeature:N,onResetBuild:T,onOpenPlans:S,onBackToProjects:A,launcherUrl:M,projectCount:C}),e.jsx(yh,{appDetailProps:t,selectedApp:s,setupSlot:a?e.jsx(nr,{topics:Q,detectedServices:le,onBack:()=>I("landing"),onOpenHosting:()=>I("hosting"),onOpenTopic:oe,onOpenLibraries:()=>I("libraries"),onDismissService:de,onAddCredential:K,onCreateTopic:L,onOpenConcepts:()=>I("concepts")}):void 0})]});return e.jsxs(ep,{children:[G,J&&e.jsx(Cb,{onClose:$}),D?e.jsx(Or,{target:D,onStored:()=>{z(null),ee()},onClose:()=>z(null)}):null]})}const f7=Object.freeze(Object.defineProperty({__proto__:null,EditorShellHomeTabContent:Mb},Symbol.toStringTag,{value:"Module"}));function Ib({activeTab:t,awaitingPlanLaunchChoice:n,buildLaunchGateArmed:s,buildActivated:r,hideResultsCommandKey:a,onSelectScenario:o,previewSlug:i,showResultsCommandKey:c,onAgentIdle:d,onAgentActive:u,onUserInput:h,notifSettings:p,onSettingsChange:f,provider:m,onRestorePreview:g,pendingPlans:b,pendingPlansLoading:x,pendingPlansError:y,onLaunchPlan:v,launchingSlug:w,launchError:j,onReorderPlans:_,isAgentBuilding:k,featureCompleteActive:S}){return r?e.jsx(lb,{awaitingPlanLaunchChoice:n,buildLaunchGateArmed:s,buildActivated:r,activeTab:t,onSelectScenario:o,previewSlug:i,showResultsCommandKey:c,hideResultsCommandKey:a,onAgentIdle:d,onAgentActive:u,onUserInput:h,notifSettings:p,onSettingsChange:f,provider:m,onRestorePreview:g,pendingPlans:b,pendingPlansLoading:x,pendingPlansError:y,onLaunchPlan:v,launchingSlug:w,launchError:j,onReorderPlans:_,isAgentBuilding:k,featureCompleteActive:S}):null}const g7=Object.freeze(Object.defineProperty({__proto__:null,EditorShellBuildLayer:Ib},Symbol.toStringTag,{value:"Module"}));function Db({onMouseDown:t}){return e.jsx("div",{onMouseDown:t,className:"shrink-0 flex items-center justify-center group",style:{width:12,cursor:"col-resize",background:"var(--bg-surface)",borderLeft:"1px solid var(--border-default)",borderRight:"1px solid var(--border-default)"},children:e.jsx("div",{className:"w-0.5 h-8 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"var(--text-dim)"}})})}const b7=Object.freeze(Object.defineProperty({__proto__:null,PanelDivider:Db},Symbol.toStringTag,{value:"Module"})),m5=[{key:"editor",label:"Editor"},{key:"preview",label:"Preview"}];function Lb({active:t,onChange:n,isAgentBuilding:s=!1,buildIdle:r=!1}){const a=s&&!r,o=r;return e.jsx("div",{"data-testid":"mobile-pane-switcher",className:"shrink-0 flex w-full",style:{background:"var(--bg-nav)",borderTop:"1px solid var(--border-default)",paddingBottom:"env(safe-area-inset-bottom)"},children:m5.map(i=>{const c=t===i.key;return e.jsxs("button",{"data-testid":`mobile-pane-switcher-${i.key}`,onClick:()=>n(i.key),"aria-pressed":c,className:`flex-1 flex items-center justify-center gap-1 h-12 text-sm border-t-2 transition-colors cursor-pointer ${c?"text-[#D7FF63] border-[#D7FF63] font-medium":"text-[#8E8E8E] border-transparent font-light"}`,children:[i.key==="editor"&&a&&e.jsx(jr,{}),i.key==="editor"&&o&&e.jsx("span",{"data-testid":"mobile-pane-switcher-dot-idle",className:"mr-1 inline-block w-2 h-2 rounded-full bg-[#FF8B43]"}),i.label]},i.key)})})}const x7=Object.freeze(Object.defineProperty({__proto__:null,MobilePaneSwitcher:Lb},Symbol.toStringTag,{value:"Module"}));function Fb({isCollapsed:t,leftPane:n,onResizeStart:s,previewPane:r,splitRef:a,isNarrow:o,mobilePane:i,onMobilePaneChange:c,isAgentBuilding:d=!1,buildIdle:u=!1,hidePreview:h=!1,onHomeLivePageBack:p}){return o?e.jsxs("div",{ref:a,className:"fixed inset-0 flex flex-col",style:{background:"var(--bg-surface)"},children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:`absolute inset-0 flex ${i==="editor"?"":"hidden"}`,children:n}),e.jsx("div",{className:`absolute inset-0 flex ${i==="preview"?"":"hidden"}`,children:r})]}),e.jsx(Lb,{active:i,onChange:c,isAgentBuilding:d,buildIdle:u})]}):p?e.jsx("div",{ref:a,className:"fixed inset-0 flex",style:{background:"var(--bg-surface)"},children:r}):h?e.jsx("div",{ref:a,className:"fixed inset-0 flex",style:{background:"var(--bg-surface)"},children:n}):e.jsxs("div",{ref:a,className:"fixed inset-0 flex",style:{background:"var(--bg-surface)"},children:[!t&&e.jsxs(e.Fragment,{children:[n,e.jsx(Db,{onMouseDown:s})]}),r]})}const y7=Object.freeze(Object.defineProperty({__proto__:null,EditorShellLayout:Fb},Symbol.toStringTag,{value:"Module"}));function zb(){const[t,n]=l.useState([]),[s,r]=l.useState(!0),[a,o]=l.useState(null),{plansVersion:i}=Nn(),c=l.useRef(!1),d=l.useCallback(async()=>{c.current||r(!0),o(null);try{const u=await fetch("/api/plans");if(!u.ok)throw new Error(`HTTP ${u.status}`);const h=await u.json();n(Array.isArray(h)?h.map(p=>({...p,dependsOn:Array.isArray(p.dependsOn)?p.dependsOn:[]})):[]),c.current=!0}catch(u){o(u instanceof Error?u.message:"Failed to load plans")}finally{r(!1)}},[]);return l.useEffect(()=>{d()},[d,i]),{plans:t,loading:s,error:a,refetch:d}}function Ki(){const[t,n]=l.useState([]),[s,r]=l.useState(!0),[a,o]=l.useState(null),{plansVersion:i,claimsVersion:c}=Nn(),d=l.useCallback(async()=>{r(!0),o(null);try{const u=await fetch("/api/plan-claims");if(!u.ok)throw new Error(`HTTP ${u.status}`);const h=await u.json();n(Array.isArray(h)?h:[])}catch(u){o(u instanceof Error?u.message:"Failed to load plan claims")}finally{r(!1)}},[]);return l.useEffect(()=>{d()},[d,i,c]),{claims:t,loading:s,error:a,refetch:d}}function Ji(){const[t,n]=l.useState(null),{claimsVersion:s}=Nn(),r=l.useCallback(async()=>{try{const a=await fetch("/api/plan-claims/sync-status");if(!a.ok)return;const o=await a.json();n(o)}catch{}},[]);return l.useEffect(()=>{r()},[r,s]),l.useEffect(()=>{const a=setInterval(()=>void r(),1e4);return()=>clearInterval(a)},[r]),{status:t}}function f5(){const[t,n]=l.useState(null),s=l.useCallback(async()=>{try{const r=await fetch("/api/server/staleness");if(!r.ok)return;const a=await r.json();n(a)}catch{}},[]);return l.useEffect(()=>{s()},[s]),l.useEffect(()=>{const r=setInterval(()=>void s(),6e4);return()=>clearInterval(r)},[s]),{staleness:t}}const Ta="codeyam-editor editor plan-claims-status",g5="git push origin HEAD";function $b(t,n){switch(t){case"credential":return{message:"Plan tracking isn't reaching the remote — git credentials need refreshing. Run the command below from a shell to wake the credential helper.",command:g5};case"network":return{message:"Plan tracking can't reach the remote (network failure). Check connectivity, then run the command below for details.",command:Ta};case"git-spawn":return{message:"Plan tracking can't launch git. Run the command below for the failing invocation.",command:Ta};default:return{message:`Plan tracking is failing (${n} failed ticks). Teammates' in-flight plans may not appear. Run the command below for details.`,command:Ta}}}function Bb({status:t}){const n=(t==null?void 0:t.consecutiveFailures)??0;if((t==null?void 0:t.enabled)===!1||n<3)return null;const{message:s,command:r}=$b(t==null?void 0:t.lastErrorCategory,n);return e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3","data-testid":"plan-claim-sync-banner",role:"alert",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 text-lg leading-none mt-0.5","aria-hidden":"true",children:"!"}),e.jsxs("div",{className:"flex-1 min-w-0 text-sm text-amber-800",children:[s," ",e.jsx("code",{className:"text-xs",children:r})," ",e.jsx(Ze,{text:r,label:"Copy command",copiedLabel:"Copied",ariaLabel:"Copy the plan-tracking diagnostic command",className:"underline text-amber-700 hover:text-amber-900 disabled:opacity-50"})]})]})})}const v7=Object.freeze(Object.defineProperty({__proto__:null,PlanClaimSyncBanner:Bb,planClaimSyncBannerContent:$b},Symbol.toStringTag,{value:"Module"})),Ec="codeyam-editor editor restart-server";function Xi({staleness:t,backendOutOfDate:n=!1}){var a;const s=!!(t!=null&&t.stale);if(!s&&!n)return null;const r=((a=t==null?void 0:t.info)==null?void 0:a.minutesStale)??0;return e.jsx("div",{className:"rounded-lg p-3","data-testid":"server-staleness-banner",role:"alert",style:{background:"rgba(239, 111, 111, 0.08)",border:"0.5px solid rgba(239, 111, 111, 0.3)"},children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-lg leading-none mt-0.5","aria-hidden":"true",style:{color:"var(--red-300)"},children:"!"}),e.jsxs("div",{className:"flex-1 min-w-0 text-sm",style:{color:"var(--text-body)"},children:[s?e.jsxs(e.Fragment,{children:["The editor is running an older version of itself (rebuilt"," ",r," min ago) and needs restarting to pick up the latest plan tracking fixes."]}):e.jsx(e.Fragment,{children:"The editor is running an older version of itself, which can’t drive the Build tab. Restarting it reconnects everything."})," ","Run"," ",e.jsx("code",{className:"text-xs",style:{color:"var(--text-strong)"},children:Ec}),"."," ",e.jsx(Ze,{text:Ec,label:"Copy command",copiedLabel:"Copied",ariaLabel:"Copy the editor restart command",className:"underline disabled:opacity-50"})]})]})})}const j7=Object.freeze(Object.defineProperty({__proto__:null,ServerStalenessBanner:Xi},Symbol.toStringTag,{value:"Module"}));function Qi(t){const n=new Map;for(const s of t){const r=n.get(s.slug);(!r||r.source!=="local"&&s.source==="local")&&n.set(s.slug,s)}return n}function b5(t){var s;const n=new Set;for(const r of t){const a=(s=r==null?void 0:r.email)==null?void 0:s.trim().toLowerCase();a&&n.add(a)}return n.size}function qb(t){return b5(t)>=2}function x5(t,n){return t.filter(s=>s.source==="local"||!n.has(s.slug))}function Hb(t=10){const[n,s]=l.useState([]),[r,a]=l.useState(!0),[o,i]=l.useState(null),c=l.useRef(!1),d=l.useCallback(async()=>{c.current||a(!0),i(null);try{const u=await fetch(`/api/plans/completed?limit=${t}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);const h=await u.json();s(Array.isArray(h)?h:[]),c.current=!0}catch(u){i(u instanceof Error?u.message:"Failed to load completed plans")}finally{a(!1)}},[t]);return l.useEffect(()=>{d()},[d]),{plans:n,loading:r,error:o,refetch:d}}function Wb(){const[t,n]=l.useState(()=>new Set),[s,r]=l.useState(!0),[a,o]=l.useState(null),i=l.useCallback(async()=>{r(!0),o(null);try{const c=await fetch("/api/plans/completed/slugs");if(!c.ok)throw new Error(`HTTP ${c.status}`);const d=await c.json(),u=Array.isArray(d==null?void 0:d.slugs)?d.slugs:[];n(new Set(u.filter(h=>typeof h=="string")))}catch(c){o(c instanceof Error?c.message:"Failed to load completed plan slugs")}finally{r(!1)}},[]);return l.useEffect(()=>{i()},[i]),{slugs:t,loading:s,error:a,refetch:i}}function y5(t,n,s){const r=new Map(n.map(a=>[a.slug,a]));return t.dependsOn.map(a=>{var o;return{slug:a,title:((o=r.get(a))==null?void 0:o.title)??null,satisfied:s.has(a)}})}function Gb(t){return t.filter(n=>!n.satisfied)}function Zi(t){const{slugs:n}=Wb();return l.useMemo(()=>{const s={},r={};for(const a of t){const o=a.dependsOn??[];if(o.length===0)continue;const i=y5({...a,dependsOn:o},t,n);r[a.slug]=i;const c=Gb(i);c.length!==0&&(s[a.slug]={count:c.length,tooltip:c.map(d=>d.title??`missing: ${d.slug}`).join(", ")})}return{annotationsBySlug:s,dependenciesBySlug:r}},[t,n])}let zn={hasActiveSession:!1,isAgentBuilding:!1,stepStateFeature:null};function Qr(t){zn={...zn,...t}}function v5(){return zn}function j5(){return zn.hasActiveSession||zn.isAgentBuilding||!!zn.stepStateFeature}const w5=500;async function _5(){var t;try{const n=await fetch("/api/config");if(!n.ok)return!0;const s=await n.json();return((t=s==null?void 0:s.providerAuth)==null?void 0:t.state)==="authenticated"}catch{return!0}}async function el(){let t=!1,n;try{const s=await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})});n=s.status,s.ok&&(t=!0)}catch{}t&&Qr({hasActiveSession:!1,isAgentBuilding:!1,stepStateFeature:null}),se("clear-editor-session",{ok:t,...n!==void 0?{status:n}:{},snapshotReset:t})}async function k5(){let t=!1,n;try{const s=await fetch("/api/stop-building",{method:"POST",headers:{"Content-Type":"application/json"}});n=s.status,s.ok&&(t=!0)}catch{}t&&Qr({hasActiveSession:!1,isAgentBuilding:!1,stepStateFeature:null}),se("stop-building",{ok:t,...n!==void 0?{status:n}:{},snapshotReset:t})}async function S5(){let t=!1,n;try{const s=await fetch("/api/reset-everything",{method:"POST",headers:{"Content-Type":"application/json"}});n=s.status,s.ok&&(t=!0)}catch{}t&&Qr({hasActiveSession:!1,isAgentBuilding:!1,stepStateFeature:null}),se("reset-everything",{ok:t,...n!==void 0?{status:n}:{},snapshotReset:t})}async function tl(t={}){const n=v5(),s=t.caller??"unknown",r=t.bypassLiveGuard===!0;if(j5()&&!r){se("launch-editor-skill",{caller:s,suppressed:!0,snapshot:n,bypassLiveGuard:!1});return}P2(),se("launch-editor-skill",{caller:s,suppressed:!1,snapshot:n,bypassLiveGuard:r}),!(t.provider==="gemini"||t.provider==="opencode")&&(Xf(t.renameLabel??"Editor",s,gd),Da("/clear\r"),await new Promise(a=>setTimeout(()=>{Da("/codeyam-editor\r"),a()},w5)))}async function N5(t={}){if(await el(),!await _5()){se("launch-editor-skill",{caller:t.caller??"unknown",suppressed:!0,reason:"provider-not-authenticated"}),console.warn("[launchEditorWorkflow] provider not authenticated; aborting launch (the terminal gate would refuse the PTY).");return}await tl(t)}function nl(t,n=!1,s=n){const r=m_(t),a=n&&r==="build"?"home":r,[o,i]=l.useState(a==="build"),[c,d]=l.useState(a==="plan");l.useEffect(()=>{a==="build"&&i(!0),a==="plan"&&d(!0)},[a]),l.useEffect(()=>{s&&r==="build"&&window.history.replaceState(null,"",Dn("home"))},[s,r]);const u=l.useCallback(f=>{if(n&&f==="build"){window.history.pushState(null,"",Dn("home"));return}window.history.pushState(null,"",Dn(f)),f==="build"&&i(!0),f==="plan"&&d(!0)},[n]),h=l.useCallback(()=>{n||(window.history.pushState(null,"",Dn("build")),i(!0))},[n]),p=l.useCallback(()=>{i(!1)},[]);return{activeTab:a,buildActivated:o,planActivated:c,navigateToTab:u,showBuildTab:h,deactivateBuild:p}}const C5=15e3;function Ub(t={}){const{launchAnchored:n=!1}=t,{showBuildTab:s}=nl(typeof window>"u"?"/":window.location.pathname),{config:r}=_t(),[a,o]=l.useState(null),[i,c]=l.useState(null),d=l.useRef(null),u=l.useCallback(()=>{d.current!==null&&(clearTimeout(d.current),d.current=null)},[]),h=l.useCallback(()=>{u(),o(null)},[u]);l.useEffect(()=>{a!==null&&n&&h()},[a,n,h]),l.useEffect(()=>u,[u]);const p=l.useCallback(async(f,m)=>{if(a)return!1;c(null),o(f);try{try{await el(),$C()}catch{}const g=await fetch(`/api/plans/${encodeURIComponent(f)}/select`,{method:"POST"});if(!g.ok){let b=`HTTP ${g.status}`;try{const x=await g.json();x!=null&&x.error&&(b=x.error)}catch{}throw new Error(b)}s()}catch(g){return c(g instanceof Error?g.message:"Failed to launch plan"),h(),!1}return u(),d.current=setTimeout(()=>{d.current=null,o(null)},C5),tl({caller:"plan-launcher",renameLabel:m,provider:r==null?void 0:r.provider,bypassLiveGuard:!0}).catch(g=>{c(g instanceof Error?g.message:"Failed to launch plan")}),!0},[a,s,r==null?void 0:r.provider,h,u]);return{launchingSlug:a,error:i,launchPlan:p}}function Yb({onClose:t}){const n=s=>{s.target===s.currentTarget&&t()};return e.jsx("div",{"data-testid":"plan-run-blocked-modal",onClick:n,className:"absolute inset-0 z-10 flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Build in progress"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:Md}),e.jsx("div",{className:"flex flex-col gap-3",children:e.jsx("button",{onClick:t,"data-testid":"plan-run-blocked-ok",className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"var(--accent-active)",color:"var(--bg-deep)"},type:"button",children:"OK"})})]})})}const w7=Object.freeze(Object.defineProperty({__proto__:null,PlanRunBlockedModal:Yb},Symbol.toStringTag,{value:"Module"}));function Vb({deps:t,onClose:n}){const s=r=>{r.target===r.currentTarget&&n()};return e.jsx("div",{"data-testid":"plan-run-dependencies-modal",onClick:s,className:"absolute inset-0 z-10 flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Prerequisite plans not yet built"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:"This plan depends on the following changes that have not yet been built. Run them first, then come back to this one."}),e.jsx("ul",{className:"flex flex-col gap-1.5 mb-4",children:t.map(r=>e.jsx("li",{"data-testid":`plan-dep-${r.slug}`,className:"text-sm text-[var(--text-primary)]",children:r.title===null?e.jsxs("span",{className:"text-[var(--text-muted)]",children:["missing: ",r.slug," — was the prerequisite plan deleted?"]}):r.title},r.slug))}),e.jsx("div",{className:"flex flex-col gap-3",children:e.jsx("button",{onClick:n,"data-testid":"plan-run-dependencies-ok",className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"var(--accent-active)",color:"var(--bg-deep)"},type:"button",children:"OK"})})]})})}const _7=Object.freeze(Object.defineProperty({__proto__:null,PlanRunDependenciesModal:Vb},Symbol.toStringTag,{value:"Module"}));function Kb({claim:t,onCancel:n,onConfirm:s}){const r=Wn(),a=t.claimedBy.agentProvider??"agent",o=t.claimedBy.currentStep??"unknown",i=t.sessionAlive===!1,c=i?"Previous session (no longer running)":"Another session is working on this plan",d=i?"Reclaim and run":"Run anyway";l.useEffect(()=>{const h=p=>{p.key==="Escape"&&n()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n]);const u=h=>{h.target===h.currentTarget&&n()};return e.jsx("div",{"data-testid":"plan-run-foreign-claim-modal",onClick:u,className:"absolute inset-0 z-10 flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{"data-testid":"plan-foreign-claim-heading",className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:c}),e.jsxs("div",{className:"text-sm text-[var(--text-muted)] mb-4 flex flex-col gap-1",children:[e.jsxs("span",{"data-testid":"plan-foreign-claim-identity",children:["claimed by ",a,"@",t.claimedBy.machine]}),e.jsxs("span",{children:["started ",yn(t.claimedBy.startedAt,r)]}),e.jsxs("span",{"data-testid":"plan-foreign-claim-step",children:["on step ",o," (",yn(t.currentStepEnteredAt,r)," on step)"]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:n,"data-testid":"plan-run-foreign-claim-cancel",className:"flex-1 px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"var(--bg-elevated, transparent)",border:"1px solid var(--border-default)",color:"var(--text-primary)"},type:"button",children:"Cancel"}),e.jsx("button",{onClick:s,"data-testid":"plan-run-foreign-claim-confirm",className:"flex-1 px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"var(--accent-warn, #c08a2c)",color:"var(--bg-deep)"},type:"button",children:d})]})]})})}const k7=Object.freeze(Object.defineProperty({__proto__:null,PlanRunForeignClaimModal:Kb},Symbol.toStringTag,{value:"Module"}));function Zr({dependenciesBySlug:t,claimsBySlug:n,isAgentBuilding:s=!1,onLaunch:r}){const[a,o]=l.useState(!1),[i,c]=l.useState(null),[d,u]=l.useState(null),h=m=>{if(s){o(!0);return}const g=Gb(t[m]??[]);if(g.length>0){c(g);return}const b=n.get(m);if(b&&b.source!=="local"){u(b);return}r(m)},p=()=>{const m=d;if(m){if(u(null),m.sessionAlive===!1){fetch(`/api/plan-claims/${encodeURIComponent(m.slug)}/reclaim`,{method:"POST"}).catch(()=>{}).finally(()=>r(m.slug));return}r(m.slug)}},f=e.jsxs(e.Fragment,{children:[a&&e.jsx(Yb,{onClose:()=>o(!1)}),i&&e.jsx(Vb,{deps:i,onClose:()=>c(null)}),d&&e.jsx(Kb,{claim:d,onCancel:()=>u(null),onConfirm:p})]});return{requestRun:h,gateModals:f}}const Jb="codeyam.";function P5(t){try{const n=window.sessionStorage.getItem(Jb+t);if(n===null)return null;const s=Number.parseInt(n,10);return Number.isInteger(s)&&s>=0?s:null}catch{return null}}function T5(t,n){try{window.sessionStorage.setItem(Jb+t,String(n))}catch{}}function Mc(t,n,s=3){const r=l.useRef(void 0);return r.current===void 0&&(r.current=P5(t)),l.useEffect(()=>{n!==null&&T5(t,n)},[t,n]),r.current??s}function Xb(t){return{reorderPlans:l.useCallback(async s=>{const r=await fetch("/api/plans/reorder",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slugs:s})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error??`HTTP ${r.status}`)}t==null||t()},[t])}}function O5(t){return`${t} will remember your plans and suggest them once the current building session is over.`}function Qb({providerLabel:t}){return e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-[var(--text-primary)]",children:"Plan your next move"}),e.jsx("p",{className:"mt-1 text-sm text-[var(--text-dim)]",children:O5(t)})]})}const S7=Object.freeze(Object.defineProperty({__proto__:null,PlanTabHeader:Qb},Symbol.toStringTag,{value:"Module"})),A5=[{id:"describe",label:"Plan"},{id:"prototype",label:"Prototype",help:"Plan writes down what to build and saves it for later, without touching code. Prototype builds it for real with the agent now — when it looks right, you formalize it into Build to decompose, test, and ship."}];function Zb({active:t,onChange:n}){const[s,r]=l.useState(null);return e.jsx("div",{className:"mt-3 flex items-center gap-1 border-b border-[var(--border-subtle)]",role:"tablist","data-testid":"plan-sub-tabs",children:A5.map(a=>{const o=a.id===t,i=e.jsxs("button",{type:"button",role:"tab","aria-selected":o,"data-testid":`plan-sub-tab-${a.id}`,onClick:()=>n(a.id),className:"px-2.5 py-2 text-xs uppercase tracking-wide transition-colors cursor-pointer border-b -mb-px inline-flex items-center gap-1.5 "+(o?"text-[var(--text-primary)] border-[var(--text-primary)] font-medium":"text-[var(--text-dim)] border-transparent hover:text-[var(--text-primary)] font-normal"),children:[a.label,a.help&&e.jsx("span",{"data-testid":`plan-sub-tab-help-${a.id}`,"aria-label":a.help,onMouseEnter:()=>r(a.id),onMouseLeave:()=>r(c=>c===a.id?null:c),className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-full bg-[var(--text-dim)] text-[9px] leading-none text-[var(--bg-deep)] normal-case",children:"?"})]},a.id);return a.help?e.jsxs("span",{className:"relative inline-flex",children:[i,s===a.id&&e.jsx("span",{role:"tooltip",id:`plan-sub-tab-tip-${a.id}`,"data-testid":`plan-sub-tab-tooltip-${a.id}`,className:"pointer-events-none absolute left-0 top-full z-20 mt-1 w-72 rounded-md border border-[var(--border-default)] bg-[var(--bg-card)] px-3 py-2 text-xs normal-case tracking-normal text-[var(--text-primary)] shadow-lg",children:a.help})]},a.id):i})})}const N7=Object.freeze(Object.defineProperty({__proto__:null,PlanSubTabs:Zb},Symbol.toStringTag,{value:"Module"})),ex="/codeyam-plan",tx="/codeyam-prototype";function R5(t,n){const s=n.replace(/\s+/g," ").trim();return s?`${t} ${s}`:t}function nx(t,n=""){const[s,r]=l.useState(n),[a,o]=l.useState(null);return{draft:s,setDraft:r,seededCommand:a,open:()=>o(R5(t,s)),close:()=>o(null)}}function sx({onClose:t,slashCommand:n}){return e.jsx(wn,{chatName:"prototype",slashCommand:n??tx,height:480,onClose:t})}const C7=Object.freeze(Object.defineProperty({__proto__:null,PrototypeAgentChat:sx},Symbol.toStringTag,{value:"Module"})),rx="Building is in-process. Prototyping is only available when building is not ongoing. Please wait for the current building session to complete before prototyping.";function ax(){return e.jsxs("div",{"data-testid":"prototype-building-banner",className:"mt-3 rounded border px-4 py-3 text-sm",style:{background:"var(--bg-surface)",borderColor:"var(--border-default)",color:"var(--text-muted)"},children:[e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:"Build in progress."})," ",rx]})}const P7=Object.freeze(Object.defineProperty({__proto__:null,PROTOTYPE_BUILDING_IN_PROGRESS_MESSAGE:rx,PrototypeBuildingInProgressBanner:ax},Symbol.toStringTag,{value:"Module"}));function co({open:t,disabled:n=!1,onToggle:s}){const r="mt-3 inline-flex items-center gap-3 rounded-lg px-4 py-2.5 text-sm font-medium transition-opacity",a=n?"border border-[var(--border-default)] text-[var(--text-dim)] cursor-not-allowed":"bg-[var(--accent-active)] text-[var(--text-on-accent)] hover:opacity-90 cursor-pointer";return e.jsxs("button",{type:"button",onClick:n?void 0:s,disabled:n,"aria-disabled":n,title:n?"Building is in progress.":void 0,"data-testid":"start-prototyping",className:`${r} ${a}`,children:[t?"Close Prototype":"Start Prototyping",!t&&!n&&e.jsx("span",{"aria-hidden":"true",className:"text-base leading-none",children:"↓"})]})}const T7=Object.freeze(Object.defineProperty({__proto__:null,StartPrototypingButton:co},Symbol.toStringTag,{value:"Module"})),uo=800;function hs(t){window.dispatchEvent(new CustomEvent("miniagent-send-input",{detail:t}))}function E5(t){return new Promise(n=>{let s=!1;const r=()=>{s||(s=!0,window.removeEventListener("miniagent-output",r),clearTimeout(a),n())},a=setTimeout(r,t);window.addEventListener("miniagent-output",r,{once:!0})})}const ox='The user has clicked "Finish and Formalize in Build". Stop prototyping. Write the plan BODY describing what was prototyped to a scratch file, then create the plan with `codeyam-editor editor plan-create --title "<feature name>" --mode ui --step 11 --source prototype --body-file <path>` (backend mode: `--mode backend --step 8`). Do NOT write the plan file yourself and do NOT hand-author frontmatter — plan-create derives the slug and stamps `createdAt`, which you have no clock to guess. It prints the path it wrote; take the slug from there and run `codeyam-editor editor launch-plan <slug>` to switch the UI to the Build tab, then output "Done — opening Build to finalize." and stop.';function ix({disabled:t=!1,onClick:n}={}){const[s,r]=l.useState(!1),a=l.useRef(!1),o=async()=>{if(!(t||a.current)){a.current=!0,r(!0);try{hs(ox),await E5(uo),hs("\r"),n==null||n()}finally{a.current=!1,r(!1)}}},i=t||s;return e.jsx("button",{type:"button",onClick:o,disabled:i,"data-testid":"finish-and-formalize",className:"mt-3 inline-flex items-center gap-2 rounded border px-3 py-1.5 text-xs font-medium uppercase tracking-wide transition-colors "+(i?"border-[var(--border-default)] text-[var(--text-dim)] cursor-not-allowed":"border-[var(--accent-active)] text-[var(--accent-active)] hover:bg-[var(--accent-active)] hover:text-black cursor-pointer"),children:"Finish and Formalize in Build"})}const O7=Object.freeze(Object.defineProperty({__proto__:null,FINISH_AND_FORMALIZE_INSTRUCTION:ox,FinishAndFormalizeButton:ix},Symbol.toStringTag,{value:"Module"}));function lx(t,n){return`Launches a chat window with ${t} to ${n==="describe"?"describe your plan":"start prototyping"}.`}function cx({providerLabel:t,kind:n}){return e.jsx("p",{className:"mt-2 text-xs text-[var(--text-dim)]","data-testid":`plan-chat-launch-caption-${n}`,children:lx(t,n)})}const A7=Object.freeze(Object.defineProperty({__proto__:null,PlanChatLaunchCaption:cx,planChatLaunchCaptionText:lx},Symbol.toStringTag,{value:"Module"}));function dx({isAgentBuilding:t,onLaunched:n,launchSignal:s=0,initialDraft:r=""}){const[a,o]=l.useState(!1),i=nx(tx,r),[c,d]=l.useState(!1),{config:u}=_t(),h=at(u==null?void 0:u.provider),p=l.useRef(n);p.current=n;const f=l.useRef(s);l.useEffect(()=>{var b;s!==f.current&&(f.current=s,d(!1),o(!1),(b=p.current)==null||b.call(p))},[s]);const m=()=>{if(t)return;const b=!a;b&&(i.open(),lt()),o(b)},g=()=>{i.close(),o(!1)};return t?e.jsxs("div",{"data-testid":"prototype-pane",children:[e.jsx(ax,{}),e.jsx(co,{open:!1,disabled:!0,onToggle:()=>{}})]}):e.jsxs("div",{"data-testid":"prototype-pane",children:[!a&&e.jsx(Uo,{value:i.draft,onChange:i.setDraft,testId:"prototype-describe-input",placeholder:"Describe what you want to prototype"}),e.jsx(co,{open:a,onToggle:m}),!a&&e.jsx(cx,{providerLabel:h,kind:"prototype"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(sx,{onClose:g,slashCommand:i.seededCommand??void 0}),e.jsx(ix,{disabled:c,onClick:()=>d(!0)}),c&&e.jsx("p",{className:"mt-2 text-xs text-[var(--text-dim)]","data-testid":"prototype-awaiting-formalize",children:"Waiting for the agent to write the plan file…"})]})]})}const R7=Object.freeze(Object.defineProperty({__proto__:null,PrototypePane:dx},Symbol.toStringTag,{value:"Module"}));function ux({open:t,onToggle:n}){return e.jsxs("button",{type:"button",onClick:n,className:"mt-3 inline-flex items-center gap-3 rounded-lg bg-[var(--accent-active)] px-4 py-2.5 text-sm font-medium text-[var(--text-on-accent)] transition-opacity hover:opacity-90 cursor-pointer","data-testid":"plan-next-change",children:[t?"Close Planner":"Plan Next Change",!t&&e.jsx("span",{"aria-hidden":"true",className:"text-base leading-none",children:"↓"})]})}const E7=Object.freeze(Object.defineProperty({__proto__:null,PlanNextChangeButton:ux},Symbol.toStringTag,{value:"Module"}));function hx({onClose:t,slashCommand:n=ex}){return e.jsx(wn,{chatName:"plan",slashCommand:n,height:360,onClose:t})}const M7=Object.freeze(Object.defineProperty({__proto__:null,PlanAuthoringChat:hx},Symbol.toStringTag,{value:"Module"}));function px({chatOpen:t,onChatToggle:n,onChatClose:s,initialDraft:r=""}){const a=nx(ex,r),o=()=>{t||a.open(),n()},i=()=>{a.close(),s()};return e.jsxs("div",{"data-testid":"describe-pane",children:[!t&&e.jsx(Uo,{value:a.draft,onChange:a.setDraft,testId:"plan-describe-input"}),e.jsx(ux,{open:t,onToggle:o}),t&&e.jsx(hx,{onClose:i,slashCommand:a.seededCommand??void 0})]})}const I7=Object.freeze(Object.defineProperty({__proto__:null,DescribePane:px},Symbol.toStringTag,{value:"Module"}));function mx({claim:t}){const n=Wn(),s=t.claimedBy.agentProvider??"agent",r=t.claimedBy.machine,a=t.claimedBy.currentStep??null,o=yn(t.currentStepEnteredAt,n),i=yn(t.claimedBy.startedAt,n),{dead:c}=Rd(t);return e.jsxs("li",{className:"flex flex-col gap-1 rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-surface,transparent)] px-3 py-2","data-testid":`in-flight-row-${t.slug}`,"data-session-alive":c?"false":void 0,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm text-[var(--text-default)]",children:t.title}),e.jsx(Bo,{testId:`in-flight-source-${t.slug}`,children:t.source})]}),e.jsx(Od,{slug:t.slug,identity:`${s}@${r}`,step:a?`step ${a} · ${o} on step`:null,age:i,dead:c})]})}const D7=Object.freeze(Object.defineProperty({__proto__:null,InFlightPlanRow:mx},Symbol.toStringTag,{value:"Module"}));function fx({claims:t}){const[n,s]=l.useState(!1);return t.length===0?null:e.jsxs("div",{className:"mt-5 border-t border-[var(--border-subtle)] pt-5","data-testid":"in-flight-section",children:[e.jsx(ws,{title:"In Flight",count:t.length,expanded:n,onToggle:()=>s(r=>!r),testId:"in-flight-header"}),n&&e.jsx("ul",{className:"mt-3 flex flex-col gap-2","data-testid":"in-flight-list",children:t.map(r=>e.jsx(mx,{claim:r},`${r.slug}:${r.claimedBy.machine}:${r.claimedBy.sessionId}:${r.claimedBy.pid}:${r.claimedBy.startedAt}`))})]})}const L7=Object.freeze(Object.defineProperty({__proto__:null,InFlightSection:fx},Symbol.toStringTag,{value:"Module"})),M5=5e3;function I5(){const[t,n]=l.useState([]),[s,r]=l.useState(null),[a,o]=l.useState(null),[i,c]=l.useState(!0),[d,u]=l.useState(null),h=l.useRef(!1),p=l.useCallback(async()=>{c(!0),u(null);try{const g=await fetch("/api/branch-queue/status");if(!g.ok)throw new Error(`HTTP ${g.status}`);const b=await g.json();if(h.current)return;n(Array.isArray(b.entries)?b.entries:[]),r(b.branch??null),o(b.remote??null)}catch(g){if(h.current)return;u(g instanceof Error?g.message:"Failed to load branch queue"),n([])}finally{h.current||c(!1)}},[]);l.useEffect(()=>{h.current=!1,p();const g=setInterval(()=>{p()},M5);return()=>{h.current=!0,clearInterval(g)}},[p]);const f=l.useCallback(async(g,b,x)=>{const y={uuid:g,priority:b};typeof x=="number"&&(y.expectedPriority=x);const v=await fetch("/api/branch-queue/set-priority",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(y)});if(!v.ok){const w=await v.text().catch(()=>"");throw new Error(`set-priority ${v.status}: ${w}`)}await p()},[p]),m=l.useCallback(async g=>{const b=await fetch("/api/branch-queue/release",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({uuid:g})});if(!b.ok){const x=await b.text().catch(()=>"");throw new Error(`release ${b.status}: ${x}`)}await p()},[p]);return{entries:t,branch:s,remote:a,loading:i,error:d,setPriority:f,release:m,refetch:p}}function D5(){const[t,n]=l.useState(null),[s,r]=l.useState(null),a=l.useCallback(c=>{n(c)},[]),o=l.useCallback(c=>{r(c)},[]),i=l.useCallback(()=>{n(null),r(null)},[]);return{dragSourceUuid:t,dragOverUuid:s,beginDrag:a,hoverOver:o,reset:i}}function L5(t,n){const s=new Map(n.map(i=>[i.uuid,i])),r=[],a=new Set;for(const i of t.order){const c=s.get(i.uuid);c&&(r.push(c),a.add(i.uuid))}for(const i of n)a.has(i.uuid)||(r.push(i),a.add(i.uuid));const o=new Set;for(const i of t.releasedUuids)s.has(i)&&o.add(i);return{order:r,releasedUuids:o}}const F5=new Set;function Oa(t,n){return t??{order:[...n],releasedUuids:new Set}}function z5(){const[t,n]=l.useState(null),s=l.useCallback(h=>t?t.order:h,[t]),r=l.useCallback((h,p,f)=>{n(m=>{const g=Oa(m,f),b=g.order.findIndex(y=>y.uuid===h),x=g.order.findIndex(y=>y.uuid===p);return b===-1||x===-1||b===x?g:{...g,order:vs(g.order,b,x)}})},[]),a=l.useCallback((h,p,f)=>{n(m=>{const g=Oa(m,f),b=g.order.findIndex(y=>y.uuid===h);if(b===-1)return g;const x=b-p;return x<0||x>=g.order.length?g:{...g,order:vs(g.order,b,x)}})},[]),o=l.useCallback((h,p)=>{n(f=>{const m=Oa(f,p),g=new Set(m.releasedUuids);return g.has(h)?g.delete(h):g.add(h),{...m,releasedUuids:g}})},[]),i=l.useCallback(h=>{n(p=>p?L5(p,h):null)},[]),c=l.useCallback(()=>n(null),[]),d=l.useCallback(h=>t?t.releasedUuids.size>0||t.order.length!==h.length?!0:t.order.some((p,f)=>{var m;return p.uuid!==((m=h[f])==null?void 0:m.uuid)}):!1,[t]),u=l.useCallback(h=>{var b,x;if(!t)return 0;const p=t.releasedUuids,f=h.filter(y=>!p.has(y.uuid)),m=t.order.filter(y=>!p.has(y.uuid));let g=0;for(let y=0;y<m.length;y++)((b=m[y])==null?void 0:b.uuid)!==((x=f[y])==null?void 0:x.uuid)&&g++;return g},[t]);return{isActive:t!==null,displayEntries:s,releasedUuids:(t==null?void 0:t.releasedUuids)??F5,isDirty:d,reorderedCount:u,releasedCount:(t==null?void 0:t.releasedUuids.size)??0,moveByDrag:r,nudge:a,toggleRelease:o,reconcile:i,reset:c}}const $5=10;function B5(t,n,s){const r=new Map(s.map(d=>[d.uuid,d])),a=s.filter(d=>n.has(d.uuid)).map(d=>d.uuid),o=t.filter(d=>!n.has(d.uuid)),i=o.length,c=[];return o.forEach((d,u)=>{const h=r.get(d.uuid);if(!h)return;const p=(i-u)*$5;h.meta.priority!==p&&c.push({uuid:d.uuid,priority:p,expectedPriority:h.meta.priority})}),{releases:a,priorities:c}}function gx({priority:t,uuid:n,onNudge:s}){const r=t===0?"priority 0":t>0?`priority +${t}`:`priority ${t}`;return e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] rounded border border-[var(--border-subtle)] px-2 py-1 text-[var(--text-muted)]","data-testid":`commit-queue-priority-chip-${n}`,children:[e.jsx("button",{type:"button",className:"text-[var(--text-dim)] hover:text-[var(--text-default)] px-0.5","data-testid":`commit-queue-nudge-down-${n}`,onClick:()=>void s(-1),"aria-label":"Lower priority",children:"−"}),e.jsx("span",{"data-testid":`commit-queue-priority-value-${n}`,children:r}),e.jsx("button",{type:"button",className:"text-[var(--text-dim)] hover:text-[var(--text-default)] px-0.5","data-testid":`commit-queue-nudge-up-${n}`,onClick:()=>void s(1),"aria-label":"Raise priority",children:"+"})]})}const F7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueuePriorityChip:gx},Symbol.toStringTag,{value:"Module"}));function bx({uuid:t,markedForRelease:n,onToggle:s}){return n?e.jsx("button",{type:"button",className:"text-xs px-2 py-1 rounded border border-[var(--border-subtle)] text-[var(--text-dim)] hover:text-[var(--text-default)] cursor-pointer","data-testid":`commit-queue-undo-release-${t}`,onClick:s,title:"Keep this entry in the queue",children:"Undo remove"}):e.jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-1 rounded border border-[var(--border-subtle)] text-[var(--text-dim)] hover:border-[var(--accent-danger)] hover:text-[var(--accent-danger)] cursor-pointer","data-testid":`commit-queue-release-${t}`,onClick:s,title:"Mark this entry for removal",children:"Force release"})}const z7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueueReleaseButton:bx},Symbol.toStringTag,{value:"Module"}));function xx({entry:t,isHead:n}){const s=Wn(),r=t.meta.agentProvider??"agent",a=t.meta.machine,o=t.meta.currentStep??null,i=yn(t.meta.startedAt??t.committerDate,s);return e.jsxs("div",{className:"flex-1 flex flex-col gap-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium text-[var(--text-default)] truncate",children:[r,"@",a]}),n&&e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[var(--accent-strong)]","data-testid":`commit-queue-head-marker-${t.uuid}`,children:"← head"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--text-muted)]",children:[o&&e.jsxs("span",{"data-testid":`commit-queue-step-${t.uuid}`,children:["step ",o]}),e.jsxs("span",{"data-testid":`commit-queue-started-${t.uuid}`,children:["started ",i]}),e.jsxs("span",{"data-testid":`commit-queue-pid-${t.uuid}`,children:["pid ",t.meta.pid]})]})]})}const $7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueueRowIdentity:xx},Symbol.toStringTag,{value:"Module"}));function yx({entry:t,position:n,isHead:s,markedForRelease:r,onPriorityNudge:a,onToggleRelease:o,onDragStart:i,onDragOver:c,onDrop:d,isDragging:u,isDragOver:h}){return e.jsxs("li",{"data-testid":`commit-queue-row-${t.uuid}`,draggable:!0,onDragStart:p=>{p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",t.uuid),i()},onDragOver:p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",c()},onDrop:p=>{p.preventDefault(),d()},"data-marked-for-release":r||void 0,className:`group flex items-center gap-3 rounded border px-3 py-2 ${s?"border-[var(--accent-strong)]":"border-[var(--border-subtle)]"} ${u?"opacity-40":""} ${h?"ring-2 ring-[var(--accent-strong)]":""} ${r?"opacity-50 line-through":""}`,children:[e.jsx("span",{"aria-hidden":!0,className:"cursor-grab select-none text-[var(--text-dim)] hover:text-[var(--text-default)]",title:"Drag to reorder","data-testid":`commit-queue-drag-${t.uuid}`,children:"⋮⋮"}),e.jsxs("span",{className:"text-xs font-mono text-[var(--text-dim)] w-6 text-right","data-testid":`commit-queue-position-${t.uuid}`,children:[n,"."]}),e.jsx(xx,{entry:t,isHead:s}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(gx,{priority:t.meta.priority,uuid:t.uuid,onNudge:a}),e.jsx(bx,{uuid:t.uuid,markedForRelease:r,onToggle:o})]})]})}const B7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueueRow:yx},Symbol.toStringTag,{value:"Module"}));function vx({reorderedCount:t,releasedCount:n,saving:s,onSave:r,onCancel:a}){const o=[];t>0&&o.push(`${t} reordered`),n>0&&o.push(`${n} to remove`);const i=o.join(" · ")||"Unsaved changes";return e.jsxs("div",{"data-testid":"commit-queue-save-bar",className:"mt-3 flex items-center justify-between gap-3 border-t border-[var(--accent-strong)] pt-3",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]","data-testid":"commit-queue-save-summary",children:i}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","data-testid":"commit-queue-cancel",onClick:a,disabled:s,className:"text-xs px-3 py-1 rounded border border-[var(--border-subtle)] text-[var(--text-dim)] hover:text-[var(--text-default)] disabled:opacity-50 cursor-pointer",children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"commit-queue-save",onClick:r,disabled:s,className:"text-xs px-3 py-1 rounded bg-[var(--accent-strong)] font-medium text-white hover:opacity-90 disabled:opacity-50 cursor-pointer",children:s?"Saving…":"Save"})]})]})}const q7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueueSaveBar:vx},Symbol.toStringTag,{value:"Module"}));function jx({entriesOverride:t,branchOverride:n}={}){const s=I5(),r=t!==void 0,a=t??s.entries,o=n??s.branch,i=D5(),c=z5(),{reconcile:d}=c,[u,h]=l.useState(null),[p,f]=l.useState(!0),[m,g]=l.useState(!1);if(l.useEffect(()=>{r||d(a)},[a,d,r]),!r&&s.loading&&a.length===0||a.length===0)return null;const b=c.displayEntries(a),x=c.isDirty(a),y=k=>{var T;const S=i.dragSourceUuid,N=(T=b[k])==null?void 0:T.uuid;i.reset(),!(S===null||!N||S===N)&&c.moveByDrag(S,N,a)},v=(k,S)=>{c.nudge(k.uuid,S,a)},w=k=>{c.toggleRelease(k.uuid,a)},j=()=>{h(null),c.reset()},_=async()=>{const{releases:k,priorities:S}=B5(b,new Set(c.releasedUuids),a);h(null),g(!0);try{if(!r){for(const N of k)await s.release(N);for(const N of S)await s.setPriority(N.uuid,N.priority,N.expectedPriority);await s.refetch()}c.reset()}catch(N){h(N instanceof Error?N.message:"Failed to save changes")}finally{g(!1)}};return e.jsxs("div",{className:"mt-6 border-t border-[var(--border-subtle)] pt-4","data-testid":"commit-queue-section",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(ws,{title:"Commit Queue",count:b.length,expanded:p,onToggle:()=>f(k=>!k),testId:"commit-queue-header"}),o&&e.jsx("span",{className:"text-[11px] text-[var(--text-dim)]","data-testid":"commit-queue-branch",children:o})]}),u&&e.jsx("div",{className:"mt-2","data-testid":"commit-queue-error",children:e.jsx(Qe,{text:u,className:"text-xs text-[var(--accent-danger)]"})}),p&&e.jsx("ol",{className:"mt-3 flex flex-col gap-2","data-testid":"commit-queue-list",children:b.map((k,S)=>e.jsx(yx,{entry:k,position:S+1,isHead:S===0,markedForRelease:c.releasedUuids.has(k.uuid),onPriorityNudge:N=>v(k,N),onToggleRelease:()=>w(k),onDragStart:()=>i.beginDrag(k.uuid),onDragOver:()=>i.hoverOver(k.uuid),onDrop:()=>y(S),isDragging:i.dragSourceUuid===k.uuid,isDragOver:i.dragOverUuid===k.uuid&&i.dragSourceUuid!==k.uuid},k.uuid))}),x&&e.jsx(vx,{reorderedCount:c.reorderedCount(a),releasedCount:c.releasedCount,saving:m,onSave:_,onCancel:j})]})}const H7=Object.freeze(Object.defineProperty({__proto__:null,CommitQueueSection:jx},Symbol.toStringTag,{value:"Module"}));function q5(t){const[n,s]=l.useState(null),[r,a]=l.useState(!0),[o,i]=l.useState(null);return l.useEffect(()=>{let c=!1;return(async()=>{a(!0),i(null);try{const d=new Date(new Date(t).getTime()-1).toISOString(),u=await fetch(`/api/journal?since=${encodeURIComponent(d)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);const p=((await u.json()).entries??[]).find(f=>f.timestamp===t)??null;c||s(p)}catch(d){c||(s(null),i(d instanceof Error?d.message:"Failed to load journal entry"))}finally{c||a(!1)}})(),()=>{c=!0}},[t]),{entry:n,loading:r,error:o}}function wx({journalTimestamp:t}){const{entry:n,loading:s,error:r}=q5(t);return s?e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Loading journal entry…"}):r?e.jsx(Qe,{text:`Failed to load journal entry: ${r}`,className:"text-sm text-[var(--accent-red)]"}):n?e.jsx(Gr,{entry:n}):e.jsx("p",{className:"text-sm text-[var(--text-dim)]",children:"No journal entry found for this plan yet."})}const W7=Object.freeze(Object.defineProperty({__proto__:null,CompletedPlanExpandedBody:wx},Symbol.toStringTag,{value:"Module"})),Ic=160;function H5(t){if(!t)return"";let n=!1;for(const s of t.split(`
|
|
47
|
+
`)){const r=s.trim();if(r.startsWith("```")){n=!n;continue}if(n||!r||/^(#{1,6}\s|[-*+]\s|>\s|\||---$)/.test(r))continue;const a=r.replace(/`([^`]*)`/g,"$1").replace(/\*\*([^*]*)\*\*/g,"$1").replace(/\*([^*]*)\*/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").trim();if(a)return a.length>Ic?`${a.slice(0,Ic).trimEnd()}…`:a}return""}function _x({plan:t,expanded:n,onToggle:s,author:r}){const a=H5(t.body);return e.jsxs("li",{className:"border border-[var(--border-subtle)] rounded-lg bg-[var(--bg-surface,transparent)]",children:[e.jsxs("button",{type:"button",onClick:s,className:"w-full text-left px-3 py-2 flex items-center justify-between gap-3 bg-transparent cursor-pointer","data-testid":"completed-plan-row",children:[r&&e.jsx(Go,{author:r}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx(Wo,{title:t.title,timestamp:t.completedAt,tone:"muted"}),a&&e.jsx("span",{className:"mt-0.5 block truncate text-xs text-[var(--text-dim)]","data-testid":`completed-plan-excerpt-${t.slug}`,children:a})]}),e.jsx(qo,{mode:t.mode}),e.jsx(Ho,{expanded:n,testId:"completed-plan-row-chevron"})]}),n&&e.jsx("div",{className:"px-3 py-2 border-t border-[var(--border-subtle)]","data-testid":"completed-plan-row-body",children:e.jsx(wx,{journalTimestamp:t.journalTimestamp})})]})}const G7=Object.freeze(Object.defineProperty({__proto__:null,CompletedPlanRow:_x},Symbol.toStringTag,{value:"Module"}));function kx({plans:t,loading:n,error:s,showAuthors:r=!1,skeletonCount:a=3}){const[o,i]=l.useState(null),[c,d]=l.useState(!1),h=n&&t.length===0?a:t.length;return e.jsxs("div",{className:"mt-5 border-t border-[var(--border-subtle)] pt-5",children:[e.jsx(ws,{title:"Completed Plans",count:h,expanded:c,onToggle:()=>d(p=>!p),testId:"completed-plans-header"}),c&&e.jsx(Sx,{plans:t,loading:n,error:s,expandedSlug:o,onToggle:p=>i(f=>f===p?null:p),showAuthors:r,skeletonCount:a})]})}function Sx({plans:t,loading:n,error:s,expandedSlug:r,onToggle:a,showAuthors:o=!1,skeletonCount:i=3}){const c=s?e.jsx(Qe,{text:`Failed to load completed plans: ${s}`,className:"text-sm text-[var(--accent-red)]",rowClassName:"mt-3"}):null;return n&&t.length===0?e.jsx($o,{count:i,testId:"recent-plans-skeleton-list",label:"Loading completed plans"}):t.length===0?c:e.jsxs(e.Fragment,{children:[c,e.jsx("ul",{className:"mt-3 flex flex-col gap-2","data-testid":"recent-plans-list",children:t.map(d=>e.jsx(_x,{plan:d,expanded:r===d.slug,onToggle:()=>a(d.slug),author:o?d.author:void 0},d.slug))})]})}const U7=Object.freeze(Object.defineProperty({__proto__:null,RecentPlansBody:Sx,RecentPlansSection:kx},Symbol.toStringTag,{value:"Module"}));function Nx({chatOpen:t,onChatOpenChange:n,isActive:s=!0,isAgentBuilding:r=!1,launchingSlug:a,launchError:o,onLaunchPlan:i,initialSubTab:c="describe",prototypeLaunchSignal:d=0}={}){const{plans:u,loading:h,error:p,refetch:f}=zb(),{claims:m}=Ki(),{slugs:g}=Wb(),{status:b}=Ji(),{staleness:x}=f5(),y=((b==null?void 0:b.consecutiveFailures)??0)>=3,{plans:v,loading:w,error:j}=Hb(),_=Mc("plan-tab.queued-count",h?null:u.length),k=Mc("plan-tab.completed-count",w?null:v.length),{config:S}=_t(),N=at(S==null?void 0:S.provider),T=i!==void 0,A=Ub(),M=T?a??null:A.launchingSlug,C=T?o??null:A.error,[H,J]=l.useState(!1),Z=l.useMemo(()=>Qi(m),[m]),F=l.useMemo(()=>x5(m,g),[m,g]),$=l.useMemo(()=>qb([...u.map(D=>D.author),...v.map(D=>D.author)]),[u,v]),[P,I]=l.useState(c),B=t!==void 0,X=B?t:H,W=D=>{B||J(D),n==null||n(D)},ie=()=>{W(!1),f()},Q=()=>{const D=!X;D&<(),W(D)};l.useEffect(()=>{if(!(!s||!X))return lt()},[s,X]);const{annotationsBySlug:O,dependenciesBySlug:L}=Zi(u),q=D=>{var K;const z=((K=u.find(ue=>ue.slug===D))==null?void 0:K.title)??D;if(i){i(D,z);return}A.launchPlan(D,z)},{requestRun:le,gateModals:de}=Zr({dependenciesBySlug:L,claimsBySlug:Z,isAgentBuilding:r,onLaunch:q}),{reorderPlans:ee}=Xb(f);return e.jsxs(en,{testId:"plan-tab",children:[e.jsx(Qb,{providerLabel:N}),e.jsx(Zb,{active:P,onChange:I}),P==="describe"&&e.jsx(px,{chatOpen:X,onChatToggle:Q,onChatClose:ie}),P==="prototype"&&e.jsx(dx,{isAgentBuilding:r,onLaunched:()=>I("describe"),launchSignal:d}),e.jsx(Xi,{staleness:x}),e.jsx(Bb,{status:b}),e.jsx(Xr,{plans:u,loading:h,error:p,onRun:le,launchingSlug:M,launchError:C,blocked:r,onReorder:ee,depAnnotationsBySlug:O,dependenciesBySlug:L,claimsBySlug:Z,staleFetch:y,skeletonCount:_,showAuthors:$}),e.jsx(fx,{claims:F}),e.jsx(jx,{}),e.jsx(kx,{plans:v,loading:w,error:j,skeletonCount:k,showAuthors:$}),de]})}const Y7=Object.freeze(Object.defineProperty({__proto__:null,PlanTab:Nx},Symbol.toStringTag,{value:"Module"}));function Cx({activeTab:t,planActivated:n,chatOpen:s,onChatOpenChange:r,isAgentBuilding:a=!1,launchingPlanSlug:o,planLaunchError:i,onLaunchPlan:c,prototypeLaunchSignal:d=0}){return n?e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:t==="plan"?"visible":"hidden",pointerEvents:t==="plan"?"auto":"none"},children:e.jsx(Nx,{chatOpen:s,onChatOpenChange:r,isActive:t==="plan",isAgentBuilding:a,launchingSlug:o,launchError:i,onLaunchPlan:c,prototypeLaunchSignal:d})}):null}const V7=Object.freeze(Object.defineProperty({__proto__:null,EditorShellPlanLayer:Cx},Symbol.toStringTag,{value:"Module"})),W5="desktop",Dc="codeyam:isDesktopApp";function G5(t=typeof window<"u"?window:void 0){var o,i,c;if(!t)return!1;try{if(((o=t.sessionStorage)==null?void 0:o.getItem(Dc))==="1")return!0}catch{}const s=new URLSearchParams(((i=t.location)==null?void 0:i.search)??"").get(W5)==="1",r=typeof t.__TAURI__<"u",a=s||r;if(a)try{(c=t.sessionStorage)==null||c.setItem(Dc,"1")}catch{}return a}function Px({visible:t,children:n}){return e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-auto",style:{visibility:t?"visible":"hidden"},children:n})}const K7=Object.freeze(Object.defineProperty({__proto__:null,TabPane:Px},Symbol.toStringTag,{value:"Module"}));function Tx({activeTab:t,children:n}){const s=["home","build","plan","history","reviews","settings"];return e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:s.map(r=>e.jsx(Px,{visible:t===r,children:n[r]},r))})}const J7=Object.freeze(Object.defineProperty({__proto__:null,LeftPanel:Tx},Symbol.toStringTag,{value:"Module"}));function Ox({label:t,description:n,checked:s,disabled:r=!1,onChange:a,children:o}){return e.jsxs("div",{className:"py-3",style:{borderTop:"1px solid var(--border-default)"},children:[e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:r,onChange:i=>a(i.target.checked),className:"accent-green-500 mt-0.5"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"text-[12px] block",style:{color:"var(--text-primary)"},children:t}),e.jsx("span",{className:"text-[11px] block mt-0.5",style:{color:"var(--text-dim)"},children:n})]})]}),o]})}const X7=Object.freeze(Object.defineProperty({__proto__:null,CheckInToggleRow:Ox},Symbol.toStringTag,{value:"Module"}));function sl({options:t,value:n,onChange:s,disabled:r=!1,ariaLabel:a}){return e.jsx("div",{className:"flex gap-1",role:a?"radiogroup":void 0,"aria-label":a,children:t.map(o=>{const i=o.value===n;return e.jsx("button",{type:"button",role:a?"radio":void 0,"aria-checked":a?i:void 0,title:o.hint,disabled:r,onClick:()=>s(o.value),className:"text-[11px] px-2 py-1 rounded cursor-pointer transition-colors",style:{background:i?"var(--bg-input)":"transparent",color:i?"var(--text-primary)":"var(--text-secondary)"},children:o.label},o.value)})})}const Q7=Object.freeze(Object.defineProperty({__proto__:null,SegmentedPicker:sl},Symbol.toStringTag,{value:"Module"})),U5=[{value:"commit",label:"Commit",hint:"Run the full finalize, then commit."},{value:"fastCommit",label:"Fast commit",hint:"Defer the heavy finalize work; owed before merge."}];function Ax({autoAction:t,branchState:n,disabled:s=!1,onChange:r}){return n.onPrimaryBranch?e.jsx("div",{className:"mt-2 ml-6",children:e.jsxs("p",{className:"text-[11px]",style:{color:"var(--text-dim)"},children:["Fast commit is disabled on"," ",n.primaryBranch??"the primary branch"," — this check-in will commit normally."]})}):e.jsxs("div",{className:"mt-2 ml-6",children:[e.jsx("div",{className:"text-[11px] mb-1",style:{color:"var(--text-muted)"},children:"When it runs on its own"}),e.jsx(sl,{options:U5,value:t,onChange:r,disabled:s,ariaLabel:"Autonomous commit action"})]})}const Z7=Object.freeze(Object.defineProperty({__proto__:null,HardeningAutoAction:Ax},Symbol.toStringTag,{value:"Module"})),Rx={checkIns:{planAccepted:{pause:!0},prototypeCompleted:{pause:!0},hardeningCompleted:{pause:!0,autoAction:"commit"},push:{pause:!0}}};function Lc(t){const n=(t==null?void 0:t.checkIns)??{},s=Rx.checkIns;return{checkIns:{planAccepted:n.planAccepted??s.planAccepted,prototypeCompleted:n.prototypeCompleted??s.prototypeCompleted,hardeningCompleted:n.hardeningCompleted??s.hardeningCompleted,push:n.push??s.push}}}function Y5(){const[t,n]=l.useState(Rx),[s,r]=l.useState({currentBranch:null,primaryBranch:null,onPrimaryBranch:!1}),[a,o]=l.useState(!0),[i,c]=l.useState(!1),[d,u]=l.useState(null);l.useEffect(()=>{let p=!1;return(async()=>{var f;try{const m=await fetch("/api/config");if(!m.ok)throw new Error(`config request failed (${m.status})`);const g=await m.json();if(p)return;const b=(g==null?void 0:g.currentBranch)??null,x=((f=g==null?void 0:g.audit)==null?void 0:f.branchBaseRef)??null;n(Lc(g==null?void 0:g.workflow)),r({currentBranch:b,primaryBranch:x,onPrimaryBranch:b!==null&&b===x})}catch(m){p||u(m instanceof Error?m.message:String(m))}finally{p||o(!1)}})(),()=>{p=!0}},[]);const h=l.useCallback(async(p,f)=>{const m=t;n(p),c(!0),u(null);try{const g=await fetch("/api/workflow-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:f,workflow:p})}),b=await g.json().catch(()=>({}));if(!g.ok||(b==null?void 0:b.success)===!1)throw new Error((b==null?void 0:b.message)??(b==null?void 0:b.error)??`save failed (${g.status})`);b!=null&&b.workflow&&n(Lc(b.workflow))}catch(g){n(m),u(g instanceof Error?g.message:String(g))}finally{c(!1)}},[t]);return{settings:t,branchState:s,loading:a,saving:i,error:d,save:h}}const V5=[{key:"planAccepted",label:"Plan accepted",description:"Pause after the plan is written, before any code is built."},{key:"prototypeCompleted",label:"Prototype completed",description:"Pause once the prototype is demoable in the Live Preview."},{key:"hardeningCompleted",label:"Hardening completed",description:"Pause after tests, scenarios, and the audit are green."},{key:"push",label:"Push",description:"Pause before the branch is pushed to the remote."}],K5=[{value:"local",label:"This machine only"},{value:"project",label:"Whole project"}];function Ex(){const[t,n]=l.useState("local"),{settings:s,branchState:r,loading:a,saving:o,error:i,save:c}=Y5(),d=s.checkIns.hardeningCompleted;return e.jsxs("section",{className:"mt-4",children:[e.jsx("h3",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:"Workflow"}),e.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-dim)"},children:"Checked means the workflow pauses and asks you at that point. Unchecked means it keeps going on its own."}),e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"text-[11px] mb-1.5",style:{color:"var(--text-muted)"},children:"Apply to"}),e.jsx(sl,{options:K5,value:t,onChange:n})]}),e.jsx("div",{className:"mt-3",children:V5.map(u=>{const h=s.checkIns[u.key];return e.jsx(Ox,{label:u.label,description:u.description,checked:h.pause,disabled:a||o,onChange:p=>void c({checkIns:{...s.checkIns,[u.key]:{...h,pause:p}}},t),children:u.key==="hardeningCompleted"&&!d.pause&&e.jsx(Ax,{autoAction:d.autoAction,branchState:r,disabled:o,onChange:p=>void c({checkIns:{...s.checkIns,hardeningCompleted:{...d,autoAction:p}}},t)})},u.key)})}),i&&e.jsxs("p",{className:"text-[11px] mt-3",role:"alert",style:{color:"var(--accent-red, #ef4444)"},children:["Could not save: ",i]})]})}const eD=Object.freeze(Object.defineProperty({__proto__:null,WorkflowSettingsSection:Ex},Symbol.toStringTag,{value:"Module"}));function Mx(){return e.jsxs("div",{className:"h-full overflow-y-auto px-4 py-4",children:[e.jsx("h2",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Settings"}),e.jsx(Ex,{})]})}const tD=Object.freeze(Object.defineProperty({__proto__:null,SettingsTab:Mx},Symbol.toStringTag,{value:"Module"}));function Ix({activeTab:t,appTabContent:n,leftWidth:s,onPreviewScreenshot:r}){const a=t!=="build"&&t!=="plan",[o,i]=l.useState(!1),[c,d]=l.useState(!1),[u,h]=l.useState(!1);return l.useEffect(()=>{t==="history"&&i(!0),t==="reviews"&&d(!0),t==="settings"&&h(!0)},[t]),e.jsx("div",{className:"absolute inset-0 flex flex-col",style:{visibility:a?"visible":"hidden",pointerEvents:a?"auto":"none"},children:e.jsx(Tx,{activeTab:t,width:s,children:{home:n,build:null,plan:null,history:o?e.jsx(Gm,{onPreviewScreenshot:r}):null,reviews:c?e.jsx(Xh,{}):null,settings:u?e.jsx(Mx,{}):null}})})}const nD=Object.freeze(Object.defineProperty({__proto__:null,EditorShellTabLayer:Ix},Symbol.toStringTag,{value:"Module"}));function Dx(t){const{annotationsBySlug:n,dependenciesBySlug:s}=Zi(t),{claims:r}=Ki(),{status:a}=Ji(),o=l.useMemo(()=>Qi(r),[r]),i=((a==null?void 0:a.consecutiveFailures)??0)>=3;return{annotationsBySlug:n,dependenciesBySlug:s,claimsBySlug:o,staleFetch:i}}function Lx({plans:t,onPickPlan:n,launchingSlug:s,planError:r,onSubmitPrompt:a,submittingPrompt:o,promptError:i,onStartBlank:c,pendingPlansLoading:d,pendingPlansError:u,isAgentBuilding:h}){const[p,f]=l.useState(""),{annotationsBySlug:m,dependenciesBySlug:g,claimsBySlug:b,staleFetch:x}=Dx(t),{requestRun:y,gateModals:v}=Zr({dependenciesBySlug:g,claimsBySlug:b,isAgentBuilding:h,onLaunch:N=>{var A;const T=((A=t.find(M=>M.slug===N))==null?void 0:A.title)??N;n(N,T)}}),w=p.trim(),j=w.length>0,_=o||s!==null,k=()=>{_||(j?a(w):c())},S=N=>{(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),k())};return e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},"data-testid":"build-launch-modal",children:[e.jsxs("div",{className:"max-w-lg w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"What do you want to build?"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:t.length>0?"Pick a queued plan to run, or describe a new build and kick it off directly.":"Describe what you want to build, or just start a session."}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"max-h-48 overflow-y-auto mb-3","data-testid":"build-launch-modal-plan-list",children:e.jsx(Xr,{plans:t,loading:d,error:u,onRun:y,launchingSlug:s,launchError:r,blocked:h,depAnnotationsBySlug:m,dependenciesBySlug:g,claimsBySlug:b,staleFetch:x})}),e.jsxs("div",{className:"flex items-center gap-3 my-4 text-xs text-[var(--text-dim)]","aria-hidden":"true",children:[e.jsx("span",{className:"flex-1 h-px bg-[var(--border-subtle)]"}),e.jsx("span",{children:"or"}),e.jsx("span",{className:"flex-1 h-px bg-[var(--border-subtle)]"})]})]}),e.jsx("p",{className:"text-xs uppercase tracking-wide text-[var(--text-dim)] mb-2",children:"Describe what you want to build"}),e.jsx("textarea",{value:p,onChange:N=>f(N.target.value),onKeyDown:S,rows:4,disabled:o||s!==null,placeholder:"e.g. Add a dark-mode toggle to the settings page",className:"w-full px-3 py-2 rounded-md text-sm resize-y disabled:opacity-50 disabled:cursor-not-allowed",style:{background:"var(--bg-deep, #0e0e0e)",color:"var(--text-primary)",border:"1px solid var(--border-default)"},"data-testid":"build-launch-modal-textarea"}),i&&e.jsx(Qe,{testId:"build-launch-modal-prompt-error",text:i,className:"text-xs text-[var(--text-danger)]",rowClassName:"mt-2"}),e.jsx("div",{className:"mt-4 flex items-center justify-end gap-2",children:e.jsx("button",{type:"button",onClick:k,disabled:_,className:"px-4 py-2 rounded-md text-sm font-medium transition cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",style:{background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #fff)",border:"1px solid transparent"},"data-testid":"build-launch-modal-submit",children:o?"Starting…":j?"Start build":"Start Building"})}),e.jsx("p",{className:"mt-3 text-center text-xs text-[var(--text-dim)]",children:"Cmd/Ctrl+Enter submits"})]}),v]})}const sD=Object.freeze(Object.defineProperty({__proto__:null,BuildLaunchModal:Lx},Symbol.toStringTag,{value:"Module"}));function Fx({onCreateNewPlan:t,onContinueSession:n,onViewPlans:s}){return e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},"data-testid":"plan-complete-dialog",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Plan Saved!"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Your plan has been committed. Start a fresh plan, continue this session to write a related follow-up with the current context, or head back to see the list."}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("button",{onClick:t,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"var(--accent-active)",color:"var(--bg-deep)"},type:"button",children:"Create New Plan"}),e.jsx("button",{onClick:n,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},type:"button",children:"Continue with this planning session"}),e.jsx("button",{onClick:s,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},type:"button",children:"View Plans"})]})]})}const rD=Object.freeze(Object.defineProperty({__proto__:null,PlanCompleteDialog:Fx},Symbol.toStringTag,{value:"Module"}));function zx({onCreateNewPlan:t,onContinueSession:n,onViewPlans:s}){return e.jsx("div",{className:"absolute inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:e.jsx(Fx,{onCreateNewPlan:t,onContinueSession:n,onViewPlans:s})})}const aD=Object.freeze(Object.defineProperty({__proto__:null,PlanCompleteTransition:zx},Symbol.toStringTag,{value:"Module"}));function J5(t){return!t||!(t instanceof Element)?!1:!!t.closest("[data-terminal-emulator], .xterm")}function X5(t){return!t||!(t instanceof Element)?!1:!!t.closest("[data-post-push-modal]")}function $x({onStartNextFeature:t,onContinueInSession:n,onStopBuilding:s,onSendTranscript:r,onSelectPlan:a,pendingPlanCount:o=0}){const i=o>0&&a,c={background:"var(--accent-active)",color:"var(--bg-deep)"},d={background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},u={background:"transparent",color:"var(--accent-danger, #f87171)",border:"1px solid var(--accent-danger, #f87171)"};return e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Feature Complete!"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Your changes have been committed and pushed. You can start a new feature with a fresh context, or continue working in the current session."}),e.jsxs("div",{className:"flex flex-col gap-3",children:[i&&e.jsx("button",{onClick:a,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:c,type:"button",children:"Select A Plan"}),e.jsx("button",{onClick:t,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:i?d:c,type:"button",children:"Start Next Feature"}),e.jsx("button",{onClick:n,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:d,type:"button",children:"Continue in Current Session"}),e.jsx("button",{onClick:s,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:u,type:"button","data-testid":"post-push-stop-building",children:"Stop Building"}),r&&e.jsx("button",{onClick:r,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-dim)",border:"1px solid var(--border-default)"},type:"button",children:"Send Session Feedback"})]}),e.jsx("p",{className:"mt-4 text-center text-xs text-[var(--text-dim)]",children:i?"Press Enter to pick a queued plan":"Press Enter to start a new feature with a fresh context"})]})}const oD=Object.freeze(Object.defineProperty({__proto__:null,PostPushTransitionDialog:$x},Symbol.toStringTag,{value:"Module"}));function Bx({onStartNextFeature:t,onContinueInSession:n,onStopBuilding:s,onSendTranscript:r,onSelectPlan:a,pendingPlanCount:o=0}){const i=l.useCallback(c=>{if(c.key!=="Enter"||J5(c.target))return;const d=c.target===document.body||c.target===document.documentElement||c.target===document;!X5(c.target)&&!d||(c.preventDefault(),o>0&&a?a():t())},[a,t,o]);return l.useEffect(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)),[i]),e.jsx("div",{className:"absolute inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},"data-post-push-modal":!0,children:e.jsx($x,{onStartNextFeature:t,onContinueInSession:n,onStopBuilding:s,onSendTranscript:r,onSelectPlan:a,pendingPlanCount:o})})}const iD=Object.freeze(Object.defineProperty({__proto__:null,PostPushTransition:Bx},Symbol.toStringTag,{value:"Module"}));function qx({plans:t,onSelect:n,onCancel:s,launchingSlug:r,error:a}){const[o,i]=l.useState(null),c=l.useMemo(()=>{const b={};for(const x of t)b[x.slug]=x;return b},[t]),{annotationsBySlug:d,dependenciesBySlug:u,claimsBySlug:h,staleFetch:p}=Dx(t),{requestRun:f,gateModals:m}=Zr({dependenciesBySlug:u,claimsBySlug:h,onLaunch:l.useCallback(b=>{const x=c[b];x&&n(x.slug,x.title)},[n,c])}),g=l.useCallback(b=>{if(b.key==="Escape"){b.preventDefault(),s();return}b.key==="Enter"&&t.length>0&&!r&&(b.preventDefault(),f(t[0].slug))},[r,s,f,t]);return l.useEffect(()=>(window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)),[g]),t.length===0?null:e.jsxs("div",{className:"absolute inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},"data-testid":"select-plan-modal",children:[e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Select A Plan"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:"Pick a queued plan to run next. Its body primes the editor workflow in a fresh session."}),e.jsx("ul",{className:"flex flex-col gap-2 max-h-[50vh] overflow-y-auto mb-2",children:t.map((b,x)=>{var y,v;return e.jsx(qi,{plan:b,position:x+1,expanded:o===b.slug,onToggle:()=>i(w=>w===b.slug?null:b.slug),onRun:f,launching:r===b.slug,unsatisfiedDepCount:(y=d[b.slug])==null?void 0:y.count,unsatisfiedDepTooltip:(v=d[b.slug])==null?void 0:v.tooltip,dependencies:u[b.slug],claim:h.get(b.slug),staleFetch:p,expandedBodyVariant:"view"},b.slug)})}),a&&e.jsx(Qe,{testId:"select-plan-error",text:a,className:"text-xs text-[var(--text-danger)]",rowClassName:"mb-3"}),e.jsx("button",{type:"button",onClick:s,className:"w-full px-4 py-2 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},children:"Cancel"}),e.jsx("p",{className:"mt-3 text-center text-xs text-[var(--text-dim)]",children:"Press Enter to launch the first plan, Escape to cancel"})]}),m]})}const lD=Object.freeze(Object.defineProperty({__proto__:null,SelectPlanModal:qx},Symbol.toStringTag,{value:"Module"}));function Hx({activeTab:t,onSendTranscript:n,appTabContent:s,awaitingPlanLaunchChoice:r,buildActivated:a,planActivated:o,buildIdle:i=!1,isAgentBuilding:c=!1,planActive:d=!1,planIdle:u=!1,bannerVisible:h=!1,onDismissIdleBanner:p,hideResultsCommandKey:f,leftWidth:m,fullWidth:g=!1,navigateToTab:b,onAgentActive:x,onAgentIdle:y,onUserInput:v,notifSettings:w,onSettingsChange:j,provider:_,onContinueInSession:k,onRestorePreview:S,onResultsScenarioSelect:N,previewSlug:T=null,onStartNextFeature:A,onStopBuilding:M,showPostPushModal:C,completionModalPermitted:H=!0,showResultsCommandKey:J,planChatOpen:Z,onPlanChatOpenChange:F,showPlanCompleteModal:$,onCreateNewPlan:P,onContinueSession:I,onViewPlans:B,pendingPlans:X,onSelectPlan:W,selectPlanOpen:ie,onPickPlan:Q,onCancelSelectPlan:O,launchingPlanSlug:L,planLaunchError:q,prototypeLaunchSignal:le=0,showBuildLaunchModal:de=!1,buildLaunchGateArmed:ee=!1,onSubmitBuildPrompt:D,submittingBuildPrompt:z=!1,buildPromptError:K=null,onStartBlankBuild:ue,pendingPlansLoading:ye,pendingPlansError:je,onReorderPlans:V,buildDisabled:te=!1,onPreviewScreenshot:oe,projectTitle:he=null}){const G=G5();return e.jsxs("div",{className:`${g?"flex-1 w-full min-w-0":"shrink-0"} flex flex-col overflow-hidden`,style:g?{background:"var(--bg-deep)"}:{width:m,background:"var(--bg-deep)"},children:[G&&e.jsx(mb,{projectTitle:he}),e.jsx(pb,{activeTab:t,onTabChange:b,onSendTranscript:n,buildIdle:i,isAgentBuilding:c,planActive:d,planIdle:u,bannerVisible:h,onDismissIdleBanner:p,buildDisabled:te,showLogo:!G,providerLabel:at(_)}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.jsx(Ib,{awaitingPlanLaunchChoice:r,buildLaunchGateArmed:ee,buildActivated:a,activeTab:t,onSelectScenario:N,previewSlug:T,showResultsCommandKey:J,hideResultsCommandKey:f,onAgentIdle:y,onAgentActive:x,onUserInput:v,notifSettings:w,onSettingsChange:j,provider:_,onRestorePreview:S,pendingPlans:X,pendingPlansLoading:ye,pendingPlansError:je,onLaunchPlan:Q,launchingSlug:L,launchError:q,onReorderPlans:V,isAgentBuilding:c,featureCompleteActive:C}),e.jsx(Cx,{activeTab:t,planActivated:o,chatOpen:Z,onChatOpenChange:F,isAgentBuilding:c,launchingPlanSlug:L,planLaunchError:q,onLaunchPlan:Q,prototypeLaunchSignal:le}),e.jsx(Ix,{activeTab:t,appTabContent:s,leftWidth:m,onPreviewScreenshot:oe}),C&&H&&t==="build"&&!ie?e.jsx(Bx,{onStartNextFeature:A,onContinueInSession:k,onStopBuilding:M,onSendTranscript:n,onSelectPlan:W,pendingPlanCount:X.length}):null,ie&&t==="build"?e.jsx(qx,{plans:X,onSelect:Q,onCancel:O,launchingSlug:L,error:q}):null,de&&t==="build"&&!C&&D&&ue?e.jsx(Lx,{plans:X,onPickPlan:Q,launchingSlug:L,planError:q,onSubmitPrompt:D,submittingPrompt:z,promptError:K,onStartBlank:ue,pendingPlansLoading:ye,pendingPlansError:je,isAgentBuilding:c}):null,$&&t==="plan"?e.jsx(zx,{onCreateNewPlan:P,onContinueSession:I,onViewPlans:B}):null]})]})}const cD=Object.freeze(Object.defineProperty({__proto__:null,EditorShellLeftPane:Hx},Symbol.toStringTag,{value:"Module"})),Fc=5173;function rl(t){if(t.startsWith("http"))try{return new URL(t).pathname}catch{return t}return t.split("?")[0]??t}function al(t){return t?parseInt(t.port||(t.protocol==="https:"?"443":"80"),10):0}function ol(t,{appPort:n,currentPort:s,previewOrigin:r}){return t.startsWith("http")?t:r?`${r}${t}`:s===n?t:`http://localhost:${n}${t}`}function Wx(t,n,s,r,a){if(s&&s.length>0)return ol(s,{appPort:r,currentPort:n,previewOrigin:a});const o=`/scenario/${t}`;return a?`${a}${o}`:n===Fc?o:`http://localhost:${Fc}${o}`}const Q5=["/apps","/entities","/app","/build","/history","/settings","/plan"];function Gx(t){if(!t)return!1;const n=rl(t);return Q5.some(s=>n===s||n.startsWith(`${s}/`))}function Ux(t,n,s){const r=typeof window<"u"?al(window.location):0;let a="";if(Iw(t)==="component"?a=Wx(t.slug,r,t.url,n,s):t.url&&(a=ol(t.url,{appPort:n,currentPort:r,previewOrigin:s})),a&&!Gx(a))try{const o=!a.startsWith("http"),i=typeof window<"u"?window.location.origin:"http://localhost",c=new URL(a,i);return c.searchParams.set("_codeyam_scenario",t.slug),o?c.pathname+c.search+c.hash:c.toString()}catch{return a}return a}async function zc(t,n=null){try{const s={pid:t};n&&(s.url=n),await fetch("/api/editor-iframe-loaded",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch{}}async function Z5(t){try{await fetch("/api/editor-iframe-error",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:t})})}catch{}}async function e3(t){try{await fetch("/api/editor-iframe-banner",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({seedError:t})})}catch{}}async function t3(t){try{await fetch("/api/editor-iframe-auth-needed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({previewOrigin:t})})}catch{}}async function n3(t){try{await fetch("/api/editor-preview-escape",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({escapedPath:t})})}catch{}}function s3(t,n,s,r,a){const o=t-a*2,i=n-a*2;return o<=0||i<=0?1:Math.min(1,o/s,i/r)}const r3=32;function a3({currentHeight:t,currentWidth:n,isFilled:s}){const[r,a]=l.useState(null),o=l.useRef(null),i=l.useRef(null),c=l.useCallback(h=>{const p=h.getBoundingClientRect();a({width:p.width,height:p.height})},[]),d=l.useCallback(h=>{if(o.current&&(o.current.disconnect(),o.current=null),i.current=h,!h){a(null);return}c(h);const p=new ResizeObserver(()=>{const f=i.current;f&&c(f)});p.observe(h),o.current=p},[c]),u=s||!r?1:s3(r.width,r.height,n,t,r3);return{containerRef:d,containerSize:r,scale:u}}const o3={kind:"iframe",fallbackKind:null,fallbackPort:null,loading:!1},$c=[400,800,1500,3e3];function Yx(){const[t,n]=l.useState({kind:"iframe",fallbackKind:null,fallbackPort:null,loading:!0});return l.useEffect(()=>{let s=!1,r,a=0;const o=()=>{const d=$c[Math.min(a,$c.length-1)];a+=1,r=setTimeout(c,d)},i=()=>{n(d=>d.loading?o3:d),o()},c=()=>{fetch("/api/project-stack").then(d=>d.ok?d.json():{}).then(d=>{s||(i3(d)?n(l3(d)):i())}).catch(()=>{s||i()})};return c(),()=>{s=!0,r&&clearTimeout(r)}},[]),t}function i3(t){return!!t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0}function l3(t){const n=t&&typeof t=="object"&&"preview"in t?t.preview:null;if(!n||typeof n!="object")return{kind:"iframe",fallbackKind:null,fallbackPort:null,loading:!1};const s=n;return{kind:c3(s.kind),fallbackKind:d3(s.fallbackKind),fallbackPort:typeof s.fallbackPort=="number"?s.fallbackPort:null,loading:!1}}function c3(t){return t==="simulator-ios"?"simulator-ios":t==="simulator-android"?"simulator-android":"iframe"}function d3(t){return t==="iframe"||t==="simulator-ios"||t==="simulator-android"?t:null}const u3="codeyam:client-routing-detected";function h3(t){const[n,s]=l.useState(!1);return l.useEffect(()=>{if(!t)return;function r(a){var o;a.origin===window.location.origin&&((o=a.data)==null?void 0:o.type)===u3&&s(!0)}return window.addEventListener("message",r),()=>window.removeEventListener("message",r)},[t]),n}const p3=700;function Vx({pollMs:t=p3,paused:n=!1,onError:s}={}){const[r,a]=l.useState(0),[o,i]=l.useState({kind:"loading"}),c=l.useRef(s);return c.current=s,l.useEffect(()=>{if(n)return;let d=!1;const u=window.setInterval(()=>{d||a(h=>h+1)},t);return()=>{d=!0,window.clearInterval(u)}},[t,n]),l.useEffect(()=>{if(n)return;let d=!1;return fetch(`/api/simulator-frame?t=${r}`,{method:"HEAD"}).then(async u=>{var p;if(d)return;if(u.ok){i({kind:"ok"});return}if(u.status===503){const f=await m3(u);if(d)return;(typeof(f==null?void 0:f.error)=="string"?f.error:"").includes("xcode")?i({kind:"xcode-missing"}):i({kind:"no-device"});return}const h=`simulator frame request failed (${u.status})`;i({kind:"capture-failed",message:h}),(p=c.current)==null||p.call(c,h)}).catch(u=>{var p;if(d)return;const h=u instanceof Error?u.message:"simulator frame request errored";i({kind:"capture-failed",message:h}),(p=c.current)==null||p.call(c,h)}),()=>{d=!0}},[r,n]),{state:o,isBooted:o.kind==="ok",frameToken:r}}async function m3(t){try{return await t.json()}catch{return null}}function f3(t,n){const s=(t==null?void 0:t.screenshotPaths)??[];if(s.length===0)return null;if(n){const r=`--${n.toLowerCase()}.png`,a=s.find(o=>o.toLowerCase().endsWith(r));if(a)return a}return s[0]??null}function g3(t,n,s){switch(t){case 1:case 2:return"Setting up...";case 3:return`Building — ${n} files modified, ${s} tests modified`;case 4:return"Verifying — running tests...";case 5:return"Ready for review";case 6:return"Refactoring...";case 7:case 8:return"Finalizing...";case 9:return"Ready for approval";case 10:return"Complete";default:return""}}async function ho(){const t=Date.now();try{const n=await fetch("/api/editor-session-summary"),s=Date.now()-t;return n.ok?{ok:!0,data:await n.json(),statusCode:n.status,durationMs:s,error:null}:{ok:!1,data:null,statusCode:n.status,durationMs:s,error:`HTTP ${n.status}`}}catch(n){return{ok:!1,data:null,statusCode:null,durationMs:Date.now()-t,error:n instanceof Error?n.message:String(n)}}}const b3=50,x3={status:"loading",lastSuccessAt:null,lastErrorAt:null,lastErrorMessage:null,fetchCount:0,errorCount:0};function y3(t,n,s){return{status:n.ok?"connected":"disconnected",lastSuccessAt:n.ok?s:t.lastSuccessAt,lastErrorAt:n.ok?t.lastErrorAt:s,lastErrorMessage:n.ok?t.lastErrorMessage:n.error,fetchCount:t.fetchCount+1,errorCount:t.errorCount+(n.ok?0:1)}}function v3(t,n){return{timestamp:n,success:t.ok,statusCode:t.statusCode,durationMs:t.durationMs,error:t.error}}function j3(t,n){return[n,...t].slice(0,b3)}function w3(){const[t,n]=l.useState(x3),[s,r]=l.useState([]),a=l.useCallback(i=>{const c=Date.now();r(d=>j3(d,v3(i,c))),n(d=>y3(d,i,c))},[]),o=l.useCallback(()=>{n(i=>({...i,status:"polling"}))},[]);return{connectionState:t,fetchLog:s,recordFetch:a,markPolling:o}}async function _3(t){try{const r=await fetch("/api/test-results");if(r.ok&&(await r.json()).running)return{kind:"busy"}}catch{}const n={tests:[t.name]};t.file&&(n.changedFiles=[t.file]);let s;try{s=await fetch("/api/test-results/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}if(s.ok)return{kind:"accepted"};try{const r=await s.json();if(typeof r.message=="string"&&r.message.trim())return{kind:"error",message:r.message}}catch{}return{kind:"error",message:`Couldn't start the run (HTTP ${s.status}).`}}function k3(t,n){if(!t.narrative)return null;for(const s of t.narrative.changes)for(const r of s.tests)if(r.name===n)return{lastRunAt:r.lastRunAt,status:r.status??"unknown"};return null}async function S3(t,n,s){const r=s.intervalMs??2e3,a=s.nowMs??(()=>Date.now()),o=s.sleep??(c=>new Promise(d=>setTimeout(d,c))),i=a()+s.timeoutMs;for(;;){const c=await ho();if(c.ok&&c.data){const d=k3(c.data,t.name);if(d!=null&&d.lastRunAt&&Date.parse(d.lastRunAt)>n)return{kind:"completed",status:d.status,summary:c.data}}if(a()>=i)return{kind:"timeout"};await o(r)}}function N3(t){return!t||t<=0?3e4:Math.max(3e4,t*2)}function C3({onSummaryUpdate:t,getLastDurationMs:n}){const[s,r]=l.useState(null),a=l.useCallback(o=>{const i=o.name;r({name:i,state:{phase:"verifying"}});const c=Date.now();(async()=>{const d=await _3(o);if(d.kind==="busy"){r({name:i,state:{phase:"busy"}});return}if(d.kind==="error"){r({name:i,state:{phase:"error",message:d.message}});return}const u=N3(n()),h=await S3(o,c,{timeoutMs:u});h.kind==="completed"?(t(h.summary),r(null)):r({name:i,state:{phase:"timeout"}})})()},[t,n]);return{active:s,onRerun:a}}function P3(t){switch(t.status){case"connected":return{dotClass:"bg-green-500",label:"Connected",labelClass:"text-green-400"};case"polling":return{dotClass:"bg-yellow-400 animate-pulse",label:"Polling...",labelClass:"text-yellow-400"};case"disconnected":return{dotClass:"bg-red-500",label:"Disconnected",labelClass:"text-red-400"};case"loading":default:return{dotClass:"bg-[var(--text-muted)]",label:"Connecting...",labelClass:"text-[var(--text-muted)]"}}}function Kx({state:t}){const n=Wn(),{dotClass:s,label:r,labelClass:a}=P3(t);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium","data-testid":"connection-status-badge",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${s}`,"data-testid":"connection-status-dot"}),e.jsx("span",{className:a,"data-testid":"connection-status-label",children:r}),t.lastSuccessAt!=null&&e.jsxs("span",{className:"text-[var(--text-muted)]","data-testid":"connection-status-updated",children:["Updated ",La(t.lastSuccessAt,n)]})]})}const dD=Object.freeze(Object.defineProperty({__proto__:null,BackendConnectionStatusBadge:Kx},Symbol.toStringTag,{value:"Module"}));function Jx({feature:t,connectionState:n,statusChip:s,userPrompt:r}){return e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-default)] rounded-lg p-5",children:[e.jsx("h1",{className:"text-lg font-semibold text-[var(--text-primary)] m-0",children:t||"Working Session Results"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[e.jsx(Kx,{state:n}),s&&e.jsx("span",{className:"ml-auto text-[11px] px-2 py-0.5 bg-[var(--bg-input)] border border-[var(--border-subtle)] text-[var(--text-secondary)] rounded-full","data-testid":"status-chip",children:s})]}),r&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)]","data-testid":"user-prompt-section",children:[e.jsx("div",{className:"text-xs font-semibold text-[var(--text-muted)] uppercase tracking-wide",children:"Your request"}),e.jsx("div",{className:"mt-2 bg-[var(--bg-input)] border border-[var(--border-subtle)] rounded-md p-3",children:e.jsx(Er,{maxHeight:90,moreLabel:"View More",lessLabel:"View Less",fadeColor:"var(--bg-input)",children:r})})]})]})}const uD=Object.freeze(Object.defineProperty({__proto__:null,BackendResultsHeader:Jx},Symbol.toStringTag,{value:"Module"}));function T3(t,n,s=[]){var r;return{headline:(r=t.description)!=null&&r.trim()?t.description:t.name,name:t.name,file:t.file,status:t.status??"unknown",failureMessage:t.failureMessage,change:n.title,lastRunAt:t.lastRunAt,lastRunKind:t.lastRunKind,recentStatuses:t.recentStatuses,exercises:s.filter(a=>a.tests.some(o=>Ui(o)===t.name)),example:t.example}}function Xx(t,n=[]){const s=[],r=[];let a=0;for(const o of t.tests){if(o.verified===!1){a+=1;continue}const i=T3(o,t,n);i.status==="passing"?s.push(i):r.push(i)}return{worksNow:s,inProgress:r,unverifiedCount:a}}function O3(t,n=[]){const s=[],r=[];let a=0;for(const o of t.changes){const i=Xx(o,n);s.push(...i.worksNow),r.push(...i.inProgress),a+=i.unverifiedCount}return{worksNow:s,inProgress:r,unverifiedCount:a}}function A3(t){if(!t||t.length<2)return!1;const n=t.some(r=>r.status==="pass"),s=t.some(r=>r.status==="fail");return n&&s}function R3(t){if(t==null||t===0)return"";const n=Math.abs(t),s=t>0?"slower":"faster";return`${n}s ${s} than the previous run`}function Qx({status:t}){switch(t){case"passing":return e.jsx("span",{className:"text-green-500 text-xs mt-0.5 shrink-0",children:"✓"});case"failing":return e.jsx("span",{className:"text-red-500 text-xs mt-0.5 shrink-0",children:"✗"});case"running":return e.jsx("span",{className:"text-[#D7FF63] text-xs mt-0.5 shrink-0 animate-spin",children:"◠"});default:return e.jsx("span",{className:"text-gray-400 text-xs mt-0.5 shrink-0",children:"●"})}}const hD=Object.freeze(Object.defineProperty({__proto__:null,NarrativeTestStatusIcon:Qx},Symbol.toStringTag,{value:"Module"})),Bc="font-mono text-[11px] text-[var(--text-primary)] whitespace-pre-wrap break-words min-w-0",qc="w-0 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-muted)] align-top pr-3 py-1 whitespace-nowrap";function Zx({example:t}){return e.jsxs("div",{"data-testid":"behavior-example",children:[e.jsx("table",{className:"w-full border-collapse",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:qc,children:"Input"}),e.jsx("td",{className:`${Bc} py-1`,"data-testid":"example-input",children:t.input})]}),e.jsxs("tr",{children:[e.jsx("td",{className:qc,children:"Output"}),e.jsx("td",{className:`${Bc} py-1`,"data-testid":"example-output",children:t.output})]})]})}),t.note&&e.jsx("p",{className:"text-[10px] text-[var(--text-muted)] mt-1 mb-0 italic","data-testid":"example-note",children:t.note})]})}const pD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorExampleTable:Zx},Symbol.toStringTag,{value:"Module"})),E3="text-[10px] font-semibold uppercase tracking-wide text-[var(--text-muted)] mb-1";function M3(t){switch(t.phase){case"busy":return"Tests are already running — try again once they finish.";case"error":return t.message;case"timeout":return"Couldn't confirm — check test results.";default:return null}}function ey({rerun:t={phase:"idle"},onRerun:n,disabled:s=!1,disabledReason:r}){const a=t.phase==="verifying",o=t.phase==="error",i=s||a,c=s&&r||M3(t);return e.jsxs("div",{"data-testid":"evidence-rerun",children:[e.jsx("div",{className:E3,children:"Re-run"}),e.jsxs("button",{type:"button",onClick:n,disabled:i,title:s?r:void 0,"aria-busy":a,"data-testid":"rerun-button",className:"inline-flex items-center gap-1.5 text-[11px] px-2 py-1 rounded border border-[var(--border-default)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--text-muted)] disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[a&&e.jsx("span",{className:"inline-block w-3 h-3 border-2 border-[var(--border-default)] border-t-[#005c75] rounded-full animate-spin"}),a?"Verifying…":"Re-run this test"]}),c&&e.jsx("p",{className:`text-[11px] mt-1 m-0 ${o?"text-red-600":"text-[var(--text-muted)]"}`,"data-testid":"rerun-note",children:c})]})}const mD=Object.freeze(Object.defineProperty({__proto__:null,RerunSection:ey},Symbol.toStringTag,{value:"Module"}));function I3(t){return t==="passing"?"passed":t==="failing"?"failed":"ran"}function D3(t){switch(t){case"full":return"full run";case"changed":return"changed-files run";case"targeted":return"targeted run"}}function ty(t){var r;const n=t.status==="failing"&&!!t.failureMessage,s=(((r=t.recentStatuses)==null?void 0:r.length)??0)>0;return!!t.lastRunAt||t.exercises.length>0||n||!!t.example||s}const ss="text-[10px] font-semibold uppercase tracking-wide text-[var(--text-muted)] mb-1";function ny({behavior:t,rerun:n={phase:"idle"},onRerun:s,disabled:r=!1,disabledReason:a}){const o=Wn(),i=t.status==="failing"&&!!t.failureMessage;return e.jsxs("div",{className:"mt-2 ml-5 space-y-3","data-testid":"behavior-evidence-drawer",children:[t.lastRunAt&&e.jsxs("div",{"data-testid":"evidence-verified",children:[e.jsx("div",{className:ss,children:"Verified"}),e.jsxs("p",{className:"text-[11px] text-[var(--text-secondary)] m-0",children:[I3(t.status)," ",La(Date.parse(t.lastRunAt),o),t.lastRunKind&&e.jsxs("span",{className:"text-[var(--text-muted)]",children:[" (",D3(t.lastRunKind),")"]})]})]}),t.example&&e.jsxs("div",{"data-testid":"evidence-example",children:[e.jsx("div",{className:ss,children:"Example"}),e.jsx(Zx,{example:t.example})]}),t.recentStatuses&&t.recentStatuses.length>0&&e.jsxs("div",{"data-testid":"evidence-recent-runs",children:[e.jsx("div",{className:ss,children:"Recent runs"}),e.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:[...t.recentStatuses].reverse().map((c,d)=>e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${c.status==="pass"?"bg-green-500":c.status==="fail"?"bg-red-500":"bg-[var(--text-dim)]"}`,title:`${c.status} · ${La(Date.parse(c.at),o)}`,"data-testid":`recent-run-dot-${c.status}`},`${c.at}-${d}`))})]}),t.exercises.length>0&&e.jsxs("div",{"data-testid":"evidence-exercises",children:[e.jsx("div",{className:ss,children:"Exercises"}),e.jsx("ul",{className:"list-none p-0 m-0 space-y-1",children:t.exercises.map(c=>e.jsxs("li",{className:"text-[11px] text-[var(--text-secondary)] flex items-center gap-x-1.5",children:[e.jsx("span",{className:"font-mono text-[var(--text-primary)]",children:c.name}),e.jsx("span",{className:"text-[var(--text-dim)]",children:"·"}),e.jsx("span",{className:"font-mono text-[var(--text-dim)] min-w-0 truncate",children:c.filePath}),c.coverage&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[var(--text-dim)]",children:"·"}),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[Math.round(c.coverage.percent),"% covered"]})]})]},c.name))})]}),i&&e.jsxs("div",{"data-testid":"evidence-failure",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:ss,children:"Failure"}),e.jsx(Ze,{variant:"subtle",text:t.failureMessage??"",label:"Copy",className:"shrink-0 px-2 py-0.5 text-[11px] font-medium rounded border border-red-200 text-red-700 hover:bg-red-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"})]}),e.jsx("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-[11px] font-mono text-red-700 whitespace-pre-wrap overflow-x-auto","data-testid":"failure-message",children:t.failureMessage})]}),e.jsx(ey,{rerun:n,onRerun:s,disabled:r,disabledReason:a})]})}const fD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorEvidenceDrawer:ny,hasDrawerContent:ty},Symbol.toStringTag,{value:"Module"}));function sy({behavior:t,rerun:n}){var h,p;const[s,r]=l.useState(!1),a=ty(t),o=A3(t.recentStatuses),i=((h=n==null?void 0:n.active)==null?void 0:h.name)===t.name,c=i?n.active.state:{phase:"idle"},d=c.phase==="verifying",u=((p=n==null?void 0:n.active)==null?void 0:p.state.phase)==="verifying"&&!i;return e.jsx("div",{"data-testid":"behavior-item",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Qx,{status:d?"running":t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start gap-1.5",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm text-[var(--text-primary)] leading-relaxed",children:[t.headline,o&&e.jsx("span",{className:"ml-1.5 align-middle inline-block px-1.5 py-0.5 rounded text-[10px] font-medium text-[var(--text-muted)] bg-[var(--bg-surface)] border border-[var(--border-default)]",title:"Recent runs mix passes and failures — this behavior is intermittently failing","data-testid":"flaky-chip",children:"flaky?"})]}),e.jsxs("div",{className:"flex items-center gap-x-1.5 mt-1 text-[11px]",children:[e.jsx("span",{className:"text-[var(--text-muted)] font-mono min-w-0 truncate",children:t.name}),t.file&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[var(--text-dim)] shrink-0",children:"·"}),e.jsx("span",{className:"text-[var(--text-dim)] font-mono min-w-0 truncate",children:t.file})]}),t.change&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[var(--text-dim)] shrink-0",children:"·"}),e.jsx("span",{className:"text-[var(--text-muted)] opacity-70 shrink-0",children:t.change})]})]})]}),a&&e.jsx("button",{className:"shrink-0 text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer text-[10px] leading-none mt-1 px-1",onClick:()=>r(!s),"aria-expanded":s,"aria-label":s?"Hide evidence":"Show evidence","data-testid":"toggle-evidence-drawer",children:s?"▾":"▸"})]}),a&&s&&e.jsx(ny,{behavior:t,rerun:c,onRerun:n?()=>n.onRerun(t):void 0,disabled:u,disabledReason:"Verifying another behavior…"})]})]})})}const gD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorItem:sy},Symbol.toStringTag,{value:"Module"}));function po({label:t,behaviors:n,tone:s,rerun:r}){if(n.length===0)return null;const a=s==="positive"?"text-green-500":"text-[var(--text-secondary)]";return e.jsxs("section",{className:"space-y-3","data-testid":"behavior-group",children:[e.jsxs("h2",{className:`text-xs font-semibold uppercase tracking-wide m-0 ${a}`,"data-testid":"behavior-group-heading",children:[t," (",n.length,")"]}),e.jsx("div",{className:"space-y-4",children:n.map(o=>e.jsx(sy,{behavior:o,rerun:r},`${o.change}:${o.name}`))})]})}const bD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorGroup:po},Symbol.toStringTag,{value:"Module"}));function il({ways:t}){return t.length===0?null:e.jsxs("div",{className:"space-y-1.5","data-testid":"ways-to-test",children:[e.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--text-secondary)] m-0",children:"Ways to test"}),e.jsx("ul",{className:"list-disc pl-4 space-y-1 m-0",children:t.map((n,s)=>e.jsx("li",{className:"text-sm leading-relaxed","data-testid":"way-to-test",children:L3(n)},s))})]})}function L3(t){return t.kind==="run-scenario"&&t.scenarioUrl?e.jsxs("a",{href:t.scenarioUrl,target:"_blank",rel:"noopener",className:"text-[var(--accent-blue)] hover:underline inline-flex items-center gap-1","data-testid":"way-to-test-scenario-link",children:[t.text,e.jsx("span",{"aria-hidden":"true",className:"text-[10px] opacity-70",children:"↗ open in dev app"})]}):t.kind==="staging-only"?e.jsx("span",{className:"text-[var(--text-muted)] italic","data-testid":"way-to-test-staging-only",children:t.text}):e.jsx("span",{className:"text-[var(--text-primary)]",children:t.text})}const xD=Object.freeze(Object.defineProperty({__proto__:null,WaysToTestList:il},Symbol.toStringTag,{value:"Module"}));function ry({change:t,functions:n=[],rerun:s}){const{worksNow:r,inProgress:a}=Xx(t,n);return e.jsxs("section",{className:"space-y-3 pt-4 border-t border-[var(--border-subtle)]","data-testid":"change-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] m-0",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-[var(--text-secondary)] leading-relaxed m-0",children:t.description}),e.jsx(il,{ways:t.waysToTest??[]}),e.jsx(po,{label:"Works now",behaviors:r,tone:"positive",rerun:s}),e.jsx(po,{label:"In progress",behaviors:a,tone:"pending",rerun:s})]})}const yD=Object.freeze(Object.defineProperty({__proto__:null,ChangeCard:ry},Symbol.toStringTag,{value:"Module"}));function ay({narrative:t,functions:n=[],rerun:s}){const{unverifiedCount:r}=O3(t,n);return e.jsxs("div",{className:"space-y-6","data-testid":"behavior-gallery",children:[t.summary&&e.jsx("p",{className:"text-sm text-[var(--text-primary)] leading-relaxed m-0",children:t.summary}),t.changes.map((a,o)=>e.jsx(ry,{change:a,functions:n,rerun:s},`${a.title}:${o}`)),r>0&&e.jsxs("p",{className:"text-[11px] text-[var(--text-muted)] m-0","data-testid":"unverified-footnote",children:[r," test",r===1?"":"s"," not yet found in source."]})]})}const vD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorGallery:ay},Symbol.toStringTag,{value:"Module"}));function oy({step:t}){return e.jsx("div",{className:"text-sm text-[var(--text-muted)]","data-testid":"behavior-gallery-empty",children:e.jsx("span",{"data-testid":"behavior-gallery-prebuild",children:"The build will describe what it’s creating here as it works."})})}const jD=Object.freeze(Object.defineProperty({__proto__:null,BehaviorGalleryEmptyState:oy},Symbol.toStringTag,{value:"Module"}));function F3(t){const n=t.trim();if(n==="??")return"New";switch(n.replace(/\s/g,"").charAt(0)){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"R":return"Renamed";case"C":return"Copied";case"U":return"Unmerged";case"T":return"Type changed";default:return n||t}}function iy({path:t,status:n,testid:s}){return e.jsxs("li",{className:"flex items-center gap-2","data-testid":s,children:[e.jsx("span",{className:"font-mono text-[var(--text-primary)] truncate",children:t}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-[var(--bg-input)] border border-[var(--border-subtle)] text-[var(--text-secondary)] shrink-0",children:F3(n)})]})}const wD=Object.freeze(Object.defineProperty({__proto__:null,BuildFileRow:iy},Symbol.toStringTag,{value:"Module"}));function ly({feature:t,modifiedFiles:n,functions:s,waysToTestBaseline:r,step:a}){const o=new Set(s.map(u=>u.filePath)),i=n.filter(u=>!o.has(u.path)),c=(()=>{const u=new Map;for(const h of s.flatMap(p=>p.tests)){const p=Ui(h);if(!p)continue;const f=JC(h),m=u.get(p);m?m.description===void 0&&f!==void 0&&(m.description=f):u.set(p,{name:p,description:f})}return Array.from(u.values())})(),d=a>=4;return e.jsxs("div",{className:"text-sm space-y-5","data-testid":"build-progress-detail",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-[var(--accent-blue)] animate-pulse","aria-hidden":"true"}),e.jsx("span",{className:"text-[var(--text-primary)] font-medium",children:t?`Building ${t}…`:"Building…"})]}),e.jsxs("section",{"data-testid":"build-areas-changed",children:[e.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--text-secondary)] m-0 mb-1.5",children:"Areas being changed"}),s.length===0&&n.length===0?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Gathering changes…"}):e.jsxs("div",{className:"space-y-3",children:[s.length>0&&e.jsx("ul",{className:"list-none pl-0 m-0 space-y-2",children:s.map(u=>e.jsx("li",{children:e.jsx(Yi,{fn:u,testid:"build-area-function"})},`${u.filePath}::${u.name}`))}),i.length>0&&e.jsxs("div",{children:[s.length>0&&e.jsx("div",{className:"text-[11px] font-medium text-[var(--text-muted)] mb-1",children:"Other files"}),e.jsx("ul",{className:"list-none pl-0 m-0 space-y-0.5",children:i.map(u=>e.jsx(iy,{path:u.path,status:u.status,testid:"build-area-file"},u.path))})]})]})]}),e.jsxs("section",{"data-testid":"build-tests",children:[e.jsxs("h4",{className:"text-[11px] font-semibold uppercase tracking-wide text-[var(--text-secondary)] m-0 mb-1.5",children:["Tests validating the change",c.length>0&&e.jsxs("span",{className:"ml-1 text-[var(--text-muted)] font-normal normal-case tracking-normal",children:["(",c.length,")"]})]}),c.length===0?e.jsx("div",{className:"text-[var(--text-muted)]",children:"Tests will appear here as they’re written."}):e.jsx("ul",{className:"list-none pl-0 m-0 space-y-1",children:c.map(u=>e.jsxs("li",{"data-testid":"build-test-name",children:[e.jsx("div",{className:"font-mono text-xs text-[var(--text-primary)]",children:u.name}),u.description&&e.jsx("div",{className:"text-[10px] text-[var(--text-muted)] mt-0.5",children:u.description})]},u.name))})]}),e.jsxs("section",{"data-testid":"build-ways-to-test",children:[e.jsx(il,{ways:r??[]}),e.jsx("div",{className:"mt-1.5 text-xs text-[var(--text-muted)] italic",children:d?"Detailed ways to test appear once the build finishes verifying.":"Detailed ways to test appear once the build finishes."})]})]})}const _D=Object.freeze(Object.defineProperty({__proto__:null,BuildProgressDetail:ly},Symbol.toStringTag,{value:"Module"}));function z3(t){return t.filter(Boolean).join(" · ")}function $3(t){if(!t)return"";const n=Math.round(t.global.percent);if(t.previousGlobal==null)return`coverage ${n}%`;const s=Math.round(t.global.percent-t.previousGlobal);if(s===0)return`coverage ${n}% (±0)`;const r=s>0?"+":"−";return`coverage ${n}% (${r}${Math.abs(s)})`}function cy({stats:t,thresholds:n,trendDeltaSecs:s}){if(!t)return null;const r=t.runners.length||t.per_runner.length,a=t.per_runner.filter(i=>i.duration_ms!=null).map(i=>`${i.name} ${Math.round(i.duration_ms/1e3)}s`),o=z3([`${r} runner${r===1?"":"s"}`,`${t.passed} passed`,t.failed>0?`${t.failed} failed`:"",...a,$3(n),R3(s)]);return e.jsx("p",{className:"text-[11px] text-[var(--text-muted)] font-mono m-0","data-testid":"run-evidence-line",children:o})}const kD=Object.freeze(Object.defineProperty({__proto__:null,RunEvidenceLine:cy},Symbol.toStringTag,{value:"Module"})),B3=5e3;function dy(){const[t,n]=l.useState(null),[s,r]=l.useState(!0),{connectionState:a,recordFetch:o,markPolling:i}=w3(),c=l.useRef(null),d=l.useRef(null);d.current=t;const u=C3({onSummaryUpdate:n,getLastDurationMs:l.useCallback(()=>{var m,g;return(g=(m=d.current)==null?void 0:m.testRunnerStats)==null?void 0:g.duration_ms},[])});if(l.useEffect(()=>{async function m(){const g=await ho();o(g),g.ok&&g.data&&n(g.data),r(!1)}return m(),()=>{c.current&&clearInterval(c.current)}},[o]),l.useEffect(()=>(c.current&&(clearInterval(c.current),c.current=null),(t==null?void 0:t.live)===!0&&(c.current=setInterval(async()=>{i();const m=await ho();o(m),m.ok&&m.data&&n(m.data)},B3)),()=>{c.current&&clearInterval(c.current)}),[t==null?void 0:t.live,o,i]),s)return e.jsx("div",{className:"min-h-screen bg-[var(--bg-deep)] flex items-center justify-center",children:e.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-[var(--border-default)] border-t-[#005c75] rounded-full"})});if(!t)return e.jsx("div",{className:"min-h-screen bg-[var(--bg-deep)] flex items-center justify-center text-[var(--text-muted)] text-sm",children:"No session data available."});const h=t.step??0,p=t.functions.reduce((m,g)=>m+g.tests.length,0),f=g3(h,t.modifiedFiles.length,p);return e.jsx("div",{className:"min-h-screen bg-[var(--bg-deep)] p-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsx(Jx,{feature:t.feature,connectionState:a,statusChip:f,userPrompt:t.userPrompt}),e.jsx(cy,{stats:t.testRunnerStats,thresholds:t.coverageThresholds,trendDeltaSecs:t.suiteTrendDeltaSecs}),e.jsx("div",{className:"bg-[var(--bg-card)] border border-[var(--border-default)] rounded-lg p-5",children:t.narrative?e.jsx(ay,{narrative:t.narrative,functions:t.functions,rerun:u}):h>=3?e.jsx(ly,{feature:t.feature,modifiedFiles:t.modifiedFiles,functions:t.functions,waysToTestBaseline:t.waysToTestBaseline,step:h}):e.jsx(oy,{step:h})})]})})}const SD=Object.freeze(Object.defineProperty({__proto__:null,BackendResultsPage:dy},Symbol.toStringTag,{value:"Module"}));function uy(){return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-auto",style:{background:"var(--bg-deep)"},children:e.jsx(dy,{})})}const ND=Object.freeze(Object.defineProperty({__proto__:null,BackendResultsPanelView:uy},Symbol.toStringTag,{value:"Module"}));function hy({onClose:t,providerLabel:n}){const[s,r]=l.useState(""),a=l.useRef(null);return l.useEffect(()=>{var o;(o=a.current)==null||o.focus()},[]),l.useEffect(()=>{const o=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t]),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-1",children:"Create New State"}),e.jsxs("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:["Describe the state you want ",n," to build."]}),e.jsx("textarea",{ref:a,value:s,onChange:o=>r(o.target.value),placeholder:"e.g. Empty inbox with a friendly empty-state illustration",rows:5,className:"w-full px-3 py-2 text-sm rounded mb-4 resize-none focus:outline-none",style:{background:"var(--bg-input)",border:"1px solid var(--border-default)",color:"var(--text-primary)"}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-md text-sm transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},children:"Cancel"}),e.jsxs("button",{type:"button",disabled:!0,title:"Coming soon",className:"px-4 py-2 rounded-md text-sm font-medium opacity-50 cursor-not-allowed",style:{background:"var(--accent-active)",color:"var(--bg-deep)"},children:["Send to ",n]})]})]})})}const CD=Object.freeze(Object.defineProperty({__proto__:null,CreateStatePlaceholderModal:hy},Symbol.toStringTag,{value:"Module"}));function py({dragActive:t,inputRef:n,folderInputRef:s,onDragOver:r,onDragLeave:a,onDrop:o,onFilePick:i,onFolderPick:c}){return e.jsxs(e.Fragment,{children:[e.jsxs("label",{onDragOver:r,onDragLeave:a,onDrop:o,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"var(--spacing-xl, 32px)",border:`2px dashed ${t?"var(--accent-active)":"var(--border-default)"}`,borderRadius:12,background:t?"var(--bg-elevated, rgba(255,255,255,0.03))":"var(--bg-input)",cursor:"pointer",textAlign:"center",gap:"var(--spacing-xs, 4px)"},children:[e.jsx("input",{ref:n,type:"file",multiple:!0,onChange:i,style:{display:"none"}}),e.jsx("div",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-primary)",fontWeight:500},children:"Drop files or a folder here, or click to choose files"}),e.jsx("div",{style:{fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)"},children:"PNG, JPG, PDF, Markdown — anything that describes your design"})]}),e.jsx(Sd,{folderInputRef:s,onFolderPick:c})]})}const PD=Object.freeze(Object.defineProperty({__proto__:null,DesignAssetDropLabel:py},Symbol.toStringTag,{value:"Module"}));function my({pending:t,onDescriptionChange:n,onRemove:s}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-xs, 4px)",padding:"var(--spacing-sm, 8px)",border:"1px solid var(--border-default)",borderRadius:8,background:"var(--bg-input)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-primary)",fontWeight:500,overflowWrap:"anywhere"},children:t.relativePath}),e.jsx("button",{type:"button",onClick:()=>s(t.id),style:{fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:"Remove"})]}),e.jsx("textarea",{value:t.description,onChange:r=>n(t.id,r.target.value),placeholder:"What does this file show? (optional)",rows:2,style:{width:"100%",padding:"var(--spacing-sm, 8px)",background:"var(--bg-default)",border:"1px solid var(--border-default)",borderRadius:6,color:"var(--text-primary)",fontSize:"var(--text-xs, 12px)",resize:"vertical",outline:"none",fontFamily:"inherit"}})]})}const TD=Object.freeze(Object.defineProperty({__proto__:null,PendingFileCard:my},Symbol.toStringTag,{value:"Module"}));function fy({pending:t,onDescriptionChange:n,onRemove:s}){return t.length===0?null:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-sm, 8px)",marginTop:"var(--spacing-md, 12px)"},children:[e.jsx(kd,{count:t.length}),t.map(r=>e.jsx(my,{pending:r,onDescriptionChange:n,onRemove:s},r.id))]})}const OD=Object.freeze(Object.defineProperty({__proto__:null,PendingFileList:fy},Symbol.toStringTag,{value:"Module"}));function q3(t){return new Promise(n=>{t.file(s=>n(s),()=>n(null))})}function H3(t){return new Promise(n=>{const s=[],r=()=>{t.readEntries(a=>{if(a.length===0){n(s);return}s.push(...a),r()},()=>n(s))};r()})}function W3(t){return t.split("/").some(n=>n.startsWith("."))}async function gy(t,n,s){if(t.name.startsWith("."))return 0;const r=n?`${n}/${t.name}`:t.name;if(t.isFile){const a=await q3(t);return a?(s.push({file:a,relativePath:r}),0):1}if(t.isDirectory){const a=await H3(t.createReader());let o=0;for(const i of a)o+=await gy(i,r,s);return o}return 0}async function G3(t){const n=t.items;if(!(!!n&&n.length>0&&typeof n[0].webkitGetAsEntry=="function"))return{files:Array.from(t.files).map(i=>({file:i,relativePath:i.name})),skipped:0,expandedViaEntryApi:!1};const r=[];for(const i of Array.from(n)){const c=i.webkitGetAsEntry();c&&r.push(c)}const a=[];let o=0;for(const i of r)o+=await gy(i,"",a);return{files:a,skipped:o,expandedViaEntryApi:!0}}function U3(t){return Array.from(t).map(n=>({file:n,relativePath:n.webkitRelativePath||n.name})).filter(({relativePath:n})=>!W3(n))}function Y3(t){return t.size===0&&t.type===""}const V3="Folders can't be read in this browser — open the folder and drop the files inside it.";function K3(t,n,s){const r=[];let a=null;for(const o of t){if(!n&&Y3(o.file)){a=V3;continue}if(o.file.size>s){a=`${o.relativePath} is larger than the ${s/(1024*1024*1024)}GB safety ceiling`;continue}r.push(o)}return{valid:r,rejection:a}}function J3(t){const{files:n,skipped:s,expandedViaEntryApi:r}=t;return s>0&&n.length===0?"Couldn't read any of the files in that folder.":n.length===0&&r?"No files found in that folder.":s>0?`${s} item(s) couldn't be read and were skipped.`:null}async function X3(t){const n=new FormData;for(const a of t)n.append("path",a.relativePath),n.append("description",a.description),n.append("file",a.file,a.file.name);const s=await fetch("/api/editor-design-assets",{method:"POST",body:n});if(!s.ok)throw new Error(s.status===413?"That file is too large to add.":`Could not save assets (status ${s.status}).`);return(await s.json()).written??t.map(a=>a.relativePath)}function by({message:t}){return t?e.jsx("div",{style:{marginTop:"var(--spacing-sm, 8px)",color:"var(--accent-danger, #f87171)",fontSize:"var(--text-xs, 12px)"},children:t}):null}const AD=Object.freeze(Object.defineProperty({__proto__:null,AssetSaveErrorMessage:by},Symbol.toStringTag,{value:"Module"}));function xy({filenames:t}){return!t||t.length===0?null:e.jsxs("div",{style:{marginTop:"var(--spacing-sm, 8px)",color:"var(--text-secondary)",fontSize:"var(--text-xs, 12px)"},children:["Added ",t.length," file",t.length===1?"":"s","."]})}const RD=Object.freeze(Object.defineProperty({__proto__:null,AssetSaveSuccessMessage:xy},Symbol.toStringTag,{value:"Module"}));function yy({disabled:t,submitting:n,onClick:s}){return e.jsx("button",{type:"button",onClick:s,disabled:t,style:{marginTop:"var(--spacing-md, 12px)",padding:"var(--spacing-sm, 8px) var(--spacing-md, 12px)",background:t?"var(--bg-input)":"var(--accent-active)",color:t?"var(--text-muted)":"var(--text-on-accent, white)",border:t?"1px solid var(--border-default)":"1px solid var(--accent-active)",borderRadius:6,fontSize:"var(--text-sm, 14px)",fontWeight:500,cursor:t?"not-allowed":"pointer"},children:n?"Saving…":"Save assets"})}const ED=Object.freeze(Object.defineProperty({__proto__:null,SaveAssetsButton:yy},Symbol.toStringTag,{value:"Module"})),Q3=1024*1024*1024;function vy({onAssetsSaved:t}){const[n,s]=l.useState([]),[r,a]=l.useState(!1),[o,i]=l.useState(null),[c,d]=l.useState(null),[u,h]=l.useState(!1),p=l.useRef(null),f=l.useRef(null),m=l.useCallback((j,_)=>{const{valid:k,rejection:S}=K3(j,_,Q3);return d(S),s(N=>[...N,...k.map(({file:T,relativePath:A})=>({id:`${A}-${T.size}-${Math.random().toString(36).slice(2)}`,file:T,relativePath:A,description:""}))]),S!==null},[]),g=l.useCallback(async j=>{const _=await G3(j);if(m(_.files,_.expandedViaEntryApi))return;const k=J3(_);k&&d(k)},[m]),b=l.useCallback(j=>{j.target.files&&m(Array.from(j.target.files).map(_=>({file:_,relativePath:_.name})),!1),j.target.value=""},[m]),x=l.useCallback(j=>{if(j.target.files){const _=U3(j.target.files);m(_,!0),_.length===0&&d("No files found in that folder.")}j.target.value=""},[m]),y=l.useCallback((j,_)=>{s(k=>k.map(S=>S.id===j?{...S,description:_}:S))},[]),v=l.useCallback(j=>{s(_=>_.filter(k=>k.id!==j))},[]),w=l.useCallback(async()=>{if(n.length!==0){a(!0),d(null);try{const j=await X3(n);i(j),s([]),t==null||t(j)}catch(j){d(j instanceof Error?j.message:String(j))}finally{a(!1)}}},[n,t]);return e.jsxs(e.Fragment,{children:[e.jsx(py,{dragActive:u,inputRef:p,onDragOver:j=>{j.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:j=>{j.preventDefault(),h(!1),g(j.dataTransfer)},onFilePick:b,onFolderPick:x,folderInputRef:f}),e.jsx(fy,{pending:n,onDescriptionChange:y,onRemove:v}),e.jsx(by,{message:c}),e.jsx(xy,{filenames:o}),e.jsx(yy,{disabled:n.length===0||r,submitting:r,onClick:w})]})}const MD=Object.freeze(Object.defineProperty({__proto__:null,DesignAssetDropZone:vy},Symbol.toStringTag,{value:"Module"}));function jy(){const[t,n]=l.useState(null),s=l.useRef(!0),r=l.useCallback(async()=>{try{const a=await fetch("/api/editor-design-assets");if(!a.ok)return;const o=await a.json();s.current&&n(Array.isArray(o.assets)?o.assets:[])}catch{}},[]);return l.useEffect(()=>(s.current=!0,r(),()=>{s.current=!1}),[r]),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:{padding:"var(--spacing-lg, 16px)",gap:"var(--spacing-md, 12px)",overflow:"auto"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"var(--text-md, 15px)",fontWeight:600,color:"var(--text-primary)",marginBottom:"var(--spacing-xs, 4px)"},children:"Add design assets"}),e.jsx("div",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-secondary)",lineHeight:1.5},children:"Drag design assets onto codeyam-editor, or browse to add them — logos, screenshots, brand guides, inspiration. The agent reads whatever you add and folds it into the mockups."})]}),e.jsx(vy,{onAssetsSaved:r}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-sm, 8px)"},children:[e.jsx("div",{style:{fontSize:"var(--text-sm, 14px)",fontWeight:600,color:"var(--text-primary)"},children:"Added assets"}),t===null?e.jsx("div",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-secondary)"},children:"Loading…"}):t.length===0?e.jsx("div",{style:{fontSize:"var(--text-sm, 14px)",color:"var(--text-secondary)"},children:"No assets added yet."}):t.map(a=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-xs, 4px)",padding:"var(--spacing-sm, 8px)",border:"1px solid var(--border-default)",borderRadius:8,background:"var(--bg-input)"},children:[e.jsx("span",{style:{fontSize:"var(--text-sm, 14px)",fontWeight:500,color:"var(--text-primary)"},children:a.filename}),a.description.trim().length>0&&e.jsx("span",{style:{fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)"},children:a.description})]},a.filename))]})]})}const ID=Object.freeze(Object.defineProperty({__proto__:null,DesignAssetsView:jy},Symbol.toStringTag,{value:"Module"}));function Z3(t,n){var c;const s=[],r=Object.entries(n.vars).filter(([,d])=>d&&d.trim());if(r.length>0){const d=r.map(([u,h])=>` ${u}: ${h};`).join(`
|
|
48
|
+
`);s.push(`:root {
|
|
49
|
+
${d}
|
|
50
|
+
}`)}if(n.primaryFont){const d=Hc(n.primaryFont,n.primaryFontStack);s.push(`body, p, li, span, button, input, textarea, select, label { font-family: ${d} !important; }`)}if(n.secondaryFont){const d=Hc(n.secondaryFont,n.secondaryFontStack);s.push(`h1, h2, h3, h4, h5, h6, .heading, [class*="title"], [class*="headline"] { font-family: ${d} !important; }`)}const a=s.length>0?`<style data-codeyam-overrides="1">
|
|
51
|
+
${s.join(`
|
|
52
|
+
|
|
53
|
+
`)}
|
|
54
|
+
</style>`:"",o=n.fontsHref?`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
55
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
56
|
+
<link rel="stylesheet" href="${n.fontsHref}" data-codeyam-fonts="1">`:"";if(!a&&!o)return t;const i=t.search(/<\/head\s*>/i);if(i===-1){const d=t.search(/<body[^>]*>/i);if(d===-1)return`${o}
|
|
57
|
+
${a}
|
|
58
|
+
${t}`;const u=d+(((c=t.match(/<body[^>]*>/i))==null?void 0:c[0].length)??0);return`${t.slice(0,u)}
|
|
59
|
+
${o}
|
|
60
|
+
${a}
|
|
61
|
+
${t.slice(u)}`}return`${t.slice(0,i)}
|
|
62
|
+
${o}
|
|
63
|
+
${a}
|
|
64
|
+
${t.slice(i)}`}function Hc(t,n){const s=/\s/.test(t)?`"${t}"`:t,r=(n==null?void 0:n.trim())||"system-ui, sans-serif";return`${s}, ${r}`}const eP={vars:{},primaryFont:null,secondaryFont:null,primaryFontStack:null,secondaryFontStack:null};function ea(t){return t.replace(/^\d{1,2}-/,"").replace(/-mockup\.html$/i,"").replace(/\.html$/i,"")}function tP(t,n){if(t===null||t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(t[s].filename!==n[s].filename||t[s].url!==n[s].url||t[s].name!==n[s].name)return!1;return!0}const nP="\x1B[200~",sP="\x1B[201~";function rP(t,n=aP){const s=t.replace(/\r\n/g,"\r").replace(/\n/g,"\r"),r=`${nP}${s}${sP}`;return n(r),new Promise(a=>{setTimeout(()=>{n("\r"),a()},Qw)})}function aP(t){window.dispatchEvent(new CustomEvent("miniagent-send-input",{detail:t}))}function oP({feedbackByFilename:t,mockupFilenames:n}){const s={};for(const o of n){const i=t[o];if(!i)continue;const c=typeof i.rating=="number",d=i.comment.trim().length>0;!c&&!d||(s[o]={rating:c?i.rating:null,comment:i.comment.trim()})}return Object.keys(s).length===0?"Iterate: before regenerating anything, first ask the user in the chat which of these designs (if any) are close enough to keep and just tweak — and let them know that every other design will be discarded and redesigned fresh. Wait for their reply before writing any mockup. No per-card feedback was provided, so let their answer guide what to keep vs. redesign from scratch.":`Iterate: before regenerating anything, first ask the user in the chat which of these designs (if any) are close enough to keep and just tweak — and let them know that every other design will be discarded and redesigned fresh from the feedback below. Wait for their reply before writing any mockup.
|
|
65
|
+
|
|
66
|
+
Once they answer: for designs they choose to keep, refine them in place using their specific feedback, keeping the same numeric prefix and design system. For every other design, redesign it fresh from the feedback — each redesign must directly address the specific comment and rating for that card (a pointed comment is a concrete instruction the redesign must visibly resolve; a low rating means change direction further). For fresh redesigns, weigh the rating and comment to decide whether to keep the same design system with a new layout, or swap in a different system from .codeyam/design/design_systems/ — avoid duplicating a system already used by a kept card. When you change a slot's design system, delete the old NN-*.html file before writing the new NN-<newsystem>-mockup.html so each slot has exactly one file. Keep numeric filename prefixes stable so slots don't move.
|
|
67
|
+
|
|
68
|
+
Per-card feedback (rating is 1-100 or null; comment may be empty):
|
|
69
|
+
|
|
70
|
+
\`\`\`json
|
|
71
|
+
`+JSON.stringify(s,null,2)+"\n```"}const iP=9e4;function lP(t){return!!(t.agentRespondedAfterDispatch||cP(t.snapshotFilenames,t.latestFilenames))}function cP(t,n){if(t.length!==n.length)return!0;const s=[...t].sort(),r=[...n].sort();for(let a=0;a<s.length;a++)if(s[a]!==r[a])return!0;return!1}function dP(t){const n={},s={},r=t.split(`
|
|
72
|
+
`);let a=!1,o=[];for(const i of r){const c=i.trim();if(/^```/.test(c)){a=!a;continue}if(a)continue;const d=/^(#{1,6})\s+(.+)$/.exec(c);if(d){const g=d[1].length;o=o.slice(0,g-1),o[g-1]=d[2].trim();continue}if(!c.startsWith("|"))continue;const u=c.split("|").map(g=>g.trim());if(u.length<3)continue;const h=u[1].replace(/`/g,"").trim(),p=u[2].replace(/`/g,"").trim();if(!/^--[A-Za-z0-9_-]+$/.test(h)||!uP(p))continue;const f=o.filter(Boolean).join(" / "),m=wy(f)?s:n;h in m||(m[h]=p)}return{light:n,dark:s}}function wy(t){return/\bdark[\s-]?mode\b|\bdark\b\s*(palette|variant|theme)?/i.test(t)}function uP(t){return!!(/^#[0-9a-fA-F]{3,8}$/.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)||/^oklch\(/i.test(t))}const hP=["Background","Surface","Text","Primary","Secondary","Accent"],pP={Background:[/^--bg(-default|-page|-canvas|-base)?$/,/^--page(-bg)?$/,/^--canvas$/,/^--background$/,/^--light-linen$/,/^--paper$/,/^--body-bg$/,/-canvas$/,/-page-bg$/],Surface:[/^--bg-surface$/,/^--surface(-1|-elevated)?$/,/^--card(-bg)?$/,/^--bg-elevated$/,/^--marketplace-gray$/,/^--panel(-bg)?$/,/^--cream$/,/-surface$/,/-porcelain-surface$/],Text:[/^--text(-primary|-default)?$/,/^--fg(-default)?$/,/^--foreground$/,/^--ink$/,/^--pitch-black$/,/^--body-text$/,/^--ink-text$/,/-ink-text$/,/-graphite-text$/],Primary:[/^--primary$/,/^--accent(-primary)?$/,/^--brand(-primary)?$/,/^--creator-pink$/,/^--palette-1$/,/^--lime$/,/^--burgundy$/,/-amethyst-accent$/,/-accent$/],Secondary:[/^--secondary$/,/^--accent-secondary$/,/^--brand-secondary$/,/^--sunshine-yellow$/,/^--palette-2$/,/^--sage$/,/^--sky-blue$/,/-sky-blue-highlight$/,/-highlight$/],Accent:[/^--accent(-tertiary|-highlight)?$/,/^--highlight$/,/^--lime-glow$/,/^--lime-deep$/,/^--firecracker-orange$/,/^--sky-blue$/,/^--gold$/,/^--palette-3$/,/-detail$/]};function mP(t){const n=[],s=t.split(`
|
|
73
|
+
`);let r=!1,a="",o=0,i=null,c=[];for(let d=0;d<s.length;d++){const h=s[d].trim();if(!r){const p=/^(#{1,6})\s+(.+)$/.exec(h);if(p){const m=p[1].length;c=c.slice(0,m-1),c[m-1]=p[2].trim(),i=p[2].trim();continue}const f=/^```(\w*)/.exec(h);f&&(r=!0,a=f[1].toLowerCase(),o=d+1);continue}if(h==="```"){if(a==="css"||a===""){const p=s.slice(o,d).join(`
|
|
74
|
+
`);for(const f of gP(p)){const m=c.filter(Boolean).join(" / "),g=fP(f.selector)||wy(m);n.push({selector:f.selector,heading:i,isDark:g,vars:f.vars})}}r=!1,a=""}}return n}function fP(t){return/\[data-theme[~|*$^]?="?dark"?\]/.test(t)}function gP(t){const n=[],s=/(:root[^\{]*?)\{([\s\S]*?)\}/g;let r;for(;(r=s.exec(t))!==null;){const a=r[1].trim(),o=r[2],i={},c=/(--[A-Za-z0-9_-]+)\s*:\s*([^;\n]+?)\s*(?:;|$)/g;let d;for(;(d=c.exec(o))!==null;){const u=d[1],h=d[2].replace(/\/\*.*?\*\//g,"").trim();h&&(i[u]=h)}Object.keys(i).length>0&&n.push({selector:a,vars:i})}return n}function bP(t,n){const s=pP[n];for(const r of Object.keys(t))for(const a of s)if(a.test(r))return{cssVar:r,value:t[r]};return{cssVar:null,value:null}}function xP(t){const n=/\[data-palette[~|*$^]?="?([^"\]]+)"?\]/.exec(t);return n?n[1].split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "):null}function yP(t){if(!t)return"Default";let n=t.replace(/\(.+?\)/g,"");return n=n.replace(/\bpalette\b/i,"").replace(/\bmode\b/i,""),/\bdark\b/i.test(n)?"Default":(n=n.replace(/\bdark\b/i,""),n=n.replace(/\blight\b/i,""),n=n.trim().replace(/\s+/g," "),n||"Default")}function Wc(t){const n=hP.map(s=>{const{cssVar:r,value:a}=bP(t,s);return{label:s,cssVar:r,value:a}});return{vars:t,slots:n}}function ll(t){const n=mP(t),s=new Map,r=new Map,a=[];for(const o of n){const c=xP(o.selector)??yP(o.heading);a.includes(c)||a.push(c),o.isDark?r.has(c)||r.set(c,o.vars):s.has(c)||s.set(c,o.vars)}if(s.size===0){const o=dP(t);o.light&&Object.keys(o.light).length>0&&(a.unshift("Default"),s.set("Default",o.light),o.dark&&Object.keys(o.dark).length>0&&r.set("Default",o.dark))}return a.map(o=>{const i=s.get(o);if(!i)return null;const c=r.get(o)??null;return{name:o,light:Wc(i),dark:c?Wc(c):null}}).filter(o=>o!==null)}function vP(t){const n=Object.keys(t);if(n.length===0)return{};const s=Sy(t),r={};for(const a of n){const o=t[a];if(!o||!o.trim())continue;const i=s.get(a)??null;r[a]=_P(o,i)}return r}const _y="#0f1115",jP="#181b21",ky="#e8eaed";function wP(t){const n=Sy(t);let s=null,r=null;for(const[a,o]of n){const i=t[a];!i||!i.trim()||(o==="Background"&&s===null&&(s=i),o==="Text"&&r===null&&(r=i))}return{bg:s??_y,text:r??ky}}function Sy(t){var i;const s=["```css",":root {",Object.entries(t).map(([c,d])=>` ${c}: ${d};`).join(`
|
|
75
|
+
`),"}","```"].join(`
|
|
76
|
+
`),r=ll(s),a=new Map,o=((i=r[0])==null?void 0:i.light.slots)??[];for(const c of o)c.cssVar&&a.set(c.cssVar,c.label);return a}function _P(t,n){switch(n){case"Background":return _y;case"Surface":return jP;case"Text":return ky;case"Primary":case"Secondary":case"Accent":return Gc(t);default:return Gc(t)}}function Gc(t){const n=kP(t.trim());if(!n)return t;const{h:s,s:r,l:a}=SP(n.r,n.g,n.b),{r:o,g:i,b:c}=NP(s,r,1-a),d=u=>u.toString(16).padStart(2,"0");return n.a!=null&&n.a<1?`rgba(${o}, ${i}, ${c}, ${n.a})`:`#${d(o)}${d(i)}${d(c)}`}function kP(t){const n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);if(n){let r=n[1];return r.length===3&&(r=r.split("").map(a=>a+a).join("")),{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}const s=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i.exec(t);return s?{r:Aa(parseInt(s[1],10)),g:Aa(parseInt(s[2],10)),b:Aa(parseInt(s[3],10)),a:s[4]!=null?parseFloat(s[4]):void 0}:null}function Aa(t){return Math.max(0,Math.min(255,t))}function SP(t,n,s){const r=t/255,a=n/255,o=s/255,i=Math.max(r,a,o),c=Math.min(r,a,o),d=(i+c)/2;let u=0,h=0;if(i!==c){const p=i-c;switch(h=d>.5?p/(2-i-c):p/(i+c),i){case r:u=(a-o)/p+(a<o?6:0);break;case a:u=(o-r)/p+2;break;default:u=(r-a)/p+4;break}u/=6}return{h:u,s:h,l:d}}function NP(t,n,s){if(n===0){const i=Math.round(s*255);return{r:i,g:i,b:i}}const r=(i,c,d)=>{let u=d;return u<0&&(u+=1),u>1&&(u-=1),u<1/6?i+(c-i)*6*u:u<1/2?c:u<2/3?i+(c-i)*(2/3-u)*6:i},a=s<.5?s*(1+n):s+n-s*n,o=2*s-a;return{r:Math.round(r(o,a,t+1/3)*255),g:Math.round(r(o,a,t)*255),b:Math.round(r(o,a,t-1/3)*255)}}function CP(t){const[n,s]=l.useState({}),r=l.useRef(!0);return l.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),l.useEffect(()=>{if(!t)return;const a=new Set,o=t.map(i=>ea(i.filename)).filter(i=>a.has(i)?!1:(a.add(i),!(i in n)));o.length!==0&&(async()=>{var i,c,d;for(const u of o)try{const h=await fetch(`/api/editor-design-systems/${u}`);if(!h.ok)continue;const p=await h.json().catch(()=>null);if(!(p!=null&&p.content)){r.current&&s(x=>({...x,[u]:null}));continue}const f=ll(p.content),m=((c=(i=f[0])==null?void 0:i.dark)==null?void 0:c.vars)??null,g=((d=f[0])==null?void 0:d.light.vars)??null,b=m&&Object.keys(m).length>0?m:g&&Object.keys(g).length>0?vP(g):null;r.current&&s(x=>({...x,[u]:b}))}catch{r.current&&s(h=>({...h,[u]:null}))}})()},[t,n]),n}function PP(){const[t,n]=l.useState([]);return l.useEffect(()=>{let s=!1;async function r(){try{const o=await fetch("/api/editor-mockups-history");if(!o.ok)return;const i=await o.json();s||n(Array.isArray(i)?i:[])}catch{}}r();const a=window.setInterval(r,4e3);return()=>{s=!0,window.clearInterval(a)}},[]),t}function Ny({round:t,onRestore:n,restoring:s=!1}){if(!t||!t.mockups||t.mockups.length===0)return e.jsx(oi,{});const r=t.feedback??{};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-md, 14px)"},children:[n&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx("button",{type:"button",onClick:n,disabled:s,style:{padding:"6px 14px",background:"transparent",color:"var(--accent-active, #D7FF63)",border:"1px solid var(--accent-active, #D7FF63)",borderRadius:6,fontSize:"var(--text-sm, 13px)",fontWeight:500,cursor:s?"default":"pointer",opacity:s?.6:1},children:s?"Bringing back…":"Bring back this round"})}),e.jsx("div",{"data-mockup-archived-round":!0,style:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"var(--spacing-lg, 16px)",rowGap:"var(--spacing-xl, 28px)"},children:t.mockups.map((a,o)=>{const i=r[a.filename],c=o+1,d=a.name.replace(/^\d{1,2}-/,"").replace(/-/g," ");return e.jsxs("div",{style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-default)",borderRadius:12,overflow:"hidden",background:"var(--bg-surface)"},children:[e.jsxs("div",{style:{padding:"var(--spacing-sm, 10px) var(--spacing-md, 14px)",display:"flex",alignItems:"center",gap:6,color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)"},children:[e.jsx("span",{style:{fontWeight:700,color:"var(--text-muted)"},children:String(c).padStart(2,"0")}),e.jsx("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",style:{textTransform:"capitalize",fontWeight:500,color:"var(--text-primary)",textDecoration:"none"},children:d})]}),e.jsx("iframe",{src:a.url,title:a.name,sandbox:"",style:{width:"100%",aspectRatio:"1 / 1",border:"none",pointerEvents:"none",background:"var(--bg-card, #1a1a1a)"}}),i&&(typeof i.rating=="number"||i.comment.trim().length>0)&&e.jsxs("div",{style:{padding:"var(--spacing-sm, 10px) var(--spacing-md, 14px)",borderTop:"1px solid var(--border-default)",display:"flex",flexDirection:"column",gap:4,fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)"},children:[typeof i.rating=="number"&&e.jsxs("div",{children:[e.jsxs("span",{style:{color:"var(--text-muted)"},children:["Rating ·"," "]}),e.jsxs("span",{style:{color:"var(--text-primary)"},children:[i.rating,"/100"]})]}),i.comment.trim().length>0&&e.jsxs("div",{style:{lineHeight:1.4},children:[e.jsxs("span",{style:{color:"var(--text-muted)"},children:["Note ·"," "]}),e.jsx("span",{style:{color:"var(--text-primary)"},children:i.comment})]})]})]},a.filename)})})]})}const DD=Object.freeze(Object.defineProperty({__proto__:null,MockupArchivedRoundView:Ny},Symbol.toStringTag,{value:"Module"})),cl=[{family:"Archivo",category:"sans",weights:[400,500,600,700]},{family:"DM Sans",category:"sans",weights:[400,500,700]},{family:"Inter",category:"sans",weights:[400,500,600,700]},{family:"Karla",category:"sans",weights:[400,500,700]},{family:"Manrope",category:"sans",weights:[400,500,700]},{family:"Nunito",category:"sans",weights:[400,600,700]},{family:"Plus Jakarta Sans",category:"sans",weights:[400,500,700]},{family:"Public Sans",category:"sans",weights:[400,500,700]},{family:"Roboto",category:"sans",weights:[400,500,700]},{family:"Work Sans",category:"sans",weights:[400,500,700]},{family:"Cormorant Garamond",category:"serif",weights:[400,500,700]},{family:"Crimson Pro",category:"serif",weights:[400,600,700]},{family:"Fraunces",category:"serif",weights:[400,600,700]},{family:"Lora",category:"serif",weights:[400,500,700]},{family:"Merriweather",category:"serif",weights:[400,700]},{family:"Playfair Display",category:"serif",weights:[400,600,700]},{family:"Source Serif 4",category:"serif",weights:[400,600,700]},{family:"Abril Fatface",category:"display",weights:[400]},{family:"Bebas Neue",category:"display",weights:[400]},{family:"Bricolage Grotesque",category:"display",weights:[400,600,800]},{family:"Chakra Petch",category:"display",weights:[400,600,700]},{family:"Lexend",category:"display",weights:[400,500,700]},{family:"Outfit",category:"display",weights:[400,600,800]},{family:"Rubik",category:"display",weights:[400,500,700]},{family:"Space Grotesk",category:"display",weights:[400,500,700]},{family:"Syne",category:"display",weights:[400,600,800]},{family:"Unbounded",category:"display",weights:[400,600,800]},{family:"Fira Code",category:"mono",weights:[400,500,700]},{family:"IBM Plex Mono",category:"mono",weights:[400,500,600]},{family:"JetBrains Mono",category:"mono",weights:[400,500,700]},{family:"Space Mono",category:"mono",weights:[400,700]}],TP={sans:"Sans-serif",serif:"Serif",display:"Display",mono:"Monospace"};function Cy(t){const n=new Set,s=[];for(const r of t){if(!r||n.has(r))continue;n.add(r);const a=cl.find(c=>c.family===r),o=(a==null?void 0:a.weights)??[400,700],i=r.replace(/ /g,"+");s.push(`family=${i}:wght@${o.join(";")}`)}return s.length===0?"":`https://fonts.googleapis.com/css2?${s.join("&")}&display=swap`}function OP(t,n,s){const r={},a=Uc(t,s),o=Uc(n,s),i=new Map;for(const c of a)c.cssVar&&i.set(c.label,c.cssVar);for(const c of o){if(!c.value)continue;const d=i.get(c.label)??c.cssVar;d&&(r[d]=c.value)}return r}function Uc(t,n){return t?n==="dark"&&t.dark?t.dark.slots:t.light.slots:[]}function AP(t,n,s){var a,o;return n!=="dark"?s:{...((o=(a=t[0])==null?void 0:a.dark)==null?void 0:o.vars)??{},...s}}function RP(t,n){const[s,r]=l.useState({kind:"loading"});return l.useEffect(()=>{let a=!1;return r({kind:"loading"}),(async()=>{try{const[o,i]=await Promise.all([fetch(t),fetch(`/api/editor-design-systems/${n}`)]),c=await o.text();let d="";if(i.ok){const u=await i.json().catch(()=>null);d=(u==null?void 0:u.content)??""}if(a)return;r({kind:"ready",html:c,palettes:ll(d)})}catch(o){a||r({kind:"error",message:o instanceof Error?o.message:String(o)})}})(),()=>{a=!0}},[t,n]),s}function Py(t,n,s){l.useEffect(()=>{if(!t)return;const r=o=>{var c;const i=o.target;(c=n.current)!=null&&c.contains(i)||s()},a=o=>{o.key==="Escape"&&s()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a)}},[t,n,s])}function Ys(t,n,s){return{name:t,light:Yc(n),dark:s?Yc(s):null}}function Yc(t){const n=[{label:"Background",cssVar:"--bg-default",value:t.bg},{label:"Surface",cssVar:"--bg-surface",value:t.surface},{label:"Text",cssVar:"--text-primary",value:t.text},{label:"Primary",cssVar:"--accent-primary",value:t.primary},{label:"Secondary",cssVar:"--accent-secondary",value:t.secondary},{label:"Accent",cssVar:"--accent-highlight",value:t.accent}],s={};for(const r of n)r.cssVar&&r.value&&(s[r.cssVar]=r.value);return{vars:s,slots:n}}function EP(){return[Ys("Lime Bright",{bg:"#F4F4EE",surface:"#FFFFFF",text:"#0F0F0F",primary:"#D7FF63",secondary:"#9DA48F",accent:"#FF6B5C"},{bg:"#14160F",surface:"#25251F",text:"#F1EFEA",primary:"#D7FF63",secondary:"#4D5247",accent:"#FF6B5C"}),Ys("Warm Cream",{bg:"#EFE9DA",surface:"#F8F3E7",text:"#3B2F1C",primary:"#C44536",secondary:"#7A9E7E",accent:"#EAA64A"},{bg:"#1F1A11",surface:"#2A2418",text:"#EFE9DA",primary:"#E07767",secondary:"#A9CBA9",accent:"#EAA64A"}),Ys("Cool Mono",{bg:"#F5F6F8",surface:"#FFFFFF",text:"#101218",primary:"#2B2D3A",secondary:"#8B8FA3",accent:"#5C8DFF"},{bg:"#0E1016",surface:"#181B23",text:"#E9EBF2",primary:"#E9EBF2",secondary:"#8B8FA3",accent:"#7CA0FF"}),Ys("Bold Pop",{bg:"#FFF8F0",surface:"#FFFFFF",text:"#181818",primary:"#FF3D7F",secondary:"#3DD2FF",accent:"#FFD60A"},{bg:"#161113",surface:"#1F1A1D",text:"#FFF8F0",primary:"#FF3D7F",secondary:"#3DD2FF",accent:"#FFD60A"})]}function Ty({palettes:t,activeName:n,theme:s,onApply:r}){const a=(()=>{const o=new Set(t.map(c=>c.name.toLowerCase())),i=EP().filter(c=>!o.has(c.name.toLowerCase()));return[...t,...i]})();return e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:a.map(o=>{const i=s==="dark"&&o.dark?o.dark:o.light,c=o.name===n;return e.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":c,"aria-label":`Apply ${o.name} palette`,title:o.name,style:{padding:4,border:c?"2px solid var(--accent-active, #D7FF63)":"1px solid var(--border-default)",borderRadius:8,background:"var(--bg-elevated)",cursor:"pointer"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 18px)",gridTemplateRows:"repeat(2, 18px)",gap:2},children:i.slots.map(d=>e.jsx("span",{title:d.label,style:{width:18,height:18,borderRadius:4,border:"1px solid var(--border-default)",background:d.value??"transparent"}},d.label))})},o.name)})})}const LD=Object.freeze(Object.defineProperty({__proto__:null,ColorPalettePicker:Ty},Symbol.toStringTag,{value:"Module"}));function Oy({slots:t,values:n,onChange:s}){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:"8px 16px"},children:t.map(r=>{const a=!r.cssVar,o=r.cssVar?n[r.cssVar]??r.value??"":"",i=MP(o);return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"70px 1fr 80px",alignItems:"center",gap:6,opacity:a?.4:1,minWidth:0},children:[e.jsx("span",{style:{fontSize:"var(--text-xs, 12px)",color:"var(--text-primary)",fontWeight:500},children:r.label}),e.jsx("input",{type:"color","aria-label":`${r.label} color`,disabled:a,value:i,onChange:c=>{r.cssVar&&s(r.cssVar,c.target.value)},style:{width:"100%",height:28,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-elevated)",cursor:a?"not-allowed":"pointer"}}),e.jsx("input",{type:"text","aria-label":`${r.label} hex`,disabled:a,value:o,onChange:c=>{r.cssVar&&s(r.cssVar,c.target.value)},spellCheck:!1,style:{padding:"4px 6px",fontSize:"var(--text-xs, 12px)",fontFamily:"var(--font-mono, monospace)",border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-elevated)",color:"var(--text-primary)"}})]},r.label)})})}function MP(t){const n=t.trim();return/^#[0-9a-fA-F]{6}$/.test(n)?n.toLowerCase():/^#[0-9a-fA-F]{3}$/.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`.toLowerCase():"#000000"}const FD=Object.freeze(Object.defineProperty({__proto__:null,ColorSwatchEditor:Oy},Symbol.toStringTag,{value:"Module"}));function mo({children:t}){return e.jsx("h4",{style:{margin:"0 0 8px",fontFamily:"var(--font-mono, 'IBM Plex Mono', monospace)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.08em"},children:t})}const zD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizePanelSectionHeading:mo},Symbol.toStringTag,{value:"Module"}));function Ay({palettes:t,activeName:n,theme:s,slots:r,vars:a,onApplyPalette:o,onColorChange:i}){return e.jsxs("div",{role:"menu",style:{padding:"var(--spacing-md, 12px)",background:"var(--bg-surface)",borderBottom:"1px solid var(--border-default)",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{children:[e.jsx(mo,{children:"Palettes"}),e.jsx(Ty,{palettes:t,activeName:n,theme:s,onApply:o})]}),e.jsxs("div",{children:[e.jsx(mo,{children:"Individual colors"}),e.jsx(Oy,{slots:r,values:a,onChange:i})]})]})}const $D=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizeColorsPanel:Ay},Symbol.toStringTag,{value:"Module"}));function Ry({message:t}){return e.jsx("div",{style:{padding:"var(--spacing-md, 12px)",color:"var(--accent-danger, #f87171)",fontSize:"var(--text-sm, 14px)"},children:t})}const BD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizeErrorBanner:Ry},Symbol.toStringTag,{value:"Module"}));let Vc=!1;function IP(){if(Vc||typeof document>"u")return;Vc=!0;const t=Cy(cl.map(s=>s.family));if(!t)return;const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.codeyamFontPreviews="1",document.head.appendChild(n)}function fo({label:t,value:n,onChange:s,hint:r}){const[a,o]=l.useState(!1),i=l.useRef(null),c=l.useRef(null),d=l.useRef(null);l.useEffect(()=>{IP()},[]);const u=l.useCallback(()=>o(!1),[]);Py(a,d,u);const h={sans:[],serif:[],display:[],mono:[]};for(const p of cl)h[p.category].push(p);return e.jsxs("div",{ref:d,style:{display:"flex",flexDirection:"column",gap:4,fontSize:"var(--text-xs, 12px)",color:"var(--text-primary)",position:"relative"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono, 'IBM Plex Mono', monospace)",fontSize:11,fontWeight:500,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)"},children:t}),r&&e.jsx("span",{style:{color:"var(--text-secondary)",fontStyle:"italic"},children:r}),e.jsxs("button",{ref:i,type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>o(p=>!p),style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,padding:"6px 10px",background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:6,fontSize:"var(--text-sm, 14px)",fontFamily:n?`"${n}", system-ui, sans-serif`:"inherit",cursor:"pointer",textAlign:"left"},children:[e.jsx("span",{children:n??"System default"}),e.jsx("span",{"aria-hidden":!0,style:{opacity:.6},children:"▾"})]}),a&&e.jsxs("div",{ref:c,role:"listbox",style:{position:"absolute",top:"100%",left:0,right:0,marginTop:4,zIndex:20,background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",maxHeight:320,overflowY:"auto",padding:4},children:[e.jsx(go,{family:null,label:"System default",isActive:n===null,onPick:()=>{s(null),o(!1)}}),Object.keys(h).map(p=>e.jsxs("div",{children:[e.jsx("div",{style:{padding:"6px 10px 2px",fontSize:"var(--text-xs, 11px)",color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:700},children:TP[p]}),h[p].map(f=>e.jsx(go,{family:f.family,label:f.family,isActive:n===f.family,onPick:()=>{s(f.family),o(!1)}},f.family))]},p))]})]})}function go({family:t,label:n,isActive:s,onPick:r}){return e.jsx("button",{type:"button",role:"option","aria-selected":s,onClick:r,style:{display:"block",width:"100%",padding:"8px 10px",background:s?"var(--bg-elevated)":"transparent",color:"var(--text-primary)",border:"none",borderRadius:4,fontSize:16,fontFamily:t?`"${t}", system-ui, sans-serif`:"inherit",textAlign:"left",cursor:"pointer"},children:n})}const qD=Object.freeze(Object.defineProperty({__proto__:null,FontOptionRow:go,FontPicker:fo},Symbol.toStringTag,{value:"Module"}));function Ey({primaryFont:t,secondaryFont:n,onPrimaryChange:s,onSecondaryChange:r}){return e.jsxs("div",{role:"menu",style:{padding:"var(--spacing-md, 12px)",background:"var(--bg-surface)",borderBottom:"1px solid var(--border-default)",display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:[e.jsx(fo,{label:"Headings",value:n,onChange:r}),e.jsx(fo,{label:"Body text",value:t,onChange:s})]})}const HD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizeFontsPanel:Ey},Symbol.toStringTag,{value:"Module"}));function dl(t){const n=/<meta\b[^>]*>/gi;let s;for(;(s=n.exec(t))!==null;){const r=s[0];if(!/name=["']codeyam-viewport["']/i.test(r))continue;const a=/content=["']([^"']+)["']/i.exec(r);if(!a)continue;const o=a[1].toLowerCase().trim();return o==="desktop"||o==="tablet"||o==="mobile"?o:null}return null}function DP(t,n){const{vars:s,bg:r,text:a}=LP(n),o=Object.entries(s).filter(([,p])=>p&&p.trim());if(o.length===0)return t;const i=[`:root {
|
|
77
|
+
`+o.map(([p,f])=>` ${p}: ${f};`).join(`
|
|
78
|
+
`)+`
|
|
79
|
+
}`,":root { color-scheme: dark; }"];r&&r.trim()&&a&&a.trim()&&i.push(`html, body { background: ${r}; color: ${a}; }`);const c=`<style data-codeyam-dark="1">${i.join(`
|
|
80
|
+
`)}</style>`;if(t.search(/<\/head\s*>/i)===-1)return`${c}
|
|
81
|
+
${t}`;const u=FP(t),h=u.search(/<\/head\s*>/i);return`${u.slice(0,h)}
|
|
82
|
+
${c}
|
|
83
|
+
${u.slice(h)}`}function LP(t){return t&&typeof t=="object"&&"vars"in t&&typeof t.vars=="object"?t:{vars:t}}function FP(t){const n=/<html\b([^>]*)>/i,s=n.exec(t);if(!s)return t;let r=s[1];/\bdata-theme\s*=/.test(r)||(r+=' data-theme="dark"');const a=/\bclass\s*=\s*("|')([\s\S]*?)\1/,o=a.exec(r);if(o){const i=o[2].split(/\s+/).filter(Boolean);if(!i.includes("dark")){const c=[...i,"dark"].join(" ");r=r.replace(a,`class=${o[1]}${c}${o[1]}`)}}else r+=' class="dark"';return t.replace(n,`<html${r}>`)}function My({html:t,srcDoc:n,theme:s,mockupUrl:r,mockupName:a}){const o=dl(t)??"desktop",i=o==="mobile"||o==="tablet",c=o==="mobile"?390:o==="tablet"?834:null;return e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",background:i?"#1a1a1a":"white",backgroundImage:i?"radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px)":void 0,backgroundSize:i?"12px 12px":void 0,display:"flex",justifyContent:"center"},children:e.jsx("iframe",{title:`Customize preview: ${a}`,srcDoc:n,sandbox:"",style:{width:i&&c?`${c}px`:"100%",height:"100%",minHeight:800,border:"none",background:"white",flexShrink:0}},`${r}-${s}`)})}const WD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizePreviewArea:My},Symbol.toStringTag,{value:"Module"}));function ul({theme:t,onToggle:n,size:s=28}){return e.jsx("button",{type:"button",onClick:n,"aria-label":t==="light"?"Switch to dark mode":"Switch to light mode","aria-pressed":t==="dark",title:t==="light"?"Dark mode":"Light mode",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:s,height:s,background:"var(--bg-card, #1a1a1a)",border:"1px solid var(--border-default)",borderRadius:6,cursor:"pointer",color:"var(--text-primary)",padding:0,fontSize:14,lineHeight:1},children:t==="light"?"☾":"☀"})}const GD=Object.freeze(Object.defineProperty({__proto__:null,MockupCardThemeToggleButton:ul},Symbol.toStringTag,{value:"Module"}));function Vs(t){return{height:28,padding:"0 8px",background:t?"#555":"#3a3a3a",color:t?"#ffffff":"#d1d5db",border:"none",borderRadius:4,fontSize:11,fontFamily:"var(--font-mono, 'IBM Plex Mono', monospace)",fontWeight:400,letterSpacing:"0.04em",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4}}function Iy({systemName:t,openMenu:n,theme:s,hasDark:r,saving:a,toolbarRef:o,onBack:i,onToggleMenu:c,onToggleTheme:d,onReset:u,onSave:h}){return e.jsxs("div",{ref:o,style:{display:"flex",alignItems:"center",gap:8,padding:"0 8px",height:40,borderBottom:"1px solid #3d3d3d",background:"#2d2d2d",flexWrap:"nowrap"},children:[e.jsx("button",{type:"button",onClick:i,"aria-label":"Back to mockups",style:{...Vs(!1),background:"transparent"},children:"← Back"}),e.jsxs("span",{style:{color:"#9ca3af",fontSize:13,fontFamily:"'IBM Plex Sans', system-ui, sans-serif",fontWeight:400,marginRight:4},children:["Customize: ",t]}),e.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":n==="fonts",onClick:()=>c("fonts"),style:Vs(n==="fonts"),children:["Fonts ",e.jsx("span",{"aria-hidden":!0,style:{opacity:.7},children:"▾"})]}),e.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":n==="colors",onClick:()=>c("colors"),style:Vs(n==="colors"),children:["Colors ",e.jsx("span",{"aria-hidden":!0,style:{opacity:.7},children:"▾"})]}),e.jsx("button",{type:"button",onClick:u,style:{...Vs(!1),background:"transparent",color:"#9ca3af"},children:"Reset"}),e.jsx("div",{style:{flex:1}}),r&&e.jsx(ul,{theme:s,onToggle:d,size:28}),e.jsx("button",{type:"button",onClick:h,disabled:a,style:{height:28,padding:"0 10px",background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #0F0F0F)",border:"none",borderRadius:4,fontSize:11,fontFamily:"var(--font-mono, 'IBM Plex Mono', monospace)",fontWeight:500,letterSpacing:"0.04em",cursor:a?"wait":"pointer",opacity:a?.7:1},children:a?"SAVING…":"SAVE"})]})}const UD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizeToolbar:Iy},Symbol.toStringTag,{value:"Module"}));function Dy({mockup:t,systemName:n,initial:s,onBack:r,onSave:a,saving:o=!1}){var T;const i=RP(t.url,n),[c,d]=l.useState(s),[u,h]=l.useState(null),[p,f]=l.useState("light"),[m,g]=l.useState(null),b=l.useRef(null),x=l.useCallback(()=>g(null),[]);Py(m!==null,b,x);const y=l.useMemo(()=>{const A=[];return c.primaryFont&&A.push(c.primaryFont),c.secondaryFont&&A.push(c.secondaryFont),A.length===0?null:Cy(A)},[c.primaryFont,c.secondaryFont]),v=l.useMemo(()=>i.kind!=="ready"?c.vars:AP(i.palettes,p,c.vars),[i,c.vars,p]),w=l.useMemo(()=>i.kind!=="ready"?"":Z3(i.html,{...c,vars:v,fontsHref:y}),[i,c,v,y]),j=l.useCallback(A=>{h(A.name);const M=i.kind==="ready"?i.palettes[0]:void 0,C=OP(M,A,p);d(H=>({...H,vars:{...H.vars,...C}}))},[i,p]),_=l.useCallback((A,M)=>{h(null),d(C=>({...C,vars:{...C.vars,[A]:M}}))},[]),k=l.useCallback(()=>{d({vars:{},primaryFont:null,secondaryFont:null,primaryFontStack:null,secondaryFontStack:null}),h(null)},[]),S=l.useMemo(()=>{if(i.kind!=="ready"||i.palettes.length===0)return[{label:"Background",cssVar:"--bg-default",value:null},{label:"Surface",cssVar:"--bg-surface",value:null},{label:"Text",cssVar:"--text-primary",value:null},{label:"Primary",cssVar:"--accent-primary",value:null},{label:"Secondary",cssVar:"--accent-secondary",value:null},{label:"Accent",cssVar:"--accent-highlight",value:null}];const A=i.palettes[0];return p==="dark"&&A.dark?A.dark.slots:A.light.slots},[i,p]),N=i.kind==="ready"&&!!((T=i.palettes[0])!=null&&T.dark);return e.jsxs("div",{"data-testid":"mockup-customize-view",className:"flex-1 flex flex-col min-w-0",style:{overflow:"hidden",position:"relative"},children:[e.jsxs("div",{ref:b,children:[e.jsx(Iy,{systemName:n,openMenu:m,theme:p,hasDark:N,saving:o,toolbarRef:{current:null},onBack:()=>r(c),onToggleMenu:A=>g(M=>M===A?null:A),onToggleTheme:()=>f(A=>A==="light"?"dark":"light"),onReset:k,onSave:()=>a(c)}),m==="fonts"&&e.jsx(Ey,{primaryFont:c.primaryFont,secondaryFont:c.secondaryFont,onPrimaryChange:A=>d(M=>({...M,primaryFont:A})),onSecondaryChange:A=>d(M=>({...M,secondaryFont:A}))}),m==="colors"&&e.jsx(Ay,{palettes:i.kind==="ready"?i.palettes:[],activeName:u,theme:p,slots:S,vars:c.vars,onApplyPalette:j,onColorChange:_})]}),i.kind==="error"&&e.jsx(Ry,{message:i.message}),i.kind==="loading"?e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",background:"white",padding:"var(--spacing-lg, 16px)",color:"var(--text-secondary)"},children:"Loading mockup…"}):i.kind==="ready"?e.jsx(My,{html:i.html,srcDoc:w,theme:p,mockupUrl:t.url,mockupName:t.name}):null]})}const YD=Object.freeze(Object.defineProperty({__proto__:null,MockupCustomizeView:Dy},Symbol.toStringTag,{value:"Module"})),zP={desktop:{w:1440,h:900},tablet:{w:834,h:1112},mobile:{w:390,h:844}},Kc="desktop",$P=1280,BP=1280,qP="#1a1a1a",HP="radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px)",WP="12px 12px";function GP(t,n,s,r){if(t<=0||n<=0||s<=0||r<=0)return{scale:0,offsetX:0,offsetY:0};const a=Math.min(t/s,n/r),o=s*a,i=r*a;return{scale:a,offsetX:Math.max(0,(t-o)/2),offsetY:Math.max(0,(n-i)/2)}}function Ly(){return e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4.5 2.5h-2v7h7v-2"}),e.jsx("path",{d:"M7 2.5h2.5V5"}),e.jsx("path",{d:"M9.5 2.5L5.5 6.5"})]})}function Fy({displayNumber:t,formattedName:n,theme:s,showThemeToggle:r,busy:a,openInNewTabUrl:o,onToggleTheme:i,onChoose:c,onCustomize:d}){return e.jsxs("div",{style:{padding:"var(--spacing-sm, 10px) var(--spacing-md, 14px)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)",minWidth:0},children:[e.jsx("span",{style:{fontWeight:700,color:"var(--text-muted)"},children:String(t).padStart(2,"0")}),o?e.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${n} in new tab`,title:"Open in new tab",onClick:u=>u.stopPropagation(),style:{display:"inline-flex",alignItems:"center",gap:4,minWidth:0,color:"var(--text-primary)",textDecoration:"none"},children:[e.jsx("span",{style:{textTransform:"capitalize",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"var(--text-muted)",lineHeight:1,flexShrink:0},children:e.jsx(Ly,{})})]}):e.jsx("span",{style:{textTransform:"capitalize",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-xs, 8px)",flexShrink:0},children:[r&&e.jsx(ul,{theme:s,onToggle:i}),e.jsx("button",{type:"button",onClick:d,disabled:a,style:{padding:"6px 14px",background:"var(--bg-card, #1a1a1a)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:6,fontSize:"var(--text-xs, 12px)",fontWeight:500,cursor:a?"wait":"pointer",opacity:a?.6:1},children:"Customize"}),e.jsx("button",{type:"button",onClick:c,disabled:a,style:{padding:"6px 14px",background:"var(--accent-active, #7c3aed)",color:"var(--text-on-accent, #fff)",border:"1px solid transparent",borderRadius:6,fontSize:"var(--text-xs, 12px)",fontWeight:600,cursor:a?"wait":"pointer",opacity:a?.6:1,boxShadow:a?"none":"0 0 0 3px color-mix(in srgb, var(--accent-active, #7c3aed) 30%, transparent), 0 2px 6px color-mix(in srgb, var(--accent-active, #7c3aed) 40%, transparent)"},children:"Select"})]})]})}const VD=Object.freeze(Object.defineProperty({__proto__:null,MockupCardFooter:Fy,OpenInNewTabIcon:Ly},Symbol.toStringTag,{value:"Module"})),UP=700;function YP({srcDoc:t,url:n,theme:s,scale:r,hasContent:a}){const[o,i]=l.useState(!1),[c,d]=l.useState(!1),u=l.useRef([]);l.useEffect(()=>{i(!1),d(!1);const m=window.setTimeout(()=>d(!0),UP);return()=>window.clearTimeout(m)},[t,n,s]);const h=()=>{const m=window.requestAnimationFrame(()=>{const g=window.requestAnimationFrame(()=>i(!0));u.current.push(g)});u.current.push(m)};l.useEffect(()=>()=>{u.current.forEach(m=>window.cancelAnimationFrame(m)),u.current=[]},[]);const p=o&&r>0;return{handleIframeLoad:h,visible:p,showSkeleton:!a||!p||!c}}function zy(){return e.jsxs("div",{"aria-label":"Loading mockup",style:{position:"absolute",inset:0,padding:"10%",display:"flex",flexDirection:"column",gap:"5%"},children:[e.jsx(Sr,{}),e.jsx(Ue,{widthPct:45,heightPx:14,variant:"overlay"}),e.jsx(Ue,{widthPct:70,heightPx:10,variant:"overlay"}),e.jsx("div",{style:{height:"6%"}}),e.jsx(Ue,{widthPct:100,heightPx:32,variant:"overlay"}),e.jsxs("div",{style:{display:"flex",gap:"4%"},children:[e.jsx(Ue,{widthPct:48,heightPx:48,variant:"overlay"}),e.jsx(Ue,{widthPct:48,heightPx:48,variant:"overlay"})]}),e.jsx(Ue,{widthPct:88,heightPx:10,variant:"overlay"}),e.jsx(Ue,{widthPct:60,heightPx:10,variant:"overlay"})]})}const KD=Object.freeze(Object.defineProperty({__proto__:null,MockupSkeletonOverlay:zy},Symbol.toStringTag,{value:"Module"}));function hl({html:t,url:n,title:s,viewport:r,theme:a,darkVars:o}){const i=l.useRef(null),[c,d]=l.useState(0),[u,h]=l.useState(0),p=zP[r];l.useEffect(()=>{const j=i.current;if(!j)return;const _=()=>{const S=j.clientWidth,N=j.clientHeight;S>0&&d(S),N>0&&h(N)};if(_(),typeof ResizeObserver>"u")return;const k=new ResizeObserver(_);return k.observe(j),()=>k.disconnect()},[]);const{scale:f,offsetX:m,offsetY:g}=GP(c,u,p.w,p.h),b=t&&a==="dark"&&o?DP(t,{vars:o,...wP(o)}):t,{handleIframeLoad:x,visible:y,showSkeleton:v}=YP({srcDoc:b,url:n,theme:a,scale:f,hasContent:t!==null}),w=()=>window.open(n,"_blank","noopener,noreferrer");return e.jsxs("div",{ref:i,onClick:w,style:{position:"relative",width:"100%",aspectRatio:`${$P} / ${BP}`,overflow:"hidden",cursor:"pointer",backgroundColor:qP,backgroundImage:HP,backgroundSize:WP},children:[t!==null&&e.jsx("iframe",{src:b?void 0:n,srcDoc:b??void 0,title:s,sandbox:"",onLoad:x,style:{width:p.w,height:p.h,border:"none",background:"white",transform:f>0?`scale(${f})`:"scale(0)",transformOrigin:"top left",pointerEvents:"none",position:"absolute",top:g,left:m,visibility:y?"visible":"hidden"}},a),v&&e.jsx(zy,{})]})}const JD=Object.freeze(Object.defineProperty({__proto__:null,MockupCardPreviewSlot:hl},Symbol.toStringTag,{value:"Module"})),VP=`
|
|
84
|
+
.mockup-feedback-slider {
|
|
85
|
+
-webkit-appearance: none;
|
|
86
|
+
appearance: none;
|
|
87
|
+
background: transparent;
|
|
88
|
+
height: 18px;
|
|
89
|
+
padding: 0;
|
|
90
|
+
margin: 0;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
.mockup-feedback-slider:focus { outline: none; }
|
|
94
|
+
.mockup-feedback-slider::-webkit-slider-runnable-track {
|
|
95
|
+
height: 4px;
|
|
96
|
+
background: #4a4a4a;
|
|
97
|
+
border-radius: 2px;
|
|
98
|
+
}
|
|
99
|
+
.mockup-feedback-slider::-moz-range-track {
|
|
100
|
+
height: 4px;
|
|
101
|
+
background: #4a4a4a;
|
|
102
|
+
border-radius: 2px;
|
|
103
|
+
border: none;
|
|
104
|
+
}
|
|
105
|
+
.mockup-feedback-slider::-moz-range-progress {
|
|
106
|
+
background: #4a4a4a;
|
|
107
|
+
height: 4px;
|
|
108
|
+
border-radius: 2px;
|
|
109
|
+
}
|
|
110
|
+
.mockup-feedback-slider::-webkit-slider-thumb {
|
|
111
|
+
-webkit-appearance: none;
|
|
112
|
+
appearance: none;
|
|
113
|
+
width: 14px;
|
|
114
|
+
height: 14px;
|
|
115
|
+
border-radius: 50%;
|
|
116
|
+
background: #5a5a5a;
|
|
117
|
+
border: none;
|
|
118
|
+
margin-top: -5px;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
transition: background 120ms ease;
|
|
121
|
+
}
|
|
122
|
+
.mockup-feedback-slider::-moz-range-thumb {
|
|
123
|
+
width: 14px;
|
|
124
|
+
height: 14px;
|
|
125
|
+
border-radius: 50%;
|
|
126
|
+
background: #5a5a5a;
|
|
127
|
+
border: none;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
transition: background 120ms ease;
|
|
130
|
+
}
|
|
131
|
+
.mockup-feedback-slider[data-rated="true"]::-webkit-slider-runnable-track {
|
|
132
|
+
/* Two stacked layers: a grey overlay that masks the right portion of
|
|
133
|
+
* the track from progress% onward, and a full-width red-amber-keylime
|
|
134
|
+
* rainbow underneath. The visible filled portion is the slice of the
|
|
135
|
+
* rainbow up to the thumb position. */
|
|
136
|
+
background:
|
|
137
|
+
linear-gradient(
|
|
138
|
+
to right,
|
|
139
|
+
transparent 0%,
|
|
140
|
+
transparent var(--mockup-feedback-progress, 0%),
|
|
141
|
+
#4a4a4a var(--mockup-feedback-progress, 0%),
|
|
142
|
+
#4a4a4a 100%
|
|
143
|
+
),
|
|
144
|
+
linear-gradient(
|
|
145
|
+
to right,
|
|
146
|
+
rgb(239, 68, 68) 0%,
|
|
147
|
+
rgb(251, 191, 36) 50%,
|
|
148
|
+
rgb(215, 255, 99) 100%
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
.mockup-feedback-slider[data-rated="true"]::-moz-range-track {
|
|
152
|
+
background: linear-gradient(
|
|
153
|
+
to right,
|
|
154
|
+
rgb(239, 68, 68) 0%,
|
|
155
|
+
rgb(251, 191, 36) 50%,
|
|
156
|
+
rgb(215, 255, 99) 100%
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
.mockup-feedback-slider[data-rated="true"]::-moz-range-progress {
|
|
160
|
+
/* Firefox draws ::-moz-range-progress on top of ::-moz-range-track,
|
|
161
|
+
* so the progress layer would otherwise hide the rainbow below it.
|
|
162
|
+
* Leave it transparent so the rainbow shows through up to the value. */
|
|
163
|
+
background: transparent;
|
|
164
|
+
}
|
|
165
|
+
.mockup-feedback-slider[data-rated="true"]::-webkit-slider-thumb {
|
|
166
|
+
background: var(--mockup-feedback-color, var(--accent-active, #D7FF63));
|
|
167
|
+
}
|
|
168
|
+
.mockup-feedback-slider[data-rated="true"]::-moz-range-thumb {
|
|
169
|
+
background: var(--mockup-feedback-color, var(--accent-active, #D7FF63));
|
|
170
|
+
}
|
|
171
|
+
`,KP=`
|
|
172
|
+
.mockup-feedback-comment {
|
|
173
|
+
width: 100%;
|
|
174
|
+
padding: var(--spacing-sm, 8px) var(--spacing-sm, 10px);
|
|
175
|
+
background: var(--bg-card, #1a1a1a);
|
|
176
|
+
color: var(--text-primary);
|
|
177
|
+
border: 1px solid var(--border-default);
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
font-size: var(--text-xs, 12px);
|
|
180
|
+
line-height: 1.4;
|
|
181
|
+
resize: vertical;
|
|
182
|
+
box-sizing: border-box;
|
|
183
|
+
min-height: 56px;
|
|
184
|
+
outline: none;
|
|
185
|
+
}
|
|
186
|
+
.mockup-feedback-comment:focus,
|
|
187
|
+
.mockup-feedback-comment:focus-visible {
|
|
188
|
+
border-color: var(--text-primary, #ffffff);
|
|
189
|
+
outline: none;
|
|
190
|
+
box-shadow: 0 0 0 1px var(--text-primary, #ffffff);
|
|
191
|
+
}
|
|
192
|
+
`;function $y({comment:t,onCommentChange:n}){return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:KP}),e.jsx("textarea",{value:t,onChange:s=>n(s.target.value),placeholder:"What do you like or would like to change? (optional)",rows:3,className:"mockup-feedback-comment"})]})}const XD=Object.freeze(Object.defineProperty({__proto__:null,MockupFeedbackCommentBox:$y},Symbol.toStringTag,{value:"Module"})),By=[239,68,68],bo=[251,191,36],qy=[215,255,99];function JP(t){const n=Math.max(1,Math.min(100,t));let s,r,a;n<=50?(s=By,r=bo,a=(n-1)/49):(s=bo,r=qy,a=(n-50)/50);const o=Math.round(s[0]+(r[0]-s[0])*a),i=Math.round(s[1]+(r[1]-s[1])*a),c=Math.round(s[2]+(r[2]-s[2])*a);return`rgb(${o}, ${i}, ${c})`}`${By.join(", ")}${bo.join(", ")}${qy.join(", ")}`;function Hy(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3z"}),e.jsx("path",{d:"M17 2h2.5a2.5 2.5 0 0 1 2.5 2.5v6A2.5 2.5 0 0 1 19.5 13H17"})]})}function Wy(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3z"}),e.jsx("path",{d:"M7 22H4.5a2.5 2.5 0 0 1-2.5-2.5v-6A2.5 2.5 0 0 1 4.5 11H7"})]})}const QD=Object.freeze(Object.defineProperty({__proto__:null,ThumbDownIcon:Hy,ThumbUpIcon:Wy},Symbol.toStringTag,{value:"Module"}));function Gy({rating:t,onRatingChange:n}){const s=t!=null,r=s&&t<=33,a=s&&t>=67;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-sm, 10px)"},children:[e.jsx("span",{"aria-hidden":"true",style:{color:r?"var(--text-primary)":"var(--text-muted)",display:"inline-flex",alignItems:"center"},children:e.jsx(Hy,{})}),e.jsx("input",{type:"range",min:1,max:100,step:1,value:t??50,onPointerDown:()=>{s||n(50)},onChange:o=>n(Number(o.target.value)),"aria-label":"Rate this mockup from 1 to 100",className:"mockup-feedback-slider","data-rated":s?"true":"false",style:{flex:1,"--mockup-feedback-progress":`${t??0}%`,"--mockup-feedback-color":s?JP(t):"var(--accent-active, #D7FF63)"}}),e.jsx("span",{"aria-hidden":"true",style:{color:a?"var(--text-primary)":"var(--text-muted)",display:"inline-flex",alignItems:"center"},children:e.jsx(Wy,{})})]})}const ZD=Object.freeze(Object.defineProperty({__proto__:null,MockupFeedbackRatingSlider:Gy},Symbol.toStringTag,{value:"Module"})),Uy={rating:null,comment:""};function Yy({value:t,onChange:n}){return e.jsxs("div",{"data-mockup-feedback":!0,style:{padding:"var(--spacing-sm, 10px) var(--spacing-md, 14px)",borderTop:"1px solid var(--border-default)",display:"flex",flexDirection:"column",gap:"var(--spacing-sm, 10px)",background:"var(--bg-surface)"},children:[e.jsx("style",{children:VP}),e.jsx(Gy,{rating:t.rating,onRatingChange:s=>n({...t,rating:s})}),e.jsx($y,{comment:t.comment,onCommentChange:s=>n({...t,comment:s})})]})}const eL=Object.freeze(Object.defineProperty({__proto__:null,EMPTY_FEEDBACK:Uy,MockupCardFeedback:Yy},Symbol.toStringTag,{value:"Module"}));function Vy({mockup:t,displayNumber:n,onChoose:s,onCustomize:r,busy:a=!1,darkVars:o=null,feedback:i,onFeedbackChange:c}){const[d,u]=l.useState(null),[h,p]=l.useState(Kc),[f,m]=l.useState("light");if(l.useEffect(()=>{if(!t)return;let b=!1;return(async()=>{try{const x=await fetch(t.url);if(!x.ok)return;const y=await x.text();if(b)return;u(y),p(dl(y)??Kc)}catch{}})(),()=>{b=!0}},[t==null?void 0:t.url]),!t)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:160,border:"1px dashed var(--border-default)",borderRadius:12,background:"var(--bg-surface)",color:"var(--text-muted)",fontSize:"var(--text-sm, 14px)"},children:"No mockup to preview"});const g=t.name.replace(/^\d{1,2}-/,"").replace(/-/g," ");return e.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",border:"1px solid var(--border-default)",borderRadius:12,overflow:"hidden",background:"var(--bg-surface)"},children:[e.jsx(Fy,{displayNumber:n,formattedName:g,theme:f,showThemeToggle:!!o,busy:a,openInNewTabUrl:t.url,onToggleTheme:()=>m(b=>b==="light"?"dark":"light"),onChoose:()=>s==null?void 0:s(t),onCustomize:()=>r==null?void 0:r(t)}),e.jsx(hl,{html:d,url:t.url,title:t.name,viewport:h,theme:f,darkVars:o}),c&&e.jsx(Yy,{value:i??Uy,onChange:c})]})}const tL=Object.freeze(Object.defineProperty({__proto__:null,MockupCard:Vy},Symbol.toStringTag,{value:"Module"}));function Ky({displayNumber:t}){return e.jsxs("div",{"data-mockup-placeholder":!0,"aria-label":"The AI is designing this mockup",style:{position:"relative",display:"flex",flexDirection:"column",border:"1px solid var(--border-default)",borderRadius:12,overflow:"hidden",background:"var(--bg-surface)"},children:[e.jsx(Sr,{}),e.jsxs("div",{style:{position:"relative",width:"100%",aspectRatio:"1 / 1",overflow:"hidden",background:"var(--bg-elevated, #141414)",padding:"10%",display:"flex",flexDirection:"column",gap:"5%"},children:[e.jsx(Ue,{widthPct:45,heightPx:14}),e.jsx(Ue,{widthPct:70,heightPx:10}),e.jsx("div",{style:{height:"6%"}}),e.jsx(Ue,{widthPct:100,heightPx:32}),e.jsxs("div",{style:{display:"flex",gap:"4%"},children:[e.jsx(Ue,{widthPct:48,heightPx:48}),e.jsx(Ue,{widthPct:48,heightPx:48})]}),e.jsx(Ue,{widthPct:88,heightPx:10}),e.jsx(Ue,{widthPct:60,heightPx:10})]}),e.jsx("div",{style:{padding:"var(--spacing-sm, 8px) var(--spacing-md, 12px)",display:"flex",alignItems:"center",gap:"var(--spacing-sm, 8px)"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"baseline",gap:6,color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)",minWidth:0},children:[e.jsx("span",{style:{fontWeight:700,color:"var(--text-muted)"},children:String(t).padStart(2,"0")}),e.jsx("span",{style:{color:"var(--text-secondary)",fontStyle:"italic"},"data-testid":"mockup-placeholder-label",children:"The AI is designing this mockup…"})]})})]})}const nL=Object.freeze(Object.defineProperty({__proto__:null,MockupPlaceholderCard:Ky},Symbol.toStringTag,{value:"Module"}));function Jy({slots:t,darkVarsBySystem:n,busyFilename:s,feedbackByFilename:r,onFeedbackChange:a,onChoose:o,onCustomize:i}){return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"var(--spacing-lg, 16px)",rowGap:"var(--spacing-xl, 28px)"},children:t.map(c=>c.mockup?e.jsx(Vy,{mockup:c.mockup,displayNumber:c.number,onChoose:o,onCustomize:i,busy:s===c.mockup.filename,darkVars:n[ea(c.mockup.filename)]??null,feedback:r==null?void 0:r[c.mockup.filename],onFeedbackChange:a?d=>a(c.mockup.filename,d):void 0},`mockup-${c.mockup.filename}`):e.jsx(Ky,{displayNumber:c.number},`placeholder-${c.number}`))})}const sL=Object.freeze(Object.defineProperty({__proto__:null,MockupGrid:Jy},Symbol.toStringTag,{value:"Module"}));function Xy(){return e.jsxs("div",{"data-mockup-generating-overlay":!0,style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--spacing-md, 14px)",zIndex:5,background:"var(--bg-overlay, rgba(15,17,21,0.45))",backdropFilter:"blur(1px)",borderRadius:12,pointerEvents:"auto"},children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}),e.jsx("div",{style:{color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)",fontWeight:500},children:"Generating new designs…"})]})}const rL=Object.freeze(Object.defineProperty({__proto__:null,MockupGridGeneratingOverlay:Xy},Symbol.toStringTag,{value:"Module"}));function Qy(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 22h4"}),e.jsx("path",{d:"M12 2a7 7 0 0 0-4 12.74V17a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-2.26A7 7 0 0 0 12 2z"})]})}function Zy(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]})}function ev({onDismiss:t}){return e.jsxs("div",{role:"note","data-mockup-info-banner":!0,style:{display:"flex",alignItems:"flex-start",gap:"var(--spacing-md, 14px)",padding:"var(--spacing-md, 14px) var(--spacing-md, 16px)",border:"1px solid var(--accent-active, #D7FF63)",borderRadius:12,background:"rgba(215, 255, 99, 0.04)"},children:[e.jsx("span",{"aria-hidden":"true",style:{color:"var(--accent-active, #D7FF63)",display:"inline-flex",alignItems:"center",flexShrink:0,paddingTop:1},children:e.jsx(Qy,{})}),e.jsxs("p",{style:{flex:1,margin:0,color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)",lineHeight:1.5},children:[e.jsx("strong",{style:{fontWeight:700},children:"Not sure which to pick?"})," ","Rate these designs and jot a quick note. We'll refine them into a fresh round — no need to choose yet."]}),e.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss tip",title:"Dismiss",style:{flexShrink:0,padding:4,background:"transparent",color:"var(--text-muted)",border:"none",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Zy,{})})]})}const aL=Object.freeze(Object.defineProperty({__proto__:null,CloseIcon:Zy,LightbulbIcon:Qy,MockupGridInfoBanner:ev},Symbol.toStringTag,{value:"Module"}));function tv(){return e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-3.36-7"}),e.jsx("polyline",{points:"21 4 21 10 15 10"})]})}function nv({feedbackCount:t,busy:n,onIterate:s}){const r=t===0?"Add a rating or note above, then iterate.":t===1?"1 card has feedback — iterate to refresh the round.":`${t} cards have feedback — iterate to refresh the round.`;return e.jsxs("div",{style:{marginTop:"var(--spacing-md, 12px)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--spacing-md, 16px)",padding:"var(--spacing-md, 16px) var(--spacing-lg, 20px)",border:"1px solid var(--border-default)",borderRadius:12,background:"var(--bg-card, #1a1a1a)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-md, 14px)",minWidth:0},children:[e.jsx("span",{"aria-hidden":"true",style:{color:"var(--accent-active, #D7FF63)",display:"inline-flex",alignItems:"center",flexShrink:0},children:e.jsx(tv,{})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx("span",{style:{color:"var(--text-primary)",fontSize:"var(--text-sm, 14px)",fontWeight:600,lineHeight:1.3},children:"Ready for the next round?"}),e.jsx("span",{style:{color:"var(--text-muted)",fontSize:"var(--text-xs, 12px)",lineHeight:1.4,marginTop:2},children:r})]})]}),e.jsx("button",{type:"button",onClick:s,disabled:n,"data-mockup-iterate":!0,style:{flexShrink:0,padding:"10px 22px",background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #0F0F0F)",border:"1px solid var(--accent-active, #D7FF63)",borderRadius:8,fontSize:"var(--text-sm, 14px)",fontWeight:600,cursor:n?"wait":"pointer",opacity:n?.6:1},children:n?"Sending…":"Iterate"})]})}const oL=Object.freeze(Object.defineProperty({__proto__:null,MockupGridIterateButton:nv,RefreshCycleIcon:tv},Symbol.toStringTag,{value:"Module"}));function sv(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}function rv(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}function av({archivedRoundsNewestFirst:t,selected:n,onSelect:s}){if(!t||t.length===0)return null;const a=[...[...t].reverse(),"current"],o=a.length,i=a.indexOf(n),c=i===-1?o-1:i,d=n==="current",u=c>0,h=c<o-1,p=d?`Round ${o} of ${o} · Current`:`Round ${c+1} of ${o} · Archived`;return e.jsxs("div",{"data-mockup-round-pager":!0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--spacing-sm, 10px)",padding:"var(--spacing-xs, 6px) var(--spacing-md, 14px)",border:"1px solid var(--border-default)",borderRadius:10,background:"var(--bg-card, #1a1a1a)"},children:[e.jsx(xo,{ariaLabel:"Previous round",disabled:!u,onClick:()=>u&&s(a[c-1]),icon:e.jsx(sv,{})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-md, 12px)",fontSize:"var(--text-xs, 12px)",color:"var(--text-secondary)"},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--text-primary)"},children:p}),!d&&e.jsx("button",{type:"button",onClick:()=>s("current"),style:{padding:"4px 10px",background:"transparent",color:"var(--accent-active, #D7FF63)",border:"1px solid var(--accent-active, #D7FF63)",borderRadius:6,fontSize:"var(--text-xs, 11px)",fontWeight:500,cursor:"pointer"},children:"Return to current"})]}),e.jsx(xo,{ariaLabel:"Next round",disabled:!h,onClick:()=>h&&s(a[c+1]),icon:e.jsx(rv,{})})]})}function xo({ariaLabel:t,disabled:n,onClick:s,icon:r}){return e.jsx("button",{type:"button",onClick:s,disabled:n,"aria-label":t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,background:"transparent",color:n?"var(--text-dim, #666)":"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:6,cursor:n?"default":"pointer",opacity:n?.5:1,padding:0},children:r})}const iL=Object.freeze(Object.defineProperty({__proto__:null,ChevronLeftIcon:sv,ChevronRightIcon:rv,MockupRoundPager:av,PagerArrowButton:xo},Symbol.toStringTag,{value:"Module"}));function ov({mockup:t,busy:n,onCancel:s,onConfirm:r}){l.useEffect(()=>{const o=i=>{i.key==="Escape"&&!n&&s()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n,s]);const a=t.name.replace(/^\d{1,2}-/,"").replace(/-/g," ");return e.jsx("div",{role:"presentation",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:200,padding:24},children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Ready to start building?",onClick:o=>o.stopPropagation(),style:{background:"var(--bg-elevated, #141414)",border:"1px solid var(--border-default)",borderRadius:12,padding:24,width:"min(440px, 100%)",display:"flex",flexDirection:"column",gap:16,fontFamily:"'IBM Plex Mono', monospace",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[e.jsx("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:8,overflow:"hidden",aspectRatio:"16 / 9",background:"#1a1a1a",position:"relative"},children:e.jsx("iframe",{src:t.url,title:`${a} thumbnail`,sandbox:"",style:{width:1440,height:900,border:"none",background:"white",transform:"scale(0.305)",transformOrigin:"top left",pointerEvents:"none",position:"absolute",top:0,left:0}})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("h2",{style:{margin:0,color:"var(--text-primary)",fontSize:16,fontWeight:600},children:"Ready to start building?"}),e.jsxs("p",{style:{margin:0,color:"var(--text-secondary)",fontSize:13,textTransform:"capitalize"},children:["Using ",e.jsx("strong",{style:{color:"var(--text-primary)"},children:a})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:s,disabled:n,style:{padding:"8px 16px",background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:6,fontSize:13,fontWeight:500,cursor:n?"wait":"pointer",opacity:n?.5:1,fontFamily:"inherit"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:r,disabled:n,style:{padding:"8px 18px",background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #0F0F0F)",border:"1px solid var(--accent-active, #D7FF63)",borderRadius:6,fontSize:13,fontWeight:600,cursor:n?"wait":"pointer",opacity:n?.7:1,fontFamily:"inherit"},children:n?"Starting…":"Start building"})]})]})})}const lL=Object.freeze(Object.defineProperty({__proto__:null,StartBuildingConfirmModal:ov},Symbol.toStringTag,{value:"Module"}));function In(t,n){if(!n)return t;const s=t.includes("?")?"&":"?";return`${t}${s}round=${encodeURIComponent(n)}`}function iv({onDesignConfirmed:t,round:n}={}){const[s,r]=l.useState(null),[a,o]=l.useState(null),[i,c]=l.useState(null),[d,u]=l.useState(null),[h,p]=l.useState(null),[f,m]=l.useState(null),[g,b]=l.useState({}),[x,y]=l.useState({}),[v,w]=l.useState(!1),[j,_]=l.useState(!1),k=l.useRef([]),S=l.useRef(!1),N=l.useRef(!1),[T,A]=l.useState(null),[M,C]=l.useState(()=>typeof window>"u"?!1:window.sessionStorage.getItem("mockup-grid-tip-dismissed")==="1"),[H,J]=l.useState("current"),Z=PP(),F=l.useRef(null),$=CP(s),P=l.useRef(!0),I=l.useCallback(async()=>{try{const[D,z]=await Promise.all([fetch(In("/api/editor-mockups",n)),fetch(In("/api/editor-mockups-target",n))]),K=await D.json(),ue=await z.json();P.current&&(r(ye=>tP(ye,K)||S.current&&K.length<k.current.length?ye:K),o(ye=>ye===ue.count?ye:ue.count))}catch(D){P.current&&c(D instanceof Error?D.message:String(D))}},[n]);l.useEffect(()=>{P.current=!0,I();const D=window.setInterval(I,4e3);return()=>{P.current=!1,window.clearInterval(D)}},[I]),l.useEffect(()=>{let D=!1;return(async()=>{try{const z=await fetch(In("/api/editor-mockups-feedback",n));if(!z.ok)return;const K=await z.json();if(D||!K||typeof K!="object"||Array.isArray(K))return;const ue={};for(const[ye,je]of Object.entries(K)){if(!je||typeof je!="object")continue;const V=je;V.rating!=null&&typeof V.rating!="number"||V.comment!=null&&typeof V.comment!="string"||(ue[ye]={rating:typeof V.rating=="number"?V.rating:null,comment:typeof V.comment=="string"?V.comment:""})}y(ue)}catch{}})(),()=>{D=!0}},[]);const B=l.useCallback((D,z)=>{y(K=>{const ue={...K,[D]:z};return F.current!=null&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>{fetch(In("/api/editor-mockups-feedback",n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)}).catch(()=>{})},400),ue})},[n]);l.useEffect(()=>()=>{F.current!=null&&window.clearTimeout(F.current)},[]);const X=l.useCallback(()=>{if(!s)return;const D=s.map(K=>K.filename);k.current=D,N.current=!1,_(!1),w(!0),J("current");const z=oP({feedbackByFilename:x,mockupFilenames:D});(async()=>{try{await fetch("/api/editor-mockups-archive",{method:"POST"})}catch{}await rP(z),P.current&&(N.current=!0,y({}),fetch(In("/api/editor-mockups-feedback",n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}).catch(()=>{}))})()},[x,s,n]);l.useEffect(()=>{S.current=v},[v]),l.useEffect(()=>{if(!v)return;const D=()=>{N.current&&_(!0)};return window.addEventListener("miniagent-output",D),()=>window.removeEventListener("miniagent-output",D)},[v]),l.useEffect(()=>{if(!v)return;const D=window.setTimeout(()=>{P.current&&w(!1)},iP);return()=>window.clearTimeout(D)},[v]),l.useEffect(()=>{v&&lP({snapshotFilenames:k.current,latestFilenames:(s??[]).map(D=>D.filename),agentRespondedAfterDispatch:j})&&w(!1)},[v,s,j]);const W=l.useCallback(async D=>{A(D);try{const z=await fetch("/api/editor-mockups-restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({round:D})});if(!z.ok){const K=await z.text().catch(()=>`${z.status}`);throw new Error(K||`restore failed: ${z.status}`)}P.current&&(J("current"),I())}catch(z){P.current&&c(z instanceof Error?z.message:String(z))}finally{P.current&&A(null)}},[I]),ie=l.useCallback(D=>{m(D)},[]),Q=l.useCallback(async()=>{if(!f)return;const D=f;u(D.filename);try{const z=await fetch("/api/editor-design-select",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:D.filename})});if(!z.ok){const K=await z.text().catch(()=>`${z.status}`);throw new Error(K||`select failed: ${z.status}`)}P.current&&(m(null),t==null||t({kind:"use",filename:D.filename}))}catch(z){c(z instanceof Error?z.message:String(z))}finally{P.current&&u(null)}},[f,t]),O=l.useCallback(D=>{const z=ea(D.filename);p({mockup:D,systemName:z})},[]),L=l.useCallback(D=>{h&&b(z=>({...z,[h.mockup.filename]:D})),p(null)},[h]),q=l.useCallback(async D=>{if(h){u(h.mockup.filename);try{const z=await fetch("/api/editor-design-select",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:h.mockup.filename,overrides:{vars:D.vars,primaryFont:D.primaryFont,secondaryFont:D.secondaryFont}})});if(!z.ok){const K=await z.text().catch(()=>`${z.status}`);throw new Error(K||`select failed: ${z.status}`)}b(K=>({...K,[h.mockup.filename]:D})),p(null),t==null||t({kind:"use",filename:h.mockup.filename})}catch(z){c(z instanceof Error?z.message:String(z))}finally{P.current&&u(null)}}},[h,t]);if(h)return e.jsx(Dy,{mockup:h.mockup,systemName:h.systemName,initial:g[h.mockup.filename]??eP,onBack:L,onSave:q,saving:d===h.mockup.filename});if(!s)return e.jsx("div",{style:{padding:"var(--spacing-lg, 16px)"},children:e.jsx("div",{style:{color:"var(--text-secondary)"},children:"Loading design mockups…"})});const le=s.reduce((D,z)=>{const K=/^(\d{1,2})-/.exec(z.filename);return K?Math.max(D,parseInt(K[1],10)):D},0),de=Math.max(a??0,le);if(de===0)return e.jsx(oi,{});const ee=Array.from({length:de},(D,z)=>{const K=z+1,ue=String(K).padStart(2,"0"),ye=s.find(je=>je.filename.startsWith(`${ue}-`))??null;return{number:K,mockup:ye}});return e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:{padding:"var(--spacing-lg, 16px)",gap:"var(--spacing-md, 12px)",overflow:"auto"},children:[!M&&e.jsx(ev,{onDismiss:()=>{C(!0),typeof window<"u"&&window.sessionStorage.setItem("mockup-grid-tip-dismissed","1")}}),e.jsx(av,{archivedRoundsNewestFirst:Z.map(D=>D.round),selected:H,onSelect:J}),i&&e.jsx("div",{style:{padding:"var(--spacing-sm, 8px) var(--spacing-md, 12px)",borderRadius:8,background:"var(--bg-danger-soft, rgba(248,113,113,0.12))",color:"var(--accent-danger, #f87171)",fontSize:"var(--text-sm, 14px)"},children:i}),H==="current"?e.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",gap:"var(--spacing-md, 12px)"},children:[e.jsxs("div",{style:v?{opacity:.4,pointerEvents:"none"}:void 0,children:[e.jsx(Jy,{slots:ee,darkVarsBySystem:$,busyFilename:d,feedbackByFilename:x,onFeedbackChange:B,onChoose:ie,onCustomize:O}),s.length>0&&e.jsx("div",{style:{marginTop:"var(--spacing-md, 12px)"},children:e.jsx(nv,{feedbackCount:Object.values(x).filter(D=>typeof D.rating=="number"||D.comment.trim().length>0).length,busy:v,onIterate:X})})]}),v&&e.jsx(Xy,{})]}):(()=>{const D=Z.find(z=>z.round===H);return D?e.jsx(Ny,{round:D,onRestore:()=>W(D.round),restoring:T===D.round}):e.jsx("div",{style:{padding:"var(--spacing-md, 14px)",color:"var(--text-secondary)",fontSize:"var(--text-sm, 14px)"},children:"Loading archived round…"})})(),f&&e.jsx(ov,{mockup:f,busy:d===f.filename,onCancel:()=>m(null),onConfirm:Q})]})}const cL=Object.freeze(Object.defineProperty({__proto__:null,DesignExplorationView:iv,systemNameFromFilename:ea,withRoundParam:In},Symbol.toStringTag,{value:"Module"}));function lv({onDesignConfirmed:t}){const[n,s]=l.useState("assets"),r=l.useRef(!0),a=l.useRef(0);return l.useEffect(()=>{r.current=!0;const o=async()=>{try{const d=await(await fetch("/api/editor-design-active-tab")).json();if(!r.current)return;d.tab!==null&&d.nonce!==null&&d.nonce>a.current&&(a.current=d.nonce,s(d.tab))}catch{}};o();const i=window.setInterval(o,4e3);return()=>{r.current=!1,window.clearInterval(i)}},[]),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx("div",{role:"tablist",style:{display:"flex",gap:"var(--spacing-xs, 4px)",padding:"var(--spacing-sm, 8px) var(--spacing-md, 12px)",borderBottom:"1px solid var(--border-default)"},children:[{id:"assets",label:"Add assets"},{id:"mockups",label:"Mockups"}].map(({id:o,label:i})=>{const c=n===o;return e.jsx("button",{type:"button",role:"tab","aria-selected":c,onClick:()=>s(o),style:{padding:"var(--spacing-xs, 4px) var(--spacing-md, 12px)",borderRadius:6,border:"none",cursor:"pointer",fontSize:"var(--text-sm, 14px)",fontWeight:500,background:c?"var(--accent-active)":"transparent",color:c?"var(--text-on-accent, white)":"var(--text-secondary)"},children:i},o)})}),n==="assets"?e.jsx(jy,{}):e.jsx(iv,{onDesignConfirmed:t})]})}const dL=Object.freeze(Object.defineProperty({__proto__:null,DesignChatPreviewPane:lv},Symbol.toStringTag,{value:"Module"}));function cv({deviceLabel:t,actions:n}){return e.jsxs("div",{role:"note",className:"flex items-center gap-2 border-b border-l-4 px-3 py-2 text-sm",style:{background:"var(--bg-surface)",borderColor:"var(--border-default)",borderLeftColor:"var(--accent-primary)",color:"var(--text-primary)"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0",children:[e.jsx("rect",{x:"3",y:"4",width:"7",height:"16",rx:"1"}),e.jsx("rect",{x:"14",y:"4",width:"7",height:"16",rx:"1"}),e.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"22",strokeDasharray:"2 2"})]}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"font-semibold",children:"Live mirror — not interactive."})," ",e.jsxs("span",{style:{color:"var(--text-dim)"},children:["Tap and type directly in the ",t," window."]})]}),n?e.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:n}):null]})}const uL=Object.freeze(Object.defineProperty({__proto__:null,NativeMirrorNotice:cv},Symbol.toStringTag,{value:"Module"}));function dv({isCollapsed:t,onToggle:n}){return e.jsx("button",{onClick:n,className:`p-1.5 rounded transition-colors cursor-pointer ${t?"text-white bg-[#666] hover:bg-[#777]":"text-gray-500 hover:text-gray-300"}`,title:t?"Show editor":"Hide editor",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M13 17l5-5-5-5"}),e.jsx("path",{d:"M6 17l5-5-5-5"})]}):e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M11 17l-5-5 5-5"}),e.jsx("path",{d:"M18 17l-5-5 5-5"})]})})})}const hL=Object.freeze(Object.defineProperty({__proto__:null,CollapseToggleButton:dv},Symbol.toStringTag,{value:"Module"}));function yo({label:t,value:n,disabled:s,onCommit:r}){const[a,o]=l.useState(String(n));l.useEffect(()=>{o(String(n))},[n]);const i=()=>{const c=Number.parseInt(a,10);if(!Number.isFinite(c)||c<=0){o(String(n));return}c!==n&&r(c)};return e.jsxs("label",{className:`flex items-center gap-0.5 px-1 py-0.5 rounded bg-[#2A2929] text-xs ${s?"opacity-50 cursor-not-allowed":""}`,children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 select-none",children:t}),e.jsx("input",{type:"text",inputMode:"numeric",value:a,disabled:s,"aria-label":t==="H"?"Height":"Width",onChange:c=>o(c.target.value.replace(/[^0-9]/g,"")),onBlur:i,onKeyDown:c=>{c.key==="Enter"?(i(),c.target.blur()):c.key==="Escape"&&(o(String(n)),c.target.blur())},className:"w-8 bg-transparent text-gray-200 text-center text-[11px] font-mono focus:outline-none disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"})]})}const pL=Object.freeze(Object.defineProperty({__proto__:null,DimensionInput:yo},Symbol.toStringTag,{value:"Module"}));function uv({isFilled:t,onToggle:n}){return e.jsx("button",{onClick:n,className:`p-1.5 rounded transition-colors cursor-pointer ${t?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:t?"Exit fullscreen":"Fill page with preview",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t?e.jsxs(e.Fragment,{children:[e.jsx("polyline",{points:"4 14 10 14 10 20"}),e.jsx("polyline",{points:"20 10 14 10 14 4"}),e.jsx("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),e.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}):e.jsxs(e.Fragment,{children:[e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("polyline",{points:"9 21 3 21 3 15"}),e.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),e.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]})})})}const mL=Object.freeze(Object.defineProperty({__proto__:null,FillPreviewButton:uv},Symbol.toStringTag,{value:"Module"}));function hv({previewUrl:t}){return e.jsx("button",{onClick:()=>{t&&window.open(t,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})}const fL=Object.freeze(Object.defineProperty({__proto__:null,OpenInNewTabButton:hv},Symbol.toStringTag,{value:"Module"})),vo=new Set;function XP(t){return vo.add(t),()=>{vo.delete(t)}}function QP(){for(const t of vo)t()}function pv(){return e.jsx("button",{onClick:()=>QP(),className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Refresh preview","aria-label":"Refresh preview",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})}const gL=Object.freeze(Object.defineProperty({__proto__:null,RefreshPreviewButton:pv},Symbol.toStringTag,{value:"Module"}));function Jc(t){var s;return t.route==="Uncategorized"?2:t.route.startsWith("/isolated-components/")||((s=t.scenarios[0])==null?void 0:s.scenarioType)==="component"?1:0}function mv(t){const n=new Map;for(const s of t){const r=s.url??"Uncategorized",a=n.get(r)??[];a.push(s),n.set(r,a)}return Array.from(n.entries()).map(([s,r])=>({route:s,scenarios:r})).sort((s,r)=>{const a=Jc(s)-Jc(r);return a!==0?a:s.route.localeCompare(r.route)})}function ZP(t,n){const s=n.trim().toLowerCase();return s?t.filter(r=>{const a=(r.url??"").toLowerCase(),o=r.name.toLowerCase(),i=(r.componentName??"").toLowerCase();return a.includes(s)||o.includes(s)||i.includes(s)}):t}function fv({tab:t,hasQuery:n}){return n?e.jsx("p",{className:"text-xs text-gray-500 px-2 py-6 text-center",children:"No matches for your search."}):e.jsxs("p",{className:"text-xs text-gray-500 px-2 py-6 text-center",children:["No ",t==="pages"?"pages":"components"," yet."]})}const bL=Object.freeze(Object.defineProperty({__proto__:null,PagePickerEmptyMessage:fv},Symbol.toStringTag,{value:"Module"}));function gv({scenario:t,active:n,onClick:s}){const r=t.screenshotPaths[0],a=Pr(t);return e.jsxs("button",{onClick:s,className:`w-32 text-left rounded border transition-colors cursor-pointer ${n?"border-[#007a99] bg-[#1a2a30]":"border-[#3d3d3d] bg-[#1a1a1a] hover:border-[#555]"}`,title:t.name,children:[e.jsx("div",{className:"aspect-[4/3] w-full overflow-hidden rounded-t border-b border-[#3d3d3d] bg-[#0f0f0f] flex items-center justify-center",children:r?e.jsx("img",{src:_n(r),alt:t.name,className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-[10px] text-gray-600",children:"No screenshot"})}),e.jsx("div",{className:"px-2 py-1 text-[11px] text-gray-200 truncate",children:a})]})}const xL=Object.freeze(Object.defineProperty({__proto__:null,PagePickerScenarioThumbnail:gv},Symbol.toStringTag,{value:"Module"}));function bv({group:t,currentSlug:n,onSelect:s}){const r=t.scenarios[0]?xu(t.scenarios[0]):null;return e.jsxs("div",{className:"mb-4 last:mb-0",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5 mb-1.5 px-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-200 truncate",children:r??t.route}),r?e.jsx("span",{className:"text-[10px] text-gray-500 font-mono truncate",children:t.route}):null]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.scenarios.map(a=>e.jsx(gv,{scenario:a,active:a.slug===n,onClick:()=>s(a.slug)},a.slug))})]})}const yL=Object.freeze(Object.defineProperty({__proto__:null,PagePickerRouteSection:bv},Symbol.toStringTag,{value:"Module"}));function jo({label:t,active:n,count:s,onClick:r}){return e.jsxs("button",{onClick:r,className:`flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-semibold tracking-wider cursor-pointer transition-colors ${n?"text-white bg-[#3a3a3a]":"text-gray-500 hover:text-gray-300"}`,children:[t,e.jsx("span",{className:`text-[10px] font-mono px-1 rounded ${n?"bg-[#555] text-gray-200":"bg-[#2a2a2a] text-gray-500"}`,children:s})]})}const vL=Object.freeze(Object.defineProperty({__proto__:null,PagePickerTabButton:jo},Symbol.toStringTag,{value:"Module"}));function xv({scenarioGroups:t,currentSlug:n,onSelect:s,onClose:r,triggerRef:a}){const[o,i]=l.useState("pages"),[c,d]=l.useState(""),u=l.useRef(null),h=l.useRef(null);l.useEffect(()=>{var y;(y=h.current)==null||y.focus()},[]),Ti(u,r,a);const p=l.useMemo(()=>t.flatMap(y=>y.scenarios),[t]),f=l.useMemo(()=>ZP(p,c),[p,c]),m=l.useMemo(()=>f.filter(_r),[f]),g=l.useMemo(()=>f.filter(To),[f]),b=o==="pages"?m:g,x=l.useMemo(()=>mv(b),[b]);return e.jsxs("div",{ref:u,className:"absolute top-full left-0 mt-1 bg-[#222] border border-[#3d3d3d] rounded-lg shadow-2xl z-50 w-[560px] max-h-[480px] flex flex-col",role:"dialog",children:[e.jsxs("div",{className:"flex items-center border-b border-[#3d3d3d] px-2 py-1.5 gap-2",children:[e.jsx(jo,{label:"PAGES",active:o==="pages",count:m.length,onClick:()=>i("pages")}),e.jsx(jo,{label:"COMPONENTS",active:o==="components",count:g.length,onClick:()=>i("components")}),e.jsx("div",{className:"flex-1"}),e.jsx("input",{ref:h,value:c,onChange:y=>d(y.target.value),placeholder:"Search…",className:"w-48 px-2 py-1 text-xs bg-[#1a1a1a] border border-[#3d3d3d] rounded text-gray-200 focus:outline-none focus:border-[#007a99]"}),e.jsx("button",{onClick:r,"aria-label":"Close",className:"p-1 text-gray-500 hover:text-gray-200 cursor-pointer",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e.jsx("div",{className:"overflow-y-auto p-3 flex-1 min-h-0",children:x.length===0?e.jsx(fv,{tab:o,hasQuery:c.trim().length>0}):x.map(y=>e.jsx(bv,{group:y,currentSlug:n,onSelect:v=>{s(v),r()}},y.route))})]})}const jL=Object.freeze(Object.defineProperty({__proto__:null,PagePickerDropdown:xv},Symbol.toStringTag,{value:"Module"}));function yv(){return e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),e.jsx("path",{d:"M14 3v6h6"})]})}function vv(){return e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1"})]})}function pl({className:t}){return e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:t??"opacity-70 shrink-0 text-gray-400",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}const wL=Object.freeze(Object.defineProperty({__proto__:null,ComponentGlyph:vv,DropdownChevron:pl,PageGlyph:yv},Symbol.toStringTag,{value:"Module"}));function jv({currentScenario:t,isOpen:n,onClick:s,buttonRef:r}){const a=t?To(t):!1,o=(t==null?void 0:t.screenshotPaths[0])??null,i=t?a?t.componentName??t.name:xu(t)??t.url??t.name:"Select a page";return e.jsxs("button",{ref:r,onClick:s,className:`flex items-center gap-1.5 max-w-[260px] pl-0.5 pr-1.5 py-0.5 rounded transition-colors cursor-pointer text-xs ${t?"text-gray-200":"text-gray-500"} ${n?"bg-[#555]":"hover:bg-[#4a4a4a]"}`,title:i,"aria-haspopup":"menu","aria-expanded":n,children:[e.jsxs("span",{className:"flex items-center gap-0.5 bg-[#1f1f1f] border border-[#3d3d3d] rounded p-0.5",children:[e.jsx("span",{className:"w-6 h-4 overflow-hidden rounded-sm bg-[#0f0f0f] flex items-center justify-center text-gray-500",children:o?e.jsx("img",{src:_n(o),alt:"",className:"w-full h-full object-cover"}):a?e.jsx(vv,{}):e.jsx(yv,{})}),e.jsx(pl,{})]}),e.jsx("span",{className:"truncate",children:i})]})}const _L=Object.freeze(Object.defineProperty({__proto__:null,PagePill:jv},Symbol.toStringTag,{value:"Module"}));function wv({scenario:t,active:n,onClick:s}){const r=t.screenshotPaths[0];return e.jsxs("button",{onClick:s,className:`flex items-center gap-2 w-full px-2 py-1.5 text-left transition-colors cursor-pointer ${n?"bg-[#1a2a30]":"hover:bg-[#2a2a2a]"}`,children:[e.jsx("div",{className:"w-10 h-7 shrink-0 rounded overflow-hidden border border-[#3d3d3d] bg-[#0f0f0f] flex items-center justify-center",children:r?e.jsx("img",{src:_n(r),alt:"",className:"w-full h-full object-cover"}):null}),e.jsx("div",{className:`text-xs truncate flex-1 min-w-0 ${n?"text-white":"text-gray-200"}`,children:Pr(t)})]})}const kL=Object.freeze(Object.defineProperty({__proto__:null,StatesDropdownRow:wv},Symbol.toStringTag,{value:"Module"}));function _v({currentScenario:t,scenarioGroups:n,onSelect:s,onCreateNew:r,onClose:a,triggerRef:o}){const i=l.useRef(null);Ti(i,a,o);const c=l.useMemo(()=>Zo(t,n),[t,n]);return e.jsxs("div",{ref:i,className:"absolute top-full right-0 mt-1 bg-[#222] border border-[#3d3d3d] rounded-lg shadow-2xl z-50 w-72 max-h-[400px] flex flex-col",role:"menu",children:[e.jsx("div",{className:"overflow-y-auto py-1 flex-1 min-h-0",children:c.map(d=>e.jsx(wv,{scenario:d,active:d.slug===t.slug,onClick:()=>{s(d.slug),a()}},d.slug))}),e.jsx("button",{onClick:()=>{r(),a()},className:"border-t border-[#3d3d3d] px-3 py-2 text-left text-[11px] font-mono tracking-wide text-[var(--accent-active)] hover:bg-[var(--accent-active)]/10 cursor-pointer",children:"+ CREATE NEW STATE"})]})}const SL=Object.freeze(Object.defineProperty({__proto__:null,StatesDropdown:_v},Symbol.toStringTag,{value:"Module"}));function kv({label:t,disabled:n,isOpen:s,onClick:r,buttonRef:a}){return e.jsxs("button",{ref:a,onClick:()=>{n||r()},disabled:n,className:`flex items-center gap-1.5 max-w-[200px] h-7 px-2.5 rounded transition-colors text-xs ${n?"bg-[#3a3a3a] text-gray-600 cursor-not-allowed":s?"bg-[#444] text-gray-200 cursor-pointer":"bg-[#3a3a3a] text-gray-200 hover:bg-[#444] cursor-pointer"}`,title:n?"No active state":t,"aria-haspopup":"menu","aria-expanded":s,children:[e.jsx("span",{className:"truncate",children:t}),e.jsx(pl,{className:"opacity-70 shrink-0"})]})}const NL=Object.freeze(Object.defineProperty({__proto__:null,StatesPillButton:kv},Symbol.toStringTag,{value:"Module"}));function Sv({viewport:t,isActive:n,onSelect:s}){return e.jsx("button",{onClick:s,className:`p-1 rounded transition-colors cursor-pointer ${n?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${t.name} (${t.width}×${t.height})`,children:e.jsx(cb,{name:t.name})})}const CL=Object.freeze(Object.defineProperty({__proto__:null,ViewportPresetButton:Sv},Symbol.toStringTag,{value:"Module"}));function Nv({viewports:t,active:n,onChange:s,currentWidth:r,currentHeight:a,previewUrl:o,isCollapsed:i,onToggleCollapsed:c,isFilled:d,onToggleFilled:u,containerWidth:h,containerHeight:p,onCustomSizeChange:f,currentScenario:m,scenarioGroups:g,onShowScenarioPreview:b,onCreateStateRequest:x,isNarrow:y=!1,onBack:v,onPlanChange:w,onToggleStatesModal:j,statesModalOpen:_=!1}){const[k,S]=l.useState(!1),[N,T]=l.useState(!1),A=l.useRef(null),M=l.useRef(null),C=d&&h?Math.round(h):r,H=d&&p?Math.round(p):a,J=m?Pr(m):"No state",Z=!m;return e.jsxs("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 h-10 grid grid-cols-[1fr_auto_1fr] items-center px-2",children:[e.jsx("div",{className:"justify-self-start",children:v?e.jsxs("button",{type:"button",onClick:v,className:"flex items-center gap-1 h-7 px-2 rounded text-sm text-[#ddd] hover:bg-[#3a3a3a]",children:[e.jsx("span",{"aria-hidden":"true",children:"←"})," Home"]}):y?null:e.jsx(dv,{isCollapsed:i,onToggle:c})}),e.jsxs("div",{className:`flex items-center gap-2 justify-self-center ${y?"min-w-0 overflow-x-auto":""}`,children:[e.jsxs("div",{className:"relative flex items-center bg-[#3a3a3a] rounded h-7 px-1 gap-1",children:[e.jsx(jv,{currentScenario:m,isOpen:k,onClick:()=>{S(F=>!F),T(!1)},buttonRef:A}),k&&e.jsx(xv,{scenarioGroups:g,currentSlug:(m==null?void 0:m.slug)??null,onSelect:b,onClose:()=>S(!1),triggerRef:A}),e.jsx("span",{className:"w-px h-5 bg-[#555] mx-1 shrink-0","aria-hidden":"true"}),t.map(F=>e.jsx(Sv,{viewport:F,isActive:!d&&n===F.name,onSelect:()=>{d&&u(),s(F.name)}},F.name)),e.jsx(uv,{isFilled:d,onToggle:u}),e.jsx(yo,{label:"H",value:H,disabled:d,onCommit:F=>f(r,F)}),e.jsx(yo,{label:"W",value:C,disabled:d,onCommit:F=>f(F,a)}),e.jsx(pv,{}),e.jsx(hv,{previewUrl:o})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:e.jsx("div",{className:"relative",children:j?_?null:e.jsx("button",{type:"button",onClick:j,className:"font-mono text-[10px] leading-none uppercase tracking-widest underline underline-offset-2 whitespace-nowrap hover:opacity-80",style:{color:"var(--lime-300)"},children:"Scenarios"}):e.jsxs(e.Fragment,{children:[e.jsx(kv,{label:J,disabled:Z,isOpen:N,onClick:()=>{T(F=>!F),S(!1)},buttonRef:M}),N&&m&&e.jsx(_v,{currentScenario:m,scenarioGroups:g,onSelect:b,onCreateNew:x,onClose:()=>T(!1),triggerRef:M})]})})})]}),e.jsx("div",{className:"justify-self-end",children:w?e.jsx("button",{type:"button",onClick:w,className:"h-7 px-3 rounded text-xs font-medium uppercase tracking-wide whitespace-nowrap text-black hover:opacity-90",style:{background:"var(--lime-300)"},children:"Plan a change to this screen"}):null})]})}const PL=Object.freeze(Object.defineProperty({__proto__:null,NavigationBar:Nv},Symbol.toStringTag,{value:"Module"}));function Cv(){return e.jsxs("div",{style:{padding:"3rem 1rem",textAlign:"center",color:"var(--text-muted)"},children:[e.jsx("h2",{style:{fontSize:"1.125rem",fontWeight:600,color:"var(--text-secondary)",margin:"0 0 0.5rem 0"},children:"No plan loaded"}),e.jsx("p",{style:{margin:0,fontSize:"0.875rem"},children:"Ask the AI to draft a plan, or pick one from the Plan tab."})]})}const TL=Object.freeze(Object.defineProperty({__proto__:null,PlanPreviewEmptyState:Cv},Symbol.toStringTag,{value:"Module"}));function Pv({title:t}){return e.jsx("h1",{style:{fontSize:"1.5rem",fontWeight:600,color:"var(--text-primary)",margin:"0 0 1rem 0",paddingBottom:"0.75rem",borderBottom:"1px solid var(--border-subtle)"},children:t})}const OL=Object.freeze(Object.defineProperty({__proto__:null,PlanPreviewHeader:Pv},Symbol.toStringTag,{value:"Module"})),Xc={prompt:null,title:null};function Tv(){const[t,n]=l.useState(Xc),[s,r]=l.useState(!0);return l.useEffect(()=>{let a=!1;return(async()=>{try{const i=await(await fetch("/api/prompt")).json();a||n({prompt:i.prompt??null,title:i.title??null})}catch{a||n(Xc)}finally{a||r(!1)}})(),()=>{a=!0}},[]),{...t,loading:s}}function Ov(){const{prompt:t,title:n,loading:s}=Tv();return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-auto",style:{background:"var(--bg-deep)"},children:e.jsx("div",{style:{padding:"1.5rem 2rem",maxWidth:"880px",width:"100%",margin:"0 auto"},children:s?null:t?e.jsxs(e.Fragment,{children:[n?e.jsx(Pv,{title:n}):null,e.jsx(Ht,{children:t})]}):e.jsx(Cv,{})})})}const AL=Object.freeze(Object.defineProperty({__proto__:null,PlanPreviewPanelView:Ov},Symbol.toStringTag,{value:"Module"}));function Av({message:t}){return e.jsx("span",{style:{color:"var(--text-dim)"},children:t})}const RL=Object.freeze(Object.defineProperty({__proto__:null,PreviewEmptyState:Av},Symbol.toStringTag,{value:"Module"}));function Rv({hasDevServerConfigured:t}){const n=t?"Starting your app…":"Your app will display here once set up";return e.jsx("div",{"data-testid":"preview-waiting-placeholder",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",color:"var(--text-dim)"},children:e.jsx("span",{children:n})})}const EL=Object.freeze(Object.defineProperty({__proto__:null,PreviewWaitingPlaceholder:Rv},Symbol.toStringTag,{value:"Module"}));function Ev(t,n,s){const r=[t];return n&&r.push(`reload:${n}`),s&&r.push(`command:${s}`),r.join("::")}function Mv({currentWidth:t,currentHeight:n,isFilled:s,scale:r}){const a=e.jsx("div",{className:"w-full h-full border border-dashed rounded flex items-center justify-center text-center px-6",style:{borderColor:"var(--border-default)",background:"var(--bg-surface)",color:"var(--text-dim)"},children:e.jsxs("div",{className:"text-sm leading-relaxed",children:[e.jsx("div",{className:"font-medium",children:"Live Preview unavailable"}),e.jsxs("div",{className:"opacity-70 mt-1",children:[t,"×",n]})]})});return s?a:e.jsx("div",{className:"shadow-[0_10px_30px_rgba(0,0,0,0.45)]",style:{width:t,height:n,transform:r<1?`scale(${r})`:void 0,transformOrigin:"center center",flexShrink:0},children:a})}const Iv=l.forwardRef(function({currentHeight:n,currentWidth:s,isFilled:r,previewUrl:a,scale:o,reloadNonce:i,commandNonce:c,iframeKey:d,onLoad:u,onError:h},p){if(wt())return e.jsx(Mv,{currentWidth:s,currentHeight:n,isFilled:r,scale:o});const f=d??Ev(a,i,c),m=()=>{h&&h("iframe error event")};return e.jsx("div",{className:r?"w-full h-full":"shadow-[0_10px_30px_rgba(0,0,0,0.45)]",style:r?void 0:{width:s,height:n,transform:o<1?`scale(${o})`:void 0,transformOrigin:"center center",flexShrink:0},children:e.jsx("iframe",{ref:p,src:a,title:"Live Preview",style:{width:"100%",height:"100%",border:"none",background:"var(--bg-deep)"},onLoad:u,onError:m},f)})}),ML=Object.freeze(Object.defineProperty({__proto__:null,EmbeddedPreviewPlaceholder:Mv,PreviewFrame:Iv},Symbol.toStringTag,{value:"Module"}));function Dv({label:t="Loading preview..."}={}){return e.jsxs("div",{role:"status","aria-live":"polite",className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[var(--bg-deep)]/80 backdrop-blur-sm text-[var(--text-muted)]",children:[e.jsx("div",{className:"w-10 h-10 border-4 border-primary/20 border-t-primary rounded-full animate-spin"}),e.jsx("span",{className:"text-sm",children:t})]})}const IL=Object.freeze(Object.defineProperty({__proto__:null,PreviewLoadingSpinner:Dv},Symbol.toStringTag,{value:"Module"}));function e4(t){var n,s;try{const r=(s=(n=t==null?void 0:t.contentWindow)==null?void 0:n.location)==null?void 0:s.href;return typeof r=="string"?r:null}catch{return null}}function t4(t,n){if(!n||!t||t==="about:blank")return null;let s;try{s=new URL(t,window.location.origin).pathname}catch{return null}return s===xn||s.startsWith(`${xn}/`)?null:s}function n4(t){return{type:"error",message:`The app navigated to "${t}", which is outside the Live Preview (everything the preview serves lives under ${xn}). That path is served by the editor, so the frame would have rendered codeyam-editor instead of your app. The preview was stopped rather than showing you the wrong application.`,filename:t,lineno:null,colno:null,stack:[`Frame navigated to: ${t}`,`Expected to stay under: ${xn}`,"",`Why this happens: the Live Preview is served from the same-origin ${xn} subpath. A root-absolute navigation (an <a href="/…">, a form action, a location.href assignment, or an upstream redirect) leaves that subpath, so the request is answered by the editor rather than your app.`,"","Fix: if this app routes on the client, set `sameOriginSafe: false` in .codeyam/stack.json so the preview runs on its own dedicated origin."].join(`
|
|
193
|
+
`),timestampMs:Date.now(),dedupeKey:`preview-escape:${t}`,count:1}}function s4({previewUrl:t,resetKey:n,capturedErrors:s}){const[r,a]=l.useState(null),o=t.startsWith(xn);l.useEffect(()=>{a(null)},[n,t]);const i=l.useCallback(u=>{const h=e4(u),p=t4(h,o);return a(p),p!==null&&n3(p),h},[o]),c=l.useCallback(()=>a(null),[]),d=l.useMemo(()=>r?[...s,n4(r)]:s,[s,r]);return{escaped:r!==null,overlayErrors:d,noteFrameLoad:i,clearEscape:c}}function r4(t,n){const s=l.useRef(!1);l.useEffect(()=>{s.current||t&&t.startCommand&&(t.intendedRunning||t.status==="stopped"&&(s.current=!0,n()))},[t,n])}function a4(t,n){const[s,r]=l.useState(!1),a=l.useCallback(()=>{s?(r(!1),t.deactivate(),t.clearSelection()):(r(!0),t.activate())},[s,t]);return l.useEffect(()=>{s&&(r(!1),t.clearSelection())},[n]),{isActive:s,toggle:a}}function o4(t,n){const[s,r]=l.useState(t),a=l.useRef(null);return l.useEffect(()=>{if(t!==!1){a.current!==null&&(window.clearTimeout(a.current),a.current=null),r(t);return}if(a.current===null)return a.current=window.setTimeout(()=>{a.current=null,r(!1)},n),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},[t,n]),s}function i4(t,n=!0,s="running"){const r=l.useRef(null),a=l.useRef(!1),[o,i]=l.useState(0),c=l.useRef(null);l.useEffect(()=>{t!=null&&(r.current!=null&&t!==r.current?(a.current=!1,i(h=>h+1)):r.current==null&&(a.current?n&&zc(t,c.current):i(h=>h+1)),r.current=t)},[t,n]);const d=l.useCallback(h=>{a.current=!0,h&&(c.current=h),n&&t!=null&&zc(t,h??c.current)},[t,n]),u=l.useCallback(h=>{n&&Z5(h)},[n]);return{reloadNonce:o,handleIframeLoad:d,handleIframeError:u}}const l4=1500,c4=2e3,d4=3e3,u4=2;function h4(){return typeof window>"u"?!1:window.location.pathname.startsWith("/scenario/")?!0:wt()}function p4(t,n=!1){const s=h4(),[r,a]=l.useState(s?!0:null),[o,i]=l.useState(null),[c,d]=l.useState(0),[u,h]=l.useState(0),p=l.useRef(null),f=l.useRef(null),m=l.useRef(null),g=l.useRef(!1),b=l.useRef(t),x=l.useRef(n);l.useEffect(()=>{b.current=t},[t]),l.useEffect(()=>{x.current=n},[n]);const y=l.useCallback(()=>{f.current!=null&&(clearTimeout(f.current),f.current=null)},[]),v=l.useCallback(async()=>{if(g.current||x.current)return;const k=b.current;if(!k)return;m.current&&m.current.abort();const S=new AbortController;m.current=S;const N=setTimeout(()=>S.abort(),d4);let T=!1;try{await fetch(k,{mode:"no-cors",cache:"no-store",signal:S.signal}),T=!0}catch{T=!1}finally{clearTimeout(N)}if(!g.current){if(i(Date.now()),T){if(d(0),p.current!==!0){const A=p.current===!1;p.current=!0,a(!0),A&&h(M=>M+1)}}else d(A=>{const M=A+1;return M>=u4&&p.current!==!1&&(p.current=!1,a(!1)),M});w()}},[]),w=l.useCallback(()=>{if(g.current)return;y();const k=p.current===!0?c4:l4;f.current=setTimeout(()=>{f.current=null,v()},k)},[y,v]),j=l.useCallback(()=>{y(),v()},[y,v]);l.useEffect(()=>{if(!s)return g.current=!1,v(),()=>{g.current=!0,y(),m.current&&(m.current.abort(),m.current=null)}},[v,y,s]),l.useEffect(()=>{s||v()},[t,v,s]);const _=l.useRef(n);return l.useEffect(()=>{if(s)return;const k=_.current;_.current=n,k&&!n&&v()},[n,v,s]),{healthy:r,lastProbeAt:o,failedProbeCount:c,reloadNonce:u,invalidate:j}}const Qc={loaded:!1,stalledRequests:0,fastRequests:0,longestStallMs:0,tailReadFailedReason:null};function m4(t){const{active:n,trigger:s}=t,[r,a]=l.useState(Qc),o=l.useRef(null),i=l.useCallback(()=>{var d;(d=o.current)==null||d.abort();const c=new AbortController;o.current=c,fetch("/api/dev-server-recent-requests",{signal:c.signal}).then(u=>{if(!u.ok)throw new Error(`HTTP ${u.status}`);return u.json()}).then(u=>{if(c.signal.aborted)return;const p=(u.stalls??[]).reduce((f,m)=>Math.max(f,m.durationMs??0),0);a({loaded:!0,stalledRequests:u.stalledRequests??0,fastRequests:u.fastRequests??0,longestStallMs:p,tailReadFailedReason:u.tailReadFailedReason??null})}).catch(u=>{c.signal.aborted||a({loaded:!0,stalledRequests:0,fastRequests:0,longestStallMs:0,tailReadFailedReason:u instanceof Error?u.message:"fetch failed"})})},[]);return l.useEffect(()=>{var c;if(!n){a(Qc),(c=o.current)==null||c.abort();return}return i(),()=>{var d;(d=o.current)==null||d.abort()}},[n,s,i]),r}function f4(t){return!t||!t.loaded||t.tailReadFailedReason?null:t.stalledRequests>0?`Recent requests took up to ${Math.max(1,Math.round(t.longestStallMs/1e3))}s — the dev server is responding, just slowly. Check the dev-server log for what's blocking the render.`:t.fastRequests===0?"No recent activity in the dev-server log — the dev server may have stopped accepting connections. Restart it if this persists.":null}function g4({liveIframeHealthy:t,previewReachable:n}){return t===!0||n===!0}function b4({hasDevServerConfigured:t,hasServed:n}){return!t||n}const x4=2e3;function y4(t,n){const[s,r]=l.useState(0),a=l.useRef(t),o=l.useRef(n),i=l.useRef(0);return l.useEffect(()=>{const c=a.current,d=o.current;if(a.current=t,o.current=n,!(n===!1)||!(t===!0)||!(c===!1&&t===!0)&&!(d===!0&&n===!1))return;const m=Date.now();m-i.current<x4||(i.current=m,r(g=>g+1))},[t,n]),s}const Ks={windowMs:1e4,threshold:4,ringBufferSize:16};function v4({pidNonce:t,probeNonce:n,draftNonce:s,windowMs:r=Ks.windowMs,threshold:a=Ks.threshold}){const[o,i]=l.useState(!1),[c,d]=l.useState([]),[u,h]=l.useState(0),p=l.useRef(!1),f=l.useRef(t),m=l.useRef(n),g=l.useRef(s),b=l.useCallback(y=>{const v=Date.now(),w=v-r;let j=[];d(k=>{const S=k.filter(N=>N.timestampMs>=w);return S.push({reason:y,timestampMs:v}),S.length>Ks.ringBufferSize&&S.splice(0,S.length-Ks.ringBufferSize),j=S,S});const _=j.filter(k=>k.timestampMs>=w).length;if(!p.current&&_>=a){p.current=!0,i(!0);return}p.current||h(k=>k+1)},[r,a]);l.useEffect(()=>{t!==f.current&&(f.current=t,b("pid"))},[t,b]),l.useEffect(()=>{n!==m.current&&(m.current=n,b("probe"))},[n,b]),l.useEffect(()=>{s!==g.current&&(g.current=s,b("draft"))},[s,b]);const x=l.useCallback(()=>{p.current=!1,i(!1),d([]),h(y=>y+1)},[]);return{tripped:o,recentReloads:c,gatedNonce:u,reset:x}}function j4(t,n,s=Do){const r=l.useRef(void 0);l.useEffect(()=>{if(!n){r.current=t;return}if(typeof t=="number"){if(r.current===void 0){r.current=t;return}t>r.current&&(r.current=t,s())}},[t,n,s])}const Zc=20,w4="codeyam-error-capture";function _4(t,n=0){const[s,r]=l.useState([]),a=l.useCallback(()=>r([]),[]);return l.useEffect(()=>{r([])},[n]),l.useEffect(()=>{function o(i){const c=i.data;if(!c||c.source!==w4)return;const d=t.current;if(d&&i.source!==d.contentWindow)return;const u=c.payload;!u||typeof u!="object"||!u.dedupeKey||r(h=>{const p=h.findIndex(m=>m.dedupeKey===u.dedupeKey);if(p>=0){const m=h.slice();return m[p]={...m[p],count:m[p].count+1,timestampMs:u.timestampMs},m}const f=[...h,{...u,count:1}];return f.length>Zc?f.slice(f.length-Zc):f})}return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[t]),{errors:s,clear:a}}const Ra=[500,1e3,2e3];async function k4(t){try{const s=await(await fetch(`/api/probe-url?url=${encodeURIComponent(t)}`)).json();return{status:typeof(s==null?void 0:s.status)=="number"?s.status:null}}catch{return{status:null}}}async function S4(){try{const n=await(await fetch("/api/dev-server-log/slice?lines=40")).json();return Array.isArray(n==null?void 0:n.lines)?n.lines:[]}catch{return[]}}function N4(t,n){const[s,r]=l.useState({status:null,clickThroughBroken:!1,logLines:[],loading:!1});return l.useEffect(()=>{if(!t){r({status:null,clickThroughBroken:!1,logLines:[],loading:!1});return}let a=!1;return r({status:null,clickThroughBroken:!1,logLines:[],loading:!0}),(async()=>{const o=1+Ra.length;let i=null;for(let d=0;d<o;d++){if(a)return;const{status:u}=await k4(t);if(a)return;if(i=u,u===null||u<500){r({status:u,clickThroughBroken:!1,logLines:[],loading:!1});return}d<Ra.length&&await new Promise(h=>setTimeout(h,Ra[d]))}const c=await S4();a||r({status:i,clickThroughBroken:!0,logLines:c,loading:!1})})(),()=>{a=!0}},[t,n]),s}function Lv({url:t,status:n,logLines:s,onRetry:r}){return e.jsx("div",{role:"alert","data-testid":"iframe-click-through-error-card",className:"absolute inset-0 z-20 flex items-center justify-center bg-zinc-950/85 p-6",children:e.jsxs("div",{className:"max-w-2xl w-full rounded-md border border-red-700 bg-zinc-900 text-zinc-100 shadow-xl",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-red-800 flex justify-between items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[e.jsxs("div",{className:"text-sm font-semibold text-red-300",children:["Scenario render failed (HTTP ",n,")"]}),e.jsx("div",{className:"mt-1 text-xs text-zinc-400 break-all",children:t}),e.jsx("div",{className:"mt-2 text-xs text-zinc-300",children:"The preview URL returned a server error. This is a bug — capture and click should always agree. Check the log below, and refresh once the underlying error is fixed."})]}),e.jsxs("div",{className:"flex-shrink-0 flex items-start gap-2",children:[e.jsx(Ze,{variant:"subtle",text:`Scenario render failed (HTTP ${n})
|
|
194
|
+
${t}
|
|
195
|
+
|
|
196
|
+
${s.join(`
|
|
197
|
+
`)}`,label:"Copy",className:"px-2.5 py-1 text-xs rounded border border-gray-600 bg-gray-800 text-gray-200 hover:bg-gray-700 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:r,className:"px-2.5 py-1 text-xs rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:"Retry"})]})]}),e.jsx("div",{className:"px-5 py-4 max-h-72 overflow-auto font-mono text-[11px] leading-snug text-zinc-300 whitespace-pre-wrap",children:s.length>0?s.join(`
|
|
198
|
+
`):e.jsxs("span",{className:"text-zinc-500 italic",children:["No dev-server log lines available — see"," ",e.jsx("code",{children:".codeyam/logs/dev-server.log"}),"."]})})]})})}const DL=Object.freeze(Object.defineProperty({__proto__:null,IframeClickThroughErrorCard:Lv},Symbol.toStringTag,{value:"Module"}));function C4(t){if(t===null||!t.startCommand)return{isRestarting:!1,isFailed:!1,isStarting:!1,isStopped:!1};const n=t.status==="failed",s=!n&&t.status!=="running"&&t.intendedRunning&&(t.restartCount??0)>0,r=!n&&t.intendedRunning&&t.status!=="running"&&(t.restartCount??0)===0,a=t.status==="stopped"&&!t.intendedRunning;return{isRestarting:s,isFailed:n,isStarting:r,isStopped:a}}const P4=20;function T4(t){const{hasDevServerConfigured:n,probeHealthy:s,backendIframeHealthy:r,isStarting:a,isRestarting:o,isFailed:i,isStopped:c,isPrePrototype:d,withinStartupGrace:u,previewReachable:h,hasEverServed:p}=t;return n?i?"crashed":r===!0||h===!0||s===!0&&r!==!1?null:d?"scaffolding":c?p?"stopped":null:o?"restarting":a||u||!p?null:s===!1?"reconnecting":r===!1&&s===!0?"disconnected":s===null?"probing":"reconnecting":null}function O4(t){return t===null||t.status!=="running"?!1:t.liveIframeHealthy!==!1}const A4=5,R4=3;function E4(t,n){return t===null||t<=0?!1:t<=(n==="backend"?R4:A4)}const ed="Setting up your project",td="Preparing your project — the preview will appear once it's ready.",M4={1:"Aligning on the plan with you.",2:"Aligning on the plan with you.",3:"Aligning on the plan with you.",4:"Preparing the project environment.",5:"Wiring routes and seeding sample data."},I4={1:"Aligning on the plan with you.",2:"Aligning on the plan with you.",3:"Preparing the project environment."};function D4(t,n){return t===null?{title:ed,body:td}:{title:ed,body:(n==="backend"?I4:M4)[t]??td}}const L4={probing:{title:"Checking the Live Preview",body:"Making sure your app is responding before showing it.",spinner:!0,nextAction:"Use Retry now. If the check keeps failing, copy this report — your app's own startup output will say why it isn't answering."},starting:{title:"Starting your app",body:"Waiting for your app's server to come up…",spinner:!0,nextAction:"Use Retry now. If it never starts, copy this report and check your app's startup output for the reason."},restarting:{title:"Restarting your app",body:"Your app's server stopped unexpectedly. CodeYam is bringing it back automatically…",spinner:!0,nextAction:"Use Retry now. If it keeps stopping, copy this report — the cause is in your app's own startup output."},reconnecting:{title:"Reconnecting to your app",body:"Waiting for your app's server to respond…",spinner:!0,nextAction:"Use Retry now. If it stays unreachable, copy this report and check whether your app's server is still running."},disconnected:{title:"The preview lost its connection",body:"Your app's server is running fine. This preview just came unstuck from it after a restart, so it's showing nothing rather than something stale.",spinner:!1,nextAction:"Use Reload preview. There's no need to restart your app — it never stopped."},stopped:{title:"Your app isn't running",body:"Starting it automatically…",spinner:!1,nextAction:"Use Retry now. If it doesn't come up, copy this report and check your app's startup output."},crashed:{title:"Your app keeps stopping",body:"CodeYam has restarted it several times and it isn't staying up. This is something in the app itself rather than in the editor.",spinner:!1,nextAction:"Use Retry now to try once more. If it stops again, copy this report — the reason will be in your app's own startup output."},scaffolding:{title:"Setting up your project",body:"Preparing your project — the preview appears once it's ready.",spinner:!0,nextAction:"Nothing yet — setup finishes on its own. If it hasn't after a few minutes, copy this report."}};function Fv({variant:t,restartCount:n=0,showRetry:s=!1,onRetry:r,bodyOverride:a}){const{title:o,body:i,spinner:c,nextAction:d}=L4[t],u=a??i,h=t==="disconnected",p=h||t==="crashed"||s,f=h?"Reload preview":"Retry now",{phase:m,attempts:g,retry:b}=xd(r??(()=>{}));return p?e.jsx("div",{"data-testid":"preview-unhealthy-overlay","data-variant":t,className:"absolute inset-0 z-50 flex items-center justify-center bg-white/90 p-6 backdrop-blur-sm dark:bg-gray-900/90",children:e.jsx(kr,{severity:t==="crashed"?"error":"warning",testId:"preview-unhealthy-notice",headline:o,explanation:u,nextAction:d,actions:r?[{label:f,onClick:b,pending:m==="pending",pendingLabel:"Checking…",testId:"preview-unhealthy-overlay-retry"}]:[],actionFeedback:m==="unchanged"?e.jsxs("span",{"data-testid":"preview-unhealthy-overlay-unchanged",children:["Checked just now — the preview still isn’t back",g>1?` (${g} tries)`:"","."]}):null})}):e.jsx(wd,{title:o,body:u,spinner:c,restartCount:n,variant:t})}const LL=Object.freeze(Object.defineProperty({__proto__:null,PreviewUnhealthyOverlay:Fv},Symbol.toStringTag,{value:"Module"}));function F4(t){return t.slice().reverse().map(n=>{const s=n.filename!=null?`
|
|
199
|
+
at ${n.filename}${n.lineno!=null?`:${n.lineno}`:""}${n.colno!=null?`:${n.colno}`:""}`:"",r=n.stack?`
|
|
200
|
+
${n.stack}`:"",a=n.count>1?` (×${n.count})`:"";return`[${n.type}]${a} ${n.message}${s}${r}`}).join(`
|
|
201
|
+
|
|
202
|
+
`)}function z4(t){if(t.length===0)return"no reloads recorded";const n={};for(const s of t)n[s.reason]=(n[s.reason]??0)+1;return Object.entries(n).map(([s,r])=>`${s}×${r}`).join(", ")}function zv({count:t,onExpand:n,onClear:s}){const r=`${t} ${t===1?"Error":"Errors"}`;return e.jsx("div",{"data-testid":"preview-error-badge",className:"absolute bottom-3 right-3 z-50 pointer-events-auto",children:e.jsxs("div",{className:"flex items-center gap-1.5 rounded-full shadow-lg border border-red-300 dark:border-red-800 bg-white dark:bg-gray-900",style:{background:"var(--bg-surface, rgba(255,255,255,0.97))"},children:[e.jsxs("button",{type:"button",onClick:n,"aria-label":`Expand ${r}`,className:"cursor-pointer flex items-center gap-1.5 pl-2.5 pr-2 py-1 text-xs font-medium text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 rounded-l-full",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block h-1.5 w-1.5 rounded-full bg-red-600"}),e.jsx("span",{children:r}),e.jsx("span",{"aria-hidden":"true",className:"text-gray-400",children:"›"})]}),e.jsx("button",{type:"button",onClick:s,"aria-label":"Dismiss errors",className:"cursor-pointer px-2 py-1 text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded-r-full",children:"✕"})]})})}const FL=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorBadge:zv},Symbol.toStringTag,{value:"Module"}));function $v({headline:t,tripped:n,onClear:s,closeAriaLabel:r="Dismiss errors",providerLabel:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 px-4 py-3 border-b border-red-200 dark:border-red-900",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-red-700 dark:text-red-300",children:t}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-500 dark:text-gray-400",children:n?"Iframe frozen on its last load attempt. Copy the errors below, fix the code, then click Retry.":`Errors recorded from the running app. Copy them below to share with ${a}.`})]}),e.jsx("button",{type:"button",onClick:s,className:"cursor-pointer text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":r,children:"✕"})]})}const zL=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorOverlayHeader:$v},Symbol.toStringTag,{value:"Module"}));function $4(t){const n=t.filename?`${t.filename}${t.lineno!=null?`:${t.lineno}`:""}${t.colno!=null?`:${t.colno}`:""}`:"";return[`${t.type}: ${t.message}`,n,t.stack??""].filter(Boolean).join(`
|
|
203
|
+
`)}function Bv({error:t,expanded:n,onToggle:s}){return e.jsxs("li",{className:"rounded border border-red-200 dark:border-red-900 bg-red-50/60 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-start",children:[e.jsxs("button",{type:"button",onClick:s,className:"flex-1 min-w-0 flex items-start gap-2 text-left px-2 py-1.5 hover:bg-red-100/60 dark:hover:bg-red-900/30",children:[e.jsx("span",{className:"mt-0.5 text-red-500","aria-hidden":"true",children:n?"▾":"▸"}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide text-red-500 dark:text-red-400 mr-2",children:t.type}),e.jsx("span",{className:"text-gray-900 dark:text-gray-100 break-words",children:t.message}),t.count>1&&e.jsxs("span",{className:"ml-2 text-gray-500",children:["×",t.count]}),t.filename&&e.jsxs("span",{className:"block text-[11px] text-gray-500 mt-0.5 truncate",children:[t.filename,t.lineno!=null?`:${t.lineno}`:"",t.colno!=null?`:${t.colno}`:""]})]})]}),e.jsx("div",{className:"shrink-0 px-1.5 py-1.5",children:e.jsx(Ze,{variant:"icon",text:$4(t)})})]}),n&&t.stack&&e.jsx("pre",{className:"px-3 pb-2 text-[11px] font-mono text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words",children:t.stack})]})}const $L=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorRow:Bv},Symbol.toStringTag,{value:"Module"}));function qv({errors:t,emptyHint:n}){const[s,r]=l.useState(null);return t.length===0?e.jsx("ul",{className:"flex-1 overflow-auto px-2 py-2 space-y-1 text-xs",children:e.jsx("li",{className:"text-gray-500 px-2 py-3",children:n??"No runtime errors captured yet."})}):e.jsx("ul",{className:"flex-1 overflow-auto px-2 py-2 space-y-1 text-xs",children:t.slice().reverse().map(a=>e.jsx(Bv,{error:a,expanded:s===a.dedupeKey,onToggle:()=>r(s===a.dedupeKey?null:a.dedupeKey)},a.dedupeKey))})}const BL=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorList:qv},Symbol.toStringTag,{value:"Module"}));function Hv({canCopy:t,reasonsSummary:n,copyState:s,onCopy:r,onCopyForAgent:a,onRetry:o,providerLabel:i}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 border-t border-red-200 dark:border-red-900 bg-gray-50 dark:bg-gray-900/40",children:[e.jsx("button",{type:"button",onClick:r,disabled:!t,className:"px-2.5 py-1 text-xs rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed",children:"Copy errors"}),e.jsxs("button",{type:"button",onClick:a,disabled:!t,className:"px-2.5 py-1 text-xs rounded bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed",children:["Copy and ask ",i]}),e.jsx("button",{type:"button",onClick:o,className:"px-2.5 py-1 text-xs rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:"Retry"}),e.jsxs("span",{className:"ml-auto text-[11px] text-gray-500",children:["Reloads in last 10s: ",n,s==="copied"&&e.jsx("span",{className:"ml-2 text-emerald-600",children:"copied ✓"}),s==="failed"&&e.jsx("span",{className:"ml-2 text-red-500",children:"copy blocked"})]})]})}const qL=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorOverlayFooter:Hv},Symbol.toStringTag,{value:"Module"})),B4=`Fix this error in the live preview. Here is what the captured runtime error reported:
|
|
204
|
+
|
|
205
|
+
`;function Wv({tripped:t,errors:n,recentReloads:s,serverHealthy:r,onRetry:a,onClear:o,providerLabel:i}){const[c,d]=l.useState("idle"),[u,h]=l.useState(!0),p=l.useMemo(()=>F4(n),[n]),f=l.useMemo(()=>z4(s),[s]);if(l.useEffect(()=>{n.length===0&&h(!0)},[n.length]),!t&&n.length===0)return null;const m=r&&!t,g=m&&u&&n.length>0,b=t?`Live Preview paused — ${n.length} error${n.length===1?"":"s"} captured`:`${n.length} runtime error${n.length===1?"":"s"} captured`;async function x(y){const v=await g_(y+p);d(v?"copied":"failed"),setTimeout(()=>d("idle"),1500)}return g?e.jsx("div",{"data-testid":"preview-error-overlay","data-tripped":"false","data-collapsed":"true",className:"absolute inset-0 z-50 pointer-events-none",children:e.jsx(zv,{count:n.length,onExpand:()=>h(!1),onClear:o})}):e.jsx("div",{"data-testid":"preview-error-overlay","data-tripped":t?"true":"false","data-collapsed":"false",className:"absolute inset-0 z-50 flex flex-col items-stretch p-4 pointer-events-none",children:e.jsxs("div",{className:"mx-auto w-full max-w-2xl rounded-lg shadow-lg pointer-events-auto flex flex-col",style:{background:"var(--bg-surface, rgba(255,255,255,0.97))",border:"1px solid var(--border-default, #ef4444)",maxHeight:"100%"},children:[e.jsx($v,{headline:b,tripped:t,onClear:m?()=>h(!0):o,closeAriaLabel:m?"Minimize errors":"Dismiss errors",providerLabel:i}),e.jsx(qv,{errors:n,emptyHint:t?`Breaker tripped before any runtime error was reported. Reasons in window: ${f}.`:null}),e.jsx(Hv,{canCopy:n.length>0,reasonsSummary:f,copyState:c,onCopy:()=>x(""),onCopyForAgent:()=>x(B4),onRetry:a,providerLabel:i})]})})}const HL=Object.freeze(Object.defineProperty({__proto__:null,PreviewErrorOverlay:Wv},Symbol.toStringTag,{value:"Module"}));function q4(t){if(!t)return null;const n=Object.entries(t).map(([s,r])=>`${s}=${typeof r=="string"?r:JSON.stringify(r)}`);return n.length>0?n.join(", "):null}function Gv({previewUrl:t,description:n,demonstratesState:s}){const r=l.useMemo(()=>{try{return new URL(t,window.location.origin).searchParams.get("_codeyam_scenario")}catch{return null}},[t]),a=l.useMemo(()=>q4(s),[s]);if(!r)return null;const o=n!=null&&n.trim()?n.trim():null;return e.jsxs("div",{className:"absolute top-2 left-2 z-30 flex flex-col gap-0.5 max-w-[16rem] px-2 py-1 rounded bg-black/60 backdrop-blur-sm border border-white/10 shadow-lg pointer-events-none select-none",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),e.jsxs("span",{className:"text-[10px] font-medium text-white/90 tracking-wide uppercase",children:["Scenario: ",r]})]}),o?e.jsx("span",{className:"text-[10px] text-white/70 leading-snug whitespace-pre-line",children:o}):null,a?e.jsx("span",{className:"text-[9px] font-mono text-white/50 tracking-wide",children:a}):null]})}const WL=Object.freeze(Object.defineProperty({__proto__:null,ActiveScenarioOverlay:Gv},Symbol.toStringTag,{value:"Module"}));function Uv(){return e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),e.jsx("h3",{className:"text-sm font-bold text-gray-900 dark:text-gray-100 uppercase tracking-tight",children:"Dev Server Crash Recovery Failed"})]}),e.jsx("div",{className:"text-[10px] text-gray-500 dark:text-gray-400 font-medium",children:"LAST 50 LOG LINES"})]})}const GL=Object.freeze(Object.defineProperty({__proto__:null,CrashLogHeader:Uv},Symbol.toStringTag,{value:"Module"}));function Yv({logs:t}){return e.jsx("div",{className:"flex-1 bg-black p-4 font-mono text-[11px] leading-relaxed overflow-y-auto text-gray-300",children:t.length>0?t.map((n,s)=>e.jsx("div",{className:"whitespace-pre-wrap break-all border-l-2 border-gray-800 pl-3 mb-1",children:n},s)):e.jsx("div",{className:"italic text-gray-600",children:"No logs captured..."})})}const UL=Object.freeze(Object.defineProperty({__proto__:null,CrashLogViewer:Yv},Symbol.toStringTag,{value:"Module"}));function Vv({providerLabel:t}){return e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-red-800 dark:text-red-300 font-medium mb-1",children:"CodeYam was unable to restart the dev server after several attempts."}),e.jsxs("p",{className:"text-xs text-red-700/80 dark:text-red-400/80",children:["Copy the logs and share them with ",t," to investigate the underlying bug."]})]})}const YL=Object.freeze(Object.defineProperty({__proto__:null,CrashLogFooterMessage:Vv},Symbol.toStringTag,{value:"Module"}));function Kv({logs:t,copyWriter:n,providerLabel:s}){return e.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-950/30 border-t border-red-100 dark:border-red-900/50",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx(Vv,{providerLabel:s}),e.jsx(Ze,{text:t.join(`
|
|
206
|
+
`),label:"Copy logs",writer:n})]})})}const VL=Object.freeze(Object.defineProperty({__proto__:null,CrashLogFooter:Kv},Symbol.toStringTag,{value:"Module"}));function Jv({logs:t,providerLabel:n}){return e.jsxs("div",{className:"absolute inset-0 bg-white dark:bg-gray-900 flex flex-col z-[60] overflow-hidden",children:[e.jsx(Uv,{}),e.jsx(Yv,{logs:t}),e.jsx(Kv,{logs:t,providerLabel:n})]})}const KL=Object.freeze(Object.defineProperty({__proto__:null,DevServerCrashLog:Jv},Symbol.toStringTag,{value:"Module"})),nd=20;function H4(t){if(!t)return null;try{return new Date(t).toLocaleTimeString()}catch{return null}}function Xv({lastError:t,failureCount:n,failedAtMs:s,holder:r,onRetry:a,onReap:o}){const[i,c]=l.useState(!1),d=t.split(`
|
|
207
|
+
`),u=d.length>nd,h=i||!u?d:d.slice(d.length-nd),p=H4(s);return e.jsxs("div",{"data-testid":"dev-server-failed-panel",className:"absolute inset-0 bg-white dark:bg-gray-900 flex flex-col z-[60] overflow-hidden",children:[e.jsxs("header",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:["Dev server failed to start after ",n," ",n===1?"attempt":"attempts"]}),p&&e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:["Last attempt: ",p]}),r&&e.jsxs("div",{"data-testid":"dev-server-failed-holder",className:"mt-3 rounded border border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/30 px-3 py-2 text-xs text-amber-900 dark:text-amber-100",children:[e.jsxs("div",{children:["Port ",e.jsx("span",{className:"font-semibold",children:r.port})," is held by:"]}),e.jsxs("div",{className:"mt-1 font-mono",children:["PID ",r.pid," — ",r.command]})]})]}),e.jsx("pre",{"data-testid":"dev-server-failed-error",className:"flex-1 overflow-auto px-6 py-4 m-0 font-mono text-xs leading-relaxed text-gray-800 dark:text-gray-200 whitespace-pre",children:h.join(`
|
|
208
|
+
`)}),e.jsxs("footer",{className:"px-6 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between gap-3",children:[u?e.jsx("button",{type:"button",onClick:()=>c(f=>!f),className:"text-xs text-gray-600 dark:text-gray-300 underline hover:text-gray-900 dark:hover:text-gray-100",children:i?"Show less":`Show all ${d.length} lines`}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ze,{variant:"subtle",text:t,label:"Copy error",className:"shrink-0 px-3 py-1.5 text-sm font-medium rounded border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"}),r&&o&&e.jsx("button",{type:"button","data-testid":"dev-server-failed-reap",onClick:o,className:"px-4 py-1.5 text-sm font-medium rounded border border-amber-500 text-amber-700 dark:text-amber-200 hover:bg-amber-100 dark:hover:bg-amber-900/50",children:"Kill orphan and retry"}),e.jsx("button",{type:"button","data-testid":"dev-server-failed-retry",onClick:a,className:"px-4 py-1.5 text-sm font-medium rounded bg-blue-600 text-white hover:bg-blue-700",children:"Retry"})]})]})]})}const JL=Object.freeze(Object.defineProperty({__proto__:null,DevServerFailedPanel:Xv},Symbol.toStringTag,{value:"Module"}));function Qv({diagnostic:t,onRetry:n}){const{expectedPort:s,actualPort:r,appName:a,currentStartCommand:o,remediation:i}=t;return e.jsxs("div",{"data-testid":"preview-port-mismatch-card",className:"absolute inset-0 bg-white dark:bg-gray-900 flex flex-col z-[60] overflow-auto",children:[e.jsxs("header",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"Dev server port conflict"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[a," bound port"," ",e.jsx("span",{className:"font-semibold",children:r}),", but the editor needs the app on port"," ",e.jsx("span",{className:"font-semibold",children:s})," so its reverse proxy (mocking, capture) can sit in front."]})]}),e.jsxs("div",{className:"flex-1 px-6 py-4 text-sm text-gray-800 dark:text-gray-200 space-y-3",children:[e.jsx("p",{children:i}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400 mb-1",children:"Current start command"}),e.jsx("pre",{className:"m-0 font-mono text-xs leading-relaxed whitespace-pre-wrap rounded bg-gray-100 dark:bg-gray-800 px-3 py-2",children:o||"(none configured)"})]})]}),e.jsx("footer",{className:"px-6 py-3 border-t border-gray-200 dark:border-gray-700 flex items-center justify-end",children:e.jsx("button",{type:"button","data-testid":"preview-port-mismatch-retry",onClick:n,className:"px-4 py-1.5 text-sm font-medium rounded bg-blue-600 text-white hover:bg-blue-700",children:"Retry"})})]})}const XL=Object.freeze(Object.defineProperty({__proto__:null,PreviewPortMismatchCard:Qv},Symbol.toStringTag,{value:"Module"})),sd=48,W4=100,G4=320,U4=192;function Y4({containerHeight:t,containerWidth:n,viewportHeight:s,viewportWidth:r}){if(!(r!=null&&s!=null&&n!=null&&t!=null&&r>0&&s>0&&n>0&&t>0))return{width:G4,height:U4,hasViewport:!1};const o=n-sd*2,i=t-sd*2-W4,c=Math.min(1,o/r,i/s);return{width:Math.round(r*c),height:Math.round(s*c),hasViewport:!0}}function wo({containerHeight:t,containerWidth:n,heading:s="The app is being edited",onDismiss:r,scenarioName:a,screenshotPath:o,subtext:i="Live preview will load when the build agent is idle",viewportHeight:c,viewportWidth:d}){const{width:u,height:h,hasViewport:p}=Y4({containerWidth:n,containerHeight:t,viewportWidth:d,viewportHeight:c}),f={width:u,height:h,...p?{overflowY:"auto"}:{}};return e.jsx("div",{className:"absolute inset-0 bg-white/90 dark:bg-gray-900/90 backdrop-blur-sm flex flex-col items-center justify-center z-50 animate-in fade-in duration-300",children:e.jsxs("div",{className:"flex flex-col items-center space-y-4 text-center p-6",children:[e.jsx("div",{className:"rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 shadow-md",style:f,children:e.jsx(kt,{screenshotPath:o??void 0,alt:a??"Scenario preview",className:p?"w-full h-auto":"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:s}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i})]}),e.jsx("button",{onClick:r,className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:"Dismiss"})]})})}const QL=Object.freeze(Object.defineProperty({__proto__:null,BuildingPreviewOverlay:wo},Symbol.toStringTag,{value:"Module"}));function Zv({isActive:t,onToggle:n,interactionAvailable:s=!0}){return e.jsx("button",{onClick:s?n:void 0,disabled:!s,title:s?t?"Exit Debug Mode":"Debug Mode":"Click-to-select is unavailable for this stack's preview (served from a separate origin)",className:"absolute z-50",style:{bottom:16,right:16,width:40,height:40,borderRadius:"50%",border:t?"2px solid var(--accent-blue)":"1px solid var(--border-default)",background:t?"var(--accent-blue)":"var(--bg-surface)",color:t?"#000":"var(--text-secondary)",cursor:s?"pointer":"not-allowed",display:"none",alignItems:"center",justifyContent:"center",opacity:s?t?1:.6:.35,transition:"all 0.15s ease",fontSize:18},onMouseEnter:r=>{s&&(r.currentTarget.style.opacity="1")},onMouseLeave:r=>{s&&(t||(r.currentTarget.style.opacity="0.6"))},children:t?"✕":"🔍"})}const ZL=Object.freeze(Object.defineProperty({__proto__:null,DebugModeButton:Zv},Symbol.toStringTag,{value:"Module"}));function V4(){const[t,n]=l.useState(null),s=l.useCallback(async(a,o)=>{try{const i=await fetch("/api/open-in-editor",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:a,line:o})}),c=await i.json().catch(()=>({}));if(!i.ok||(c==null?void 0:c.success)!==!0){n({message:(c==null?void 0:c.error)??`HTTP ${i.status}`,command:(c==null?void 0:c.command)??null});return}n(null)}catch(i){n({message:i instanceof Error?i.message:String(i),command:null})}},[]),r=l.useCallback(()=>n(null),[]);return{openInEditor:s,lastError:t,clearError:r}}function ej({tag:t,id:n,className:s,text:r,detectionMethod:a,previewUrl:o}){return e.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0",children:[e.jsx("div",{className:"rounded overflow-hidden flex-1",style:{background:"var(--bg-deep)",border:"1px solid var(--border-default)",minHeight:200,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{color:"var(--text-secondary)",fontSize:12},children:[e.jsxs("div",{className:"text-center",style:{color:"var(--text-secondary)"},children:["Preview: ",o.split("/").pop()]}),e.jsxs("div",{className:"mt-2 p-3 rounded",style:{background:"var(--bg-surface)",border:"1px dashed var(--border-default)",fontSize:11,fontFamily:"monospace"},children:["<",t,n?` id="${n}"`:"",s?` class="${s.slice(0,40)}"`:"",">",e.jsx("br",{}),r.slice(0,60),r.length>60?"...":""]})]})}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-secondary)"},children:["Detected via: ",a]})]})}const e9=Object.freeze(Object.defineProperty({__proto__:null,DebugModalElementPreview:ej},Symbol.toStringTag,{value:"Module"}));function tj({ancestors:t,onOpenInEditor:n}){return t.length===0?e.jsx("div",{style:{color:"var(--text-secondary)",fontSize:12,fontStyle:"italic"},children:"No component ancestry available."}):e.jsx("ul",{className:"flex flex-col gap-1",style:{listStyle:"none",padding:0,margin:0},children:t.map((s,r)=>{const a=s.sourceFile&&s.lineNumber?`${s.sourceFile}:${s.lineNumber}`:s.sourceFile??"(unknown source)",o=!!s.sourceFile;return e.jsxs("li",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{background:"var(--bg-deep)"},children:[e.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontSize:12},children:s.componentName??"<anonymous>"}),e.jsx("span",{style:{color:"var(--text-secondary)",fontFamily:"monospace",fontSize:11,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),o&&e.jsx("button",{onClick:()=>n(s.sourceFile,s.lineNumber),className:"px-2 py-0.5 rounded text-xs",style:{background:"transparent",border:"1px solid var(--border-default)",color:"var(--accent-blue)",cursor:"pointer",fontSize:11},children:"Open in editor"})]},`${s.componentName??"anon"}-${r}`)})})}const t9=Object.freeze(Object.defineProperty({__proto__:null,DebugAncestryList:tj},Symbol.toStringTag,{value:"Module"}));function nj({ancestors:t,onOpenInEditor:n}){const[s,r]=l.useState(t.length>1);return t.length===0?null:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("button",{onClick:()=>r(a=>!a),className:"text-left",style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,cursor:"pointer",padding:0},children:[s?"▾":"▸"," Component ancestry (",t.length,")"]}),s&&e.jsx(tj,{ancestors:t,onOpenInEditor:n})]})}const n9=Object.freeze(Object.defineProperty({__proto__:null,DebugAncestrySection:nj},Symbol.toStringTag,{value:"Module"}));function sj({propsNames:t}){if(t.length===0)return null;const n=()=>{var s;(s=navigator.clipboard)==null||s.writeText(t.join(", "))};return e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontSize:12},children:"props:"}),t.map(s=>e.jsx("span",{onClick:n,className:"px-1.5 py-0.5 rounded",style:{background:"var(--bg-deep)",color:"var(--text-primary)",fontFamily:"monospace",fontSize:11,cursor:"pointer"},title:"Click to copy prop names",children:s},s))]})}const s9=Object.freeze(Object.defineProperty({__proto__:null,DebugPropsChips:sj},Symbol.toStringTag,{value:"Module"}));function rj({componentDisplay:t,sourceDisplay:n,tag:s,id:r,boundingBox:a,feedback:o,onFeedbackChange:i,creating:c,hasComponentName:d,ancestors:u,propsNames:h,onOpenInEditor:p,onGoToIsolated:f,onCreatePlan:m,onClose:g}){const b=c||!o.trim();return e.jsxs("div",{className:"flex-1 flex flex-col gap-3 min-w-0",children:[e.jsx("h3",{style:{color:"var(--text-primary)",fontSize:16,fontWeight:600,margin:0},children:t}),n&&e.jsx("div",{className:"px-2 py-1 rounded",style:{background:"var(--bg-deep)",fontSize:12,fontFamily:"monospace",color:"var(--accent-blue)"},children:n}),e.jsxs("div",{className:"flex flex-col gap-1",style:{color:"var(--text-secondary)",fontSize:12},children:[e.jsxs("div",{children:["Element: <",s,">",r?` #${r}`:""]}),e.jsxs("div",{children:["Position: ",Math.round(a.x),", ",Math.round(a.y)," (",Math.round(a.width),"x",Math.round(a.height),")"]})]}),e.jsx(sj,{propsNames:h}),e.jsx(nj,{ancestors:u,onOpenInEditor:p}),e.jsx("textarea",{value:o,onChange:x=>i(x.target.value),placeholder:"Describe the issue or desired change...",className:"flex-1 p-2 rounded resize-none",style:{background:"var(--bg-deep)",border:"1px solid var(--border-default)",color:"var(--text-primary)",fontSize:13,minHeight:80,outline:"none"}}),e.jsxs("div",{className:"flex gap-2",children:[d&&e.jsx("button",{onClick:f,className:"px-3 py-1.5 rounded text-sm",style:{background:"var(--bg-deep)",border:"1px solid var(--border-default)",color:"var(--text-primary)",cursor:"pointer"},children:"Go to Isolated Component"}),e.jsx("button",{onClick:m,disabled:b,className:"px-3 py-1.5 rounded text-sm flex-1",style:{background:b?"var(--bg-deep)":"var(--accent-blue)",border:"none",color:b?"var(--text-secondary)":"#000",cursor:b?"not-allowed":"pointer",fontWeight:600},children:c?"Creating...":"Create Fix Plan"}),e.jsx("button",{onClick:g,className:"px-3 py-1.5 rounded text-sm",style:{background:"transparent",border:"1px solid var(--border-default)",color:"var(--text-secondary)",cursor:"pointer"},children:"Cancel"})]})]})}const r9=Object.freeze(Object.defineProperty({__proto__:null,DebugModalInfoPanel:rj},Symbol.toStringTag,{value:"Module"}));function aj({error:t,onDismiss:n}){return e.jsxs("div",{onClick:s=>s.stopPropagation(),className:"fixed bottom-4 left-1/2 px-3 py-2 rounded",style:{transform:"translateX(-50%)",background:"var(--bg-surface)",border:"1px solid var(--accent-red, #f85149)",color:"var(--text-primary)",fontSize:12,zIndex:60,maxWidth:520},children:[e.jsxs("div",{children:["Open in editor failed: ",t.message]}),t.command&&e.jsx("div",{style:{fontFamily:"monospace",fontSize:11,marginTop:4},children:t.command}),e.jsx("button",{onClick:n,className:"mt-1",style:{background:"transparent",border:"none",color:"var(--accent-blue)",cursor:"pointer",fontSize:11,padding:0},children:"Dismiss"})]})}const a9=Object.freeze(Object.defineProperty({__proto__:null,OpenInEditorErrorToast:aj},Symbol.toStringTag,{value:"Module"}));function oj({element:t,previewUrl:n,onClose:s,onGoToIsolated:r,onCreatePlan:a}){const[o,i]=l.useState(""),[c,d]=l.useState(!1),{openInEditor:u,lastError:h,clearError:p}=V4(),f=async()=>{d(!0);try{await a(o,t)}finally{d(!1)}},m=t.componentName??`<${t.element.tag}>`,g=t.sourceFile?`${t.sourceFile}${t.lineNumber?`:${t.lineNumber}`:""}`:null;return e.jsxs("div",{className:"absolute inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.7)"},onClick:s,children:[e.jsxs("div",{className:"flex gap-4 p-6 rounded-lg max-w-3xl w-full mx-4",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",maxHeight:"80vh"},onClick:b=>b.stopPropagation(),children:[e.jsx(ej,{tag:t.element.tag,id:t.element.id,className:t.element.className,text:t.element.text,detectionMethod:t.detectionMethod,previewUrl:n}),e.jsx(rj,{componentDisplay:m,sourceDisplay:g,tag:t.element.tag,id:t.element.id,boundingBox:t.element.boundingBox,feedback:o,onFeedbackChange:i,creating:c,hasComponentName:!!t.componentName,ancestors:t.ancestors,propsNames:t.propsNames,onOpenInEditor:u,onGoToIsolated:()=>r(t.componentName),onCreatePlan:f,onClose:s})]}),h&&e.jsx(aj,{error:h,onDismiss:p})]})}const o9=Object.freeze(Object.defineProperty({__proto__:null,DebugModal:oj},Symbol.toStringTag,{value:"Module"}));function ij(){return e.jsx("div",{className:"absolute z-40 px-2 py-1 rounded",style:{bottom:8,right:8,background:"var(--bg-surface)",border:"1px solid var(--accent-blue)",color:"var(--accent-blue)",fontSize:11,fontWeight:600,pointerEvents:"none",fontFamily:"system-ui"},"data-testid":"debug-freeze-pill",children:"Debug — frozen"})}const i9=Object.freeze(Object.defineProperty({__proto__:null,DebugFreezePill:ij},Symbol.toStringTag,{value:"Module"}));function lj({hoveredElement:t}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute inset-0 z-40",style:{border:"3px solid var(--accent-blue)",cursor:"crosshair",pointerEvents:"none"}}),t&&e.jsx("div",{className:"absolute z-40 px-2 py-1 rounded",style:{top:8,left:8,background:"var(--accent-blue)",color:"#000",fontSize:12,fontWeight:600,pointerEvents:"none"},children:t.componentName??`<${t.element.tag}>`}),e.jsx(ij,{})]})}const l9=Object.freeze(Object.defineProperty({__proto__:null,DebugOverlay:lj},Symbol.toStringTag,{value:"Module"}));function cj(){return e.jsx("div",{className:"absolute z-40 pointer-events-none",style:{top:0,left:0,right:0,bottom:0,border:"2px solid var(--accent-blue, #D7FF63)",borderRadius:4,boxSizing:"border-box"},children:e.jsx("div",{style:{position:"absolute",top:0,left:16,padding:"2px 8px",background:"var(--accent-blue, #D7FF63)",color:"#000",fontSize:10,fontWeight:700,fontFamily:"system-ui, -apple-system, sans-serif",borderRadius:"0 0 4px 4px",letterSpacing:.5},children:"INSPECT MODE"})})}const c9=Object.freeze(Object.defineProperty({__proto__:null,InspectModeRibbon:cj},Symbol.toStringTag,{value:"Module"}));function K4(t,n,s){const{width:r,maxHeight:a,gap:o}=s,i=t.y+t.height+o,c=i+a>n.height,d=c?Math.max(o,t.y-a-o):i,u=Math.max(o,Math.min(t.x,n.width-r-o));return{top:d,left:u,placedAbove:c}}function dj({onDismiss:t}){return e.jsx("div",{onClick:t,style:{position:"fixed",inset:0,zIndex:999998,background:"transparent"}})}const d9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCardBackdrop:dj},Symbol.toStringTag,{value:"Module"}));function uj({match:t,onOpen:n}){return e.jsxs("button",{onClick:()=>n(t),style:{width:"100%",textAlign:"left",padding:"6px 8px",background:"rgba(88, 166, 255, 0.12)",color:"inherit",border:"1px solid rgba(88, 166, 255, 0.4)",borderRadius:4,cursor:"pointer",fontFamily:"monospace",fontSize:11},children:[e.jsx("div",{style:{fontWeight:600},children:t.endpoint}),e.jsx("div",{style:{opacity:.85},children:t.jsonPath})]})}const u9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCardMatchButton:uj},Symbol.toStringTag,{value:"Module"}));function hj({matches:t,onOpen:n}){return e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:6},children:t.map((s,r)=>e.jsx("li",{children:e.jsx(uj,{match:s,onOpen:n})},`${s.endpoint}${s.jsonPath}${r}`))})}const h9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCardMatchList:hj},Symbol.toStringTag,{value:"Module"}));function pj({clickedText:t,matches:n,corpusEmpty:s,onOpenInPanel:r}){return e.jsxs("div",{style:{padding:"8px 12px"},children:[e.jsxs("div",{style:{opacity:.7,marginBottom:6,wordBreak:"break-all"},children:["Clicked: ",e.jsx("code",{children:mj(t,120)||"(empty)"})]}),s?e.jsx("div",{style:{opacity:.85},children:"No mocks were consumed on this page load yet."}):n.length===0?e.jsx("div",{style:{opacity:.85},children:"No direct mock value matches — this value may be computed or concatenated."}):e.jsx(hj,{matches:n,onOpen:r})]})}function mj(t,n){return t.length<=n?t:t.slice(0,n-1)+"…"}const p9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCardBody:pj,truncate:mj},Symbol.toStringTag,{value:"Module"}));function fj({onDismiss:t}){return e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--border-muted, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontWeight:600},children:"Data source"}),e.jsx("button",{onClick:t,"aria-label":"Dismiss",style:{background:"transparent",color:"inherit",border:"none",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}const m9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCardHeader:fj},Symbol.toStringTag,{value:"Module"})),rd=320,ad=320,J4=8;function gj({clickedText:t,matches:n,anchor:s,onOpenInPanel:r,onDismiss:a,corpusEmpty:o}){l.useEffect(()=>{function h(p){p.key==="Escape"&&a()}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[a]);const i=typeof window<"u"?window.innerHeight:800,c=typeof window<"u"?window.innerWidth:1200,{top:d,left:u}=K4(s,{width:c,height:i},{width:rd,maxHeight:ad,gap:J4});return e.jsxs(e.Fragment,{children:[e.jsx(dj,{onDismiss:a}),e.jsxs("div",{style:{position:"fixed",top:d,left:u,width:rd,maxHeight:ad,zIndex:999999,background:"var(--bg-surface, #1f2937)",color:"var(--text-primary, #f3f4f6)",border:"1px solid var(--border-muted, #374151)",borderRadius:8,boxShadow:"0 10px 30px rgba(0,0,0,0.5)",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:12,overflow:"auto"},role:"dialog","aria-label":"Mock data source inspector",children:[e.jsx(fj,{onDismiss:a}),e.jsx(pj,{clickedText:t,matches:n,corpusEmpty:o,onOpenInPanel:r})]})]})}const f9=Object.freeze(Object.defineProperty({__proto__:null,InspectResultCard:gj},Symbol.toStringTag,{value:"Module"}));function bj({healthy:t,reason:n,authNeeded:s}){const r=s?"auth-needed":t===!0?"healthy":t===!1?"unhealthy":"unknown",o={healthy:{bg:"#1f3a24",border:"#2f6b3a",dot:"#4ade80",label:"Live"},unhealthy:{bg:"#3a1f1f",border:"#6b2f2f",dot:"#f87171",label:"Stale"},unknown:{bg:"#2a2a2a",border:"#444",dot:"#9ca3af",label:"—"},"auth-needed":{bg:"#3a2f1f",border:"#6b552f",dot:"#fbbf24",label:"Sign in"}}[r];return e.jsxs("div",{role:"status","aria-label":`Live preview iframe: ${r}`,title:r==="auth-needed"?"Live Preview runs on a separate secured host that needs sign-in. Open it top-level to sign in, then reload.":r==="healthy"?"Live Preview iframe is healthy and matches the running dev server.":r==="unhealthy"?n?`Live Preview iframe is stale: ${n}`:"Live Preview iframe is stale and out of sync with the dev server.":"Live Preview iframe health unknown.",style:{position:"absolute",top:8,right:8,display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:999,backgroundColor:o.bg,border:`1px solid ${o.border}`,color:"#fff",fontSize:11,fontFamily:"monospace",zIndex:30,pointerEvents:"auto"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:o.dot,boxShadow:r==="healthy"?`0 0 6px ${o.dot}`:void 0}}),e.jsx("span",{children:o.label})]})}const g9=Object.freeze(Object.defineProperty({__proto__:null,LiveIframeHealthPill:bj},Symbol.toStringTag,{value:"Module"})),X4=new Set(["localhost","127.0.0.1","[::1]","::1"]);function od(t){if(!t)return!1;try{return!X4.has(new URL(t).hostname)}catch{return!1}}function xj(t,n,s){if(t===!1)return"local";const r=typeof window<"u"?window.location.origin:null;return od(n)||od(r)?"hosted":"tunnel"}function Q4(t,n,s,r){return/^https?:\/\//i.test(s??"")?!0:xj(t,n)==="local"}function yj(t,n){switch(t){case"local":return{heading:`Nothing is answering on port ${n}`,ariaLabel:"Preview port not answering",showForwardFlag:!1};case"hosted":return{heading:"This preview needs a dedicated preview host",ariaLabel:"Preview host not provisioned",showForwardFlag:!1};case"tunnel":return{heading:`Forward port ${n} to see the Live Preview`,ariaLabel:"Preview port forward required",showForwardFlag:!0}}}function vj({hint:t,onRecheck:n}){const{inContainer:s,reachableUrl:r}=zo(),a=xj(s,r),{heading:o,showForwardFlag:i}=yj(a,t.port),{phase:c,attempts:d,retry:u}=xd(n),h=a==="local"?`This app does its own page routing, so its preview is served on its own address — port ${t.port} on this machine. The editor is running here too, so that address is already the right one. Nothing is answering on it.`:a==="hosted"?`This app does its own page routing, so its preview is served on its own address — port ${t.port}. But that address points at YOUR machine, not the one running the app. You reach this editor over a hosted address rather than a port forward, so there is no forward that could resolve it.`:`This app does its own page routing, so its preview is served on its own address — port ${t.port}. Your connection to this machine only carries the editor's port, so your browser can't reach that one.`,p=a==="local"?"Start your app's server, then reload the preview.":a==="hosted"?"This one isn't yours to fix from here — a dedicated preview host has to be provisioned for this machine, alongside the editor's own address. Copy this report and send it to whoever set the machine up.":`Add ${t.flag} to the connection you use to reach this machine, then reload the preview. Copy this report to get the flag with its context.`;return e.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center p-8",style:{background:"var(--bg-surface)"},children:e.jsx(kr,{severity:"blocked",testId:"preview-forward-port-notice",headline:o,explanation:h,nextAction:p,diagnostics:i?t.flag:void 0,actions:[{label:i?"I've added it — reload preview":"Reload preview",onClick:u,pending:c==="pending",pendingLabel:"Rechecking…",testId:"preview-forward-port-notice-recheck"}],actionFeedback:c==="unchanged"?e.jsxs("span",{"data-testid":"preview-forward-port-notice-unchanged",children:["Checked just now — port ",t.port," still isn’t reachable",d>1?` (${d} tries)`:"","."]}):null})})}const b9=Object.freeze(Object.defineProperty({__proto__:null,PreviewForwardPortNotice:vj,forwardPortNoticeCopy:yj},Symbol.toStringTag,{value:"Module"}));function jj(t){if(!t)return null;let n;try{n=new URL(t)}catch{return null}if(!(n.hostname==="localhost"||n.hostname==="127.0.0.1"||n.hostname==="[::1]"||n.hostname==="::1"))return null;const r=Number(n.port);return!Number.isInteger(r)||r<=0||r>65535?null:{port:r,flag:`-L ${r}:localhost:${r}`}}function id(t,n){return(n==null?void 0:n.previewOrigin)??(t==null?void 0:t.previewOrigin)??null}function wj(t,n){if(!t||!/^https?:\/\//i.test(t))return!0;const s=typeof window<"u"?window.location.origin:null;if(!s)return!1;try{return new URL(t).origin===s}catch{return!0}}async function Z4(t,n){if(wj(t))return"unknown";const s=t;try{await fetch(s,{credentials:"include",mode:"no-cors",redirect:"follow"})}catch{return jj(s)?"unreachable":"unknown"}try{return(await fetch(s,{credentials:"include",mode:"cors",redirect:"manual"})).type==="opaqueredirect"?"needs-signin":"authed"}catch{return"unknown"}}function eT(t,n){const[s,r]=l.useState("unknown"),[a,o]=l.useState(0),[i,c]=l.useState("idle"),[d,u]=l.useState(0),h=l.useCallback(async()=>{const f=await Z4(t);r(m=>(m==="needs-signin"&&f==="authed"&&o(g=>g+1),f)),f!=="unknown"&&!wt()&&t3(f==="needs-signin"?t??null:null)},[t]);l.useEffect(()=>{h()},[h,n]);const p=l.useCallback(()=>{c("pending"),u(f=>f+1),h().finally(()=>c("unchanged"))},[h]);return{authState:s,recheck:p,remountNonce:a,recheckPhase:i,recheckAttempts:d}}function ld(t){if(!t||typeof t!="object")return null;const n=t;return{componentName:n.componentName??null,sourceFile:n.sourceFile??null,lineNumber:n.lineNumber??null,detectionMethod:n.detectionMethod??"dom-heuristics",ancestors:Array.isArray(n.ancestors)?n.ancestors:[],propsNames:Array.isArray(n.propsNames)?n.propsNames:[],element:n.element}}function tT(t){const[n,s]=l.useState(!1),[r,a]=l.useState(null),[o,i]=l.useState(null),c=l.useRef(!1),d=l.useCallback(f=>{const m=t.current;m!=null&&m.contentWindow&&m.contentWindow.postMessage({type:f},"*")},[t]),u=l.useCallback(()=>{s(!0),a(null),i(null),d("codeyam:debug:activate")},[d]),h=l.useCallback(()=>{s(!1),a(null),i(null),d("codeyam:debug:deactivate")},[d]),p=l.useCallback(()=>{i(null)},[]);return l.useEffect(()=>{function f(m){!m.data||typeof m.data.type!="string"||(m.data.type==="codeyam:debug:hover"?a(ld(m.data.payload)):m.data.type==="codeyam:debug:selected"&&i(ld(m.data.payload)))}return window.addEventListener("message",f),()=>window.removeEventListener("message",f)},[]),l.useEffect(()=>{c.current&&!n&&(c.current=!1),n&&(c.current=!0)},[n]),{isActive:n,hoveredElement:r,selectedElement:o,activate:u,deactivate:h,clearSelection:p}}const nT=/^\/api\/mock-panel(\/.*)?$/;function sT(t,n){return t.toUpperCase()!=="GET"?!1:nT.test(n)}function rT(t){return Array.isArray(t)?t.filter(n=>n.consumedThisPageLoad&&!sT(n.method,n.pathPattern)).map(n=>({endpoint:`${n.method} ${n.pathPattern}`,body:n.body})):[]}async function aT(t,n,s){return(await fetch("/api/debug/create-plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedback:t,componentName:n.componentName,sourceFile:n.sourceFile,lineNumber:n.lineNumber,detectionMethod:n.detectionMethod,element:n.element,previewUrl:s})})).json()}const oT=12;function iT(t,n,s){if(n.length===0)return[];const r=[];return _o(t,n,s,"$",0,new Set,r),r}function lT(t,n){const s=[];for(const o of t)for(const i of iT(o.body,n,o.endpoint))s.push(i);const r=new Set,a=[];for(const o of s){const i=`${o.endpoint}\0${o.jsonPath}`;r.has(i)||(r.add(i),a.push(o))}return a.sort((o,i)=>{const c=i.matchedValue.length-o.matchedValue.length;return c!==0?c:i.pathDepth-o.pathDepth}),a}function _o(t,n,s,r,a,o,i){if(t==null)return;const c=typeof t;if(c==="string"||c==="number"||c==="boolean"){String(t)===n&&i.push({endpoint:s,jsonPath:r,matchedValue:String(t),pathDepth:a});return}if(!(a>=oT)&&!o.has(t)){if(o.add(t),Array.isArray(t))for(let d=0;d<t.length;d++)_o(t[d],n,s,`${r}[${d}]`,a+1,o,i);else if(c==="object")for(const[d,u]of Object.entries(t))_o(u,n,s,`${r}.${d}`,a+1,o,i);o.delete(t)}}const cT={backgroundColor:"#1e1e1e",backgroundImage:"conic-gradient(#262626 25%, #1e1e1e 0 50%, #262626 0 75%, #1e1e1e 0)",backgroundSize:"16px 16px"};function _j({providerLabel:t,buildingScenarioName:n,buildingScenarioSlug:s,buildingScenarioDescription:r,buildingScreenshotPath:a,containerHeight:o,containerRef:i,containerWidth:c,currentHeight:d,currentWidth:u,emptyStateMessage:h,isFilled:p,onDismissBuildingOverlay:f,historicalScreenshotPath:m,historicalScenarioName:g,historicalHeading:b,historicalSubtext:x,onDismissHistoricalPreview:y,previewSlug:v,previewUrl:w,previewOrigin:j,scale:_,commandNonce:k}){var Ge,Wt;const S=!!g&&!s,N=!!s||S,T=l.useRef(null),A=i??T,M=l.useRef(null),{status:C,restart:H}=Zw();r4(C,H);const{isRestarting:J,isFailed:Z,isStarting:F,isStopped:$}=C4(C),{stepState:P}=Ts(),I=E4((P==null?void 0:P.step)??null,(P==null?void 0:P.mode)??"ui"),B=(C==null?void 0:C.liveIframeHealthy)!==void 0,{reloadNonce:X,handleIframeLoad:W,handleIframeError:ie}=i4((C==null?void 0:C.pid)??null,B,C==null?void 0:C.status),Q=(C==null?void 0:C.status)==="failed",{healthy:O,failedProbeCount:L,reloadNonce:q,invalidate:le}=p4(w,Q),de=o4(C==null?void 0:C.liveIframeHealthy,750),ee=y4(O,de),[D,z]=l.useState(0);l.useEffect(()=>e_(()=>{z(Le=>Le+1)}),[]),j4(C==null?void 0:C.sourceVersion,C==null?void 0:C.liveReloadEnabled);const{authState:K,recheck:ue,remountNonce:ye}=eT(j,w),je=l.useMemo(()=>jj(j),[j]),V=v4({pidNonce:X,probeNonce:q+ee,draftNonce:D+ye}),te=V.gatedNonce,{errors:oe,clear:he}=_4(M,te),{escaped:G,overlayErrors:ne,noteFrameLoad:re,clearEscape:U}=s4({previewUrl:w,resetKey:te,capturedErrors:oe}),we=N4(w,te),_e=l.useCallback(()=>{V.reset(),he(),U(),le()},[V,he,U,le]),Se=l.useCallback(()=>{he(),U()},[he,U]),dt=l.useCallback(()=>Do(),[]),Ye=(C==null?void 0:C.devServerStartedSecsAgo)??null,ft=Ye!==null&&Ye<P4,Ae=!!(C!=null&&C.startCommand),gt=g4({liveIframeHealthy:de,previewReachable:(Ge=C==null?void 0:C.previewProbe)==null?void 0:Ge.reachable}),[ut,on]=l.useState(!1);l.useEffect(()=>{gt&&!ut&&on(!0)},[gt,ut]);const St=gt||ut,qe=b4({hasDevServerConfigured:Ae,hasServed:St}),Nt=qe?w:"about:blank",Ct=Ev(Nt,te,k),[ln,it]=l.useState(null),cn=qe&&ln!==Ct,ve=T4({hasDevServerConfigured:Ae,probeHealthy:O,backendRunning:(C==null?void 0:C.status)==="running",backendIframeHealthy:de,isStarting:F,isRestarting:J,isFailed:Z,isStopped:$,isPrePrototype:I,withinStartupGrace:ft,previewReachable:((Wt=C==null?void 0:C.previewProbe)==null?void 0:Wt.reachable)===!0,hasEverServed:St}),Pe=l.useRef(void 0);l.useEffect(()=>{var Gt;if(Pe.current===ve)return;const Le=Pe.current;Pe.current=ve,console.debug(`[preview-overlay] ${Le===void 0?"(init)":Le??"none"} → ${ve??"none"}`,{status:C==null?void 0:C.status,intendedRunning:C==null?void 0:C.intendedRunning,restartCount:C==null?void 0:C.restartCount,pid:C==null?void 0:C.pid,liveIframeHealthy:C==null?void 0:C.liveIframeHealthy,previewProbeReachable:(Gt=C==null?void 0:C.previewProbe)==null?void 0:Gt.reachable,devServerStartedSecsAgo:Ye,withinStartupGrace:ft,probeHealthy:O,isStarting:F,isRestarting:J,isFailed:Z,isStopped:$})},[ve,C,Ye,ft,O,F,J,Z,$]);const Te=C==null?void 0:C.portDiagnostic,Ce=(Te==null?void 0:Te.conflict)===!0,Re=ve==="scaffolding"?D4((P==null?void 0:P.step)??null,(P==null?void 0:P.mode)??"ui").body:void 0,E=m4({active:ve==="reconnecting",trigger:L}),Ke=ve==="reconnecting"?f4(E):null,ht=Re??Ke??void 0,Oe=L>=10,{isActive:Je,hoveredElement:He,selectedElement:De,activate:bt,deactivate:Xe,clearSelection:Ne}=tT(M),pt=l.useCallback(()=>{Je?Xe():bt()},[Je,bt,Xe]),{entries:We}=t_(v??null),{isActive:Pt,toggle:Pn}=a4({activate:bt,deactivate:Xe,clearSelection:Ne},X);l.useEffect(()=>(ql({isActive:Pt,previewSlug:v??null}),()=>{ql({isActive:!1,previewSlug:null})}),[Pt,v]),l.useEffect(()=>n_(()=>{Pn()}),[Pn]);const dn=Pt&&De?De.element.text.trim():"",Tn=l.useMemo(()=>rT(We),[We]),As=l.useMemo(()=>!Pt||!dn?[]:lT(Tn,dn),[Pt,dn,Tn]),Rs=l.useCallback(async Le=>{Ne(),Xe();try{const On=await(await fetch("/api/scenarios")).json(),An=Array.isArray(On)?On.find(Xn=>Xn.componentName===Le):null;if(An!=null&&An.slug){const Xn=al(window.location),ta=Wx(An.slug,Xn,null,0,j);window.history.pushState(null,"",ta);return}}catch{}window.history.pushState(null,"","/entities")},[Ne,Xe,j]),Es=l.useCallback(async(Le,Gt)=>{try{await aT(Le,Gt,w),Ne(),Xe()}catch(On){console.error("Failed to create debug plan:",On)}},[w,Ne,Xe]);return e.jsx("div",{ref:A,className:`relative flex-1 flex overflow-hidden ${p?"":"items-center justify-center p-8"}`,style:p?{backgroundColor:"#fff"}:cT,children:w?e.jsxs(e.Fragment,{children:[e.jsx(Iv,{ref:M,currentHeight:d,currentWidth:u,isFilled:p,previewUrl:Nt,scale:_,iframeKey:Ct,onLoad:()=>{if(qe){const Le=re(M.current);W(Le??w),it(Ct)}},onError:ie}),!qe&&e.jsx(Rv,{hasDevServerConfigured:Ae}),cn&&e.jsx(Dv,{}),!p&&e.jsx(Gv,{previewUrl:w,description:r}),!p&&e.jsx(bj,{healthy:de,reason:(C==null?void 0:C.iframeLastError)??null,authNeeded:K==="needs-signin"}),K==="needs-signin"&&j&&e.jsx(Ah,{previewOrigin:j,onRecheck:ue}),K==="unreachable"&&je&&e.jsx(vj,{hint:je,onRecheck:ue}),Je&&e.jsx(lj,{hoveredElement:He}),Pt&&e.jsx(cj,{}),De&&!Pt&&e.jsx(oj,{element:De,previewUrl:w,onClose:Ne,onGoToIsolated:Rs,onCreatePlan:Es}),De&&Pt&&e.jsx(gj,{clickedText:dn,matches:As,anchor:De.element.boundingBox,corpusEmpty:Tn.length===0,onOpenInPanel:Le=>{s_({routeKey:Le.endpoint,jsonPath:Le.jsonPath}),Ne()},onDismiss:Ne}),!N&&e.jsx(Zv,{isActive:Je,onToggle:pt,interactionAvailable:wj(j)}),Q?e.jsx(Xv,{lastError:(C==null?void 0:C.lastError)??(C==null?void 0:C.lastExit)??"(no error message captured)",failureCount:(C==null?void 0:C.failureCount)??0,failedAtMs:C==null?void 0:C.failedAtMs,holder:C==null?void 0:C.holder,onRetry:H,onReap:async()=>{await fetch("/api/editor-dev-server/reap",{method:"POST",headers:{"Content-Type":"application/json"}})}}):Ce&&Te?e.jsx(Qv,{diagnostic:Te,onRetry:H}):ve&&(ve==="crashed"?e.jsx(Jv,{logs:(C==null?void 0:C.logs)??[],providerLabel:t}):e.jsx(Fv,{variant:ve,restartCount:(C==null?void 0:C.restartCount)??0,showRetry:Oe,onRetry:ve==="disconnected"?dt:le,bodyOverride:ht})),e.jsx(Wv,{tripped:V.tripped||G,errors:ne,recentReloads:V.recentReloads,serverHealthy:O4(C),onRetry:_e,onClear:Se,providerLabel:t}),we.clickThroughBroken&&we.status!==null&&e.jsx(Lv,{url:w,status:we.status,logLines:we.logLines,onRetry:_e}),s&&f&&e.jsx(wo,{containerHeight:o,containerWidth:c,onDismiss:f,scenarioName:n??null,screenshotPath:a??null,viewportHeight:d,viewportWidth:u}),S&&y&&e.jsx(wo,{containerHeight:o,containerWidth:c,heading:b??void 0,subtext:x??void 0,onDismiss:y,scenarioName:g??null,screenshotPath:m??null,viewportHeight:d,viewportWidth:u})]}):e.jsx(Av,{message:h})})}const x9=Object.freeze(Object.defineProperty({__proto__:null,PreviewCanvas:_j},Symbol.toStringTag,{value:"Module"}));function kj({prompt:t}){const[n,s]=l.useState(!0);return e.jsxs("section",{"aria-label":"What you asked for",style:{border:"1px solid var(--border-subtle)",borderRadius:"8px",padding:"0.875rem 1rem",marginBottom:"1.5rem",background:"var(--bg-elevated)",fontFamily:"'IBM Plex Mono', monospace"},children:[e.jsxs("button",{type:"button",onClick:()=>s(r=>!r),"aria-expanded":n,style:{width:"100%",background:"transparent",border:"none",padding:0,margin:0,color:"var(--text-muted)",fontSize:"0.75rem",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:"inherit"},children:[e.jsx("span",{children:"What you asked for"}),e.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",transition:"transform 150ms ease",transform:n?"rotate(0deg)":"rotate(-90deg)",color:"var(--text-muted)",fontSize:"0.75rem"},children:"▾"})]}),n?e.jsx("div",{style:{marginTop:"0.625rem",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",color:"var(--text-secondary)",fontSize:"0.8125rem",lineHeight:1.55},children:e.jsx(Ht,{children:t})}):null]})}const y9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupDescriptionCard:kj},Symbol.toStringTag,{value:"Module"}));function Sj({html:t,viewport:n}){return e.jsxs("div",{children:[e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.625rem"},children:"Your chosen design"}),e.jsx("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:"6px",overflow:"hidden"},children:e.jsx(hl,{html:t,url:"",title:"Chosen design",viewport:n,theme:"light",darkVars:null})})]})}const v9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupChosenMockup:Sj},Symbol.toStringTag,{value:"Module"}));function Nj({assets:t}){return e.jsxs("div",{children:[e.jsx("div",{style:{color:"var(--text-muted)",fontSize:"0.75rem",fontWeight:500,marginBottom:"0.625rem"},children:"Design assets you added"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",fontFamily:"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"},children:t.map(n=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",padding:"0.5rem 0.625rem",border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-input)"},children:[e.jsx("span",{style:{fontSize:"0.8125rem",fontWeight:500,color:"var(--text-primary)"},children:n.filename}),n.description.trim().length>0&&e.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:n.description})]},n.filename))})]})}const j9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupDesignAssetList:Nj},Symbol.toStringTag,{value:"Module"}));function Cj({mockupHtml:t,mockupViewport:n,assets:s}){const r=t!==null,a=s.length>0;return!r&&!a?null:e.jsxs("section",{"aria-label":"Your chosen design",style:{border:"1px solid var(--border-subtle)",borderRadius:"8px",padding:"0.875rem 1rem",marginBottom:"1.5rem",background:"var(--bg-elevated)",fontFamily:"'IBM Plex Mono', monospace"},children:[r&&e.jsx("div",{style:{marginBottom:a?"1rem":0},children:e.jsx(Sj,{html:t,viewport:n})}),a&&e.jsx(Nj,{assets:s})]})}const w9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupDesignCard:Cj},Symbol.toStringTag,{value:"Module"}));function Pj(){return e.jsxs("header",{style:{marginBottom:"1.5rem",fontFamily:"'IBM Plex Mono', monospace"},children:[e.jsxs("h1",{style:{fontSize:"1.125rem",fontWeight:600,color:"var(--text-primary)",margin:"0 0 0.5rem 0",display:"flex",alignItems:"baseline",gap:"0.5rem"},children:[e.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-muted)",letterSpacing:"-0.1em"},children:"::"}),"Setting up your project…"]}),e.jsx("p",{style:{margin:0,color:"var(--text-muted)",fontSize:"0.8125rem"},children:"This usually takes a few minutes."})]})}const _9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupHeader:Pj},Symbol.toStringTag,{value:"Module"}));function dT(t,n){if(t.phaseSteps.length===0)return"pending";const s=t.phaseSteps[0],r=t.phaseSteps[t.phaseSteps.length-1];return n>r?"complete":n>=s?"active":"pending"}const ko="#D7FF63",uT="var(--text-muted)";function Tj({status:t}){return t==="complete"?e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",style:{flexShrink:0,display:"block"},children:[e.jsx("circle",{cx:"9",cy:"9",r:"7.5",fill:"none",stroke:"#FFFFFF",strokeWidth:"1.5"}),e.jsx("path",{d:"M5.5 9.2 L8 11.5 L12.5 6.5",fill:"none",stroke:"#FFFFFF",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):t==="active"?e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",role:"img","aria-label":"In progress",style:{flexShrink:0,display:"block",animation:"codeyam-setup-spin 1.1s linear infinite"},children:[e.jsx("circle",{cx:"9",cy:"9",r:"7.5",fill:"none",stroke:ko,strokeWidth:"1.5",opacity:"0.25"}),e.jsx("path",{d:"M9 1.5 A 7.5 7.5 0 0 1 16.5 9",fill:"none",stroke:ko,strokeWidth:"1.75",strokeLinecap:"round"})]}):e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",style:{flexShrink:0,display:"block"},children:e.jsx("circle",{cx:"9",cy:"9",r:"7.5",fill:"none",stroke:uT,strokeWidth:"1.5"})})}function Oj({phase:t,status:n}){const s=n==="active"?ko:n==="complete"?"var(--text-primary)":"var(--text-muted)";return e.jsxs("li",{"data-phase-id":t.phaseId,"data-phase-status":n,style:{display:"flex",alignItems:"center",gap:"0.625rem"},children:[e.jsx(Tj,{status:n}),e.jsx("span",{style:{color:s,fontSize:"0.8125rem",fontFamily:"'IBM Plex Mono', monospace",fontWeight:n==="active"?600:400,letterSpacing:"0.01em"},children:t.phaseLabel})]})}const k9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupProgressRow:Oj,StatusIndicator:Tj},Symbol.toStringTag,{value:"Module"}));function Aj({currentStep:t,mode:n}){const s=n2(n);return e.jsx("section",{"aria-label":"Progress",style:{marginBottom:"0.5rem"},children:e.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:"0.875rem"},children:s.map(r=>{const a=dT(r,t);return e.jsx(Oj,{phase:r,status:a},r.phaseId)})})})}const S9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupProgressList:Aj},Symbol.toStringTag,{value:"Module"}));function hT(t){let n=t;const s=n.match(/^Feature: [^\n]*\n\nProject context: /);return s?n=n.slice(s[0].length):n.startsWith("Project context: ")&&(n=n.slice(17)),n.endsWith(`
|
|
209
|
+
`)&&(n=n.slice(0,-1)),n}function Rj({prompt:t,currentStep:n,mode:s,mockupHtml:r=null,mockupViewport:a="desktop",assets:o=[]}){return e.jsxs("div",{style:{background:"var(--bg-elevated, #141414)",border:"1px solid var(--border-subtle)",borderRadius:"12px",padding:"1.5rem 1.75rem",maxWidth:"520px"},children:[e.jsx(Pj,{}),e.jsx(kj,{prompt:hT(t)}),e.jsx(Cj,{mockupHtml:r,mockupViewport:a,assets:o}),e.jsx(Aj,{currentStep:n,mode:s})]})}const N9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupPreviewView:Rj},Symbol.toStringTag,{value:"Module"}));function pT(){const[t,n]=l.useState(null),[s,r]=l.useState("desktop"),[a,o]=l.useState([]);return l.useEffect(()=>{let i=!1;async function c(){try{const u=await fetch("/api/editor-design-selection");if(!u.ok)return;const h=await u.json();if(!h||typeof h.filename!="string"||!h.filename)return;const p=await fetch("/api/editor-design-selected-mockup");if(!p.ok)return;const f=await p.text();if(i||!f)return;n(f),r(dl(f)??"desktop")}catch{}}async function d(){try{const u=await fetch("/api/editor-design-assets");if(!u.ok)return;const h=await u.json();!i&&Array.isArray(h.assets)&&o(h.assets)}catch{}}return c(),d(),()=>{i=!0}},[]),{mockupHtml:t,mockupViewport:s,assets:a}}function Ej(){const{prompt:t}=Tv(),{stepState:n}=Ts(),{mockupHtml:s,mockupViewport:r,assets:a}=pT();return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-auto",style:{background:"var(--bg-deep)"},children:e.jsx("div",{style:{padding:"1.5rem 2rem",maxWidth:"880px",width:"100%",margin:"0 auto"},children:e.jsx(Rj,{prompt:t??"",currentStep:(n==null?void 0:n.step)??1,mode:(n==null?void 0:n.mode)??"ui",mockupHtml:s,mockupViewport:r,assets:a})})})}const C9=Object.freeze(Object.defineProperty({__proto__:null,ProjectSetupPreviewPane:Ej},Symbol.toStringTag,{value:"Module"}));function mT(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/setup-terminal`}function fT(t,n,s=1500){if(t<=0)return!1;const r=n-t;return r>=0&&r<=s}function Mj({assistantTyping:t}){return e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-[11px]",style:{background:"var(--bg-card)",color:"var(--text-secondary)",borderBottom:"1px solid var(--border-subtle)"},children:[e.jsx("span",{children:"Shared setup terminal — you and the assistant both drive this shell."}),t&&e.jsx("span",{className:"rounded px-2 py-0.5",style:{background:"rgba(215, 255, 99, 0.15)",color:"#8fae00",border:"1px solid rgba(215, 255, 99, 0.4)"},children:"Assistant is typing…"})]})}const P9=Object.freeze(Object.defineProperty({__proto__:null,SetupTerminalHeader:Mj},Symbol.toStringTag,{value:"Module"})),gT=1200,bT=1e3,xT=["\x1B[90mproject/my-app\x1B[0m $ dig codeyam.com +short","\x1B[36m76.76.21.21\x1B[0m","\x1B[90mproject/my-app\x1B[0m $ \x1B[2m# assistant ran:\x1B[0m vercel --version","\x1B[36mVercel CLI 39.1.3\x1B[0m","\x1B[90mproject/my-app\x1B[0m $ "].join(`\r
|
|
210
|
+
`);function Ij(){const t=wt(),n=l.useRef(null),s=l.useRef(null),r=l.useRef(null),a=l.useRef(null),o=l.useRef(!1),i=l.useRef(!1),c=l.useRef(null),[d,u]=l.useState(!1),[h,p]=Ai(1200);function f(m){const g=a.current;(g==null?void 0:g.readyState)===WebSocket.OPEN&&g.send(new TextEncoder().encode(m))}return Oi(n,()=>{if(r.current&&s.current){r.current.fit();const m=a.current;(m==null?void 0:m.readyState)===WebSocket.OPEN&&m.send(JSON.stringify({type:"resize",cols:s.current.cols,rows:s.current.rows}))}}),l.useEffect(()=>{if(t)return;let m=!1;const g=async()=>{try{const x=await fetch("/api/setup-terminal/activity");if(!x.ok)return;const y=await x.json();if(m)return;u(fT(y.lastInjectMs??0,Date.now()))}catch{}};g();const b=window.setInterval(g,bT);return()=>{m=!0,window.clearInterval(b)}},[t]),l.useEffect(()=>{if(!n.current||o.current)return;o.current=!0,i.current=!1;const m=new Ao.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', monospace",rightClickSelectsWord:!1,theme:{background:"#1e1e1e",foreground:"#cccccc",cursor:"#D7FF63",selectionBackground:"#264f78"}}),g=new Ro.FitAddon;m.loadAddon(g),m.open(n.current),s.current=m,r.current=g;const b=Eo(m,n.current,{onCopy:()=>p()}),x=Mo(m,{sendInput:f});if(requestAnimationFrame(()=>{g.fit(),m.focus()}),t)return m.write(xT),u(!0),()=>{x(),b(),m.dispose(),o.current=!1};const y=()=>{if(i.current)return;const v=new WebSocket(mT());a.current=v,v.binaryType="arraybuffer",v.onmessage=w=>{w.data instanceof ArrayBuffer&&m.write(new Uint8Array(w.data))},v.onopen=()=>{v.send(JSON.stringify({type:"resize",cols:m.cols,rows:m.rows}))},v.onclose=()=>{i.current||(c.current=window.setTimeout(y,gT))}};return y(),m.onData(f),()=>{var v;i.current=!0,c.current!==null&&window.clearTimeout(c.current),(v=a.current)==null||v.close(),x(),b(),m.dispose(),o.current=!1}},[t]),e.jsxs("div",{className:"relative flex-1 flex flex-col",style:{minHeight:0},children:[e.jsx(Mj,{assistantTyping:d}),e.jsx("div",{ref:n,className:"flex-1",style:{background:"#1e1e1e",minHeight:0,paddingTop:3,paddingLeft:3},onClick:()=>{var m;return(m=s.current)==null?void 0:m.focus()}}),h&&e.jsx(Ur,{})]})}const T9=Object.freeze(Object.defineProperty({__proto__:null,SetupTerminalPane:Ij},Symbol.toStringTag,{value:"Module"}));function yT(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/setup-browser`}function vT(t){let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const s=n;if(s.type!=="frame"||typeof s.data!="string")return null;const r=typeof s.w=="number"?s.w:0,a=typeof s.h=="number"?s.h:0;return{src:`data:image/jpeg;base64,${s.data}`,width:r,height:a}}function jT(t){const n=t.paneWidth>0&&t.frameWidth>0?t.frameWidth/t.paneWidth:1,s=t.paneHeight>0&&t.frameHeight>0?t.frameHeight/t.paneHeight:1;return JSON.stringify({kind:"mouse",event:t.event,x:Math.round(t.paneX*n),y:Math.round(t.paneY*s),button:"left",clickCount:1})}function wT(t,n,s=1500){if(t<=0)return!1;const r=n-t;return r>=0&&r<=s}function rs(t,n){const s=`<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="800" viewBox="0 0 1280 800">
|
|
211
|
+
<rect width="1280" height="800" fill="#0b0d12"/>
|
|
212
|
+
<rect width="1280" height="56" fill="#11141b"/>
|
|
213
|
+
<text x="28" y="35" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="20" font-weight="700">${n}</text>
|
|
214
|
+
${t}
|
|
215
|
+
</svg>`;return`data:image/svg+xml;utf8,${encodeURIComponent(s)}`}function xt(t,n,s,r,a){return`
|
|
216
|
+
<text x="${t}" y="${n}" fill="#98a0ad" font-family="system-ui, sans-serif" font-size="14">${r}</text>
|
|
217
|
+
<rect x="${t}" y="${n+10}" width="${s}" height="40" rx="6" fill="#171b24" stroke="#2a303c"/>
|
|
218
|
+
<text x="${t+14}" y="${n+36}" fill="#e7e9ee" font-family="ui-monospace, monospace" font-size="15">${a}</text>`}const _T={hosting:rs(`
|
|
219
|
+
<text x="28" y="130" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="28" font-weight="700">Production Deployment</text>
|
|
220
|
+
<rect x="28" y="160" width="1224" height="120" rx="10" fill="#12161f" stroke="#232a36"/>
|
|
221
|
+
<circle cx="60" cy="220" r="8" fill="#3ecf8e"/>
|
|
222
|
+
<text x="82" y="212" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="17">my-app.vercel.app</text>
|
|
223
|
+
<text x="82" y="238" fill="#98a0ad" font-family="system-ui, sans-serif" font-size="14">Ready · deployed 2m ago · main@a1b2c3d</text>
|
|
224
|
+
<rect x="28" y="320" width="360" height="44" rx="8" fill="#D7FF63"/>
|
|
225
|
+
<text x="70" y="348" fill="#0b0d12" font-family="system-ui, sans-serif" font-size="16" font-weight="600">Add a custom domain →</text>`,"▲ Vercel — Project Settings"),dns:rs(`
|
|
226
|
+
<text x="28" y="130" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="26" font-weight="700">DNS Records — codeyam.com</text>
|
|
227
|
+
${xt(28,180,300,"Type","CNAME")}
|
|
228
|
+
${xt(360,180,420,"Name","www")}
|
|
229
|
+
${xt(812,180,440,"Value","cname.vercel-dns.com")}
|
|
230
|
+
${xt(28,280,300,"Type","A")}
|
|
231
|
+
${xt(360,280,420,"Name","@")}
|
|
232
|
+
${xt(812,280,440,"Value","76.76.21.21")}
|
|
233
|
+
<rect x="28" y="380" width="220" height="44" rx="8" fill="#D7FF63"/>
|
|
234
|
+
<text x="70" y="408" fill="#0b0d12" font-family="system-ui, sans-serif" font-size="16" font-weight="600">Save Records</text>`,"☁ Cloudflare — DNS"),signin:rs(`
|
|
235
|
+
<rect x="440" y="200" width="400" height="380" rx="14" fill="#12161f" stroke="#232a36"/>
|
|
236
|
+
<text x="640" y="260" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="22" font-weight="700" text-anchor="middle">Sign in to continue</text>
|
|
237
|
+
${xt(472,300,336,"Email","you@example.com")}
|
|
238
|
+
${xt(472,380,336,"Password","••••••••••")}
|
|
239
|
+
<rect x="472" y="470" width="336" height="44" rx="8" fill="#4c7fff"/>
|
|
240
|
+
<text x="640" y="498" fill="#ffffff" font-family="system-ui, sans-serif" font-size="16" font-weight="600" text-anchor="middle">Sign in</text>`,"App Store Connect — Sign In"),appstore:rs(`
|
|
241
|
+
<text x="28" y="130" fill="#e7e9ee" font-family="system-ui, sans-serif" font-size="26" font-weight="700">App Information</text>
|
|
242
|
+
${xt(28,180,560,"Name","CodeYam")}
|
|
243
|
+
${xt(620,180,632,"Subtitle","Build code and data scenarios together")}
|
|
244
|
+
${xt(28,280,1224,"Promotional Text","See your app in every state, before you ship it.")}
|
|
245
|
+
<rect x="28" y="400" width="200" height="44" rx="8" fill="#4c7fff"/>
|
|
246
|
+
<text x="128" y="428" fill="#ffffff" font-family="system-ui, sans-serif" font-size="16" font-weight="600" text-anchor="middle">Submit for Review</text>`," App Store Connect — 1.0"),navigating:rs(`
|
|
247
|
+
<rect x="0" y="56" width="1280" height="3" fill="#D7FF63"/>
|
|
248
|
+
<text x="28" y="420" fill="#5b6472" font-family="system-ui, sans-serif" font-size="20" text-anchor="start">Loading DNS records…</text>`,"☁ Cloudflare — DNS")},kT={hosting:"https://vercel.com/acme/my-app",dns:"https://dash.cloudflare.com/dns/codeyam.com",signin:"https://appstoreconnect.apple.com/login",appstore:"https://appstoreconnect.apple.com/apps/1234/appstore",navigating:"https://dash.cloudflare.com/dns/codeyam.com"};function ST(t){return _T[t]}function NT(t){return kT[t]}function Dj({address:t,assistantNavigating:n,onBack:s,onForward:r,onReload:a,onStop:o}){const i={background:"var(--bg-input, #2a2a2a)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",borderRadius:4,width:24,height:22,cursor:"pointer",fontSize:12};return e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2 text-[11px]",style:{background:"var(--bg-card)",color:"var(--text-secondary)",borderBottom:"1px solid var(--border-subtle)"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Shared setup browser — you and the assistant both control this window."}),n&&e.jsx("span",{className:"rounded px-2 py-0.5",style:{background:"rgba(215, 255, 99, 0.15)",color:"#8fae00",border:"1px solid rgba(215, 255, 99, 0.4)"},children:"Assistant is navigating…"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",style:i,onClick:s,title:"Back","aria-label":"Back",children:"‹"}),e.jsx("button",{type:"button",style:i,onClick:r,title:"Forward","aria-label":"Forward",children:"›"}),e.jsx("button",{type:"button",style:i,onClick:a,title:"Reload","aria-label":"Reload",children:"↻"}),e.jsx("div",{className:"flex-1 truncate rounded px-2 py-0.5",style:{background:"var(--bg-input, #1e1e1e)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",fontFamily:"'IBM Plex Mono', monospace"},title:t,children:t||"about:blank"}),e.jsx("button",{type:"button",style:i,onClick:o,title:"Stop","aria-label":"Stop",children:"✕"})]})]})}const O9=Object.freeze(Object.defineProperty({__proto__:null,SetupBrowserHeader:Dj},Symbol.toStringTag,{value:"Module"})),CT=1200,PT=1e3;function Lj({demo:t="hosting",address:n,assistantNavigating:s,disconnected:r=!1}={}){const o=wt()||s!==void 0||r,i=l.useRef(null),c=l.useRef(null),d=l.useRef(!1),u=l.useRef(null),h=l.useRef({width:0,height:0}),[p,f]=l.useState(o?ST(t):null),[m,g]=l.useState(n??(o?NT(t):"")),[b,x]=l.useState(s??!1),[y,v]=l.useState(!1);l.useEffect(()=>{if(o)return;let j=!1;const _=async()=>{try{const S=await fetch("/api/setup-browser/activity");if(!S.ok)return;const N=await S.json();if(j)return;x(wT(N.lastActMs??0,Date.now()))}catch{}};_();const k=window.setInterval(_,PT);return()=>{j=!0,window.clearInterval(k)}},[o]),l.useEffect(()=>{if(o)return;d.current=!1;const j=()=>{if(d.current)return;const _=new WebSocket(yT());c.current=_,_.onopen=()=>v(!0),_.onmessage=k=>{if(typeof k.data!="string")return;const S=vT(k.data);S&&(h.current={width:S.width,height:S.height},f(S.src))},_.onclose=()=>{v(!1),!d.current&&(u.current=window.setTimeout(j,CT))}};return j(),()=>{var _;d.current=!0,u.current!==null&&window.clearTimeout(u.current),(_=c.current)==null||_.close()}},[o]);function w(j,_){const k=c.current;if(!k||k.readyState!==WebSocket.OPEN)return;const S=_.currentTarget.getBoundingClientRect();k.send(jT({event:j,paneX:_.clientX-S.left,paneY:_.clientY-S.top,paneWidth:S.width,paneHeight:S.height,frameWidth:h.current.width,frameHeight:h.current.height}))}return e.jsxs("div",{className:"relative flex-1 flex flex-col",style:{minHeight:0},children:[e.jsx(Dj,{address:m,assistantNavigating:b,onReload:()=>g(m)}),e.jsx("div",{ref:i,className:"flex-1 flex items-center justify-center overflow-hidden",style:{background:"#0b0d12",minHeight:0},children:r?e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-6",children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontSize:13},children:"The shared browser session was stopped."}),e.jsx("button",{type:"button",className:"rounded px-3 py-1.5",style:{background:"#D7FF63",color:"#0b0d12",fontSize:13,fontWeight:600,cursor:"pointer"},children:"Relaunch shared browser"})]}):p?e.jsx("img",{src:p,alt:"Shared setup browser viewport",className:"max-w-full max-h-full",style:{objectFit:"contain"},draggable:!1,onMouseDown:j=>w("mousePressed",j),onMouseUp:j=>w("mouseReleased",j)}):e.jsx("span",{style:{color:"var(--text-secondary)",fontSize:13},children:y?"Waiting for the first frame…":"Connecting to the shared browser…"})})]})}const A9=Object.freeze(Object.defineProperty({__proto__:null,SetupBrowserPane:Lj},Symbol.toStringTag,{value:"Module"}));function Fj({onDismiss:t,previewOrigin:n}){const{inContainer:s,reachableUrl:r}=zo(),a=Q4(s,r,n);return e.jsx(kr,{severity:"warning",testId:"client-routing-advisory",className:"flex w-full flex-col gap-3 border-b border-l-4 px-4 py-3 text-sm",headline:"Reloading the preview may land on the wrong page",explanation:"This app uses client-side routing, so it handles its own page navigation. The Live Preview is served from the /__codeyam_preview sub-path, which a client-side router cannot serve correctly on a reload or a deep link. Clicking around inside the app works, but reloading may land on the wrong route.",nextAction:a?e.jsxs(e.Fragment,{children:["Set ",e.jsx("code",{children:"sameOriginSafe: false"})," in"," ",e.jsx("code",{children:".codeyam/stack.json"}),", then reload. The preview moves to its own address and the problem goes away. Copy this report if you want to hand the change to an agent."]}):e.jsx(e.Fragment,{children:"Nothing you can change here. This editor is reached remotely and has no dedicated preview address provisioned, so there is nowhere to move the preview to yet — one has to be provisioned for this machine, alongside the editor’s own address, and the preview will use it automatically. Until then the sub-path is the only route that reaches you. Copy this report and send it to whoever set the machine up."}),nextActionText:a?'Set "sameOriginSafe": false in .codeyam/stack.json, then reload. The preview moves to its own address and the problem goes away.':"Nothing you can change here. This editor is reached remotely and has no dedicated preview address provisioned, so there is nowhere to move the preview to yet — one has to be provisioned for this machine, alongside the editor's own address. Until then the sub-path is the only route that reaches you. Copy this report and send it to whoever set the machine up.",actions:[{label:"Dismiss",onClick:t,variant:"secondary",ariaLabel:"Dismiss client-routing advisory",testId:"client-routing-advisory-dismiss"}]})}const R9=Object.freeze(Object.defineProperty({__proto__:null,ClientRoutingAdvisory:Fj},Symbol.toStringTag,{value:"Module"})),TT="Seed failed — DB state is unknown",OT="Preview capture failed — the app's data was seeded";function zj({error:t,kind:n,onRetry:s}){const r=n==="device"?OT:TT;return e.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-3 border-b border-[var(--accent-red)] bg-[var(--accent-red)]/10 px-4 py-2 text-sm text-[var(--accent-red)]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold",children:r}),e.jsx("div",{className:"truncate text-xs opacity-90",children:t})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(Ze,{variant:"subtle",text:`${r}
|
|
249
|
+
${t}`,label:"Copy",className:"shrink-0 rounded border border-[var(--accent-red)] px-2 py-1 text-xs hover:bg-[var(--accent-red)] hover:text-white disabled:opacity-50 disabled:cursor-not-allowed"}),s?e.jsx("button",{type:"button",onClick:s,className:"shrink-0 rounded border border-[var(--accent-red)] px-2 py-1 text-xs hover:bg-[var(--accent-red)] hover:text-white",children:"Retry"}):null]})]})}const E9=Object.freeze(Object.defineProperty({__proto__:null,SeedErrorBanner:zj},Symbol.toStringTag,{value:"Module"}));function $j({label:t="Loading scenario..."}={}){return e.jsx("div",{role:"status","aria-live":"polite",className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-[var(--bg-deep)]/90 backdrop-blur-sm text-[var(--text-muted)]",children:t})}const M9=Object.freeze(Object.defineProperty({__proto__:null,SeedLoadingOverlay:$j},Symbol.toStringTag,{value:"Module"}));function Bj(t){return t.state==="preflight-running"||t.state==="booting-simulator"||t.state==="simulator-booted"||t.state==="building-app"}const AT=1500;function qj({stackId:t,pollMs:n=AT,onStateChange:s}={}){const[r,a]=l.useState({state:"idle"}),[o,i]=l.useState(!1),c=l.useRef(s);c.current=s,l.useEffect(()=>{let h=!1,p=!0;const f=async()=>{var g;try{const b=await fetch("/api/simulator-status");if(!b.ok)return;const x=await b.json();if(h||!p)return;const{history:y,...v}=x;a(v),(g=c.current)==null||g.call(c,v)}catch{}};f();const m=window.setInterval(f,n);return()=>{h=!0,p=!1,window.clearInterval(m)}},[n]);const d=l.useCallback(async()=>{if(!o){i(!0);try{const h=t?JSON.stringify({stack_id:t}):"{}";await fetch("/api/start-simulator",{method:"POST",headers:{"content-type":"application/json"},body:h})}finally{i(!1)}}},[t,o]),u=o||Bj(r);return{status:r,posting:o,buttonDisabled:u,start:d}}function Hj({stderrTail:t,onClose:n}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},onClick:n,children:e.jsxs("div",{className:"max-w-2xl w-full max-h-[80vh] overflow-auto rounded p-4 font-mono text-xs",style:{background:"var(--bg-elevated)",color:"var(--text-primary)"},onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("strong",{children:"Build logs (stderr tail)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ze,{variant:"subtle",text:t,label:"Copy"}),e.jsx("button",{type:"button",onClick:n,className:"opacity-70 hover:opacity-100",children:"✕"})]})]}),e.jsx("pre",{className:"whitespace-pre-wrap",children:t||"(no stderr captured)"})]})})}const I9=Object.freeze(Object.defineProperty({__proto__:null,BuildLogsModal:Hj},Symbol.toStringTag,{value:"Module"}));function So({stackId:t,pollMs:n,onStateChange:s}){const[r,a]=l.useState(!1),{status:o,start:i,buttonDisabled:c}=qj({stackId:t,pollMs:n,onStateChange:s}),d=o.state==="app-launched";return e.jsxs("div",{className:"flex items-center gap-3 text-sm",style:{color:"var(--text-primary)"},children:[e.jsx("button",{type:"button",onClick:i,disabled:c,className:"px-3 py-1 rounded font-medium disabled:opacity-40 disabled:cursor-not-allowed",style:d?{background:"var(--surface-raised)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",opacity:.7}:{background:"var(--accent-primary)",color:"var(--bg-deep)"},children:d?"Restart simulator":"Start simulator"}),e.jsx(Wj,{status:o}),o.state==="build-failed"?e.jsx("button",{type:"button",onClick:()=>a(!0),className:"text-xs underline opacity-80 hover:opacity-100",children:"see logs"}):null,r&&o.state==="build-failed"?e.jsx(Hj,{stderrTail:o.stderrTail,onClose:()=>a(!1)}):null]})}function Wj({status:t}){const n=ml(t);return e.jsx("span",{className:"text-xs opacity-80","data-testid":"simulator-status-pill",children:n})}function ml(t){switch(t.state){case"idle":return"No simulator running";case"preflight-running":return"Pre-flight checks…";case"preflight-failed":return`Pre-flight failed: ${t.check} — ${t.message}`;case"booting-simulator":return`Booting ${t.device}…`;case"simulator-booted":return`Simulator booted (${t.name})`;case"building-app":return`Building (${Gj(t.elapsedSec)})…`;case"build-failed":return"Build failed";case"app-launched":return`App running ▸${t.appBundleId!=="com.codeyam.android"?" (host proxy active)":""}`;case"stopped":return t.reason.kind==="user-requested"?"Stopped":t.reason.kind==="editor-server-shutdown"?"Editor server shut down":t.reason.code!=null?`Stopped (exit ${t.reason.code})`:"Stopped"}}function Gj(t){if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return`${n}m ${s.toString().padStart(2,"0")}s`}const D9=Object.freeze(Object.defineProperty({__proto__:null,SimulatorLauncherControls:So,StatusPill:Wj,formatElapsed:Gj,pillText:ml},Symbol.toStringTag,{value:"Module"}));function Uj({stackId:t,pollMs:n,onStateChange:s}){const{status:r,start:a,buttonDisabled:o}=qj({stackId:t,pollMs:n,onStateChange:s}),i=Bj(r);return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-full px-6 text-center",style:{color:"var(--text-primary)"},children:[e.jsx("div",{className:"text-3xl","aria-hidden":"true",children:"📱"}),e.jsx("div",{className:"text-sm font-medium",children:"No simulator running yet"}),e.jsx("div",{className:"text-xs opacity-70",children:i?ml(r):"Start it to preview this scenario on device."}),e.jsx("button",{type:"button",onClick:a,disabled:o,className:"px-3 py-1 rounded font-medium disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"var(--accent-primary)",color:"var(--bg-deep)"},children:"Start simulator"})]})}const L9=Object.freeze(Object.defineProperty({__proto__:null,SimulatorNotBootedPrompt:Uj},Symbol.toStringTag,{value:"Module"}));function cr({src:t,currentHeight:n,currentWidth:s,isFilled:r,scale:a}){return r?e.jsx("img",{src:t,alt:"Simulator / Emulator preview",className:"w-full h-full object-contain",style:{background:"var(--bg-deep)"}}):e.jsx("div",{className:"shadow-[0_10px_30px_rgba(0,0,0,0.45)]",style:{width:s,height:n,transform:a<1?`scale(${a})`:void 0,transformOrigin:"center center",flexShrink:0},children:e.jsx("img",{src:t,alt:"Simulator / Emulator preview",style:{width:"100%",height:"100%",background:"var(--bg-deep)",objectFit:"contain"}})})}const F9=Object.freeze(Object.defineProperty({__proto__:null,DeviceFrameImage:cr},Symbol.toStringTag,{value:"Module"}));function wr({currentWidth:t,currentHeight:n,isFilled:s,scale:r,title:a,hint:o}){const i=e.jsx("div",{className:"w-full h-full border border-dashed rounded flex items-center justify-center text-center px-6",style:{borderColor:"var(--border-default)",background:"var(--bg-surface)",color:"var(--text-dim)"},children:e.jsxs("div",{className:"text-sm leading-relaxed",children:[e.jsx("div",{className:"font-medium",children:a}),e.jsx("div",{className:"opacity-70 mt-1",children:o})]})});return s?i:e.jsx("div",{className:"shadow-[0_10px_30px_rgba(0,0,0,0.45)]",style:{width:t,height:n,transform:r<1?`scale(${r})`:void 0,transformOrigin:"center center",flexShrink:0},children:i})}const z9=Object.freeze(Object.defineProperty({__proto__:null,SimulatorFrameNotice:wr},Symbol.toStringTag,{value:"Module"}));function Yj({currentWidth:t,currentHeight:n,isFilled:s,scale:r,variant:a}){const o=a==="xcode-missing"?"Xcode/Android tooling not detected":"No simulator / emulator running",i=a==="xcode-missing"?"Install Xcode or Android SDK + command line tools, then boot a device.":"Boot a simulator or emulator to see the live preview.";return e.jsx(wr,{currentWidth:t,currentHeight:n,isFilled:s,scale:r,title:o,hint:i})}const $9=Object.freeze(Object.defineProperty({__proto__:null,NoBootedSimulatorPlaceholder:Yj},Symbol.toStringTag,{value:"Module"})),RT=1500;function Vj(t=RT){const[n,s]=l.useState({available:!1,loading:!0,capturedAtMs:null});return l.useEffect(()=>{let r=!1;const a=()=>{fetch("/api/preview-capture-status").then(i=>i.ok?i.json():{available:!1}).then(i=>{r||s({available:(i==null?void 0:i.available)===!0,loading:!1,capturedAtMs:typeof(i==null?void 0:i.capturedAtMs)=="number"?i.capturedAtMs:null})}).catch(()=>{r||s(i=>({available:i.available,loading:!1,capturedAtMs:i.capturedAtMs}))})};a();const o=window.setInterval(a,t);return()=>{r=!0,window.clearInterval(o)}},[t]),n}const ET=700;function Kj({currentHeight:t,currentWidth:n,isFilled:s,scale:r,pollMs:a=ET,onError:o,deviceLabel:i="iOS Simulator",scenarioScreenshotSrc:c=null,bootState:d}){const u=Vx({pollMs:a,paused:!!c||!!d,onError:o}),{state:h,frameToken:p}=d??u,f=Vj();if(c)return e.jsx(cr,{src:c,currentWidth:n,currentHeight:t,isFilled:s,scale:r});if(h.kind==="no-device"||h.kind==="xcode-missing"){if(!f.loading&&f.available){const g=f.capturedAtMs!=null?`/api/preview-capture?cb=${f.capturedAtMs}`:"/api/preview-capture";return e.jsx(cr,{src:g,currentWidth:n,currentHeight:t,isFilled:s,scale:r})}return e.jsx(Yj,{currentWidth:n,currentHeight:t,isFilled:s,scale:r,variant:h.kind})}if(h.kind==="loading")return e.jsx(wr,{currentWidth:n,currentHeight:t,isFilled:s,scale:r,title:`Connecting to the ${i}…`,hint:"Waiting for the first live frame."});if(h.kind==="capture-failed")return e.jsx(wr,{currentWidth:n,currentHeight:t,isFilled:s,scale:r,title:"Live preview frame unavailable",hint:`Your app is still running — interact with it directly in the ${i} window.`});const m=`/api/simulator-frame?t=${p}`;return e.jsx(cr,{src:m,currentWidth:n,currentHeight:t,isFilled:s,scale:r})}const B9=Object.freeze(Object.defineProperty({__proto__:null,SimulatorPreviewFrame:Kj},Symbol.toStringTag,{value:"Module"}));function Jj({emptyStateMessage:t,projectSetupInProgress:n,previewSlug:s,previewUrl:r,viewports:a,activeViewport:o,onViewportChange:i,isCollapsed:c,onToggleCollapsed:d,isFilled:u,onToggleFilled:h,currentWidth:p,currentHeight:f,onCustomSizeChange:m,buildingScenarioSlug:g,buildingScreenshotPath:b,buildingScenarioName:x,buildingScenarioDescription:y,onDismissBuildingOverlay:v,historicalScreenshotPath:w,historicalScenarioName:j,historicalHeading:_,historicalSubtext:k,onDismissHistoricalPreview:S,previewSeeding:N,previewSeedError:T,previewSeedErrorKind:A,onRetrySeed:M,currentScenario:C,scenarioGroups:H,onShowScenarioPreview:J,commandNonce:Z,previewOrigin:F,isNarrow:$=!1,onBack:P,onPlanChange:I,onDesignConfirmed:B}){const{config:X}=_t(),W=at(X==null?void 0:X.provider),[ie,Q]=l.useState(!1),O=!!P,q=(C?Zo(C,H??[]):[]).length>1,[le,de]=l.useState(!0),[ee,D]=l.useState(!1),z=O?le:ee,K=O?de:D,ue=O||q,ye=z&&!!C&&(O||q),[je,V]=l.useState({state:"idle"}),{containerRef:te,containerSize:oe,scale:he}=a3({currentHeight:f,currentWidth:p,isFilled:u}),G=Yx(),re=h3(F===xn),[U,we]=l.useState(!1),_e=!!(X!=null&&X.previewDedicatedOriginUnavailable),[Se,dt]=l.useState(!1);l.useEffect(()=>{wt()||e3(T??null)},[T]);const Ye=f3(C,o),ft=Ye?_n(Ye,C==null?void 0:C.screenshotCapturedAtMs):null,Ae=pa(G.kind),gt=!!ft,ut=Vx({paused:!Ae||gt}),on=ut.state.kind==="no-device"||ut.state.kind==="xcode-missing",St=G.fallbackKind==="iframe"&&G.fallbackPort!==null,qe=Ae&&!gt&&St&&on,Nt=G.fallbackPort??0,ln=(C?Ux(C,Nt,F):"")||ol("/",{appPort:Nt,currentPort:typeof window<"u"?al(window.location):0,previewOrigin:F}),it=r?rl(r):"",cn=it==="/results"||it.startsWith("/results/"),ve=it==="/plan-preview",Pe=it==="/design-exploration",Te=it==="/setup-terminal",Ce=it==="/setup-browser";if(Te)return e.jsx(Ij,{});if(Ce)return e.jsx(Lj,{});if(ve)return e.jsx(Ov,{});if(cn)return e.jsx(uy,{});if(Pe)return e.jsx(lv,{onDesignConfirmed:B});if(n&&!r&&!G.loading&&!pa(G.kind))return e.jsx(Ej,{});const Re=je.state==="app-launched";return e.jsxs("div",{"data-preview-pane":"true",className:"flex-1 flex flex-col min-w-0",children:[e.jsx(Nv,{viewports:a,active:o,onChange:i,currentWidth:p,currentHeight:f,previewUrl:r,isCollapsed:c,onToggleCollapsed:d,isFilled:u,onToggleFilled:h,containerWidth:(oe==null?void 0:oe.width)??null,containerHeight:(oe==null?void 0:oe.height)??null,onCustomSizeChange:m,currentScenario:C??null,scenarioGroups:H??[],onShowScenarioPreview:J??(()=>{}),onCreateStateRequest:()=>Q(!0),isNarrow:$,onBack:P,onPlanChange:I,onToggleStatesModal:ue?()=>K(E=>!E):void 0,statesModalOpen:z}),T?e.jsx(zj,{error:T,kind:A,onRetry:M}):null,_e&&!Se?e.jsx(vd,{onDismiss:()=>dt(!0)}):re&&!U?e.jsx(Fj,{previewOrigin:F,onDismiss:()=>we(!0)}):null,ye&&C?e.jsx(yu,{currentScenario:C,scenarioGroups:H??[],onSelect:E=>(J??(()=>{}))(E),onCreateNew:()=>Q(!0),onClose:()=>K(!1)}):null,e.jsxs("div",{className:"relative flex-1 flex flex-col min-h-0",children:[Ae&&!qe?e.jsxs(e.Fragment,{children:[e.jsx(cv,{deviceLabel:ma(G.kind),actions:e.jsx(So,{onStateChange:V})}),e.jsx("div",{ref:te,className:"relative flex-1 flex overflow-hidden items-center justify-center p-8",style:{backgroundColor:"#1e1e1e"},children:Re?e.jsx(Kj,{currentHeight:f,currentWidth:p,isFilled:u,scale:he,deviceLabel:ma(G.kind),scenarioScreenshotSrc:ft,bootState:ut}):e.jsx(Uj,{onStateChange:V})})]}):e.jsxs(e.Fragment,{children:[qe?e.jsx(Oh,{deviceLabel:ma(G.kind),actions:e.jsx(So,{})}):null,e.jsx(_j,{providerLabel:W,containerRef:te,containerHeight:oe==null?void 0:oe.height,containerWidth:oe==null?void 0:oe.width,currentHeight:f,currentWidth:p,emptyStateMessage:t??"Select a scenario to preview",isFilled:u,previewSlug:qe?(C==null?void 0:C.slug)??s:s,previewUrl:qe?ln:r,previewOrigin:F,scale:he,buildingScenarioSlug:g,buildingScreenshotPath:b,buildingScenarioName:x,buildingScenarioDescription:y,onDismissBuildingOverlay:v,historicalScreenshotPath:w,historicalScenarioName:j,historicalHeading:_,historicalSubtext:k,onDismissHistoricalPreview:S,commandNonce:Z})]}),N?e.jsx($j,{label:pa(G.kind)?"Loading scenario on device…":void 0}):null]}),ie?e.jsx(hy,{onClose:()=>Q(!1),providerLabel:W}):null]})}const q9=Object.freeze(Object.defineProperty({__proto__:null,PreviewPanel:Jj},Symbol.toStringTag,{value:"Module"})),No="reset";function Xj({busy:t,onCancel:n,onConfirm:s}){const[r,a]=l.useState(""),o=r.trim().toLowerCase()===No;return l.useEffect(()=>{const i=c=>{c.key==="Escape"&&!t&&n()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,n]),e.jsx("div",{role:"presentation",onClick:()=>{t||n()},style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:200,padding:24},children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Cancel build and reset everything?",onClick:i=>i.stopPropagation(),style:{background:"var(--bg-elevated, #141414)",border:"1px solid var(--border-default)",borderRadius:12,padding:24,width:"min(440px, 100%)",display:"flex",flexDirection:"column",gap:16,fontFamily:"'IBM Plex Mono', monospace",boxShadow:"0 20px 60px rgba(0,0,0,0.5)"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("h2",{style:{margin:0,color:"var(--text-primary)",fontSize:16,fontWeight:600},children:"Cancel build & reset everything?"}),e.jsxs("p",{style:{margin:0,color:"var(--text-secondary)",fontSize:13},children:["This stops the current build, clears the editor session, and"," ",e.jsx("strong",{style:{color:"var(--accent-red)"},children:"permanently discards uncommitted code changes"})," ","(back to the current commit). This cannot be undone."]})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6,color:"var(--text-secondary)",fontSize:12},children:["Type ",e.jsx("strong",{style:{color:"var(--text-primary)"},children:No})," to confirm",e.jsx("input",{type:"text",value:r,disabled:t,autoFocus:!0,"data-testid":"reset-confirm-input",onChange:i=>a(i.target.value),style:{padding:"8px 10px",background:"var(--bg-input, #0f0f0f)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderRadius:6,fontSize:13,fontFamily:"inherit"}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:n,disabled:t,style:{padding:"8px 16px",background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:6,fontSize:13,fontWeight:500,cursor:t?"wait":"pointer",opacity:t?.5:1,fontFamily:"inherit"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:s,disabled:t||!o,"data-testid":"reset-confirm-button",style:{padding:"8px 18px",background:"var(--accent-red, #ff5c5c)",color:"#fff",border:"1px solid var(--accent-red, #ff5c5c)",borderRadius:6,fontSize:13,fontWeight:600,cursor:t?"wait":o?"pointer":"not-allowed",opacity:t||!o?.5:1,fontFamily:"inherit"},children:t?"Resetting…":"Reset everything"})]})]})})}const H9=Object.freeze(Object.defineProperty({__proto__:null,RESET_CONFIRM_WORD:No,ResetBuildConfirmModal:Xj},Symbol.toStringTag,{value:"Module"}));function MT(){const[t,n]=l.useState([]),[s,r]=l.useState(!0),[a,o]=l.useState(null),{scenariosVersion:i}=Nn(),c=l.useCallback(async()=>{r(!0),o(null);try{const u=await fetch("/api/scenarios");if(!u.ok)throw new Error(`HTTP ${u.status}`);const h=(await u.json()).map(Oo);n(mv(h))}catch(u){o(u instanceof Error?u.message:"Failed to load scenarios")}finally{r(!1)}},[]);l.useEffect(()=>{c()},[c,i]);const d=t.reduce((u,h)=>u+h.scenarios.length,0);return{groups:t,loading:s,error:a,totalScenarios:d,reload:c}}function IT(t){if(Array.isArray(t))return{entities:t,unsurfacedPages:[],componentSurfaceReason:null};if(t&&typeof t=="object"){const n=t;return{entities:Array.isArray(n.entities)?n.entities:[],unsurfacedPages:Array.isArray(n.unsurfacedPages)?n.unsurfacedPages:[],componentSurfaceReason:DT(n.componentSurfaceReason)}}return{entities:[],unsurfacedPages:[],componentSurfaceReason:null}}function DT(t){if(!t||typeof t!="object")return null;const n=t.kind;return n==="no-component-scenarios"||n==="missing-from-glossary"||n==="not-visual-components"?t:null}function LT(){const[t,n]=l.useState([]),[s,r]=l.useState([]),[a,o]=l.useState(null),[i,c]=l.useState(!0),[d,u]=l.useState(null),{scenariosVersion:h}=Nn(),p=l.useCallback(async()=>{c(!0),u(null);try{const f=await fetch("/api/app-route-entities");if(!f.ok)throw new Error(`HTTP ${f.status}`);const m=IT(await f.json());n(m.entities.map(g=>({...g,scenarios:Array.isArray(g==null?void 0:g.scenarios)?g.scenarios.map(Oo):[]}))),r(m.unsurfacedPages),o(m.componentSurfaceReason)}catch(f){u(f instanceof Error?f.message:"Failed to load app routes"),n([]),r([]),o(null)}finally{c(!1)}},[]);return l.useEffect(()=>{p()},[p,h]),{routeEntities:t,unsurfacedPages:s,componentSurfaceReason:a,loading:i,error:d,reload:p}}function cd(t){const n=new Map;for(const s of t){const r=FT(s.path);let a=n.get(r);a||(a=[],n.set(r,a));for(const o of s.tests)a.push({...o,file:s.path})}return Array.from(n.entries()).map(([s,r])=>({feature:s,tests:r})).filter(s=>s.tests.length>0).sort((s,r)=>s.feature.localeCompare(r.feature))}function FT(t){const s=t.replace(/\\/g,"/").replace(/^\.\//,"").split("/").filter(r=>r.length>0);return s.length===0?"Other":s[0]==="crates"&&s.length>=2?`crates/${s[1]}`:t==="(no-file)"?"(no-file)":s[0]}function Qj(t,n){if(n===".")return t;const s=n.endsWith("/")?n:`${n}/`;return t.map(r=>({feature:r.feature,tests:r.tests.filter(a=>a.file.startsWith(s))})).filter(r=>r.tests.length>0)}function Zj(t,n,s){return s==="backend"?[]:t.map(r=>({...r,scenarios:r.scenarios.filter(_r)})).filter(r=>r.scenarios.length>0)}function e0(t){let n=0,s=0,r=0,a=0,o=0;for(const i of t)for(const c of i.tests)o+=1,n+=1,c.status==="passed"?s+=1:c.status==="skipped"?a+=1:c.status==="failed"&&(r+=1);return{total:n,passed:s,failed:r,ignored:a,discovered:o}}function zT(t){return t.reduce((n,s)=>n+s.scenarios.length,0)}const $T=3e3;function BT(){const[t,n]=l.useState([]),[s,r]=l.useState(!0),[a,o]=l.useState(!1),[i,c]=l.useState(null),[d,u]=l.useState(!1),[h,p]=l.useState(null),[f,m]=l.useState(null),[g,b]=l.useState(null),x=l.useRef(null),y=l.useRef(null),v=l.useRef(!1),w=l.useRef(null),{testsVersion:j}=Nn(),_=l.useCallback(async(C=!1)=>{var F;(F=x.current)==null||F.abort();const H=new AbortController;x.current=H;const{signal:J}=H;C&&(v.current=!0,o(!0));const Z=!C&&w.current!==null;Z||(r(!0),c(null));try{if(!C&&!Z)try{const B=await fetch("/api/test-results/summary",{signal:J});if(B.ok){const X=await B.json();X.running?p(X.currentRunner??null):X.stats&&(m(X.stats),b(X.coverage??null))}}catch{}let $,P;if(Z){$=w.current;const B=await fetch("/api/test-results",{signal:J});if(!B.ok)throw new Error(`test-results: HTTP ${B.status}`);P=await B.json()}else if(C){const B=await fetch("/api/test-results/refresh",{method:"POST",signal:J});if(!B.ok)throw new Error(`test-results: HTTP ${B.status}`);P=await B.json(),$=w.current??[]}else{const[B,X]=await Promise.all([fetch("/api/tests",{signal:J}),fetch("/api/test-results",{signal:J})]);if(!B.ok)throw new Error(`tests: HTTP ${B.status}`);if(!X.ok)throw new Error(`test-results: HTTP ${X.status}`);$=cd(await B.json()),P=await X.json(),w.current=$}if(p(P.currentRunner??null),P.running&&v.current){y.current=setTimeout(()=>_(!1),$T);return}const I=v.current;if(v.current=!1,I){const B=await fetch("/api/tests",{signal:J});B.ok&&($=cd(await B.json()),w.current=$)}n($),u(P.cached??!1),b(P.coverage??null),m(null),r(!1),o(!1)}catch($){if($ instanceof DOMException&&$.name==="AbortError")return;v.current=!1,c($ instanceof Error?$.message:"Failed to load tests"),r(!1),o(!1)}},[]);l.useEffect(()=>(w.current=null,_(),()=>{var C;(C=x.current)==null||C.abort(),y.current&&clearTimeout(y.current)}),[_,j]);const{total:k,passed:S,failed:N,ignored:T,discovered:A}=l.useMemo(()=>e0(t),[t]),M=l.useCallback(()=>{v.current||_(!0)},[_]);return{groups:t,loading:s,refreshing:a,error:i,cached:d,currentRunner:h,summaryStats:f,coverage:g,totalTests:k,passedTests:S,failedTests:N,ignoredTests:T,discoveredTests:A,reload:_,refresh:M}}function fl(t,n){return t.filter(s=>s.appDir===n)}function t0(t,n){return n?t.find(s=>s.route===n)??null:null}function n0(t,n,s,r=null){const a=Zj(t,n,s);return WT(a,r)}function qT(t){const n=t.filter(o=>o.defaultScenarioSlug);if(n.length===0)return null;const s=n.find(o=>o.route==="/"&&o.defaultScenarioSlug);if(s!=null&&s.defaultScenarioSlug)return s.defaultScenarioSlug;const r=n.find(o=>o.defaultScenarioSlug&&o.scenarios.some(i=>Co(i)));if(r!=null&&r.defaultScenarioSlug)return r.defaultScenarioSlug;const a=[...n].sort((o,i)=>o.route.length-i.route.length||o.route.localeCompare(i.route))[0];return(a==null?void 0:a.defaultScenarioSlug)??null}function HT(t){return(t==null?void 0:t.defaultScenarioSlug)??null}function s0(t,n,s=null){const r=t.find(a=>a.type==="web");return r?n0(n,r.dir,r.type,s):null}function WT(t,n){const s=t.flatMap(d=>d.scenarios.filter(u=>_r(u)).map(u=>({route:d.route,scenario:u})));if(s.length===0)return null;const r=Js(s.filter(({route:d,scenario:u})=>d==="/"&&Co(u)),n);if(r)return r.scenario.slug;const a=Js(s.filter(({route:d})=>d==="/"),n);if(a)return a.scenario.slug;const o=Js(s.filter(({scenario:d})=>Co(d)),n);if(o)return o.scenario.slug;const i=Math.min(...s.map(({route:d})=>d.length)),c=Js(s.filter(({route:d})=>d.length===i),n);return(c==null?void 0:c.scenario.slug)??null}function Js(t,n){return t.find(({scenario:s})=>GT(s,n))??t[0]??null}function GT(t,n){return n?t.dimensions.length===0||t.dimensions.includes(n):!0}function Co(t){return/\bhome\b/i.test(t.name)}function dd(t){return new Set(t.flatMap(n=>n.scenarios.map(s=>s.slug)))}function Ea({selectedApp:t,appRouteEntities:n,scenarioGroups:s,defaultScreenSize:r=null}){return t?qT(n)??n0(s,t.dir,t.type,r):null}function UT({apps:t,hasExplicitAppSelection:n,scenarioGroups:s,defaultScreenSize:r=null}){return n||t.length===0||s.length===0?null:s0(t,s,r)}function ud(t){return HT(t)}function YT({apps:t,routeEntities:n,selectedApp:s,appRouteEntities:r}){if(s)return r;const a=t.find(o=>o.type==="web");return a?fl(n,a.dir):[]}function VT({previewRouteEntities:t,selectedRouteEntity:n}){var r;if(n!=null&&n.route)return n.route;if(t.length===0)return null;const s=t.find(a=>a.route==="/");return s?s.route:((r=[...t].sort((a,o)=>a.route.length-o.route.length||a.route.localeCompare(o.route))[0])==null?void 0:r.route)??null}function KT({previewRouteEntities:t,path:n}){var r;const s=rl(n);return((r=t0(t,s))==null?void 0:r.defaultScenarioSlug)??null}function JT(t){return t.startsWith("/scenario/")||yd(t)}function XT(t){return JT(t)?!1:t==="/"||t==="/apps"||t==="/apps/"}function QT(t,n,s=""){const r=fa(s),[a,o]=l.useState(r.selectedAppDir),[i,c]=l.useState(r.selectedEntityHash);l.useEffect(()=>{const v=fa(s);o(w=>w===v.selectedAppDir?w:v.selectedAppDir),c(w=>w===v.selectedEntityHash?w:v.selectedEntityHash)},[s]),l.useEffect(()=>{if(typeof window>"u"||t.length!==1)return;const v=fa(s);if(v.selectedAppDir||v.selectedEntityHash||!XT(s))return;const w=ga(t[0].dir);`${window.location.pathname}${window.location.search}`!==w&&(window.history.replaceState({},"",w),o(t[0].dir))},[t,s]);const d=l.useMemo(()=>i?n.find(v=>za(v)===i)??null:null,[n,i]),u=l.useMemo(()=>a?t.find(v=>v.dir===a)??null:d?t.find(v=>v.dir===d.appDir)??null:i?t.find(v=>v.type==="web")??t[0]??null:null,[t,a,d,i]),h=l.useMemo(()=>u?fl(n,u.dir):[],[n,u]),p=l.useMemo(()=>i?d:null,[i,d]);function f(v){if(typeof window>"u")return;const w=`${window.location.pathname}${window.location.search}`;v!==w&&window.history.pushState({},"",v)}function m(v){o(v),c(null),f(ga(v))}function g(){o(null),c(null),f("/apps")}function b(v){const w=h.find(k=>k.route===v);if(!w)return;const j=za(w),_=iu(w);!j||!_||(c(j),f(_))}function x(v){c(v),f(`/entities/${v}`)}function y(){c(null),f(a?ga(a):"/apps")}return{selectedApp:u,appRouteEntities:h,selectedEntityHash:i,selectedRouteEntity:p,selectApp:m,deselectApp:g,selectRoute:b,selectEntity:x,deselectRoute:y}}function ZT(t,n,s,r,a="",o=null,i=!0,c){const[d,u]=l.useState(null),h=l.useRef(!1),p=l.useRef(!1),{selectedApp:f,appRouteEntities:m,selectedEntityHash:g,selectedRouteEntity:b,selectApp:x,deselectApp:y,selectRoute:v,selectEntity:w,deselectRoute:j}=QT(t,n,a),_=l.useMemo(()=>dd(m),[m]),k=l.useMemo(()=>dd(b?[b]:[]),[b]),S=l.useMemo(()=>Ea({selectedApp:f,appRouteEntities:m,scenarioGroups:s,defaultScreenSize:o}),[m,o,s,f]),N=l.useMemo(()=>ud(b),[b]),T=l.useMemo(()=>f?Qj(r,f.dir):[],[r,f]);l.useEffect(()=>{if(h.current)return;if(c!=null&&c.current){h.current=!0;return}if(!i)return;const F=UT({apps:t,scenarioGroups:s,hasExplicitAppSelection:!!f,defaultScreenSize:o});F&&(u(F),h.current=!0)},[t,o,s,f,i,c]),l.useEffect(()=>{if(f){if(p.current){p.current=!1;return}if(b){if(!N||d&&k.has(d))return;u(N);return}S&&(d&&_.has(d)||u(S))}},[S,N,d,f,_,b,k]);function A(F){x(F);const $=t.find(I=>I.dir===F);if(!$)return;const P=Ea({selectedApp:$,appRouteEntities:fl(n,$.dir),scenarioGroups:s,defaultScreenSize:o});u(P)}function M(){y(),u(s0(t,s,o))}function C(F){v(F);const $=ud(t0(m,F));u($)}const H=l.useCallback(F=>{p.current=!0,u(F)},[]);function J(){if(j(),!f)return;const F=Ea({selectedApp:f,appRouteEntities:m,scenarioGroups:s,defaultScreenSize:o});F&&u(F)}function Z(F){w(F)}return{selectedApp:f,appRouteEntities:m,appTestGroups:T,selectedEntityHash:g,selectedRouteEntity:b,previewSlug:d,setPreviewSlug:u,setPreviewSlugExplicit:H,selectApp:A,deselectApp:M,selectRoute:C,selectEntity:Z,deselectRoute:J}}const eO=1e3;function tO(t,n){const s=l.useRef(t);s.current=t;const r=l.useRef(n);r.current=n;const a=l.useRef(null),o=l.useRef(null);l.useEffect(()=>{let i=!0;async function c(){var d;if(i){try{const u=a.current,h=u===null?"/api/editor-commands":`/api/editor-commands?since=${u}`,p=await fetch(h);if(p.ok){const f=await p.json();typeof f.seq=="number"&&(a.current=f.seq),f.bootId&&(o.current===null?o.current=f.bootId:o.current!==f.bootId&&(o.current=f.bootId,(d=r.current)==null||d.call(r)));for(const m of f.commands??[])s.current(m)}}catch{}i&&setTimeout(c,eO)}}return c(),()=>{i=!1}},[])}function nO(){const[t,n]=l.useState({}),[s,r]=l.useState(!0),[a,o]=l.useState(null);l.useEffect(()=>{let c=!1;return fetch("/api/dependency-graph").then(d=>{if(!d.ok)throw new Error(`HTTP ${d.status}`);return d.json()}).then(d=>{if(c)return;const u="files"in d?d.files:d;n(u),r(!1)}).catch(d=>{c||(o(d.message),r(!1))}),()=>{c=!0}},[]);const i=l.useMemo(()=>s1(t),[t]);return{graph:t,entityLookup:i,loading:s,error:a}}function sO(t){return t==="/design-exploration"}function rO(t,n,s){return t.startsWith("http")||t?t:s?`${s}/results`:`http://127.0.0.1:${n}/results`}function aO(t,n,s){return t.startsWith("http")||t?t:s?`${s}/plan-preview`:`http://127.0.0.1:${n}/plan-preview`}function r0(t,n){if(!n)return null;for(const s of t)for(const r of s.scenarios)if(r.slug===n||r.id===n)return r;return null}function oO({directPreviewPath:t,fallbackPreviewPath:n,previewKind:s,selectedScenario:r,port:a,previewOrigin:o}){return s==="blank"?"":t&&(s==="application"||s==="results"||s==="plan-preview")?s==="results"?rO(t,a,o):s==="plan-preview"?aO(t,a,o):t.startsWith("http")||sO(t)?t:o?`${o}${t}`:`http://127.0.0.1:${a}${t}`:r?Ux({slug:r.slug,scenarioType:r.scenarioType,componentName:r.componentName,url:r.url},a,o):n?n.startsWith("http")?n:o?`${o}${n}`:`http://127.0.0.1:${a}${n}`:""}function iO(t,n=Date.now()){const s=t.includes("?")?"&":"?";return`${t}${s}_cb=${n}`}function Po(t,n){if(!t)return null;for(const s of n)for(const r of s.scenarios)if(r.slug===t)return r;return null}function lO({apps:t,appRouteEntities:n,directPreviewPath:s,fallbackPort:r,previewKind:a,previewOrigin:o,previewSlug:i,routeEntities:c,scenarioGroups:d,selectedApp:u,selectedRouteEntity:h}){const p=r0(d,i),f=YT({apps:t,routeEntities:c,selectedApp:u,appRouteEntities:n}),m=VT({previewRouteEntities:f,selectedRouteEntity:h});let g="blank";a==="plan-preview"&&s?g="plan-preview":a==="results"&&s?g="results":a==="application"&&s?g="application":p?g=_r(p)?"application":"component":m&&(g="application");const b=oO({directPreviewPath:s,fallbackPreviewPath:m,previewKind:g,selectedScenario:p,port:r,previewOrigin:o});return{selectedScenario:p,previewRouteEntities:f,fallbackPreviewPath:m,resolvedPreviewKind:g,basePreviewUrl:b}}function cO({allowEditorRoutePreview:t,command:n,configLoaded:s,previewRouteEntities:r,scenarioGroups:a,scenarioDeferAvailable:o=!1}){const i=n.dimension??null,c=!!n.dimension,d=n.commandNonce;if(n.scenarioSlug??n.scenarioId){const b=n.scenarioSlug??n.scenarioId,x=r0(a,b);return x?{clearCustomSize:c,scenarioSlug:x.slug,type:"show-scenario",viewportName:i,commandNonce:d}:o?{clearCustomSize:c,type:"defer",viewportName:i,commandNonce:d}:n.path?{clearCustomSize:c,path:n.path,previewKind:"application",previewSlug:null,preserveDirectPreviewPathOnSlugChange:!0,type:"show-path",viewportName:i,commandNonce:d}:{clearCustomSize:c,scenarioSlug:b,type:"show-scenario",viewportName:i,commandNonce:d}}if(!n.path)return{clearCustomSize:c,type:"refresh",viewportName:i,commandNonce:d};const u=n.path,h=u.startsWith("http")?new URL(u).pathname:u.split("?")[0]??u,p=h==="/results"||h.startsWith("/results/"),f=h==="/plan-preview",m=Gx(u);if(f)return{clearCustomSize:c,path:u,previewKind:"plan-preview",previewSlug:null,preserveDirectPreviewPathOnSlugChange:!1,type:"show-path",viewportName:i,commandNonce:d};if(p)return{clearCustomSize:c,path:u,previewKind:"results",previewSlug:null,preserveDirectPreviewPathOnSlugChange:!1,type:"show-path",viewportName:i,commandNonce:d};if(m&&!t)return{clearCustomSize:c,type:s?"ignore":"defer",viewportName:i,commandNonce:d};if(m&&t)return{clearCustomSize:c,path:u,previewKind:"application",previewSlug:null,preserveDirectPreviewPathOnSlugChange:!0,type:"show-path",viewportName:i,commandNonce:d};const g=KT({previewRouteEntities:r,path:u});return g?{clearCustomSize:c,scenarioSlug:g,type:"show-scenario",viewportName:i,commandNonce:d}:{clearCustomSize:c,path:u,previewKind:"application",previewSlug:null,preserveDirectPreviewPathOnSlugChange:!1,type:"show-path",viewportName:i,commandNonce:d}}function dO(t,n,s,r,a){const o=r.dimensions;return o.length===0||o.includes(t)&&n===null&&s===null?null:o.find(i=>a.some(c=>c.name===i))??o[0]}const uO=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}];function hO(t,n){const s=Object.entries(t);if(s.length===0)return uO;const r=s.map(([a,o])=>({name:a,width:o.width,height:o.height}));if(n){const a=r.findIndex(o=>o.name===n);if(a>0){const[o]=r.splice(a,1);r.unshift(o)}}return r}const pO=1500;function mO({enabled:t,pollMs:n=pO}){const[s,r]=l.useState(0),a=l.useRef(void 0);return l.useEffect(()=>{if(!t)return;let o=!1;const i=async()=>{try{const d=await fetch("/api/simulator-status");if(!d.ok)return;const u=await d.json();if(o)return;const h=u.state,p=a.current;a.current=h,h==="app-launched"&&p!==void 0&&p!=="app-launched"&&r(f=>f+1)}catch{}};i();const c=window.setInterval(i,n);return()=>{o=!0,window.clearInterval(c)}},[t,n]),s}function fO({isInIframe:t,hydrated:n=!0,persistedPath:s,previewKind:r,resolvedViewport:a,selectedScenario:o}){l.useEffect(()=>{t||!n||fetch("/api/editor-preview-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:r==="blank"?null:r,path:s,scenarioSlug:(o==null?void 0:o.slug)??null,scenarioId:(o==null?void 0:o.id)??null,dimension:a.name,width:a.width,height:a.height})}).catch(()=>{})},[n,t,s,r,a.height,a.name,a.width,o==null?void 0:o.id,o==null?void 0:o.slug])}function gO({deviceLaunchGeneration:t=0,isInIframe:n,onActivated:s,previewKind:r,previewMedium:a,scenariosLoaded:o,selectedScenario:i,seedRetryToken:c=0}){const[d,u]=l.useState(!1),[h,p]=l.useState(null),[f,m]=l.useState(null);return l.useEffect(()=>{if(!o||n)return;if(Dw({isInIframe:n,previewKind:r,previewMedium:a,selectedScenario:i})){fetch("/api/editor-deactivate-scenario",{method:"POST"}).catch(()=>{});return}if(!i||i.scenarioType!=="application")return;let g=!1;return u(!0),p(null),m(null),fetch("/api/editor-activate-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:i.slug})}).then(async b=>{const x=await b.json().catch(()=>null);if(!g){if(!x||x.success===!1||x.seedError||x.deviceSeedError){p(x&&(x.seedError||x.deviceSeedError||x.error)||"scenario activation failed"),x!=null&&x.seedError?m("seed"):x!=null&&x.deviceSeedError||x!=null&&x.error?m("device"):m(null);return}s()}}).catch(b=>{g||(p(b instanceof Error?b.message:String(b)),m(null))}).finally(()=>{g||u(!1)}),()=>{g=!0}},[t,c,n,s,r,a,o,i==null?void 0:i.componentName,i==null?void 0:i.scenarioType,i==null?void 0:i.slug]),{seeding:d,seedError:h,seedErrorKind:f}}const bO=3;function xO({apps:t,appRouteEntities:n,configLoaded:s,defaultScreenSize:r,hydrated:a=!0,port:o,previewMedium:i,previewOrigin:c,projectTitle:d,previewSlug:u,routeEntities:h,scenarioGroups:p,scenariosLoaded:f,screenSizes:m,selectedApp:g,selectedRouteEntity:b,setPreviewSlug:x}){const[y,v]=l.useState(r??"Desktop"),w=l.useRef(!1),[j,_]=l.useState(null),[k,S]=l.useState(null),[N,T]=l.useState(null),[A,M]=l.useState(null),[C,H]=l.useState(()=>Date.now()),[J,Z]=l.useState(0),F=l.useRef(null),$=l.useRef(!1),P=l.useMemo(()=>hO(m,r),[r,m]);l.useEffect(()=>{w.current||r&&(v(r),w.current=!0)},[r]);const I=l.useMemo(()=>j!==null&&k!==null?{name:"Custom",width:j,height:k}:P.find(re=>re.name===y)??P[0]??{name:"Desktop",width:1440,height:900},[y,k,j,P]),B=wt(),X=d==="CodeYam Editor",{basePreviewUrl:W,fallbackPreviewPath:ie,previewRouteEntities:Q,resolvedPreviewKind:O,selectedScenario:L}=l.useMemo(()=>lO({apps:t,appRouteEntities:n,directPreviewPath:N,fallbackPort:o,previewKind:A,previewOrigin:c,previewSlug:u,routeEntities:h,scenarioGroups:p,selectedApp:g,selectedRouteEntity:b}),[t,n,N,o,A,c,u,h,p,g,b]),q=l.useMemo(()=>W?iO(W,C):"",[W,C]),le=l.useCallback(re=>{v(re),_(null),S(null)},[]),de=l.useCallback((re,U)=>{_(re),S(U)},[]),ee=l.useCallback(re=>{x(re),T(null),M(null),H(Date.now());const U=Po(re,p);if(!U)return;const we=dO(y,j,k,U,P);we!==null&&(v(we),_(null),S(null))},[y,k,j,p,x,P]),D=l.useCallback((re,U)=>{const we=(U==null?void 0:U.retriesLeft)??bO,_e=cO({allowEditorRoutePreview:X,command:re,configLoaded:s,previewRouteEntities:Q,scenarioGroups:p,scenarioDeferAvailable:we>0});if(_e.viewportName&&v(_e.viewportName),_e.clearCustomSize&&(_(null),S(null)),_e.type==="show-scenario"){ee(_e.scenarioSlug),Z(Se=>Se+1);return}if(_e.type==="defer"){F.current={command:re,retriesLeft:we};return}if(_e.type==="refresh"){H(Date.now()),Z(Se=>Se+1);return}_e.type!=="ignore"&&(_e.type==="show-path"&&(M(_e.previewKind),T(_e.path),$.current=_e.preserveDirectPreviewPathOnSlugChange,typeof _e.previewSlug=="string"?x(_e.previewSlug):_e.previewSlug===null&&x(null)),H(Date.now()),Z(Se=>Se+1))},[s,X,Q,p,x,ee]);l.useEffect(()=>{if(!s)return;const re=F.current;re&&(F.current=null,D(re.command,{retriesLeft:re.retriesLeft-1}))},[s,p,D]),l.useEffect(()=>{if(!(!u||N===null)){if($.current){$.current=!1;return}T(null),M(null),H(Date.now())}},[N,u]);const z=l.useMemo(()=>O==="results"||O==="plan-preview"?N:O==="application"?N??(L==null?void 0:L.url)??ie:null,[N,ie,O,L==null?void 0:L.url]),K=l.useCallback(()=>{H(Date.now())},[]),[ue,ye]=l.useState(0),je=l.useCallback(()=>{ye(re=>re+1)},[]);fO({isInIframe:B,hydrated:a,persistedPath:z,previewKind:O,resolvedViewport:I,selectedScenario:L?{id:L.id??null,slug:L.slug}:null});const te=mO({enabled:i==="simulator-ios"||i==="simulator-android"}),{seeding:oe,seedError:he,seedErrorKind:G}=gO({deviceLaunchGeneration:te,seedRetryToken:ue,isInIframe:B,onActivated:K,previewKind:O,previewMedium:i,scenariosLoaded:f,selectedScenario:L?{slug:L.slug,scenarioType:L.scenarioType,componentName:L.componentName??null}:null}),ne=l.useCallback(re=>{T(re),M(re?"application":null),H(Date.now())},[]);return{viewports:P,resolvedViewport:I,previewUrl:q,handleViewportChange:le,handleCustomSizeChange:de,showScenarioPreview:ee,handlePreviewCommand:D,setPreviewPath:ne,previewSeeding:oe,previewSeedError:he,previewSeedErrorKind:G,retrySeed:je,commandNonce:J}}function yO({isInIframe:t,scenariosLoaded:n,restoredRef:s,onAdopt:r,onHydrated:a,onSettledEmpty:o}){const i=l.useRef(!1),c=l.useRef(!1),d=l.useRef(null),u=l.useRef(n);u.current=n;const h=l.useRef(r),p=l.useRef(a),f=l.useRef(o);h.current=r,p.current=a,f.current=o;const m=l.useCallback(()=>{if(c.current||!u.current||s.current)return;const g=d.current;g&&(c.current=!0,s.current=!0,h.current(g))},[s]);l.useEffect(()=>{t||i.current||(i.current=!0,fetch("/api/editor-preview-state").then(g=>g.json()).then(g=>{g&&(g.scenarioSlug||g.path)&&(d.current=g,m())}).catch(()=>{}).finally(()=>{var g;p.current(),!c.current&&!d.current&&((g=f.current)==null||g.call(f))}))},[t,m]),l.useEffect(()=>{m()},[n,m])}function vO({isInIframe:t,onConverge:n}){const s=l.useRef(n);s.current=n,l.useEffect(()=>{if(!t)return XP(()=>{fetch("/api/editor-preview-state").then(r=>r.json()).then(r=>{r&&(r.scenarioSlug||r.path)&&s.current(r)}).catch(()=>{}).finally(()=>{Do()})})},[t])}function jO({restoredRef:t,initiallySettled:n=!1,apply:s}){const r=l.useRef(n),a=l.useRef(null),o=l.useRef(s);o.current=s;const i=l.useCallback(u=>{t.current||(u.scenarioSlug||u.path)&&(t.current=!0,o.current(u))},[t]),c=l.useCallback(u=>{if(!t.current){if(!r.current){a.current=u;return}i(u)}},[i,t]),d=l.useCallback(()=>{r.current=!0;const u=a.current;a.current=null,u&&i(u)},[i]);return{requestRestore:c,onAdoptSettledEmpty:d}}function wO(t,{handlePreviewCommand:n,handleCustomSizeChange:s}){!t.scenarioSlug&&!t.path||(n({...t.scenarioSlug?{scenarioSlug:t.scenarioSlug}:{},...t.path?{path:t.path}:{},...t.dimension?{dimension:t.dimension}:{}}),t.dimension==="Custom"&&typeof t.width=="number"&&typeof t.height=="number"&&s(t.width,t.height))}function _O(){const[t,n]=l.useState(!1),s=l.useCallback(()=>{n(!0)},[]),r=l.useCallback(()=>{},[]),a=l.useCallback(()=>{},[]),o=l.useCallback(()=>{n(!1)},[]);return{showPostPushModal:t,onFeatureCompleteCommand:s,onAgentIdle:r,onAgentActive:a,dismissModal:o}}function a0(t){return t===null||t.slug===null||t.slug==="feature-complete"}function kO({showPostPushModal:t,stepState:n,dismissModal:s}){const r=l.useRef(!1);l.useEffect(()=>{if(!t){r.current=!1;return}if(a0(n)){r.current=!0;return}r.current&&(n==null?void 0:n.slug)!=null&&(s(),r.current=!1)},[t,n,s])}function SO(){const[t,n]=l.useState(!1),s=l.useCallback(()=>{n(!0)},[]),r=l.useCallback(()=>{n(!1)},[]);return{showPlanCompleteModal:t,onPlanCompleteCommand:s,dismissPlanCompleteModal:r}}function NO({plans:t,completedPlans:n,isAgentBuilding:s,onLaunch:r}){const{claims:a}=Ki(),{status:o}=Ji(),i=((o==null?void 0:o.consecutiveFailures)??0)>=3,c=l.useMemo(()=>Qi(a),[a]),{annotationsBySlug:d,dependenciesBySlug:u}=Zi(t),h=l.useMemo(()=>qb([...t.map(m=>m.author),...n.map(m=>m.author)]),[t,n]),{requestRun:p,gateModals:f}=Zr({dependenciesBySlug:u,claimsBySlug:c,isAgentBuilding:s,onLaunch:r});return{claimsBySlug:c,staleFetch:i,annotationsBySlug:d,dependenciesBySlug:u,showAuthors:h,requestRun:p,gateModals:f}}function CO(){const{showBuildTab:t}=nl(typeof window>"u"?"/":window.location.pathname),{config:n}=_t(),[s,r]=l.useState(!1),[a,o]=l.useState(null),i=l.useCallback(async c=>{if(s)return!1;o(null),r(!0);try{try{await el()}catch{}const d=await fetch("/api/build/start-from-prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c})});if(!d.ok){let u=`HTTP ${d.status}`;try{const h=await d.json();h!=null&&h.error&&(u=h.error)}catch{}throw new Error(u)}return t(),await tl({provider:n==null?void 0:n.provider}),!0}catch(d){return o(d instanceof Error?d.message:"Failed to launch build"),!1}finally{r(!1)}},[s,t,n==null?void 0:n.provider]);return{launching:s,error:a,launchPrompt:i}}function PO({onTransitionToLive:t}){const[n,s]=l.useState(!1),[r,a]=l.useState(null),o=l.useRef(!1),i=l.useRef(null),c=l.useRef(t);c.current=t;const d=l.useCallback(()=>{o.current=!0,s(!0)},[]),u=l.useCallback(()=>{o.current=!1,s(!1);const m=i.current;m&&(i.current=null,a(null),c.current(m))},[]),h=l.useCallback(m=>o.current?(i.current=m,a(m),!0):!1,[]),p=l.useCallback(()=>{i.current=null,a(null)},[]),f=l.useCallback(()=>{o.current=!1,s(!1),i.current=null,a(null)},[]);return{isAgentBuilding:n,isAgentBuildingRef:o,buildingScenarioSlug:r,onAgentIdle:u,onAgentActive:d,guardScenarioSelect:h,clearBuildingOverlay:p,forceIdle:f}}function TO({chatOpen:t}){const[n,s]=l.useState(!1),[r,a]=l.useState(!1);return l.useEffect(()=>{function o(d){const u=d.detail;return(u==null?void 0:u.chatName)==="plan"}function i(d){o(d)&&(s(!0),a(!1))}function c(d){o(d)&&(s(!1),a(!0))}return window.addEventListener("miniagent-agent-active",i),window.addEventListener("miniagent-agent-idle",c),()=>{window.removeEventListener("miniagent-agent-active",i),window.removeEventListener("miniagent-agent-idle",c)}},[]),l.useEffect(()=>{t||(s(!1),a(!1))},[t]),{planActive:n,planIdle:r}}function OO(t,n,s){return t.map(r=>{const a=Qj(n,r.dir),o=Zj(s,r.dir,r.type),{total:i,passed:c,failed:d,ignored:u,discovered:h}=e0(a),p=zT(o);return{app:r,tests:{total:i,passed:c,failed:d,ignored:u,discovered:h},scenarios:{total:p,thumbnails:AO(o)}}})}function AO(t){const n=[];for(const s of t)for(const r of s.scenarios)if(r.screenshotPaths.length>0&&n.push({path:r.screenshotPaths[0],cacheBuster:r.screenshotCapturedAtMs}),n.length>=6)return n;return n}function RO(t,n){return t==null?null:Math.min(1,Math.max(.04,t/Ni(n)))}function EO(t,n){return t==null||t===0?null:`${t}/${Ni(n)}`}function MO(t,n){var r;if(n==null||!Number.isFinite(n))return null;let s=null;for(const a of t??[]){const o=(r=a.screenshotPaths)==null?void 0:r[0];if(!o)continue;const i=a.screenshotCapturedAtMs;i==null||i<n||(!s||i>s.at)&&(s={path:o,at:i})}return(s==null?void 0:s.path)??null}const IO="Your app will display here once set up.",DO="Loading your app…",LO="Setting up your project…",FO="Select a scenario to preview",zO="No preview is available for this project.";function $O({configLoading:t,hasNoApps:n,hasStepState:s,hasPreviewableApp:r,setupInProgress:a,hasCaptureFrame:o}){return t?DO:a&&!o?LO:n&&!s?IO:r?FO:zO}const BO=["web","mobile"];function qO(t){return BO.includes(t)}function HO(t,n){return n?{scenarioSlug:t,path:n}:{scenarioSlug:t}}function WO(t,n){return t==="needs-login"&&!n}function GO(t,n){if(!t)return null;for(const s of n)for(const r of s.scenarios)if(r.name===t)return r;return null}const UO="The app is being edited",YO="Live preview will load when the build agent is idle",VO="Showing a saved version",KO="This is a past version of this scenario";function JO({shot:t,isLatest:n,liveScenario:s,isAgentBuilding:r}){if(n&&s&&!r)return{kind:"live",slug:s.slug};const[a,o]=r?[UO,YO]:[VO,KO];return{kind:"historical",screenshotPath:t.screenshotPath??null,scenarioName:t.name,heading:a,subtext:o}}function o0(t){return!t.hasActiveSession&&!t.isAgentBuilding&&!t.showPostPushModal&&t.launchingPlanSlug===null&&!t.submittingBuildPrompt&&!t.stepStateFeature&&!t.buildLaunchModalDismissed}function XO(t){return t.activeTab==="build"&&o0(t)}const QO=900*1e3;function ZO(){const[t,n]=l.useState(null),s=l.useCallback(async()=>{try{const r=await fetch("/api/server/update-check");if(!r.ok)return;const a=await r.json();n(a)}catch{}},[]);return l.useEffect(()=>{s()},[s]),l.useEffect(()=>{const r=setInterval(()=>void s(),QO);return()=>clearInterval(r)},[s]),{update:t}}function e6(t,n,s){const[r,a]=l.useState(!1),o=l.useCallback(()=>{a(!0)},[]),i=l.useCallback(c=>{a(!1),n(c)},[n]);return l.useEffect(()=>{r&&(t||(a(!1),s==null||s(),n("build")))},[r,t,n,s]),{arm:o,navigateToTabUser:i,pendingBuildNav:r}}const t6=4e3,n6=2;function i0({state:t,provider:n,credsPresent:s=!0,cliInstalled:r=!0,scannedDirs:a=[],reason:o=null,expiresAt:i=null,probeInFlight:c=!1,probeAttempts:d=0,backendOutOfDate:u=!1,sessionOngoing:h=!1,onAuthenticated:p,onAuthorized:f}){const[m,g]=l.useState(!1),[b,x]=l.useState(!1),y=at(n),[v,w]=l.useState(!1);l.useEffect(()=>{if(t!=="unknown"){w(!1);return}const S=window.setTimeout(()=>w(!0),t6);return()=>window.clearTimeout(S)},[t]);const j=l.useCallback(()=>{g(!1),p(),f==null||f()},[p,f]),_=l.useCallback(async()=>{x(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),p()}catch{}finally{x(!1)}},[p]);if(t==="authenticated")return null;const k=m?e.jsx(a_,{provider:n,onAuthenticated:j,onClose:()=>g(!1)}):null;if(t==="unknown"){const S=o==="probe-timeout"&&d>=n6,N=r===!1||o==="cli-not-found";return!S&&!N&&(c||!v)||u?null:N?e.jsxs("div",{"data-testid":"provider-auth-cli-not-found","data-auth-card":!0,className:"m-4 rounded-lg border border-[#3A3A3A] bg-[#1E1E1E] p-5 space-y-3",children:[e.jsxs("p",{className:"text-sm text-white font-medium",children:[y," CLI not found"]}),e.jsxs("p",{className:"text-sm text-[#8E8E8E]",children:["We couldn't find the ",y," CLI on this machine — we searched your PATH and the standard install locations",a.length>0?e.jsxs(e.Fragment,{children:[" (",a.join(", "),")"]}):e.jsx(e.Fragment,{children:" (~/.local/bin, ~/.cargo/bin, /opt/homebrew/bin, /usr/local/bin)"}),". Install the ",y," CLI, or add the directory it lives in to your PATH, then recheck. This is a PATH/install problem — re-authenticating won't fix it."]}),e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:e.jsx("button",{onClick:()=>void _(),"data-testid":"provider-auth-cli-not-found-recheck",disabled:b,className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:b?"Rechecking…":"Recheck after installing"})})]}):e.jsxs("div",{"data-testid":"provider-auth-checking","data-auth-card":!0,className:"m-4 rounded-lg border border-[#3A3A3A] bg-[#1E1E1E] p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{"data-testid":"provider-auth-checking-spinner","aria-hidden":"true",className:"h-4 w-4 rounded-full border-2 border-[#8E8E8E] border-t-transparent animate-spin"}),e.jsxs("p",{className:"text-sm text-[#8E8E8E]",children:["Checking your ",y," account… If this takes more than a few seconds, your token may need refresh."]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("button",{onClick:()=>g(!0),"data-testid":"provider-auth-checking-retry",className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Authenticate"}),e.jsx("button",{onClick:()=>void _(),"data-testid":"provider-auth-checking-recheck",disabled:b,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:b?"Rechecking…":"Already logged in? Recheck"})]}),k]})}return e.jsx(r_,{provider:n,credsPresent:s,reason:o,expiresAt:i,sessionOngoing:h,onAuthenticated:p,onAuthorized:f})}const W9=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthGate:i0},Symbol.toStringTag,{value:"Module"}));function l0({update:t}){const{copied:n,copy:s}=Fo();if(!t||!t.available)return null;const r=t.channel==="desktop";return e.jsx("div",{className:"rounded-lg p-4","data-testid":"update-available-banner",role:"status",style:{background:"rgba(91, 155, 213, 0.16)",border:"1px solid rgba(91, 155, 213, 0.55)",borderLeft:"4px solid var(--blue-300)",boxShadow:"0 2px 10px rgba(91, 155, 213, 0.18)"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-xl leading-none mt-0.5","aria-hidden":"true",style:{color:"var(--blue-300)"},children:"↑"}),e.jsxs("div",{className:"flex-1 min-w-0 text-sm",style:{color:"var(--text-body)"},children:[e.jsx("div",{className:"font-semibold mb-1",style:{color:"var(--blue-300)"},children:r?"Update ready":"Update available"}),r?e.jsx(e.Fragment,{children:"It will install automatically after your current session ends. To install now, use the Check for Updates menu."}):e.jsxs(e.Fragment,{children:["A new version of CodeYam Editor is available (",e.jsxs("span",{style:{color:"var(--text-strong)",fontWeight:600},children:[t.currentVersion," → ",t.latestVersion]}),"). Run"," ",e.jsx("code",{className:"text-xs",style:{color:"var(--text-strong)"},children:t.upgradeCommand})," ","to upgrade."," ",e.jsx("button",{type:"button",className:"mt-2 inline-block rounded px-2.5 py-1 text-xs font-medium",style:{background:"var(--blue-300)",color:"#0b1220"},onClick:()=>void s(t.upgradeCommand??""),children:n?"Copied":"Copy command"})]})]})]})})}const G9=Object.freeze(Object.defineProperty({__proto__:null,UpdateAvailableBanner:l0},Symbol.toStringTag,{value:"Module"})),s6=300,hd=150;function r6(t){const[n,s]=l.useState(null),r=l.useRef(!1),[a,o]=l.useState(!1),i=l.useCallback(()=>{var u;return((u=t.current)==null?void 0:u.clientWidth)??1200},[t]),c=n??Math.floor(i()/2),d=l.useCallback(u=>{u.preventDefault(),r.current=!0,o(!0)},[]);return l.useEffect(()=>{const u=p=>{var b;if(!r.current)return;const f=((b=t.current)==null?void 0:b.getBoundingClientRect().left)??0,m=p.clientX-f,g=i();m<hd?s(0):m>g-hd?s(g):s(Math.max(s6,m))},h=()=>{r.current&&(r.current=!1,o(!1))};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",h)}},[t,i]),{leftWidth:c,isDragging:a,handleMouseDown:d}}const a6=3e3;function o6({hot:t,isInIframe:n,reload:s=()=>window.location.reload(),sustainedDisconnectMs:r=a6}){return()=>{}}function i6(){l.useEffect(()=>o6({hot:void 0,isInIframe:wt()}),[])}const l6=5e3;function pd(t){return new Promise(n=>{let s=!1;const r=()=>{s||(s=!0,window.removeEventListener("miniagent-agent-idle",a),clearTimeout(o),n())},a=i=>{const c=i.detail;(c==null?void 0:c.chatName)==="plan"&&r()},o=setTimeout(r,t);window.addEventListener("miniagent-agent-idle",a)})}function c6(t){return o_()?Promise.resolve():new Promise(n=>{let s=!1;const r=()=>{s||(s=!0,window.removeEventListener("miniagent-ws-open",r),clearTimeout(a),n())},a=setTimeout(r,t);window.addEventListener("miniagent-ws-open",r,{once:!0})})}async function md(){await c6(l6),hs("\x1B"),await pd(uo),hs("/clear\r"),await pd(uo),hs("/codeyam-plan\r")}function d6(){fetch("/api/clear-build-agent-session",{method:"POST"}).catch(()=>{})}function u6(t){const n=l.useRef(null),s=l.useRef(null);l.useEffect(()=>{if(typeof document>"u")return;s.current||(s.current=document.createElement("canvas"),s.current.width=64,s.current.height=64);const r=document.querySelector('link[rel="icon"]');if(!r){se("favicon-redraw",{idle:t,hasIcon:!1});return}if(n.current||(n.current=r.href),!t){r.href=n.current,se("favicon-restore",{});return}se("favicon-redraw",{idle:!0,hasIcon:!0});const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const o=s.current,i=o.getContext("2d");i.clearRect(0,0,64,64);const c=56,d=(64-c)/2;i.drawImage(a,d,d,c,c);const u=12,h=64-u-1,p=u+1;i.beginPath(),i.arc(h,p,u,0,2*Math.PI),i.fillStyle="#ef4444",i.fill(),r.href=o.toDataURL("image/png")},a.src=n.current},[t]),l.useEffect(()=>()=>{if(typeof document>"u")return;const r=document.querySelector('link[rel="icon"]');r&&n.current&&(r.href=n.current)},[])}const h6=120*1e3,c0=1500;class p6{constructor(n,s,r=se){At(this,"deferred",!1);At(this,"userActiveSinceLastOutput",!1);At(this,"lastActivitySource",null);At(this,"lastActivityAt",null);At(this,"lastNotificationTime",null);At(this,"actions");At(this,"env");At(this,"now");At(this,"log");this.actions=n,this.env=s,this.now=s.now??(()=>Date.now()),this.log=r}reportUserActivity(n){this.userActiveSinceLastOutput=!0,this.lastActivitySource=n,this.lastActivityAt=this.now()}resetActivityFlag(){this.userActiveSinceLastOutput=!1}onIdle(n,s){this.deferred=!1;const r=this.env.hasBrowserFocus(),a=this.lastNotificationTime===null?null:this.now()-this.lastNotificationTime,o=this.lastActivityAt===null?null:this.now()-this.lastActivityAt,i={buildTabActive:s,hasBrowserFocus:r,msSinceLastNotification:a,userActiveSinceLastOutput:this.userActiveSinceLastOutput,lastActivitySource:this.lastActivitySource,msSinceLastActivity:o},c=o!==null&&o<c0;if(s&&r&&c)return this.userActiveSinceLastOutput=!1,this.log("suppressed-user-active",i),"suppressed";if(a!==null&&a<h6)return this.log("cooldown",i),"cooldown";const d=this.notify(n);return this.log(d==="played"?"notify-played":"notify-played-no-sound",i),d}onBuildTabChange(n,s){return!n&&this.deferred?(this.deferred=!1,this.notify(s),!0):!1}onActive(){const n=this.deferred;this.deferred=!1,this.log("on-active",{hadDeferred:n}),this.actions.closeSystemNotification(),this.log("system-notification-closed-on-active",{hadDeferred:n})}onUserEngagement(){const n=this.deferred;return this.deferred=!1,n}get isDeferred(){return this.deferred}notify(n){const s=!!(n!=null&&n.sound)&&n.sound!=="off";s?(this.actions.playSound(n.sound),this.log("sound-played",{soundId:n.sound})):this.log("sound-skipped-off",{});const r=this.env.hasBrowserFocus(),a=typeof Notification<"u"?Notification.permission:"unknown";return!r&&(n!=null&&n.systemNotification)?this.env.hasNotificationPermission()?(this.actions.showSystemNotification(),this.log("system-notification-shown",{notificationPermission:a})):this.log("system-notification-skipped-no-permission",{notificationPermission:a}):r&&this.log("system-notification-skipped-focus",{notificationPermission:a}),this.lastNotificationTime=this.now(),s?"played":"played-no-sound"}}function m6(t,n){return new p6({playSound:Si,showSystemNotification:()=>{if(typeof Notification>"u"||Notification.permission!=="granted")return;n.current&&n.current.close();const s=t.current,r=new Notification(`${s} is ready for you`,{body:`${s} has finished and is waiting for your input.`,tag:"build-agent-idle"});r.onclick=()=>{window.focus(),r.close(),n.current=null},n.current=r},closeSystemNotification:()=>{typeof Notification>"u"||n.current&&(n.current.close(),n.current=null)}},{hasBrowserFocus:()=>document.hasFocus(),hasNotificationPermission:()=>typeof Notification<"u"&&Notification.permission==="granted"})}function f6(t,n){return t==="hook-stop"?n.idleOnStop:n.idleOnNotification}const g6=600*1e3,b6=3e3;function x6({agentName:t,isBuildTabActive:n,isAgentBuilding:s,buildSessionLive:r,featureCompleteKey:a,navigateToTab:o,onAgentIdleImmediate:i,onAgentActiveImmediate:c}){const d=l.useRef(t);d.current=t;const u=l.useRef(n);u.current=n;const h=l.useRef(i);h.current=i;const p=l.useRef(c);p.current=c;const[f,m]=l.useState(Km),[g,b]=l.useState(!1),x=l.useRef(!1);x.current=g;const y=l.useRef(!1),v=l.useRef(null),w=l.useRef(null),j=l.useRef(null),_=l.useRef(typeof document<"u"&&document.hidden?Date.now():null),k=l.useRef(null),S=l.useRef(r??!1);S.current=r??!1,u6(g),j.current||(j.current=m6(d,w));const N=l.useCallback(P=>{m(P),Jm(P)},[]),T=l.useCallback(P=>{v.current!==null&&(clearTimeout(v.current),v.current=null,se("debounce-cancelled",{trigger:P}))},[]),A=l.useCallback(P=>{x.current&&se("idle-cleared",{trigger:P}),b(!1),x.current=!1,k.current=null,w.current&&(w.current.close(),w.current=null)},[]),M=l.useCallback(P=>{var I;if(!f6(P,f)){se("idle-suppressed-by-pref",{source:P});return}se("ws-idle-received",{buildTabActive:u.current,source:P}),(I=h.current)==null||I.call(h),T("re-arm-on-idle"),v.current=setTimeout(()=>{var ie;v.current=null;const B=_.current,X=B===null?null:Date.now()-B,W=B!==null&&Date.now()-B>g6;se("debounce-resolved",{suppressedForOvernight:W,msHidden:X,buildTabActive:u.current}),W||(ie=j.current)==null||ie.onIdle(f,u.current),b(!0),x.current=!0,k.current=Date.now(),y.current=!1,se("agent-currently-idle-set",{suppressedForOvernight:W}),u.current&<()},c0)},[f,T]),C=l.useCallback(()=>{var P,I,B;(P=p.current)==null||P.call(p),T("agent-active"),(I=j.current)==null||I.onActive(),(B=j.current)==null||B.resetActivityFlag(),x.current&&S.current&&k.current!==null&&Date.now()-k.current>b6&&A("remote-resume")},[T,A]),H=l.useCallback(()=>{var P,I;T("user-input"),x.current&&((P=j.current)==null||P.onUserEngagement(),(I=j.current)==null||I.reportUserActivity("terminal-input"),y.current=!0,A("user-input"))},[T,A]),J=l.useCallback(P=>{var I;P==="build"&&(T("navigate-build"),x.current&&((I=j.current)==null||I.onUserEngagement(),y.current=!0,A("navigate-build"))),o(P)},[o,T,A]),Z=l.useCallback(()=>{var P;T("dismiss-banner"),(P=j.current)==null||P.onUserEngagement(),y.current=!0,A("dismiss-banner")},[T,A]),F=l.useCallback(()=>{var P;T("stop-building"),(P=j.current)==null||P.onUserEngagement(),y.current=!0,A("stop-building")},[T,A]);l.useEffect(()=>{function P(){var L;x.current&&(y.current||(T("ack-notification"),(L=j.current)==null||L.onUserEngagement(),y.current=!0,se("notification-acknowledged",{trigger:"user-return"})))}function I(L){var q;x.current&&u.current&&document.hasFocus()&&(document.hidden||((q=j.current)==null||q.onUserEngagement(),y.current=!0,A(L)))}function B(L){var q;document.hasFocus()&&P(),(q=j.current)==null||q.reportUserActivity(L)}const X=()=>B("mousemove"),W=()=>B("mousedown"),ie=()=>B("keydown");function Q(){document.hidden?_.current===null&&(_.current=Date.now()):(_.current=null,P(),I("tab-visible-on-build"))}function O(){var L;P(),I("window-focus-on-build"),(L=j.current)==null||L.reportUserActivity("focus")}return window.addEventListener("focus",O),document.addEventListener("visibilitychange",Q),document.addEventListener("mousemove",X),document.addEventListener("mousedown",W),document.addEventListener("keydown",ie),()=>{T("unmount"),window.removeEventListener("focus",O),document.removeEventListener("visibilitychange",Q),document.removeEventListener("mousemove",X),document.removeEventListener("mousedown",W),document.removeEventListener("keydown",ie)}},[T,A]);const $=l.useRef(a??0);return l.useEffect(()=>{var B;const P=a??0;if(P===$.current)return;$.current=P;const I=u.current&&document.hasFocus();se("feature-complete-fast-path",{skipBecauseWatching:I}),!I&&((B=j.current)==null||B.onIdle(f,!1),b(!0),x.current=!0,k.current=Date.now(),y.current=!1)},[a,f]),l.useEffect(()=>{var P,I;if((P=j.current)==null||P.onBuildTabChange(n,f),n)return x.current&&typeof document<"u"&&document.hasFocus()&&!document.hidden&&((I=j.current)==null||I.onUserEngagement(),y.current=!0,A("build-tab-active-on-focus")),lt()},[n,f,A]),{buildIdle:g,bannerVisible:g,notifSettings:f,handleSettingsChange:N,handleAgentIdle:M,handleAgentActive:C,handleUserInput:H,handleNavigateToTab:J,dismissIdleBanner:Z,clearIdleForStopBuilding:F}}const y6=1e4;function v6(t){const{isAgentBuilding:n,submittingBuildPrompt:s,launchingPlanSlug:r,sessionInfo:a,stepFeature:o,refetchSessionInfo:i}=t,[c,d]=l.useState(!1),u=l.useRef(!1),h=l.useCallback((f,m)=>{u.current!==f&&(se("build-session-live-change",{from:u.current,to:f,trigger:m}),u.current=f,d(f))},[]);return l.useEffect(()=>{n&&h(!0,"agent-active")},[n,h]),l.useEffect(()=>{s&&h(!0,"launch-prompt")},[s,h]),l.useEffect(()=>{r!==null&&h(!0,"launch-plan")},[r,h]),l.useEffect(()=>{((a==null?void 0:a.resumeMode)==="resume"||(a==null?void 0:a.resumeMode)==="handoff")&&h(!0,"resumable-session-detected")},[a,h]),l.useEffect(()=>{(a==null?void 0:a.agentBrokerLive)===!0&&h(!0,"broker-live-detected")},[a,h]),l.useEffect(()=>{a&&!a.hasSession&&!a.agentBrokerLive&&h(!1,"session-ended")},[a,h]),l.useEffect(()=>{if(!c)return;const f=setInterval(()=>{i()},y6);return()=>clearInterval(f)},[c,i]),{buildSessionLive:c,agentActivelyBuilding:c&&(!!o||n||s||r!==null),transitionBuildSessionLive:h}}function fd(t){const{isAgentBuilding:n,trigger:s,transitionBuildSessionLive:r}=t;if(n){se("build-session-live-suppress-clear",{trigger:s,reason:"agent-still-active"});return}r(!1,s)}const j6=new Set(["ui-confirm-plan","backend-confirm-plan","present-live","backend-confirm","ui-present","backend-review"]);function w6(t,n){return t&&j6.has(t)?"needs-input":n?"waiting":"building"}function _6(){const[t,n]=l.useState({loading:!1,error:null,downloaded:!1}),s=l.useCallback(async a=>{n({loading:!0,error:null,downloaded:!1});try{const i=await(await fetch("/api/editor-transcript-package")).json();if(!i.success){n({loading:!1,error:i.error||"Failed to package transcript",downloaded:!1});return}let c=i.content;a!=null&&a.trim()&&(c=`## User Notes
|
|
250
|
+
|
|
251
|
+
${a.trim()}
|
|
252
|
+
|
|
253
|
+
${c}`);const d=new Blob([c],{type:"text/markdown"}),u=URL.createObjectURL(d),h=document.createElement("a");h.href=u,h.download=i.filename,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(u),n({loading:!1,error:null,downloaded:!0})}catch(o){n({loading:!1,error:o instanceof Error?o.message:"Network error",downloaded:!1})}},[]),r=l.useCallback(()=>{n({loading:!1,error:null,downloaded:!1})},[]);return{...t,sendTranscript:s,reset:r}}function k6(t,n){var o;const s="feedback@codeyam.com",r=encodeURIComponent(`CodeYam Session Feedback: ${t||"Session"}`+(n!=null&&n.category?` [${n.category}]`:"")),a=encodeURIComponent([((o=n==null?void 0:n.note)==null?void 0:o.trim())||"(no note)","","(Please attach the downloaded transcript file.)"].join(`
|
|
254
|
+
|
|
255
|
+
`));return`mailto:${s}?subject=${r}&body=${a}`}const S6=["bug","suggestion","question","praise"];function d0({featureName:t,onClose:n}){const[s,r]=l.useState(""),[a,o]=l.useState(null),[i,c]=l.useState(!1),{loading:d,error:u,downloaded:h,sendTranscript:p}=_6(),f=l.useCallback(()=>{p(s)},[p,s]),m=l.useCallback(()=>{navigator.clipboard.writeText("feedback@codeyam.com").then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[]),g=l.useCallback(b=>{o(x=>x===b?null:b)},[]);return e.jsxs("div",{className:"max-w-md w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:"Send Session Transcript"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:"Download your session transcript and send it to the CodeYam team for feedback or debugging."}),e.jsxs("div",{className:"mb-3",children:[e.jsx("span",{className:"block text-xs text-[var(--text-muted)] mb-1.5",children:"Tag (optional)"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:S6.map(b=>{const x=a===b;return e.jsx("button",{type:"button","aria-pressed":x,onClick:()=>g(b),className:"px-2.5 py-1 rounded-full text-xs transition cursor-pointer",style:{background:x?"var(--accent-active)":"transparent",color:x?"var(--bg-deep)":"var(--text-secondary)",border:"1px solid var(--border-default)"},children:b},b)})})]}),e.jsx("textarea",{value:s,onChange:b=>r(b.target.value),placeholder:"What's on your mind? (optional)",className:"w-full h-20 px-3 py-2 text-sm rounded-md mb-4 resize-none",style:{background:"var(--bg-input, var(--bg-deep))",color:"var(--text-primary)",border:"1px solid var(--border-default)"}}),u&&e.jsx(Qe,{text:u,className:"text-sm text-red-400",rowClassName:"mb-3"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[h?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-green-400 text-center",children:"Transcript downloaded!"}),e.jsx("a",{href:k6(t,{note:s,category:a}),className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition text-center block",style:{background:"var(--accent-active)",color:"var(--bg-deep)"},children:"Open Email Client"}),e.jsx("button",{onClick:m,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},type:"button",children:i?"Copied!":"Copy Email Address"}),e.jsx("p",{className:"text-xs text-[var(--text-dim)] text-center",children:"Attach the downloaded file to your email"})]}):e.jsx("button",{onClick:f,disabled:d,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"var(--accent-active)",color:"var(--bg-deep)",opacity:d?.6:1},type:"button",children:d?"Packaging transcript...":"Download Transcript"}),e.jsx("button",{onClick:n,className:"w-full px-4 py-2.5 rounded-md text-sm font-medium transition",style:{background:"transparent",color:"var(--text-secondary)",border:h?"none":"1px solid var(--border-default)"},type:"button",children:h?"Done":"Cancel"})]})]})}const U9=Object.freeze(Object.defineProperty({__proto__:null,SendTranscriptModal:d0},Symbol.toStringTag,{value:"Module"}));function u0({sha:t,onClick:n}){if(!t)return null;const s=t.slice(0,6),r="font-mono text-[11px] leading-none px-1.5 py-0.5 rounded border border-white/5 bg-black/55 backdrop-blur-sm hover:bg-black/75";return e.jsx("div",{className:`fixed bottom-1 left-1 z-30 ${n?"":"pointer-events-none"}`,style:{paddingBottom:"env(safe-area-inset-bottom)"},children:n?e.jsx("button",{type:"button",onClick:n,"data-testid":"build-sha-badge",title:t,"aria-label":`Build commit ${t}`,className:`cursor-pointer ${r}`,style:{color:"var(--text-secondary)"},children:s}):e.jsx("span",{"data-testid":"build-sha-badge",title:t,"aria-label":`Build commit ${t}`,className:r,style:{color:"var(--text-secondary)"},children:s})})}const Y9=Object.freeze(Object.defineProperty({__proto__:null,BuildShaBadge:u0},Symbol.toStringTag,{value:"Module"}));function N6(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/raw-terminal`}function h0(){if(wt())return null;const t=l.useRef(null),n=l.useRef(null),s=l.useRef(null),r=l.useRef(null),a=l.useRef(!1),[o,i]=l.useState(!1),[c,d]=Ai(1200);function u(h){const p=r.current;(p==null?void 0:p.readyState)===WebSocket.OPEN&&p.send(new TextEncoder().encode(h))}return Oi(t,()=>{if(s.current&&n.current){s.current.fit();const h=r.current;(h==null?void 0:h.readyState)===WebSocket.OPEN&&h.send(JSON.stringify({type:"resize",cols:n.current.cols,rows:n.current.rows}))}}),l.useEffect(()=>{if(!t.current||a.current)return;a.current=!0;const h=new Ao.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', monospace",rightClickSelectsWord:!1,theme:{background:"#1e1e1e",foreground:"#cccccc",cursor:"#D7FF63",selectionBackground:"#264f78"}}),p=new Ro.FitAddon;h.loadAddon(p),h.open(t.current),n.current=h,s.current=p;const f=Eo(h,t.current,{onCopy:()=>d()}),m=Mo(h,{sendInput:u});requestAnimationFrame(()=>{p.fit(),h.focus()});const g=new WebSocket(N6());return r.current=g,g.binaryType="arraybuffer",g.onmessage=b=>{b.data instanceof ArrayBuffer&&h.write(new Uint8Array(b.data))},g.onopen=()=>{g.send(JSON.stringify({type:"resize",cols:h.cols,rows:h.rows}))},g.onclose=()=>{i(!0),h.writeln(`\r
|
|
256
|
+
\x1B[90m[Shell session ended]\x1B[0m`)},h.onData(u),()=>{var b;(b=r.current)==null||b.close(),m(),f(),h.dispose(),a.current=!1}},[]),e.jsxs("div",{className:"relative flex-1 flex flex-col",style:{minHeight:0},children:[e.jsx("div",{ref:t,className:"flex-1",style:{background:"#1e1e1e",minHeight:0,paddingTop:3,paddingLeft:3},onClick:()=>{var h;return(h=n.current)==null?void 0:h.focus()}}),o&&e.jsx("div",{role:"alert",className:"absolute bottom-2 left-2 rounded px-2 py-1 text-[11px]",style:{background:"var(--bg-card)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:"Shell disconnected — close and reopen for a fresh shell."}),c&&e.jsx(Ur,{})]})}const V9=Object.freeze(Object.defineProperty({__proto__:null,RawTerminalEmulator:h0},Symbol.toStringTag,{value:"Module"}));function p0({isOpen:t,onClose:n}){return l.useEffect(()=>{if(!t)return;const s=r=>{r.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,n]),t?e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"raw-terminal-modal-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onMouseDown:s=>{s.target===s.currentTarget&&n()},children:e.jsxs("div",{className:"flex flex-col rounded-lg shadow-xl",style:{width:"80vw",height:"80vh",maxWidth:1200,maxHeight:800,background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border-default)]",children:[e.jsx("h2",{id:"raw-terminal-modal-title",className:"text-sm font-semibold text-[var(--text-primary)] m-0",children:"Terminal"}),e.jsx("button",{type:"button",onClick:n,"data-testid":"raw-terminal-modal-close","aria-label":"Close terminal",className:"text-sm text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"✕"})]}),e.jsx("div",{className:"flex-1 flex flex-col",style:{minHeight:0},children:e.jsx(h0,{})})]})}):null}const K9=Object.freeze(Object.defineProperty({__proto__:null,RawTerminalModal:p0},Symbol.toStringTag,{value:"Module"}));function C6(){const[t,n]=l.useState(!1),[s,r]=l.useState(null),[a,o]=l.useState(null),i=l.useRef(0);l.useEffect(()=>{if(a===null)return;const f=window.setTimeout(()=>o(null),rg);return()=>window.clearTimeout(f)},[a]);const c=l.useRef(null),d=l.useCallback(()=>r(null),[]),u=l.useCallback(async f=>{if(f.length!==0){for(const m of f)if(m.size>fr){o(`${m.name} is larger than the ${fr/(1024*1024)} MB cap`);return}try{const m=await Promise.all(f.map(async y=>({filename:y.name||"unnamed",contentBase64:await ag(y)}))),g=await fetch("/api/editor-upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:m})});if(!g.ok){const y=await g.json().then(v=>v.error).catch(()=>null);throw new Error(y??`Upload failed: ${g.status}`)}const x=(await g.json()).written??[];if(x.length===0)throw new Error("Upload returned no saved files");r(x)}catch(m){o(m instanceof Error?m.message:String(m))}}},[]),h=l.useCallback(()=>{var f;(f=c.current)==null||f.click()},[]),p=l.useCallback(f=>{const m=f.target,g=Array.from(m.files??[]).filter(b=>b.size>0);m.value="",u(g)},[u]);return l.useEffect(()=>{const f=y=>{var v,w;return!!((w=(v=y.dataTransfer)==null?void 0:v.types)!=null&&w.includes("Files"))},m=y=>{f(y)&&(y.preventDefault(),i.current+=1,n(!0))},g=y=>{f(y)&&y.preventDefault()},b=y=>{f(y)&&(i.current=Math.max(0,i.current-1),i.current===0&&n(!1))},x=y=>{var w;if(!f(y))return;if(y.defaultPrevented){i.current=0,n(!1);return}if(y.preventDefault(),i.current=0,n(!1),y.dataTransfer&&ig(y.dataTransfer)){o("Folder drops are not supported — drag individual files instead");return}const v=Array.from(((w=y.dataTransfer)==null?void 0:w.files)??[]).filter(j=>j.size>0);u(v)};return window.addEventListener("dragenter",m),window.addEventListener("dragover",g),window.addEventListener("dragleave",b),window.addEventListener("drop",x),()=>{window.removeEventListener("dragenter",m),window.removeEventListener("dragover",g),window.removeEventListener("dragleave",b),window.removeEventListener("drop",x)}},[u]),{dragActive:t,pendingPaths:s,error:a,clearPending:d,openPicker:h,fileInputRef:c,handlePickerChange:p}}function m0({visible:t}){return t?e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)",pointerEvents:"none"},"data-testid":"global-file-drop-overlay","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 px-10 py-8 rounded-xl text-center",style:{border:"2px dashed var(--accent-active, #D7FF63)",background:"rgba(0, 0, 0, 0.30)"},children:[e.jsx("span",{className:"text-2xl font-semibold text-[var(--text-primary)]",children:"Drop files to add them to this session"}),e.jsx("span",{className:"text-sm text-[var(--text-muted)]",children:"Saved to .codeyam/uploads/ — then hand them to the agent"})]})}):null}const J9=Object.freeze(Object.defineProperty({__proto__:null,GlobalFileDropOverlay:m0},Symbol.toStringTag,{value:"Module"}));function f0({message:t}){return e.jsx("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-[80] px-4 py-2 rounded-md text-sm",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",color:"var(--text-danger, #ff6b6b)"},"data-testid":"global-file-drop-error",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:t}),e.jsx(Ze,{variant:"icon",text:t})]})})}const X9=Object.freeze(Object.defineProperty({__proto__:null,GlobalFileDropToast:f0},Symbol.toStringTag,{value:"Module"}));function g0({paths:t,onClose:n}){const{sendToAgent:s,agentReady:r}=bd(),[a,o]=l.useState(!1),i=l.useCallback(h=>{h.key==="Escape"&&(h.preventDefault(),n())},[n]);l.useEffect(()=>(window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)),[i]);const c=t.map(og).join(" "),d=l.useCallback(()=>{s(c+" ")&&n()},[s,c,n]),u=l.useCallback(()=>{var h;(h=navigator.clipboard)==null||h.writeText(c).then(()=>{o(!0),window.setTimeout(()=>o(!1),1500)},()=>{})},[c]);return e.jsx("div",{className:"fixed inset-0 z-[75] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},"data-testid":"file-drop-confirm-modal",children:e.jsxs("div",{className:"max-w-lg w-full mx-4 p-6 rounded-lg",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)] mb-2",children:t.length===1?"File added":`${t.length} files added`}),e.jsxs("p",{className:"text-sm text-[var(--text-muted)] mb-4",children:["Saved to your project. Hand the path",t.length===1?"":"s"," to the agent so it can read"," ",t.length===1?"it":"them","."]}),e.jsx("ul",{className:"mb-4 max-h-48 overflow-y-auto rounded-md p-3 text-xs font-mono",style:{background:"var(--bg-deep, #0e0e0e)",border:"1px solid var(--border-subtle)",color:"var(--text-primary)"},"data-testid":"file-drop-confirm-paths",children:t.map(h=>e.jsx("li",{className:"truncate py-0.5",children:h},h))}),!r&&e.jsx("p",{className:"mb-3 text-xs",style:{color:"var(--text-dim)"},"data-testid":"file-drop-confirm-no-agent-hint",children:"Start or focus a session to hand the file to the agent."}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:u,className:"px-4 py-2 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},"data-testid":"file-drop-confirm-copy",children:a?"Copied":"Copy path"}),e.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 rounded-md text-sm font-medium transition cursor-pointer",style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border-default)"},"data-testid":"file-drop-confirm-done",children:"Done"}),e.jsx("button",{type:"button",onClick:d,disabled:!r,className:"px-4 py-2 rounded-md text-sm font-medium transition cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",style:{background:"var(--accent-active, #D7FF63)",color:"var(--text-on-accent, #fff)",border:"1px solid transparent"},"data-testid":"file-drop-confirm-tell-agent",children:"Tell the agent"})]}),e.jsx("p",{className:"mt-3 text-center text-xs text-[var(--text-dim)]",children:"Escape closes · files stay in .codeyam/uploads/"})]})})}const Q9=Object.freeze(Object.defineProperty({__proto__:null,FileDropConfirmModal:g0},Symbol.toStringTag,{value:"Module"}));let Ma=null;function P6(t){if(typeof t!="object"||t===null)return null;const n=t.buildCommitSha;return typeof n!="string"||n===""||n==="unknown"?null:n}async function T6(){try{const t=await fetch("/api/health");return t.ok?P6(await t.json()):null}catch{return null}}function O6(){const[t,n]=l.useState(null);return l.useEffect(()=>{let s=!0;return Ma||(Ma=T6()),Ma.then(r=>{s&&n(r)}),()=>{s=!1}},[]),{sha:t}}function A6(){var Ll,Fl,zl;i6();const{sha:t}=O6(),n=f_(),{state:s,provider:r,credsPresent:a,cliInstalled:o,scannedDirs:i,reason:c,expiresAt:d,probeInFlight:u,probeAttempts:h,backendFieldAbsent:p,refresh:f}=i_(),{update:m}=ZO(),{sessionInfo:g,refetch:b}=Wi({pollIntervalMs:15e3}),x=(g==null?void 0:g.agentBrokerLive)??!1,y=WO(s,x),{activeTab:v,buildActivated:w,planActivated:j,navigateToTab:_,deactivateBuild:k}=nl(n,y,s==="needs-login"&&!x),[S,N]=l.useState(!1),T=l.useCallback(()=>{N(!0)},[]),{arm:A,navigateToTabUser:M}=e6(y,_,T),C=l.useCallback(()=>M("build"),[M]),[H,J]=l.useState(!1),[Z,F]=l.useState(!1),$=wt(),[P,I]=l.useState($),B=l.useRef(!1),X=l.useCallback(()=>I(!0),[]),[W,ie]=l.useState($),[Q,O]=l.useState(0),[L,q]=l.useState(0),[le,de]=l.useState(0),[ee,D]=l.useState(0),[z,K]=l.useState(null),{showPostPushModal:ue,onFeatureCompleteCommand:ye,onAgentIdle:je,onAgentActive:V,dismissModal:te}=_O(),{showPlanCompleteModal:oe,onPlanCompleteCommand:he,dismissPlanCompleteModal:G}=SO(),[ne,re]=l.useState(!1),[U,we]=l.useState(!1),[_e,Se]=l.useState(!1),[dt,Ye]=l.useState(!1),[ft,Ae]=l.useState(!1),[gt,ut]=l.useState(!1),on=l.useCallback(()=>{Se(!0)},[]),St=l.useCallback(()=>{Se(!1)},[]),{plans:qe,loading:Nt,error:Ct,refetch:ln}=zb(),{plans:it}=Hb(),{reorderPlans:cn}=Xb(ln),{launchPrompt:ve,launching:Pe,error:Te}=CO(),[Ce,Re]=l.useState(null),{stepState:E,refetch:Ke}=Ts();kO({showPostPushModal:ue,stepState:E,dismissModal:te});const ht=l.useRef(null),{leftWidth:Oe,handleMouseDown:Je}=r6(ht),He=Zf(768),[De,bt]=l.useState("editor"),Xe=l.useCallback(Y=>{bt(Y),Y==="editor"&&(lt(),typeof window<"u"&&window.dispatchEvent(new Event("resize")))},[]),[Ne,pt]=l.useState(!1),We=v==="home";l.useEffect(()=>{!We&&Ne&&pt(!1)},[We,Ne]);const{entityLookup:Pt}=nO(),{groups:Pn,loading:dn,refreshing:Tn,currentRunner:As,coverage:Rs,refresh:Es}=BT(),{groups:Ge,loading:Wt,reload:Le}=MT(),{routeEntities:Gt,unsurfacedPages:On,componentSurfaceReason:An,loading:Xn,error:ta}=LT(),{config:ae,apps:Dt,loading:Ms,refetch:Rn}=_t(),b0=Yx(),un=l.useMemo(()=>OO(Dt,Pn,Ge),[Dt,Ge,Pn]),{saved:x0}=nf(),y0=sf({appStatsLength:un.length,configLoading:Ms,scenariosLoading:Wt,setupAnswersSaved:x0,hasStepState:!!E}),na=We&&!Ne&&!y0,v0=He||na?((Ll=ht.current)==null?void 0:Ll.clientWidth)??(typeof window<"u"?window.innerWidth:Oe):Oe,j0=l.useCallback(()=>{J(Y=>!Y)},[]),w0=l.useCallback(()=>{F(Y=>!Y)},[]),{selectedApp:hn,appRouteEntities:gl,appTestGroups:_0,selectedEntityHash:k0,selectedRouteEntity:bl,previewSlug:Qn,setPreviewSlugExplicit:S0,selectApp:sa,deselectApp:ra,selectRoute:aa,selectEntity:N0,deselectRoute:C0}=ZT(Dt,Gt,Ge,Pn,n,(ae==null?void 0:ae.defaultScreenSize)??null,W,B),{viewports:P0,resolvedViewport:Zn,previewUrl:T0,handleViewportChange:O0,handleCustomSizeChange:oa,showScenarioPreview:es,handlePreviewCommand:tt,setPreviewPath:ia,previewSeeding:A0,previewSeedError:R0,previewSeedErrorKind:E0,retrySeed:M0,commandNonce:I0}=xO({apps:Dt,appRouteEntities:gl,configLoaded:!Ms,hydrated:P,port:(ae==null?void 0:ae.port)??5173,previewMedium:b0.kind,previewOrigin:id(ae,hn),projectTitle:(ae==null?void 0:ae.projectTitle)??null,routeEntities:Gt,screenSizes:(ae==null?void 0:ae.screenSizes)??{},defaultScreenSize:(ae==null?void 0:ae.defaultScreenSize)??null,scenarioGroups:Ge,scenariosLoaded:!Wt,selectedApp:hn,selectedRouteEntity:bl,previewSlug:Qn,setPreviewSlug:S0});l.useEffect(()=>{We&&Ne&&Zn.name==="Desktop"&&F(!0)},[We,Ne,Zn.name]);const{isAgentBuilding:Lt,isAgentBuildingRef:la,buildingScenarioSlug:ca,onAgentIdle:xl,onAgentActive:yl,guardScenarioSelect:vl,clearBuildingOverlay:Tt,forceIdle:jl}=PO({onTransitionToLive:es}),{planActive:D0,planIdle:L0}=TO({chatOpen:ne}),Is=(g==null?void 0:g.resumeMode)==="resume"||(g==null?void 0:g.resumeMode)==="handoff",{launchPlan:ts,launchingSlug:Ds,error:F0}=Ub({launchAnchored:Is||!!(E!=null&&E.feature)}),{buildSessionLive:z0,agentActivelyBuilding:ns,transitionBuildSessionLive:pn}=v6({isAgentBuilding:Lt,submittingBuildPrompt:Pe,launchingPlanSlug:Ds,sessionInfo:g,stepFeature:(E==null?void 0:E.feature)??null,refetchSessionInfo:b});l.useEffect(()=>{Lt&&g&&!g.hasSession&&!g.agentBrokerLive&&jl()},[Lt,g,jl]),l.useEffect(()=>{Qr({hasActiveSession:Is,isAgentBuilding:Lt,stepStateFeature:(E==null?void 0:E.feature)??null})},[Is,Lt,E==null?void 0:E.feature]),l.useEffect(()=>{const Y=ae==null?void 0:ae.projectTitle;document.title=typeof Y=="string"&&Y.length>0?`CodeYam: ${Y}`:"CodeYam"},[ae==null?void 0:ae.projectTitle]);const $0=l.useCallback(()=>{je(),xl()},[je,xl]),B0=l.useCallback(()=>{V(),yl()},[V,yl]),Ls=(ae==null?void 0:ae.provider)??l_,wl=at(Ls),{buildIdle:Fs,bannerVisible:q0,notifSettings:_l,handleSettingsChange:kl,handleAgentIdle:H0,handleAgentActive:W0,handleUserInput:G0,handleNavigateToTab:Sl,dismissIdleBanner:U0,clearIdleForStopBuilding:zs}=x6({agentName:wl,isBuildTabActive:v==="build",isAgentBuilding:Lt,buildSessionLive:z0,featureCompleteKey:le,navigateToTab:M,onAgentIdleImmediate:$0,onAgentActiveImmediate:B0}),Nl=l.useMemo(()=>w6(E==null?void 0:E.slug,Fs),[E==null?void 0:E.slug,Fs]),Cl=E?t2(E.step,E.mode):null,Pl=l.useMemo(()=>RO(E==null?void 0:E.step,E==null?void 0:E.mode),[E==null?void 0:E.step,E==null?void 0:E.mode]),Tl=E?EO(E.step,E.mode):null,Y0=((Fl=it[0])==null?void 0:Fl.title)??null,Ol=l.useMemo(()=>{const Y=Date.parse((E==null?void 0:E.startedAt)??"");return Number.isNaN(Y)?null:Y},[E==null?void 0:E.startedAt]),V0=l.useMemo(()=>MO(Ge.flatMap(Y=>Y.scenarios),Ol),[Ge,Ol]),{claimsBySlug:K0,staleFetch:J0,annotationsBySlug:X0,dependenciesBySlug:Q0,showAuthors:Z0,requestRun:ew,gateModals:tw}=NO({plans:qe,completedPlans:it,isAgentBuilding:ns,onLaunch:Y=>{var Ot;const Fe=((Ot=qe.find(Rw=>Rw.slug===Y))==null?void 0:Ot.title)??Y;ts(Y,Fe)}}),Al=l.useCallback(Y=>{Re(null),!vl(Y)&&(es(Y),We&&pt(!0))},[vl,es,We]),nw=l.useCallback(Y=>{const Fe=GO(Y.name,Ge),Ot=JO({shot:{name:Y.name,screenshotPath:Y.screenshotPath},isLatest:Y.isLatest,liveScenario:Fe,isAgentBuilding:Lt});if(Ot.kind==="live"){Re(null),es(Ot.slug);return}Re({screenshotPath:Ot.screenshotPath,scenarioName:Ot.scenarioName,heading:Ot.heading,subtext:Ot.subtext})},[Lt,Ge,es]),sw=l.useCallback(()=>{Re(null)},[]),Ft=l.useMemo(()=>Po(ca,Ge),[ca,Ge]),rw=((zl=Ft==null?void 0:Ft.screenshotPaths)==null?void 0:zl[0])??null,aw=(Ft==null?void 0:Ft.name)??null,ow=(Ft==null?void 0:Ft.description)??null,iw=l.useCallback(Y=>{switch(Y.type){case"preview":("scenarioSlug"in Y||"scenarioId"in Y)&&Le(),tt(Y);break;case"showResults":Tt(),Le(),O(Fe=>Fe+1),(E==null?void 0:E.mode)==="backend"&&tt({path:"/results",dimension:"Desktop"});break;case"hideResults":q(Fe=>Fe+1);break;case"featureComplete":Tt(),ye(),de(Fe=>Fe+1),Rn(),Ke(),fd({isAgentBuilding:la.current,trigger:"feature-complete",transitionBuildSessionLive:pn});break;case"planComplete":he(),Rn(),fd({isAgentBuilding:la.current,trigger:"plan-complete",transitionBuildSessionLive:pn});break;case"launchPlan":ts(Y.slug,Y.title),D(Fe=>Fe+1);break;case"requestCredential":K({serviceName:Y.serviceName,envVar:Y.envVar,topic:Y.topic,docsUrl:Y.docsUrl});break}},[Tt,tt,la,ts,ye,he,Rn,Ke,Le,E,pn]);tO(iw,l.useCallback(()=>{window.location.reload()},[]));const $s=(E==null?void 0:E.slug)==="ui-confirm-plan"||(E==null?void 0:E.slug)==="backend-confirm-plan",da=l.useRef(null);l.useEffect(()=>{if(!E||!$s){da.current=null;return}da.current!==E.step&&(da.current=E.step,tt({path:"/plan-preview",dimension:"Desktop"}))},[E,$s,tt]);const ua=l.useRef(null);l.useEffect(()=>{if(!E||E.mode!=="backend"||E.step<2||$s){ua.current=null;return}ua.current!==E.step&&(ua.current=E.step,tt({path:"/results",dimension:"Desktop"}))},[E,$s,tt]);const ha=l.useRef(!1);l.useEffect(()=>{(E==null?void 0:E.slug)==="ui-confirm-plan"?ha.current=!0:ha.current&&(ha.current=!1,ia(null))},[E,ia]);const lw=l.useCallback(async()=>{te(),N(!0),await N5({provider:Ls,renameLabel:(E==null?void 0:E.feature)??void 0,caller:"post-push-modal",bypassLiveGuard:!0}),lt()},[te,Ls,E]),cw=l.useCallback(()=>{te(),lt()},[te]),dw=l.useCallback(async()=>{window.dispatchEvent(new CustomEvent("build-session-stopped")),await k5(),te(),_("home"),k(),pn(!1,"stop-building"),Tt(),zs(),N(!1),b()},[te,_,k,pn,Tt,zs,b]),uw=l.useCallback(async()=>{ut(!0),window.dispatchEvent(new CustomEvent("build-session-stopped")),await S5(),ut(!1),Ae(!1),_("home"),k(),pn(!1,"reset-everything"),Tt(),zs(),N(!1),b()},[_,k,pn,Tt,zs,b]),hw=l.useCallback(()=>{re(!0),md(),G(),lt()},[G]),pw=l.useCallback(()=>{re(!0),G(),lt()},[G]),mw=l.useCallback(()=>{G(),md().finally(()=>{re(!1),d6()})},[G]),fw=l.useCallback(()=>{we(!0)},[]),gw=l.useCallback(()=>{we(!1)},[]),bw=l.useCallback(async(Y,Fe)=>{await ts(Y,Fe)&&(we(!1),N(!0),te(),b())},[ts,te,b]),xw=l.useCallback(async Y=>{await ve(Y)&&(N(!0),b())},[ve,b]),yw=l.useCallback(()=>{N(!0)},[]),Rl={hasActiveSession:Is,isAgentBuilding:Lt,showPostPushModal:ue,launchingPlanSlug:Ds,submittingBuildPrompt:Pe,stepStateFeature:(E==null?void 0:E.feature)??null,buildLaunchModalDismissed:S},vw=o0(Rl),El=XO({activeTab:v,...Rl}),jw=El||U;l.useEffect(()=>{v==="build"&&b()},[v,b]),l.useEffect(()=>{v==="home"&&(Rn(),f())},[v,Rn,f]);const ww=l.useCallback(async(Y,Fe)=>{Tt(),tt(HO(Y,Fe))},[Tt,tt]),_w=l.useCallback(Y=>{tt({...Y.scenarioSlug?{scenarioSlug:Y.scenarioSlug}:{},...Y.path?{path:Y.path}:{},...Y.dimension?{dimension:Y.dimension}:{}})},[tt]),{requestRestore:kw,onAdoptSettledEmpty:Ml}=jO({restoredRef:B,initiallySettled:$,apply:_w}),Il=l.useCallback(Y=>{wO(Y,{handlePreviewCommand:tt,handleCustomSizeChange:oa})},[oa,tt]),Sw=l.useCallback(()=>{Ml(),ie(!0)},[Ml]);yO({isInIframe:$,scenariosLoaded:!Wt,restoredRef:B,onAdopt:Il,onHydrated:X,onSettledEmpty:Sw}),vO({isInIframe:$,onConverge:Il});const Nw=l.useMemo(()=>({apps:Dt,isSingleApp:Dt.length===1,onSelectApps:ra,onSelectApp:sa,onSelectRoute:aa}),[Dt,ra,sa,aa]),Cw=l.useMemo(()=>hn?un.find(Y=>Y.app.dir===hn.dir)??null:null,[un,hn]),Pw=e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"12px 28px 0"},children:e.jsx(Xi,{staleness:null,backendOutOfDate:p})}),e.jsx("div",{style:{padding:"12px 28px 0"},children:e.jsx(l0,{update:m})}),e.jsx(i0,{state:s,provider:r,credsPresent:a,cliInstalled:o,scannedDirs:i,reason:c,expiresAt:d,probeInFlight:u,probeAttempts:h,backendOutOfDate:p,sessionOngoing:x,onAuthenticated:f,onAuthorized:C}),un.length>0&&e.jsx("div",{style:{padding:"10px 28px 0"},children:e.jsx("div",{style:{width:"100%",maxWidth:1e3,marginInline:"auto"},children:e.jsx(tf,{settings:_l,onChange:kl,providerLabel:wl})})}),e.jsx(Mb,{selectedApp:hn,projectTitle:(ae==null?void 0:ae.projectTitle)??null,admin:(ae==null?void 0:ae.admin)??!1,isBuilding:ns,buildingLabel:(E==null?void 0:E.feature)??null,buildingStepLabel:Cl,buildingStepPosition:Tl,buildingStatus:Nl,buildingProgress:Pl,lastBuiltLabel:Y0,buildingThumbnailPath:V0,plans:qe,plansLoading:Nt,plansError:Ct,onRunPlan:ew,launchingSlug:Ds,planDepAnnotationsBySlug:X0,planDependenciesBySlug:Q0,planClaimsBySlug:K0,planStaleFetch:J0,showPlanAuthors:Z0,onNavigateToPlan:()=>_("plan"),onNavigateToBuild:()=>M("build"),onResetBuild:()=>Ae(!0),onBackToProjects:Dt.length>1?ra:void 0,launcherUrl:(ae==null?void 0:ae.launcherUrl)??null,projectCount:(ae==null?void 0:ae.projectCount)??0,onOpenSetupBrowser:ae!=null&&ae.setupBrowserEnabled?()=>tt({path:"/setup-browser",dimension:"Desktop"}):void 0,appDetailProps:{navContext:Nw,routeEntities:gl,unsurfacedPages:On,componentSurfaceReason:An,routesLoading:Xn,routesError:ta,selectedEntityHash:k0,selectedRouteEntity:bl,testGroups:_0,selectedSlug:Qn,entityLookup:Pt,allScenarios:Ge.flatMap(Y=>Y.scenarios),onSelectScenario:Al,onSelectRoute:aa,onSelectEntity:N0,onBackToRoutes:C0,onScenariosChanged:Le,coverage:Rs,showProjectBand:Dt.length===1,stats:Cw,testsLoading:dn,testsRefreshing:Tn,onRunTests:Es,currentRunner:As},appOverviewProps:{projectTitle:(ae==null?void 0:ae.projectTitle)??"Project",projectDescription:(ae==null?void 0:ae.projectDescription)??null,stats:un,coverage:Rs,onSelectApp:sa,configLoading:Ms,scenariosLoading:Wt,testsLoading:dn,testsRefreshing:Tn,onRunTests:Es,currentRunner:As,stepState:E,onPreviewUrl:ia,onComplete:async()=>{await Rn(),console.info("[EditorShell] questionnaire complete; arming pending build-nav",{providerAuthState:s,buildBlocked:y}),A()},onOpenBuildTab:()=>M("build"),isBuilding:ns,buildingLabel:(E==null?void 0:E.feature)??null,buildingStepLabel:Cl,buildingStepPosition:Tl,buildingStatus:Nl,buildingProgress:Pl,onResetBuild:()=>Ae(!0)}})]}),Tw=un.some(Y=>qO(Y.app.type)),Ow=Ge.reduce((Y,Fe)=>Y+Fe.scenarios.length,0),Dl=!!E&&!Wt&&Ow===0,Aw=Vj(),zt=C6();return e.jsx(c_,{children:e.jsxs(d_,{openPicker:zt.openPicker,children:[e.jsx(Fb,{splitRef:ht,isCollapsed:H,hidePreview:na,onHomeLivePageBack:We&&Ne?()=>pt(!1):void 0,onResizeStart:Je,isNarrow:He,mobilePane:De,onMobilePaneChange:Xe,isAgentBuilding:ns,buildIdle:Fs,leftPane:e.jsx(Hx,{activeTab:v,onSendTranscript:on,appTabContent:Pw,awaitingPlanLaunchChoice:jw,buildActivated:w,planActivated:j,buildIdle:Fs,isAgentBuilding:ns,planActive:D0,planIdle:L0,bannerVisible:q0,onDismissIdleBanner:U0,hideResultsCommandKey:L,leftWidth:v0,fullWidth:He||na,navigateToTab:Sl,onAgentActive:W0,onAgentIdle:H0,onUserInput:G0,notifSettings:_l,onSettingsChange:kl,provider:Ls,onRestorePreview:kw,onResultsScenarioSelect:ww,previewSlug:Qn,showPostPushModal:ue,completionModalPermitted:a0(E),onStartNextFeature:lw,onContinueInSession:cw,onStopBuilding:dw,showResultsCommandKey:Q,planChatOpen:ne,onPlanChatOpenChange:re,showPlanCompleteModal:oe,onCreateNewPlan:hw,onContinueSession:pw,onViewPlans:mw,pendingPlans:qe,onSelectPlan:fw,selectPlanOpen:U,onPickPlan:bw,onCancelSelectPlan:gw,launchingPlanSlug:Ds,planLaunchError:F0,prototypeLaunchSignal:ee,showBuildLaunchModal:El,buildLaunchGateArmed:vw,onSubmitBuildPrompt:xw,submittingBuildPrompt:Pe,buildPromptError:Te,onStartBlankBuild:yw,pendingPlansLoading:Nt,pendingPlansError:Ct,onReorderPlans:cn,buildDisabled:y,onPreviewScreenshot:nw,projectTitle:(ae==null?void 0:ae.projectTitle)??null}),previewPane:e.jsx(Jj,{emptyStateMessage:$O({configLoading:Ms,hasNoApps:un.length===0,hasStepState:!!E,hasPreviewableApp:Tw,setupInProgress:Dl,hasCaptureFrame:Aw.available}),projectSetupInProgress:Dl,previewSlug:Qn,previewUrl:T0,viewports:P0,activeViewport:Zn.name,onViewportChange:O0,isCollapsed:H,onToggleCollapsed:j0,isNarrow:He,onBack:We&&Ne?()=>pt(!1):void 0,onPlanChange:We&&Ne?()=>Sl("plan"):void 0,isFilled:Z,onToggleFilled:w0,currentWidth:Zn.width,currentHeight:Zn.height,onCustomSizeChange:oa,buildingScenarioSlug:ca,buildingScreenshotPath:rw,buildingScenarioName:aw,buildingScenarioDescription:ow,onDismissBuildingOverlay:Tt,historicalScreenshotPath:(Ce==null?void 0:Ce.screenshotPath)??null,historicalScenarioName:(Ce==null?void 0:Ce.scenarioName)??null,historicalHeading:(Ce==null?void 0:Ce.heading)??null,historicalSubtext:(Ce==null?void 0:Ce.subtext)??null,onDismissHistoricalPreview:sw,previewSeeding:A0,previewSeedError:R0,previewSeedErrorKind:E0,onRetrySeed:M0,currentScenario:Po(Qn,Ge),scenarioGroups:Ge,onShowScenarioPreview:Al,commandNonce:I0,previewOrigin:id(ae,hn),onDesignConfirmed:()=>M("build")})}),_e?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:e.jsx(d0,{featureName:(E==null?void 0:E.feature)??null,onClose:St})}):null,e.jsx(p0,{isOpen:dt,onClose:()=>Ye(!1)}),e.jsx(u0,{sha:t,onClick:()=>Ye(!0)}),e.jsx(m0,{visible:zt.dragActive}),e.jsx("input",{ref:zt.fileInputRef,type:"file",multiple:!0,onChange:zt.handlePickerChange,style:{display:"none"},"data-testid":"global-file-picker-input"}),zt.error?e.jsx(f0,{message:zt.error}):null,zt.pendingPaths?e.jsx(g0,{paths:zt.pendingPaths,onClose:zt.clearPending}):null,ft?e.jsx(Xj,{busy:gt,onCancel:()=>Ae(!1),onConfirm:()=>void uw()}):null,z?e.jsx(Or,{target:z,onStored:()=>K(null),onClose:()=>K(null)}):null,tw]})})}const Z9=Object.freeze(Object.defineProperty({__proto__:null,EditorShell:A6},Symbol.toStringTag,{value:"Module"}));export{Cd as $,ok as A,Me as B,Er as C,vy as D,z1 as E,g0 as F,bi as G,Bn as H,sk as I,me as J,dp as K,Jt as L,kh as M,ur as N,fi as O,Ah as P,_f as Q,jd as R,di as S,Ir as T,gi as U,jh as V,fe as W,ik as X,wd as Y,vd as Z,Nd as _,Dr as a,Sx as a$,qo as a0,Ho as a1,Wo as a2,Pd as a3,Go as a4,ws as a5,Od as a6,Ad as a7,Ld as a8,Fa as a9,yt as aA,Th as aB,Ch as aC,qa as aD,Lu as aE,Oh as aF,oi as aG,eb as aH,ct as aI,Wj as aJ,Tj as aK,Op as aL,Tp as aM,Pp as aN,cm as aO,Qt as aP,$t as aQ,pe as aR,ge as aS,nn as aT,l0 as aU,Xi as aV,is as aW,js as aX,sb as aY,ls as aZ,R as a_,Bo as aa,Uo as ab,Wd as ac,Vd as ad,Jo as ae,Jd as af,$o as ag,_d as ah,kd as ai,Sd as aj,Xd as ak,Qd as al,Zd as am,bu as an,yu as ao,yh as ap,fu as aq,mu as ar,ai as as,Wa as at,Ut as au,er as av,gn as aw,fn as ax,mn as ay,Yt as az,nr as b,au as b$,Hi as b0,Qv as b1,Bb as b2,xo as b3,Jy as b4,Dy as b5,Iy as b6,My as b7,Ey as b8,Ay as b9,Hy as bA,$n as bB,Ur as bC,et as bD,Cr as bE,Ss as bF,Cp as bG,ui as bH,$e as bI,ce as bJ,pv as bK,tv as bL,nu as bM,Rr as bN,$1 as bO,Ly as bP,Gn as bQ,Qy as bR,tu as bS,hm as bT,xm as bU,bm as bV,fm as bW,mm as bX,pm as bY,_i as bZ,tn as b_,ul as ba,Fy as bb,Rb as bc,rb as bd,fo as be,go as bf,qn as bg,ab as bh,Xv as bi,lv as bj,jy as bk,rn as bl,tb as bm,Oy as bn,Ty as bo,lo as bp,an as bq,nb as br,Xo as bs,Ve as bt,ri as bu,sn as bv,vh as bw,Gv as bx,Nr as by,Wy as bz,SE as c,u0 as c$,as as c0,Mv as c1,Ee as c2,vn as c3,Zy as c4,su as c5,rv as c6,sv as c7,Be as c8,vt as c9,Ab as cA,Tb as cB,Vi as cC,Pb as cD,hu as cE,Kd as cF,uh as cG,hh as cH,du as cI,cu as cJ,gu as cK,pu as cL,uu as cM,bh as cN,yf as cO,gf as cP,hf as cQ,xf as cR,bf as cS,uf as cT,Id as cU,Ci as cV,Pu as cW,nh as cX,Ha as cY,th as cZ,Qo as c_,qt as ca,rt as cb,hi as cc,ou as cd,ru as ce,Rv as cf,Ue as cg,hj as ch,uj as ci,fj as cj,pj as ck,dj as cl,gj as cm,Lv as cn,cj as co,Dv as cp,$j as cq,zj as cr,db as cs,Su as ct,Nu as cu,ku as cv,ju as cw,_u as cx,kt as cy,xh as cz,um as d,wv as d$,jr as d0,zv as d1,Bv as d2,qv as d3,Hv as d4,$v as d5,Wv as d6,Fj as d7,Fv as d8,Jv as d9,jb as dA,Sb as dB,Nb as dC,Os as dD,Qx as dE,cy as dF,oy as dG,Zx as dH,ey as dI,ny as dJ,sy as dK,po as dL,il as dM,ry as dN,ay as dO,Kx as dP,Yi as dQ,iy as dR,ly as dS,Jx as dT,dy as dU,ob as dV,Jg as dW,Zg as dX,yv as dY,pl as dZ,vv as d_,Yv as da,Uv as db,Vv as dc,Kv as dd,vf as de,df,cf as dg,of as dh,af as di,rf as dj,lf as dk,Dh as dl,Mh as dm,Rh as dn,Ua as dp,Eh as dq,_b as dr,gb as ds,bb as dt,xb as du,wb as dv,yb as dw,vb as dx,kb as dy,Cb as dz,Jh as e,sx as e$,bv as e0,gv as e1,fv as e2,jo as e3,Sv as e4,kv as e5,hy as e6,_v as e7,xv as e8,jv as e9,vx as eA,bx as eB,gx as eC,yx as eD,jx as eE,mx as eF,fx as eG,Xr as eH,Vb as eI,Kb as eJ,Yb as eK,Dd as eL,Bg as eM,Lg as eN,Bi as eO,Dg as eP,qg as eQ,zg as eR,Fg as eS,$g as eT,Ed as eU,qi as eV,$i as eW,cx as eX,ax as eY,ix as eZ,co as e_,Nv as ea,ng as eb,tg as ec,dg as ed,cg as ee,Dj as ef,Lj as eg,Mj as eh,Ij as ei,h0 as ej,p0 as ek,ug as el,zx as em,Fx as en,qx as eo,$x as ep,Bx as eq,f0 as er,m0 as es,Lx as et,en as eu,wx as ev,_x as ew,kx as ex,Hg as ey,xx as ez,Kh as f,Xs as f$,dx as f0,px as f1,Zb as f2,hx as f3,ux as f4,Qb as f5,Nx as f6,sl as f7,Ax as f8,Ex as f9,ih as fA,lh as fB,ch as fC,dh as fD,ti as fE,Zu as fF,Xu as fG,Ju as fH,Ku as fI,Qu as fJ,eh as fK,Hu as fL,Uu as fM,Gu as fN,qu as fO,Wu as fP,zu as fQ,Fu as fR,ii as fS,Va as fT,Hh as fU,Wh as fV,zh as fW,Yh as fX,qh as fY,Fh as fZ,Ba as f_,Ox as fa,Mx as fb,hv as fc,uv as fd,Qs as fe,vu as ff,Au as fg,Tu as fh,Ru as fi,A6 as fj,yo as fk,dv as fl,Ih as fm,Yu as fn,Iu as fo,Du as fp,Mu as fq,Px as fr,Yg as fs,Vg as ft,Cu as fu,ei as fv,lu as fw,sh as fx,rh as fy,oh as fz,tr as g,Em as g$,ni as g0,cv as g1,wr as g2,Yj as g3,So as g4,Hj as g5,bj as g6,Oj as g7,Aj as g8,Nj as g9,Yy as gA,hl as gB,Vy as gC,Ny as gD,wf as gE,to as gF,zf as gG,Lf as gH,Df as gI,Ef as gJ,fs as gK,Ln as gL,sr as gM,Rf as gN,Af as gO,Tf as gP,Cf as gQ,Pf as gR,Bf as gS,$f as gT,Tx as gU,zm as gV,Fm as gW,Lm as gX,Dm as gY,Im as gZ,Mm as g_,Sj as ga,Cj as gb,kj as gc,Pj as gd,Xj as ge,ov as gf,Ej as gg,Rj as gh,Pv as gi,Cv as gj,Ov as gk,uy as gl,Iv as gm,Av as gn,_j as go,Ug as gp,Db as gq,Sf as gr,kf as gs,av as gt,Ky as gu,nv as gv,ev as gw,Xy as gx,Gy as gy,$y as gz,ga as h,Xh as h$,Rm as h0,Am as h1,Qp as h2,Xp as h3,Jp as h4,Kp as h5,Vp as h6,Yp as h7,Up as h8,Gp as h9,Xa as hA,lm as hB,Ja as hC,Om as hD,Tm as hE,Pm as hF,Cm as hG,Nm as hH,Sm as hI,Qa as hJ,km as hK,wm as hL,jm as hM,Wr as hN,vm as hO,ym as hP,ph as hQ,dm as hR,Zh as hS,Qh as hT,ap as hU,op as hV,ip as hW,Sh as hX,Ga as hY,Nh as hZ,Ph as h_,Wp as ha,Hp as hb,qp as hc,Bp as hd,$p as he,Fp as hf,Lp as hg,Dp as hh,Ip as hi,Mp as hj,Rp as hk,Ap as hl,Ep as hm,Np as hn,Sp as ho,kp as hp,jp as hq,yp as hr,im as hs,om as ht,am as hu,rm as hv,sm as hw,em as hx,Zp as hy,lp as hz,sg as i,Vo as i$,eo as i0,Um as i1,tf as i2,Qm as i3,Bm as i4,Za as i5,qm as i6,Hm as i7,Wm as i8,Gr as i9,sj as iA,nj as iB,tj as iC,lj as iD,rj as iE,ej as iF,oj as iG,Zv as iH,wo as iI,Tr as iJ,Ou as iK,li as iL,hg as iM,Qf as iN,Wg as iO,Jf as iP,Wf as iQ,lb as iR,Hf as iS,Kg as iT,qf as iU,Vh as iV,Lh as iW,vj as iX,gh as iY,ke as iZ,Ud as i_,Gm as ia,Mr as ib,Gg as ic,ub as id,Lb as ie,Ix as ig,Cx as ih,Hx as ii,Fb as ij,Ib as ik,Mb as il,Vf as im,rr as io,Kf as ip,Yf as iq,Uf as ir,Gf as is,hb as it,mb as iu,pb as iv,cb as iw,Hn as ix,aj as iy,ij as iz,Jj as j,y8 as j$,Ko as j0,rp as j1,Or as j2,i0 as j3,xy as j4,by as j5,yy as j6,fy as j7,my as j8,py as j9,$E as jA,VE as jB,GR as jC,HE as jD,uA as jE,eD as jF,KE as jG,aE as jH,xD as jI,CL as jJ,fM as jK,G9 as jL,RR as jM,ER as jN,TR as jO,OR as jP,PR as jQ,AR as jR,mE as jS,iI as jT,bR as jU,nE as jV,xR as jW,iR as jX,lR as jY,oR as jZ,cE as j_,Fr as ja,ji as jb,wp as jc,_p as jd,vp as je,vi as jf,Hr as jg,qr as jh,Br as ji,pp as jj,$r as jk,hp as jl,xi as jm,Rt as jn,zr as jo,fp as jp,hr as jq,yi as jr,Ka as js,xp as jt,gp as ju,mp as jv,bp as jw,cr as jx,Uj as jy,Kj as jz,Vu as k,UA as k$,b8 as k0,g8 as k1,x8 as k2,eM as k3,CE as k4,K7 as k5,vM as k6,tI as k7,f8 as k8,oI as k9,P9 as kA,YE as kB,UE as kC,VR as kD,YR as kE,GE as kF,WE as kG,NA as kH,WR as kI,A9 as kJ,O9 as kK,AE as kL,tD as kM,z8 as kN,B8 as kO,fA as kP,j7 as kQ,U9 as kR,kM as kS,lD as kT,Q7 as kU,M9 as kV,E9 as kW,TM as kX,EA as kY,aR as kZ,NE as k_,aI as ka,VM as kb,D8 as kc,L8 as kd,NL as ke,kL as kf,SL as kg,T7 as kh,lL as ki,MM as kj,IM as kk,A8 as kl,W6 as km,H6 as kn,ZM as ko,B9 as kp,L9 as kq,D9 as kr,z9 as ks,aM as kt,sM as ku,rM as kv,xM as kw,LM as kx,UR as ky,T9 as kz,Eu as l,lI as l$,WA as l0,GA as l1,YA as l2,KA as l3,VA as l4,tE as l5,wA as l6,eE as l7,rR as l8,ED as l9,pR as lA,gR as lB,fR as lC,hR as lD,mR as lE,PE as lF,ZR as lG,sE as lH,rE as lI,B6 as lJ,H9 as lK,mD as lL,bM as lM,gL as lN,uM as lO,U7 as lP,QE as lQ,BE as lR,SM as lS,K9 as lT,V9 as lU,R8 as lV,zI as lW,qI as lX,BI as lY,$I as lZ,FI as l_,jA as la,lE as lb,YM as lc,DE as ld,kD as le,LA as lf,MA as lg,XA as lh,JA as li,FA as lj,NR as lk,CR as ll,SR as lm,PA as ln,TA as lo,AA as lp,MR as lq,RA as lr,OA as ls,jR as lt,vR as lu,yR as lv,nR as lw,_R as lx,wR as ly,kR as lz,Km as m,K6 as m$,oM as m0,mM as m1,pA as m2,W9 as m3,R7 as m4,P7 as m5,C7 as m6,I8 as m7,k9 as m8,S9 as m9,oD as mA,iD as mB,S7 as mC,Y7 as mD,N7 as mE,cA as mF,nA as mG,k7 as mH,_7 as mI,iA as mJ,oA as mK,w7 as mL,Z6 as mM,J6 as mN,G6 as mO,rA as mP,P8 as mQ,_8 as mR,C8 as mS,w8 as mT,T8 as mU,S8 as mV,k8 as mW,eA as mX,N8 as mY,lA as mZ,aA as m_,N9 as ma,C9 as mb,_9 as mc,w9 as md,j9 as me,y9 as mf,v9 as mg,EL as mh,q6 as mi,LL as mj,oE as mk,XL as ml,q9 as mm,IL as mn,ML as mo,b9 as mp,$L as mq,zL as mr,qL as ms,HL as mt,BL as mu,FL as mv,RL as mw,$6 as mx,x9 as my,DM as mz,ef as n,sL as n$,O8 as n0,AL as n1,OL as n2,TL as n3,E7 as n4,X6 as n5,j8 as n6,Q6 as n7,aD as n8,rD as n9,e8 as nA,XI as nB,QI as nC,t8 as nD,ZI as nE,JI as nF,VI as nG,WI as nH,QM as nI,_I as nJ,wI as nK,jI as nL,cR as nM,$9 as nN,n8 as nO,PL as nP,CA as nQ,uL as nR,hD as nS,QR as nT,KD as nU,iL as nV,nL as nW,oL as nX,aL as nY,rL as nZ,iE as n_,v7 as na,A7 as nb,M7 as nc,tA as nd,JM as ne,hM as nf,OD as ng,U6 as nh,TD as ni,ZE as nj,b7 as nk,wL as nl,_L as nm,vL as nn,xL as no,yL as np,bL as nq,jL as nr,s7 as ns,fL as nt,a9 as nu,NI as nv,GI as nw,YI as nx,UI as ny,KI as nz,Xm as o,HR as o$,QD as o0,ZD as o1,XD as o2,YD as o3,UD as o4,WD as o5,zD as o6,HD as o7,BD as o8,$D as o9,m9 as oA,p9 as oB,d9 as oC,f9 as oD,c9 as oE,L7 as oF,sA as oG,D7 as oH,dI as oI,DL as oJ,vI as oK,V8 as oL,SA as oM,zM as oN,UM as oO,HM as oP,$M as oQ,GM as oR,WM as oS,qM as oT,BM as oU,u7 as oV,TE as oW,p7 as oX,m7 as oY,d7 as oZ,qR as o_,GD as oa,JD as ob,VD as oc,eL as od,tL as oe,DD as of,m8 as og,sI as oh,x7 as oi,q8 as oj,eI as ok,EM as ol,zA as om,g9 as on,LE as oo,FE as op,zE as oq,nM as or,J7 as os,IE as ot,uR as ou,dR as ov,JR as ow,gM as ox,h9 as oy,u9 as oz,rP as p,KL as p$,h7 as p0,LI as p1,xI as p2,fI as p3,mI as p4,gI as p5,bI as p6,Z7 as p7,DA as p8,IA as p9,jM as pA,U8 as pB,HA as pC,qA as pD,tR as pE,QA as pF,sR as pG,eR as pH,XE as pI,nD as pJ,V7 as pK,cD as pL,y7 as pM,f7 as pN,g7 as pO,Z9 as pP,c8 as pQ,d8 as pR,l8 as pS,i8 as pT,o8 as pU,u8 as pV,K8 as pW,pL as pX,W8 as pY,F9 as pZ,JL as p_,X9 as pa,J9 as pb,Y8 as pc,$8 as pd,vA as pe,cM as pf,qD as pg,O7 as ph,mL as pi,XR as pj,Q9 as pk,M8 as pl,kA as pm,DR as pn,xA as po,bA as pp,$R as pq,FR as pr,LR as ps,hA as pt,yA as pu,gA as pv,XM as pw,nI as px,KM as py,BR as pz,iv as q,R9 as q$,rI as q0,ME as q1,J8 as q2,cL as q3,dL as q4,ID as q5,MD as q6,PD as q7,I7 as q8,CM as q9,t7 as qA,n7 as qB,Z8 as qC,Q8 as qD,e7 as qE,X8 as qF,bE as qG,AM as qH,V6 as qI,FM as qJ,RE as qK,EE as qL,_A as qM,G7 as qN,W7 as qO,H7 as qP,q7 as qQ,$7 as qR,B7 as qS,z7 as qT,F7 as qU,pI as qV,pM as qW,FD as qX,LD as qY,KR as qZ,hL as q_,s9 as qa,l9 as qb,yI as qc,ZL as qd,r9 as qe,e9 as qf,o9 as qg,i9 as qh,n9 as qi,t9 as qj,PM as qk,lM as ql,HI as qm,iM as qn,CD as qo,cI as qp,UL as qq,GL as qr,YL as qs,VL as qt,l7 as qu,i7 as qv,a7 as qw,o7 as qx,r7 as qy,c7 as qz,ci as r,pE as r$,yM as r0,Y6 as r1,X7 as r2,NM as r3,dA as r4,yD as r5,RI as r6,QL as r7,DI as r8,AI as r9,SD as rA,uD as rB,dD as rC,_M as rD,RD as rE,AD as rF,hE as rG,dE as rH,yE as rI,wE as rJ,_E as rK,jE as rL,zR as rM,hI as rN,uI as rO,TI as rP,PI as rQ,SI as rR,kI as rS,CI as rT,s8 as rU,xE as rV,BA as rW,$A as rX,IR as rY,kE as rZ,fE as r_,MI as ra,EI as rb,v8 as rc,p8 as rd,E8 as re,h8 as rf,a8 as rg,H8 as rh,r8 as ri,F8 as rj,G8 as rk,Y9 as rl,II as rm,_D as rn,I9 as ro,sD as rp,wD as rq,ZA as rr,gD as rs,bD as rt,jD as ru,vD as rv,pD as rw,fD as rx,RM as ry,ND as rz,Jm as s,uE as s0,gE as s1,vE as s2,mA as s3,wM as s4,OM as s5,OI as s6,dM as s7,tM as s8,OE as s9,WL as sa,JE as sb,qE as sc,Lr as sd,_n as t,Bu as u,d0 as v,ks as w,jn as x,rk as y,ak as z};
|