@ai-sdet/test-manager 0.1.5

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.
Files changed (30) hide show
  1. package/README.md +312 -0
  2. package/dist/cli.js +16455 -0
  3. package/dist/client/assets/AIView-BYoeRnLC.js +73 -0
  4. package/dist/client/assets/AdminSettingsView-JqCQI3K1.js +1 -0
  5. package/dist/client/assets/ChatSection-rpiFyFcg.js +8 -0
  6. package/dist/client/assets/MilestonesView-CTJ8r67W.js +1 -0
  7. package/dist/client/assets/ReportsView-DJ8KPr1J.js +1 -0
  8. package/dist/client/assets/RunExecution-BJnn0cq7.js +1 -0
  9. package/dist/client/assets/RunsView-oDa9JyRq.js +1 -0
  10. package/dist/client/assets/SettingsView-BVCLWqOk.js +1 -0
  11. package/dist/client/assets/SpaceView-BxtPCtW1.js +1 -0
  12. package/dist/client/assets/TestEditor-Dthst0HS.js +63 -0
  13. package/dist/client/assets/TestMuImportDialog-B2yx7BdF.js +5 -0
  14. package/dist/client/assets/TrashView-B5uFN2Ua.js +1 -0
  15. package/dist/client/assets/UserGroupsView-MGu6frpT.js +1 -0
  16. package/dist/client/assets/UsersView-DwWeOblN.js +1 -0
  17. package/dist/client/assets/comments-section-CHZSUoK5.js +53 -0
  18. package/dist/client/assets/hooks-BItXZ0yP.js +1 -0
  19. package/dist/client/assets/hooks-BM-wcPhm.js +4 -0
  20. package/dist/client/assets/icons-J9gKYxTz.js +41 -0
  21. package/dist/client/assets/index-CYPrMEmp.css +1 -0
  22. package/dist/client/assets/index-a9kCDHqT.js +7 -0
  23. package/dist/client/assets/markdown-YKl4gdXq.js +29 -0
  24. package/dist/client/assets/radix-ui-Cxk3sw_C.js +41 -0
  25. package/dist/client/assets/react-D-pHAthU.js +40 -0
  26. package/dist/client/assets/tiptap-Ch64zYGz.js +167 -0
  27. package/dist/client/index.html +62 -0
  28. package/dist/index.js +12990 -0
  29. package/dist/server/index.js +16195 -0
  30. package/package.json +124 -0
