PageSourceSearch

https://xterns.ai/assets/XternSimulationWorkspace-CkrMMSTH.js

js xterns.ai collected 2026-10-05 13:24:11 UTC 46,061 bytes, 21 lines download raw bytes

1import{c as xe,M as ts,s as rs,j as e,B as T,I as H,n as Ce,r as h,h as ee,i as de,k as me,J as E,m as se,p as as,a5 as ns,t as ue,x as he,a8 as is,u as os,E as ls,f as cs,aK as je,bt as ve,bu as we,aZ as Ee,L as ye,br as ds,T as ms,S as us,P as hs,F as xs,A as ps}from"./index-DLd_kDlx.js";import{L as F}from"./label-D4-ENrYn.js";import{S as Ie,a as Le,b as Me,c as _e,d as $e}from"./select-RSrodAEw.js";import{T as te}from"./textarea-C6X-I43k.js";import{P as Oe}from"./plus-0WhrdjYO.js";import{E as gs}from"./external-link-D0CFvOTk.js";import{T as bs}from"./trash-2-0uuZSTFd.js";import{L as fs}from"./link-2-DxGcptQD.js";import{R as js}from"./refresh-cw-CoPjtj5-.js";import{D as vs,p as ws,b as ys,a as Ns,u as ks,C as Ss}from"./core.esm-CBNPzdJB.js";import{C as Cs}from"./CreateRepoDialog-CS0zHZ02.js";import{u as ze}from"./useGitHubIdentity-DDmb0Jwt.js";import{G as We}from"./git-branch-C-twpC7K.js";import{E as As}from"./earth-tODT83zM.js";import{C as Ts}from"./clock-3-De2r9tJK.js";import{G as Rs}from"./grip-D8CWfeHW.js";import{E as Ds,F as Es}from"./EmployerIntroVideo-EY6CLzfQ.js";import{d as Is,e as Ls,b as Ms,f as _s,h as $s,i as Ps,j as Fs,k as Bs}from"./useEmployerOpportunities-CGJnNoIG.js";import{L as le}from"./loader-circle-D2miE2xB.js";import{A as Pe}from"./arrow-left-BXtn7MCa.js";import{L as Us}from"./linkedin-C3YpjTq8.js";import{S as Os}from"./shield-check-C7sUiJPm.js";import{B as zs}from"./bot-B7Ux8HTI.js";import{A as Ws}from"./award-MEJfpupD.js";import{S as Gs}from"./save-DnzFMk1L.js";import{S as Ks}from"./send-DsBTdW9L.js";import"./index-BdQq_4o_.js";import"./index-Deh-4PO1.js";import"./chevron-down-DpJJsCer.js";import"./chevron-up-M4SAwIjf.js";import"./switch-7Twrb7Os.js";import"./circle-play-CGUr0fM_.js";import"./useMutation-CotV56Sa.js";import"./useEnterpriseAccount-DtG-D-iC.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Vs=xe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const qs=xe("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Hs=xe("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Xs=xe("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);function Ys(s){if(!s)return null;const i=s.trim();if(!i)return null;const o=i.match(/^https?:\/\/github\.com\/([^/\s]+)\/([^/\s#?]+?)(?:\.git)?(?:[/?#]|$)/i);if(o)return{owner:o[1],repo:o[2]};const l=i.match(/^([^/\s]+)\/([^/\s]+?)(?:\.git)?$/);return l?{owner:l[1],repo:l[2]}:null}function Js(s,i,o=!0){const l=ts({queryKey:["github-branches",s,i],enabled:!!s&&!!i&&o,staleTime:3e5,queryFn:async()=>{const{data:m,error:a}=await rs.functions.invoke("github-list-branches",{body:{owner:s,repo:i}});if(a)throw a;return(m==null?void 0:m.branches)??[]}});return{branches:l.data??[],isLoading:l.isLoading,isFetching:l.isFetching,refetch:l.refetch,error:l.error}}const Qs={link:"Link",document:"Document",prototype:"Prototype",repository:"Repository",demo:"Demo",other:"Other"},Ne=(s=[],i="")=>({id:`artifact-${crypto.randomUUID()}`,title:"",type:"link",url:"",description:"",repoUrl:i,branch:"",commitSha:"",taskIds:s});function Zs({artifacts:s,tasks:i,disabled:o,linkedRepoUrl:l="",githubConnected:m=!1,onChange:a}){const v=i.map(x=>x.id),f=s.length>0?s:[Ne(v,l)],g=(x,t)=>{a(f.map(p=>p.id===x?{...p,...t}:p))},y=(x,t,p)=>{g(x.id,{taskIds:p?[...new Set([...x.taskIds,t])]:x.taskIds.filter(M=>M!==t)})},k=(x,t)=>{g(x.id,{taskIds:t?v:[]})},D=x=>{const t=f.filter(p=>p.id!==x);a(t.length>0?t:[Ne(v,l)])};return e.jsxs("div",{className:"space-y-4",children:[f.map((x,t)=>e.jsx(et,{artifact:x,index:t,tasks:i,allTaskIds:v,disabled:o,canRemove:f.length>1,linkedRepoUrl:l,githubConnected:m,onUpdate:p=>g(x.id,p),onRemove:()=>D(x.id),onToggleTask:(p,M)=>y(x,p,M),onToggleAllTasks:p=>k(x,p)},x.id)),e.jsxs(T,{type:"button",variant:"outline",disabled:o,onClick:()=>a([...f,Ne(v,l)]),children:[e.jsx(Oe,{className:"mr-2 h-4 w-4"}),"Add artifact"]})]})}function et({artifact:s,index:i,tasks:o,allTaskIds:l,disabled:m,canRemove:a,linkedRepoUrl:v,githubConnected:f,onUpdate:g,onRemove:y,onToggleTask:k,onToggleAllTasks:D}){var j;const x=s.repoUrl.trim()||v,t=Ys(x),{branches:p,isFetching:M,refetch:I}=Js(t==null?void 0:t.owner,t==null?void 0:t.repo,f),R=p.length>0,N=!s.repoUrl.trim()&&!!v&&!m;return e.jsxs("div",{className:"space-y-4 rounded-md border bg-white p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("p",{className:"text-sm font-semibold text-gray-900",children:["Artifact ",i+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.url.trim()&&e.jsx(T,{variant:"outline",size:"icon",asChild:!0,children:e.jsx("a",{href:s.url.trim(),target:"_blank",rel:"noreferrer","aria-label":"Open artifact",children:e.jsx(gs,{className:"h-4 w-4"})})}),e.jsx(T,{variant:"outline",size:"icon",disabled:m||!a,onClick:y,"aria-label":"Remove artifact",children:e.jsx(bs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-[1fr_150px]",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:`${s.id}-title`,children:"Title"}),e.jsx(H,{id:`${s.id}-title`,value:s.title,disabled:m,onChange:c=>g({title:c.target.value}),placeholder:"Dashboard walkthrough, repo, design doc..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{children:"Type"}),e.jsxs(Ie,{value:s.type,disabled:m,onValueChange:c=>g({type:c}),children:[e.jsx(Le,{children:e.jsx(Me,{})}),e.jsx(_e,{children:Object.entries(Qs).map(([c,n])=>e.jsx($e,{value:c,children:n},c))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:`${s.id}-url`,children:"Artifact URL"}),e.jsx(H,{id:`${s.id}-url`,value:s.url,disabled:m,onChange:c=>g({url:c.target.value}),placeholder:"https://..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:`${s.id}-description`,children:"Evidence note"}),e.jsx(te,{id:`${s.id}-description`,value:s.description,disabled:m,onChange:c=>g({description:c.target.value}),className:"min-h-20"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(F,{htmlFor:`${s.id}-repo`,children:"Repo"}),N&&e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-xs font-medium text-blue-700 hover:underline",onClick:()=>g({repoUrl:v}),children:[e.jsx(fs,{className:"h-3 w-3"}),"Use linked repo"]})]}),e.jsx(H,{id:`${s.id}-repo`,value:s.repoUrl,disabled:m,onChange:c=>g({repoUrl:c.target.value}),placeholder:v||"https://github.com/..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(F,{htmlFor:`${s.id}-branch`,children:"Branch"}),R&&e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>I(),disabled:M,"aria-label":"Refresh branches",children:[e.jsx(js,{className:`h-3 w-3 ${M?"animate-spin":""}`}),"Refresh"]})]}),R?e.jsxs(Ie,{value:s.branch||void 0,disabled:m,onValueChange:c=>g({branch:c}),children:[e.jsx(Le,{id:`${s.id}-branch`,children:e.jsx(Me,{placeholder:((j=p.find(c=>c.name==="main"||c.name==="master"))==null?void 0:j.name)??"Select branch"})}),e.jsx(_e,{children:p.map(c=>e.jsx($e,{value:c.name,children:c.name},c.name))})]}):e.jsx(H,{id:`${s.id}-branch`,value:s.branch,disabled:m,onChange:c=>g({branch:c.target.value}),placeholder:"feature/simulation"})]})]}),o.length>0&&e.jsxs("div",{className:"space-y-2",children:[(()=>{const c=l.every(w=>s.taskIds.includes(w)),n=l.some(w=>s.taskIds.includes(w));return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(F,{children:"Linked tasks"}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md border bg-slate-50 px-3 py-2",children:[e.jsx(Ce,{checked:c?!0:n?"indeterminate":!1,disabled:m,onCheckedChange:w=>D(w===!0)}),e.jsx("span",{className:"text-sm text-gray-700",children:"Link/unlink all tasks"})]})]})})(),e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:o.map(c=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded-md border p-2",children:[e.jsx(Ce,{className:"mt-0.5",checked:s.taskIds.includes(c.id),disabled:m,onCheckedChange:n=>k(c.id,n===!0)}),e.jsx("span",{className:"text-sm text-gray-700",children:c.title})]},c.id))})]})]})}const st={todo:"To do",in_progress:"In progress",blocked:"Blocked",done:"Done"},tt={todo:"border-slate-200 bg-slate-50",in_progress:"border-blue-200 bg-blue-50",blocked:"border-amber-200 bg-amber-50",done:"border-emerald-200 bg-emerald-50"},ke=["todo","in_progress","blocked","done"],rt={idle:"Saved",saving:"Saving...",saved:"Saved",error:"Could not save"},at=s=>{const i=Math.max(0,Math.round(s)),o=Math.floor(i/3600),l=Math.floor(i%3600/60),m=i%60;return o>0?`${o}h ${l}m`:l>0?`${l}m`:`${m}s`},nt=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"").slice(0,36)||"ticket";function Ge({task:s,disabled:i,isEditing:o,isOverlay:l=!1,onEditToggle:m,onTaskUpdate:a}
21){const{attributes:v,listeners:f,setActivatorNodeRef:g,setNodeRef:y,transform:k,isDragging:D}=ks({id:l?`${s.id}-overlay`:s.id,disabled:i||l}),x=k?{transform:Ss.Translate.toString(k)}:void 0;return e.jsxs("article",{ref:y,style:x,className:ue("rounded-lg border bg-white p-3 shadow-sm transition-all hover:border-blue-300 hover:shadow-md",D&&"opacity-0",l&&"w-72 rotate-1 shadow-xl"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-950",children:s.title}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[e.jsx(E,{variant:"outline",className:"text-[11px]",children:s.source}),s.skills.slice(0,2).map(t=>e.jsx(E,{variant:"secondary",className:"max-w-full truncate text-[11px]",children:t},t))]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(T,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",disabled:i,onClick:m,children:s.status==="done"?e.jsx(he,{className:"h-4 w-4"}):e.jsx(Vs,{className:"h-4 w-4"})}),e.jsx("button",{ref:g,type:"button",className:ue("rounded p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-700",i?"cursor-not-allowed opacity-40":"cursor-grab active:cursor-grabbing"),disabled:i,title:"Drag ticket",...f,...v,children:e.jsx(Rs,{className:"h-5 w-5"})})]})]}),o?e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{children:"Description"}),e.jsx(te,{value:s.description,disabled:i,className:"min-h-20 resize-y",onChange:t=>a(s.id,{description:t.target.value,updatedAt:new Date().toISOString()}),placeholder:"Explain your thinking, approach, and implementation notes."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{children:"Acceptance criteria"}),e.jsx(te,{value:s.acceptanceCriteria,disabled:i,className:"min-h-20 resize-y",onChange:t=>a(s.id,{acceptanceCriteria:t.target.value,updatedAt:new Date().toISOString()}),placeholder:"What must be true for this ticket to be complete?"})]})]}):e.jsxs("div",{className:"mt-3 space-y-2 text-sm text-gray-600",children:[e.jsx("p",{className:"line-clamp-3",children:s.description||"No description yet."}),s.acceptanceCriteria&&e.jsx("p",{className:"line-clamp-3 rounded-md bg-slate-50 p-2 text-xs text-gray-700",children:s.acceptanceCriteria})]})]})}function it({status:s,tasks:i,disabled:o,editingTaskId:l,onEditTask:m,onTaskUpdate:a}){const{isOver:v,setNodeRef:f}=Ns({id:s});return e.jsxs("section",{ref:f,className:ue("flex max-h-[620px] min-w-[280px] flex-col rounded-xl border p-3 transition-colors",tt[s],v&&"ring-2 ring-blue-300 ring-offset-2"),children:[e.jsxs("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:st[s]}),e.jsx(E,{variant:"secondary",children:i.length})]}),e.jsx("div",{className:ue("space-y-3 overflow-y-auto rounded-lg p-1 pr-2 transition-colors",i.length===0?"min-h-28":"min-h-40",v&&"border-2 border-dashed border-blue-300 bg-white/70"),children:i.length===0?e.jsx("div",{className:"rounded-lg border border-dashed bg-white/70 p-4 text-center text-sm text-muted-foreground",children:"Drop tickets here"}):i.map(g=>e.jsx(Ge,{task:g,disabled:o,isEditing:l===g.id,onEditToggle:()=>m(l===g.id?null:g.id),onTaskUpdate:a},g.id))})]})}function ot({epics:s,tasks:i,disabled:o,scopeAccepted:l,scopeAcceptedAt:m,workMode:a,repoUrl:v,repoVisibility:f,timeSpentSeconds:g,timerActive:y,saveStatus:k,onScopeAcceptedChange:D,onWorkModeChange:x,onTaskStatusChange:t,onTaskUpdate:p,onTaskCreate:M,onRepoChange:I,onRepoVisibilityChange:R}){const[N,j]=h.useState(null),[c,n]=h.useState(""),[w,$]=h.useState(null),{identity:U,connectUrl:B,isConnected:P}=ze(),z=h.useMemo(()=>{const d=new Map;return ke.forEach(S=>
21d.set(S,[])),i.forEach(S=>{var O;(O=d.get(S.status))==null||O.push(S)}),d},[i]),Y=w?i.find(d=>d.id===w)??null:null,pe=d=>{M({...d,updatedAt:new Date().toISOString()}),j(d.id)},J=()=>{var G;const d=c.trim();if(!d||o)return;const S=s[0],O={id:`task-workspace-${Date.now()}-${nt(d)}`,epicId:(S==null?void 0:S.id)??"epic-simulation-workspace",title:d,description:"",acceptanceCriteria:"",status:"todo",source:"workspace",skills:((G=S==null?void 0:S.skills)==null?void 0:G.slice(0,3))??[],deliverable:null,timeSpentSeconds:0,updatedAt:new Date().toISOString()};pe(O),n("")},ge=d=>{$(String(d.active.id))},re=d=>{var ae;$(null);const S=(ae=d.over)==null?void 0:ae.id,O=String(d.active.id);if(!S||!ke.includes(S))return;const G=i.find(be=>be.id===O);!G||G.status===S||t(O,S)},W=a==="direct_work";return e.jsxs("div",{className:"space-y-5",children:[e.jsxs(ee,{className:"border-blue-100 bg-gradient-to-br from-white to-blue-50/40",children:[e.jsx(de,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs(me,{className:"flex items-center gap-2 text-lg",children:[e.jsx(qs,{className:"h-5 w-5 text-blue-600"}),W?"Direct work mode":"Simulation sprint board"]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:W?"Work without the guided sprint board, then return to submit your result.":"Plan your work first, then move only the tickets you choose onto the board."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(E,{variant:k==="error"?"destructive":"secondary",className:"h-9 rounded-lg px-3",children:rt[k]}),e.jsx(T,{type:"button",size:"sm",variant:a==="guided_sprint"?"default":"outline",disabled:o,onClick:()=>x("guided_sprint"),children:"Guided sprint"}),e.jsx(T,{type:"button",size:"sm",variant:a==="direct_work"?"default":"outline",disabled:o,onClick:()=>x("direct_work"),children:"Direct work"})]})]})}),e.jsxs(se,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[1.2fr_1fr_220px]",children:[e.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border bg-white p-4",children:[e.jsx(Ce,{className:"mt-0.5",checked:l,disabled:o,onCheckedChange:d=>D(d===!0)}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm font-semibold text-gray-900",children:"Scope accepted"}),e.jsx("span",{className:"mt-1 block text-sm text-gray-600",children:m?`Accepted ${new Date(m).toLocaleString()}`:"Confirm you understand the brief before submitting."})]})]}),e.jsxs("div",{className:"rounded-lg border bg-white p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-900",children:[e.jsx(We,{className:"h-4 w-4 text-slate-700"}),"Repository"]}),e.jsxs(E,{variant:"outline",className:"gap-1",children:[f==="private"?e.jsx(as,{className:"h-3 w-3"}):e.jsx(As,{className:"h-3 w-3"}),f]})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[e.jsx(H,{value:v,disabled:o,onChange:d=>I(d.target.value),placeholder:"https://github.com/you/opportunity-work"}),e.jsx(T,{type:"button",variant:"outline",disabled:o,onClick:()=>R(f==="private"?"public":"private"),children:f==="private"?"Private":"Public"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:P?`Connected as @${U==null?void 0:U.github_username}`:"Connect GitHub to create or sync repos."}),!P&&B&&e.jsx("a",{className:"font-medium text-blue-700 hover:underline",href:B,children:"Connect"})]}),P&&e.jsx(Cs,{defaultRepoName:"xtern-opportunity",defaultDescription:"Xterns opportunity simulation workspace",defaultPrivate:f==="private",onCreated:d=>I(`https://github.com/${d}`),trigger:e.jsxs(T,{type:"button",variant:"outline",size:"sm",className:"mt-3 w-full gap-2",disabled:o,children:[e.jsx(ns,{className:"h-4 w-4"}),"Create GitHub repo"]})})]}),e.jsxs("div",{className:"rounded-lg border bg-white p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-900",children:[e.jsx(Ts,{className:"h-4 w-4 text-slate-700"}),"Time tracked"]}),e.jsx(E,{variant:y?"default":"secondary",children:at(g)})]}),e.jsxs(T,{type:"button",className:"mt-3 w-full",variant:"outline",disabled:!0,children:[e.jsx(Hs,{className:"mr-2 h-4 w-4"}),y?"Tracking session":"Paused"]})]})]}),W?e.jsxs("div",{className:"rounded-xl border border-emerald-100 bg-emerald-50 p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-emerald-950",children:"No sprint guide needed"}),e.jsx("p",{className:"mt-1 text-sm text-emerald-900",children:"Direct work skips tickets, planning, and board movement. Attach your artifact or repository in Evidence, then complete the reflection and AI usage disclosure in Submission."})]}):e.jsxs("div",{className:"rounded-xl border border-violet-100 bg-white p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-950",children:"Planning layer"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Create your own tickets, then move them across the board as you work."})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[e.jsx(H,{value:c,disabled:o,onChange:d=>n(d.target.value),onKeyDown:d=>{d.key==="Enter"&&J()},placeholder:"Create your own ticket, e.g. Implement auth flow"}),e.jsxs(T,{type:"button",disabled:o||!c.trim(),onClick:J,children:[e.jsx(Oe,{className:"mr-2 h-4 w-4"}),"Add ticket"]})]})]})]})]}),!W&&e.jsxs(vs,{collisionDetection:ws,onDragStart:ge,onDragEnd:re,children:[e.jsx("div",{className:"flex items-start gap-4 overflow-x-auto pb-2",children:ke.map(d=>e.jsx(it,{status:d,tasks:z.get(d)??[],disabled:o,editingTaskId:N,onEditTask:j,onTaskUpdate:p},d))}),e.jsx(ys,{children:Y?e.jsx(Ge,{task:Y,disabled:!1,isEditing:!1,isOverlay:!0,onEditToggle:()=>{},onTaskUpdate:p}):null})]})]})}const lt=15e3,ct=30,dt=6e4,mt=120*1e3,ut=8*3600,Fe=()=>new Date().toISOString().slice(0,10);function ht({enabled:s,scopeKey:i,serverSeconds:o,initialDailyTracked:l,onFlush:m}){const[a,v]=h.useState(0),[f,g]=h.useState(!1),y=h.useRef(0),k=h.useRef(Date.now()),D=h.useRef(Date.now()),x=h.useRef(Date.now()),t=h.useRef({...l??{}}
21),p=h.useRef(i),M=h.useRef(m);M.current=m;const I=h.useMemo(()=>JSON.stringify(l??{}),[l]),R=h.useCallback(N=>{const j=y.current;if(j<=0||!N)return;y.current=0,v(0),x.current=Date.now();const c=Fe();try{const n=M.current({scopeKey:N,incrementSeconds:j,dailyDate:c});n&&typeof n.catch=="function"&&n.catch(w=>{console.error("Simulation timer flush failed:",w)})}catch(n){console.error("Simulation timer flush failed:",n)}},[]);return h.useEffect(()=>{if(p.current===i)return;const N=p.current;R(N),p.current=i,y.current=0,v(0),t.current={...l??{}},k.current=Date.now(),D.current=Date.now(),x.current=Date.now()},[i,I,R]),h.useEffect(()=>{if(!s)return;const N=()=>{D.current=Date.now()},j=["mousemove","keydown","pointerdown","scroll","touchstart"];return j.forEach(c=>window.addEventListener(c,N,{passive:!0})),()=>j.forEach(c=>window.removeEventListener(c,N))},[s]),h.useEffect(()=>{if(!s){g(!1);return}k.current=Date.now(),D.current=Date.now(),x.current=Date.now(),g(!0);const N=window.setInterval(()=>{const j=Date.now(),c=Math.floor((j-k.current)/1e3);k.current=j;const n=Math.max(0,Math.min(ct,c)),w=j-D.current>mt,$=typeof document<"u"&&document.visibilityState==="hidden",U=!w&&!$;if(U&&n>0){const B=Fe(),P=t.current[B]??0,z=Math.max(0,Math.min(n,ut-P));z>0&&(t.current[B]=P+z,y.current+=z,v(y.current))}g(B=>B!==U?U:B),y.current>0&&j-x.current>=dt&&R(p.current)},lt);return()=>window.clearInterval(N)},[s,R]),h.useEffect(()=>{if(!s)return;const N=()=>{document.visibilityState==="hidden"?(R(p.current),g(!1)):(k.current=Date.now(),D.current=Date.now(),g(!0))},j=()=>R(p.current);return document.addEventListener("visibilitychange",N),window.addEventListener("pagehide",j),window.addEventListener("beforeunload",j),()=>{document.removeEventListener("visibilitychange",N),window.removeEventListener("pagehide",j),window.removeEventListener("beforeunload",j)}},[s,R]),h.useEffect(()=>()=>R(p.current),[R]),{displaySeconds:Math.max(0,Math.round(o))+a,pendingSeconds:a,isRunning:s&&f}}const xt={guided_sprint:"Guided sprint",direct_work:"Direct work"},pt={todo:"To do",in_progress:"In progress",blocked:"Blocked",done:"Done"},Be=s=>`xtern-simulation-work-mode:${s}`,Ue=[{key:"overview",label:"Overview",className:"border-blue-200 bg-blue-50 text-blue-950 hover:bg-blue-100"},{key:"board",label:"Board",className:"border-violet-200 bg-violet-50 text-violet-950 hover:bg-violet-100"},{key:"evidence",label:"Evidence",className:"border-emerald-200 bg-emerald-50 text-emerald-950 hover:bg-emerald-100"},{key:"submission",label:"Submission",className:"border-amber-200 bg-amber-50 text-amber-950 hover:bg-amber-100"}],ce=({title:s,items:i})=>i.length===0?null:e.jsxs("div",{className:"rounded-md border bg-white p-4",children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-gray-500",children:s}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm leading-6 text-gray-700",children:i.map(o=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx(he,{className:"mt-1 h-4 w-4 shrink-0 text-emerald-600"}),e.jsx("span",{children:o})]},o))})]}),X=s=>s&&typeof s=="object"&&!Array.isArray(s)?s:{},q=s=>{const i=typeof s=="number"?s:Number(s);return Number.isFinite(i)?i:null},K=s=>typeof s=="string"?s:"",Se=s=>Array.isArray(s)?s.map(i=>K(i).trim()).filter(Boolean):[],gt=s=>{const i=Math.max(0,Math.round(s)),o=Math.floor(i/3600),l=Math.floor(i%3600/60),m=i%60;return o>0?`${o}h ${l}m`:l>0?`${l}m`:`${m}s`},bt=s=>{const i=X(s==null?void 0:s.simulation_workspace),o=X(i.assessment);if(Object.keys(o).length===0)return null;const l=q(o.performance_score),m=l===5?5:l===1?1:3;return{performanceScore:m,performanceLabel:K(o.performance_label)||(m===5?"Excellent Performance":m===3?"Average Performance":"Low Effort"),feedbackSummary:K(o.feedback_summary),improvementRecommendations:Se(o.improvement_recommendations),recruiterPipelineVisible:o.recruiter_pipeline_visible!==!1,recruiterPipelineMessage:K(o.recruiter_pipeline_message)||"Congratulations! You have been added to the Recruiter Pipeline.",recruiterPipelineContext:K(o.recruiter_pipeline_context)||"Your profile is now available for consideration when employers open relevant Job roles within the Xterns talent network.",status:K(o.assessment_status)||"assessed",artifactCount:q(o.artifact_count)??0,completedTaskCount:q(o.completed_task_count)??0,taskCount:q(o.task_count)??0,skills:Se(o.skills),trustTier:q(o.trust_tier),attributionTier:q(o.attribution_tier),reviewNotes:Se(o.review_notes),assessedAt:K(o.assessed_at)||null}},Qt=()=>{const{opportunityId:s,section:i}=is(),o=os(),{toast:l}=ls(),{user:m}=cs(),{opportunity:a,isLoading:v}=Is(s),f=Ls(s),g=Ms(),y=_s(),k=$s(),D=Ps(),x=Fs(),[t,p]=h.useState(null),[M,I]=h.useState("idle"),R=h.useRef(null),N=h.useRef(null),j=h.useRef(!1),c=h.useRef(null);h.useEffect(()=>{var A,_;if(!a||!s)return;const r=`${s}:${((A=f.data)==null?void 0:A.id)??"not-started"}`;if(t&&R.current===r){((_=f.data)==null?void 0:_.stage)==="completed"&&t.submissionStatus==="draft"&&p({...t,submissionStatus:"submitted",completedAt:t.completedAt??f.data.completedAt});return}const b=window.localStorage.getItem(Be(s)),u=Bs(a,f.data);R.current=r,p({...u,lastWorkedAt:null,workMode:b==="guided_sprint"||b==="direct_work"?b:u.workMode}),I("idle")},[f.data,t,a,s]);const n=f.data,w=(n==null?void 0:n.stage)==="completed"||(t==null?void 0:t.submissionStatus)==="submitted"||(t==null?void 0:t.submissionStatus)==="assessment_pending"||(t==null?void 0:t.submissionStatus)==="completed",$=!!w;h.useEffect(()=>{var u;if(!s||!n||X((u=n.metadata)==null?void 0:u.simulation_workspace).last_worked_at==null)return;const b=`${s}:${n.id}`;c.current!==b&&(c.current=b,x.mutateAsync({opportunityId:s}).catch(A=>console.error("Failed to clear stale simulation timer:",A)))},[n,x,s]);const U=h.useMemo(()=>{var u;const r=X((u=n==null?void 0:n.metadata)==null?void 0:u.simulation_workspace),b=Number(r.time_spent_seconds??r.timeSpentSeconds??0);return Number.isFinite(b)?Math.max(0,Math.round(b)):0},[n==null?void 0:n.metadata]),B=h.useMemo(()=>{var A;const r=X((A=n==null?void 0:n.metadata)==null?void 0:A.simulation_workspace),b=X(r.daily_tracked),u={};return Object.entries(b).forEach(([_,L])=>{const V=Number(L);Number.isFinite(V)&&V>0&&(u[_]=Math.round(V))}),u},[n==null?void 0:n.metadata]),P=m!=null&&m.id&&s&&(n!=null&&n.id)?`${m.id}:${s}:${n.id}`:null,z=h.useCallback(async({scopeKey:r,incrementSeconds:b,dailyDate:u})=>{const A=P;if(!(!A||A!==r)&&!(!s||!n||w))try{await D.mutateAsync({opportunityId:s,incrementSeconds:b,dailyDate:u})}catch(_){console.error("Failed to credit simulation time:",_)}},[n,D,w,s,P]),Y=ht({enabled:!!(n&&t&&!w&&P),scopeKey:P,serverSeconds:U,initialDailyTracked:B,onFlush:z}),{isConnected:pe}=ze(),J=Y.displaySeconds,ge=Y.isRunning,re=h.useCallback(async()=>
21{if(!(!s||j.current)){for(j.current=!0;N.current;){const r=N.current;N.current=null;try{await y.mutateAsync({opportunityId:s,fields:r}),I("saved")}catch(b){console.error("Could not autosave opportunity workspace:",b),I("error")}}j.current=!1}},[s,y]),W=h.useCallback(r=>{!s||!n||w||(N.current=r,I("saving"),re())},[n,w,s,re]),d=h.useCallback((r,b={})=>{if(!t)return;const u={...t,...r};p(u),b.autosave!==!1&&W(u)},[W,t]),S=r=>{s&&window.localStorage.setItem(Be(s),r),d({workMode:r})},O=r=>{d({scopeAccepted:r,scopeAcceptedAt:r?(t==null?void 0:t.scopeAcceptedAt)??new Date().toISOString():null})},G=(r,b)=>{t&&d({tasks:t.tasks.map(u=>u.id===r?{...u,status:b,updatedAt:new Date().toISOString()}:u)})},ae=(r,b)=>{t&&d({tasks:t.tasks.map(u=>u.id===r?{...u,...b}:u)})},be=r=>{if(!t)return;const b=t.epics.length>0?t.epics.map((u,A)=>A===0?{...u,taskIds:[...new Set([...u.taskIds,r.id])]}:u):[{id:r.epicId,title:"Simulation workspace",description:"Self-organized tickets for this opportunity.",skills:r.skills,deliverables:[],taskIds:[r.id]}];d({epics:b,tasks:[...t.tasks,r]})},Ke=r=>{d({artifacts:r})},Ve=async()=>{var u,A;if(!s)return;const r=await g.mutateAsync(s);await f.refetch();const b=((u=r.atlasActivity)==null?void 0:u.published)===!1;l({title:b?"Simulation started, Atlas sync failed":"Simulation started",description:b?((A=r.atlasActivity)==null?void 0:A.errorMessage)||"Atlas did not receive the activity update.":"Your simulation workspace is ready.",variant:b?"destructive":void 0})},qe=async()=>{if(!(!s||!t))try{const r=t;I("saving"),await y.mutateAsync({opportunityId:s,fields:r}),p(r),I("saved"),l({title:"Workspace saved",description:"Your simulation scope, tasks, artifacts, and reflection were saved."})}catch(r){l({title:"Could not save workspace",description:r instanceof Error?r.message:"Please try again.",variant:"destructive"}),I("error")}},He=async()=>{var r,b,u,A;if(!(!s||!t))try{const _=t,L=await k.mutateAsync({opportunityId:s,fields:_}),V=!!(L.assessment&&!L.assessmentError);d({timeSpentSeconds:_.timeSpentSeconds,lastWorkedAt:null,submissionStatus:V?"completed":"submitted",assessmentState:V?"reviewed":"pending",submittedAt:_.submittedAt??L.completedAt,completedAt:L.completedAt},{autosave:!1}),await f.refetch();const fe=((r=L.atlasActivity)==null?void 0:r.published)===!1||((b=L.assessmentActivity)==null?void 0:b.published)===!1;l({title:L.assessmentError?"Submitted, assessment pending":fe?"Submitted, Atlas sync failed":"Congratulations! You have been added to the Recruiter Pipeline.",description:fe?((u=L.assessmentActivity)==null?void 0:u.errorMessage)||((A=L.atlasActivity)==null?void 0:A.errorMessage)||"Atlas did not receive the submission update.":L.assessmentError?L.assessmentError:"Your profile is now available for consideration when employers open relevant Job roles within the Xterns talent network.",variant:fe||L.assessmentError?"destructive":void 0})}catch(_){l({title:"Could not submit simulation",description:_ instanceof Error?_.message:"Please try again.",variant:"destructive"})}},Xe=v||f.isLoading||!!a&&!t,ne=(t==null?void 0:t.artifacts.filter(r=>r.title.trim()||r.url.trim()||r.repoUrl.trim()||r.commitSha.trim()).length)??0,Ae=!!(t!=null&&t.repoUrl.trim())||((t==null?void 0:t.artifacts.some(r=>r.repoUrl.trim()||r.commitSha.trim()))??!1),ie=(t==null?void 0:t.tasks.filter(r=>r.status==="done").length)??0,Ye=t!=null&&t.tasks.length?Math.round(ie/t.tasks.length*100):0,oe=(t==null?void 0:t.workMode)==="direct_work",C=h.useMemo(()=>bt(n==null?void 0:n.metadata),[n==null?void 0:n.metadata]),Q=[{label:"Scope accepted",done:!!(t!=null&&t.scopeAccepted)},{label:"Artifact attached",done:ne>0},{label:"Git attribution",done:Ae},{label:"Reflection written",done:!!(t!=null&&t.reflection.trim())},{label:"AI use disclosed",done:!!(t!=null&&t.aiUsageDisclosure.trim())}],Te=Math.round(Q.filter(r=>r.done).length/Q.length*100),Je=C?"Assessed":w?"Submitted":n?"Building":"Not started",Re=!!(n&&(t!=null&&t.scopeAccepted)&&t.reflection.trim()&&t.aiUsageDisclosure.trim()&&(ne>0||t.repoUrl.trim())&&(oe||ie>0)),De=s?`${window.location.origin}/xterns/opportunities/${s}/workspace`:window.location.href,Qe=a?`I am working on "${a.title}" from ${a.companyName} on Xterns. It is a real employer simulation where I can prove my skills through practical work and build evidence for global opportunities.`:"",Ze=`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(De)}`,es=`https://twitter.com/intent/tweet?text=${encodeURIComponent(Qe)}&url=${encodeURIComponent(De)}`,Z=Ue.some(r=>r.key===i)?i:"overview",ss=`/xterns/opportunities/${s}/workspace`;return Xe?e.jsx(je,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(ve,{}),e.jsx(we,{className:"flex items-center justify-center",children:e.jsx(le,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})}):!a||a.track!=="simulation"?e.jsx(je,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(ve,{}),e.jsxs(we,{className:"flex-1",children:[e.jsxs("header",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center gap-2 border-b bg-white px-4",children:[e.jsx(Ee,{className:"-ml-1"}),e.jsx(T,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(ye,{to:"/xterns/jobs",children:[e.jsx(Pe,{className:"mr-2 h-4 w-4"}),"Opportunities"]})})]}),e.jsx("div",{className:"p-6",children:e.jsx(ee,{children:e.jsx(se,{className:"py-12 text-center text-sm text-muted-foreground",children:"This simulation workspace is not available."})})})]})]})}):e.jsx(je,{children:e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(ve,{}),e.jsxs(we,{className:"flex-1",children:[e.jsxs("header",{className:"sticky top-0 z-40 flex h-16 shrink-0 items-center gap-2 border-b bg-white px-4",children:[e.jsx(Ee,{className:"-ml-1"}),e.jsxs(T,{variant:"ghost",size:"sm",onClick:()=>o("/xterns/jobs"),children:[e.jsx(Pe,{className:"mr-2 h-4 w-4"}),"Opportunities"]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"truncate text-xl font-semibold",children:a.title}),e.jsx("p",{className:"truncate text-sm text-gray-600",children:a.companyName})]}),w?e.jsxs(E,{className:C?"bg-emerald-100 text-emerald-800 hover:bg-emerald-100":"bg-amber-100 text-amber-800 hover:bg-amber-100",children:[e.jsx(ds,{className:"mr-1 h-3.5 w-3.5"}),C?"AI reviewed":"Assessment pending"]}):e.jsx(E,{variant:"secondary",children:xt[t.workMode]})]}),e.jsx("div",{className:"sticky top-16 z-30 border-b bg-white/95 px-6 py-3 backdrop-blur",children:e.jsx("nav",{className:"mx-auto grid max-w-7xl grid-cols-2 gap-2 text-sm md:flex md:overflow-x-auto",children:Ue.map(r=>e.jsx(ye,{to:`${ss}/${r.key}`,className:`rounded-lg border px-4 py-2 font-semibold transition-colors ${Z===r.key?"ring-2 ring-offset-2":""} ${r.className}`,children:r.label},r.key))})}),e.jsx("div",{className:"p-6",children:e.jsxs("section",{className:"mx-auto max-w-7xl space-y-6",children:[Z==="overview"&&e.jsxs(ee,{children:[e.jsxs(de,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.companyLogoUrl?e.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-xl border bg-white p-2",children:e.jsx("img",{src:a.c
21ompanyLogoUrl,alt:`${a.companyName} logo`,className:"max-h-full max-w-full object-contain"})}):e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl border bg-muted text-sm font-semibold",children:a.companyName.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{variant:"secondary",children:"Simulation"}),e.jsx(E,{variant:"outline",children:a.durationLabel}),e.jsx(E,{variant:"outline",children:a.workMode})]})]}),e.jsx(me,{className:"text-2xl",children:a.title})]}),e.jsxs(se,{className:"space-y-5",children:[e.jsxs("div",{className:a.introVideoUrl?"grid items-start gap-5 lg:grid-cols-[1fr_320px]":"",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-gray-500",children:"Project brief"}),e.jsx("p",{className:"mt-2 max-w-4xl whitespace-pre-line text-sm leading-6 text-gray-600",children:a.projectBrief||a.summary})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(T,{type:"button",variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:Ze,target:"_blank",rel:"noreferrer",children:[e.jsx(Us,{className:"mr-2 h-4 w-4"}),"Share on LinkedIn"]})}),e.jsx(T,{type:"button",variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:es,target:"_blank",rel:"noreferrer",children:[e.jsx(Xs,{className:"mr-2 h-4 w-4"}),"Share on X"]})})]})]}),a.introVideoUrl?e.jsx(Ds,{url:a.introVideoUrl,title:a.introVideoTitle,compact:!0}):null]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx(ce,{title:"Technology required",items:a.technologyRequirements.length>0?a.technologyRequirements:a.skills}),e.jsx(ce,{title:"Deliverables",items:a.deliverables.length>0?a.deliverables:[a.summary]}),e.jsx(ce,{title:"Acceptance criteria",items:a.acceptanceCriteria}),e.jsx(ce,{title:"Review rubric",items:a.reviewRubric}),(a.expectedTimeline||a.difficulty)&&e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-4 md:col-span-2",children:[e.jsx("h2",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-gray-500",children:"Work settings"}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.expectedTimeline&&e.jsxs(E,{className:"border-amber-300 bg-white text-amber-700 hover:bg-white",children:["Timeline: ",a.expectedTimeline]}),a.difficulty&&e.jsxs(E,{className:"border-violet-300 bg-white text-violet-700 hover:bg-white",children:["Difficulty: ",a.difficulty]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-4",children:[e.jsxs("div",{className:"rounded-md border border-blue-100 bg-blue-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-blue-900",children:[e.jsx(ms,{className:"h-4 w-4"}),"Readiness"]}),e.jsxs("p",{className:"mt-2 text-2xl font-semibold text-blue-950",children:[Te,"%"]})]}),e.jsxs("div",{className:"rounded-md border border-emerald-100 bg-emerald-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-900",children:[e.jsx(Es,{className:"h-4 w-4"}),"Evidence"]}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-emerald-950",children:ne})]}),e.jsxs("div",{className:"rounded-md border border-amber-100 bg-amber-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-900",children:[e.jsx(We,{className:"h-4 w-4"}),"Attribution"]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-amber-950",children:Ae?"Git linked":"Needs Git"})]}),e.jsxs("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-900",children:[e.jsx(Os,{className:"h-4 w-4"}),"Signal"]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-slate-950",children:Je})]})]})]})]}),Z==="board"&&e.jsx(ot,{epics:t.epics,tasks:t.tasks,disabled:!n||$,scopeAccepted:t.scopeAccepted,scopeAcceptedAt:t.scopeAcceptedAt,workMode:t.workMode,onScopeAcceptedChange:O,onWorkModeChange:S,onTaskStatusChange:G,onTaskUpdate:ae,onTaskCreate:be,repoUrl:t.repoUrl,repoVisibility:t.repoVisibility,timeSpentSeconds:J,timerActive:ge,saveStatus:M,onRepoChange:r=>d({repoUrl:r}),onRepoVisibilityChange:r=>d({repoVisibility:r})}),Z==="evidence"&&e.jsxs(ee,{children:[e.jsx(de,{children:e.jsxs(me,{className:"flex items-center gap-2 text-lg",children:[e.jsx(us,{className:"h-5 w-5 text-blue-600"}),"Artifacts"]})}),e.jsx(se,{children:e.jsx(Zs,{artifacts:t.artifacts,tasks:t.tasks,disabled:!n||$,linkedRepoUrl:t.repoUrl,githubConnected:pe,onChange:Ke})})]}),Z==="submission"&&e.jsxs(ee,{children:[e.jsx(de,{children:e.jsxs(me,{className:"flex items-center gap-2 text-lg",children:[e.jsx(zs,{className:"h-5 w-5 text-blue-600"}),"Submission"]})}),e.jsxs(se,{className:"space-y-5",children:[!n&&e.jsxs(T,{className:"w-full",onClick:()=>void Ve(),disabled:g.isPending,children:[g.isPending&&e.jsx(le,{className:"mr-2 h-4 w-4 animate-spin"}),"Start simulation"]}),!oe&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Task progress"}),e.jsxs("span",{className:"font-medium text-gray-900",children:[ie,"/",t.tasks.length]})]}),e.jsx(hs,{value:Ye,className:"h-2"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"rounded-md border bg-white p-3",children:[e.jsx("p",{className:"text-gray-600",children:"Artifacts"}),e.jsx("p",{className:"mt-1 text-xl font-semibold text-gray-900",children:ne})]}),e.jsxs("div",{className:"rounded-md border bg-white p-3",children:[e.jsx("p",{className:"text-gray-600",children:"Status"}),e.jsx("p",{className:"mt-1 text-sm font-semibold text-gray-900",children:C?"Reviewed":w?"Pending":"Draft"})]})]}),e.jsxs("div",{className:"space-y-3 rounded-md border bg-white p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900",children:"Submission readiness"}),e.jsxs("p",{className:"text-xs text-gray-500",children:[Q.filter(r=>r.done).length,"/",Q.length," complete"]})]}),e.jsxs(E,{variant:Re?"default":"secondary",children:[Te,"%"]})]}),e.jsx("div",{className:"space-y-2",children:Q.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-gray-600",children:r.label}),r.done?e.jsx(he,{className:"h-4 w-4 text-emerald-600"}):e.jsx(xs,{className:"h-4 w-4 text-amber-500"})]},r.label))})]}),e.jsxs("div",{className:"space-y-2 rounded-md border border-blue-100 bg-blue-50 p-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium text-blue-950",children:[e.jsx(Ws,{className:"h-4 w-4"}),"Signal evidence"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-blue-900",children:[!
21oe&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Tasks done"}),e.jsx("span",{className:"text-right font-medium",children:ie})]}),e.jsx("span",{children:"Time tracked"}),e.jsx("span",{className:"text-right font-medium",children:gt(J)}),e.jsx("span",{children:"Skills in scope"}),e.jsx("span",{className:"text-right font-medium",children:a.skills.length})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"reflection",children:"Reflection"}),e.jsx(te,{id:"reflection",value:t.reflection,onChange:r=>d({reflection:r.target.value}),disabled:!n||$,className:"min-h-32",placeholder:"What did you build, what tradeoffs did you make, and what would you improve next?"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"ai-usage",children:"AI usage disclosure"}),e.jsx(te,{id:"ai-usage",value:t.aiUsageDisclosure,onChange:r=>d({aiUsageDisclosure:r.target.value}),disabled:!n||$,className:"min-h-28",placeholder:"Mention any AI tools used, what they helped with, and what you verified yourself."})]}),!oe&&e.jsx("div",{className:"space-y-2 rounded-md border bg-white p-3",children:Object.entries(pt).map(([r,b])=>e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:b}),e.jsx("span",{className:"font-medium text-gray-900",children:t.tasks.filter(u=>u.status===r).length})]},r))}),w&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800",children:"Submitted evidence is locked while the review result remains available below."}),C&&e.jsxs("div",{className:"space-y-4 rounded-md border border-emerald-200 bg-emerald-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-emerald-950",children:"AI Review Engine"}),e.jsx("p",{className:"text-xs text-emerald-800",children:C.assessedAt?new Date(C.assessedAt).toLocaleString():C.status})]}),e.jsxs(E,{className:"bg-emerald-100 text-emerald-900 hover:bg-emerald-100",children:[C.performanceScore,"/5 - ",C.performanceLabel]})]}),e.jsxs("div",{className:"rounded-md border border-emerald-200 bg-white p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-emerald-950",children:"Feedback Summary"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-emerald-900",children:C.feedbackSummary})]}),C.improvementRecommendations.length>0&&e.jsxs("div",{className:"rounded-md border border-emerald-200 bg-white p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-emerald-950",children:"Improvement Recommendations"}),e.jsx("div",{className:"mt-2 space-y-2",children:C.improvementRecommendations.map(r=>e.jsxs("div",{className:"flex gap-2 text-sm text-emerald-900",children:[e.jsx(he,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600"}),e.jsx("span",{children:r})]},r))})]}),C.recruiterPipelineVisible&&e.jsxs("div",{className:"rounded-md border border-blue-200 bg-blue-50 p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-blue-950",children:C.recruiterPipelineMessage}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-blue-900",children:C.recruiterPipelineContext})]}),C.skills.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:C.skills.slice(0,6).map(r=>e.jsx(E,{variant:"outline",className:"border-emerald-200 bg-white text-emerald-900",children:r},r))}),e.jsxs("div",{className:"rounded-md border border-slate-200 bg-white p-3",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-950",children:"Take the Next Opportunity Simulation"}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-slate-700",children:"Keep up the momentum. Complete more opportunity simulations to strengthen your portfolio, improve your recruiter visibility, and increase your chances of being matched with future roles."}),e.jsx(T,{asChild:!0,className:"mt-3",children:e.jsxs(ye,{to:"/xterns/jobs",children:["Take the Next Opportunity Simulation",e.jsx(ps,{className:"ml-2 h-4 w-4"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[e.jsxs(T,{variant:"outline",onClick:()=>void qe(),disabled:!n||$||y.isPending,children:[y.isPending?e.jsx(le,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Gs,{className:"mr-2 h-4 w-4"}),"Save"]}),e.jsxs(T,{onClick:()=>void He(),disabled:!Re||$||k.isPending,children:[k.isPending?e.jsx(le,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Ks,{className:"mr-2 h-4 w-4"}),"Submit"]})]})]})]})]})})]})]})})};export{Qt 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.