@testmuai/kane-cli 0.2.10 → 0.2.11

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 (55) hide show
  1. package/dist/ChromeProfilePicker-YIDCOJVA.js +2 -0
  2. package/dist/CliFeedbackPrompt-T5LVDBVG.js +2 -0
  3. package/dist/{CliUploadProgress-ZVRZFMGT.js → CliUploadProgress-YJW7DHBT.js} +1 -1
  4. package/dist/{ConfigView-XCWDFTNS.js → ConfigView-5L75H3A6.js} +1 -1
  5. package/dist/FolderPicker-LEE4Y5JF.js +2 -0
  6. package/dist/{HelpView-DOYUDPWZ.js → HelpView-SIIWVMWF.js} +1 -1
  7. package/dist/{LinksBox-FR4WLNX4.js → LinksBox-M72NCTRJ.js} +1 -1
  8. package/dist/ProfilesView-6MW5P6M4.js +2 -0
  9. package/dist/ProjectPicker-57G2ILEN.js +2 -0
  10. package/dist/SingleShotApp-UD4M2CZC.js +2 -0
  11. package/dist/{WhoamiView-AP6NXPTL.js → WhoamiView-ZKNSYOLI.js} +1 -1
  12. package/dist/{changelog-DFV22SXX.js → changelog-TWE6QJ5S.js} +1 -1
  13. package/dist/{chunk-UNQM5247.js → chunk-2O7RIXHD.js} +1 -1
  14. package/dist/{chunk-5WXHT4JD.js → chunk-55EYPGTJ.js} +1 -1
  15. package/dist/{chunk-75XK2HKS.js → chunk-7ONI2K3S.js} +1 -1
  16. package/dist/{chunk-43D3E7EA.js → chunk-C4KI7FLV.js} +1 -1
  17. package/dist/chunk-CKMDFVL6.js +5 -0
  18. package/dist/{chunk-SOUKF5VL.js → chunk-D3YS6JDD.js} +1 -1
  19. package/dist/{chunk-FK2AWXZN.js → chunk-HHNLJWO5.js} +1 -1
  20. package/dist/{chunk-7E2QYCMX.js → chunk-ID77BNBM.js} +1 -1
  21. package/dist/chunk-IQYKSZAW.js +20 -0
  22. package/dist/chunk-J3ZXTHAH.js +103 -0
  23. package/dist/chunk-LBW6EFWN.js +2 -0
  24. package/dist/chunk-M5TQDTQN.js +2 -0
  25. package/dist/{chunk-PXIG2FKV.js → chunk-NDMXYUJM.js} +1 -1
  26. package/dist/chunk-TMTSY6CU.js +2 -0
  27. package/dist/chunk-XQL5WHKR.js +2 -0
  28. package/dist/chunk-Y3MXIITZ.js +2 -0
  29. package/dist/chunk-Y4AOKSSQ.js +2 -0
  30. package/dist/chunk-YUUZDFT7.js +2 -0
  31. package/dist/chunk-Z3JYUFJ4.js +2 -0
  32. package/dist/index.js +46 -57
  33. package/dist/{logging-WJPMWUL5.js → logging-JWPN5HMJ.js} +1 -1
  34. package/dist/login-flow-WXMKYI5G.js +2 -0
  35. package/dist/{pipeline-ZSNZGJIH.js → pipeline-6DGALO2W.js} +1 -1
  36. package/dist/{tms-client-VH42IFUF.js → tms-client-CTH4NVFM.js} +1 -1
  37. package/dist/validate-basic-RV5TSUKJ.js +2 -0
  38. package/dist/{version-check-AGBPWJQA.js → version-check-FOMPCS47.js} +1 -1
  39. package/package.json +5 -5
  40. package/dist/ChromeProfilePicker-VPCR7EPX.js +0 -2
  41. package/dist/CliFeedbackPrompt-CKWGADHU.js +0 -2
  42. package/dist/FolderPicker-DN4OV6BI.js +0 -2
  43. package/dist/LoginWizard-NJ22OXIH.js +0 -2
  44. package/dist/ProfilesView-ENBYW7PJ.js +0 -2
  45. package/dist/ProjectPicker-43LFS6S6.js +0 -2
  46. package/dist/chunk-5PATFYIN.js +0 -2
  47. package/dist/chunk-6REBTGNQ.js +0 -106
  48. package/dist/chunk-7H6IY5KC.js +0 -2
  49. package/dist/chunk-FBK6UISI.js +0 -2
  50. package/dist/chunk-HFQ7T5KT.js +0 -2
  51. package/dist/chunk-KJAVR2NX.js +0 -2
  52. package/dist/chunk-OILYCYAD.js +0 -2
  53. package/dist/chunk-YSOCZU7T.js +0 -2
  54. package/dist/chunk-YTG6V347.js +0 -2
  55. package/dist/login-flow-5WUX5JKU.js +0 -2
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-Y4AOKSSQ.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{c as ChromeProfilePicker,b as formatChromeProfileLine,a as listChromeProfiles};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as r}from"./chunk-Z3JYUFJ4.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import{c as e}from"./chunk-C44QQJR4.js";import{a as i}from"./chunk-6YGTRKDT.js";import{e as m}from"./chunk-UR6MHSHU.js";var t=m(i(),1);async function d(){return new Promise(o=>{let c=e(t.default.createElement(r,{onSubmit:n=>{c.unmount(),o(n)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{d as renderFeedbackPrompt};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as P,d as g,e as f}from"./chunk-7E2QYCMX.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
2
+ import{c as P,d as g,e as f}from"./chunk-ID77BNBM.js";import{a as c}from"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import{c as d}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var e=p(h(),1);var m=p(c(),1);function w({pipeline:t,buildShareUrl:r,onDone:o}){let[n,i]=(0,e.useState)(P()),[S,l]=(0,e.useState)("uploading"),[U,R]=(0,e.useState)(),[C,E]=(0,e.useState)();return(0,e.useEffect)(()=>{let x=t.config.onProgress;t.config.onProgress=(s,u,a)=>{x(s,u,a),i(y=>g(y,s,u,a))},t.execute().then(s=>{s.success?(R(r?.(s)),l("success")):(E(s.error),l("failed")),setTimeout(()=>o(s),1500)})},[]),(0,m.jsx)(f,{steps:n,status:S,testUrl:U,error:C})}async function O(t,r){return new Promise(o=>{let n=d(e.default.createElement(w,{pipeline:t,buildShareUrl:r,onDone:i=>{n.unmount(),o(i)}}),{stdout:process.stderr,exitOnCtrlC:!1})})}export{O as renderUploadProgress};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d,b as l,c as r}from"./chunk-FK2AWXZN.js";import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-75XK2HKS.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var f=n(h(),1);var e=n(m(),1);function S({model:c,mode:s,authLabel:g,profile:b,env:p,defaultUrl:i,projectId:v,folderId:x,windowSize:w,chromeProfile:B}){let{exit:a}=u();return(0,f.useEffect)(()=>{let C=setTimeout(()=>a(),50);return()=>clearTimeout(C)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(d,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:g}),(0,e.jsx)(l,{label:" profile",value:b}),(0,e.jsx)(l,{label:" env",value:p}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:i??"(none)",valueColor:i?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" mode",value:s}),(0,e.jsx)(l,{label:" window",value:w}),(0,e.jsx)(l,{label:" project",value:v??"(none)"}),(0,e.jsx)(l,{label:" folder",value:x??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:B,valueColor:o.dimmed})]})})})}export{S as ConfigView};
2
+ import{a as d,b as l,c as r}from"./chunk-HHNLJWO5.js";import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-7ONI2K3S.js";import{a as t,j as u}from"./chunk-C44QQJR4.js";import{a as h}from"./chunk-6YGTRKDT.js";import{e as n}from"./chunk-UR6MHSHU.js";var f=n(h(),1);var e=n(m(),1);function S({model:c,mode:s,authLabel:g,profile:b,env:p,defaultUrl:i,projectId:v,folderId:x,windowSize:w,chromeProfile:B}){let{exit:a}=u();return(0,f.useEffect)(()=>{let C=setTimeout(()=>a(),50);return()=>clearTimeout(C)},[a]),(0,e.jsx)(t,{flexDirection:"column",children:(0,e.jsx)(d,{title:"Configuration",children:(0,e.jsxs)(t,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{label:"Auth"}),(0,e.jsx)(l,{label:" method",value:g}),(0,e.jsx)(l,{label:" profile",value:b}),(0,e.jsx)(l,{label:" env",value:p}),(0,e.jsx)(r,{label:"Defaults"}),(0,e.jsx)(l,{label:" url",value:i??"(none)",valueColor:i?o.cyan:o.dimmed}),(0,e.jsx)(l,{label:" model",value:c}),(0,e.jsx)(l,{label:" mode",value:s}),(0,e.jsx)(l,{label:" window",value:w}),(0,e.jsx)(l,{label:" project",value:v??"(none)"}),(0,e.jsx)(l,{label:" folder",value:x??"(none)"}),(0,e.jsx)(r,{label:"Paths"}),(0,e.jsx)(l,{label:" chrome",value:B,valueColor:o.dimmed})]})})})}export{S as ConfigView};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-LBW6EFWN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as l,t}from"./chunk-75XK2HKS.js";import{a as n,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var b=u(T(),1);var e=u(f(),1),w="https://www.testmuai.com/support/docs/kane-cli-introduction",B="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:i}=p(),s=i?.columns??80;return(0,b.useEffect)(()=>{let d=setTimeout(()=>c(),50);return()=>clearTimeout(d)},[c]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:l}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",h]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(m,{title:"USAGE",children:(0,e.jsxs)(o,{color:t.cyan,children:[" $ ",l," ","<command>"," [flags]"]})}),(0,e.jsxs)(m,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run a browser automation task",highlight:!0}),(0,e.jsx)(a,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"})]}),(0,e.jsxs)(m,{title:"RUN FLAGS",children:[(0,e.jsx)(r,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(r,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(r,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(r,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(r,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(r,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(r,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(r,{long:"--cft",desc:"Use Playwright Chromium instead of managed Chrome"}),(0,e.jsx)(r,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(r,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(r,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(r,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(r,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(r,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(m,{title:"EXAMPLES",children:[(0,e.jsx)(g,{label:"Search",cmd:`${l} run "Search for laptop"`}),(0,e.jsx)(g,{label:"Headless",cmd:`${l} run "Verify login" --headless`}),(0,e.jsx)(g,{label:"Variables",cmd:`${l} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(g,{label:"Agent",cmd:`${l} run "Add to cart" --agent | jq .status`})]}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(s-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:w})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:B})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function m({title:c,children:i}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dimmed,children:c})}),i]})}function a({cmd:c,args:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:12,children:(0,e.jsx)(o,{color:d?t.purple:t.green,bold:!0,children:c})}),(0,e.jsx)(n,{width:28,children:i?(0,e.jsx)(o,{color:t.dimmed,children:i}):null}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function r({long:c,arg:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:26,children:[(0,e.jsx)(o,{color:d?t.purple:t.cyan,children:c}),i&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",i]})]}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function g({label:c,cmd:i}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",c]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",i]})]})}export{L as HelpView};
2
+ import{a as f}from"./chunk-HCBYKLMW.js";import{a as h,b as l,t}from"./chunk-7ONI2K3S.js";import{a as n,b as o,j as x,k as p}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var b=u(T(),1);var e=u(f(),1),w="https://www.testmuai.com/support/docs/kane-cli-introduction",B="https://github.com/LambdaTest/kane-cli/issues";function L(){let{exit:c}=x(),{stdout:i}=p(),s=i?.columns??80;return(0,b.useEffect)(()=>{let d=setTimeout(()=>c(),50);return()=>clearTimeout(d)},[c]),(0,e.jsxs)(n,{flexDirection:"column",children:[(0,e.jsxs)(n,{paddingX:1,paddingTop:1,flexDirection:"column",children:[(0,e.jsx)(o,{color:t.purple,bold:!0,children:l}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Browser automation powered by AI "}),(0,e.jsxs)(o,{color:t.muted,children:[" v",h]})]})]}),(0,e.jsx)(o,{children:" "}),(0,e.jsx)(m,{title:"USAGE",children:(0,e.jsxs)(o,{color:t.cyan,children:[" $ ",l," ","<command>"," [flags]"]})}),(0,e.jsxs)(m,{title:"COMMANDS",children:[(0,e.jsx)(a,{cmd:"run",args:"<objective>",desc:"Run a browser automation task",highlight:!0}),(0,e.jsx)(a,{cmd:"login",desc:"Auth setup (interactive, --oauth, or --username)"}),(0,e.jsx)(a,{cmd:"logout",desc:"Revoke tokens + delete profile"}),(0,e.jsx)(a,{cmd:"whoami",desc:"Show authenticated identity"}),(0,e.jsx)(a,{cmd:"config",args:"show|set-\u2026|reset",desc:"Manage configuration"}),(0,e.jsx)(a,{cmd:"profiles",args:"list|switch|delete",desc:"Manage auth profiles"})]}),(0,e.jsxs)(m,{title:"RUN FLAGS",children:[(0,e.jsx)(r,{long:"--max-steps",arg:"<n>",desc:"Max agent steps (default: 30)"}),(0,e.jsx)(r,{long:"--timeout",arg:"<sec>",desc:"Kill run after N seconds"}),(0,e.jsx)(r,{long:"--headless",desc:"No visible browser window"}),(0,e.jsx)(r,{long:"--variables",arg:"<json>",desc:"Inline variables as JSON"}),(0,e.jsx)(r,{long:"--variables-file",arg:"<path>",desc:"Load variables from file"}),(0,e.jsx)(r,{long:"--ws-endpoint",arg:"<url>",desc:"Remote browser (LambdaTest)"}),(0,e.jsx)(r,{long:"--cdp-endpoint",arg:"<url>",desc:"Connect to existing Chrome CDP"}),(0,e.jsx)(r,{long:"--cft",desc:"Use Playwright Chromium instead of managed Chrome"}),(0,e.jsx)(r,{long:"--global-context",arg:"<file>",desc:"Override global context markdown"}),(0,e.jsx)(r,{long:"--local-context",arg:"<file>",desc:"Override local context markdown"}),(0,e.jsx)(r,{long:"--username",arg:"<user>",desc:"Basic auth (skip OAuth)"}),(0,e.jsx)(r,{long:"--access-key",arg:"<key>",desc:"Basic auth access key"}),(0,e.jsx)(r,{long:"--env",arg:"<name>",desc:"Environment (prod or stage)"}),(0,e.jsx)(r,{long:"--agent",desc:"NDJSON output (no UI)",highlight:!0})]}),(0,e.jsxs)(m,{title:"EXAMPLES",children:[(0,e.jsx)(g,{label:"Search",cmd:`${l} run "Search for laptop"`}),(0,e.jsx)(g,{label:"Headless",cmd:`${l} run "Verify login" --headless`}),(0,e.jsx)(g,{label:"Variables",cmd:`${l} run "Login as {{user}}" --variables '{"user":{"value":"alice"}}'`}),(0,e.jsx)(g,{label:"Agent",cmd:`${l} run "Add to cart" --agent | jq .status`})]}),(0,e.jsxs)(n,{flexDirection:"column",marginTop:0,paddingX:1,children:[(0,e.jsx)(o,{color:t.muted,children:"\u2500".repeat(Math.min(s-2,70))}),(0,e.jsxs)(n,{gap:3,children:[(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Docs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:w})]}),(0,e.jsxs)(n,{children:[(0,e.jsx)(o,{color:t.dimmed,children:"Bugs "}),(0,e.jsx)(o,{color:t.cyan,underline:!0,children:B})]})]})]}),(0,e.jsx)(o,{children:" "})]})}function m({title:c,children:i}){return(0,e.jsxs)(n,{flexDirection:"column",marginBottom:1,children:[(0,e.jsx)(n,{marginLeft:1,children:(0,e.jsx)(o,{bold:!0,color:t.dimmed,children:c})}),i]})}function a({cmd:c,args:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsx)(n,{width:12,children:(0,e.jsx)(o,{color:d?t.purple:t.green,bold:!0,children:c})}),(0,e.jsx)(n,{width:28,children:i?(0,e.jsx)(o,{color:t.dimmed,children:i}):null}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function r({long:c,arg:i,desc:s,highlight:d}){return(0,e.jsxs)(n,{marginLeft:2,children:[(0,e.jsxs)(n,{width:26,children:[(0,e.jsx)(o,{color:d?t.purple:t.cyan,children:c}),i&&(0,e.jsxs)(o,{color:t.dimmed,children:[" ",i]})]}),(0,e.jsx)(o,{color:t.dimmed,children:s})]})}function g({label:c,cmd:i}){return(0,e.jsxs)(n,{marginLeft:2,flexDirection:"column",children:[(0,e.jsxs)(o,{color:t.dimmed,children:["# ",c]}),(0,e.jsxs)(o,{color:t.cyan,children:["$ ",i]})]})}export{L as HelpView};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-PXIG2FKV.js";import"./chunk-HCBYKLMW.js";import"./chunk-75XK2HKS.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
2
+ import{a}from"./chunk-NDMXYUJM.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as LinksBox};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-TMTSY6CU.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as ProfilesView,a as formatProfileLine};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-M5TQDTQN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{b as ProjectPicker,a as formatProjectLine};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{t as a}from"./chunk-IQYKSZAW.js";import"./chunk-LBW6EFWN.js";import"./chunk-CKMDFVL6.js";import"./chunk-PWGEMRBD.js";import"./chunk-L5Y2GUO6.js";import"./chunk-M5TQDTQN.js";import"./chunk-Y3MXIITZ.js";import"./chunk-2O7RIXHD.js";import"./chunk-XQL5WHKR.js";import"./chunk-HCBYKLMW.js";import"./chunk-7ONI2K3S.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-YUUZDFT7.js";import"./chunk-DXKKUGFG.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as s,b as o}from"./chunk-FK2AWXZN.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-75XK2HKS.js";import{a as r,b as n,j as u}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
2
+ import{a as s,b as o}from"./chunk-HHNLJWO5.js";import{a as x}from"./chunk-HCBYKLMW.js";import{t as i}from"./chunk-7ONI2K3S.js";import{a as r,b as n,j as u}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as t}from"./chunk-UR6MHSHU.js";var p=t(B(),1);var e=t(x(),1);function R({profile:f,env:g,authenticated:a,authMethod:v,username:m,tokenStatus:l,expiresAt:c}){let{exit:d}=u();return(0,p.useEffect)(()=>{let b=setTimeout(()=>d(),50);return()=>clearTimeout(b)},[d]),(0,e.jsx)(r,{flexDirection:"column",children:(0,e.jsx)(s,{title:"Identity",variant:a?"success":"warning",children:(0,e.jsxs)(r,{flexDirection:"column",paddingY:1,children:[(0,e.jsx)(r,{children:a?(0,e.jsx)(n,{color:i.green,bold:!0,children:"\u2713 Authenticated"}):(0,e.jsx)(n,{color:i.yellow,bold:!0,children:"\u26A0 Not logged in"})}),(0,e.jsxs)(r,{flexDirection:"column",marginTop:1,children:[(0,e.jsx)(o,{label:"Profile",value:f}),(0,e.jsx)(o,{label:"Environment",value:g}),(0,e.jsx)(o,{label:"Method",value:v}),m&&(0,e.jsx)(o,{label:"User",value:m}),l&&(0,e.jsx)(o,{label:"Token",value:l,valueColor:l==="valid"?i.green:l==="expired"?i.red:i.dimmed}),c&&(0,e.jsx)(o,{label:"Expires",value:c})]})]})})})}export{R as WhoamiView};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as i,f as c}from"./chunk-75XK2HKS.js";import"./chunk-UR6MHSHU.js";import{readFileSync as h,writeFileSync as g,mkdirSync as u}from"fs";import{join as d}from"path";var l=d(i,"changelog-cache.json"),f=3600*1e3;function p(){try{let e=JSON.parse(h(l,"utf-8"));if(Date.now()-e.cachedAt<f)return e}catch{}return null}function y(e){try{u(i,{recursive:!0}),g(l,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function E(e){try{let t=p();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await fetch(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return y(s),e?.all?s:s.slice(0,5)}catch{return[]}}function A(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
2
+ import{c as i,f as c}from"./chunk-7ONI2K3S.js";import"./chunk-UR6MHSHU.js";import{readFileSync as h,writeFileSync as g,mkdirSync as u}from"fs";import{join as d}from"path";var l=d(i,"changelog-cache.json"),f=3600*1e3;function p(){try{let e=JSON.parse(h(l,"utf-8"));if(Date.now()-e.cachedAt<f)return e}catch{}return null}function y(e){try{u(i,{recursive:!0}),g(l,JSON.stringify({entries:e,cachedAt:Date.now()}))}catch{}}async function E(e){try{let t=p();if(t){let r=t.entries;return e?.all?r:r.slice(0,5)}let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),a=await fetch(`${c}?per_page=30`,{headers:{Accept:"application/vnd.github+json"},signal:n.signal});if(clearTimeout(o),!a.ok)return[];let s=(await a.json()).map(r=>({version:r.tag_name.replace(/^v/,""),date:r.published_at?r.published_at.slice(0,10):"",body:r.body??""}));return y(s),e?.all?s:s.slice(0,5)}catch{return[]}}function A(e){if(e.length===0)return"Could not fetch changelog. Visit https://github.com/LambdaTest/kane-cli/releases";let t=["kane-cli Changelog","\u2500".repeat(40),""];for(let n of e){if(t.push(`v${n.version} (${n.date})`),n.body){let o=n.body.split(`
3
3
  `).filter(a=>a.trim());for(let a of o)t.push(` ${a}`)}t.push("")}return t.join(`
4
4
  `)}export{E as fetchChangelog,A as formatChangelog};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{s}from"./chunk-75XK2HKS.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost}}export{n as a};
2
+ import{s}from"./chunk-7ONI2K3S.js";function n(r="prod"){let e=s[r];return r!=="stage"?e:{authBaseUrl:process.env.KANE_STAGE_AUTH_URL??e.authBaseUrl,consentUrl:process.env.KANE_STAGE_CONSENT_URL??e.consentUrl,controllerBaseUrl:process.env.TESTMUAI_BASE_URL??e.controllerBaseUrl,tmsBaseUrl:process.env.KANE_STAGE_TMS_URL??e.tmsBaseUrl,secretsBaseUrl:process.env.KANE_STAGE_SECRETS_URL??e.secretsBaseUrl,testManagerUiUrl:process.env.KANE_STAGE_TEST_MANAGER_UI_URL??e.testManagerUiUrl,shareApiBaseUrl:process.env.KANE_STAGE_SHARE_API_URL??e.shareApiBaseUrl,v16ServerHost:process.env.KANE_STAGE_V16_SERVER_HOST??e.v16ServerHost}}export{n as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as u,g as f}from"./chunk-75XK2HKS.js";var o=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,i,n={}){if(this.stopped)return;let r=this.buildEntry(e,t,i,n);this.buffer.push(r)}logStep(e,t,i,n={}){if(this.stopped)return;let r=this.buildEntry("debug",t,i,n);r.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(r)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let i={"Content-Type":"application/json"};t&&(i.Authorization=`Bearer ${t}`);let n=JSON.stringify(e);for(let r=0;r<3;r++){try{let h=new AbortController,p=setTimeout(()=>h.abort(),1e4),d=await fetch(this.config.proxyUrl,{method:"POST",headers:i,body:n,signal:h.signal});if(clearTimeout(p),d.ok)return}catch{}r<2&&await new Promise(h=>setTimeout(h,1e3*Math.pow(2,r)))}this._droppedBatches++,this._droppedEntries+=e.length}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,i,n){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`env:${this.config.environment},version:${this.config.device.cli_version}`,level:e,event:t,message:i,session_id:this.config.sessionId,run_index:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:n,timestamp:new Date().toISOString()}}};import{platform as l,arch as g}from"os";function y(s){let e={proxyUrl:f,sessionId:s.sessionId,identity:s.identity,device:{cli_version:u,platform:l(),arch:g()},environment:s.environment,getToken:s.getToken};return new o(e)}export{o as a,y as b};
2
+ import{a as u,g as f}from"./chunk-7ONI2K3S.js";var n=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry(e,t,i,s);this.buffer.push(r)}logStep(e,t,i,s={}){if(this.stopped)return;let r=this.buildEntry("debug",t,i,s);r.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(r)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let i={"Content-Type":"application/json"};t&&(i.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let r=0;r<3;r++){try{let h=new AbortController,p=setTimeout(()=>h.abort(),1e4),d=await fetch(this.config.proxyUrl,{method:"POST",headers:i,body:s,signal:h.signal});if(clearTimeout(p),d.ok)return}catch{}r<2&&await new Promise(h=>setTimeout(h,1e3*Math.pow(2,r)))}this._droppedBatches++,this._droppedEntries+=e.length}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,i,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:i,session_id:this.config.sessionId,run_index:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as l,arch as g}from"os";function v(o){let e={proxyUrl:f,sessionId:o.sessionId,identity:o.identity,device:{cli_version:u,platform:l(),arch:g()},getToken:o.getToken};return new n(e)}export{n as a,v as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{homedir as s}from"os";import{join as t}from"path";var c="0.2.10",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
2
+ import{homedir as s}from"os";import{join as t}from"path";var c="0.2.11",l="kane-cli",e=t(s(),".testmuai","kaneai"),m=t(e,"profiles"),i=t(e,"tui-config.json"),d="https://registry.npmjs.org/@testmuai/kane-cli",h="https://api.github.com/repos/LambdaTest/kane-cli/releases",f="https://dd-proxy.lambdatest.com/intake/kane-cli",u="https://kaneai-playground.lambdatest.io",_=9222,b=9230,U=t(e,"chrome-profiles"),r="127.0.0.1",x=18392,g=18400,o="/callback";function A(a){return`http://${r}:${a}${o}`}var R="KANE CLI",L="*",C={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server"}},E={base:"#ffffff",primary:"#ff9500",secondary:"#888888",accent:"#ffffff",dim:"#666666",ambient:"#444444",statusPass:"#4ade80",statusFail:"#ef4444",purple:"#ff9500",cyan:"#ff9500",yellow:"#ff9500",green:"#4ade80",greenDim:"#666666",red:"#ef4444",redDim:"#666666",dimmed:"#666666",muted:"#444444"};export{c as a,l as b,e as c,i as d,d as e,h as f,f as g,u as h,_ as i,b as j,U as k,r as l,x as m,g as n,o,A as p,R as q,L as r,C as s,E as t};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,c,e as o}from"./chunk-75XK2HKS.js";import{readFileSync as m,writeFileSync as f,mkdirSync as d,realpathSync as h}from"fs";import{join as g}from"path";var y="npm install -g @testmuai/kane-cli@latest",C="brew upgrade lambdatest/kane/kane-cli";function N(){try{let t=process.argv[1];if(t&&h(t).includes("/Cellar/"))return C}catch{}return y}var p=g(c,"version-check.json"),b=1440*60*1e3;function S(){try{let t=JSON.parse(m(p,"utf-8"));if(Date.now()-t.checkedAt<b)return t}catch{}return null}function k(t){try{d(c,{recursive:!0}),f(p,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function l(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function v(){try{let t=S();if(t)return l(a,t.latest)>0?{current:a,latest:t.latest,severity:u(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await fetch(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(k(e),l(a,e)>0?{current:a,latest:e,severity:u(a,e)}:null):null}catch{return null}}export{N as a,l as b,u as c,v as d};
2
+ import{a,c,e as o}from"./chunk-7ONI2K3S.js";import{readFileSync as m,writeFileSync as f,mkdirSync as d,realpathSync as h}from"fs";import{join as g}from"path";var y="npm install -g @testmuai/kane-cli@latest",C="brew upgrade lambdatest/kane/kane-cli";function N(){try{let t=process.argv[1];if(t&&h(t).includes("/Cellar/"))return C}catch{}return y}var p=g(c,"version-check.json"),b=1440*60*1e3;function S(){try{let t=JSON.parse(m(p,"utf-8"));if(Date.now()-t.checkedAt<b)return t}catch{}return null}function k(t){try{d(c,{recursive:!0}),f(p,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function l(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function v(){try{let t=S();if(t)return l(a,t.latest)>0?{current:a,latest:t.latest,severity:u(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await fetch(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(k(e),l(a,e)>0?{current:a,latest:e,severity:u(a,e)}:null):null}catch{return null}}export{N as a,l as b,u as c,v as d};
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as d}from"./chunk-2O7RIXHD.js";import{c as h,q as g,r as u}from"./chunk-7ONI2K3S.js";import{readFileSync as a,writeFileSync as f,mkdirSync as p,readdirSync as c,unlinkSync as s,existsSync as l,chmodSync as y}from"fs";import{join as n,dirname as C}from"path";var v=class{baseDir;profilesDir;configFile;constructor(t=h){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(a(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){p(this.baseDir,{recursive:!0,mode:448}),f(this.configFile,JSON.stringify(t,null,2)+`
3
+ `),y(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let r=this.readConfig();r.active_profile=t,this.writeConfig(r)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let r=this.readConfig();r.default_env=t,this.writeConfig(r)}credentialsPath(t,r){return n(this.profilesDir,t,r,"credentials")}clientPath(t,r){return n(this.profilesDir,t,r,"client.json")}basicAuthPath(t,r){return n(this.profilesDir,t,r,"basic-auth")}profileConfigPath(t,r){return n(this.profilesDir,t,r,"profile-config.json")}saveProfileConfig(t,r,e){let i=this.loadProfileConfig(t,r)??{};this.writeSecure(this.profileConfigPath(t,r),{...i,...e})}loadProfileConfig(t,r){try{return JSON.parse(a(this.profileConfigPath(t,r),"utf-8"))}catch{return null}}writeSecure(t,r){try{p(C(t),{recursive:!0,mode:448}),f(t,JSON.stringify(r,null,2)+`
4
+ `),y(t,384)}catch(e){let i=e instanceof Error?e.message:String(e);process.stderr.write(`[auth] Failed to save credentials: ${i}
5
+ `)}}saveCredentials(t,r,e){this.writeSecure(this.credentialsPath(t,r),e)}loadCredentials(t,r){try{return JSON.parse(a(this.credentialsPath(t,r),"utf-8"))}catch{return null}}saveClient(t,r,e){this.writeSecure(this.clientPath(t,r),e)}loadClient(t,r){try{return JSON.parse(a(this.clientPath(t,r),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let r=this.getDefaultEnv();return{credentials:this.loadCredentials(t,r),profile:t,env:r}}saveBasicAuth(t,r,e){this.writeSecure(this.basicAuthPath(t,r),e)}loadBasicAuth(t,r){try{return JSON.parse(a(this.basicAuthPath(t,r),"utf-8"))}catch{return null}}deleteBasicAuth(t,r){try{s(this.basicAuthPath(t,r))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let r=this.getDefaultEnv(),e=this.loadBasicAuth(t,r);return e?{method:"basic",...e,profile:t,env:r}:this.loadCredentials(t,r)?{method:"oauth",profile:t,env:r}:null}listProfiles(){let t=[];try{for(let r of c(this.profilesDir)){let e=n(this.profilesDir,r);try{for(let i of c(e)){let o=n(e,i),P=l(n(o,"credentials")),w=l(n(o,"client.json")),k=l(n(o,"basic-auth"));(P||w||k)&&t.push({profile:r,env:i})}}catch{}}}catch{}return t}deleteProfile(t,r){try{s(this.credentialsPath(t,r))}catch{}if(this.getActiveProfile()===t){let e=this.readConfig();delete e.active_profile,this.writeConfig(e)}}deleteProfileFull(t,r){if(r){try{s(this.credentialsPath(t,r))}catch{}try{s(this.clientPath(t,r))}catch{}try{s(this.basicAuthPath(t,r))}catch{}try{s(this.profileConfigPath(t,r))}catch{}}else try{let e=n(this.profilesDir,t);for(let i of c(e)){try{s(n(e,i,"credentials"))}catch{}try{s(n(e,i,"client.json"))}catch{}try{s(n(e,i,"basic-auth"))}catch{}try{s(n(e,i,"profile-config.json"))}catch{}}}catch{}}};import{createHash as S,randomBytes as A}from"crypto";var m=class{authBaseUrl;consentUrl;constructor(t="prod"){let r=d(t);this.authBaseUrl=r.authBaseUrl,this.consentUrl=r.consentUrl}static generatePkce(){let t=A(96).toString("base64url").slice(0,128),r=S("sha256").update(t).digest("base64url");return[t,r]}buildAuthorizationUrl(t,r,e,i){let o=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:i,scope:u,code_challenge:r,code_challenge_method:"S256",state:e});return`${this.consentUrl}/oauth2?${o.toString()}`}async registerClient(t){let r=await fetch(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:g,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!r.ok)throw new Error(`DCR failed: ${r.status} ${await r.text()}`);return r.json()}async exchangeCode(t,r,e,i){let o=await fetch(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:e})});if(!o.ok)throw new Error(`Token exchange failed: ${o.status}`);return o.json()}async refreshToken(t,r){let e=await fetch(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:r})});if(!e.ok)throw new Error(`Token refresh failed: ${e.status}`);return e.json()}async revokeToken(t,r,e="access_token"){await fetch(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:e,client_id:r})})}async validateToken(t){let r=new AbortController,e=setTimeout(()=>r.abort(),1e4);try{let i=await fetch(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:r.signal});return clearTimeout(e),i.ok}catch{return clearTimeout(e),!1}}};export{v as a,m as b};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Tc}from"./chunk-L5Y2GUO6.js";import{a as xc}from"./chunk-HFQ7T5KT.js";import{a as vc}from"./chunk-DXKKUGFG.js";import{a as P,b as ZE,c as g,d as QE,e as XE,f as JE}from"./chunk-UR6MHSHU.js";var kc=g((XB,Cc)=>{"use strict";var uv=typeof process=="object"&&process&&process.platform==="win32";Cc.exports=uv?{sep:"\\"}:{sep:"/"}});var Bc=g((JB,jc)=>{"use strict";jc.exports=qc;function qc(t,e,r){t instanceof RegExp&&(t=Mc(t,r)),e instanceof RegExp&&(e=Mc(e,r));var i=Fc(t,e,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+t.length,i[1]),post:r.slice(i[1]+e.length)}}function Mc(t,e){var r=e.match(t);return r?r[0]:null}qc.range=Fc;function Fc(t,e,r){var i,n,s,o,a,l=r.indexOf(t),u=r.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],s=r.length;f>=0&&!a;)f==l?(i.push(f),l=r.indexOf(t,f+1)):i.length==1?a=[i.pop(),u]:(n=i.pop(),n<s&&(s=n,o=u),u=r.indexOf(e,f+1)),f=l<u&&l>=0?l:u;i.length&&(a=[s,o])}return a}});var na=g((e3,Vc)=>{"use strict";var Uc=Bc();Vc.exports=hv;var Wc="\0SLASH"+Math.random()+"\0",Gc="\0OPEN"+Math.random()+"\0",ia="\0CLOSE"+Math.random()+"\0",zc="\0COMMA"+Math.random()+"\0",$c="\0PERIOD"+Math.random()+"\0";function ra(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function fv(t){return t.split("\\\\").join(Wc).split("\\{").join(Gc).split("\\}").join(ia).split("\\,").join(zc).split("\\.").join($c)}function cv(t){return t.split(Wc).join("\\").split(Gc).join("{").split(ia).join("}").split(zc).join(",").split($c).join(".")}function Hc(t){if(!t)return[""];var e=[],r=Uc("{","}",t);if(!r)return t.split(",");var i=r.pre,n=r.body,s=r.post,o=i.split(",");o[o.length-1]+="{"+n+"}";var a=Hc(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function hv(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),gi(fv(t),!0).map(cv)):[]}function dv(t){return"{"+t+"}"}function pv(t){return/^-?0\d/.test(t)}function gv(t,e){return t<=e}function _v(t,e){return t>=e}function gi(t,e){var r=[],i=Uc("{","}",t);if(!i)return[t];var n=i.pre,s=i.post.length?gi(i.post,!1):[""];if(/\$$/.test(i.pre))for(var o=0;o<s.length;o++){var a=n+"{"+i.body+"}"+s[o];r.push(a)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),f=l||u,c=i.body.indexOf(",")>=0;if(!f&&!c)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+ia+i.post,gi(t)):[t];var h;if(f)h=i.body.split(/\.\./);else if(h=Hc(i.body),h.length===1&&(h=gi(h[0],!1).map(dv),h.length===1))return s.map(function(R){return i.pre+h[0]+R});var d;if(f){var m=ra(h[0]),p=ra(h[1]),E=Math.max(h[0].length,h[1].length),y=h.length==3?Math.max(Math.abs(ra(h[2])),1):1,b=gv,v=p<m;v&&(y*=-1,b=_v);var S=h.some(pv);d=[];for(var T=m;b(T,p);T+=y){var D;if(u)D=String.fromCharCode(T),D==="\\"&&(D="");else if(D=String(T),S){var x=E-D.length;if(x>0){var O=new Array(x+1).join("0");T<0?D="-"+O+D.slice(1):D=O+D}}d.push(D)}}else{d=[];for(var w=0;w<h.length;w++)d.push.apply(d,gi(h[w],!1))}for(var w=0;w<d.length;w++)for(var o=0;o<s.length;o++){var a=n+d[w]+s[o];(!e||f||a)&&r.push(a)}}return r}});var Jc=g((r3,ua)=>{"use strict";var Ne=ua.exports=(t,e,r={})=>(Mn(e),!r.nocomment&&e.charAt(0)==="#"?!1:new wr(e,r).match(t));ua.exports=Ne;var aa=kc();Ne.sep=aa.sep;var Ae=Symbol("globstar **");Ne.GLOBSTAR=Ae;var yv=na(),Yc={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},la="[^/]",sa=la+"*?",mv="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bv="(?:(?!(?:\\/|^)\\.).)*?",Qc=t=>t.split("").reduce((e,r)=>(e[r]=!0,e),{}),Kc=Qc("().*{}+?[]^$\\!"),wv=Qc("[.("),Zc=/\/+/;Ne.filter=(t,e={})=>(r,i,n)=>Ne(r,t,e);var Rt=(t,e={})=>{let r={};return Object.keys(t).forEach(i=>r[i]=t[i]),Object.keys(e).forEach(i=>r[i]=e[i]),r};Ne.defaults=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Ne;let e=Ne,r=(i,n,s)=>e(i,n,Rt(t,s));return r.Minimatch=class extends e.Minimatch{constructor(n,s){super(n,Rt(t,s))}},r.Minimatch.defaults=i=>e.defaults(Rt(t,i)).Minimatch,r.filter=(i,n)=>e.filter(i,Rt(t,n)),r.defaults=i=>e.defaults(Rt(t,i)),r.makeRe=(i,n)=>e.makeRe(i,Rt(t,n)),r.braceExpand=(i,n)=>e.braceExpand(i,Rt(t,n)),r.match=(i,n,s)=>e.match(i,n,Rt(t,s)),r};Ne.braceExpand=(t,e)=>Xc(t,e);var Xc=(t,e={})=>(Mn(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:yv(t)),Sv=1024*64,Mn=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Sv)throw new TypeError("pattern is too long")},oa=Symbol("subparse");Ne.makeRe=(t,e)=>new wr(t,e||{}).makeRe();Ne.match=(t,e,r={})=>{let i=new wr(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};var Ev=t=>t.replace(/\\(.)/g,"$1"),vv=t=>t.replace(/\\([^-\]])/g,"$1"),xv=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Tv=t=>t.replace(/[[\]\\]/g,"\\$&"),wr=class{constructor(e,r){Mn(e),r||(r={}),this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion!==void 0?r.maxGlobstarRecursion:200,this.set=[],this.pattern=e,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}debug(){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();let i=this.globSet=this.braceExpand();r.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,i),i=this.globParts=i.map(n=>n.split(Zc)),this.debug(this.pattern,i),i=i.map((n,s,o)=>n.map(this.parse,this)),this.debug(this.pattern,i),i=i.filter(n=>n.indexOf(!1)===-1),this.debug(this.pattern,i),this.set=i}parseNegate(){if(this.options.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i){return r.indexOf(Ae)!==-1?this._matchGlobstar(e,r,i,0,0):this._matchOne(e,r,i,0,0)}_matchGlobstar(e,r,i,n,s){let o=-1;for(let b=s;b<r.length;b++)if(r[b]===Ae){o=b;break}let a=-1;for(let b=r.length-1;b>=0;b--)if(r[b]===Ae){a=b;break}let l=r.slice(s,o),u=i?r.slice(o+1):r.slice(o+1,a),f=i?[]:r.slice(a+1);if(l.length){let b=e.slice(n,n+l.length);if(!this._matchOne(b,l,i,0,0))return!1;n+=l.length}let c=0;if(f.length){if(f.length+n>e.length)return!1;let b=e.length-f.length;if(this._matchOne(e,f,i,b,0))c=f.length;else{if(e[e.length-1]!==""||n+f.length===e.length||!this._matchOne(e,f,i,b-1,0))return!1;c=f.length+1}}if(!u.length){let b=!!c;for(let v=n;v<e.length-c;v++){let S=String(e[v]);if(b=!0,S==="."||S===".."||!this.options.dot&&S.charAt(0)===".")return!1}return i||b}let h=[[[],0]],d=h[0],m=0,p=[0];for(let b of u)b===Ae?(p.push(m),d=[[],0],h.push(d)):(d[0].push(b),m++);let E=h.length-1,y=e.length-c;for(let b of h)b[1]=y-(p[E--]+b[0].length);return!!this._matchGlobStarBodySections(e,h,n,0,i,0,!!c)}_matchGlobStarBodySections(e,r,i,n,s,o,a){let l=r[n];if(!l){for(let c=i;c<e.length;c++){a=!0;let h=e[c];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1}return a}let[u,f]=l;for(;i<=f;){if(this._matchOne(e.slice(0,i+u.length),u,s,i,0)&&o<this.maxGlobstarRecursion){let d=this._matchGlobStarBodySections(e,r,i+u.length,n+1,s,o+1,a);if(d!==!1)return d}let h=e[i];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1;i++}return s||null}_matchOne(e,r,i,n,s){let o,a,l,u;for(o=n,a=s,l=e.length,u=r.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let f=r[a],c=e[o];if(this.debug(r,f,c),f===!1||f===Ae)return!1;let h;if(typeof f=="string"?(h=c===f,this.debug("string match",f,c,h)):(h=c.match(f),this.debug("pattern match",f,c,h)),!h)return!1}if(o===l&&a===u)return!0;if(o===l)return i;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Xc(this.pattern,this.options)}parse(e,r){Mn(e);let i=this.options;if(e==="**")if(i.noglobstar)e="*";else return Ae;if(e==="")return"";let n="",s=!1,o=!1,a=[],l=[],u,f=!1,c=-1,h=-1,d,m,p,E=e.charAt(0)===".",y=i.dot||E,b=()=>E?"":y?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",v=x=>x.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",S=()=>{if(u){switch(u){case"*":n+=sa,s=!0;break;case"?":n+=la,s=!0;break;default:n+="\\"+u;break}this.debug("clearStateChar %j %j",u,n),u=!1}};for(let x=0,O;x<e.length&&(O=e.charAt(x));x++){if(this.debug("%s %s %s %j",e,x,n,O),o){if(O==="/")return!1;Kc[O]&&(n+="\\"),n+=O,o=!1;continue}switch(O){case"/":return!1;case"\\":if(f&&e.charAt(x+1)==="-"){n+=O;continue}S(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,x,n,O),f){this.debug(" in class"),O==="!"&&x===h+1&&(O="^"),n+=O;continue}if(O==="*"&&u==="*")continue;this.debug("call clearStateChar %j",u),S(),u=O,i.noext&&S();continue;case"(":{if(f){n+="(";continue}if(!u){n+="\\(";continue}let w={type:u,start:x-1,reStart:n.length,open:Yc[u].open,close:Yc[u].close};this.debug(this.pattern," ",w),a.push(w),n+=w.open,w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1))),this.debug("plType %j %j",u,n),u=!1;continue}case")":{let w=a[a.length-1];if(f||!w){n+="\\)";continue}a.pop(),S(),s=!0,m=w,n+=m.close,m.type==="!"&&l.push(Object.assign(m,{reEnd:n.length}));continue}case"|":{let w=a[a.length-1];if(f||!w){n+="\\|";continue}S(),n+="|",w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1)));continue}case"[":if(S(),f){n+="\\"+O;continue}f=!0,h=x,c=n.length,n+=O;continue;case"]":if(x===h+1||!f){n+="\\"+O;continue}d=e.substring(h+1,x);try{RegExp("["+Tv(vv(d))+"]"),n+=O}catch{n=n.substring(0,c)+"(?:$.)"}s=!0,f=!1;continue;default:S(),Kc[O]&&!(O==="^"&&f)&&(n+="\\"),n+=O;break}}for(f&&(d=e.slice(h+1),p=this.parse(d,oa),n=n.substring(0,c)+"\\["+p[0],s=s||p[1]),m=a.pop();m;m=a.pop()){let x;x=n.slice(m.reStart+m.open.length),this.debug("setting tail",n,m),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,(w,R,A)=>(A||(A="\\"),R+R+A+"|")),this.debug(`tail=%j
2
+ import{a as Tc}from"./chunk-L5Y2GUO6.js";import{a as xc}from"./chunk-YUUZDFT7.js";import{a as vc}from"./chunk-DXKKUGFG.js";import{a as P,b as ZE,c as g,d as QE,e as XE,f as JE}from"./chunk-UR6MHSHU.js";var kc=g((XB,Cc)=>{"use strict";var uv=typeof process=="object"&&process&&process.platform==="win32";Cc.exports=uv?{sep:"\\"}:{sep:"/"}});var Bc=g((JB,jc)=>{"use strict";jc.exports=qc;function qc(t,e,r){t instanceof RegExp&&(t=Mc(t,r)),e instanceof RegExp&&(e=Mc(e,r));var i=Fc(t,e,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+t.length,i[1]),post:r.slice(i[1]+e.length)}}function Mc(t,e){var r=e.match(t);return r?r[0]:null}qc.range=Fc;function Fc(t,e,r){var i,n,s,o,a,l=r.indexOf(t),u=r.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],s=r.length;f>=0&&!a;)f==l?(i.push(f),l=r.indexOf(t,f+1)):i.length==1?a=[i.pop(),u]:(n=i.pop(),n<s&&(s=n,o=u),u=r.indexOf(e,f+1)),f=l<u&&l>=0?l:u;i.length&&(a=[s,o])}return a}});var na=g((e3,Vc)=>{"use strict";var Uc=Bc();Vc.exports=hv;var Wc="\0SLASH"+Math.random()+"\0",Gc="\0OPEN"+Math.random()+"\0",ia="\0CLOSE"+Math.random()+"\0",zc="\0COMMA"+Math.random()+"\0",$c="\0PERIOD"+Math.random()+"\0";function ra(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function fv(t){return t.split("\\\\").join(Wc).split("\\{").join(Gc).split("\\}").join(ia).split("\\,").join(zc).split("\\.").join($c)}function cv(t){return t.split(Wc).join("\\").split(Gc).join("{").split(ia).join("}").split(zc).join(",").split($c).join(".")}function Hc(t){if(!t)return[""];var e=[],r=Uc("{","}",t);if(!r)return t.split(",");var i=r.pre,n=r.body,s=r.post,o=i.split(",");o[o.length-1]+="{"+n+"}";var a=Hc(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function hv(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),gi(fv(t),!0).map(cv)):[]}function dv(t){return"{"+t+"}"}function pv(t){return/^-?0\d/.test(t)}function gv(t,e){return t<=e}function _v(t,e){return t>=e}function gi(t,e){var r=[],i=Uc("{","}",t);if(!i)return[t];var n=i.pre,s=i.post.length?gi(i.post,!1):[""];if(/\$$/.test(i.pre))for(var o=0;o<s.length;o++){var a=n+"{"+i.body+"}"+s[o];r.push(a)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),f=l||u,c=i.body.indexOf(",")>=0;if(!f&&!c)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+ia+i.post,gi(t)):[t];var h;if(f)h=i.body.split(/\.\./);else if(h=Hc(i.body),h.length===1&&(h=gi(h[0],!1).map(dv),h.length===1))return s.map(function(R){return i.pre+h[0]+R});var d;if(f){var m=ra(h[0]),p=ra(h[1]),E=Math.max(h[0].length,h[1].length),y=h.length==3?Math.max(Math.abs(ra(h[2])),1):1,b=gv,v=p<m;v&&(y*=-1,b=_v);var S=h.some(pv);d=[];for(var T=m;b(T,p);T+=y){var D;if(u)D=String.fromCharCode(T),D==="\\"&&(D="");else if(D=String(T),S){var x=E-D.length;if(x>0){var O=new Array(x+1).join("0");T<0?D="-"+O+D.slice(1):D=O+D}}d.push(D)}}else{d=[];for(var w=0;w<h.length;w++)d.push.apply(d,gi(h[w],!1))}for(var w=0;w<d.length;w++)for(var o=0;o<s.length;o++){var a=n+d[w]+s[o];(!e||f||a)&&r.push(a)}}return r}});var Jc=g((r3,ua)=>{"use strict";var Ne=ua.exports=(t,e,r={})=>(Mn(e),!r.nocomment&&e.charAt(0)==="#"?!1:new wr(e,r).match(t));ua.exports=Ne;var aa=kc();Ne.sep=aa.sep;var Ae=Symbol("globstar **");Ne.GLOBSTAR=Ae;var yv=na(),Yc={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},la="[^/]",sa=la+"*?",mv="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bv="(?:(?!(?:\\/|^)\\.).)*?",Qc=t=>t.split("").reduce((e,r)=>(e[r]=!0,e),{}),Kc=Qc("().*{}+?[]^$\\!"),wv=Qc("[.("),Zc=/\/+/;Ne.filter=(t,e={})=>(r,i,n)=>Ne(r,t,e);var Rt=(t,e={})=>{let r={};return Object.keys(t).forEach(i=>r[i]=t[i]),Object.keys(e).forEach(i=>r[i]=e[i]),r};Ne.defaults=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Ne;let e=Ne,r=(i,n,s)=>e(i,n,Rt(t,s));return r.Minimatch=class extends e.Minimatch{constructor(n,s){super(n,Rt(t,s))}},r.Minimatch.defaults=i=>e.defaults(Rt(t,i)).Minimatch,r.filter=(i,n)=>e.filter(i,Rt(t,n)),r.defaults=i=>e.defaults(Rt(t,i)),r.makeRe=(i,n)=>e.makeRe(i,Rt(t,n)),r.braceExpand=(i,n)=>e.braceExpand(i,Rt(t,n)),r.match=(i,n,s)=>e.match(i,n,Rt(t,s)),r};Ne.braceExpand=(t,e)=>Xc(t,e);var Xc=(t,e={})=>(Mn(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:yv(t)),Sv=1024*64,Mn=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Sv)throw new TypeError("pattern is too long")},oa=Symbol("subparse");Ne.makeRe=(t,e)=>new wr(t,e||{}).makeRe();Ne.match=(t,e,r={})=>{let i=new wr(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};var Ev=t=>t.replace(/\\(.)/g,"$1"),vv=t=>t.replace(/\\([^-\]])/g,"$1"),xv=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Tv=t=>t.replace(/[[\]\\]/g,"\\$&"),wr=class{constructor(e,r){Mn(e),r||(r={}),this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion!==void 0?r.maxGlobstarRecursion:200,this.set=[],this.pattern=e,this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.make()}debug(){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();let i=this.globSet=this.braceExpand();r.debug&&(this.debug=(...n)=>console.error(...n)),this.debug(this.pattern,i),i=this.globParts=i.map(n=>n.split(Zc)),this.debug(this.pattern,i),i=i.map((n,s,o)=>n.map(this.parse,this)),this.debug(this.pattern,i),i=i.filter(n=>n.indexOf(!1)===-1),this.debug(this.pattern,i),this.set=i}parseNegate(){if(this.options.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i){return r.indexOf(Ae)!==-1?this._matchGlobstar(e,r,i,0,0):this._matchOne(e,r,i,0,0)}_matchGlobstar(e,r,i,n,s){let o=-1;for(let b=s;b<r.length;b++)if(r[b]===Ae){o=b;break}let a=-1;for(let b=r.length-1;b>=0;b--)if(r[b]===Ae){a=b;break}let l=r.slice(s,o),u=i?r.slice(o+1):r.slice(o+1,a),f=i?[]:r.slice(a+1);if(l.length){let b=e.slice(n,n+l.length);if(!this._matchOne(b,l,i,0,0))return!1;n+=l.length}let c=0;if(f.length){if(f.length+n>e.length)return!1;let b=e.length-f.length;if(this._matchOne(e,f,i,b,0))c=f.length;else{if(e[e.length-1]!==""||n+f.length===e.length||!this._matchOne(e,f,i,b-1,0))return!1;c=f.length+1}}if(!u.length){let b=!!c;for(let v=n;v<e.length-c;v++){let S=String(e[v]);if(b=!0,S==="."||S===".."||!this.options.dot&&S.charAt(0)===".")return!1}return i||b}let h=[[[],0]],d=h[0],m=0,p=[0];for(let b of u)b===Ae?(p.push(m),d=[[],0],h.push(d)):(d[0].push(b),m++);let E=h.length-1,y=e.length-c;for(let b of h)b[1]=y-(p[E--]+b[0].length);return!!this._matchGlobStarBodySections(e,h,n,0,i,0,!!c)}_matchGlobStarBodySections(e,r,i,n,s,o,a){let l=r[n];if(!l){for(let c=i;c<e.length;c++){a=!0;let h=e[c];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1}return a}let[u,f]=l;for(;i<=f;){if(this._matchOne(e.slice(0,i+u.length),u,s,i,0)&&o<this.maxGlobstarRecursion){let d=this._matchGlobStarBodySections(e,r,i+u.length,n+1,s,o+1,a);if(d!==!1)return d}let h=e[i];if(h==="."||h===".."||!this.options.dot&&h.charAt(0)===".")return!1;i++}return s||null}_matchOne(e,r,i,n,s){let o,a,l,u;for(o=n,a=s,l=e.length,u=r.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let f=r[a],c=e[o];if(this.debug(r,f,c),f===!1||f===Ae)return!1;let h;if(typeof f=="string"?(h=c===f,this.debug("string match",f,c,h)):(h=c.match(f),this.debug("pattern match",f,c,h)),!h)return!1}if(o===l&&a===u)return!0;if(o===l)return i;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return Xc(this.pattern,this.options)}parse(e,r){Mn(e);let i=this.options;if(e==="**")if(i.noglobstar)e="*";else return Ae;if(e==="")return"";let n="",s=!1,o=!1,a=[],l=[],u,f=!1,c=-1,h=-1,d,m,p,E=e.charAt(0)===".",y=i.dot||E,b=()=>E?"":y?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",v=x=>x.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",S=()=>{if(u){switch(u){case"*":n+=sa,s=!0;break;case"?":n+=la,s=!0;break;default:n+="\\"+u;break}this.debug("clearStateChar %j %j",u,n),u=!1}};for(let x=0,O;x<e.length&&(O=e.charAt(x));x++){if(this.debug("%s %s %s %j",e,x,n,O),o){if(O==="/")return!1;Kc[O]&&(n+="\\"),n+=O,o=!1;continue}switch(O){case"/":return!1;case"\\":if(f&&e.charAt(x+1)==="-"){n+=O;continue}S(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,x,n,O),f){this.debug(" in class"),O==="!"&&x===h+1&&(O="^"),n+=O;continue}if(O==="*"&&u==="*")continue;this.debug("call clearStateChar %j",u),S(),u=O,i.noext&&S();continue;case"(":{if(f){n+="(";continue}if(!u){n+="\\(";continue}let w={type:u,start:x-1,reStart:n.length,open:Yc[u].open,close:Yc[u].close};this.debug(this.pattern," ",w),a.push(w),n+=w.open,w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1))),this.debug("plType %j %j",u,n),u=!1;continue}case")":{let w=a[a.length-1];if(f||!w){n+="\\)";continue}a.pop(),S(),s=!0,m=w,n+=m.close,m.type==="!"&&l.push(Object.assign(m,{reEnd:n.length}));continue}case"|":{let w=a[a.length-1];if(f||!w){n+="\\|";continue}S(),n+="|",w.start===0&&w.type!=="!"&&(E=!0,n+=v(e.slice(x+1)));continue}case"[":if(S(),f){n+="\\"+O;continue}f=!0,h=x,c=n.length,n+=O;continue;case"]":if(x===h+1||!f){n+="\\"+O;continue}d=e.substring(h+1,x);try{RegExp("["+Tv(vv(d))+"]"),n+=O}catch{n=n.substring(0,c)+"(?:$.)"}s=!0,f=!1;continue;default:S(),Kc[O]&&!(O==="^"&&f)&&(n+="\\"),n+=O;break}}for(f&&(d=e.slice(h+1),p=this.parse(d,oa),n=n.substring(0,c)+"\\["+p[0],s=s||p[1]),m=a.pop();m;m=a.pop()){let x;x=n.slice(m.reStart+m.open.length),this.debug("setting tail",n,m),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,(w,R,A)=>(A||(A="\\"),R+R+A+"|")),this.debug(`tail=%j
3
3
  %s`,x,x,m,n);let O=m.type==="*"?sa:m.type==="?"?la:"\\"+m.type;s=!0,n=n.slice(0,m.reStart)+O+"\\("+x}S(),o&&(n+="\\\\");let T=wv[n.charAt(0)];for(let x=l.length-1;x>-1;x--){let O=l[x],w=n.slice(0,O.reStart),R=n.slice(O.reStart,O.reEnd-8),A=n.slice(O.reEnd),N=n.slice(O.reEnd-8,O.reEnd)+A,G=w.split(")").length,ue=w.split("(").length-G,Z=A;for(let V=0;V<ue;V++)Z=Z.replace(/\)[+*?]?/,"");A=Z;let te=A===""&&r!==oa?"(?:$|\\/)":"";n=w+R+A+te+N}if(n!==""&&s&&(n="(?=.)"+n),T&&(n=b()+n),r===oa)return[n,s];if(i.nocase&&!s&&(s=e.toUpperCase()!==e.toLowerCase()),!s)return Ev(e);let D=i.nocase?"i":"";try{return Object.assign(new RegExp("^"+n+"$",D),{_glob:e,_src:n})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?sa:r.dot?mv:bv,n=r.nocase?"i":"",s=e.map(o=>(o=o.map(a=>typeof a=="string"?xv(a):a===Ae?Ae:a._src).reduce((a,l)=>(a[a.length-1]===Ae&&l===Ae||a.push(l),a),[]),o.forEach((a,l)=>{a!==Ae||o[l-1]===Ae||(l===0?o.length>1?o[l+1]="(?:\\/|"+i+"\\/)?"+o[l+1]:o[l]=i:l===o.length-1?o[l-1]+="(?:\\/|"+i+")?":(o[l-1]+="(?:\\/|\\/"+i+"\\/)"+o[l+1],o[l+1]=Ae))}),o.filter(a=>a!==Ae).join("/"))).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,n)}catch{this.regexp=!1}return this.regexp}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;aa.sep!=="/"&&(e=e.split(aa.sep).join("/")),e=e.split(Zc),this.debug(this.pattern,"split",e);let n=this.set;this.debug(this.pattern,"set",n);let s;for(let o=e.length-1;o>=0&&(s=e[o],!s);o--);for(let o=0;o<n.length;o++){let a=n[o],l=e;if(i.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return Ne.defaults(e).Minimatch}};Ne.Minimatch=wr});var nh=g((i3,ih)=>{"use strict";ih.exports=rh;var ca=P("fs"),{EventEmitter:Rv}=P("events"),{Minimatch:fa}=Jc(),{resolve:Av}=P("path");function Ov(t,e){return new Promise((r,i)=>{ca.readdir(t,{withFileTypes:!0},(n,s)=>{if(n)switch(n.code){case"ENOTDIR":e?i(n):r([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":r([]);break;default:i(n);break}else r(s)})})}function eh(t,e){return new Promise((r,i)=>{(e?ca.stat:ca.lstat)(t,(s,o)=>{s?s.code==="ENOENT"?r(e?eh(t,!1):null):r(null):r(o)})})}async function*th(t,e,r,i,n,s){let o=await Ov(e+t,s);for(let a of o){let l=a.name;l===void 0&&(l=a,i=!0);let u=t+"/"+l,f=u.slice(1),c=e+"/"+f,h=null;(i||r)&&(h=await eh(c,r)),!h&&a.name!==void 0&&(h=a),h===null&&(h={isDirectory:()=>!1}),h.isDirectory()?n(f)||(yield{relative:f,absolute:c,stats:h},yield*th(u,e,r,i,n,!1)):yield{relative:f,absolute:c,stats:h}}}async function*Iv(t,e,r,i){yield*th("",t,e,r,i,!0)}function Dv(t){return{pattern:t.pattern,dot:!!t.dot,noglobstar:!!t.noglobstar,matchBase:!!t.matchBase,nocase:!!t.nocase,ignore:t.ignore,skip:t.skip,follow:!!t.follow,stat:!!t.stat,nodir:!!t.nodir,mark:!!t.mark,silent:!!t.silent,absolute:!!t.absolute}}var qn=class extends Rv{constructor(e,r,i){if(super(),typeof r=="function"&&(i=r,r=null),this.options=Dv(r||{}),this.matchers=[],this.options.pattern){let n=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=n.map(s=>new fa(s,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let n=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=n.map(s=>new fa(s,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let n=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=n.map(s=>new fa(s,{dot:!0}))}this.iterator=Iv(Av(e||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,i&&(this._matches=[],this.on("match",n=>this._matches.push(this.options.absolute?n.absolute:n.relative)),this.on("error",n=>i(n)),this.on("end",()=>i(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(e){return this.skipMatchers.some(r=>r.match(e))}_fileMatches(e,r){let i=e+(r?"/":"");return(this.matchers.length===0||this.matchers.some(n=>n.match(i)))&&!this.ignoreMatchers.some(n=>n.match(i))&&(!this.options.nodir||!r)}_next(){!this.paused&&!this.aborted?this.iterator.next().then(e=>{if(e.done)this.emit("end");else{let r=e.value.stats.isDirectory();if(this._fileMatches(e.value.relative,r)){let i=e.value.relative,n=e.value.absolute;this.options.mark&&r&&(i+="/",n+="/"),this.options.stat?this.emit("match",{relative:i,absolute:n,stat:e.value.stats}):this.emit("match",{relative:i,absolute:n})}this._next(this.iterator)}}).catch(e=>{this.abort(),this.emit("error",e),!e.code&&!this.options.silent&&console.error(e)}):this.inactive=!0}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}};function rh(t,e,r){return new qn(t,e,r)}rh.ReaddirGlob=qn});var rd={};QE(rd,{all:()=>wa,allLimit:()=>Sa,allSeries:()=>Ea,any:()=>Ia,anyLimit:()=>Da,anySeries:()=>Pa,apply:()=>fh,applyEach:()=>_h,applyEachSeries:()=>yh,asyncify:()=>jn,auto:()=>Ca,autoInject:()=>mh,cargo:()=>bh,cargoQueue:()=>wh,compose:()=>Sh,concat:()=>pa,concatLimit:()=>mi,concatSeries:()=>ga,constant:()=>Eh,default:()=>kx,detect:()=>_a,detectLimit:()=>ya,detectSeries:()=>ma,dir:()=>xh,doDuring:()=>Bn,doUntil:()=>Th,doWhilst:()=>Bn,during:()=>$n,each:()=>ba,eachLimit:()=>Un,eachOf:()=>Fe,eachOfLimit:()=>yi,eachOfSeries:()=>Xe,eachSeries:()=>Wn,ensureAsync:()=>qa,every:()=>wa,everyLimit:()=>Sa,everySeries:()=>Ea,filter:()=>va,filterLimit:()=>xa,filterSeries:()=>Ta,find:()=>_a,findLimit:()=>ya,findSeries:()=>ma,flatMap:()=>pa,flatMapLimit:()=>mi,flatMapSeries:()=>ga,foldl:()=>Sr,foldr:()=>Aa,forEach:()=>ba,forEachLimit:()=>Un,forEachOf:()=>Fe,forEachOfLimit:()=>yi,forEachOfSeries:()=>Xe,forEachSeries:()=>Wn,forever:()=>Ah,groupBy:()=>Oh,groupByLimit:()=>Zn,groupBySeries:()=>Ih,inject:()=>Sr,log:()=>Dh,map:()=>Yn,mapLimit:()=>Si,mapSeries:()=>Na,mapValues:()=>Ph,mapValuesLimit:()=>Qn,mapValuesSeries:()=>Lh,memoize:()=>Nh,nextTick:()=>Ch,parallel:()=>kh,parallelLimit:()=>Mh,priorityQueue:()=>qh,queue:()=>ja,race:()=>Fh,reduce:()=>Sr,reduceRight:()=>Aa,reflect:()=>Gn,reflectAll:()=>jh,reject:()=>Bh,rejectLimit:()=>Uh,rejectSeries:()=>Wh,retry:()=>zn,retryable:()=>$h,select:()=>va,selectLimit:()=>xa,selectSeries:()=>Ta,seq:()=>Ma,series:()=>Hh,setImmediate:()=>At,some:()=>Ia,someLimit:()=>Da,someSeries:()=>Pa,sortBy:()=>Vh,timeout:()=>Yh,times:()=>Kh,timesLimit:()=>Xn,timesSeries:()=>Zh,transform:()=>Qh,tryEach:()=>Xh,unmemoize:()=>Jh,until:()=>ed,waterfall:()=>td,whilst:()=>$n,wrapSync:()=>jn});function fh(t,...e){return(...r)=>t(...e,...r)}function bi(t){return function(...e){var r=e.pop();return t.call(this,e,r)}}function dh(t){setTimeout(t,0)}function ph(t){return(e,...r)=>t(()=>e(...r))}function jn(t){return wi(t)?function(...e){let r=e.pop(),i=t.apply(this,e);return sh(i,r)}:bi(function(e,r){var i;try{i=t.apply(this,e)}catch(n){return r(n)}if(i&&typeof i.then=="function")return sh(i,r);r(null,i)})}function sh(t,e){return t.then(r=>{oh(e,null,r)},r=>{oh(e,r&&(r instanceof Error||r.message)?r:new Error(r))})}function oh(t,e,r){try{t(e,r)}catch(i){At(n=>{throw n},i)}}function wi(t){return t[Symbol.toStringTag]==="AsyncFunction"}function Lv(t){return t[Symbol.toStringTag]==="AsyncGenerator"}function Nv(t){return typeof t[Symbol.asyncIterator]=="function"}function q(t){if(typeof t!="function")throw new Error("expected a function");return wi(t)?jn(t):t}function M(t,e){if(e||(e=t.length),!e)throw new Error("arity is undefined");function r(...i){return typeof i[e-1]=="function"?t.apply(this,i):new Promise((n,s)=>{i[e-1]=(o,...a)=>{if(o)return s(o);n(a.length>1?a:a[0])},t.apply(this,i)})}return r}function gh(t){return function(r,...i){return M(function(s){var o=this;return t(r,(a,l)=>{q(a).apply(o,i.concat(l))},s)})}}function La(t,e,r,i){e=e||[];var n=[],s=0,o=q(r);return t(e,(a,l,u)=>{var f=s++;o(a,(c,h)=>{n[f]=h,u(c)})},a=>{i(a,n)})}function Hn(t){return t&&typeof t.length=="number"&&t.length>=0&&t.length%1===0}function Ot(t){function e(...r){if(t!==null){var i=t;t=null,i.apply(this,r)}}return Object.assign(e,t),e}function Cv(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}function kv(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}function Mv(t){var e=-1;return function(){var i=t.next();return i.done?null:(e++,{value:i.value,key:e})}}function qv(t){var e=t?Object.keys(t):[],r=-1,i=e.length;return function n(){var s=e[++r];return s==="__proto__"?n():r<i?{value:t[s],key:s}:null}}function Fv(t){if(Hn(t))return kv(t);var e=Cv(t);return e?Mv(e):qv(t)}function It(t){return function(...e){if(t===null)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}}function ah(t,e,r,i){let n=!1,s=!1,o=!1,a=0,l=0;function u(){a>=e||o||n||(o=!0,t.next().then(({value:h,done:d})=>{if(!(s||n)){if(o=!1,d){n=!0,a<=0&&i(null);return}a++,r(h,l,f),l++,u()}}).catch(c))}function f(h,d){if(a-=1,!s){if(h)return c(h);if(h===!1){n=!0,s=!0;return}if(d===Vn||n&&a<=0)return n=!0,i(null);u()}}function c(h){s||(o=!1,n=!0,i(h))}u()}function jv(t,e,r,i){return $e(e)(t,q(r),i)}function Bv(t,e,r){r=Ot(r);var i=0,n=0,{length:s}=t,o=!1;s===0&&r(null);function a(l,u){l===!1&&(o=!0),o!==!0&&(l?r(l):(++n===s||u===Vn)&&r(null))}for(;i<s;i++)e(t[i],i,It(a))}function Uv(t,e,r){return yi(t,1/0,e,r)}function Wv(t,e,r){var i=Hn(t)?Bv:Uv;return i(t,q(e),r)}function Gv(t,e,r){return La(Fe,t,e,r)}function zv(t,e,r){return yi(t,1,e,r)}function $v(t,e,r){return La(Xe,t,e,r)}function Er(){let t,e;function r(i,...n){if(i)return e(i);t(n.length>1?n:n[0])}return r[vr]=new Promise((i,n)=>{t=i,e=n}),r}function Ca(t,e,r){typeof e!="number"&&(r=e,e=null),r=Ot(r||Er());var i=Object.keys(t).length;if(!i)return r(null);e||(e=i);var n={},s=0,o=!1,a=!1,l=Object.create(null),u=[],f=[],c={};Object.keys(t).forEach(v=>{var S=t[v];if(!Array.isArray(S)){h(v,[S]),f.push(v);return}var T=S.slice(0,S.length-1),D=T.length;if(D===0){h(v,S),f.push(v);return}c[v]=D,T.forEach(x=>{if(!t[x])throw new Error("async.auto task `"+v+"` has a non-existent dependency `"+x+"` in "+T.join(", "));m(x,()=>{D--,D===0&&h(v,S)})})}),y(),d();function h(v,S){u.push(()=>E(v,S))}function d(){if(!o){if(u.length===0&&s===0)return r(null,n);for(;u.length&&s<e;){var v=u.shift();v()}}}function m(v,S){var T=l[v];T||(T=l[v]=[]),T.push(S)}function p(v){var S=l[v]||[];S.forEach(T=>T()),d()}function E(v,S){if(!a){var T=It((x,...O)=>{if(s--,x===!1){o=!0;return}if(O.length<2&&([O]=O),x){var w={};if(Object.keys(n).forEach(R=>{w[R]=n[R]}),w[v]=O,a=!0,l=Object.create(null),o)return;r(x,w)}else n[v]=O,p(v)});s++;var D=q(S[S.length-1]);S.length>1?D(n,T):D(T)}}function y(){for(var v,S=0;f.length;)v=f.pop(),S++,b(v).forEach(T=>{--c[T]===0&&f.push(T)});if(S!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function b(v){var S=[];return Object.keys(t).forEach(T=>{let D=t[T];Array.isArray(D)&&D.indexOf(v)>=0&&S.push(T)}),S}return r[vr]}function Zv(t){let e="",r=0,i=t.indexOf("*/");for(;r<t.length;)if(t[r]==="/"&&t[r+1]==="/"){let n=t.indexOf(`
4
4
  `,r);r=n===-1?t.length:n}else if(i!==-1&&t[r]==="/"&&t[r+1]==="*"){let n=t.indexOf("*/",r);n!==-1?(r=n+2,i=t.indexOf("*/",r)):(e+=t[r],r++)}else e+=t[r],r++;return e}function Qv(t){let e=Zv(t.toString()),r=e.match(Hv);if(r||(r=e.match(Vv)),!r)throw new Error(`could not parse args in autoInject
5
5
  Source:
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-75XK2HKS.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
2
+ import{a as m}from"./chunk-HCBYKLMW.js";import{t as o}from"./chunk-7ONI2K3S.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as a}from"./chunk-UR6MHSHU.js";var e=a(m(),1),u={default:o.muted,error:o.red,success:o.green,info:o.purple,warning:o.yellow};function T({title:t,titleColor:l,borderColor:d,variant:n="default",children:c,width:s,paddingX:x=2,paddingY:g=0,marginBottom:p=0}){let f=d??u[n],B=l??(n==="default"?o.purple:u[n]);return(0,e.jsxs)(r,{flexDirection:"column",marginBottom:p,children:[t&&(0,e.jsx)(r,{marginBottom:0,children:(0,e.jsxs)(i,{color:B,bold:!0,children:[" ",t]})}),(0,e.jsx)(r,{borderStyle:"round",borderColor:f,flexDirection:"column",paddingX:x,paddingY:g,width:s,children:c})]})}function h({label:t,value:l,labelColor:d=o.dimmed,valueColor:n,labelWidth:c=14}){return(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:c,children:(0,e.jsx)(i,{color:d,children:t})}),(0,e.jsx)(i,{color:n,children:l})]})}function C({label:t}){return(0,e.jsx)(r,{marginTop:1,marginBottom:0,children:(0,e.jsx)(i,{bold:!0,children:t})})}export{T as a,h as b,C as c};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-75XK2HKS.js";import{a as s,b as n}from"./chunk-C44QQJR4.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var c=u(f(),1);var R=u(f(),1);var m=u(f(),1);function b(o,r){let a=(0,m.useRef)(o);a.current=o,(0,m.useEffect)(()=>{if(r===null)return;let i=setInterval(()=>a.current(),r);return()=>clearInterval(i)},[r])}var B=u(d(),1),T=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function v({active:o=!0}){let[r,a]=(0,R.useState)(0);return b(()=>{a(i=>(i+1)%T.length)},o?80:null),(0,B.jsx)(n,{color:t.purple,children:o?T[r]:"\u25CF"})}var e=u(d(),1);function $(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function k(o,r,a,i){return o.map(p=>p.name===r?{...p,status:a,detail:i}:p)}function I(o){let r=o/1e3;if(r<60)return`${r.toFixed(1)}s`;let a=Math.floor(r/60),i=Math.round(r%60);return`${a}m ${i}s`}function O(o){let[r,a]=(0,c.useState)(0),i=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!o)return;i.current=Date.now();let p=setInterval(()=>{a(Date.now()-i.current)},100);return()=>clearInterval(p)},[o]),r}function y({steps:o,status:r,testUrl:a,error:i}){let p=O(r==="uploading");return r==="uploading"?(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",I(p)]})]}),(0,e.jsx)(s,{flexDirection:"column",marginTop:1,children:o.filter(l=>l.status!=="skipped").map((l,E,P)=>{let D=E===P.length-1?"\u2514\u2500":"\u251C\u2500",g=l.status==="done",x=l.status==="running",S=l.status==="failed";return(0,e.jsxs)(s,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",D," "]}),(0,e.jsx)(s,{width:3,children:x?(0,e.jsx)(v,{}):g?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):S?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:g?t.dim:x?t.base:S?t.red:t.muted,children:l.label}),l.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",l.detail]})]},l.name)})}),(0,e.jsx)(s,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):r==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(s,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{b as a,v as b,$ as c,k as d,y as e};
2
+ import{a as d}from"./chunk-HCBYKLMW.js";import{t}from"./chunk-7ONI2K3S.js";import{a as s,b as n}from"./chunk-C44QQJR4.js";import{a as f}from"./chunk-6YGTRKDT.js";import{e as u}from"./chunk-UR6MHSHU.js";var c=u(f(),1);var R=u(f(),1);var m=u(f(),1);function b(o,r){let a=(0,m.useRef)(o);a.current=o,(0,m.useEffect)(()=>{if(r===null)return;let i=setInterval(()=>a.current(),r);return()=>clearInterval(i)},[r])}var B=u(d(),1),T=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function v({active:o=!0}){let[r,a]=(0,R.useState)(0);return b(()=>{a(i=>(i+1)%T.length)},o?80:null),(0,B.jsx)(n,{color:t.purple,children:o?T[r]:"\u25CF"})}var e=u(d(),1);function $(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function k(o,r,a,i){return o.map(p=>p.name===r?{...p,status:a,detail:i}:p)}function I(o){let r=o/1e3;if(r<60)return`${r.toFixed(1)}s`;let a=Math.floor(r/60),i=Math.round(r%60);return`${a}m ${i}s`}function O(o){let[r,a]=(0,c.useState)(0),i=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!o)return;i.current=Date.now();let p=setInterval(()=>{a(Date.now()-i.current)},100);return()=>clearInterval(p)},[o]),r}function y({steps:o,status:r,testUrl:a,error:i}){let p=O(r==="uploading");return r==="uploading"?(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.primary,children:"\u2601 "}),(0,e.jsx)(n,{color:t.primary,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dimmed,children:[" ",I(p)]})]}),(0,e.jsx)(s,{flexDirection:"column",marginTop:1,children:o.filter(l=>l.status!=="skipped").map((l,E,P)=>{let D=E===P.length-1?"\u2514\u2500":"\u251C\u2500",g=l.status==="done",x=l.status==="running",S=l.status==="failed";return(0,e.jsxs)(s,{children:[(0,e.jsxs)(n,{color:t.dimmed,children:[" ",D," "]}),(0,e.jsx)(s,{width:3,children:x?(0,e.jsx)(v,{}):g?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):S?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:g?t.dim:x?t.base:S?t.red:t.muted,children:l.label}),l.detail&&(0,e.jsxs)(n,{color:t.dimmed,children:[" ",l.detail]})]},l.name)})}),(0,e.jsx)(s,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):r==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(s,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(s,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(s,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dimmed,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{b as a,v as b,$ as c,k as d,y as e};
@@ -0,0 +1,20 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as De}from"./chunk-LBW6EFWN.js";import{a as Pe,b as Fe}from"./chunk-CKMDFVL6.js";import{a as fe}from"./chunk-PWGEMRBD.js";import{b as Le}from"./chunk-M5TQDTQN.js";import{a as je}from"./chunk-Y3MXIITZ.js";import{a as ne}from"./chunk-2O7RIXHD.js";import{a as re}from"./chunk-XQL5WHKR.js";import{a as X}from"./chunk-HCBYKLMW.js";import{c as de,d as Ae,h as Ie,t as v}from"./chunk-7ONI2K3S.js";import{a as x,b as h,h as Ce,i as z,j as Ee,k as Re}from"./chunk-C44QQJR4.js";import{a as te}from"./chunk-6YGTRKDT.js";import{a as _e}from"./chunk-YUUZDFT7.js";import{e as $}from"./chunk-UR6MHSHU.js";var R=$(te(),1);var J=$(te(),1);var ve=$(te(),1);var Y=$(X(),1);function Be({history:o,onSelect:e,onClose:t}){let[i,l]=(0,ve.useState)(""),[r,c]=(0,ve.useState)(0),n=i?o.search(i).slice(0,8):[];return z((a,_)=>{if(_.escape){t();return}if(_.return){n.length>0&&n[r]?e(n[r]):t();return}if(_.upArrow){c(b=>Math.max(0,b-1));return}if(_.downArrow){c(b=>Math.min(n.length-1,b+1));return}if(_.backspace||_.delete){l(b=>b.slice(0,-1)),c(0);return}a&&!_.ctrl&&!_.meta&&(l(b=>b+a),c(0))}),(0,Y.jsxs)(x,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Y.jsx)(h,{color:v.muted,bold:!0,children:"reverse search"}),(0,Y.jsxs)(x,{gap:1,children:[(0,Y.jsx)(h,{color:v.dimmed,children:"search:"}),(0,Y.jsx)(h,{children:i}),(0,Y.jsx)(h,{color:v.purple,children:"\u2588"})]}),n.length>0&&(0,Y.jsx)(h,{children:" "}),n.map((a,_)=>(0,Y.jsx)(x,{marginLeft:2,children:(0,Y.jsxs)(h,{color:_===r?v.purple:v.dimmed,bold:_===r,children:[_===r?"\u25B8 ":" ",a]})},`${_}-${a}`))]})}var Q=$(X(),1);function Oe({commands:o,selectedIndex:e}){return o.length===0?null:(0,Q.jsx)(x,{flexDirection:"column",marginBottom:0,children:o.map((t,i)=>{let l=i===e;return(0,Q.jsxs)(x,{children:[(0,Q.jsx)(h,{color:l?v.primary:v.dimmed,children:l?"\u276F ":" "}),(0,Q.jsxs)(h,{color:l?v.primary:void 0,bold:l,children:["/",t.name]}),t.args&&(0,Q.jsxs)(h,{color:v.dimmed,children:[" ",t.args]}),(0,Q.jsxs)(h,{color:v.dimmed,children:[" ",t.description]})]},t.name)})})}var ge=$(te(),1);var qe=27,Qe=127,Ze=11;function et(o){return o>=64&&o<=126}function tt(o,e){o===Ze&&e({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(o)})}function rt(o,e){o===Qe&&e({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function nt(o,e){let t=o.map(l=>String.fromCharCode(l)).join(""),i=/^\[1;([0-9]+)([A-D])$/.exec(t);if(i){let l=parseInt(i[1],10),r=i[2],c={raw:"\x1B"+t};if(l===2)c.shift=!0;else if(l===3)c.meta=!0;else if(l===5)c.ctrl=!0;else return;r==="A"?c.arrowUp=!0:r==="B"?c.arrowDown=!0:r==="C"?c.arrowRight=!0:r==="D"&&(c.arrowLeft=!0),e(c);return}if(t==="[H"||t==="[1~"||t==="[7~"){e({home:!0,raw:"\x1B"+t});return}if(t==="[F"||t==="[4~"||t==="[8~"){e({end:!0,raw:"\x1B"+t});return}if(t==="[3;5~"){e({delete:!0,ctrl:!0,raw:"\x1B"+t});return}if(t==="[3;3~"){e({delete:!0,meta:!0,raw:"\x1B"+t});return}}function ot(o,e){o===72?e({home:!0,raw:"\x1BO"+String.fromCharCode(o)}):o===70&&e({end:!0,raw:"\x1BO"+String.fromCharCode(o)})}function it(){let o="IDLE",e=[];function t(){o="IDLE",e=[]}return{feed(i,l){for(let r of i)o==="IDLE"?r===qe?(o="ESC",e=[]):tt(r,l):o==="ESC"?r===91?(o="CSI",e=[]):r===79?(o="SS3",e=[]):(rt(r,l),t()):o==="CSI"?(e.push(r),et(r)&&(nt([91,...e],l),t())):o==="SS3"&&(ot(r,l),t())},flushIdle(i){o==="ESC"&&e.length===0&&i({raw:"\x1B"}),t()}}}function Ne(o,e={}){let t=(0,ge.useRef)(o);t.current=o;let{stdin:i}=Ce();(0,ge.useEffect)(()=>{if(e.isActive===!1||!i)return;let l=it(),r=null,c=n=>{r&&(clearTimeout(r),r=null);let a=Buffer.isBuffer(n)?n:Buffer.from(n,"binary");l.feed(a,_=>t.current(_)),r=setTimeout(()=>{l.flushIdle(_=>t.current(_)),r=null},50)};return i.on("data",c),()=>{i.removeListener("data",c),r&&clearTimeout(r)}},[e.isActive,i])}var D=$(X(),1);function $e({onSubmit:o,onEscape:e,history:t,placeholder:i="Type an objective or /command...",commands:l}){let[r,c]=(0,J.useState)([]),[n,a]=(0,J.useState)(0),[_,b]=(0,J.useState)("none"),[j,C]=(0,J.useState)(-1),A=(0,J.useRef)(""),[L,ee]=(0,J.useState)(!0),{stdout:N}=Re(),F=N?.columns??80,[U,K]=(0,J.useState)(0),I=r.join(""),G=(()=>{if(_!=="none"||r.length===0)return"";if(I.startsWith("/")&&l&&I.length>=2){let s=I.slice(1).toLowerCase(),u=l.find(y=>y.name.startsWith(s)&&y.name!==s);return u?`/${u.name}`.slice(I.length):""}if(I.startsWith("/"))return"";let f=t.getAll();for(let s=f.length-1;s>=0;s--)if(f[s].startsWith(I)&&f[s]!==I)return f[s].slice(I.length);return""})(),B=(()=>{if(!l||!I.startsWith("/"))return[];let f=I.length>=2?I.slice(1).toLowerCase():"";return f&&l.some(s=>s.name===f)?[]:l.filter(s=>!f||s.name.startsWith(f))})(),H=B.length>0&&I.startsWith("/");z((f,s)=>{if(L&&f&&ee(!1),s.return){if(H&&B[U]){let u=`/${B[U].name}`;t.push(u),o(u),c([]),a(0),b("none"),C(-1),A.current="",ee(!0),K(0);return}I.trim()&&(t.push(I.trim()),o(I.trim()),c([]),a(0),b("none"),C(-1),A.current="",ee(!0),K(0));return}if(s.escape){_!=="none"?b("none"):r.length>0?(c([]),a(0),C(-1),A.current=""):e?.();return}if(s.tab){if(H&&B[U]){let u=`/${B[U].name}`;c([...u]),a(u.length),K(0);return}if(G){let u=I+G;c([...u]),a(u.length);return}return}if(s.ctrl&&f==="r"){b("search");return}if(s.ctrl&&f==="a"){a(0);return}if(s.ctrl&&f==="e"){a(r.length);return}if(s.ctrl&&f==="w"){if(n===0)return;let u=n-1;for(;u>0&&r[u]===" ";)u--;for(;u>0&&r[u-1]!==" ";)u--;let y=[...r.slice(0,u),...r.slice(n)];c(y),a(u);return}if(s.ctrl&&f==="u"){c([]),a(0),C(-1),b("none");return}if(s.meta&&f==="b"){let u=n-1;for(;u>0&&r[u]===" ";)u--;for(;u>0&&r[u-1]!==" ";)u--;a(Math.max(0,u));return}if(s.meta&&f==="f"){let u=n;for(;u<r.length&&r[u]!==" ";)u++;for(;u<r.length&&r[u]===" ";)u++;a(u);return}if(s.leftArrow){if(s.ctrl||s.shift)return;a(u=>Math.max(0,u-1));return}if(s.rightArrow){if(s.ctrl||s.shift)return;if(n>=r.length&&G){let u=I+G;c([...u]),a(u.length)}else a(u=>Math.min(r.length,u+1));return}if(s.upArrow){if(s.shift)return;if(H){K(u=>Math.max(0,u-1));return}if(_==="none"){let u=t.getAll();if(u.length===0)return;if(j===-1){A.current=I,C(u.length-1);let y=u[u.length-1];c([...y]),a(y.length)}else if(j>0){let y=j-1;C(y);let O=u[y];c([...O]),a(O.length)}}return}if(s.downArrow){if(s.shift)return;if(H){K(u=>Math.min(B.length-1,u+1));return}if(_==="none"){let u=t.getAll();if(j===-1)return;if(j<u.length-1){let y=j+1;C(y);let O=u[y];c([...O]),a(O.length)}else{C(-1);let y=A.current;c([...y]),a(y.length)}}return}if(s.backspace||s.delete){if(s.meta||s.ctrl)return;if(n>0){let u=[...r.slice(0,n-1),...r.slice(n)];c(u),a(n-1),C(-1),K(0)}return}if(f&&!s.ctrl&&!s.meta){let u=[...r.slice(0,n),...f,...r.slice(n)];c(u),a(n+f.length),C(-1),K(0)}},{isActive:_!=="search"}),Ne(f=>{if(f.home){a(0);return}if(f.end){a(r.length);return}if(f.killToEnd){c(r.slice(0,n));return}if(f.arrowLeft&&(f.ctrl||f.meta)){let s=n-1;for(;s>0&&r[s]===" ";)s--;for(;s>0&&r[s-1]!==" ";)s--;a(Math.max(0,s));return}if(f.arrowRight&&(f.ctrl||f.meta)){let s=n;for(;s<r.length&&r[s]!==" ";)s++;for(;s<r.length&&r[s]===" ";)s++;a(s);return}if(f.backspace&&f.meta){if(n===0)return;let s=n-1;for(;s>0&&r[s]===" ";)s--;for(;s>0&&r[s-1]!==" ";)s--;let u=[...r.slice(0,s),...r.slice(n)];c(u),a(s);return}if(f.delete&&(f.ctrl||f.meta)){let s=n;for(;s<r.length&&r[s]===" ";)s++;for(;s<r.length&&r[s]!==" ";)s++;c([...r.slice(0,n),...r.slice(s)]);return}},{isActive:_!=="search"});let se=f=>{c([...f]),a(f.length),b("none")},M=()=>{b("none")},V=(()=>{if(L&&r.length===0)return null;let f=n>=r.length,s=r.slice(0,n).join(""),u=f?" ":r[n],y=f?"":r.slice(n+1).join(""),O="\u276F "+s+u+y+G,W=2,d=W+s.length,g=d+1,p=g+y.length,m=O.length,S=Math.max(1,Math.ceil(m/F)),E=[];for(let P=0;P<S;P++)E.push({start:P*F,end:Math.min((P+1)*F,m)});return{full:O,p:W,b:d,c:g,a:p,lines:E}})();return(0,D.jsxs)(x,{flexDirection:"column",children:[_==="search"&&(0,D.jsx)(Be,{history:t,onSelect:se,onClose:M}),H&&(0,D.jsx)(Oe,{commands:B,selectedIndex:U}),(0,D.jsx)(h,{color:v.muted,children:"\u2500".repeat(F)}),V===null?(0,D.jsxs)(x,{children:[(0,D.jsx)(h,{color:v.purple,children:"\u276F "}),(0,D.jsx)(h,{inverse:!0,children:" "}),(0,D.jsx)(h,{color:v.dimmed,children:i})]}):(0,D.jsx)(x,{flexDirection:"column",children:V.lines.map(({start:f,end:s},u)=>{let{full:y,p:O,b:W,c:d,a:g}=V,p=[];return s>0&&f<O&&p.push((0,D.jsx)(h,{color:v.purple,children:y.slice(Math.max(f,0),Math.min(O,s))},"p")),s>O&&f<W&&p.push((0,D.jsx)(h,{children:y.slice(Math.max(O,f),Math.min(W,s))},"b")),s>W&&f<d&&p.push((0,D.jsx)(h,{color:v.purple,inverse:!0,children:y.slice(Math.max(W,f),Math.min(d,s))},"c")),s>d&&f<g&&p.push((0,D.jsx)(h,{children:y.slice(Math.max(d,f),Math.min(g,s))},"a")),s>g&&p.push((0,D.jsx)(h,{color:v.dimmed,children:y.slice(Math.max(g,f),s)},"g")),(0,D.jsx)(x,{children:p},u)})}),(0,D.jsx)(re,{bindings:[{keys:"\u2191\u2193",label:"history"},{keys:"\u21B5",label:"submit"},{keys:"tab",label:"complete"},{keys:"ctrl+r",label:"search"}],escBackLabel:"clear"})]})}var k=$(te(),1);var w=$(X(),1);function st(o){let e=[{id:"method",label:"Auth method",options:[{label:"Basic Auth",value:"basic"},{label:"OAuth (browser)",value:"oauth"}]}];return o&&e.push({id:"env",label:"Environment",options:[{label:"prod",value:"prod"},{label:"stage",value:"stage"}]}),e.push({id:"profile",label:"Profile"}),e.push({id:"credentials",label:"Credentials"}),e}function ke({devMode:o,profiles:e,onBasicLogin:t,onOAuthLogin:i,onComplete:l,onCancel:r}){let c=st(o),[n,a]=(0,k.useState)(0),[_,b]=(0,k.useState)(0),[j,C]=(0,k.useState)({}),[A,L]=(0,k.useState)("select"),[ee,N]=(0,k.useState)(""),[F,U]=(0,k.useState)("username"),[K,I]=(0,k.useState)(""),[G,B]=(0,k.useState)(null),[H,se]=(0,k.useState)(null),M=c[n],V=j.method??"basic",f=j.env??"prod",s=(0,k.useCallback)(()=>{let m=e.filter(S=>S.env===f).map(S=>({label:`${S.profile} [${S.env}]`,value:S.profile}));return m.push({label:"+ Create new",value:"__new__"}),m},[e,f]),u=(0,k.useCallback)(()=>{n===0?r():(a(p=>p-1),b(0),L("select"),N(""),B(null))},[n,r]),y=(0,k.useCallback)(p=>{V==="basic"?(L("text-input"),U("username"),N("")):(L("waiting"),i(p,f).then(()=>{se(`Logged in via OAuth as ${p} [${f}]`),L("done")}).catch(m=>{B(m.message),L("error")}))},[V,f,i]),O=(0,k.useCallback)(p=>{let m=p.trim();if(m){if(F==="profileName"){let S=m;C(E=>({...E,profile:S})),y(S);return}if(F==="username"){I(m),N(""),U("accessKey"),L("text-input-masked");return}if(F==="accessKey"){let S=j.profile??"default";L("waiting"),(async()=>{try{await t(S,f,K,m),se(`Logged in as ${S} [${f}] via basic auth`),L("done")}catch{B("Credentials not valid. Please use valid credentials."),I(""),N(""),U("username"),L("text-input")}})()}}},[F,j.profile,f,t,K,y]),W=(0,k.useCallback)(p=>{N(p),G&&B(null)},[G]);z((p,m)=>{if(A==="done"){let E=j.profile??"default";l(E,f);return}if(A==="error"){r();return}if(A==="waiting"){m.escape&&r();return}if(A==="text-input"||A==="text-input-masked")return;if(m.escape){u();return}let S=M?.id==="profile"?s():M?.options??[];if(m.upArrow){b(E=>Math.max(0,E-1));return}if(m.downArrow){b(E=>Math.min(S.length-1,E+1));return}if(m.return&&S[_]){let E=S[_];if(M.id==="profile"){if(E.value==="__new__"){L("text-input"),U("profileName"),N("");return}C(P=>({...P,profile:E.value})),a(P=>P+1),b(0),y(E.value);return}C(P=>({...P,[M.id]:E.value})),a(P=>P+1),b(0)}});let d="Login";if(A==="done")return(0,w.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:v.statusPass,paddingX:2,paddingY:1,children:[(0,w.jsxs)(h,{color:v.statusPass,bold:!0,children:["\u2713 ",H]}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsx)(h,{color:v.dim,children:"press any key"})})]});if(A==="error")return(0,w.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:v.statusFail,paddingX:2,paddingY:1,children:[(0,w.jsx)(h,{color:v.statusFail,bold:!0,children:"Login failed"}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsx)(h,{color:v.statusFail,children:G})}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsx)(h,{color:v.dim,children:"press any key"})})]});if(A==="waiting")return(0,w.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:v.primary,paddingX:2,paddingY:1,children:[(0,w.jsxs)(h,{color:v.primary,bold:!0,children:[d," \u203A OAuth"]}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsx)(h,{color:v.secondary,children:"Opening browser for login..."})}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsx)(h,{color:v.primary,children:"Waiting for callback \u27F3"})}),(0,w.jsx)(re,{bindings:[],escBackLabel:"cancel"})]});if(A==="text-input"||A==="text-input-masked"){let p=F==="username"?"Username":F==="accessKey"?"Access Key":"Profile name",m=F==="username"||F==="accessKey"?`${d} \u203A Basic Auth`:`${d} \u203A New Profile`;return(0,w.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:v.primary,paddingX:2,paddingY:1,children:[G&&(F==="username"||F==="accessKey")&&(0,w.jsx)(x,{marginBottom:1,children:(0,w.jsxs)(h,{color:v.statusFail,children:["\u2717 ",G]})}),(0,w.jsx)(h,{color:v.primary,bold:!0,children:m}),F==="accessKey"&&(0,w.jsxs)(x,{marginTop:1,children:[(0,w.jsx)(h,{color:v.secondary,children:"Username: "}),(0,w.jsx)(h,{children:K})]}),(0,w.jsxs)(x,{marginTop:1,children:[(0,w.jsxs)(h,{color:v.secondary,children:[p,": "]}),(0,w.jsx)(je,{value:ee,onChange:W,onSubmit:O,onCancel:u,masked:A==="text-input-masked"})]}),(0,w.jsx)(re,{bindings:[{keys:"\u21B5",label:"confirm"}],escBackLabel:"back"})]})}let g=M?.id==="profile"?s():M?.options??[];return(0,w.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:v.primary,paddingX:2,paddingY:1,children:[(0,w.jsx)(h,{color:v.primary,bold:!0,children:d}),(0,w.jsx)(x,{marginTop:1,children:(0,w.jsxs)(h,{color:v.secondary,children:[M?.label,":"]})}),(0,w.jsx)(x,{flexDirection:"column",marginTop:1,children:g.map((p,m)=>{let S=m===_,E=S?"\u276F ":" ",P=p.value==="__new__"?v.statusPass:S?v.primary:void 0;return(0,w.jsxs)(h,{color:P,children:[E,p.label]},p.value)})}),(0,w.jsx)(re,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}import{readFileSync as lt,writeFileSync as xe,mkdirSync as Se,existsSync as at}from"fs";import{dirname as we}from"path";var me={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:Ie,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",code_export:{enabled:!0,language:"python",skip_validation:!0},last_seen_version:""},oe=class{constructor(e=Ae){this.path=e}exists(){return at(this.path)}load(){try{let e=lt(this.path,"utf-8"),t=JSON.parse(e);return{...me,...t,code_export:{...me.code_export,...t.code_export??{}}}}catch{return{...me,code_export:{...me.code_export}}}}set(e,t){try{let i=this.load();i[e]=t,Se(we(this.path),{recursive:!0}),xe(this.path,JSON.stringify(i,null,2)+`
3
+ `)}catch(i){let l=i instanceof Error?i.message:String(i);process.stderr.write(`[config] Failed to save config: ${l}
4
+ `)}}save(e){try{let i={...this.load(),...e};Se(we(this.path),{recursive:!0}),xe(this.path,JSON.stringify(i,null,2)+`
5
+ `)}catch(t){let i=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${i}
6
+ `)}}writeRaw(e){try{Se(we(this.path),{recursive:!0}),xe(this.path,JSON.stringify(e,null,2)+`
7
+ `)}catch(t){let i=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${i}
8
+ `)}}};import{randomUUID as ct}from"crypto";import{mkdirSync as ut,writeFileSync as Me,appendFileSync as dt,existsSync as Ue}from"fs";import{join as le}from"path";var ft=le(de,"sessions"),pe=class{sessionId;sessionDir;runs=[];_flows=[];_nextIndex=0;_started=!1;_testId=null;_testcaseId=null;_projectId=null;_uploadStatus="pending";_uploadAttempts=0;_uploadError=null;_firstObjective=null;_firstUrl=null;_auteurVariables={};_screenshotSas=null;_model="";_environment="";_profile=null;_startedAt="";_remoteLogger=null;_earlyLogBuffer=[];constructor(){this.sessionId=ct(),this.sessionDir=le(ft,this.sessionId)}start(e){if(!this._started){this._started=!0,this._model=e.model,this._environment=e.environment,this._profile=e.profile,this._startedAt=new Date().toISOString();try{ut(this.sessionDir,{recursive:!0});let t={session_id:this.sessionId,started_at:this._startedAt,model:e.model,environment:e.environment,profile:e.profile,objectives:[],runs:[],status:"in_progress"};Me(le(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
9
+ `)}catch{}this._log(`SESSION START session_id=${this.sessionId}`),this._log(`CONFIG model=${e.model} env=${e.environment} profile=${e.profile}`),this._earlyLogBuffer.push({level:"info",event:"SESSION_START",message:"Session started",context:{session_id:this.sessionId}},{level:"info",event:"CONFIG",message:"Session config",context:{model:e.model,environment:e.environment,profile:e.profile}})}}setRemoteLogger(e){this._remoteLogger=e;for(let t of this._earlyLogBuffer)e.log(t.level,t.event,t.message,t.context);this._earlyLogBuffer=[]}get hasRemoteLogger(){return this._remoteLogger!==null}setAuteurVariables(e){Object.assign(this._auteurVariables,e)}get auteurVariables(){return this._auteurVariables}setScreenshotSas(e){this._screenshotSas=e}get screenshotSas(){return this._screenshotSas}get screenshotBaseUrl(){return this._screenshotSas?`${this._screenshotSas.base_url}/${this._screenshotSas.container}`:""}get startedAt(){return this._startedAt||new Date().toISOString()}log(e,t,i,l){if(t===void 0){this._log(e);let n=e.indexOf(" "),a=n>0?e.slice(0,n):e,_=n>0?e.slice(n+1):"",b=/fail|error/i.test(e)?"error":"info";this._remoteLogger?.log(b,a,_||e);return}let r=e,c=i;this._log(`${t} ${c}`),this._remoteLogger?.log(r,t,c,l)}logStep(e,t,i){this._log(`${e} ${t}`);let l=this._nextIndex>0?this._nextIndex-1:0;this._remoteLogger?.logStep(l,e,t,i)}logCommand(e){this._log(`COMMAND ${e}`)}logRunStart(e,t,i){this._log(`RUN ${e} START objective="${t.slice(0,100)}" url=${i}`),this._remoteLogger?.setRunIndex(e),this._remoteLogger?.log("info","RUN_START",`Run ${e} started`,{run_index:e,objective:t,url:i})}logRunEnd(e,t,i,l){let r=(i??0).toFixed(1),c=(l??"").slice(0,100);this._log(`RUN ${e} END status=${t} duration=${r}s summary="${c}"`),this._remoteLogger?.log("info","RUN_END",`Run ${e} ended`,{run_index:e,status:t,duration:i??0,summary:l??""}),t!=="failed"&&t!=="error"&&this._remoteLogger?.discardSteps(e)}escalateRun(e){this._remoteLogger?.escalate(e)}logChromeLaunch(e,t){this._log(`CHROME LAUNCH port=${e} endpoint=${t}`),this._remoteLogger?.log("info","CHROME_LAUNCH","Chrome launched",{port:e,cdp_endpoint:t})}async finish(e="complete"){this._log(`SESSION END status=${e} total_runs=${this.runs.length}`),this._remoteLogger?.log("info","SESSION_END","Session ended",{status:e,total_runs:this.runs.length}),await this._remoteLogger?.shutdown();let t={session_id:this.sessionId,started_at:this._startedAt,ended_at:new Date().toISOString(),model:this._model,environment:this._environment,profile:this._profile,status:e,total_runs:this.runs.length,test_id:this._testId,testcase_id:this._testcaseId,commit_id:this.sessionId,project_id:this._projectId,upload_status:this._uploadStatus,upload_attempts:this._uploadAttempts,last_upload_attempt:this._uploadAttempts>0?new Date().toISOString():null,upload_error:this._uploadError,runs:this.runs.map(i=>({index:i.index,objective:i.objective,status:i.status,summary:i.summary,run_dir:i.run_dir}))};Ue(this.sessionDir)&&Me(le(this.sessionDir,"session.json"),JSON.stringify(t,null,2)+`
10
+ `)}nextRunIndex(){return this._nextIndex}addRunResult(e,t){this.runs.push(e),this._nextIndex+=t??1}getContext(){return{prior_runs:this.runs.map(e=>({index:e.index,objective:e.objective,summary:e.summary,status:e.status,memory:e.context.memory,variables:e.context.variables,pointer:e.context.pointer}))}}addFlow(e){let t={...e,index:this._flows.length+1};return this._flows.push(t),t}getFlows(){return[...this._flows]}getFlow(e){return this._flows.find(t=>t.index===e)}clearFlows(){this._flows=[]}setTestId(e){this._testId=e}get testId(){return this._testId}setTestcaseId(e){this._testcaseId=e}get testcaseId(){return this._testcaseId}setProjectId(e){this._projectId=e}setFirstRun(e,t){this._firstObjective||(this._firstObjective=e,this._firstUrl=t)}get firstObjective(){return this._firstObjective}get firstUrl(){return this._firstUrl}getRunDirs(){let e=[];for(let t of this.runs)t.run_dirs&&t.run_dirs.length>0?e.push(...t.run_dirs):t.run_dir&&e.push(t.run_dir);return e}getRunObjectives(){let e=[];for(let t of this.runs)t.flow_objectives&&t.flow_objectives.length>0?e.push(...t.flow_objectives):e.push(t.objective);return e}getRunMetadata(){let e=[];for(let t of this.runs)if(t.perFlowMetadata&&t.perFlowMetadata.length>0)e.push(...t.perFlowMetadata);else{let i={resultCode:t.resultCode,reasonCode:t.reasonCode,errorMessage:t.status==="failed"?t.summary??null:null,summary:t.summary,oneLiner:t.oneLiner},l=t.run_dirs?.length??1;for(let r=0;r<l;r++)e.push(i)}return e}setUploadStatus(e,t){this._uploadStatus=e,this._uploadAttempts+=1,this._uploadError=t??null}_log(e){if(!(!this._started||!Ue(this.sessionDir)))try{let t=new Date().toISOString().slice(0,19).replace("T"," "),i=le(this.sessionDir,"tui.log");dt(i,`[${t}] ${e}
11
+ `)}catch{}}};var Ke=$(te(),1);import{readFileSync as gt,writeFileSync as mt,mkdirSync as pt}from"fs";import{dirname as ht,join as _t}from"path";var vt=_t(de,"command-history.json"),xt=200,ye=class{entries;filePath;max;constructor(e=vt,t=xt){this.filePath=e,this.max=t,this.entries=this._load()}push(e){this.entries.length>0&&this.entries[this.entries.length-1]===e||(this.entries.push(e),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(e){let t=e.toLowerCase(),i=[];for(let l=this.entries.length-1;l>=0;l--)this.entries[l].toLowerCase().includes(t)&&i.push(this.entries[l]);return i}_load(){try{let e=gt(this.filePath,"utf-8"),t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}_save(){try{pt(ht(this.filePath),{recursive:!0}),mt(this.filePath,JSON.stringify(this.entries)+`
12
+ `)}catch{}}};function Ge(o){let e=(0,Ke.useRef)(null);return e.current||(e.current=new ye(o)),e.current}function ie(o,e,t,i){let l=o.loadProfileConfig(t,i)??{},r={projectId:l.project_id??null,projectName:l.project_name??null,folderId:l.folder_id??null,folderName:l.folder_name??null};return e.save({project_id:r.projectId,project_name:r.projectName,folder_id:r.folderId,folder_name:r.folderName}),r}function ae(o,e,t,i,l){let r={};l.projectId!==void 0&&(r.project_id=l.projectId??void 0),l.projectName!==void 0&&(r.project_name=l.projectName??void 0),l.folderId!==void 0&&(r.folder_id=l.folderId??void 0),l.folderName!==void 0&&(r.folder_name=l.folderName??void 0),o.saveProfileConfig(t,i,r);let c=o.loadProfileConfig(t,i)??{};e.save({project_id:c.project_id??null,project_name:c.project_name??null,folder_id:c.folder_id??null,folder_name:c.folder_name??null})}function nr(o,e,t,i,l){let r=o.loadProfileConfig(t,i)??{},c=e.load(),n={project_id:r.project_id??null,project_name:r.project_name??null,folder_id:r.folder_id??null,folder_name:r.folder_name??null},a={project_id:c.project_id??null,project_name:c.project_name??null,folder_id:c.folder_id??null,folder_name:c.folder_name??null},_=n.project_id===a.project_id&&n.project_name===a.project_name&&n.folder_id===a.folder_id&&n.folder_name===a.folder_name,b={projectId:n.project_id,projectName:n.project_name,folderId:n.folder_id,folderName:n.folder_name};return _?{rehydrated:!1,state:b}:(l?.("warn","STALE_TUI_CONFIG_REHYDRATED","tui-config divergent from profile-config \u2014 rewriting",{profile:t,env:i,profile_state:n,tui_state:a}),e.save(n),{rehydrated:!0,state:b})}function He(o){return o.projectId!==null&&o.folderId!==null}async function he(o,e,t,i){let l=o.loadBasicAuth(e,t),r=o.loadCredentials(e,t);if(!l&&!r)return i("info","STARTUP_GATE_NO_CREDS","Profile has no credentials",{profile:e,env:t}),{status:"needs_login",profile:e,env:t};let c=ne(t),n=async()=>o.loadCredentials(e,t)?.access_token??null,a=new fe(c.controllerBaseUrl,n,l,i);i("info","STARTUP_GATE_VALIDATE","Validating credentials with controller",{profile:e,env:t,method:l?"basic":"oauth"});let _=await a.resolve(!0);if(_)return i("info","STARTUP_GATE_VALID","Credentials validated",{profile:e,env:t,username:_.username,org_id:_.org_id}),{status:"authenticated",result:{profile:e,env:t,credentials:r,basicAuth:l,tmsCreds:_,resolver:a}};if(!l&&r){let b=r.refresh_token,C=o.loadClient(e,t)?.client_id;if(b&&C){i("info","STARTUP_GATE_REFRESH","Attempting token refresh",{profile:e,env:t});try{let L=await new Fe(t).refreshToken(b,C);if(L.access_token){o.saveCredentials(e,t,{...r,...L,expires_at:Date.now()/1e3+(L.expires_in??3600)});let N=await a.resolve(!0);if(N)return i("info","STARTUP_GATE_REFRESH_OK","Token refreshed and validated",{profile:e,env:t,username:N.username}),{status:"authenticated",result:{profile:e,env:t,credentials:{...r,...L},basicAuth:null,tmsCreds:N,resolver:a}}}i("warn","STARTUP_GATE_REFRESH_INVALID","Refreshed token still invalid",{profile:e,env:t})}catch(A){i("warn","STARTUP_GATE_REFRESH_FAILED","Token refresh failed",{profile:e,env:t,error:A instanceof Error?A.message:String(A)})}}else i("info","STARTUP_GATE_NO_REFRESH","No refresh_token or client_id \u2014 login required",{profile:e,env:t})}return i("info","STARTUP_GATE_INVALID","Credentials invalid \u2014 login required",{profile:e,env:t}),{status:"needs_login",profile:e,env:t}}async function Ve(o,e,t=new oe){let i=o.listProfiles();if(e("info","STARTUP_GATE_START","Auth startup gate",{profile_count:i.length}),i.length===0)return e("info","STARTUP_GATE_NONE","No profiles found \u2014 login required"),{status:"needs_login"};if(i.length>1){let c=o.getActiveProfile(),n=o.getDefaultEnv();if(c&&i.some(_=>_.profile===c&&_.env===n)){e("info","STARTUP_GATE_TRY_ACTIVE","Multiple profiles \u2014 trying active first",{activeProfile:c,activeEnv:n});let _=await he(o,c,n,e);if(_.status==="authenticated")return _;e("info","STARTUP_GATE_ACTIVE_FAILED","Active profile invalid \u2014 showing picker",{activeProfile:c,activeEnv:n})}return e("info","STARTUP_GATE_MULTI","Multiple profiles \u2014 picker required",{profiles:i.map(a=>`${a.profile}/${a.env}`)}),{status:"needs_pick",profiles:i}}let{profile:l,env:r}=i[0];return o.setActiveProfile(l),o.setDefaultEnv(r),ie(o,t,l,r),he(o,l,r,e)}var ze=()=>!!process.env.KANE_DEV_MODE,Z=[],We=!1,Ye=null,be=null,Te=null,ce=null;function dr(o){ce=o}function fr(){return ce}function gr(o,e){Z=Z.filter(t=>t.name!==o),Z.push({name:o,fn:e})}function mr(o,e){let t=Z.find(l=>l.name===o);if(!t)return;Z=Z.filter(l=>l.name!==o);let i=!0;try{t.fn()}catch(l){i=!1,process.stderr.write(`[exit-manager] cleanup(${o}) failed: ${l instanceof Error?l.message:String(l)}
13
+ `)}e&&i&&ze()&&process.stderr.write(`[exit-manager] cleanup(${o}): ${e}
14
+ `)}function q(o,e,t=!1){if(We){process.exit(Ye??o);return}if(We=!0,Ye=o,t&&ce)try{ce.log("error","CRASH",e),ce.shutdownSync()}catch{}let i=[...Z].reverse(),l=[];for(let r of i)try{r.fn(),l.push(r.name)}catch(c){process.stderr.write(`[exit-manager] cleanup(${r.name}) failed: ${c instanceof Error?c.message:String(c)}
15
+ `)}if(Z=[],ze()&&(process.stderr.write(`[exit-manager] shutdown(${o}): ${e}
16
+ `),l.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${l.join(", ")}
17
+ `)),t&&Te){try{Te()}catch{}process.stderr.write(`
18
+ Kane CLI crashed unexpectedly: ${e}
19
+ `+(l.length>0?`Resources cleaned up (${l.join(", ")}).
20
+ `:"")),process.exit(o);return}if(be&&!t){be();return}process.exit(o)}function pr(o){be=o}function hr(o){Te=o}var Xe=!1;function _r(){Xe||(Xe=!0,process.on("SIGINT",()=>{q(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{q(143,"Received SIGTERM",!0)}),process.on("uncaughtException",o=>{q(1,`Uncaught exception: ${o.message}`,!0)}),process.on("unhandledRejection",o=>{q(1,`Unhandled rejection: ${String(o)}`,!0)}))}var T=$(X(),1);function Fr({resultRef:o,mode:e="singleshot",loginCompleteRef:t}){let{exit:i}=Ee(),l=(0,R.useRef)(new Pe),r=(0,R.useRef)(new oe),c=(0,R.useRef)(new pe),n=l.current,a=r.current,_=c.current,b=Ge(),[j,C]=(0,R.useState)(e==="login"?"login":"gate"),[A,L]=(0,R.useState)(null),[ee,N]=(0,R.useState)(null),[F,U]=(0,R.useState)(null),[K,I]=(0,R.useState)(null),[G,B]=(0,R.useState)([]),H=(0,R.useCallback)((d,g,p,m)=>_.log(d,g,p,m),[_]),se=(0,R.useCallback)((d,g)=>{d?ie(n,a,d,g):a.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[n,a]),M=(0,R.useCallback)(()=>{e==="login"?(t&&(t.current=!0),i()):C("input")},[e,i,t]),V=(0,R.useCallback)((d,g)=>{let p=ie(n,a,d,g);if(e==="login"){C("ensure-project");return}He(p)?M():p.projectId?C("ensure-folder"):C("ensure-project")},[n,a,M,e]);z((d,g)=>{g.ctrl&&d==="c"&&q(0,"Ctrl+C exit")});let f=(0,R.useRef)(!1);R.default.useEffect(()=>{f.current||(f.current=!0,e!=="login"&&Ve(n,H).then(d=>{L(d),d.status==="authenticated"?V(d.result.profile,d.result.env):d.status==="needs_pick"?C("pick"):(N(d.profile??null),U(d.env??null),C("login"))}).catch(d=>{I(`Auth check failed: ${d instanceof Error?d.message:String(d)}`)}))},[n,H]);let s=(0,R.useCallback)(d=>{o.current={objective:d},i()},[o,i]),u=(0,R.useCallback)(async(d,g)=>{n.setActiveProfile(d),n.setDefaultEnv(g),(await he(n,d,g,H)).status==="authenticated"?V(d,g):(N(d),U(g),C("login"))},[n,H,V]),y=(0,R.useCallback)(()=>{let d=n.getActiveProfile(),g=n.getDefaultEnv();if(!d)return null;let p=ne(g),m=n.loadBasicAuth(d,g);return new fe(p.controllerBaseUrl,async()=>n.loadCredentials(d,g)?.access_token??null,m,H)},[n,H]),O=(0,R.useCallback)(async()=>{let d=y();if(!d)return null;let g=d.cached??await d.resolve();if(!g)return null;let p=ne(n.getDefaultEnv()),m=new _e(p.tmsBaseUrl,g.username,g.access_key);try{let E=(await m.listProjects()).find(ue=>ue.name==="KaneAI Generated");if(E)return{id:E.project_id,name:E.name};let P=await m.createProject("KaneAI Generated");return{id:P.id,name:P.name}}catch{return null}},[y,n]),W=(0,R.useCallback)(async d=>{let g=y();if(!g)return null;let p=g.cached??await g.resolve();if(!p)return null;let m=ne(n.getDefaultEnv()),S=new _e(m.tmsBaseUrl,p.username,p.access_key);try{let P=(await S.listFolders(d)).find(Je=>Je.name==="Untitled");if(P)return{id:P.id,name:P.name};let ue=await S.createFolder(d,"Untitled");return{id:ue.id,name:ue.name}}catch{return null}},[y,n]);if(j==="gate")return(0,T.jsx)(x,{paddingX:1,children:(0,T.jsx)(h,{color:"yellow",children:"Checking authentication..."})});if(K)return(0,T.jsxs)(x,{flexDirection:"column",paddingX:1,children:[(0,T.jsx)(h,{color:"red",children:K}),(0,T.jsx)(h,{color:"gray",children:"Press Ctrl+C to exit."})]});if(j==="pick"&&A?.status==="needs_pick")return(0,T.jsx)(St,{profiles:A.profiles,onSelect:u});if(j==="login")return(0,T.jsx)(ke,{devMode:process.env.KANE_DEV_MODE==="1",profiles:n.listProfiles(),onBasicLogin:async(d,g,p,m)=>{let{validateBasicAuth:S}=await import("./validate-basic-RV5TSUKJ.js");await S(g,p,m),n.saveBasicAuth(d,g,{username:p,access_key:m}),n.setActiveProfile(d),n.setDefaultEnv(g)},onOAuthLogin:async(d,g)=>{let{LoginFlow:p}=await import("./login-flow-WXMKYI5G.js");n.setDefaultEnv(g),n.setActiveProfile(d),await new p(d,g,n).login()},onComplete:(d,g)=>{N(d),U(g),n.setActiveProfile(d),n.setDefaultEnv(g),V(d,g)},onCancel:()=>{q(0,"Login cancelled")}});if(j==="ensure-project"){let d=n.getActiveProfile()??"default",g=n.getDefaultEnv(),p=()=>{if(e==="login"){C("ensure-folder");return}ie(n,a,d,g).folderId?M():C("ensure-folder")};return(0,T.jsxs)(x,{flexDirection:"column",children:[(0,T.jsx)(x,{paddingX:1,marginBottom:1,children:(0,T.jsx)(h,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,T.jsx)(Le,{resolver:y(),currentProjectId:a.load().project_id,env:g,onSelect:(m,S)=>{ae(n,a,d,g,{projectId:m,projectName:S}),B(E=>[...E,`\u2713 Project: ${S} (${m})`]),p()},onCancel:async()=>{let m=await O();m&&(ae(n,a,d,g,{projectId:m.id,projectName:m.name}),B(S=>[...S,`\u2713 Default project: ${m.name} (${m.id})`]),p())}})]})}if(j==="ensure-folder"){let d=n.getActiveProfile()??"default",g=n.getDefaultEnv(),p=n.loadProfileConfig(d,g);return(0,T.jsxs)(x,{flexDirection:"column",children:[(0,T.jsx)(x,{paddingX:1,marginBottom:1,children:(0,T.jsx)(h,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,T.jsx)(De,{resolver:y(),projectId:p?.project_id??"",currentFolderId:a.load().folder_id,env:g,onSelect:(m,S)=>{ae(n,a,d,g,{folderId:m,folderName:S}),B(E=>[...E,`\u2713 Folder: ${S} (${m})`]),M()},onCancel:async()=>{if(!p?.project_id)return;let m=await W(p.project_id);m&&(ae(n,a,d,g,{folderId:m.id,folderName:m.name}),B(S=>[...S,`\u2713 Default folder: ${m.name} (${m.id})`]),M())}})]})}return j==="input"?(0,T.jsxs)(x,{flexDirection:"column",children:[G.length>0&&(0,T.jsx)(x,{flexDirection:"column",paddingX:1,marginBottom:1,children:G.map((d,g)=>(0,T.jsx)(h,{color:"green",children:d},g))}),(0,T.jsx)($e,{onSubmit:s,onEscape:()=>q(0,"User pressed Escape"),history:b,placeholder:"Type an objective..."})]}):(0,T.jsx)(T.Fragment,{})}function St({profiles:o,onSelect:e}){let[t,i]=(0,R.useState)(0),[l,r]=(0,R.useState)(!1);return z((c,n)=>{if(!l){if(n.escape){q(0,"Profile picker cancelled");return}if(n.upArrow&&t>0&&i(a=>a-1),n.downArrow&&t<o.length-1&&i(a=>a+1),n.return){r(!0);let a=o[t];e(a.profile,a.env).catch(()=>r(!1))}}}),(0,T.jsxs)(x,{flexDirection:"column",paddingX:1,children:[(0,T.jsx)(h,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,T.jsx)(x,{marginTop:1,flexDirection:"column",children:o.map((c,n)=>(0,T.jsxs)(h,{children:[n===t?"\u276F ":" ",(0,T.jsx)(h,{color:n===t?"#ff9500":"white",bold:n===t,children:c.profile}),(0,T.jsxs)(h,{color:"gray",children:[" [",c.env,"]"]})]},`${c.profile}-${c.env}`))}),l&&(0,T.jsx)(x,{marginTop:1,children:(0,T.jsx)(h,{color:"yellow",children:"Validating credentials..."})})]})}export{Ge as a,$e as b,ke as c,pe as d,oe as e,ie as f,ae as g,nr as h,He as i,dr as j,fr as k,gr as l,mr as m,q as n,pr as o,hr as p,_r as q,he as r,Ve as s,Fr as t};
@@ -0,0 +1,103 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as D,b as A}from"./chunk-CKMDFVL6.js";import{l as S,m as C,n as P,o as U,p as N}from"./chunk-7ONI2K3S.js";import{createServer as Oe}from"http";import{randomBytes as He}from"crypto";import{URL as $e}from"url";import Z from"process";import{Buffer as ee}from"buffer";import re from"path";import{fileURLToPath as ke}from"url";import{promisify as Le}from"util";import te from"child_process";import Me,{constants as Ie}from"fs/promises";import Y from"process";import G,{constants as me}from"fs/promises";import j from"process";import le from"os";import L from"fs";import se from"fs";import z from"fs";var E;function ie(){try{return z.statSync("/.dockerenv"),!0}catch{return!1}}function ae(){try{return z.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function B(){return E===void 0&&(E=ie()||ae()),E}var k,ce=()=>{try{return se.statSync("/run/.containerenv"),!0}catch{return!1}};function u(){return k===void 0&&(k=ce()||B()),k}var K=()=>{if(j.platform!=="linux")return!1;if(le.release().toLowerCase().includes("microsoft"))return!u();try{if(L.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!u()}catch{}return L.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||L.existsSync("/run/WSL")?!u():!1},d=j.env.__IS_WSL_TEST__?K:K();var de=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",n=!1;try{await G.access(t,me.F_OK),n=!0}catch{}if(!n)return e;let o=await G.readFile(t,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(r=i.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),fe=async()=>`${await de()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,M=async()=>d?fe():`${Y.env.SYSTEMROOT||Y.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;function f(e,r,t){let n=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let o=t();return n(o),o},set(o){n(o)}}),e}import{promisify as Pe}from"util";import O from"process";import{execFile as Ae}from"child_process";import{promisify as pe}from"util";import ue from"process";import{execFile as ge}from"child_process";var he=pe(ge);async function I(){if(ue.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await he("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return t==="com.apple.safari"?"com.apple.Safari":t}import we from"process";import{promisify as xe}from"util";import{execFile as ye,execFileSync as cr}from"child_process";var ve=xe(ye);async function X(e,{humanReadableOutput:r=!0,signal:t}={}){if(we.platform!=="darwin")throw new Error("macOS only");let n=r?[]:["-ss"],o={};t&&(o.signal=t);let{stdout:i}=await ve("osascript",["-e",e,n],o);return i.trim()}async function T(e){return X(`tell application "Finder" to set app_path to application file id "${e}" as string
3
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as be}from"util";import{execFile as Se}from"child_process";var Ce=be(Se),y={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},ur=new Map(Object.entries(y)),F=class extends Error{};async function _(e=Ce){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new F(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:n}=t.groups,o=n.lastIndexOf("."),i=n.lastIndexOf("-"),c=o===-1?void 0:n.slice(0,o),a=i===-1?void 0:n.slice(0,i);return y[n]??y[c]??y[a]??{name:n,id:n}}var Ee=Pe(Ae),Be=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function H(){if(O.platform==="darwin"){let e=await I();return{name:await T(e),id:e}}if(O.platform==="linux"){let{stdout:e}=await Ee("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:Be(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(O.platform==="win32")return _();throw new Error("Only macOS, Linux, and Windows are supported")}var Te=Le(te.execFile),$=re.dirname(ke(import.meta.url)),q=re.join($,"xdg-open"),{platform:w,arch:V}=Z;async function Fe(){let e=await M(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,t=ee.from(r,"utf16le").toString("base64"),{stdout:n}=await Te(e,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",t],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}var J=async(e,r)=>{let t;for(let n of e)try{return await r(n)}catch(o){t=o}throw t},v=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return J(e.app,a=>v({...e,app:a}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return J(r,a=>v({...e,app:{name:a,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},s=d?await Fe():await H();if(s.id in a){let m=a[s.id];return r==="browserPrivate"&&t.push(l[m]),v({...e,app:{name:g[m],arguments:t}})}throw new Error(`${s.name} is not supported as a default browser`)}let n,o=[],i={};if(w==="darwin")n="open",e.wait&&o.push("--wait-apps"),e.background&&o.push("--background"),e.newInstance&&o.push("--new"),r&&o.push("-a",r);else if(w==="win32"||d&&!u()&&!r){n=await M(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),d||(i.windowsVerbatimArguments=!0);let a=["Start"];e.wait&&a.push("-Wait"),r?(a.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&a.push(`"${e.target}"`),t.length>0&&(t=t.map(l=>`"\`"${l}\`""`),a.push("-ArgumentList",t.join(","))),e.target=ee.from(a.join(" "),"utf16le").toString("base64")}else{if(r)n=r;else{let a=!$||$==="/",l=!1;try{await Me.access(q,Ie.X_OK),l=!0}catch{}n=Z.versions.electron??(w==="android"||a||!l)?"xdg-open":q}t.length>0&&o.push(...t),e.wait||(i.stdio="ignore",i.detached=!0)}w==="darwin"&&t.length>0&&o.push("--args",...t),e.target&&o.push(e.target);let c=te.spawn(n,o,i);return e.wait?new Promise((a,l)=>{c.once("error",l),c.once("close",s=>{if(!e.allowNonzeroExitCode&&s>0){l(new Error(`Exited with code ${s}`));return}a(c)})}):(c.unref(),c)},_e=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return v({...r,target:e})};function Q(e){if(typeof e=="string"||Array.isArray(e))return e;let{[V]:r}=e;if(!r)throw new Error(`${V} is not supported`);return r}function b({[w]:e},{wsl:r}){if(r&&d)return Q(r);if(!e)throw new Error(`${w} is not supported`);return Q(e)}var g={};f(g,"chrome",()=>b({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));f(g,"brave",()=>b({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));f(g,"firefox",()=>b({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));f(g,"edge",()=>b({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));f(g,"browser",()=>"browser");f(g,"browserPrivate",()=>"browserPrivate");var oe=_e;var ne=class{profile;environment;creds;oauth;constructor(r="default",t="prod",n){this.profile=r,this.environment=t,this.creds=n??new D,this.oauth=new A(t)}async login(){let{server:r,port:t}=await this.startCallbackServer(),n=N(t);try{let o=this.creds.loadClient(this.profile,this.environment),i=o?.redirect_uris;(!o||!i?.includes(n))&&(o=await this.oauth.registerClient(n),this.creds.saveClient(this.profile,this.environment,o));let c=o.client_id,[a,l]=A.generatePkce(),s=He(32).toString("hex"),m=this.oauth.buildAuthorizationUrl(c,l,s,n),p=await this.waitForCallback(r,t,m,s);if(!p)throw new Error("Login cancelled or timed out");let h=await this.oauth.exchangeCode(p,c,a,n),x={access_token:h.access_token,refresh_token:h.refresh_token,expires_at:Math.floor(Date.now()/1e3)+h.expires_in,scope:h.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,x),this.creds.setActiveProfile(this.profile),x}catch(o){throw r.close(),o}}startCallbackServer(){return new Promise((r,t)=>{let n=C,o=()=>{let i=Oe();i.on("error",c=>{c.code==="EADDRINUSE"&&n<P?(n++,o()):t(new Error(`Failed to start callback server: ${c.message}. Ports ${C}-${P} are all in use.`))}),i.listen(n,S,()=>{r({server:i,port:n})})};o()})}waitForCallback(r,t,n,o){return new Promise(i=>{let c=!1,a=setTimeout(()=>l(null),12e4),l=s=>{c||(c=!0,clearTimeout(a),r.close(),i(s))};r.on("request",(s,m)=>{let p=new $e(s.url??"/",`http://${S}:${t}`);if(p.pathname!==U){m.writeHead(404),m.end();return}let h=p.searchParams.get("state"),x=p.searchParams.get("code");if(p.searchParams.get("error")){m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),l(null);return}if(h!==o){m.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),l(null);return}m.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),m.end(R({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),l(x)}),oe(n).catch(s=>{let m=s instanceof Error?s.message:String(s);process.stderr.write(`[auth] Could not open browser: ${m}
4
+ Please open this URL manually: ${n}
5
+ `)})})}};function R(e){let r=e.state==="success",t=r?"#22c55e":"#ef4444",n=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",o=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=e.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
6
+ <html lang="en">
7
+ <head>
8
+ <meta charset="utf-8" />
9
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
10
+ <title>${W(e.title)} \xB7 KaneAI</title>
11
+ <style>
12
+ :root {
13
+ color-scheme: light dark;
14
+ --bg: #f7f7f8;
15
+ --card: #ffffff;
16
+ --fg: #0a0a0a;
17
+ --muted: #6b7280;
18
+ --border: rgba(0, 0, 0, 0.06);
19
+ --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
20
+ }
21
+ @media (prefers-color-scheme: dark) {
22
+ :root {
23
+ --bg: #0a0a0a;
24
+ --card: #141416;
25
+ --fg: #f5f5f7;
26
+ --muted: #9ca3af;
27
+ --border: rgba(255, 255, 255, 0.08);
28
+ --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
29
+ }
30
+ }
31
+ * { box-sizing: border-box; }
32
+ html, body { height: 100%; }
33
+ body {
34
+ margin: 0;
35
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
36
+ background: var(--bg);
37
+ color: var(--fg);
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ padding: 24px;
42
+ -webkit-font-smoothing: antialiased;
43
+ }
44
+ .card {
45
+ width: 100%;
46
+ max-width: 420px;
47
+ background: var(--card);
48
+ border: 1px solid var(--border);
49
+ border-radius: 16px;
50
+ box-shadow: var(--shadow);
51
+ padding: 40px 32px 32px;
52
+ text-align: center;
53
+ animation: rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
54
+ }
55
+ @keyframes rise {
56
+ from { opacity: 0; transform: translateY(8px); }
57
+ to { opacity: 1; transform: translateY(0); }
58
+ }
59
+ .icon {
60
+ width: 64px;
61
+ height: 64px;
62
+ margin: 0 auto 20px;
63
+ border-radius: 999px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ background: ${n};
68
+ color: ${t};
69
+ }
70
+ h1 {
71
+ font-size: 22px;
72
+ font-weight: 600;
73
+ letter-spacing: -0.01em;
74
+ margin: 0 0 8px;
75
+ }
76
+ p {
77
+ margin: 0;
78
+ color: var(--muted);
79
+ font-size: 14.5px;
80
+ line-height: 1.5;
81
+ }
82
+ .brand {
83
+ margin-top: 28px;
84
+ padding-top: 20px;
85
+ border-top: 1px solid var(--border);
86
+ font-size: 12px;
87
+ letter-spacing: 0.08em;
88
+ text-transform: uppercase;
89
+ color: var(--muted);
90
+ }
91
+ .brand strong { color: var(--fg); font-weight: 600; letter-spacing: 0.08em; }
92
+ </style>
93
+ </head>
94
+ <body>
95
+ <main class="card" role="status" aria-live="polite">
96
+ <div class="icon">${o}</div>
97
+ <h1>${W(e.title)}</h1>
98
+ <p>${W(e.message)}</p>
99
+ <div class="brand"><strong>KaneAI</strong> \xB7 CLI</div>
100
+ </main>
101
+ ${i}
102
+ </body>
103
+ </html>`}function W(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}export{ne as a};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as A,b as _}from"./chunk-Y3MXIITZ.js";import{a as B}from"./chunk-2O7RIXHD.js";import{a as R}from"./chunk-XQL5WHKR.js";import{a as P}from"./chunk-HCBYKLMW.js";import{t as c}from"./chunk-7ONI2K3S.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as k}from"./chunk-YUUZDFT7.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,s,y,m){return{id:n,label:`${s} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:s,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=B(m),T=new k(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let i=await T.listFolders(s);yield{page:1,folders:i,totalLoaded:i.length,done:!0}})();for await(let i of F){if(d(!1),i.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(i.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),i.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,s,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!s){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=B(m),i=await new k(T.tmsBaseUrl,a.username,a.access_key).createFolder(s,r);x(i.id,i.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,s,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.primary,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as I,b as A}from"./chunk-Y3MXIITZ.js";import{a as L}from"./chunk-2O7RIXHD.js";import{a as R}from"./chunk-XQL5WHKR.js";import{a as v}from"./chunk-HCBYKLMW.js";import{t as s}from"./chunk-7ONI2K3S.js";import{a as u,b as i}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{a as T}from"./chunk-YUUZDFT7.js";import{e as N}from"./chunk-UR6MHSHU.js";var t=N(J(),1);var e=N(v(),1);function X(n,y,c){return{id:n,label:`${y} (${n})`,isActive:n===c}}function Z({resolver:n,currentProjectId:y,env:c,onSelect:x,onCancel:w}){let[F,M]=(0,t.useState)([]),[_,l]=(0,t.useState)(!0),[$,m]=(0,t.useState)(!1),[O,P]=(0,t.useState)(null),[g,d]=(0,t.useState)("list"),[S,k]=(0,t.useState)(""),[C,p]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController;return l(!0),m(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){P("Login first to browse projects"),l(!1),m(!1);return}let a=L(c),E=new T(a.tmsBaseUrl,r.username,r.access_key),j=!0,b=0;for await(let f of E.listProjectsStream({signal:o.signal})){if(j&&(l(!1),j=!1),f.totalLoaded===0&&f.done&&b===0){h.current=!0,d("naming"),m(!1);return}f.projects.length>0&&(M(H=>[...H,...f.projects.map(B=>X(B.project_id,B.name,y))]),b+=f.projects.length),f.done&&m(!1)}j&&(l(!1),m(!1))}catch(r){if(r?.name==="AbortError")return;P(r instanceof Error?r.message:String(r)),l(!1),m(!1)}})(),()=>o.abort()},[n,y,c]);let U=(0,t.useCallback)(o=>{let r=o.trim();if(!r){p("Name cannot be empty");return}p(null),d("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let E=L(c),b=await new T(E.tmsBaseUrl,a.username,a.access_key).createProject(r);x(b.id,b.name)}catch(a){p(a instanceof Error?a.message:String(a)),d("naming")}})()},[n,c,x]),D=(0,t.useCallback)(()=>{k(""),p(null),h.current?w():d("list")},[w]);return g==="naming"||g==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:s.primary,paddingX:2,paddingY:1,children:[(0,e.jsx)(i,{color:s.primary,bold:!0,children:"Create new project"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"No projects yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(i,{color:s.dim,children:"Name: "}),g==="naming"?(0,e.jsx)(I,{value:S,onChange:o=>{k(o),C&&p(null)},onSubmit:U,onCancel:D}):(0,e.jsx)(i,{children:S})]}),C&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.red,children:C})}),g==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(i,{color:s.dim,children:"Creating..."})}),g==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(A,{title:"Projects",items:F,loading:_,loadingMore:$,preserveSelectionById:!0,error:O,itemNoun:"projects",onTab:()=>{h.current=!1,d("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.replace(` (${o.id})`,"");x(o.id,r)},onCancel:w})}export{X as a,Z as b};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as c}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-75XK2HKS.js";import{a as s,b as u,j as p}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as l}from"./chunk-UR6MHSHU.js";var x=l(T(),1);function g(n,e){if(!e)return n;let i=n.trim()||e;return`\x1B]8;;${e}\x07${i}\x1B]8;;\x07`}var r=l(c(),1);function h({shareableLink:n,testCaseLink:e,codeExportDir:i,autoExit:m=!0}){let{exit:f}=p();(0,x.useEffect)(()=>{if(!m)return;let t=setTimeout(()=>f(),100);return()=>clearTimeout(t)},[f,m]);let o=[];return n&&o.push({label:"ShareLink",url:n}),e&&o.push({label:"TestCase",url:e}),i&&o.push({label:"CodeExport",url:i,linkUrl:`file://${i}`}),o.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:o.map(t=>(0,r.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(u,{color:a.primary,children:[t.label,":"]}),(0,r.jsx)(u,{color:a.dim,children:g(t.url,t.linkUrl??t.url)})]},t.label))})}export{h as a};
2
+ import{a as c}from"./chunk-HCBYKLMW.js";import{t as a}from"./chunk-7ONI2K3S.js";import{a as s,b as u,j as p}from"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as l}from"./chunk-UR6MHSHU.js";var x=l(T(),1);function g(n,e){if(!e)return n;let i=n.trim()||e;return`\x1B]8;;${e}\x07${i}\x1B]8;;\x07`}var r=l(c(),1);function h({shareableLink:n,testCaseLink:e,codeExportDir:i,autoExit:m=!0}){let{exit:f}=p();(0,x.useEffect)(()=>{if(!m)return;let t=setTimeout(()=>f(),100);return()=>clearTimeout(t)},[f,m]);let o=[];return n&&o.push({label:"ShareLink",url:n}),e&&o.push({label:"TestCase",url:e}),i&&o.push({label:"CodeExport",url:i,linkUrl:`file://${i}`}),o.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(s,{flexDirection:"column",marginTop:1,marginLeft:1,children:o.map(t=>(0,r.jsxs)(s,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(u,{color:a.primary,children:[t.label,":"]}),(0,r.jsx)(u,{color:a.dim,children:g(t.url,t.linkUrl??t.url)})]},t.label))})}export{h as a};