@testver/testver 1.4.3 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/LICENSE +88 -69
  2. package/README.md +6 -2
  3. package/bin/testver.js +9 -1
  4. package/dist/index.js +38415 -21751
  5. package/package.json +179 -178
  6. package/src/ui/static/agents/antigravity.svg +76 -0
  7. package/src/ui/static/agents/codex.svg +3 -0
  8. package/src/ui/static/agents/gemini.svg +1 -0
  9. package/src/ui/static/agents/opencode.svg +4 -0
  10. package/src/ui/static/agents/vscode.svg +17 -0
  11. package/src/ui/static/assets/{AIPanel-KQFq4c0Q.js → AIPanel-RWO8Cd9w.js} +32 -32
  12. package/src/ui/static/assets/{AIRecordPanel-CAs8fXyS.js → AIRecordPanel-DnreS585.js} +40 -40
  13. package/src/ui/static/assets/{AIStreamUI-p_sMTEDQ.js → AIStreamUI-C1gHJtlF.js} +9 -9
  14. package/src/ui/static/assets/{AITestGenPage-CHaHfmu4.js → AITestGenPage-C8bWUelu.js} +5 -5
  15. package/src/ui/static/assets/{APITestingPage-BSGJY_hd.js → APITestingPage-DwL67hqL.js} +19 -19
  16. package/src/ui/static/assets/AboutPage-CynLB95E.js +1 -0
  17. package/src/ui/static/assets/AccessTokensTab-BdevOmpE.js +1 -0
  18. package/src/ui/static/assets/AdvancedPage-BeM7aB8b.js +3 -0
  19. package/src/ui/static/assets/{AnalyticsPage-Lm8noJqC.js → AnalyticsPage-C5ddYfRk.js} +1 -1
  20. package/src/ui/static/assets/AuditLogPage-DYcUdJoj.js +1 -0
  21. package/src/ui/static/assets/{ChangesSummary-Cu0_4Ucf.js → ChangesSummary-BjNMwGIZ.js} +3 -3
  22. package/src/ui/static/assets/{CodeMapPage-uEjuo3fk.js → CodeMapPage-BQOEtv-R.js} +3 -3
  23. package/src/ui/static/assets/{ConfirmDialog-DtotgVmI.js → ConfirmDialog-D_N9188T.js} +1 -1
  24. package/src/ui/static/assets/{CoveragePage-jNkQJA1P.js → CoveragePage-8bDSphY1.js} +2 -2
  25. package/src/ui/static/assets/{CronBuilder-D2fERHt9.js → CronBuilder-C7_JADb7.js} +1 -1
  26. package/src/ui/static/assets/{Dashboard-BaIj_IdQ.js → Dashboard-B22yRPyV.js} +1 -1
  27. package/src/ui/static/assets/{DefectsPage-DH0njYFG.js → DefectsPage-Arv4Ac-b.js} +72 -72
  28. package/src/ui/static/assets/{EmptyState-utxlJ0fu.js → EmptyState-BShNSbLf.js} +1 -1
  29. package/src/ui/static/assets/{ExportButton-ouKqn9CU.js → ExportButton-xrS_AnfS.js} +1 -1
  30. package/src/ui/static/assets/{FileViewer-mU3JloJ6.js → FileViewer-Bcr9T1jW.js} +18 -18
  31. package/src/ui/static/assets/{GitPage-TrX-RqNC.js → GitPage-DXL2Sv40.js} +12 -12
  32. package/src/ui/static/assets/{ImportExportPage-CIhK_raX.js → ImportExportPage-BcjzRd7T.js} +36 -36
  33. package/src/ui/static/assets/{JiraPushDialog-DgEZS-0u.js → JiraPushDialog-DNYU9Ce0.js} +1 -1
  34. package/src/ui/static/assets/{KpiTile-BHLE3HVj.js → KpiTile-BKlWqjgN.js} +1 -1
  35. package/src/ui/static/assets/{LiveExecutionView-CaIf7Jux.js → LiveExecutionView-1LlyEDEe.js} +1 -1
  36. package/src/ui/static/assets/{MediaModal-DNM45Uz2.js → MediaModal-Dyy_iHl9.js} +1 -1
  37. package/src/ui/static/assets/MobileRunPicker-Cf5rm469.js +1 -0
  38. package/src/ui/static/assets/MobileRunTarget-C4M4YJJh.js +6 -0
  39. package/src/ui/static/assets/{ModuleExplorer-rni7JbsL.js → ModuleExplorer-BKVbxFZK.js} +1 -1
  40. package/src/ui/static/assets/{OutputPage-Cn2WCpJ6.js → OutputPage-Bi-28tJi.js} +1 -1
  41. package/src/ui/static/assets/PipelinesPanel-BtO3iSJ4.js +1 -0
  42. package/src/ui/static/assets/{ProfilePage-BKNdkSnx.js → ProfilePage-BgZ4VDC-.js} +1 -1
  43. package/src/ui/static/assets/{ProjectExplorer-5e7J8t-o.js → ProjectExplorer-BVGbmVP7.js} +1 -1
  44. package/src/ui/static/assets/{RemoteFileStrip-C1S2aclP.js → RemoteFileStrip-dzPInzgb.js} +1 -1
  45. package/src/ui/static/assets/{ReportCard-D4EElEe9.js → ReportCard-LOf1PXlb.js} +2 -2
  46. package/src/ui/static/assets/{ReportFullView-2w2ysKRg.js → ReportFullView-Ce4OI8lf.js} +1 -1
  47. package/src/ui/static/assets/{ReportsPage-9Fx-IEwV.js → ReportsPage-DFxCQ8cY.js} +48 -48
  48. package/src/ui/static/assets/{ResultsPage-DPkfGh-K.js → ResultsPage-DD-uj8gk.js} +115 -115
  49. package/src/ui/static/assets/{RunState-CRuS_bC2.js → RunState-DDwFB4tA.js} +1 -1
  50. package/src/ui/static/assets/{RunTargets-CPKBrefj.js → RunTargets-CkIpY3v3.js} +1 -1
  51. package/src/ui/static/assets/ScriptMappingPage-DQQoR6sR.js +1 -0
  52. package/src/ui/static/assets/{SearchableDevicePicker-DubIldKj.js → SearchableDevicePicker-CenIxD7b.js} +1 -1
  53. package/src/ui/static/assets/{SettingsPage-BuZrrlW2.js → SettingsPage-DAV_0y0m.js} +83 -83
  54. package/src/ui/static/assets/{SharedReportView-ig5hECRk.js → SharedReportView-CqSLFKT1.js} +1 -1
  55. package/src/ui/static/assets/{SourcesPage-BPkqRqkC.js → SourcesPage-BvqC9oKw.js} +14 -14
  56. package/src/ui/static/assets/TestExplorerPage-Bdnll77k.js +7 -0
  57. package/src/ui/static/assets/{TestManagementPage-DJiWpCne.js → TestManagementPage-CCNE688A.js} +10 -10
  58. package/src/ui/static/assets/{TestPlansPage-G1lvK1C0.js → TestPlansPage-T6D25i6-.js} +5 -5
  59. package/src/ui/static/assets/{TestverCreditsRing-CEBSy3w3.js → TestverCreditsRing-CoDk5eAS.js} +1 -1
  60. package/src/ui/static/assets/TestverMcpPage-Dte0qSXp.js +34 -0
  61. package/src/ui/static/assets/{UncommittedDiffViewer-FKvUZcRi.js → UncommittedDiffViewer-BNroxCoo.js} +2 -2
  62. package/src/ui/static/assets/{UserManagementPage-gDGhaHE4.js → UserManagementPage-BU4MuDJZ.js} +10 -10
  63. package/src/ui/static/assets/{WorkflowsPage-BACdnU-1.js → WorkflowsPage-BP5k7AqE.js} +83 -83
  64. package/src/ui/static/assets/clipboard-BIEd7Ccc.js +1 -0
  65. package/src/ui/static/assets/{hiddenLlmProviders-DzwaR-b9.js → hiddenLlmProviders-BPORgy-e.js} +1 -1
  66. package/src/ui/static/assets/index-BlA8ntjb.js +47 -0
  67. package/src/ui/static/assets/index-Co4_SlGD.css +1 -0
  68. package/src/ui/static/assets/{reportMeta-3kxT7BIT.js → reportMeta-B9ZRW6ts.js} +1 -1
  69. package/src/ui/static/assets/runSelected-BoPm1sz-.js +1 -0
  70. package/src/ui/static/assets/{useFeatureFlags-DrhvBp0C.js → useFeatureFlags-B4Otsv-N.js} +1 -1
  71. package/src/ui/static/assets/{useJiraConnector-Dwj69Rfh.js → useJiraConnector--JZhbYrT.js} +1 -1
  72. package/src/ui/static/assets/{useOwnership-C1CmzcvJ.js → useOwnership-BhPOiYzy.js} +1 -1
  73. package/src/ui/static/assets/useSuites-GN_K2mHc.js +1 -0
  74. package/src/ui/static/assets/{useTestExplorer-CUqC18DV.js → useTestExplorer-BGhkGHKy.js} +1 -1
  75. package/src/ui/static/assets/{useTestLifecycle-C2S_vaX2.js → useTestLifecycle-DX5ES6x8.js} +1 -1
  76. package/src/ui/static/assets/{useTestManagement-DW6AW2mt.js → useTestManagement-ommXjx0q.js} +2 -2
  77. package/src/ui/static/assets/{useTestResults-yjH1aUy-.js → useTestResults-DWjvm8gm.js} +1 -1
  78. package/src/ui/static/assets/{vendor-icons-D_Dmmj8d.js → vendor-icons-Cm92aSc5.js} +1426 -1416
  79. package/src/ui/static/index.html +479 -479
  80. package/src/ui/static/assets/AboutPage-CDa24SCJ.js +0 -1
  81. package/src/ui/static/assets/AdvancedPage-BqXP0FLg.js +0 -3
  82. package/src/ui/static/assets/AuditLogPage-BvldSIik.js +0 -1
  83. package/src/ui/static/assets/MobileRunPicker-DFKm6_nU.js +0 -1
  84. package/src/ui/static/assets/MobileRunTarget-DHDoDZ_F.js +0 -6
  85. package/src/ui/static/assets/PipelinesPanel-D6zWcLtD.js +0 -1
  86. package/src/ui/static/assets/ScriptMappingPage-C3K_uyf0.js +0 -1
  87. package/src/ui/static/assets/TestExplorerPage-C_jl93GR.js +0 -7
  88. package/src/ui/static/assets/index-D6sQYc_0.js +0 -47
  89. package/src/ui/static/assets/index-aInN0yoR.css +0 -1
  90. package/src/ui/static/assets/runSelected-WlgnZcSF.js +0 -1
  91. package/src/ui/static/assets/useSuites-V0AxZYex.js +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-DOVfxdUy.js";import{F as a}from"./vendor-icons-D_Dmmj8d.js";function i({title:r,description:t,icon:m,action:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center animate-fade-in",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-surface-2 flex items-center justify-center mb-4 text-gray-400",children:m??e.jsx(a,{size:28})}),e.jsx("h3",{className:"text-lg font-medium text-gray-200 mb-1",children:r}),t&&e.jsx("p",{className:"text-sm text-gray-400 max-w-md",children:t}),s&&e.jsx("div",{className:"mt-4",children:s})]})}export{i as E};
