1import{i as e}from"./rolldown-runtime-BgQAZz4g.js";import{Ei as t,Ur as s,ia as r,la as l}from"./assets-CG_h8I8R.js";import{S as a,t as n}from"./vendor-FbXec9oV.js";import{A as i,H as o,b as c,ct as d,d as x,f as m,g as u,k as p,p as h}from"./index-CjA5d7xr.js";import{n as f}from"./DesignView-Bhzv5wgy.js";var b=e(l(),1),g=e(a(),1),j=[{id:"plan",label:"Plan"},{id:"art",label:"Art"},{id:"uploads",label:"Uploads"},{id:"screenshots",label:"Screenshots"}];function y({pic:e,onBack:s}){return(0,g.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,g.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 text-sm text-text-muted hover:text-text-primary",children:[(0,g.jsx)(o,{size:13})," Back"]}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"ui-key h-8 inline-flex items-center rounded-full px-3 text-xs text-text-secondary",children:"Open full size"}),(0,g.jsx)("button",{type:"button",onClick:()=>{return s=()=>u(e.url,`${e.title}.png`),t.getState().setChatOpen(!0),void setTimeout(s,60);var s},className:"ui-key h-8 rounded-full px-3 text-xs text-text-secondary",children:"Use in chat"})]})]}),(0,g.jsx)("img",{src:e.url,alt:e.title,className:"w-full rounded-lg border border-border bg-surface-sunken"}),(0,g.jsxs)("div",{className:"text-sm text-text-primary",children:[null!=e.number?`#${e.number} · `:"",e.title]})]})}function v({pics:e,empty:t,onOpen:s}){return e.length?(0,g.jsx)("div",{className:"grid grid-cols-2 gap-3 p-4 lg:grid-cols-3",children:e.map(e=>(0,g.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group flex flex-col gap-1.5 text-left",children:[(0,g.jsxs)("span",{className:"relative block overflow-hidden rounded-lg border border-border bg-surface-sunken group-hover:border-border-strong",children:[(0,g.jsx)("img",{src:e.url,alt:e.title,className:"block aspect-video w-full object-cover",loading:"lazy"}),null!=e.number&&(0,g.jsxs)("span",{className:"absolute left-2 top-2 rounded-full bg-black/65 px-2 py-0.5 font-mono text-xs text-white",children:["#",e.number]})]}),(0,g.jsx)("span",{className:"truncate text-xs text-text-secondary",children:e.title})]},e.key))}):(0,g.jsx)("p",{className:"p-6 text-sm text-text-muted",children:t})}function N({pics:e,onOpen:t}){const s=h(e=>e.design?.text??"");return s?(0,g.jsxs)("div",{className:"mx-auto max-w-3xl px-6 py-5",children:[e.length>0&&(0,g.jsx)("div",{className:"mb-5 grid grid-cols-2 gap-2 sm:grid-cols-4",children:e.map(e=>(0,g.jsxs)("button",{type:"button",onClick:()=>t(e),className:"group flex flex-col gap-1 text-left",children:[(0,g.jsx)("img",{src:e.url,alt:e.title,className:"block aspect-[4/3] w-full rounded-md border border-border object-cover group-hover:border-border-strong",loading:"lazy"}),(0,g.jsx)("span",{className:"truncate text-xs text-text-secondary",children:e.title})]},e.key))}),(0,g.jsx)("div",{className:"mb-2 font-mono text-xs text-text-placeholder",children:"plan.md"}),(0,g.jsx)(n,{remarkPlugins:[c],components:f,children:s})]}):(0,g.jsx)("p",{className:"p-6 text-sm text-text-muted",children:"The plan appears here once the design is written."})}function k(){const e=r(e=>e.projectId),[t,s]=(0,b.useState)(null),[l,a]=(0,b.useState)(null);return(0,b.useEffect)(()=>{e&&i(e).then(s).catch(()=>s([]))},[e]),l?(0,g.jsxs)("div",{className:"flex flex-col gap-3 p-4",children:[(0,g.jsxs)("button",{type:"button",onClick:()=>a(null),className:"inline-flex items-center gap-1.5 self-start text-sm text-text-muted hover:text-text-primary",children:[(0,g.jsx)(o,{size:13})," Back"]}),(0,g.jsx)("div",{className:"font-mono text-sm text-text-primary",children:l.name}),(0,g.jsx)("p",{className:"m-0 whitespace-pre-wrap text-sm text-text-secondary",children:l.text})]}):null===t?(0,g.jsx)("p",{className:"p-6 text-sm text-text-muted",children:"Loadingâ¦"}):t.length?(0,g.jsx)("ul",{className:"flex flex-col p-2",children:t.map(t=>(0,g.jsx)("li",{children:(0,g.jsxs)("button",{type:"button",onClick:()=>{e&&p(e,t.docId).then(e=>e&&a({name:t.filename,text:e.text}))},className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left hover:bg-surface-hover",children:[(0,g.jsx)(d,{size:14,className:"shrink-0 text-text-muted"}),(0,g.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm text-text-primary",children:t.filename}),(0,g.jsx)("span",{className:"shrink-0 text-xs text-text-muted",children:new Date(t.createdAt).toLocaleDateString()})]})},t.docId))}):(0,g.jsx)("p",{className:"p-6 text-sm text-text-muted",children:"Documents you attach in the chat (PDF, DOCX, pasted briefs) land here."})}function w(){const e=h(e=>e.images),t=h(e=>e.pictures),r=h(e=>e.runs),l=h(e=>e.events),a=s(e=>e.filesTab),[n,i]=(0,b.useState)(null);(0,b.useEffect)(()=>{i(null)},[a]);const o=h(e=>e.lane),c=(0,b.useMemo)(()=>x(o).flatMap(t=>e[t]?[{key:t,url:e[t],title:m(t,o)}]:[]),[e,o]),d=(0,b.useMemo)(()=>[...c,...t.map(e=>({key:`p${e.number}`,url:e.url,title:e.prompt||`Picture ${e.number}`,number:e.number}))],[c,t]),u=(0,b.useMemo)(()=>function(e,t){const s=[];for(const r of[...e].sort((e,t)=>
1e.createdAt<t.createdAt?-1:1)){let e=null;for(const l of t[r.id]??[])"run"===l.who&&"string"==typeof l.payload.image&&(e=l.payload.image),"saved"===l.who&&e&&!s.includes(e)&&s.push(e)}return s.map((e,t)=>({key:`s${t+1}`,url:e,title:`Screenshot ${t+1}`})).reverse()}(r,l),[r,l]);return(0,g.jsxs)("div",{className:"relative flex-1 min-h-0 flex flex-col overflow-hidden bg-surface",children:[(0,g.jsx)("div",{className:"flex items-center border-b border-border-subtle px-3 py-2 shrink-0",children:(0,g.jsx)("div",{role:"tablist","aria-label":"Files",className:"inline-flex items-center gap-0.5 rounded-full border border-border bg-surface-sunken p-[3px] shadow-[var(--shadow-groove)]",children:j.map(e=>(0,g.jsx)("button",{type:"button",role:"tab","aria-selected":a===e.id,onClick:()=>{return t=e.id,s.setState({filesTab:t});var t},className:"h-7 rounded-full px-3 text-sm font-medium "+(a===e.id?"ui-toggle-thumb text-text-primary":"border border-transparent text-text-secondary hover:text-text-primary"),children:e.label},e.id))})}),(0,g.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:n?(0,g.jsx)(y,{pic:n,onBack:()=>i(null)}):"plan"===a?(0,g.jsx)(N,{pics:c,onOpen:i}):"art"===a?(0,g.jsx)(v,{pics:d,empty:"The design's pictures and the pictures you make in the chat land here.",onOpen:i}):"uploads"===a?(0,g.jsx)(k,{}):(0,g.jsx)(v,{pics:u,empty:"A screenshot of the game lands here each time it is saved.",onOpen:i})})]})}export{w as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.