test-lah 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +20 -20
  3. package/.next/standalone/.next/app-path-routes-manifest.json +4 -4
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +21 -21
  6. package/.next/standalone/.next/server/app/(dashboard)/integrations/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page.js +6 -6
  8. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  15. package/.next/standalone/.next/server/app/api/e2e/route.js +3 -3
  16. package/.next/standalone/.next/server/app/api/e2e/route_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/api/generate/route.js +3 -3
  18. package/.next/standalone/.next/server/app/api/generate/route_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/api/llm/encrypt/route_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/api/llm/test/route.js +3 -3
  21. package/.next/standalone/.next/server/app/api/llm/test/route_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/api/weather/route_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/index.html +1 -1
  24. package/.next/standalone/.next/server/app/index.rsc +2 -2
  25. package/.next/standalone/.next/server/app/integrations.html +1 -1
  26. package/.next/standalone/.next/server/app/integrations.rsc +2 -2
  27. package/.next/standalone/.next/server/app/login/page.js +1 -1
  28. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/login.html +1 -1
  30. package/.next/standalone/.next/server/app/login.rsc +2 -2
  31. package/.next/standalone/.next/server/app/page.js +1 -1
  32. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/projects.html +1 -1
  34. package/.next/standalone/.next/server/app/projects.rsc +2 -2
  35. package/.next/standalone/.next/server/app-paths-manifest.json +4 -4
  36. package/.next/standalone/.next/server/chunks/615.js +1 -1
  37. package/.next/standalone/.next/server/chunks/736.js +2 -2
  38. package/.next/standalone/.next/server/chunks/845.js +5 -5
  39. package/.next/standalone/.next/server/pages/404.html +1 -1
  40. package/.next/standalone/.next/server/pages/500.html +1 -1
  41. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-4f738ff151196fe8.js +1 -0
  42. package/.next/standalone/.next/static/css/ab7683c62149b050.css +3 -0
  43. package/.next/standalone/package.json +1 -1
  44. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-4f738ff151196fe8.js +1 -0
  45. package/.next/static/css/ab7683c62149b050.css +3 -0
  46. package/package.json +1 -1
  47. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-54a0bcaf9f4781a6.js +0 -1
  48. package/.next/standalone/.next/static/css/0ecf0abc0513341e.css +0 -3
  49. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-54a0bcaf9f4781a6.js +0 -1
  50. package/.next/static/css/0ecf0abc0513341e.css +0 -3
  51. /package/.next/standalone/.next/static/{KciO6b7pbSb5S7vZYVyl2 → Dmhhi1aH71i6LYut_5YOv}/_buildManifest.js +0 -0
  52. /package/.next/standalone/.next/static/{KciO6b7pbSb5S7vZYVyl2 → Dmhhi1aH71i6LYut_5YOv}/_ssgManifest.js +0 -0
  53. /package/.next/static/{KciO6b7pbSb5S7vZYVyl2 → Dmhhi1aH71i6LYut_5YOv}/_buildManifest.js +0 -0
  54. /package/.next/static/{KciO6b7pbSb5S7vZYVyl2 → Dmhhi1aH71i6LYut_5YOv}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
1
  (()=>{var a={};a.id=948,a.ids=[948],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19553:(a,b,c)=>{"use strict";c.d(b,{P:()=>i});var d=c(38301),e=c(79472);let f={apiKey:"",baseURL:"",defaultModel:"",secondaryModel:"",models:[],connected:!1};function g(){let a={};for(let b of e.Pj)a[b.id]={...f,baseURL:b.baseURL||""};return{activeProvider:null,providers:a}}function h(a){try{localStorage.setItem("qa-llm-config",JSON.stringify(a))}catch{}}function i(){let[a,b]=(0,d.useState)(g),[c,e]=(0,d.useState)(!1),f=(0,d.useCallback)((a,c)=>{let d=g(),e={...d,providers:{...d.providers,[a]:{...d.providers[a],...c}}};h(e),b(e)},[]),i=(0,d.useCallback)(a=>{let c={...g(),activeProvider:a};h(c),b(c)},[]),j=a.activeProvider?a.providers[a.activeProvider]:null,k=c&&!!j&&j.apiKey.length>0&&j.connected;return{config:a,loaded:c,isConnected:k,activeProvider:j,activeProviderId:a.activeProvider,updateProvider:f,setActiveProvider:i}}},21820:a=>{"use strict";a.exports=require("os")},22017:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>E.a,__next_app__:()=>K,handler:()=>M,pages:()=>J,routeModule:()=>L,tree:()=>I});var d=c(49754),e=c(9117),f=c(46595),g=c(32324),h=c(39326),i=c(38928),j=c(20175),k=c(12),l=c(54290),m=c(12696),n=c(52574),o=c(82802),p=c(77533),q=c(45229),r=c(32822),s=c(261),t=c(26453),u=c(52474),v=c(26713),w=c(51356),x=c(62685),y=c(36225),z=c(63446),A=c(2762),B=c(45742),C=c(86439),D=c(81170),E=c.n(D),F=c(62506),G=c(91203),H={};for(let a in F)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(H[a]=()=>F[a]);c.d(b,H);let I={children:["",{children:["(dashboard)",{children:["projects",{children:["[projectId]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,41009)),"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx"]}]},{}]},{}]},{layout:[()=>Promise.resolve().then(c.bind(c,97788)),"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/layout.tsx"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,87028,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,90461,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,32768,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,51472)),"/home/sltr91025/code-repository/open-source/test-lah/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,81170,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,87028,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,90461,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,32768,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]}.children,J=["/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx"],K={require:c,loadChunk:()=>Promise.resolve()},L=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/(dashboard)/projects/[projectId]/page",pathname:"/projects/[projectId]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:I},distDir:".next",relativeProjectDir:""});async function M(a,b,d){var D;let H="/(dashboard)/projects/[projectId]/page";"/index"===H&&(H="/");let N=(0,h.getRequestMeta)(a,"postponed"),O=(0,h.getRequestMeta)(a,"minimalMode"),P=await L.prepare(a,b,{srcPage:H,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,parsedUrl:T,pageIsDynamic:U,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,serverActionsManifest:Y,clientReferenceManifest:Z,subresourceIntegrityManifest:$,prerenderManifest:_,isDraftMode:aa,resolvedPathname:ab,revalidateOnlyGenerated:ac,routerServerContext:ad,nextConfig:ae,interceptionRoutePatterns:af}=P,ag=T.pathname||"/",ah=(0,s.normalizeAppPath)(H),{isOnDemandRevalidate:ai}=P,aj=L.match(ag,_),ak=!!_.routes[ab],al=!!(aj||ak||_.routes[ah]),am=a.headers["user-agent"]||"",an=(0,v.getBotType)(am),ao=(0,q.isHtmlBotRequest)(a),ap=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[u.NEXT_ROUTER_PREFETCH_HEADER],aq=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[u.RSC_HEADER]),ar=(0,t.getIsPossibleServerAction)(a),as=(0,m.checkIsAppPPREnabled)(ae.experimental.ppr)&&(null==(D=_.routes[ah]??_.dynamicRoutes[ah])?void 0:D.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?N:void 0,aw=as&&aq&&!ap,ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=!am||(0,q.shouldServeStreamingMetadata)(am,ae.htmlLimitedBots);ao&&as&&(al=!1,ay=!1);let az=!0===L.isDev||!al||"string"==typeof N||aw,aA=ao&&as,aB=null;aa||!al||az||ar||av||aw||(aB=ab);let aC=aB;!aC&&L.isDev&&(aC=ab),L.isDev||aa||!al||!aq||aw||(0,k.d)(a.headers);let aD={...F,tree:I,pages:J,GlobalError:E(),handler:M,routeModule:L,__next_app__:K};Y&&Z&&(0,p.setReferenceManifestsSingleton)({page:H,clientReferenceManifest:Z,serverActionsManifest:Y,serverModuleMap:(0,r.createServerModuleMap)({serverActionsManifest:Y})});let aE=a.method||"GET",aF=(0,g.getTracer)(),aG=aF.getActiveScopeSpan();try{let f=L.getVaryHeader(ab,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return L.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aF.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aE} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aE} ${a.url}`)})},m=async({span:e,postponed:f,fallbackRouteParams:g})=>{let i={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aD,Component:(0,j.T)(aD),params:S,routeModule:L,page:H,postponed:f,shouldWaitOnAllReady:aA,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||az,buildManifest:V,nextFontManifest:W,reactLoadableManifest:X,subresourceIntegrityManifest:$,serverActionsManifest:Y,clientReferenceManifest:Z,setIsrStatus:null==ad?void 0:ad.setIsrStatus,dir:c(33873).join(process.cwd(),L.relativeProjectDir),isDraftMode:aa,isRevalidate:al&&!f&&!aw,botType:an,isOnDemandRevalidate:ai,isPossibleServerAction:ar,assetPrefix:ae.assetPrefix,nextConfigOutput:ae.output,crossOrigin:ae.crossOrigin,trailingSlash:ae.trailingSlash,previewProps:_.preview,deploymentId:ae.deploymentId,enableTainting:ae.experimental.taint,htmlLimitedBots:ae.htmlLimitedBots,devtoolSegmentExplorer:ae.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:ae.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:ae.experimental.cacheLife,basePath:ae.basePath,serverActions:ae.experimental.serverActions,...at?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:at}:{},experimental:{isRoutePPREnabled:as,expireTime:ae.expireTime,staleTimes:ae.experimental.staleTimes,cacheComponents:!!ae.experimental.cacheComponents,clientSegmentCache:!!ae.experimental.clientSegmentCache,clientParamParsing:!!ae.experimental.clientParamParsing,dynamicOnHover:!!ae.experimental.dynamicOnHover,inlineCss:!!ae.experimental.inlineCss,authInterrupts:!!ae.experimental.authInterrupts,clientTraceMetadata:ae.experimental.clientTraceMetadata||[]},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>L.onRequestError(a,b,d,ad),err:(0,h.getRequestMeta)(a,"invokeError"),dev:L.isDev}},l=await k(e,i),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[z.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,al&&(null==n?void 0:n.revalidate)===0&&!L.isDev&&!as){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ab}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
2
- see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:w.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===L.isDev,l=c||b.writableEnded;if(ai&&ac&&!f&&!O)return(null==ad?void 0:ad.render404)?await ad.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(j=(0,x.parseFallbackField)(aj.fallback)),j===x.FallbackMode.PRERENDER&&(0,v.isBot)(am)&&(!as||ao)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(j!==x.FallbackMode.NOT_FOUND||f)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),!O&&j!==x.FallbackMode.BLOCKING_STATIC_RENDER&&aC&&!l&&!aa&&U&&(k||!ak)){let b;if((k||aj)&&j===x.FallbackMode.NOT_FOUND)throw new C.NoFallbackError;if(as&&!aq){let c="string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:k?ah:null;if(b=await L.handleResponse({cacheKey:c,req:a,nextConfig:ae,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:_,isRoutePPREnabled:as,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||au?(0,o.u)(ah):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=ai||g||!av?void 0:av;if(at&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:w.CachedRouteKind.PAGES,html:y.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=U&&as&&((0,h.getRequestMeta)(a,"renderFallbackShell")||au)?(0,o.u)(ag):null;return m({span:i,postponed:n,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,o=await L.handleResponse({cacheKey:aB,responseGenerator:a=>n({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ae,prerenderManifest:_,waitUntil:d.waitUntil});if(aa&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),L.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aB)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=o.value)?void 0:f.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=o.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;al&&!aw&&(!p||ap)&&(O||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(u.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(av)l={revalidate:0,expire:void 0};else if(O&&aq&&!ap&&as)l={revalidate:0,expire:void 0};else if(!L.isDev)if(aa)l={revalidate:0,expire:void 0};else if(al){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??ae.expireTime}}else l={revalidate:z.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(o.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===w.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[z.NEXT_CACHE_TAGS_HEADER];O&&al&&c&&"string"==typeof c&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(d,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&av)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(O&&al||delete a[z.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[z.NEXT_CACHE_TAGS_HEADER];if(O&&al&&s&&"string"==typeof s&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,s),!q.status||aq&&as||(b.statusCode=q.status),!O&&q.status&&G.RedirectStatusCode[q.status]&&aq&&(b.statusCode=200),p&&b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"1"),aq&&!aa){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:q.html,cacheControl:aw?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(q.rscData,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||O||aq)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:o.cacheControl});if(at)return t.push(new ReadableStream({start(a){a.enqueue(A.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let v=new TransformStream;return t.push(v.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(v.writable)}).catch(a=>{v.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aG)return await aF.withPropagatedContext(a.headers,()=>aF.trace(i.BaseServerSpan.handleRequest,{spanName:`${aE} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aE,"http.target":a.url}},p));await p(aG)}catch(b){throw b instanceof C.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:al,isOnDemandRevalidate:ai})},ad),b}}},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41009:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx","default")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41204:a=>{"use strict";a.exports=require("string_decoder")},42692:(a,b,c)=>{Promise.resolve().then(c.bind(c,62003))},49485:a=>{"use strict";a.exports=require("rimraf")},55511:a=>{"use strict";a.exports=require("crypto")},61252:(a,b,c)=>{Promise.resolve().then(c.bind(c,41009))},62003:(a,b,c)=>{"use strict";let d;c.r(b),c.d(b,{default:()=>dY});var e,f,g=c(21124),h=c(95627),i=c.n(h),j=c(38301),k=c.n(j),l=c(42378),m=c(5908);let n=(0,j.memo)(function({node:a,position:b,isSelected:c,testCases:d,isDragged:e,edgeDragActive:f,isEdgeDropTarget:h,deleteMode:i,isDeleteChecked:k,onSelect:l,onAddChild:m,onDelete:n,onUnlinkNode:o,onRename:p,onUpdateNode:q,onDragStart:r,onEdgeStart:s,onToggleDeleteCheck:t,depth:u,svgRef:v}){let[w,x]=(0,j.useState)(!1),[y,z]=(0,j.useState)(a.label),[A,B]=(0,j.useState)(!1),[C,D]=(0,j.useState)(!1),[E,F]=(0,j.useState)("horizontal"),[G,H]=(0,j.useState)(""),I=(0,j.useRef)(null),J=(0,j.useRef)(null),K=(0,j.useRef)(null),L=(0,j.useRef)({startX:0,startY:0,moved:!1}),{w:M,h:N}=0===u?{w:160,h:56}:1===u?{w:144,h:48}:{w:132,h:42},O=d.some(a=>"fail"===a.status),P=d.length>0&&d.every(a=>"pass"===a.status||"skip"===a.status);(0,j.useEffect)(()=>{let b=b=>{let c=b.detail;c?.parentId===a.id&&(D(!0),H(""))};return window.addEventListener("mindmap:add-child",b),()=>window.removeEventListener("mindmap:add-child",b)},[a.id]),(0,j.useEffect)(()=>{if(!C)return;let a=a=>{K.current&&!K.current.contains(a.target)&&(G.trim()?S():(D(!1),H("")))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[C,G]),(0,j.useEffect)(()=>{C&&J.current&&J.current.focus()},[C]);let Q=(0,j.useCallback)(()=>{z(a.label),x(!0),setTimeout(()=>I.current?.focus(),0)},[a.label]),R=(0,j.useCallback)(()=>{y.trim()&&p(a.id,y.trim()),x(!1)},[y,a.id,p]),S=(0,j.useCallback)(()=>{if(G.trim()){let c="vertical"===E?{x:b.x,y:b.y+N+60}:{x:b.x+M+120,y:b.y};m(a.id,G.trim(),c,E)}D(!1),H("")},[G,a.id,m,b.x,b.y,N,M,E]),T=(0,j.useCallback)(a=>b=>{b.stopPropagation(),F(a),D(!0),H("")},[]),U=(0,j.useCallback)(c=>{if(2===c.button||i)return;if(c.stopPropagation(),!c.target.closest('[data-drag-handle="true"]'))return void l(a.id);c.preventDefault(),L.current={startX:c.clientX,startY:c.clientY,moved:!1};let d=a=>a.preventDefault();document.addEventListener("contextmenu",d);let e=c=>{let d=c.clientX-L.current.startX,e=c.clientY-L.current.startY;!L.current.moved&&(Math.abs(d)>6||Math.abs(e)>6)&&(L.current.moved=!0,r(a.id,L.current.startX,L.current.startY,b.x,b.y))},f=()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",f),setTimeout(()=>document.removeEventListener("contextmenu",d),100)};window.addEventListener("mousemove",e),window.addEventListener("mouseup",f)},[a.id,l,r,i,b]),V=a.id.replace(/[^a-zA-Z0-9]/g,"").slice(0,8),W=c&&!i;return(0,g.jsxs)("g",{transform:`translate(${b.x}, ${b.y})`,onMouseDown:U,onDoubleClick:a=>{a.stopPropagation(),i||Q()},onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),style:{cursor:i?"pointer":"default",transition:e?"none":"transform 150ms ease-out"},onClick:()=>{i&&t(a.id)},children:[(0,g.jsxs)("defs",{children:[(0,g.jsxs)("linearGradient",{id:`fill-${V}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,g.jsx)("stop",{offset:"0%",stopColor:"#FFFFFF"}),(0,g.jsx)("stop",{offset:"100%",stopColor:"#FAF9F7"})]}),(0,g.jsxs)("filter",{id:`shadow-${V}`,x:"-10%",y:"-10%",width:"120%",height:"130%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.08"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"3",stdDeviation:"6",floodOpacity:"0.05"})]}),(0,g.jsxs)("filter",{id:`shadow-hover-${V}`,x:"-10%",y:"-10%",width:"120%",height:"140%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"2",stdDeviation:"4",floodOpacity:"0.12"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"6",stdDeviation:"12",floodOpacity:"0.08"})]}),(0,g.jsxs)("filter",{id:`shadow-drag-${V}`,x:"-20%",y:"-20%",width:"140%",height:"160%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"4",stdDeviation:"8",floodOpacity:"0.2"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"8",stdDeviation:"16",floodOpacity:"0.1"})]}),(0,g.jsxs)("filter",{id:`glow-${V}`,x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,g.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"blur"}),(0,g.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"})]})]}),!i&&(0,g.jsxs)("g",{"data-drag-handle":"true",transform:`translate(0, ${-N/2-10})`,style:{cursor:e?"grabbing":"grab"},children:[(0,g.jsx)("rect",{x:-20,y:-7,width:40,height:14,rx:4,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1,opacity:A||c?.9:.5,style:{transition:"opacity 150ms ease-out"}}),(0,g.jsx)("circle",{cx:-8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:0,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:0,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6})]}),h&&(0,g.jsx)("rect",{x:-M/2-6,y:-N/2-6,width:M+12,height:N+12,rx:8,fill:"var(--status-pass-bg)",stroke:"var(--status-pass-text)",strokeWidth:2,opacity:.5}),(()=>{let a=O?"var(--status-fail-bg)":P?"var(--status-pass-bg)":null;return(0,g.jsxs)(g.Fragment,{children:[a&&(0,g.jsx)("rect",{x:-M/2,y:-N/2,width:M,height:N,rx:4,fill:a,opacity:.15}),(0,g.jsx)("rect",{x:-M/2,y:-N/2,width:M,height:N,rx:4,fill:`url(#fill-${V})`,stroke:i&&k?"var(--status-fail-text)":"var(--border)",strokeWidth:i&&k?2:.5,filter:e?`url(#shadow-drag-${V})`:A?`url(#shadow-hover-${V})`:`url(#shadow-${V})`,style:{transition:"filter 200ms ease-out, stroke 150ms ease-out"}}),(0,g.jsx)("path",{d:`M ${M/2-10} ${-N/2} L ${M/2} ${-N/2} L ${M/2} ${-N/2+10} Z`,fill:"var(--bg-secondary)",opacity:.5}),(0,g.jsx)("path",{d:`M ${M/2-10} ${-N/2} L ${M/2-10} ${-N/2+10} L ${M/2} ${-N/2+10}`,fill:"none",stroke:"var(--border)",strokeWidth:.5,opacity:.4})]})})(),i&&(0,g.jsxs)("g",{transform:`translate(${-M/2+8}, 0)`,children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:k?"var(--status-fail-text)":"transparent",stroke:k?"var(--status-fail-text)":"var(--border)",strokeWidth:1.5}),k&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),a.code&&!i&&(0,g.jsxs)("g",{transform:`translate(${-M/2+6}, ${-N/2-11})`,style:{opacity:A||c?1:0,transition:"opacity 150ms ease-out"},children:[(0,g.jsx)("rect",{x:0,y:0,width:Math.max(6.5*a.code.length+10,28),height:14,rx:7,fill:"var(--accent)",opacity:.08}),(0,g.jsx)("text",{x:5,y:10,style:{fill:"var(--text-tertiary)",fontSize:8,fontWeight:500,fontFamily:"monospace",letterSpacing:"0.05em"},children:a.code})]}),w?(0,g.jsx)("foreignObject",{x:-M/2+8,y:-N/2+4,width:M-16,height:N-8,children:(0,g.jsx)("input",{ref:I,value:y,onChange:a=>z(a.target.value),onBlur:R,onKeyDown:a=>{"Enter"===a.key&&R(),"Escape"===a.key&&x(!1)},className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})}):(0,g.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",className:"select-none",onClick:a=>{a.stopPropagation(),i||Q()},style:{fill:"var(--text-primary)",fontSize:0===u?13:11.5,fontWeight:0===u?600:450,fontFamily:"inherit",letterSpacing:"-0.01em",cursor:A&&!i?"text":"default",pointerEvents:"auto"},children:a.label.length>22?a.label.slice(0,22)+"…":a.label}),W&&!w&&!f&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("g",{transform:`translate(${M/2+3}, -11)`,children:[(0,g.jsxs)("g",{onClick:T("horizontal"),onMouseDown:a=>a.stopPropagation(),style:{cursor:"pointer"},children:[(0,g.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,g.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,g.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,g.jsx)("g",{transform:"translate(24, 7)",onMouseDown:c=>{c.stopPropagation(),c.preventDefault(),s(a.id,"pass",b.x+M/2+3+22+2+4,b.y-11+11,"horizontal")},onContextMenu:c=>{c.preventDefault(),c.stopPropagation(),s(a.id,"fail",b.x+M/2+3+22+2+4,b.y-11+11,"horizontal")},style:{cursor:"crosshair"},children:(0,g.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--status-pass-text)",opacity:.8,children:(0,g.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]}),(0,g.jsxs)("g",{transform:`translate(-11, ${N/2+3})`,children:[(0,g.jsxs)("g",{onClick:T("vertical"),onMouseDown:a=>a.stopPropagation(),style:{cursor:"pointer"},children:[(0,g.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,g.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,g.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,g.jsx)("g",{transform:"translate(24, 7)",onMouseDown:c=>{c.stopPropagation(),c.preventDefault(),s(a.id,"pass",b.x-11+11,b.y+N/2+3+22+2+4,"vertical")},onContextMenu:c=>{c.preventDefault(),c.stopPropagation(),s(a.id,"fail",b.x-11+11,b.y+N/2+3+22+2+4,"vertical")},style:{cursor:"crosshair"},children:(0,g.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--accent)",opacity:.8,children:(0,g.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]})]}),f&&!h&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("g",{transform:`translate(${-M/2-10}, 0)`,children:(0,g.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})}),(0,g.jsx)("g",{transform:`translate(0, ${-N/2-10})`,children:(0,g.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})})]}),C&&(0,g.jsxs)("g",{children:["vertical"===E?(0,g.jsx)("line",{x1:0,y1:N/2,x2:0,y2:N/2+50,stroke:"var(--border-hover)",strokeWidth:1.5}):(0,g.jsx)("line",{x1:M/2,y1:0,x2:M/2+50,y2:0,stroke:"var(--border-hover)",strokeWidth:1.5}),(0,g.jsx)("rect",{x:"vertical"===E?-M/2:M/2+50,y:"vertical"===E?N/2+50:-N/2,width:M,height:N,rx:4,fill:"var(--bg-card)",stroke:"var(--accent)",strokeWidth:1,strokeDasharray:"4 3"}),(0,g.jsx)("foreignObject",{x:"vertical"===E?-M/2+4:M/2+50+4,y:"vertical"===E?N/2+50+4:-N/2+4,width:M-8,height:N-8,children:(0,g.jsx)("div",{ref:K,children:(0,g.jsx)("input",{ref:J,value:G,onChange:a=>H(a.target.value),onBlur:()=>{G.trim()?S():(D(!1),H(""))},onKeyDown:a=>{"Enter"===a.key&&S(),"Escape"===a.key&&(D(!1),H("")),a.stopPropagation()},onMouseDown:a=>a.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 o=c(58403),p=c(44943);function q({width:a=16,height:b=16,x:c=0,y:d=0,cx:e=1,cy:f=1,cr:h=1,className:i,glow:k=!1,...l}){let m=(0,j.useId)(),n=(0,j.useRef)(null),[q,r]=(0,j.useState)({width:0,height:0}),s=Array.from({length:Math.ceil(q.width/a)*Math.ceil(q.height/b)},(g,h)=>{let i=h%Math.ceil(q.width/a),j=Math.floor(h/Math.ceil(q.width/a));return{x:i*a+e+c,y:j*b+f+d,delay:5*Math.random(),duration:3*Math.random()+2}});return(0,g.jsxs)("svg",{ref:n,"aria-hidden":"true",className:(0,p.cn)("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",i),...l,children:[(0,g.jsx)("defs",{children:(0,g.jsxs)("radialGradient",{id:`${m}-gradient`,children:[(0,g.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),(0,g.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),s.map(a=>(0,g.jsx)(o.P.circle,{cx:a.x,cy:a.y,r:h,fill:k?`url(#${m}-gradient)`:"currentColor",initial:k?{opacity:.4,scale:1}:{},animate:k?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:k?{duration:a.duration,repeat:1/0,repeatType:"reverse",delay:a.delay,ease:"easeInOut"}:{}},`${a.x}-${a.y}`))]})}let r=k().forwardRef(({className:a,children:b,rippleColor:c="#ffffff",duration:d="600ms",onClick:e,...f},h)=>{let[i,k]=(0,j.useState)([]);return(0,j.useEffect)(()=>{let a=null;if(i.length>0){let b=i[i.length-1];a=setTimeout(()=>{k(a=>a.filter(a=>a.key!==b.key))},parseInt(d))}return()=>{null!==a&&clearTimeout(a)}},[i,d]),(0,g.jsxs)("button",{className:(0,p.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",a),onClick:a=>{(a=>{let b=a.currentTarget.getBoundingClientRect(),c=Math.max(b.width,b.height),d={x:a.clientX-b.left-c/2,y:a.clientY-b.top-c/2,size:c,key:Date.now()};k(a=>[...a,d])})(a),e?.(a)},ref:h,...f,children:[(0,g.jsx)("div",{className:"relative z-10",children:b}),(0,g.jsx)("span",{className:"pointer-events-none absolute inset-0",children:i.map(a=>(0,g.jsx)("span",{className:"animate-rippling bg-background absolute rounded-full opacity-30",style:{width:`${a.size}px`,height:`${a.size}px`,top:`${a.y}px`,left:`${a.x}px`,backgroundColor:c,transform:"scale(0)","--duration":d}},a.key))})]})});function s({nodes:a,edges:b,testCases:c,selectedNodeId:d,onSelect:e,onAddNode:f,onDeleteNode:h,onDeleteNodes:i,onUnlinkNode:k,onRenameNode:l,onUpdateNode:m,onAddEdge:o,onDeleteEdge:p,onUpdateEdge:s,canUndo:v,canRedo:w,onUndo:x,onRedo:y}){let z=(0,j.useMemo)(()=>(function(a){let b=new Map;if(0===a.length)return b;let c=new Map;for(let b of a)c.set(b.id,b);let d=new Set;for(let b of a)b.position&&d.add(b.id);let e=a.filter(a=>null===a.parentId);if(0===e.length)return b;let f=0;for(let a of e)f=function a(e,f,g,h,i){let j=c.get(e);if(!j)return g;let k="vertical"===j.direction,l=k?j.position?.x??h:60+180*f,m=g;for(let b of j.children)m=k?a(b,f,m,h,i):a(b,f+1,m,h,i);let n=j.children.map(a=>b.get(a)).filter(Boolean),o=n.length>0?(Math.min(...n.map(a=>a.y))+Math.max(...n.map(a=>a.y)))/2:g;if(d.has(e)&&j.position){let c=n.length>0?o:g,d=j.position.x-(k?j.position.x:l),h=j.position.y-c;b.set(e,j.position);let i=g;for(let b of j.children)i=k?a(b,f,i,d,h):a(b,f+1,i,d,h);return i}return k?b.set(e,{x:(j.position?.x??0)+h,y:o+i}):b.set(e,{x:l+h,y:o+i}),m}(a.id,0,f,0,0);let g=Array.from(b.entries());if(g.length>0){let a=g.filter(([a])=>!d.has(a)).map(([,a])=>a.y);if(a.length>0){let c=(Math.min(...a)+Math.max(...a))/2;for(let[a,e]of g)d.has(a)||b.set(a,{x:e.x,y:e.y-c+300})}}return b})(a),[a]),[A,B]=(0,j.useState)({x:0,y:0}),[C,D]=(0,j.useState)(1),[E,F]=(0,j.useState)(!1),[G,H]=(0,j.useState)({x:0,y:0}),[I,J]=(0,j.useState)(null),[K,L]=(0,j.useState)(!1),[M,N]=(0,j.useState)(null),[O,P]=(0,j.useState)(null),[Q,R]=(0,j.useState)(null),[S,T]=(0,j.useState)(null),[U,V]=(0,j.useState)(!1),[W,X]=(0,j.useState)(new Set),[Y,Z]=(0,j.useState)(!1),[$,_]=(0,j.useState)(null),[aa,ab]=(0,j.useState)(!1),[ac,ad]=(0,j.useState)(new Set),ae=(0,j.useRef)(null),af=(0,j.useRef)(null),ag=(0,j.useRef)(null),ah=(0,j.useCallback)(()=>{let a=Array.from(z.values());if(0===a.length){D(1),B({x:0,y:0});return}if(!ae.current)return;let b=ae.current.getBoundingClientRect(),c=Math.min(...a.map(a=>a.x))-80,d=Math.max(...a.map(a=>a.x))+80,e=Math.min(...a.map(a=>a.y))-80,f=Math.max(...a.map(a=>a.y))+80,g=Math.min(b.width/(d-c),b.height/(f-e),1.5);D(g),B({x:b.width/2/g-(c+d)/2,y:b.height/2/g-(e+f)/2})},[z]),ai=(0,j.useCallback)((a,b)=>{if(!ae.current)return{x:0,y:0};let c=ae.current.getBoundingClientRect();return{x:(a-c.left)/C-A.x,y:(b-c.top)/C-A.y}},[C,A]),aj=(0,j.useCallback)(a=>{a.target===ae.current&&(F(!0),H({x:a.clientX-A.x*C,y:a.clientY-A.y*C}))},[A,C]),ak=(0,j.useCallback)(b=>{if(E&&B({x:(b.clientX-G.x)/C,y:(b.clientY-G.y)/C}),I){let a=ai(I.startClientX,I.startClientY),c=ai(b.clientX,b.clientY),d=c.x-a.x,e=c.y-a.y,f=I.startNodeX+d,g=I.startNodeY+e;ag.current={id:I.id,x:f,y:g},af.current||(af.current=requestAnimationFrame(()=>{ag.current&&(m(ag.current.id,{position:{x:ag.current.x,y:ag.current.y}}),ag.current=null),af.current=null}))}if(O){let c=ai(b.clientX,b.clientY);P(a=>a?{...a,curX:c.x,curY:c.y}:null);let d=null;for(let b of a){if(b.id===O.fromId)continue;let a=z.get(b.id);if(!a)continue;let e=c.x-a.x,f=c.y-a.y;if(80>Math.abs(e)&&40>Math.abs(f)){d=b.id;break}}T(d)}},[E,G,C,I,O,ai,m,a,z]),al=(0,j.useCallback)(()=>{if(O){let b={x:O.curX,y:O.curY};for(let c of a){let a=z.get(c.id);if(!a)continue;let d=b.x-a.x,e=b.y-a.y;if(80>Math.abs(d)&&40>Math.abs(e)&&c.id!==O.fromId){o(O.fromId,c.id,O.type);break}}P(null),T(null)}F(!1),J(null),af.current&&(cancelAnimationFrame(af.current),af.current=null)},[O,a,z,o]),am=(0,j.useCallback)(a=>{a.target===ae.current&&(e(null),L(!1))},[e]),an=(0,j.useCallback)(a=>{a.target===ae.current&&(N(ai(a.clientX,a.clientY)),L(!0))},[ai]),ao=(0,j.useCallback)(a=>{a.trim()&&f(null,a.trim(),M??void 0),L(!1),N(null)},[f,M]),ap=(0,j.useCallback)((a,b,c,d,e)=>{J({id:a,startNodeX:d,startNodeY:e,startClientX:b,startClientY:c})},[]),aq=(0,j.useCallback)((a,b,c,d,e)=>{P({fromId:a,type:b,startX:c,startY:d,curX:c,curY:d,direction:e})},[]),ar=(0,j.useCallback)(()=>{V(a=>!a),X(new Set),ab(!1),ad(new Set)},[]),as=(0,j.useCallback)(()=>{ab(a=>!a),ad(new Set),V(!1),X(new Set)},[]),at=(0,j.useCallback)(a=>{ad(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),au=(0,j.useCallback)(()=>{Array.from(ac).forEach(a=>{a.startsWith("tree-")?k(a.replace("tree-","")):p(a)}),ad(new Set),ab(!1)},[ac,k,p]),av=(0,j.useCallback)(a=>{X(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),aw=(0,j.useCallback)(()=>{$?(h($),_(null)):W.size>0&&(i(Array.from(W)),X(new Set),V(!1)),Z(!1)},[$,W,h,i]),ax=Array.from(z.values());return ax.length>0&&(ax.map(a=>a.x),ax.map(a=>a.x)),ax.length>0&&(ax.map(a=>a.y),ax.map(a=>a.y)),(0,g.jsxs)("div",{className:"relative w-full h-full overflow-hidden",style:{backgroundColor:"var(--bg-primary)"},children:[(0,g.jsx)(q,{width:24,height:24,cr:1,className:"text-neutral-300/60 dark:text-neutral-600/40"}),(0,g.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1",children:[(0,g.jsx)("button",{onClick:()=>D(a=>Math.min(3,1.2*a)),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,g.jsx)("button",{onClick:()=>D(a=>Math.max(.2,.8*a)),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,g.jsx)("button",{onClick:ah,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,g.jsxs)("div",{className:"text-[10px] text-center mt-0.5",style:{color:"var(--text-tertiary)"},children:[Math.round(100*C),"%"]}),(0,g.jsxs)("div",{className:"mt-1 border-t pt-1",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:ar,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:U?"var(--status-fail-text)":"var(--border)",color:U?"var(--status-fail-text)":"var(--text-secondary)",backgroundColor:U?"var(--status-fail-bg)":"var(--bg-card)"},title:U?"Exit delete mode":"Delete nodes",children:(0,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,g.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,g.jsx)("button",{onClick:as,className:"w-7 h-7 mt-1 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:aa?"var(--status-skip-text)":"var(--border)",color:aa?"var(--status-skip-text)":"var(--text-secondary)",backgroundColor:aa?"var(--status-skip-bg)":"var(--bg-card)"},title:aa?"Exit unlink mode":"Unlink lines",children:(0,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("path",{d:"M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3"}),(0,g.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12",strokeDasharray:"3 3"})]})})]})]}),(0,g.jsxs)("div",{className:"absolute top-3 left-3 z-10 flex flex-col gap-1",children:[(0,g.jsx)("button",{onClick:x,disabled:!v,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,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,g.jsx)("path",{d:"M3 5h5a3 3 0 0 1 0 6H6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,g.jsx)("path",{d:"M5.5 2.5L3 5l2.5 2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),(0,g.jsx)("button",{onClick:y,disabled:!w,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,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,g.jsx)("path",{d:"M11 5H6a3 3 0 0 0 0 6h2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,g.jsx)("path",{d:"M8.5 2.5L11 5 8.5 7.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})})]}),U&&(0,g.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,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select nodes to delete"}),(0,g.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:[W.size," selected"]}),(0,g.jsx)("button",{onClick:()=>{W.size>0&&Z(!0)},disabled:0===W.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,g.jsx)("button",{onClick:ar,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"})]}),aa&&(0,g.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,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select lines to unlink"}),(0,g.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-skip-bg)",color:"var(--status-skip-text)"},children:[ac.size," selected"]}),(0,g.jsx)("button",{onClick:au,disabled:0===ac.size,className:"px-3 py-1 text-[11px] font-medium rounded transition-colors disabled:opacity-40",style:{backgroundColor:"var(--status-skip-text)",color:"white"},children:"Unlink"}),(0,g.jsx)("button",{onClick:as,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"})]}),Y&&(0,g.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:()=>Z(!1),children:(0,g.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:a=>a.stopPropagation(),children:[(0,g.jsxs)("h3",{className:"text-sm font-semibold mb-2",style:{color:"var(--text-primary)"},children:["Delete ",$?"node":`${W.size} node${W.size>1?"s":""}`,"?"]}),(0,g.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["This will permanently remove the ",$?"node":`selected node${W.size>1?"s":""}`," and all their test cases. This action cannot be undone."]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("button",{onClick:()=>Z(!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,g.jsx)("button",{onClick:aw,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"})]})]})}),d&&(0,g.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex gap-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Tab = add child"}),(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Enter = add sibling"}),(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Del = delete"})]}),(0,g.jsxs)("svg",{ref:ae,width:"100%",height:"100%",onMouseDown:aj,onMouseMove:ak,onMouseUp:al,onClick:am,onDoubleClick:an,style:{cursor:E||I?"grabbing":O?"crosshair":"default"},children:[(0,g.jsxs)("defs",{children:[(0,g.jsx)("marker",{id:"arrow-pass",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-pass-text)"})}),(0,g.jsx)("marker",{id:"arrow-fail",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-fail-text)"})}),(0,g.jsx)("marker",{id:"arrow-default",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--text-tertiary)"})})]}),(0,g.jsxs)("g",{transform:`scale(${C}) translate(${A.x}, ${A.y})`,children:[a.map(c=>{let d;if(!c.parentId)return null;let e=z.get(c.parentId),f=z.get(c.id);if(!e||!f||b.some(a=>a.fromId===c.parentId&&a.toId===c.id||a.fromId===c.id&&a.toId===c.parentId))return null;let h=a.find(a=>a.id===c.parentId),i=h?.direction==="vertical",j=`tree-${c.id}`,l=ac.has(j);if(i){let a=e.y+40,b=f.y-40;d=`M ${e.x} ${e.y+28} C ${e.x} ${a}, ${f.x} ${b}, ${f.x} ${f.y-21}`}else{let a=e.x+60,b=f.x-60;d=`M ${e.x+70} ${e.y} C ${a} ${e.y}, ${b} ${f.y}, ${f.x-60} ${f.y}`}let m=(e.x+f.x)/2,n=(e.y+f.y)/2;return(0,g.jsxs)("g",{children:[(0,g.jsx)("path",{d:d,fill:"none",stroke:"transparent",strokeWidth:12,style:{cursor:"pointer"},onClick:()=>{aa?at(j):o(c.parentId,c.id,"pass")},onDoubleClick:a=>{a.stopPropagation(),aa||k(c.id)}}),(0,g.jsx)("path",{d:d,fill:"none",stroke:aa&&l?"var(--status-skip-text)":"var(--border-hover)",strokeWidth:aa&&l?2.5:1.5,strokeDasharray:aa&&l?"6 4":"none",style:{pointerEvents:"none",transition:"stroke 150ms, stroke-width 150ms"}}),aa&&(0,g.jsxs)("g",{transform:`translate(${m}, ${n})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:l?"var(--status-skip-text)":"var(--bg-card)",stroke:l?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),l&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})]},`tree-edge-${c.id}`)}),b.map(b=>{let c,d=z.get(b.fromId),e=z.get(b.toId);if(!d||!e)return null;let f="pass"===b.type,h="fail"===b.type;b.type;let i=f?"var(--status-pass-text)":h?"var(--status-fail-text)":"var(--text-tertiary)",j=(d.x+e.x)/2,k=(d.y+e.y)/2-12,l=ac.has(b.id),m=a.find(a=>a.id===b.fromId);return c=m?.direction==="vertical"?`M ${d.x} ${d.y} C ${d.x} ${d.y+80}, ${e.x} ${e.y-80}, ${e.x} ${e.y}`:`M ${d.x} ${d.y} C ${d.x+80} ${d.y}, ${e.x-80} ${e.y}, ${e.x} ${e.y}`,(0,g.jsxs)("g",{children:[(0,g.jsx)("path",{d:c,fill:"none",stroke:"transparent",strokeWidth:16,style:{cursor:"pointer"},onClick:()=>{aa?at(b.id):f?s(b.id,{type:"fail"}):h?s(b.id,{type:"default"}):s(b.id,{type:"pass"})},onMouseEnter:()=>R(b.id),onMouseLeave:()=>R(null)}),(0,g.jsx)("path",{d:c,fill:"none",stroke:aa&&l?"var(--status-skip-text)":i,strokeWidth:aa&&l||Q===b.id?2.5:1.8,strokeDasharray:aa&&l?"6 4":f?"none":h?"6 4":"3 3",markerEnd:aa?void 0:f?"url(#arrow-pass)":h?"url(#arrow-fail)":"url(#arrow-default)",style:{transition:"stroke-width 150ms ease-out, stroke 150ms ease-out",pointerEvents:"none"}}),aa&&(0,g.jsxs)("g",{transform:`translate(${j}, ${k})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:l?"var(--status-skip-text)":"var(--bg-card)",stroke:l?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),l&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),!aa&&Q===b.id&&(0,g.jsxs)("g",{transform:`translate(${j}, ${k-12})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-22,y:-7,width:44,height:14,rx:7,fill:f?"var(--status-pass-bg)":h?"var(--status-fail-bg)":"var(--bg-secondary)",stroke:f?"var(--status-pass-text)":h?"var(--status-fail-text)":"var(--border)",strokeWidth:.5}),(0,g.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:i,fontSize:9,fontWeight:500},children:f?"Pass":h?"Fail":"Default"})]})]},b.id)}),O&&(0,g.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}),a.map(b=>{let i=z.get(b.id);if(!i)return null;let j=function(a,b){let c=0,d=a;for(;d.parentId;){c++;let a=b.find(a=>a.id===d.parentId);if(!a)break;d=a}return c}(b,a);return(0,g.jsx)(n,{node:b,position:i,isSelected:b.id===d,testCases:c[b.id]??[],isDragged:I?.id===b.id,edgeDragActive:null!==O,isEdgeDropTarget:S===b.id&&null!==O&&b.id!==O.fromId,deleteMode:U,isDeleteChecked:W.has(b.id),onSelect:e,onAddChild:(a,b,c,d)=>{f(a,b,c,d)},onDelete:h,onUnlinkNode:k,onRename:l,onUpdateNode:m,onDragStart:ap,onEdgeStart:aq,onToggleDeleteCheck:av,depth:j,svgRef:ae},b.id)})]})]}),K&&M&&(0,g.jsx)(u,{position:M,scale:C,pan:A,svgRef:ae,onSubmit:ao,onCancel:()=>L(!1)}),0===a.length&&!K&&(0,g.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,g.jsx)(r,{onClick:()=>{if(!ae.current){N({x:0,y:0}),L(!0);return}let a=ae.current.getBoundingClientRect();N({x:a.width/2/C-A.x,y:a.height/2/C-A.y}),L(!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,g.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,g.jsx)("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),"Create your first flow node"]})})}),a.length>0&&(0,g.jsx)(t,{nodes:a,positions:z,pan:A,scale:C})]})}function t({nodes:a,positions:b,pan:c,scale:d}){let e=Array.from(b.values());if(0===e.length)return null;let f=Math.min(...e.map(a=>a.x)),h=Math.max(...e.map(a=>a.x)),i=Math.min(...e.map(a=>a.y)),j=Math.max(...e.map(a=>a.y)),k=h-f+80,l=j-i+80,m=Math.max(60,l/k*120),n=120/k,o=m/l;return(0,g.jsx)("div",{className:"absolute bottom-3 right-3 border z-10",style:{width:120,height:m,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",borderRadius:"var(--radius-sm)",opacity:.85},children:(0,g.jsx)("svg",{width:120,height:m,children:a.map(a=>{let c=b.get(a.id);if(!c)return null;let d=(c.x-f+40)*n,e=(c.y-i+40)*o;return(0,g.jsx)("circle",{cx:d,cy:e,r:2.5,fill:"var(--accent)",opacity:.6},a.id)})})})}function u({position:a,scale:b,pan:c,svgRef:d,onSubmit:e,onCancel:f}){let[h,i]=(0,j.useState)(""),k=(0,j.useRef)(null),l=(0,j.useRef)(null),m=(0,j.useCallback)(()=>{if(!d.current)return{left:"50%",top:"50%"};let e=d.current.getBoundingClientRect();return{left:(a.x+c.x)*b+e.left,top:(a.y+c.y)*b+e.top}},[a,b,c,d])(),n=144*b,o=48*b;return(0,g.jsxs)("div",{ref:l,className:"fixed z-50",style:{left:`${m.left}px`,top:`${m.top}px`,transform:"translate(-50%, 0)"},children:[(0,g.jsx)("div",{style:{width:2,height:20*b,margin:"0 auto",backgroundColor:"var(--border-hover)"}}),(0,g.jsx)("div",{style:{width:`${n}px`,height:`${o}px`,border:"1.5px dashed var(--accent)",borderRadius:4*b,backgroundColor:"var(--bg-card)",display:"flex",alignItems:"center",justifyContent:"center",padding:`${4*b}px`},children:(0,g.jsx)("input",{ref:k,autoFocus:!0,value:h,onChange:a=>i(a.target.value),onKeyDown:a=>{"Enter"===a.key&&h.trim()&&e(h),"Escape"===a.key&&f(),a.stopPropagation()},onBlur:()=>{h.trim()?e(h):f()},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(a){return(0,g.jsxs)("div",{className:"flex flex-col h-full",children:[(0,g.jsxs)("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Flow Map"}),(0,g.jsxs)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:[a.nodes.length," node",1!==a.nodes.length?"s":""]}),(0,g.jsx)("div",{className:"flex-1"}),(0,g.jsx)("button",{onClick:a.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,g.jsx)("div",{className:"flex-1 min-h-0",children:(0,g.jsx)(s,{nodes:a.nodes,edges:a.edges,testCases:a.testCases,selectedNodeId:a.selectedNodeId,onSelect:a.onSelect,onAddNode:a.onAddNode,onDeleteNode:a.onDeleteNode,onDeleteNodes:a.onDeleteNodes,onUnlinkNode:a.onUnlinkNode,onRenameNode:a.onRenameNode,onUpdateNode:a.onUpdateNode,onAddEdge:a.onAddEdge,onDeleteEdge:a.onDeleteEdge,onUpdateEdge:a.onUpdateEdge,canUndo:a.canUndo,canRedo:a.canRedo,onUndo:a.onUndo,onRedo:a.onRedo})})]})}r.displayName="RippleButton";var w=c(19188),x=c(98457);function y({value:a,className:b=""}){let c=Math.max(0,Math.min(100,a));return(0,g.jsx)("div",{className:`h-2 w-full overflow-hidden ${b}`,style:{backgroundColor:"var(--bg-secondary)",borderRadius:"var(--radius-pill)"},children:(0,g.jsx)("div",{className:"h-full transition-all duration-150 ease-out",style:{width:`${c}%`,backgroundColor:c>=80?"var(--status-pass-text)":c>=50?"var(--status-skip-text)":"var(--status-fail-text)",borderRadius:"var(--radius-pill)"}})})}function z({onAdd:a,nodeLabel:b}){let[c,d]=(0,j.useState)(""),e=(0,j.useRef)(null),f=()=>{c.trim()&&(a(c.trim()),d(""))};return(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("input",{ref:e,value:c,onChange:a=>d(a.target.value),onKeyDown:a=>{"Enter"===a.key&&f()},placeholder:`Add test case for "${b}"...`,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,g.jsx)("button",{onClick:f,disabled:!c.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 A={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"}};function B({status:a,onCycle:b}){let c=A[a];return(0,g.jsx)("button",{onClick:b,className:"px-2.5 py-0.5 text-xs font-medium rounded-full transition-opacity hover:opacity-80 whitespace-nowrap",style:{backgroundColor:c.bg,color:c.text,borderRadius:"var(--radius-pill)"},children:c.label})}let C=["untested","pass","fail","skip"];function D({tc:a,visibleCols:b,expandAll:c,selected:d,onToggleSelect:e,onUpdate:f,onDelete:h,onDragStart:i,onDragOver:k,onDrop:l}){let[m,n]=(0,j.useState)(null),[o,p]=(0,j.useState)(""),[q,r]=(0,j.useState)(!1),[s,t]=(0,j.useState)(null),u=(0,j.useRef)(null),v=b=>{p(a[b]??""),n(b)},w=()=>{m&&(f({[m]:o}),n(null))},x=()=>{let b=C.indexOf(a.status);f({status:C[(b+1)%C.length]})},y=a=>{if("Enter"===a.key&&"steps"!==m&&w(),"Escape"===a.key&&(n(null),p("")),"Tab"===a.key){a.preventDefault(),w();let c=b.filter(a=>"status"!==a.key&&"code"!==a.key).map(a=>a.key),d=c.indexOf(m),e=a.shiftKey?c[d-1]:c[d+1];e&&v(e)}},z=b=>{let c=a[b];return c&&c.length>40};return(0,g.jsx)(g.Fragment,{children:(0,g.jsxs)("tr",{className:"group transition-colors",style:{backgroundColor:q?"var(--bg-secondary)":"transparent"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),draggable:!0,onDragStart:i,onDragOver:k,onDrop:l,children:[(0,g.jsx)("td",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,g.jsx)("input",{type:"checkbox",checked:d,onChange:e,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),b.map(b=>(0,g.jsx)("td",{className:"px-2 py-1.5 text-xs border-b",style:{borderColor:"var(--border)",color:"var(--text-primary)",maxWidth:"steps"===b.key||"expected"===b.key?300:void 0},children:"status"===b.key?(0,g.jsx)(B,{status:a.status,onCycle:x}):"code"===b.key?(0,g.jsx)("span",{className:"font-mono text-[10px]",style:{color:"var(--text-tertiary)"},children:a.code||"—"}):"case_type"===b.key?(0,g.jsx)(F,{value:a.case_type||"General",onChange:a=>f({case_type:a})}):m===b.key?"steps"===b.key?(0,g.jsx)("textarea",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:w,onKeyDown:y,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,g.jsx)("input",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:w,onKeyDown:y,className:"w-full bg-transparent outline-none border-b text-xs",style:{borderColor:"var(--accent)",color:"var(--text-primary)"}}):"links"===b.key?(0,g.jsx)("div",{className:"flex items-center gap-1",children:a.links?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("a",{href:a.links,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline hover:opacity-80 transition-opacity",style:{color:"var(--accent)"},onClick:a=>a.stopPropagation(),children:"Open Link"}),(0,g.jsx)("button",{onClick:a=>{a.stopPropagation(),f({links:""})},className:"text-[10px] opacity-0 group-hover:opacity-100 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},title:"Clear link",children:"\xd7"})]}):(0,g.jsx)("span",{className:"cursor-text block text-[11px]",onClick:()=>v(b.key),style:{color:"var(--text-tertiary)"},children:"Add link..."})}):(0,g.jsx)("span",{className:"cursor-text block",onClick:()=>{z(b.key)&&(s===b.key?t(null):t(b.key))},onDoubleClick:()=>v(b.key),title:z(b.key)?s===b.key||c?"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:s===b.key||c&&z(b.key)?"pre-wrap":"nowrap",display:"block",maxHeight:s===b.key||c&&z(b.key)?"none":"1.2em",lineHeight:"1.2em"},children:a[b.key]||(0,g.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"—"})})},b.key)),(0,g.jsx)("td",{className:"px-1 py-1.5 border-b",style:{borderColor:"var(--border)"},children:q&&(0,g.jsx)("button",{onClick:h,className:"text-[10px] opacity-50 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},children:"\xd7"})})]})})}let E={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 F({value:a,onChange:b}){let c=E[a]||E.General;return(0,g.jsx)("select",{value:a,onChange:a=>b(a.target.value),className:"text-[10px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer",style:{backgroundColor:c.bg,color:c.text},children:w.D_.map(a=>(0,g.jsx)("option",{value:a,children:a},a))})}function G({testCases:a,columns:b,expandAll:c,selectedIds:d,onToggleSelect:e,onToggleSelectAll:f,sortKey:h,sortDirection:i,onSortChange:j,onUpdate:k,onDelete:l,onReorder:m}){let n=b.filter(a=>a.visible),o=a.length>0&&a.every(a=>d.has(a.id)),p=a.some(a=>d.has(a.id)),q=a=>{a.preventDefault(),a.dataTransfer.dropEffect="move"};return 0===a.length?null:(0,g.jsx)("div",{className:"overflow-x-auto",style:{minWidth:0},children:(0,g.jsxs)("table",{className:"text-xs",style:{minWidth:"900px",width:"100%"},children:[(0,g.jsx)("thead",{className:"sticky top-0 z-10",style:{backgroundColor:"var(--bg-primary)"},children:(0,g.jsxs)("tr",{children:[(0,g.jsx)("th",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,g.jsx)("input",{type:"checkbox",checked:o,ref:a=>{a&&(a.indeterminate=p&&!o)},onChange:f,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),n.map(a=>(0,g.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"},onClick:()=>j(a.key),children:(0,g.jsxs)("div",{className:"flex items-center gap-1",children:[(0,g.jsx)("span",{children:a.label}),h===a.key&&(0,g.jsx)("span",{className:"text-[8px]",children:"asc"===i?"↑":"↓"})]})},a.key)),(0,g.jsx)("th",{className:"w-6 border-b",style:{borderColor:"var(--border)"}})]})}),(0,g.jsx)("tbody",{children:a.map(b=>(0,g.jsx)(D,{tc:b,visibleCols:n,expandAll:c,selected:d.has(b.id),onToggleSelect:()=>e(b.id),onUpdate:a=>k(b.id,a),onDelete:()=>l(b.id),onDragStart:a=>{var c;return c=b.id,void(a.dataTransfer.setData("text/plain",c),a.dataTransfer.effectAllowed="move")},onDragOver:q,onDrop:c=>((b,c)=>{b.preventDefault();let d=b.dataTransfer.getData("text/plain");if(d===c)return;let e=a.map(a=>a.id),f=e.indexOf(d),g=e.indexOf(c);if(-1===f||-1===g)return;let h=[...e];h.splice(f,1),h.splice(g,0,d),m(h)})(c,b.id)},b.id))})]})})}function H({stats:a}){return(0,g.jsxs)("div",{className:"flex items-center gap-4 px-4 py-2 text-xs border-t flex-wrap",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,g.jsxs)("span",{children:["Total: ",(0,g.jsx)("strong",{style:{color:"var(--text-primary)"},children:a.total})]}),(0,g.jsxs)("span",{children:["Pass: ",(0,g.jsx)("strong",{style:{color:"var(--status-pass-text)"},children:a.pass}),a.total>0&&` (${a.passRate}%)`]}),(0,g.jsxs)("span",{children:["Fail: ",(0,g.jsx)("strong",{style:{color:"var(--status-fail-text)"},children:a.fail})]}),(0,g.jsxs)("span",{children:["Skip: ",(0,g.jsx)("strong",{style:{color:"var(--status-skip-text)"},children:a.skip})]}),(0,g.jsxs)("span",{children:["Untested: ",(0,g.jsx)("strong",{style:{color:"var(--status-untested-text)"},children:a.untested})]})]})}var I=c(22858);function J({open:a,onClose:b,node:c,testCases:d,columns:e}){let f=e&&e.length>0?e:w._X;return a?(0,g.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,children:(0,g.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:a=>a.stopPropagation(),children:[(0,g.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Export Test Cases"}),(0,g.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["Export “",c.label,"” (",d.length," case",1!==d.length?"s":"",")"]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,g.jsxs)("button",{onClick:()=>{(0,I.k5)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Markdown (.md)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Formatted table for documentation"})]}),(0,g.jsxs)("button",{onClick:()=>{(0,I.hX)(c,d),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"JSON (.json)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Structured data backup"})]}),(0,g.jsxs)("button",{onClick:()=>{(0,I.Rz)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"CSV (.csv)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Spreadsheet-compatible format"})]}),(0,g.jsxs)("button",{onClick:async()=>{await (0,I.G$)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Excel (.xlsx)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Styled spreadsheet for reporting"})]})]}),(0,g.jsx)("button",{onClick:b,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}function K(a,b,c){function d(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:g,traits:new Set},enumerable:!1}),c._zod.traits.has(a))return;c._zod.traits.add(a),b(c,d);let e=g.prototype,f=Object.keys(e);for(let a=0;a<f.length;a++){let b=f[a];b in c||(c[b]=e[b].bind(c))}}let e=c?.Parent??Object;class f extends e{}function g(a){var b;let e=c?.Parent?new f:this;for(let c of(d(e,a),(b=e._zod).deferred??(b.deferred=[]),e._zod.deferred))c();return e}return Object.defineProperty(f,"name",{value:a}),Object.defineProperty(g,"init",{value:d}),Object.defineProperty(g,Symbol.hasInstance,{value:b=>!!c?.Parent&&b instanceof c.Parent||b?._zod?.traits?.has(a)}),Object.defineProperty(g,"name",{value:a}),g}Symbol("zod_brand");class L extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class M extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});let N=globalThis.__zod_globalConfig;function O(a){return a&&Object.assign(N,a),N}let P=/^[cC][0-9a-z]{6,}$/,Q=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S=/^[0-9a-vA-V]{20}$/,T=/^[A-Za-z0-9]{27}$/,U=/^[a-zA-Z0-9_-]{21}$/,V=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,X=a=>a?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${a}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Y=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,_=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,aa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ab=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ac=/^[A-Za-z0-9_-]*$/,ad=/^https?$/,ae=/^\+[1-9]\d{6,14}$/,af="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ag=RegExp(`^${af}$`);function ah(a){let b="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof a.precision?-1===a.precision?`${b}`:0===a.precision?`${b}:[0-5]\\d`:`${b}:[0-5]\\d\\.\\d{${a.precision}}`:`${b}(?::[0-5]\\d(?:\\.\\d+)?)?`}let ai=/^[^A-Z]*$/,aj=/^[^a-z]*$/;function ak(a){let b=Object.values(a).filter(a=>"number"==typeof a);return Object.entries(a).filter(([a,c])=>-1===b.indexOf(+a)).map(([a,b])=>b)}function al(a,b){return"bigint"==typeof b?b.toString():b}function am(a){return{get value(){{let b=a();return Object.defineProperty(this,"value",{value:b}),b}}}}function an(a){let b=+!!a.startsWith("^"),c=a.endsWith("$")?a.length-1:a.length;return a.slice(b,c)}let ao=Symbol("evaluating");function ap(a,b,c){let d;Object.defineProperty(a,b,{get(){if(d!==ao)return void 0===d&&(d=ao,d=c()),d},set(c){Object.defineProperty(a,b,{value:c})},configurable:!0})}function aq(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!0,configurable:!0})}function ar(...a){let b={};for(let c of a)Object.assign(b,Object.getOwnPropertyDescriptors(c));return Object.defineProperties({},b)}function as(a){return JSON.stringify(a)}let at="captureStackTrace"in Error?Error.captureStackTrace:(...a)=>{};function au(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}let av=am(()=>{if(N.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(a){return!1}});function aw(a){if(!1===au(a))return!1;let b=a.constructor;if(void 0===b||"function"!=typeof b)return!0;let c=b.prototype;return!1!==au(c)&&!1!==Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")}function ax(a){return aw(a)?{...a}:Array.isArray(a)?[...a]:a instanceof Map?new Map(a):a instanceof Set?new Set(a):a}let ay=new Set(["string","number","symbol"]);function az(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function aA(a,b,c){let d=new a._zod.constr(b??a._zod.def);return(!b||c?.parent)&&(d._zod.parent=a),d}function aB(a){if(!a)return{};if("string"==typeof a)return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");a.error=a.message}return(delete a.message,"string"==typeof a.error)?{...a,error:()=>a.error}:a}function aC(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue!==!0)return!0;return!1}function aD(a,b){return b.map(b=>(b.path??(b.path=[]),b.path.unshift(a),b))}function aE(a){return"string"==typeof a?a:a?.message}function aF(a,b,c){let d=a.message?a.message:aE(a.inst?._zod.def?.error?.(a))??aE(b?.error?.(a))??aE(c.customError?.(a))??aE(c.localeError?.(a))??"Invalid input",{inst:e,continue:f,input:g,...h}=a;return h.path??(h.path=[]),h.message=d,b?.reportInput&&(h.input=g),h}function aG(a){return Array.isArray(a)?"array":"string"==typeof a?"string":"unknown"}function aH(...a){let[b,c,d]=a;return"string"==typeof b?{message:b,code:"custom",input:c,inst:d}:{...b}}Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_VALUE,Number.MAX_VALUE;let aI=K("$ZodCheck",(a,b)=>{var c;a._zod??(a._zod={}),a._zod.def=b,(c=a._zod).onattach??(c.onattach=[])}),aJ=K("$ZodCheckMaxLength",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;if(d.length<=b.maximum)return;let e=aG(d);c.issues.push({origin:e,code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),aK=K("$ZodCheckMinLength",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;if(d.length>=b.minimum)return;let e=aG(d);c.issues.push({origin:e,code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),aL=K("$ZodCheckLengthEquals",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.length,c.maximum=b.length,c.length=b.length}),a._zod.check=c=>{let d=c.value,e=d.length;if(e===b.length)return;let f=aG(d),g=e>b.length;c.issues.push({origin:f,...g?{code:"too_big",maximum:b.length}:{code:"too_small",minimum:b.length},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),aM=K("$ZodCheckStringFormat",(a,b)=>{var c,d;aI.init(a,b),a._zod.onattach.push(a=>{let c=a._zod.bag;c.format=b.format,b.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(b.pattern))}),b.pattern?(c=a._zod).check??(c.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:b.format,input:c.value,...b.pattern?{pattern:b.pattern.toString()}:{},inst:a,continue:!b.abort})}):(d=a._zod).check??(d.check=()=>{})}),aN=K("$ZodCheckRegex",(a,b)=>{aM.init(a,b),a._zod.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:b.pattern.toString(),inst:a,continue:!b.abort})}}),aO=K("$ZodCheckLowerCase",(a,b)=>{b.pattern??(b.pattern=ai),aM.init(a,b)}),aP=K("$ZodCheckUpperCase",(a,b)=>{b.pattern??(b.pattern=aj),aM.init(a,b)}),aQ=K("$ZodCheckIncludes",(a,b)=>{aI.init(a,b);let c=az(b.includes),d=new RegExp("number"==typeof b.position?`^.{${b.position}}${c}`:c);b.pattern=d,a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(d)}),a._zod.check=c=>{c.value.includes(b.includes,b.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:b.includes,input:c.value,inst:a,continue:!b.abort})}}),aR=K("$ZodCheckStartsWith",(a,b)=>{aI.init(a,b);let c=RegExp(`^${az(b.prefix)}.*`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.startsWith(b.prefix)||c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:b.prefix,input:c.value,inst:a,continue:!b.abort})}}),aS=K("$ZodCheckEndsWith",(a,b)=>{aI.init(a,b);let c=RegExp(`.*${az(b.suffix)}$`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.endsWith(b.suffix)||c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:b.suffix,input:c.value,inst:a,continue:!b.abort})}}),aT=K("$ZodCheckOverwrite",(a,b)=>{aI.init(a,b),a._zod.check=a=>{a.value=b.tx(a.value)}});class aU{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if("function"==typeof a){a(this,{execution:"sync"}),a(this,{execution:"async"});return}let b=a.split("\n").filter(a=>a),c=Math.min(...b.map(a=>a.length-a.trimStart().length));for(let a of b.map(a=>a.slice(c)).map(a=>" ".repeat(2*this.indent)+a))this.content.push(a)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(a=>` ${a}`)].join("\n"))}}let aV=(a,b)=>{a.name="$ZodError",Object.defineProperty(a,"_zod",{value:a._zod,enumerable:!1}),Object.defineProperty(a,"issues",{value:b,enumerable:!1}),a.message=JSON.stringify(b,al,2),Object.defineProperty(a,"toString",{value:()=>a.message,enumerable:!1})},aW=K("$ZodError",aV),aX=K("$ZodError",aV,{Parent:Error}),aY=a=>(b,c,d,e)=>{let f=d?{...d,async:!1}:{async:!1},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise)throw new L;if(g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>aF(a,f,O())));throw at(b,e?.callee),b}return g.value},aZ=a=>async(b,c,d,e)=>{let f=d?{...d,async:!0}:{async:!0},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise&&(g=await g),g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>aF(a,f,O())));throw at(b,e?.callee),b}return g.value},a$=a=>(b,c,d)=>{let e=d?{...d,async:!1}:{async:!1},f=b._zod.run({value:c,issues:[]},e);if(f instanceof Promise)throw new L;return f.issues.length?{success:!1,error:new(a??aW)(f.issues.map(a=>aF(a,e,O())))}:{success:!0,data:f.value}},a_=a$(aX),a0=a=>async(b,c,d)=>{let e=d?{...d,async:!0}:{async:!0},f=b._zod.run({value:c,issues:[]},e);return f instanceof Promise&&(f=await f),f.issues.length?{success:!1,error:new a(f.issues.map(a=>aF(a,e,O())))}:{success:!0,data:f.value}},a1=a0(aX),a2={major:4,minor:4,patch:3},a3=K("$ZodType",(a,b)=>{var c;a??(a={}),a._zod.def=b,a._zod.bag=a._zod.bag||{},a._zod.version=a2;let d=[...a._zod.def.checks??[]];for(let b of(a._zod.traits.has("$ZodCheck")&&d.unshift(a),d))for(let c of b._zod.onattach)c(a);if(0===d.length)(c=a._zod).deferred??(c.deferred=[]),a._zod.deferred?.push(()=>{a._zod.run=a._zod.parse});else{let b=(a,b,c)=>{let d,e=aC(a);for(let f of b){if(f._zod.def.when){if(function(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue===!1)return!0;return!1}(a)||!f._zod.def.when(a))continue}else if(e)continue;let b=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&c?.async===!1)throw new L;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==b&&(e||(e=aC(a,b)))});else{if(a.issues.length===b)continue;e||(e=aC(a,b))}}return d?d.then(()=>a):a},c=(c,e,f)=>{if(aC(c))return c.aborted=!0,c;let g=b(e,d,f);if(g instanceof Promise){if(!1===f.async)throw new L;return g.then(b=>a._zod.parse(b,f))}return a._zod.parse(g,f)};a._zod.run=(e,f)=>{if(f.skipChecks)return a._zod.parse(e,f);if("backward"===f.direction){let b=a._zod.parse({value:e.value,issues:[]},{...f,skipChecks:!0});return b instanceof Promise?b.then(a=>c(a,e,f)):c(b,e,f)}let g=a._zod.parse(e,f);if(g instanceof Promise){if(!1===f.async)throw new L;return g.then(a=>b(a,d,f))}return b(g,d,f)}}ap(a,"~standard",()=>({validate:b=>{try{let c=a_(a,b);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return a1(a,b).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),a4=K("$ZodString",(a,b)=>{a3.init(a,b),a._zod.pattern=[...a?._zod.bag?.patterns??[]].pop()??(a=>{let b=a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${b}$`)})(a._zod.bag),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=String(c.value)}catch(a){}return"string"==typeof c.value||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:a}),c}}),a5=K("$ZodStringFormat",(a,b)=>{aM.init(a,b),a4.init(a,b)}),a6=K("$ZodGUID",(a,b)=>{b.pattern??(b.pattern=W),a5.init(a,b)}),a7=K("$ZodUUID",(a,b)=>{if(b.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[b.version];if(void 0===a)throw Error(`Invalid UUID version: "${b.version}"`);b.pattern??(b.pattern=X(a))}else b.pattern??(b.pattern=X());a5.init(a,b)}),a8=K("$ZodEmail",(a,b)=>{b.pattern??(b.pattern=Y),a5.init(a,b)}),a9=K("$ZodURL",(a,b)=>{a5.init(a,b),a._zod.check=c=>{try{let d=c.value.trim();if(!b.normalize&&b.protocol?.source===ad.source&&!/^https?:\/\//i.test(d))return void c.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:c.value,inst:a,continue:!b.abort});let e=new URL(d);b.hostname&&(b.hostname.lastIndex=0,b.hostname.test(e.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:b.hostname.source,input:c.value,inst:a,continue:!b.abort})),b.protocol&&(b.protocol.lastIndex=0,b.protocol.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:b.protocol.source,input:c.value,inst:a,continue:!b.abort})),b.normalize?c.value=e.href:c.value=d;return}catch(d){c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:a,continue:!b.abort})}}}),ba=K("$ZodEmoji",(a,b)=>{b.pattern??(b.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a5.init(a,b)}),bb=K("$ZodNanoID",(a,b)=>{b.pattern??(b.pattern=U),a5.init(a,b)}),bc=K("$ZodCUID",(a,b)=>{b.pattern??(b.pattern=P),a5.init(a,b)}),bd=K("$ZodCUID2",(a,b)=>{b.pattern??(b.pattern=Q),a5.init(a,b)}),be=K("$ZodULID",(a,b)=>{b.pattern??(b.pattern=R),a5.init(a,b)}),bf=K("$ZodXID",(a,b)=>{b.pattern??(b.pattern=S),a5.init(a,b)}),bg=K("$ZodKSUID",(a,b)=>{b.pattern??(b.pattern=T),a5.init(a,b)}),bh=K("$ZodISODateTime",(a,b)=>{b.pattern??(b.pattern=function(a){let b=ah({precision:a.precision}),c=["Z"];a.local&&c.push(""),a.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let d=`${b}(?:${c.join("|")})`;return RegExp(`^${af}T(?:${d})$`)}(b)),a5.init(a,b)}),bi=K("$ZodISODate",(a,b)=>{b.pattern??(b.pattern=ag),a5.init(a,b)}),bj=K("$ZodISOTime",(a,b)=>{b.pattern??(b.pattern=RegExp(`^${ah(b)}$`)),a5.init(a,b)}),bk=K("$ZodISODuration",(a,b)=>{b.pattern??(b.pattern=V),a5.init(a,b)}),bl=K("$ZodIPv4",(a,b)=>{b.pattern??(b.pattern=Z),a5.init(a,b),a._zod.bag.format="ipv4"}),bm=K("$ZodIPv6",(a,b)=>{b.pattern??(b.pattern=$),a5.init(a,b),a._zod.bag.format="ipv6",a._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:a,continue:!b.abort})}}}),bn=K("$ZodCIDRv4",(a,b)=>{b.pattern??(b.pattern=_),a5.init(a,b)}),bo=K("$ZodCIDRv6",(a,b)=>{b.pattern??(b.pattern=aa),a5.init(a,b),a._zod.check=c=>{let d=c.value.split("/");try{if(2!==d.length)throw Error();let[a,b]=d;if(!b)throw Error();let c=Number(b);if(`${c}`!==b||c<0||c>128)throw Error();new URL(`http://[${a}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:a,continue:!b.abort})}}});function bp(a){if(""===a)return!0;if(/\s/.test(a)||a.length%4!=0)return!1;try{return atob(a),!0}catch{return!1}}let bq=K("$ZodBase64",(a,b)=>{b.pattern??(b.pattern=ab),a5.init(a,b),a._zod.bag.contentEncoding="base64",a._zod.check=c=>{bp(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:a,continue:!b.abort})}}),br=K("$ZodBase64URL",(a,b)=>{b.pattern??(b.pattern=ac),a5.init(a,b),a._zod.bag.contentEncoding="base64url",a._zod.check=c=>{!function(a){if(!ac.test(a))return!1;let b=a.replace(/[-_]/g,a=>"-"===a?"+":"/");return bp(b.padEnd(4*Math.ceil(b.length/4),"="))}(c.value)&&c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:a,continue:!b.abort})}}),bs=K("$ZodE164",(a,b)=>{b.pattern??(b.pattern=ae),a5.init(a,b)}),bt=K("$ZodJWT",(a,b)=>{a5.init(a,b),a._zod.check=c=>{!function(a,b=null){try{let c=a.split(".");if(3!==c.length)return!1;let[d]=c;if(!d)return!1;let e=JSON.parse(atob(d));if("typ"in e&&e?.typ!=="JWT"||!e.alg||b&&(!("alg"in e)||e.alg!==b))return!1;return!0}catch{return!1}}(c.value,b.alg)&&c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:a,continue:!b.abort})}}),bu=K("$ZodUnknown",(a,b)=>{a3.init(a,b),a._zod.parse=a=>a}),bv=K("$ZodNever",(a,b)=>{a3.init(a,b),a._zod.parse=(b,c)=>(b.issues.push({expected:"never",code:"invalid_type",input:b.value,inst:a}),b)});function bw(a,b,c){a.issues.length&&b.issues.push(...aD(c,a.issues)),b.value[c]=a.value}let bx=K("$ZodArray",(a,b)=>{a3.init(a,b),a._zod.parse=(c,d)=>{let e=c.value;if(!Array.isArray(e))return c.issues.push({expected:"array",code:"invalid_type",input:e,inst:a}),c;c.value=Array(e.length);let f=[];for(let a=0;a<e.length;a++){let g=e[a],h=b.element._zod.run({value:g,issues:[]},d);h instanceof Promise?f.push(h.then(b=>bw(b,c,a))):bw(h,c,a)}return f.length?Promise.all(f).then(()=>c):c}});function by(a,b,c,d,e,f){let g=c in d;if(a.issues.length){if(e&&f&&!g)return;b.issues.push(...aD(c,a.issues))}if(!g&&!e){a.issues.length||b.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[c]});return}void 0===a.value?g&&(b.value[c]=void 0):b.value[c]=a.value}function bz(a){var b;let c=Object.keys(a.shape);for(let b of c)if(!a.shape?.[b]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${b}": expected a Zod schema`);let d=Object.keys(b=a.shape).filter(a=>"optional"===b[a]._zod.optin&&"optional"===b[a]._zod.optout);return{...a,keys:c,keySet:new Set(c),numKeys:c.length,optionalKeys:new Set(d)}}function bA(a,b,c,d,e,f){let g=[],h=e.keySet,i=e.catchall._zod,j=i.def.type,k="optional"===i.optin,l="optional"===i.optout;for(let e in b){if("__proto__"===e||h.has(e))continue;if("never"===j){g.push(e);continue}let f=i.run({value:b[e],issues:[]},d);f instanceof Promise?a.push(f.then(a=>by(a,c,e,b,k,l))):by(f,c,e,b,k,l)}return(g.length&&c.issues.push({code:"unrecognized_keys",keys:g,input:b,inst:f}),a.length)?Promise.all(a).then(()=>c):c}let bB=K("$ZodObject",(a,b)=>{let c;a3.init(a,b);let d=Object.getOwnPropertyDescriptor(b,"shape");if(!d?.get){let a=b.shape;Object.defineProperty(b,"shape",{get:()=>{let c={...a};return Object.defineProperty(b,"shape",{value:c}),c}})}let e=am(()=>bz(b));ap(a._zod,"propValues",()=>{let a=b.shape,c={};for(let b in a){let d=a[b]._zod;if(d.values)for(let a of(c[b]??(c[b]=new Set),d.values))c[b].add(a)}return c});let f=b.catchall;a._zod.parse=(b,d)=>{c??(c=e.value);let g=b.value;if(!au(g))return b.issues.push({expected:"object",code:"invalid_type",input:g,inst:a}),b;b.value={};let h=[],i=c.shape;for(let a of c.keys){let c=i[a],e="optional"===c._zod.optin,f="optional"===c._zod.optout,j=c._zod.run({value:g[a],issues:[]},d);j instanceof Promise?h.push(j.then(c=>by(c,b,a,g,e,f))):by(j,b,a,g,e,f)}return f?bA(h,g,b,d,e.value,a):h.length?Promise.all(h).then(()=>b):b}}),bC=K("$ZodObjectJIT",(a,b)=>{let c,d;bB.init(a,b);let e=a._zod.parse,f=am(()=>bz(b)),g=!N.jitless,h=g&&av.value,i=b.catchall;a._zod.parse=(j,k)=>{d??(d=f.value);let l=j.value;return au(l)?g&&h&&k?.async===!1&&!0!==k.jitless?(c||(c=(a=>{let b=new aU(["shape","payload","ctx"]),c=f.value,d=a=>{let b=as(a);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};b.write("const input = payload.value;");let e=Object.create(null),g=0;for(let a of c.keys)e[a]=`key_${g++}`;for(let f of(b.write("const newResult = {};"),c.keys)){let c=e[f],g=as(f),h=a[f],i=h?._zod?.optin==="optional",j=h?._zod?.optout==="optional";b.write(`const ${c} = ${d(f)};`),i&&j?b.write(`
2
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:w.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===L.isDev,l=c||b.writableEnded;if(ai&&ac&&!f&&!O)return(null==ad?void 0:ad.render404)?await ad.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(j=(0,x.parseFallbackField)(aj.fallback)),j===x.FallbackMode.PRERENDER&&(0,v.isBot)(am)&&(!as||ao)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(j!==x.FallbackMode.NOT_FOUND||f)&&(j=x.FallbackMode.BLOCKING_STATIC_RENDER),!O&&j!==x.FallbackMode.BLOCKING_STATIC_RENDER&&aC&&!l&&!aa&&U&&(k||!ak)){let b;if((k||aj)&&j===x.FallbackMode.NOT_FOUND)throw new C.NoFallbackError;if(as&&!aq){let c="string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:k?ah:null;if(b=await L.handleResponse({cacheKey:c,req:a,nextConfig:ae,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:_,isRoutePPREnabled:as,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||au?(0,o.u)(ah):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=ai||g||!av?void 0:av;if(at&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:w.CachedRouteKind.PAGES,html:y.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=U&&as&&((0,h.getRequestMeta)(a,"renderFallbackShell")||au)?(0,o.u)(ag):null;return m({span:i,postponed:n,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,o=await L.handleResponse({cacheKey:aB,responseGenerator:a=>n({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ae,prerenderManifest:_,waitUntil:d.waitUntil});if(aa&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),L.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aB)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=o.value)?void 0:f.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=o.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;al&&!aw&&(!p||ap)&&(O||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(u.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(av)l={revalidate:0,expire:void 0};else if(O&&aq&&!ap&&as)l={revalidate:0,expire:void 0};else if(!L.isDev)if(aa)l={revalidate:0,expire:void 0};else if(al){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??ae.expireTime}}else l={revalidate:z.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(o.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===w.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[z.NEXT_CACHE_TAGS_HEADER];O&&al&&c&&"string"==typeof c&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(d,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&av)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(O&&al||delete a[z.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[z.NEXT_CACHE_TAGS_HEADER];if(O&&al&&s&&"string"==typeof s&&b.setHeader(z.NEXT_CACHE_TAGS_HEADER,s),!q.status||aq&&as||(b.statusCode=q.status),!O&&q.status&&G.RedirectStatusCode[q.status]&&aq&&(b.statusCode=200),p&&b.setHeader(u.NEXT_DID_POSTPONE_HEADER,"1"),aq&&!aa){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:q.html,cacheControl:aw?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:y.default.fromStatic(q.rscData,u.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||O||aq)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:o.cacheControl});if(at)return t.push(new ReadableStream({start(a){a.enqueue(A.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let v=new TransformStream;return t.push(v.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==w.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(v.writable)}).catch(a=>{v.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:ae.generateEtags,poweredByHeader:ae.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aG)return await aF.withPropagatedContext(a.headers,()=>aF.trace(i.BaseServerSpan.handleRequest,{spanName:`${aE} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aE,"http.target":a.url}},p));await p(aG)}catch(b){throw b instanceof C.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:al,isOnDemandRevalidate:ai})},ad),b}}},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41009:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/sltr91025/code-repository/open-source/test-lah/src/app/(dashboard)/projects/[projectId]/page.tsx","default")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41204:a=>{"use strict";a.exports=require("string_decoder")},42692:(a,b,c)=>{Promise.resolve().then(c.bind(c,70854))},49485:a=>{"use strict";a.exports=require("rimraf")},55511:a=>{"use strict";a.exports=require("crypto")},61252:(a,b,c)=>{Promise.resolve().then(c.bind(c,41009))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70854:(a,b,c)=>{"use strict";let d;c.r(b),c.d(b,{default:()=>d$});var e,f,g=c(21124),h=c(95627),i=c.n(h),j=c(38301),k=c.n(j),l=c(42378),m=c(5908);let n=(0,j.memo)(function({node:a,position:b,isSelected:c,testCases:d,isDragged:e,edgeDragActive:f,isEdgeDropTarget:h,deleteMode:i,isDeleteChecked:k,onSelect:l,onAddChild:m,onDelete:n,onUnlinkNode:o,onRename:p,onUpdateNode:q,onDragStart:r,onEdgeStart:s,onToggleDeleteCheck:t,depth:u,svgRef:v}){let[w,x]=(0,j.useState)(!1),[y,z]=(0,j.useState)(a.label),[A,B]=(0,j.useState)(!1),[C,D]=(0,j.useState)(!1),[E,F]=(0,j.useState)("horizontal"),[G,H]=(0,j.useState)(""),I=(0,j.useRef)(null),J=(0,j.useRef)(null),K=(0,j.useRef)(null),L=(0,j.useRef)({startX:0,startY:0,moved:!1}),{w:M,h:N}=0===u?{w:160,h:56}:1===u?{w:144,h:48}:{w:132,h:42},O=d.some(a=>"fail"===a.status),P=d.some(a=>"skip"===a.status),Q=d.some(a=>"untested"===a.status),R=O||P||Q,S=d.length>0&&d.every(a=>"pass"===a.status);(0,j.useEffect)(()=>{let b=b=>{let c=b.detail;c?.parentId===a.id&&(D(!0),H(""))};return window.addEventListener("mindmap:add-child",b),()=>window.removeEventListener("mindmap:add-child",b)},[a.id]),(0,j.useEffect)(()=>{if(!C)return;let a=a=>{K.current&&!K.current.contains(a.target)&&(G.trim()?V():(D(!1),H("")))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[C,G]),(0,j.useEffect)(()=>{C&&J.current&&J.current.focus()},[C]);let T=(0,j.useCallback)(()=>{z(a.label),x(!0),setTimeout(()=>I.current?.focus(),0)},[a.label]),U=(0,j.useCallback)(()=>{y.trim()&&p(a.id,y.trim()),x(!1)},[y,a.id,p]),V=(0,j.useCallback)(()=>{if(G.trim()){let c="vertical"===E?{x:b.x,y:b.y+N+60}:{x:b.x+M+120,y:b.y};m(a.id,G.trim(),c,E)}D(!1),H("")},[G,a.id,m,b.x,b.y,N,M,E]),W=(0,j.useCallback)(a=>b=>{b.stopPropagation(),F(a),D(!0),H("")},[]),X=(0,j.useCallback)(c=>{if(2===c.button||i)return;if(c.stopPropagation(),!c.target.closest('[data-drag-handle="true"]'))return void l(a.id);c.preventDefault(),L.current={startX:c.clientX,startY:c.clientY,moved:!1};let d=a=>a.preventDefault();document.addEventListener("contextmenu",d);let e=c=>{let d=c.clientX-L.current.startX,e=c.clientY-L.current.startY;!L.current.moved&&(Math.abs(d)>6||Math.abs(e)>6)&&(L.current.moved=!0,r(a.id,L.current.startX,L.current.startY,b.x,b.y))},f=()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",f),setTimeout(()=>document.removeEventListener("contextmenu",d),100)};window.addEventListener("mousemove",e),window.addEventListener("mouseup",f)},[a.id,l,r,i,b]),Y=a.id.replace(/[^a-zA-Z0-9]/g,"").slice(0,8),Z=c&&!i;return(0,g.jsxs)("g",{transform:`translate(${b.x}, ${b.y})`,onMouseDown:X,onDoubleClick:a=>{a.stopPropagation(),i||T()},onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),style:{cursor:i?"pointer":"default",transition:e?"none":"transform 150ms ease-out"},onClick:()=>{i&&t(a.id)},children:[(0,g.jsxs)("defs",{children:[(0,g.jsxs)("linearGradient",{id:`fill-${Y}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,g.jsx)("stop",{offset:"0%",stopColor:"#FFFFFF"}),(0,g.jsx)("stop",{offset:"100%",stopColor:"#FAF9F7"})]}),(0,g.jsxs)("filter",{id:`shadow-${Y}`,x:"-10%",y:"-10%",width:"120%",height:"130%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.08"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"3",stdDeviation:"6",floodOpacity:"0.05"})]}),(0,g.jsxs)("filter",{id:`shadow-hover-${Y}`,x:"-10%",y:"-10%",width:"120%",height:"140%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"2",stdDeviation:"4",floodOpacity:"0.12"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"6",stdDeviation:"12",floodOpacity:"0.08"})]}),(0,g.jsxs)("filter",{id:`shadow-drag-${Y}`,x:"-20%",y:"-20%",width:"140%",height:"160%",children:[(0,g.jsx)("feDropShadow",{dx:"0",dy:"4",stdDeviation:"8",floodOpacity:"0.2"}),(0,g.jsx)("feDropShadow",{dx:"0",dy:"8",stdDeviation:"16",floodOpacity:"0.1"})]}),(0,g.jsxs)("filter",{id:`glow-${Y}`,x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,g.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"blur"}),(0,g.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"})]})]}),!i&&(0,g.jsxs)("g",{"data-drag-handle":"true",transform:`translate(0, ${-N/2-10})`,style:{cursor:e?"grabbing":"grab"},children:[(0,g.jsx)("rect",{x:-20,y:-7,width:40,height:14,rx:4,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1,opacity:A||c?.9:.5,style:{transition:"opacity 150ms ease-out"}}),(0,g.jsx)("circle",{cx:-8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:-4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:0,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:0,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,g.jsx)("circle",{cx:8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6})]}),h&&(0,g.jsx)("rect",{x:-M/2-6,y:-N/2-6,width:M+12,height:N+12,rx:8,fill:"var(--status-pass-bg)",stroke:"var(--status-pass-text)",strokeWidth:2,opacity:.5}),(()=>{let a=O?"var(--status-fail-bg)":R?"var(--status-skip-bg)":S?"var(--status-pass-bg)":null;return(0,g.jsxs)(g.Fragment,{children:[a&&(0,g.jsx)("rect",{x:-M/2,y:-N/2,width:M,height:N,rx:4,fill:a,opacity:O?.2:.15}),(0,g.jsx)("rect",{x:-M/2,y:-N/2,width:M,height:N,rx:4,fill:`url(#fill-${Y})`,stroke:i&&k?"var(--status-fail-text)":"var(--border)",strokeWidth:i&&k?2:.5,filter:e?`url(#shadow-drag-${Y})`:A?`url(#shadow-hover-${Y})`:`url(#shadow-${Y})`,style:{transition:"filter 200ms ease-out, stroke 150ms ease-out"}}),(0,g.jsx)("path",{d:`M ${M/2-10} ${-N/2} L ${M/2} ${-N/2} L ${M/2} ${-N/2+10} Z`,fill:"var(--bg-secondary)",opacity:.5}),(0,g.jsx)("path",{d:`M ${M/2-10} ${-N/2} L ${M/2-10} ${-N/2+10} L ${M/2} ${-N/2+10}`,fill:"none",stroke:"var(--border)",strokeWidth:.5,opacity:.4})]})})(),d.length>0&&!i&&(0,g.jsxs)("g",{transform:`translate(${M/2-6}, ${N/2-6})`,style:{opacity:A||c?1:.7,transition:"opacity 150ms ease-out"},children:[(0,g.jsx)("rect",{x:-12,y:-8,width:24,height:16,rx:8,fill:O?"var(--status-fail-bg)":R?"var(--status-skip-bg)":"var(--status-pass-bg)",stroke:O?"var(--status-fail-text)":R?"var(--status-skip-text)":"var(--status-pass-text)",strokeWidth:.75}),(0,g.jsxs)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:O?"var(--status-fail-text)":R?"var(--status-skip-text)":"var(--status-pass-text)",fontSize:9,fontWeight:600,fontFamily:"monospace"},children:[O?d.filter(a=>"fail"===a.status).length:R?d.filter(a=>"pass"!==a.status).length:d.length,"/",d.length]})]}),i&&(0,g.jsxs)("g",{transform:`translate(${-M/2+8}, 0)`,children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:k?"var(--status-fail-text)":"transparent",stroke:k?"var(--status-fail-text)":"var(--border)",strokeWidth:1.5}),k&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),a.code&&!i&&(0,g.jsxs)("g",{transform:`translate(${-M/2+6}, ${-N/2-11})`,style:{opacity:A||c?1:0,transition:"opacity 150ms ease-out"},children:[(0,g.jsx)("rect",{x:0,y:0,width:Math.max(6.5*a.code.length+10,28),height:14,rx:7,fill:"var(--accent)",opacity:.08}),(0,g.jsx)("text",{x:5,y:10,style:{fill:"var(--text-tertiary)",fontSize:8,fontWeight:500,fontFamily:"monospace",letterSpacing:"0.05em"},children:a.code})]}),w?(0,g.jsx)("foreignObject",{x:-M/2+8,y:-N/2+4,width:M-16,height:N-8,children:(0,g.jsx)("input",{ref:I,value:y,onChange:a=>z(a.target.value),onBlur:U,onKeyDown:a=>{"Enter"===a.key&&U(),"Escape"===a.key&&x(!1)},className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})}):(0,g.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",className:"select-none",onClick:a=>{a.stopPropagation(),i||T()},style:{fill:"var(--text-primary)",fontSize:0===u?13:11.5,fontWeight:0===u?600:450,fontFamily:"inherit",letterSpacing:"-0.01em",cursor:A&&!i?"text":"default",pointerEvents:"auto"},children:a.label.length>22?a.label.slice(0,22)+"…":a.label}),Z&&!w&&!f&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("g",{transform:`translate(${M/2+3}, -11)`,children:[(0,g.jsxs)("g",{onClick:W("horizontal"),onMouseDown:a=>a.stopPropagation(),style:{cursor:"pointer"},children:[(0,g.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,g.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,g.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,g.jsx)("g",{transform:"translate(24, 7)",onMouseDown:c=>{c.stopPropagation(),c.preventDefault(),s(a.id,"pass",b.x+M/2+3+22+2+4,b.y-11+11,"horizontal")},onContextMenu:c=>{c.preventDefault(),c.stopPropagation(),s(a.id,"fail",b.x+M/2+3+22+2+4,b.y-11+11,"horizontal")},style:{cursor:"crosshair"},children:(0,g.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--status-pass-text)",opacity:.8,children:(0,g.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]}),(0,g.jsxs)("g",{transform:`translate(-11, ${N/2+3})`,children:[(0,g.jsxs)("g",{onClick:W("vertical"),onMouseDown:a=>a.stopPropagation(),style:{cursor:"pointer"},children:[(0,g.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,g.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,g.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,g.jsx)("g",{transform:"translate(24, 7)",onMouseDown:c=>{c.stopPropagation(),c.preventDefault(),s(a.id,"pass",b.x-11+11,b.y+N/2+3+22+2+4,"vertical")},onContextMenu:c=>{c.preventDefault(),c.stopPropagation(),s(a.id,"fail",b.x-11+11,b.y+N/2+3+22+2+4,"vertical")},style:{cursor:"crosshair"},children:(0,g.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--accent)",opacity:.8,children:(0,g.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]})]}),f&&!h&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("g",{transform:`translate(${-M/2-10}, 0)`,children:(0,g.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})}),(0,g.jsx)("g",{transform:`translate(0, ${-N/2-10})`,children:(0,g.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})})]}),C&&(0,g.jsxs)("g",{children:["vertical"===E?(0,g.jsx)("line",{x1:0,y1:N/2,x2:0,y2:N/2+50,stroke:"var(--border-hover)",strokeWidth:1.5}):(0,g.jsx)("line",{x1:M/2,y1:0,x2:M/2+50,y2:0,stroke:"var(--border-hover)",strokeWidth:1.5}),(0,g.jsx)("rect",{x:"vertical"===E?-M/2:M/2+50,y:"vertical"===E?N/2+50:-N/2,width:M,height:N,rx:4,fill:"var(--bg-card)",stroke:"var(--accent)",strokeWidth:1,strokeDasharray:"4 3"}),(0,g.jsx)("foreignObject",{x:"vertical"===E?-M/2+4:M/2+50+4,y:"vertical"===E?N/2+50+4:-N/2+4,width:M-8,height:N-8,children:(0,g.jsx)("div",{ref:K,children:(0,g.jsx)("input",{ref:J,value:G,onChange:a=>H(a.target.value),onBlur:()=>{G.trim()?V():(D(!1),H(""))},onKeyDown:a=>{"Enter"===a.key&&V(),"Escape"===a.key&&(D(!1),H("")),a.stopPropagation()},onMouseDown:a=>a.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 o=c(58403),p=c(44943);function q({width:a=16,height:b=16,x:c=0,y:d=0,cx:e=1,cy:f=1,cr:h=1,className:i,glow:k=!1,...l}){let m=(0,j.useId)(),n=(0,j.useRef)(null),[q,r]=(0,j.useState)({width:0,height:0}),s=Array.from({length:Math.ceil(q.width/a)*Math.ceil(q.height/b)},(g,h)=>{let i=h%Math.ceil(q.width/a),j=Math.floor(h/Math.ceil(q.width/a));return{x:i*a+e+c,y:j*b+f+d,delay:5*Math.random(),duration:3*Math.random()+2}});return(0,g.jsxs)("svg",{ref:n,"aria-hidden":"true",className:(0,p.cn)("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",i),...l,children:[(0,g.jsx)("defs",{children:(0,g.jsxs)("radialGradient",{id:`${m}-gradient`,children:[(0,g.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),(0,g.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),s.map(a=>(0,g.jsx)(o.P.circle,{cx:a.x,cy:a.y,r:h,fill:k?`url(#${m}-gradient)`:"currentColor",initial:k?{opacity:.4,scale:1}:{},animate:k?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:k?{duration:a.duration,repeat:1/0,repeatType:"reverse",delay:a.delay,ease:"easeInOut"}:{}},`${a.x}-${a.y}`))]})}let r=k().forwardRef(({className:a,children:b,rippleColor:c="#ffffff",duration:d="600ms",onClick:e,...f},h)=>{let[i,k]=(0,j.useState)([]);return(0,j.useEffect)(()=>{let a=null;if(i.length>0){let b=i[i.length-1];a=setTimeout(()=>{k(a=>a.filter(a=>a.key!==b.key))},parseInt(d))}return()=>{null!==a&&clearTimeout(a)}},[i,d]),(0,g.jsxs)("button",{className:(0,p.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",a),onClick:a=>{(a=>{let b=a.currentTarget.getBoundingClientRect(),c=Math.max(b.width,b.height),d={x:a.clientX-b.left-c/2,y:a.clientY-b.top-c/2,size:c,key:Date.now()};k(a=>[...a,d])})(a),e?.(a)},ref:h,...f,children:[(0,g.jsx)("div",{className:"relative z-10",children:b}),(0,g.jsx)("span",{className:"pointer-events-none absolute inset-0",children:i.map(a=>(0,g.jsx)("span",{className:"animate-rippling bg-background absolute rounded-full opacity-30",style:{width:`${a.size}px`,height:`${a.size}px`,top:`${a.y}px`,left:`${a.x}px`,backgroundColor:c,transform:"scale(0)","--duration":d}},a.key))})]})});function s({nodes:a,edges:b,testCases:c,selectedNodeId:d,onSelect:e,onAddNode:f,onDeleteNode:h,onDeleteNodes:i,onUnlinkNode:k,onRenameNode:l,onUpdateNode:m,onAddEdge:o,onDeleteEdge:p,onUpdateEdge:s,canUndo:v,canRedo:w,onUndo:x,onRedo:y}){let z=(0,j.useMemo)(()=>(function(a){let b=new Map;if(0===a.length)return b;let c=new Map;for(let b of a)c.set(b.id,b);let d=new Set;for(let b of a)b.position&&d.add(b.id);let e=a.filter(a=>null===a.parentId);if(0===e.length)return b;let f=0;for(let a of e)f=function a(e,f,g,h,i){let j=c.get(e);if(!j)return g;let k="vertical"===j.direction,l=k?j.position?.x??h:60+180*f,m=g;for(let b of j.children)m=k?a(b,f,m,h,i):a(b,f+1,m,h,i);let n=j.children.map(a=>b.get(a)).filter(Boolean),o=n.length>0?(Math.min(...n.map(a=>a.y))+Math.max(...n.map(a=>a.y)))/2:g;if(d.has(e)&&j.position){let c=n.length>0?o:g,d=j.position.x-(k?j.position.x:l),h=j.position.y-c;b.set(e,j.position);let i=g;for(let b of j.children)i=k?a(b,f,i,d,h):a(b,f+1,i,d,h);return i}return k?b.set(e,{x:(j.position?.x??0)+h,y:o+i}):b.set(e,{x:l+h,y:o+i}),m}(a.id,0,f,0,0);let g=Array.from(b.entries());if(g.length>0){let a=g.filter(([a])=>!d.has(a)).map(([,a])=>a.y);if(a.length>0){let c=(Math.min(...a)+Math.max(...a))/2;for(let[a,e]of g)d.has(a)||b.set(a,{x:e.x,y:e.y-c+300})}}return b})(a),[a]),[A,B]=(0,j.useState)({x:0,y:0}),[C,D]=(0,j.useState)(1),[E,F]=(0,j.useState)(!1),[G,H]=(0,j.useState)({x:0,y:0}),[I,J]=(0,j.useState)(null),[K,L]=(0,j.useState)(!1),[M,N]=(0,j.useState)(null),[O,P]=(0,j.useState)(null),[Q,R]=(0,j.useState)(null),[S,T]=(0,j.useState)(null),[U,V]=(0,j.useState)(!1),[W,X]=(0,j.useState)(new Set),[Y,Z]=(0,j.useState)(!1),[$,_]=(0,j.useState)(null),[aa,ab]=(0,j.useState)(!1),[ac,ad]=(0,j.useState)(new Set),ae=(0,j.useRef)(null),af=(0,j.useRef)(null),ag=(0,j.useRef)(null),ah=(0,j.useCallback)(()=>{let a=Array.from(z.values());if(0===a.length){D(1),B({x:0,y:0});return}if(!ae.current)return;let b=ae.current.getBoundingClientRect(),c=Math.min(...a.map(a=>a.x))-80,d=Math.max(...a.map(a=>a.x))+80,e=Math.min(...a.map(a=>a.y))-80,f=Math.max(...a.map(a=>a.y))+80,g=Math.min(b.width/(d-c),b.height/(f-e),1.5);D(g),B({x:b.width/2/g-(c+d)/2,y:b.height/2/g-(e+f)/2})},[z]),ai=(0,j.useCallback)((a,b)=>{if(!ae.current)return{x:0,y:0};let c=ae.current.getBoundingClientRect();return{x:(a-c.left)/C-A.x,y:(b-c.top)/C-A.y}},[C,A]),aj=(0,j.useCallback)(a=>{a.target===ae.current&&(F(!0),H({x:a.clientX-A.x*C,y:a.clientY-A.y*C}))},[A,C]),ak=(0,j.useCallback)(b=>{if(E&&B({x:(b.clientX-G.x)/C,y:(b.clientY-G.y)/C}),I){let a=ai(I.startClientX,I.startClientY),c=ai(b.clientX,b.clientY),d=c.x-a.x,e=c.y-a.y,f=I.startNodeX+d,g=I.startNodeY+e;ag.current={id:I.id,x:f,y:g},af.current||(af.current=requestAnimationFrame(()=>{ag.current&&(m(ag.current.id,{position:{x:ag.current.x,y:ag.current.y}}),ag.current=null),af.current=null}))}if(O){let c=ai(b.clientX,b.clientY);P(a=>a?{...a,curX:c.x,curY:c.y}:null);let d=null;for(let b of a){if(b.id===O.fromId)continue;let a=z.get(b.id);if(!a)continue;let e=c.x-a.x,f=c.y-a.y;if(80>Math.abs(e)&&40>Math.abs(f)){d=b.id;break}}T(d)}},[E,G,C,I,O,ai,m,a,z]),al=(0,j.useCallback)(()=>{if(O){let b={x:O.curX,y:O.curY};for(let c of a){let a=z.get(c.id);if(!a)continue;let d=b.x-a.x,e=b.y-a.y;if(80>Math.abs(d)&&40>Math.abs(e)&&c.id!==O.fromId){o(O.fromId,c.id,O.type);break}}P(null),T(null)}F(!1),J(null),af.current&&(cancelAnimationFrame(af.current),af.current=null)},[O,a,z,o]),am=(0,j.useCallback)(a=>{a.target===ae.current&&(e(null),L(!1))},[e]),an=(0,j.useCallback)(a=>{a.target===ae.current&&(N(ai(a.clientX,a.clientY)),L(!0))},[ai]),ao=(0,j.useCallback)(a=>{a.trim()&&f(null,a.trim(),M??void 0),L(!1),N(null)},[f,M]),ap=(0,j.useCallback)((a,b,c,d,e)=>{J({id:a,startNodeX:d,startNodeY:e,startClientX:b,startClientY:c})},[]),aq=(0,j.useCallback)((a,b,c,d,e)=>{P({fromId:a,type:b,startX:c,startY:d,curX:c,curY:d,direction:e})},[]),ar=(0,j.useCallback)(()=>{V(a=>!a),X(new Set),ab(!1),ad(new Set)},[]),as=(0,j.useCallback)(()=>{ab(a=>!a),ad(new Set),V(!1),X(new Set)},[]),at=(0,j.useCallback)(a=>{ad(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),au=(0,j.useCallback)(()=>{Array.from(ac).forEach(a=>{a.startsWith("tree-")?k(a.replace("tree-","")):p(a)}),ad(new Set),ab(!1)},[ac,k,p]),av=(0,j.useCallback)(a=>{X(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),aw=(0,j.useCallback)(()=>{$?(h($),_(null)):W.size>0&&(i(Array.from(W)),X(new Set),V(!1)),Z(!1)},[$,W,h,i]),ax=Array.from(z.values());return ax.length>0&&(ax.map(a=>a.x),ax.map(a=>a.x)),ax.length>0&&(ax.map(a=>a.y),ax.map(a=>a.y)),(0,g.jsxs)("div",{className:"relative w-full h-full overflow-hidden",style:{backgroundColor:"var(--bg-primary)"},children:[(0,g.jsx)(q,{width:24,height:24,cr:1,className:"text-neutral-300/60 dark:text-neutral-600/40"}),(0,g.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1",children:[(0,g.jsx)("button",{onClick:()=>D(a=>Math.min(3,1.2*a)),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,g.jsx)("button",{onClick:()=>D(a=>Math.max(.2,.8*a)),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,g.jsx)("button",{onClick:ah,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,g.jsxs)("div",{className:"text-[10px] text-center mt-0.5",style:{color:"var(--text-tertiary)"},children:[Math.round(100*C),"%"]}),(0,g.jsxs)("div",{className:"mt-1 border-t pt-1",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:ar,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:U?"var(--status-fail-text)":"var(--border)",color:U?"var(--status-fail-text)":"var(--text-secondary)",backgroundColor:U?"var(--status-fail-bg)":"var(--bg-card)"},title:U?"Exit delete mode":"Delete nodes",children:(0,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,g.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,g.jsx)("button",{onClick:as,className:"w-7 h-7 mt-1 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:aa?"var(--status-skip-text)":"var(--border)",color:aa?"var(--status-skip-text)":"var(--text-secondary)",backgroundColor:aa?"var(--status-skip-bg)":"var(--bg-card)"},title:aa?"Exit unlink mode":"Unlink lines",children:(0,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("path",{d:"M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3"}),(0,g.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12",strokeDasharray:"3 3"})]})})]})]}),(0,g.jsxs)("div",{className:"absolute top-3 left-3 z-10 flex flex-col gap-1",children:[(0,g.jsx)("button",{onClick:x,disabled:!v,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,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,g.jsx)("path",{d:"M3 5h5a3 3 0 0 1 0 6H6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,g.jsx)("path",{d:"M5.5 2.5L3 5l2.5 2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),(0,g.jsx)("button",{onClick:y,disabled:!w,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,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,g.jsx)("path",{d:"M11 5H6a3 3 0 0 0 0 6h2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,g.jsx)("path",{d:"M8.5 2.5L11 5 8.5 7.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})})]}),U&&(0,g.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,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select nodes to delete"}),(0,g.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:[W.size," selected"]}),(0,g.jsx)("button",{onClick:()=>{W.size>0&&Z(!0)},disabled:0===W.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,g.jsx)("button",{onClick:ar,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"})]}),aa&&(0,g.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,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select lines to unlink"}),(0,g.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-skip-bg)",color:"var(--status-skip-text)"},children:[ac.size," selected"]}),(0,g.jsx)("button",{onClick:au,disabled:0===ac.size,className:"px-3 py-1 text-[11px] font-medium rounded transition-colors disabled:opacity-40",style:{backgroundColor:"var(--status-skip-text)",color:"white"},children:"Unlink"}),(0,g.jsx)("button",{onClick:as,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"})]}),Y&&(0,g.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:()=>Z(!1),children:(0,g.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:a=>a.stopPropagation(),children:[(0,g.jsxs)("h3",{className:"text-sm font-semibold mb-2",style:{color:"var(--text-primary)"},children:["Delete ",$?"node":`${W.size} node${W.size>1?"s":""}`,"?"]}),(0,g.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["This will permanently remove the ",$?"node":`selected node${W.size>1?"s":""}`," and all their test cases. This action cannot be undone."]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("button",{onClick:()=>Z(!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,g.jsx)("button",{onClick:aw,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"})]})]})}),d&&(0,g.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex gap-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Tab = add child"}),(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Enter = add sibling"}),(0,g.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Del = delete"})]}),(0,g.jsxs)("svg",{ref:ae,width:"100%",height:"100%",onMouseDown:aj,onMouseMove:ak,onMouseUp:al,onClick:am,onDoubleClick:an,style:{cursor:E||I?"grabbing":O?"crosshair":"default"},children:[(0,g.jsxs)("defs",{children:[(0,g.jsx)("marker",{id:"arrow-pass",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-pass-text)"})}),(0,g.jsx)("marker",{id:"arrow-fail",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-fail-text)"})}),(0,g.jsx)("marker",{id:"arrow-default",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,g.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--text-tertiary)"})})]}),(0,g.jsxs)("g",{transform:`scale(${C}) translate(${A.x}, ${A.y})`,children:[a.map(c=>{let d;if(!c.parentId)return null;let e=z.get(c.parentId),f=z.get(c.id);if(!e||!f||b.some(a=>a.fromId===c.parentId&&a.toId===c.id||a.fromId===c.id&&a.toId===c.parentId))return null;let h=a.find(a=>a.id===c.parentId),i=h?.direction==="vertical",j=`tree-${c.id}`,l=ac.has(j);if(i){let a=e.y+40,b=f.y-40;d=`M ${e.x} ${e.y+28} C ${e.x} ${a}, ${f.x} ${b}, ${f.x} ${f.y-21}`}else{let a=e.x+60,b=f.x-60;d=`M ${e.x+70} ${e.y} C ${a} ${e.y}, ${b} ${f.y}, ${f.x-60} ${f.y}`}let m=(e.x+f.x)/2,n=(e.y+f.y)/2;return(0,g.jsxs)("g",{children:[(0,g.jsx)("path",{d:d,fill:"none",stroke:"transparent",strokeWidth:12,style:{cursor:"pointer"},onClick:()=>{aa?at(j):o(c.parentId,c.id,"pass")},onDoubleClick:a=>{a.stopPropagation(),aa||k(c.id)}}),(0,g.jsx)("path",{d:d,fill:"none",stroke:aa&&l?"var(--status-skip-text)":"var(--border-hover)",strokeWidth:aa&&l?2.5:1.5,strokeDasharray:aa&&l?"6 4":"none",style:{pointerEvents:"none",transition:"stroke 150ms, stroke-width 150ms"}}),aa&&(0,g.jsxs)("g",{transform:`translate(${m}, ${n})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:l?"var(--status-skip-text)":"var(--bg-card)",stroke:l?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),l&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})]},`tree-edge-${c.id}`)}),b.map(b=>{let c,d=z.get(b.fromId),e=z.get(b.toId);if(!d||!e)return null;let f="pass"===b.type,h="fail"===b.type;b.type;let i=f?"var(--status-pass-text)":h?"var(--status-fail-text)":"var(--text-tertiary)",j=(d.x+e.x)/2,k=(d.y+e.y)/2-12,l=ac.has(b.id),m=a.find(a=>a.id===b.fromId);return c=m?.direction==="vertical"?`M ${d.x} ${d.y} C ${d.x} ${d.y+80}, ${e.x} ${e.y-80}, ${e.x} ${e.y}`:`M ${d.x} ${d.y} C ${d.x+80} ${d.y}, ${e.x-80} ${e.y}, ${e.x} ${e.y}`,(0,g.jsxs)("g",{children:[(0,g.jsx)("path",{d:c,fill:"none",stroke:"transparent",strokeWidth:16,style:{cursor:"pointer"},onClick:()=>{aa?at(b.id):f?s(b.id,{type:"fail"}):h?s(b.id,{type:"default"}):s(b.id,{type:"pass"})},onMouseEnter:()=>R(b.id),onMouseLeave:()=>R(null)}),(0,g.jsx)("path",{d:c,fill:"none",stroke:aa&&l?"var(--status-skip-text)":i,strokeWidth:aa&&l||Q===b.id?2.5:1.8,strokeDasharray:aa&&l?"6 4":f?"none":h?"6 4":"3 3",markerEnd:aa?void 0:f?"url(#arrow-pass)":h?"url(#arrow-fail)":"url(#arrow-default)",style:{transition:"stroke-width 150ms ease-out, stroke 150ms ease-out",pointerEvents:"none"}}),aa&&(0,g.jsxs)("g",{transform:`translate(${j}, ${k})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:l?"var(--status-skip-text)":"var(--bg-card)",stroke:l?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),l&&(0,g.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),!aa&&Q===b.id&&(0,g.jsxs)("g",{transform:`translate(${j}, ${k-12})`,style:{pointerEvents:"none"},children:[(0,g.jsx)("rect",{x:-22,y:-7,width:44,height:14,rx:7,fill:f?"var(--status-pass-bg)":h?"var(--status-fail-bg)":"var(--bg-secondary)",stroke:f?"var(--status-pass-text)":h?"var(--status-fail-text)":"var(--border)",strokeWidth:.5}),(0,g.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:i,fontSize:9,fontWeight:500},children:f?"Pass":h?"Fail":"Default"})]})]},b.id)}),O&&(0,g.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}),a.map(b=>{let i=z.get(b.id);if(!i)return null;let j=function(a,b){let c=0,d=a;for(;d.parentId;){c++;let a=b.find(a=>a.id===d.parentId);if(!a)break;d=a}return c}(b,a);return(0,g.jsx)(n,{node:b,position:i,isSelected:b.id===d,testCases:c[b.id]??[],isDragged:I?.id===b.id,edgeDragActive:null!==O,isEdgeDropTarget:S===b.id&&null!==O&&b.id!==O.fromId,deleteMode:U,isDeleteChecked:W.has(b.id),onSelect:e,onAddChild:(a,b,c,d)=>{f(a,b,c,d)},onDelete:h,onUnlinkNode:k,onRename:l,onUpdateNode:m,onDragStart:ap,onEdgeStart:aq,onToggleDeleteCheck:av,depth:j,svgRef:ae},b.id)})]})]}),K&&M&&(0,g.jsx)(u,{position:M,scale:C,pan:A,svgRef:ae,onSubmit:ao,onCancel:()=>L(!1)}),0===a.length&&!K&&(0,g.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,g.jsx)(r,{onClick:()=>{if(!ae.current){N({x:0,y:0}),L(!0);return}let a=ae.current.getBoundingClientRect();N({x:a.width/2/C-A.x,y:a.height/2/C-A.y}),L(!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,g.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,g.jsx)("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),"Create your first flow node"]})})}),a.length>0&&(0,g.jsx)(t,{nodes:a,positions:z,pan:A,scale:C})]})}function t({nodes:a,positions:b,pan:c,scale:d}){let e=Array.from(b.values());if(0===e.length)return null;let f=Math.min(...e.map(a=>a.x)),h=Math.max(...e.map(a=>a.x)),i=Math.min(...e.map(a=>a.y)),j=Math.max(...e.map(a=>a.y)),k=h-f+80,l=j-i+80,m=Math.max(60,l/k*120),n=120/k,o=m/l;return(0,g.jsx)("div",{className:"absolute bottom-3 right-3 border z-10",style:{width:120,height:m,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",borderRadius:"var(--radius-sm)",opacity:.85},children:(0,g.jsx)("svg",{width:120,height:m,children:a.map(a=>{let c=b.get(a.id);if(!c)return null;let d=(c.x-f+40)*n,e=(c.y-i+40)*o;return(0,g.jsx)("circle",{cx:d,cy:e,r:2.5,fill:"var(--accent)",opacity:.6},a.id)})})})}function u({position:a,scale:b,pan:c,svgRef:d,onSubmit:e,onCancel:f}){let[h,i]=(0,j.useState)(""),k=(0,j.useRef)(null),l=(0,j.useRef)(null),m=(0,j.useCallback)(()=>{if(!d.current)return{left:"50%",top:"50%"};let e=d.current.getBoundingClientRect();return{left:(a.x+c.x)*b+e.left,top:(a.y+c.y)*b+e.top}},[a,b,c,d])(),n=144*b,o=48*b;return(0,g.jsxs)("div",{ref:l,className:"fixed z-50",style:{left:`${m.left}px`,top:`${m.top}px`,transform:"translate(-50%, 0)"},children:[(0,g.jsx)("div",{style:{width:2,height:20*b,margin:"0 auto",backgroundColor:"var(--border-hover)"}}),(0,g.jsx)("div",{style:{width:`${n}px`,height:`${o}px`,border:"1.5px dashed var(--accent)",borderRadius:4*b,backgroundColor:"var(--bg-card)",display:"flex",alignItems:"center",justifyContent:"center",padding:`${4*b}px`},children:(0,g.jsx)("input",{ref:k,autoFocus:!0,value:h,onChange:a=>i(a.target.value),onKeyDown:a=>{"Enter"===a.key&&h.trim()&&e(h),"Escape"===a.key&&f(),a.stopPropagation()},onBlur:()=>{h.trim()?e(h):f()},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(a){return(0,g.jsxs)("div",{className:"flex flex-col h-full",children:[(0,g.jsxs)("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Flow Map"}),(0,g.jsxs)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:[a.nodes.length," node",1!==a.nodes.length?"s":""]}),(0,g.jsx)("div",{className:"flex-1"}),(0,g.jsx)("button",{onClick:a.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,g.jsx)("div",{className:"flex-1 min-h-0",children:(0,g.jsx)(s,{nodes:a.nodes,edges:a.edges,testCases:a.testCases,selectedNodeId:a.selectedNodeId,onSelect:a.onSelect,onAddNode:a.onAddNode,onDeleteNode:a.onDeleteNode,onDeleteNodes:a.onDeleteNodes,onUnlinkNode:a.onUnlinkNode,onRenameNode:a.onRenameNode,onUpdateNode:a.onUpdateNode,onAddEdge:a.onAddEdge,onDeleteEdge:a.onDeleteEdge,onUpdateEdge:a.onUpdateEdge,canUndo:a.canUndo,canRedo:a.canRedo,onUndo:a.onUndo,onRedo:a.onRedo})})]})}r.displayName="RippleButton";var w=c(19188),x=c(98457);function y({value:a,className:b=""}){let c=Math.max(0,Math.min(100,a));return(0,g.jsx)("div",{className:`h-2 w-full overflow-hidden ${b}`,style:{backgroundColor:"var(--bg-secondary)",borderRadius:"var(--radius-pill)"},children:(0,g.jsx)("div",{className:"h-full transition-all duration-150 ease-out",style:{width:`${c}%`,backgroundColor:c>=80?"var(--status-pass-text)":c>=50?"var(--status-skip-text)":"var(--status-fail-text)",borderRadius:"var(--radius-pill)"}})})}function z({onAdd:a,nodeLabel:b}){let[c,d]=(0,j.useState)(""),e=(0,j.useRef)(null),f=()=>{c.trim()&&(a(c.trim()),d(""))};return(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("input",{ref:e,value:c,onChange:a=>d(a.target.value),onKeyDown:a=>{"Enter"===a.key&&f()},placeholder:`Add test case for "${b}"...`,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,g.jsx)("button",{onClick:f,disabled:!c.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 A={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"}},B=["untested","pass","fail","skip"];function C({status:a,onChange:b}){let c=A[a];return(0,g.jsx)("select",{value:a,onChange:a=>b(a.target.value),className:"text-[11px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer appearance-none",style:{backgroundColor:c.bg,color:c.text,borderRadius:"var(--radius-pill)",minWidth:72},children:B.map(a=>(0,g.jsx)("option",{value:a,children:A[a].label},a))})}function D({tc:a,visibleCols:b,expandAll:c,selected:d,onToggleSelect:e,onUpdate:f,onDelete:h,onDragStart:i,onDragOver:k,onDrop:l}){let[m,n]=(0,j.useState)(null),[o,p]=(0,j.useState)(""),[q,r]=(0,j.useState)(!1),[s,t]=(0,j.useState)(null),u=(0,j.useRef)(null),v=b=>{p(a[b]??""),n(b)},w=()=>{m&&(f({[m]:o}),n(null))},x=a=>{f({status:a})},y=a=>{if("Enter"===a.key&&"steps"!==m&&w(),"Escape"===a.key&&(n(null),p("")),"Tab"===a.key){a.preventDefault(),w();let c=b.filter(a=>"status"!==a.key&&"code"!==a.key).map(a=>a.key),d=c.indexOf(m),e=a.shiftKey?c[d-1]:c[d+1];e&&v(e)}},z=b=>{let c=a[b];return c&&c.length>40};return(0,g.jsx)(g.Fragment,{children:(0,g.jsxs)("tr",{className:"group transition-colors",style:{backgroundColor:q?"var(--bg-secondary)":"transparent"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),draggable:!0,onDragStart:i,onDragOver:k,onDrop:l,children:[(0,g.jsx)("td",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,g.jsx)("input",{type:"checkbox",checked:d,onChange:e,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),b.map(b=>(0,g.jsx)("td",{className:"px-2 py-1.5 text-xs border-b",style:{borderColor:"var(--border)",color:"var(--text-primary)",maxWidth:"steps"===b.key||"expected"===b.key?300:void 0},children:"status"===b.key?(0,g.jsx)(C,{status:a.status,onChange:x}):"code"===b.key?(0,g.jsx)("span",{className:"font-mono text-[10px]",style:{color:"var(--text-tertiary)"},children:a.code||"—"}):"case_type"===b.key?(0,g.jsx)(F,{value:a.case_type||"General",onChange:a=>f({case_type:a})}):m===b.key?"steps"===b.key?(0,g.jsx)("textarea",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:w,onKeyDown:y,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,g.jsx)("input",{ref:u,value:o,onChange:a=>p(a.target.value),onBlur:w,onKeyDown:y,className:"w-full bg-transparent outline-none border-b text-xs",style:{borderColor:"var(--accent)",color:"var(--text-primary)"}}):"links"===b.key?(0,g.jsx)("div",{className:"flex items-center gap-1",children:a.links?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("a",{href:a.links,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline hover:opacity-80 transition-opacity",style:{color:"var(--accent)"},onClick:a=>a.stopPropagation(),children:"Open Link"}),(0,g.jsx)("button",{onClick:a=>{a.stopPropagation(),f({links:""})},className:"text-[10px] opacity-0 group-hover:opacity-100 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},title:"Clear link",children:"\xd7"})]}):(0,g.jsx)("span",{className:"cursor-text block text-[11px]",onClick:()=>v(b.key),style:{color:"var(--text-tertiary)"},children:"Add link..."})}):(0,g.jsx)("span",{className:"cursor-text block",onClick:()=>{z(b.key)&&(s===b.key?t(null):t(b.key))},onDoubleClick:()=>v(b.key),title:z(b.key)?s===b.key||c?"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:s===b.key||c&&z(b.key)?"pre-wrap":"nowrap",display:"block",maxHeight:s===b.key||c&&z(b.key)?"none":"1.2em",lineHeight:"1.2em"},children:a[b.key]||(0,g.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"—"})})},b.key)),(0,g.jsx)("td",{className:"px-1 py-1.5 border-b",style:{borderColor:"var(--border)"},children:q&&(0,g.jsx)("button",{onClick:h,className:"text-[10px] opacity-50 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},children:"\xd7"})})]})})}let E={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 F({value:a,onChange:b}){let c=E[a]||E.General;return(0,g.jsx)("select",{value:a,onChange:a=>b(a.target.value),className:"text-[10px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer",style:{backgroundColor:c.bg,color:c.text},children:w.D_.map(a=>(0,g.jsx)("option",{value:a,children:a},a))})}function G({testCases:a,columns:b,expandAll:c,selectedIds:d,onToggleSelect:e,onToggleSelectAll:f,sortKey:h,sortDirection:i,onSortChange:j,onUpdate:k,onDelete:l,onReorder:m}){let n=b.filter(a=>a.visible),o=a.length>0&&a.every(a=>d.has(a.id)),p=a.some(a=>d.has(a.id)),q=a=>{a.preventDefault(),a.dataTransfer.dropEffect="move"};return 0===a.length?null:(0,g.jsx)("div",{className:"overflow-x-auto",style:{minWidth:0},children:(0,g.jsxs)("table",{className:"text-xs",style:{minWidth:"900px",width:"100%"},children:[(0,g.jsx)("thead",{className:"sticky top-0 z-10",style:{backgroundColor:"var(--bg-primary)"},children:(0,g.jsxs)("tr",{children:[(0,g.jsx)("th",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,g.jsx)("input",{type:"checkbox",checked:o,ref:a=>{a&&(a.indeterminate=p&&!o)},onChange:f,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),n.map(a=>(0,g.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"},onClick:()=>j(a.key),children:(0,g.jsxs)("div",{className:"flex items-center gap-1",children:[(0,g.jsx)("span",{children:a.label}),h===a.key&&(0,g.jsx)("span",{className:"text-[8px]",children:"asc"===i?"↑":"↓"})]})},a.key)),(0,g.jsx)("th",{className:"w-6 border-b",style:{borderColor:"var(--border)"}})]})}),(0,g.jsx)("tbody",{children:a.map(b=>(0,g.jsx)(D,{tc:b,visibleCols:n,expandAll:c,selected:d.has(b.id),onToggleSelect:()=>e(b.id),onUpdate:a=>k(b.id,a),onDelete:()=>l(b.id),onDragStart:a=>{var c;return c=b.id,void(a.dataTransfer.setData("text/plain",c),a.dataTransfer.effectAllowed="move")},onDragOver:q,onDrop:c=>((b,c)=>{b.preventDefault();let d=b.dataTransfer.getData("text/plain");if(d===c)return;let e=a.map(a=>a.id),f=e.indexOf(d),g=e.indexOf(c);if(-1===f||-1===g)return;let h=[...e];h.splice(f,1),h.splice(g,0,d),m(h)})(c,b.id)},b.id))})]})})}function H({stats:a}){return(0,g.jsxs)("div",{className:"flex items-center gap-4 px-4 py-2 text-xs border-t flex-wrap",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,g.jsxs)("span",{children:["Total: ",(0,g.jsx)("strong",{style:{color:"var(--text-primary)"},children:a.total})]}),(0,g.jsxs)("span",{children:["Pass: ",(0,g.jsx)("strong",{style:{color:"var(--status-pass-text)"},children:a.pass}),a.total>0&&` (${a.passRate}%)`]}),(0,g.jsxs)("span",{children:["Fail: ",(0,g.jsx)("strong",{style:{color:"var(--status-fail-text)"},children:a.fail})]}),(0,g.jsxs)("span",{children:["Skip: ",(0,g.jsx)("strong",{style:{color:"var(--status-skip-text)"},children:a.skip})]}),(0,g.jsxs)("span",{children:["Untested: ",(0,g.jsx)("strong",{style:{color:"var(--status-untested-text)"},children:a.untested})]})]})}var I=c(22858);function J({open:a,onClose:b,node:c,testCases:d,columns:e}){let f=e&&e.length>0?e:w._X;return a?(0,g.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,children:(0,g.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:a=>a.stopPropagation(),children:[(0,g.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Export Test Cases"}),(0,g.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["Export “",c.label,"” (",d.length," case",1!==d.length?"s":"",")"]}),(0,g.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,g.jsxs)("button",{onClick:()=>{(0,I.k5)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Markdown (.md)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Formatted table for documentation"})]}),(0,g.jsxs)("button",{onClick:()=>{(0,I.hX)(c,d),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"JSON (.json)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Structured data backup"})]}),(0,g.jsxs)("button",{onClick:()=>{(0,I.Rz)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"CSV (.csv)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Spreadsheet-compatible format"})]}),(0,g.jsxs)("button",{onClick:async()=>{await (0,I.G$)(c,d,f),b()},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,g.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Excel (.xlsx)"}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Styled spreadsheet for reporting"})]})]}),(0,g.jsx)("button",{onClick:b,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}function K(a,b,c){function d(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:g,traits:new Set},enumerable:!1}),c._zod.traits.has(a))return;c._zod.traits.add(a),b(c,d);let e=g.prototype,f=Object.keys(e);for(let a=0;a<f.length;a++){let b=f[a];b in c||(c[b]=e[b].bind(c))}}let e=c?.Parent??Object;class f extends e{}function g(a){var b;let e=c?.Parent?new f:this;for(let c of(d(e,a),(b=e._zod).deferred??(b.deferred=[]),e._zod.deferred))c();return e}return Object.defineProperty(f,"name",{value:a}),Object.defineProperty(g,"init",{value:d}),Object.defineProperty(g,Symbol.hasInstance,{value:b=>!!c?.Parent&&b instanceof c.Parent||b?._zod?.traits?.has(a)}),Object.defineProperty(g,"name",{value:a}),g}Symbol("zod_brand");class L extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class M extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(e=globalThis).__zod_globalConfig??(e.__zod_globalConfig={});let N=globalThis.__zod_globalConfig;function O(a){return a&&Object.assign(N,a),N}let P=/^[cC][0-9a-z]{6,}$/,Q=/^[0-9a-z]+$/,R=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,S=/^[0-9a-vA-V]{20}$/,T=/^[A-Za-z0-9]{27}$/,U=/^[a-zA-Z0-9_-]{21}$/,V=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,X=a=>a?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${a}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Y=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,_=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,aa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ab=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ac=/^[A-Za-z0-9_-]*$/,ad=/^https?$/,ae=/^\+[1-9]\d{6,14}$/,af="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ag=RegExp(`^${af}$`);function ah(a){let b="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof a.precision?-1===a.precision?`${b}`:0===a.precision?`${b}:[0-5]\\d`:`${b}:[0-5]\\d\\.\\d{${a.precision}}`:`${b}(?::[0-5]\\d(?:\\.\\d+)?)?`}let ai=/^[^A-Z]*$/,aj=/^[^a-z]*$/;function ak(a){let b=Object.values(a).filter(a=>"number"==typeof a);return Object.entries(a).filter(([a,c])=>-1===b.indexOf(+a)).map(([a,b])=>b)}function al(a,b){return"bigint"==typeof b?b.toString():b}function am(a){return{get value(){{let b=a();return Object.defineProperty(this,"value",{value:b}),b}}}}function an(a){let b=+!!a.startsWith("^"),c=a.endsWith("$")?a.length-1:a.length;return a.slice(b,c)}let ao=Symbol("evaluating");function ap(a,b,c){let d;Object.defineProperty(a,b,{get(){if(d!==ao)return void 0===d&&(d=ao,d=c()),d},set(c){Object.defineProperty(a,b,{value:c})},configurable:!0})}function aq(a,b,c){Object.defineProperty(a,b,{value:c,writable:!0,enumerable:!0,configurable:!0})}function ar(...a){let b={};for(let c of a)Object.assign(b,Object.getOwnPropertyDescriptors(c));return Object.defineProperties({},b)}function as(a){return JSON.stringify(a)}let at="captureStackTrace"in Error?Error.captureStackTrace:(...a)=>{};function au(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}let av=am(()=>{if(N.jitless||"undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(a){return!1}});function aw(a){if(!1===au(a))return!1;let b=a.constructor;if(void 0===b||"function"!=typeof b)return!0;let c=b.prototype;return!1!==au(c)&&!1!==Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")}function ax(a){return aw(a)?{...a}:Array.isArray(a)?[...a]:a instanceof Map?new Map(a):a instanceof Set?new Set(a):a}let ay=new Set(["string","number","symbol"]);function az(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function aA(a,b,c){let d=new a._zod.constr(b??a._zod.def);return(!b||c?.parent)&&(d._zod.parent=a),d}function aB(a){if(!a)return{};if("string"==typeof a)return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");a.error=a.message}return(delete a.message,"string"==typeof a.error)?{...a,error:()=>a.error}:a}function aC(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue!==!0)return!0;return!1}function aD(a,b){return b.map(b=>(b.path??(b.path=[]),b.path.unshift(a),b))}function aE(a){return"string"==typeof a?a:a?.message}function aF(a,b,c){let d=a.message?a.message:aE(a.inst?._zod.def?.error?.(a))??aE(b?.error?.(a))??aE(c.customError?.(a))??aE(c.localeError?.(a))??"Invalid input",{inst:e,continue:f,input:g,...h}=a;return h.path??(h.path=[]),h.message=d,b?.reportInput&&(h.input=g),h}function aG(a){return Array.isArray(a)?"array":"string"==typeof a?"string":"unknown"}function aH(...a){let[b,c,d]=a;return"string"==typeof b?{message:b,code:"custom",input:c,inst:d}:{...b}}Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_VALUE,Number.MAX_VALUE;let aI=K("$ZodCheck",(a,b)=>{var c;a._zod??(a._zod={}),a._zod.def=b,(c=a._zod).onattach??(c.onattach=[])}),aJ=K("$ZodCheckMaxLength",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.maximum??1/0;b.maximum<c&&(a._zod.bag.maximum=b.maximum)}),a._zod.check=c=>{let d=c.value;if(d.length<=b.maximum)return;let e=aG(d);c.issues.push({origin:e,code:"too_big",maximum:b.maximum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),aK=K("$ZodCheckMinLength",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag.minimum??-1/0;b.minimum>c&&(a._zod.bag.minimum=b.minimum)}),a._zod.check=c=>{let d=c.value;if(d.length>=b.minimum)return;let e=aG(d);c.issues.push({origin:e,code:"too_small",minimum:b.minimum,inclusive:!0,input:d,inst:a,continue:!b.abort})}}),aL=K("$ZodCheckLengthEquals",(a,b)=>{var c;aI.init(a,b),(c=a._zod.def).when??(c.when=a=>{let b=a.value;return null!=b&&void 0!==b.length}),a._zod.onattach.push(a=>{let c=a._zod.bag;c.minimum=b.length,c.maximum=b.length,c.length=b.length}),a._zod.check=c=>{let d=c.value,e=d.length;if(e===b.length)return;let f=aG(d),g=e>b.length;c.issues.push({origin:f,...g?{code:"too_big",maximum:b.length}:{code:"too_small",minimum:b.length},inclusive:!0,exact:!0,input:c.value,inst:a,continue:!b.abort})}}),aM=K("$ZodCheckStringFormat",(a,b)=>{var c,d;aI.init(a,b),a._zod.onattach.push(a=>{let c=a._zod.bag;c.format=b.format,b.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(b.pattern))}),b.pattern?(c=a._zod).check??(c.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:b.format,input:c.value,...b.pattern?{pattern:b.pattern.toString()}:{},inst:a,continue:!b.abort})}):(d=a._zod).check??(d.check=()=>{})}),aN=K("$ZodCheckRegex",(a,b)=>{aM.init(a,b),a._zod.check=c=>{b.pattern.lastIndex=0,b.pattern.test(c.value)||c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:b.pattern.toString(),inst:a,continue:!b.abort})}}),aO=K("$ZodCheckLowerCase",(a,b)=>{b.pattern??(b.pattern=ai),aM.init(a,b)}),aP=K("$ZodCheckUpperCase",(a,b)=>{b.pattern??(b.pattern=aj),aM.init(a,b)}),aQ=K("$ZodCheckIncludes",(a,b)=>{aI.init(a,b);let c=az(b.includes),d=new RegExp("number"==typeof b.position?`^.{${b.position}}${c}`:c);b.pattern=d,a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(d)}),a._zod.check=c=>{c.value.includes(b.includes,b.position)||c.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:b.includes,input:c.value,inst:a,continue:!b.abort})}}),aR=K("$ZodCheckStartsWith",(a,b)=>{aI.init(a,b);let c=RegExp(`^${az(b.prefix)}.*`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.startsWith(b.prefix)||c.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:b.prefix,input:c.value,inst:a,continue:!b.abort})}}),aS=K("$ZodCheckEndsWith",(a,b)=>{aI.init(a,b);let c=RegExp(`.*${az(b.suffix)}$`);b.pattern??(b.pattern=c),a._zod.onattach.push(a=>{let b=a._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(c)}),a._zod.check=c=>{c.value.endsWith(b.suffix)||c.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:b.suffix,input:c.value,inst:a,continue:!b.abort})}}),aT=K("$ZodCheckOverwrite",(a,b)=>{aI.init(a,b),a._zod.check=a=>{a.value=b.tx(a.value)}});class aU{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if("function"==typeof a){a(this,{execution:"sync"}),a(this,{execution:"async"});return}let b=a.split("\n").filter(a=>a),c=Math.min(...b.map(a=>a.length-a.trimStart().length));for(let a of b.map(a=>a.slice(c)).map(a=>" ".repeat(2*this.indent)+a))this.content.push(a)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(a=>` ${a}`)].join("\n"))}}let aV=(a,b)=>{a.name="$ZodError",Object.defineProperty(a,"_zod",{value:a._zod,enumerable:!1}),Object.defineProperty(a,"issues",{value:b,enumerable:!1}),a.message=JSON.stringify(b,al,2),Object.defineProperty(a,"toString",{value:()=>a.message,enumerable:!1})},aW=K("$ZodError",aV),aX=K("$ZodError",aV,{Parent:Error}),aY=a=>(b,c,d,e)=>{let f=d?{...d,async:!1}:{async:!1},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise)throw new L;if(g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>aF(a,f,O())));throw at(b,e?.callee),b}return g.value},aZ=a=>async(b,c,d,e)=>{let f=d?{...d,async:!0}:{async:!0},g=b._zod.run({value:c,issues:[]},f);if(g instanceof Promise&&(g=await g),g.issues.length){let b=new(e?.Err??a)(g.issues.map(a=>aF(a,f,O())));throw at(b,e?.callee),b}return g.value},a$=a=>(b,c,d)=>{let e=d?{...d,async:!1}:{async:!1},f=b._zod.run({value:c,issues:[]},e);if(f instanceof Promise)throw new L;return f.issues.length?{success:!1,error:new(a??aW)(f.issues.map(a=>aF(a,e,O())))}:{success:!0,data:f.value}},a_=a$(aX),a0=a=>async(b,c,d)=>{let e=d?{...d,async:!0}:{async:!0},f=b._zod.run({value:c,issues:[]},e);return f instanceof Promise&&(f=await f),f.issues.length?{success:!1,error:new a(f.issues.map(a=>aF(a,e,O())))}:{success:!0,data:f.value}},a1=a0(aX),a2={major:4,minor:4,patch:3},a3=K("$ZodType",(a,b)=>{var c;a??(a={}),a._zod.def=b,a._zod.bag=a._zod.bag||{},a._zod.version=a2;let d=[...a._zod.def.checks??[]];for(let b of(a._zod.traits.has("$ZodCheck")&&d.unshift(a),d))for(let c of b._zod.onattach)c(a);if(0===d.length)(c=a._zod).deferred??(c.deferred=[]),a._zod.deferred?.push(()=>{a._zod.run=a._zod.parse});else{let b=(a,b,c)=>{let d,e=aC(a);for(let f of b){if(f._zod.def.when){if(function(a,b=0){if(!0===a.aborted)return!0;for(let c=b;c<a.issues.length;c++)if(a.issues[c]?.continue===!1)return!0;return!1}(a)||!f._zod.def.when(a))continue}else if(e)continue;let b=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&c?.async===!1)throw new L;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==b&&(e||(e=aC(a,b)))});else{if(a.issues.length===b)continue;e||(e=aC(a,b))}}return d?d.then(()=>a):a},c=(c,e,f)=>{if(aC(c))return c.aborted=!0,c;let g=b(e,d,f);if(g instanceof Promise){if(!1===f.async)throw new L;return g.then(b=>a._zod.parse(b,f))}return a._zod.parse(g,f)};a._zod.run=(e,f)=>{if(f.skipChecks)return a._zod.parse(e,f);if("backward"===f.direction){let b=a._zod.parse({value:e.value,issues:[]},{...f,skipChecks:!0});return b instanceof Promise?b.then(a=>c(a,e,f)):c(b,e,f)}let g=a._zod.parse(e,f);if(g instanceof Promise){if(!1===f.async)throw new L;return g.then(a=>b(a,d,f))}return b(g,d,f)}}ap(a,"~standard",()=>({validate:b=>{try{let c=a_(a,b);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return a1(a,b).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),a4=K("$ZodString",(a,b)=>{a3.init(a,b),a._zod.pattern=[...a?._zod.bag?.patterns??[]].pop()??(a=>{let b=a?`[\\s\\S]{${a?.minimum??0},${a?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${b}$`)})(a._zod.bag),a._zod.parse=(c,d)=>{if(b.coerce)try{c.value=String(c.value)}catch(a){}return"string"==typeof c.value||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:a}),c}}),a5=K("$ZodStringFormat",(a,b)=>{aM.init(a,b),a4.init(a,b)}),a6=K("$ZodGUID",(a,b)=>{b.pattern??(b.pattern=W),a5.init(a,b)}),a7=K("$ZodUUID",(a,b)=>{if(b.version){let a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[b.version];if(void 0===a)throw Error(`Invalid UUID version: "${b.version}"`);b.pattern??(b.pattern=X(a))}else b.pattern??(b.pattern=X());a5.init(a,b)}),a8=K("$ZodEmail",(a,b)=>{b.pattern??(b.pattern=Y),a5.init(a,b)}),a9=K("$ZodURL",(a,b)=>{a5.init(a,b),a._zod.check=c=>{try{let d=c.value.trim();if(!b.normalize&&b.protocol?.source===ad.source&&!/^https?:\/\//i.test(d))return void c.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:c.value,inst:a,continue:!b.abort});let e=new URL(d);b.hostname&&(b.hostname.lastIndex=0,b.hostname.test(e.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:b.hostname.source,input:c.value,inst:a,continue:!b.abort})),b.protocol&&(b.protocol.lastIndex=0,b.protocol.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:b.protocol.source,input:c.value,inst:a,continue:!b.abort})),b.normalize?c.value=e.href:c.value=d;return}catch(d){c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:a,continue:!b.abort})}}}),ba=K("$ZodEmoji",(a,b)=>{b.pattern??(b.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a5.init(a,b)}),bb=K("$ZodNanoID",(a,b)=>{b.pattern??(b.pattern=U),a5.init(a,b)}),bc=K("$ZodCUID",(a,b)=>{b.pattern??(b.pattern=P),a5.init(a,b)}),bd=K("$ZodCUID2",(a,b)=>{b.pattern??(b.pattern=Q),a5.init(a,b)}),be=K("$ZodULID",(a,b)=>{b.pattern??(b.pattern=R),a5.init(a,b)}),bf=K("$ZodXID",(a,b)=>{b.pattern??(b.pattern=S),a5.init(a,b)}),bg=K("$ZodKSUID",(a,b)=>{b.pattern??(b.pattern=T),a5.init(a,b)}),bh=K("$ZodISODateTime",(a,b)=>{b.pattern??(b.pattern=function(a){let b=ah({precision:a.precision}),c=["Z"];a.local&&c.push(""),a.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let d=`${b}(?:${c.join("|")})`;return RegExp(`^${af}T(?:${d})$`)}(b)),a5.init(a,b)}),bi=K("$ZodISODate",(a,b)=>{b.pattern??(b.pattern=ag),a5.init(a,b)}),bj=K("$ZodISOTime",(a,b)=>{b.pattern??(b.pattern=RegExp(`^${ah(b)}$`)),a5.init(a,b)}),bk=K("$ZodISODuration",(a,b)=>{b.pattern??(b.pattern=V),a5.init(a,b)}),bl=K("$ZodIPv4",(a,b)=>{b.pattern??(b.pattern=Z),a5.init(a,b),a._zod.bag.format="ipv4"}),bm=K("$ZodIPv6",(a,b)=>{b.pattern??(b.pattern=$),a5.init(a,b),a._zod.bag.format="ipv6",a._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:a,continue:!b.abort})}}}),bn=K("$ZodCIDRv4",(a,b)=>{b.pattern??(b.pattern=_),a5.init(a,b)}),bo=K("$ZodCIDRv6",(a,b)=>{b.pattern??(b.pattern=aa),a5.init(a,b),a._zod.check=c=>{let d=c.value.split("/");try{if(2!==d.length)throw Error();let[a,b]=d;if(!b)throw Error();let c=Number(b);if(`${c}`!==b||c<0||c>128)throw Error();new URL(`http://[${a}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:a,continue:!b.abort})}}});function bp(a){if(""===a)return!0;if(/\s/.test(a)||a.length%4!=0)return!1;try{return atob(a),!0}catch{return!1}}let bq=K("$ZodBase64",(a,b)=>{b.pattern??(b.pattern=ab),a5.init(a,b),a._zod.bag.contentEncoding="base64",a._zod.check=c=>{bp(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:a,continue:!b.abort})}}),br=K("$ZodBase64URL",(a,b)=>{b.pattern??(b.pattern=ac),a5.init(a,b),a._zod.bag.contentEncoding="base64url",a._zod.check=c=>{!function(a){if(!ac.test(a))return!1;let b=a.replace(/[-_]/g,a=>"-"===a?"+":"/");return bp(b.padEnd(4*Math.ceil(b.length/4),"="))}(c.value)&&c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:a,continue:!b.abort})}}),bs=K("$ZodE164",(a,b)=>{b.pattern??(b.pattern=ae),a5.init(a,b)}),bt=K("$ZodJWT",(a,b)=>{a5.init(a,b),a._zod.check=c=>{!function(a,b=null){try{let c=a.split(".");if(3!==c.length)return!1;let[d]=c;if(!d)return!1;let e=JSON.parse(atob(d));if("typ"in e&&e?.typ!=="JWT"||!e.alg||b&&(!("alg"in e)||e.alg!==b))return!1;return!0}catch{return!1}}(c.value,b.alg)&&c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:a,continue:!b.abort})}}),bu=K("$ZodUnknown",(a,b)=>{a3.init(a,b),a._zod.parse=a=>a}),bv=K("$ZodNever",(a,b)=>{a3.init(a,b),a._zod.parse=(b,c)=>(b.issues.push({expected:"never",code:"invalid_type",input:b.value,inst:a}),b)});function bw(a,b,c){a.issues.length&&b.issues.push(...aD(c,a.issues)),b.value[c]=a.value}let bx=K("$ZodArray",(a,b)=>{a3.init(a,b),a._zod.parse=(c,d)=>{let e=c.value;if(!Array.isArray(e))return c.issues.push({expected:"array",code:"invalid_type",input:e,inst:a}),c;c.value=Array(e.length);let f=[];for(let a=0;a<e.length;a++){let g=e[a],h=b.element._zod.run({value:g,issues:[]},d);h instanceof Promise?f.push(h.then(b=>bw(b,c,a))):bw(h,c,a)}return f.length?Promise.all(f).then(()=>c):c}});function by(a,b,c,d,e,f){let g=c in d;if(a.issues.length){if(e&&f&&!g)return;b.issues.push(...aD(c,a.issues))}if(!g&&!e){a.issues.length||b.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[c]});return}void 0===a.value?g&&(b.value[c]=void 0):b.value[c]=a.value}function bz(a){var b;let c=Object.keys(a.shape);for(let b of c)if(!a.shape?.[b]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${b}": expected a Zod schema`);let d=Object.keys(b=a.shape).filter(a=>"optional"===b[a]._zod.optin&&"optional"===b[a]._zod.optout);return{...a,keys:c,keySet:new Set(c),numKeys:c.length,optionalKeys:new Set(d)}}function bA(a,b,c,d,e,f){let g=[],h=e.keySet,i=e.catchall._zod,j=i.def.type,k="optional"===i.optin,l="optional"===i.optout;for(let e in b){if("__proto__"===e||h.has(e))continue;if("never"===j){g.push(e);continue}let f=i.run({value:b[e],issues:[]},d);f instanceof Promise?a.push(f.then(a=>by(a,c,e,b,k,l))):by(f,c,e,b,k,l)}return(g.length&&c.issues.push({code:"unrecognized_keys",keys:g,input:b,inst:f}),a.length)?Promise.all(a).then(()=>c):c}let bB=K("$ZodObject",(a,b)=>{let c;a3.init(a,b);let d=Object.getOwnPropertyDescriptor(b,"shape");if(!d?.get){let a=b.shape;Object.defineProperty(b,"shape",{get:()=>{let c={...a};return Object.defineProperty(b,"shape",{value:c}),c}})}let e=am(()=>bz(b));ap(a._zod,"propValues",()=>{let a=b.shape,c={};for(let b in a){let d=a[b]._zod;if(d.values)for(let a of(c[b]??(c[b]=new Set),d.values))c[b].add(a)}return c});let f=b.catchall;a._zod.parse=(b,d)=>{c??(c=e.value);let g=b.value;if(!au(g))return b.issues.push({expected:"object",code:"invalid_type",input:g,inst:a}),b;b.value={};let h=[],i=c.shape;for(let a of c.keys){let c=i[a],e="optional"===c._zod.optin,f="optional"===c._zod.optout,j=c._zod.run({value:g[a],issues:[]},d);j instanceof Promise?h.push(j.then(c=>by(c,b,a,g,e,f))):by(j,b,a,g,e,f)}return f?bA(h,g,b,d,e.value,a):h.length?Promise.all(h).then(()=>b):b}}),bC=K("$ZodObjectJIT",(a,b)=>{let c,d;bB.init(a,b);let e=a._zod.parse,f=am(()=>bz(b)),g=!N.jitless,h=g&&av.value,i=b.catchall;a._zod.parse=(j,k)=>{d??(d=f.value);let l=j.value;return au(l)?g&&h&&k?.async===!1&&!0!==k.jitless?(c||(c=(a=>{let b=new aU(["shape","payload","ctx"]),c=f.value,d=a=>{let b=as(a);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};b.write("const input = payload.value;");let e=Object.create(null),g=0;for(let a of c.keys)e[a]=`key_${g++}`;for(let f of(b.write("const newResult = {};"),c.keys)){let c=e[f],g=as(f),h=a[f],i=h?._zod?.optin==="optional",j=h?._zod?.optout==="optional";b.write(`const ${c} = ${d(f)};`),i&&j?b.write(`
3
3
  if (${c}.issues.length) {
4
4
  if (${g} in input) {
5
5
  payload.issues = payload.issues.concat(${c}.issues.map(iss => ({
@@ -60,14 +60,14 @@ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__
60
60
 
61
61
  `)}b.write("payload.value = newResult;"),b.write("return payload;");let h=b.compile();return(b,c)=>h(a,b,c)})(b.shape)),j=c(j,k),i)?bA([],l,j,k,d,a):j:e(j,k):(j.issues.push({expected:"object",code:"invalid_type",input:l,inst:a}),j)}});function bD(a,b,c,d){for(let c of a)if(0===c.issues.length)return b.value=c.value,b;let e=a.filter(a=>!aC(a));return 1===e.length?(b.value=e[0].value,e[0]):(b.issues.push({code:"invalid_union",input:b.value,inst:c,errors:a.map(a=>a.issues.map(a=>aF(a,d,O())))}),b)}let bE=K("$ZodUnion",(a,b)=>{a3.init(a,b),ap(a._zod,"optin",()=>b.options.some(a=>"optional"===a._zod.optin)?"optional":void 0),ap(a._zod,"optout",()=>b.options.some(a=>"optional"===a._zod.optout)?"optional":void 0),ap(a._zod,"values",()=>{if(b.options.every(a=>a._zod.values))return new Set(b.options.flatMap(a=>Array.from(a._zod.values)))}),ap(a._zod,"pattern",()=>{if(b.options.every(a=>a._zod.pattern)){let a=b.options.map(a=>a._zod.pattern);return RegExp(`^(${a.map(a=>an(a.source)).join("|")})$`)}});let c=1===b.options.length?b.options[0]._zod.run:null;a._zod.parse=(d,e)=>{if(c)return c(d,e);let f=!1,g=[];for(let a of b.options){let b=a._zod.run({value:d.value,issues:[]},e);if(b instanceof Promise)g.push(b),f=!0;else{if(0===b.issues.length)return b;g.push(b)}}return f?Promise.all(g).then(b=>bD(b,d,a,e)):bD(g,d,a,e)}}),bF=K("$ZodIntersection",(a,b)=>{a3.init(a,b),a._zod.parse=(a,c)=>{let d=a.value,e=b.left._zod.run({value:d,issues:[]},c),f=b.right._zod.run({value:d,issues:[]},c);return e instanceof Promise||f instanceof Promise?Promise.all([e,f]).then(([b,c])=>bG(a,b,c)):bG(a,e,f)}});function bG(a,b,c){let d,e=new Map;for(let c of b.issues)if("unrecognized_keys"===c.code)for(let a of(d??(d=c),c.keys))e.has(a)||e.set(a,{}),e.get(a).l=!0;else a.issues.push(c);for(let b of c.issues)if("unrecognized_keys"===b.code)for(let a of b.keys)e.has(a)||e.set(a,{}),e.get(a).r=!0;else a.issues.push(b);let f=[...e].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(f.length&&d&&a.issues.push({...d,keys:f}),aC(a))return a;let g=function a(b,c){if(b===c||b instanceof Date&&c instanceof Date&&+b==+c)return{valid:!0,data:b};if(aw(b)&&aw(c)){let d=Object.keys(c),e=Object.keys(b).filter(a=>-1!==d.indexOf(a)),f={...b,...c};for(let d of e){let e=a(b[d],c[d]);if(!e.valid)return{valid:!1,mergeErrorPath:[d,...e.mergeErrorPath]};f[d]=e.data}return{valid:!0,data:f}}if(Array.isArray(b)&&Array.isArray(c)){if(b.length!==c.length)return{valid:!1,mergeErrorPath:[]};let d=[];for(let e=0;e<b.length;e++){let f=a(b[e],c[e]);if(!f.valid)return{valid:!1,mergeErrorPath:[e,...f.mergeErrorPath]};d.push(f.data)}return{valid:!0,data:d}}return{valid:!1,mergeErrorPath:[]}}(b.value,c.value);if(!g.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`);return a.value=g.data,a}let bH=K("$ZodEnum",(a,b)=>{a3.init(a,b);let c=ak(b.entries),d=new Set(c);a._zod.values=d,a._zod.pattern=RegExp(`^(${c.filter(a=>ay.has(typeof a)).map(a=>"string"==typeof a?az(a):a.toString()).join("|")})$`),a._zod.parse=(b,e)=>{let f=b.value;return d.has(f)||b.issues.push({code:"invalid_value",values:c,input:f,inst:a}),b}}),bI=K("$ZodTransform",(a,b)=>{a3.init(a,b),a._zod.optin="optional",a._zod.parse=(c,d)=>{if("backward"===d.direction)throw new M(a.constructor.name);let e=b.transform(c.value,c);if(d.async)return(e instanceof Promise?e:Promise.resolve(e)).then(a=>(c.value=a,c.fallback=!0,c));if(e instanceof Promise)throw new L;return c.value=e,c.fallback=!0,c}});function bJ(a,b){return void 0===b&&(a.issues.length||a.fallback)?{issues:[],value:void 0}:a}let bK=K("$ZodOptional",(a,b)=>{a3.init(a,b),a._zod.optin="optional",a._zod.optout="optional",ap(a._zod,"values",()=>b.innerType._zod.values?new Set([...b.innerType._zod.values,void 0]):void 0),ap(a._zod,"pattern",()=>{let a=b.innerType._zod.pattern;return a?RegExp(`^(${an(a.source)})?$`):void 0}),a._zod.parse=(a,c)=>{if("optional"===b.innerType._zod.optin){let d=a.value,e=b.innerType._zod.run(a,c);return e instanceof Promise?e.then(a=>bJ(a,d)):bJ(e,d)}return void 0===a.value?a:b.innerType._zod.run(a,c)}}),bL=K("$ZodExactOptional",(a,b)=>{bK.init(a,b),ap(a._zod,"values",()=>b.innerType._zod.values),ap(a._zod,"pattern",()=>b.innerType._zod.pattern),a._zod.parse=(a,c)=>b.innerType._zod.run(a,c)}),bM=K("$ZodNullable",(a,b)=>{a3.init(a,b),ap(a._zod,"optin",()=>b.innerType._zod.optin),ap(a._zod,"optout",()=>b.innerType._zod.optout),ap(a._zod,"pattern",()=>{let a=b.innerType._zod.pattern;return a?RegExp(`^(${an(a.source)}|null)$`):void 0}),ap(a._zod,"values",()=>b.innerType._zod.values?new Set([...b.innerType._zod.values,null]):void 0),a._zod.parse=(a,c)=>null===a.value?a:b.innerType._zod.run(a,c)}),bN=K("$ZodDefault",(a,b)=>{a3.init(a,b),a._zod.optin="optional",ap(a._zod,"values",()=>b.innerType._zod.values),a._zod.parse=(a,c)=>{if("backward"===c.direction)return b.innerType._zod.run(a,c);if(void 0===a.value)return a.value=b.defaultValue,a;let d=b.innerType._zod.run(a,c);return d instanceof Promise?d.then(a=>bO(a,b)):bO(d,b)}});function bO(a,b){return void 0===a.value&&(a.value=b.defaultValue),a}let bP=K("$ZodPrefault",(a,b)=>{a3.init(a,b),a._zod.optin="optional",ap(a._zod,"values",()=>b.innerType._zod.values),a._zod.parse=(a,c)=>("backward"===c.direction||void 0===a.value&&(a.value=b.defaultValue),b.innerType._zod.run(a,c))}),bQ=K("$ZodNonOptional",(a,b)=>{a3.init(a,b),ap(a._zod,"values",()=>{let a=b.innerType._zod.values;return a?new Set([...a].filter(a=>void 0!==a)):void 0}),a._zod.parse=(c,d)=>{let e=b.innerType._zod.run(c,d);return e instanceof Promise?e.then(b=>bR(b,a)):bR(e,a)}});function bR(a,b){return a.issues.length||void 0!==a.value||a.issues.push({code:"invalid_type",expected:"nonoptional",input:a.value,inst:b}),a}let bS=K("$ZodCatch",(a,b)=>{a3.init(a,b),a._zod.optin="optional",ap(a._zod,"optout",()=>b.innerType._zod.optout),ap(a._zod,"values",()=>b.innerType._zod.values),a._zod.parse=(a,c)=>{if("backward"===c.direction)return b.innerType._zod.run(a,c);let d=b.innerType._zod.run(a,c);return d instanceof Promise?d.then(d=>(a.value=d.value,d.issues.length&&(a.value=b.catchValue({...a,error:{issues:d.issues.map(a=>aF(a,c,O()))},input:a.value}),a.issues=[],a.fallback=!0),a)):(a.value=d.value,d.issues.length&&(a.value=b.catchValue({...a,error:{issues:d.issues.map(a=>aF(a,c,O()))},input:a.value}),a.issues=[],a.fallback=!0),a)}}),bT=K("$ZodPipe",(a,b)=>{a3.init(a,b),ap(a._zod,"values",()=>b.in._zod.values),ap(a._zod,"optin",()=>b.in._zod.optin),ap(a._zod,"optout",()=>b.out._zod.optout),ap(a._zod,"propValues",()=>b.in._zod.propValues),a._zod.parse=(a,c)=>{if("backward"===c.direction){let d=b.out._zod.run(a,c);return d instanceof Promise?d.then(a=>bU(a,b.in,c)):bU(d,b.in,c)}let d=b.in._zod.run(a,c);return d instanceof Promise?d.then(a=>bU(a,b.out,c)):bU(d,b.out,c)}});function bU(a,b,c){return a.issues.length?(a.aborted=!0,a):b._zod.run({value:a.value,issues:a.issues,fallback:a.fallback},c)}let bV=K("$ZodReadonly",(a,b)=>{a3.init(a,b),ap(a._zod,"propValues",()=>b.innerType._zod.propValues),ap(a._zod,"values",()=>b.innerType._zod.values),ap(a._zod,"optin",()=>b.innerType?._zod?.optin),ap(a._zod,"optout",()=>b.innerType?._zod?.optout),a._zod.parse=(a,c)=>{if("backward"===c.direction)return b.innerType._zod.run(a,c);let d=b.innerType._zod.run(a,c);return d instanceof Promise?d.then(bW):bW(d)}});function bW(a){return a.value=Object.freeze(a.value),a}let bX=K("$ZodCustom",(a,b)=>{aI.init(a,b),a3.init(a,b),a._zod.parse=(a,b)=>a,a._zod.check=c=>{let d=c.value,e=b.fn(d);if(e instanceof Promise)return e.then(b=>bY(b,c,d,a));bY(e,c,d,a)}});function bY(a,b,c,d){if(!a){let a={code:"custom",input:c,inst:d,path:[...d._zod.def.path??[]],continue:!d._zod.def.abort};d._zod.def.params&&(a.params=d._zod.def.params),b.issues.push(aH(a))}}Symbol("ZodOutput"),Symbol("ZodInput");class bZ{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...b){let c=b[0];return this._map.set(a,c),c&&"object"==typeof c&&"id"in c&&this._idmap.set(c.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){let b=this._map.get(a);return b&&"object"==typeof b&&"id"in b&&this._idmap.delete(b.id),this._map.delete(a),this}get(a){let b=a._zod.parent;if(b){let c={...this.get(b)??{}};delete c.id;let d={...c,...this._map.get(a)};return Object.keys(d).length?d:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}(f=globalThis).__zod_globalRegistry??(f.__zod_globalRegistry=new bZ);let b$=globalThis.__zod_globalRegistry;function b_(a,b){return new a({type:"string",format:"guid",check:"string_format",abort:!1,...aB(b)})}function b0(a,b){return new aJ({check:"max_length",...aB(b),maximum:a})}function b1(a,b){return new aK({check:"min_length",...aB(b),minimum:a})}function b2(a,b){return new aL({check:"length_equals",...aB(b),length:a})}function b3(a){return new aT({check:"overwrite",tx:a})}function b4(a){let b=a?.target??"draft-2020-12";return"draft-4"===b&&(b="draft-04"),"draft-7"===b&&(b="draft-07"),{processors:a.processors??{},metadataRegistry:a?.metadata??b$,target:b,unrepresentable:a?.unrepresentable??"throw",override:a?.override??(()=>{}),io:a?.io??"output",counter:0,seen:new Map,cycles:a?.cycles??"ref",reused:a?.reused??"inline",external:a?.external??void 0}}function b5(a,b,c={path:[],schemaPath:[]}){var d;let e=a._zod.def,f=b.seen.get(a);if(f)return f.count++,c.schemaPath.includes(a)&&(f.cycle=c.path),f.schema;let g={schema:{},count:1,cycle:void 0,path:c.path};b.seen.set(a,g);let h=a._zod.toJSONSchema?.();if(h)g.schema=h;else{let d={...c,schemaPath:[...c.schemaPath,a],path:c.path};if(a._zod.processJSONSchema)a._zod.processJSONSchema(b,g.schema,d);else{let c=g.schema,f=b.processors[e.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${e.type}`);f(a,b,c,d)}let f=a._zod.parent;f&&(g.ref||(g.ref=f),b5(f,b,d),b.seen.get(f).isParent=!0)}let i=b.metadataRegistry.get(a);return i&&Object.assign(g.schema,i),"input"===b.io&&function a(b,c){let d=c??{seen:new Set};if(d.seen.has(b))return!1;d.seen.add(b);let e=b._zod.def;if("transform"===e.type)return!0;if("array"===e.type)return a(e.element,d);if("set"===e.type)return a(e.valueType,d);if("lazy"===e.type)return a(e.getter(),d);if("promise"===e.type||"optional"===e.type||"nonoptional"===e.type||"nullable"===e.type||"readonly"===e.type||"default"===e.type||"prefault"===e.type)return a(e.innerType,d);if("intersection"===e.type)return a(e.left,d)||a(e.right,d);if("record"===e.type||"map"===e.type)return a(e.keyType,d)||a(e.valueType,d);if("pipe"===e.type)return!!b._zod.traits.has("$ZodCodec")||a(e.in,d)||a(e.out,d);if("object"===e.type){for(let b in e.shape)if(a(e.shape[b],d))return!0;return!1}if("union"===e.type){for(let b of e.options)if(a(b,d))return!0;return!1}if("tuple"===e.type){for(let b of e.items)if(a(b,d))return!0;if(e.rest&&a(e.rest,d))return!0}return!1}(a)&&(delete g.schema.examples,delete g.schema.default),"input"===b.io&&"_prefault"in g.schema&&((d=g.schema).default??(d.default=g.schema._prefault)),delete g.schema._prefault,b.seen.get(a).schema}function b6(a,b){let c=a.seen.get(b);if(!c)throw Error("Unprocessed schema. This is a bug in Zod.");let d=new Map;for(let b of a.seen.entries()){let c=a.metadataRegistry.get(b[0])?.id;if(c){let a=d.get(c);if(a&&a!==b[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);d.set(c,b[0])}}let e=b=>{if(b[1].schema.$ref)return;let d=b[1],{ref:e,defId:f}=(b=>{let d="draft-2020-12"===a.target?"$defs":"definitions";if(a.external){let c=a.external.registry.get(b[0])?.id,e=a.external.uri??(a=>a);if(c)return{ref:e(c)};let f=b[1].defId??b[1].schema.id??`schema${a.counter++}`;return b[1].defId=f,{defId:f,ref:`${e("__shared")}#/${d}/${f}`}}if(b[1]===c)return{ref:"#"};let e=`#/${d}/`,f=b[1].schema.id??`__schema${a.counter++}`;return{defId:f,ref:e+f}})(b);d.def={...d.schema},f&&(d.defId=f);let g=d.schema;for(let a in g)delete g[a];g.$ref=e};if("throw"===a.cycles)for(let b of a.seen.entries()){let a=b[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
62
62
 
63
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of a.seen.entries()){let d=c[1];if(b===c[0]){e(c);continue}if(a.external){let d=a.external.registry.get(c[0])?.id;if(b!==c[0]&&d){e(c);continue}}if(a.metadataRegistry.get(c[0])?.id||d.cycle||d.count>1&&"ref"===a.reused){e(c);continue}}}function b7(a,b){let c=a.seen.get(b);if(!c)throw Error("Unprocessed schema. This is a bug in Zod.");let d=b=>{let c=a.seen.get(b);if(null===c.ref)return;let e=c.def??c.schema,f={...e},g=c.ref;if(c.ref=null,g){d(g);let c=a.seen.get(g),h=c.schema;if(h.$ref&&("draft-07"===a.target||"draft-04"===a.target||"openapi-3.0"===a.target)?(e.allOf=e.allOf??[],e.allOf.push(h)):Object.assign(e,h),Object.assign(e,f),b._zod.parent===g)for(let a in e)"$ref"!==a&&"allOf"!==a&&(a in f||delete e[a]);if(h.$ref&&c.def)for(let a in e)"$ref"!==a&&"allOf"!==a&&a in c.def&&JSON.stringify(e[a])===JSON.stringify(c.def[a])&&delete e[a]}let h=b._zod.parent;if(h&&h!==g){d(h);let b=a.seen.get(h);if(b?.schema.$ref&&(e.$ref=b.schema.$ref,b.def))for(let a in e)"$ref"!==a&&"allOf"!==a&&a in b.def&&JSON.stringify(e[a])===JSON.stringify(b.def[a])&&delete e[a]}a.override({zodSchema:b,jsonSchema:e,path:c.path??[]})};for(let b of[...a.seen.entries()].reverse())d(b[0]);let e={};if("draft-2020-12"===a.target?e.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===a.target?e.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===a.target?e.$schema="http://json-schema.org/draft-04/schema#":a.target,a.external?.uri){let c=a.external.registry.get(b)?.id;if(!c)throw Error("Schema is missing an `id` property");e.$id=a.external.uri(c)}Object.assign(e,c.def??c.schema);let f=a.metadataRegistry.get(b)?.id;void 0!==f&&e.id===f&&delete e.id;let g=a.external?.defs??{};for(let b of a.seen.entries()){let a=b[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,g[a.defId]=a.def)}a.external||Object.keys(g).length>0&&("draft-2020-12"===a.target?e.$defs=g:e.definitions=g);try{let c=JSON.parse(JSON.stringify(e));return Object.defineProperty(c,"~standard",{value:{...b["~standard"],jsonSchema:{input:b8(b,"input",a.processors),output:b8(b,"output",a.processors)}},enumerable:!1,writable:!1}),c}catch(a){throw Error("Error converting schema to JSON.")}}let b8=(a,b,c={})=>d=>{let{libraryOptions:e,target:f}=d??{},g=b4({...e??{},target:f,io:b,processors:c});return b5(a,g),b6(g,a),b7(g,a)},b9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ca=(a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType},cb=K("ZodISODateTime",(a,b)=>{bh.init(a,b),cy.init(a,b)}),cc=K("ZodISODate",(a,b)=>{bi.init(a,b),cy.init(a,b)}),cd=K("ZodISOTime",(a,b)=>{bj.init(a,b),cy.init(a,b)}),ce=K("ZodISODuration",(a,b)=>{bk.init(a,b),cy.init(a,b)}),cf=K("ZodError",(a,b)=>{aW.init(a,b),a.name="ZodError",Object.defineProperties(a,{format:{value:b=>(function(a,b=a=>a.message){let c={_errors:[]},d=(a,e=[])=>{for(let f of a.issues)if("invalid_union"===f.code&&f.errors.length)f.errors.map(a=>d({issues:a},[...e,...f.path]));else if("invalid_key"===f.code)d({issues:f.issues},[...e,...f.path]);else if("invalid_element"===f.code)d({issues:f.issues},[...e,...f.path]);else{let a=[...e,...f.path];if(0===a.length)c._errors.push(b(f));else{let d=c,e=0;for(;e<a.length;){let c=a[e];e===a.length-1?(d[c]=d[c]||{_errors:[]},d[c]._errors.push(b(f))):d[c]=d[c]||{_errors:[]},d=d[c],e++}}}};return d(a),c})(a,b)},flatten:{value:b=>(function(a,b=a=>a.message){let c={},d=[];for(let e of a.issues)e.path.length>0?(c[e.path[0]]=c[e.path[0]]||[],c[e.path[0]].push(b(e))):d.push(b(e));return{formErrors:d,fieldErrors:c}})(a,b)},addIssue:{value:b=>{a.issues.push(b),a.message=JSON.stringify(a.issues,al,2)}},addIssues:{value:b=>{a.issues.push(...b),a.message=JSON.stringify(a.issues,al,2)}},isEmpty:{get:()=>0===a.issues.length}})},{Parent:Error}),cg=aY(cf),ch=aZ(cf),ci=a$(cf),cj=a0(cf),ck=(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return aY(cf)(a,b,d)},cl=(a,b,c)=>aY(cf)(a,b,c),cm=async(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return aZ(cf)(a,b,d)},cn=async(a,b,c)=>aZ(cf)(a,b,c),co=(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return a$(cf)(a,b,d)},cp=(a,b,c)=>a$(cf)(a,b,c),cq=async(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return a0(cf)(a,b,d)},cr=async(a,b,c)=>a0(cf)(a,b,c),cs=new WeakMap;function ct(a,b,c){let d=Object.getPrototypeOf(a),e=cs.get(d);if(e||(e=new Set,cs.set(d,e)),!e.has(b))for(let a in e.add(b),c){let b=c[a];Object.defineProperty(d,a,{configurable:!0,enumerable:!1,get(){let c=b.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(b){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:b})}})}}let cu=K("ZodType",(a,b)=>(a3.init(a,b),Object.assign(a["~standard"],{jsonSchema:{input:b8(a,"input"),output:b8(a,"output")}}),a.toJSONSchema=((a,b={})=>c=>{let d=b4({...c,processors:b});return b5(a,d),b6(d,a),b7(d,a)})(a,{}),a.def=b,a.type=b.type,Object.defineProperty(a,"_def",{value:b}),a.parse=(b,c)=>cg(a,b,c,{callee:a.parse}),a.safeParse=(b,c)=>ci(a,b,c),a.parseAsync=async(b,c)=>ch(a,b,c,{callee:a.parseAsync}),a.safeParseAsync=async(b,c)=>cj(a,b,c),a.spa=a.safeParseAsync,a.encode=(b,c)=>ck(a,b,c),a.decode=(b,c)=>cl(a,b,c),a.encodeAsync=async(b,c)=>cm(a,b,c),a.decodeAsync=async(b,c)=>cn(a,b,c),a.safeEncode=(b,c)=>co(a,b,c),a.safeDecode=(b,c)=>cp(a,b,c),a.safeEncodeAsync=async(b,c)=>cq(a,b,c),a.safeDecodeAsync=async(b,c)=>cr(a,b,c),ct(a,"ZodType",{check(...a){let b=this.def;return this.clone(ar(b,{checks:[...b.checks??[],...a.map(a=>"function"==typeof a?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,b){return aA(this,a,b)},brand(){return this},register(a,b){return a.add(this,b),this},refine(a,b){return this.check(function(a,b={}){return new db({type:"custom",check:"custom",fn:a,...aB(b)})}(a,b))},superRefine(a,b){return this.check(function(a,b){let c=function(a,b){let c=new aI({check:"custom",...aB(b)});return c._zod.check=a,c}(b=>(b.addIssue=a=>{"string"==typeof a?b.issues.push(aH(a,b.value,c._zod.def)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=b.value),a.inst??(a.inst=c),a.continue??(a.continue=!c._zod.def.abort),b.issues.push(aH(a)))},a(b.value,b)),b);return c}(a,b))},overwrite(a){return this.check(b3(a))},optional(){return c0(this)},exactOptional(){var a;return a=this,new c1({type:"optional",innerType:a})},nullable(){return c3(this)},nullish(){return c0(c3(this))},nonoptional(a){var b;return b=this,new c6({type:"nonoptional",innerType:b,...aB(a)})},array(){return function(a,b){return new cV({type:"array",element:a,...aB(void 0)})}(this)},or(a){return new cX({type:"union",options:[this,a],...aB(void 0)})},and(a){var b;return b=this,new cY({type:"intersection",left:b,right:a})},transform(a){return c9(this,new c$({type:"transform",transform:a}))},default(a){var b,c;return b=this,c=a,new c4({type:"default",innerType:b,get defaultValue(){return"function"==typeof c?c():ax(c)}})},prefault(a){var b,c;return b=this,c=a,new c5({type:"prefault",innerType:b,get defaultValue(){return"function"==typeof c?c():ax(c)}})},catch(a){var b,c;return b=this,new c7({type:"catch",innerType:b,catchValue:"function"==typeof(c=a)?c:()=>c})},pipe(a){return c9(this,a)},readonly(){var a;return a=this,new da({type:"readonly",innerType:a})},describe(a){let b=this.clone();return b$.add(b,{description:a}),b},meta(...a){if(0===a.length)return b$.get(this);let b=this.clone();return b$.add(b,a[0]),b},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(a,"description",{get:()=>b$.get(a)?.description,configurable:!0}),a)),cv=K("_ZodString",(a,b)=>{a4.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{c.type="string";let{minimum:e,maximum:f,format:g,patterns:h,contentEncoding:i}=a._zod.bag;if("number"==typeof e&&(c.minLength=e),"number"==typeof f&&(c.maxLength=f),g&&(c.format=b9[g]??g,""===c.format&&delete c.format,"time"===g&&delete c.format),i&&(c.contentEncoding=i),h&&h.size>0){let a=[...h];1===a.length?c.pattern=a[0].source:a.length>1&&(c.allOf=[...a.map(a=>({..."draft-07"===b.target||"draft-04"===b.target||"openapi-3.0"===b.target?{type:"string"}:{},pattern:a.source}))])}})(a,b,c,0);let c=a._zod.bag;a.format=c.format??null,a.minLength=c.minimum??null,a.maxLength=c.maximum??null,ct(a,"_ZodString",{regex(...a){return this.check(function(a,b){return new aN({check:"string_format",format:"regex",...aB(b),pattern:a})}(...a))},includes(...a){return this.check(function(a,b){return new aQ({check:"string_format",format:"includes",...aB(b),includes:a})}(...a))},startsWith(...a){return this.check(function(a,b){return new aR({check:"string_format",format:"starts_with",...aB(b),prefix:a})}(...a))},endsWith(...a){return this.check(function(a,b){return new aS({check:"string_format",format:"ends_with",...aB(b),suffix:a})}(...a))},min(...a){return this.check(b1(...a))},max(...a){return this.check(b0(...a))},length(...a){return this.check(b2(...a))},nonempty(...a){return this.check(b1(1,...a))},lowercase(a){return this.check(new aO({check:"string_format",format:"lowercase",...aB(a)}))},uppercase(a){return this.check(new aP({check:"string_format",format:"uppercase",...aB(a)}))},trim(){return this.check(b3(a=>a.trim()))},normalize(...a){return this.check(function(a){return b3(b=>b.normalize(a))}(...a))},toLowerCase(){return this.check(b3(a=>a.toLowerCase()))},toUpperCase(){return this.check(b3(a=>a.toUpperCase()))},slugify(){return this.check(b3(a=>a.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),cw=K("ZodString",(a,b)=>{a4.init(a,b),cv.init(a,b),a.email=b=>a.check(new cz({type:"string",format:"email",check:"string_format",abort:!1,...aB(b)})),a.url=b=>a.check(new cC({type:"string",format:"url",check:"string_format",abort:!1,...aB(b)})),a.jwt=b=>a.check(new cR({type:"string",format:"jwt",check:"string_format",abort:!1,...aB(b)})),a.emoji=b=>a.check(new cD({type:"string",format:"emoji",check:"string_format",abort:!1,...aB(b)})),a.guid=b=>a.check(b_(cA,b)),a.uuid=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,...aB(b)})),a.uuidv4=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...aB(b)})),a.uuidv6=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...aB(b)})),a.uuidv7=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...aB(b)})),a.nanoid=b=>a.check(new cE({type:"string",format:"nanoid",check:"string_format",abort:!1,...aB(b)})),a.guid=b=>a.check(b_(cA,b)),a.cuid=b=>a.check(new cF({type:"string",format:"cuid",check:"string_format",abort:!1,...aB(b)})),a.cuid2=b=>a.check(new cG({type:"string",format:"cuid2",check:"string_format",abort:!1,...aB(b)})),a.ulid=b=>a.check(new cH({type:"string",format:"ulid",check:"string_format",abort:!1,...aB(b)})),a.base64=b=>a.check(new cO({type:"string",format:"base64",check:"string_format",abort:!1,...aB(b)})),a.base64url=b=>a.check(new cP({type:"string",format:"base64url",check:"string_format",abort:!1,...aB(b)})),a.xid=b=>a.check(new cI({type:"string",format:"xid",check:"string_format",abort:!1,...aB(b)})),a.ksuid=b=>a.check(new cJ({type:"string",format:"ksuid",check:"string_format",abort:!1,...aB(b)})),a.ipv4=b=>a.check(new cK({type:"string",format:"ipv4",check:"string_format",abort:!1,...aB(b)})),a.ipv6=b=>a.check(new cL({type:"string",format:"ipv6",check:"string_format",abort:!1,...aB(b)})),a.cidrv4=b=>a.check(new cM({type:"string",format:"cidrv4",check:"string_format",abort:!1,...aB(b)})),a.cidrv6=b=>a.check(new cN({type:"string",format:"cidrv6",check:"string_format",abort:!1,...aB(b)})),a.e164=b=>a.check(new cQ({type:"string",format:"e164",check:"string_format",abort:!1,...aB(b)})),a.datetime=b=>a.check(new cb({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...aB(b)})),a.date=b=>a.check(new cc({type:"string",format:"date",check:"string_format",...aB(b)})),a.time=b=>a.check(new cd({type:"string",format:"time",check:"string_format",precision:null,...aB(b)})),a.duration=b=>a.check(new ce({type:"string",format:"duration",check:"string_format",...aB(b)}))});function cx(a){return new cw({type:"string",...aB(a)})}let cy=K("ZodStringFormat",(a,b)=>{a5.init(a,b),cv.init(a,b)}),cz=K("ZodEmail",(a,b)=>{a8.init(a,b),cy.init(a,b)}),cA=K("ZodGUID",(a,b)=>{a6.init(a,b),cy.init(a,b)}),cB=K("ZodUUID",(a,b)=>{a7.init(a,b),cy.init(a,b)}),cC=K("ZodURL",(a,b)=>{a9.init(a,b),cy.init(a,b)}),cD=K("ZodEmoji",(a,b)=>{ba.init(a,b),cy.init(a,b)}),cE=K("ZodNanoID",(a,b)=>{bb.init(a,b),cy.init(a,b)}),cF=K("ZodCUID",(a,b)=>{bc.init(a,b),cy.init(a,b)}),cG=K("ZodCUID2",(a,b)=>{bd.init(a,b),cy.init(a,b)}),cH=K("ZodULID",(a,b)=>{be.init(a,b),cy.init(a,b)}),cI=K("ZodXID",(a,b)=>{bf.init(a,b),cy.init(a,b)}),cJ=K("ZodKSUID",(a,b)=>{bg.init(a,b),cy.init(a,b)}),cK=K("ZodIPv4",(a,b)=>{bl.init(a,b),cy.init(a,b)}),cL=K("ZodIPv6",(a,b)=>{bm.init(a,b),cy.init(a,b)}),cM=K("ZodCIDRv4",(a,b)=>{bn.init(a,b),cy.init(a,b)}),cN=K("ZodCIDRv6",(a,b)=>{bo.init(a,b),cy.init(a,b)}),cO=K("ZodBase64",(a,b)=>{bq.init(a,b),cy.init(a,b)}),cP=K("ZodBase64URL",(a,b)=>{br.init(a,b),cy.init(a,b)}),cQ=K("ZodE164",(a,b)=>{bs.init(a,b),cy.init(a,b)}),cR=K("ZodJWT",(a,b)=>{bt.init(a,b),cy.init(a,b)}),cS=K("ZodUnknown",(a,b)=>{bu.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>{}});function cT(){return new cS({type:"unknown"})}let cU=K("ZodNever",(a,b)=>{bv.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>{b.not={}}}),cV=K("ZodArray",(a,b)=>{bx.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,{minimum:f,maximum:g}=a._zod.bag;"number"==typeof f&&(c.minItems=f),"number"==typeof g&&(c.maxItems=g),c.type="array",c.items=b5(e.element,b,{...d,path:[...d.path,"items"]})})(a,b,c,d),a.element=b.element,ct(a,"ZodArray",{min(a,b){return this.check(b1(a,b))},nonempty(a){return this.check(b1(1,a))},max(a,b){return this.check(b0(a,b))},length(a,b){return this.check(b2(a,b))},unwrap(){return this.element}})}),cW=K("ZodObject",(a,b)=>{bC.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;c.type="object",c.properties={};let f=e.shape;for(let a in f)c.properties[a]=b5(f[a],b,{...d,path:[...d.path,"properties",a]});let g=new Set([...new Set(Object.keys(f))].filter(a=>{let c=e.shape[a]._zod;return"input"===b.io?void 0===c.optin:void 0===c.optout}));g.size>0&&(c.required=Array.from(g)),e.catchall?._zod.def.type==="never"?c.additionalProperties=!1:e.catchall?e.catchall&&(c.additionalProperties=b5(e.catchall,b,{...d,path:[...d.path,"additionalProperties"]})):"output"===b.io&&(c.additionalProperties=!1)})(a,b,c,d),ap(a,"shape",()=>b.shape),ct(a,"ZodObject",{keyof(){var a;return new cZ({type:"enum",entries:Array.isArray(a=Object.keys(this._zod.def.shape))?Object.fromEntries(a.map(a=>[a,a])):a,...aB(void 0)})},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:cT()})},loose(){return this.clone({...this._zod.def,catchall:cT()})},strict(){return this.clone({...this._zod.def,catchall:new cU({type:"never",...aB(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return function(a,b){if(!aw(b))throw Error("Invalid input to extend: expected a plain object");let c=a._zod.def.checks;if(c&&c.length>0){let c=a._zod.def.shape;for(let a in b)if(void 0!==Object.getOwnPropertyDescriptor(c,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let d=ar(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return aq(this,"shape",c),c}});return aA(a,d)}(this,a)},safeExtend(a){var b=this;if(!aw(a))throw Error("Invalid input to safeExtend: expected a plain object");let c=ar(b._zod.def,{get shape(){let c={...b._zod.def.shape,...a};return aq(this,"shape",c),c}});return aA(b,c)},merge(a){var b=this;if(b._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let c=ar(b._zod.def,{get shape(){let c={...b._zod.def.shape,...a._zod.def.shape};return aq(this,"shape",c),c},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return aA(b,c)},pick(a){return function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=ar(a._zod.def,{get shape(){let a={};for(let d in b){if(!(d in c.shape))throw Error(`Unrecognized key: "${d}"`);b[d]&&(a[d]=c.shape[d])}return aq(this,"shape",a),a},checks:[]});return aA(a,e)}(this,a)},omit(a){return function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=ar(a._zod.def,{get shape(){let d={...a._zod.def.shape};for(let a in b){if(!(a in c.shape))throw Error(`Unrecognized key: "${a}"`);b[a]&&delete d[a]}return aq(this,"shape",d),d},checks:[]});return aA(a,e)}(this,a)},partial(...a){return function(a,b,c){let d=b._zod.def.checks;if(d&&d.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=ar(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in d))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=a?new a({type:"optional",innerType:d[b]}):d[b])}else for(let b in d)e[b]=a?new a({type:"optional",innerType:d[b]}):d[b];return aq(this,"shape",e),e},checks:[]});return aA(b,e)}(c_,this,a[0])},required(...a){return function(a,b,c){let d=ar(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in e))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=new a({type:"nonoptional",innerType:d[b]}))}else for(let b in d)e[b]=new a({type:"nonoptional",innerType:d[b]});return aq(this,"shape",e),e}});return aA(b,d)}(c6,this,a[0])}})}),cX=K("ZodUnion",(a,b)=>{bE.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=!1===e.inclusive,g=e.options.map((a,c)=>b5(a,b,{...d,path:[...d.path,f?"oneOf":"anyOf",c]}));f?c.oneOf=g:c.anyOf=g})(a,b,c,d),a.options=b.options}),cY=K("ZodIntersection",(a,b)=>{bF.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=b5(e.left,b,{...d,path:[...d.path,"allOf",0]}),g=b5(e.right,b,{...d,path:[...d.path,"allOf",1]}),h=a=>"allOf"in a&&1===Object.keys(a).length;c.allOf=[...h(f)?f.allOf:[f],...h(g)?g.allOf:[g]]})(a,b,c,d)}),cZ=K("ZodEnum",(a,b)=>{bH.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=ak(a._zod.def.entries);e.every(a=>"number"==typeof a)&&(c.type="number"),e.every(a=>"string"==typeof a)&&(c.type="string"),c.enum=e})(a,0,c,0),a.enum=b.entries,a.options=Object.values(b.entries);let c=new Set(Object.keys(b.entries));a.extract=(a,d)=>{let e={};for(let d of a)if(c.has(d))e[d]=b.entries[d];else throw Error(`Key ${d} not found in enum`);return new cZ({...b,checks:[],...aB(d),entries:e})},a.exclude=(a,d)=>{let e={...b.entries};for(let b of a)if(c.has(b))delete e[b];else throw Error(`Key ${b} not found in enum`);return new cZ({...b,checks:[],...aB(d),entries:e})}}),c$=K("ZodTransform",(a,b)=>{bI.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>((a,b,c,d)=>{if("throw"===b.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,a,0,0),a._zod.parse=(c,d)=>{if("backward"===d.direction)throw new M(a.constructor.name);c.addIssue=d=>{"string"==typeof d?c.issues.push(aH(d,c.value,b)):(d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=c.value),d.inst??(d.inst=a),c.issues.push(aH(d)))};let e=b.transform(c.value,c);return e instanceof Promise?e.then(a=>(c.value=a,c.fallback=!0,c)):(c.value=e,c.fallback=!0,c)}}),c_=K("ZodOptional",(a,b)=>{bK.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>ca(a,b,c,d),a.unwrap=()=>a._zod.def.innerType});function c0(a){return new c_({type:"optional",innerType:a})}let c1=K("ZodExactOptional",(a,b)=>{bL.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>ca(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),c2=K("ZodNullable",(a,b)=>{bM.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=b5(e.innerType,b,d),g=b.seen.get(a);"openapi-3.0"===b.target?(g.ref=e.innerType,c.nullable=!0):c.anyOf=[f,{type:"null"}]})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType});function c3(a){return new c2({type:"nullable",innerType:a})}let c4=K("ZodDefault",(a,b)=>{bN.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,c.default=JSON.parse(JSON.stringify(e.defaultValue))})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType,a.removeDefault=a.unwrap}),c5=K("ZodPrefault",(a,b)=>{bP.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,"input"===b.io&&(c._prefault=JSON.parse(JSON.stringify(e.defaultValue)))})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),c6=K("ZodNonOptional",(a,b)=>{bQ.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType})(a,b,0,d),a.unwrap=()=>a._zod.def.innerType}),c7=K("ZodCatch",(a,b)=>{bS.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e,f=a._zod.def;b5(f.innerType,b,d),b.seen.get(a).ref=f.innerType;try{e=f.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}c.default=e})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType,a.removeCatch=a.unwrap}),c8=K("ZodPipe",(a,b)=>{bT.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=e.in._zod.traits.has("$ZodTransform"),g="input"===b.io?f?e.out:e.in:e.out;b5(g,b,d),b.seen.get(a).ref=g})(a,b,0,d),a.in=b.in,a.out=b.out});function c9(a,b){return new c8({type:"pipe",in:a,out:b})}let da=K("ZodReadonly",(a,b)=>{bV.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,c.readOnly=!0})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),db=K("ZodCustom",(a,b)=>{bX.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>((a,b,c,d)=>{if("throw"===b.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,a,0,0)});async function dc(a,b,c,d="google",e="",f="en",g,h){let i=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a,prompt:b,apiKey:c,provider:d,model:e,language:f,baseURL:g,images:h})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Request failed"}))).error||`HTTP ${i.status}`);return(await i.json()).testCases}new cW({type:"object",shape:{title:cx().describe("Short descriptive title of the test case"),steps:cx().describe("Numbered test steps separated by newlines"),expected:cx().describe("Expected result of the test")}??{},...aB(void 0)});var dd=c(19553);let de=["User can log in with valid credentials","Invalid input shows validation error","Form submits successfully and redirects","Edge case: empty required fields"],df=["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 dg({open:a,onClose:b,node:c,onGenerate:d}){let{isConnected:e,activeProvider:f,activeProviderId:h}=(0,dd.P)(),[i,k]=(0,j.useState)(""),[l,m]=(0,j.useState)(""),[n,o]=(0,j.useState)("en"),[p,q]=(0,j.useState)(!1),[r,s]=(0,j.useState)(!1),[t,u]=(0,j.useState)(null),[v,w]=(0,j.useState)([]),[x,y]=(0,j.useState)(""),[z,A]=(0,j.useState)(df[0]),[B,C]=(0,j.useState)(0),D=(0,j.useRef)(null),E=(0,j.useRef)(null),[F,G]=(0,j.useState)(!1),H=(0,j.useCallback)(async()=>{try{let a=await fetch("https://api.thecatapi.com/v1/images/search?size=med"),b=await a.json();b?.[0]?.url&&y(b[0].url)}catch{y("")}A(df[Math.floor(Math.random()*df.length)])},[]),I=a=>new Promise((b,c)=>{if(!a.type.startsWith("image/"))return void c(Error("Not an image file"));if(a.size>5242880)return void c(Error("Image too large (max 5MB)"));let d=new FileReader;d.onload=()=>b(d.result),d.onerror=()=>c(Error("Failed to read file")),d.readAsDataURL(a)}),J=(0,j.useCallback)(async a=>{let b=5-v.length;if(b<=0)return void u("Maximum 5 images allowed");let c=Array.from(a).slice(0,b),d=[];for(let a of c)try{let b=await I(a);d.push(b)}catch(a){u(a instanceof Error?a.message:"Failed to load image")}d.length>0&&(w(a=>[...a,...d]),u(null))},[v.length]),K=(0,j.useCallback)(a=>{w(b=>b.filter((b,c)=>c!==a))},[]),L=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),G(!0)},[]),M=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),G(!1)},[]),N=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),G(!1),a.dataTransfer.files.length>0&&J(a.dataTransfer.files)},[J]),O=(0,j.useCallback)(a=>{a.target.files&&a.target.files.length>0&&(J(a.target.files),a.target.value="")},[J]),P=async()=>{if(!e)return void u("Please configure an AI provider in Integrations first.");if(!l.trim()&&0===v.length)return void u("Please describe the feature, paste a ticket, or attach an image.");s(!0),u(null);try{let a=await dc(i,l,f.apiKey,h??void 0,f.defaultModel,n,f.baseURL||void 0,v.length>0?v:void 0);d(a),b()}catch(a){u(a instanceof Error?a.message:"Generation failed")}finally{s(!1)}};return a?(0,g.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,children:(0,g.jsxs)("div",{className:"flex rounded-xl overflow-hidden",style:{maxWidth:r?"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:a=>a.stopPropagation(),children:[(0,g.jsxs)("div",{className:"flex-1 min-w-0",style:{maxWidth:"512px"},children:[(0,g.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,g.jsx)("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)"},children:(0,g.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,g.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,g.jsx)("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Generate Test Cases"})]}),(0,g.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Describe the feature and let AI generate test cases for “",c.label,"”"]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Test Case Title"}),(0,g.jsx)("input",{value:i,onChange:a=>k(a.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,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Description / DoD / Ticket"}),(0,g.jsx)("textarea",{value:l,onChange:a=>m(a.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"===n?"Jelaskan fitur, kriteria penerimaan, atau tempel tiket...":"Describe the feature, acceptance criteria, or paste a ticket..."}),(0,g.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:de.map(a=>(0,g.jsxs)("button",{onClick:()=>m(b=>b?`${b}
64
- ${a}`:a),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:["+ ",a]},a))})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:["Screenshots ",(0,g.jsx)("span",{className:"font-normal",style:{color:"var(--text-tertiary)"},children:"(optional)"})]}),v.length>0&&(0,g.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:v.map((a,b)=>(0,g.jsxs)("div",{className:"relative group rounded-lg overflow-hidden border",style:{borderColor:"var(--border)",width:72,height:72},children:[(0,g.jsx)("img",{src:a,alt:`Screenshot ${b+1}`,className:"w-full h-full object-cover"}),(0,g.jsx)("button",{onClick:()=>K(b),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,g.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,g.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},b))}),(0,g.jsx)("div",{ref:E,onDragOver:L,onDragLeave:M,onDrop:N,onClick:()=>D.current?.click(),className:"rounded-lg border-2 border-dashed cursor-pointer transition-colors",style:{borderColor:F?"var(--accent)":"var(--border)",backgroundColor:F?"var(--accent)08":"transparent",padding:v.length>0?"8px":"16px"},children:(0,g.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,g.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,g.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,g.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,g.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,g.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:v.length>0?`Add more (${v.length}/5) \xb7 paste, drop, or click`:"Paste from clipboard, drop, or click to upload"})]})}),(0,g.jsx)("input",{ref:D,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:O})]}),t&&(0,g.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:t}),!e&&(0,g.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,g.jsxs)("div",{className:"rounded-lg border overflow-hidden",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("button",{onClick:()=>q(a=>!a),className:"w-full flex items-center justify-between px-3 py-2 transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Language"}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.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"===n?"EN":"ID"}),(0,g.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:p?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms ease-out"},children:(0,g.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),(0,g.jsx)("div",{style:{maxHeight:p?"80px":"0px",overflow:"hidden",transition:"max-height 200ms ease-out"},children:(0,g.jsx)("div",{className:"px-3 pb-2 pt-1",children:(0,g.jsxs)("select",{value:n,onChange:a=>{o(a.target.value),q(!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,g.jsx)("option",{value:"en",children:"English"}),(0,g.jsx)("option",{value:"id",children:"Bahasa Indonesia"})]})})})]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:b,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,g.jsx)("button",{onClick:P,disabled:r||!e,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:r?(0,g.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,g.jsx)("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,g.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),"Generating..."]}):"Generate Test Cases"})]})]}),(0,g.jsx)("div",{className:"flex-shrink-0 overflow-hidden",style:{width:r?"280px":"0px",transition:"width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,g.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:+!!r,transition:"opacity 300ms ease-out 100ms"},children:[(0,g.jsx)("div",{className:"w-full rounded-xl overflow-hidden mb-4 border",style:{borderColor:"var(--border)",height:180,backgroundColor:"var(--bg-card)"},children:x&&(0,g.jsx)("img",{src:x,alt:"Cute cat",width:280,height:180,className:"w-full h-full object-cover",style:{animation:"fadeIn 800ms ease-out"},onError:a=>{a.target.style.display="none"}},B)}),(0,g.jsx)("p",{className:"text-xs text-center mb-3",style:{color:"var(--text-secondary)",animation:"fadeIn 800ms ease-out"},children:z}),(0,g.jsx)("button",{onClick:H,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"})]})})]})}):null}let dh={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)"}};function di({open:a,onClose:b,node:c,testCases:d,stats:e}){return a?(0,g.jsxs)("div",{style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:b,className:"jsx-540c0278eef48442 fixed inset-0 z-[300] flex items-center justify-center",children:[(0,g.jsxs)("div",{style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)",animation:"fadeInUp 200ms ease-out"},onClick:a=>a.stopPropagation(),className:"jsx-540c0278eef48442 w-full max-w-lg mx-4 rounded-xl overflow-hidden",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 px-5 pt-5 pb-4 border-b",children:[(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center justify-between mb-2",children:[(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center gap-2",children:[c.code&&(0,g.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:c.code}),(0,g.jsx)("h3",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-sm font-semibold",children:c.label})]}),(0,g.jsx)("button",{onClick:b,style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),c.notes&&(0,g.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:c.notes})]}),(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 grid grid-cols-4 gap-3 p-5",children:[(0,g.jsx)(dj,{label:"Total",value:e.total}),(0,g.jsx)(dj,{label:"Pass",value:e.pass,color:"var(--status-pass-text)"}),(0,g.jsx)(dj,{label:"Fail",value:e.fail,color:"var(--status-fail-text)"}),(0,g.jsx)(dj,{label:"Untested",value:e.untested,color:"var(--status-untested-text)"})]}),(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,g.jsxs)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 flex items-center justify-between text-[10px] mb-1.5",children:[(0,g.jsx)("span",{className:"jsx-540c0278eef48442",children:"Pass Rate"}),(0,g.jsxs)("span",{style:{color:e.passRate>=80?"var(--status-pass-text)":e.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)",fontWeight:600},className:"jsx-540c0278eef48442",children:[e.passRate,"%"]})]}),(0,g.jsx)("div",{style:{backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 h-2 w-full rounded-full overflow-hidden",children:(0,g.jsx)("div",{style:{width:`${e.passRate}%`,backgroundColor:e.passRate>=80?"var(--status-pass-text)":e.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"},className:"jsx-540c0278eef48442 h-full rounded-full transition-all duration-500"})})]}),d.length>0&&(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,g.jsx)("h4",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-semibold uppercase tracking-wider mb-2",children:"Test Cases"}),(0,g.jsx)("div",{className:"jsx-540c0278eef48442 space-y-1.5 max-h-48 overflow-y-auto",children:d.map(a=>{let b=dh[a.status]||dh.untested;return(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 flex items-center gap-2 px-3 py-2 rounded-lg border",children:[(0,g.jsx)("span",{style:{backgroundColor:b.bg,color:b.text},className:"jsx-540c0278eef48442 text-[9px] font-mono px-1.5 py-0.5 rounded-full flex-shrink-0",children:a.status}),(0,g.jsx)("span",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-[11px] flex-1 truncate",children:a.title}),a.code&&(0,g.jsx)("span",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[9px] font-mono flex-shrink-0",children:a.code})]},a.id)})})]}),0===d.length&&(0,g.jsx)("div",{className:"jsx-540c0278eef48442 px-5 pb-5 text-center",children:(0,g.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:"No test cases for this node yet."})}),(0,g.jsx)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 px-5 py-3 border-t",children:(0,g.jsx)("button",{onClick:b,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,g.jsx)(i(),{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 dj({label:a,value:b,color:c}){return(0,g.jsxs)("div",{className:"text-center p-2 rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("div",{className:"text-[10px] mb-0.5",style:{color:"var(--text-tertiary)"},children:a}),(0,g.jsx)("div",{className:"text-lg font-semibold",style:{color:c??"var(--text-primary)"},children:b})]})}function dk(a){let b=[],c="",d=!1;for(let e=0;e<a.length;e++){let f=a[e];d?'"'===f?e+1<a.length&&'"'===a[e+1]?(c+='"',e++):d=!1:c+=f:'"'===f?d=!0:","===f?(b.push(c),c=""):c+=f}return b.push(c),b}function dl({open:a,onClose:b,onImport:c,nodeLabel:d}){let[e,f]=(0,j.useState)("csv"),[h,i]=(0,j.useState)(null),[k,l]=(0,j.useState)(null),[m,n]=(0,j.useState)(!1),o=(0,j.useRef)(null),p=()=>{i(null),l(null),n(!1)},q=(0,j.useCallback)(a=>{i(null),l(null);let b=new FileReader;b.onload=()=>{try{let c=b.result,d=a.name.endsWith(".json")||"application/json"===a.type?function(a){let b=JSON.parse(a),c=Array.isArray(b)?b:b.testCases||b.test_cases||b.cases;if(!Array.isArray(c))throw Error('JSON must be an array of test cases, or an object with a "testCases" array');let d=[];for(let a of c){if("string"==typeof a){a.trim()&&d.push({title:a.trim(),steps:"",expected:""});continue}if("object"!=typeof a||!a)continue;let b=a.title||a.name||a.testCase||a["test case"]||"";b&&"string"==typeof b&&d.push({title:b.trim(),steps:String(a.steps||a.instructions||"").trim(),expected:String(a.expected||a["expected result"]||a.result||"").trim()})}if(0===d.length)throw Error("No valid test cases found in JSON");return d}(c):function(a){let b=a.split("\n").map(a=>a.trim()).filter(a=>a.length>0);if(b.length<2)throw Error("CSV must have a header row and at least one data row");let c=dk(b[0]).map(a=>a.toLowerCase().trim()),d=c.findIndex(a=>"title"===a||"test case"===a||"testcase"===a||"name"===a||"test case title"===a),e=c.findIndex(a=>"steps"===a||"test steps"===a||"step"===a||"instructions"===a),f=c.findIndex(a=>"expected"===a||"expected result"===a||"expected results"===a||"result"===a);if(-1===d)throw Error('Could not find a "title" or "test case" column in the CSV header');let g=[];for(let a=1;a<b.length;a++){let c=dk(b[a]),h=(c[d]||"").trim();h&&g.push({title:h,steps:e>=0?(c[e]||"").trim():"",expected:f>=0?(c[f]||"").trim():""})}if(0===g.length)throw Error("No valid test cases found in CSV");return g}(c);l(d)}catch(a){i(a instanceof Error?a.message:"Failed to parse file")}},b.onerror=()=>i("Failed to read file"),b.readAsText(a)},[]);return a?(0,g.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:()=>{p(),b()},children:(0,g.jsxs)("div",{className:"w-full max-w-lg mx-4 rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:a=>a.stopPropagation(),children:[(0,g.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Import Test Cases"}),(0,g.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Import test cases into “",d,"” from CSV or JSON"]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,g.jsxs)("div",{className:"text-[11px] rounded-lg px-3 py-2",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Supported formats:"}),(0,g.jsxs)("ul",{className:"space-y-0.5 ml-3",children:[(0,g.jsxs)("li",{children:[(0,g.jsx)("strong",{children:"CSV:"})," Header row with columns: title, steps, expected (or similar names)"]}),(0,g.jsxs)("li",{children:[(0,g.jsx)("strong",{children:"JSON:"}),' Array of objects with "title", "steps", "expected" fields']})]})]}),(0,g.jsx)("div",{onDragOver:a=>{a.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:a=>{a.preventDefault(),n(!1);let b=a.dataTransfer.files[0];b&&q(b)},onClick:()=>o.current?.click(),className:"border-2 border-dashed rounded-lg cursor-pointer transition-colors py-8",style:{borderColor:m?"var(--accent)":"var(--border)",backgroundColor:m?"var(--accent)08":"transparent"},children:(0,g.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),(0,g.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,g.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Drop a .csv or .json file here, or click to browse"})]})}),(0,g.jsx)("input",{ref:o,type:"file",accept:".csv,.json",className:"hidden",onChange:a=>{let b=a.target.files?.[0];b&&q(b),a.target.value=""}}),h&&(0,g.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:h}),k&&k.length>0&&(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,g.jsxs)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:["Preview (",k.length," test case",1!==k.length?"s":"",")"]}),(0,g.jsx)("button",{onClick:()=>l(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,g.jsxs)("div",{className:"max-h-[200px] overflow-auto rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("table",{className:"text-[11px] w-full",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{style:{backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"#"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Title"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Steps"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Expected"})]})}),(0,g.jsx)("tbody",{children:k.slice(0,20).map((a,b)=>(0,g.jsxs)("tr",{className:"border-t",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-tertiary)"},children:b+1}),(0,g.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-primary)"},children:a.title}),(0,g.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:a.steps||"—"}),(0,g.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:a.expected||"—"})]},b))})]}),k.length>20&&(0,g.jsxs)("div",{className:"px-2 py-1 text-[10px] border-t",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["...and ",k.length-20," more"]})]})]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:()=>{p(),b()},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,g.jsxs)("button",{onClick:()=>{k&&0!==k.length&&(c(k),p(),b())},disabled:!k||0===k.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 ",k?`(${k.length})`:""]})]})]})}):null}function dm({testCases:a,projectId:b,onClose:c}){let{e2e:d,testCases:e}=(0,m.M)(),[f,h]=(0,j.useState)(d.config.baseUrl),[i,k]=(0,j.useState)(d.config.browser),[l,n]=(0,j.useState)(d.config.headless),[o,p]=(0,j.useState)(d.config.timeout),[q,r]=(0,j.useState)("runner"),[s,t]=(0,j.useState)(!1),[u,v]=(0,j.useState)(!1),[w,x]=(0,j.useState)([]),[y,z]=(0,j.useState)(null),[A,B]=(0,j.useState)([]),[C,D]=(0,j.useState)([]),[E,F]=(0,j.useState)(null),[G,H]=(0,j.useState)(!0),[I,J]=(0,j.useState)(22),[K,L]=(0,j.useState)(!0),M=(0,j.useRef)(!1),N=(0,j.useRef)(null),[O,P]=(0,j.useState)(""),[Q,R]=(0,j.useState)(!1),[S,T]=(0,j.useState)({}),[U,V]=(0,j.useState)(null),[W,X]=(0,j.useState)(""),[Y,Z]=(0,j.useState)(null),[$,_]=(0,j.useState)(null),aa=(0,j.useRef)(null),ab=(0,j.useRef)(null),[ac,ad]=(0,j.useState)(new Set(a.map(a=>a.id))),ae=(0,j.useCallback)(a=>{a.preventDefault(),M.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";let b=a=>{if(!M.current||!N.current)return;let b=N.current.getBoundingClientRect(),c=a.clientX;J(Math.min(Math.max((b.right-c)/b.width*100,15),50))},c=()=>{M.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",c)},[]),af=(0,j.useCallback)((a,b)=>{B(c=>[...c,{time:new Date,type:a,message:b}]),window.setTimeout(()=>{ab.current?.scrollIntoView({behavior:"smooth"})},50)},[]),ag=(0,j.useCallback)(a=>{ad(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ah=(0,j.useCallback)(()=>{ac.size===a.length?ad(new Set):ad(new Set(a.map(a=>a.id)))},[a,ac]),ai=(0,j.useCallback)(()=>{let a=localStorage.getItem("qa-llm-config");if(!a)return null;let b=JSON.parse(a),c=b.activeProvider;if(!c||!b.providers?.[c])return null;let d=b.providers[c];return d.apiKey&&d.connected?{provider:c,model:d.defaultModel,apiKey:d.apiKey,baseURL:d.baseURL}:null},[]),aj=(0,j.useCallback)(async()=>{let b=ai();if(!b)return void af("error","Please configure LLM in Integrations page first");v(!0),af("info","Generating test scripts...");try{let c=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:a.filter(a=>ac.has(a.id)),baseUrl:f,llmConfig:b,generateOnly:!0})});if(!c.ok)return void af("error","Failed to generate scripts");let e=await c.json();for(let[b,c]of(T(a=>({...a,...e.scripts})),Object.entries(e.scripts))){let e=a.find(a=>a.id===b);e&&d.saveScript(b,e.title,e.code,c)}af("success",`Generated ${Object.keys(e.scripts).length} test script(s)`),r("scripts")}catch(a){af("error",`Error: ${a instanceof Error?a.message:String(a)}`)}finally{v(!1)}},[a,ac,f,ai,af,d]),ak=(0,j.useCallback)(async()=>{let c=a.filter(a=>ac.has(a.id));if(0===c.length)return;let e=ai();if(!e)return void af("error","Please configure LLM in Integrations page first");t(!0),x([]),B([]),D([]),F(null),P(""),R(!1);let g=new AbortController;aa.current=g,af("info",`Starting E2E test run with ${c.length} test(s)...`),af("info",`Target: ${f}`),af("info",`Browser: ${i} | Headless: ${l}`);try{let a=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:c,baseUrl:f,browser:i,headless:l,timeout:o,llmConfig:e}),signal:g.signal});if(!a.ok){let b=await a.json();af("error",b.error||"Failed to run tests"),t(!1);return}let h=a.body?.getReader(),j=new TextDecoder,k="",m=[];if(h)for(;;){let{done:a,value:c}=await h.read();if(a)break;let e=(k+=j.decode(c,{stream:!0})).split("\n");for(let a of(k=e.pop()||"",e))if(a.startsWith("data: "))try{let c=JSON.parse(a.slice(6));switch(c.type){case"status":af("info",c.message);break;case"testStart":z({index:c.index,title:c.title}),af("info",`
63
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of a.seen.entries()){let d=c[1];if(b===c[0]){e(c);continue}if(a.external){let d=a.external.registry.get(c[0])?.id;if(b!==c[0]&&d){e(c);continue}}if(a.metadataRegistry.get(c[0])?.id||d.cycle||d.count>1&&"ref"===a.reused){e(c);continue}}}function b7(a,b){let c=a.seen.get(b);if(!c)throw Error("Unprocessed schema. This is a bug in Zod.");let d=b=>{let c=a.seen.get(b);if(null===c.ref)return;let e=c.def??c.schema,f={...e},g=c.ref;if(c.ref=null,g){d(g);let c=a.seen.get(g),h=c.schema;if(h.$ref&&("draft-07"===a.target||"draft-04"===a.target||"openapi-3.0"===a.target)?(e.allOf=e.allOf??[],e.allOf.push(h)):Object.assign(e,h),Object.assign(e,f),b._zod.parent===g)for(let a in e)"$ref"!==a&&"allOf"!==a&&(a in f||delete e[a]);if(h.$ref&&c.def)for(let a in e)"$ref"!==a&&"allOf"!==a&&a in c.def&&JSON.stringify(e[a])===JSON.stringify(c.def[a])&&delete e[a]}let h=b._zod.parent;if(h&&h!==g){d(h);let b=a.seen.get(h);if(b?.schema.$ref&&(e.$ref=b.schema.$ref,b.def))for(let a in e)"$ref"!==a&&"allOf"!==a&&a in b.def&&JSON.stringify(e[a])===JSON.stringify(b.def[a])&&delete e[a]}a.override({zodSchema:b,jsonSchema:e,path:c.path??[]})};for(let b of[...a.seen.entries()].reverse())d(b[0]);let e={};if("draft-2020-12"===a.target?e.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===a.target?e.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===a.target?e.$schema="http://json-schema.org/draft-04/schema#":a.target,a.external?.uri){let c=a.external.registry.get(b)?.id;if(!c)throw Error("Schema is missing an `id` property");e.$id=a.external.uri(c)}Object.assign(e,c.def??c.schema);let f=a.metadataRegistry.get(b)?.id;void 0!==f&&e.id===f&&delete e.id;let g=a.external?.defs??{};for(let b of a.seen.entries()){let a=b[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,g[a.defId]=a.def)}a.external||Object.keys(g).length>0&&("draft-2020-12"===a.target?e.$defs=g:e.definitions=g);try{let c=JSON.parse(JSON.stringify(e));return Object.defineProperty(c,"~standard",{value:{...b["~standard"],jsonSchema:{input:b8(b,"input",a.processors),output:b8(b,"output",a.processors)}},enumerable:!1,writable:!1}),c}catch(a){throw Error("Error converting schema to JSON.")}}let b8=(a,b,c={})=>d=>{let{libraryOptions:e,target:f}=d??{},g=b4({...e??{},target:f,io:b,processors:c});return b5(a,g),b6(g,a),b7(g,a)},b9={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ca=(a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType},cb=K("ZodISODateTime",(a,b)=>{bh.init(a,b),cy.init(a,b)}),cc=K("ZodISODate",(a,b)=>{bi.init(a,b),cy.init(a,b)}),cd=K("ZodISOTime",(a,b)=>{bj.init(a,b),cy.init(a,b)}),ce=K("ZodISODuration",(a,b)=>{bk.init(a,b),cy.init(a,b)}),cf=K("ZodError",(a,b)=>{aW.init(a,b),a.name="ZodError",Object.defineProperties(a,{format:{value:b=>(function(a,b=a=>a.message){let c={_errors:[]},d=(a,e=[])=>{for(let f of a.issues)if("invalid_union"===f.code&&f.errors.length)f.errors.map(a=>d({issues:a},[...e,...f.path]));else if("invalid_key"===f.code)d({issues:f.issues},[...e,...f.path]);else if("invalid_element"===f.code)d({issues:f.issues},[...e,...f.path]);else{let a=[...e,...f.path];if(0===a.length)c._errors.push(b(f));else{let d=c,e=0;for(;e<a.length;){let c=a[e];e===a.length-1?(d[c]=d[c]||{_errors:[]},d[c]._errors.push(b(f))):d[c]=d[c]||{_errors:[]},d=d[c],e++}}}};return d(a),c})(a,b)},flatten:{value:b=>(function(a,b=a=>a.message){let c={},d=[];for(let e of a.issues)e.path.length>0?(c[e.path[0]]=c[e.path[0]]||[],c[e.path[0]].push(b(e))):d.push(b(e));return{formErrors:d,fieldErrors:c}})(a,b)},addIssue:{value:b=>{a.issues.push(b),a.message=JSON.stringify(a.issues,al,2)}},addIssues:{value:b=>{a.issues.push(...b),a.message=JSON.stringify(a.issues,al,2)}},isEmpty:{get:()=>0===a.issues.length}})},{Parent:Error}),cg=aY(cf),ch=aZ(cf),ci=a$(cf),cj=a0(cf),ck=(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return aY(cf)(a,b,d)},cl=(a,b,c)=>aY(cf)(a,b,c),cm=async(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return aZ(cf)(a,b,d)},cn=async(a,b,c)=>aZ(cf)(a,b,c),co=(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return a$(cf)(a,b,d)},cp=(a,b,c)=>a$(cf)(a,b,c),cq=async(a,b,c)=>{let d=c?{...c,direction:"backward"}:{direction:"backward"};return a0(cf)(a,b,d)},cr=async(a,b,c)=>a0(cf)(a,b,c),cs=new WeakMap;function ct(a,b,c){let d=Object.getPrototypeOf(a),e=cs.get(d);if(e||(e=new Set,cs.set(d,e)),!e.has(b))for(let a in e.add(b),c){let b=c[a];Object.defineProperty(d,a,{configurable:!0,enumerable:!1,get(){let c=b.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(b){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:b})}})}}let cu=K("ZodType",(a,b)=>(a3.init(a,b),Object.assign(a["~standard"],{jsonSchema:{input:b8(a,"input"),output:b8(a,"output")}}),a.toJSONSchema=((a,b={})=>c=>{let d=b4({...c,processors:b});return b5(a,d),b6(d,a),b7(d,a)})(a,{}),a.def=b,a.type=b.type,Object.defineProperty(a,"_def",{value:b}),a.parse=(b,c)=>cg(a,b,c,{callee:a.parse}),a.safeParse=(b,c)=>ci(a,b,c),a.parseAsync=async(b,c)=>ch(a,b,c,{callee:a.parseAsync}),a.safeParseAsync=async(b,c)=>cj(a,b,c),a.spa=a.safeParseAsync,a.encode=(b,c)=>ck(a,b,c),a.decode=(b,c)=>cl(a,b,c),a.encodeAsync=async(b,c)=>cm(a,b,c),a.decodeAsync=async(b,c)=>cn(a,b,c),a.safeEncode=(b,c)=>co(a,b,c),a.safeDecode=(b,c)=>cp(a,b,c),a.safeEncodeAsync=async(b,c)=>cq(a,b,c),a.safeDecodeAsync=async(b,c)=>cr(a,b,c),ct(a,"ZodType",{check(...a){let b=this.def;return this.clone(ar(b,{checks:[...b.checks??[],...a.map(a=>"function"==typeof a?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,b){return aA(this,a,b)},brand(){return this},register(a,b){return a.add(this,b),this},refine(a,b){return this.check(function(a,b={}){return new db({type:"custom",check:"custom",fn:a,...aB(b)})}(a,b))},superRefine(a,b){return this.check(function(a,b){let c=function(a,b){let c=new aI({check:"custom",...aB(b)});return c._zod.check=a,c}(b=>(b.addIssue=a=>{"string"==typeof a?b.issues.push(aH(a,b.value,c._zod.def)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=b.value),a.inst??(a.inst=c),a.continue??(a.continue=!c._zod.def.abort),b.issues.push(aH(a)))},a(b.value,b)),b);return c}(a,b))},overwrite(a){return this.check(b3(a))},optional(){return c0(this)},exactOptional(){var a;return a=this,new c1({type:"optional",innerType:a})},nullable(){return c3(this)},nullish(){return c0(c3(this))},nonoptional(a){var b;return b=this,new c6({type:"nonoptional",innerType:b,...aB(a)})},array(){return function(a,b){return new cV({type:"array",element:a,...aB(void 0)})}(this)},or(a){return new cX({type:"union",options:[this,a],...aB(void 0)})},and(a){var b;return b=this,new cY({type:"intersection",left:b,right:a})},transform(a){return c9(this,new c$({type:"transform",transform:a}))},default(a){var b,c;return b=this,c=a,new c4({type:"default",innerType:b,get defaultValue(){return"function"==typeof c?c():ax(c)}})},prefault(a){var b,c;return b=this,c=a,new c5({type:"prefault",innerType:b,get defaultValue(){return"function"==typeof c?c():ax(c)}})},catch(a){var b,c;return b=this,new c7({type:"catch",innerType:b,catchValue:"function"==typeof(c=a)?c:()=>c})},pipe(a){return c9(this,a)},readonly(){var a;return a=this,new da({type:"readonly",innerType:a})},describe(a){let b=this.clone();return b$.add(b,{description:a}),b},meta(...a){if(0===a.length)return b$.get(this);let b=this.clone();return b$.add(b,a[0]),b},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(a,"description",{get:()=>b$.get(a)?.description,configurable:!0}),a)),cv=K("_ZodString",(a,b)=>{a4.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{c.type="string";let{minimum:e,maximum:f,format:g,patterns:h,contentEncoding:i}=a._zod.bag;if("number"==typeof e&&(c.minLength=e),"number"==typeof f&&(c.maxLength=f),g&&(c.format=b9[g]??g,""===c.format&&delete c.format,"time"===g&&delete c.format),i&&(c.contentEncoding=i),h&&h.size>0){let a=[...h];1===a.length?c.pattern=a[0].source:a.length>1&&(c.allOf=[...a.map(a=>({..."draft-07"===b.target||"draft-04"===b.target||"openapi-3.0"===b.target?{type:"string"}:{},pattern:a.source}))])}})(a,b,c,0);let c=a._zod.bag;a.format=c.format??null,a.minLength=c.minimum??null,a.maxLength=c.maximum??null,ct(a,"_ZodString",{regex(...a){return this.check(function(a,b){return new aN({check:"string_format",format:"regex",...aB(b),pattern:a})}(...a))},includes(...a){return this.check(function(a,b){return new aQ({check:"string_format",format:"includes",...aB(b),includes:a})}(...a))},startsWith(...a){return this.check(function(a,b){return new aR({check:"string_format",format:"starts_with",...aB(b),prefix:a})}(...a))},endsWith(...a){return this.check(function(a,b){return new aS({check:"string_format",format:"ends_with",...aB(b),suffix:a})}(...a))},min(...a){return this.check(b1(...a))},max(...a){return this.check(b0(...a))},length(...a){return this.check(b2(...a))},nonempty(...a){return this.check(b1(1,...a))},lowercase(a){return this.check(new aO({check:"string_format",format:"lowercase",...aB(a)}))},uppercase(a){return this.check(new aP({check:"string_format",format:"uppercase",...aB(a)}))},trim(){return this.check(b3(a=>a.trim()))},normalize(...a){return this.check(function(a){return b3(b=>b.normalize(a))}(...a))},toLowerCase(){return this.check(b3(a=>a.toLowerCase()))},toUpperCase(){return this.check(b3(a=>a.toUpperCase()))},slugify(){return this.check(b3(a=>a.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}})}),cw=K("ZodString",(a,b)=>{a4.init(a,b),cv.init(a,b),a.email=b=>a.check(new cz({type:"string",format:"email",check:"string_format",abort:!1,...aB(b)})),a.url=b=>a.check(new cC({type:"string",format:"url",check:"string_format",abort:!1,...aB(b)})),a.jwt=b=>a.check(new cR({type:"string",format:"jwt",check:"string_format",abort:!1,...aB(b)})),a.emoji=b=>a.check(new cD({type:"string",format:"emoji",check:"string_format",abort:!1,...aB(b)})),a.guid=b=>a.check(b_(cA,b)),a.uuid=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,...aB(b)})),a.uuidv4=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...aB(b)})),a.uuidv6=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...aB(b)})),a.uuidv7=b=>a.check(new cB({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...aB(b)})),a.nanoid=b=>a.check(new cE({type:"string",format:"nanoid",check:"string_format",abort:!1,...aB(b)})),a.guid=b=>a.check(b_(cA,b)),a.cuid=b=>a.check(new cF({type:"string",format:"cuid",check:"string_format",abort:!1,...aB(b)})),a.cuid2=b=>a.check(new cG({type:"string",format:"cuid2",check:"string_format",abort:!1,...aB(b)})),a.ulid=b=>a.check(new cH({type:"string",format:"ulid",check:"string_format",abort:!1,...aB(b)})),a.base64=b=>a.check(new cO({type:"string",format:"base64",check:"string_format",abort:!1,...aB(b)})),a.base64url=b=>a.check(new cP({type:"string",format:"base64url",check:"string_format",abort:!1,...aB(b)})),a.xid=b=>a.check(new cI({type:"string",format:"xid",check:"string_format",abort:!1,...aB(b)})),a.ksuid=b=>a.check(new cJ({type:"string",format:"ksuid",check:"string_format",abort:!1,...aB(b)})),a.ipv4=b=>a.check(new cK({type:"string",format:"ipv4",check:"string_format",abort:!1,...aB(b)})),a.ipv6=b=>a.check(new cL({type:"string",format:"ipv6",check:"string_format",abort:!1,...aB(b)})),a.cidrv4=b=>a.check(new cM({type:"string",format:"cidrv4",check:"string_format",abort:!1,...aB(b)})),a.cidrv6=b=>a.check(new cN({type:"string",format:"cidrv6",check:"string_format",abort:!1,...aB(b)})),a.e164=b=>a.check(new cQ({type:"string",format:"e164",check:"string_format",abort:!1,...aB(b)})),a.datetime=b=>a.check(new cb({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...aB(b)})),a.date=b=>a.check(new cc({type:"string",format:"date",check:"string_format",...aB(b)})),a.time=b=>a.check(new cd({type:"string",format:"time",check:"string_format",precision:null,...aB(b)})),a.duration=b=>a.check(new ce({type:"string",format:"duration",check:"string_format",...aB(b)}))});function cx(a){return new cw({type:"string",...aB(a)})}let cy=K("ZodStringFormat",(a,b)=>{a5.init(a,b),cv.init(a,b)}),cz=K("ZodEmail",(a,b)=>{a8.init(a,b),cy.init(a,b)}),cA=K("ZodGUID",(a,b)=>{a6.init(a,b),cy.init(a,b)}),cB=K("ZodUUID",(a,b)=>{a7.init(a,b),cy.init(a,b)}),cC=K("ZodURL",(a,b)=>{a9.init(a,b),cy.init(a,b)}),cD=K("ZodEmoji",(a,b)=>{ba.init(a,b),cy.init(a,b)}),cE=K("ZodNanoID",(a,b)=>{bb.init(a,b),cy.init(a,b)}),cF=K("ZodCUID",(a,b)=>{bc.init(a,b),cy.init(a,b)}),cG=K("ZodCUID2",(a,b)=>{bd.init(a,b),cy.init(a,b)}),cH=K("ZodULID",(a,b)=>{be.init(a,b),cy.init(a,b)}),cI=K("ZodXID",(a,b)=>{bf.init(a,b),cy.init(a,b)}),cJ=K("ZodKSUID",(a,b)=>{bg.init(a,b),cy.init(a,b)}),cK=K("ZodIPv4",(a,b)=>{bl.init(a,b),cy.init(a,b)}),cL=K("ZodIPv6",(a,b)=>{bm.init(a,b),cy.init(a,b)}),cM=K("ZodCIDRv4",(a,b)=>{bn.init(a,b),cy.init(a,b)}),cN=K("ZodCIDRv6",(a,b)=>{bo.init(a,b),cy.init(a,b)}),cO=K("ZodBase64",(a,b)=>{bq.init(a,b),cy.init(a,b)}),cP=K("ZodBase64URL",(a,b)=>{br.init(a,b),cy.init(a,b)}),cQ=K("ZodE164",(a,b)=>{bs.init(a,b),cy.init(a,b)}),cR=K("ZodJWT",(a,b)=>{bt.init(a,b),cy.init(a,b)}),cS=K("ZodUnknown",(a,b)=>{bu.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>{}});function cT(){return new cS({type:"unknown"})}let cU=K("ZodNever",(a,b)=>{bv.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>{b.not={}}}),cV=K("ZodArray",(a,b)=>{bx.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,{minimum:f,maximum:g}=a._zod.bag;"number"==typeof f&&(c.minItems=f),"number"==typeof g&&(c.maxItems=g),c.type="array",c.items=b5(e.element,b,{...d,path:[...d.path,"items"]})})(a,b,c,d),a.element=b.element,ct(a,"ZodArray",{min(a,b){return this.check(b1(a,b))},nonempty(a){return this.check(b1(1,a))},max(a,b){return this.check(b0(a,b))},length(a,b){return this.check(b2(a,b))},unwrap(){return this.element}})}),cW=K("ZodObject",(a,b)=>{bC.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;c.type="object",c.properties={};let f=e.shape;for(let a in f)c.properties[a]=b5(f[a],b,{...d,path:[...d.path,"properties",a]});let g=new Set([...new Set(Object.keys(f))].filter(a=>{let c=e.shape[a]._zod;return"input"===b.io?void 0===c.optin:void 0===c.optout}));g.size>0&&(c.required=Array.from(g)),e.catchall?._zod.def.type==="never"?c.additionalProperties=!1:e.catchall?e.catchall&&(c.additionalProperties=b5(e.catchall,b,{...d,path:[...d.path,"additionalProperties"]})):"output"===b.io&&(c.additionalProperties=!1)})(a,b,c,d),ap(a,"shape",()=>b.shape),ct(a,"ZodObject",{keyof(){var a;return new cZ({type:"enum",entries:Array.isArray(a=Object.keys(this._zod.def.shape))?Object.fromEntries(a.map(a=>[a,a])):a,...aB(void 0)})},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:cT()})},loose(){return this.clone({...this._zod.def,catchall:cT()})},strict(){return this.clone({...this._zod.def,catchall:new cU({type:"never",...aB(void 0)})})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return function(a,b){if(!aw(b))throw Error("Invalid input to extend: expected a plain object");let c=a._zod.def.checks;if(c&&c.length>0){let c=a._zod.def.shape;for(let a in b)if(void 0!==Object.getOwnPropertyDescriptor(c,a))throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let d=ar(a._zod.def,{get shape(){let c={...a._zod.def.shape,...b};return aq(this,"shape",c),c}});return aA(a,d)}(this,a)},safeExtend(a){var b=this;if(!aw(a))throw Error("Invalid input to safeExtend: expected a plain object");let c=ar(b._zod.def,{get shape(){let c={...b._zod.def.shape,...a};return aq(this,"shape",c),c}});return aA(b,c)},merge(a){var b=this;if(b._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let c=ar(b._zod.def,{get shape(){let c={...b._zod.def.shape,...a._zod.def.shape};return aq(this,"shape",c),c},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return aA(b,c)},pick(a){return function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let e=ar(a._zod.def,{get shape(){let a={};for(let d in b){if(!(d in c.shape))throw Error(`Unrecognized key: "${d}"`);b[d]&&(a[d]=c.shape[d])}return aq(this,"shape",a),a},checks:[]});return aA(a,e)}(this,a)},omit(a){return function(a,b){let c=a._zod.def,d=c.checks;if(d&&d.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let e=ar(a._zod.def,{get shape(){let d={...a._zod.def.shape};for(let a in b){if(!(a in c.shape))throw Error(`Unrecognized key: "${a}"`);b[a]&&delete d[a]}return aq(this,"shape",d),d},checks:[]});return aA(a,e)}(this,a)},partial(...a){return function(a,b,c){let d=b._zod.def.checks;if(d&&d.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=ar(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in d))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=a?new a({type:"optional",innerType:d[b]}):d[b])}else for(let b in d)e[b]=a?new a({type:"optional",innerType:d[b]}):d[b];return aq(this,"shape",e),e},checks:[]});return aA(b,e)}(c_,this,a[0])},required(...a){return function(a,b,c){let d=ar(b._zod.def,{get shape(){let d=b._zod.def.shape,e={...d};if(c)for(let b in c){if(!(b in e))throw Error(`Unrecognized key: "${b}"`);c[b]&&(e[b]=new a({type:"nonoptional",innerType:d[b]}))}else for(let b in d)e[b]=new a({type:"nonoptional",innerType:d[b]});return aq(this,"shape",e),e}});return aA(b,d)}(c6,this,a[0])}})}),cX=K("ZodUnion",(a,b)=>{bE.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=!1===e.inclusive,g=e.options.map((a,c)=>b5(a,b,{...d,path:[...d.path,f?"oneOf":"anyOf",c]}));f?c.oneOf=g:c.anyOf=g})(a,b,c,d),a.options=b.options}),cY=K("ZodIntersection",(a,b)=>{bF.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=b5(e.left,b,{...d,path:[...d.path,"allOf",0]}),g=b5(e.right,b,{...d,path:[...d.path,"allOf",1]}),h=a=>"allOf"in a&&1===Object.keys(a).length;c.allOf=[...h(f)?f.allOf:[f],...h(g)?g.allOf:[g]]})(a,b,c,d)}),cZ=K("ZodEnum",(a,b)=>{bH.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=ak(a._zod.def.entries);e.every(a=>"number"==typeof a)&&(c.type="number"),e.every(a=>"string"==typeof a)&&(c.type="string"),c.enum=e})(a,0,c,0),a.enum=b.entries,a.options=Object.values(b.entries);let c=new Set(Object.keys(b.entries));a.extract=(a,d)=>{let e={};for(let d of a)if(c.has(d))e[d]=b.entries[d];else throw Error(`Key ${d} not found in enum`);return new cZ({...b,checks:[],...aB(d),entries:e})},a.exclude=(a,d)=>{let e={...b.entries};for(let b of a)if(c.has(b))delete e[b];else throw Error(`Key ${b} not found in enum`);return new cZ({...b,checks:[],...aB(d),entries:e})}}),c$=K("ZodTransform",(a,b)=>{bI.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>((a,b,c,d)=>{if("throw"===b.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema")})(0,a,0,0),a._zod.parse=(c,d)=>{if("backward"===d.direction)throw new M(a.constructor.name);c.addIssue=d=>{"string"==typeof d?c.issues.push(aH(d,c.value,b)):(d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=c.value),d.inst??(d.inst=a),c.issues.push(aH(d)))};let e=b.transform(c.value,c);return e instanceof Promise?e.then(a=>(c.value=a,c.fallback=!0,c)):(c.value=e,c.fallback=!0,c)}}),c_=K("ZodOptional",(a,b)=>{bK.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>ca(a,b,c,d),a.unwrap=()=>a._zod.def.innerType});function c0(a){return new c_({type:"optional",innerType:a})}let c1=K("ZodExactOptional",(a,b)=>{bL.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>ca(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),c2=K("ZodNullable",(a,b)=>{bM.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=b5(e.innerType,b,d),g=b.seen.get(a);"openapi-3.0"===b.target?(g.ref=e.innerType,c.nullable=!0):c.anyOf=[f,{type:"null"}]})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType});function c3(a){return new c2({type:"nullable",innerType:a})}let c4=K("ZodDefault",(a,b)=>{bN.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,c.default=JSON.parse(JSON.stringify(e.defaultValue))})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType,a.removeDefault=a.unwrap}),c5=K("ZodPrefault",(a,b)=>{bP.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,"input"===b.io&&(c._prefault=JSON.parse(JSON.stringify(e.defaultValue)))})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),c6=K("ZodNonOptional",(a,b)=>{bQ.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType})(a,b,0,d),a.unwrap=()=>a._zod.def.innerType}),c7=K("ZodCatch",(a,b)=>{bS.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e,f=a._zod.def;b5(f.innerType,b,d),b.seen.get(a).ref=f.innerType;try{e=f.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}c.default=e})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType,a.removeCatch=a.unwrap}),c8=K("ZodPipe",(a,b)=>{bT.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def,f=e.in._zod.traits.has("$ZodTransform"),g="input"===b.io?f?e.out:e.in:e.out;b5(g,b,d),b.seen.get(a).ref=g})(a,b,0,d),a.in=b.in,a.out=b.out});function c9(a,b){return new c8({type:"pipe",in:a,out:b})}let da=K("ZodReadonly",(a,b)=>{bV.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(b,c,d)=>((a,b,c,d)=>{let e=a._zod.def;b5(e.innerType,b,d),b.seen.get(a).ref=e.innerType,c.readOnly=!0})(a,b,c,d),a.unwrap=()=>a._zod.def.innerType}),db=K("ZodCustom",(a,b)=>{bX.init(a,b),cu.init(a,b),a._zod.processJSONSchema=(a,b,c)=>((a,b,c,d)=>{if("throw"===b.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema")})(0,a,0,0)});async function dc(a,b,c,d="google",e="",f="en",g,h){let i=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a,prompt:b,apiKey:c,provider:d,model:e,language:f,baseURL:g,images:h})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Request failed"}))).error||`HTTP ${i.status}`);return(await i.json()).testCases}new cW({type:"object",shape:{title:cx().describe("Short descriptive title of the test case"),steps:cx().describe("Numbered test steps separated by newlines"),expected:cx().describe("Expected result of the test")}??{},...aB(void 0)});var dd=c(19553);async function de(a){let b=URL.createObjectURL(a),c=document.createElement("video");c.muted=!0,c.preload="auto",c.crossOrigin="anonymous",await new Promise((a,d)=>{c.onloadedmetadata=()=>a(),c.onerror=()=>d(Error("Failed to load video")),c.src=b}),await c.play().catch(()=>{}),c.pause();let d=c.duration;if(!isFinite(d)||d<=0)throw URL.revokeObjectURL(b),Error("Could not determine video duration");let e=Math.min(d<=10?4:8,Math.ceil(d)),f=[];for(let a=0;a<e;a++){let b=.1+a/e*(d-.2);f.push(Math.min(b,d-.05))}let g=document.createElement("canvas"),h=g.getContext("2d"),i=[];for(let a of f){await function(a,b){return new Promise(c=>{let d=()=>{a.removeEventListener("seeked",d),requestAnimationFrame(()=>c())};a.addEventListener("seeked",d),a.currentTime=b})}(c,a);let b=function(a,b,c){let{videoWidth:d,videoHeight:e}=a,f=d>1280?1280/d:1;return b.width=Math.round(d*f),b.height=Math.round(e*f),c.drawImage(a,0,0,b.width,b.height),b.toDataURL("image/jpeg",.82)}(c,g,h);i.push(b)}return URL.revokeObjectURL(b),{frames:i,duration:d,thumbnail:i[0]??""}}let df=["User can log in with valid credentials","Invalid input shows validation error","Form submits successfully and redirects","Edge case: empty required fields"],dg=["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 dh({open:a,onClose:b,node:c,onGenerate:d}){let{isConnected:e,activeProvider:f,activeProviderId:h}=(0,dd.P)(),[i,k]=(0,j.useState)(""),[l,m]=(0,j.useState)(""),[n,o]=(0,j.useState)("en"),[p,q]=(0,j.useState)(!1),[r,s]=(0,j.useState)(!1),[t,u]=(0,j.useState)(null),[v,w]=(0,j.useState)([]),[x,y]=(0,j.useState)(""),[z,A]=(0,j.useState)(dg[0]),[B,C]=(0,j.useState)(0),D=(0,j.useRef)(null),E=(0,j.useRef)(null),F=(0,j.useRef)(null),[G,H]=(0,j.useState)(!1),[I,J]=(0,j.useState)(!1),[K,L]=(0,j.useState)(null),[M,N]=(0,j.useState)([]),[O,P]=(0,j.useState)(new Set),[Q,R]=(0,j.useState)(!1),[S,T]=(0,j.useState)(null),U=(0,j.useCallback)(async()=>{try{let a=await fetch("https://api.thecatapi.com/v1/images/search?size=med"),b=await a.json();b?.[0]?.url&&y(b[0].url)}catch{y("")}A(dg[Math.floor(Math.random()*dg.length)])},[]),V=a=>new Promise((b,c)=>{if(!a.type.startsWith("image/"))return void c(Error("Not an image file"));if(a.size>5242880)return void c(Error("Image too large (max 5MB)"));let d=new FileReader;d.onload=()=>b(d.result),d.onerror=()=>c(Error("Failed to read file")),d.readAsDataURL(a)}),W=(0,j.useCallback)(async a=>{if(!a.type.startsWith("video/"))return void u("Not a video file");if(a.size>0x3200000)return void u("Video too large (max 50MB)");J(!0),L("Loading video...");try{let b=await de(a);if(b.duration>120){u(`Video too long (${Math.round(b.duration)}s). Max 120s.`),J(!1),L(null);return}L(`Extracted ${b.frames.length} frames. Select which to include...`),N(b.frames),P(new Set(b.frames.map((a,b)=>b))),R(!0),u(null)}catch(a){u(a instanceof Error?a.message:"Failed to process video")}finally{J(!1),L(null)}},[]),X=(0,j.useCallback)(()=>{let a=5-v.length,b=M.filter((a,b)=>O.has(b)).slice(0,a);b.length>0&&w(a=>[...a,...b]),N([]),P(new Set),R(!1)},[M,O,v.length]),Y=(0,j.useCallback)(()=>{N([]),P(new Set),R(!1)},[]),Z=(0,j.useCallback)(a=>{P(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.size<5&&c.add(a),c})},[]),$=(0,j.useCallback)(()=>{P(new Set(Array.from({length:Math.min(M.length,5)},(a,b)=>b)))},[M]),_=(0,j.useCallback)(()=>{P(new Set)},[]),aa=(0,j.useCallback)(async a=>{let b=5-v.length;if(b<=0)return void u("Maximum 5 images/frames allowed");let c=Array.from(a),d=c.filter(a=>a.type.startsWith("image/")),e=c.filter(a=>a.type.startsWith("video/")),f=d.slice(0,b),g=[];for(let a of f)try{let b=await V(a);g.push(b)}catch(a){u(a instanceof Error?a.message:"Failed to load image")}g.length>0&&(w(a=>[...a,...g]),u(null)),e.length>0&&await W(e[0])},[v.length,W]),ab=(0,j.useCallback)(a=>{w(b=>b.filter((b,c)=>c!==a))},[]),ac=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),H(!0)},[]),ad=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),H(!1)},[]),ae=(0,j.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),H(!1),a.dataTransfer.files.length>0&&aa(a.dataTransfer.files)},[aa]);(0,j.useCallback)(async a=>{await W(a)},[W]);let af=(0,j.useCallback)(a=>{a.target.files&&a.target.files.length>0&&(aa(a.target.files),a.target.value="")},[aa]),ag=async()=>{if(!e)return void u("Please configure an AI provider in Integrations first.");if(!l.trim()&&0===v.length)return void u("Please describe the feature, paste a ticket, or attach an image.");s(!0),u(null);try{let a=await dc(i,l,f.apiKey,h??void 0,f.defaultModel,n,f.baseURL||void 0,v.length>0?v:void 0);d(a),b()}catch(a){u(a instanceof Error?a.message:"Generation failed")}finally{s(!1)}};return a?(0,g.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:b,children:[(0,g.jsxs)("div",{className:"flex rounded-xl overflow-hidden",style:{maxWidth:r?"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:a=>a.stopPropagation(),children:[(0,g.jsxs)("div",{className:"flex-1 min-w-0",style:{maxWidth:"512px"},children:[(0,g.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,g.jsx)("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)"},children:(0,g.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,g.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,g.jsx)("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Generate Test Cases"})]}),(0,g.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Describe the feature and let AI generate test cases for “",c.label,"”"]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Test Case Title"}),(0,g.jsx)("input",{value:i,onChange:a=>k(a.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,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Description / DoD / Ticket"}),(0,g.jsx)("textarea",{value:l,onChange:a=>m(a.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"===n?"Jelaskan fitur, kriteria penerimaan, atau tempel tiket...":"Describe the feature, acceptance criteria, or paste a ticket..."}),(0,g.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:df.map(a=>(0,g.jsxs)("button",{onClick:()=>m(b=>b?`${b}
64
+ ${a}`:a),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:["+ ",a]},a))})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:["Screenshots & Videos ",(0,g.jsx)("span",{className:"font-normal",style:{color:"var(--text-tertiary)"},children:"(optional)"})]}),v.length>0&&(0,g.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:v.map((a,b)=>(0,g.jsxs)("div",{className:"relative group rounded-lg overflow-hidden border",style:{borderColor:"var(--border)",width:72,height:72},children:[(0,g.jsx)("img",{src:a,alt:`Screenshot ${b+1}`,className:"w-full h-full object-cover"}),(0,g.jsx)("button",{onClick:()=>ab(b),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,g.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,g.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},b))}),(0,g.jsx)("div",{ref:F,onDragOver:ac,onDragLeave:ad,onDrop:ae,onClick:()=>D.current?.click(),className:"rounded-lg border-2 border-dashed cursor-pointer transition-colors",style:{borderColor:G?"var(--accent)":"var(--border)",backgroundColor:G?"var(--accent)08":"transparent",padding:v.length>0?"8px":"16px"},children:(0,g.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,g.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,g.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,g.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,g.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,g.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:v.length>0?`Add more (${v.length}/5) \xb7 paste, drop, or click`:"Paste from clipboard, drop, or click to upload"})]})}),!Q&&v.length<5&&(0,g.jsx)("div",{className:"mt-2",children:I?(0,g.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsx)("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",children:(0,g.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),(0,g.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:K})]}):(0,g.jsxs)("button",{type:"button",onClick:a=>{a.stopPropagation(),E.current?.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,g.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("polygon",{points:"23 7 16 12 23 17 23 7"}),(0,g.jsx)("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),"Upload video (extract key frames)"]})}),Q&&M.length>0&&(0,g.jsxs)("div",{className:"mt-2 p-3 rounded-lg border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,g.jsxs)("span",{className:"text-[11px] font-medium",style:{color:"var(--text-secondary)"},children:["Select frames ",(0,g.jsxs)("span",{style:{color:"var(--text-tertiary)"},children:["(",O.size,"/",5," max)"]})]}),(0,g.jsxs)("div",{className:"flex gap-1",children:[(0,g.jsx)("button",{type:"button",onClick:$,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"All"}),(0,g.jsx)("button",{type:"button",onClick:_,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"None"})]})]}),(0,g.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:M.map((a,b)=>(0,g.jsxs)("div",{className:"relative group rounded-md overflow-hidden border-2 transition-all cursor-pointer",style:{width:80,height:80,borderColor:O.has(b)?"var(--accent)":"var(--border)",opacity:O.has(b)?1:.5},children:[(0,g.jsx)("button",{type:"button",onClick:()=>Z(b),className:"w-full h-full",children:(0,g.jsx)("img",{src:a,alt:`Frame ${b+1}`,className:"w-full h-full object-cover"})}),(0,g.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),T(a)},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,g.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,g.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),(0,g.jsx)("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),(0,g.jsx)("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),O.has(b)&&(0,g.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,g.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,g.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,g.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:b+1})]},b))}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("button",{type:"button",onClick:Y,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,g.jsxs)("button",{type:"button",onClick:X,disabled:0===O.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 ",O.size," frame",1!==O.size?"s":""]})]})]}),(0,g.jsx)("input",{ref:D,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:af}),(0,g.jsx)("input",{ref:E,type:"file",accept:"video/*",className:"hidden",onChange:async a=>{let b=a.target.files?.[0];b&&(await W(b),a.target.value="")}})]}),t&&(0,g.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:t}),!e&&(0,g.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,g.jsxs)("div",{className:"rounded-lg border overflow-hidden",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("button",{onClick:()=>q(a=>!a),className:"w-full flex items-center justify-between px-3 py-2 transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Language"}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.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"===n?"EN":"ID"}),(0,g.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:p?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms ease-out"},children:(0,g.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),(0,g.jsx)("div",{style:{maxHeight:p?"80px":"0px",overflow:"hidden",transition:"max-height 200ms ease-out"},children:(0,g.jsx)("div",{className:"px-3 pb-2 pt-1",children:(0,g.jsxs)("select",{value:n,onChange:a=>{o(a.target.value),q(!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,g.jsx)("option",{value:"en",children:"English"}),(0,g.jsx)("option",{value:"id",children:"Bahasa Indonesia"})]})})})]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:b,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,g.jsx)("button",{onClick:ag,disabled:r||!e,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:r?(0,g.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,g.jsx)("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,g.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),"Generating..."]}):"Generate Test Cases"})]})]}),(0,g.jsx)("div",{className:"flex-shrink-0 overflow-hidden",style:{width:r?"280px":"0px",transition:"width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,g.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:+!!r,transition:"opacity 300ms ease-out 100ms"},children:[(0,g.jsx)("div",{className:"w-full rounded-xl overflow-hidden mb-4 border",style:{borderColor:"var(--border)",height:180,backgroundColor:"var(--bg-card)"},children:x&&(0,g.jsx)("img",{src:x,alt:"Cute cat",width:280,height:180,className:"w-full h-full object-cover",style:{animation:"fadeIn 800ms ease-out"},onError:a=>{a.target.style.display="none"}},B)}),(0,g.jsx)("p",{className:"text-xs text-center mb-3",style:{color:"var(--text-secondary)",animation:"fadeIn 800ms ease-out"},children:z}),(0,g.jsx)("button",{onClick:U,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"})]})})]}),S&&(0,g.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:a=>{a.stopPropagation(),T(null)},children:(0,g.jsxs)("div",{className:"relative max-w-4xl max-h-full",onClick:a=>a.stopPropagation(),children:[(0,g.jsx)("img",{src:S,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,g.jsx)("button",{onClick:()=>T(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,g.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,g.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,g.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})]}):null}let di={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)"}};function dj({open:a,onClose:b,node:c,testCases:d,stats:e}){return a?(0,g.jsxs)("div",{style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:b,className:"jsx-540c0278eef48442 fixed inset-0 z-[300] flex items-center justify-center",children:[(0,g.jsxs)("div",{style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)",animation:"fadeInUp 200ms ease-out"},onClick:a=>a.stopPropagation(),className:"jsx-540c0278eef48442 w-full max-w-lg mx-4 rounded-xl overflow-hidden",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 px-5 pt-5 pb-4 border-b",children:[(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center justify-between mb-2",children:[(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center gap-2",children:[c.code&&(0,g.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:c.code}),(0,g.jsx)("h3",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-sm font-semibold",children:c.label})]}),(0,g.jsx)("button",{onClick:b,style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),c.notes&&(0,g.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:c.notes})]}),(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 grid grid-cols-4 gap-3 p-5",children:[(0,g.jsx)(dk,{label:"Total",value:e.total}),(0,g.jsx)(dk,{label:"Pass",value:e.pass,color:"var(--status-pass-text)"}),(0,g.jsx)(dk,{label:"Fail",value:e.fail,color:"var(--status-fail-text)"}),(0,g.jsx)(dk,{label:"Untested",value:e.untested,color:"var(--status-untested-text)"})]}),(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,g.jsxs)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 flex items-center justify-between text-[10px] mb-1.5",children:[(0,g.jsx)("span",{className:"jsx-540c0278eef48442",children:"Pass Rate"}),(0,g.jsxs)("span",{style:{color:e.passRate>=80?"var(--status-pass-text)":e.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)",fontWeight:600},className:"jsx-540c0278eef48442",children:[e.passRate,"%"]})]}),(0,g.jsx)("div",{style:{backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 h-2 w-full rounded-full overflow-hidden",children:(0,g.jsx)("div",{style:{width:`${e.passRate}%`,backgroundColor:e.passRate>=80?"var(--status-pass-text)":e.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"},className:"jsx-540c0278eef48442 h-full rounded-full transition-all duration-500"})})]}),d.length>0&&(0,g.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,g.jsx)("h4",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-semibold uppercase tracking-wider mb-2",children:"Test Cases"}),(0,g.jsx)("div",{className:"jsx-540c0278eef48442 space-y-1.5 max-h-48 overflow-y-auto",children:d.map(a=>{let b=di[a.status]||di.untested;return(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 flex items-center gap-2 px-3 py-2 rounded-lg border",children:[(0,g.jsx)("span",{style:{backgroundColor:b.bg,color:b.text},className:"jsx-540c0278eef48442 text-[9px] font-mono px-1.5 py-0.5 rounded-full flex-shrink-0",children:a.status}),(0,g.jsx)("span",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-[11px] flex-1 truncate",children:a.title}),a.code&&(0,g.jsx)("span",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[9px] font-mono flex-shrink-0",children:a.code})]},a.id)})})]}),0===d.length&&(0,g.jsx)("div",{className:"jsx-540c0278eef48442 px-5 pb-5 text-center",children:(0,g.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:"No test cases for this node yet."})}),(0,g.jsx)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 px-5 py-3 border-t",children:(0,g.jsx)("button",{onClick:b,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,g.jsx)(i(),{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 dk({label:a,value:b,color:c}){return(0,g.jsxs)("div",{className:"text-center p-2 rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("div",{className:"text-[10px] mb-0.5",style:{color:"var(--text-tertiary)"},children:a}),(0,g.jsx)("div",{className:"text-lg font-semibold",style:{color:c??"var(--text-primary)"},children:b})]})}function dl(a){let b=[],c="",d=!1;for(let e=0;e<a.length;e++){let f=a[e];d?'"'===f?e+1<a.length&&'"'===a[e+1]?(c+='"',e++):d=!1:c+=f:'"'===f?d=!0:","===f?(b.push(c),c=""):c+=f}return b.push(c),b}function dm({open:a,onClose:b,onImport:c,nodeLabel:d}){let[e,f]=(0,j.useState)("csv"),[h,i]=(0,j.useState)(null),[k,l]=(0,j.useState)(null),[m,n]=(0,j.useState)(!1),o=(0,j.useRef)(null),p=()=>{i(null),l(null),n(!1)},q=(0,j.useCallback)(a=>{i(null),l(null);let b=new FileReader;b.onload=()=>{try{let c=b.result,d=a.name.endsWith(".json")||"application/json"===a.type?function(a){let b=JSON.parse(a),c=Array.isArray(b)?b:b.testCases||b.test_cases||b.cases;if(!Array.isArray(c))throw Error('JSON must be an array of test cases, or an object with a "testCases" array');let d=[];for(let a of c){if("string"==typeof a){a.trim()&&d.push({title:a.trim(),steps:"",expected:""});continue}if("object"!=typeof a||!a)continue;let b=a.title||a.name||a.testCase||a["test case"]||"";b&&"string"==typeof b&&d.push({title:b.trim(),steps:String(a.steps||a.instructions||"").trim(),expected:String(a.expected||a["expected result"]||a.result||"").trim()})}if(0===d.length)throw Error("No valid test cases found in JSON");return d}(c):function(a){let b=a.split("\n").map(a=>a.trim()).filter(a=>a.length>0);if(b.length<2)throw Error("CSV must have a header row and at least one data row");let c=dl(b[0]).map(a=>a.toLowerCase().trim()),d=c.findIndex(a=>"title"===a||"test case"===a||"testcase"===a||"name"===a||"test case title"===a),e=c.findIndex(a=>"steps"===a||"test steps"===a||"step"===a||"instructions"===a),f=c.findIndex(a=>"expected"===a||"expected result"===a||"expected results"===a||"result"===a);if(-1===d)throw Error('Could not find a "title" or "test case" column in the CSV header');let g=[];for(let a=1;a<b.length;a++){let c=dl(b[a]),h=(c[d]||"").trim();h&&g.push({title:h,steps:e>=0?(c[e]||"").trim():"",expected:f>=0?(c[f]||"").trim():""})}if(0===g.length)throw Error("No valid test cases found in CSV");return g}(c);l(d)}catch(a){i(a instanceof Error?a.message:"Failed to parse file")}},b.onerror=()=>i("Failed to read file"),b.readAsText(a)},[]);return a?(0,g.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:()=>{p(),b()},children:(0,g.jsxs)("div",{className:"w-full max-w-lg mx-4 rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:a=>a.stopPropagation(),children:[(0,g.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Import Test Cases"}),(0,g.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Import test cases into “",d,"” from CSV or JSON"]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,g.jsxs)("div",{className:"text-[11px] rounded-lg px-3 py-2",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Supported formats:"}),(0,g.jsxs)("ul",{className:"space-y-0.5 ml-3",children:[(0,g.jsxs)("li",{children:[(0,g.jsx)("strong",{children:"CSV:"})," Header row with columns: title, steps, expected (or similar names)"]}),(0,g.jsxs)("li",{children:[(0,g.jsx)("strong",{children:"JSON:"}),' Array of objects with "title", "steps", "expected" fields']})]})]}),(0,g.jsx)("div",{onDragOver:a=>{a.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:a=>{a.preventDefault(),n(!1);let b=a.dataTransfer.files[0];b&&q(b)},onClick:()=>o.current?.click(),className:"border-2 border-dashed rounded-lg cursor-pointer transition-colors py-8",style:{borderColor:m?"var(--accent)":"var(--border)",backgroundColor:m?"var(--accent)08":"transparent"},children:(0,g.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),(0,g.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,g.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Drop a .csv or .json file here, or click to browse"})]})}),(0,g.jsx)("input",{ref:o,type:"file",accept:".csv,.json",className:"hidden",onChange:a=>{let b=a.target.files?.[0];b&&q(b),a.target.value=""}}),h&&(0,g.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:h}),k&&k.length>0&&(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,g.jsxs)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:["Preview (",k.length," test case",1!==k.length?"s":"",")"]}),(0,g.jsx)("button",{onClick:()=>l(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,g.jsxs)("div",{className:"max-h-[200px] overflow-auto rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("table",{className:"text-[11px] w-full",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{style:{backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"#"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Title"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Steps"}),(0,g.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Expected"})]})}),(0,g.jsx)("tbody",{children:k.slice(0,20).map((a,b)=>(0,g.jsxs)("tr",{className:"border-t",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-tertiary)"},children:b+1}),(0,g.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-primary)"},children:a.title}),(0,g.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:a.steps||"—"}),(0,g.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:a.expected||"—"})]},b))})]}),k.length>20&&(0,g.jsxs)("div",{className:"px-2 py-1 text-[10px] border-t",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["...and ",k.length-20," more"]})]})]})]}),(0,g.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,g.jsx)("button",{onClick:()=>{p(),b()},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,g.jsxs)("button",{onClick:()=>{k&&0!==k.length&&(c(k),p(),b())},disabled:!k||0===k.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 ",k?`(${k.length})`:""]})]})]})}):null}function dn({testCases:a,projectId:b,onClose:c}){let{e2e:d,testCases:e}=(0,m.M)(),[f,h]=(0,j.useState)(d.config.baseUrl),[i,k]=(0,j.useState)(d.config.browser),[l,n]=(0,j.useState)(d.config.headless),[o,p]=(0,j.useState)(d.config.timeout),[q,r]=(0,j.useState)("runner"),[s,t]=(0,j.useState)(!1),[u,v]=(0,j.useState)(!1),[w,x]=(0,j.useState)([]),[y,z]=(0,j.useState)(null),[A,B]=(0,j.useState)([]),[C,D]=(0,j.useState)([]),[E,F]=(0,j.useState)(null),[G,H]=(0,j.useState)(!0),[I,J]=(0,j.useState)(22),[K,L]=(0,j.useState)(!0),M=(0,j.useRef)(!1),N=(0,j.useRef)(null),[O,P]=(0,j.useState)(""),[Q,R]=(0,j.useState)(!1),[S,T]=(0,j.useState)({}),[U,V]=(0,j.useState)(null),[W,X]=(0,j.useState)(""),[Y,Z]=(0,j.useState)(null),[$,_]=(0,j.useState)(null),aa=(0,j.useRef)(null),ab=(0,j.useRef)(null),[ac,ad]=(0,j.useState)(new Set(a.map(a=>a.id))),ae=(0,j.useCallback)(a=>{a.preventDefault(),M.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";let b=a=>{if(!M.current||!N.current)return;let b=N.current.getBoundingClientRect(),c=a.clientX;J(Math.min(Math.max((b.right-c)/b.width*100,15),50))},c=()=>{M.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",b),document.addEventListener("mouseup",c)},[]),af=(0,j.useCallback)((a,b)=>{B(c=>[...c,{time:new Date,type:a,message:b}]),window.setTimeout(()=>{ab.current?.scrollIntoView({behavior:"smooth"})},50)},[]),ag=(0,j.useCallback)(a=>{ad(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ah=(0,j.useCallback)(()=>{ac.size===a.length?ad(new Set):ad(new Set(a.map(a=>a.id)))},[a,ac]),ai=(0,j.useCallback)(()=>{let a=localStorage.getItem("qa-llm-config");if(!a)return null;let b=JSON.parse(a),c=b.activeProvider;if(!c||!b.providers?.[c])return null;let d=b.providers[c];return d.apiKey&&d.connected?{provider:c,model:d.defaultModel,apiKey:d.apiKey,baseURL:d.baseURL}:null},[]),aj=(0,j.useCallback)(async()=>{let b=ai();if(!b)return void af("error","Please configure LLM in Integrations page first");v(!0),af("info","Generating test scripts...");try{let c=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:a.filter(a=>ac.has(a.id)),baseUrl:f,llmConfig:b,generateOnly:!0})});if(!c.ok)return void af("error","Failed to generate scripts");let e=await c.json();for(let[b,c]of(T(a=>({...a,...e.scripts})),Object.entries(e.scripts))){let e=a.find(a=>a.id===b);e&&d.saveScript(b,e.title,e.code,c)}af("success",`Generated ${Object.keys(e.scripts).length} test script(s)`),r("scripts")}catch(a){af("error",`Error: ${a instanceof Error?a.message:String(a)}`)}finally{v(!1)}},[a,ac,f,ai,af,d]),ak=(0,j.useCallback)(async()=>{let c=a.filter(a=>ac.has(a.id));if(0===c.length)return;let e=ai();if(!e)return void af("error","Please configure LLM in Integrations page first");t(!0),x([]),B([]),D([]),F(null),P(""),R(!1);let g=new AbortController;aa.current=g,af("info",`Starting E2E test run with ${c.length} test(s)...`),af("info",`Target: ${f}`),af("info",`Browser: ${i} | Headless: ${l}`);try{let a=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:c,baseUrl:f,browser:i,headless:l,timeout:o,llmConfig:e}),signal:g.signal});if(!a.ok){let b=await a.json();af("error",b.error||"Failed to run tests"),t(!1);return}let h=a.body?.getReader(),j=new TextDecoder,k="",m=[];if(h)for(;;){let{done:a,value:c}=await h.read();if(a)break;let e=(k+=j.decode(c,{stream:!0})).split("\n");for(let a of(k=e.pop()||"",e))if(a.startsWith("data: "))try{let c=JSON.parse(a.slice(6));switch(c.type){case"status":af("info",c.message);break;case"testStart":z({index:c.index,title:c.title}),af("info",`
65
65
  ━━━ Test ${c.index}/${c.total}: ${c.code} - ${c.title} ━━━`),c.script&&T(a=>({...a,[c.testCaseId]:c.script}));break;case"step":af("info",` → ${c.message}`);break;case"aiThinking":af("ai",` 🤖 ${c.message}`);break;case"aiAction":af("ai",` 🎯 ${c.message}`);break;case"screenshot":F(c.image),D(a=>[...a,{image:c.image,label:c.label,timestamp:new Date}]);break;case"stepResult":af("pass"===c.status?"success":"error",` ${"pass"===c.status?"✓":"✗"} ${c.message}`);break;case"healing":af("healing",` 🔧 ${c.message}`);break;case"healingAction":af("healing",` 💊 ${c.message}`);break;case"healed":af("success",` ✨ ${c.message}`);break;case"aiAnalysis":af("ai",` 📊 AI Analysis:
66
66
  ${c.message}`);break;case"error":af("error",` ⚠ ${c.message}`);break;case"healingReport":P(c.report),c.report&&!c.report.includes("All tests passed")&&R(!0);break;case"testComplete":af("pass"===c.status?"success":"error",`
67
- ${"pass"===c.status?"✓":"✗"} Test ${c.index} completed: ${c.status.toUpperCase()} (${c.duration}ms)`),c.script&&(T(a=>({...a,[c.testCaseId]:c.script})),d.saveScript(c.testCaseId,c.result?.testCaseTitle||"","",c.script)),m.push(c.result),x([...m]);break;case"complete":af("success","\n═══════════════════════════════════════");let e=c.results.filter(a=>"pass"===a.status).length,g=c.results.filter(a=>"fail"===a.status||"error"===a.status).length;af("success",`Test run complete: ${e} passed, ${g} failed`),d.saveRun({projectId:b,config:{baseUrl:f,browser:i,headless:l,timeout:o},results:c.results,totalPassed:e,totalFailed:g,totalDuration:c.results.reduce((a,b)=>a+b.duration,0),healingReport:O||void 0});break;case"aborted":af("warning","\n━━━ Test run stopped by user ━━━")}}catch{}}}catch(a){a instanceof Error&&"AbortError"===a.name?af("warning","\n━━━ Test run stopped by user ━━━"):af("error",`Error: ${a instanceof Error?a.message:String(a)}`)}t(!1),z(null),aa.current=null},[a,ac,f,i,l,o,af,ai,b,d,O]),al=(0,j.useCallback)(()=>{aa.current&&(af("warning","Stopping test run..."),aa.current.abort())},[af]),am=(0,j.useCallback)(()=>{if(!U||!W)return;let b=a.find(a=>a.id===U);b&&(d.saveScript(b.id,b.title,b.code,W),T(a=>({...a,[b.id]:W})),af("success",`Script saved for ${b.code}`)),V(null),X("")},[U,W,a,d,af]);return(0,g.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,g.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,g.jsxs)("div",{className:"flex items-center justify-between p-3 md:p-4 border-b shrink-0",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsx)("h2",{className:"text-base md:text-lg font-semibold truncate",style:{color:"var(--text-primary)"},children:"E2E Agentic Test Runner"}),(0,g.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,g.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:["runner"===q&&(0,g.jsx)("button",{onClick:()=>L(!K),className:"md:hidden p-1.5 rounded",style:{backgroundColor:K?"var(--accent)":"var(--bg-secondary)",color:K?"white":"var(--text-secondary)"},title:"Toggle config panel",children:"☰"}),(0,g.jsx)("button",{onClick:c,className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]})]}),(0,g.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(a=>(0,g.jsxs)("button",{onClick:()=>r(a.id),className:"px-3 md:px-4 py-2 text-xs flex items-center gap-1.5 transition-colors whitespace-nowrap",style:{backgroundColor:q===a.id?"var(--bg-secondary)":"transparent",color:q===a.id?"var(--accent)":"var(--text-tertiary)",borderBottom:q===a.id?"2px solid var(--accent)":"2px solid transparent"},children:[(0,g.jsx)("span",{children:a.icon}),a.label]},a.id))}),"runner"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.jsx)("div",{className:`${K?"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,g.jsxs)("div",{className:"p-3 md:p-4 space-y-3 md:space-y-4",children:[(0,g.jsxs)("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Configuration"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Target URL"}),(0,g.jsx)("input",{type:"url",value:f,onChange:a=>h(a.target.value),disabled:s,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,g.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Browser"}),(0,g.jsxs)("select",{value:i,onChange:a=>k(a.target.value),disabled:s,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,g.jsx)("option",{value:"chromium",children:"Chromium"}),(0,g.jsx)("option",{value:"firefox",children:"Firefox"}),(0,g.jsx)("option",{value:"webkit",children:"WebKit"}),(0,g.jsx)("option",{value:"edge",children:"Edge"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Timeout (ms)"}),(0,g.jsx)("input",{type:"number",value:o,onChange:a=>p(Number(a.target.value)),disabled:s,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,g.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,g.jsx)("input",{type:"checkbox",checked:l,onChange:a=>n(a.target.checked),disabled:s,className:"accent-[var(--accent)]"}),(0,g.jsx)("span",{style:{color:"var(--text-secondary)"},children:"Run headless"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Test Cases (",ac.size,"/",a.length,")"]}),(0,g.jsx)("button",{onClick:ah,disabled:s,className:"text-xs underline disabled:opacity-50",style:{color:"var(--accent)"},children:ac.size===a.length?"Deselect All":"Select All"})]}),(0,g.jsx)("div",{className:"max-h-[150px] md:max-h-[200px] overflow-auto rounded-lg",style:{border:"1px solid var(--border)"},children:a.map(a=>{let b=w.find(b=>b.testCaseId===a.id);return(0,g.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:ac.has(a.id)?"var(--bg-secondary)":"transparent"},children:[(0,g.jsx)("input",{type:"checkbox",checked:ac.has(a.id),onChange:()=>ag(a.id),disabled:s,className:"accent-[var(--accent)]"}),(0,g.jsx)("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:a.code}),b&&(0,g.jsx)("span",{style:{color:"pass"===b.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===b.status?"✓":"✗"})]},a.id)})})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)("button",{onClick:aj,disabled:s||u||0===ac.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:u?"⏳ Generating...":"{ } Generate Scripts"}),O&&(0,g.jsx)("button",{onClick:()=>R(!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,g.jsxs)("div",{ref:N,className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,g.jsxs)("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden min-h-0",children:[(0,g.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:[(0,g.jsx)("div",{className:"p-3 border-b",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Execution Log"}),s&&(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),(0,g.jsx)("span",{className:"text-xs truncate max-w-[150px]",style:{color:"var(--text-tertiary)"},children:y?y.title:"Processing..."})]})]})}),(0,g.jsxs)("div",{className:"flex-1 overflow-auto p-3 font-mono text-xs",style:{backgroundColor:"var(--bg-primary)"},children:[0===A.length?(0,g.jsx)("div",{className:"text-center py-8",style:{color:"var(--text-tertiary)"},children:'Click "Run Tests" to start'}):A.map((a,b)=>(0,g.jsx)("div",{className:"py-0.5",style:{color:(a=>{switch(a){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)"}})(a.type)},children:a.message.split("\n").map((a,b)=>(0,g.jsx)("div",{children:a||"\xa0"},b))},b)),(0,g.jsx)("div",{ref:ab})]})]}),(0,g.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:ae}),(0,g.jsxs)("div",{className:"border-t md:border-t-0 md:border-l flex flex-col transition-all duration-200",style:{borderColor:"var(--border)",maxHeight:G?"300px":"36px",minHeight:G?"200px":"36px",width:"auto",flex:G?`0 0 ${I}%`:"0 0 36px",...{}},children:[(0,g.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:()=>H(!G),children:[(0,g.jsx)("span",{className:"text-sm",children:"\uD83D\uDDA5️"}),G&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("h3",{className:"text-sm font-medium flex-1",style:{color:"var(--text-primary)"},children:"Browser Preview"}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:C.length>0?`${C.length} screenshots`:""})]})]}),G&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{backgroundColor:"var(--bg-secondary)"},children:E?(0,g.jsx)("img",{src:`data:image/jpeg;base64,${E}`,alt:"Browser preview",className:"w-full rounded"}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full min-h-[100px] text-xs",style:{color:"#666"},children:s?"Waiting...":"Preview during execution"})}),C.length>0&&(0,g.jsx)("div",{className:"p-2 border-t overflow-x-auto flex gap-1 shrink-0",style:{borderColor:"var(--border)"},children:C.slice(-6).map((a,b)=>(0,g.jsx)("button",{onClick:()=>F(a.image),className:"flex-shrink-0 w-10 h-7 md:w-12 md:h-8 rounded overflow-hidden border",style:{border:E===a.image?"2px solid var(--accent)":"1px solid var(--border)"},title:a.label,children:(0,g.jsx)("img",{src:`data:image/jpeg;base64,${a.image}`,alt:a.label,className:"w-full h-full object-cover"})},b))})]})]})]}),w.length>0&&(0,g.jsx)("div",{className:"p-2 md:p-3 border-t shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,g.jsxs)("div",{className:"flex flex-wrap gap-3 md:gap-4 text-xs md:text-sm",children:[(0,g.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",w.filter(a=>"pass"===a.status).length]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",w.filter(a=>"fail"===a.status).length]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["⚠ ",w.filter(a=>"error"===a.status).length]}),(0,g.jsxs)("span",{className:"ml-auto",style:{color:"var(--text-tertiary)"},children:[Math.round(w.reduce((a,b)=>a+b.duration,0)/1e3),"s"]})]})})]})]}),"scripts"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.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,g.jsxs)("div",{className:"p-3",children:[(0,g.jsx)("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-primary)"},children:"Test Scripts"}),(0,g.jsx)("div",{className:"space-y-1",children:a.map(a=>{let b=!!S[a.id],c=Y===a.id;return(0,g.jsxs)("button",{onClick:()=>{Z(a.id),V(null)},className:"w-full text-left px-3 py-2 text-xs rounded flex items-center gap-2",style:{backgroundColor:c?"var(--bg-secondary)":"transparent",color:"var(--text-primary)",border:c?"1px solid var(--border)":"1px solid transparent"},children:[(0,g.jsx)("span",{className:b?"text-green-500":"text-gray-400",children:b?"✓":"○"}),(0,g.jsxs)("span",{className:"truncate",children:[a.code," - ",a.title]})]},a.id)})})]})}),(0,g.jsx)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:Y?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"p-3 border-b flex items-center justify-between shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[a.find(a=>a.id===Y)?.code," - Script"]}),(0,g.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--text-tertiary)"},children:U?"Editing":"Click Edit to modify"})]}),(0,g.jsx)("div",{className:"flex gap-2 ml-2",children:U?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("button",{onClick:()=>{V(null),X("")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,g.jsx)("button",{onClick:am,className:"px-3 py-1.5 text-xs rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Save"})]}):(0,g.jsx)("button",{onClick:()=>{V(Y),X(S[Y]||"")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"✏️ Edit"})})]}),(0,g.jsx)("div",{className:"flex-1 overflow-auto p-4",style:{backgroundColor:"#1e1e2e"},children:U?(0,g.jsx)("textarea",{value:W,onChange:a=>X(a.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}):S[Y]?(0,g.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap",style:{color:"#cdd6f4"},children:S[Y]}):(0,g.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[(0,g.jsx)("p",{className:"text-sm",style:{color:"#666"},children:"No script generated yet"}),(0,g.jsx)("button",{onClick:aj,disabled:u,className:"px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:u?"Generating...":"Generate Script"})]})})]}):(0,g.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,g.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"text-3xl md:text-4xl mb-3"}),(0,g.jsx)("p",{className:"text-sm",children:"Select a test case to view its script"})]})})})]}),"history"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.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,g.jsxs)("div",{className:"p-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Run History (",d.runs.length,")"]}),d.runs.length>0&&(0,g.jsx)("button",{onClick:d.clearRuns,className:"text-xs underline",style:{color:"var(--status-fail-text)"},children:"Clear All"})]}),0===d.runs.length?(0,g.jsx)("div",{className:"text-center py-8 text-xs",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):(0,g.jsx)("div",{className:"space-y-2",children:d.runs.map(a=>(0,g.jsxs)("div",{className:"p-3 rounded-lg group relative",style:{backgroundColor:$?.id===a.id?"var(--bg-secondary)":"transparent",border:$?.id===a.id?"1px solid var(--border)":"1px solid transparent"},children:[(0,g.jsxs)("button",{onClick:()=>_(a),className:"w-full text-left",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:new Date(a.timestamp).toLocaleString()}),(0,g.jsxs)("span",{className:"text-xs",style:{color:a.totalFailed>0?"var(--status-fail-text)":"var(--status-pass-text)"},children:[a.totalPassed,"✓ ",a.totalFailed,"✗"]})]}),(0,g.jsxs)("div",{className:"text-xs mt-1 truncate",style:{color:"var(--text-tertiary)"},children:[a.config.baseUrl," • ",a.config.browser]})]}),(0,g.jsx)("button",{onClick:()=>{d.deleteRun(a.id),$?.id===a.id&&_(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:"✕"})]},a.id))})]})}),(0,g.jsx)("div",{className:"flex-1 overflow-auto",children:$?(0,g.jsxs)("div",{className:"p-4 space-y-4",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Run Details"}),(0,g.jsx)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:new Date($.timestamp).toLocaleString()})]}),(0,g.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,g.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",$.totalPassed]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",$.totalFailed]})]})]}),(0,g.jsx)("div",{className:"space-y-2",children:$.results.map((a,b)=>(0,g.jsxs)("div",{className:"p-3 rounded-lg",style:{backgroundColor:"var(--bg-secondary)",border:`1px solid ${"pass"===a.status?"var(--status-pass-border)":"var(--status-fail-border)"}`},children:[(0,g.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,g.jsxs)("span",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[a.testCaseCode||`Test ${b+1}`," - ",a.testCaseTitle]}),(0,g.jsx)("span",{className:"text-xs px-2 py-0.5 rounded shrink-0",style:{backgroundColor:"pass"===a.status?"var(--status-pass-bg)":"var(--status-fail-bg)",color:"pass"===a.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:a.status.toUpperCase()})]}),a.error&&(0,g.jsx)("p",{className:"text-xs mt-2 p-2 rounded break-words",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:a.error}),(0,g.jsx)("div",{className:"mt-2 space-y-1",children:a.steps.map((a,b)=>(0,g.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,g.jsx)("span",{className:"shrink-0",style:{color:"pass"===a.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===a.status?"✓":"✗"}),(0,g.jsx)("span",{style:{color:"var(--text-secondary)"},children:a.step})]},b))}),a.aiAnalysis&&(0,g.jsxs)("div",{className:"mt-2 p-2 rounded text-xs break-words",style:{backgroundColor:"var(--bg-primary)",color:"var(--text-secondary)"},children:[(0,g.jsx)("strong",{children:"AI:"})," ",a.aiAnalysis]})]},a.testCaseId))})]}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,g.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"text-3xl md:text-4xl mb-3",children:"\uD83D\uDCCB"}),(0,g.jsx)("p",{className:"text-sm",children:"Select a run to view details"})]})})})]}),(0,g.jsxs)("div",{className:"p-3 md:p-4 border-t flex items-center justify-between shrink-0",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"text-xs truncate max-w-[200px] md:max-w-none",style:{color:"var(--text-tertiary)"},children:[s&&y&&(0,g.jsxs)("span",{children:["Running: ",y.title]}),!s&&w.length>0&&(0,g.jsxs)("span",{children:[w.length," tests completed"]}),!s&&0===w.length&&"runner"===q&&(0,g.jsx)("span",{className:"hidden sm:inline",children:"Config saved per project"})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("button",{onClick:c,disabled:s,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"===q&&(s?(0,g.jsx)("button",{onClick:al,className:"px-3 md:px-4 py-2 text-sm rounded flex items-center gap-2",style:{backgroundColor:"#ef4444",color:"white"},children:"■ Stop"}):(0,g.jsx)("button",{onClick:ak,disabled:0===ac.size,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:"▶ Run"}))]})]})]}),Q&&(0,g.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,g.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,g.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h2",{className:"text-lg font-semibold",style:{color:"var(--text-primary)"},children:"\uD83D\uDD27 Healing Report"}),(0,g.jsx)("p",{className:"text-xs mt-1",style:{color:"var(--text-tertiary)"},children:"AI recommendations"})]}),(0,g.jsx)("button",{onClick:()=>R(!1),className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]}),(0,g.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-xs font-mono break-words",style:{color:"var(--text-secondary)"},children:O})}),(0,g.jsx)("div",{className:"p-4 border-t flex justify-end",style:{borderColor:"var(--border)"},children:(0,g.jsx)("button",{onClick:()=>R(!1),className:"px-4 py-2 text-sm rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Close"})})]})})]})}let dn=c(43249).$;var dp=c(85586),dq=c(39952),dr=c(44013);let ds=40,dt=60,du=140,dv=!1,dw=(d="supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border p-2 backdrop-blur-md",a=>dn(d,null==a?void 0:a.class,null==a?void 0:a.className)),dx=k().forwardRef(({className:a,children:b,iconSize:c=ds,iconMagnification:d=dt,disableMagnification:e=dv,iconDistance:f=du,direction:h="middle",...i},j)=>{let l=(0,dp.d)(1/0);return(0,g.jsx)(o.P.div,{ref:j,onMouseMove:a=>l.set(a.pageX),onMouseLeave:()=>l.set(1/0),...i,className:(0,p.cn)(dw({className:a}),{"items-start":"top"===h,"items-center":"middle"===h,"items-end":"bottom"===h}),children:k().Children.map(b,a=>k().isValidElement(a)&&a.type===dy?k().cloneElement(a,{...a.props,mouseX:l,size:c,magnification:d,disableMagnification:e,distance:f}):a)})});dx.displayName="Dock";let dy=({size:a=ds,magnification:b=dt,disableMagnification:c,distance:d=du,mouseX:e,className:f,children:h,...i})=>{let k=(0,j.useRef)(null),l=Math.max(6,.2*a),m=(0,dp.d)(1/0),n=(0,dq.G)(e??m,a=>{let b=k.current?.getBoundingClientRect()??{x:0,width:0};return a-b.x-b.width/2}),q=c?a:b,r=(0,dq.G)(n,[-d,0,d],[a,q,a]),s=(0,dr.z)(r,{mass:.15,stiffness:120,damping:25});return(0,g.jsx)(o.P.div,{ref:k,style:{width:s,height:s,padding:l},className:(0,p.cn)("flex aspect-square cursor-pointer items-center justify-center rounded-full",c&&"hover:bg-muted-foreground transition-colors",f),...i,children:(0,g.jsx)("div",{children:h})})};dy.displayName="DockIcon";let dz=function(a,...b){let c=new URL("https://base-ui.com/production-error");return c.searchParams.set("code",a.toString()),b.forEach(a=>c.searchParams.append("args[]",a)),`Base UI error #${a}; visit ${c} for the full message.`},dA={};function dB(a,b){let c=j.useRef(dA);return c.current===dA&&(c.current=a(b)),c}function dC(a,b,c,d){var e,f,g,h,i;let j=dB(dD).current;return e=j,f=a,g=b,h=c,i=d,(e.refs[0]!==f||e.refs[1]!==g||e.refs[2]!==h||e.refs[3]!==i)&&dE(j,[a,b,c,d]),j.callback}function dD(){return{callback:null,cleanup:null,refs:[]}}function dE(a,b){if(a.refs=b,b.every(a=>null==a)){a.callback=null;return}a.callback=c=>{if(a.cleanup&&(a.cleanup(),a.cleanup=null),null!=c){let d=Array(b.length).fill(null);for(let a=0;a<b.length;a+=1){let e=b[a];if(null!=e)switch(typeof e){case"function":{let b=e(c);"function"==typeof b&&(d[a]=b);break}case"object":e.current=c}}a.cleanup=()=>{for(let a=0;a<b.length;a+=1){let c=b[a];if(null!=c)switch(typeof c){case"function":{let b=d[a];"function"==typeof b?b():c(null);break}case"object":c.current=null}}}}}}let dF=parseInt(j.version,10);function dG(a){if(!j.isValidElement(a))return null;let b=a.props;return(dF>=19?b?.ref:a.ref)??null}function dH(a,b){return a&&!b?a:!a&&b?b:a||b?{...a,...b}:void 0}Object.freeze([]);let dI=Object.freeze({}),dJ={};function dK(a,b,c,d,e){if(!c&&!d&&!e&&!a)return dL(b);let f=dL(a);return b&&(f=dM(f,b)),c&&(f=dM(f,c)),d&&(f=dM(f,d)),e&&(f=dM(f,e)),f}function dL(a){return dO(a)?{...dP(a,dJ)}:function(a){let b={...a};for(let a in b){let c=b[a];dN(a,c)&&(b[a]=dQ(c))}return b}(a)}function dM(a,b){return dO(b)?dP(b,a):function(a,b){if(!b)return a;for(let c in b){let d=b[c];switch(c){case"style":a[c]=dH(a.style,d);break;case"className":a[c]=dS(a.className,d);break;default:dN(c,d)?a[c]=function(a,b){return b?a?(...c)=>{let d=c[0];if(dT(d)){dR(d);let e=b(...c);return d.baseUIHandlerPrevented||a?.(...c),e}let e=b(...c);return a?.(...c),e}:dQ(b):a}(a[c],d):a[c]=d}}return a}(a,b)}function dN(a,b){let c=a.charCodeAt(0),d=a.charCodeAt(1),e=a.charCodeAt(2);return 111===c&&110===d&&e>=65&&e<=90&&("function"==typeof b||void 0===b)}function dO(a){return"function"==typeof a}function dP(a,b){return dO(a)?a(b):a??dJ}function dQ(a){return a?(...b)=>{let c=b[0];return dT(c)&&dR(c),a(...b)}:a}function dR(a){return a.preventBaseUIHandler=()=>{a.baseUIHandlerPrevented=!0},a}function dS(a,b){return b?a?b+" "+a:b:a}function dT(a){return null!=a&&"object"==typeof a&&"nativeEvent"in a}let dU=Symbol.for("react.lazy"),dV=j.forwardRef(function(a,b){let{className:c,render:d,orientation:e="horizontal",style:f,...g}=a;return function(a,b,c={}){let d=b.render,e=function(a,b={}){let{className:c,style:d,render:e}=a,{state:f=dI,ref:g,props:h,stateAttributesMapping:i,enabled:j=!0}=b,k=j?"function"==typeof c?c(f):c:void 0,l=j?"function"==typeof d?d(f):d:void 0,m=j?function(a,b){let c={};for(let d in a){let e=a[d];if(b?.hasOwnProperty(d)){let a=b[d](e);null!=a&&Object.assign(c,a);continue}!0===e?c[`data-${d.toLowerCase()}`]="":e&&(c[`data-${d.toLowerCase()}`]=e.toString())}return c}(f,i):dI,n=j&&h?function(a){if(Array.isArray(a)){if(0===a.length)return dJ;if(1===a.length)return dL(a[0]);let b=dL(a[0]);for(let c=1;c<a.length;c+=1)b=dM(b,a[c]);return b}return dK(void 0,a)}(h):void 0,o=j?dH(m,n)??{}:dI;return("undefined"!=typeof document&&(j?Array.isArray(g)?o.ref=function(a){var b,c;let d=dB(dD).current;return b=d,c=a,(b.refs.length!==c.length||b.refs.some((a,b)=>a!==c[b]))&&dE(d,a),d.callback}([o.ref,dG(e),...g]):o.ref=dC(o.ref,dG(e),g):dC(null,null)),j)?(void 0!==k&&(o.className=dS(o.className,k)),void 0!==l&&(o.style=dH(o.style,l)),o):dI}(b,c);return!1===c.enabled?null:function(a,b,c,d){if(b){if("function"==typeof b)return b(c,d);let a=dK(c,b.props);a.ref=c.ref;let e=b;return e?.$$typeof===dU&&(e=j.Children.toArray(b)[0]),j.cloneElement(e,a)}if("string"==typeof a){var e,f;return e=a,f=c,"button"===e?(0,j.createElement)("button",{type:"button",...f,key:f.key}):"img"===e?(0,j.createElement)("img",{alt:"",...f,key:f.key}):j.createElement(e,f)}throw Error(dz(8))}("div",d,e,c.state??dI)}(0,a,{state:{orientation:e},ref:b,props:[{role:"separator","aria-orientation":e},g]})});function dW({className:a,orientation:b="horizontal",...c}){return(0,g.jsx)(dV,{"data-slot":"separator",orientation:b,className:(0,p.cn)("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...c})}function dX({selectedNode:a,testCases:b,stats:c,columns:d,projectId:e,fullscreen:f,onAddTestCase:h,onUpdateTestCase:k,onDeleteTestCase:m,onBulkDelete:n,onBulkUpdate:o,onReorderTestCases:p,onReorderColumn:q,onToggleColumn:r,onRenameColumn:s,onUpdateNode:t,onAddColumn:u,onDeleteColumn:v,confirmDialog:A}){(0,l.useRouter)();let[B,C]=(0,j.useState)(!1),[D,E]=(0,j.useState)(!1),[F,K]=(0,j.useState)(!1),[L,M]=(0,j.useState)(!1),[N,O]=(0,j.useState)(!1),[P,Q]=(0,j.useState)(!1),[R,S]=(0,j.useState)(!1),[T,U]=(0,j.useState)(!1),[V,W]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(new Set),[Z,$]=(0,j.useState)(null),[_,aa]=(0,j.useState)("asc"),[ab,ac]=(0,j.useState)(!1),[ad,ae]=(0,j.useState)(""),af=(0,j.useRef)(null),ag=(0,j.useRef)(null),ah=f?d:d.filter(a=>"code"!==a.key),ai=w._X.map(a=>a.key),aj=(0,j.useCallback)(a=>{Y(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ak=(0,j.useCallback)(()=>{X.size===b.length?Y(new Set):Y(new Set(b.map(a=>a.id)))},[X.size,b]),al=(0,j.useCallback)(()=>Y(new Set),[]),am=(0,j.useCallback)(async()=>{a&&0!==X.size&&(!A||await A("Delete Test Cases",`Delete ${X.size} selected test case(s)?`))&&(n(a.id,Array.from(X)),Y(new Set))},[a,X,n,A]),an=(0,j.useCallback)(b=>{a&&0!==X.size&&(o(a.id,Array.from(X),{status:b}),Y(new Set))},[a,X,o]),ao=Z?[...b].sort((a,b)=>{let c=a[Z]||"",d=b[Z]||"",e=c.localeCompare(d);return"asc"===_?e:-e}):b,ap=(0,j.useCallback)(b=>{if(a)for(let c of b)h(a.id,c.title,c.steps,c.expected)},[a,h]),aq=(0,j.useCallback)(b=>{if(a)for(let c of b)h(a.id,c.title,c.steps,c.expected)},[a,h]);return a?(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 flex flex-col h-full relative",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,g.jsx)("h2",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-base font-medium mb-2",children:a.label}),(0,g.jsx)(y,{value:c.passRate})]}),B&&(0,g.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,g.jsx)("label",{style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-xs font-medium mb-1 block",children:"Node Notes"}),(0,g.jsx)("textarea",{value:a.notes??"",onChange:b=>t(a.id,{notes:b.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,g.jsx)("div",{className:"jsx-bc071752c54fb059 px-4 py-3",children:(0,g.jsx)(z,{onAdd:b=>h(a.id,b),nodeLabel:a.label})}),X.size>0&&(0,g.jsxs)("div",{style:{borderColor:"var(--accent)",backgroundColor:"var(--accent)",animation:"fadeInUp 150ms ease-out"},className:"jsx-bc071752c54fb059 mx-4 mb-2 px-3 py-2 rounded-lg border flex items-center gap-3",children:[(0,g.jsxs)("span",{className:"jsx-bc071752c54fb059 text-xs font-medium text-white",children:[X.size," selected"]}),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1"}),["pass","fail","skip","untested"].map(a=>(0,g.jsxs)("button",{onClick:()=>an(a),style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:["Mark ",a.charAt(0).toUpperCase()+a.slice(1)]},a)),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 w-px h-4 bg-white/30"}),(0,g.jsx)("button",{onClick:am,style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"Delete"}),(0,g.jsx)("button",{onClick:al,style:{color:"#fff"},title:"Clear selection",className:"jsx-bc071752c54fb059 px-1.5 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"\xd7"})]}),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1 min-h-0 overflow-auto px-2",children:0===b.length?(0,g.jsx)(x.p,{message:"No test cases yet. Use the quick-add bar or Generate button to add test cases."}):(0,g.jsx)(G,{testCases:ao,columns:ah,expandAll:T,selectedIds:X,onToggleSelect:aj,onToggleSelectAll:ak,sortKey:Z,sortDirection:_,onSortChange:a=>{null===a?$(null):Z===a?aa(a=>"asc"===a?"desc":"asc"):($(a),aa("asc"))},onUpdate:(b,c)=>k(a.id,b,c),onDelete:b=>m(a.id,b),onReorder:b=>p(a.id,b)})}),(0,g.jsx)(H,{stats:c}),(0,g.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:[R&&(0,g.jsxs)("div",{ref:ag,style:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:2,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeInUp 200ms ease-out",width:180},className:"jsx-bc071752c54fb059 absolute z-30 rounded-xl border",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center justify-between px-3 py-2 border-b",children:[(0,g.jsx)("h4",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-[11px] font-semibold",children:"Columns"}),(0,g.jsx)("button",{onClick:()=>S(!1),style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 py-1 max-h-[240px] overflow-y-auto",children:[ah.map((c,d)=>{let e=!ai.includes(c.key);return(0,g.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,g.jsxs)("button",{onClick:()=>a&&r(a.id,c.key),style:{color:c.visible?"var(--text-primary)":"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 flex items-center gap-2 flex-1 text-left",children:[(0,g.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:c.visible?"✓":""}),(0,g.jsx)("span",{className:"jsx-bc071752c54fb059",children:c.label})]}),(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-0.5 opacity-0 group-hover/col:opacity-100 transition-opacity",children:[(0,g.jsx)("button",{onClick:()=>a&&q?.(a.id,c.key,"up"),disabled:0===d,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,g.jsx)("button",{onClick:()=>a&&q?.(a.id,c.key,"down"),disabled:d===ah.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:"↓"}),e&&(0,g.jsx)("button",{onClick:async()=>{if(a&&v)(!b.some(a=>{let b=a[c.key];return b&&"string"==typeof b&&""!==b.trim()})||!A||await A("Delete Column",`This column has data in some test cases. Delete "${c.label}" anyway?`))&&v(a.id,c.key)},style:{color:"var(--status-fail-text)"},title:`Delete ${c.label}`,className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded hover:opacity-100 transition-opacity text-[10px]",children:"\xd7"})]})]},c.key)}),ab?(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 px-3 py-1.5",children:(0,g.jsx)("input",{ref:af,value:ad,onChange:a=>ae(a.target.value),onKeyDown:b=>{"Enter"===b.key&&ad.trim()&&(u?.(a.id,ad.trim()),ae(""),ac(!1)),"Escape"===b.key&&(ac(!1),ae(""))},onBlur:()=>{ad.trim()&&u?.(a.id,ad.trim()),ae(""),ac(!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,g.jsxs)("button",{onClick:()=>ac(!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,g.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:"+"}),(0,g.jsx)("span",{className:"jsx-bc071752c54fb059",children:"Add New Column"})]})]})]}),(0,g.jsxs)(dx,{direction:"middle",iconSize:32,iconMagnification:44,iconDistance:100,children:[(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>M(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"14 2 14 8 20 8",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"10 9 9 9 8 9",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Node Summary"})]})}),(0,g.jsx)(dW,{orientation:"vertical",className:"h-full"}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>C(!B),style:{backgroundColor:B?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:B?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,g.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",className:"jsx-bc071752c54fb059"}),(0,g.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,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Notes"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>E(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 10 12 15 17 10",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Export"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>{let c=(0,I.wy)(a,b,d);navigator.clipboard.writeText(c).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)})},style:{backgroundColor:V?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:V?(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,g.jsx)("polyline",{points:"20 6 9 17 4 12",className:"jsx-bc071752c54fb059"})}):(0,g.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,g.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:V?"Copied!":"Copy as Markdown"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>S(!R),style:{backgroundColor:R?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:R?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,g.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Columns"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>U(a=>!a),style:{backgroundColor:T?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:T?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:T?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 3 3 6 7 9",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 15 21 18 17 21",className:"jsx-bc071752c54fb059"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 3 21 6 17 9",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 15 3 18 7 21",className:"jsx-bc071752c54fb059"})]})})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:T?"Collapse All":"Expand All"})]})}),(0,g.jsx)(dW,{orientation:"vertical",className:"h-full"}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>O(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 8 12 3 7 8",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Import Cases"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>Q(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("circle",{cx:"12",cy:"12",r:"10",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"12 6 12 12 16 14",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"E2E Test"})]})}),(0,g.jsx)(dy,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>K(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",className:"jsx-bc071752c54fb059"})})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Generate"})]})})]})]}),(0,g.jsx)(J,{open:D,onClose:()=>E(!1),node:a,testCases:b,columns:d}),(0,g.jsx)(dg,{open:F,onClose:()=>K(!1),node:a,onGenerate:ap}),(0,g.jsx)(di,{open:L,onClose:()=>M(!1),node:a,testCases:b,stats:c}),(0,g.jsx)(dl,{open:N,onClose:()=>O(!1),onImport:aq,nodeLabel:a.label}),P&&a&&(0,g.jsx)(dm,{testCases:b,projectId:e,onClose:()=>Q(!1)}),(0,g.jsx)(i(),{id:"bc071752c54fb059",children:"@keyframes fadeInUp{from{opacity:0;transform:translatey(8px)}to{opacity:1;transform:translatey(0)}}"})]}):(0,g.jsx)("div",{className:"h-full",children:(0,g.jsx)(x.p,{message:"Select a node from the mindmap to view its test cases."})})}function dY(){let a=(0,l.useParams)(),b=(0,l.useRouter)(),c=a.projectId,{projects:d,activeProject:e,activeProjectId:f,selectedNodeId:h,setSelectedNodeId:k,switchProject:n,mindmap:o,testCases:p,pushState:q,lastSaved:r,canUndo:s,canRedo:t,undo:u,redo:w,confirmDialog:y}=(0,m.M)(),z=d[c]??null;(0,j.useRef)(null);let A=f===c?e:z,B=(0,j.useMemo)(()=>A?.flows.find(a=>a.id===h)??null,[A,h]),[C,D]=(0,j.useState)("mindmap"),[E,F]=(0,j.useState)(.5),[G,H]=(0,j.useState)(!1),[I,J]=(0,j.useState)(!1),[K,L]=(0,j.useState)(!1),[M,N]=(0,j.useState)(!1),O=(0,j.useRef)(null),P=(0,j.useRef)(null),Q=(0,j.useRef)(null),R=(0,j.useRef)(null),S=(0,j.useRef)({mouseX:0,startRatio:.5}),T=(0,j.useCallback)(a=>{a.preventDefault(),S.current={mouseX:a.clientX,startRatio:E},H(!0)},[E]);return z?A?(0,g.jsxs)("div",{className:"jsx-a894832df36b68ca h-full flex flex-col",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},className:"jsx-a894832df36b68ca flex md:hidden border-b flex-shrink-0",children:[(0,g.jsx)("button",{onClick:()=>D("mindmap"),style:{color:"mindmap"===C?"var(--accent)":"var(--text-tertiary)",borderBottom:"mindmap"===C?"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,g.jsx)("button",{onClick:()=>D("testcases"),style:{color:"testcases"===C?"var(--accent)":"var(--text-tertiary)",borderBottom:"testcases"===C?"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,g.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,g.jsx)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-a894832df36b68ca text-[10px]",children:r?(0,g.jsxs)("span",{className:"jsx-a894832df36b68ca",children:["Last saved ",function(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/1e3),d=Math.floor(c/60),e=Math.floor(d/60);return c<10?"just now":c<60?`${c}s ago`:d<60?`${d}m ago`:e<24?`${e}h ago`:b.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(r)]}):(0,g.jsx)("span",{className:"jsx-a894832df36b68ca",children:"Not saved yet"})}),(0,g.jsxs)("div",{className:"jsx-a894832df36b68ca flex items-center gap-2",children:[(0,g.jsx)("button",{onClick:()=>L(a=>!a),style:{color:"var(--text-tertiary)"},title:K?"Exit fullscreen":"Expand test cases",className:"jsx-a894832df36b68ca p-1 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:K?(0,g.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,g.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,g.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,g.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,g.jsx)("button",{onClick:()=>b.push(`/projects/${c}/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,g.jsx)("button",{onClick:()=>{N(!0),setTimeout(()=>N(!1),1500);let a=new Event("save-project");window.dispatchEvent(a)},style:{borderColor:M?"var(--status-pass-text)":"var(--border)",color:M?"var(--status-pass-text)":"var(--text-secondary)",backgroundColor:M?"var(--status-pass-bg)":"transparent"},className:"jsx-a894832df36b68ca px-3 py-1 text-xs font-medium rounded-md border transition-all",children:M?"Saved!":"Save"})]})]}),(0,g.jsxs)("div",{ref:O,style:{cursor:G?"col-resize":void 0},className:"jsx-a894832df36b68ca flex-1 flex min-h-0 relative",children:[!K&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{ref:P,style:{width:`${100*E}%`},className:`jsx-a894832df36b68ca
67
+ ${"pass"===c.status?"✓":"✗"} Test ${c.index} completed: ${c.status.toUpperCase()} (${c.duration}ms)`),c.script&&(T(a=>({...a,[c.testCaseId]:c.script})),d.saveScript(c.testCaseId,c.result?.testCaseTitle||"","",c.script)),m.push(c.result),x([...m]);break;case"complete":af("success","\n═══════════════════════════════════════");let e=c.results.filter(a=>"pass"===a.status).length,g=c.results.filter(a=>"fail"===a.status||"error"===a.status).length;af("success",`Test run complete: ${e} passed, ${g} failed`),d.saveRun({projectId:b,config:{baseUrl:f,browser:i,headless:l,timeout:o},results:c.results,totalPassed:e,totalFailed:g,totalDuration:c.results.reduce((a,b)=>a+b.duration,0),healingReport:O||void 0});break;case"aborted":af("warning","\n━━━ Test run stopped by user ━━━")}}catch{}}}catch(a){a instanceof Error&&"AbortError"===a.name?af("warning","\n━━━ Test run stopped by user ━━━"):af("error",`Error: ${a instanceof Error?a.message:String(a)}`)}t(!1),z(null),aa.current=null},[a,ac,f,i,l,o,af,ai,b,d,O]),al=(0,j.useCallback)(()=>{aa.current&&(af("warning","Stopping test run..."),aa.current.abort())},[af]),am=(0,j.useCallback)(()=>{if(!U||!W)return;let b=a.find(a=>a.id===U);b&&(d.saveScript(b.id,b.title,b.code,W),T(a=>({...a,[b.id]:W})),af("success",`Script saved for ${b.code}`)),V(null),X("")},[U,W,a,d,af]);return(0,g.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,g.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,g.jsxs)("div",{className:"flex items-center justify-between p-3 md:p-4 border-b shrink-0",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsx)("h2",{className:"text-base md:text-lg font-semibold truncate",style:{color:"var(--text-primary)"},children:"E2E Agentic Test Runner"}),(0,g.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,g.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:["runner"===q&&(0,g.jsx)("button",{onClick:()=>L(!K),className:"md:hidden p-1.5 rounded",style:{backgroundColor:K?"var(--accent)":"var(--bg-secondary)",color:K?"white":"var(--text-secondary)"},title:"Toggle config panel",children:"☰"}),(0,g.jsx)("button",{onClick:c,className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]})]}),(0,g.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(a=>(0,g.jsxs)("button",{onClick:()=>r(a.id),className:"px-3 md:px-4 py-2 text-xs flex items-center gap-1.5 transition-colors whitespace-nowrap",style:{backgroundColor:q===a.id?"var(--bg-secondary)":"transparent",color:q===a.id?"var(--accent)":"var(--text-tertiary)",borderBottom:q===a.id?"2px solid var(--accent)":"2px solid transparent"},children:[(0,g.jsx)("span",{children:a.icon}),a.label]},a.id))}),"runner"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.jsx)("div",{className:`${K?"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,g.jsxs)("div",{className:"p-3 md:p-4 space-y-3 md:space-y-4",children:[(0,g.jsxs)("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Configuration"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Target URL"}),(0,g.jsx)("input",{type:"url",value:f,onChange:a=>h(a.target.value),disabled:s,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,g.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Browser"}),(0,g.jsxs)("select",{value:i,onChange:a=>k(a.target.value),disabled:s,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,g.jsx)("option",{value:"chromium",children:"Chromium"}),(0,g.jsx)("option",{value:"firefox",children:"Firefox"}),(0,g.jsx)("option",{value:"webkit",children:"WebKit"}),(0,g.jsx)("option",{value:"edge",children:"Edge"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Timeout (ms)"}),(0,g.jsx)("input",{type:"number",value:o,onChange:a=>p(Number(a.target.value)),disabled:s,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,g.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,g.jsx)("input",{type:"checkbox",checked:l,onChange:a=>n(a.target.checked),disabled:s,className:"accent-[var(--accent)]"}),(0,g.jsx)("span",{style:{color:"var(--text-secondary)"},children:"Run headless"})]})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Test Cases (",ac.size,"/",a.length,")"]}),(0,g.jsx)("button",{onClick:ah,disabled:s,className:"text-xs underline disabled:opacity-50",style:{color:"var(--accent)"},children:ac.size===a.length?"Deselect All":"Select All"})]}),(0,g.jsx)("div",{className:"max-h-[150px] md:max-h-[200px] overflow-auto rounded-lg",style:{border:"1px solid var(--border)"},children:a.map(a=>{let b=w.find(b=>b.testCaseId===a.id);return(0,g.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:ac.has(a.id)?"var(--bg-secondary)":"transparent"},children:[(0,g.jsx)("input",{type:"checkbox",checked:ac.has(a.id),onChange:()=>ag(a.id),disabled:s,className:"accent-[var(--accent)]"}),(0,g.jsx)("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:a.code}),b&&(0,g.jsx)("span",{style:{color:"pass"===b.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===b.status?"✓":"✗"})]},a.id)})})]}),(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)("button",{onClick:aj,disabled:s||u||0===ac.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:u?"⏳ Generating...":"{ } Generate Scripts"}),O&&(0,g.jsx)("button",{onClick:()=>R(!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,g.jsxs)("div",{ref:N,className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,g.jsxs)("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden min-h-0",children:[(0,g.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:[(0,g.jsx)("div",{className:"p-3 border-b",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Execution Log"}),s&&(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),(0,g.jsx)("span",{className:"text-xs truncate max-w-[150px]",style:{color:"var(--text-tertiary)"},children:y?y.title:"Processing..."})]})]})}),(0,g.jsxs)("div",{className:"flex-1 overflow-auto p-3 font-mono text-xs",style:{backgroundColor:"var(--bg-primary)"},children:[0===A.length?(0,g.jsx)("div",{className:"text-center py-8",style:{color:"var(--text-tertiary)"},children:'Click "Run Tests" to start'}):A.map((a,b)=>(0,g.jsx)("div",{className:"py-0.5",style:{color:(a=>{switch(a){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)"}})(a.type)},children:a.message.split("\n").map((a,b)=>(0,g.jsx)("div",{children:a||"\xa0"},b))},b)),(0,g.jsx)("div",{ref:ab})]})]}),(0,g.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:ae}),(0,g.jsxs)("div",{className:"border-t md:border-t-0 md:border-l flex flex-col transition-all duration-200",style:{borderColor:"var(--border)",maxHeight:G?"300px":"36px",minHeight:G?"200px":"36px",width:"auto",flex:G?`0 0 ${I}%`:"0 0 36px",...{}},children:[(0,g.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:()=>H(!G),children:[(0,g.jsx)("span",{className:"text-sm",children:"\uD83D\uDDA5️"}),G&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("h3",{className:"text-sm font-medium flex-1",style:{color:"var(--text-primary)"},children:"Browser Preview"}),(0,g.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:C.length>0?`${C.length} screenshots`:""})]})]}),G&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{backgroundColor:"var(--bg-secondary)"},children:E?(0,g.jsx)("img",{src:`data:image/jpeg;base64,${E}`,alt:"Browser preview",className:"w-full rounded"}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full min-h-[100px] text-xs",style:{color:"#666"},children:s?"Waiting...":"Preview during execution"})}),C.length>0&&(0,g.jsx)("div",{className:"p-2 border-t overflow-x-auto flex gap-1 shrink-0",style:{borderColor:"var(--border)"},children:C.slice(-6).map((a,b)=>(0,g.jsx)("button",{onClick:()=>F(a.image),className:"flex-shrink-0 w-10 h-7 md:w-12 md:h-8 rounded overflow-hidden border",style:{border:E===a.image?"2px solid var(--accent)":"1px solid var(--border)"},title:a.label,children:(0,g.jsx)("img",{src:`data:image/jpeg;base64,${a.image}`,alt:a.label,className:"w-full h-full object-cover"})},b))})]})]})]}),w.length>0&&(0,g.jsx)("div",{className:"p-2 md:p-3 border-t shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,g.jsxs)("div",{className:"flex flex-wrap gap-3 md:gap-4 text-xs md:text-sm",children:[(0,g.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",w.filter(a=>"pass"===a.status).length]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",w.filter(a=>"fail"===a.status).length]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["⚠ ",w.filter(a=>"error"===a.status).length]}),(0,g.jsxs)("span",{className:"ml-auto",style:{color:"var(--text-tertiary)"},children:[Math.round(w.reduce((a,b)=>a+b.duration,0)/1e3),"s"]})]})})]})]}),"scripts"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.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,g.jsxs)("div",{className:"p-3",children:[(0,g.jsx)("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-primary)"},children:"Test Scripts"}),(0,g.jsx)("div",{className:"space-y-1",children:a.map(a=>{let b=!!S[a.id],c=Y===a.id;return(0,g.jsxs)("button",{onClick:()=>{Z(a.id),V(null)},className:"w-full text-left px-3 py-2 text-xs rounded flex items-center gap-2",style:{backgroundColor:c?"var(--bg-secondary)":"transparent",color:"var(--text-primary)",border:c?"1px solid var(--border)":"1px solid transparent"},children:[(0,g.jsx)("span",{className:b?"text-green-500":"text-gray-400",children:b?"✓":"○"}),(0,g.jsxs)("span",{className:"truncate",children:[a.code," - ",a.title]})]},a.id)})})]})}),(0,g.jsx)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:Y?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"p-3 border-b flex items-center justify-between shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[a.find(a=>a.id===Y)?.code," - Script"]}),(0,g.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--text-tertiary)"},children:U?"Editing":"Click Edit to modify"})]}),(0,g.jsx)("div",{className:"flex gap-2 ml-2",children:U?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("button",{onClick:()=>{V(null),X("")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,g.jsx)("button",{onClick:am,className:"px-3 py-1.5 text-xs rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Save"})]}):(0,g.jsx)("button",{onClick:()=>{V(Y),X(S[Y]||"")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"✏️ Edit"})})]}),(0,g.jsx)("div",{className:"flex-1 overflow-auto p-4",style:{backgroundColor:"#1e1e2e"},children:U?(0,g.jsx)("textarea",{value:W,onChange:a=>X(a.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}):S[Y]?(0,g.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap",style:{color:"#cdd6f4"},children:S[Y]}):(0,g.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[(0,g.jsx)("p",{className:"text-sm",style:{color:"#666"},children:"No script generated yet"}),(0,g.jsx)("button",{onClick:aj,disabled:u,className:"px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:u?"Generating...":"Generate Script"})]})})]}):(0,g.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,g.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"text-3xl md:text-4xl mb-3"}),(0,g.jsx)("p",{className:"text-sm",children:"Select a test case to view its script"})]})})})]}),"history"===q&&(0,g.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,g.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,g.jsxs)("div",{className:"p-3",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,g.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Run History (",d.runs.length,")"]}),d.runs.length>0&&(0,g.jsx)("button",{onClick:d.clearRuns,className:"text-xs underline",style:{color:"var(--status-fail-text)"},children:"Clear All"})]}),0===d.runs.length?(0,g.jsx)("div",{className:"text-center py-8 text-xs",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):(0,g.jsx)("div",{className:"space-y-2",children:d.runs.map(a=>(0,g.jsxs)("div",{className:"p-3 rounded-lg group relative",style:{backgroundColor:$?.id===a.id?"var(--bg-secondary)":"transparent",border:$?.id===a.id?"1px solid var(--border)":"1px solid transparent"},children:[(0,g.jsxs)("button",{onClick:()=>_(a),className:"w-full text-left",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:new Date(a.timestamp).toLocaleString()}),(0,g.jsxs)("span",{className:"text-xs",style:{color:a.totalFailed>0?"var(--status-fail-text)":"var(--status-pass-text)"},children:[a.totalPassed,"✓ ",a.totalFailed,"✗"]})]}),(0,g.jsxs)("div",{className:"text-xs mt-1 truncate",style:{color:"var(--text-tertiary)"},children:[a.config.baseUrl," • ",a.config.browser]})]}),(0,g.jsx)("button",{onClick:()=>{d.deleteRun(a.id),$?.id===a.id&&_(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:"✕"})]},a.id))})]})}),(0,g.jsx)("div",{className:"flex-1 overflow-auto",children:$?(0,g.jsxs)("div",{className:"p-4 space-y-4",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Run Details"}),(0,g.jsx)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:new Date($.timestamp).toLocaleString()})]}),(0,g.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,g.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",$.totalPassed]}),(0,g.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",$.totalFailed]})]})]}),(0,g.jsx)("div",{className:"space-y-2",children:$.results.map((a,b)=>(0,g.jsxs)("div",{className:"p-3 rounded-lg",style:{backgroundColor:"var(--bg-secondary)",border:`1px solid ${"pass"===a.status?"var(--status-pass-border)":"var(--status-fail-border)"}`},children:[(0,g.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,g.jsxs)("span",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[a.testCaseCode||`Test ${b+1}`," - ",a.testCaseTitle]}),(0,g.jsx)("span",{className:"text-xs px-2 py-0.5 rounded shrink-0",style:{backgroundColor:"pass"===a.status?"var(--status-pass-bg)":"var(--status-fail-bg)",color:"pass"===a.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:a.status.toUpperCase()})]}),a.error&&(0,g.jsx)("p",{className:"text-xs mt-2 p-2 rounded break-words",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:a.error}),(0,g.jsx)("div",{className:"mt-2 space-y-1",children:a.steps.map((a,b)=>(0,g.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,g.jsx)("span",{className:"shrink-0",style:{color:"pass"===a.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===a.status?"✓":"✗"}),(0,g.jsx)("span",{style:{color:"var(--text-secondary)"},children:a.step})]},b))}),a.aiAnalysis&&(0,g.jsxs)("div",{className:"mt-2 p-2 rounded text-xs break-words",style:{backgroundColor:"var(--bg-primary)",color:"var(--text-secondary)"},children:[(0,g.jsx)("strong",{children:"AI:"})," ",a.aiAnalysis]})]},a.testCaseId))})]}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,g.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,g.jsx)("p",{className:"text-3xl md:text-4xl mb-3",children:"\uD83D\uDCCB"}),(0,g.jsx)("p",{className:"text-sm",children:"Select a run to view details"})]})})})]}),(0,g.jsxs)("div",{className:"p-3 md:p-4 border-t flex items-center justify-between shrink-0",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{className:"text-xs truncate max-w-[200px] md:max-w-none",style:{color:"var(--text-tertiary)"},children:[s&&y&&(0,g.jsxs)("span",{children:["Running: ",y.title]}),!s&&w.length>0&&(0,g.jsxs)("span",{children:[w.length," tests completed"]}),!s&&0===w.length&&"runner"===q&&(0,g.jsx)("span",{className:"hidden sm:inline",children:"Config saved per project"})]}),(0,g.jsxs)("div",{className:"flex gap-2",children:[(0,g.jsx)("button",{onClick:c,disabled:s,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"===q&&(s?(0,g.jsx)("button",{onClick:al,className:"px-3 md:px-4 py-2 text-sm rounded flex items-center gap-2",style:{backgroundColor:"#ef4444",color:"white"},children:"■ Stop"}):(0,g.jsx)("button",{onClick:ak,disabled:0===ac.size,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:"▶ Run"}))]})]})]}),Q&&(0,g.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,g.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,g.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("h2",{className:"text-lg font-semibold",style:{color:"var(--text-primary)"},children:"\uD83D\uDD27 Healing Report"}),(0,g.jsx)("p",{className:"text-xs mt-1",style:{color:"var(--text-tertiary)"},children:"AI recommendations"})]}),(0,g.jsx)("button",{onClick:()=>R(!1),className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]}),(0,g.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,g.jsx)("pre",{className:"whitespace-pre-wrap text-xs font-mono break-words",style:{color:"var(--text-secondary)"},children:O})}),(0,g.jsx)("div",{className:"p-4 border-t flex justify-end",style:{borderColor:"var(--border)"},children:(0,g.jsx)("button",{onClick:()=>R(!1),className:"px-4 py-2 text-sm rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Close"})})]})})]})}let dp=c(43249).$;var dq=c(85586),dr=c(39952),ds=c(44013);let dt=40,du=60,dv=140,dw=!1,dx=(d="supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border p-2 backdrop-blur-md",a=>dp(d,null==a?void 0:a.class,null==a?void 0:a.className)),dy=k().forwardRef(({className:a,children:b,iconSize:c=dt,iconMagnification:d=du,disableMagnification:e=dw,iconDistance:f=dv,direction:h="middle",...i},j)=>{let l=(0,dq.d)(1/0);return(0,g.jsx)(o.P.div,{ref:j,onMouseMove:a=>l.set(a.pageX),onMouseLeave:()=>l.set(1/0),...i,className:(0,p.cn)(dx({className:a}),{"items-start":"top"===h,"items-center":"middle"===h,"items-end":"bottom"===h}),children:k().Children.map(b,a=>k().isValidElement(a)&&a.type===dz?k().cloneElement(a,{...a.props,mouseX:l,size:c,magnification:d,disableMagnification:e,distance:f}):a)})});dy.displayName="Dock";let dz=({size:a=dt,magnification:b=du,disableMagnification:c,distance:d=dv,mouseX:e,className:f,children:h,...i})=>{let k=(0,j.useRef)(null),l=Math.max(6,.2*a),m=(0,dq.d)(1/0),n=(0,dr.G)(e??m,a=>{let b=k.current?.getBoundingClientRect()??{x:0,width:0};return a-b.x-b.width/2}),q=c?a:b,r=(0,dr.G)(n,[-d,0,d],[a,q,a]),s=(0,ds.z)(r,{mass:.15,stiffness:120,damping:25});return(0,g.jsx)(o.P.div,{ref:k,style:{width:s,height:s,padding:l},className:(0,p.cn)("flex aspect-square cursor-pointer items-center justify-center rounded-full",c&&"hover:bg-muted-foreground transition-colors",f),...i,children:(0,g.jsx)("div",{children:h})})};dz.displayName="DockIcon";let dA=function(a,...b){let c=new URL("https://base-ui.com/production-error");return c.searchParams.set("code",a.toString()),b.forEach(a=>c.searchParams.append("args[]",a)),`Base UI error #${a}; visit ${c} for the full message.`},dB={};function dC(a,b){let c=j.useRef(dB);return c.current===dB&&(c.current=a(b)),c}function dD(a,b,c,d){var e,f,g,h,i;let j=dC(dE).current;return e=j,f=a,g=b,h=c,i=d,(e.refs[0]!==f||e.refs[1]!==g||e.refs[2]!==h||e.refs[3]!==i)&&dF(j,[a,b,c,d]),j.callback}function dE(){return{callback:null,cleanup:null,refs:[]}}function dF(a,b){if(a.refs=b,b.every(a=>null==a)){a.callback=null;return}a.callback=c=>{if(a.cleanup&&(a.cleanup(),a.cleanup=null),null!=c){let d=Array(b.length).fill(null);for(let a=0;a<b.length;a+=1){let e=b[a];if(null!=e)switch(typeof e){case"function":{let b=e(c);"function"==typeof b&&(d[a]=b);break}case"object":e.current=c}}a.cleanup=()=>{for(let a=0;a<b.length;a+=1){let c=b[a];if(null!=c)switch(typeof c){case"function":{let b=d[a];"function"==typeof b?b():c(null);break}case"object":c.current=null}}}}}}let dG=parseInt(j.version,10);function dH(a){if(!j.isValidElement(a))return null;let b=a.props;return(dG>=19?b?.ref:a.ref)??null}function dI(a,b){return a&&!b?a:!a&&b?b:a||b?{...a,...b}:void 0}Object.freeze([]);let dJ=Object.freeze({}),dK={};function dL(a,b,c,d,e){if(!c&&!d&&!e&&!a)return dM(b);let f=dM(a);return b&&(f=dN(f,b)),c&&(f=dN(f,c)),d&&(f=dN(f,d)),e&&(f=dN(f,e)),f}function dM(a){return dP(a)?{...dQ(a,dK)}:function(a){let b={...a};for(let a in b){let c=b[a];dO(a,c)&&(b[a]=dR(c))}return b}(a)}function dN(a,b){return dP(b)?dQ(b,a):function(a,b){if(!b)return a;for(let c in b){let d=b[c];switch(c){case"style":a[c]=dI(a.style,d);break;case"className":a[c]=dT(a.className,d);break;default:dO(c,d)?a[c]=function(a,b){return b?a?(...c)=>{let d=c[0];if(dU(d)){dS(d);let e=b(...c);return d.baseUIHandlerPrevented||a?.(...c),e}let e=b(...c);return a?.(...c),e}:dR(b):a}(a[c],d):a[c]=d}}return a}(a,b)}function dO(a,b){let c=a.charCodeAt(0),d=a.charCodeAt(1),e=a.charCodeAt(2);return 111===c&&110===d&&e>=65&&e<=90&&("function"==typeof b||void 0===b)}function dP(a){return"function"==typeof a}function dQ(a,b){return dP(a)?a(b):a??dK}function dR(a){return a?(...b)=>{let c=b[0];return dU(c)&&dS(c),a(...b)}:a}function dS(a){return a.preventBaseUIHandler=()=>{a.baseUIHandlerPrevented=!0},a}function dT(a,b){return b?a?b+" "+a:b:a}function dU(a){return null!=a&&"object"==typeof a&&"nativeEvent"in a}let dV=Symbol.for("react.lazy"),dW=j.forwardRef(function(a,b){let{className:c,render:d,orientation:e="horizontal",style:f,...g}=a;return function(a,b,c={}){let d=b.render,e=function(a,b={}){let{className:c,style:d,render:e}=a,{state:f=dJ,ref:g,props:h,stateAttributesMapping:i,enabled:j=!0}=b,k=j?"function"==typeof c?c(f):c:void 0,l=j?"function"==typeof d?d(f):d:void 0,m=j?function(a,b){let c={};for(let d in a){let e=a[d];if(b?.hasOwnProperty(d)){let a=b[d](e);null!=a&&Object.assign(c,a);continue}!0===e?c[`data-${d.toLowerCase()}`]="":e&&(c[`data-${d.toLowerCase()}`]=e.toString())}return c}(f,i):dJ,n=j&&h?function(a){if(Array.isArray(a)){if(0===a.length)return dK;if(1===a.length)return dM(a[0]);let b=dM(a[0]);for(let c=1;c<a.length;c+=1)b=dN(b,a[c]);return b}return dL(void 0,a)}(h):void 0,o=j?dI(m,n)??{}:dJ;return("undefined"!=typeof document&&(j?Array.isArray(g)?o.ref=function(a){var b,c;let d=dC(dE).current;return b=d,c=a,(b.refs.length!==c.length||b.refs.some((a,b)=>a!==c[b]))&&dF(d,a),d.callback}([o.ref,dH(e),...g]):o.ref=dD(o.ref,dH(e),g):dD(null,null)),j)?(void 0!==k&&(o.className=dT(o.className,k)),void 0!==l&&(o.style=dI(o.style,l)),o):dJ}(b,c);return!1===c.enabled?null:function(a,b,c,d){if(b){if("function"==typeof b)return b(c,d);let a=dL(c,b.props);a.ref=c.ref;let e=b;return e?.$$typeof===dV&&(e=j.Children.toArray(b)[0]),j.cloneElement(e,a)}if("string"==typeof a){var e,f;return e=a,f=c,"button"===e?(0,j.createElement)("button",{type:"button",...f,key:f.key}):"img"===e?(0,j.createElement)("img",{alt:"",...f,key:f.key}):j.createElement(e,f)}throw Error(dA(8))}("div",d,e,c.state??dJ)}(0,a,{state:{orientation:e},ref:b,props:[{role:"separator","aria-orientation":e},g]})});function dX({className:a,orientation:b="horizontal",...c}){return(0,g.jsx)(dW,{"data-slot":"separator",orientation:b,className:(0,p.cn)("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...c})}function dY({selectedNode:a,testCases:b,stats:c,columns:d,projectId:e,fullscreen:f,onAddTestCase:h,onUpdateTestCase:k,onDeleteTestCase:m,onBulkDelete:n,onBulkUpdate:o,onReorderTestCases:p,onReorderColumn:q,onToggleColumn:r,onRenameColumn:s,onUpdateNode:t,onAddColumn:u,onDeleteColumn:v,confirmDialog:A}){(0,l.useRouter)();let[B,C]=(0,j.useState)(!1),[D,E]=(0,j.useState)(!1),[F,K]=(0,j.useState)(!1),[L,M]=(0,j.useState)(!1),[N,O]=(0,j.useState)(!1),[P,Q]=(0,j.useState)(!1),[R,S]=(0,j.useState)(!1),[T,U]=(0,j.useState)(!1),[V,W]=(0,j.useState)(!1),[X,Y]=(0,j.useState)(new Set),[Z,$]=(0,j.useState)(null),[_,aa]=(0,j.useState)("asc"),[ab,ac]=(0,j.useState)(!1),[ad,ae]=(0,j.useState)(""),af=(0,j.useRef)(null),ag=(0,j.useRef)(null),ah=f?d:d.filter(a=>"code"!==a.key),ai=w._X.map(a=>a.key),aj=(0,j.useCallback)(a=>{Y(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ak=(0,j.useCallback)(()=>{X.size===b.length?Y(new Set):Y(new Set(b.map(a=>a.id)))},[X.size,b]),al=(0,j.useCallback)(()=>Y(new Set),[]),am=(0,j.useCallback)(async()=>{a&&0!==X.size&&(!A||await A("Delete Test Cases",`Delete ${X.size} selected test case(s)?`))&&(n(a.id,Array.from(X)),Y(new Set))},[a,X,n,A]),an=(0,j.useCallback)(b=>{a&&0!==X.size&&(o(a.id,Array.from(X),{status:b}),Y(new Set))},[a,X,o]),ao=Z?[...b].sort((a,b)=>{let c=a[Z]||"",d=b[Z]||"",e=c.localeCompare(d);return"asc"===_?e:-e}):b,ap=(0,j.useCallback)(b=>{if(a)for(let c of b)h(a.id,c.title,c.steps,c.expected)},[a,h]),aq=(0,j.useCallback)(b=>{if(a)for(let c of b)h(a.id,c.title,c.steps,c.expected)},[a,h]);return a?(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 flex flex-col h-full relative",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,g.jsx)("h2",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-base font-medium mb-2",children:a.label}),(0,g.jsx)(y,{value:c.passRate})]}),B&&(0,g.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,g.jsx)("label",{style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-xs font-medium mb-1 block",children:"Node Notes"}),(0,g.jsx)("textarea",{value:a.notes??"",onChange:b=>t(a.id,{notes:b.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,g.jsx)("div",{className:"jsx-bc071752c54fb059 px-4 py-3",children:(0,g.jsx)(z,{onAdd:b=>h(a.id,b),nodeLabel:a.label})}),X.size>0&&(0,g.jsxs)("div",{style:{borderColor:"var(--accent)",backgroundColor:"var(--accent)",animation:"fadeInUp 150ms ease-out"},className:"jsx-bc071752c54fb059 mx-4 mb-2 px-3 py-2 rounded-lg border flex items-center gap-3",children:[(0,g.jsxs)("span",{className:"jsx-bc071752c54fb059 text-xs font-medium text-white",children:[X.size," selected"]}),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1"}),["pass","fail","skip","untested"].map(a=>(0,g.jsxs)("button",{onClick:()=>an(a),style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:["Mark ",a.charAt(0).toUpperCase()+a.slice(1)]},a)),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 w-px h-4 bg-white/30"}),(0,g.jsx)("button",{onClick:am,style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"Delete"}),(0,g.jsx)("button",{onClick:al,style:{color:"#fff"},title:"Clear selection",className:"jsx-bc071752c54fb059 px-1.5 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"\xd7"})]}),(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1 min-h-0 overflow-auto px-2",children:0===b.length?(0,g.jsx)(x.p,{message:"No test cases yet. Use the quick-add bar or Generate button to add test cases."}):(0,g.jsx)(G,{testCases:ao,columns:ah,expandAll:T,selectedIds:X,onToggleSelect:aj,onToggleSelectAll:ak,sortKey:Z,sortDirection:_,onSortChange:a=>{null===a?$(null):Z===a?aa(a=>"asc"===a?"desc":"asc"):($(a),aa("asc"))},onUpdate:(b,c)=>k(a.id,b,c),onDelete:b=>m(a.id,b),onReorder:b=>p(a.id,b)})}),(0,g.jsx)(H,{stats:c}),(0,g.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:[R&&(0,g.jsxs)("div",{ref:ag,style:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:2,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeInUp 200ms ease-out",width:180},className:"jsx-bc071752c54fb059 absolute z-30 rounded-xl border",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center justify-between px-3 py-2 border-b",children:[(0,g.jsx)("h4",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-[11px] font-semibold",children:"Columns"}),(0,g.jsx)("button",{onClick:()=>S(!1),style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 py-1 max-h-[240px] overflow-y-auto",children:[ah.map((c,d)=>{let e=!ai.includes(c.key);return(0,g.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,g.jsxs)("button",{onClick:()=>a&&r(a.id,c.key),style:{color:c.visible?"var(--text-primary)":"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 flex items-center gap-2 flex-1 text-left",children:[(0,g.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:c.visible?"✓":""}),(0,g.jsx)("span",{className:"jsx-bc071752c54fb059",children:c.label})]}),(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-0.5 opacity-0 group-hover/col:opacity-100 transition-opacity",children:[(0,g.jsx)("button",{onClick:()=>a&&q?.(a.id,c.key,"up"),disabled:0===d,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,g.jsx)("button",{onClick:()=>a&&q?.(a.id,c.key,"down"),disabled:d===ah.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:"↓"}),e&&(0,g.jsx)("button",{onClick:async()=>{if(a&&v)(!b.some(a=>{let b=a[c.key];return b&&"string"==typeof b&&""!==b.trim()})||!A||await A("Delete Column",`This column has data in some test cases. Delete "${c.label}" anyway?`))&&v(a.id,c.key)},style:{color:"var(--status-fail-text)"},title:`Delete ${c.label}`,className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded hover:opacity-100 transition-opacity text-[10px]",children:"\xd7"})]})]},c.key)}),ab?(0,g.jsx)("div",{className:"jsx-bc071752c54fb059 px-3 py-1.5",children:(0,g.jsx)("input",{ref:af,value:ad,onChange:a=>ae(a.target.value),onKeyDown:b=>{"Enter"===b.key&&ad.trim()&&(u?.(a.id,ad.trim()),ae(""),ac(!1)),"Escape"===b.key&&(ac(!1),ae(""))},onBlur:()=>{ad.trim()&&u?.(a.id,ad.trim()),ae(""),ac(!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,g.jsxs)("button",{onClick:()=>ac(!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,g.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:"+"}),(0,g.jsx)("span",{className:"jsx-bc071752c54fb059",children:"Add New Column"})]})]})]}),(0,g.jsxs)(dy,{direction:"middle",iconSize:32,iconMagnification:44,iconDistance:100,children:[(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>M(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"14 2 14 8 20 8",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"10 9 9 9 8 9",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Node Summary"})]})}),(0,g.jsx)(dX,{orientation:"vertical",className:"h-full"}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>C(!B),style:{backgroundColor:B?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:B?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,g.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",className:"jsx-bc071752c54fb059"}),(0,g.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,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Notes"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>E(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 10 12 15 17 10",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Export"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>{let c=(0,I.wy)(a,b,d);navigator.clipboard.writeText(c).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)})},style:{backgroundColor:V?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:V?(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,g.jsx)("polyline",{points:"20 6 9 17 4 12",className:"jsx-bc071752c54fb059"})}):(0,g.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,g.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:V?"Copied!":"Copy as Markdown"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>S(!R),style:{backgroundColor:R?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:R?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,g.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Columns"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>U(a=>!a),style:{backgroundColor:T?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,g.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:T?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:T?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 3 3 6 7 9",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 15 21 18 17 21",className:"jsx-bc071752c54fb059"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 3 21 6 17 9",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"7 15 3 18 7 21",className:"jsx-bc071752c54fb059"})]})})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:T?"Collapse All":"Expand All"})]})}),(0,g.jsx)(dX,{orientation:"vertical",className:"h-full"}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>O(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"17 8 12 3 7 8",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Import Cases"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>Q(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("circle",{cx:"12",cy:"12",r:"10",className:"jsx-bc071752c54fb059"}),(0,g.jsx)("polyline",{points:"12 6 12 12 16 14",className:"jsx-bc071752c54fb059"})]})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"E2E Test"})]})}),(0,g.jsx)(dz,{children:(0,g.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,g.jsx)("button",{onClick:()=>K(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,g.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,g.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",className:"jsx-bc071752c54fb059"})})}),(0,g.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Generate"})]})})]})]}),(0,g.jsx)(J,{open:D,onClose:()=>E(!1),node:a,testCases:b,columns:d}),(0,g.jsx)(dh,{open:F,onClose:()=>K(!1),node:a,onGenerate:ap}),(0,g.jsx)(dj,{open:L,onClose:()=>M(!1),node:a,testCases:b,stats:c}),(0,g.jsx)(dm,{open:N,onClose:()=>O(!1),onImport:aq,nodeLabel:a.label}),P&&a&&(0,g.jsx)(dn,{testCases:b,projectId:e,onClose:()=>Q(!1)}),(0,g.jsx)(i(),{id:"bc071752c54fb059",children:"@keyframes fadeInUp{from{opacity:0;transform:translatey(8px)}to{opacity:1;transform:translatey(0)}}"})]}):(0,g.jsx)("div",{className:"h-full",children:(0,g.jsx)(x.p,{message:"Select a node from the mindmap to view its test cases."})})}function dZ({nodes:a,testCases:b,onSelectNode:c,onClose:d}){let[e,f]=(0,j.useState)(""),[h,i]=(0,j.useState)(0),k=(0,j.useRef)(null),l=(0,j.useRef)(null),m=(0,j.useMemo)(()=>{if(!e.trim())return[];let c=e.toLowerCase().trim(),d=[];for(let e of a)for(let a of b[e.id]??[]){let b=a.title.toLowerCase().includes(c),f=a.steps.toLowerCase().includes(c),g=a.expected.toLowerCase().includes(c),h=a.code.toLowerCase().includes(c);if(b||f||g||h){let b="title",c=a.title;f?(b="steps",c=a.steps):g?(b="expected",c=a.expected):h&&(b="code",c=a.code),d.push({node:e,testCase:a,matchField:b,matchText:c})}}return d},[e,a,b]),n=(0,j.useCallback)(a=>{c(a.node.id),d()},[c,d]),o=(0,j.useCallback)(a=>{"Escape"===a.key?d():"ArrowDown"===a.key?(a.preventDefault(),i(a=>Math.min(a+1,m.length-1))):"ArrowUp"===a.key?(a.preventDefault(),i(a=>Math.max(a-1,0))):"Enter"===a.key&&m.length>0&&(a.preventDefault(),n(m[h]))},[m,h,n,d]),p=(a,b)=>{if(!b.trim())return a;let c=a.toLowerCase().indexOf(b.toLowerCase());if(-1===c)return a;let d=a.slice(0,c),e=a.slice(c,c+b.length),f=a.slice(c+b.length);return(0,g.jsxs)(g.Fragment,{children:[d.length>30&&"...",d.length>30?d.slice(-30):d,(0,g.jsx)("mark",{style:{backgroundColor:"var(--accent)",color:"#fff",borderRadius:2,padding:"0 1px"},children:e}),f.slice(0,40),f.length>40&&"..."]})},q={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)"}};return(0,g.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:d,children:(0,g.jsxs)("div",{className:"w-full max-w-lg rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:a=>a.stopPropagation(),children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:"var(--border)"},children:[(0,g.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,g.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,g.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,g.jsx)("input",{ref:k,value:e,onChange:a=>f(a.target.value),onKeyDown:o,placeholder:"Search test cases...",className:"flex-1 bg-transparent outline-none text-sm",style:{color:"var(--text-primary)"}}),(0,g.jsx)("kbd",{className:"text-[10px] px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"ESC"})]}),(0,g.jsxs)("div",{ref:l,className:"max-h-[300px] overflow-y-auto",children:[e.trim()&&0===m.length&&(0,g.jsx)("div",{className:"px-4 py-8 text-center",children:(0,g.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["No test cases found for “",e,"”"]})}),m.map((a,b)=>{let c=q[a.testCase.status]||q.untested;return(0,g.jsxs)("div",{"data-search-item":!0,className:"flex items-start gap-3 px-4 py-2.5 cursor-pointer transition-colors",style:{backgroundColor:b===h?"var(--bg-secondary)":"transparent",borderLeft:b===h?"2px solid var(--accent)":"2px solid transparent"},onClick:()=>n(a),onMouseEnter:()=>i(b),children:[(0,g.jsx)("div",{className:"w-2 h-2 rounded-full mt-1.5 flex-shrink-0",style:{backgroundColor:c.text}}),(0,g.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,g.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,g.jsx)("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)"},children:a.node.code||a.node.label})}),(0,g.jsx)("div",{className:"text-xs font-medium truncate",style:{color:"var(--text-primary)"},children:p(a.testCase.title,e)}),"title"!==a.matchField&&(0,g.jsxs)("div",{className:"text-[11px] truncate mt-0.5",style:{color:"var(--text-tertiary)"},children:[(0,g.jsxs)("span",{className:"font-medium",style:{color:"var(--text-secondary)"},children:[a.matchField,":"]})," ",p(a.matchText,e)]})]}),(0,g.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0",style:{backgroundColor:c.bg,color:c.text},children:a.testCase.status})]},`${a.node.id}-${a.testCase.id}`)})]}),e.trim()&&m.length>0&&(0,g.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-t",style:{borderColor:"var(--border)"},children:[(0,g.jsxs)("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[m.length," result",1!==m.length?"s":""]}),(0,g.jsxs)("div",{className:"flex items-center gap-1",children:[(0,g.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↑↓"}),(0,g.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"navigate"})]}),(0,g.jsxs)("div",{className:"flex items-center gap-1",children:[(0,g.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↵"}),(0,g.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"go to node"})]})]})]})})}function d$(){let a=(0,l.useParams)(),b=(0,l.useRouter)(),c=a.projectId,{projects:d,activeProject:e,activeProjectId:f,selectedNodeId:h,setSelectedNodeId:k,switchProject:n,mindmap:o,testCases:p,pushState:q,lastSaved:r,canUndo:s,canRedo:t,undo:u,redo:w,confirmDialog:y}=(0,m.M)(),z=d[c]??null;(0,j.useRef)(null);let A=f===c?e:z,B=(0,j.useMemo)(()=>A?.flows.find(a=>a.id===h)??null,[A,h]),[C,D]=(0,j.useState)("mindmap"),[E,F]=(0,j.useState)(!1),[G,H]=(0,j.useState)(.5),[I,J]=(0,j.useState)(!1),[K,L]=(0,j.useState)(!1),[M,N]=(0,j.useState)(!1),[O,P]=(0,j.useState)(!1),Q=(0,j.useRef)(null),R=(0,j.useRef)(null),S=(0,j.useRef)(null),T=(0,j.useRef)(null),U=(0,j.useRef)({mouseX:0,startRatio:.5}),V=(0,j.useCallback)(a=>{a.preventDefault(),U.current={mouseX:a.clientX,startRatio:G},J(!0)},[G]);return z?A?(0,g.jsxs)("div",{className:"jsx-a894832df36b68ca h-full flex flex-col",children:[(0,g.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},className:"jsx-a894832df36b68ca flex md:hidden border-b flex-shrink-0",children:[(0,g.jsx)("button",{onClick:()=>D("mindmap"),style:{color:"mindmap"===C?"var(--accent)":"var(--text-tertiary)",borderBottom:"mindmap"===C?"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,g.jsx)("button",{onClick:()=>D("testcases"),style:{color:"testcases"===C?"var(--accent)":"var(--text-tertiary)",borderBottom:"testcases"===C?"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,g.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,g.jsx)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-a894832df36b68ca text-[10px]",children:r?(0,g.jsxs)("span",{className:"jsx-a894832df36b68ca",children:["Last saved ",function(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/1e3),d=Math.floor(c/60),e=Math.floor(d/60);return c<10?"just now":c<60?`${c}s ago`:d<60?`${d}m ago`:e<24?`${e}h ago`:b.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(r)]}):(0,g.jsx)("span",{className:"jsx-a894832df36b68ca",children:"Not saved yet"})}),(0,g.jsxs)("div",{className:"jsx-a894832df36b68ca flex items-center gap-2",children:[(0,g.jsxs)("button",{onClick:()=>F(!0),style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},title:"Search test cases (Ctrl+K)",className:"jsx-a894832df36b68ca flex items-center gap-1.5 px-2 py-1 rounded-md border text-[11px] transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,g.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,g.jsx)("circle",{cx:"11",cy:"11",r:"8",className:"jsx-a894832df36b68ca"}),(0,g.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65",className:"jsx-a894832df36b68ca"})]}),(0,g.jsx)("span",{className:"jsx-a894832df36b68ca hidden sm:inline",children:"Search"}),(0,g.jsx)("kbd",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-a894832df36b68ca text-[9px] px-1 py-0.5 rounded border ml-1 hidden sm:inline",children:"⌘K"})]}),(0,g.jsx)("button",{onClick:()=>N(a=>!a),style:{color:"var(--text-tertiary)"},title:M?"Exit fullscreen":"Expand test cases",className:"jsx-a894832df36b68ca p-1 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:M?(0,g.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,g.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,g.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,g.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,g.jsx)("button",{onClick:()=>b.push(`/projects/${c}/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,g.jsx)("button",{onClick:()=>{P(!0),setTimeout(()=>P(!1),1500);let a=new Event("save-project");window.dispatchEvent(a)},style:{borderColor:O?"var(--status-pass-text)":"var(--border)",color:O?"var(--status-pass-text)":"var(--text-secondary)",backgroundColor:O?"var(--status-pass-bg)":"transparent"},className:"jsx-a894832df36b68ca px-3 py-1 text-xs font-medium rounded-md border transition-all",children:O?"Saved!":"Save"})]})]}),(0,g.jsxs)("div",{ref:Q,style:{cursor:I?"col-resize":void 0},className:"jsx-a894832df36b68ca flex-1 flex min-h-0 relative",children:[!M&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{ref:R,style:{width:`${100*G}%`},className:`jsx-a894832df36b68ca
68
68
  ${"mindmap"===C?"flex":"hidden"}
69
69
  md:flex flex-col min-w-0 mobile-full-width
70
- `,children:(0,g.jsx)(v,{nodes:o.nodes,edges:o.edges,testCases:A.testCases??{},selectedNodeId:h,onSelect:o.selectNode,onAddNode:(a,b,c,d)=>{q("Add node"),o.addNode(a,b,c,d)},onDeleteNode:a=>{q("Delete node"),o.deleteNode(a)},onDeleteNodes:a=>{q("Delete nodes"),o.deleteNodes(a)},onUnlinkNode:a=>{q("Unlink node"),o.unlinkNode(a)},onRenameNode:(a,b)=>{q("Rename node"),o.renameNode(a,b)},onUpdateNode:(a,b)=>{q("Update node"),o.updateNode(a,b)},onAddEdge:(a,b,c)=>{q("Add edge"),o.addEdge(a,b,c)},onDeleteEdge:a=>{q("Delete edge"),o.deleteEdge(a)},onUpdateEdge:(a,b)=>{q("Update edge"),o.updateEdge(a,b)},onResetLayout:()=>{q("Reset layout"),o.resetLayout()},canUndo:s,canRedo:t,onUndo:u,onRedo:w})}),(0,g.jsxs)("div",{ref:R,style:{width:20,cursor:"col-resize"},onMouseDown:T,onMouseEnter:()=>J(!0),onMouseLeave:()=>J(!1),className:"jsx-a894832df36b68ca hidden md:flex items-center justify-center flex-shrink-0 select-none relative group",children:[(0,g.jsx)("div",{style:{backgroundColor:I||G?"var(--bg-secondary)":"transparent"},className:"jsx-a894832df36b68ca absolute inset-y-0 -left-2 -right-2 transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:"var(--border)",opacity:I||G?0:1},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[1px] transition-opacity duration-150"}),(0,g.jsx)("div",{style:{background:"linear-gradient(180deg, #9E7AFF 0%, #FE8BBB 50%, #9E7AFF 100%)",opacity:I||G?.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,g.jsxs)("div",{className:"jsx-a894832df36b68ca relative z-10 flex flex-col gap-1.5",children:[(0,g.jsx)("div",{style:{backgroundColor:I||G?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:I||G?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:I||G?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"})]})]})]}),(0,g.jsx)("div",{ref:Q,style:{width:K?"100%":`${(1-E)*100}%`},className:`jsx-a894832df36b68ca
70
+ `,children:(0,g.jsx)(v,{nodes:o.nodes,edges:o.edges,testCases:A.testCases??{},selectedNodeId:h,onSelect:o.selectNode,onAddNode:(a,b,c,d)=>{q("Add node"),o.addNode(a,b,c,d)},onDeleteNode:a=>{q("Delete node"),o.deleteNode(a)},onDeleteNodes:a=>{q("Delete nodes"),o.deleteNodes(a)},onUnlinkNode:a=>{q("Unlink node"),o.unlinkNode(a)},onRenameNode:(a,b)=>{q("Rename node"),o.renameNode(a,b)},onUpdateNode:(a,b)=>{q("Update node"),o.updateNode(a,b)},onAddEdge:(a,b,c)=>{q("Add edge"),o.addEdge(a,b,c)},onDeleteEdge:a=>{q("Delete edge"),o.deleteEdge(a)},onUpdateEdge:(a,b)=>{q("Update edge"),o.updateEdge(a,b)},onResetLayout:()=>{q("Reset layout"),o.resetLayout()},canUndo:s,canRedo:t,onUndo:u,onRedo:w})}),(0,g.jsxs)("div",{ref:T,style:{width:20,cursor:"col-resize"},onMouseDown:V,onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:"jsx-a894832df36b68ca hidden md:flex items-center justify-center flex-shrink-0 select-none relative group",children:[(0,g.jsx)("div",{style:{backgroundColor:K||I?"var(--bg-secondary)":"transparent"},className:"jsx-a894832df36b68ca absolute inset-y-0 -left-2 -right-2 transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:"var(--border)",opacity:K||I?0:1},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[1px] transition-opacity duration-150"}),(0,g.jsx)("div",{style:{background:"linear-gradient(180deg, #9E7AFF 0%, #FE8BBB 50%, #9E7AFF 100%)",opacity:K||I?.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,g.jsxs)("div",{className:"jsx-a894832df36b68ca relative z-10 flex flex-col gap-1.5",children:[(0,g.jsx)("div",{style:{backgroundColor:K||I?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:K||I?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,g.jsx)("div",{style:{backgroundColor:K||I?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"})]})]})]}),(0,g.jsx)("div",{ref:S,style:{width:M?"100%":`${(1-G)*100}%`},className:`jsx-a894832df36b68ca
71
71
  ${"testcases"===C?"flex":"hidden"}
72
72
  md:flex flex-col min-w-0 mobile-full-width
73
- `,children:(0,g.jsx)(dX,{selectedNode:B,testCases:p.testCases,stats:p.stats,columns:h?A.columnConfigs?.[h]??A.columnConfig??[]:A.columnConfig??[],projectId:c,fullscreen:K,onAddTestCase:p.addTestCase,onUpdateTestCase:p.updateTestCase,onDeleteTestCase:p.deleteTestCase,onBulkDelete:p.bulkDeleteTestCases,onBulkUpdate:p.bulkUpdateTestCases,onReorderTestCases:p.reorderTestCases,onToggleColumn:p.toggleColumnVisibility,onRenameColumn:p.updateColumnConfig,onUpdateNode:o.updateNode,onAddColumn:p.addColumn,onDeleteColumn:p.deleteColumn,onReorderColumn:p.reorderColumn,confirmDialog:y})})]}),(0,g.jsx)(i(),{id:"a894832df36b68ca",children:"@media(max-width:767px){.mobile-full-width.jsx-a894832df36b68ca{width:100%!important}}"})]}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,g.jsx)("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading project..."})}):(0,g.jsx)(x.p,{message:"Project not found.",action:{label:"Back to Projects",onClick:()=>b.push("/projects")}})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74075:a=>{"use strict";a.exports=require("zlib")},79428:a=>{"use strict";a.exports=require("buffer")},79472:(a,b,c)=>{"use strict";c.d(b,{Pj:()=>d});let d=Object.values({openai:{id:"openai",name:"OpenAI",type:"native",description:"GPT models powering ChatGPT. Industry-leading language understanding.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openai.svg",keyUrl:"https://platform.openai.com/api-keys",keyPlaceholder:"sk-...",color:"#10A37F",sdkProvider:"openai",defaultModel:"gpt-4o-mini",popularModels:["gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"]},google:{id:"google",name:"Google Gemini",type:"native",description:"Google's multimodal AI with strong reasoning capabilities.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/googlegemini.svg",keyUrl:"https://aistudio.google.com/apikey",keyPlaceholder:"AIza...",color:"#4285F4",sdkProvider:"google",defaultModel:"gemini-2.5-flash",popularModels:["gemini-2.5-flash","gemini-2.5-pro","gemini-2.0-flash"]},anthropic:{id:"anthropic",name:"Anthropic",type:"native",description:"Claude models — safe, steerable, and highly capable.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/anthropic.svg",keyUrl:"https://console.anthropic.com/settings/keys",keyPlaceholder:"sk-ant-...",color:"#D97706",sdkProvider:"anthropic",defaultModel:"claude-sonnet-4-20250514",popularModels:["claude-sonnet-4-20250514","claude-haiku-4-20250514","claude-3-5-sonnet-20241022"]},deepseek:{id:"deepseek",name:"DeepSeek",type:"openai-compatible",description:"High-performance open-source models with competitive reasoning.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/deepseek.svg",keyUrl:"https://platform.deepseek.com/api_keys",keyPlaceholder:"sk-...",color:"#4D6BFE",sdkProvider:"openai",baseURL:"https://api.deepseek.com/v1",defaultModel:"deepseek-chat",popularModels:["deepseek-chat","deepseek-reasoner"]},xiaomi:{id:"xiaomi",name:"Xiaomi (MiMo)",type:"openai-compatible",description:"Xiaomi's MiMo models — OpenAI-compatible API.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/xiaomi.svg",keyUrl:"https://platform.xiaomimimo.com/",keyPlaceholder:"tp-...",color:"#FF6900",sdkProvider:"openai",baseURL:"https://token-plan-sgp.xiaomimimo.com/v1",defaultModel:"mimo-v2.5",popularModels:["mimo-v2.5","mimo-v2.5-pro"]},openrouter:{id:"openrouter",name:"OpenRouter",type:"openai-compatible",description:"Unified gateway to 200+ models — Claude, Llama, Mistral, Gemini, and more.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openrouter.svg",keyUrl:"https://openrouter.ai/keys",keyPlaceholder:"sk-or-...",color:"#6366F1",sdkProvider:"openai",baseURL:"https://openrouter.ai/api/v1",defaultModel:"openrouter/free",popularModels:["openrouter/free","meta-llama/llama-4-maverick:free","google/gemini-2.5-flash:free","deepseek/deepseek-chat-v3-0324:free","mistralai/mistral-small-3.2-24b:free","qwen/qwen3-235b-a22b:free","microsoft/phi-4-reasoning-plus:free"]},groq:{id:"groq",name:"Groq",type:"native",description:"Ultra-fast inference with LPU hardware. Blazing speed for Llama, Mixtral, and Gemma models.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/groq.svg",keyUrl:"https://console.groq.com/keys",keyPlaceholder:"gsk_...",color:"#F55036",sdkProvider:"groq",defaultModel:"llama-3.3-70b-versatile",popularModels:["llama-3.3-70b-versatile","llama-3.1-8b-instant","mixtral-8x7b-32768","gemma2-9b-it","meta-llama/llama-4-scout-17b-16e-instruct","qwen-qwq-32b"]},custom:{id:"custom",name:"Custom (OpenAI-compatible)",type:"openai-compatible",description:"Any OpenAI-compatible API — Ollama, LM Studio, vLLM, LiteLLM, etc.",logoUrl:"",keyUrl:"",keyPlaceholder:"sk-... or any key",color:"#6B7280",sdkProvider:"openai",defaultModel:"",popularModels:[],requiresBaseURL:!0}})},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[873,917,736,506,485,824,583,403,615,350],()=>b(b.s=22017));module.exports=c})();
73
+ `,children:(0,g.jsx)(dY,{selectedNode:B,testCases:p.testCases,stats:p.stats,columns:h?A.columnConfigs?.[h]??A.columnConfig??[]:A.columnConfig??[],projectId:c,fullscreen:M,onAddTestCase:p.addTestCase,onUpdateTestCase:p.updateTestCase,onDeleteTestCase:p.deleteTestCase,onBulkDelete:p.bulkDeleteTestCases,onBulkUpdate:p.bulkUpdateTestCases,onReorderTestCases:p.reorderTestCases,onToggleColumn:p.toggleColumnVisibility,onRenameColumn:p.updateColumnConfig,onUpdateNode:o.updateNode,onAddColumn:p.addColumn,onDeleteColumn:p.deleteColumn,onReorderColumn:p.reorderColumn,confirmDialog:y})})]}),(0,g.jsx)(i(),{id:"a894832df36b68ca",children:"@media(max-width:767px){.mobile-full-width.jsx-a894832df36b68ca{width:100%!important}}"}),E&&A&&(0,g.jsx)(dZ,{nodes:A.flows,testCases:A.testCases??{},onSelectNode:a=>{k(a),o.selectNode(a)},onClose:()=>F(!1)})]}):(0,g.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,g.jsx)("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading project..."})}):(0,g.jsx)(x.p,{message:"Project not found.",action:{label:"Back to Projects",onClick:()=>b.push("/projects")}})}},74075:a=>{"use strict";a.exports=require("zlib")},79428:a=>{"use strict";a.exports=require("buffer")},79472:(a,b,c)=>{"use strict";c.d(b,{Pj:()=>d});let d=Object.values({openai:{id:"openai",name:"OpenAI",type:"native",description:"GPT models powering ChatGPT. Industry-leading language understanding.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openai.svg",keyUrl:"https://platform.openai.com/api-keys",keyPlaceholder:"sk-...",color:"#10A37F",sdkProvider:"openai",defaultModel:"gpt-4o-mini",popularModels:["gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"]},google:{id:"google",name:"Google Gemini",type:"native",description:"Google's multimodal AI with strong reasoning capabilities.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/googlegemini.svg",keyUrl:"https://aistudio.google.com/apikey",keyPlaceholder:"AIza...",color:"#4285F4",sdkProvider:"google",defaultModel:"gemini-2.5-flash",popularModels:["gemini-2.5-flash","gemini-2.5-pro","gemini-2.0-flash"]},anthropic:{id:"anthropic",name:"Anthropic",type:"native",description:"Claude models — safe, steerable, and highly capable.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/anthropic.svg",keyUrl:"https://console.anthropic.com/settings/keys",keyPlaceholder:"sk-ant-...",color:"#D97706",sdkProvider:"anthropic",defaultModel:"claude-sonnet-4-20250514",popularModels:["claude-sonnet-4-20250514","claude-haiku-4-20250514","claude-3-5-sonnet-20241022"]},deepseek:{id:"deepseek",name:"DeepSeek",type:"openai-compatible",description:"High-performance open-source models with competitive reasoning.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/deepseek.svg",keyUrl:"https://platform.deepseek.com/api_keys",keyPlaceholder:"sk-...",color:"#4D6BFE",sdkProvider:"openai",baseURL:"https://api.deepseek.com/v1",defaultModel:"deepseek-chat",popularModels:["deepseek-chat","deepseek-reasoner"]},xiaomi:{id:"xiaomi",name:"Xiaomi (MiMo)",type:"openai-compatible",description:"Xiaomi's MiMo models — OpenAI-compatible API.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/xiaomi.svg",keyUrl:"https://platform.xiaomimimo.com/",keyPlaceholder:"tp-...",color:"#FF6900",sdkProvider:"openai",baseURL:"https://token-plan-sgp.xiaomimimo.com/v1",defaultModel:"mimo-v2.5",popularModels:["mimo-v2.5","mimo-v2.5-pro"]},openrouter:{id:"openrouter",name:"OpenRouter",type:"openai-compatible",description:"Unified gateway to 200+ models — Claude, Llama, Mistral, Gemini, and more.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openrouter.svg",keyUrl:"https://openrouter.ai/keys",keyPlaceholder:"sk-or-...",color:"#6366F1",sdkProvider:"openai",baseURL:"https://openrouter.ai/api/v1",defaultModel:"openrouter/free",popularModels:["openrouter/free","meta-llama/llama-4-maverick:free","google/gemini-2.5-flash:free","deepseek/deepseek-chat-v3-0324:free","mistralai/mistral-small-3.2-24b:free","qwen/qwen3-235b-a22b:free","microsoft/phi-4-reasoning-plus:free"]},groq:{id:"groq",name:"Groq",type:"native",description:"Ultra-fast inference with LPU hardware. Blazing speed for Llama, Mixtral, and Gemma models.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/groq.svg",keyUrl:"https://console.groq.com/keys",keyPlaceholder:"gsk_...",color:"#F55036",sdkProvider:"groq",defaultModel:"llama-3.3-70b-versatile",popularModels:["llama-3.3-70b-versatile","llama-3.1-8b-instant","mixtral-8x7b-32768","gemma2-9b-it","meta-llama/llama-4-scout-17b-16e-instruct","qwen-qwq-32b"]},custom:{id:"custom",name:"Custom (OpenAI-compatible)",type:"openai-compatible",description:"Any OpenAI-compatible API — Ollama, LM Studio, vLLM, LiteLLM, etc.",logoUrl:"",keyUrl:"",keyPlaceholder:"sk-... or any key",color:"#6B7280",sdkProvider:"openai",defaultModel:"",popularModels:[],requiresBaseURL:!0}})},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[873,917,736,506,485,824,583,403,615,350],()=>b(b.s=22017));module.exports=c})();