1
+ import{j as e}from"./vendor-react-DOVfxdUy.js";import{F as a}from"./vendor-icons-Cm92aSc5.js";function i({title:r,description:t,icon:m,action:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center animate-fade-in",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-surface-2 flex items-center justify-center mb-4 text-gray-400",children:m??e.jsx(a,{size:28})}),e.jsx("h3",{className:"text-lg font-medium text-gray-200 mb-1",children:r}),t&&e.jsx("p",{className:"text-sm text-gray-400 max-w-md",children:t}),s&&e.jsx("div",{className:"mt-4",children:s})]})}export{i as E};
@@ -1 +1 @@
1
- import{r as n,j as s}from"./vendor-react-DOVfxdUy.js";import{ii as N,bY as E}from"./index-D6sQYc_0.js";import{bg as w,aL as C,i as S,a0 as d,r as f,a5 as y,y as k}from"./vendor-icons-D_Dmmj8d.js";const l={docx:{label:"Word Document (.docx)",icon:S,color:"text-blue-400"},pdf:{label:"PDF Report (.pdf)",icon:C,color:"text-red-400"},xlsx:{label:"Excel Spreadsheet (.xlsx)",icon:w,color:"text-emerald-400"},csv:{label:"CSV File (.csv)",icon:w,color:"text-gray-400"}};function L({type:j,formats:r,params:v,label:x="Export",size:u="sm"}){const[m,c]=n.useState(!1),[o,p]=n.useState(null),[h,b]=n.useState(null),i=n.useRef(null);n.useEffect(()=>{const e=t=>{i.current&&!i.current.contains(t.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const g=async e=>{p(e);try{const t=await N({type:j,format:e,params:v});if(t!=null&&t.downloadUrl){const a=document.createElement("a");a.href=E(t.downloadUrl),a.download=t.filename||`export.${e}`,document.body.appendChild(a),a.click(),document.body.removeChild(a),b(e),setTimeout(()=>b(null),2e3)}}catch(t){console.error("Export failed:",t)}finally{p(null)}};if(r.length===1){const e=r[0];return(l[e]||l.csv).icon,s.jsxs("button",{onClick:()=>g(e),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o===e?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):h===e?s.jsx(f,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x]})}return s.jsxs("div",{ref:i,className:"relative",children:[s.jsxs("button",{onClick:()=>c(!m),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x,s.jsx(k,{className:"w-3 h-3"})]}),m&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-1 border border-white/10 rounded-lg shadow-xl z-50 w-56 py-1 overflow-hidden",children:r.map(e=>{const t=l[e]||l.csv,a=t.icon;return s.jsxs("button",{onClick:()=>{g(e),c(!1)},disabled:o!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-xs text-gray-300 hover:bg-surface-3 hover:text-gray-100 transition-colors disabled:opacity-50",children:[o===e?s.jsx(d,{className:"w-4 h-4 animate-spin"}):h===e?s.jsx(f,{className:"w-4 h-4 text-emerald-400"}):s.jsx(a,{className:`w-4 h-4 ${t.color}`}),s.jsx("span",{children:t.label})]},e)})})]})}export{L as E};
1
+ import{r as n,j as s}from"./vendor-react-DOVfxdUy.js";import{iq as N,b$ as E}from"./index-BlA8ntjb.js";import{bh as f,aM as C,j as S,a1 as d,s as g,a6 as y,z as k}from"./vendor-icons-Cm92aSc5.js";const l={docx:{label:"Word Document (.docx)",icon:S,color:"text-blue-400"},pdf:{label:"PDF Report (.pdf)",icon:C,color:"text-red-400"},xlsx:{label:"Excel Spreadsheet (.xlsx)",icon:f,color:"text-emerald-400"},csv:{label:"CSV File (.csv)",icon:f,color:"text-gray-400"}};function $({type:j,formats:r,params:v,label:x="Export",size:u="sm"}){const[m,c]=n.useState(!1),[o,p]=n.useState(null),[h,b]=n.useState(null),i=n.useRef(null);n.useEffect(()=>{const e=t=>{i.current&&!i.current.contains(t.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const w=async e=>{p(e);try{const t=await N({type:j,format:e,params:v});if(t!=null&&t.downloadUrl){const a=document.createElement("a");a.href=E(t.downloadUrl),a.download=t.filename||`export.${e}`,document.body.appendChild(a),a.click(),document.body.removeChild(a),b(e),setTimeout(()=>b(null),2e3)}}catch(t){console.error("Export failed:",t)}finally{p(null)}};if(r.length===1){const e=r[0];return(l[e]||l.csv).icon,s.jsxs("button",{onClick:()=>w(e),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o===e?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):h===e?s.jsx(g,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x]})}return s.jsxs("div",{ref:i,className:"relative",children:[s.jsxs("button",{onClick:()=>c(!m),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x,s.jsx(k,{className:"w-3 h-3"})]}),m&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-1 border border-white/10 rounded-lg shadow-xl z-50 w-56 py-1 overflow-hidden",children:r.map(e=>{const t=l[e]||l.csv,a=t.icon;return s.jsxs("button",{onClick:()=>{w(e),c(!1)},disabled:o!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-xs text-gray-300 hover:bg-surface-3 hover:text-gray-100 transition-colors disabled:opacity-50",children:[o===e?s.jsx(d,{className:"w-4 h-4 animate-spin"}):h===e?s.jsx(g,{className:"w-4 h-4 text-emerald-400"}):s.jsx(a,{className:`w-4 h-4 ${t.color}`}),s.jsx("span",{children:t.label})]},e)})})]})}export{$ as E};
@@ -1,18 +1,18 @@
1
- import{r as x,j as e,p as Ye}from"./vendor-react-DOVfxdUy.js";import{j as T,i as M,c as D,az as se,aA as Ee,aB as U,aC as xe,aD as Q,aE as B,a1 as X,Q as Fe,aF as Y,K as de,aG as re,aH as He,aI as L,aJ as et,aK as ue,aL as tt,y as We,t as Oe,F as st,aM as rt,aN as at,aO as nt,aP as lt,T as it,aQ as ot,aR as ct,aS as ve,aa as Ie,aT as ae,aU as ne,aV as xt,aW as dt,aX as ut,_ as ye,R as le,aY as mt,aZ as ht,q as ft,a_ as pt,a$ as gt,X as me,b0 as he,a2 as bt,o as $e}from"./vendor-icons-D_Dmmj8d.js";import{u as jt,I as yt,R as Le,a as vt}from"./RemoteFileStrip-C1S2aclP.js";import{h as wt,u as Nt,b as kt,c as zt,r as Ct,d as St,e as Et,f as Ft,i as fe,L as $t,j as Lt}from"./index-D6sQYc_0.js";import{a as Tt,u as Mt}from"./vendor-query-DkZSMtfn.js";import{F as we}from"./index-DLmlY2Ol.js";import{u as Ne}from"./useChartTheme-CTIe6M63.js";import{w as Rt}from"./sandboxStorage-BrzaG3ny.js";import{r as Wt}from"./simpleMarkdown-kWs-10D8.js";import{E as H}from"./EmptyState-utxlJ0fu.js";import{f as Ot}from"./formatDate-T65-Y6Mi.js";import{U as It}from"./UncommittedDiffViewer-FKvUZcRi.js";const Dt=2e3;function vs(s){const a=x.useRef(s);a.current=s;const r=x.useCallback(p=>{const u=a.current;if(u)try{p.size===0?localStorage.removeItem(u):p.size<=Dt&&localStorage.setItem(u,JSON.stringify([...p]))}catch{}},[]),[n,i]=x.useState(()=>{if(!s)return new Set;try{const p=localStorage.getItem(s);if(!p)return new Set;const u=JSON.parse(p);return Array.isArray(u)?new Set(u.filter(o=>typeof o=="string")):new Set}catch{return new Set}}),t=x.useCallback(p=>{i(u=>{const o=new Set(u);return o.has(p)?o.delete(p):o.add(p),r(o),o})},[r]),c=x.useCallback(p=>{const u=new Set(p);r(u),i(u)},[r]),d=x.useCallback(()=>{const p=new Set;r(p),i(p)},[r]);return{expanded:n,toggle:t,expandAll:c,collapseAll:d}}const l=14,ee={".ts":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".tsx":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".d.ts":{icon:e.jsx(L,{size:l}),color:"text-blue-300"},".js":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".jsx":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".mjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".cjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".py":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".pyw":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".java":{icon:e.jsx(ue,{size:l}),color:"text-orange-400"},".kt":{icon:e.jsx(ue,{size:l}),color:"text-purple-400"},".scala":{icon:e.jsx(ue,{size:l}),color:"text-red-400"},".cs":{icon:e.jsx(et,{size:l}),color:"text-green-400"},".csproj":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".sln":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".rb":{icon:e.jsx(L,{size:l}),color:"text-red-400"},".feature":{icon:e.jsx(He,{size:l}),color:"text-emerald-400"},".robot":{icon:e.jsx(D,{size:l}),color:"text-teal-400"},".json":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".jsonc":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".yaml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".yml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".toml":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".html":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".htm":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".xml":{icon:e.jsx(de,{size:l}),color:"text-orange-300"},".css":{icon:e.jsx(Y,{size:l}),color:"text-blue-400"},".scss":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".sass":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".less":{icon:e.jsx(Y,{size:l}),color:"text-indigo-400"},".md":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".mdx":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".txt":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".rst":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".csv":{icon:e.jsx(X,{size:l}),color:"text-green-300"},".sql":{icon:e.jsx(X,{size:l}),color:"text-blue-300"},".db":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".sqlite":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".png":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".jpg":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".jpeg":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".gif":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".svg":{icon:e.jsx(B,{size:l}),color:"text-amber-300"},".webp":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".ico":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".ini":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".conf":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".cfg":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".properties":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".sh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bash":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".zsh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bat":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".cmd":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".ps1":{icon:e.jsx(D,{size:l}),color:"text-blue-300"},".zip":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".tar":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".gz":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".pem":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".key":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".cert":{icon:e.jsx(xe,{size:l}),color:"text-red-300"}},Te={"package.json":{icon:e.jsx(U,{size:l}),color:"text-green-400"},"package-lock.json":{icon:e.jsx(U,{size:l}),color:"text-green-300"},"pnpm-lock.yaml":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},"yarn.lock":{icon:e.jsx(U,{size:l}),color:"text-blue-300"},"tsconfig.json":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},"vite.config.ts":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},"webpack.config.js":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},".gitignore":{icon:e.jsx(T,{size:l}),color:"text-gray-500"},".eslintrc.json":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},".prettierrc":{icon:e.jsx(T,{size:l}),color:"text-pink-300"},Dockerfile:{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},"docker-compose.yml":{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.local":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.example":{icon:e.jsx(se,{size:l}),color:"text-yellow-400"},Makefile:{icon:e.jsx(D,{size:l}),color:"text-amber-400"},Gemfile:{icon:e.jsx(M,{size:l}),color:"text-red-400"},"requirements.txt":{icon:e.jsx(M,{size:l}),color:"text-sky-400"},"pom.xml":{icon:e.jsx(T,{size:l}),color:"text-orange-400"},"build.gradle":{icon:e.jsx(T,{size:l}),color:"text-green-400"}},pe={icon:e.jsx(tt,{size:l}),color:"text-gray-500"};function Pt(s){const a=s.toLowerCase();if(Te[a])return Te[a];if(a.startsWith(".env"))return ee[".env"]??pe;if(a.endsWith(".d.ts"))return ee[".d.ts"]??pe;const r=a.lastIndexOf(".");if(r>=0){const n=a.substring(r);if(ee[n])return ee[n]}return pe}const Me=new WeakMap,Re=new WeakMap;function De(s){if(s.type==="file")return 1;if(!s.children)return 0;const a=Me.get(s);if(a!==void 0)return a;const r=s.children.reduce((n,i)=>n+De(i),0);return Me.set(s,r),r}function Pe(s,a){let r=Re.get(s);const n=r==null?void 0:r.get(a);if(n!==void 0)return n;const i=a.toLowerCase();let t=s.name.toLowerCase().includes(i);return!t&&s.type==="directory"&&s.children&&(t=s.children.some(c=>Pe(c,a))),r||(r=new Map,Re.set(s,r)),r.size>8&&r.clear(),r.set(a,t),t}function Gt({nodes:s,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t=0,filter:c}){const d=x.useMemo(()=>{let o=[...s];return c&&c.trim()&&(o=o.filter(g=>Pe(g,c.trim()))),o.sort((g,z)=>g.type!==z.type?g.type==="directory"?-1:1:g.name.localeCompare(z.name))},[s,c]),{check:p,byPath:u}=jt();return d.length===0?null:e.jsx("div",{className:"relative",children:d.map(o=>{const g=a.has(o.path),z=r===o.path,v=o.type==="directory"?De(o):0,b=o.type==="file"?Pt(o.name):null;return e.jsxs("div",{className:"relative",children:[t>0&&e.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none","aria-hidden":"true",children:Array.from({length:t},(j,y)=>e.jsx("div",{className:"absolute top-0 bottom-0 border-l border-white/[0.06]",style:{left:`${y*16+16}px`}},y))}),e.jsxs("button",{className:`
2
- group w-full flex items-center gap-1.5 py-[3px] text-[13px] text-left
3
- transition-colors duration-75 relative
4
- ${z?"bg-brand-500/12 text-gray-100 before:absolute before:inset-y-0 before:left-0 before:w-[2px] before:bg-brand-400":"text-gray-400 hover:text-gray-200 hover:bg-white/[0.04]"}
5
- `,style:{paddingLeft:`${t*16+8}px`,paddingRight:"8px"},onClick:()=>{o.type==="directory"?n(o.path):i(o.path)},title:o.path,children:[o.type==="directory"?e.jsx("span",{className:"flex-shrink-0 w-4 h-4 flex items-center justify-center transition-transform duration-100 text-gray-500",children:g?e.jsx(We,{size:14}):e.jsx(Oe,{size:14})}):e.jsx("span",{className:"w-4 flex-shrink-0"}),o.type==="directory"?e.jsx("span",{className:"text-amber-400/80 flex-shrink-0",children:g?e.jsx(st,{size:15}):e.jsx(rt,{size:15})}):e.jsx("span",{className:`flex-shrink-0 ${(b==null?void 0:b.color)??"text-gray-500"}`,children:b==null?void 0:b.icon}),e.jsx("span",{className:`truncate flex-1 ${z?"font-medium":""}`,children:o.name}),o.type==="directory"&&o.truncated&&e.jsx("span",{className:"text-[10px] text-amber-500/70 flex-shrink-0 ml-1",title:"Too many files — this folder's listing was cut short",children:"…"}),o.type==="directory"&&v>0&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:v}),o.type==="file"&&u.size>0&&e.jsx(yt,{path:o.path,byPath:u,label:wt(p)}),o.type==="file"&&o.language&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:o.language})]}),o.type==="directory"&&g&&o.children&&e.jsx(Gt,{nodes:o.children,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t+1,filter:c})]},o.path)})})}const ge="testver_outline_visible",At={typescript:"typescript",javascript:"javascript",python:"python",java:"java",csharp:"csharp",ruby:"ruby",gherkin:"plaintext",robot:"plaintext",json:"json",yaml:"yaml",xml:"xml",html:"html",css:"css",markdown:"markdown",shell:"shell",sql:"sql"};function Vt(s,a,r){const n=s.split(`
6
- `);for(let i=0;i<n.length;i++){const t=n[i];if(r==="class"&&new RegExp(`\\bclass\\s+${te(a)}\\b`).test(t)||r==="method"&&[new RegExp(`\\b${te(a)}\\s*\\(`),new RegExp(`\\bdef\\s+${te(a)}\\b`),new RegExp(`\\bfunction\\s+${te(a)}\\s*\\(`)].some(d=>d.test(t)))return i+1}for(let i=0;i<n.length;i++)if(n[i].includes(a))return i+1;return null}function te(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const _t={Given:"text-sky-300",When:"text-amber-300",Then:"text-emerald-300",And:"text-gray-300",But:"text-rose-300"};function be({content:s,metadata:a,onChange:r,readOnly:n=!0,onEditorReady:i,steps:t,onStepClick:c}){var S,A,J,h,V,E,K;const d=Ne(),p=At[a.language]??"plaintext",u=x.useRef(null),o=((A=(S=a.metadata)==null?void 0:S.classes)==null?void 0:A.length)??0,g=((h=(J=a.metadata)==null?void 0:J.methods)==null?void 0:h.length)??0,z=((V=a.metadata)==null?void 0:V.testCount)??0,v=(t==null?void 0:t.length)??0,b=!!(o||g||v),[j,y]=x.useState(()=>{if(!b)return!1;try{const f=localStorage.getItem(ge);return f===null?!0:f==="1"}catch{return!0}});x.useEffect(()=>{if(b&&j===!1)try{const f=localStorage.getItem(ge);(f===null||f==="1")&&y(!0)}catch{}},[b]),x.useEffect(()=>{if(b)try{localStorage.setItem(ge,j?"1":"0")}catch{}},[j,b]);const q=x.useCallback(f=>{u.current=f,i==null||i(f)},[i]),R=x.useCallback(f=>{const w=u.current;if(!w)return;w.revealLineInCenter(f),w.setPosition({lineNumber:f,column:1}),w.focus();const $=w.deltaDecorations([],[{range:{startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{w.deltaDecorations($,[])},1500)},[]),P=x.useCallback((f,w)=>{const $=Vt(s,f,w);$&&R($)},[s,R]),G=o+g+v;return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(we,{height:"100%",language:p,value:s,onChange:r,onMount:q,theme:d.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})}),b&&e.jsx(e.Fragment,{children:j?e.jsxs("div",{className:`w-52 border-l border-white/5 bg-surface-1 flex flex-col flex-shrink-0
7
- animate-[slideInRight_150ms_ease-out]`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-white/5 flex-shrink-0",children:[e.jsx(re,{size:12,className:"text-gray-500"}),e.jsx("span",{className:"text-[10px] uppercase font-semibold text-gray-500 flex-1 tracking-wider",children:"Outline"}),e.jsx("button",{onClick:()=>y(!1),className:"p-0.5 rounded hover:bg-white/5 text-gray-500 hover:text-gray-300 transition-colors",title:"Hide outline panel",children:e.jsx(at,{size:14})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 pt-2",children:[((E=a.metadata)==null?void 0:E.classes)&&o>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(nt,{size:11,className:"text-brand-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Classes"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:o})]}),a.metadata.classes.map(f=>e.jsx("button",{onClick:()=>P(f,"class"),className:`block w-full text-left text-xs text-brand-300 py-1 px-1.5 -mx-1.5 rounded
8
- hover:bg-brand-500/10 hover:text-brand-200 transition-colors truncate cursor-pointer`,title:`Go to class ${f}`,children:f},f))]}),((K=a.metadata)==null?void 0:K.methods)&&g>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(re,{size:11,className:"text-amber-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Methods"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:g})]}),a.metadata.methods.map(f=>e.jsxs("button",{onClick:()=>P(f,"method"),className:`block w-full text-left text-xs text-gray-300 py-1 px-1.5 -mx-1.5 rounded font-mono
9
- hover:bg-white/5 hover:text-gray-100 transition-colors truncate cursor-pointer`,title:`Go to ${f}()`,children:[f,"()"]},f))]}),t&&v>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(lt,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Steps"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:v})]}),t.map((f,w)=>{var W;const $=(W=f.match(/^(Given|When|Then|And|But)/))==null?void 0:W[1],ie=_t[$??""]??"text-gray-300";return e.jsx("button",{onClick:()=>c==null?void 0:c(f),className:`block w-full text-left text-xs py-1 px-1.5 -mx-1.5 rounded truncate
10
- transition-colors cursor-pointer ${ie} hover:bg-white/5 hover:brightness-125`,title:`Go to: ${f}`,children:f},w)})]}),z>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(it,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Tests"})]}),e.jsxs("div",{className:"text-xs text-emerald-300 px-1.5",children:[z," test(s)"]})]})]})]}):e.jsxs("button",{onClick:()=>y(!0),className:`w-7 border-l border-white/5 bg-surface-1 flex flex-col items-center justify-center
11
- gap-2 flex-shrink-0 hover:bg-white/[0.03] transition-colors group cursor-pointer`,title:"Show outline panel",children:[e.jsx(ot,{size:14,className:"text-gray-600 group-hover:text-gray-400 transition-colors"}),e.jsx("span",{className:`text-[10px] font-medium text-gray-600 group-hover:text-gray-400 transition-colors
12
- [writing-mode:vertical-lr] tracking-wider select-none`,children:"OUTLINE"}),G>0&&e.jsx("span",{className:"text-[9px] text-gray-600 bg-surface-2 rounded-full px-1 min-w-[16px] text-center",children:G})]})})]})}function Bt({content:s}){const a=s.split(`
13
- `);return e.jsx("div",{className:"h-full overflow-auto p-4 font-mono text-sm",children:a.map((r,n)=>{const i=r.trimStart();let t="text-gray-300";return i.startsWith("Feature:")?t="text-brand-300 font-bold text-base":i.startsWith("Scenario:")||i.startsWith("Scenario Outline:")?t="text-amber-300 font-semibold mt-3":i.startsWith("Background:")?t="text-violet-300 font-semibold mt-3":/^(Given|When|Then|And|But)\b/.test(i)?t="text-emerald-300":i.startsWith("@")?t="text-sky-400 text-xs":i.startsWith("|")?t="text-cyan-300/80":i.startsWith("#")?t="text-gray-500 italic":i.startsWith("Examples:")&&(t="text-rose-300 font-medium mt-2"),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"w-10 text-right text-gray-600 pr-3 select-none flex-shrink-0 text-xs leading-6",children:n+1}),e.jsx("pre",{className:`${t} leading-6 whitespace-pre`,children:r})]},n)})})}function Ut({content:s,language:a}){const[r,n]=x.useState("table");return r==="raw"||a==="yaml"?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:r,onToggle:n}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono whitespace-pre",children:s})]}):a==="json"?e.jsx(qt,{content:s,mode:r,onToggle:n}):a==="csv"?e.jsx(Zt,{content:s,mode:r,onToggle:n}):e.jsx("pre",{className:"p-4 text-sm text-gray-300 font-mono overflow-auto h-full",children:s})}function Z({mode:s,onToggle:a}){return e.jsxs("div",{className:"flex gap-1 p-2 border-b border-white/5",children:[e.jsxs("button",{onClick:()=>a("table"),className:`flex items-center gap-1 px-2 py-1 rounded text-xs ${s==="table"?"bg-brand-500/20 text-brand-300":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(ct,{size:12})," Table"]}),e.jsxs("button",{onClick:()=>a("raw"),className:`flex items-center gap-1 px-2 py-1 rounded text-xs ${s==="raw"?"bg-brand-500/20 text-brand-300":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(ve,{size:12})," Raw"]})]})}function qt({content:s,mode:a,onToggle:r}){let n;try{n=JSON.parse(s)}catch{n=null}if(!n||!Array.isArray(n)||n.length===0)return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono whitespace-pre",children:JSON.stringify(n,null,2)})]});const i=Object.keys(n[0]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-2",children:e.jsx("tr",{children:i.map(t=>e.jsx("th",{className:"text-left px-3 py-2 text-gray-400 font-medium border-b border-white/5",children:t},t))})}),e.jsx("tbody",{children:n.map((t,c)=>e.jsx("tr",{className:"hover:bg-white/5",children:i.map(d=>e.jsx("td",{className:"px-3 py-1.5 text-gray-300 border-b border-white/3",children:String(t[d]??"")},d))},c))})]})}),e.jsxs("div",{className:"px-3 py-1.5 border-t border-white/5 text-[10px] text-gray-500",children:[n.length," rows, ",i.length," columns"]})]})}function Zt({content:s,mode:a,onToggle:r}){const n=s.trim().split(`
14
- `);if(n.length<2)return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono",children:s})]});const i=n[0].split(",").map(c=>c.trim()),t=n.slice(1).map(c=>c.split(",").map(d=>d.trim()));return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-2",children:e.jsx("tr",{children:i.map((c,d)=>e.jsx("th",{className:"text-left px-3 py-2 text-gray-400 font-medium border-b border-white/5",children:c},d))})}),e.jsx("tbody",{children:t.map((c,d)=>e.jsx("tr",{className:"hover:bg-white/5",children:c.map((p,u)=>e.jsx("td",{className:"px-3 py-1.5 text-gray-300 border-b border-white/3",children:p},u))},d))})]})}),e.jsxs("div",{className:"px-3 py-1.5 border-t border-white/5 text-[10px] text-gray-500",children:[t.length," rows, ",i.length," columns"]})]})}const Jt={GET:"text-emerald-400 bg-emerald-400/10",POST:"text-amber-400 bg-amber-400/10",PUT:"text-sky-400 bg-sky-400/10",PATCH:"text-violet-400 bg-violet-400/10",DELETE:"text-red-400 bg-red-400/10"};function Kt({metadata:s}){var r;const a=((r=s.metadata)==null?void 0:r.endpoints)??[];return a.length===0?e.jsx("div",{className:"p-6 text-center text-sm text-gray-500",children:"No API endpoints detected in this file."}):e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-200 mb-3",children:["Detected Endpoints (",a.length,")"]}),a.map((n,i)=>{const t=n.method.toUpperCase(),c=Jt[t]??"text-gray-400 bg-gray-400/10";return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-surface-2 border border-white/5",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold font-mono ${c}`,children:t}),e.jsx("span",{className:"text-sm text-gray-200 font-mono flex-1 truncate",children:n.url})]},i)})]})}function Qt({content:s,keywords:a}){const r=s.split(`
15
- `);return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 overflow-auto p-4 font-mono text-sm",children:r.map((n,i)=>{const t=n.trimStart();let c="text-gray-300";return t.startsWith("***")?c="text-brand-300 font-bold":t.startsWith("[")&&t.includes("]")?c="text-amber-300":t.startsWith("#")?c="text-gray-500 italic":t.startsWith("$")||t.startsWith("@")?c="text-sky-300":!n.startsWith(" ")&&!n.startsWith(" ")&&t.length>0&&!t.startsWith("*")&&(c="text-emerald-300 font-medium"),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"w-10 text-right text-gray-600 pr-3 select-none flex-shrink-0 text-xs leading-6",children:i+1}),e.jsx("pre",{className:`${c} leading-6 whitespace-pre`,children:n})]},i)})}),a&&a.length>0&&e.jsxs("div",{className:"w-48 border-l border-white/5 bg-surface-1 overflow-y-auto p-3 flex-shrink-0",children:[e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500 mb-2",children:"Keywords"}),a.map(n=>e.jsx("div",{className:"text-xs text-emerald-300 py-0.5 truncate",children:n},n))]})]})}function Xt({content:s,metadata:a,onChange:r,readOnly:n=!0}){const i=Ne(),[t,c]=x.useState("preview"),[d,p]=x.useState(!1);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("iframe",{srcDoc:Rt(s),title:"HTML Preview",className:"w-full h-full border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"}):e.jsx(we,{height:"100%",language:"html",value:s,onChange:r,theme:i.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}const je=[.25,.5,.75,1,1.5,2,3,4];function Yt({src:s,path:a}){const[r,n]=x.useState("fit"),[i,t]=x.useState(!1),[c,d]=x.useState(null),[p,u]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>{n("fit"),d(null),u(!1)},[s]);const g=z=>{n(v=>{const b=v==="fit"?1:v,j=je.findIndex(q=>q>=b-.001),y=Math.max(0,Math.min(je.length-1,(j===-1?3:j)+z));return je[y]})};return p?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-500",children:[e.jsx(xt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"Could not load this image"}),e.jsx("p",{className:"text-xs text-gray-600 font-mono",children:a})]}):e.jsxs("div",{className:`h-full flex flex-col ${i?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>n("fit"),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r==="fit"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Fit to window",children:"Fit"}),e.jsx("button",{onClick:()=>n(1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r===1?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Actual size (100%)",children:"1:1"}),e.jsx("div",{className:"w-px h-4 bg-white/10 mx-1"}),e.jsx("button",{onClick:()=>g(-1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom out",children:e.jsx(dt,{size:13})}),e.jsx("span",{className:"text-[11px] text-gray-500 w-11 text-center tabular-nums",children:r==="fit"?"fit":`${Math.round(r*100)}%`}),e.jsx("button",{onClick:()=>g(1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom in",children:e.jsx(ut,{size:13})}),e.jsx("div",{className:"flex-1"}),c&&e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums mr-1",children:[c.w," × ",c.h]}),e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:e.jsx(ye,{size:13})}),e.jsx("button",{onClick:()=>{o.current&&(o.current.src=s)},className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Reload",children:e.jsx(le,{size:13})}),e.jsx("button",{onClick:()=>t(!i),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:i?"Exit fullscreen":"Fullscreen",children:i?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-auto flex items-center justify-center p-4 scrollbar-thin",style:{backgroundImage:"linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%),linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:e.jsx("img",{ref:o,src:s,alt:a,onLoad:z=>{const v=z.currentTarget;d({w:v.naturalWidth,h:v.naturalHeight})},onError:()=>u(!0),className:r==="fit"?"max-w-full max-h-full object-contain":"shrink-0",style:r==="fit"?void 0:{width:`${c?c.w*r:0}px`,imageRendering:r>1?"pixelated":"auto"}})})]})}function Ht({src:s,path:a}){const[r,n]=x.useState(!1),[i,t]=x.useState(0);return x.useEffect(()=>{t(c=>c+1)},[s]),e.jsxs("div",{className:`h-full flex flex-col ${r?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"PDF"}),e.jsx("div",{className:"flex-1"}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:[e.jsx(ye,{size:12}),"Open"]}),e.jsx("button",{onClick:()=>n(!r),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:r?"Exit fullscreen":"Fullscreen",children:r?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-hidden bg-neutral-800",children:e.jsx("object",{data:s,type:"application/pdf",className:"w-full h-full",children:e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-400",children:[e.jsx(mt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"This browser can't display PDFs inline."}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-brand-500/15 text-brand-300 text-xs font-medium hover:bg-brand-500/25 transition-colors",children:[e.jsx(ye,{size:12}),"Open ",a.split("/").pop()," in a new tab"]})]})},i)})]})}function es({content:s,onChange:a,readOnly:r=!0,initialMode:n="preview"}){const i=Ne(),[t,c]=x.useState(n),[d,p]=x.useState(!1),u=x.useMemo(()=>Wt(s),[s]);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("div",{className:"h-full overflow-y-auto scrollbar-thin px-6 py-4",children:e.jsx("div",{className:"skill-markdown-preview max-w-3xl text-[13px] leading-relaxed text-gray-300",dangerouslySetInnerHTML:{__html:u}})}):e.jsx(we,{height:"100%",language:"markdown",value:s,onChange:a,theme:i.monacoTheme,options:{readOnly:r,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}function ts({commits:s,isLoading:a,filePath:r}){const[n,i]=x.useState(null);return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading history..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400",children:"No commit history found for this file."}):e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ht,{size:12,className:"text-sky-700 dark:text-sky-400"}),e.jsxs("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide",children:["File History (",s.length," commit",s.length!==1?"s":"",")"]})]}),e.jsx("div",{className:"space-y-0.5",children:s.map(t=>e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i(n===t.sha?null:t.sha),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded hover:bg-gray-100 dark:hover:bg-surface-2 transition-colors text-left",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-500 flex-shrink-0",children:n===t.sha?e.jsx(We,{size:10}):e.jsx(Oe,{size:10})}),e.jsx("span",{className:"font-mono text-sky-700 dark:text-sky-300 text-xs font-semibold w-14 flex-shrink-0",children:t.shortSha}),e.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-200 truncate flex-1",children:t.message}),e.jsxs("span",{className:"text-[11px] text-gray-700 dark:text-gray-400 flex-shrink-0 flex items-center gap-1",children:[e.jsx(ft,{size:9})," ",t.author]}),e.jsx("span",{className:"text-[11px] text-gray-600 dark:text-gray-500 flex-shrink-0",title:Ot(t.timestamp),children:rs(t.timestamp)})]}),n===t.sha&&e.jsx(ss,{sha:t.sha,filePath:r})]},t.sha))})]})}function ss({sha:s,filePath:a}){var c;const{data:r,isLoading:n}=Nt(s);if(n)return e.jsxs("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(le,{size:8,className:"animate-spin"})," Loading diff..."]});const i=a.replace(/\\/g,"/"),t=(c=r==null?void 0:r.files)==null?void 0:c.find(d=>{const p=d.path.replace(/\\/g,"/");return p===i||i.endsWith(`/${p}`)||p.endsWith(`/${i}`)});return t!=null&&t.patch?e.jsxs("div",{className:"ml-8 mr-2 mb-1 rounded border border-gray-300 dark:border-white/5 bg-gray-50 dark:bg-black/20 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 text-[11px] border-b border-gray-200 dark:border-white/5 bg-gray-100 dark:bg-transparent",children:[e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400 font-semibold",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-700 dark:text-red-400 font-semibold",children:["-",t.deletions]})]}),e.jsx("div",{className:"max-h-48 overflow-auto",children:e.jsx("pre",{className:"text-[11px] font-mono leading-[1.5] whitespace-pre",children:t.patch.split(`
16
- `).slice(0,100).map((d,p)=>{let u="",o="text-gray-800 dark:text-gray-300";return d.startsWith("+++")||d.startsWith("---")?(o="text-gray-700 dark:text-gray-400 font-bold",u="bg-gray-200/50 dark:bg-white/[0.02]"):d.startsWith("@@")?(o="text-sky-700 dark:text-sky-300 font-semibold",u="bg-sky-100 dark:bg-sky-500/10"):d.startsWith("+")?(o="text-emerald-800 dark:text-emerald-300",u="bg-emerald-100 dark:bg-emerald-500/10"):d.startsWith("-")&&(o="text-red-800 dark:text-red-300",u="bg-red-100 dark:bg-red-500/10"),e.jsx("div",{className:`px-2 ${u} ${o}`,children:d||" "},p)})})}),(t.patch.split(`
17
- `).length>100||t.truncated)&&e.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-600 dark:text-gray-400 border-t border-gray-200 dark:border-white/5",children:"Showing the first 100 lines — open the commit on the Git page for the full diff."})]}):e.jsx("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400",children:"No diff available for this file in this commit."})}function rs(s){try{const a=Date.now(),r=new Date(s).getTime(),n=a-r,i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const t=Math.floor(i/60);if(t<24)return`${t}h`;const c=Math.floor(t/24);if(c<30)return`${c}d`;const d=Math.floor(c/7);return c<90?`${d}w`:`${Math.floor(c/30)}mo`}catch{return""}}function as({files:s,isLoading:a}){return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-500 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading changes..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-500",children:"No uncommitted changes for this file."}):e.jsx("div",{className:"px-3 py-2",children:e.jsx(It,{files:s,showGroups:!0,defaultExpanded:!0})})}function ns(s,a){const r=s.split(`
18
- `);for(let t=0;t<r.length;t++)if(r[t].includes(a))return t+1;const n=a.replace(/[\\^$.*+?()[\]{}|]/g,"");if(n.length>5){for(let t=0;t<r.length;t++)if(r[t].includes(n))return t+1}const i=a.replace(/[^a-zA-Z0-9\s]/g,"").trim().split(/\s+/).filter(t=>t.length>2);if(i.length>=2){const t=i.slice(0,3).join(".*"),c=new RegExp(t,"i");for(let d=0;d<r.length;d++)if(c.test(r[d]))return d+1}return null}const ls=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","avif","svg"]);function is(s){var r;if(!s)return null;const a=((r=s.split(".").pop())==null?void 0:r.toLowerCase())??"";return ls.has(a)?"image":a==="pdf"?"pdf":null}function os(s){const a=s.split("/").map(encodeURIComponent).join("/"),r=Lt(),n=r?`?raw=1&token=${encodeURIComponent(r)}`:"?raw=1";return`/api/files/${a}${n}`}function ws({filePath:s,onRun:a,onActiveFileChange:r,initialHighlightLine:n,onHighlightConsumed:i}){var Se;const{toast:t}=kt(),c=zt(),d=Tt(),p=x.useRef(null),[u,o]=x.useState(null),[g,z]=x.useState("none"),[v,b]=x.useState(!1),j=x.useRef(null),y=x.useRef(null),[q,R]=x.useState(null),P=x.useRef(u);P.current=u;const G=u!==null&&u!==j.current;x.useEffect(()=>{if(s===null){y.current=null,o(null),j.current=null,R(null);return}const m=P.current,k=j.current;m!==null&&m!==k?R(s):(y.current=null,o(null),j.current=null,R(null))},[s]),x.useEffect(()=>{if(!G)return;const m=k=>(k.preventDefault(),k.returnValue="You have unsaved changes. Are you sure you want to leave?",k.returnValue);return window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[G]);const S=Ye(G),A=x.useRef(s),J=P.current!==null&&P.current!==j.current&&y.current!==null&&y.current!==s;q===null&&!J&&(A.current=s);const h=A.current;x.useEffect(()=>{r==null||r(h)},[h,r]);const V=is(h),{data:E,isLoading:K,error:f}=Mt({queryKey:["file",h],queryFn:()=>Ct(h),enabled:!!h&&!V}),w=x.useCallback((m,k)=>{m.revealLineInCenter(k),m.setPosition({lineNumber:k,column:1}),m.focus();const _=m.deltaDecorations([],[{range:{startLineNumber:k,startColumn:1,endLineNumber:k,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{m.deltaDecorations(_,[])},1500)},[]),$=x.useCallback(m=>{p.current=m,n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);x.useEffect(()=>{const m=p.current;m&&n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);const ie=x.useCallback(m=>{const k=p.current;if(!k||!E)return;const _=u??E.content,F=ns(_,m);F&&w(k,F)},[u,E,w]),{data:W}=St(),ke=(W==null?void 0:W.available)??!1,Ge=ke&&((Se=W==null?void 0:W.uncommittedChanges)==null?void 0:Se.some(m=>h&&(m.path===h||h.endsWith(m.path)||m.path.endsWith(h.replace(/\\/g,"/"))))),{data:oe,isLoading:Ae}=Et(g==="history"?h:null),{data:ce,isLoading:Ve}=Ft(g==="changes"?h:null,g==="changes"),_e=x.useCallback(()=>{E&&h&&(y.current=h,j.current=E.content,o(E.content))},[E,h]),Be=x.useCallback(()=>{y.current=null,o(null),j.current=null},[]),Ue=x.useCallback(async()=>{if(!(u===null||!h)){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved"),y.current=null,o(null),j.current=null}catch(m){t("error",`Save failed: ${m}`)}b(!1)}},[u,h,d,t]),qe=x.useCallback(()=>{y.current=null,o(null),j.current=null,A.current=s,R(null)},[s]),Ze=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,A.current=s,R(null)},[u,h,s,d,t]),ze=x.useCallback(()=>{R(null)},[]),Je=x.useCallback(()=>{y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S]),Ke=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S,u,h,d,t]),Ce=x.useCallback(()=>{S.state==="blocked"&&S.reset()},[S]);if(!h)return e.jsx(H,{title:"Select a file",description:"Choose a file from the tree to view its contents",icon:e.jsx(M,{size:28})});if(V){const m=os(h);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase",children:V==="pdf"?"pdf":"image"})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:V==="image"?e.jsx(Yt,{src:m,path:h}):e.jsx(Ht,{src:m,path:h})})]})}if(K)return e.jsx($t,{text:"Loading file..."});if(f||!E){const m=f==null?void 0:f.code;return m==="binary_file"?e.jsx(H,{title:"Binary file",description:`${h} can't be shown in the editor. Open it with an external application.`,icon:e.jsx(M,{size:28})}):m==="file_too_large"?e.jsx(H,{title:"File too large to preview",description:(f==null?void 0:f.message)||"This file exceeds the preview size limit.",icon:e.jsx(M,{size:28})}):e.jsx(H,{title:"Error loading file",description:String(f)})}const{content:Qe,metadata:C}=E,O=C.language,N=u!==null&&y.current===h,I=N?u:Qe,Xe=()=>{var m,k,_;return O==="html"?e.jsx(Xt,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0}):O==="markdown"?e.jsx(es,{content:I,readOnly:!N,onChange:N?F=>o(F??null):void 0,initialMode:N?"code":"preview"}):O==="gherkin"&&!N?e.jsx(Bt,{content:I}):O==="robot"&&!N?e.jsx(Qt,{content:I,keywords:(m=C.metadata)==null?void 0:m.keywords}):(O==="csv"||O==="json"&&C.type==="data"||O==="yaml")&&!N?e.jsx(Ut,{content:I,language:O}):(k=C.metadata)!=null&&k.endpoints&&C.metadata.endpoints.length>0?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Kt,{content:I,metadata:C}),e.jsx("div",{className:"flex-1 border-t border-white/5",children:e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})})]}):(_=C.metadata)!=null&&_.steps&&C.metadata.steps.length>0?e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$,steps:C.metadata.steps,onStepClick:ie}):e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),N&&e.jsx("span",{className:"text-[9px] font-medium text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:G?"MODIFIED":"EDITING"}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[C.lines," lines"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:O}),ke&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(g==="history"?"none":"history"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="history"?"bg-sky-600/20 text-sky-300 border-sky-500/30":"bg-surface-2 hover:bg-surface-3 text-gray-400 border-white/5"}`,title:"View git history for this file",children:[e.jsx(pt,{size:12})," History"]}),Ge&&e.jsxs("button",{onClick:()=>z(g==="changes"?"none":"changes"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="changes"?"bg-amber-600/20 text-amber-300 border-amber-500/30":"bg-surface-2 hover:bg-surface-3 text-amber-400 border-white/5"}`,title:"View uncommitted changes for this file",children:[e.jsx(gt,{size:12})," Changes"]})]}),N?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Be,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-400 border border-white/5 flex items-center gap-1",title:"Discard changes",children:[e.jsx(me,{size:12})," Cancel"]}),e.jsxs("button",{onClick:Ue,disabled:v,className:"px-2 py-1 text-xs rounded bg-brand-600 hover:bg-brand-500 text-white flex items-center gap-1 disabled:opacity-50",children:[e.jsx(he,{size:12})," ",v?"Saving...":"Save"]})]}):e.jsx("button",{onClick:_e,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-300 border border-white/5",children:"Edit"}),C.type==="test"&&a&&e.jsxs("button",{onClick:()=>c(()=>a(h),{files:[h]}),className:"px-2 py-1 text-xs rounded bg-emerald-600 hover:bg-emerald-500 text-white flex items-center gap-1",children:[e.jsx(bt,{size:12})," Run"]})]}),e.jsx(vt,{filePath:h}),g!=="none"&&e.jsxs("div",{className:"border-b border-white/5 bg-surface-1/80 max-h-[40vh] overflow-y-auto flex-shrink-0",children:[g==="history"&&e.jsx(ts,{commits:(oe==null?void 0:oe.commits)||[],isLoading:Ae,filePath:h}),g==="changes"&&e.jsx(as,{files:(ce==null?void 0:ce.files)||[],isLoading:Ve})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:Xe()}),q!==null&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:ze}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:ze,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes in the current file. What would you like to do?"})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:qe,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard Changes"}),e.jsxs("button",{onClick:Ze,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Switch"]})]})]})]}),S.state==="blocked"&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:Ce}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:Ce,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes. If you leave this page, your changes will be lost."})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:Je,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard & Leave"}),e.jsxs("button",{onClick:Ke,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Leave"]})]})]})]})]})}export{Gt as F,ws as a,vs as u};
1
+ import{r as x,j as e,p as Ye}from"./vendor-react-DOVfxdUy.js";import{k as T,j as M,c as D,aA as se,aB as Ee,aC as U,aD as xe,aE as Q,aF as _,a2 as X,V as Fe,aG as Y,O as de,aH as re,aI as He,aJ as L,aK as et,aL as ue,aM as tt,z as We,u as Oe,F as st,aN as rt,aO as at,aP as nt,aQ as lt,T as it,aR as ot,aS as ct,aT as ve,ab as Ie,aU as ae,aV as ne,aW as xt,aX as dt,aY as ut,$ as ye,R as le,aZ as mt,a_ as ht,r as ft,a$ as pt,b0 as gt,X as me,b1 as he,a3 as bt,p as $e}from"./vendor-icons-Cm92aSc5.js";import{u as jt,I as yt,R as Le,a as vt}from"./RemoteFileStrip-dzPInzgb.js";import{h as wt,u as Nt,b as kt,c as zt,r as Ct,d as St,e as Et,f as Ft,i as fe,L as $t,j as Lt}from"./index-BlA8ntjb.js";import{a as Tt,u as Mt}from"./vendor-query-DkZSMtfn.js";import{F as we}from"./index-DLmlY2Ol.js";import{u as Ne}from"./useChartTheme-CTIe6M63.js";import{w as Rt}from"./sandboxStorage-BrzaG3ny.js";import{r as Wt}from"./simpleMarkdown-kWs-10D8.js";import{E as H}from"./EmptyState-BShNSbLf.js";import{f as Ot}from"./formatDate-T65-Y6Mi.js";import{U as It}from"./UncommittedDiffViewer-BNroxCoo.js";const Dt=2e3;function vs(s){const a=x.useRef(s);a.current=s;const r=x.useCallback(p=>{const u=a.current;if(u)try{p.size===0?localStorage.removeItem(u):p.size<=Dt&&localStorage.setItem(u,JSON.stringify([...p]))}catch{}},[]),[n,i]=x.useState(()=>{if(!s)return new Set;try{const p=localStorage.getItem(s);if(!p)return new Set;const u=JSON.parse(p);return Array.isArray(u)?new Set(u.filter(o=>typeof o=="string")):new Set}catch{return new Set}}),t=x.useCallback(p=>{i(u=>{const o=new Set(u);return o.has(p)?o.delete(p):o.add(p),r(o),o})},[r]),c=x.useCallback(p=>{const u=new Set(p);r(u),i(u)},[r]),d=x.useCallback(()=>{const p=new Set;r(p),i(p)},[r]);return{expanded:n,toggle:t,expandAll:c,collapseAll:d}}const l=14,ee={".ts":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".tsx":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".d.ts":{icon:e.jsx(L,{size:l}),color:"text-blue-300"},".js":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".jsx":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".mjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".cjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".py":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".pyw":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".java":{icon:e.jsx(ue,{size:l}),color:"text-orange-400"},".kt":{icon:e.jsx(ue,{size:l}),color:"text-purple-400"},".scala":{icon:e.jsx(ue,{size:l}),color:"text-red-400"},".cs":{icon:e.jsx(et,{size:l}),color:"text-green-400"},".csproj":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".sln":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".rb":{icon:e.jsx(L,{size:l}),color:"text-red-400"},".feature":{icon:e.jsx(He,{size:l}),color:"text-emerald-400"},".robot":{icon:e.jsx(D,{size:l}),color:"text-teal-400"},".json":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".jsonc":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".yaml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".yml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".toml":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".html":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".htm":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".xml":{icon:e.jsx(de,{size:l}),color:"text-orange-300"},".css":{icon:e.jsx(Y,{size:l}),color:"text-blue-400"},".scss":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".sass":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".less":{icon:e.jsx(Y,{size:l}),color:"text-indigo-400"},".md":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".mdx":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".txt":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".rst":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".csv":{icon:e.jsx(X,{size:l}),color:"text-green-300"},".sql":{icon:e.jsx(X,{size:l}),color:"text-blue-300"},".db":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".sqlite":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".png":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".jpg":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".jpeg":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".gif":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".svg":{icon:e.jsx(_,{size:l}),color:"text-amber-300"},".webp":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".ico":{icon:e.jsx(_,{size:l}),color:"text-pink-300"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".ini":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".conf":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".cfg":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".properties":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".sh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bash":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".zsh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bat":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".cmd":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".ps1":{icon:e.jsx(D,{size:l}),color:"text-blue-300"},".zip":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".tar":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".gz":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".pem":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".key":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".cert":{icon:e.jsx(xe,{size:l}),color:"text-red-300"}},Te={"package.json":{icon:e.jsx(U,{size:l}),color:"text-green-400"},"package-lock.json":{icon:e.jsx(U,{size:l}),color:"text-green-300"},"pnpm-lock.yaml":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},"yarn.lock":{icon:e.jsx(U,{size:l}),color:"text-blue-300"},"tsconfig.json":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},"vite.config.ts":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},"webpack.config.js":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},".gitignore":{icon:e.jsx(T,{size:l}),color:"text-gray-500"},".eslintrc.json":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},".prettierrc":{icon:e.jsx(T,{size:l}),color:"text-pink-300"},Dockerfile:{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},"docker-compose.yml":{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.local":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.example":{icon:e.jsx(se,{size:l}),color:"text-yellow-400"},Makefile:{icon:e.jsx(D,{size:l}),color:"text-amber-400"},Gemfile:{icon:e.jsx(M,{size:l}),color:"text-red-400"},"requirements.txt":{icon:e.jsx(M,{size:l}),color:"text-sky-400"},"pom.xml":{icon:e.jsx(T,{size:l}),color:"text-orange-400"},"build.gradle":{icon:e.jsx(T,{size:l}),color:"text-green-400"}},pe={icon:e.jsx(tt,{size:l}),color:"text-gray-500"};function Pt(s){const a=s.toLowerCase();if(Te[a])return Te[a];if(a.startsWith(".env"))return ee[".env"]??pe;if(a.endsWith(".d.ts"))return ee[".d.ts"]??pe;const r=a.lastIndexOf(".");if(r>=0){const n=a.substring(r);if(ee[n])return ee[n]}return pe}const Me=new WeakMap,Re=new WeakMap;function De(s){if(s.type==="file")return 1;if(!s.children)return 0;const a=Me.get(s);if(a!==void 0)return a;const r=s.children.reduce((n,i)=>n+De(i),0);return Me.set(s,r),r}function Pe(s,a){let r=Re.get(s);const n=r==null?void 0:r.get(a);if(n!==void 0)return n;const i=a.toLowerCase();let t=s.name.toLowerCase().includes(i);return!t&&s.type==="directory"&&s.children&&(t=s.children.some(c=>Pe(c,a))),r||(r=new Map,Re.set(s,r)),r.size>8&&r.clear(),r.set(a,t),t}function Gt({nodes:s,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t=0,filter:c}){const d=x.useMemo(()=>{let o=[...s];return c&&c.trim()&&(o=o.filter(g=>Pe(g,c.trim()))),o.sort((g,z)=>g.type!==z.type?g.type==="directory"?-1:1:g.name.localeCompare(z.name))},[s,c]),{check:p,byPath:u}=jt();return d.length===0?null:e.jsx("div",{className:"relative",children:d.map(o=>{const g=a.has(o.path),z=r===o.path,v=o.type==="directory"?De(o):0,b=o.type==="file"?Pt(o.name):null;return e.jsxs("div",{className:"relative",children:[t>0&&e.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none","aria-hidden":"true",children:Array.from({length:t},(j,y)=>e.jsx("div",{className:"absolute top-0 bottom-0 border-l border-white/[0.06]",style:{left:`${y*16+16}px`}},y))}),e.jsxs("button",{className:`
2
+ group w-full flex items-center gap-1.5 py-[3px] text-[13px] text-left
3
+ transition-colors duration-75 relative
4
+ ${z?"bg-brand-500/12 text-gray-100 before:absolute before:inset-y-0 before:left-0 before:w-[2px] before:bg-brand-400":"text-gray-400 hover:text-gray-200 hover:bg-white/[0.04]"}
5
+ `,style:{paddingLeft:`${t*16+8}px`,paddingRight:"8px"},onClick:()=>{o.type==="directory"?n(o.path):i(o.path)},title:o.path,children:[o.type==="directory"?e.jsx("span",{className:"flex-shrink-0 w-4 h-4 flex items-center justify-center transition-transform duration-100 text-gray-500",children:g?e.jsx(We,{size:14}):e.jsx(Oe,{size:14})}):e.jsx("span",{className:"w-4 flex-shrink-0"}),o.type==="directory"?e.jsx("span",{className:"text-amber-400/80 flex-shrink-0",children:g?e.jsx(st,{size:15}):e.jsx(rt,{size:15})}):e.jsx("span",{className:`flex-shrink-0 ${(b==null?void 0:b.color)??"text-gray-500"}`,children:b==null?void 0:b.icon}),e.jsx("span",{className:`truncate flex-1 ${z?"font-medium":""}`,children:o.name}),o.type==="directory"&&o.truncated&&e.jsx("span",{className:"text-[10px] text-amber-500/70 flex-shrink-0 ml-1",title:"Too many files — this folder's listing was cut short",children:"…"}),o.type==="directory"&&v>0&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:v}),o.type==="file"&&u.size>0&&e.jsx(yt,{path:o.path,byPath:u,label:wt(p)}),o.type==="file"&&o.language&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:o.language})]}),o.type==="directory"&&g&&o.children&&e.jsx(Gt,{nodes:o.children,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t+1,filter:c})]},o.path)})})}const ge="testver_outline_visible",Vt={typescript:"typescript",javascript:"javascript",python:"python",java:"java",csharp:"csharp",ruby:"ruby",gherkin:"plaintext",robot:"plaintext",json:"json",yaml:"yaml",xml:"xml",html:"html",css:"css",markdown:"markdown",shell:"shell",sql:"sql"};function At(s,a,r){const n=s.split(`
6
+ `);for(let i=0;i<n.length;i++){const t=n[i];if(r==="class"&&new RegExp(`\\bclass\\s+${te(a)}\\b`).test(t)||r==="method"&&[new RegExp(`\\b${te(a)}\\s*\\(`),new RegExp(`\\bdef\\s+${te(a)}\\b`),new RegExp(`\\bfunction\\s+${te(a)}\\s*\\(`)].some(d=>d.test(t)))return i+1}for(let i=0;i<n.length;i++)if(n[i].includes(a))return i+1;return null}function te(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Bt={Given:"text-sky-300",When:"text-amber-300",Then:"text-emerald-300",And:"text-gray-300",But:"text-rose-300"};function be({content:s,metadata:a,onChange:r,readOnly:n=!0,onEditorReady:i,steps:t,onStepClick:c}){var S,V,J,h,A,E,K;const d=Ne(),p=Vt[a.language]??"plaintext",u=x.useRef(null),o=((V=(S=a.metadata)==null?void 0:S.classes)==null?void 0:V.length)??0,g=((h=(J=a.metadata)==null?void 0:J.methods)==null?void 0:h.length)??0,z=((A=a.metadata)==null?void 0:A.testCount)??0,v=(t==null?void 0:t.length)??0,b=!!(o||g||v),[j,y]=x.useState(()=>{if(!b)return!1;try{const f=localStorage.getItem(ge);return f===null?!0:f==="1"}catch{return!0}});x.useEffect(()=>{if(b&&j===!1)try{const f=localStorage.getItem(ge);(f===null||f==="1")&&y(!0)}catch{}},[b]),x.useEffect(()=>{if(b)try{localStorage.setItem(ge,j?"1":"0")}catch{}},[j,b]);const q=x.useCallback(f=>{u.current=f,i==null||i(f)},[i]),R=x.useCallback(f=>{const w=u.current;if(!w)return;w.revealLineInCenter(f),w.setPosition({lineNumber:f,column:1}),w.focus();const $=w.deltaDecorations([],[{range:{startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{w.deltaDecorations($,[])},1500)},[]),P=x.useCallback((f,w)=>{const $=At(s,f,w);$&&R($)},[s,R]),G=o+g+v;return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(we,{height:"100%",language:p,value:s,onChange:r,onMount:q,theme:d.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})}),b&&e.jsx(e.Fragment,{children:j?e.jsxs("div",{className:`w-52 border-l border-white/5 bg-surface-1 flex flex-col flex-shrink-0
7
+ animate-[slideInRight_150ms_ease-out]`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-white/5 flex-shrink-0",children:[e.jsx(re,{size:12,className:"text-gray-500"}),e.jsx("span",{className:"text-[10px] uppercase font-semibold text-gray-500 flex-1 tracking-wider",children:"Outline"}),e.jsx("button",{onClick:()=>y(!1),className:"p-0.5 rounded hover:bg-white/5 text-gray-500 hover:text-gray-300 transition-colors",title:"Hide outline panel",children:e.jsx(at,{size:14})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 pt-2",children:[((E=a.metadata)==null?void 0:E.classes)&&o>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(nt,{size:11,className:"text-brand-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Classes"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:o})]}),a.metadata.classes.map(f=>e.jsx("button",{onClick:()=>P(f,"class"),className:`block w-full text-left text-xs text-brand-300 py-1 px-1.5 -mx-1.5 rounded
8
+ hover:bg-brand-500/10 hover:text-brand-200 transition-colors truncate cursor-pointer`,title:`Go to class ${f}`,children:f},f))]}),((K=a.metadata)==null?void 0:K.methods)&&g>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(re,{size:11,className:"text-amber-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Methods"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:g})]}),a.metadata.methods.map(f=>e.jsxs("button",{onClick:()=>P(f,"method"),className:`block w-full text-left text-xs text-gray-300 py-1 px-1.5 -mx-1.5 rounded font-mono
9
+ hover:bg-white/5 hover:text-gray-100 transition-colors truncate cursor-pointer`,title:`Go to ${f}()`,children:[f,"()"]},f))]}),t&&v>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(lt,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Steps"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:v})]}),t.map((f,w)=>{var W;const $=(W=f.match(/^(Given|When|Then|And|But)/))==null?void 0:W[1],ie=Bt[$??""]??"text-gray-300";return e.jsx("button",{onClick:()=>c==null?void 0:c(f),className:`block w-full text-left text-xs py-1 px-1.5 -mx-1.5 rounded truncate
10
+ transition-colors cursor-pointer ${ie} hover:bg-white/5 hover:brightness-125`,title:`Go to: ${f}`,children:f},w)})]}),z>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(it,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Tests"})]}),e.jsxs("div",{className:"text-xs text-emerald-300 px-1.5",children:[z," test(s)"]})]})]})]}):e.jsxs("button",{onClick:()=>y(!0),className:`w-7 border-l border-white/5 bg-surface-1 flex flex-col items-center justify-center
11
+ gap-2 flex-shrink-0 hover:bg-white/[0.03] transition-colors group cursor-pointer`,title:"Show outline panel",children:[e.jsx(ot,{size:14,className:"text-gray-600 group-hover:text-gray-400 transition-colors"}),e.jsx("span",{className:`text-[10px] font-medium text-gray-600 group-hover:text-gray-400 transition-colors
12
+ [writing-mode:vertical-lr] tracking-wider select-none`,children:"OUTLINE"}),G>0&&e.jsx("span",{className:"text-[9px] text-gray-600 bg-surface-2 rounded-full px-1 min-w-[16px] text-center",children:G})]})})]})}function _t({content:s}){const a=s.split(`
13
+ `);return e.jsx("div",{className:"h-full overflow-auto p-4 font-mono text-sm",children:a.map((r,n)=>{const i=r.trimStart();let t="text-gray-300";return i.startsWith("Feature:")?t="text-brand-300 font-bold text-base":i.startsWith("Scenario:")||i.startsWith("Scenario Outline:")?t="text-amber-300 font-semibold mt-3":i.startsWith("Background:")?t="text-violet-300 font-semibold mt-3":/^(Given|When|Then|And|But)\b/.test(i)?t="text-emerald-300":i.startsWith("@")?t="text-sky-400 text-xs":i.startsWith("|")?t="text-cyan-300/80":i.startsWith("#")?t="text-gray-500 italic":i.startsWith("Examples:")&&(t="text-rose-300 font-medium mt-2"),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"w-10 text-right text-gray-600 pr-3 select-none flex-shrink-0 text-xs leading-6",children:n+1}),e.jsx("pre",{className:`${t} leading-6 whitespace-pre`,children:r})]},n)})})}function Ut({content:s,language:a}){const[r,n]=x.useState("table");return r==="raw"||a==="yaml"?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:r,onToggle:n}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono whitespace-pre",children:s})]}):a==="json"?e.jsx(qt,{content:s,mode:r,onToggle:n}):a==="csv"?e.jsx(Zt,{content:s,mode:r,onToggle:n}):e.jsx("pre",{className:"p-4 text-sm text-gray-300 font-mono overflow-auto h-full",children:s})}function Z({mode:s,onToggle:a}){return e.jsxs("div",{className:"flex gap-1 p-2 border-b border-white/5",children:[e.jsxs("button",{onClick:()=>a("table"),className:`flex items-center gap-1 px-2 py-1 rounded text-xs ${s==="table"?"bg-brand-500/20 text-brand-300":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(ct,{size:12})," Table"]}),e.jsxs("button",{onClick:()=>a("raw"),className:`flex items-center gap-1 px-2 py-1 rounded text-xs ${s==="raw"?"bg-brand-500/20 text-brand-300":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(ve,{size:12})," Raw"]})]})}function qt({content:s,mode:a,onToggle:r}){let n;try{n=JSON.parse(s)}catch{n=null}if(!n||!Array.isArray(n)||n.length===0)return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono whitespace-pre",children:JSON.stringify(n,null,2)})]});const i=Object.keys(n[0]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-2",children:e.jsx("tr",{children:i.map(t=>e.jsx("th",{className:"text-left px-3 py-2 text-gray-400 font-medium border-b border-white/5",children:t},t))})}),e.jsx("tbody",{children:n.map((t,c)=>e.jsx("tr",{className:"hover:bg-white/5",children:i.map(d=>e.jsx("td",{className:"px-3 py-1.5 text-gray-300 border-b border-white/3",children:String(t[d]??"")},d))},c))})]})}),e.jsxs("div",{className:"px-3 py-1.5 border-t border-white/5 text-[10px] text-gray-500",children:[n.length," rows, ",i.length," columns"]})]})}function Zt({content:s,mode:a,onToggle:r}){const n=s.trim().split(`
14
+ `);if(n.length<2)return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("pre",{className:"flex-1 overflow-auto p-4 text-sm text-gray-300 font-mono",children:s})]});const i=n[0].split(",").map(c=>c.trim()),t=n.slice(1).map(c=>c.split(",").map(d=>d.trim()));return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Z,{mode:a,onToggle:r}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"sticky top-0 bg-surface-2",children:e.jsx("tr",{children:i.map((c,d)=>e.jsx("th",{className:"text-left px-3 py-2 text-gray-400 font-medium border-b border-white/5",children:c},d))})}),e.jsx("tbody",{children:t.map((c,d)=>e.jsx("tr",{className:"hover:bg-white/5",children:c.map((p,u)=>e.jsx("td",{className:"px-3 py-1.5 text-gray-300 border-b border-white/3",children:p},u))},d))})]})}),e.jsxs("div",{className:"px-3 py-1.5 border-t border-white/5 text-[10px] text-gray-500",children:[t.length," rows, ",i.length," columns"]})]})}const Jt={GET:"text-emerald-400 bg-emerald-400/10",POST:"text-amber-400 bg-amber-400/10",PUT:"text-sky-400 bg-sky-400/10",PATCH:"text-violet-400 bg-violet-400/10",DELETE:"text-red-400 bg-red-400/10"};function Kt({metadata:s}){var r;const a=((r=s.metadata)==null?void 0:r.endpoints)??[];return a.length===0?e.jsx("div",{className:"p-6 text-center text-sm text-gray-500",children:"No API endpoints detected in this file."}):e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-200 mb-3",children:["Detected Endpoints (",a.length,")"]}),a.map((n,i)=>{const t=n.method.toUpperCase(),c=Jt[t]??"text-gray-400 bg-gray-400/10";return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-surface-2 border border-white/5",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold font-mono ${c}`,children:t}),e.jsx("span",{className:"text-sm text-gray-200 font-mono flex-1 truncate",children:n.url})]},i)})]})}function Qt({content:s,keywords:a}){const r=s.split(`
15
+ `);return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 overflow-auto p-4 font-mono text-sm",children:r.map((n,i)=>{const t=n.trimStart();let c="text-gray-300";return t.startsWith("***")?c="text-brand-300 font-bold":t.startsWith("[")&&t.includes("]")?c="text-amber-300":t.startsWith("#")?c="text-gray-500 italic":t.startsWith("$")||t.startsWith("@")?c="text-sky-300":!n.startsWith(" ")&&!n.startsWith(" ")&&t.length>0&&!t.startsWith("*")&&(c="text-emerald-300 font-medium"),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"w-10 text-right text-gray-600 pr-3 select-none flex-shrink-0 text-xs leading-6",children:i+1}),e.jsx("pre",{className:`${c} leading-6 whitespace-pre`,children:n})]},i)})}),a&&a.length>0&&e.jsxs("div",{className:"w-48 border-l border-white/5 bg-surface-1 overflow-y-auto p-3 flex-shrink-0",children:[e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500 mb-2",children:"Keywords"}),a.map(n=>e.jsx("div",{className:"text-xs text-emerald-300 py-0.5 truncate",children:n},n))]})]})}function Xt({content:s,metadata:a,onChange:r,readOnly:n=!0}){const i=Ne(),[t,c]=x.useState("preview"),[d,p]=x.useState(!1);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("iframe",{srcDoc:Rt(s),title:"HTML Preview",className:"w-full h-full border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"}):e.jsx(we,{height:"100%",language:"html",value:s,onChange:r,theme:i.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}const je=[.25,.5,.75,1,1.5,2,3,4];function Yt({src:s,path:a}){const[r,n]=x.useState("fit"),[i,t]=x.useState(!1),[c,d]=x.useState(null),[p,u]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>{n("fit"),d(null),u(!1)},[s]);const g=z=>{n(v=>{const b=v==="fit"?1:v,j=je.findIndex(q=>q>=b-.001),y=Math.max(0,Math.min(je.length-1,(j===-1?3:j)+z));return je[y]})};return p?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-500",children:[e.jsx(xt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"Could not load this image"}),e.jsx("p",{className:"text-xs text-gray-600 font-mono",children:a})]}):e.jsxs("div",{className:`h-full flex flex-col ${i?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>n("fit"),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r==="fit"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Fit to window",children:"Fit"}),e.jsx("button",{onClick:()=>n(1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r===1?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Actual size (100%)",children:"1:1"}),e.jsx("div",{className:"w-px h-4 bg-white/10 mx-1"}),e.jsx("button",{onClick:()=>g(-1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom out",children:e.jsx(dt,{size:13})}),e.jsx("span",{className:"text-[11px] text-gray-500 w-11 text-center tabular-nums",children:r==="fit"?"fit":`${Math.round(r*100)}%`}),e.jsx("button",{onClick:()=>g(1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom in",children:e.jsx(ut,{size:13})}),e.jsx("div",{className:"flex-1"}),c&&e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums mr-1",children:[c.w," × ",c.h]}),e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:e.jsx(ye,{size:13})}),e.jsx("button",{onClick:()=>{o.current&&(o.current.src=s)},className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Reload",children:e.jsx(le,{size:13})}),e.jsx("button",{onClick:()=>t(!i),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:i?"Exit fullscreen":"Fullscreen",children:i?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-auto flex items-center justify-center p-4 scrollbar-thin",style:{backgroundImage:"linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%),linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:e.jsx("img",{ref:o,src:s,alt:a,onLoad:z=>{const v=z.currentTarget;d({w:v.naturalWidth,h:v.naturalHeight})},onError:()=>u(!0),className:r==="fit"?"max-w-full max-h-full object-contain":"shrink-0",style:r==="fit"?void 0:{width:`${c?c.w*r:0}px`,imageRendering:r>1?"pixelated":"auto"}})})]})}function Ht({src:s,path:a}){const[r,n]=x.useState(!1),[i,t]=x.useState(0);return x.useEffect(()=>{t(c=>c+1)},[s]),e.jsxs("div",{className:`h-full flex flex-col ${r?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"PDF"}),e.jsx("div",{className:"flex-1"}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:[e.jsx(ye,{size:12}),"Open"]}),e.jsx("button",{onClick:()=>n(!r),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:r?"Exit fullscreen":"Fullscreen",children:r?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-hidden bg-neutral-800",children:e.jsx("object",{data:s,type:"application/pdf",className:"w-full h-full",children:e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-400",children:[e.jsx(mt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"This browser can't display PDFs inline."}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-brand-500/15 text-brand-300 text-xs font-medium hover:bg-brand-500/25 transition-colors",children:[e.jsx(ye,{size:12}),"Open ",a.split("/").pop()," in a new tab"]})]})},i)})]})}function es({content:s,onChange:a,readOnly:r=!0,initialMode:n="preview"}){const i=Ne(),[t,c]=x.useState(n),[d,p]=x.useState(!1),u=x.useMemo(()=>Wt(s),[s]);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("div",{className:"h-full overflow-y-auto scrollbar-thin px-6 py-4",children:e.jsx("div",{className:"skill-markdown-preview max-w-3xl text-[13px] leading-relaxed text-gray-300",dangerouslySetInnerHTML:{__html:u}})}):e.jsx(we,{height:"100%",language:"markdown",value:s,onChange:a,theme:i.monacoTheme,options:{readOnly:r,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}function ts({commits:s,isLoading:a,filePath:r}){const[n,i]=x.useState(null);return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading history..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400",children:"No commit history found for this file."}):e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ht,{size:12,className:"text-sky-700 dark:text-sky-400"}),e.jsxs("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide",children:["File History (",s.length," commit",s.length!==1?"s":"",")"]})]}),e.jsx("div",{className:"space-y-0.5",children:s.map(t=>e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i(n===t.sha?null:t.sha),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded hover:bg-gray-100 dark:hover:bg-surface-2 transition-colors text-left",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-500 flex-shrink-0",children:n===t.sha?e.jsx(We,{size:10}):e.jsx(Oe,{size:10})}),e.jsx("span",{className:"font-mono text-sky-700 dark:text-sky-300 text-xs font-semibold w-14 flex-shrink-0",children:t.shortSha}),e.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-200 truncate flex-1",children:t.message}),e.jsxs("span",{className:"text-[11px] text-gray-700 dark:text-gray-400 flex-shrink-0 flex items-center gap-1",children:[e.jsx(ft,{size:9})," ",t.author]}),e.jsx("span",{className:"text-[11px] text-gray-600 dark:text-gray-500 flex-shrink-0",title:Ot(t.timestamp),children:rs(t.timestamp)})]}),n===t.sha&&e.jsx(ss,{sha:t.sha,filePath:r})]},t.sha))})]})}function ss({sha:s,filePath:a}){var c;const{data:r,isLoading:n}=Nt(s);if(n)return e.jsxs("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(le,{size:8,className:"animate-spin"})," Loading diff..."]});const i=a.replace(/\\/g,"/"),t=(c=r==null?void 0:r.files)==null?void 0:c.find(d=>{const p=d.path.replace(/\\/g,"/");return p===i||i.endsWith(`/${p}`)||p.endsWith(`/${i}`)});return t!=null&&t.patch?e.jsxs("div",{className:"ml-8 mr-2 mb-1 rounded border border-gray-300 dark:border-white/5 bg-gray-50 dark:bg-black/20 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 text-[11px] border-b border-gray-200 dark:border-white/5 bg-gray-100 dark:bg-transparent",children:[e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400 font-semibold",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-700 dark:text-red-400 font-semibold",children:["-",t.deletions]})]}),e.jsx("div",{className:"max-h-48 overflow-auto",children:e.jsx("pre",{className:"text-[11px] font-mono leading-[1.5] whitespace-pre",children:t.patch.split(`
16
+ `).slice(0,100).map((d,p)=>{let u="",o="text-gray-800 dark:text-gray-300";return d.startsWith("+++")||d.startsWith("---")?(o="text-gray-700 dark:text-gray-400 font-bold",u="bg-gray-200/50 dark:bg-white/[0.02]"):d.startsWith("@@")?(o="text-sky-700 dark:text-sky-300 font-semibold",u="bg-sky-100 dark:bg-sky-500/10"):d.startsWith("+")?(o="text-emerald-800 dark:text-emerald-300",u="bg-emerald-100 dark:bg-emerald-500/10"):d.startsWith("-")&&(o="text-red-800 dark:text-red-300",u="bg-red-100 dark:bg-red-500/10"),e.jsx("div",{className:`px-2 ${u} ${o}`,children:d||" "},p)})})}),(t.patch.split(`
17
+ `).length>100||t.truncated)&&e.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-600 dark:text-gray-400 border-t border-gray-200 dark:border-white/5",children:"Showing the first 100 lines — open the commit on the Git page for the full diff."})]}):e.jsx("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400",children:"No diff available for this file in this commit."})}function rs(s){try{const a=Date.now(),r=new Date(s).getTime(),n=a-r,i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const t=Math.floor(i/60);if(t<24)return`${t}h`;const c=Math.floor(t/24);if(c<30)return`${c}d`;const d=Math.floor(c/7);return c<90?`${d}w`:`${Math.floor(c/30)}mo`}catch{return""}}function as({files:s,isLoading:a}){return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-500 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading changes..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-500",children:"No uncommitted changes for this file."}):e.jsx("div",{className:"px-3 py-2",children:e.jsx(It,{files:s,showGroups:!0,defaultExpanded:!0})})}function ns(s,a){const r=s.split(`
18
+ `);for(let t=0;t<r.length;t++)if(r[t].includes(a))return t+1;const n=a.replace(/[\\^$.*+?()[\]{}|]/g,"");if(n.length>5){for(let t=0;t<r.length;t++)if(r[t].includes(n))return t+1}const i=a.replace(/[^a-zA-Z0-9\s]/g,"").trim().split(/\s+/).filter(t=>t.length>2);if(i.length>=2){const t=i.slice(0,3).join(".*"),c=new RegExp(t,"i");for(let d=0;d<r.length;d++)if(c.test(r[d]))return d+1}return null}const ls=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","avif","svg"]);function is(s){var r;if(!s)return null;const a=((r=s.split(".").pop())==null?void 0:r.toLowerCase())??"";return ls.has(a)?"image":a==="pdf"?"pdf":null}function os(s){const a=s.split("/").map(encodeURIComponent).join("/"),r=Lt(),n=r?`?raw=1&token=${encodeURIComponent(r)}`:"?raw=1";return`/api/files/${a}${n}`}function ws({filePath:s,onRun:a,onActiveFileChange:r,initialHighlightLine:n,onHighlightConsumed:i}){var Se;const{toast:t}=kt(),c=zt(),d=Tt(),p=x.useRef(null),[u,o]=x.useState(null),[g,z]=x.useState("none"),[v,b]=x.useState(!1),j=x.useRef(null),y=x.useRef(null),[q,R]=x.useState(null),P=x.useRef(u);P.current=u;const G=u!==null&&u!==j.current;x.useEffect(()=>{if(s===null){y.current=null,o(null),j.current=null,R(null);return}const m=P.current,k=j.current;m!==null&&m!==k?R(s):(y.current=null,o(null),j.current=null,R(null))},[s]),x.useEffect(()=>{if(!G)return;const m=k=>(k.preventDefault(),k.returnValue="You have unsaved changes. Are you sure you want to leave?",k.returnValue);return window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[G]);const S=Ye(G),V=x.useRef(s),J=P.current!==null&&P.current!==j.current&&y.current!==null&&y.current!==s;q===null&&!J&&(V.current=s);const h=V.current;x.useEffect(()=>{r==null||r(h)},[h,r]);const A=is(h),{data:E,isLoading:K,error:f}=Mt({queryKey:["file",h],queryFn:()=>Ct(h),enabled:!!h&&!A}),w=x.useCallback((m,k)=>{m.revealLineInCenter(k),m.setPosition({lineNumber:k,column:1}),m.focus();const B=m.deltaDecorations([],[{range:{startLineNumber:k,startColumn:1,endLineNumber:k,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{m.deltaDecorations(B,[])},1500)},[]),$=x.useCallback(m=>{p.current=m,n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);x.useEffect(()=>{const m=p.current;m&&n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);const ie=x.useCallback(m=>{const k=p.current;if(!k||!E)return;const B=u??E.content,F=ns(B,m);F&&w(k,F)},[u,E,w]),{data:W}=St(),ke=(W==null?void 0:W.available)??!1,Ge=ke&&((Se=W==null?void 0:W.uncommittedChanges)==null?void 0:Se.some(m=>h&&(m.path===h||h.endsWith(m.path)||m.path.endsWith(h.replace(/\\/g,"/"))))),{data:oe,isLoading:Ve}=Et(g==="history"?h:null),{data:ce,isLoading:Ae}=Ft(g==="changes"?h:null,g==="changes"),Be=x.useCallback(()=>{E&&h&&(y.current=h,j.current=E.content,o(E.content))},[E,h]),_e=x.useCallback(()=>{y.current=null,o(null),j.current=null},[]),Ue=x.useCallback(async()=>{if(!(u===null||!h)){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved"),y.current=null,o(null),j.current=null}catch(m){t("error",`Save failed: ${m}`)}b(!1)}},[u,h,d,t]),qe=x.useCallback(()=>{y.current=null,o(null),j.current=null,V.current=s,R(null)},[s]),Ze=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,V.current=s,R(null)},[u,h,s,d,t]),ze=x.useCallback(()=>{R(null)},[]),Je=x.useCallback(()=>{y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S]),Ke=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S,u,h,d,t]),Ce=x.useCallback(()=>{S.state==="blocked"&&S.reset()},[S]);if(!h)return e.jsx(H,{title:"Select a file",description:"Choose a file from the tree to view its contents",icon:e.jsx(M,{size:28})});if(A){const m=os(h);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase",children:A==="pdf"?"pdf":"image"})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:A==="image"?e.jsx(Yt,{src:m,path:h}):e.jsx(Ht,{src:m,path:h})})]})}if(K)return e.jsx($t,{text:"Loading file..."});if(f||!E){const m=f==null?void 0:f.code;return m==="binary_file"?e.jsx(H,{title:"Binary file",description:`${h} can't be shown in the editor. Open it with an external application.`,icon:e.jsx(M,{size:28})}):m==="file_too_large"?e.jsx(H,{title:"File too large to preview",description:(f==null?void 0:f.message)||"This file exceeds the preview size limit.",icon:e.jsx(M,{size:28})}):e.jsx(H,{title:"Error loading file",description:String(f)})}const{content:Qe,metadata:C}=E,O=C.language,N=u!==null&&y.current===h,I=N?u:Qe,Xe=()=>{var m,k,B;return O==="html"?e.jsx(Xt,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0}):O==="markdown"?e.jsx(es,{content:I,readOnly:!N,onChange:N?F=>o(F??null):void 0,initialMode:N?"code":"preview"}):O==="gherkin"&&!N?e.jsx(_t,{content:I}):O==="robot"&&!N?e.jsx(Qt,{content:I,keywords:(m=C.metadata)==null?void 0:m.keywords}):(O==="csv"||O==="json"&&C.type==="data"||O==="yaml")&&!N?e.jsx(Ut,{content:I,language:O}):(k=C.metadata)!=null&&k.endpoints&&C.metadata.endpoints.length>0?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Kt,{content:I,metadata:C}),e.jsx("div",{className:"flex-1 border-t border-white/5",children:e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})})]}):(B=C.metadata)!=null&&B.steps&&C.metadata.steps.length>0?e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$,steps:C.metadata.steps,onStepClick:ie}):e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),N&&e.jsx("span",{className:"text-[9px] font-medium text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:G?"MODIFIED":"EDITING"}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[C.lines," lines"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:O}),ke&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(g==="history"?"none":"history"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="history"?"bg-sky-600/20 text-sky-300 border-sky-500/30":"bg-surface-2 hover:bg-surface-3 text-gray-400 border-white/5"}`,title:"View git history for this file",children:[e.jsx(pt,{size:12})," History"]}),Ge&&e.jsxs("button",{onClick:()=>z(g==="changes"?"none":"changes"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="changes"?"bg-amber-600/20 text-amber-300 border-amber-500/30":"bg-surface-2 hover:bg-surface-3 text-amber-400 border-white/5"}`,title:"View uncommitted changes for this file",children:[e.jsx(gt,{size:12})," Changes"]})]}),N?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:_e,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-400 border border-white/5 flex items-center gap-1",title:"Discard changes",children:[e.jsx(me,{size:12})," Cancel"]}),e.jsxs("button",{onClick:Ue,disabled:v,className:"px-2 py-1 text-xs rounded bg-brand-600 hover:bg-brand-500 text-white flex items-center gap-1 disabled:opacity-50",children:[e.jsx(he,{size:12})," ",v?"Saving...":"Save"]})]}):e.jsx("button",{onClick:Be,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-300 border border-white/5",children:"Edit"}),C.type==="test"&&a&&e.jsxs("button",{onClick:()=>c(()=>a(h),{files:[h]}),className:"px-2 py-1 text-xs rounded bg-emerald-600 hover:bg-emerald-500 text-white flex items-center gap-1",children:[e.jsx(bt,{size:12})," Run"]})]}),e.jsx(vt,{filePath:h}),g!=="none"&&e.jsxs("div",{className:"border-b border-white/5 bg-surface-1/80 max-h-[40vh] overflow-y-auto flex-shrink-0",children:[g==="history"&&e.jsx(ts,{commits:(oe==null?void 0:oe.commits)||[],isLoading:Ve,filePath:h}),g==="changes"&&e.jsx(as,{files:(ce==null?void 0:ce.files)||[],isLoading:Ae})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:Xe()}),q!==null&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:ze}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:ze,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes in the current file. What would you like to do?"})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:qe,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard Changes"}),e.jsxs("button",{onClick:Ze,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Switch"]})]})]})]}),S.state==="blocked"&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:Ce}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:Ce,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes. If you leave this page, your changes will be lost."})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:Je,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard & Leave"}),e.jsxs("button",{onClick:Ke,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Leave"]})]})]})]})]})}export{Gt as F,ws as a,vs as u};