@@ -0,0 +1 @@
1
+ import{j as e,r as v,b as k}from"./react-D-pHAthU.js";import{x as Y,au as q,aM as I,d as K,aN as W,q as O,D as ee,C as G,o as H,aa as te}from"./icons-J9gKYxTz.js";import{b,u as U,C as _,S as g}from"./index-a9kCDHqT.js";import{m as V,T as re,A as le,n as se,p as N,V as ie,o as ne,q as E,r as P,s as M,t as A,u as ae,v as oe}from"./hooks-BM-wcPhm.js";import{C as de}from"./comments-section-CHZSUoK5.js";import"./radix-ui-Cxk3sw_C.js";import"./markdown-YKl4gdXq.js";import"./tiptap-Ch64zYGz.js";function ce({appId:t,planId:i}){const f={cacheKey:`plan:${i}`,load:()=>b.plans.comments.list(t,i),create:d=>b.plans.comments.create(t,i,d).then(()=>{}),reply:(d,o)=>b.plans.comments.reply(t,i,d,o).then(()=>{}),update:(d,o)=>b.plans.comments.update(t,i,d,o).then(()=>{}),delete:d=>b.plans.comments.delete(t,i,d).then(()=>{})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,padding:"14px 16px 12px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx(Y,{size:15,weight:"duotone",color:"var(--t-text-muted)"}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",fontWeight:600,color:"var(--t-text-secondary)"},children:"Comments"})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",padding:"12px 16px"},children:e.jsx(de,{appId:t,source:f})})]})}const xe={analysis:{label:"Analysis",subtitle:"Pre-dev analysis and impact reports for tickets and features.",icon:e.jsx(H,{size:20,weight:"fill"})},"test-plan":{label:"Test Plans",subtitle:"Test plans generated from tickets and codebase analysis.",icon:e.jsx(G,{size:20,weight:"fill"})},"test-report":{label:"Test Reports",subtitle:"Execution reports and test run summaries.",icon:e.jsx(ee,{size:20,weight:"fill"})}},Q={draft:{label:"Draft",color:"var(--t-text-muted)",bg:"var(--t-bg-panel)",border:"var(--t-border-subtle)",icon:e.jsx(te,{size:11,weight:"bold"})},published:{label:"Published",color:"var(--t-accent-success)",bg:"rgba(22,163,74,0.08)",border:"rgba(22,163,74,0.25)",icon:e.jsx(K,{size:11,weight:"bold"})},archived:{label:"Archived",color:"var(--t-text-muted)",bg:"var(--t-bg-panel)",border:"var(--t-border-subtle)",icon:e.jsx(W,{size:11,weight:"bold"})}};function F({status:t}){const i=Q[t];return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"0 7px",height:20,borderRadius:4,fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:i.color,background:i.bg,border:`1px solid ${i.border}`,flexShrink:0},children:[i.icon," ",i.label]})}const j={display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:5,fontSize:11,fontWeight:500,border:"1px solid var(--t-border-subtle)",background:"transparent",cursor:"pointer",color:"var(--t-text-muted)"};function X(){const t=[120,260,70,90,70,90,80,48];return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"10px 20px",borderBottom:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx(g,{width:50,height:16,borderRadius:4}),e.jsx("div",{style:{flex:1}}),[48,48,72,64].map((i,f)=>e.jsx(g,{width:i,height:24,borderRadius:5},f))]}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-panel)"},children:["Ticket","Summary","Complexity","Repo","Status","Created by","Date",""].map(i=>e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--t-text-muted)",whiteSpace:"nowrap"},children:i},i))})}),e.jsx("tbody",{children:Array.from({length:6}).map((i,f)=>e.jsx("tr",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:t.map((d,o)=>e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx(g,{width:d,height:o===4?20:13,borderRadius:o===4?4:3})},o))},f))})]})})]})}function Z(){return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[e.jsxs("div",{style:{padding:"12px 16px 10px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,background:"var(--t-bg-elevated)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(g,{width:30,height:30,borderRadius:6}),e.jsx(g,{width:1,height:20,borderRadius:0}),e.jsx(g,{width:80,height:18,borderRadius:4}),e.jsx(g,{width:60,height:20,borderRadius:4}),e.jsx("div",{style:{flex:1}}),e.jsx(g,{width:120,height:30,borderRadius:6}),e.jsx(g,{width:30,height:30,borderRadius:6})]}),e.jsx(g,{width:340,height:13,borderRadius:3,style:{marginLeft:40}})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",padding:20,display:"flex",flexDirection:"column",gap:16},children:[180,220,160,200,140].map((t,i)=>e.jsxs("div",{style:{borderRadius:8,border:"1px solid var(--t-border-subtle)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-panel)",display:"flex",alignItems:"center",gap:10},children:[e.jsx(g,{width:16,height:16,borderRadius:3}),e.jsx(g,{width:100+i*15,height:13,borderRadius:3})]}),e.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:10},children:Array.from({length:Math.round(t/40)}).map((f,d)=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx(g,{width:`${60+d*17%30}%`,height:11,borderRadius:3}),e.jsx(g,{width:`${40+d*13%35}%`,height:9,borderRadius:3})]},d))})]},i))})]})}function fe({appId:t,onNavigate:i,statusFilter:f}){const{user:d}=U(),o=P.get(t),[y,s]=v.useState(o??[]),[C,T]=v.useState(!o),[w,u]=v.useState(null),[n,p]=v.useState(null);v.useEffect(()=>{P.has(t)||T(!0),b.analyses.list(t).then(l=>{s(l),P.set(t,l),l.forEach(r=>V.set(E(t,r.id),r))}).finally(()=>T(!1))},[t]);async function D(l,r){u(l.id);try{const a=await b.analyses.updateStatus(t,l.id,r);s(c=>{const m=c.map(h=>h.id===l.id?a:h);return P.set(t,m),V.set(E(t,a.id),a),m})}finally{u(null)}}async function z(l){u(l.id);try{await b.analyses.delete(t,l.id),s(r=>{const a=r.filter(c=>c.id!==l.id);return P.set(t,a),V.delete(E(t,l.id)),a})}finally{u(null)}}const R=f==="all"?y:y.filter(l=>l.status===f);return C?e.jsx(X,{}):y.length===0?e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:"var(--t-text-muted)"},children:[e.jsx(H,{size:32}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)"},children:"No analyses saved yet. Run an analysis in the AI chat and click Save."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:e.jsx("div",{style:{flex:1,overflowY:"auto"},children:R.length===0?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:["No ",f!=="all"?f:""," analyses."]}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-panel)"},children:["Ticket","Summary","Complexity","Repo","Status","Created by","Date",""].map(l=>e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--t-text-muted)",whiteSpace:"nowrap"},children:l},l))})}),e.jsx("tbody",{children:R.map(l=>{var m;let r={};try{r=JSON.parse(l.analysisData)}catch{}const a=((m=r.feasibility)==null?void 0:m.complexity)??"—",c=d!=null&&Number(d.id)===Number(l.createdBy);return e.jsxs("tr",{onClick:()=>i({type:"analysis-detail",appId:t,analysisId:l.id}),style:{borderBottom:"1px solid var(--t-border-subtle)",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:h=>h.currentTarget.style.background="var(--t-bg-hover)",onMouseLeave:h=>h.currentTarget.style.background="",children:[e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("code",{style:{fontSize:12,fontWeight:700,color:"var(--t-text-primary)",fontFamily:"monospace"},children:l.ticketId})}),e.jsx("td",{style:{padding:"10px 16px",maxWidth:320},children:e.jsx("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:l.ticketSummary})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-secondary)"},children:a})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-muted)"},children:l.repoName??"—"})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(F,{status:l.status})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-secondary)"},children:l.createdByName})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-muted)"},children:new Date(l.createdAt).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})})}),e.jsx("td",{style:{padding:"10px 16px"},onClick:h=>h.stopPropagation(),children:c&&e.jsxs("div",{style:{display:"flex",gap:4},children:[l.status==="published"&&e.jsxs("button",{onClick:()=>p({title:"Archive analysis",description:`Archive analysis for ${l.ticketId}? It will be hidden from the main view.`,confirmLabel:"Archive",confirmVariant:"default",onConfirm:()=>D(l,"archived")}),disabled:w===l.id,style:{...j,fontSize:10},title:"Archive",children:[e.jsx(W,{size:11,weight:"bold"})," Archive"]}),l.status!=="draft"&&e.jsx("button",{onClick:()=>p({title:"Revert to draft",description:`Revert analysis for ${l.ticketId} to draft? It will be hidden from other team members.`,confirmLabel:"Revert to draft",confirmVariant:"default",onConfirm:()=>D(l,"draft")}),disabled:w===l.id,style:{...j,fontSize:10},title:"Revert to Draft",children:"Draft"}),e.jsx("button",{onClick:()=>p({title:"Delete analysis",description:`Delete analysis for ${l.ticketId}? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive",onConfirm:()=>z(l)}),disabled:w===l.id,style:{...j,fontSize:10,color:"var(--t-accent-danger)",borderColor:"rgba(220,38,38,0.2)"},title:"Delete",children:e.jsx(O,{size:11,weight:"bold"})})]})})]},l.id)})})]})})}),e.jsx(_,{open:!!n,title:(n==null?void 0:n.title)??"",description:(n==null?void 0:n.description)??"",confirmLabel:n==null?void 0:n.confirmLabel,confirmVariant:n==null?void 0:n.confirmVariant,onConfirm:()=>{const l=n;p(null),l==null||l.onConfirm()},onCancel:()=>p(null)})]})}function Se({appId:t,analysisId:i,onBack:f}){const{user:d}=U(),o=E(t,i),y=V.get(o)??null,[s,C]=v.useState(y),[T,w]=v.useState(!y),[u,n]=v.useState(!1),[p,D]=v.useState("cards"),[z,R]=v.useState(!1),[l,r]=v.useState(!1),[a,c]=v.useState(null);v.useEffect(()=>{const x=V.get(o)??null;x||w(!0),b.analyses.get(t,i).then(L=>{C(L),V.set(o,L)}).catch(()=>{x||C(null)}).finally(()=>w(!1))},[t,i,o]);async function m(x){if(s){n(!0);try{const L=await b.analyses.updateStatus(t,s.id,x);C(L),V.set(o,L);const B=P.get(t);B&&P.set(t,B.map(J=>J.id===s.id?L:J))}finally{n(!1)}}}async function h(){if(s){n(!0);try{await b.analyses.delete(t,s.id),V.delete(o);const x=P.get(t);x&&P.set(t,x.filter(L=>L.id!==s.id)),f()}finally{n(!1)}}}if(T)return e.jsx(Z,{});if(!s)return e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:"Analysis not found."});let S=null;try{S=JSON.parse(s.analysisData)}catch{}const $=d!=null&&Number(d.id)===Number(s.createdBy);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[e.jsxs("div",{style:{padding:"12px 16px 10px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,background:"var(--t-bg-elevated)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{onClick:f,title:"Back to Analysis list",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",cursor:"pointer",color:"var(--t-text-muted)",flexShrink:0},children:e.jsx(q,{size:15,weight:"bold"})}),e.jsx("span",{style:{width:1,height:20,background:"var(--t-border-subtle)",flexShrink:0}}),e.jsx("code",{style:{fontSize:14,fontWeight:700,color:"var(--t-text-primary)",fontFamily:"monospace",flexShrink:0},children:s.ticketId}),e.jsx(F,{status:s.status}),s.ticketUrl&&e.jsx("a",{href:s.ticketUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",fontSize:11,fontWeight:500,color:"var(--t-text-secondary)",textDecoration:"none",flexShrink:0,cursor:"pointer"},onMouseEnter:x=>{x.currentTarget.style.background="var(--t-bg-elevated)",x.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent",x.currentTarget.style.color="var(--t-text-secondary)"},children:"View in Jira ↗"}),e.jsx("div",{style:{flex:1}}),e.jsx("div",{style:{display:"flex",borderRadius:6,overflow:"hidden",border:"1px solid var(--t-border-subtle)",flexShrink:0},children:re.map(({mode:x,icon:L,label:B})=>e.jsxs("button",{onClick:()=>D(x),style:{display:"flex",alignItems:"center",gap:5,padding:"5px 11px",border:"none",cursor:"pointer",fontSize:11,fontWeight:500,background:p===x?"var(--t-text-primary)":"transparent",color:p===x?"var(--t-bg-base)":"var(--t-text-muted)",transition:"background 0.12s"},children:[L,B]},x))}),e.jsx("button",{onClick:()=>R(!0),title:"Expand to full screen",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",cursor:"pointer",color:"var(--t-text-muted)",flexShrink:0},children:e.jsx(I,{size:13,weight:"bold"})}),e.jsx("button",{onClick:()=>r(x=>!x),title:"Comments",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:6,border:"1px solid var(--t-border-subtle)",background:l?"var(--t-bg-elevated)":"transparent",cursor:"pointer",color:l?"var(--t-text-primary)":"var(--t-text-muted)",flexShrink:0},children:e.jsx(Y,{size:13,weight:l?"fill":"regular"})}),$&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:1,height:20,background:"var(--t-border-subtle)",flexShrink:0}}),s.status==="draft"&&e.jsxs("button",{onClick:()=>c({title:"Publish analysis",description:`Publish analysis for ${s.ticketId}? It will be visible to all team members.`,confirmLabel:"Publish",confirmVariant:"default",onConfirm:()=>m("published")}),disabled:u,style:{...j,color:"var(--t-accent-success)",borderColor:"rgba(22,163,74,0.3)"},children:[e.jsx(K,{size:12,weight:"bold"})," Publish"]}),s.status==="published"&&e.jsxs("button",{onClick:()=>c({title:"Archive analysis",description:`Archive analysis for ${s.ticketId}? It will be hidden from the main view.`,confirmLabel:"Archive",confirmVariant:"default",onConfirm:()=>m("archived")}),disabled:u,style:j,children:[e.jsx(W,{size:12,weight:"bold"})," Archive"]}),s.status!=="draft"&&e.jsx("button",{onClick:()=>c({title:"Revert to draft",description:`Revert analysis for ${s.ticketId} to draft? It will be hidden from other team members.`,confirmLabel:"Revert to draft",confirmVariant:"default",onConfirm:()=>m("draft")}),disabled:u,style:j,children:"Revert to Draft"}),e.jsxs("button",{onClick:()=>c({title:"Delete analysis",description:`Delete analysis for ${s.ticketId}? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive",onConfirm:h}),disabled:u,style:{...j,color:"var(--t-accent-danger)",borderColor:"rgba(220,38,38,0.3)"},children:[e.jsx(O,{size:12,weight:"bold"})," Delete"]})]})]}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",paddingLeft:40,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.ticketSummary})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px"},children:S?e.jsx(le,{data:S,appId:t,analysisId:i,hideSave:!0,standalone:!0,viewMode:p,setViewMode:D,expanded:z,setExpanded:R}):e.jsx("p",{style:{color:"var(--t-text-muted)"},children:"Could not parse analysis data."})}),l&&e.jsx("div",{style:{width:380,flexShrink:0,borderLeft:"1px solid var(--t-border-subtle)",display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--t-bg-surface)"},children:e.jsx(se,{appId:t,analysisId:i})})]})]}),e.jsx(_,{open:!!a,title:(a==null?void 0:a.title)??"",description:(a==null?void 0:a.description)??"",confirmLabel:a==null?void 0:a.confirmLabel,confirmVariant:a==null?void 0:a.confirmVariant,onConfirm:()=>{const x=a;c(null),x==null||x.onConfirm()},onCancel:()=>c(null)})]})}function he({appId:t,onNavigate:i,statusFilter:f}){const{user:d}=U(),o=A.get(t),[y,s]=k.useState(o??[]),[C,T]=k.useState(!o),[w,u]=k.useState(null),[n,p]=k.useState(null);k.useEffect(()=>{A.has(t)||T(!0),b.plans.list(t).then(r=>{s(r),A.set(t,r),r.forEach(a=>N.set(M(t,a.id),a))}).finally(()=>T(!1))},[t]);async function D(r,a){u(r.id);try{const c=await b.plans.updateStatus(t,r.id,a);s(m=>{const h=m.map(S=>S.id===r.id?c:S);return A.set(t,h),N.set(M(t,c.id),c),h})}finally{u(null)}}async function z(r){u(r.id);try{await b.plans.delete(t,r.id),s(a=>{const c=a.filter(m=>m.id!==r.id);return A.set(t,c),N.delete(M(t,r.id)),c})}finally{u(null)}}const R=f==="all"?y:y.filter(r=>r.status===f);if(C)return e.jsx(X,{});if(y.length===0)return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:"var(--t-text-muted)"},children:[e.jsx(G,{size:32}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)"},children:"No test plans saved yet. Run a test plan in the AI chat and click Save."})]});const l=r=>r==="plan"?"Test Plan":r==="notes"?"Test Notes":"Plan + Notes";return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:e.jsx("div",{style:{flex:1,overflowY:"auto"},children:R.length===0?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:["No ",f!=="all"?f:""," plans."]}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-panel)"},children:["Ticket","Summary","Type","Repo","MR/PR","Status","Created by","Date",""].map(r=>e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--t-text-muted)",whiteSpace:"nowrap"},children:r},r))})}),e.jsx("tbody",{children:R.map(r=>{const a=d!=null&&Number(d.id)===Number(r.createdBy);return e.jsxs("tr",{onClick:()=>i({type:"plan-detail",appId:t,planId:r.id}),style:{borderBottom:"1px solid var(--t-border-subtle)",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:c=>c.currentTarget.style.background="var(--t-bg-hover)",onMouseLeave:c=>c.currentTarget.style.background="",children:[e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("code",{style:{fontSize:12,fontWeight:700,color:"var(--t-text-primary)",fontFamily:"monospace"},children:r.ticketId})}),e.jsx("td",{style:{padding:"10px 16px",maxWidth:300},children:e.jsx("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:r.ticketSummary})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:11,color:"var(--t-accent-primary)",background:"var(--t-accent-primary-subtle)",padding:"2px 7px",borderRadius:4,fontWeight:600},children:l(r.planType)})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-muted)"},children:r.repoName??"—"})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:r.mrPrUrl?e.jsx("a",{href:r.mrPrUrl,target:"_blank",rel:"noreferrer",onClick:c=>c.stopPropagation(),style:{fontSize:12,color:"var(--t-accent-primary)",textDecoration:"none"},children:"View ↗"}):e.jsx("span",{style:{fontSize:12,color:"var(--t-text-muted)"},children:"—"})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(F,{status:r.status})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-secondary)"},children:r.createdByName})}),e.jsx("td",{style:{padding:"10px 16px",whiteSpace:"nowrap"},children:e.jsx("span",{style:{fontSize:12,color:"var(--t-text-muted)"},children:new Date(r.createdAt).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})})}),e.jsx("td",{style:{padding:"10px 16px"},onClick:c=>c.stopPropagation(),children:a&&e.jsxs("div",{style:{display:"flex",gap:4},children:[r.status==="published"&&e.jsxs("button",{onClick:()=>p({title:"Archive plan",description:`Archive plan for ${r.ticketId}? It will be hidden from the main view.`,confirmLabel:"Archive",confirmVariant:"default",onConfirm:()=>D(r,"archived")}),disabled:w===r.id,style:{...j,fontSize:10},children:[e.jsx(W,{size:11,weight:"bold"})," Archive"]}),r.status!=="draft"&&e.jsx("button",{onClick:()=>p({title:"Revert to draft",description:`Revert plan for ${r.ticketId} to draft? It will be hidden from other team members.`,confirmLabel:"Revert to draft",confirmVariant:"default",onConfirm:()=>D(r,"draft")}),disabled:w===r.id,style:{...j,fontSize:10},children:"Draft"}),e.jsx("button",{onClick:()=>p({title:"Delete plan",description:`Delete plan for ${r.ticketId}? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive",onConfirm:()=>z(r)}),disabled:w===r.id,style:{...j,fontSize:10,color:"var(--t-accent-danger)",borderColor:"rgba(220,38,38,0.2)"},children:e.jsx(O,{size:11,weight:"bold"})})]})})]},r.id)})})]})})}),e.jsx(_,{open:!!n,title:(n==null?void 0:n.title)??"",description:(n==null?void 0:n.description)??"",confirmLabel:n==null?void 0:n.confirmLabel,confirmVariant:n==null?void 0:n.confirmVariant,onConfirm:()=>{const r=n;p(null),r==null||r.onConfirm()},onCancel:()=>p(null)})]})}function ke({appId:t,planId:i,onBack:f}){const{user:d}=U(),o=M(t,i),y=N.get(o)??null,[s,C]=k.useState(y),[T,w]=k.useState(!y),[u,n]=k.useState(!1),[p,D]=k.useState("list"),[z,R]=k.useState(!1),[l,r]=k.useState(null);k.useEffect(()=>{const h=N.get(o)??null;h||w(!0),b.plans.get(t,i).then(S=>{C(S),N.set(o,S)}).catch(()=>{h||C(null)}).finally(()=>w(!1))},[t,i,o]);async function a(h){if(s){n(!0);try{const S=await b.plans.updateStatus(t,s.id,h);C(S),N.set(o,S);const $=A.get(t);$&&A.set(t,$.map(x=>x.id===s.id?S:x))}finally{n(!1)}}}async function c(){if(s){n(!0);try{await b.plans.delete(t,s.id),ae(t,s.id),oe(t),f()}finally{n(!1)}}}if(T)return e.jsx(Z,{});if(!s)return e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:"Plan not found."});const m=d!=null&&Number(d.id)===Number(s.createdBy);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[e.jsxs("div",{style:{padding:"12px 16px 10px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,background:"var(--t-bg-elevated)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{onClick:f,title:"Back to Test Plans",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",cursor:"pointer",color:"var(--t-text-muted)",flexShrink:0},children:e.jsx(q,{size:15,weight:"bold"})}),e.jsx("span",{style:{width:1,height:20,background:"var(--t-border-subtle)",flexShrink:0}}),e.jsx("code",{style:{fontSize:14,fontWeight:700,color:"var(--t-text-primary)",fontFamily:"monospace",flexShrink:0},children:s.ticketId}),e.jsx(F,{status:s.status}),s.ticketUrl&&e.jsx("a",{href:s.ticketUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",fontSize:11,fontWeight:500,color:"var(--t-text-secondary)",textDecoration:"none",flexShrink:0},children:"View in Jira ↗"}),s.mrPrUrl&&e.jsx("a",{href:s.mrPrUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",fontSize:11,fontWeight:500,color:"var(--t-text-secondary)",textDecoration:"none",flexShrink:0},children:"View MR/PR ↗"}),e.jsx("div",{style:{flex:1}}),e.jsx(ie,{viewMode:p,setViewMode:D}),e.jsx("button",{onClick:()=>R(h=>!h),title:"Comments",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:6,border:"1px solid var(--t-border-subtle)",background:z?"var(--t-bg-elevated)":"transparent",cursor:"pointer",color:z?"var(--t-text-primary)":"var(--t-text-muted)",flexShrink:0},children:e.jsx(Y,{size:13,weight:z?"fill":"regular"})}),m&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:1,height:20,background:"var(--t-border-subtle)",flexShrink:0}}),s.status==="draft"&&e.jsxs("button",{onClick:()=>r({title:"Publish plan",description:`Publish plan for ${s.ticketId}? It will be visible to all team members.`,confirmLabel:"Publish",confirmVariant:"default",onConfirm:()=>a("published")}),disabled:u,style:{...j,color:"var(--t-accent-success)",borderColor:"rgba(22,163,74,0.3)"},children:[e.jsx(K,{size:12,weight:"bold"})," Publish"]}),s.status==="published"&&e.jsxs("button",{onClick:()=>r({title:"Archive plan",description:`Archive plan for ${s.ticketId}? It will be hidden from the main view.`,confirmLabel:"Archive",confirmVariant:"default",onConfirm:()=>a("archived")}),disabled:u,style:j,children:[e.jsx(W,{size:12,weight:"bold"})," Archive"]}),s.status!=="draft"&&e.jsx("button",{onClick:()=>r({title:"Revert to draft",description:`Revert plan for ${s.ticketId} to draft? It will be hidden from other team members.`,confirmLabel:"Revert to draft",confirmVariant:"default",onConfirm:()=>a("draft")}),disabled:u,style:j,children:"Revert to Draft"}),e.jsxs("button",{onClick:()=>r({title:"Delete plan",description:`Delete plan for ${s.ticketId}? This cannot be undone.`,confirmLabel:"Delete",confirmVariant:"destructive",onConfirm:c}),disabled:u,style:{...j,color:"var(--t-accent-danger)",borderColor:"rgba(220,38,38,0.3)"},children:[e.jsx(O,{size:12,weight:"bold"})," Delete"]})]})]}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",paddingLeft:40,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.ticketSummary})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsx("div",{style:{flex:1,overflowY:"auto",padding:20},children:e.jsx(ne,{planData:s.planData,testNotes:s.testNotes,planType:s.planType,viewMode:p})}),z&&e.jsx("div",{style:{width:380,flexShrink:0,borderLeft:"1px solid var(--t-border-subtle)",display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--t-bg-surface)"},children:e.jsx(ce,{appId:t,planId:i})})]})]}),e.jsx(_,{open:!!l,title:(l==null?void 0:l.title)??"",description:(l==null?void 0:l.description)??"",confirmLabel:l==null?void 0:l.confirmLabel,confirmVariant:l==null?void 0:l.confirmVariant,onConfirm:()=>{const h=l;r(null),h==null||h.onConfirm()},onCancel:()=>r(null)})]})}function ue({label:t}){return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,color:"var(--t-text-muted)"},children:[e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:600,color:"var(--t-text-secondary)"},children:t}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)"},children:"Coming soon"})]})}function Ce({appId:t,section:i="analysis",onNavigate:f}){const d=xe[i],[o,y]=v.useState("all");return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[e.jsxs("div",{style:{padding:"14px 20px 12px 18px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,background:"var(--t-bg-elevated)",display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{color:"var(--t-text-muted)"},children:d.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:600,fontSize:"var(--t-text-base)",color:"var(--t-text-primary)"},children:d.label}),e.jsx("div",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",marginTop:1},children:d.subtitle})]}),(i==="analysis"||i==="test-plan")&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),["all","draft","published","archived"].map(s=>e.jsx("button",{onClick:()=>y(s),style:{padding:"3px 10px",borderRadius:5,fontSize:11,fontWeight:500,border:"1px solid var(--t-border-subtle)",cursor:"pointer",background:o===s?"var(--t-text-primary)":"transparent",color:o===s?"var(--t-bg-base)":"var(--t-text-muted)"},children:s==="all"?"All":Q[s].label},s))]})]}),e.jsx("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:i==="analysis"?e.jsx(fe,{appId:t,onNavigate:f,statusFilter:o}):i==="test-plan"?e.jsx(he,{appId:t,onNavigate:f,statusFilter:o}):e.jsx(ue,{label:d.label})})]})}export{Se as AnalysisDetailView,ke as PlanDetailView,Ce as ReportsView};
@@ -0,0 +1 @@
1
+ import{r as l,j as e,a as Be}from"./react-D-pHAthU.js";import{au as ot,av as it,ag as ne,c as le,k as Te,U as De,aw as lt,ax as dt,b as G,q as Ae,ay as ct,S as xt,Z as Fe,az as We,at as ae,a3 as q,L as Q,K as X,I as Pe,y as he,V as xe,F as pt,h as ut,aA as gt,aB as Oe,m as ft,_ as ht,x as bt,j as vt}from"./icons-J9gKYxTz.js";import{D as ze,a as Ce,f as Re,b as Ie,d as mt,c as yt}from"./radix-ui-Cxk3sw_C.js";import{w as jt,a as kt,S as N,e as St,x as pe,B as V,A as wt,b as Y,C as Tt,y as zt,z as Ct}from"./index-a9kCDHqT.js";import{C as _e}from"./comments-section-CHZSUoK5.js";import{e as ue,s as ge}from"./hooks-BItXZ0yP.js";import"./tiptap-Ch64zYGz.js";const Ee={pending:"var(--t-border-strong)",pass:"#22c55e",fail:"#ef4444",skip:"#f59e0b",blocked:"#f97316"},Rt={pending:"var(--t-text-muted)",pass:"#22c55e",fail:"#ef4444",skip:"#f59e0b",blocked:"#f97316"},Ne={pending:"bg-secondary text-muted-foreground border-border",running:"bg-secondary text-yellow border-border",passed:"bg-green/10 text-green border-green/20",failed:"bg-destructive/10 text-destructive border-destructive/20",aborted:"bg-secondary text-muted-foreground border-border"},He={pass:e.jsx(q,{size:14,weight:"bold"}),fail:e.jsx(G,{size:14,weight:"bold"}),skip:e.jsx(ae,{size:14,weight:"bold"}),blocked:e.jsx(We,{size:14,weight:"fill"})},me={pass:e.jsx(q,{size:14}),fail:e.jsx(G,{size:14}),skip:e.jsx(ae,{size:14}),blocked:e.jsx(We,{size:14})},se={pass:{color:"#22c55e",background:"rgba(34,197,94,0.10)",border:"1px solid rgba(34,197,94,0.25)"},fail:{color:"#ef4444",background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.25)"},skip:{color:"#f59e0b",background:"rgba(245,158,11,0.10)",border:"1px solid rgba(245,158,11,0.25)"},blocked:{color:"#f97316",background:"rgba(249,115,22,0.10)",border:"1px solid rgba(249,115,22,0.25)"}},ce={pass:"Pass",fail:"Fail",skip:"Skip",blocked:"Block"},It={low:"#6b7280",medium:"#d97706",high:"#ea580c",critical:"#dc2626"};function de({label:t,options:x,selected:f,onChange:S}){const[y,A]=l.useState(!1),R=l.useRef(null),B=l.useRef(null),[I,F]=l.useState(null);l.useEffect(()=>{if(!y)return;const g=j=>{B.current&&!B.current.contains(j.target)&&R.current&&!R.current.contains(j.target)&&A(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[y]);const W=()=>{if(!y&&R.current){const g=R.current.getBoundingClientRect();F({top:g.bottom+4,left:g.left})}A(g=>!g)},H=g=>{const j=new Set(f);j.has(g)?j.delete(g):j.add(g),S(j)},k=f.size,T=k>0;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:R,onClick:W,style:{display:"flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:5,border:`1px solid ${T?"var(--t-border-strong)":"var(--t-border-default)"}`,background:T?"var(--t-bg-surface)":"transparent",color:T?"var(--t-text-primary)":"var(--t-text-secondary)",fontSize:"var(--t-text-sm)",cursor:"pointer",flexShrink:0,transition:"all 0.1s"},children:[e.jsx(Fe,{size:12,weight:T?"fill":"regular"}),t,k>0&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",fontWeight:700,background:"var(--t-text-primary)",color:"var(--t-bg-base)",borderRadius:10,padding:"0 5px",lineHeight:"16px",minWidth:16,textAlign:"center"},children:k})]}),y&&I&&Be.createPortal(e.jsx("div",{ref:B,style:{position:"fixed",top:I.top,left:I.left,zIndex:9999,minWidth:180,maxHeight:260,overflowY:"auto",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:8,boxShadow:"var(--t-shadow-sm)",padding:"4px 0"},children:x.length===0?e.jsx("div",{style:{padding:"8px 14px",fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)"},children:"No options"}):e.jsxs(e.Fragment,{children:[x.map(g=>e.jsxs("button",{onClick:()=>H(g),onMouseEnter:j=>j.currentTarget.style.background="var(--t-sidebar-hover)",onMouseLeave:j=>j.currentTarget.style.background="transparent",style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 14px",background:"transparent",border:"none",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",cursor:"pointer",textAlign:"left"},children:[e.jsx("div",{style:{width:14,height:14,borderRadius:3,border:f.has(g)?"1.5px solid var(--t-text-primary)":"1.5px solid var(--t-border-strong)",background:f.has(g)?"var(--t-text-primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.1s"},children:f.has(g)&&e.jsx(q,{size:9,weight:"bold",color:"var(--t-bg-base)"})}),g]},g)),k>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:1,background:"var(--t-border-subtle)",margin:"3px 0"}}),e.jsx("button",{onClick:()=>{S(new Set),A(!1)},onMouseEnter:g=>g.currentTarget.style.background="var(--t-sidebar-hover)",onMouseLeave:g=>g.currentTarget.style.background="transparent",style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 14px",background:"transparent",border:"none",color:"var(--t-text-muted)",fontSize:"var(--t-text-xs)",cursor:"pointer",textAlign:"left"},children:"Clear filter"})]})]})}),document.body)]})}function Ke({status:t,size:x=22}){if(t==="pass")return e.jsx(De,{size:x,weight:"fill",color:"#22c55e",style:{flexShrink:0}});if(t==="fail")return e.jsx(ut,{size:x,weight:"fill",color:"#ef4444",style:{flexShrink:0}});if(t==="skip")return e.jsx(gt,{size:x,weight:"fill",color:"#f59e0b",style:{flexShrink:0}});if(t==="blocked")return e.jsx(Oe,{size:x,weight:"fill",color:"#f97316",style:{flexShrink:0}});const f=Math.max(8,x-6),S=Math.max(1.5,f*.08),y=(f-S*2)/2,A=Math.max(2,y*.6),R=Math.max(1.5,y*.3);return e.jsx("div",{style:{width:x,height:x,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{width:f,height:f,viewBox:`0 0 ${f} ${f}`,children:e.jsx("circle",{cx:f/2,cy:f/2,r:y,fill:"none",stroke:"var(--t-border-strong)",strokeWidth:S,strokeDasharray:`${A} ${R}`,strokeLinecap:"round"})})})}function Et({result:t,isSelected:x,isChecked:f,bulkMode:S,onSelect:y,onToggleCheck:A,onMarkResult:R,onRemove:B,onResetResult:I,onGoToSource:F}){const[W,H]=l.useState(!1),[k,T]=l.useState(!1),g=l.useRef(null),j=l.useRef(null),[M,K]=l.useState(null);l.useEffect(()=>{if(!k)return;const i=h=>{g.current&&!g.current.contains(h.target)&&j.current&&!j.current.contains(h.target)&&T(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[k]);const E=()=>{if(j.current){const i=j.current.getBoundingClientRect();K({top:i.bottom+4,right:window.innerWidth-i.right})}T(i=>!i)},P=x?t.status==="pending"?"var(--t-border-strong)":Ee[t.status]??"var(--t-border-strong)":t.status==="pending"?"transparent":Ee[t.status]??"transparent";return e.jsxs("div",{onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),onClick:y,style:{position:"relative",display:"flex",alignItems:"center",gap:10,padding:"6px 12px 6px 14px",borderBottom:"1px solid var(--t-border-subtle)",background:x||W?"var(--t-bg-hover)":"transparent",transition:"background 0.1s",cursor:"pointer",borderLeft:`2px solid ${P}`},children:[e.jsx("div",{onClick:i=>{i.stopPropagation(),A(i)},style:{width:16,height:16,flexShrink:0,borderRadius:4,border:f?"1.5px solid var(--t-text-primary)":"1.5px solid var(--t-border-strong)",background:f?"var(--t-text-primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",opacity:W||f||S?1:0,pointerEvents:W||f||S?"auto":"none"},children:f&&e.jsx(q,{size:10,weight:"bold",color:"var(--t-bg-base)"})}),e.jsx(Ke,{status:t.status}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",justifyContent:"center"},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:t.status==="pending"?"var(--t-text-secondary)":"var(--t-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3},children:t.testTitle||`Test #${t.testId}`}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginTop:2,flexWrap:"nowrap",overflow:"hidden"},children:[t.internalId&&e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--t-text-muted)",flexShrink:0},children:t.internalId}),t.internalId&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-border-default)",flexShrink:0},children:"·"}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:It[t.priority]??"var(--t-text-muted)",flexShrink:0},children:t.priority}),(()=>{const i=t.tags?(()=>{try{return JSON.parse(t.tags)}catch{return[]}})():[];return i.length===0?null:e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-border-default)",flexShrink:0},children:"·"}),i.slice(0,3).map(h=>e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",fontWeight:500,color:"var(--t-text-muted)",background:"var(--t-bg-elevated)",border:"1px solid var(--t-border-subtle)",borderRadius:3,padding:"0 4px",flexShrink:0,lineHeight:"14px"},children:h},h)),i.length>3&&e.jsxs("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-text-muted)",flexShrink:0},children:["+",i.length-3]})]})})(),t.category&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-border-default)",flexShrink:0},children:"·"}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--t-text-muted)",flexShrink:0},children:t.category})]})]})]}),t.executedBy&&e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",flexShrink:0},children:t.executedBy}),e.jsx("div",{style:{display:"flex",gap:2,flexShrink:0,opacity:W?1:0,transition:"opacity 0.1s"},onClick:i=>i.stopPropagation(),children:["pass","fail","skip","blocked"].map(i=>{const h=t.status===i,$=se[i].color;return e.jsx("button",{title:ce[i],onClick:()=>R(t.id,i,{propagateToSteps:!0}),onMouseEnter:w=>{h||(w.currentTarget.style.color=$,w.currentTarget.style.background="var(--t-elem-hover)",w.currentTarget.style.borderColor="var(--t-border-default)")},onMouseLeave:w=>{h||(w.currentTarget.style.color="var(--t-text-muted)",w.currentTarget.style.background="transparent",w.currentTarget.style.borderColor="transparent")},style:{width:26,height:26,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",flexShrink:0,...h?se[i]:{color:"var(--t-text-muted)",background:"transparent",border:"1px solid transparent"}},children:h?He[i]:me[i]},i)})}),e.jsxs("div",{style:{flexShrink:0},onClick:i=>i.stopPropagation(),children:[e.jsx("button",{ref:j,title:"More options",onClick:E,onMouseEnter:i=>{i.currentTarget.style.color="var(--t-text-secondary)",i.currentTarget.style.background="var(--t-elem-hover)"},onMouseLeave:i=>{i.currentTarget.style.color=k?"var(--t-text-secondary)":"var(--t-text-muted)",i.currentTarget.style.background=k?"var(--t-elem-hover)":"transparent"},style:{width:26,height:26,borderRadius:5,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",background:k?"var(--t-elem-hover)":"transparent",border:"none",color:k?"var(--t-text-secondary)":"var(--t-text-muted)"},children:e.jsx(ft,{size:14,weight:"bold"})}),k&&M&&Be.createPortal(e.jsxs("div",{ref:g,style:{position:"fixed",top:M.top,right:M.right,zIndex:9999,minWidth:175,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:8,boxShadow:"var(--t-shadow-sm)",overflow:"hidden",padding:"4px 0"},children:[e.jsxs("button",{onClick:()=>{T(!1),I()},onMouseEnter:i=>i.currentTarget.style.background="var(--t-sidebar-hover)",onMouseLeave:i=>i.currentTarget.style.background="transparent",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"transparent",border:"none",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",cursor:"pointer",textAlign:"left"},children:[e.jsx(ne,{size:13,color:"var(--t-text-muted)"})," Reset test progress"]}),e.jsx("div",{style:{height:1,background:"var(--t-border-subtle)",margin:"3px 0"}}),e.jsxs("button",{onClick:()=>{T(!1),F()},onMouseEnter:i=>i.currentTarget.style.background="var(--t-sidebar-hover)",onMouseLeave:i=>i.currentTarget.style.background="transparent",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"transparent",border:"none",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",cursor:"pointer",textAlign:"left"},children:[e.jsx(ht,{size:13,color:"var(--t-text-muted)"})," Go to test source"]}),e.jsx("div",{style:{height:1,background:"var(--t-border-subtle)",margin:"3px 0"}}),e.jsxs("button",{onClick:()=>{T(!1),B()},onMouseEnter:i=>i.currentTarget.style.background="rgba(239,68,68,0.07)",onMouseLeave:i=>i.currentTarget.style.background="transparent",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"8px 14px",background:"transparent",border:"none",color:"var(--t-accent-danger)",fontSize:"var(--t-text-sm)",cursor:"pointer",textAlign:"left"},children:[e.jsx(Ae,{size:13,color:"var(--t-accent-danger)"})," Remove from run"]})]}),document.body)]})]})}const Me={pending:{bg:"var(--t-bg-surface)",border:"var(--t-border-default)",color:"var(--t-text-muted)"},pass:{bg:"rgba(34,197,94,0.1)",border:"rgba(34,197,94,0.28)",color:"#22c55e"},fail:{bg:"rgba(239,68,68,0.1)",border:"rgba(239,68,68,0.28)",color:"#ef4444"},skip:{bg:"rgba(245,158,11,0.1)",border:"rgba(245,158,11,0.28)",color:"#f59e0b"},blocked:{bg:"rgba(249,115,22,0.1)",border:"rgba(249,115,22,0.28)",color:"#f97316"}};function Nt({result:t,appId:x,runId:f,onClose:S,onMarkResult:y,onResetResult:A,onMarkStep:R}){const[B,I]=l.useState(!1),[F,W]=l.useState(t.ticketId??null),[H,k]=l.useState(!1),[T,g]=l.useState(t.ticketId??""),[j,M]=l.useState({}),[K,E]=l.useState(new Set),[P,i]=l.useState(!1),[h,$]=l.useState(!1),[w,_]=l.useState(!0),[D,a]=l.useState(!1),p=[t.spaceName,...t.folderPath??[],t.folderName].filter(Boolean);l.useEffect(()=>{W(t.ticketId??null),g(t.ticketId??""),k(!1),i(!1),$(!1),_(!0),a(!1)},[t.id,t.ticketId]),l.useEffect(()=>{let s=!1;const m=t.stepResults.map(d=>d.id);if(m.length===0){M({});return}return Promise.all(m.map(d=>Y.comments.listStep(f,t.id,d).then(v=>[d,v.reduce((n,u)=>{var C;return n+1+(((C=u.replies)==null?void 0:C.length)??0)},0)]).catch(()=>[d,0]))).then(d=>{s||M(Object.fromEntries(d))}),()=>{s=!0}},[t.id,f,t.stepResults]);const b=s=>{E(m=>{const d=new Set(m);return d.has(s)?d.delete(s):d.add(s),d})},o=async()=>{const s=T.trim()||null;W(s),k(!1);try{await Y.comments.updateTicket(f,t.id,s)}catch{}};return e.jsxs("div",{style:{width:580,flexShrink:0,borderLeft:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[e.jsx("p",{style:{flex:1,margin:0,fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)",lineHeight:1.5,wordBreak:"break-word"},children:t.testTitle||`Test #${t.testId}`}),e.jsx("button",{onClick:async()=>{I(!0);try{await A()}finally{I(!1)}},title:"Reset test",style:{width:28,height:28,borderRadius:5,border:"1px solid var(--t-border-default)",cursor:"pointer",background:"transparent",color:"var(--t-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.1s",marginTop:1},onMouseEnter:s=>{s.currentTarget.style.color="var(--t-text-primary)",s.currentTarget.style.borderColor="var(--t-border-strong)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--t-text-muted)",s.currentTarget.style.borderColor="var(--t-border-default)"},children:e.jsx(ne,{size:13,className:B?"animate-spin":""})}),e.jsx("button",{onClick:S,title:"Close",style:{width:28,height:28,borderRadius:5,border:"none",cursor:"pointer",background:"transparent",color:"var(--t-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.1s",marginTop:1},onMouseEnter:s=>{s.currentTarget.style.color="var(--t-text-primary)",s.currentTarget.style.background="var(--t-elem-hover)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--t-text-muted)",s.currentTarget.style.background="transparent"},children:e.jsx(G,{size:14})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:8},children:[p.length>0?e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.join(" · ")}):e.jsx("span",{}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"2px 8px",borderRadius:20,flexShrink:0,fontSize:"var(--t-text-xs)",fontWeight:600,background:t.status==="pending"?"var(--t-bg-elevated)":t.status==="pass"?"rgba(34,197,94,0.1)":t.status==="fail"?"rgba(239,68,68,0.1)":t.status==="skip"?"rgba(245,158,11,0.1)":"rgba(249,115,22,0.1)",color:t.status==="pending"?"var(--t-text-muted)":t.status==="pass"?"#22c55e":t.status==="fail"?"#ef4444":t.status==="skip"?"#f59e0b":"#f97316"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"currentColor",flexShrink:0}}),t.status==="pending"?"Pending":ce[t.status]]})]})]}),e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--t-border-subtle)",display:"flex",gap:6,flexShrink:0},children:["pass","fail","skip","blocked"].map(s=>{var d,v;const m=t.status===s;return e.jsxs("button",{title:ce[s],onClick:()=>y(t.id,s,{propagateToSteps:!0}),style:{flex:1,height:34,borderRadius:6,border:"1px solid",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,cursor:"pointer",transition:"all 0.12s",fontSize:"var(--t-text-sm)",fontWeight:600,...m?{...se[s],borderColor:((v=(d=se[s].border)==null?void 0:d.match(/#[a-f0-9]+|rgba[^)]+\)/i))==null?void 0:v[0])??"transparent"}:{background:"transparent",borderColor:"var(--t-border-default)",color:"var(--t-text-secondary)"}},onMouseEnter:n=>{m||(n.currentTarget.style.color=se[s].color,n.currentTarget.style.borderColor="var(--t-border-strong)",n.currentTarget.style.background="var(--t-row-hover)")},onMouseLeave:n=>{m||(n.currentTarget.style.color="var(--t-text-secondary)",n.currentTarget.style.borderColor="var(--t-border-default)",n.currentTarget.style.background="transparent")},children:[m?He[s]:me[s],ce[s]]},s)})}),e.jsxs("div",{style:{padding:"10px 16px 12px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.06em",textTransform:"uppercase",flexShrink:0},children:"Ticket ID"}),H?e.jsx("input",{autoFocus:!0,value:T,placeholder:"e.g. PROJ-123",onChange:s=>g(s.target.value),onBlur:o,onKeyDown:s=>{s.key==="Enter"&&o(),s.key==="Escape"&&(g(F??""),k(!1))},style:{flex:1,minWidth:0,height:28,padding:"0 8px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-base)",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",outline:"none"}}):F?e.jsxs("button",{type:"button",onClick:()=>{g(F),k(!0)},style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 8px",borderRadius:20,border:"1px solid var(--t-border-default)",background:"var(--t-bg-elevated)",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",fontWeight:500,cursor:"pointer"},children:[e.jsx(he,{size:13,color:"var(--t-text-muted)"}),F]}):e.jsxs("button",{type:"button",onClick:()=>{g(""),k(!0)},style:{display:"inline-flex",alignItems:"center",gap:5,padding:0,border:"none",background:"transparent",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)",cursor:"pointer"},children:[e.jsx(he,{size:13})," Add ticket"]})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:[t.preconditions&&e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("button",{type:"button",onClick:()=>i(s=>!s),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"10px 16px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left"},children:[P?e.jsx(Q,{size:12,color:"var(--t-text-muted)",weight:"bold"}):e.jsx(X,{size:12,color:"var(--t-text-muted)",weight:"bold"}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Preconditions"})]}),P&&e.jsx("div",{style:{padding:"0 16px 12px"},children:e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:t.preconditions},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",lineHeight:1.6}})})]}),t.testData&&e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("button",{type:"button",onClick:()=>$(s=>!s),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"10px 16px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left"},children:[h?e.jsx(Q,{size:12,color:"var(--t-text-muted)",weight:"bold"}):e.jsx(X,{size:12,color:"var(--t-text-muted)",weight:"bold"}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Test Data"})]}),h&&e.jsx("div",{style:{padding:"0 16px 12px"},children:e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:t.testData},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",lineHeight:1.6}})})]}),e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("button",{type:"button",onClick:()=>_(s=>!s),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"10px 16px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left"},children:[w?e.jsx(Q,{size:12,color:"var(--t-text-muted)",weight:"bold"}):e.jsx(X,{size:12,color:"var(--t-text-muted)",weight:"bold"}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.06em",textTransform:"uppercase",flex:1},children:"Steps"}),t.stepResults.length>0&&e.jsxs("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",fontVariantNumeric:"tabular-nums"},children:[t.stepResults.filter(s=>s.status!=="pending").length,e.jsx("span",{style:{color:"var(--t-border-strong)",margin:"0 3px"},children:"/"}),t.stepResults.length]})]}),w&&e.jsxs(e.Fragment,{children:[t.stepResults.length>0&&e.jsx("div",{style:{margin:"0 16px 8px",height:2,background:"var(--t-border-subtle)",borderRadius:2,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",borderRadius:2,transition:"width 0.4s ease",background:"var(--t-accent-success)",width:`${Math.round(t.stepResults.filter(s=>s.status!=="pending").length/t.stepResults.length*100)}%`}})}),t.stepResults.length===0?e.jsx("div",{style:{padding:"16px",textAlign:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:"No steps defined for this test."}):e.jsx(e.Fragment,{children:t.testType==="bdd"?(()=>{const s=[];for(const v of t.stepResults){const n=v.scenarioId??null,u=s[s.length-1];!u||u.scenarioId!==n?s.push({scenarioId:n,featureName:v.featureName??null,scenarioName:v.scenarioName??null,steps:[v]}):u.steps.push(v)}const m=54,d=new Set;return s.map(v=>e.jsxs("div",{style:{marginBottom:4},children:[v.featureName&&!d.has(v.featureName)&&(d.add(v.featureName),e.jsxs("div",{style:{padding:"14px 16px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.07em",textTransform:"uppercase",flexShrink:0},children:"Feature"}),e.jsx("span",{style:{flex:1,height:1,background:"var(--t-border-subtle)"}})]}),e.jsx("p",{style:{margin:"3px 0 0",fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.featureName})]})),e.jsxs("div",{style:{paddingLeft:m,paddingRight:16,paddingTop:10,paddingBottom:4},children:[e.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.04em",textTransform:"uppercase"},children:["Scenario"," "]}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",fontWeight:500},children:v.scenarioName??"—"})]}),v.steps.map((n,u)=>e.jsx($e,{step:n,index:u,isLast:u===v.steps.length-1,appId:x,runId:f,resultId:t.id,commentCount:j[n.id]??0,commentsExpanded:K.has(n.id),onToggleComments:()=>b(n.id),onMark:C=>R(n.id,C)},n.id))]},v.scenarioId??"none"))})():t.stepResults.map((s,m)=>e.jsx($e,{step:s,index:m,isLast:m===t.stepResults.length-1,appId:x,runId:f,resultId:t.id,commentCount:j[s.id]??0,commentsExpanded:K.has(s.id),onToggleComments:()=>b(s.id),onMark:d=>R(s.id,d)},s.id))})]})]}),e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("button",{type:"button",onClick:()=>a(s=>!s),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"10px 16px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left"},children:[D?e.jsx(Q,{size:12,color:"var(--t-text-muted)",weight:"bold"}):e.jsx(X,{size:12,color:"var(--t-text-muted)",weight:"bold"}),e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",letterSpacing:"0.06em",textTransform:"uppercase"},children:"Comments"})]}),D&&e.jsx("div",{style:{padding:"0 16px 16px"},children:e.jsx(_e,{appId:x,runId:f,resultId:t.id})})]})]})]})}function $e({step:t,index:x,isLast:f,appId:S,runId:y,resultId:A,commentCount:R,commentsExpanded:B,onToggleComments:I,onMark:F}){const[W,H]=l.useState(!1),[k,T]=l.useState(t.ticketId??null),[g,j]=l.useState(!1),[M,K]=l.useState(t.ticketId??""),E=Me[t.status]??Me.pending,P={pass:"#22c55e",fail:"#ef4444",skip:"#f59e0b",blocked:"#f97316"};l.useEffect(()=>{T(t.ticketId??null),K(t.ticketId??"")},[t.id,t.ticketId]);const i=async()=>{const h=M.trim()||null;T(h),j(!1);try{await Y.comments.updateStepTicket(y,A,t.id,h)}catch{}};return e.jsxs("div",{style:{display:"flex",padding:"0 16px"},onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),children:[e.jsxs("div",{style:{flexShrink:0,width:26,marginRight:12,display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx("div",{style:{marginTop:5,width:26,height:26,borderRadius:"50%",background:E.bg,border:`1.5px solid ${E.border}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.status==="pending"?e.jsx("span",{style:{fontSize:"var(--t-text-xs)",fontWeight:700,color:E.color,fontVariantNumeric:"tabular-nums",lineHeight:1},children:x+1}):t.status==="pass"?e.jsx(q,{size:13,weight:"bold",color:E.color}):t.status==="fail"?e.jsx(G,{size:13,weight:"bold",color:E.color}):e.jsx(ae,{size:13,weight:"bold",color:E.color})}),!f&&e.jsx("div",{style:{width:1,flex:1,minHeight:10,background:"var(--t-border-subtle)",marginTop:4}})]}),e.jsxs("div",{style:{flex:1,minWidth:0,paddingTop:8,paddingBottom:f?12:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:t.action},style:{flex:1,minWidth:0,fontSize:"var(--t-text-base)",fontWeight:t.status==="pending"?400:500,color:t.status==="pending"?"var(--t-text-secondary)":"var(--t-text-primary)",lineHeight:1.55,wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden"}}),e.jsxs("div",{style:{display:"flex",gap:2,flexShrink:0,paddingTop:2},children:[e.jsxs("button",{type:"button",title:k?`Ticket: ${k}`:"Add ticket ID",onClick:()=>{K(k??""),j(h=>!h)},style:{height:22,minWidth:22,padding:k?"0 6px":0,borderRadius:4,border:`1px solid ${k?"var(--t-border-default)":"var(--t-border-subtle)"}`,display:"inline-flex",alignItems:"center",gap:4,justifyContent:"center",cursor:"pointer",background:k?"var(--t-bg-elevated)":"transparent",color:k?"var(--t-text-primary)":"var(--t-border-strong)",fontSize:"var(--t-text-xs)"},children:[e.jsx(he,{size:12}),k&&e.jsx("span",{style:{maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"},children:k})]}),e.jsxs("button",{type:"button",title:"Comments",onClick:I,style:{height:22,minWidth:22,padding:R>0?"0 6px":0,borderRadius:4,border:`1px solid ${B?"var(--t-border-default)":"var(--t-border-subtle)"}`,display:"inline-flex",alignItems:"center",gap:4,justifyContent:"center",cursor:"pointer",background:B?"var(--t-bg-elevated)":"transparent",color:R>0?"var(--t-text-primary)":"var(--t-border-strong)",fontSize:"var(--t-text-xs)"},children:[e.jsx(bt,{size:12}),R>0&&e.jsx("span",{children:R})]})]}),e.jsx("div",{style:{display:"flex",gap:2,flexShrink:0,paddingTop:2,opacity:W?1:0,transition:"opacity 0.1s"},children:["pass","fail","skip","blocked"].map(h=>{const $=t.status===h,w=P[h];return e.jsx("button",{title:h.charAt(0).toUpperCase()+h.slice(1),onClick:()=>F(h),style:{width:22,height:22,borderRadius:4,border:`1px solid ${$?`${w}35`:"var(--t-border-subtle)"}`,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",background:$?`${w}12`:"transparent",color:$?w:"var(--t-border-strong)"},onMouseEnter:_=>{$||(_.currentTarget.style.color=w,_.currentTarget.style.borderColor=`${w}35`,_.currentTarget.style.background=`${w}0d`)},onMouseLeave:_=>{$||(_.currentTarget.style.color="var(--t-border-strong)",_.currentTarget.style.borderColor="var(--t-border-subtle)",_.currentTarget.style.background="transparent")},children:h==="pass"?e.jsx(q,{size:11,weight:"bold"}):h==="fail"?e.jsx(G,{size:11,weight:"bold"}):h==="blocked"?e.jsx(Oe,{size:11,weight:"bold"}):e.jsx(ae,{size:11,weight:"bold"})},h)})})]}),t.expectedResult&&e.jsxs("div",{style:{marginTop:6,background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)",borderRadius:5,padding:"6px 9px",maxWidth:"100%"},children:[e.jsx("span",{style:{display:"block",fontSize:10,color:"var(--t-text-muted)",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",marginBottom:4},children:"Expected"}),e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:t.expectedResult},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",lineHeight:1.5,wordBreak:"break-word",overflowWrap:"break-word"}})]}),g&&e.jsx("input",{autoFocus:!0,value:M,placeholder:"e.g. PROJ-123",onChange:h=>K(h.target.value),onBlur:i,onKeyDown:h=>{h.key==="Enter"&&i(),h.key==="Escape"&&(K(k??""),j(!1))},style:{marginTop:8,width:"100%",height:28,padding:"0 8px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-base)",color:"var(--t-text-primary)",fontSize:"var(--t-text-sm)",outline:"none"}}),B&&e.jsx("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px solid var(--t-border-subtle)"},children:e.jsx(_e,{appId:S,runId:y,resultId:A,stepResultId:t.id})})]})]})}function Mt({folderId:t,folderName:x,folderPath:f,spaceName:S,results:y,appId:A,runId:R,selectedResultId:B,bulkSelectedIds:I,onMarkResult:F,onResetFolder:W,onRemoveResult:H,onResetResult:k,onSelectResult:T,onToggleBulkSelect:g,onNavigate:j}){const[M,K]=l.useState(!0),[E,P]=l.useState(!1),[i,h]=l.useState(!1),$=y.filter(n=>n.status==="pass").length,w=y.filter(n=>n.status==="fail").length,_=y.filter(n=>n.status==="skip").length,D=y.filter(n=>n.status==="blocked").length,a=y.filter(n=>n.status==="pending").length,p=[S,...f].filter(Boolean),b=y.map(n=>n.id),o=b.filter(n=>I.has(n)).length,s=o===b.length&&b.length>0,m=o>0&&o<b.length,d=I.size>0,v=n=>{n.stopPropagation(),s?b.forEach(u=>I.has(u)&&g(u)):b.forEach(u=>!I.has(u)&&g(u))};return e.jsxs("div",{style:{margin:"0 16px 10px",border:"1px solid var(--t-border-subtle)",borderRadius:8,overflow:"hidden",background:"var(--t-bg-surface)"},children:[e.jsxs("button",{type:"button",onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),onClick:()=>K(n=>!n),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"9px 14px",background:E?"var(--t-bg-hover)":"var(--t-bg-surface)",border:"none",borderBottom:M?"1px solid var(--t-border-subtle)":"none",cursor:"pointer",textAlign:"left",transition:"background 0.1s"},children:[e.jsx("span",{style:{color:"var(--t-text-muted)",flexShrink:0,lineHeight:1,marginTop:1},children:M?e.jsx(Q,{size:11}):e.jsx(X,{size:11})}),e.jsxs("div",{onClick:v,style:{width:16,height:16,flexShrink:0,borderRadius:4,border:s?"1.5px solid var(--t-text-primary)":m?"1.5px solid var(--t-text-secondary)":"1.5px solid var(--t-border-default)",background:s?"var(--t-text-primary)":m?"var(--t-bg-elevated)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",opacity:E||d?1:0,pointerEvents:E||d?"auto":"none"},children:[s&&e.jsx(q,{size:10,weight:"bold",color:"var(--t-bg-base)"}),m&&e.jsx(ae,{size:10,weight:"bold",color:"var(--t-text-primary)"})]}),e.jsx(Pe,{size:18,color:"var(--t-text-secondary)",weight:"fill",style:{flexShrink:0}}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-primary)",flexShrink:0,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x||"Uncategorized"}),p.length>0&&e.jsx("span",{style:{color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)",flexShrink:0},children:"·"}),p.length>0&&e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.join(" / ")}),p.length===0&&e.jsx("span",{style:{flex:1}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",fontVariantNumeric:"tabular-nums"},children:y.length}),[{key:"pass",count:$,label:"Passed"},{key:"fail",count:w,label:"Failed"},{key:"skip",count:_,label:"Skipped"},{key:"blocked",count:D,label:"Blocked"},{key:"pending",count:a,label:"Pending"}].filter(({count:n})=>n>0).map(({key:n,count:u,label:C})=>e.jsxs("div",{title:`${u} ${C}`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[e.jsx(Ke,{status:n,size:18}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:600,fontVariantNumeric:"tabular-nums",color:Rt[n]??"var(--t-text-muted)"},children:u})]},n))]}),t!=null&&e.jsx("button",{title:"Reset folder progress",onClick:async n=>{n.stopPropagation(),h(!0);try{await W(t)}finally{h(!1)}},style:{width:26,height:26,borderRadius:5,marginLeft:4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",border:"1px solid transparent",background:"transparent",color:"var(--t-border-strong)",transition:"all 0.1s",flexShrink:0},onMouseEnter:n=>{n.currentTarget.style.color="var(--t-text-secondary)",n.currentTarget.style.background="var(--t-sidebar-hover)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--t-border-strong)",n.currentTarget.style.background="transparent"},children:e.jsx(ne,{size:12,className:i?"animate-spin":""})})]}),M&&e.jsx("div",{children:y.map(n=>e.jsx(Et,{result:n,isSelected:B===n.id,isChecked:I.has(n.id),bulkMode:d,onSelect:()=>T(n),onToggleCheck:()=>g(n.id),onMarkResult:F,onRemove:()=>H(n.id,n.testTitle||`Test #${n.testId}`),onResetResult:()=>k(n.id),onGoToSource:()=>{n.folderId!=null&&j({type:"tests",appId,spaceId:n.spaceId??0,folderId:n.folderId,selectedTestId:n.testId})}},n.id))})]})}function Le(t){const x=new Map;t.forEach(S=>x.set(S.id,{...S,children:[]}));const f=[];return t.forEach(S=>{var y;S.parentFolderId===null?f.push(x.get(S.id)):(y=x.get(S.parentFolderId))==null||y.children.push(x.get(S.id))}),f}function be(t,x){for(const f of x){if(f.id===t)return f;const S=be(t,f.children);if(S)return S}return null}function ve(t){return t.flatMap(x=>[x.id,...ve(x.children)])}function fe({checked:t,indeterminate:x,onChange:f}){const S=l.useRef(null);return l.useEffect(()=>{S.current&&(S.current.indeterminate=x)},[x]),e.jsx("input",{type:"checkbox",ref:S,checked:t,onChange:f,style:{width:13,height:13,cursor:"pointer",accentColor:"var(--t-text-secondary)",flexShrink:0}})}function $t({spaces:t,value:x,onChange:f}){const[S,y]=l.useState(new Set),[A,R]=l.useState(new Set),[B,I]=l.useState(new Map),[F,W]=l.useState(new Set),[H,k]=l.useState(new Set),[T,g]=l.useState(new Map),j=l.useRef(x);j.current=x;const M=async a=>{const p=B.get(a);if(p)return p;const b=zt(a);if(b){const o=Le(b);return I(s=>new Map([...s,[a,o]])),o}R(o=>new Set([...o,a]));try{const o=await Y.folders.list(a);Ct(a,o);const s=Le(o);return I(m=>new Map([...m,[a,s]])),s}finally{R(o=>{const s=new Set(o);return s.delete(a),s})}},K=async a=>{const p=!S.has(a);y(b=>{const o=new Set(b);return p?o.add(a):o.delete(a),o}),p&&await M(a)},E=async a=>{const p=!F.has(a);if(W(b=>{const o=new Set(b);return p?o.add(a):o.delete(a),o}),p&&!T.has(a)){const b=ue(a);if(b)g(o=>new Map([...o,[a,b]]));else{k(o=>new Set([...o,a]));try{const o=await Y.tests.list(a);ge(a,o),g(s=>new Map([...s,[a,o]]))}finally{k(o=>{const s=new Set(o);return s.delete(a),s})}}}},P=(a,p,b)=>{const o=(b.get(a)??[]).map(m=>m.id),s=be(a,p);return[...o,...(s==null?void 0:s.children.flatMap(m=>P(m.id,p,b)))??[]]},i=a=>{if(!a.length)return"none";const p=a.filter(b=>x.has(b)).length;return p===a.length?"all":p>0?"some":"none"},h=a=>{const p=new Set(j.current);p.has(a)?p.delete(a):p.add(a),f(p)},$=async(a,p)=>{const b=be(a,p),o=[a,...ve((b==null?void 0:b.children)??[])],s=new Map(T);o.forEach(d=>{if(!s.has(d)){const v=ue(d);v&&s.set(d,v)}});const m=o.filter(d=>!s.has(d));return m.length?((await Promise.all(m.map(async v=>({fid:v,tests:await Y.tests.list(v)})))).forEach(({fid:v,tests:n})=>{ge(v,n),s.set(v,n)}),g(s)):s.size!==T.size&&g(s),s},w=async(a,p)=>{const b=await $(a,p),o=P(a,p,b),s=o.length>0&&o.every(d=>j.current.has(d)),m=new Set(j.current);s?o.forEach(d=>m.delete(d)):o.forEach(d=>m.add(d)),f(m)},_=async a=>{const p=await M(a),b=ve(p),o=new Map(T);b.forEach(u=>{if(!o.has(u)){const C=ue(u);C&&o.set(u,C)}});const s=b.filter(u=>!o.has(u));s.length?((await Promise.all(s.map(async C=>({fid:C,tests:await Y.tests.list(C)})))).forEach(({fid:C,tests:U})=>{ge(C,U),o.set(C,U)}),g(o)):o.size!==T.size&&g(o);const m=u=>u.flatMap(C=>[...(o.get(C.id)??[]).map(U=>U.id),...m(C.children)]),d=m(p),v=d.length>0&&d.every(u=>j.current.has(u)),n=new Set(j.current);v?d.forEach(u=>n.delete(u)):d.forEach(u=>n.add(u)),f(n)},D=(a,p,b)=>{const o=F.has(a.id),s=H.has(a.id),m=T.get(a.id)??[],d=P(a.id,p,T),v=i(d),n=d.filter(u=>x.has(u)).length;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 group cursor-pointer select-none",style:{paddingLeft:b*20+12,paddingRight:12,height:34,borderBottom:"1px solid var(--t-border-subtle)"},onClick:()=>E(a.id),children:[e.jsx("span",{className:"text-muted-foreground w-3 h-3 flex items-center justify-center shrink-0",children:s?e.jsx(xe,{size:10,className:"animate-spin"}):o?e.jsx(Q,{size:10}):e.jsx(X,{size:10})}),e.jsx("span",{onClick:u=>u.stopPropagation(),children:e.jsx(fe,{checked:v==="all",indeterminate:v==="some",onChange:()=>w(a.id,p)})}),e.jsx(Pe,{size:13,color:"var(--t-text-muted)",weight:"fill"}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.name}),d.length>0&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:n>0?"var(--t-text-secondary)":"var(--t-text-muted)",background:n>0?"var(--t-bg-elevated)":"transparent",border:n>0?"1px solid var(--t-border-default)":"none",borderRadius:4,padding:n>0?"1px 5px":void 0,fontVariantNumeric:"tabular-nums",flexShrink:0},children:n>0?`${n}/${d.length}`:d.length})]}),o&&e.jsxs(e.Fragment,{children:[m.map(u=>e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none group",style:{paddingLeft:b*20+36,paddingRight:12,height:32,borderBottom:"1px solid var(--t-border-subtle)",background:x.has(u.id)?"var(--t-sidebar-hover)":"transparent"},onClick:()=>h(u.id),children:[e.jsx("span",{onClick:C=>C.stopPropagation(),children:e.jsx(fe,{checked:x.has(u.id),indeterminate:!1,onChange:()=>h(u.id)})}),e.jsx(vt,{size:11,color:x.has(u.id)?"var(--t-text-secondary)":"var(--t-text-muted)"}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",color:x.has(u.id)?"var(--t-text-primary)":"var(--t-text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.04em",color:"var(--t-text-muted)",background:"var(--t-bg-elevated)",border:"1px solid var(--t-border-default)",borderRadius:3,padding:"1px 4px",flexShrink:0,textTransform:"uppercase"},children:u.type==="bdd"?"BDD":"STD"})]},u.id)),a.children.map(u=>D(u,p,b+1))]})]},a.id)};return e.jsxs("div",{children:[t.length===0&&e.jsx("div",{style:{padding:"40px 20px",textAlign:"center",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"No spaces available."}),e.jsx("div",{children:t.map(a=>{const p=S.has(a.id),b=A.has(a.id),o=B.get(a.id)??[],s=o.flatMap(v=>P(v.id,o,T)),m=i(s),d=s.filter(v=>x.has(v)).length;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",style:{padding:"0 12px",height:40,background:"var(--t-bg-surface)",borderBottom:"1px solid var(--t-border-default)",borderTop:"1px solid var(--t-border-default)",position:"sticky",top:0,zIndex:1},onClick:()=>K(a.id),children:[e.jsx("span",{className:"text-muted-foreground w-3 h-3 flex items-center justify-center shrink-0",children:b?e.jsx(xe,{size:11,className:"animate-spin"}):p?e.jsx(Q,{size:11}):e.jsx(X,{size:11})}),e.jsx("span",{onClick:v=>v.stopPropagation(),children:e.jsx(fe,{checked:m==="all",indeterminate:m==="some",onChange:()=>_(a.id)})}),e.jsx(pt,{size:13,color:"var(--t-text-secondary)",weight:"fill"}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",fontWeight:600,color:"var(--t-text-primary)",flex:1,letterSpacing:"0.01em"},children:a.name}),s.length>0&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",fontVariantNumeric:"tabular-nums",color:d>0?"var(--t-text-primary)":"var(--t-text-muted)",background:d>0?"var(--t-bg-elevated)":"var(--t-sidebar-hover)",border:"1px solid var(--t-border-default)",borderRadius:4,padding:"2px 7px"},children:d>0?`${d} / ${s.length}`:`${s.length} tests`})]}),p&&e.jsxs(e.Fragment,{children:[b&&e.jsxs("div",{style:{padding:"10px 16px",fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",display:"flex",alignItems:"center",gap:6},children:[e.jsx(xe,{size:10,className:"animate-spin"})," Loading folders…"]}),!b&&o.length===0&&e.jsx("div",{style:{padding:"10px 16px",fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",fontStyle:"italic"},children:"No folders in this space."}),o.map(v=>D(v,o,1))]})]},a.id)})})]})}function Ot({run:t,results:x,report:f,loading:S,appId:y,spaces:A,initialSelectedResultId:R,onNavigate:B,onMarkResult:I,onBulkMarkResult:F,onMarkStep:W,onResetResult:H,onResetProgress:k,onBulkReset:T,onSetRunStatus:g,onRefreshResults:j,onRunUpdated:M}){const[K,E]=l.useState(!1),[P,i]=l.useState(!1),[h,$]=l.useState(new Set),[w,_]=l.useState(R??null),[D,a]=l.useState(new Set),[p,b]=l.useState(null),[o,s]=l.useState(new Set),[m,d]=l.useState(new Set),[v,n]=l.useState(new Set),[u,C]=l.useState(new Set),[U,Ue]=l.useState("default"),[Ve,te]=l.useState(!1),[ye,je]=l.useState(!1),[O,Z]=l.useState({name:"",description:"",environment:"",jiraIssueKey:"",referenceDoc:"",assigneeId:"",milestoneId:null}),{milestones:Ye}=jt(y),{isEditor:ee}=kt(y),oe=r=>{_(r);const c=t==null?void 0:t.id;if(c==null)return;const z=r!=null?`/apps/${y}/runs/${c}/results/${r}`:`/apps/${y}/runs/${c}`;window.history.replaceState(null,"",z)},Je=l.useMemo(()=>{const r=new Set;return x.forEach(c=>{c.priority&&r.add(c.priority)}),[...r].sort()},[x]),Ze=l.useMemo(()=>{const r=new Set;return x.forEach(c=>{c.category&&r.add(c.category)}),[...r].sort()},[x]),Ge=l.useMemo(()=>{const r=new Set;return x.forEach(c=>{if(c.tags)try{JSON.parse(c.tags).forEach(z=>r.add(z))}catch{}}),[...r].sort()},[x]),Qe=l.useMemo(()=>x.filter(r=>{if(u.size>0&&!u.has(r.status)||o.size>0&&!o.has(r.priority)||m.size>0&&(!r.category||!m.has(r.category)))return!1;if(v.size>0){let c=[];try{c=r.tags?JSON.parse(r.tags):[]}catch{}if(!c.some(L=>v.has(L)))return!1}return!0}),[x,u,o,m,v]),ke=u.size>0||o.size>0||m.size>0||v.size>0,Xe=r=>{a(c=>{const z=new Set(c);return z.has(r)?z.delete(r):z.add(r),z})},ie=()=>a(new Set),qe=async r=>{!t||D.size===0||(await F([...D],r,{propagateToSteps:!0}),ie())},et=async()=>{!t||D.size===0||(await T([...D]),ie())},tt=()=>{if(!t||D.size===0)return;const r=D.size;b({title:`Remove ${r} test${r===1?"":"s"} from run`,description:`${r} selected test${r===1?"":"s"} will be removed from this run. Their results will be lost.`,confirmLabel:`Remove ${r}`,onConfirm:async()=>{await Promise.all([...D].map(c=>Y.runs.removeResult(y,t.id,c))),w!==null&&D.has(w)&&oe(null),await j(),ie()}})},rt=async()=>{if(!(!t||!h.size)){i(!0);try{const r=[...h].map(c=>({scopeType:"test",scopeId:c}));await Y.runs.addItems(y,t.id,r),await j(),$(new Set),E(!1)}finally{i(!1)}}},st=()=>{t&&b({title:"Reset all progress",description:`Reset all test results in "${t.name}"? Every result will go back to pending and the run status will be set to pending.`,confirmLabel:"Reset",onConfirm:async()=>{t&&(await k(),await g("pending"))}})},nt=async r=>{t&&await k(r)},at=(r,c)=>{b({title:"Remove test from run",description:`"${c}" will be removed from this run. Its results will be lost.`,confirmLabel:"Remove",onConfirm:async()=>{t&&(await Y.runs.removeResult(y,t.id,r),w===r&&oe(null),await j())}})},Se=async r=>{await H(r)};if(S||!t)return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--t-bg-base)"},children:[e.jsxs("div",{style:{height:48,borderBottom:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",gap:12,padding:"0 20px",flexShrink:0},children:[e.jsx(N,{width:120,height:14,borderRadius:3}),e.jsx(N,{width:60,height:22,borderRadius:4}),e.jsx("div",{style:{flex:1}}),e.jsx(N,{width:80,height:22,borderRadius:4}),e.jsx(N,{width:80,height:22,borderRadius:4})]}),e.jsx("div",{style:{height:36,borderBottom:"1px solid var(--t-border-subtle)",padding:"0 20px",display:"flex",alignItems:"center",gap:12,flexShrink:0},children:e.jsx(N,{height:8,borderRadius:99})}),e.jsx("div",{style:{height:42,borderBottom:"1px solid var(--t-border-subtle)",padding:"0 16px",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:Array.from({length:4}).map((r,c)=>e.jsx(N,{width:80,height:26,borderRadius:5},c))}),e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex"},children:[e.jsx("div",{style:{flex:1,overflowY:"auto"},children:e.jsx(St,{count:8,rowHeight:48,padding:"10px 20px",showIcon:!1})}),w!=null&&e.jsxs("div",{style:{width:580,flexShrink:0,borderLeft:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:e.jsx(N,{height:13,width:"70%",borderRadius:3})}),e.jsx(N,{width:28,height:28,borderRadius:5}),e.jsx(N,{width:28,height:28,borderRadius:5})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:8},children:[e.jsx(N,{height:10,width:160,borderRadius:3}),e.jsx(N,{height:22,width:64,borderRadius:20})]})]}),e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--t-border-subtle)",display:"flex",gap:6,flexShrink:0},children:[0,1,2,3].map(r=>e.jsx(N,{height:34,borderRadius:6,style:{flex:1}},r))}),e.jsxs("div",{style:{padding:"10px 16px 12px",borderBottom:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[e.jsx(N,{width:58,height:10,borderRadius:3}),e.jsx(N,{width:80,height:22,borderRadius:20})]}),e.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",gap:6,flexShrink:0},children:[e.jsx(N,{width:12,height:12,borderRadius:2}),e.jsx(N,{width:44,height:10,borderRadius:3,style:{flex:1}}),e.jsx(N,{width:30,height:10,borderRadius:3})]}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:[70,85,55,75,62].map((r,c)=>e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 16px"},children:[e.jsxs("div",{style:{width:26,marginRight:12,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(N,{width:26,height:26,borderRadius:99,style:{marginTop:8}}),c<4&&e.jsx("div",{style:{width:1,height:28,background:"var(--t-border-subtle)",marginTop:4}})]}),e.jsxs("div",{style:{flex:1,paddingTop:10,paddingBottom:c===4?12:20,display:"flex",flexDirection:"column",gap:5},children:[e.jsx(N,{height:11,width:`${r}%`,borderRadius:3}),c%2===0&&e.jsx(N,{height:9,width:`${r-22}%`,borderRadius:3})]}),e.jsx("div",{style:{display:"flex",gap:4,flexShrink:0,paddingTop:10},children:[0,1,2,3].map(z=>e.jsx(N,{width:30,height:26,borderRadius:5},z))})]},c))})]})]})]});const J=(f==null?void 0:f.summary)??{total:0,pass:0,fail:0,skip:0,blocked:0,pending:0,passRate:0};return e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 h-14 shrink-0 gap-4",style:{borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>B({type:"runs",appId:y}),title:"Back to runs",style:{width:28,height:28,borderRadius:6,border:"none",background:"transparent",color:"var(--t-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},onMouseEnter:r=>{r.currentTarget.style.background="var(--t-bg-hover)",r.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="var(--t-text-muted)"},children:e.jsx(ot,{size:14})}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{className:pe("text-[11px] font-medium px-2.5 py-0.5 rounded-full border shrink-0",Ne[t.status]??Ne.pending),children:t.status}),t.environment&&e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:t.environment})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[ee&&e.jsxs(V,{size:"sm",variant:"outline",onClick:()=>{Z({name:t.name,description:t.description??"",environment:t.environment??"",jiraIssueKey:t.jiraIssueKey??"",referenceDoc:t.referenceDoc??"",assigneeId:t.assigneeId??"",milestoneId:t.milestoneId??null}),te(!0)},className:"gap-1.5 text-muted-foreground",title:"Edit run details",children:[e.jsx(it,{size:13})," Edit"]}),ee&&e.jsxs(V,{size:"sm",variant:"outline",onClick:st,className:"gap-1.5 text-muted-foreground",title:"Reset all test progress in this run",children:[e.jsx(ne,{size:13})," Reset"]}),ee&&e.jsxs(V,{size:"sm",variant:"outline",onClick:()=>{$(new Set),E(!0)},className:"gap-1.5",children:[e.jsx(le,{size:13})," Add Tests"]}),ee&&t.status==="pending"&&e.jsxs(V,{size:"sm",onClick:()=>b({title:"Start run",description:`Start "${t.name}"? This will mark it as running and allow you to record test results.`,confirmLabel:"Start",onConfirm:()=>g("running")}),children:[e.jsx(Te,{size:13,weight:"fill"})," Start"]}),ee&&t.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsxs(V,{size:"sm",variant:"outline",className:"text-green border-green/30 hover:bg-green/10",onClick:()=>g("passed"),children:[e.jsx(De,{size:13,weight:"fill"})," Pass"]}),e.jsxs(V,{size:"sm",variant:"outline",className:"text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>g("failed"),children:[e.jsx(lt,{size:13,weight:"fill"})," Fail"]}),e.jsxs(V,{size:"sm",variant:"outline",onClick:()=>b({title:"Abort run",description:`Abort "${t.name}"? The run will be marked as aborted. You can restart it later.`,confirmLabel:"Abort",onConfirm:()=>g("aborted")}),children:[e.jsx(dt,{size:13})," Abort"]})]}),ee&&(t.status==="passed"||t.status==="failed"||t.status==="aborted")&&e.jsxs(V,{size:"sm",variant:"outline",onClick:()=>g("running"),children:[e.jsx(Te,{size:13,weight:"fill"})," Restart"]})]})]}),e.jsxs("div",{className:"px-6 py-4 flex items-center gap-8 shrink-0",style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[[{label:"Total",value:J.total,cls:"text-foreground"},{label:"Pass",value:J.pass,cls:"text-green"},{label:"Fail",value:J.fail,cls:"text-destructive"},{label:"Skip",value:J.skip,cls:"text-yellow"},{label:"Block",value:J.blocked,cls:"text-purple"},{label:"Pending",value:J.pending,cls:"text-muted-foreground"}].map(({label:r,value:c,cls:z})=>e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:pe("text-2xl font-bold tabular-nums",z),children:c}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r})]},r)),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-36 h-1.5 bg-secondary rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-green rounded-full transition-all duration-700",style:{width:`${J.passRate}%`}})}),e.jsxs("span",{className:pe("text-sm font-semibold tabular-nums",J.passRate>=80?"text-green":J.passRate>=50?"text-yellow":"text-destructive"),children:[J.passRate,"%"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-row",children:[e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[D.size>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-surface)",flexShrink:0},children:[e.jsx("button",{onClick:ie,title:"Clear selection",style:{width:22,height:22,borderRadius:4,border:"1px solid var(--t-border-default)",background:"transparent",color:"var(--t-text-secondary)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},children:e.jsx(G,{size:12})}),e.jsxs("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",flexShrink:0},children:[D.size," selected"]}),e.jsx("div",{style:{flex:1}}),[{s:"pass",label:"Pass",color:"#22c55e"},{s:"fail",label:"Fail",color:"#ef4444"},{s:"skip",label:"Skip",color:"#f59e0b"},{s:"blocked",label:"Block",color:"#f97316"}].map(({s:r,label:c,color:z})=>e.jsxs("button",{onClick:()=>qe(r),onMouseEnter:L=>{L.currentTarget.style.background=`${z}18`,L.currentTarget.style.borderColor=`${z}44`,L.currentTarget.style.color=z},onMouseLeave:L=>{L.currentTarget.style.background="transparent",L.currentTarget.style.borderColor="var(--t-border-default)",L.currentTarget.style.color="var(--t-text-secondary)"},style:{padding:"4px 10px",borderRadius:5,border:"1px solid var(--t-border-default)",background:"transparent",color:"var(--t-text-secondary)",fontSize:"var(--t-text-sm)",cursor:"pointer",transition:"all 0.1s",display:"flex",alignItems:"center",gap:5},children:[me[r]," ",c]},r)),e.jsx("div",{style:{width:1,height:18,background:"var(--t-border-default)",flexShrink:0}}),e.jsxs("button",{onClick:et,onMouseEnter:r=>{r.currentTarget.style.background="var(--t-sidebar-hover)",r.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="var(--t-text-secondary)"},style:{padding:"4px 10px",borderRadius:5,border:"1px solid var(--t-border-default)",background:"transparent",color:"var(--t-text-secondary)",fontSize:"var(--t-text-sm)",cursor:"pointer",transition:"all 0.1s",display:"flex",alignItems:"center",gap:5},children:[e.jsx(ne,{size:13})," Reset"]}),e.jsxs("button",{onClick:tt,onMouseEnter:r=>{r.currentTarget.style.background="rgba(239,68,68,0.07)",r.currentTarget.style.borderColor="rgba(239,68,68,0.25)",r.currentTarget.style.color="var(--t-accent-danger)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.borderColor="var(--t-border-default)",r.currentTarget.style.color="var(--t-text-secondary)"},style:{padding:"4px 10px",borderRadius:5,border:"1px solid var(--t-border-default)",background:"transparent",color:"var(--t-text-secondary)",fontSize:"var(--t-text-sm)",cursor:"pointer",transition:"all 0.1s",display:"flex",alignItems:"center",gap:5},children:[e.jsx(Ae,{size:13})," Remove"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"7px 14px",borderBottom:"1px solid var(--t-border-subtle)",background:ke?"var(--t-bg-surface)":"transparent",flexShrink:0,flexWrap:"wrap"},children:[e.jsx(de,{label:"Status",options:["pending","pass","fail","skip","blocked"],selected:u,onChange:C}),e.jsx(de,{label:"Priority",options:Je,selected:o,onChange:s}),e.jsx(de,{label:"Category",options:Ze,selected:m,onChange:d}),e.jsx(de,{label:"Tags",options:Ge,selected:v,onChange:n}),ke&&e.jsxs("button",{onClick:()=>{C(new Set),s(new Set),d(new Set),n(new Set)},style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:5,border:"1px solid var(--t-border-subtle)",background:"transparent",color:"var(--t-text-muted)",fontSize:"var(--t-text-xs)",cursor:"pointer"},children:[e.jsx(G,{size:10})," Clear all"]}),e.jsx("div",{style:{flex:1}}),e.jsxs("button",{onClick:()=>Ue(r=>r==="default"?"asc":r==="asc"?"desc":"default"),title:U==="default"?"Sort folders A→Z":U==="asc"?"Sort folders Z→A":"Remove sort",style:{display:"flex",alignItems:"center",gap:5,padding:"4px 10px",borderRadius:5,border:`1px solid ${U!=="default"?"var(--t-border-strong)":"var(--t-border-default)"}`,background:U!=="default"?"var(--t-bg-surface)":"transparent",color:U!=="default"?"var(--t-text-primary)":"var(--t-text-secondary)",fontSize:"var(--t-text-sm)",cursor:"pointer",flexShrink:0,transition:"all 0.1s"},children:[e.jsx(ct,{size:12,weight:U!=="default"?"bold":"regular"}),"Folders",U==="asc"?" A→Z":U==="desc"?" Z→A":""]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:x.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-muted-foreground",children:[e.jsx(xt,{size:32,color:"#333"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm",children:"No tests in this run yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:'Click "Add Tests" to select spaces or folders to include.'})]}),e.jsxs(V,{size:"sm",variant:"outline",onClick:()=>{$(new Set),E(!0)},className:"gap-1.5",children:[e.jsx(le,{size:13})," Add Tests"]})]}):(()=>{const r=new Map;for(const z of Qe){const L=z.folderId??null;r.has(L)||r.set(L,[]),r.get(L).push(z)}const c=[...r.entries()];return U!=="default"&&c.sort(([,z],[,L])=>{const re=(z[0].folderName||"").toLowerCase(),we=(L[0].folderName||"").toLowerCase();return U==="asc"?re.localeCompare(we):we.localeCompare(re)}),c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[e.jsx(Fe,{size:28,color:"#555"}),e.jsx("p",{className:"text-sm",children:"No tests match the current filters"}),e.jsx("button",{onClick:()=>{C(new Set),s(new Set),d(new Set),n(new Set)},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",background:"transparent",border:"1px solid var(--t-border-default)",borderRadius:5,padding:"4px 12px",cursor:"pointer"},children:"Clear filters"})]}):e.jsx("div",{className:"py-3",children:c.map(([z,L])=>e.jsx(Mt,{folderId:z,folderName:L[0].folderName||"Uncategorized",folderPath:L[0].folderPath??[],spaceName:L[0].spaceName||"",results:L,appId:y,runId:t.id,selectedResultId:w,bulkSelectedIds:D,onMarkResult:I,onResetFolder:nt,onRemoveResult:at,onResetResult:Se,onToggleBulkSelect:Xe,onSelectResult:re=>oe(w===re.id?null:re.id),onNavigate:B},z??-1))})})()})]}),w!=null&&(()=>{const r=x.find(c=>c.id===w);return r?e.jsx(Nt,{result:r,appId:y,runId:t.id,onClose:()=>oe(null),onMarkResult:I,onResetResult:()=>Se(r.id),onMarkStep:(c,z)=>W(r.id,c,z)}):null})()]}),e.jsx(ze,{open:K,onOpenChange:E,children:e.jsxs(Ce,{children:[e.jsx(Re,{style:{position:"fixed",inset:0,background:"var(--t-overlay)",backdropFilter:"blur(2px)",zIndex:50}}),e.jsxs(Ie,{style:{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%,-50%)",zIndex:51,width:700,maxWidth:"calc(100vw - 32px)",height:580,maxHeight:"calc(100vh - 64px)",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:12,boxShadow:"var(--t-shadow-lg)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"16px 20px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:6,background:"var(--t-bg-surface)",border:"1px solid var(--t-border-default)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(le,{size:14,color:"var(--t-text-secondary)"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx(mt,{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-primary)",margin:0},children:"Add Tests to Run"}),e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",margin:0,marginTop:2},children:"Expand spaces and folders to select tests individually or in bulk."})]}),e.jsx(yt,{style:{width:28,height:28,borderRadius:6,border:"none",cursor:"pointer",background:"transparent",color:"var(--t-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:"✕"})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",background:"var(--t-bg-base)",borderBottom:"1px solid var(--t-border-subtle)"},children:e.jsx($t,{spaces:A,value:h,onChange:$})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",flexShrink:0,gap:12},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:h.size>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:"var(--t-text-xs)",fontWeight:600,color:"var(--t-text-primary)",background:"var(--t-bg-elevated)",border:"1px solid var(--t-border-default)",borderRadius:4,padding:"3px 8px",fontVariantNumeric:"tabular-nums"},children:h.size}),e.jsxs("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)"},children:["test",h.size===1?"":"s"," selected"]}),e.jsx("button",{type:"button",onClick:()=>$(new Set),style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear"})]}):e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)"},children:"No tests selected"})}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(V,{variant:"outline",size:"sm",onClick:()=>E(!1),children:"Cancel"}),e.jsxs(V,{size:"sm",onClick:rt,disabled:P||!h.size,children:[e.jsx(le,{size:13}),P?"Adding…":`Add ${h.size||0} Test${h.size===1?"":"s"}`]})]})]})]})]})}),e.jsx(ze,{open:Ve,onOpenChange:te,children:e.jsxs(Ce,{children:[e.jsx(Re,{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:9998}}),e.jsxs(Ie,{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%,-50%)",zIndex:9999,width:480,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:10,boxShadow:"var(--t-shadow-lg)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 14px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:600,color:"var(--t-text-primary)"},children:"Edit Run"}),e.jsx("button",{onClick:()=>te(!1),style:{width:26,height:26,borderRadius:5,border:"none",background:"transparent",color:"var(--t-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onMouseEnter:r=>{r.currentTarget.style.background="var(--t-elem-hover)",r.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:r=>{r.currentTarget.style.background="transparent",r.currentTarget.style.color="var(--t-text-muted)"},children:e.jsx(G,{size:13})})]}),e.jsxs("div",{style:{padding:"16px 20px",display:"flex",flexDirection:"column",gap:14,overflowY:"auto"},children:[e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsxs("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:["Name ",e.jsx("span",{style:{color:"var(--t-accent-danger)"},children:"*"})]}),e.jsx("input",{value:O.name,onChange:r=>Z(c=>({...c,name:r.target.value})),placeholder:"Run name",style:{height:34,padding:"0 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",outline:"none"}})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Description"}),e.jsx("textarea",{value:O.description,onChange:r=>Z(c=>({...c,description:r.target.value})),placeholder:"Optional description",rows:2,style:{padding:"7px 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",outline:"none",resize:"vertical",fontFamily:"inherit"}})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Environment"}),e.jsx("input",{list:"env-suggestions",value:O.environment,onChange:r=>Z(c=>({...c,environment:r.target.value})),placeholder:"e.g. Staging, Production, QA…",style:{height:34,padding:"0 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",outline:"none"}}),e.jsx("datalist",{id:"env-suggestions",children:["Development","Staging","Production","QA","UAT","Pre-production","Local"].map(r=>e.jsx("option",{value:r},r))})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Jira Issue Key"}),e.jsx("input",{value:O.jiraIssueKey,onChange:r=>Z(c=>({...c,jiraIssueKey:r.target.value})),placeholder:"e.g. PROJ-123",style:{height:34,padding:"0 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",outline:"none"}})]}),e.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Reference Document"}),e.jsx("input",{value:O.referenceDoc,onChange:r=>Z(c=>({...c,referenceDoc:r.target.value})),placeholder:"Confluence URL",style:{height:34,padding:"0 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",outline:"none"}})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Assignee"}),e.jsx(wt,{appId:y,value:O.assigneeId||null,onChange:r=>Z(c=>({...c,assigneeId:r??""}))})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Milestone"}),e.jsxs("select",{value:O.milestoneId??"",onChange:r=>Z(c=>({...c,milestoneId:r.target.value?Number(r.target.value):null})),style:{height:34,padding:"0 10px",borderRadius:6,border:"1px solid var(--t-border-default)",background:"var(--t-bg-surface)",color:O.milestoneId?"var(--t-text-primary)":"var(--t-text-muted)",fontSize:"var(--t-text-base)",outline:"none",cursor:"pointer"},children:[e.jsx("option",{value:"",children:"None"}),Ye.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,padding:"12px 20px",borderTop:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx(V,{size:"sm",variant:"outline",onClick:()=>te(!1),children:"Cancel"}),e.jsx(V,{size:"sm",disabled:!O.name.trim()||ye,onClick:async()=>{if(!(!t||!O.name.trim())){je(!0);try{await Y.runs.update(y,t.id,{name:O.name.trim(),description:O.description||void 0,environment:O.environment||void 0,jiraIssueKey:O.jiraIssueKey||void 0,referenceDoc:O.referenceDoc||void 0,assigneeId:O.assigneeId||void 0,milestoneId:O.milestoneId??null}),te(!1),await(M==null?void 0:M()),await j()}finally{je(!1)}}},children:ye?"Saving…":"Save"})]})]})]})}),e.jsx(Tt,{open:p!==null,title:(p==null?void 0:p.title)??"",description:(p==null?void 0:p.description)??"",confirmLabel:(p==null?void 0:p.confirmLabel)??"Confirm",onConfirm:async()=>{p&&(await p.onConfirm(),b(null))},onCancel:()=>b(null)})]})}export{Ot as RunExecution};
@@ -0,0 +1 @@
1
+ import{j as e}from"./react-D-pHAthU.js";import{c as i,k as s}from"./icons-J9gKYxTz.js";import{B as r}from"./index-a9kCDHqT.js";import"./radix-ui-Cxk3sw_C.js";function c({appId:n,onNavigate:l,onCreateRun:t}){return e.jsxs("div",{style:{flex:1,background:"var(--t-bg-base)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px 0 18px",height:48,borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-primary)"},children:"Runs"}),t&&e.jsxs(r,{onClick:t,variant:"outline",style:{gap:6,height:30,fontSize:"var(--t-text-sm)",padding:"0 12px"},children:[e.jsx(i,{size:13}),"New Run"]})]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,textAlign:"center"},children:[e.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(s,{size:24,weight:"duotone",color:"var(--t-text-muted)"})}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"No run selected"}),e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",marginTop:5},children:"Create a run to start executing your test cases."})]}),t&&e.jsxs(r,{onClick:t,variant:"outline",style:{gap:6},children:[e.jsx(i,{size:14}),"New Run"]})]})})]})}export{c as RunsView};
@@ -0,0 +1 @@
1
+ import{r as n,j as e}from"./react-D-pHAthU.js";import{a as de,u as ce,b as y,e as J,B as C,J as xe}from"./index-a9kCDHqT.js";import{r as G,aC as K,aD as ue,a3 as O,aE as pe,q as $,g as ge,ad as ve,Y as he,c as V,aF as me,aG as fe,J as Q,b as ye,aH as be,z as je,aI as Se,aJ as we,d as ze}from"./icons-J9gKYxTz.js";import"./radix-ui-Cxk3sw_C.js";const ke=["text","number","dropdown","multiselect","date","checkbox","url"],q={text:"Text",number:"Number",dropdown:"Dropdown",multiselect:"Multi-select",date:"Date",checkbox:"Checkbox",url:"URL"},X=["low","medium","high","critical"],Z=["draft","active","deprecated"],Y={low:"#555",medium:"#eab308",high:"#f97316",critical:"#e5484d"},H={draft:"#555",active:"#22c55e",deprecated:"#888"};function B({children:s}){return e.jsx("p",{style:{fontSize:11,fontWeight:600,color:"var(--t-text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:14},children:s})}function R({children:s,style:r}){return e.jsx("div",{style:{background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)",borderRadius:8,padding:16,...r},children:s})}function D({icon:s,onClick:r,danger:o=!1,title:d}){return e.jsx("button",{title:d,onClick:r,style:{width:28,height:28,border:"none",borderRadius:6,background:"transparent",color:"var(--t-text-muted)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.1s"},onMouseEnter:c=>{const x=c.currentTarget;x.style.background=o?"rgba(229,72,77,0.1)":"var(--t-bg-elevated)",x.style.color=o?"var(--t-accent-danger)":"var(--t-text-secondary)"},onMouseLeave:c=>{const x=c.currentTarget;x.style.background="transparent",x.style.color="var(--t-text-muted)"},children:s})}function F({value:s,onChange:r,placeholder:o,style:d}){return e.jsx("input",{value:s,onChange:c=>r(c.target.value),placeholder:o,style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",padding:"6px 10px",outline:"none",width:"100%",boxSizing:"border-box",...d},onFocus:c=>c.currentTarget.style.borderColor="var(--t-border-strong)",onBlur:c=>c.currentTarget.style.borderColor="var(--t-border-default)"})}function P({value:s,onChange:r,children:o,style:d}){return e.jsx("select",{value:s,onChange:c=>r(c.target.value),style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",padding:"6px 10px",outline:"none",cursor:"pointer",...d},children:o})}const U=()=>({name:"",type:"text",options:"",required:!1,defaultValue:""});function Ce({appId:s}){const[r,o]=n.useState([]),[d,c]=n.useState(null),[x,f]=n.useState(!1),[a,h]=n.useState(U()),[v,i]=n.useState(!1),u=n.useCallback(async()=>{const t=await y.fields.list(s);o(t.sort((b,z)=>b.order-z.order))},[s]);n.useEffect(()=>{u()},[u]);const k=t=>{c(t.id),f(!1),h({name:t.name,type:t.type,options:t.options?JSON.parse(t.options).join(", "):"",required:t.required,defaultValue:t.defaultValue??""})},w=()=>{c(null),f(!1),h(U())},j=async()=>{if(!a.name.trim())return;i(!0);const t={name:a.name.trim(),type:a.type,options:["dropdown","multiselect"].includes(a.type)?a.options.split(",").map(b=>b.trim()).filter(Boolean):void 0,required:a.required,defaultValue:a.defaultValue||void 0};x?await y.fields.create(s,t):d!==null&&await y.fields.update(s,d,t),await u(),w(),i(!1)},m=async t=>{await y.fields.delete(s,t),await u()},g=async(t,b)=>{const z=r.findIndex(A=>A.id===t),E=z+b;if(E<0||E>=r.length)return;const T=[...r];[T[z],T[E]]=[T[E],T[z]],await Promise.all(T.map((A,p)=>y.fields.update(s,A.id,{order:p}))),await u()},S=e.jsxs(R,{style:{marginBottom:16},children:[e.jsx("p",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-secondary)",marginBottom:14},children:x?"New Field":"Edit Field"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:12},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",marginBottom:5},children:"Field name"}),e.jsx(F,{value:a.name,onChange:t=>h(b=>({...b,name:t})),placeholder:"e.g. Automation Status"})]}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",marginBottom:5},children:"Type"}),e.jsx(P,{value:a.type,onChange:t=>h(b=>({...b,type:t})),children:ke.map(t=>e.jsx("option",{value:t,children:q[t]},t))})]})]}),["dropdown","multiselect"].includes(a.type)&&e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",marginBottom:5},children:["Options ",e.jsx("span",{style:{color:"var(--t-text-muted)"},children:"(comma-separated)"})]}),e.jsx(F,{value:a.options,onChange:t=>h(b=>({...b,options:t})),placeholder:"Option A, Option B, Option C"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:14},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",marginBottom:5},children:"Default value"}),e.jsx(F,{value:a.defaultValue,onChange:t=>h(b=>({...b,defaultValue:t})),placeholder:"Optional"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingTop:20},children:[e.jsx("input",{type:"checkbox",id:"req",checked:a.required,onChange:t=>h(b=>({...b,required:t.target.checked})),style:{width:14,height:14,cursor:"pointer"}}),e.jsx("label",{htmlFor:"req",style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)",cursor:"pointer"},children:"Required field"})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs(C,{size:"sm",onClick:j,disabled:v,style:{gap:5},children:[e.jsx(O,{size:12})," ",v?"Saving…":"Save Field"]}),e.jsx(C,{size:"sm",variant:"outline",onClick:w,children:"Cancel"})]})]});return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[e.jsx(B,{children:"Custom Fields"}),!x&&d===null&&e.jsxs(C,{size:"sm",onClick:()=>{f(!0),c(null),h(U())},style:{gap:5},children:[e.jsx(V,{size:12})," Add Field"]})]}),(x||d!==null)&&S,r.length===0&&!x?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"No custom fields yet. Add one to extend every test."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:r.map((t,b)=>e.jsxs(R,{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flexShrink:0},children:[e.jsx(D,{icon:e.jsx(me,{size:11}),onClick:()=>g(t.id,-1),title:"Move up"}),e.jsx(D,{icon:e.jsx(fe,{size:11}),onClick:()=>g(t.id,1),title:"Move down"})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)"},children:t.name}),t.required&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-accent-danger)",background:"rgba(229,72,77,0.1)",border:"1px solid rgba(229,72,77,0.2)",borderRadius:4,padding:"1px 5px"},children:"required"})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:3},children:[e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)"},children:q[t.type]}),t.defaultValue&&e.jsxs("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)"},children:["default: ",t.defaultValue]}),t.options&&(()=>{try{const z=JSON.parse(t.options);return e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)"},children:z.join(" · ")})}catch{return null}})()]})]}),e.jsxs("div",{style:{display:"flex",gap:4,flexShrink:0},children:[e.jsx(D,{icon:e.jsx(Q,{size:13}),onClick:()=>k(t),title:"Edit"}),e.jsx(D,{icon:e.jsx($,{size:13}),onClick:()=>m(t.id),danger:!0,title:"Delete"})]})]},t.id))})]})}function Ae({appId:s}){const[r,o]=n.useState({}),[d,c]=n.useState(null);n.useEffect(()=>{y.settings.get(s).then(o).catch(()=>o({}))},[s]);const x=async(a,h)=>{c(a),await y.settings.set(s,a,h),o(v=>({...v,[a]:h})),c(null)},f=(a,h,v)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)"},children:a}),d===h&&e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",marginTop:2},children:"Saving…"})]}),v]});return e.jsxs("div",{children:[e.jsx(B,{children:"Test Defaults"}),e.jsxs(R,{children:[f("Default Priority","defaultPriority",e.jsx(P,{value:r.defaultPriority??"medium",onChange:a=>x("defaultPriority",a),style:{width:160},children:X.map(a=>e.jsx("option",{value:a,children:a.charAt(0).toUpperCase()+a.slice(1)},a))})),f("Default Status","defaultStatus",e.jsx(P,{value:r.defaultStatus??"draft",onChange:a=>x("defaultStatus",a),style:{width:160},children:Z.map(a=>e.jsx("option",{value:a,children:a.charAt(0).toUpperCase()+a.slice(1)},a))})),f("Default Assignee","defaultAssignee",e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(F,{value:r.defaultAssignee??"",onChange:a=>o(h=>({...h,defaultAssignee:a})),placeholder:"email or name",style:{width:200}}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>x("defaultAssignee",r.defaultAssignee??""),children:"Save"})]}))]})]})}function Te({appId:s}){const[r,o]=n.useState([]),[d,c]=n.useState(""),[x,f]=n.useState(!0);n.useEffect(()=>{y.settings.get(s).then(i=>{o(i.tags??[]),f(!1)}).catch(()=>f(!1))},[s]);const a=async i=>{await y.settings.set(s,"tags",i),o(i)},h=async()=>{const i=d.trim();!i||r.includes(i)||(await a([...r,i]),c(""))},v=async i=>{await a(r.filter(u=>u!==i))};return x?e.jsx(xe,{lines:4,style:{marginTop:8}}):e.jsxs("div",{children:[e.jsx(B,{children:"Tags Library"}),e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",marginBottom:16},children:"Define the tag palette for this app. Tests can only use tags from this list."}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:20},children:[e.jsx("input",{value:d,onChange:i=>c(i.target.value),onKeyDown:i=>{i.key==="Enter"&&h()},placeholder:"New tag…",style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-primary)",fontSize:"var(--t-text-base)",padding:"8px 12px",outline:"none",width:280,boxSizing:"border-box"},onFocus:i=>i.currentTarget.style.borderColor="var(--t-border-strong)",onBlur:i=>i.currentTarget.style.borderColor="var(--t-border-default)"}),e.jsxs(C,{onClick:h,style:{gap:6,height:36,flexShrink:0},children:[e.jsx(V,{size:13})," Add Tag"]})]}),r.length===0?e.jsx("div",{style:{textAlign:"center",padding:"32px 0",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"No tags yet. Add some to curate the tag library for tests."}):e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:r.map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:99,padding:"5px 12px",fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)"},children:[i,e.jsx("button",{onClick:()=>v(i),style:{background:"none",border:"none",cursor:"pointer",color:"var(--t-text-muted)",padding:0,display:"flex",transition:"color 0.1s"},onMouseEnter:u=>u.currentTarget.style.color="var(--t-accent-danger)",onMouseLeave:u=>u.currentTarget.style.color="var(--t-text-muted)",children:e.jsx(ye,{size:11})})]},i))})]})}function Re({appId:s}){const[r,o]=n.useState({}),[d,c]=n.useState(!1);n.useEffect(()=>{y.settings.get(s).then(o).catch(()=>{})},[s]);const x=r.statusLabels??{},f=r.priorityLabels??{},a=(u,k,w)=>{o(j=>{var m,g,S,t;return{...j,statusLabels:{...j.statusLabels,[u]:{label:((g=(m=j.statusLabels)==null?void 0:m[u])==null?void 0:g.label)??u,color:((t=(S=j.statusLabels)==null?void 0:S[u])==null?void 0:t.color)??H[u],[k]:w}}}})},h=(u,k,w)=>{o(j=>{var m,g,S,t;return{...j,priorityLabels:{...j.priorityLabels,[u]:{label:((g=(m=j.priorityLabels)==null?void 0:m[u])==null?void 0:g.label)??u,color:((t=(S=j.priorityLabels)==null?void 0:S[u])==null?void 0:t.color)??Y[u],[k]:w}}}})},v=async()=>{c(!0),await Promise.all([y.settings.set(s,"statusLabels",r.statusLabels??{}),y.settings.set(s,"priorityLabels",r.priorityLabels??{})]),c(!1)},i=({keys:u,defaults:k,labels:w,onUpdate:j})=>e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:u.map(m=>{var t,b;const g=((t=w[m])==null?void 0:t.label)??m,S=((b=w[m])==null?void 0:b.color)??k[m];return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",width:80,textTransform:"capitalize"},children:m}),e.jsx("input",{type:"color",value:S,onChange:z=>j(m,"color",z.target.value),style:{width:32,height:28,border:"1px solid var(--t-border-default)",borderRadius:6,cursor:"pointer",background:"transparent",padding:2}}),e.jsx(F,{value:g,onChange:z=>j(m,"label",z),style:{maxWidth:200}}),e.jsx("span",{style:{fontSize:"var(--t-text-sm)",padding:"2px 8px",borderRadius:4,background:"var(--t-bg-panel)",color:S,border:`1px solid ${S}40`},children:g})]},m)})});return e.jsxs("div",{children:[e.jsx(B,{children:"Status Labels"}),e.jsx(R,{style:{marginBottom:20},children:e.jsx(i,{keys:Z,defaults:H,labels:x,onUpdate:a})}),e.jsx(B,{children:"Priority Labels"}),e.jsx(R,{style:{marginBottom:20},children:e.jsx(i,{keys:X,defaults:Y,labels:f,onUpdate:h})}),e.jsxs(C,{onClick:v,disabled:d,style:{gap:5},children:[e.jsx(O,{size:13})," ",d?"Saving…":"Save Labels"]})]})}const ee={admin:"var(--t-text-primary)",editor:"var(--t-accent-success)",viewer:"var(--t-text-secondary)"},Ee={admin:{color:"var(--t-text-primary)",background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.15)"},editor:{color:"var(--t-accent-success)",background:"rgba(34,197,94,0.08)",border:"1px solid rgba(34,197,94,0.2)"},viewer:{color:"var(--t-text-secondary)",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)"}};function te({role:s}){const r=Ee[s];return e.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:r.color,background:r.background,border:r.border,borderRadius:4,padding:"2px 7px"},children:s})}function Le({appId:s,canManage:r}){const[o,d]=n.useState([]),[c,x]=n.useState([]),[f,a]=n.useState(!0),[h,v]=n.useState(!1),[i,u]=n.useState(""),[k,w]=n.useState("editor"),[j,m]=n.useState(!1),[g,S]=n.useState(null),t=n.useCallback(async()=>{a(!0);try{const[p,I]=await Promise.all([y.members.appGroups.list(s),y.groups.list()]);d(p),x(I)}finally{a(!1)}},[s]);n.useEffect(()=>{t()},[t]);const b=async()=>{if(i){m(!0),S(null);try{await y.members.appGroups.add(s,Number(i),k),await t(),v(!1),u(""),w("editor")}catch(p){S(p instanceof Error?p.message:"Failed to add group")}finally{m(!1)}}},z=async(p,I)=>{await y.members.appGroups.update(s,p,I),await t()},E=async p=>{await y.members.appGroups.remove(s,p),await t()},T=new Set(o.map(p=>p.groupId)),A=c.filter(p=>!T.has(p.id));return f?e.jsx(J,{count:3,rowHeight:44,padding:"8px 0",showIcon:!1}):e.jsxs("div",{style:{marginTop:28},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx(B,{children:"Group Access"}),r&&!h&&e.jsxs(C,{size:"sm",onClick:()=>v(!0),style:{gap:5},children:[e.jsx(V,{size:13})," Add Group"]})]}),h&&e.jsxs(R,{style:{padding:"12px 14px",marginBottom:12,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[A.length===0?e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",fontStyle:"italic",flex:1},children:c.length===0?"No groups exist yet — go to User Management → User Groups to create one.":"All groups already have access to this app."}):e.jsxs(e.Fragment,{children:[e.jsxs("select",{value:i,onChange:p=>u(Number(p.target.value)||""),style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",padding:"5px 8px",flex:1,minWidth:160},children:[e.jsx("option",{value:"",children:"Select group…"}),A.map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]}),e.jsxs("select",{value:k,onChange:p=>w(p.target.value),style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",padding:"5px 8px",width:110},children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]}),e.jsxs(C,{size:"sm",disabled:j||!i,onClick:()=>void b(),style:{gap:5},children:[e.jsx(O,{size:12})," ",j?"Adding…":"Add"]})]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>{v(!1),S(null)},children:"Cancel"}),g&&e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-accent-danger)",margin:0,width:"100%"},children:g})]}),o.length===0?e.jsx("div",{style:{textAlign:"center",padding:"24px 0",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"No groups have access to this app yet."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.map(p=>e.jsxs(R,{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"var(--t-bg-elevated)",border:"1px solid var(--t-border-default)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(G,{size:15,color:"var(--t-text-muted)"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.groupName}),p.groupDescription&&e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",margin:0},children:p.groupDescription})]}),r?e.jsxs("select",{value:p.role,onChange:I=>void z(p.groupId,I.target.value),style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:ee[p.role],fontSize:"var(--t-text-sm)",padding:"4px 8px",cursor:"pointer",outline:"none"},children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx(te,{role:p.role}),r&&e.jsx(D,{icon:e.jsx($,{size:13}),onClick:()=>void E(p.groupId),danger:!0,title:"Remove group access"})]},p.id))})]})}function Be({appId:s}){const{user:r}=ce(),[o,d]=n.useState([]),[c,x]=n.useState(!0),[f,a]=n.useState(null),[h,v]=n.useState(null),[i,u]=n.useState(!1),[k,w]=n.useState(""),[j,m]=n.useState([]),[g,S]=n.useState(null),[t,b]=n.useState("editor"),[z,E]=n.useState(!1),[T,A]=n.useState(null),p=n.useRef(null),I=(r==null?void 0:r.globalRole)==="super_admin",_=o.find(l=>l.userId===(r==null?void 0:r.id)),M=I||(_==null?void 0:_.role)==="admin",W=n.useCallback(async()=>{x(!0);try{const l=await y.members.app.list(s);d(l)}finally{x(!1)}},[s]);n.useEffect(()=>{W()},[W]);const se=async(l,L)=>{a(l);try{await y.members.app.update(s,l,L),await W()}finally{a(null)}},re=async l=>{v(l);try{await y.members.app.remove(s,l),await W()}finally{v(null)}},ae=l=>{if(w(l),S(null),p.current&&clearTimeout(p.current),l.length<2){m([]);return}p.current=setTimeout(()=>{y.users.search(l).then(m)},300)},ne=async()=>{if(!g){A("Select a user from search results");return}E(!0),A(null);try{await y.members.app.add(s,g.id,t),await W(),u(!1),w(""),m([]),S(null),b("editor")}catch(l){A(l instanceof Error?l.message:"Failed to add member")}finally{E(!1)}},N=new Set(o.map(l=>l.userId));return c?e.jsx(J,{count:4,rowHeight:48,padding:"10px 0"}):e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[e.jsx(B,{children:"App Members"}),M&&!i&&e.jsxs(C,{size:"sm",onClick:()=>u(!0),style:{gap:5},children:[e.jsx(ue,{size:13})," Add Member"]})]}),i&&e.jsxs(R,{style:{marginBottom:16,position:"relative"},children:[e.jsx("p",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-secondary)",marginBottom:12},children:"Add Member"}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,position:"relative"},children:[e.jsx(F,{value:g?`${g.email}${g.name?` (${g.name})`:""}`:k,onChange:l=>ae(l),placeholder:"Search by email or name…"}),j.length>0&&!g&&e.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,zIndex:10,overflow:"hidden",marginTop:4},children:[j.filter(l=>!N.has(l.id)).map(l=>e.jsxs("button",{type:"button",onClick:()=>{S(l),m([])},style:{display:"block",width:"100%",textAlign:"left",padding:"8px 12px",background:"none",border:"none",cursor:"pointer",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)"},onMouseEnter:L=>L.currentTarget.style.background="var(--t-bg-elevated)",onMouseLeave:L=>L.currentTarget.style.background="none",children:[l.email,l.name?` — ${l.name}`:""]},l.id)),j.every(l=>N.has(l.id))&&e.jsx("p",{style:{padding:"8px 12px",color:"var(--t-text-muted)",fontSize:"var(--t-text-sm)"},children:"All matching users are already members"})]})]}),e.jsxs(P,{value:t,onChange:l=>b(l),style:{width:110},children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]}),e.jsxs(C,{size:"sm",disabled:z||!g,onClick:()=>void ne(),style:{gap:5,whiteSpace:"nowrap"},children:[e.jsx(O,{size:12})," ",z?"Adding…":"Add"]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>{u(!1),w(""),m([]),S(null),A(null)},children:"Cancel"})]}),T&&e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-accent-danger)",marginTop:8},children:T})]}),o.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"No members yet. Add someone to get started."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:o.map(l=>{const L=l.userId===(r==null?void 0:r.id),le=f===l.userId,ie=h===l.userId;return e.jsxs(R,{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"var(--t-bg-elevated)",border:"1px solid var(--t-border-default)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(G,{size:14,color:"var(--t-text-muted)"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name??l.email}),L&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-text-muted)",flexShrink:0},children:"you"}),l.role==="admin"&&e.jsx(pe,{size:11,color:"var(--t-text-primary)",weight:"fill",style:{flexShrink:0}})]}),l.name&&e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",margin:0},children:l.email})]}),M&&!L?e.jsxs("select",{value:l.role,disabled:le||ie,onChange:oe=>void se(l.userId,oe.target.value),style:{background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,color:ee[l.role],fontSize:"var(--t-text-sm)",padding:"4px 8px",cursor:"pointer",outline:"none"},children:[e.jsx("option",{value:"viewer",children:"Viewer"}),e.jsx("option",{value:"editor",children:"Editor"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx(te,{role:l.role}),M&&!L&&e.jsx(D,{icon:e.jsx($,{size:13}),onClick:()=>void re(l.userId),danger:!0,title:"Remove member"})]},l.id)})}),e.jsx(Le,{appId:s,canManage:M})]})}const Ie={jira:{label:"Jira",icon:e.jsx(ze,{size:18,color:"#0052CC"}),group:"issue-tracker",fields:[{key:"host",label:"Host",placeholder:"https://yourorg.atlassian.net"},{key:"projectKey",label:"Project key",placeholder:"PROJ"},{key:"email",label:"Email",placeholder:"you@example.com"},{key:"token",label:"API token",placeholder:"••••••••",secret:!0}]},github:{label:"GitHub",icon:e.jsx(we,{size:18,color:"#ccc"}),group:"vcs",fields:[{key:"token",label:"Personal access token",placeholder:"ghp_••••••",secret:!0},{key:"baseUrl",label:"Base URL (optional, for GitHub Enterprise)",placeholder:"https://github.yourcompany.com"}]},gitlab:{label:"GitLab",icon:e.jsx(Se,{size:18,color:"#FC6D26"}),group:"vcs",fields:[{key:"token",label:"Personal access token",placeholder:"glpat-••••••",secret:!0},{key:"baseUrl",label:"Base URL (optional, for self-hosted)",placeholder:"https://gitlab.yourcompany.com"}]},bitbucket:{label:"Bitbucket",icon:e.jsx(je,{size:18,color:"#0052CC"}),group:"vcs",fields:[{key:"token",label:"Access token",placeholder:"ATBB••••••",secret:!0}]},slack:{label:"Slack",icon:e.jsx(be,{size:18,color:"#4A154B"}),group:"notification",fields:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://hooks.slack.com/services/…",secret:!0},{key:"channel",label:"Channel",placeholder:"#test-alerts"}]}};function De({appId:s,type:r,existing:o,onRefresh:d}){const c=Ie[r],[x,f]=n.useState(!1),[a,h]=n.useState({}),[v,i]=n.useState(!1),[u,k]=n.useState((o==null?void 0:o.enabled)??!0);n.useEffect(()=>{o&&(h(o.config),k(o.enabled))},[o]);const w=async()=>{i(!0),await y.integrations.upsert(s,r,a,u),await d(),f(!1),i(!1)},j=async()=>{await y.integrations.delete(s,r),h({}),await d()},m=!!o;return e.jsxs(R,{style:{marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:8,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:c.icon}),e.jsxs("div",{style:{flex:1},children:[e.jsx("p",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:c.label}),e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:m?"var(--t-accent-success)":"var(--t-text-muted)"},children:m?u?"Connected & enabled":"Connected but disabled":"Not connected"})]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[m&&e.jsx(D,{icon:e.jsx($,{size:13}),onClick:j,danger:!0,title:"Disconnect"}),e.jsxs(C,{size:"sm",variant:"outline",onClick:()=>f(g=>!g),style:{gap:5},children:[e.jsx(Q,{size:12})," ",m?"Edit":"Connect"]})]})]}),x&&e.jsxs("div",{style:{marginTop:16,paddingTop:16,borderTop:"1px solid var(--t-border-subtle)"},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:14},children:c.fields.map(g=>e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-secondary)",marginBottom:5},children:g.label}),e.jsx(F,{value:a[g.key]??"",onChange:S=>h(t=>({...t,[g.key]:S})),placeholder:g.placeholder})]},g.key))}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:14},children:[e.jsx("input",{type:"checkbox",id:`${r}-enabled`,checked:u,onChange:g=>k(g.target.checked),style:{width:14,height:14,cursor:"pointer"}}),e.jsx("label",{htmlFor:`${r}-enabled`,style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)",cursor:"pointer"},children:"Enabled"})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs(C,{size:"sm",onClick:w,disabled:v,style:{gap:5},children:[e.jsx(O,{size:12})," ",v?"Saving…":"Save"]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>f(!1),children:"Cancel"})]})]})]})}function Fe({appId:s}){const[r,o]=n.useState([]),d=n.useCallback(async()=>{const x=await y.integrations.list(s).catch(()=>[]);o(x)},[s]);n.useEffect(()=>{d()},[d]);const c=[{title:"Issue Trackers",description:"Connect your issue tracker to link tickets to test plans and runs.",types:["jira"]},{title:"Version Control",description:"Connect your VCS provider to fetch MR/PR details and diffs for AI-powered test planning.",types:["github","gitlab","bitbucket"]},{title:"Notifications",description:"Send test run results and alerts to your team.",types:["slack"]}];return e.jsxs("div",{children:[e.jsx(B,{children:"Integrations"}),c.map(x=>e.jsxs("div",{style:{marginBottom:28},children:[e.jsx("p",{style:{fontSize:"var(--t-text-sm)",fontWeight:600,color:"var(--t-text-primary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:4},children:x.title}),e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",marginBottom:12},children:x.description}),x.types.map(f=>e.jsx(De,{appId:s,type:f,existing:r.find(a=>a.type===f),onRefresh:d},f))]},x.title))]})}const Oe=[{id:"fields",label:"Custom Fields",icon:e.jsx(K,{size:14})},{id:"defaults",label:"Defaults",icon:e.jsx(O,{size:14})},{id:"tags",label:"Tags",icon:e.jsx(ge,{size:14})},{id:"labels",label:"Labels",icon:e.jsx(ve,{size:14})},{id:"integrations",label:"Integrations",icon:e.jsx(he,{size:14})}];function $e({appId:s,appName:r,section:o="tests"}){const[d,c]=n.useState("fields"),{loading:x,isAdmin:f,isEditor:a}=de(s);if(!x&&!a)return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,color:"var(--t-text-muted)"},children:[e.jsx(G,{size:32,weight:"duotone"}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-secondary)"},children:"Access denied"}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)"},children:"You need editor or admin access to view settings."})]});if(o==="members")return!x&&!f?e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12},children:[e.jsx(G,{size:32,weight:"duotone",color:"var(--t-text-muted)"}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-secondary)"},children:"Admin access required"}),e.jsx("p",{style:{margin:0,fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)"},children:"Only app admins can manage member access."})]}):e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--t-bg-base)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"0 28px 0 18px",height:52,borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)",flexShrink:0},children:[e.jsx(G,{size:20,color:"var(--t-text-muted)"}),e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"Members"}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)"},children:"·"}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)"},children:r})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",padding:"28px 32px"},children:e.jsx(Be,{appId:s})})]});const h=Oe.filter(v=>v.id!=="integrations"||f);return e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--t-bg-base)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"0 28px 0 18px",height:52,borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)",flexShrink:0},children:[e.jsx(K,{size:20,color:"var(--t-text-muted)"}),e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"Tests"}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)"},children:"·"}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)"},children:r})]}),e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex"},children:[e.jsx("div",{style:{width:200,flexShrink:0,borderRight:"1px solid var(--t-border-subtle)",padding:"16px 0",overflowY:"auto"},children:h.map(v=>e.jsxs("button",{onClick:()=>c(v.id),style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"9px 20px",border:"none",cursor:"pointer",background:d===v.id?"var(--t-bg-panel)":"transparent",color:d===v.id?"var(--t-text-primary)":"var(--t-text-muted)",fontSize:"var(--t-text-base)",textAlign:"left",transition:"all 0.1s",borderLeft:d===v.id?"2px solid var(--t-border-strong)":"2px solid transparent"},onMouseEnter:i=>{d!==v.id&&(i.currentTarget.style.color="var(--t-text-secondary)")},onMouseLeave:i=>{d!==v.id&&(i.currentTarget.style.color="var(--t-text-muted)")},children:[v.icon,v.label]},v.id))}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 32px"},children:[d==="fields"&&e.jsx(Ce,{appId:s}),d==="defaults"&&e.jsx(Ae,{appId:s}),d==="tags"&&e.jsx(Te,{appId:s}),d==="labels"&&e.jsx(Re,{appId:s}),d==="integrations"&&e.jsx(Fe,{appId:s})]})]})]})}export{$e as SettingsView};
@@ -0,0 +1 @@
1
+ import{r as l,j as e,a as ce}from"./react-D-pHAthU.js";import{ai as L,L as oe,c as A,F as Ee,S as Le,f as xe,b as G,j as pe,aj as Ae,D as Ne,E as X,M as ue,J as ie,q as ge,a3 as $e,z as Oe,ak as Pe,K as He}from"./icons-J9gKYxTz.js";import{s as _e,B as S,S as h,R as qe,C as Ue,b as W}from"./index-a9kCDHqT.js";import{D as Ve,a as Ye,f as Je,b as Ke}from"./radix-ui-Cxk3sw_C.js";import{u as Xe,d as Ge}from"./hooks-BItXZ0yP.js";const le={low:"#6b7280",medium:"#d97706",high:"#ea580c",critical:"#dc2626"},ye={draft:"#6b7280",active:"#16a34a",deprecated:"#4b5563"},Qe=["low","medium","high","critical"],Ze=["draft","active","deprecated"],Fe={given:"#9ca3af",when:"#9ca3af",then:"#9ca3af",and:"#6b7280",but:"#6b7280"};function v({label:p,children:d}){return e.jsxs("div",{style:{display:"flex",alignItems:"baseline",padding:"7px 0",borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsx("span",{style:{width:100,flexShrink:0,fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",fontWeight:500},children:p}),e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)"},children:d})]})}function he({title:p,defaultOpen:d,badge:a,children:f}){const[r,y]=l.useState(d??!1);return e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("button",{onClick:()=>y(n=>!n),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"12px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--t-text-muted)",textAlign:"left"},children:[e.jsx("span",{style:{color:"var(--t-text-muted)",flexShrink:0},children:r?e.jsx(oe,{size:11,weight:"bold"}):e.jsx(He,{size:11,weight:"bold"})}),e.jsx("span",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.07em",color:"var(--t-text-muted)",flex:1},children:p}),a]}),r&&e.jsx("div",{style:{padding:"0 20px 16px"},children:f})]})}function et({folderId:p,testId:d,onClose:a,onEdit:f}){const{test:r,loading:y}=Ge(p,d);return e.jsxs("div",{style:{flex:1,borderLeft:"1px solid var(--t-border-default)",display:"flex",flexDirection:"column",background:"var(--t-bg-surface)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"12px 16px 12px 20px",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0,gap:12},children:[r?e.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)",lineHeight:1.5,wordBreak:"break-word"},children:r.title}),e.jsx("span",{style:{fontSize:10,color:"var(--t-text-muted)",textTransform:"uppercase",letterSpacing:"0.06em",marginTop:1},children:r.type==="bdd"?"BDD":"Traditional"})]}):y?e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsx(h,{height:13,width:"72%",borderRadius:3}),e.jsx(h,{height:9,width:"30%",borderRadius:3})]}):e.jsx("span",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)"},children:"Detail"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexShrink:0},children:[e.jsxs("button",{onClick:f,style:{display:"flex",alignItems:"center",gap:5,padding:"5px 10px",borderRadius:6,border:"1px solid var(--t-border-subtle)",background:"transparent",color:"var(--t-text-muted)",cursor:"pointer",fontSize:"var(--t-text-sm)",fontWeight:500},onMouseEnter:n=>{const o=n.currentTarget;o.style.borderColor="var(--t-border-default)",o.style.color="var(--t-text-secondary)"},onMouseLeave:n=>{const o=n.currentTarget;o.style.borderColor="var(--t-border-subtle)",o.style.color="var(--t-text-muted)"},children:[e.jsx(ie,{size:12})," Edit"]}),e.jsx("button",{onClick:a,style:{width:26,height:26,borderRadius:5,border:"none",background:"transparent",color:"var(--t-text-muted)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:n=>{n.currentTarget.style.color="var(--t-text-secondary)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--t-text-muted)"},children:e.jsx(G,{size:14})})]})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:y?e.jsxs("div",{children:[e.jsxs("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 20px"},children:[e.jsx(h,{width:11,height:11,borderRadius:2}),e.jsx(h,{width:44,height:10,borderRadius:3})]}),e.jsx("div",{style:{padding:"0 20px 16px"},children:[65,82,55,73].map((n,o)=>e.jsxs("div",{style:{display:"flex",gap:14,padding:"9px 0",borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsx(h,{width:14,height:10,borderRadius:2,style:{marginTop:2,flexShrink:0}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[e.jsx(h,{height:11,width:`${n}%`,borderRadius:3}),o%2===0&&e.jsx(h,{height:9,width:`${Math.round(n*.65)}%`,borderRadius:3})]})]},o))})]}),e.jsx("div",{style:{borderBottom:"1px solid var(--t-border-subtle)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"12px 20px"},children:[e.jsx(h,{width:11,height:11,borderRadius:2}),e.jsx(h,{width:50,height:10,borderRadius:3})]})})]}):r?e.jsxs(e.Fragment,{children:[e.jsxs(he,{title:r.type==="bdd"?"Scenarios":"Steps",defaultOpen:!0,children:[r.preconditions&&e.jsxs("div",{style:{marginBottom:14,padding:"8px 12px",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-subtle)",borderRadius:6},children:[e.jsx("p",{style:{fontSize:11,color:"var(--t-text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:5},children:"Preconditions"}),e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:r.preconditions},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",lineHeight:1.6,wordBreak:"break-word",overflowWrap:"break-word"}})]}),r.testData&&e.jsxs("div",{style:{marginBottom:14,padding:"8px 12px",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-subtle)",borderRadius:6},children:[e.jsx("p",{style:{fontSize:11,color:"var(--t-text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:5},children:"Test Data"}),e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:r.testData},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",lineHeight:1.6,wordBreak:"break-word",overflowWrap:"break-word"}})]}),r.type==="traditional"?r.steps&&r.steps.length>0?e.jsx("ol",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column"},children:r.steps.map((n,o)=>e.jsxs("li",{style:{display:"flex",gap:14,padding:"9px 0",borderBottom:"1px solid var(--t-border-subtle)"},children:[e.jsx("span",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",fontWeight:700,flexShrink:0,width:18,paddingTop:2,textAlign:"right"},children:o+1}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:n.action},style:{fontSize:"var(--t-text-base)",color:"var(--t-text-primary)",lineHeight:1.6,wordBreak:"break-word",overflowWrap:"break-word"}}),n.expectedResult&&e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:n.expectedResult},style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",marginTop:5,paddingTop:5,borderTop:"1px dashed var(--t-border-subtle)",lineHeight:1.6,wordBreak:"break-word",overflowWrap:"break-word"}})]})]},n.id))}):e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",fontStyle:"italic"},children:"No steps added."}):r.scenarios&&r.scenarios.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:r.scenarios.map(n=>e.jsxs("div",{style:{background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 14px",borderBottom:n.steps.length?"1px solid var(--t-border-subtle)":void 0,background:"var(--t-bg-panel)"},children:[n.feature&&e.jsxs("p",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-text-muted)",fontFamily:"monospace",marginBottom:3,letterSpacing:"0.02em"},children:["Feature:"," ",e.jsx("span",{style:{color:"var(--t-text-secondary)",fontWeight:500},children:n.feature})]}),e.jsxs("p",{style:{fontSize:"var(--t-text-xs)",fontFamily:"monospace"},children:[e.jsx("span",{style:{color:"var(--t-text-muted)"},children:"Scenario: "}),e.jsx("span",{style:{color:"var(--t-text-primary)",fontWeight:500},children:n.scenario})]})]}),n.steps.length>0&&e.jsx("div",{style:{padding:"8px 14px",display:"flex",flexDirection:"column",gap:3},children:n.steps.map(o=>e.jsxs("p",{style:{fontSize:"var(--t-text-sm)",fontFamily:"monospace",lineHeight:1.7},children:[e.jsx("span",{style:{color:Fe[o.type]??"var(--t-text-muted)",fontWeight:600,display:"inline-block",width:38,textAlign:"right",marginRight:10},children:o.type.charAt(0).toUpperCase()+o.type.slice(1)}),e.jsx("span",{style:{color:"var(--t-text-secondary)"},children:o.text})]},o.id))})]},n.id))}):e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",fontStyle:"italic"},children:"No scenarios added."})]}),e.jsx(he,{title:"Details",children:e.jsxs("div",{style:{paddingTop:4},children:[r.internalId&&e.jsx(v,{label:"ID",children:e.jsx("span",{style:{fontFamily:"monospace",fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)"},children:r.internalId})}),e.jsx(v,{label:"Type",children:e.jsx("span",{style:{textTransform:"capitalize",color:"var(--t-text-secondary)"},children:r.type})}),r.category&&e.jsx(v,{label:"Category",children:e.jsx("span",{style:{color:"var(--t-text-secondary)"},children:r.category})}),e.jsx(v,{label:"Priority",children:e.jsx("span",{style:{color:le[r.priority]??"var(--t-text-muted)",textTransform:"capitalize"},children:r.priority})}),e.jsx(v,{label:"Status",children:e.jsx("span",{style:{color:ye[r.status]??"var(--t-text-muted)",textTransform:"capitalize"},children:r.status})}),r.automationStatus&&e.jsx(v,{label:"Automation",children:e.jsx("span",{style:{color:"var(--t-text-secondary)"},children:r.automationStatus})}),r.estimatedTime!=null&&r.estimatedTime>0&&e.jsx(v,{label:"Estimate",children:e.jsx("span",{style:{color:"var(--t-text-secondary)"},children:r.estimatedTime>=60?`${Math.floor(r.estimatedTime/60)}h${r.estimatedTime%60>0?` ${r.estimatedTime%60}m`:""}`:`${r.estimatedTime}m`})}),r.jiraIssueKey&&e.jsx(v,{label:"Jira",children:e.jsx("span",{style:{fontFamily:"monospace",fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)"},children:r.jiraIssueKey})}),r.assigneeId&&e.jsx(v,{label:"Assignee",children:r.assigneeId}),r.createdBy&&e.jsx(v,{label:"Created by",children:r.createdBy}),r.updatedBy&&r.updatedBy!==r.createdBy&&e.jsx(v,{label:"Updated by",children:r.updatedBy}),r.description&&e.jsxs("div",{style:{marginTop:16},children:[e.jsx("p",{style:{fontSize:11,color:"var(--t-text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:6},children:"Description"}),e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:r.description},style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)",lineHeight:1.7,wordBreak:"break-word",overflowWrap:"break-word"}})]}),r.notes&&e.jsxs("div",{style:{marginTop:14},children:[e.jsx("p",{style:{fontSize:11,color:"var(--t-text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:6},children:"Notes"}),e.jsx("div",{className:"rich-preview",dangerouslySetInnerHTML:{__html:r.notes},style:{fontSize:"var(--t-text-base)",color:"var(--t-text-secondary)",lineHeight:1.7,wordBreak:"break-word",overflowWrap:"break-word"}})]}),r.tags&&(()=>{try{const n=JSON.parse(r.tags);return n.length?e.jsxs("div",{style:{marginTop:14},children:[e.jsx("p",{style:{fontSize:11,color:"var(--t-text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:8},children:"Tags"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:n.map(o=>e.jsx("span",{style:{fontSize:"var(--t-text-sm)",padding:"2px 10px",borderRadius:99,background:"var(--t-bg-surface)",color:"var(--t-text-muted)",border:"1px solid var(--t-border-subtle)"},children:o},o))})]}):null}catch{return null}})()]})})]}):e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:"Not found"})})]})}function tt({appId:p,testIds:d,open:a,onClose:f,onApplied:r}){const[y,n]=l.useState(""),[o,T]=l.useState(""),[C,m]=l.useState(""),[u,U]=l.useState([]),[D,k]=l.useState("replace"),[w,N]=l.useState([]),[g,$]=l.useState(!1);l.useEffect(()=>{a&&(n(""),T(""),m(""),U([]),k("replace"),W.settings.get(p).then(s=>N(s.tags??[])).catch(()=>{}))},[a,p]);const V=async()=>{$(!0);const s={};y&&(s.priority=y),o&&(s.status=o),C.trim()&&(s.assigneeId=C.trim()),u.length>0&&(s.tags=u,s.tagsMode=D),Object.keys(s).length>0&&await W.bulk.tests.update({testIds:d,updates:s}),$(!1),r(),f()},R=s=>e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",marginBottom:8,marginTop:0},children:s}),x=(s,j,I,O)=>e.jsx("button",{onClick:I,style:{padding:"4px 10px",borderRadius:6,border:"1px solid",borderColor:j?"var(--t-text-primary)":"var(--t-border-default)",background:j?"var(--t-bg-surface)":"transparent",color:j?"var(--t-text-primary)":O??"var(--t-text-muted)",fontSize:"var(--t-text-sm)",cursor:"pointer"},children:s.charAt(0).toUpperCase()+s.slice(1)||"No change"},s||"none");return e.jsx(Ve,{open:a,onOpenChange:s=>{s||f()},children:e.jsxs(Ye,{children:[e.jsx(Je,{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(2px)",zIndex:50}}),e.jsxs(Ke,{style:{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%,-50%)",zIndex:51,width:480,maxWidth:"calc(100vw - 32px)",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:12,padding:24,boxShadow:"0 24px 60px rgba(0,0,0,0.8)",maxHeight:"calc(100vh - 64px)",overflowY:"auto"},children:[e.jsxs("p",{style:{fontSize:"var(--t-text-xl)",fontWeight:600,color:"var(--t-text-primary)",marginBottom:4},children:["Edit ",d.length," test",d.length!==1?"s":""]}),e.jsx("p",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",marginBottom:0},children:"Only fields you select below will be updated. All others remain unchanged."}),e.jsxs("div",{style:{marginTop:20},children:[R("Priority"),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[x("no change",y==="",()=>n("")),Qe.map(s=>x(s,y===s,()=>n(s),le[s]))]})]}),e.jsxs("div",{style:{marginTop:16},children:[R("Status"),e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[x("no change",o==="",()=>T("")),Ze.map(s=>x(s,o===s,()=>T(s),ye[s]))]})]}),e.jsxs("div",{style:{marginTop:16},children:[R("Assignee"),e.jsx("input",{value:C,onChange:s=>m(s.target.value),placeholder:"Leave blank to keep unchanged",style:{width:"100%",boxSizing:"border-box",background:"var(--t-bg-surface)",border:"1px solid var(--t-border-default)",borderRadius:6,padding:"6px 10px",fontSize:"var(--t-text-base)",color:"var(--t-text-primary)",outline:"none"}})]}),w.length>0&&e.jsxs("div",{style:{marginTop:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[R("Tags"),e.jsx("div",{style:{display:"flex",gap:2,background:"var(--t-bg-surface)",padding:2,borderRadius:6,border:"1px solid var(--t-border-subtle)",marginBottom:8},children:["replace","append"].map(s=>e.jsx("button",{onClick:()=>k(s),style:{padding:"2px 10px",borderRadius:4,border:"none",background:D===s?"var(--t-bg-panel)":"transparent",color:D===s?"var(--t-text-primary)":"var(--t-text-muted)",fontSize:"var(--t-text-xs)",cursor:"pointer"},children:s.charAt(0).toUpperCase()+s.slice(1)},s))})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:w.map(s=>{const j=u.includes(s);return e.jsx("button",{onClick:()=>U(I=>j?I.filter(O=>O!==s):[...I,s]),style:{padding:"3px 10px",borderRadius:99,border:"1px solid",borderColor:j?"var(--t-border-default)":"var(--t-border-subtle)",background:j?"var(--t-bg-surface)":"transparent",color:j?"var(--t-text-secondary)":"var(--t-text-muted)",fontSize:"var(--t-text-sm)",cursor:"pointer"},children:s},s)})}),u.length>0&&e.jsx("p",{style:{fontSize:"var(--t-text-xs)",color:"var(--t-text-muted)",marginTop:6,marginBottom:0},children:D==="replace"?"Existing tags will be replaced with selected tags":"Selected tags will be added to existing tags"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:24},children:[e.jsx(S,{variant:"outline",size:"sm",onClick:f,disabled:g,children:"Cancel"}),e.jsx(S,{size:"sm",onClick:V,disabled:g,children:g?"Applying…":`Apply to ${d.length} test${d.length!==1?"s":""}`})]})]})]})})}function it({appId:p,activeSpaceId:d,activeFolderId:a,selectedTestId:f,onSelectTest:r,onNavigate:y,onAddSpace:n,onAddFolder:o,onImportFromTestMu:T,onImportFromTestRail:C,onImportFromCsv:m}){const{tests:u,loading:U,removeTest:D,refetch:k}=Xe(a??null),[w,N]=l.useState(null),{clipboard:g,copy:$,cut:V,clear:R}=_e(),[x,s]=l.useState(new Set),[j,I]=l.useState(null),[O,de]=l.useState(!1),[Q,P]=l.useState(!1),[Z,fe]=l.useState(null),H=l.useRef(null),F=l.useRef(null),[ee,Y]=l.useState(!1),[te,be]=l.useState(null),_=l.useRef(null),[M,re]=l.useState(""),se=l.useRef(null);l.useEffect(()=>{re("")},[a]),l.useEffect(()=>{if(!Q)return;const t=c=>{F.current&&!F.current.contains(c.target)&&H.current&&!H.current.contains(c.target)&&P(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[Q]),l.useEffect(()=>{if(!ee)return;const t=c=>{se.current&&!se.current.contains(c.target)&&_.current&&!_.current.contains(c.target)&&Y(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[ee]);const ve=()=>{if(H.current){const t=H.current.getBoundingClientRect();fe({top:t.bottom+4,right:window.innerWidth-t.right})}P(t=>!t)},me=()=>{if(_.current){const t=_.current.getBoundingClientRect();be({top:t.bottom+4,right:window.innerWidth-t.right})}Y(t=>!t)},je=(t,c)=>{c.stopPropagation(),s(i=>{const b=new Set(i);return b.has(t)?b.delete(t):b.add(t),b})},E=()=>s(new Set),Se=()=>s(new Set(u.map(t=>t.id))),J=u.length>0&&x.size===u.length,we=x.size>0,ke=(g==null?void 0:g.kind)==="test",ze=t=>{a&&$({kind:"test",ids:[t],sourceFolderId:a})},Te=t=>{a&&V({kind:"test",ids:[t],sourceFolderId:a})},K=()=>window.dispatchEvent(new CustomEvent("sdet:folders:refresh")),Ce=async t=>{a&&(await W.bulk.tests.duplicate({testIds:[t],targetFolderId:a}),await k(),K())},Re=()=>{a&&($({kind:"test",ids:[...x],sourceFolderId:a}),E())},Ie=()=>{a&&(V({kind:"test",ids:[...x],sourceFolderId:a}),E())},Me=async()=>{a&&(await W.bulk.tests.duplicate({testIds:[...x],targetFolderId:a}),E(),await k(),K())},Be=async()=>{x.size&&(await W.bulk.tests.delete({testIds:[...x]}),E(),await k(),K())},We=async()=>{!g||!a||g.kind!=="test"||(g.mode==="copy"?await W.bulk.tests.duplicate({testIds:g.ids,targetFolderId:a}):await W.bulk.tests.move({testIds:g.ids,targetFolderId:a}),R(),await k(),K())};return d?a?e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--t-bg-base)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",height:52,borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"Tests"}),e.jsx("span",{style:{fontSize:"var(--t-text-xs)",padding:"2px 8px",borderRadius:99,background:"var(--t-bg-surface)",color:"var(--t-text-muted)",fontWeight:500},children:M.trim()?`${u.filter(t=>t.title.toLowerCase().includes(M.toLowerCase())||(t.internalId??"").toLowerCase().includes(M.toLowerCase())).length} / ${u.length}`:u.length}),u.length>0&&e.jsx("button",{onClick:J?E:Se,style:{fontSize:"var(--t-text-xs)",color:J?"var(--t-text-primary)":"var(--t-text-muted)",background:"none",border:"none",cursor:"pointer",padding:"2px 6px",borderRadius:4},onMouseEnter:t=>{t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.color=J?"var(--t-text-primary)":"var(--t-text-muted)"},children:J?"Deselect all":"Select all"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,maxWidth:260,margin:"0 16px",padding:"5px 10px",borderRadius:7,background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)"},children:[e.jsx(xe,{size:13,style:{color:"var(--t-text-muted)",flexShrink:0}}),e.jsx("input",{value:M,onChange:t=>re(t.target.value),placeholder:"Search tests…",style:{flex:1,background:"none",border:"none",outline:"none",fontSize:"var(--t-text-sm)",color:"var(--t-text-primary)",minWidth:0}}),M&&e.jsx("button",{onClick:()=>re(""),style:{background:"none",border:"none",cursor:"pointer",padding:0,color:"var(--t-text-muted)",display:"flex",lineHeight:1},children:e.jsx(G,{size:11})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[m&&e.jsxs(S,{size:"sm",variant:"outline",onClick:m,style:{gap:6},children:[e.jsx(L,{size:13})," Import from CSV"]}),e.jsxs(S,{ref:_,size:"sm",variant:"outline",onClick:me,style:{gap:6},children:[e.jsx(A,{size:13}),"New",e.jsx(oe,{size:11,style:{marginLeft:2}})]}),ee&&te&&ce.createPortal(e.jsxs("div",{ref:se,style:{position:"fixed",top:te.top,right:te.right,zIndex:9999,minWidth:180,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",overflow:"hidden",padding:"4px 0"},children:[e.jsxs("button",{onClick:()=>{Y(!1),y({type:"test-editor",appId:p,spaceId:d,folderId:a})},style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"transparent",border:"none",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",cursor:"pointer",textAlign:"left"},onMouseEnter:t=>{t.currentTarget.style.background="var(--t-bg-hover)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(pe,{size:13}),"New Test"]}),o&&e.jsxs("button",{onClick:()=>{Y(!1),o()},style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"transparent",border:"none",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",cursor:"pointer",textAlign:"left"},onMouseEnter:t=>{t.currentTarget.style.background="var(--t-bg-hover)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(Ae,{size:13}),"New Folder"]})]}),document.body)]})]}),ke&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 24px",background:"var(--t-bg-surface)",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsx(Ne,{size:13,color:"var(--t-text-muted)"}),e.jsxs("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",flex:1},children:[g.ids.length," test",g.ids.length!==1?"s":""," ",g.mode==="copy"?"copied":"cut"," — paste into current folder"]}),e.jsx("button",{onClick:We,style:{fontSize:"var(--t-text-sm)",fontWeight:500,color:"var(--t-text-primary)",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,padding:"4px 10px",cursor:"pointer"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--t-border-strong)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--t-border-default)",t.currentTarget.style.color="var(--t-text-primary)"},children:"Paste here"}),e.jsx("button",{onClick:R,title:"Clear clipboard",style:{width:24,height:24,borderRadius:4,border:"none",background:"transparent",color:"var(--t-text-muted)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:t=>{t.currentTarget.style.color="var(--t-text-secondary)"},onMouseLeave:t=>{t.currentTarget.style.color="var(--t-text-muted)"},children:e.jsx(G,{size:12})})]}),we&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 24px",background:"var(--t-bg-surface)",borderBottom:"1px solid var(--t-border-subtle)",flexShrink:0},children:[e.jsxs("span",{style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",marginRight:4},children:[x.size," selected"]}),[{label:"Copy",icon:e.jsx(X,{size:12}),action:Re},{label:"Cut",icon:e.jsx(ue,{size:12}),action:Ie},{label:"Duplicate",icon:e.jsx(X,{size:12}),action:Me}].map(({label:t,icon:c,action:i})=>e.jsxs("button",{onClick:i,style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,padding:"4px 10px",cursor:"pointer"},onMouseEnter:b=>{b.currentTarget.style.borderColor="var(--t-border-strong)",b.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:b=>{b.currentTarget.style.borderColor="var(--t-border-default)",b.currentTarget.style.color="var(--t-text-secondary)"},children:[c,t]},t)),e.jsxs("button",{onClick:()=>de(!0),style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--t-text-sm)",color:"var(--t-text-secondary)",background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:6,padding:"4px 10px",cursor:"pointer"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--t-border-strong)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--t-border-default)",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(ie,{size:12}),"Edit"]}),e.jsx("div",{style:{width:1,height:18,background:"var(--t-border-default)",margin:"0 4px"}}),e.jsxs("button",{onClick:Be,style:{display:"flex",alignItems:"center",gap:5,fontSize:"var(--t-text-sm)",color:"var(--t-accent-danger)",background:"transparent",border:"1px solid var(--t-border-default)",borderRadius:6,padding:"4px 10px",cursor:"pointer"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--t-accent-danger)",t.currentTarget.style.color="var(--t-accent-danger)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--t-border-default)",t.currentTarget.style.color="var(--t-accent-danger)"},children:[e.jsx(ge,{size:12}),"Move to Trash"]}),e.jsx("div",{style:{flex:1}}),e.jsxs("button",{onClick:E,style:{fontSize:"var(--t-text-sm)",color:"var(--t-text-muted)",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:4},onMouseEnter:t=>{t.currentTarget.style.color="var(--t-text-secondary)"},onMouseLeave:t=>{t.currentTarget.style.color="var(--t-text-muted)"},children:[e.jsx(G,{size:11})," Clear"]})]}),e.jsxs("div",{style:{flex:1,overflow:"hidden",display:"flex"},children:[e.jsx("div",{style:{flex:1,overflowY:"auto"},children:U?e.jsx(e.Fragment,{children:Array.from({length:9}).map((t,c)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"13px 24px",borderTop:c>0?"1px solid var(--t-border-subtle)":"none"},children:[e.jsx(h,{width:16,height:16,borderRadius:4}),e.jsx(h,{width:26,height:26,borderRadius:6}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[e.jsx(h,{height:12,width:`${42+c*17%36}%`,borderRadius:3}),e.jsx(h,{height:9,width:`${20+c*13%24}%`,borderRadius:3})]}),e.jsx(h,{width:44,height:18,borderRadius:99}),e.jsx(h,{width:38,height:18,borderRadius:99})]},c))}):u.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14,height:"100%",textAlign:"center"},children:[e.jsx(pe,{size:32,weight:"duotone",color:"var(--t-text-muted)"}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"No tests yet"}),e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",marginTop:5},children:"Add your first test to this folder."})]}),e.jsxs(S,{onClick:()=>y({type:"test-editor",appId:p,spaceId:d,folderId:a}),variant:"outline",size:"sm",style:{gap:6},children:[e.jsx(A,{size:13})," New Test"]})]}):(()=>{const t=M.trim().toLowerCase(),c=t?u.filter(i=>i.title.toLowerCase().includes(t)||(i.internalId??"").toLowerCase().includes(t)):u;return t&&c.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,height:"100%",color:"var(--t-text-muted)",fontSize:"var(--t-text-base)"},children:[e.jsx(xe,{size:28,weight:"duotone"}),e.jsxs("span",{children:["No tests match"," ",e.jsxs("strong",{style:{color:"var(--t-text-secondary)"},children:["“",M,"”"]})]})]}):c.map((i,b)=>{const ne=i.id===f,B=x.has(i.id);return e.jsxs("div",{onClick:()=>r(ne?null:i.id),className:"test-row",style:{display:"flex",alignItems:"center",gap:10,padding:"13px 24px",cursor:"pointer",borderTop:b>0?"1px solid var(--t-border-subtle)":"none",transition:"background 0.1s",background:B||ne||j===i.id?"var(--t-bg-hover)":"transparent",borderLeft:B?"2px solid var(--t-border-strong)":ne?"2px solid var(--t-border-default)":"2px solid transparent"},onMouseEnter:z=>{I(i.id),z.currentTarget.querySelectorAll(".row-action-btn").forEach(ae=>ae.style.opacity="1");const q=z.currentTarget.querySelector(".row-checkbox");q&&(q.style.opacity="1")},onMouseLeave:z=>{I(null),z.currentTarget.querySelectorAll(".row-action-btn").forEach(ae=>ae.style.opacity="0");const q=z.currentTarget.querySelector(".row-checkbox");q&&!B&&(q.style.opacity="0")},children:[e.jsx("div",{className:"row-checkbox",onClick:z=>{z.stopPropagation(),je(i.id,z)},style:{width:16,height:16,flexShrink:0,borderRadius:4,border:B?"1.5px solid var(--t-text-primary)":"1.5px solid var(--t-border-strong)",background:B?"var(--t-text-primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.1s",opacity:B||x.size>0?1:0,pointerEvents:"auto"},children:B&&e.jsx($e,{size:10,weight:"bold",color:"var(--t-bg-base)"})}),e.jsx("span",{title:i.type==="bdd"?"BDD":"Traditional",style:{width:26,height:26,borderRadius:6,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)"},children:i.type==="bdd"?e.jsx(Oe,{size:13,color:"var(--t-text-muted)"}):e.jsx(Pe,{size:13,color:"var(--t-text-muted)"})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:"var(--t-text-base)",fontWeight:500,color:"var(--t-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.title}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:3,alignItems:"center"},children:[i.internalId&&e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--t-text-muted)"},children:i.internalId}),i.internalId&&e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-border-default)"},children:"·"}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--t-text-muted)"},children:i.status}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:le[i.priority]??"var(--t-text-muted)"},children:i.priority}),i.category&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:"var(--t-text-2xs)",color:"var(--t-border-default)"},children:"·"}),e.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--t-text-muted)"},children:i.category})]})]})]}),e.jsx(qe,{items:[{label:"Edit",icon:e.jsx(ie,{size:13}),action:()=>y({type:"test-editor",appId:p,spaceId:d,folderId:a,testId:i.id})},{label:"Copy",icon:e.jsx(X,{size:13}),action:()=>ze(i.id),separator:!0},{label:"Cut",icon:e.jsx(ue,{size:13}),action:()=>Te(i.id)},{label:"Duplicate",icon:e.jsx(X,{size:13,weight:"fill"}),action:()=>Ce(i.id)},{label:"Delete",icon:e.jsx(ge,{size:13}),action:()=>N({id:i.id,name:i.title}),destructive:!0,separator:!0}]})]},i.id)})})()}),f!==null&&e.jsx(et,{folderId:a,testId:f,appId:p,spaceId:d,activeFolderId:a,onClose:()=>r(null),onEdit:()=>y({type:"test-editor",appId:p,spaceId:d,folderId:a,testId:f})})]}),e.jsx(Ue,{open:w!==null,title:"Delete test",description:`"${w==null?void 0:w.name}" will be permanently deleted.`,confirmLabel:"Delete Test",onConfirm:async()=>{w&&(await D(w.id),N(null))},onCancel:()=>N(null)}),e.jsx(tt,{appId:p,testIds:[...x],open:O,onClose:()=>de(!1),onApplied:async()=>{await k()}})]}):e.jsxs("div",{style:{flex:1,background:"var(--t-bg-base)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",height:52,borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)",flexShrink:0},children:[e.jsx("span",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"Folders"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[m&&e.jsxs(S,{size:"sm",variant:"outline",onClick:m,style:{gap:6},children:[e.jsx(L,{size:13})," Import from CSV"]}),o&&e.jsxs(S,{size:"sm",variant:"outline",onClick:o,style:{gap:6},children:[e.jsx(A,{size:13})," New Folder"]})]})]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,textAlign:"center"},children:[e.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Le,{size:26,weight:"duotone",color:"var(--t-text-muted)"})}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)",margin:0},children:"No folder selected"}),e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",marginTop:5},children:"Select a folder from the sidebar or create a new one."})]}),o&&e.jsxs(S,{onClick:o,variant:"outline",size:"sm",style:{gap:6},children:[e.jsx(A,{size:13})," New Folder"]})]})})]}):e.jsxs("div",{style:{flex:1,background:"var(--t-bg-base)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",height:48,borderBottom:"1px solid var(--t-border-subtle)",background:"var(--t-bg-elevated)",flexShrink:0},children:[e.jsx("span",{style:{fontSize:"var(--t-text-base)",fontWeight:600,color:"var(--t-text-primary)"},children:"Spaces"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(T||C||m)&&e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{ref:H,onClick:ve,style:{display:"flex",alignItems:"center",gap:6,height:30,fontSize:"var(--t-text-sm)",padding:"0 12px",background:"transparent",border:"1px solid var(--t-border-default)",borderRadius:6,color:"var(--t-text-primary)",cursor:"pointer",transition:"border-color 0.1s, background 0.1s"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--t-border-strong)",t.currentTarget.style.background="var(--t-bg-hover)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--t-border-default)",t.currentTarget.style.background="transparent"},children:[e.jsx(L,{size:13}),"Import",e.jsx(oe,{size:11,style:{marginLeft:2}})]}),Q&&Z&&ce.createPortal(e.jsxs("div",{ref:F,style:{position:"fixed",top:Z.top,right:Z.right,zIndex:9999,minWidth:190,background:"var(--t-bg-panel)",border:"1px solid var(--t-border-default)",borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.6)",overflow:"hidden",padding:"4px 0"},children:[T&&e.jsxs("button",{onClick:()=>{P(!1),T()},style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"transparent",border:"none",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",cursor:"pointer",textAlign:"left"},onMouseEnter:t=>{t.currentTarget.style.background="var(--t-bg-hover)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(L,{size:13}),"Import from TestMu"]}),C&&e.jsxs("button",{onClick:()=>{P(!1),C()},style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"transparent",border:"none",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",cursor:"pointer",textAlign:"left"},onMouseEnter:t=>{t.currentTarget.style.background="var(--t-bg-hover)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(L,{size:13}),"Import from TestRail"]}),m&&e.jsxs("button",{onClick:()=>{P(!1),m()},style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"7px 12px",background:"transparent",border:"none",color:"var(--t-text-secondary)",fontSize:"var(--t-text-base)",cursor:"pointer",textAlign:"left"},onMouseEnter:t=>{t.currentTarget.style.background="var(--t-bg-hover)",t.currentTarget.style.color="var(--t-text-primary)"},onMouseLeave:t=>{t.currentTarget.style.background="transparent",t.currentTarget.style.color="var(--t-text-secondary)"},children:[e.jsx(L,{size:13}),"Import from CSV"]})]}),document.body)]}),n&&e.jsxs(S,{onClick:n,variant:"outline",style:{gap:6,height:30,fontSize:"var(--t-text-sm)",padding:"0 12px"},children:[e.jsx(A,{size:13}),"Add Space"]})]})]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,textAlign:"center"},children:[e.jsx("div",{style:{width:52,height:52,borderRadius:14,background:"var(--t-bg-surface)",border:"1px solid var(--t-border-subtle)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Ee,{size:26,weight:"duotone",color:"var(--t-text-muted)"})}),e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"var(--t-text-lg)",fontWeight:500,color:"var(--t-text-primary)"},children:"No space selected"}),e.jsx("p",{style:{fontSize:"var(--t-text-base)",color:"var(--t-text-muted)",marginTop:5},children:"Create a space to organise your test cases."})]}),n&&e.jsxs(S,{onClick:n,variant:"outline",style:{gap:6},children:[e.jsx(A,{size:14}),"Add Space"]})]})})]})}export{it as SpaceView};