test-lah 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +44 -34
- package/.next/standalone/.next/app-path-routes-manifest.json +8 -7
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +21 -21
- package/.next/standalone/.next/server/app/(dashboard)/integrations/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page.js +17 -70
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page.js +2 -22
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/page.js +34 -2
- package/.next/standalone/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/api/e2e/route.js +13 -2
- package/.next/standalone/.next/server/app/api/e2e/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/generate/route.js +13 -2
- package/.next/standalone/.next/server/app/api/generate/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/llm/encrypt/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/llm/test/route.js +13 -2
- package/.next/standalone/.next/server/app/api/llm/test/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/refine-notes/route.js +29 -0
- package/.next/standalone/.next/server/app/api/refine-notes/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/refine-notes/route_client-reference-manifest.js +1 -0
- package/.next/standalone/.next/server/app/api/weather/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/integrations.html +1 -1
- package/.next/standalone/.next/server/app/integrations.rsc +4 -4
- package/.next/standalone/.next/server/app/login/page.js +2 -2
- package/.next/standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/login.html +1 -1
- package/.next/standalone/.next/server/app/login.rsc +3 -3
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects.html +1 -1
- package/.next/standalone/.next/server/app/projects.rsc +4 -4
- package/.next/standalone/.next/server/app-paths-manifest.json +8 -7
- package/.next/standalone/.next/server/chunks/423.js +62 -0
- package/.next/standalone/.next/server/chunks/615.js +2 -2
- package/.next/standalone/.next/server/chunks/736.js +2 -2
- package/.next/standalone/.next/server/chunks/779.js +1 -0
- package/.next/standalone/.next/server/chunks/845.js +5 -5
- package/.next/standalone/.next/server/chunks/898.js +21 -0
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/172-84d6b7afea495880.js +1 -0
- package/.next/standalone/.next/static/chunks/246-28370f424ce95be6.js +1 -0
- package/.next/standalone/.next/static/chunks/253-d1beae5e3cf2d88e.js +1 -0
- package/.next/standalone/.next/static/chunks/642-d84ad067810dd35b.js +1 -0
- package/.next/standalone/.next/static/chunks/661-a763fedcbf90af81.js +1 -0
- package/.next/standalone/.next/static/chunks/793-7306e111aea85b00.js +1 -0
- package/.next/standalone/.next/static/chunks/968-a7dcf12036013254.js +62 -0
- package/.next/standalone/.next/static/chunks/app/(dashboard)/integrations/page-d62f7774ba0ed3ab.js +1 -0
- package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-e4ed5abcbb7c8802.js +1 -0
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-0d320c1bd8d89d9c.js +1 -0
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-1b2e89d37c95e30f.js +1 -0
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/page-5f4191feafff095a.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/e2e/route-234cc6154c5cd194.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/generate/route-234cc6154c5cd194.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/llm/encrypt/route-234cc6154c5cd194.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/llm/test/route-234cc6154c5cd194.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/refine-notes/route-234cc6154c5cd194.js +1 -0
- package/.next/standalone/.next/static/chunks/app/api/weather/route-234cc6154c5cd194.js +1 -0
- package/.next/{static/chunks/app/login/page-a655de2a3e8514f8.js → standalone/.next/static/chunks/app/login/page-35c717d39c71dcbf.js} +1 -1
- package/.next/standalone/.next/static/chunks/app/page-dd12a450edb4a44d.js +1 -0
- package/.next/standalone/.next/static/css/d31bdcc43c2da03c.css +3 -0
- package/.next/standalone/.next/static/pu5ThH8RrsP9e4dTXjYwA/_buildManifest.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/.next/static/chunks/172-84d6b7afea495880.js +1 -0
- package/.next/static/chunks/246-28370f424ce95be6.js +1 -0
- package/.next/static/chunks/253-d1beae5e3cf2d88e.js +1 -0
- package/.next/static/chunks/642-d84ad067810dd35b.js +1 -0
- package/.next/static/chunks/661-a763fedcbf90af81.js +1 -0
- package/.next/static/chunks/793-7306e111aea85b00.js +1 -0
- package/.next/static/chunks/968-a7dcf12036013254.js +62 -0
- package/.next/static/chunks/app/(dashboard)/integrations/page-d62f7774ba0ed3ab.js +1 -0
- package/.next/static/chunks/app/(dashboard)/layout-e4ed5abcbb7c8802.js +1 -0
- package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-0d320c1bd8d89d9c.js +1 -0
- package/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-1b2e89d37c95e30f.js +1 -0
- package/.next/static/chunks/app/(dashboard)/projects/page-5f4191feafff095a.js +1 -0
- package/.next/static/chunks/app/api/e2e/route-234cc6154c5cd194.js +1 -0
- package/.next/static/chunks/app/api/generate/route-234cc6154c5cd194.js +1 -0
- package/.next/static/chunks/app/api/llm/encrypt/route-234cc6154c5cd194.js +1 -0
- package/.next/static/chunks/app/api/llm/test/route-234cc6154c5cd194.js +1 -0
- package/.next/static/chunks/app/api/refine-notes/route-234cc6154c5cd194.js +1 -0
- package/.next/static/chunks/app/api/weather/route-234cc6154c5cd194.js +1 -0
- package/.next/{standalone/.next/static/chunks/app/login/page-a655de2a3e8514f8.js → static/chunks/app/login/page-35c717d39c71dcbf.js} +1 -1
- package/.next/static/chunks/app/page-dd12a450edb4a44d.js +1 -0
- package/.next/static/css/d31bdcc43c2da03c.css +3 -0
- package/.next/static/pu5ThH8RrsP9e4dTXjYwA/_buildManifest.js +1 -0
- package/README.md +27 -4
- package/package.json +1 -1
- package/.next/standalone/.next/server/chunks/350.js +0 -21
- package/.next/standalone/.next/server/chunks/403.js +0 -1
- package/.next/standalone/.next/server/chunks/583.js +0 -1
- package/.next/standalone/.next/static/Dmhhi1aH71i6LYut_5YOv/_buildManifest.js +0 -1
- package/.next/standalone/.next/static/chunks/246-1673b37cc8edb269.js +0 -1
- package/.next/standalone/.next/static/chunks/485-23e4a6e33ee79f14.js +0 -1
- package/.next/standalone/.next/static/chunks/532-95cb537bb36c2e68.js +0 -62
- package/.next/standalone/.next/static/chunks/637-dcbc811f7143935f.js +0 -1
- package/.next/standalone/.next/static/chunks/708-1fc7a6d1d5b4aee7.js +0 -1
- package/.next/standalone/.next/static/chunks/app/(dashboard)/integrations/page-f5e71fcfbeffdfb1.js +0 -1
- package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-69e4ea7abe9faff3.js +0 -1
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-4f738ff151196fe8.js +0 -1
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-b69fc155f1796e19.js +0 -1
- package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/page-11a49918142004f5.js +0 -1
- package/.next/standalone/.next/static/chunks/app/api/e2e/route-ccff81cd0a5704f2.js +0 -1
- package/.next/standalone/.next/static/chunks/app/api/generate/route-ccff81cd0a5704f2.js +0 -1
- package/.next/standalone/.next/static/chunks/app/api/llm/encrypt/route-ccff81cd0a5704f2.js +0 -1
- package/.next/standalone/.next/static/chunks/app/api/llm/test/route-ccff81cd0a5704f2.js +0 -1
- package/.next/standalone/.next/static/chunks/app/api/weather/route-ccff81cd0a5704f2.js +0 -1
- package/.next/standalone/.next/static/chunks/app/page-a90eeaea3538ebf2.js +0 -1
- package/.next/standalone/.next/static/css/ab7683c62149b050.css +0 -3
- package/.next/static/Dmhhi1aH71i6LYut_5YOv/_buildManifest.js +0 -1
- package/.next/static/chunks/246-1673b37cc8edb269.js +0 -1
- package/.next/static/chunks/485-23e4a6e33ee79f14.js +0 -1
- package/.next/static/chunks/532-95cb537bb36c2e68.js +0 -62
- package/.next/static/chunks/637-dcbc811f7143935f.js +0 -1
- package/.next/static/chunks/708-1fc7a6d1d5b4aee7.js +0 -1
- package/.next/static/chunks/app/(dashboard)/integrations/page-f5e71fcfbeffdfb1.js +0 -1
- package/.next/static/chunks/app/(dashboard)/layout-69e4ea7abe9faff3.js +0 -1
- package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-4f738ff151196fe8.js +0 -1
- package/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-b69fc155f1796e19.js +0 -1
- package/.next/static/chunks/app/(dashboard)/projects/page-11a49918142004f5.js +0 -1
- package/.next/static/chunks/app/api/e2e/route-ccff81cd0a5704f2.js +0 -1
- package/.next/static/chunks/app/api/generate/route-ccff81cd0a5704f2.js +0 -1
- package/.next/static/chunks/app/api/llm/encrypt/route-ccff81cd0a5704f2.js +0 -1
- package/.next/static/chunks/app/api/llm/test/route-ccff81cd0a5704f2.js +0 -1
- package/.next/static/chunks/app/api/weather/route-ccff81cd0a5704f2.js +0 -1
- package/.next/static/chunks/app/page-a90eeaea3538ebf2.js +0 -1
- package/.next/static/css/ab7683c62149b050.css +0 -3
- /package/.next/standalone/.next/static/{Dmhhi1aH71i6LYut_5YOv → pu5ThH8RrsP9e4dTXjYwA}/_ssgManifest.js +0 -0
- /package/.next/static/{Dmhhi1aH71i6LYut_5YOv → pu5ThH8RrsP9e4dTXjYwA}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[948],{1868:(e,t,r)=>{Promise.resolve().then(r.bind(r,4065))},4065:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>$});var s=r(5155),a=r(8661),o=r.n(a),l=r(2115),n=r(63),i=r(7246);let c=(0,l.memo)(function(e){let{node:t,position:r,isSelected:a,testCases:o,isDragged:n,edgeDragActive:i,isEdgeDropTarget:c,deleteMode:d,isDeleteChecked:x,onSelect:u,onAddChild:p,onDelete:m,onUnlinkNode:h,onRename:b,onUpdateNode:v,onDragStart:y,onEdgeStart:f,onToggleDeleteCheck:g,depth:j,showCounter:k,svgRef:C}=e,[w,N]=(0,l.useState)(!1),[S,D]=(0,l.useState)(t.label),[E,L]=(0,l.useState)(!1),[M,R]=(0,l.useState)(!1),[A,T]=(0,l.useState)("horizontal"),[z,I]=(0,l.useState)(""),W=(0,l.useRef)(null),F=(0,l.useRef)(null),B=(0,l.useRef)(null),P=(0,l.useRef)({startX:0,startY:0,moved:!1}),{w:U,h:O}=0===j?{w:160,h:56}:1===j?{w:144,h:48}:{w:132,h:42},X=o.some(e=>"fail"===e.status),H=o.some(e=>"skip"===e.status),K=o.some(e=>"untested"===e.status),G=o.some(e=>"blocked"===e.status),Y=X||H||K||G,V=o.length>0&&o.every(e=>"pass"===e.status);(0,l.useEffect)(()=>{let e=e=>{let r=e.detail;(null==r?void 0:r.parentId)===t.id&&(R(!0),I(""))};return window.addEventListener("mindmap:add-child",e),()=>window.removeEventListener("mindmap:add-child",e)},[t.id]),(0,l.useEffect)(()=>{if(!M)return;let e=e=>{B.current&&!B.current.contains(e.target)&&(z.trim()?q():(R(!1),I("")))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[M,z]),(0,l.useEffect)(()=>{M&&F.current&&F.current.focus()},[M]);let _=(0,l.useCallback)(()=>{D(t.label),N(!0),setTimeout(()=>{var e;return null==(e=W.current)?void 0:e.focus()},0)},[t.label]),J=(0,l.useCallback)(()=>{S.trim()&&b(t.id,S.trim()),N(!1)},[S,t.id,b]),q=(0,l.useCallback)(()=>{if(z.trim()){let e="vertical"===A?{x:r.x,y:r.y+O+60}:{x:r.x+U+120,y:r.y};p(t.id,z.trim(),e,A)}R(!1),I("")},[z,t.id,p,r.x,r.y,O,U,A]),Z=(0,l.useCallback)(e=>t=>{t.stopPropagation(),T(e),R(!0),I("")},[]),$=(0,l.useCallback)(e=>{if(2===e.button||d)return;if(e.stopPropagation(),!e.target.closest('[data-drag-handle="true"]'))return void u(t.id);e.preventDefault(),P.current={startX:e.clientX,startY:e.clientY,moved:!1};let s=e=>e.preventDefault();document.addEventListener("contextmenu",s);let a=e=>{let s=e.clientX-P.current.startX,a=e.clientY-P.current.startY;!P.current.moved&&(Math.abs(s)>6||Math.abs(a)>6)&&(P.current.moved=!0,y(t.id,P.current.startX,P.current.startY,r.x,r.y))},o=()=>{window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",o),setTimeout(()=>document.removeEventListener("contextmenu",s),100)};window.addEventListener("mousemove",a),window.addEventListener("mouseup",o)},[t.id,u,y,d,r]),Q=t.id.replace(/[^a-zA-Z0-9]/g,"").slice(0,8),ee=a&&!d;return(0,s.jsxs)("g",{transform:"translate(".concat(r.x,", ").concat(r.y,")"),onMouseDown:$,onDoubleClick:e=>{e.stopPropagation(),d||_()},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),style:{cursor:d?"pointer":"default",transition:n?"none":"transform 150ms ease-out"},onClick:()=>{d&&g(t.id)},children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"fill-".concat(Q),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#FFFFFF"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#FAF9F7"})]}),(0,s.jsxs)("filter",{id:"shadow-".concat(Q),x:"-10%",y:"-10%",width:"120%",height:"130%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.08"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"3",stdDeviation:"6",floodOpacity:"0.05"})]}),(0,s.jsxs)("filter",{id:"shadow-hover-".concat(Q),x:"-10%",y:"-10%",width:"120%",height:"140%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"2",stdDeviation:"4",floodOpacity:"0.12"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"6",stdDeviation:"12",floodOpacity:"0.08"})]}),(0,s.jsxs)("filter",{id:"shadow-drag-".concat(Q),x:"-20%",y:"-20%",width:"140%",height:"160%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"4",stdDeviation:"8",floodOpacity:"0.2"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"8",stdDeviation:"16",floodOpacity:"0.1"})]}),(0,s.jsxs)("filter",{id:"glow-".concat(Q),x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,s.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"blur"}),(0,s.jsx)("feColorMatrix",{in:"blur",type:"matrix",values:"0 0 0 0 0.4 0 0 0 0 0.8 0 0 0 0 0.4 0 0 0 0.6 0"})]})]}),!d&&(0,s.jsxs)("g",{"data-drag-handle":"true",transform:"translate(0, ".concat(-O/2-10,")"),style:{cursor:n?"grabbing":"grab"},children:[(0,s.jsx)("rect",{x:-20,y:-7,width:40,height:14,rx:4,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1,opacity:E||a?.9:.5,style:{transition:"opacity 150ms ease-out"}}),(0,s.jsx)("circle",{cx:-8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:0,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:0,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6})]}),(()=>{let e=X?"var(--status-fail-bg)":Y?"var(--status-skip-bg)":V?"var(--status-pass-bg)":null;return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)("rect",{x:-U/2,y:-O/2,width:U,height:O,rx:4,fill:e,opacity:X?.2:.15}),(0,s.jsx)("rect",{x:-U/2,y:-O/2,width:U,height:O,rx:4,fill:"url(#fill-".concat(Q,")"),stroke:d&&x?"var(--status-fail-text)":"var(--border)",strokeWidth:d&&x?2:.5,filter:n?"url(#shadow-drag-".concat(Q,")"):E?"url(#shadow-hover-".concat(Q,")"):"url(#shadow-".concat(Q,")"),style:{transition:"filter 200ms ease-out, stroke 150ms ease-out"}}),(0,s.jsx)("path",{d:"M ".concat(U/2-10," ").concat(-O/2," L ").concat(U/2," ").concat(-O/2," L ").concat(U/2," ").concat(-O/2+10," Z"),fill:"var(--bg-secondary)",opacity:.5}),(0,s.jsx)("path",{d:"M ".concat(U/2-10," ").concat(-O/2," L ").concat(U/2-10," ").concat(-O/2+10," L ").concat(U/2," ").concat(-O/2+10),fill:"none",stroke:"var(--border)",strokeWidth:.5,opacity:.4})]})})(),o.length>0&&!d&&k&&(0,s.jsxs)("text",{x:U/2-6,y:-O/2+10,textAnchor:"end",style:{fill:X?"var(--status-fail-text)":Y?"var(--status-skip-text)":"var(--status-pass-text)",fontSize:9,fontWeight:700,fontFamily:"monospace",opacity:E||a?1:.7,transition:"opacity 150ms ease-out",pointerEvents:"none"},children:[X?o.filter(e=>"fail"===e.status).length:Y?o.filter(e=>"pass"!==e.status).length:o.length,"/",o.length]}),d&&(0,s.jsxs)("g",{transform:"translate(".concat(-U/2+8,", 0)"),children:[(0,s.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:x?"var(--status-fail-text)":"transparent",stroke:x?"var(--status-fail-text)":"var(--border)",strokeWidth:1.5}),x&&(0,s.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),t.code&&!d&&(0,s.jsxs)("g",{transform:"translate(".concat(-U/2+4,", ").concat(-O/2+4,")"),style:{opacity:E||a?1:0,transition:"opacity 150ms ease-out"},children:[(0,s.jsx)("rect",{x:0,y:0,width:Math.max(6.5*t.code.length+10,28),height:14,rx:2,fill:"var(--accent)",opacity:.08}),(0,s.jsx)("text",{x:5,y:10,style:{fill:"var(--text-tertiary)",fontSize:8,fontWeight:500,fontFamily:"monospace",letterSpacing:"0.05em"},children:t.code})]}),w?(0,s.jsx)("foreignObject",{x:-U/2+8,y:-O/2+4,width:U-16,height:O-8,children:(0,s.jsx)("input",{ref:W,value:S,onChange:e=>D(e.target.value),onBlur:J,onKeyDown:e=>{"Enter"===e.key&&J(),"Escape"===e.key&&N(!1)},className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})}):(0,s.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",className:"select-none",onClick:e=>{e.stopPropagation(),d||_()},style:{fill:"var(--text-primary)",fontSize:0===j?13:11.5,fontWeight:0===j?600:450,fontFamily:"inherit",letterSpacing:"-0.01em",cursor:E&&!d?"text":"default",pointerEvents:"auto"},children:t.label.length>22?t.label.slice(0,22)+"…":t.label}),ee&&!w&&!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("g",{transform:"translate(".concat(U/2+3,", ").concat(-11,")"),children:[(0,s.jsxs)("g",{onClick:Z("horizontal"),onMouseDown:e=>e.stopPropagation(),style:{cursor:"pointer",transition:"opacity 150ms ease-out"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.85"},children:[(0,s.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,s.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,s.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,s.jsx)("g",{transform:"translate(".concat(24,", ").concat(7,")"),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),f(t.id,"pass",r.x+U/2+3+22+2+4,r.y-11+11,"horizontal")},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),f(t.id,"fail",r.x+U/2+3+22+2+4,r.y-11+11,"horizontal")},style:{cursor:"crosshair",transition:"opacity 150ms ease-out"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"},children:(0,s.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--status-pass-text)",opacity:.8,children:(0,s.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]}),(0,s.jsxs)("g",{transform:"translate(".concat(-11,", ").concat(O/2+3,")"),children:[(0,s.jsxs)("g",{onClick:Z("vertical"),onMouseDown:e=>e.stopPropagation(),style:{cursor:"pointer",transition:"opacity 150ms ease-out"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.85"},children:[(0,s.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,s.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,s.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,s.jsx)("g",{transform:"translate(".concat(24,", ").concat(7,")"),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),f(t.id,"pass",r.x-11+11,r.y+O/2+3+22+2+4,"vertical")},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),f(t.id,"fail",r.x-11+11,r.y+O/2+3+22+2+4,"vertical")},style:{cursor:"crosshair",transition:"opacity 150ms ease-out"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"},children:(0,s.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--accent)",opacity:.8,children:(0,s.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]})]}),i&&!c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("g",{transform:"translate(".concat(-U/2-10,", 0)"),children:(0,s.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})}),(0,s.jsx)("g",{transform:"translate(0, ".concat(-O/2-10,")"),children:(0,s.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})})]}),M&&(0,s.jsxs)("g",{children:["vertical"===A?(0,s.jsx)("line",{x1:0,y1:O/2,x2:0,y2:O/2+50,stroke:"var(--border-hover)",strokeWidth:1.5}):(0,s.jsx)("line",{x1:U/2,y1:0,x2:U/2+50,y2:0,stroke:"var(--border-hover)",strokeWidth:1.5}),(0,s.jsx)("rect",{x:"vertical"===A?-U/2:U/2+50,y:"vertical"===A?O/2+50:-O/2,width:U,height:O,rx:4,fill:"var(--bg-card)",stroke:"var(--accent)",strokeWidth:1,strokeDasharray:"4 3"}),(0,s.jsx)("foreignObject",{x:"vertical"===A?-U/2+4:U/2+50+4,y:"vertical"===A?O/2+50+4:-O/2+4,width:U-8,height:O-8,children:(0,s.jsx)("div",{ref:B,children:(0,s.jsx)("input",{ref:F,value:z,onChange:e=>I(e.target.value),onBlur:()=>{z.trim()?q():(R(!1),I(""))},onKeyDown:e=>{"Enter"===e.key&&q(),"Escape"===e.key&&(R(!1),I("")),e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),placeholder:"Name node...",className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})})})]})]})});var d=r(7069),x=r(4269);function u(e){let{width:t=16,height:r=16,x:a=0,y:o=0,cx:n=1,cy:i=1,cr:c=1,className:u,glow:p=!1,...m}=e,h=(0,l.useId)(),b=(0,l.useRef)(null),[v,y]=(0,l.useState)({width:0,height:0});(0,l.useEffect)(()=>{let e=()=>{if(b.current){let{width:e,height:t}=b.current.getBoundingClientRect();y({width:e,height:t})}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let f=Array.from({length:Math.ceil(v.width/t)*Math.ceil(v.height/r)},(e,s)=>{let l=s%Math.ceil(v.width/t),c=Math.floor(s/Math.ceil(v.width/t));return{x:l*t+n+a,y:c*r+i+o,delay:5*Math.random(),duration:3*Math.random()+2}});return(0,s.jsxs)("svg",{ref:b,"aria-hidden":"true",className:(0,x.cn)("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",u),...m,children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("radialGradient",{id:"".concat(h,"-gradient"),children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),f.map(e=>(0,s.jsx)(d.P.circle,{cx:e.x,cy:e.y,r:c,fill:p?"url(#".concat(h,"-gradient)"):"currentColor",initial:p?{opacity:.4,scale:1}:{},animate:p?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:p?{duration:e.duration,repeat:1/0,repeatType:"reverse",delay:e.delay,ease:"easeInOut"}:{}},"".concat(e.x,"-").concat(e.y)))]})}let p=l.forwardRef((e,t)=>{let{className:r,children:a,rippleColor:o="#ffffff",duration:n="600ms",onClick:i,...c}=e,[d,u]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let e=null;if(d.length>0){let t=d[d.length-1];e=setTimeout(()=>{u(e=>e.filter(e=>e.key!==t.key))},parseInt(n))}return()=>{null!==e&&clearTimeout(e)}},[d,n]),(0,s.jsxs)("button",{className:(0,x.cn)("bg-background text-primary relative flex cursor-pointer items-center justify-center overflow-hidden rounded-lg border-2 px-4 py-2 text-center",r),onClick:e=>{(e=>{let t=e.currentTarget.getBoundingClientRect(),r=Math.max(t.width,t.height),s={x:e.clientX-t.left-r/2,y:e.clientY-t.top-r/2,size:r,key:Date.now()};u(e=>[...e,s])})(e),null==i||i(e)},ref:t,...c,children:[(0,s.jsx)("div",{className:"relative z-10",children:a}),(0,s.jsx)("span",{className:"pointer-events-none absolute inset-0",children:d.map(e=>(0,s.jsx)("span",{className:"animate-rippling bg-background absolute rounded-full opacity-30",style:{width:"".concat(e.size,"px"),height:"".concat(e.size,"px"),top:"".concat(e.y,"px"),left:"".concat(e.x,"px"),backgroundColor:o,transform:"scale(0)","--duration":n}},e.key))})]})});function m(e){let{nodes:t,edges:r,testCases:a,selectedNodeId:o,onSelect:n,onAddNode:i,onDeleteNode:d,onDeleteNodes:x,onUnlinkNode:m,onRenameNode:v,onUpdateNode:y,onAddEdge:f,onDeleteEdge:g,onUpdateEdge:j,canUndo:k,canRedo:C,onUndo:w,onRedo:N}=e,S=(0,l.useMemo)(()=>(function(e){let t=new Map;if(0===e.length)return t;let r=new Map;for(let t of e)r.set(t.id,t);let s=new Set;for(let t of e)t.position&&s.add(t.id);let a=e.filter(e=>null===e.parentId);if(0===a.length)return t;let o=0;for(let e of a)o=function e(a,o,l,n,i){var c,d,x,u;let p=r.get(a);if(!p)return l;let m="vertical"===p.direction,h=m?null!=(d=null==(c=p.position)?void 0:c.x)?d:n:60+180*o,b=l;for(let t of p.children)b=m?e(t,o,b,n,i):e(t,o+1,b,n,i);let v=p.children.map(e=>t.get(e)).filter(Boolean),y=v.length>0?(Math.min(...v.map(e=>e.y))+Math.max(...v.map(e=>e.y)))/2:l;if(s.has(a)&&p.position){let r=v.length>0?y:l,s=p.position.x-(m?p.position.x:h),n=p.position.y-r;t.set(a,p.position);let i=l;for(let t of p.children)i=m?e(t,o,i,s,n):e(t,o+1,i,s,n);return i}return m?t.set(a,{x:(null!=(u=null==(x=p.position)?void 0:x.x)?u:0)+n,y:y+i}):t.set(a,{x:h+n,y:y+i}),b}(e.id,0,o,0,0);let l=Array.from(t.entries());if(l.length>0){let e=l.filter(e=>{let[t]=e;return!s.has(t)}).map(e=>{let[,t]=e;return t.y});if(e.length>0){let r=(Math.min(...e)+Math.max(...e))/2;for(let[e,a]of l)s.has(e)||t.set(e,{x:a.x,y:a.y-r+300})}}return t})(t),[t]),[D,E]=(0,l.useState)({x:0,y:0}),[L,M]=(0,l.useState)(1),[R,A]=(0,l.useState)(!1),[T,z]=(0,l.useState)({x:0,y:0}),[I,W]=(0,l.useState)(null),[F,B]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),[O,X]=(0,l.useState)(null),[H,K]=(0,l.useState)(null),[G,Y]=(0,l.useState)(null),[V,_]=(0,l.useState)(!1),[J,q]=(0,l.useState)(new Set),[Z,$]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(null),[et,er]=(0,l.useState)(!1),[es,ea]=(0,l.useState)(!1),eo=(0,l.useRef)(null),el=(0,l.useRef)(null),en=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=eo.current;if(!e)return;let t=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;M(e=>Math.max(.2,Math.min(3,e*t)))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let ei=(0,l.useCallback)(()=>{let e=Array.from(S.values());if(0===e.length){M(1),E({x:0,y:0});return}if(!eo.current)return;let t=eo.current.getBoundingClientRect(),r=Math.min(...e.map(e=>e.x))-80,s=Math.max(...e.map(e=>e.x))+80,a=Math.min(...e.map(e=>e.y))-80,o=Math.max(...e.map(e=>e.y))+80,l=Math.min(t.width/(s-r),t.height/(o-a),1.5);M(l),E({x:t.width/2/l-(r+s)/2,y:t.height/2/l-(a+o)/2})},[S]);(0,l.useEffect)(()=>{let e=e=>{var r;let s=null==(r=e.target)?void 0:r.tagName;if("INPUT"!==s&&"TEXTAREA"!==s){if((e.ctrlKey||e.metaKey)&&(("="===e.key||"+"===e.key)&&(e.preventDefault(),M(e=>Math.min(3,1.15*e))),"-"===e.key&&(e.preventDefault(),M(e=>Math.max(.2,.85*e))),"0"===e.key&&(e.preventDefault(),ei())),"Tab"===e.key&&o&&!e.ctrlKey&&!e.metaKey){e.preventDefault();let r=t.find(e=>e.id===o);if(r){let e=new CustomEvent("mindmap:add-child",{detail:{parentId:r.id}});window.dispatchEvent(e)}}if("Enter"===e.key&&o&&!e.ctrlKey&&!e.metaKey){e.preventDefault();let r=t.find(e=>e.id===o);if(r)if(r.parentId){let e=new CustomEvent("mindmap:add-child",{detail:{parentId:r.parentId}});window.dispatchEvent(e)}else{let e=S.get(r.id);e&&i(null,"",{x:e.x,y:e.y+70})}}"Delete"!==e.key&&"Backspace"!==e.key||!o||e.ctrlKey||e.metaKey||(e.preventDefault(),ee(o),$(!0))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,t,S,i,d,ei]);let ec=(0,l.useCallback)((e,t)=>{if(!eo.current)return{x:0,y:0};let r=eo.current.getBoundingClientRect();return{x:(e-r.left)/L-D.x,y:(t-r.top)/L-D.y}},[L,D]),ed=(0,l.useCallback)(e=>{e.target===eo.current&&(A(!0),z({x:e.clientX-D.x*L,y:e.clientY-D.y*L}))},[D,L]),ex=(0,l.useCallback)(e=>{if(R&&E({x:(e.clientX-T.x)/L,y:(e.clientY-T.y)/L}),I){let t=ec(I.startClientX,I.startClientY),r=ec(e.clientX,e.clientY),s=r.x-t.x,a=r.y-t.y,o=I.startNodeX+s,l=I.startNodeY+a;en.current={id:I.id,x:o,y:l},el.current||(el.current=requestAnimationFrame(()=>{en.current&&(y(en.current.id,{position:{x:en.current.x,y:en.current.y}}),en.current=null),el.current=null}))}if(O){let r=ec(e.clientX,e.clientY);X(e=>e?{...e,curX:r.x,curY:r.y}:null);let s=null;for(let e of t){if(e.id===O.fromId)continue;let t=S.get(e.id);if(!t)continue;let a=r.x-t.x,o=r.y-t.y;if(80>Math.abs(a)&&40>Math.abs(o)){s=e.id;break}}Y(s)}},[R,T,L,I,O,ec,y,t,S]),eu=(0,l.useCallback)(()=>{if(O){let e={x:O.curX,y:O.curY};for(let r of t){let t=S.get(r.id);if(!t)continue;let s=e.x-t.x,a=e.y-t.y;if(80>Math.abs(s)&&40>Math.abs(a)&&r.id!==O.fromId){f(O.fromId,r.id,O.type);break}}X(null),Y(null)}A(!1),W(null),el.current&&(cancelAnimationFrame(el.current),el.current=null)},[O,t,S,f]),ep=(0,l.useCallback)(e=>{e.target===eo.current&&(n(null),B(!1))},[n]),em=(0,l.useCallback)(e=>{e.target===eo.current&&(U(ec(e.clientX,e.clientY)),B(!0))},[ec]),eh=(0,l.useCallback)(e=>{e.trim()&&i(null,e.trim(),null!=P?P:void 0),B(!1),U(null)},[i,P]),eb=(0,l.useCallback)((e,t,r,s,a)=>{W({id:e,startNodeX:s,startNodeY:a,startClientX:t,startClientY:r})},[]),ev=(0,l.useCallback)((e,t,r,s,a)=>{X({fromId:e,type:t,startX:r,startY:s,curX:r,curY:s,direction:a})},[]),ey=(0,l.useCallback)(()=>{_(e=>!e),q(new Set),er(!1)},[]),ef=(0,l.useCallback)(()=>{er(e=>!e),_(!1),q(new Set)},[]),eg=(0,l.useCallback)(e=>{q(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ej=(0,l.useCallback)(()=>{Q?(d(Q),ee(null)):J.size>0&&(x(Array.from(J)),q(new Set),_(!1)),$(!1)},[Q,J,d,x]),ek=Array.from(S.values());return ek.length>0&&(ek.map(e=>e.x),ek.map(e=>e.x)),ek.length>0&&(ek.map(e=>e.y),ek.map(e=>e.y)),(0,s.jsxs)("div",{className:"relative w-full h-full overflow-hidden",style:{backgroundColor:"var(--bg-primary)"},children:[(0,s.jsx)(u,{width:24,height:24,cr:1,className:"text-neutral-300/60 dark:text-neutral-600/40"}),(0,s.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1",children:[(0,s.jsx)("button",{onClick:()=>M(e=>Math.min(3,1.2*e)),className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"+"}),(0,s.jsx)("button",{onClick:()=>M(e=>Math.max(.2,.8*e)),className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"−"}),(0,s.jsx)("button",{onClick:ei,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"Fit"}),(0,s.jsxs)("div",{className:"text-[10px] text-center mt-0.5",style:{color:"var(--text-tertiary)"},children:[Math.round(100*L),"%"]}),(0,s.jsxs)("div",{className:"mt-1 border-t pt-1",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:ey,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:V?"var(--status-fail-text)":"var(--border)",color:V?"var(--status-fail-text)":"var(--text-secondary)",backgroundColor:V?"var(--status-fail-bg)":"var(--bg-card)"},title:V?"Exit delete mode":"Delete nodes",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,s.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),(0,s.jsx)("button",{onClick:ef,className:"w-7 h-7 mt-1 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:et?"var(--status-skip-text)":"var(--border)",color:et?"var(--status-skip-text)":"var(--text-secondary)",backgroundColor:et?"var(--status-skip-bg)":"var(--bg-card)"},title:et?"Exit unlink mode":"Unlink lines",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3"}),(0,s.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12",strokeDasharray:"3 3"})]})}),(0,s.jsx)("button",{onClick:()=>ea(e=>!e),className:"w-7 h-7 mt-1 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:es?"var(--accent)":"var(--border)",color:es?"#fff":"var(--text-secondary)",backgroundColor:es?"var(--accent)":"var(--bg-card)"},title:es?"Hide counter":"Show counter",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),(0,s.jsx)("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})})]})]}),(0,s.jsxs)("div",{className:"absolute top-3 left-3 z-10 flex flex-col gap-1",children:[(0,s.jsx)("button",{onClick:w,disabled:!k,className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)] disabled:opacity-25",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},title:"Undo (Ctrl+Z)",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,s.jsx)("path",{d:"M3 5h5a3 3 0 0 1 0 6H6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,s.jsx)("path",{d:"M5.5 2.5L3 5l2.5 2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),(0,s.jsx)("button",{onClick:N,disabled:!C,className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)] disabled:opacity-25",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},title:"Redo (Ctrl+Shift+Z)",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,s.jsx)("path",{d:"M11 5H6a3 3 0 0 0 0 6h2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,s.jsx)("path",{d:"M8.5 2.5L11 5 8.5 7.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})})]}),V&&(0,s.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-4 py-2 rounded-lg border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--status-fail-text)",boxShadow:"var(--shadow-lg)",animation:"fadeInDown 200ms ease-out"},children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select nodes to delete"}),(0,s.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:[J.size," selected"]}),(0,s.jsx)("button",{onClick:()=>{J.size>0&&$(!0)},disabled:0===J.size,className:"px-3 py-1 text-[11px] font-medium rounded transition-colors disabled:opacity-40",style:{backgroundColor:"var(--status-fail-text)",color:"white"},children:"Delete"}),(0,s.jsx)("button",{onClick:ey,className:"px-3 py-1 text-[11px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]}),et&&(0,s.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-4 py-2 rounded-lg border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--status-skip-text)",boxShadow:"var(--shadow-lg)",animation:"fadeInDown 200ms ease-out"},children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Click the icon on a line to unlink it"}),(0,s.jsx)("button",{onClick:ef,className:"px-3 py-1 text-[11px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Done"})]}),Z&&(0,s.jsx)("div",{className:"fixed inset-0 z-[400] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:()=>$(!1),children:(0,s.jsxs)("div",{className:"w-full max-w-sm mx-4 p-5 rounded-xl border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold mb-2",style:{color:"var(--text-primary)"},children:["Delete ",Q?"node":"".concat(J.size," node").concat(J.size>1?"s":""),"?"]}),(0,s.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["This will permanently remove the ",Q?"node":"selected node".concat(J.size>1?"s":"")," and all their test cases. This action cannot be undone."]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:()=>$(!1),className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:ej,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg transition-colors",style:{backgroundColor:"var(--status-fail-text)",color:"white"},children:"Delete"})]})]})}),o&&(0,s.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex gap-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Tab = add child"}),(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Enter = add sibling"}),(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Del = delete"})]}),(0,s.jsxs)("svg",{ref:eo,width:"100%",height:"100%",onMouseDown:ed,onMouseMove:ex,onMouseUp:eu,onClick:ep,onDoubleClick:em,style:{cursor:R||I?"grabbing":O?"crosshair":"default"},children:[(0,s.jsxs)("defs",{children:[(0,s.jsx)("marker",{id:"arrow-pass",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,s.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-pass-text)"})}),(0,s.jsx)("marker",{id:"arrow-fail",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,s.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-fail-text)"})})]}),(0,s.jsxs)("g",{transform:"scale(".concat(L,") translate(").concat(D.x,", ").concat(D.y,")"),children:[t.map(e=>{let a;if(!e.parentId)return null;let o=S.get(e.parentId),l=S.get(e.id);if(!o||!l||r.some(t=>t.fromId===e.parentId&&t.toId===e.id||t.fromId===e.id&&t.toId===e.parentId))return null;let n=t.find(t=>t.id===e.parentId),i=(null==n?void 0:n.direction)==="vertical";if(e.id,i){let e=o.y+40,t=l.y-40;a="M ".concat(o.x," ").concat(o.y+28," C ").concat(o.x," ").concat(e,", ").concat(l.x," ").concat(t,", ").concat(l.x," ").concat(l.y-21)}else{let e=o.x+60,t=l.x-60;a="M ".concat(o.x+70," ").concat(o.y," C ").concat(e," ").concat(o.y,", ").concat(t," ").concat(l.y,", ").concat(l.x-60," ").concat(l.y)}let c=(o.x+l.x)/2,d=(o.y+l.y)/2;return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:a,fill:"none",stroke:"transparent",strokeWidth:12,style:{cursor:"pointer"},onClick:()=>{et?m(e.id):f(e.parentId,e.id,"plain")},onDoubleClick:t=>{t.stopPropagation(),et||m(e.id)}}),(0,s.jsx)("path",{d:a,fill:"none",stroke:et?"var(--status-skip-text)":"var(--border-hover)",strokeWidth:et?2:1.5,strokeDasharray:et?"6 4":"none",style:{pointerEvents:"none",transition:"stroke 150ms, stroke-width 150ms"}}),et&&(0,s.jsxs)("g",{transform:"translate(".concat(c,", ").concat(d,")"),style:{cursor:"pointer"},onClick:t=>{t.stopPropagation(),m(e.id)},children:[(0,s.jsx)("rect",{x:-10,y:-10,width:20,height:20,rx:4,fill:"var(--bg-card)",stroke:"var(--status-skip-text)",strokeWidth:1.5}),(0,s.jsxs)("g",{transform:"translate(-5, -5)",children:[(0,s.jsx)("line",{x1:"0",y1:"0",x2:"10",y2:"10",stroke:"var(--status-skip-text)",strokeWidth:"2",strokeLinecap:"round"}),(0,s.jsx)("line",{x1:"10",y1:"0",x2:"0",y2:"10",stroke:"var(--status-skip-text)",strokeWidth:"2",strokeLinecap:"round"})]})]})]},"tree-edge-".concat(e.id))}),r.map(e=>{let r,a=S.get(e.fromId),o=S.get(e.toId);if(!a||!o)return null;let l="pass"===e.type,n="fail"===e.type,i=l?"var(--status-pass-text)":n?"var(--status-fail-text)":"var(--text-tertiary)",c=(a.x+o.x)/2,d=(a.y+o.y)/2-12,x=t.find(t=>t.id===e.fromId);return r=(null==x?void 0:x.direction)==="vertical"?"M ".concat(a.x," ").concat(a.y," C ").concat(a.x," ").concat(a.y+80,", ").concat(o.x," ").concat(o.y-80,", ").concat(o.x," ").concat(o.y):"M ".concat(a.x," ").concat(a.y," C ").concat(a.x+80," ").concat(a.y,", ").concat(o.x-80," ").concat(o.y,", ").concat(o.x," ").concat(o.y),(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:r,fill:"none",stroke:"transparent",strokeWidth:16,style:{cursor:"pointer"},onClick:()=>{et?g(e.id):l?j(e.id,{type:"fail"}):n?j(e.id,{type:"plain"}):j(e.id,{type:"pass"})},onMouseEnter:()=>K(e.id),onMouseLeave:()=>K(null)}),(0,s.jsx)("path",{d:r,fill:"none",stroke:et?"var(--status-skip-text)":i,strokeWidth:et?2:H===e.id?2.5:1.8,strokeDasharray:et?"6 4":l?"none":n?"6 4":"none",markerEnd:et?void 0:l?"url(#arrow-pass)":n?"url(#arrow-fail)":void 0,style:{transition:"stroke-width 150ms ease-out, stroke 150ms ease-out",pointerEvents:"none"}}),et&&(0,s.jsxs)("g",{transform:"translate(".concat(c,", ").concat(d,")"),style:{cursor:"pointer"},onClick:t=>{t.stopPropagation(),g(e.id)},children:[(0,s.jsx)("rect",{x:-10,y:-10,width:20,height:20,rx:4,fill:"var(--bg-card)",stroke:"var(--status-skip-text)",strokeWidth:1.5}),(0,s.jsxs)("g",{transform:"translate(-5, -5)",children:[(0,s.jsx)("line",{x1:"0",y1:"0",x2:"10",y2:"10",stroke:"var(--status-skip-text)",strokeWidth:"2",strokeLinecap:"round"}),(0,s.jsx)("line",{x1:"10",y1:"0",x2:"0",y2:"10",stroke:"var(--status-skip-text)",strokeWidth:"2",strokeLinecap:"round"})]})]}),!et&&H===e.id&&!(!l&&!n)&&(0,s.jsxs)("g",{transform:"translate(".concat(c,", ").concat(d-12,")"),style:{pointerEvents:"none"},children:[(0,s.jsx)("rect",{x:-22,y:-7,width:44,height:14,rx:7,fill:l?"var(--status-pass-bg)":"var(--status-fail-bg)",stroke:l?"var(--status-pass-text)":"var(--status-fail-text)",strokeWidth:.5}),(0,s.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:i,fontSize:9,fontWeight:500},children:l?"Pass":"Fail"})]})]},e.id)}),O&&(0,s.jsx)("line",{x1:O.startX,y1:O.startY,x2:O.curX,y2:O.curY,stroke:"pass"===O.type?"var(--status-pass-text)":"var(--status-fail-text)",strokeWidth:2,strokeDasharray:"6 4",opacity:.6}),t.map(e=>{var r;let l=S.get(e.id);if(!l)return null;let x=function(e,t){let r=0,s=e;for(;s.parentId;){r++;let e=t.find(e=>e.id===s.parentId);if(!e)break;s=e}return r}(e,t);return(0,s.jsx)(c,{node:e,position:l,isSelected:e.id===o,testCases:null!=(r=a[e.id])?r:[],isDragged:(null==I?void 0:I.id)===e.id,edgeDragActive:null!==O,isEdgeDropTarget:G===e.id&&null!==O&&e.id!==O.fromId,deleteMode:V,isDeleteChecked:J.has(e.id),onSelect:n,onAddChild:(e,t,r,s)=>{i(e,t,r,s)},onDelete:d,onUnlinkNode:m,onRename:v,onUpdateNode:y,onDragStart:eb,onEdgeStart:ev,onToggleDeleteCheck:eg,depth:x,showCounter:es,svgRef:eo},e.id)})]})]}),F&&P&&(0,s.jsx)(b,{position:P,scale:L,pan:D,svgRef:eo,onSubmit:eh,onCancel:()=>B(!1)}),0===t.length&&!F&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsx)(p,{onClick:()=>{if(!eo.current){U({x:0,y:0}),B(!0);return}let e=eo.current.getBoundingClientRect();U({x:e.width/2/L-D.x,y:e.height/2/L-D.y}),B(!0)},rippleColor:"rgba(0,0,0,0.08)",className:"text-sm px-6 py-2.5",style:{color:"var(--text-tertiary)",borderColor:"var(--border)",borderRadius:"var(--radius-pill)",backgroundColor:"transparent"},children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,s.jsx)("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),"Create your first flow node"]})})}),t.length>0&&(0,s.jsx)(h,{nodes:t,positions:S,pan:D,scale:L})]})}function h(e){let{nodes:t,positions:r,pan:a,scale:o}=e,l=Array.from(r.values());if(0===l.length)return null;let n=Math.min(...l.map(e=>e.x)),i=Math.max(...l.map(e=>e.x)),c=Math.min(...l.map(e=>e.y)),d=Math.max(...l.map(e=>e.y)),x=i-n+80,u=d-c+80,p=Math.max(60,u/x*120),m=120/x,h=p/u;return(0,s.jsx)("div",{className:"absolute bottom-3 right-3 border z-10",style:{width:120,height:p,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",borderRadius:"var(--radius-sm)",opacity:.85},children:(0,s.jsx)("svg",{width:120,height:p,children:t.map(e=>{let t=r.get(e.id);if(!t)return null;let a=(t.x-n+40)*m,o=(t.y-c+40)*h;return(0,s.jsx)("circle",{cx:a,cy:o,r:2.5,fill:"var(--accent)",opacity:.6},e.id)})})})}function b(e){let{position:t,scale:r,pan:a,svgRef:o,onSubmit:n,onCancel:i}=e,[c,d]=(0,l.useState)(""),x=(0,l.useRef)(null),u=(0,l.useRef)(null),p=(0,l.useCallback)(()=>{if(!o.current)return{left:"50%",top:"50%"};let e=o.current.getBoundingClientRect();return{left:(t.x+a.x)*r+e.left,top:(t.y+a.y)*r+e.top}},[t,r,a,o])(),m=144*r,h=48*r;return(0,l.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&(c.trim()?n(c):i())};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c,n,i]),(0,s.jsxs)("div",{ref:u,className:"fixed z-50",style:{left:"".concat(p.left,"px"),top:"".concat(p.top,"px"),transform:"translate(-50%, 0)"},children:[(0,s.jsx)("div",{style:{width:2,height:20*r,margin:"0 auto",backgroundColor:"var(--border-hover)"}}),(0,s.jsx)("div",{style:{width:"".concat(m,"px"),height:"".concat(h,"px"),border:"1.5px dashed var(--accent)",borderRadius:4*r,backgroundColor:"var(--bg-card)",display:"flex",alignItems:"center",justifyContent:"center",padding:"".concat(4*r,"px")},children:(0,s.jsx)("input",{ref:x,autoFocus:!0,value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c.trim()&&n(c),"Escape"===e.key&&i(),e.stopPropagation()},onBlur:()=>{c.trim()?n(c):i()},placeholder:"Name node...",className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})})]})}function v(e){return(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsxs)("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Flow Map"}),(0,s.jsxs)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:[e.nodes.length," node",1!==e.nodes.length?"s":""]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("button",{onClick:e.onResetLayout,className:"px-2 py-1 text-[10px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",borderRadius:"var(--radius-sm)"},children:"Reset layout"})]}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:(0,s.jsx)(m,{nodes:e.nodes,edges:e.edges,testCases:e.testCases,selectedNodeId:e.selectedNodeId,onSelect:e.onSelect,onAddNode:e.onAddNode,onDeleteNode:e.onDeleteNode,onDeleteNodes:e.onDeleteNodes,onUnlinkNode:e.onUnlinkNode,onRenameNode:e.onRenameNode,onUpdateNode:e.onUpdateNode,onAddEdge:e.onAddEdge,onDeleteEdge:e.onDeleteEdge,onUpdateEdge:e.onUpdateEdge,canUndo:e.canUndo,canRedo:e.canRedo,onUndo:e.onUndo,onRedo:e.onRedo})})]})}p.displayName="RippleButton";var y=r(6497),f=r(8566),g=r(5815);function j(e){let{value:t,className:r=""}=e,a=Math.max(0,Math.min(100,t));return(0,s.jsx)("div",{className:"h-2 w-full overflow-hidden ".concat(r),style:{backgroundColor:"var(--bg-secondary)",borderRadius:"var(--radius-pill)"},children:(0,s.jsx)("div",{className:"h-full transition-all duration-150 ease-out",style:{width:"".concat(a,"%"),backgroundColor:a>=80?"var(--status-pass-text)":a>=50?"var(--status-skip-text)":"var(--status-fail-text)",borderRadius:"var(--radius-pill)"}})})}function k(e){let{onAdd:t,nodeLabel:r}=e,[a,o]=(0,l.useState)(""),n=(0,l.useRef)(null);(0,l.useEffect)(()=>{var e;null==(e=n.current)||e.focus()},[r]);let i=()=>{a.trim()&&(t(a.trim()),o(""))};return(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{ref:n,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i()},placeholder:'Add test case for "'.concat(r,'"...'),className:"flex-1 px-3 py-2 text-sm bg-transparent outline-none border transition-colors focus:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)"}}),(0,s.jsx)("button",{onClick:i,disabled:!a.trim(),className:"px-4 py-2 text-sm font-medium rounded-md transition-opacity hover:opacity-80 disabled:opacity-30",style:{backgroundColor:"var(--accent)",color:"var(--bg-primary)",borderRadius:"var(--radius-sm)"},children:"+ Add"})]})}let C={untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)",label:"Untested"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)",label:"Pass"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)",label:"Fail"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)",label:"Skip"},blocked:{bg:"var(--status-blocked-bg)",text:"var(--status-blocked-text)",label:"Blocked"}},w=["untested","pass","fail","skip","blocked"];function N(e){let{status:t,onChange:r}=e,a=C[t];return(0,s.jsx)("select",{value:t,onChange:e=>r(e.target.value),className:"text-[11px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer appearance-none",style:{backgroundColor:a.bg,color:a.text,borderRadius:"var(--radius-pill)",minWidth:72},children:w.map(e=>(0,s.jsx)("option",{value:e,children:C[e].label},e))})}function S(e){let{tc:t,visibleCols:r,expandAll:a,selectMode:o,selected:n,onToggleSelect:i,onUpdate:c,onDelete:d,onDragStart:x,onDragOver:u,onDrop:p}=e,[m,h]=(0,l.useState)(null),[b,v]=(0,l.useState)(""),[y,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(null),[k,C]=(0,l.useState)(!1),w=(0,l.useRef)(null);(0,l.useEffect)(()=>{m&&w.current&&w.current.focus()},[m]);let S=e=>{var r;v(null!=(r=t[e])?r:""),h(e)},D=()=>{m&&(c({[m]:b}),h(null))},L=e=>{c({status:e})},M=e=>{if("Enter"===e.key&&"steps"!==m&&D(),"Escape"===e.key&&(h(null),v("")),"Tab"===e.key){e.preventDefault(),D();let t=r.filter(e=>"status"!==e.key&&"code"!==e.key).map(e=>e.key),s=t.indexOf(m),a=e.shiftKey?t[s-1]:t[s+1];a&&S(a)}},R=e=>{let r=t[e];return r&&r.length>40};return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("tr",{className:"group transition-colors",style:{backgroundColor:n?"rgba(111,78,55,0.06)":y?"var(--bg-secondary)":"transparent"},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),draggable:!0,onDragStart:x,onDragOver:u,onDrop:p,children:[o&&(0,s.jsx)("td",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,s.jsx)("input",{type:"checkbox",checked:n,onChange:i,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),r.map(e=>(0,s.jsx)("td",{className:"px-2 py-1.5 text-xs border-b",style:{borderColor:"var(--border)",color:"var(--text-primary)",maxWidth:"steps"===e.key||"expected"===e.key?300:void 0,minWidth:"code"===e.key?60:void 0},children:"status"===e.key?(0,s.jsx)(N,{status:t.status,onChange:L}):"code"===e.key?(0,s.jsx)("span",{className:"font-mono text-[10px] cursor-pointer hover:underline transition-colors",style:{color:k?"var(--accent)":"var(--text-tertiary)"},onClick:e=>{e.stopPropagation(),t.code&&navigator.clipboard.writeText(t.code).then(()=>{C(!0),setTimeout(()=>C(!1),1500)})},title:"Click to copy",children:k?"Copied!":t.code||"—"}):"case_type"===e.key?(0,s.jsx)(E,{value:t.case_type||"General",onChange:e=>c({case_type:e})}):m===e.key?"steps"===e.key||"expected"===e.key||"notes"===e.key||"links"===e.key?(0,s.jsx)("textarea",{ref:w,value:b,onChange:e=>v(e.target.value),onBlur:D,onKeyDown:M,className:"w-full bg-transparent outline-none border rounded p-1 text-xs resize-none",style:{borderColor:"var(--accent)",color:"var(--text-primary)",minHeight:60},rows:3}):(0,s.jsx)("input",{ref:w,value:b,onChange:e=>v(e.target.value),onBlur:D,onKeyDown:M,className:"w-full bg-transparent outline-none border-b text-xs",style:{borderColor:"var(--accent)",color:"var(--text-primary)"}}):"links"===e.key?(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[t.links?t.links.split(",").map((e,r)=>{let a=e.trim();return a?(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline hover:opacity-80 transition-opacity",style:{color:"var(--accent)"},onClick:e=>e.stopPropagation(),children:a.length>30?a.slice(0,30)+"...":a}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),c({links:t.links.split(",").map(e=>e.trim()).filter(e=>e!==a).join(", ")})},className:"text-[10px] opacity-0 group-hover:opacity-100 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},title:"Remove link",children:"\xd7"})]},r):null}):null,(0,s.jsx)("span",{className:"cursor-text text-[11px] opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>S(e.key),style:{color:"var(--text-tertiary)"},children:t.links?"+ Add link":"Add link..."})]}):(0,s.jsx)("span",{className:"cursor-text block",onClick:()=>{R(e.key)&&(g===e.key?j(null):j(e.key))},onDoubleClick:()=>S(e.key),title:R(e.key)?g===e.key||a?"Click to collapse \xb7 Double-click to edit":"Click to expand \xb7 Double-click to edit":"Double-click to edit",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:g===e.key||a&&R(e.key)?"pre-wrap":"nowrap",display:"block",maxHeight:g===e.key||a&&R(e.key)?"none":"1.2em",lineHeight:"1.2em"},children:t[e.key]||(0,s.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"—"})})},e.key)),(0,s.jsx)("td",{className:"px-1 py-1.5 border-b",style:{borderColor:"var(--border)"},children:y&&(0,s.jsx)("button",{onClick:d,className:"text-[10px] opacity-50 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},children:"\xd7"})})]})})}let D={Positive:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},Negative:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},General:{bg:"var(--bg-secondary)",text:"var(--text-tertiary)"}};function E(e){let{value:t,onChange:r}=e,a=D[t]||D.General;return(0,s.jsx)("select",{value:t,onChange:e=>r(e.target.value),className:"text-[10px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer",style:{backgroundColor:a.bg,color:a.text},children:f.D_.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})}function L(e){let{testCases:t,columns:r,expandAll:a,selectMode:o,selectedIds:n,onToggleSelect:i,onToggleSelectAll:c,sortKey:d,sortDirection:x,onSortChange:u,onUpdate:p,onDelete:m,onReorder:h,onAddColumn:b,onOpenColumns:v}=e,[y,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(""),k=(0,l.useRef)(null);(0,l.useEffect)(()=>{y&&k.current&&k.current.focus()},[y]);let C=()=>{g.trim()&&b&&b(g.trim()),j(""),f(!1)},w=r.filter(e=>e.visible),N=t.length>0&&t.every(e=>n.has(e.id)),D=t.some(e=>n.has(e.id)),E=e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"};return 0===t.length?null:(0,s.jsx)("div",{className:"overflow-x-auto",style:{minWidth:0},children:(0,s.jsxs)("table",{className:"text-xs",style:{minWidth:"900px",width:"100%"},children:[(0,s.jsx)("thead",{className:"sticky top-0 z-10",style:{backgroundColor:"var(--bg-primary)"},children:(0,s.jsxs)("tr",{children:[o&&(0,s.jsx)("th",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,s.jsx)("input",{type:"checkbox",checked:N,ref:e=>{e&&(e.indeterminate=D&&!N)},onChange:c,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),w.map(e=>(0,s.jsx)("th",{className:"px-2 py-1.5 text-left text-[10px] font-medium uppercase tracking-wider border-b cursor-pointer select-none hover:bg-[var(--bg-secondary)] transition-colors",style:{color:"var(--text-tertiary)",borderColor:"var(--border)",whiteSpace:"nowrap",minWidth:"code"===e.key?60:void 0},onClick:()=>u(e.key),children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:e.label}),d===e.key&&(0,s.jsx)("span",{className:"text-[8px]",children:"asc"===x?"↑":"↓"})]})},e.key)),(0,s.jsx)("th",{className:"w-8 border-b",style:{borderColor:"var(--border)"},children:y?(0,s.jsx)("input",{ref:k,value:g,onChange:e=>j(e.target.value),onKeyDown:e=>{"Enter"===e.key&&C(),"Escape"===e.key&&(f(!1),j(""))},onBlur:C,placeholder:"Name...",className:"w-16 px-1 py-0.5 text-[10px] rounded border outline-none",style:{borderColor:"var(--accent)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"}}):(0,s.jsx)("button",{onClick:()=>f(!0),className:"w-5 h-5 flex items-center justify-center rounded text-[10px] transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"var(--text-tertiary)"},title:"Add column",children:"+"})})]})}),(0,s.jsx)("tbody",{children:t.map(e=>(0,s.jsx)(S,{tc:e,visibleCols:w,expandAll:a,selectMode:o,selected:n.has(e.id),onToggleSelect:()=>i(e.id),onUpdate:t=>p(e.id,t),onDelete:()=>m(e.id),onDragStart:t=>{var r;return r=e.id,void(t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="move")},onDragOver:E,onDrop:r=>((e,r)=>{e.preventDefault();let s=e.dataTransfer.getData("text/plain");if(s===r)return;let a=t.map(e=>e.id),o=a.indexOf(s),l=a.indexOf(r);if(-1===o||-1===l)return;let n=[...a];n.splice(o,1),n.splice(l,0,s),h(n)})(r,e.id)},e.id))})]})})}function M(e){var t;let{stats:r,fullscreen:a,nodes:o,allTestCases:n,selectedNodeId:i,onSelectNode:c}=e,[d,x]=(0,l.useState)(!1),u=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!d)return;let e=e=>{u.current&&!u.current.contains(e.target)&&x(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[d]),(0,s.jsxs)("div",{className:"flex items-center gap-4 px-4 py-2 text-xs border-t flex-wrap relative",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,s.jsxs)("span",{children:["Total: ",(0,s.jsx)("strong",{style:{color:"var(--text-primary)"},children:r.total})]}),(0,s.jsxs)("span",{children:["Pass: ",(0,s.jsx)("strong",{style:{color:"var(--status-pass-text)"},children:r.pass}),r.total>0&&" (".concat(r.passRate,"%)")]}),(0,s.jsxs)("span",{children:["Fail: ",(0,s.jsx)("strong",{style:{color:"var(--status-fail-text)"},children:r.fail})]}),(0,s.jsxs)("span",{children:["Skip: ",(0,s.jsx)("strong",{style:{color:"var(--status-skip-text)"},children:r.skip})]}),(0,s.jsxs)("span",{children:["Untested: ",(0,s.jsx)("strong",{style:{color:"var(--status-untested-text)"},children:r.untested})]}),(0,s.jsxs)("span",{children:["Blocked: ",(0,s.jsx)("strong",{style:{color:"var(--status-blocked-text)"},children:r.blocked})]}),a&&o&&o.length>0&&(0,s.jsxs)("div",{className:"ml-auto relative",ref:u,children:[(0,s.jsxs)("button",{onClick:()=>x(e=>!e),className:"flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,s.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("polyline",{points:"8 12 12 16 16 12"}),(0,s.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16"})]}),(null==(t=o.find(e=>e.id===i))?void 0:t.label)||"Jump to node",(0,s.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:d?"rotate(180deg)":"none",transition:"transform 150ms"},children:(0,s.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),d&&(0,s.jsx)("div",{className:"absolute z-50 bottom-full right-0 mb-1 w-56 max-h-[240px] overflow-y-auto rounded-lg border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeInUp 150ms ease-out"},children:o.map(e=>{var t;let r=null!=(t=null==n?void 0:n[e.id])?t:[],a=e.id===i,o=r.filter(e=>"pass"===e.status).length,l=r.filter(e=>"fail"===e.status).length;return(0,s.jsxs)("button",{onClick:()=>{null==c||c(e.id),x(!1)},className:"w-full flex items-center justify-between px-3 py-2 text-[11px] text-left transition-colors hover:bg-[var(--bg-secondary)]",style:{backgroundColor:a?"var(--bg-secondary)":"transparent",borderLeft:a?"2px solid var(--accent)":"2px solid transparent"},children:[(0,s.jsx)("span",{className:"truncate font-medium",style:{color:a?"var(--accent)":"var(--text-primary)"},children:e.label}),(0,s.jsx)("span",{className:"flex items-center gap-1.5 flex-shrink-0 ml-2",children:r.length>0&&(0,s.jsxs)(s.Fragment,{children:[l>0&&(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)",fontSize:9},children:[l,"f"]}),o>0&&(0,s.jsxs)("span",{style:{color:"var(--status-pass-text)",fontSize:9},children:[o,"p"]}),(0,s.jsx)("span",{className:"font-mono",style:{color:"var(--text-tertiary)",fontSize:9},children:r.length})]})})]},e.id)})})]})]})}var R=r(158);function A(e){let{open:t,onClose:r,node:a,testCases:o,columns:l}=e,n=l&&l.length>0?l:f._X;return t?(0,s.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,children:(0,s.jsxs)("div",{className:"w-full max-w-sm mx-4 rounded-xl p-5",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Export Test Cases"}),(0,s.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["Export “",a.label,"” (",o.length," case",1!==o.length?"s":"",")"]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("button",{onClick:()=>{(0,R.k5)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Markdown (.md)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Formatted table for documentation"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,R.hX)(a,o),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"JSON (.json)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Structured data backup"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,R.Rz)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"CSV (.csv)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Spreadsheet-compatible format"})]}),(0,s.jsxs)("button",{onClick:async()=>{await (0,R.G$)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Excel (.xlsx)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Styled spreadsheet for reporting"})]})]}),(0,s.jsx)("button",{onClick:r,className:"w-full mt-3 px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]})}):null}var T=r(7711),z=r(7669);async function I(e){var t;let r=URL.createObjectURL(e),s=document.createElement("video");s.muted=!0,s.preload="auto",s.crossOrigin="anonymous",await new Promise((e,t)=>{s.onloadedmetadata=()=>e(),s.onerror=()=>t(Error("Failed to load video")),s.src=r}),await s.play().catch(()=>{}),s.pause();let a=s.duration;if(!isFinite(a)||a<=0)throw URL.revokeObjectURL(r),Error("Could not determine video duration");let o=Math.min(a<=10?4:8,Math.ceil(a)),l=[];for(let e=0;e<o;e++){let t=.1+e/o*(a-.2);l.push(Math.min(t,a-.05))}let n=document.createElement("canvas"),i=n.getContext("2d"),c=[];for(let e of l){await function(e,t){return new Promise(r=>{let s=()=>{e.removeEventListener("seeked",s),requestAnimationFrame(()=>r())};e.addEventListener("seeked",s),e.currentTime=t})}(s,e);let t=function(e,t,r){let{videoWidth:s,videoHeight:a}=e,o=s>1280?1280/s:1;return t.width=Math.round(s*o),t.height=Math.round(a*o),r.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg",.82)}(s,n,i);c.push(t)}return URL.revokeObjectURL(r),{frames:c,duration:a,thumbnail:null!=(t=c[0])?t:""}}let W=["User can log in with valid credentials","Invalid input shows validation error","Form submits successfully and redirects","Edge case: empty required fields"],F=["While you wait... have this cute cat!","Hang tight! Here's a furry friend.","Generating... enjoy this kitty!","Almost there! Cat says hi.","Test cases incoming... meow!"];function B(e){let{open:t,onClose:r,node:a,onGenerate:o}=e,{isConnected:n,activeProvider:i,activeProviderId:c}=(0,z.P)(),[d,x]=(0,l.useState)(""),[u,p]=(0,l.useState)(""),[m,h]=(0,l.useState)("en"),[b,v]=(0,l.useState)(!1),[y,f]=(0,l.useState)(!1),[g,j]=(0,l.useState)(null),[k,C]=(0,l.useState)([]),[w,N]=(0,l.useState)(""),[S,D]=(0,l.useState)(F[0]),[E,L]=(0,l.useState)(0),M=(0,l.useRef)(null),R=(0,l.useRef)(null),A=(0,l.useRef)(null),[B,P]=(0,l.useState)(!1),[U,O]=(0,l.useState)(!1),[X,H]=(0,l.useState)(null),[K,G]=(0,l.useState)([]),[Y,V]=(0,l.useState)(new Set),[_,J]=(0,l.useState)(!1),[q,Z]=(0,l.useState)(null),$=(0,l.useCallback)(async()=>{try{var e;let t=await fetch("https://api.thecatapi.com/v1/images/search?size=med"),r=await t.json();(null==r||null==(e=r[0])?void 0:e.url)&&N(r[0].url)}catch(e){N("")}D(F[Math.floor(Math.random()*F.length)])},[]);(0,l.useEffect)(()=>{t&&(x(a.label),p(""),j(null),f(!1),C([]),G([]),V(new Set),J(!1),N(""),L(0))},[t,a.label]),(0,l.useEffect)(()=>{if(!y)return;$();let e=setInterval(()=>{L(e=>e+1),$()},2e3);return()=>clearInterval(e)},[y,$]);let Q=e=>new Promise((t,r)=>{if(!e.type.startsWith("image/"))return void r(Error("Not an image file"));if(e.size>5242880)return void r(Error("Image too large (max ".concat(5,"MB)")));let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>r(Error("Failed to read file")),s.readAsDataURL(e)}),ee=(0,l.useCallback)(async e=>{if(!e.type.startsWith("video/"))return void j("Not a video file");if(e.size>0x3200000)return void j("Video too large (max ".concat(50,"MB)"));O(!0),H("Loading video...");try{let t=await I(e);if(t.duration>120){j("Video too long (".concat(Math.round(t.duration),"s). Max ").concat(120,"s.")),O(!1),H(null);return}H("Extracted ".concat(t.frames.length," frames. Select which to include...")),G(t.frames),V(new Set(t.frames.map((e,t)=>t))),J(!0),j(null)}catch(e){j(e instanceof Error?e.message:"Failed to process video")}finally{O(!1),H(null)}},[]),et=(0,l.useCallback)(()=>{let e=5-k.length,t=K.filter((e,t)=>Y.has(t)).slice(0,e);t.length>0&&C(e=>[...e,...t]),G([]),V(new Set),J(!1)},[K,Y,k.length]),er=(0,l.useCallback)(()=>{G([]),V(new Set),J(!1)},[]),es=(0,l.useCallback)(e=>{V(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.size<5&&r.add(e),r})},[]),ea=(0,l.useCallback)(()=>{V(new Set(Array.from({length:Math.min(K.length,5)},(e,t)=>t)))},[K]),eo=(0,l.useCallback)(()=>{V(new Set)},[]),el=(0,l.useCallback)(async e=>{let t=5-k.length;if(t<=0)return void j("Maximum ".concat(5," images/frames allowed"));let r=Array.from(e),s=r.filter(e=>e.type.startsWith("image/")),a=r.filter(e=>e.type.startsWith("video/")),o=s.slice(0,t),l=[];for(let e of o)try{let t=await Q(e);l.push(t)}catch(e){j(e instanceof Error?e.message:"Failed to load image")}l.length>0&&(C(e=>[...e,...l]),j(null)),a.length>0&&await ee(a[0])},[k.length,ee]),en=(0,l.useCallback)(e=>{C(t=>t.filter((t,r)=>r!==e))},[]);(0,l.useEffect)(()=>{if(!t)return;let e=e=>{var t;let r=null==(t=e.clipboardData)?void 0:t.items;if(!r)return;let s=[];for(let e of Array.from(r))if(e.type.startsWith("image/")){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),el(s))};return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[t,el]);let ei=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),P(!0)},[]),ec=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),P(!1)},[]),ed=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),P(!1),e.dataTransfer.files.length>0&&el(e.dataTransfer.files)},[el]);(0,l.useCallback)(async e=>{await ee(e)},[ee]);let ex=(0,l.useCallback)(e=>{e.target.files&&e.target.files.length>0&&(el(e.target.files),e.target.value="")},[el]),eu=async()=>{if(!n)return void j("Please configure an AI provider in Integrations first.");if(!u.trim()&&0===k.length)return void j("Please describe the feature, paste a ticket, or attach an image.");f(!0),j(null);try{let e=await (0,T.Z7)(d,u,i.apiKey,null!=c?c:void 0,i.defaultModel,m,i.baseURL||void 0,k.length>0?k:void 0);o(e),r()}catch(e){j(e instanceof Error?e.message:"Generation failed")}finally{f(!1)}};return t?(0,s.jsxs)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,children:[(0,s.jsxs)("div",{className:"flex rounded-xl overflow-hidden",style:{maxWidth:y?"720px":"512px",width:"100%",margin:"0 16px",backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",transition:"max-width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",style:{maxWidth:"512px"},children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)"},children:(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,s.jsx)("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Generate Test Cases"})]}),(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Describe the feature and let AI generate test cases for “",a.label,"”"]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Test Case Title"}),(0,s.jsx)("input",{value:d,onChange:e=>x(e.target.value),className:"w-full px-3 py-2 text-sm rounded-lg outline-none border transition-colors focus:border-[var(--accent)]",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},placeholder:"Feature name..."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Description / DoD / Ticket"}),(0,s.jsx)("textarea",{value:u,onChange:e=>p(e.target.value),rows:4,className:"w-full px-3 py-2 text-sm rounded-lg outline-none border resize-none transition-colors focus:border-[var(--accent)]",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},placeholder:"id"===m?"Jelaskan fitur, kriteria penerimaan, atau tempel tiket...":"Describe the feature, acceptance criteria, or paste a ticket..."}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:W.map(e=>(0,s.jsxs)("button",{onClick:()=>p(t=>t?"".concat(t,"\n").concat(e):e),className:"px-2 py-0.5 text-[10px] rounded-full border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["+ ",e]},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:["Screenshots & Videos ",(0,s.jsx)("span",{className:"font-normal",style:{color:"var(--text-tertiary)"},children:"(optional)"})]}),k.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:k.map((e,t)=>(0,s.jsxs)("div",{className:"relative group rounded-lg overflow-hidden border",style:{borderColor:"var(--border)",width:72,height:72},children:[(0,s.jsx)("img",{src:e,alt:"Screenshot ".concat(t+1),className:"w-full h-full object-cover"}),(0,s.jsx)("button",{onClick:()=>en(t),className:"absolute top-0.5 right-0.5 w-5 h-5 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"rgba(0,0,0,0.7)",color:"#fff"},title:"Remove",children:(0,s.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},t))}),(0,s.jsx)("div",{ref:A,onDragOver:ei,onDragLeave:ec,onDrop:ed,onClick:()=>{var e;return null==(e=M.current)?void 0:e.click()},className:"rounded-lg border-2 border-dashed cursor-pointer transition-colors",style:{borderColor:B?"var(--accent)":"var(--border)",backgroundColor:B?"var(--accent)08":"transparent",padding:k.length>0?"8px":"16px"},children:(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,s.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,s.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:k.length>0?"Add more (".concat(k.length,"/").concat(5,") \xb7 paste, drop, or click"):"Paste from clipboard, drop, or click to upload"})]})}),!_&&k.length<5&&(0,s.jsx)("div",{className:"mt-2",children:U?(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsx)("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",children:(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),(0,s.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:X})]}):(0,s.jsxs)("button",{type:"button",onClick:e=>{var t;e.stopPropagation(),null==(t=R.current)||t.click()},className:"flex items-center gap-2 px-3 py-1.5 text-[11px] rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:[(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polygon",{points:"23 7 16 12 23 17 23 7"}),(0,s.jsx)("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),"Upload video (extract key frames)"]})}),_&&K.length>0&&(0,s.jsxs)("div",{className:"mt-2 p-3 rounded-lg border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("span",{className:"text-[11px] font-medium",style:{color:"var(--text-secondary)"},children:["Select frames ",(0,s.jsxs)("span",{style:{color:"var(--text-tertiary)"},children:["(",Y.size,"/",5," max)"]})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:ea,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"All"}),(0,s.jsx)("button",{type:"button",onClick:eo,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"None"})]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:K.map((e,t)=>(0,s.jsxs)("div",{className:"relative group rounded-md overflow-hidden border-2 transition-all cursor-pointer",style:{width:80,height:80,borderColor:Y.has(t)?"var(--accent)":"var(--border)",opacity:Y.has(t)?1:.5},children:[(0,s.jsx)("button",{type:"button",onClick:()=>es(t),className:"w-full h-full",children:(0,s.jsx)("img",{src:e,alt:"Frame ".concat(t+1),className:"w-full h-full object-cover"})}),(0,s.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),Z(e)},className:"absolute top-0.5 left-0.5 w-6 h-6 rounded flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"rgba(0,0,0,0.7)",color:"#fff"},title:"Zoom",children:(0,s.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),(0,s.jsx)("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),(0,s.jsx)("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),Y.has(t)&&(0,s.jsx)("div",{className:"absolute top-0.5 right-0.5 w-5 h-5 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--accent)",color:"#fff"},children:(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,s.jsx)("span",{className:"absolute bottom-0 left-0 right-0 text-center text-[9px] py-0.5",style:{backgroundColor:"rgba(0,0,0,0.6)",color:"#fff"},children:t+1})]},t))}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:er,className:"flex-1 px-3 py-1.5 text-[11px] rounded-md border transition-colors hover:bg-[var(--bg-card)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsxs)("button",{type:"button",onClick:et,disabled:0===Y.size,className:"flex-1 px-3 py-1.5 text-[11px] rounded-md transition-colors hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",style:{backgroundColor:"var(--accent)",color:"#fff"},children:["Add ",Y.size," frame",1!==Y.size?"s":""]})]})]}),(0,s.jsx)("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ex}),(0,s.jsx)("input",{ref:R,type:"file",accept:"video/*",className:"hidden",onChange:async e=>{var t;let r=null==(t=e.target.files)?void 0:t[0];r&&(await ee(r),e.target.value="")}})]}),g&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:g}),!n&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-skip-bg)",color:"var(--status-skip-text)"},children:"No AI provider configured. Go to Integrations to set up."}),(0,s.jsxs)("div",{className:"rounded-lg border overflow-hidden",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("button",{onClick:()=>v(e=>!e),className:"w-full flex items-center justify-between px-3 py-2 transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Language"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[10px] font-mono font-semibold px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:"en"===m?"EN":"ID"}),(0,s.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:b?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms ease-out"},children:(0,s.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),(0,s.jsx)("div",{style:{maxHeight:b?"80px":"0px",overflow:"hidden",transition:"max-height 200ms ease-out"},children:(0,s.jsx)("div",{className:"px-3 pb-2 pt-1",children:(0,s.jsxs)("select",{value:m,onChange:e=>{h(e.target.value),v(!1)},className:"w-full px-2.5 py-1.5 text-xs rounded-md border outline-none transition-colors cursor-pointer",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},children:[(0,s.jsx)("option",{value:"en",children:"English"}),(0,s.jsx)("option",{value:"id",children:"Bahasa Indonesia"})]})})})]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:r,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:eu,disabled:y||!n,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg transition-all hover:opacity-90 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)",color:"#fff",boxShadow:"0 2px 8px rgba(141,110,99,0.3)"},children:y?(0,s.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),"Generating..."]}):"Generate Test Cases"})]})]}),(0,s.jsx)("div",{className:"flex-shrink-0 overflow-hidden",style:{width:y?"280px":"0px",transition:"width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,s.jsxs)("div",{className:"w-[280px] h-full flex flex-col items-center justify-center p-5 border-l",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)",opacity:+!!y,transition:"opacity 300ms ease-out 100ms"},children:[(0,s.jsx)("div",{className:"w-full rounded-xl overflow-hidden mb-4 border",style:{borderColor:"var(--border)",height:180,backgroundColor:"var(--bg-card)"},children:w&&(0,s.jsx)("img",{src:w,alt:"Cute cat",width:280,height:180,className:"w-full h-full object-cover",style:{animation:"fadeIn 800ms ease-out"},onError:e=>{e.target.style.display="none"}},E)}),(0,s.jsx)("p",{className:"text-xs text-center mb-3",style:{color:"var(--text-secondary)",animation:"fadeIn 800ms ease-out"},children:S}),(0,s.jsx)("button",{onClick:$,className:"px-3 py-1.5 text-[10px] rounded-full border transition-colors hover:bg-[var(--bg-card)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"New cat"})]})})]}),q&&(0,s.jsx)("div",{className:"fixed inset-0 z-[400] flex items-center justify-center p-8",style:{backgroundColor:"rgba(0,0,0,0.85)",animation:"fadeIn 150ms ease-out"},onClick:e=>{e.stopPropagation(),Z(null)},children:(0,s.jsxs)("div",{className:"relative max-w-4xl max-h-full",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("img",{src:q,alt:"Frame preview",className:"max-w-full max-h-[80vh] object-contain rounded-lg",style:{boxShadow:"0 8px 32px rgba(0,0,0,0.5)"}}),(0,s.jsx)("button",{onClick:()=>Z(null),className:"absolute -top-2 -right-2 w-8 h-8 rounded-full flex items-center justify-center transition-colors hover:opacity-80",style:{backgroundColor:"var(--bg-card)",color:"var(--text-primary)",boxShadow:"var(--shadow-lg)"},children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})]}):null}let P={pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"},untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"},blocked:{bg:"var(--status-blocked-bg)",text:"var(--status-blocked-text)"}};function U(e){let{open:t,onClose:r,node:a,testCases:l,stats:n}=e;return t?(0,s.jsxs)("div",{style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,className:"jsx-540c0278eef48442 fixed inset-0 z-[300] flex items-center justify-center",children:[(0,s.jsxs)("div",{style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)",animation:"fadeInUp 200ms ease-out"},onClick:e=>e.stopPropagation(),className:"jsx-540c0278eef48442 w-full max-w-lg mx-4 rounded-xl overflow-hidden",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 px-5 pt-5 pb-4 border-b",children:[(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center justify-between mb-2",children:[(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center gap-2",children:[a.code&&(0,s.jsx)("span",{style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-mono px-1.5 py-0.5 rounded",children:a.code}),(0,s.jsx)("h3",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-sm font-semibold",children:a.label})]}),(0,s.jsx)("button",{onClick:r,style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),a.notes&&(0,s.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:a.notes})]}),(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 grid grid-cols-4 gap-3 p-5",children:[(0,s.jsx)(O,{label:"Total",value:n.total}),(0,s.jsx)(O,{label:"Pass",value:n.pass,color:"var(--status-pass-text)"}),(0,s.jsx)(O,{label:"Fail",value:n.fail,color:"var(--status-fail-text)"}),(0,s.jsx)(O,{label:"Blocked",value:n.blocked,color:"var(--status-blocked-text)"}),(0,s.jsx)(O,{label:"Untested",value:n.untested,color:"var(--status-untested-text)"})]}),(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,s.jsxs)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 flex items-center justify-between text-[10px] mb-1.5",children:[(0,s.jsx)("span",{className:"jsx-540c0278eef48442",children:"Pass Rate"}),(0,s.jsxs)("span",{style:{color:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)",fontWeight:600},className:"jsx-540c0278eef48442",children:[n.passRate,"%"]})]}),(0,s.jsx)("div",{style:{backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 h-2 w-full rounded-full overflow-hidden",children:(0,s.jsx)("div",{style:{width:"".concat(n.passRate,"%"),backgroundColor:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"},className:"jsx-540c0278eef48442 h-full rounded-full transition-all duration-500"})})]}),l.length>0&&(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,s.jsx)("h4",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-semibold uppercase tracking-wider mb-2",children:"Test Cases"}),(0,s.jsx)("div",{className:"jsx-540c0278eef48442 space-y-1.5 max-h-48 overflow-y-auto",children:l.map(e=>{let t=P[e.status]||P.untested;return(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 flex items-center gap-2 px-3 py-2 rounded-lg border",children:[(0,s.jsx)("span",{style:{backgroundColor:t.bg,color:t.text},className:"jsx-540c0278eef48442 text-[9px] font-mono px-1.5 py-0.5 rounded-full flex-shrink-0",children:e.status}),(0,s.jsx)("span",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-[11px] flex-1 truncate",children:e.title}),e.code&&(0,s.jsx)("span",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[9px] font-mono flex-shrink-0",children:e.code})]},e.id)})})]}),0===l.length&&(0,s.jsx)("div",{className:"jsx-540c0278eef48442 px-5 pb-5 text-center",children:(0,s.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:"No test cases for this node yet."})}),(0,s.jsx)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 px-5 py-3 border-t",children:(0,s.jsx)("button",{onClick:r,style:{borderColor:"var(--border)",color:"var(--text-secondary)"},className:"jsx-540c0278eef48442 w-full px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-card)]",children:"Close"})})]}),(0,s.jsx)(o(),{id:"540c0278eef48442",children:"@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeInUp{from{opacity:0;transform:translatey(12px)}to{opacity:1;transform:translatey(0)}}"})]}):null}function O(e){let{label:t,value:r,color:a}=e;return(0,s.jsxs)("div",{className:"text-center p-2 rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("div",{className:"text-[10px] mb-0.5",style:{color:"var(--text-tertiary)"},children:t}),(0,s.jsx)("div",{className:"text-lg font-semibold",style:{color:null!=a?a:"var(--text-primary)"},children:r})]})}function X(e){let t=[],r="",s=!1;for(let a=0;a<e.length;a++){let o=e[a];s?'"'===o?a+1<e.length&&'"'===e[a+1]?(r+='"',a++):s=!1:r+=o:'"'===o?s=!0:","===o?(t.push(r),r=""):r+=o}return t.push(r),t}function H(e){let{open:t,onClose:r,onImport:a,nodeLabel:o}=e,[n,i]=(0,l.useState)("csv"),[c,d]=(0,l.useState)(null),[x,u]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),h=(0,l.useRef)(null),b=()=>{d(null),u(null),m(!1)},v=(0,l.useCallback)(e=>{d(null),u(null);let t=new FileReader;t.onload=()=>{try{let r=t.result,s=e.name.endsWith(".json")||"application/json"===e.type?function(e){let t=JSON.parse(e),r=Array.isArray(t)?t:t.testCases||t.test_cases||t.cases;if(!Array.isArray(r))throw Error('JSON must be an array of test cases, or an object with a "testCases" array');let s=[];for(let e of r){if("string"==typeof e){e.trim()&&s.push({title:e.trim(),steps:"",expected:""});continue}if("object"!=typeof e||!e)continue;let t=e.title||e.name||e.testCase||e["test case"]||"";t&&"string"==typeof t&&s.push({title:t.trim(),steps:String(e.steps||e.instructions||"").trim(),expected:String(e.expected||e["expected result"]||e.result||"").trim()})}if(0===s.length)throw Error("No valid test cases found in JSON");return s}(r):function(e){let t=e.split("\n").map(e=>e.trim()).filter(e=>e.length>0);if(t.length<2)throw Error("CSV must have a header row and at least one data row");let r=X(t[0]).map(e=>e.toLowerCase().trim()),s=r.findIndex(e=>"title"===e||"test case"===e||"testcase"===e||"name"===e||"test case title"===e),a=r.findIndex(e=>"steps"===e||"test steps"===e||"step"===e||"instructions"===e),o=r.findIndex(e=>"expected"===e||"expected result"===e||"expected results"===e||"result"===e);if(-1===s)throw Error('Could not find a "title" or "test case" column in the CSV header');let l=[];for(let e=1;e<t.length;e++){let r=X(t[e]),n=(r[s]||"").trim();n&&l.push({title:n,steps:a>=0?(r[a]||"").trim():"",expected:o>=0?(r[o]||"").trim():""})}if(0===l.length)throw Error("No valid test cases found in CSV");return l}(r);u(s)}catch(e){d(e instanceof Error?e.message:"Failed to parse file")}},t.onerror=()=>d("Failed to read file"),t.readAsText(e)},[]);return t?(0,s.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:()=>{b(),r()},children:(0,s.jsxs)("div",{className:"w-full max-w-lg mx-4 rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Import Test Cases"}),(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Import test cases into “",o,"” from CSV or JSON"]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,s.jsxs)("div",{className:"text-[11px] rounded-lg px-3 py-2",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Supported formats:"}),(0,s.jsxs)("ul",{className:"space-y-0.5 ml-3",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"CSV:"})," Header row with columns: title, steps, expected (or similar names)"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"JSON:"}),' Array of objects with "title", "steps", "expected" fields']})]})]}),(0,s.jsx)("div",{onDragOver:e=>{e.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{e.preventDefault(),m(!1);let t=e.dataTransfer.files[0];t&&v(t)},onClick:()=>{var e;return null==(e=h.current)?void 0:e.click()},className:"border-2 border-dashed rounded-lg cursor-pointer transition-colors py-8",style:{borderColor:p?"var(--accent)":"var(--border)",backgroundColor:p?"var(--accent)08":"transparent"},children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),(0,s.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,s.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Drop a .csv or .json file here, or click to browse"})]})}),(0,s.jsx)("input",{ref:h,type:"file",accept:".csv,.json",className:"hidden",onChange:e=>{var t;let r=null==(t=e.target.files)?void 0:t[0];r&&v(r),e.target.value=""}}),c&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:c}),x&&x.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:["Preview (",x.length," test case",1!==x.length?"s":"",")"]}),(0,s.jsx)("button",{onClick:()=>u(null),className:"text-[10px] px-1.5 py-0.5 rounded border hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"Clear"})]}),(0,s.jsxs)("div",{className:"max-h-[200px] overflow-auto rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("table",{className:"text-[11px] w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"#"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Title"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Steps"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Expected"})]})}),(0,s.jsx)("tbody",{children:x.slice(0,20).map((e,t)=>(0,s.jsxs)("tr",{className:"border-t",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-tertiary)"},children:t+1}),(0,s.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-primary)"},children:e.title}),(0,s.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:e.steps||"—"}),(0,s.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:e.expected||"—"})]},t))})]}),x.length>20&&(0,s.jsxs)("div",{className:"px-2 py-1 text-[10px] border-t",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["...and ",x.length-20," more"]})]})]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:()=>{b(),r()},className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsxs)("button",{onClick:()=>{x&&0!==x.length&&(a(x),b(),r())},disabled:!x||0===x.length,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg transition-all hover:opacity-90 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)",color:"#fff"},children:["Import ",x?"(".concat(x.length,")"):""]})]})]})}):null}function K(e){var t;let{testCases:r,projectId:a,onClose:o}=e,{e2e:n,testCases:c}=(0,i.M)(),[d,x]=(0,l.useState)(n.config.baseUrl),[u,p]=(0,l.useState)(n.config.browser),[m,h]=(0,l.useState)(n.config.headless),[b,v]=(0,l.useState)(n.config.timeout),[y,f]=(0,l.useState)("runner"),[g,j]=(0,l.useState)(!1),[k,C]=(0,l.useState)(!1),[w,N]=(0,l.useState)([]),[S,D]=(0,l.useState)(null),[E,L]=(0,l.useState)([]),[M,R]=(0,l.useState)([]),[A,T]=(0,l.useState)(null),[z,I]=(0,l.useState)(!0),[W,F]=(0,l.useState)(22),[B,P]=(0,l.useState)(!0),U=(0,l.useRef)(!1),O=(0,l.useRef)(null),[X,H]=(0,l.useState)(""),[K,G]=(0,l.useState)(!1),[Y,V]=(0,l.useState)({}),[_,J]=(0,l.useState)(null),[q,Z]=(0,l.useState)(""),[$,Q]=(0,l.useState)(null),[ee,et]=(0,l.useState)(null),er=(0,l.useRef)(null),es=(0,l.useRef)(null),[ea,eo]=(0,l.useState)(new Set(r.map(e=>e.id))),[el,en]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=()=>{let e=window.innerWidth>=768;en(e),e?(P(!0),I(!0)):(P(!1),I(!1))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let ei=(0,l.useCallback)(e=>{e.preventDefault(),U.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";let t=e=>{if(!U.current||!O.current)return;let t=O.current.getBoundingClientRect(),r=e.clientX;F(Math.min(Math.max((t.right-r)/t.width*100,15),50))},r=()=>{U.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},[]);(0,l.useEffect)(()=>{let e={};for(let t of r){let r=n.getScript(t.id);r&&(e[t.id]=r.script)}V(e)},[r,n]),(0,l.useEffect)(()=>{let e=window.setTimeout(()=>{n.saveConfig({baseUrl:d,browser:u,headless:m,timeout:b})},500);return()=>window.clearTimeout(e)},[d,u,m,b,n]);let ec=(0,l.useCallback)((e,t)=>{L(r=>[...r,{time:new Date,type:e,message:t}]),window.setTimeout(()=>{var e;null==(e=es.current)||e.scrollIntoView({behavior:"smooth"})},50)},[]),ed=(0,l.useCallback)(e=>{eo(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ex=(0,l.useCallback)(()=>{ea.size===r.length?eo(new Set):eo(new Set(r.map(e=>e.id)))},[r,ea]),eu=(0,l.useCallback)(()=>{var e;let t=localStorage.getItem("qa-llm-config");if(!t)return null;let r=JSON.parse(t),s=r.activeProvider;if(!s||!(null==(e=r.providers)?void 0:e[s]))return null;let a=r.providers[s];return a.apiKey&&a.connected?{provider:s,model:a.defaultModel,apiKey:a.apiKey,baseURL:a.baseURL}:null},[]),ep=(0,l.useCallback)(async()=>{let e=eu();if(!e)return void ec("error","Please configure LLM in Integrations page first");C(!0),ec("info","Generating test scripts...");try{let t=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:r.filter(e=>ea.has(e.id)),baseUrl:d,llmConfig:e,generateOnly:!0})});if(!t.ok)return void ec("error","Failed to generate scripts");let s=await t.json();for(let[e,t]of(V(e=>({...e,...s.scripts})),Object.entries(s.scripts))){let s=r.find(t=>t.id===e);s&&n.saveScript(e,s.title,s.code,t)}ec("success","Generated ".concat(Object.keys(s.scripts).length," test script(s)")),f("scripts")}catch(e){ec("error","Error: ".concat(e instanceof Error?e.message:String(e)))}finally{C(!1)}},[r,ea,d,eu,ec,n]),em=(0,l.useCallback)(async()=>{let e=r.filter(e=>ea.has(e.id));if(0===e.length)return;let t=eu();if(!t)return void ec("error","Please configure LLM in Integrations page first");j(!0),N([]),L([]),R([]),T(null),H(""),G(!1);let s=new AbortController;er.current=s,ec("info","Starting E2E test run with ".concat(e.length," test(s)...")),ec("info","Target: ".concat(d)),ec("info","Browser: ".concat(u," | Headless: ").concat(m));try{var o,l;let r=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:e,baseUrl:d,browser:u,headless:m,timeout:b,llmConfig:t}),signal:s.signal});if(!r.ok){let e=await r.json();ec("error",e.error||"Failed to run tests"),j(!1);return}let i=null==(o=r.body)?void 0:o.getReader(),c=new TextDecoder,x="",p=[];if(i)for(;;){let{done:e,value:t}=await i.read();if(e)break;let r=(x+=c.decode(t,{stream:!0})).split("\n");for(let e of(x=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));switch(t.type){case"status":ec("info",t.message);break;case"testStart":D({index:t.index,title:t.title}),ec("info","\n━━━ Test ".concat(t.index,"/").concat(t.total,": ").concat(t.code," - ").concat(t.title," ━━━")),t.script&&V(e=>({...e,[t.testCaseId]:t.script}));break;case"step":ec("info"," → ".concat(t.message));break;case"aiThinking":ec("ai"," \uD83E\uDD16 ".concat(t.message));break;case"aiAction":ec("ai"," \uD83C\uDFAF ".concat(t.message));break;case"screenshot":T(t.image),R(e=>[...e,{image:t.image,label:t.label,timestamp:new Date}]);break;case"stepResult":ec("pass"===t.status?"success":"error"," ".concat("pass"===t.status?"✓":"✗"," ").concat(t.message));break;case"healing":ec("healing"," \uD83D\uDD27 ".concat(t.message));break;case"healingAction":ec("healing"," \uD83D\uDC8A ".concat(t.message));break;case"healed":ec("success"," ✨ ".concat(t.message));break;case"aiAnalysis":ec("ai"," \uD83D\uDCCA AI Analysis:\n".concat(t.message));break;case"error":ec("error"," ⚠ ".concat(t.message));break;case"healingReport":H(t.report),t.report&&!t.report.includes("All tests passed")&&G(!0);break;case"testComplete":ec("pass"===t.status?"success":"error","\n ".concat("pass"===t.status?"✓":"✗"," Test ").concat(t.index," completed: ").concat(t.status.toUpperCase()," (").concat(t.duration,"ms)")),t.script&&(V(e=>({...e,[t.testCaseId]:t.script})),n.saveScript(t.testCaseId,(null==(l=t.result)?void 0:l.testCaseTitle)||"","",t.script)),p.push(t.result),N([...p]);break;case"complete":ec("success","\n═══════════════════════════════════════");let r=t.results.filter(e=>"pass"===e.status).length,s=t.results.filter(e=>"fail"===e.status||"error"===e.status).length;ec("success","Test run complete: ".concat(r," passed, ").concat(s," failed")),n.saveRun({projectId:a,config:{baseUrl:d,browser:u,headless:m,timeout:b},results:t.results,totalPassed:r,totalFailed:s,totalDuration:t.results.reduce((e,t)=>e+t.duration,0),healingReport:X||void 0});break;case"aborted":ec("warning","\n━━━ Test run stopped by user ━━━")}}catch(e){}}}catch(e){e instanceof Error&&"AbortError"===e.name?ec("warning","\n━━━ Test run stopped by user ━━━"):ec("error","Error: ".concat(e instanceof Error?e.message:String(e)))}j(!1),D(null),er.current=null},[r,ea,d,u,m,b,ec,eu,a,n,X]),eh=(0,l.useCallback)(()=>{er.current&&(ec("warning","Stopping test run..."),er.current.abort())},[ec]),eb=(0,l.useCallback)(()=>{if(!_||!q)return;let e=r.find(e=>e.id===_);e&&(n.saveScript(e.id,e.title,e.code,q),V(t=>({...t,[e.id]:q})),ec("success","Script saved for ".concat(e.code))),J(null),Z("")},[_,q,r,n,ec]);return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-2 md:p-4",style:{backgroundColor:"rgba(0,0,0,0.5)"},children:[(0,s.jsxs)("div",{className:"w-full max-w-6xl max-h-[95vh] md:max-h-[92vh] rounded-lg shadow-xl flex flex-col",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 md:p-4 border-b shrink-0",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h2",{className:"text-base md:text-lg font-semibold truncate",style:{color:"var(--text-primary)"},children:"E2E Agentic Test Runner"}),(0,s.jsx)("p",{className:"text-xs mt-0.5 hidden sm:block",style:{color:"var(--text-tertiary)"},children:"AI-powered testing with script generation & live preview"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:["runner"===y&&(0,s.jsx)("button",{onClick:()=>P(!B),className:"md:hidden p-1.5 rounded",style:{backgroundColor:B?"var(--accent)":"var(--bg-secondary)",color:B?"white":"var(--text-secondary)"},title:"Toggle config panel",children:"☰"}),(0,s.jsx)("button",{onClick:o,className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]})]}),(0,s.jsx)("div",{className:"flex border-b overflow-x-auto shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[{id:"runner",label:"Runner",icon:"▶"},{id:"scripts",label:"Scripts",icon:"{ }"},{id:"history",label:"History",icon:"\uD83D\uDCCB"}].map(e=>(0,s.jsxs)("button",{onClick:()=>f(e.id),className:"px-3 md:px-4 py-2 text-xs flex items-center gap-1.5 transition-colors whitespace-nowrap",style:{backgroundColor:y===e.id?"var(--bg-secondary)":"transparent",color:y===e.id?"var(--accent)":"var(--text-tertiary)",borderBottom:y===e.id?"2px solid var(--accent)":"2px solid transparent"},children:[(0,s.jsx)("span",{children:e.icon}),e.label]},e.id))}),"runner"===y&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"".concat(B?"max-h-[35vh] md:max-h-none":"max-h-0 md:max-h-none"," md:flex-[0_0_28%] border-b md:border-b-0 md:border-r overflow-auto transition-all duration-200 shrink-0"),style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3 md:p-4 space-y-3 md:space-y-4",children:[(0,s.jsxs)("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Configuration"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Target URL"}),(0,s.jsx)("input",{type:"url",value:d,onChange:e=>x(e.target.value),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},placeholder:"http://localhost:3000"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Browser"}),(0,s.jsxs)("select",{value:u,onChange:e=>p(e.target.value),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:[(0,s.jsx)("option",{value:"chromium",children:"Chromium"}),(0,s.jsx)("option",{value:"firefox",children:"Firefox"}),(0,s.jsx)("option",{value:"webkit",children:"WebKit"}),(0,s.jsx)("option",{value:"edge",children:"Edge"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Timeout (ms)"}),(0,s.jsx)("input",{type:"number",value:b,onChange:e=>v(Number(e.target.value)),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"}})]})]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),disabled:g,className:"accent-[var(--accent)]"}),(0,s.jsx)("span",{style:{color:"var(--text-secondary)"},children:"Run headless"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Test Cases (",ea.size,"/",r.length,")"]}),(0,s.jsx)("button",{onClick:ex,disabled:g,className:"text-xs underline disabled:opacity-50",style:{color:"var(--accent)"},children:ea.size===r.length?"Deselect All":"Select All"})]}),(0,s.jsx)("div",{className:"max-h-[150px] md:max-h-[200px] overflow-auto rounded-lg",style:{border:"1px solid var(--border)"},children:r.map(e=>{let t=w.find(t=>t.testCaseId===e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-xs border-b last:border-b-0 hover:opacity-80 cursor-pointer",style:{borderColor:"var(--border)",backgroundColor:ea.has(e.id)?"var(--bg-secondary)":"transparent"},children:[(0,s.jsx)("input",{type:"checkbox",checked:ea.has(e.id),onChange:()=>ed(e.id),disabled:g,className:"accent-[var(--accent)]"}),(0,s.jsx)("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:e.code}),t&&(0,s.jsx)("span",{style:{color:"pass"===t.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===t.status?"✓":"✗"})]},e.id)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("button",{onClick:ep,disabled:g||k||0===ea.size,className:"w-full px-3 py-2 text-xs rounded flex items-center justify-center gap-2 disabled:opacity-50",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:k?"⏳ Generating...":"{ } Generate Scripts"}),X&&(0,s.jsx)("button",{onClick:()=>G(!0),className:"w-full px-3 py-2 text-xs rounded flex items-center justify-center gap-2",style:{backgroundColor:"var(--status-skip-bg)",border:"1px solid var(--status-skip-border)",color:"var(--status-skip-text)"},children:"\uD83D\uDD27 View Healing Report"})]})]})}),(0,s.jsxs)("div",{ref:O,className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:[(0,s.jsx)("div",{className:"p-3 border-b",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Execution Log"}),g&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),(0,s.jsx)("span",{className:"text-xs truncate max-w-[150px]",style:{color:"var(--text-tertiary)"},children:S?S.title:"Processing..."})]})]})}),(0,s.jsxs)("div",{className:"flex-1 overflow-auto p-3 font-mono text-xs",style:{backgroundColor:"var(--bg-primary)"},children:[0===E.length?(0,s.jsx)("div",{className:"text-center py-8",style:{color:"var(--text-tertiary)"},children:'Click "Run Tests" to start'}):E.map((e,t)=>(0,s.jsx)("div",{className:"py-0.5",style:{color:(e=>{switch(e){case"error":return"var(--status-fail-text)";case"success":return"var(--status-pass-text)";case"ai":return"#8b5cf6";case"healing":return"#f59e0b";case"warning":return"var(--status-skip-text)";default:return"var(--text-secondary)"}})(e.type)},children:e.message.split("\n").map((e,t)=>(0,s.jsx)("div",{children:e||"\xa0"},t))},t)),(0,s.jsx)("div",{ref:es})]})]}),(0,s.jsx)("div",{className:"w-1 md:w-1.5 cursor-col-resize hover:bg-[var(--accent)] transition-colors shrink-0",style:{backgroundColor:"var(--border)"},onMouseDown:ei}),(0,s.jsxs)("div",{className:"border-t md:border-t-0 md:border-l flex flex-col transition-all duration-200",style:{borderColor:"var(--border)",maxHeight:z?"300px":"36px",minHeight:z?"200px":"36px",width:"auto",flex:z?"0 0 ".concat(W,"%"):"0 0 36px",...el?{maxHeight:"none",minHeight:"auto",flex:z?"0 0 ".concat(W,"%"):"0 0 36px"}:{}},children:[(0,s.jsxs)("div",{className:"p-2 md:p-3 border-b cursor-pointer flex items-center gap-2 shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},onClick:()=>I(!z),children:[(0,s.jsx)("span",{className:"text-sm",children:"\uD83D\uDDA5️"}),z&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"text-sm font-medium flex-1",style:{color:"var(--text-primary)"},children:"Browser Preview"}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:M.length>0?"".concat(M.length," screenshots"):""})]})]}),z&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{backgroundColor:"var(--bg-secondary)"},children:A?(0,s.jsx)("img",{src:"data:image/jpeg;base64,".concat(A),alt:"Browser preview",className:"w-full rounded"}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full min-h-[100px] text-xs",style:{color:"#666"},children:g?"Waiting...":"Preview during execution"})}),M.length>0&&(0,s.jsx)("div",{className:"p-2 border-t overflow-x-auto flex gap-1 shrink-0",style:{borderColor:"var(--border)"},children:M.slice(-6).map((e,t)=>(0,s.jsx)("button",{onClick:()=>T(e.image),className:"flex-shrink-0 w-10 h-7 md:w-12 md:h-8 rounded overflow-hidden border",style:{border:A===e.image?"2px solid var(--accent)":"1px solid var(--border)"},title:e.label,children:(0,s.jsx)("img",{src:"data:image/jpeg;base64,".concat(e.image),alt:e.label,className:"w-full h-full object-cover"})},t))})]})]})]}),w.length>0&&(0,s.jsx)("div",{className:"p-2 md:p-3 border-t shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 md:gap-4 text-xs md:text-sm",children:[(0,s.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",w.filter(e=>"pass"===e.status).length]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",w.filter(e=>"fail"===e.status).length]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["⚠ ",w.filter(e=>"error"===e.status).length]}),(0,s.jsxs)("span",{className:"ml-auto",style:{color:"var(--text-tertiary)"},children:[Math.round(w.reduce((e,t)=>e+t.duration,0)/1e3),"s"]})]})})]})]}),"scripts"===y&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"w-full md:w-64 border-b md:border-b-0 md:border-r overflow-auto max-h-[30vh] md:max-h-none",style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3",children:[(0,s.jsx)("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-primary)"},children:"Test Scripts"}),(0,s.jsx)("div",{className:"space-y-1",children:r.map(e=>{let t=!!Y[e.id],r=$===e.id;return(0,s.jsxs)("button",{onClick:()=>{Q(e.id),J(null)},className:"w-full text-left px-3 py-2 text-xs rounded flex items-center gap-2",style:{backgroundColor:r?"var(--bg-secondary)":"transparent",color:"var(--text-primary)",border:r?"1px solid var(--border)":"1px solid transparent"},children:[(0,s.jsx)("span",{className:t?"text-green-500":"text-gray-400",children:t?"✓":"○"}),(0,s.jsxs)("span",{className:"truncate",children:[e.code," - ",e.title]})]},e.id)})})]})}),(0,s.jsx)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:$?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"p-3 border-b flex items-center justify-between shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[null==(t=r.find(e=>e.id===$))?void 0:t.code," - Script"]}),(0,s.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--text-tertiary)"},children:_?"Editing":"Click Edit to modify"})]}),(0,s.jsx)("div",{className:"flex gap-2 ml-2",children:_?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>{J(null),Z("")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:eb,className:"px-3 py-1.5 text-xs rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Save"})]}):(0,s.jsx)("button",{onClick:()=>{J($),Z(Y[$]||"")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"✏️ Edit"})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",style:{backgroundColor:"#1e1e2e"},children:_?(0,s.jsx)("textarea",{value:q,onChange:e=>Z(e.target.value),className:"w-full h-full min-h-[300px] font-mono text-sm p-4 rounded resize-none",style:{backgroundColor:"#1e1e2e",color:"#cdd6f4",border:"none",outline:"none"},spellCheck:!1}):Y[$]?(0,s.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap",style:{color:"#cdd6f4"},children:Y[$]}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[(0,s.jsx)("p",{className:"text-sm",style:{color:"#666"},children:"No script generated yet"}),(0,s.jsx)("button",{onClick:ep,disabled:k,className:"px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:k?"Generating...":"Generate Script"})]})})]}):(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"text-3xl md:text-4xl mb-3"}),(0,s.jsx)("p",{className:"text-sm",children:"Select a test case to view its script"})]})})})]}),"history"===y&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"w-full md:w-80 border-b md:border-b-0 md:border-r overflow-auto max-h-[40vh] md:max-h-none",style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Run History (",n.runs.length,")"]}),n.runs.length>0&&(0,s.jsx)("button",{onClick:n.clearRuns,className:"text-xs underline",style:{color:"var(--status-fail-text)"},children:"Clear All"})]}),0===n.runs.length?(0,s.jsx)("div",{className:"text-center py-8 text-xs",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):(0,s.jsx)("div",{className:"space-y-2",children:n.runs.map(e=>(0,s.jsxs)("div",{className:"p-3 rounded-lg group relative",style:{backgroundColor:(null==ee?void 0:ee.id)===e.id?"var(--bg-secondary)":"transparent",border:(null==ee?void 0:ee.id)===e.id?"1px solid var(--border)":"1px solid transparent"},children:[(0,s.jsxs)("button",{onClick:()=>et(e),className:"w-full text-left",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:new Date(e.timestamp).toLocaleString()}),(0,s.jsxs)("span",{className:"text-xs",style:{color:e.totalFailed>0?"var(--status-fail-text)":"var(--status-pass-text)"},children:[e.totalPassed,"✓ ",e.totalFailed,"✗"]})]}),(0,s.jsxs)("div",{className:"text-xs mt-1 truncate",style:{color:"var(--text-tertiary)"},children:[e.config.baseUrl," • ",e.config.browser]})]}),(0,s.jsx)("button",{onClick:()=>{n.deleteRun(e.id),(null==ee?void 0:ee.id)===e.id&&et(null)},className:"absolute top-2 right-2 p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"var(--status-fail-text)"},title:"Delete run",children:"✕"})]},e.id))})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:ee?(0,s.jsxs)("div",{className:"p-4 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Run Details"}),(0,s.jsx)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:new Date(ee.timestamp).toLocaleString()})]}),(0,s.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,s.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",ee.totalPassed]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",ee.totalFailed]})]})]}),(0,s.jsx)("div",{className:"space-y-2",children:ee.results.map((e,t)=>(0,s.jsxs)("div",{className:"p-3 rounded-lg",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid ".concat("pass"===e.status?"var(--status-pass-border)":"var(--status-fail-border)")},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,s.jsxs)("span",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[e.testCaseCode||"Test ".concat(t+1)," - ",e.testCaseTitle]}),(0,s.jsx)("span",{className:"text-xs px-2 py-0.5 rounded shrink-0",style:{backgroundColor:"pass"===e.status?"var(--status-pass-bg)":"var(--status-fail-bg)",color:"pass"===e.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:e.status.toUpperCase()})]}),e.error&&(0,s.jsx)("p",{className:"text-xs mt-2 p-2 rounded break-words",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:e.error}),(0,s.jsx)("div",{className:"mt-2 space-y-1",children:e.steps.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,s.jsx)("span",{className:"shrink-0",style:{color:"pass"===e.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===e.status?"✓":"✗"}),(0,s.jsx)("span",{style:{color:"var(--text-secondary)"},children:e.step})]},t))}),e.aiAnalysis&&(0,s.jsxs)("div",{className:"mt-2 p-2 rounded text-xs break-words",style:{backgroundColor:"var(--bg-primary)",color:"var(--text-secondary)"},children:[(0,s.jsx)("strong",{children:"AI:"})," ",e.aiAnalysis]})]},e.testCaseId))})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,s.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"text-3xl md:text-4xl mb-3",children:"\uD83D\uDCCB"}),(0,s.jsx)("p",{className:"text-sm",children:"Select a run to view details"})]})})})]}),(0,s.jsxs)("div",{className:"p-3 md:p-4 border-t flex items-center justify-between shrink-0",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"text-xs truncate max-w-[200px] md:max-w-none",style:{color:"var(--text-tertiary)"},children:[g&&S&&(0,s.jsxs)("span",{children:["Running: ",S.title]}),!g&&w.length>0&&(0,s.jsxs)("span",{children:[w.length," tests completed"]}),!g&&0===w.length&&"runner"===y&&(0,s.jsx)("span",{className:"hidden sm:inline",children:"Config saved per project"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:o,disabled:g,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Close"}),"runner"===y&&(g?(0,s.jsx)("button",{onClick:eh,className:"px-3 md:px-4 py-2 text-sm rounded flex items-center gap-2",style:{backgroundColor:"#ef4444",color:"white"},children:"■ Stop"}):(0,s.jsx)("button",{onClick:em,disabled:0===ea.size,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:"▶ Run"}))]})]})]}),K&&(0,s.jsx)("div",{className:"fixed inset-0 z-60 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0,0,0,0.6)"},children:(0,s.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] rounded-lg shadow-xl flex flex-col",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",style:{color:"var(--text-primary)"},children:"\uD83D\uDD27 Healing Report"}),(0,s.jsx)("p",{className:"text-xs mt-1",style:{color:"var(--text-tertiary)"},children:"AI recommendations"})]}),(0,s.jsx)("button",{onClick:()=>G(!1),className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-xs font-mono break-words",style:{color:"var(--text-secondary)"},children:X})}),(0,s.jsx)("div",{className:"p-4 border-t flex justify-end",style:{borderColor:"var(--border)"},children:(0,s.jsx)("button",{onClick:()=>G(!1),className:"px-4 py-2 text-sm rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Close"})})]})})]})}let G=(0,r(3101).F)("mx-auto flex h-[54px] w-max items-center justify-center gap-1.5 rounded-xl border p-2"),Y=l.forwardRef((e,t)=>{let{className:r,children:a,iconSize:o=36,direction:l="middle",...n}=e;return(0,s.jsx)("div",{ref:t,...n,className:(0,x.cn)(G({className:r}),{"items-start":"top"===l,"items-center":"middle"===l,"items-end":"bottom"===l}),children:a})});Y.displayName="Dock";let V=e=>{let{size:t=36,label:r,className:a,children:o,...n}=e,[i,c]=(0,l.useState)(!1);return(0,s.jsxs)("div",{className:(0,x.cn)("relative flex items-center cursor-pointer rounded-lg transition-all duration-200",a),style:{height:t},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),...n,children:[(0,s.jsxs)("div",{className:"flex items-center justify-center flex-shrink-0 transition-all duration-200",style:{width:t,height:t},children:[o,i&&(0,s.jsx)("div",{className:"absolute inset-0 rounded-lg overflow-hidden pointer-events-none",style:{opacity:.15},children:(0,s.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.4) 45%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.4) 55%, transparent 60%)",backgroundSize:"200% 100%",animation:"dockShimmer 1.5s ease-in-out"}})})]}),(0,s.jsx)(y.N,{children:i&&r&&(0,s.jsx)(d.P.span,{initial:{width:0,opacity:0},animate:{width:"auto",opacity:1},exit:{width:0,opacity:0},transition:{duration:.35,ease:[.25,.1,.25,1]},className:"text-[10px] font-medium whitespace-nowrap overflow-hidden flex-shrink-0 pr-2",style:{color:"var(--text-secondary)"},children:r})})]})};function _(e){var t;let{selectedNode:r,testCases:a,stats:i,columns:c,projectId:d,fullscreen:x,allNodes:u,allTestCases:p,onSelectNode:m,onAddTestCase:h,onUpdateTestCase:b,onDeleteTestCase:v,onBulkDelete:y,onBulkUpdate:C,onReorderTestCases:w,onReorderColumn:N,onToggleColumn:S,onRenameColumn:D,onUpdateNode:E,onAddColumn:R,onDeleteColumn:T,confirmDialog:z}=e;(0,n.useRouter)();let[I,W]=(0,l.useState)(!1),[F,P]=(0,l.useState)(!1),[O,X]=(0,l.useState)(!1),[G,_]=(0,l.useState)(!1),[Z,$]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(!1),[es,ea]=(0,l.useState)(!1),[eo,el]=(0,l.useState)(!1),[en,ei]=(0,l.useState)(new Set),[ec,ed]=(0,l.useState)(new Set),[ex,eu]=(0,l.useState)(!1),[ep,em]=(0,l.useState)(new Set),[eh,eb]=(0,l.useState)(null),[ev,ey]=(0,l.useState)("asc"),[ef,eg]=(0,l.useState)(!1),[ej,ek]=(0,l.useState)(""),eC=(0,l.useRef)(null),ew=(0,l.useRef)(null),eN=x?c:c.filter(e=>"code"!==e.key),eS=f._X.map(e=>e.key);(0,l.useEffect)(()=>{em(new Set)},[null==r?void 0:r.id]);let eD=(0,l.useCallback)(e=>{em(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),eE=(0,l.useCallback)(e=>{ei(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),eL=(0,l.useCallback)(()=>ei(new Set),[]),eM=(0,l.useCallback)(e=>{ed(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),eR=(0,l.useCallback)(()=>ed(new Set),[]),eA=en.size+ec.size,eT=a.filter(e=>{let t=0===en.size||en.has(e.status),r=0===ec.size||ec.has(e.case_type);return t&&r}),ez=(0,l.useCallback)(()=>{ep.size===eT.length?em(new Set):em(new Set(eT.map(e=>e.id)))},[ep.size,eT]),eI=(0,l.useCallback)(()=>em(new Set),[]),eW=(0,l.useCallback)(async()=>{r&&0!==ep.size&&(!z||await z("Delete Test Cases","Delete ".concat(ep.size," selected test case(s)?")))&&(y(r.id,Array.from(ep)),em(new Set))},[r,ep,y,z]),eF=(0,l.useCallback)(e=>{r&&0!==ep.size&&(C(r.id,Array.from(ep),{status:e}),em(new Set))},[r,ep,C]),eB=eh?[...eT].sort((e,t)=>{let r=e[eh]||"",s=t[eh]||"",a=r.localeCompare(s);return"asc"===ev?a:-a}):eT;(0,l.useEffect)(()=>{if(!ex||0===ep.size)return;let e=e=>{var t;let r=null==(t=e.target)?void 0:t.tagName;"INPUT"!==r&&"TEXTAREA"!==r&&(("p"===e.key||"P"===e.key)&&(e.preventDefault(),eF("pass")),("f"===e.key||"F"===e.key)&&(e.preventDefault(),eF("fail")),("k"===e.key||"K"===e.key)&&(e.preventDefault(),eF("skip")),("u"===e.key||"U"===e.key)&&(e.preventDefault(),eF("untested")),("b"===e.key||"B"===e.key)&&(e.preventDefault(),eF("blocked")),("d"===e.key||"D"===e.key)&&(e.preventDefault(),eW()),"Escape"===e.key&&(e.preventDefault(),eI()))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ex,ep.size,eF,eW,eI]),(0,l.useEffect)(()=>{ef&&eC.current&&eC.current.focus()},[ef]),(0,l.useEffect)(()=>{if(!et)return;let e=e=>{ew.current&&!ew.current.contains(e.target)&&er(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[et]);let eP=(0,l.useCallback)(e=>{if(r)for(let t of e)h(r.id,t.title,t.steps,t.expected)},[r,h]),eU=(0,l.useCallback)(e=>{if(r)for(let t of e)h(r.id,t.title,t.steps,t.expected)},[r,h]);return r?(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex flex-col h-full relative",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,s.jsx)("h2",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-base font-medium mb-2",children:r.label}),(0,s.jsx)(j,{value:i.passRate}),(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-1.5 mt-2 flex-wrap",children:[(0,s.jsx)("button",{onClick:()=>{eu(e=>!e),ex&&em(new Set)},style:{backgroundColor:ex?"var(--accent)":"transparent",color:ex?"#fff":"var(--text-tertiary)",borderColor:ex?"transparent":"var(--border)"},className:"jsx-bc071752c54fb059 px-3 py-0.5 text-[10px] font-medium rounded-sm border transition-colors",children:"Select"}),ex&&ep.size>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{style:{backgroundColor:"var(--accent)",color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-0.5 text-[10px] font-medium rounded-sm",children:[ep.size," selected"]}),(0,s.jsx)("button",{onClick:eI,style:{borderColor:"var(--border)",color:"var(--text-secondary)"},className:"jsx-bc071752c54fb059 px-2 py-0.5 text-[10px] font-medium rounded-sm border transition-colors hover:bg-[var(--bg-secondary)]",children:"Unselect All"})]}),(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:()=>el(e=>!e),style:{color:eA>0||eo?"var(--accent)":"var(--text-tertiary)"},title:"Filters",className:"jsx-bc071752c54fb059 relative p-1 rounded-sm transition-colors hover:bg-[var(--bg-secondary)]",children:(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:eA>0?"2.5":"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,s.jsx)("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",className:"jsx-bc071752c54fb059"})})}),eA>0&&!eo&&(0,s.jsxs)("span",{style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-[10px] font-medium",children:[eA," filter",eA>1?"s":""," active"]})]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1"}),(0,s.jsx)("button",{onClick:()=>W(e=>!e),style:{color:I?"var(--accent)":"var(--text-tertiary)"},title:"Notes",className:"jsx-bc071752c54fb059 p-1 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("button",{onClick:()=>ea(e=>!e),style:{color:es?"var(--accent)":"var(--text-tertiary)"},title:es?"Collapse All":"Expand All",className:"jsx-bc071752c54fb059 p-1 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:es?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"7 3 3 6 7 9",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"17 15 21 18 17 21",className:"jsx-bc071752c54fb059"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"17 3 21 6 17 9",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"7 15 3 18 7 21",className:"jsx-bc071752c54fb059"})]})})})]}),eo&&(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("div",{style:{backgroundColor:"var(--border)"},className:"jsx-bc071752c54fb059 w-px h-4 mx-0.5"}),[["all","All"],["untested","Untested"],["pass","Pass"],["fail","Fail"],["skip","Skip"],["blocked","Blocked"]].map(e=>{let[t,r]=e,o="all"===t?0===en.size:en.has(t),l="all"===t?a.length:a.filter(e=>e.status===t).length,n={all:{bg:"var(--bg-secondary)",text:"var(--text-secondary)"},untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"},blocked:{bg:"var(--status-blocked-bg)",text:"var(--status-blocked-text)"}}[t];return(0,s.jsxs)("button",{onClick:()=>"all"===t?eL():eE(t),style:{backgroundColor:o?n.bg:"transparent",color:o?n.text:"var(--text-tertiary)",borderColor:o?"transparent":"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded-full border transition-colors",children:[r,(0,s.jsx)("span",{style:{backgroundColor:o?"rgba(0,0,0,0.1)":"var(--bg-secondary)",color:o?n.text:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 px-1 py-0 text-[9px] rounded-full min-w-[16px] text-center",children:l})]},t)}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)"},className:"jsx-bc071752c54fb059 w-px h-4 mx-0.5"}),[["all","All"],...f.D_.map(e=>[e,e])].map(e=>{let[t,r]=e,o="all"===t?0===ec.size:ec.has(t),l="all"===t?a.length:a.filter(e=>e.case_type===t).length,n={all:{bg:"var(--bg-secondary)",text:"var(--text-secondary)"},Positive:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},Negative:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},General:{bg:"var(--bg-secondary)",text:"var(--text-tertiary)"}},i=n[t]||n.General;return(0,s.jsxs)("button",{onClick:()=>"all"===t?eR():eM(t),style:{backgroundColor:o?i.bg:"transparent",color:o?i.text:"var(--text-tertiary)",borderColor:o?"transparent":"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded-full border transition-colors",children:[r,(0,s.jsx)("span",{style:{backgroundColor:o?"rgba(0,0,0,0.1)":"var(--bg-secondary)",color:o?i.text:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 px-1 py-0 text-[9px] rounded-full min-w-[16px] text-center",children:l})]},"ct-".concat(t))})]})]}),I&&(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,s.jsx)("label",{style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-xs font-medium mb-1 block",children:"Node Notes"}),(0,s.jsx)("textarea",{value:null!=(t=r.notes)?t:"",onChange:e=>E(r.id,{notes:e.target.value}),placeholder:"Add notes for this node...",rows:3,style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 w-full px-3 py-2 text-sm bg-transparent outline-none border resize-none"})]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 px-4 py-3",children:(0,s.jsx)(k,{onAdd:e=>h(r.id,e),nodeLabel:r.label})}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1 min-h-0 overflow-auto px-2",children:0===a.length?(0,s.jsx)(g.p,{message:"No test cases yet. Use the quick-add bar or Generate button to add test cases."}):(0,s.jsx)(L,{testCases:eB,columns:eN,expandAll:es,selectMode:ex,selectedIds:ep,onToggleSelect:eD,onToggleSelectAll:ez,sortKey:eh,sortDirection:ev,onSortChange:e=>{null===e?eb(null):eh===e?ey(e=>"asc"===e?"desc":"asc"):(eb(e),ey("asc"))},onUpdate:(e,t)=>b(r.id,e,t),onDelete:e=>v(r.id,e),onReorder:e=>w(r.id,e),onAddColumn:R?e=>R(r.id,e):void 0,onOpenColumns:()=>er(!0)})}),ex&&ep.size>0&&(0,s.jsxs)("div",{style:{borderColor:"var(--border)",animation:"fadeInUp 150ms ease-out"},className:"jsx-bc071752c54fb059 px-4 py-2 border-t flex items-center gap-3",children:[(0,s.jsxs)("span",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-xs font-medium",children:[ep.size," selected"]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1"}),[["pass","P"],["fail","F"],["skip","K"],["untested","U"],["blocked","B"]].map(e=>{let[t,r]=e;return(0,s.jsxs)("button",{onClick:()=>eF(t),style:{borderColor:"var(--border)",color:"var(--text-secondary)"},title:"Mark ".concat(t," (").concat(r,")"),className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",children:[t.charAt(0).toUpperCase()+t.slice(1),(0,s.jsx)("kbd",{style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 ml-1 text-[8px] px-0.5 rounded",children:r})]},t)}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)"},className:"jsx-bc071752c54fb059 w-px h-4"}),(0,s.jsxs)("button",{onClick:eW,style:{borderColor:"var(--border)",color:"var(--status-fail-text)"},title:"Delete (D)",className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md border transition-colors hover:bg-[var(--status-fail-bg)]",children:["Delete",(0,s.jsx)("kbd",{style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 ml-1 text-[8px] px-0.5 rounded",children:"D"})]}),(0,s.jsx)("button",{onClick:eI,style:{color:"var(--text-tertiary)"},title:"Clear (Esc)",className:"jsx-bc071752c54fb059 px-1.5 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-[var(--bg-secondary)]",children:"\xd7"})]}),(0,s.jsx)(M,{stats:i,fullscreen:x,nodes:u,allTestCases:p,selectedNodeId:null==r?void 0:r.id,onSelectNode:m}),(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 flex-shrink-0 border-t py-2 flex justify-center relative",children:[et&&(0,s.jsx)("div",{ref:ew,style:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:4,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeIn 150ms ease-out",width:180},className:"jsx-bc071752c54fb059 absolute z-30 rounded-lg border",children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 py-1 max-h-[240px] overflow-y-auto",children:[c.map((e,t)=>{let o=!eS.includes(e.key);return(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center justify-between px-3 py-1.5 text-[11px] hover:bg-[var(--bg-secondary)] transition-colors group/col",children:[(0,s.jsxs)("button",{onClick:()=>r&&S(r.id,e.key),style:{color:e.visible?"var(--text-primary)":"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 flex items-center gap-2 flex-1 text-left",children:[(0,s.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:e.visible?"✓":""}),(0,s.jsx)("span",{className:"jsx-bc071752c54fb059",children:e.label})]}),(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-0.5 opacity-0 group-hover/col:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:()=>r&&(null==N?void 0:N(r.id,e.key,"up")),disabled:0===t,style:{color:"var(--text-tertiary)"},title:"Move up",className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded text-[10px] disabled:opacity-20 hover:bg-[var(--bg-secondary)]",children:"↑"}),(0,s.jsx)("button",{onClick:()=>r&&(null==N?void 0:N(r.id,e.key,"down")),disabled:t===c.length-1,style:{color:"var(--text-tertiary)"},title:"Move down",className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded text-[10px] disabled:opacity-20 hover:bg-[var(--bg-secondary)]",children:"↓"}),o&&(0,s.jsx)("button",{onClick:async()=>{if(r&&T)(!a.some(t=>{let r=t[e.key];return r&&"string"==typeof r&&""!==r.trim()})||!z||await z("Delete Column",'This column has data in some test cases. Delete "'.concat(e.label,'" anyway?')))&&T(r.id,e.key)},style:{color:"var(--status-fail-text)"},title:"Delete ".concat(e.label),className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded hover:opacity-100 transition-opacity text-[10px]",children:"\xd7"})]})]},e.key)}),ef?(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 px-3 py-1.5",children:(0,s.jsx)("input",{ref:eC,value:ej,onChange:e=>ek(e.target.value),onKeyDown:e=>{"Enter"===e.key&&ej.trim()&&(null==R||R(r.id,ej.trim()),ek(""),eg(!1)),"Escape"===e.key&&(eg(!1),ek(""))},onBlur:()=>{ej.trim()&&(null==R||R(r.id,ej.trim())),ek(""),eg(!1)},placeholder:"Column name...",style:{borderColor:"var(--accent)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 w-full px-2 py-1 text-[11px] rounded border outline-none"})}):(0,s.jsxs)("button",{onClick:()=>eg(!0),style:{color:"var(--accent)"},className:"jsx-bc071752c54fb059 w-full px-3 py-1.5 text-[11px] text-left flex items-center gap-2 hover:bg-[var(--bg-secondary)] transition-colors",children:[(0,s.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:"+"}),(0,s.jsx)("span",{className:"jsx-bc071752c54fb059",children:"Add Column"})]})]})}),(0,s.jsxs)(Y,{direction:"middle",iconSize:36,children:[(0,s.jsx)(V,{label:"Summary",onClick:()=>_(!0),children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"14 2 14 8 20 8",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"10 9 9 9 8 9",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)(V,{label:"Columns",onClick:()=>er(!et),children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:et?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)"},className:"jsx-bc071752c54fb059 w-px h-5 mx-0.5 flex-shrink-0"}),(0,s.jsx)(q,{onExport:()=>P(!0),onImport:()=>$(!0)}),(0,s.jsx)(J,{selectedNode:r,filteredTestCases:eT,columns:c}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)"},className:"jsx-bc071752c54fb059 w-px h-5 mx-0.5 flex-shrink-0"}),(0,s.jsx)(V,{label:"E2E Test",onClick:()=>ee(!0),children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"12 6 12 12 16 14",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)(V,{label:"Generate",onClick:()=>X(!0),children:(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,s.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",className:"jsx-bc071752c54fb059"})})})]})]}),(0,s.jsx)(A,{open:F,onClose:()=>P(!1),node:r,testCases:eB,columns:c}),(0,s.jsx)(B,{open:O,onClose:()=>X(!1),node:r,onGenerate:eP}),(0,s.jsx)(U,{open:G,onClose:()=>_(!1),node:r,testCases:a,stats:i}),(0,s.jsx)(H,{open:Z,onClose:()=>$(!1),onImport:eU,nodeLabel:r.label}),Q&&r&&(0,s.jsx)(K,{testCases:a,projectId:d,onClose:()=>ee(!1)}),(0,s.jsx)(o(),{id:"bc071752c54fb059",children:"@keyframes fadeInUp{from{opacity:0;transform:translatey(8px)}to{opacity:1;transform:translatey(0)}}"})]}):(0,s.jsx)("div",{className:"h-full",children:(0,s.jsx)(g.p,{message:"Select a node from the mindmap to view its test cases."})})}function J(e){let{selectedNode:t,filteredTestCases:r,columns:a}=e,[o,n]=(0,l.useState)(!1),[i,c]=(0,l.useState)(null),x=e=>{let s="md"===e?(0,R.wy)(t,r,a):(0,R.nN)(t,r);navigator.clipboard.writeText(s).then(()=>{c(e),setTimeout(()=>c(null),2e3)})};return(0,s.jsxs)("div",{className:"relative flex items-center cursor-pointer rounded-lg",style:{height:36},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,s.jsxs)("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:36,height:36},children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,s.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),o&&(0,s.jsx)("div",{className:"absolute inset-0 rounded-lg overflow-hidden pointer-events-none",style:{opacity:.15},children:(0,s.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.4) 45%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.4) 55%, transparent 60%)",backgroundSize:"200% 100%",animation:"dockShimmer 1.5s ease-in-out"}})})]}),(0,s.jsx)(y.N,{children:o&&(0,s.jsxs)(d.P.div,{initial:{width:0,opacity:0},animate:{width:"auto",opacity:1},exit:{width:0,opacity:0},transition:{duration:.5,ease:[.25,.1,.25,1]},className:"flex items-center gap-0 overflow-hidden whitespace-nowrap flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),x("md")},className:"text-[10px] font-medium px-1.5 py-0.5 rounded transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"md"===i?"var(--accent)":"var(--text-secondary)"},children:"md"===i?"Copied!":"Markdown"}),(0,s.jsx)("span",{className:"text-[10px]",style:{color:"var(--border)"},children:"|"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),x("json")},className:"text-[10px] font-medium px-1.5 py-0.5 rounded transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"json"===i?"var(--accent)":"var(--text-secondary)"},children:"json"===i?"Copied!":"JSON"})]})})]})}function q(e){let{onExport:t,onImport:r}=e,[a,o]=(0,l.useState)(!1);return(0,s.jsxs)("div",{className:"relative flex items-center cursor-pointer rounded-lg",style:{height:36},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,s.jsxs)("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:36,height:36},children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polyline",{points:"17 1 21 5 17 9"}),(0,s.jsx)("path",{d:"M3 11V9a4 4 0 014-4h14"}),(0,s.jsx)("polyline",{points:"7 23 3 19 7 15"}),(0,s.jsx)("path",{d:"M21 13v2a4 4 0 01-4 4H3"})]}),a&&(0,s.jsx)("div",{className:"absolute inset-0 rounded-lg overflow-hidden pointer-events-none",style:{opacity:.15},children:(0,s.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.4) 45%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.4) 55%, transparent 60%)",backgroundSize:"200% 100%",animation:"dockShimmer 1.5s ease-in-out"}})})]}),(0,s.jsx)(y.N,{children:a&&(0,s.jsxs)(d.P.div,{initial:{width:0,opacity:0},animate:{width:"auto",opacity:1},exit:{width:0,opacity:0},transition:{duration:.5,ease:[.25,.1,.25,1]},className:"flex items-center gap-0 overflow-hidden whitespace-nowrap flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),t()},className:"text-[10px] font-medium px-1.5 py-0.5 rounded transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"var(--text-secondary)"},children:"Export"}),(0,s.jsx)("span",{className:"text-[10px]",style:{color:"var(--border)"},children:"|"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),r()},className:"text-[10px] font-medium px-1.5 py-0.5 rounded transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"var(--text-secondary)"},children:"Import"})]})})]})}function Z(e){let{nodes:t,testCases:r,onSelectNode:a,onClose:o}=e,[n,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(0),x=(0,l.useRef)(null),u=(0,l.useRef)(null);(0,l.useEffect)(()=>{var e;null==(e=x.current)||e.focus()},[]);let p=(0,l.useMemo)(()=>{if(!n.trim())return[];let e=n.toLowerCase().trim(),s=[];for(let o of t){var a;for(let t of null!=(a=r[o.id])?a:[]){let r=t.title.toLowerCase().includes(e),a=t.steps.toLowerCase().includes(e),l=t.expected.toLowerCase().includes(e),n=t.code.toLowerCase().includes(e);if(r||a||l||n){let e="title",r=t.title;a?(e="steps",r=t.steps):l?(e="expected",r=t.expected):n&&(e="code",r=t.code),s.push({node:o,testCase:t,matchField:e,matchText:r})}}}return s},[n,t,r]);(0,l.useEffect)(()=>{d(0)},[p.length]),(0,l.useEffect)(()=>{var e;u.current&&(null==(e=u.current.querySelectorAll("[data-search-item]")[c])||e.scrollIntoView({block:"nearest"}))},[c]);let m=(0,l.useCallback)(e=>{a(e.node.id),o()},[a,o]),h=(0,l.useCallback)(e=>{"Escape"===e.key?o():"ArrowDown"===e.key?(e.preventDefault(),d(e=>Math.min(e+1,p.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d(e=>Math.max(e-1,0))):"Enter"===e.key&&p.length>0&&(e.preventDefault(),m(p[c]))},[p,c,m,o]),b=(e,t)=>{if(!t.trim())return e;let r=e.toLowerCase().indexOf(t.toLowerCase());if(-1===r)return e;let a=e.slice(0,r),o=e.slice(r,r+t.length),l=e.slice(r+t.length);return(0,s.jsxs)(s.Fragment,{children:[a.length>30&&"...",a.length>30?a.slice(-30):a,(0,s.jsx)("mark",{style:{backgroundColor:"var(--accent)",color:"#fff",borderRadius:2,padding:"0 1px"},children:o}),l.slice(0,40),l.length>40&&"..."]})},v={untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"},blocked:{bg:"var(--status-blocked-bg)",text:"var(--status-blocked-text)"}};return(0,s.jsx)("div",{className:"fixed inset-0 z-[350] flex items-start justify-center pt-[15vh]",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:o,children:(0,s.jsxs)("div",{className:"w-full max-w-lg rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,s.jsx)("input",{ref:x,value:n,onChange:e=>i(e.target.value),onKeyDown:h,placeholder:"Search test cases...",className:"flex-1 bg-transparent outline-none text-sm",style:{color:"var(--text-primary)"}}),(0,s.jsx)("kbd",{className:"text-[10px] px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"ESC"})]}),(0,s.jsxs)("div",{ref:u,className:"max-h-[300px] overflow-y-auto",children:[n.trim()&&0===p.length&&(0,s.jsx)("div",{className:"px-4 py-8 text-center",children:(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["No test cases found for “",n,"”"]})}),p.map((e,t)=>{let r=v[e.testCase.status]||v.untested;return(0,s.jsxs)("div",{"data-search-item":!0,className:"flex items-start gap-3 px-4 py-2.5 cursor-pointer transition-colors",style:{backgroundColor:t===c?"var(--bg-secondary)":"transparent",borderLeft:t===c?"2px solid var(--accent)":"2px solid transparent"},onClick:()=>m(e),onMouseEnter:()=>d(t),children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full mt-1.5 flex-shrink-0",style:{backgroundColor:r.text}}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,s.jsx)("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)"},children:e.node.code||e.node.label})}),(0,s.jsx)("div",{className:"text-xs font-medium truncate",style:{color:"var(--text-primary)"},children:b(e.testCase.title,n)}),"title"!==e.matchField&&(0,s.jsxs)("div",{className:"text-[11px] truncate mt-0.5",style:{color:"var(--text-tertiary)"},children:[(0,s.jsxs)("span",{className:"font-medium",style:{color:"var(--text-secondary)"},children:[e.matchField,":"]})," ",b(e.matchText,n)]})]}),(0,s.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0",style:{backgroundColor:r.bg,color:r.text},children:e.testCase.status})]},"".concat(e.node.id,"-").concat(e.testCase.id))})]}),n.trim()&&p.length>0&&(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-t",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[p.length," result",1!==p.length?"s":""]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↑↓"}),(0,s.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"navigate"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↵"}),(0,s.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"go to node"})]})]})]})})}function $(){var e,t,r,a,c,d,x;let u=(0,n.useParams)(),p=(0,n.useRouter)(),m=u.projectId,{projects:h,activeProject:b,activeProjectId:y,selectedNodeId:f,setSelectedNodeId:j,switchProject:k,mindmap:C,testCases:w,pushState:N,lastSaved:S,canUndo:D,canRedo:E,undo:L,redo:M,confirmDialog:R}=(0,i.M)(),A=null!=(t=h[m])?t:null,T=(0,l.useRef)(null),z=y===m?b:A;(0,l.useEffect)(()=>{h[m]&&T.current!==m&&(T.current=m,k(m))},[m,h,k]),(0,l.useEffect)(()=>{j(null)},[m,j]),(0,l.useEffect)(()=>{let e=setInterval(()=>O(new Date),1e4);return()=>clearInterval(e)},[]);let I=(0,l.useMemo)(()=>{var e;return null!=(e=null==z?void 0:z.flows.find(e=>e.id===f))?e:null},[z,f]),[W,F]=(0,l.useState)("mindmap"),[B,P]=(0,l.useState)(!1),[U,O]=(0,l.useState)(()=>new Date),[X,H]=(0,l.useState)(.5),[K,G]=(0,l.useState)(!1),[Y,V]=(0,l.useState)(!1),[J,q]=(0,l.useState)(!1),[$,Q]=(0,l.useState)(!1),ee=(0,l.useRef)(null),et=(0,l.useRef)(null),er=(0,l.useRef)(null),es=(0,l.useRef)(null),ea=(0,l.useRef)({mouseX:0,startRatio:.5}),eo=(0,l.useCallback)(e=>{e.preventDefault(),ea.current={mouseX:e.clientX,startRatio:X},G(!0)},[X]);return((0,l.useEffect)(()=>{if(!K)return;let e=e=>{if(!ee.current)return;let t=ee.current.getBoundingClientRect(),r=(e.clientX-ea.current.mouseX)/t.width;H(Math.max(.1,Math.min(.9,ea.current.startRatio+r)))},t=()=>G(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[K]),(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),P(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),A)?z?(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca h-full flex flex-col",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},className:"jsx-a894832df36b68ca flex md:hidden border-b flex-shrink-0",children:[(0,s.jsx)("button",{onClick:()=>F("mindmap"),style:{color:"mindmap"===W?"var(--accent)":"var(--text-tertiary)",borderBottom:"mindmap"===W?"2px solid var(--accent)":"2px solid transparent"},className:"jsx-a894832df36b68ca flex-1 px-4 py-2 text-xs font-medium transition-colors",children:"Mindmap"}),(0,s.jsx)("button",{onClick:()=>F("testcases"),style:{color:"testcases"===W?"var(--accent)":"var(--text-tertiary)",borderBottom:"testcases"===W?"2px solid var(--accent)":"2px solid transparent"},className:"jsx-a894832df36b68ca flex-1 px-4 py-2 text-xs font-medium transition-colors",children:"Test Cases"})]}),(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-a894832df36b68ca flex items-center justify-between px-4 py-1.5 border-b flex-shrink-0",children:[(0,s.jsx)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-a894832df36b68ca text-[10px]",children:S?(0,s.jsxs)("span",{className:"jsx-a894832df36b68ca",children:["Last saved ",function(e,t){let r=new Date(e),s=Math.floor((t.getTime()-r.getTime())/1e3),a=Math.floor(s/60),o=Math.floor(a/60);return s<10?"just now":s<60?"".concat(s,"s ago"):a<60?"".concat(a,"m ago"):o<24?"".concat(o,"h ago"):r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(S,U)]}):(0,s.jsx)("span",{className:"jsx-a894832df36b68ca",children:"Not saved yet"})}),(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca flex items-center gap-2",children:[(0,s.jsxs)("button",{onClick:()=>P(!0),style:{borderColor:"var(--border)",color:"var(--text-tertiary)",minWidth:160},title:"Search test cases (Ctrl+K)",className:"jsx-a894832df36b68ca flex items-center gap-1.5 px-4 py-1 rounded-md border text-[11px] transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,s.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8",className:"jsx-a894832df36b68ca"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65",className:"jsx-a894832df36b68ca"})]}),(0,s.jsx)("span",{className:"jsx-a894832df36b68ca hidden sm:inline",children:"Search test cases..."}),(0,s.jsx)("kbd",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-a894832df36b68ca text-[9px] px-1 py-0.5 rounded border ml-auto hidden sm:inline",children:"⌘K"})]}),(0,s.jsx)("button",{onClick:()=>p.push("/projects/".concat(m,"/summary")),style:{borderColor:"var(--border)",color:"var(--text-secondary)"},className:"jsx-a894832df36b68ca hidden md:block px-3 py-1 text-xs font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",children:"Project Report"}),(0,s.jsx)("button",{onClick:()=>{Q(!0),setTimeout(()=>Q(!1),1500);let e=new Event("save-project");window.dispatchEvent(e)},style:{borderColor:$?"var(--status-pass-text)":"var(--border)",color:$?"var(--status-pass-text)":"var(--text-secondary)",backgroundColor:$?"var(--status-pass-bg)":"transparent"},className:"jsx-a894832df36b68ca px-3 py-1 text-xs font-medium rounded-md border transition-all",children:$?"Saved!":"Save"}),(0,s.jsx)("div",{className:"jsx-a894832df36b68ca flex-1"}),(0,s.jsx)("button",{onClick:()=>q(e=>!e),style:{color:"var(--text-tertiary)"},title:J?"Exit fullscreen":"Expand test cases",className:"jsx-a894832df36b68ca p-1.5 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:J?(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:(0,s.jsx)("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3",className:"jsx-a894832df36b68ca"})}):(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:(0,s.jsx)("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3",className:"jsx-a894832df36b68ca"})})})]})]}),(0,s.jsxs)("div",{ref:ee,style:{cursor:K?"col-resize":void 0},className:"jsx-a894832df36b68ca flex-1 flex min-h-0 relative",children:[!J&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{ref:et,style:{width:"".concat(100*X,"%")},className:"jsx-a894832df36b68ca "+"\n ".concat("mindmap"===W?"flex":"hidden","\n md:flex flex-col min-w-0 mobile-full-width\n "),children:(0,s.jsx)(v,{nodes:C.nodes,edges:C.edges,testCases:null!=(r=z.testCases)?r:{},selectedNodeId:f,onSelect:C.selectNode,onAddNode:(e,t,r,s)=>{N("Add node"),C.addNode(e,t,r,s)},onDeleteNode:e=>{N("Delete node"),C.deleteNode(e)},onDeleteNodes:e=>{N("Delete nodes"),C.deleteNodes(e)},onUnlinkNode:e=>{N("Unlink node"),C.unlinkNode(e)},onRenameNode:(e,t)=>{N("Rename node"),C.renameNode(e,t)},onUpdateNode:(e,t)=>{N("Update node"),C.updateNode(e,t)},onAddEdge:(e,t,r)=>{N("Add edge"),C.addEdge(e,t,r)},onDeleteEdge:e=>{N("Delete edge"),C.deleteEdge(e)},onUpdateEdge:(e,t)=>{N("Update edge"),C.updateEdge(e,t)},onResetLayout:()=>{N("Reset layout"),C.resetLayout()},canUndo:D,canRedo:E,onUndo:L,onRedo:M})}),(0,s.jsxs)("div",{ref:es,style:{width:20,cursor:"col-resize"},onMouseDown:eo,onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),className:"jsx-a894832df36b68ca hidden md:flex items-center justify-center flex-shrink-0 select-none relative group",children:[(0,s.jsx)("div",{style:{backgroundColor:Y||K?"var(--bg-secondary)":"transparent"},className:"jsx-a894832df36b68ca absolute inset-y-0 -left-2 -right-2 transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)",opacity:Y||K?0:1},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[1px] transition-opacity duration-150"}),(0,s.jsx)("div",{style:{background:"linear-gradient(180deg, #9E7AFF 0%, #FE8BBB 50%, #9E7AFF 100%)",opacity:Y||K?.8:.4,animation:"beamFlow 3s ease-in-out infinite",backgroundSize:"100% 200%"},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[2px] transition-opacity duration-150"}),(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca relative z-10 flex flex-col gap-1.5",children:[(0,s.jsx)("div",{style:{backgroundColor:Y||K?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:Y||K?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:Y||K?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"})]})]})]}),(0,s.jsx)("div",{ref:er,style:{width:J?"100%":"".concat((1-X)*100,"%")},className:"jsx-a894832df36b68ca "+"\n ".concat("testcases"===W?"flex":"hidden","\n md:flex flex-col min-w-0 mobile-full-width\n "),children:(0,s.jsx)(_,{selectedNode:I,testCases:w.testCases,stats:w.stats,columns:f?null!=(c=null!=(a=null==(e=z.columnConfigs)?void 0:e[f])?a:z.columnConfig)?c:[]:null!=(d=z.columnConfig)?d:[],projectId:m,fullscreen:J,allNodes:z.flows,allTestCases:z.testCases,onSelectNode:e=>{j(e),C.selectNode(e)},onAddTestCase:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Add test case"),w.addTestCase(...t)},onUpdateTestCase:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Update test case"),w.updateTestCase(...t)},onDeleteTestCase:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Delete test case"),w.deleteTestCase(...t)},onBulkDelete:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Delete test cases"),w.bulkDeleteTestCases(...t)},onBulkUpdate:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Update test cases"),w.bulkUpdateTestCases(...t)},onReorderTestCases:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Reorder test cases"),w.reorderTestCases(...t)},onToggleColumn:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Toggle column"),w.toggleColumnVisibility(...t)},onRenameColumn:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Rename column"),w.updateColumnConfig(...t)},onUpdateNode:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Update node"),C.updateNode(...t)},onAddColumn:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Add column"),w.addColumn(...t)},onDeleteColumn:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Delete column"),w.deleteColumn(...t)},onReorderColumn:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];N("Reorder column"),w.reorderColumn(...t)},confirmDialog:R})})]}),(0,s.jsx)(o(),{id:"a894832df36b68ca",children:"@media(max-width:767px){.mobile-full-width.jsx-a894832df36b68ca{width:100%!important}}"}),B&&z&&(0,s.jsx)(Z,{nodes:z.flows,testCases:null!=(x=z.testCases)?x:{},onSelectNode:e=>{j(e),C.selectNode(e)},onClose:()=>P(!1)})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading project..."})}):(0,s.jsx)(g.p,{message:"Project not found.",action:{label:"Back to Projects",onClick:()=>p.push("/projects")}})}V.displayName="DockIcon"},4269:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o});var s=r(2821),a=r(5889);function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,s.$)(t))}},5815:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var s=r(5155);function a(e){let{message:t,action:r}=e;return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-6 text-center",children:[(0,s.jsx)("img",{src:"https://static.vecteezy.com/system/resources/thumbnails/067/162/149/small/cute-duck-meme-sticker-transparent-cute-illustration-free-png.png",alt:"",className:"w-28 h-28 object-contain select-none opacity-15",draggable:!1}),(0,s.jsx)("p",{className:"text-sm max-w-[280px]",style:{color:"var(--text-tertiary)"},children:t}),r&&(0,s.jsx)("button",{onClick:r.onClick,className:"px-4 py-2 text-sm font-medium rounded-md transition-opacity hover:opacity-80",style:{backgroundColor:"var(--accent)",color:"var(--bg-primary)",borderRadius:"var(--radius-pill)"},children:r.label})]})}}},e=>{e.O(0,[343,909,793,968,253,246,642,441,255,358],()=>e(e.s=1868)),_N_E=e.O()}]);
|
package/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-1b2e89d37c95e30f.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[659],{1399:(e,r,t)=>{Promise.resolve().then(t.bind(t,6268))},6268:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>u});var s=t(5155),a=t(2115),l=t(63),o=t(2619),d=t.n(o),n=t(7246),i=t(7669),c=t(7711),x=t(158);function u(){var e,r,t;let o=(0,l.useParams)().projectId,{projects:x,updateProject:u}=(0,n.M)(),{activeProvider:p,activeProviderId:b,isConnected:h}=(0,i.P)(),f=x[o],[j,g]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),k=(0,a.useCallback)(e=>{f&&u(f.id,r=>({...r,notes:e}))},[f,u]),w=(0,a.useCallback)(async()=>{if(f&&p&&h){C(!0);try{let e=await (0,c.Js)(f.name,f.notes||"",p.apiKey,b||"google",p.defaultModel,p.baseURL);u(f.id,r=>({...r,notes:e}))}catch(e){console.error("Refine failed:",e)}finally{C(!1)}}},[f,u,p,b,h]);if(!f)return(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("p",{style:{color:"var(--text-tertiary)"},children:"Project not found."})});let R=Object.values(f.testCases).flat(),S=f.flows.length,E=R.length,P=(null!=(e=f.edges)?e:[]).length,M=R.filter(e=>"pass"===e.status).length,I=R.filter(e=>"fail"===e.status).length,_=R.filter(e=>"skip"===e.status).length,B=R.filter(e=>"untested"===e.status).length,F=R.filter(e=>"blocked"===e.status).length,J=E-_,L=J>0?Math.round(M/J*100):0,O=f.flows.map(e=>{var r;let t=null!=(r=f.testCases[e.id])?r:[],s=t.filter(e=>"pass"===e.status).length,a=t.filter(e=>"fail"===e.status).length,l=t.filter(e=>"skip"===e.status).length,o=t.length,d=o-l,n=d>0?Math.round(s/d*100):0;return{node:e,total:o,pass:s,fail:a,skip:l,rate:n}});return(0,s.jsxs)("div",{className:"h-full overflow-auto",children:[(0,s.jsxs)("div",{className:"px-5 py-4 border-b flex items-center gap-3",style:{borderColor:"var(--border)"},children:[(0,s.jsx)(d(),{href:"/projects/".concat(o),className:"text-xs px-2 py-1 rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"← Back"}),(0,s.jsxs)("h2",{className:"text-base font-medium flex-1",style:{color:"var(--text-primary)"},children:[f.name," — Summary"]}),(0,s.jsx)("button",{onClick:()=>g(!0),className:"px-3 py-1.5 text-xs font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Export"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 p-5",children:[(0,s.jsx)(m,{label:"Flow Nodes",value:S}),(0,s.jsx)(m,{label:"Test Cases",value:E}),(0,s.jsx)(m,{label:"Pass Rate",value:"".concat(L,"%"),color:"var(--status-pass-text)"}),(0,s.jsx)(m,{label:"Conditional Edges",value:P}),(0,s.jsx)(v,{type:f.type||"",onUpdate:e=>u(f.id,r=>({...r,type:e}))})]}),(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Status Breakdown"}),(0,s.jsxs)("div",{className:"flex gap-4 text-sm",style:{color:"var(--text-secondary)"},children:[(0,s.jsxs)("span",{children:["Pass: ",(0,s.jsx)("strong",{style:{color:"var(--status-pass-text)"},children:M})]}),(0,s.jsxs)("span",{children:["Fail: ",(0,s.jsx)("strong",{style:{color:"var(--status-fail-text)"},children:I})]}),(0,s.jsxs)("span",{children:["Skip: ",(0,s.jsx)("strong",{style:{color:"var(--status-skip-text)"},children:_})]}),(0,s.jsxs)("span",{children:["Untested: ",(0,s.jsx)("strong",{style:{color:"var(--status-untested-text)"},children:B})]}),(0,s.jsxs)("span",{children:["Blocked: ",(0,s.jsx)("strong",{style:{color:"var(--status-blocked-text)"},children:F})]})]})]}),(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Notes"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("textarea",{value:f.notes||"",onChange:e=>k(e.target.value),placeholder:"Add project notes, observations, or documentation...",rows:4,className:"w-full px-3 py-2 text-sm bg-transparent outline-none border resize-none transition-colors focus:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)"}}),h?(0,s.jsx)("button",{onClick:w,disabled:N||!f.notes,className:"absolute bottom-2 right-2 px-2 py-0.5 text-[10px] font-medium rounded border transition-all hover:bg-[var(--bg-secondary)] disabled:opacity-30 z-10",style:{borderColor:"var(--border)",color:"var(--accent)",backgroundColor:"var(--bg-card)",opacity:N?1:.7},title:"AI will refine your notes to be more structured",onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.7",children:N?"Refining...":"✦ Refine"}):(0,s.jsx)("button",{disabled:!0,className:"absolute bottom-2 right-2 px-2 py-0.5 text-[10px] font-medium rounded border opacity-30 cursor-not-allowed",style:{borderColor:"var(--border)",color:"var(--text-tertiary)",backgroundColor:"var(--bg-card)"},title:"Configure an LLM provider in Settings to use AI refine",children:"✦ Refine"})]})]}),(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Per-Node Breakdown"}),(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"text-left py-1.5 text-xs font-medium",style:{color:"var(--text-tertiary)"},children:"Code"}),(0,s.jsx)("th",{className:"text-left py-1.5 text-xs font-medium",style:{color:"var(--text-tertiary)"},children:"Node"}),(0,s.jsx)("th",{className:"text-right py-1.5 text-xs font-medium",style:{color:"var(--text-tertiary)"},children:"Cases"}),(0,s.jsx)("th",{className:"text-right py-1.5 text-xs font-medium",style:{color:"var(--text-tertiary)"},children:"Rate"}),(0,s.jsx)("th",{className:"py-1.5 w-24 text-xs font-medium",style:{color:"var(--text-tertiary)"}})]})}),(0,s.jsx)("tbody",{children:O.map(e=>{let{node:r,total:t,rate:a}=e;return(0,s.jsxs)("tr",{className:"border-t",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("td",{className:"py-2 font-mono text-xs",style:{color:"var(--text-tertiary)"},children:r.code||"—"}),(0,s.jsx)("td",{className:"py-2",style:{color:"var(--text-primary)"},children:r.label}),(0,s.jsx)("td",{className:"py-2 text-right",style:{color:"var(--text-secondary)"},children:t}),(0,s.jsx)("td",{className:"py-2 text-right",style:{color:a>=80?"var(--status-pass-text)":a>=50?"var(--status-skip-text)":"var(--status-fail-text)"},children:t>0?"".concat(a,"%"):"—"}),(0,s.jsx)("td",{className:"py-2",children:t>0&&(0,s.jsx)("div",{className:"h-2 w-full rounded-full overflow-hidden",style:{backgroundColor:"var(--bg-secondary)"},children:(0,s.jsx)("div",{className:"h-full rounded-full",style:{width:"".concat(a,"%"),backgroundColor:a>=80?"var(--status-pass-text)":a>=50?"var(--status-skip-text)":"var(--status-fail-text)"}})})})]},r.id)})})]})]}),(null!=(r=f.edges)?r:[]).length>0&&(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"Conditional Edges"}),(0,s.jsx)("div",{className:"flex flex-col gap-2",children:(null!=(t=f.edges)?t:[]).map(e=>{var r,t;let a=f.flows.find(r=>r.id===e.fromId),l=f.flows.find(r=>r.id===e.toId);return(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--text-secondary)"},children:[(0,s.jsx)("span",{style:{color:"var(--text-primary)"},children:null!=(r=null==a?void 0:a.label)?r:"?"}),(0,s.jsx)("span",{style:{color:"pass"===e.type?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===e.type?"→ ✓ Pass →":"fail"===e.type?"→ ✗ Fail →":"→"}),(0,s.jsx)("span",{style:{color:"var(--text-primary)"},children:null!=(t=null==l?void 0:l.label)?t:"?"})]},e.id)})})]}),(0,s.jsx)(y,{open:j,onClose:()=>g(!1),project:f})]})}function m(e){let{label:r,value:t,color:a}=e;return(0,s.jsxs)("div",{className:"p-3 rounded-md border",style:{borderColor:"var(--border)",borderRadius:"var(--radius-md)"},children:[(0,s.jsx)("div",{className:"text-xs mb-1",style:{color:"var(--text-tertiary)"},children:r}),(0,s.jsx)("div",{className:"text-lg font-medium",style:{color:null!=a?a:"var(--text-primary)"},children:t})]})}function v(e){let{type:r,onUpdate:t}=e,[l,o]=(0,a.useState)(!1);return(0,s.jsxs)("div",{className:"p-3 rounded-md border",style:{borderColor:"var(--border)",borderRadius:"var(--radius-md)"},children:[(0,s.jsxs)("div",{className:"text-xs mb-1 flex items-center justify-between",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("span",{children:"Project Type"}),(0,s.jsx)("button",{onClick:()=>o(e=>!e),className:"text-[10px] hover:underline transition-colors",style:{color:"var(--accent)"},children:l?"Done":"Edit"})]}),l?(0,s.jsxs)("select",{value:r,onChange:e=>{t(e.target.value),o(!1)},className:"w-full px-2 py-1 text-sm rounded border outline-none cursor-pointer",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)",color:r?"var(--text-primary)":"var(--text-tertiary)"},children:[(0,s.jsx)("option",{value:"",children:"None"}),(0,s.jsx)("option",{value:"Dashboard",children:"Dashboard"}),(0,s.jsx)("option",{value:"Website",children:"Website"}),(0,s.jsx)("option",{value:"Gak Jelas",children:"Gak Jelas"})]}):(0,s.jsx)("div",{className:"text-lg font-medium",style:{color:r?"var(--text-primary)":"var(--text-tertiary)"},children:r||"Not set"})]})}function y(e){let{open:r,onClose:t,project:a}=e;return r?(0,s.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:t,children:(0,s.jsxs)("div",{className:"w-full max-w-sm mx-4 rounded-xl p-5",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Export Project"}),(0,s.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["Export “",a.name,"” as:"]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("button",{onClick:()=>{(0,x.ii)(a),t()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Markdown (.md)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Formatted tables for documentation"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,x.Vj)(a),t()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"JSON (.json)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Full data backup"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,x.Bf)(a),t()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"CSV (.csv)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Spreadsheet-compatible format"})]}),(0,s.jsxs)("button",{onClick:async()=>{await (0,x.sy)(a),t()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Excel (.xlsx)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Styled spreadsheet with Summary tab"})]})]}),(0,s.jsx)("button",{onClick:t,className:"w-full mt-3 px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]})}):null}}},e=>{e.O(0,[343,619,968,246,642,441,255,358],()=>e(e.s=1399)),_N_E=e.O()}]);
|