@vostride/agent-qa-dashboard-ui 0.1.12 → 0.1.13

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 (78) hide show
  1. package/dist/assets/{arrow-up-down-CN-uHgX9.js → arrow-up-down-DD6yziGv.js} +1 -1
  2. package/dist/assets/{badge-DrW2vGVJ.js → badge-CC1v3nk4.js} +1 -1
  3. package/dist/assets/{batch-action-bar-uEhHVDds.js → batch-action-bar-D1IfTx55.js} +1 -1
  4. package/dist/assets/{circle-alert-BKX0IIz1.js → circle-alert-CULfrrqE.js} +1 -1
  5. package/dist/assets/{circle-x-yPIxYoz1.js → circle-x-B7AOkLOS.js} +1 -1
  6. package/dist/assets/{config-TRu3J-E7.js → config-a9DxCBoP.js} +1 -1
  7. package/dist/assets/{copy-Clw3wvSn.js → copy-CEZJVgtu.js} +1 -1
  8. package/dist/assets/{display-step-NqsJgW_B.js → display-step-CO4k5dQA.js} +1 -1
  9. package/dist/assets/{dist-BPJgj1d0.js → dist-BJdB11cl.js} +1 -1
  10. package/dist/assets/{dist-BPheZrD6.js → dist-DzF0KPMF.js} +1 -1
  11. package/dist/assets/{dist-m_OM4Je_.js → dist-wK15YRiu.js} +1 -1
  12. package/dist/assets/{empty-state-BTvOA5lp.js → empty-state-BfgY0UGA.js} +1 -1
  13. package/dist/assets/{external-link-C_uggQOc.js → external-link-DC-KkLmq.js} +1 -1
  14. package/dist/assets/{eye-CZrufbYE.js → eye-YQHiLgt4.js} +1 -1
  15. package/dist/assets/{file-code-B3iDpJRP.js → file-code-BpwHxsqo.js} +1 -1
  16. package/dist/assets/{file-search-DHHwYVza.js → file-search-LR6NeRNh.js} +1 -1
  17. package/dist/assets/{filename-validation-4sTTEagx.js → filename-validation-S8QXnNdt.js} +1 -1
  18. package/dist/assets/{grip-vertical-A-AANrBM.js → grip-vertical-KfzS75WH.js} +1 -1
  19. package/dist/assets/{hook-editor-yhQoi-Ky.js → hook-editor-tcKRn_gP.js} +1 -1
  20. package/dist/assets/{hook-runtime-JF-0oZpz.js → hook-runtime-CTRviwQE.js} +1 -1
  21. package/dist/assets/{hook-viewer-DIkxp9uJ.js → hook-viewer-eGadGjA0.js} +1 -1
  22. package/dist/assets/{hooks-CDRbjPKv.js → hooks-BM--ZgFe.js} +1 -1
  23. package/dist/assets/{id-badge-NwZYoNfB.js → id-badge-BmmZdbHv.js} +1 -1
  24. package/dist/assets/{index-Bvtm2F6f.js → index-B4FdO6Vk.js} +2 -2
  25. package/dist/assets/index-DzWZqTlZ.css +2 -0
  26. package/dist/assets/{insights-DuYBsUzB.js → insights-C_tn8W_Q.js} +1 -1
  27. package/dist/assets/{insights-line-grid-BKOqA-1W.js → insights-line-grid-DKZyKGcI.js} +1 -1
  28. package/dist/assets/{lib-58FyJI_k.js → lib-B9z0w3j9.js} +1 -1
  29. package/dist/assets/{live-run-ucgeJa3o.js → live-run-EmcKA5cK.js} +1 -1
  30. package/dist/assets/{memory-B7nfWNTH.js → memory-CdMqWelO.js} +1 -1
  31. package/dist/assets/{memory-product-D1u5V75o.js → memory-product-f5AfXXJn.js} +1 -1
  32. package/dist/assets/{monaco-editor-DNT0Mzki.js → monaco-editor-DF4W-NC-.js} +2 -2
  33. package/dist/assets/{monaco-editor-inner-DuCqlGei.js → monaco-editor-inner-I81tD0qz.js} +1 -1
  34. package/dist/assets/{monaco.contribution-LYJB_lCm.js → monaco.contribution-CEeipeu9.js} +2 -2
  35. package/dist/assets/{observation-block-4AqYhL1h.js → observation-block-DC5e2IE9.js} +1 -1
  36. package/dist/assets/{observation-markdown-Dx_5-T0t.js → observation-markdown-DyWjt-yP.js} +1 -1
  37. package/dist/assets/{pencil-DdRoBrsh.js → pencil-CZF_NGi6.js} +1 -1
  38. package/dist/assets/plus-Qf7V331e.js +1 -0
  39. package/dist/assets/{popover-DGZi688D.js → popover-DwYq4QYF.js} +1 -1
  40. package/dist/assets/{refresh-cw-C_0AkMuu.js → refresh-cw-RAow1kax.js} +1 -1
  41. package/dist/assets/{resizable-BGEcNRZO.js → resizable-B2X6KlcC.js} +1 -1
  42. package/dist/assets/run-detail-DZ-1orHT.js +1 -0
  43. package/dist/assets/{runs-CywxkFZ6.js → runs-CTOIdEAQ.js} +1 -1
  44. package/dist/assets/{scroll-area-CnATfQoe.js → scroll-area-BmkJ1y7Q.js} +1 -1
  45. package/dist/assets/{select-CeVjgiKI.js → select-D5oFJNaq.js} +1 -1
  46. package/dist/assets/{shortcut-hints-Bs5o743i.js → shortcut-hints-CtwepXR1.js} +1 -1
  47. package/dist/assets/{split-button-DcY8ames.js → split-button-wGcE-JDx.js} +1 -1
  48. package/dist/assets/square-CgFZz_zK.js +1 -0
  49. package/dist/assets/{step-name-pills-Dta5ZGMZ.js → step-name-pills-VuIw2nNC.js} +1 -1
  50. package/dist/assets/{suite-editor-Bnf6KMna.js → suite-editor-DLu7OCZy.js} +1 -1
  51. package/dist/assets/{suite-navbar-PStktQ6j.js → suite-navbar-B8gZoPMT.js} +1 -1
  52. package/dist/assets/{suite-viewer-BD74MY_X.js → suite-viewer-CPBPmJdG.js} +1 -1
  53. package/dist/assets/{suites-BvfwzFEd.js → suites-wRKqOnN6.js} +1 -1
  54. package/dist/assets/{switch-ByV5GV5L.js → switch-CPd0R3ri.js} +1 -1
  55. package/dist/assets/{tab-console-BQFkZJG_.js → tab-console-BORDNFzI.js} +1 -1
  56. package/dist/assets/{table-D08QBBt4.js → table-QG2rKYu8.js} +1 -1
  57. package/dist/assets/{tabs-DrB_Acb3.js → tabs-DzjvuMEX.js} +1 -1
  58. package/dist/assets/{test-editor-w7ZQPYgH.js → test-editor-BoaHOuai.js} +1 -1
  59. package/dist/assets/{test-navbar-DoHKAy1p.js → test-navbar-C6-h4kbc.js} +1 -1
  60. package/dist/assets/{test-viewer-BwUQNVa4.js → test-viewer-0SziRmsW.js} +1 -1
  61. package/dist/assets/{tests-B5ELKDH2.js → tests-OLyMTO9C.js} +1 -1
  62. package/dist/assets/{tests-suites-table-widths-DNWnkAjA.js → tests-suites-table-widths-D49Zcf1r.js} +1 -1
  63. package/dist/assets/{textarea-DChEVvwQ.js → textarea-CVB6Do1_.js} +1 -1
  64. package/dist/assets/{trash-2-7P1Dp87k.js → trash-2-BhJSaMLG.js} +1 -1
  65. package/dist/assets/{tsMode-DEhRZlmT.js → tsMode-TiV3uQ0t.js} +1 -1
  66. package/dist/assets/{use-hook-run-session-x-d_iodT.js → use-hook-run-session-DH_86Jtn.js} +1 -1
  67. package/dist/assets/{use-keyboard-shortcuts-EAppuiKO.js → use-keyboard-shortcuts-Bal_Cx9w.js} +1 -1
  68. package/dist/assets/{use-page-title-B1t9-5_U.js → use-page-title-B4YPyIzc.js} +1 -1
  69. package/dist/assets/{use-run-status-favicon-D69P46yH.js → use-run-status-favicon-Rjqwuxhd.js} +1 -1
  70. package/dist/assets/{use-selection-queue-BboTDies.js → use-selection-queue-O7K3NZNK.js} +1 -1
  71. package/dist/assets/{viewer-url-state-6mOK5_sY.js → viewer-url-state-ClEUZJMl.js} +1 -1
  72. package/dist/assets/{zap-KFJmkY3Y.js → zap-BYpQfhU4.js} +1 -1
  73. package/dist/index.html +2 -2
  74. package/package.json +2 -2
  75. package/dist/assets/index-CW7tbJhs.css +0 -2
  76. package/dist/assets/plus-pXO98OAE.js +0 -1
  77. package/dist/assets/run-detail-3tlB8sew.js +0 -1
  78. package/dist/assets/square-D71GHEET.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{En as t,Qn as n,Wt as r,pr as i}from"./index-Bvtm2F6f.js";var a=e(i(),1),o=n(),s=`Label`,c=a.forwardRef((e,n)=>(0,o.jsx)(t.label,{...e,ref:n,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));c.displayName=s;var l=c;function u({className:e,...t}){return(0,o.jsx)(l,{"data-slot":`label`,className:r(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}Object.freeze({status:`aborted`});function d(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var f=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},p={};function m(e){return e&&Object.assign(p,e),p}function ee(e,t){return typeof t==`bigint`?t.toString():t}function te(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function h(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var g=Symbol(`evaluating`);function _(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==g)return r===void 0&&(r=g,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var v=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ne(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var re={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ie(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function C(e){return typeof e==`string`?e:e?.message}function w(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=C(e.inst?._zod.def?.error?.(e))??C(t?.error?.(e))??C(n.customError?.(e))??C(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}var T=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,ee,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ae=d(`$ZodError`,T),E=d(`$ZodError`,T,{Parent:Error}),oe=(e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new f;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>w(e,a,m())));throw v(t,i?.callee),t}return o.value})(E),se=(e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>w(e,a,m())));throw v(t,i?.callee),t}return o.value})(E),D=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new f;return a.issues.length?{success:!1,error:new(e??ae)(a.issues.map(e=>w(e,i,m())))}:{success:!0,data:a.value}})(E),O=(e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>w(e,i,m())))}:{success:!0,data:a.value}})(E),ce=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},le=/^-?\d+$/,ue=/^-?\d+(?:\.\d+)?$/,k=d(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),A={number:`number`,bigint:`bigint`,object:`date`},de=d(`$ZodCheckLessThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fe=d(`$ZodCheckGreaterThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pe=d(`$ZodCheckNumberFormat`,(e,t)=>{k.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=re[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=le)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),me=d(`$ZodCheckStringFormat`,(e,t)=>{var n,r;k.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),j=d(`$ZodCheckRegex`,(e,t)=>{me.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),M={major:4,minor:3,patch:6},N=d(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=M;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=S(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new f;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=S(e,t))});else{if(e.issues.length===t)continue;r||=S(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(S(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new f;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new f;return o.then(e=>t(e,r,a))}return t(o,r,a)}}_(e,`~standard`,()=>({validate:t=>{try{let n=D(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return O(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),P=d(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ce(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=d(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??ue,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),I=d(`$ZodNumberFormat`,(e,t)=>{pe.init(e,t),F.init(e,t)}),L=d(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function R(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...ie(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function z(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ne(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function he(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>R(e,n,i,t,u))):R(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var ge=d(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=te(()=>z(t));_(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=y,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>R(n,t,e,s,r))):R(i,t,e,s,r)}return i?he(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}});function B(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var _e=d(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${h(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>B(t,e.value)):B(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}});function ve(e,t){return new e({type:`string`,...x(t)})}function ye(e,t){return new e({type:`number`,checks:[],...x(t)})}function be(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function xe(e,t){return new e({type:`never`,...x(t)})}function Se(e,t){return new de({check:`less_than`,...x(t),value:e,inclusive:!0})}function Ce(e,t){return new fe({check:`greater_than`,...x(t),value:e,inclusive:!0})}function we(e,t){return new j({check:`string_format`,format:`regex`,...x(t),pattern:e})}var V=d(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);N.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>oe(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>D(e,t,n),e.parseAsync=async(t,n)=>se(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>O(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>b(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),Te=d(`ZodMiniString`,(e,t)=>{P.init(e,t),V.init(e,t)});function H(e){return ve(Te,e)}var U=d(`ZodMiniNumber`,(e,t)=>{F.init(e,t),V.init(e,t)});function Ee(e){return ye(U,e)}var De=d(`ZodMiniNumberFormat`,(e,t)=>{I.init(e,t),U.init(e,t)});function Oe(e){return be(De,e)}var ke=d(`ZodMiniNever`,(e,t)=>{L.init(e,t),V.init(e,t)});function Ae(e){return xe(ke,e)}var je=d(`ZodMiniObject`,(e,t)=>{ge.init(e,t),V.init(e,t),_(e,`shape`,()=>t.shape)});function W(e,t){return new je({type:`object`,shape:e,catchall:Ae(),...x(t)})}var Me=d(`ZodMiniOptional`,(e,t)=>{_e.init(e,t),V.init(e,t)});function G(e){return new Me({type:`optional`,innerType:e})}function Ne(e,t){let n=new Uint16Array(e);globalThis.crypto.getRandomValues(n);let r=Array(e);for(let i=0;i<e;i++)r[i]=t[n[i]%t.length];return r}var K=H().check(we(/^[a-z0-9]+$/,{error:`prefix must be lowercase alphanumeric`})),q=Ee().check(Oe({error:`words must be an integer`}),Ce(1,{error:`words must be at least 1`}),Se(16,{error:`words must be at most 16`})),Pe=W({prefix:G(K),words:G(q)}),Fe=W({prefix:G(K),words:G(q),namespace:G(H())}),J=Object.freeze(`aal aani aba abama abas abase abb abba abby abe abel abele abet abidi abies able abler ably abort about abouts above abox abu abut aby acca accent accept access accord ace acer aces ach achar ache achen acher aching acid acier acker acle acor acre act acting action active actor acts actual acute ada adai adam adapt adar adat aday adays add adda added adder addle adds addy ade adet adin adjust admin ado adult advert ady adz aes afar affa affirm aft after aga again agal agama agar agate age aged agen agena agency agenda agent ager ages agger aghan aging agio agnes ago agog agon agonal agra agre agree agua ague agy aha ahead ahir aho ahu aias aid ail ailing ails aim aint air aira aire airs airt airy ait ajar ajari aka akal akala akan ake akey akia akin akka ako akov aku ala alada alaki alala alan aland alar alarm alary alas alb album ale alea alee alem alen alert ales alette alex alf alias alice alida alien align alin aline alist alit alite alive alk all allah allan alle allen aller allow ally alma almost alo alogy alone along alp alpha also alt altar alter altern alto alur always aly alya ama amah amain amang amani amar amara amarin amazon amba ambar amber amble ambo ame amen ament ami amia amic amid amide amil amin amine amini amir amma amman ammer ammo ammu among amor amos amount amp ample amt amy ana anam anan anana anas anat anay anchor and anda ande andi andre andy anele anes angel angelo anger angers angka angle angled angler angles ango ani animal anime anion anis anker ann anna anne annet annie annual anoa anon ansa anser ansu answer ant anta antal antar antara ante antes anthem anti antic anton ants antu any apa apache apar apart apatan ape aper aping apis apollo aport appear append apple apply apps apse apt apus ara arab arad arar arc arca arch arched arches archie archy ardu are area ared arena argas argent argo argon aria arian aries ariot arius ark arks arm armed arming armor arms army arn arna arne arni aro around arrant arras array arris arrow arry art artar artha artist arts arty aru arum ary aryl asa asana ascii ascus ase asem ash asha ashen asher ashes ashy asian aside ask askar asks asp aspect asper assert asset assets assi assign assis assist ast asta aster astern astian ata atap ate aten ates athing ati atik atis atlas atma atom atomic atoms atria atta attach attack attar atter attern attery audio audit auge augh aught auh auk aum aus author auto autos ava avail aval avar ave avens aver avera averse avery aves avian avid avis avo avoid awa await awake awan award aware awat away awd awin awl awn awner awning axe axed axes axis axon ayah aye ayin ayu azine azo azole azon azure baa baar bab babel baby bac bach back backs backup bad badge bae bag bags bah bait baka bal ball balls bam ban banana band bands bane bang bank banks banner bar bara bard bare barer barn barra bars bart barth baru bas base based bases bash basic basis basket bass bat batch bate bath batis battle baud bay bea beam bean beans bear beat beats beaut beck bed beds bee beek been beer before beg begin behind being bel belief bell bella bells below belt ben bench bend bene beni ber bere berg berger beri bern berry bert bes best bet beta beth bets better bhar bias bib bid bien bier big bike bill bin binary bind binder bine bing bins bios biotic bird birds birth bis bishop bit bite bito biz black blad blade blah blank blas blast bled blend blick blind blink blo blob bloc block blood blower blue blur boa board boat bob bod boden body bog bola bold bole boll bolo bolt bom bomb bon bond bone bones boni bonus boo book bool boom boost boot boots bor bord border borg born borne boro borrow bos boss bot both bottom bounce bound bourg bout bouw bow bower boxes boxing boy bra brace brain brains bran branch brand bread break bred breed brew brick bridge brief brig bright bring brit broken broker brook brot brown browse brush bubble buck bucket bud buddy budget buds buff buffer bug build built bulk bull bullet bum bun bund bundle bung bur bureau burg burn burst bury bus buster busy but button buy buyer buzz cab cache cad cade cake cakes cal call caller cam came camel camera camp campo can cancel cand canner cannot canon cant canvas cap cape car cara carbon card care career caret cargo carry cart case cash casino cass cast caster cat catch cate cation caught cause cede cee ceil cel cell cement cent center cep ceptor ceral ceria cern cess cha chaft chai chain chair chal chalk champ chance chang change chant chap char charge chart chat chaus che cheap check chee chef chen cheng chet chi chia chid chief chien chil child chin china chine ching chip chips chlor cho choice chol choose chosen christ chrome chunk church cid cine cion cipher circle cit cite city civil claim clam clang clare class clave clean clear cled click client cline cling clinic clip clips clipse cloak clock clone close closed cloth cloud club coach coal coat cobra cod code coder coe coffee cohol coil coin col cola cold cole coli coll colon color colors column coma comb combat come comes comic coming comma commit common con cond cone cones conn conte conto contra cony cook cool coop cop cope copy cor cord corder core corn corner corp cos cost cot could count county coupon cours course court cover cow cox craft cran cratch crate crawl cream crease create credit cree creen crest crete crew crib crime cris critic cro crop cross crow crumb cry crypt cub cube cue cult cup cur curl curr curse cursor curve custom cut cute cyan cycle dab dad dade dae daemon dag daily dain dak dal dale dam damage dan dance dang danger dao dap dar dark dart das dash data date dater dating datum day days dead deal dealer death deb decess deck decode dee deep define deg degree del delay dele delete delta deme den dene dense dent deny depart depend deploy depth dere derive dern design desk dess detach detail detect dev device dew dha dial dib dice did diet dig digest digit dim din ding dip dire direct dirty dis disc dish disk dit dita ditch div divide dob doc dock docker doctor dod does dog dogs doing dol dom domain don done dont doom door dop dor dos dose dot double dow down draft drag dragon dram draw drawer dream dress drink drive driver drop dry dual dub duck duct ductor duit dum dummy dump dup during dust dux each ean ear earing early earn earth ease east easy eat ebb eben echo eddy eden edge edict edit edith editor edo educt eel eer effect eft egg egger ego either eke eker eking eland elate elb eld elder elding elect elf eli elia elian elite elk ell ella elle ellen elm elod elon elope els else elt elves embar embed ember eme emit emm emma empt empty emu enable encode end ended ender endere ending endue enemy energy engine enos ens ense ensky ensure ental enter entity entry enzyme epoch equal equip era erade eral erase erd ere erg eria erian erie ermine erne eros err erring error ers erse escape escort ess essay essed essie estado estate esteem ester estre eta etch ether ethyl etna etta ettle eva eve even event ever every evil ewer exact exam excel except exist exit expand expect expert expire expiry export extend extent extern extra eye eyen eyer eyey eyn fabric face facet fact factor fad fade fail fair faith fake faker fall fallen false fam family fan fang fant far farm fass fast fat fatal father fatter fault favor fear feat fed fee feed feel feer fei fell fels felt female fen fern fest fet fetch few fib fiber fico fid field fifo fig fight figure file fill filled film filter fin final find finder fine finger finish finite finity fir fire firm first fish fit five fix fixed flag flake flare flash flat fleet flex flight flip flix flo float floor flora flow flower flu fluid flush flux fly foam focus fod fog foil fold folder folie folio folk follow fon fond fono font foo food foot footer for fora force forced forcer ford forest forge forget forgot fork form formal format forme formed former formin fort forth forum fot found fox fra fram frame fred free freeze fresh fried friend frig frist fro frog from front fruit fuel full fully fum fun fund funk fusc fusion future gab gabe gable gad gage gain gal gam game gaming gamma gan gang gant gaon gap gar gara garden gare garten gary gas gast gat gata gate gau gave gaz gear ged gee gel geld gelt gem gen gender gene genic genre gens gent geo ger gerald gers ges gest get geta getter gey gez ghan ghost gid gie gif gift gig gil gin ging gio girl gist git give given giver giving glass glib global glyph gnu goal god going gol gold golly gon gone gong goo good goods gor gos got gra grab grad grade graded grader grain gram grand grant graph grass grat gratis grave gray great gree green greg grey grid griff grim gris gross ground group grow grown growth grunt guan guard gue guess guest guide guild guise gul gulp gum gun guna gur guru gus gust gut gym gyro habit hack had haft hag hah hail hain hair hak hal hala hale half hall halo halt halter halve ham hammer han hand handle hanger hao hap happy hard harm hart hash hasta hat hau hausen have haven haw hawk hawm hay head headed header heal health heap hear heart heat heater heavy heck heder heed heer hehe hei height hein hele hello helm helmet help helper hem heme hen hend hep her hern hero hers het hew hex hey hia hic hid hidden hide high higher hill him hin hind hing hint hip hire hiro his hist hit hler hob hobo hod hog hoi hold holder hole holm holt holy home hon hone hong hood hoof hook hoot hop hope hopper hora horn horse hose host hot hotel hound hour house hoven hover how hub hud hug hui huk hum huma human hun hung hunt hunter hurst hurt hut hwa hyp hyper ian iao iba iban ibid ibo ice iced ich icho icing icon icy ida ide idea ideal idean ides idle idler ido idol ife iffy ignite ignore ihi ijo ikat ike ikey ila ilia ilian ilium ilk ilka ill illy ilot ima image imam imber imer imi imine immi immit immune imp impact impi import imu inca inch income ind indaba indan inde indent index india indic indra indy ineri inermi inez infect infer inform infra ing inga inger ingle inia inion initis inject ink inken inker inkle inks inky inn inner inning ino inoma input insert inside insula intend intent inter intern into invent invert invest invite invoke ion ione ioni ionic ipid ira iran irani ire iris irish irk irma iron ism iso issue issuer ist istle ita itala itali italic itch item iten iter ither ito its itys itza iva ivan ivin ivy iwa iyo izar izard izzard jab jack jade jam jama jaman jan jar jara jat jati java jaw jay jed jem jest jet jete jim jin jing job joch joe john join joint joker jon jong joni jos jours joy juan jud judge jug juice juju jump jun junk junto jur jury just jut kai kaj kan kana kang kari karma kat kate kay kea ked kee keen keep keeper keet kele ken kend kenn kent kep ker kern kernel ket keta key kick kid kids kil killer kim kin kina kind king kino kip kish kiss kit kite kitty knife know known koa kob koch kol kon kona kop kor kos kou kra kraft kreis kua kung lab label labor lac lace lack lad lade laden lady lag lagen lager lai laid lain lak lake lalo lam lama lambda lament lamp lan lana land lander lane lant lap lar large lari las laser lash lass last lat late lated laten later latest latex latin lation laugh launch lava law lay layer layout lazy lea lead leader leaf league lean lear learn lease least leave lech leck lector led leda lede leden ledge ledged ledger lee leed leep leer lees leet left leg legacy legal legate legend leger leges lei leigh lek lemma len lend lene length lens lent leo ler les less lesson lest let lete lett letter lev levant level lever lew lex lexia ley liable lias lice lich lichen licit lick lid lide lie lied lief lier lif life lift light ligne like lim lime limit lin line linear lined linen liner ling linge linger linha linie lining link linked links linky lint lion lip lis lish list listed listen lit lite liter little liv live living liz loa load loaded loader loan lob lobal local locale loch lock locked locker lod lof log loge logged logger logic login logo logos loin loir long loo lood look lookup loom loon loop loot lop lope lord lose loss lost lot lots lotte lou love lover low lower lox loyd luc luck lug lum lunes lung lur lush lut lux lying lys lysis mac mack macro mad made mag mage magic mah mail mailer main maine maint major make maker making mal malar mall mallow mam man mana manage mand mande manent manes mani mania mann mano mans manse mant manual manuel many mao map mapper mar march mare margin marine mark marked marker market markup mars mart marvin mary mas masa mask masked mass massa mast master mat match mate mater math matrix matter max may maya maybe maze meal mean mede media median medio medium meet meg mein mel meld mele melon mem member memo memory men meng ment mental mentor menu mer mere merge merk mero mes mesa mese mesh mess messe messer mester met meta metal mete meteor meter method metic metric mica mico micro mid middle mien mig might mil mile milk mill mime min mina mind mine miner ming mino minor mint minus minute mir mirror mise miss mist mite mitt mix mixed mob mobile mock mod modal mode model modern modify module mog moil moire moment mon money mong mongo mono mont month monton moo moon moor mooth mor more morgen mort most mostly mot mother motion motor mount mouse mouth move movie moving mrs much mud mult mum mun mund mung munity mus museum music must mute mux naa naam nab nable nach nae nag naio nais nak nam nama name nan nance nancy nant nap nar nard nast nat nation native nature nay nea neal near neath neb neck ned nee need needle needs neet nef nei nell nelly neo ness nest nesty net nete never new news next nias nice nici nick nid night nil nim nine ning nisse nit nod node nog noise noma nome non nonce none noop nor norm normal north nose nostic not note notice notify nou noun nous nova novo now nth nub nul null number numero nun nut nye oak oban obe obi object occur och ock ocracy ocular oda odal odd ode odel odin odium odor ods odz oes off offer office offset oft often ogle ohia oil oint oka okee oki okia okra old olden older ole oleg olid olio olive olla olm ology olor olson oman omar omber omega omen omer omina omit ona once one oner onium only ons ontal onto onus onym onza oodles oons oord opal opaque ope open opera opsy opt optic option opus ora oracle orage orang orange orb orbit orc orca order ordu ore orf organ orgia orias orient origin orna orris ort ory osc ose ossal osse ostic otate other otic otis oto otto otus ouch ouf ough ought ounce ounds ours oust out outed outen outer outing output ova oval oven over ovine ovis owe ower owing owl owler own owner oxide oxy oxygen oyer paar pac pace paced pack packer packet pad page pager pagina pail pain paint pair paired pais pal pam pan pand panel pang panic pant pants pap paper paque par para param parate parcel pard paren parent parer pari paring park parse parser part party pass passen past paste pat patch path pathy pau pause paw pawn pay payer pea peace peak peaker peat ped peed peer peg pele pell pen pend pent people pep per peri period perk perm permit person pert perty pes peso pet phase phasis phi phil pho phon phone phonic phony phot photo phrase pia pic pick picked picker pickle pie pier pig pik pile pill pillar pilot pin pine ping pink pip pipe pir piro pit pitch pivot pix pizza place placer plain plan planet plant plash plass plat plate play player please pled plex pliant plied plier pliers plies plot ploy pluck plug plural plus ply pod poi point poke pol polar pole policy polis poly pom pon pond ponder pone ponent pong pont pony pool poor pop poral port porta portal ported porter porto pose poser posing posit poss post postal posted poster pot pow power pox pray prefer prefix prep preset press prest pretty price priced prim prima prime primer print prior pro prob probe prod prof profit prog prompt proof prop proper props prote proto prove proved prow proxy pseudo psi pst psych puan pub public pul pull pulse pump pun punt pur pure purple puru push put python qua quad quake quan quant quare quart quat queen query quest quet queue quick quid quiet quila quin quina quip quire quis quit quite quiz quo quot quota quote raad rab rabbit race rach rack rad rada radio radius raff raft rag rage rah raid rail rain rais raise raised raiser raj rale ram rama rame ran rana rance rand random rang range rank rant rap rapid rapper rare ras rase rash rat rate rated rather rating ratio ration raul raw rax ray rea reach react read reader ready reak real really realm ream rear reason reb recent recipe reck record rect red redd rede redo reduce redux ree reef reek reem reen rees reet ref refer refix refund reg region reh rein reis reit reject rel reland relay reload remain reman remark remote remove renal rename rend render renew rent rep repair repeat repen reply report resent reset resh resize resp rest result resume ret retain retan retch retry return reuse rev reve revet review reward rex rhein rho ria rial rib ric rice rich richt rick rid ridden ride ridge rie rier riff rift rig right rik rim rine ring ringer rink rio riot rip rise risk rist rit rita rite rive river rix roach road rob robe robot roc rock rocket rod rodd roe rog roger roi roit rok roke roker role rolled roller rolley roman rome ron rone rong roof rook room roon root rope ropy rosa rose ross rot rota rotate rote rottle roud rough round roup route router rove row rowing rox roy rub ruby ruck rud ruff rug rule rum run runner rupa rus rush rust rut ruta sab sad safe sage said sak sal salary sale salt sam same sample san sand sans sap sar sass sat save saved saving say scala scalar scale scaled scan scape scar scene schema scheme school schule scient scious scope score screen scribe script scroll sea seal sealed search season seat sec second secret sect sector secure seed seeing seek seen seer seg segue seid seit sele select self seller semble semi sen send sender sense sensor sept ser sera seri serial series sero sert serve server servo sess set sett setter setup seven sey sha shade shader shadow shake shall shan shape share sharp shaw shay she shed sheet shell shen sheng shi shield shift shim shin shine ship shire shirt shiv sho shock shoe shop shore short shot should show shown shu sia sib sic sid side sie sig sigma sign signal sil silent silver sim simple sin since sing single sink sip sir sis sit six size sizes skal skat sker ski skill skim skin skip sky sla slam slash sled sleep slice slick slide slider slot slow slug small smart smarty smith smooth snake snap snow soap sob soc social sock socket soe soever soft soil sol solar sold sole solid solo solute solve solver some son song sons soon sorry sort sorted sou sound source south soy spa space spam span spann spar spark spart spawn spec sped speech speed spell spent sphere spiel spill spin spire spired splice split spoken spor sport sports spot spread spring sprite spur spy square ssi stable stack staff stag stage stake stall stamp stan stance stand star start stash state static status staw stay stead steady steam steel steen stein stell stem sten step stern stick sticks sticky stid still stim stime sting stock stocks stod stof stoff stone stood stop store storm story stra stract strain strand strap stre stream street streng stress strict stride strike string strip stripe strix stroke strom strong stu stub stud studio study stuff stum sty style sub submit subset such suffix suite summer sup super sur sure surf survey sus swap sweet swift swiper switch symbol sync syntax system taa tab tabla table tables tablet tach tag tai tail tain taj take taken taking tal talk tam tan tank tap tar tara tare target task taste tat tau tax tay tea teach team tear tec tech ted tee teen teg teil tele tell tema temp temper tempo tempt ten tenant tensor tent tera teras teri term termin tern terna ternal terne test teste tested tester text tez tha thai than thane thank thanks that the their them theme then these theta they thin thing think third this tho thon thorn those though thouse thread three throw thumb thus thy tic tick ticker ticket tid tie tier tig tight til tile tim time timer times tin ting tiny tip title titre toa toast tod today toe tog toggle toi token tol tom ton tone tong too tool toon top topia topic tops tor torch tot total tou touch tour tout tower town tox toy tra trace track tract trade trag trail train trait tram tran trap trash travel tray tree trend trent tri trial trica trim trin trip tron truck true trust truth try trying tube tum tun tur turn turned tweet twig two type uang ubi uca udal udder udi udo uds ugh uji uke ula ule ull ulla uller ulling ultima ultimo ulu umber umble umbo ume ump umph umu una unable unal unami unbind unca uncate unci uncia unde unden under undo undy unie union unique unit unity unken unless unlink unlock unsafe unset untar until unto unused unwrap unze update upload upo upon upper ura ural uran urate urban urd urde urdu ure urent urf urge urgent urger uri uria urlar urn urna urnal urning uro urs ursa ursal ursus uru urus usable usage usar use used user ush usher ussels ust uster usual usun uta utas utch ute utile utter utu utum uva vai vain vair val vale vali valid vall valor value valuer van vang vara vare vari varna vary vas vast vat vault veal vector veda vedic vee veen veer vei veil vela vell velo velte vend vendor vent venter venue venus vera verb verd verify verity vern versal verse versed verst vert vertex very vest vester vet via vic vice video vie vier view viewer vill villa ville vim vina vince vine vino viol vip vira viral viron virus vis visa vise vision visit visor vista visual vita vive vod voet vog voice void vol vole volent volt volume vote vum waar wab wad wadi wag wagon wah wain wait waka wake wale wali walk walker wall wallet wan wand wander wandle wane wang want wany wap war ward warden ware warf warm warn warp wart was wash washed washer wat watch water wave wax way wayne ways weak wealth weapon wear web wed wee weekly ween weep weet wei weka well welt wem wen wend went`.split(` `));function Y(e,t){return e?`${e}_${t}`:t}async function Ie(e,t){if(!e||typeof e!=`string`)throw Error(`input must be a non-empty string`);let n=Fe.parse(t??{}),r=n.words??8;if(!globalThis.crypto?.subtle)throw Error(`idAgent.from() requires Web Crypto API (crypto.subtle). Use HTTPS in browsers.`);let i=new TextEncoder,a=i.encode(n.namespace??`id-agent`),o=await globalThis.crypto.subtle.importKey(`raw`,a,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),s=await globalThis.crypto.subtle.sign(`HMAC`,o,i.encode(e)),c=new DataView(s),l=Array(r);for(let e=0;e<r;e++)l[e]=J[c.getUint16(e*2)%4096];return Y(n.prefix,l.join(`-`))}function Le(){let e=(e=>{let t=Pe.parse(e??{}),n=Ne(t.words??8,J);return Y(t.prefix,n.join(`-`))});return e.from=(e,t)=>Ie(e,t),e}var Re=Le();Math.log2(J.length),new Set(J);var X={test:`t`,suite:`s`,hook:`h`,observation:`obs`,run:`r`};function Z(e){return Re({prefix:e,words:10})}function Q(){return Z(X.test)}function ze(){return Z(X.suite)}function Be(){return Z(X.hook)}var $=[{name:`Linear`,slug:`linear`},{name:`Vercel`,slug:`vercel`},{name:`Notion`,slug:`notion`},{name:`Stripe`,slug:`stripe`},{name:`GitHub`,slug:`github`},{name:`Slack`,slug:`slack`},{name:`Figma`,slug:`figma`},{name:`Shopify`,slug:`shopify`},{name:`Datadog`,slug:`datadog`},{name:`Supabase`,slug:`supabase`}];$.map(e=>e.name),$.map(e=>e.slug);function Ve(e){let t=String(e),n=0;for(let e=0;e<t.length;e+=1)n=n*31+t.charCodeAt(e)>>>0;return n}function He(e){return $[Ve(e)%$.length]}function Ue(e){return He(e).slug}export{u as a,Ue as i,ze as n,Q as r,Be as t};
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{En as t,Qn as n,Wt as r,pr as i}from"./index-B4FdO6Vk.js";var a=e(i(),1),o=n(),s=`Label`,c=a.forwardRef((e,n)=>(0,o.jsx)(t.label,{...e,ref:n,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));c.displayName=s;var l=c;function u({className:e,...t}){return(0,o.jsx)(l,{"data-slot":`label`,className:r(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}Object.freeze({status:`aborted`});function d(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var f=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},p={};function m(e){return e&&Object.assign(p,e),p}function ee(e,t){return typeof t==`bigint`?t.toString():t}function te(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function h(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var g=Symbol(`evaluating`);function _(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==g)return r===void 0&&(r=g,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var v=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function b(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ne(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var re={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ie(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function C(e){return typeof e==`string`?e:e?.message}function w(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=C(e.inst?._zod.def?.error?.(e))??C(t?.error?.(e))??C(n.customError?.(e))??C(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}var T=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,ee,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ae=d(`$ZodError`,T),E=d(`$ZodError`,T,{Parent:Error}),oe=(e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new f;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>w(e,a,m())));throw v(t,i?.callee),t}return o.value})(E),se=(e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>w(e,a,m())));throw v(t,i?.callee),t}return o.value})(E),D=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new f;return a.issues.length?{success:!1,error:new(e??ae)(a.issues.map(e=>w(e,i,m())))}:{success:!0,data:a.value}})(E),O=(e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>w(e,i,m())))}:{success:!0,data:a.value}})(E),ce=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},le=/^-?\d+$/,ue=/^-?\d+(?:\.\d+)?$/,k=d(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),A={number:`number`,bigint:`bigint`,object:`date`},de=d(`$ZodCheckLessThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fe=d(`$ZodCheckGreaterThan`,(e,t)=>{k.init(e,t);let n=A[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pe=d(`$ZodCheckNumberFormat`,(e,t)=>{k.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=re[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=le)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),me=d(`$ZodCheckStringFormat`,(e,t)=>{var n,r;k.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),j=d(`$ZodCheckRegex`,(e,t)=>{me.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),M={major:4,minor:3,patch:6},N=d(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=M;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=S(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new f;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=S(e,t))});else{if(e.issues.length===t)continue;r||=S(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(S(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new f;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new f;return o.then(e=>t(e,r,a))}return t(o,r,a)}}_(e,`~standard`,()=>({validate:t=>{try{let n=D(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return O(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),P=d(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ce(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=d(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??ue,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),I=d(`$ZodNumberFormat`,(e,t)=>{pe.init(e,t),F.init(e,t)}),L=d(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function R(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...ie(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function z(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ne(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function he(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>R(e,n,i,t,u))):R(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var ge=d(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=te(()=>z(t));_(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=y,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>R(n,t,e,s,r))):R(i,t,e,s,r)}return i?he(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}});function B(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var _e=d(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${h(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>B(t,e.value)):B(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}});function ve(e,t){return new e({type:`string`,...x(t)})}function ye(e,t){return new e({type:`number`,checks:[],...x(t)})}function be(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function xe(e,t){return new e({type:`never`,...x(t)})}function Se(e,t){return new de({check:`less_than`,...x(t),value:e,inclusive:!0})}function Ce(e,t){return new fe({check:`greater_than`,...x(t),value:e,inclusive:!0})}function we(e,t){return new j({check:`string_format`,format:`regex`,...x(t),pattern:e})}var V=d(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);N.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>oe(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>D(e,t,n),e.parseAsync=async(t,n)=>se(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>O(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>b(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),Te=d(`ZodMiniString`,(e,t)=>{P.init(e,t),V.init(e,t)});function H(e){return ve(Te,e)}var U=d(`ZodMiniNumber`,(e,t)=>{F.init(e,t),V.init(e,t)});function Ee(e){return ye(U,e)}var De=d(`ZodMiniNumberFormat`,(e,t)=>{I.init(e,t),U.init(e,t)});function Oe(e){return be(De,e)}var ke=d(`ZodMiniNever`,(e,t)=>{L.init(e,t),V.init(e,t)});function Ae(e){return xe(ke,e)}var je=d(`ZodMiniObject`,(e,t)=>{ge.init(e,t),V.init(e,t),_(e,`shape`,()=>t.shape)});function W(e,t){return new je({type:`object`,shape:e,catchall:Ae(),...x(t)})}var Me=d(`ZodMiniOptional`,(e,t)=>{_e.init(e,t),V.init(e,t)});function G(e){return new Me({type:`optional`,innerType:e})}function Ne(e,t){let n=new Uint16Array(e);globalThis.crypto.getRandomValues(n);let r=Array(e);for(let i=0;i<e;i++)r[i]=t[n[i]%t.length];return r}var K=H().check(we(/^[a-z0-9]+$/,{error:`prefix must be lowercase alphanumeric`})),q=Ee().check(Oe({error:`words must be an integer`}),Ce(1,{error:`words must be at least 1`}),Se(16,{error:`words must be at most 16`})),Pe=W({prefix:G(K),words:G(q)}),Fe=W({prefix:G(K),words:G(q),namespace:G(H())}),J=Object.freeze(`aal aani aba abama abas abase abb abba abby abe abel abele abet abidi abies able abler ably abort about abouts above abox abu abut aby acca accent accept access accord ace acer aces ach achar ache achen acher aching acid acier acker acle acor acre act acting action active actor acts actual acute ada adai adam adapt adar adat aday adays add adda added adder addle adds addy ade adet adin adjust admin ado adult advert ady adz aes afar affa affirm aft after aga again agal agama agar agate age aged agen agena agency agenda agent ager ages agger aghan aging agio agnes ago agog agon agonal agra agre agree agua ague agy aha ahead ahir aho ahu aias aid ail ailing ails aim aint air aira aire airs airt airy ait ajar ajari aka akal akala akan ake akey akia akin akka ako akov aku ala alada alaki alala alan aland alar alarm alary alas alb album ale alea alee alem alen alert ales alette alex alf alias alice alida alien align alin aline alist alit alite alive alk all allah allan alle allen aller allow ally alma almost alo alogy alone along alp alpha also alt altar alter altern alto alur always aly alya ama amah amain amang amani amar amara amarin amazon amba ambar amber amble ambo ame amen ament ami amia amic amid amide amil amin amine amini amir amma amman ammer ammo ammu among amor amos amount amp ample amt amy ana anam anan anana anas anat anay anchor and anda ande andi andre andy anele anes angel angelo anger angers angka angle angled angler angles ango ani animal anime anion anis anker ann anna anne annet annie annual anoa anon ansa anser ansu answer ant anta antal antar antara ante antes anthem anti antic anton ants antu any apa apache apar apart apatan ape aper aping apis apollo aport appear append apple apply apps apse apt apus ara arab arad arar arc arca arch arched arches archie archy ardu are area ared arena argas argent argo argon aria arian aries ariot arius ark arks arm armed arming armor arms army arn arna arne arni aro around arrant arras array arris arrow arry art artar artha artist arts arty aru arum ary aryl asa asana ascii ascus ase asem ash asha ashen asher ashes ashy asian aside ask askar asks asp aspect asper assert asset assets assi assign assis assist ast asta aster astern astian ata atap ate aten ates athing ati atik atis atlas atma atom atomic atoms atria atta attach attack attar atter attern attery audio audit auge augh aught auh auk aum aus author auto autos ava avail aval avar ave avens aver avera averse avery aves avian avid avis avo avoid awa await awake awan award aware awat away awd awin awl awn awner awning axe axed axes axis axon ayah aye ayin ayu azine azo azole azon azure baa baar bab babel baby bac bach back backs backup bad badge bae bag bags bah bait baka bal ball balls bam ban banana band bands bane bang bank banks banner bar bara bard bare barer barn barra bars bart barth baru bas base based bases bash basic basis basket bass bat batch bate bath batis battle baud bay bea beam bean beans bear beat beats beaut beck bed beds bee beek been beer before beg begin behind being bel belief bell bella bells below belt ben bench bend bene beni ber bere berg berger beri bern berry bert bes best bet beta beth bets better bhar bias bib bid bien bier big bike bill bin binary bind binder bine bing bins bios biotic bird birds birth bis bishop bit bite bito biz black blad blade blah blank blas blast bled blend blick blind blink blo blob bloc block blood blower blue blur boa board boat bob bod boden body bog bola bold bole boll bolo bolt bom bomb bon bond bone bones boni bonus boo book bool boom boost boot boots bor bord border borg born borne boro borrow bos boss bot both bottom bounce bound bourg bout bouw bow bower boxes boxing boy bra brace brain brains bran branch brand bread break bred breed brew brick bridge brief brig bright bring brit broken broker brook brot brown browse brush bubble buck bucket bud buddy budget buds buff buffer bug build built bulk bull bullet bum bun bund bundle bung bur bureau burg burn burst bury bus buster busy but button buy buyer buzz cab cache cad cade cake cakes cal call caller cam came camel camera camp campo can cancel cand canner cannot canon cant canvas cap cape car cara carbon card care career caret cargo carry cart case cash casino cass cast caster cat catch cate cation caught cause cede cee ceil cel cell cement cent center cep ceptor ceral ceria cern cess cha chaft chai chain chair chal chalk champ chance chang change chant chap char charge chart chat chaus che cheap check chee chef chen cheng chet chi chia chid chief chien chil child chin china chine ching chip chips chlor cho choice chol choose chosen christ chrome chunk church cid cine cion cipher circle cit cite city civil claim clam clang clare class clave clean clear cled click client cline cling clinic clip clips clipse cloak clock clone close closed cloth cloud club coach coal coat cobra cod code coder coe coffee cohol coil coin col cola cold cole coli coll colon color colors column coma comb combat come comes comic coming comma commit common con cond cone cones conn conte conto contra cony cook cool coop cop cope copy cor cord corder core corn corner corp cos cost cot could count county coupon cours course court cover cow cox craft cran cratch crate crawl cream crease create credit cree creen crest crete crew crib crime cris critic cro crop cross crow crumb cry crypt cub cube cue cult cup cur curl curr curse cursor curve custom cut cute cyan cycle dab dad dade dae daemon dag daily dain dak dal dale dam damage dan dance dang danger dao dap dar dark dart das dash data date dater dating datum day days dead deal dealer death deb decess deck decode dee deep define deg degree del delay dele delete delta deme den dene dense dent deny depart depend deploy depth dere derive dern design desk dess detach detail detect dev device dew dha dial dib dice did diet dig digest digit dim din ding dip dire direct dirty dis disc dish disk dit dita ditch div divide dob doc dock docker doctor dod does dog dogs doing dol dom domain don done dont doom door dop dor dos dose dot double dow down draft drag dragon dram draw drawer dream dress drink drive driver drop dry dual dub duck duct ductor duit dum dummy dump dup during dust dux each ean ear earing early earn earth ease east easy eat ebb eben echo eddy eden edge edict edit edith editor edo educt eel eer effect eft egg egger ego either eke eker eking eland elate elb eld elder elding elect elf eli elia elian elite elk ell ella elle ellen elm elod elon elope els else elt elves embar embed ember eme emit emm emma empt empty emu enable encode end ended ender endere ending endue enemy energy engine enos ens ense ensky ensure ental enter entity entry enzyme epoch equal equip era erade eral erase erd ere erg eria erian erie ermine erne eros err erring error ers erse escape escort ess essay essed essie estado estate esteem ester estre eta etch ether ethyl etna etta ettle eva eve even event ever every evil ewer exact exam excel except exist exit expand expect expert expire expiry export extend extent extern extra eye eyen eyer eyey eyn fabric face facet fact factor fad fade fail fair faith fake faker fall fallen false fam family fan fang fant far farm fass fast fat fatal father fatter fault favor fear feat fed fee feed feel feer fei fell fels felt female fen fern fest fet fetch few fib fiber fico fid field fifo fig fight figure file fill filled film filter fin final find finder fine finger finish finite finity fir fire firm first fish fit five fix fixed flag flake flare flash flat fleet flex flight flip flix flo float floor flora flow flower flu fluid flush flux fly foam focus fod fog foil fold folder folie folio folk follow fon fond fono font foo food foot footer for fora force forced forcer ford forest forge forget forgot fork form formal format forme formed former formin fort forth forum fot found fox fra fram frame fred free freeze fresh fried friend frig frist fro frog from front fruit fuel full fully fum fun fund funk fusc fusion future gab gabe gable gad gage gain gal gam game gaming gamma gan gang gant gaon gap gar gara garden gare garten gary gas gast gat gata gate gau gave gaz gear ged gee gel geld gelt gem gen gender gene genic genre gens gent geo ger gerald gers ges gest get geta getter gey gez ghan ghost gid gie gif gift gig gil gin ging gio girl gist git give given giver giving glass glib global glyph gnu goal god going gol gold golly gon gone gong goo good goods gor gos got gra grab grad grade graded grader grain gram grand grant graph grass grat gratis grave gray great gree green greg grey grid griff grim gris gross ground group grow grown growth grunt guan guard gue guess guest guide guild guise gul gulp gum gun guna gur guru gus gust gut gym gyro habit hack had haft hag hah hail hain hair hak hal hala hale half hall halo halt halter halve ham hammer han hand handle hanger hao hap happy hard harm hart hash hasta hat hau hausen have haven haw hawk hawm hay head headed header heal health heap hear heart heat heater heavy heck heder heed heer hehe hei height hein hele hello helm helmet help helper hem heme hen hend hep her hern hero hers het hew hex hey hia hic hid hidden hide high higher hill him hin hind hing hint hip hire hiro his hist hit hler hob hobo hod hog hoi hold holder hole holm holt holy home hon hone hong hood hoof hook hoot hop hope hopper hora horn horse hose host hot hotel hound hour house hoven hover how hub hud hug hui huk hum huma human hun hung hunt hunter hurst hurt hut hwa hyp hyper ian iao iba iban ibid ibo ice iced ich icho icing icon icy ida ide idea ideal idean ides idle idler ido idol ife iffy ignite ignore ihi ijo ikat ike ikey ila ilia ilian ilium ilk ilka ill illy ilot ima image imam imber imer imi imine immi immit immune imp impact impi import imu inca inch income ind indaba indan inde indent index india indic indra indy ineri inermi inez infect infer inform infra ing inga inger ingle inia inion initis inject ink inken inker inkle inks inky inn inner inning ino inoma input insert inside insula intend intent inter intern into invent invert invest invite invoke ion ione ioni ionic ipid ira iran irani ire iris irish irk irma iron ism iso issue issuer ist istle ita itala itali italic itch item iten iter ither ito its itys itza iva ivan ivin ivy iwa iyo izar izard izzard jab jack jade jam jama jaman jan jar jara jat jati java jaw jay jed jem jest jet jete jim jin jing job joch joe john join joint joker jon jong joni jos jours joy juan jud judge jug juice juju jump jun junk junto jur jury just jut kai kaj kan kana kang kari karma kat kate kay kea ked kee keen keep keeper keet kele ken kend kenn kent kep ker kern kernel ket keta key kick kid kids kil killer kim kin kina kind king kino kip kish kiss kit kite kitty knife know known koa kob koch kol kon kona kop kor kos kou kra kraft kreis kua kung lab label labor lac lace lack lad lade laden lady lag lagen lager lai laid lain lak lake lalo lam lama lambda lament lamp lan lana land lander lane lant lap lar large lari las laser lash lass last lat late lated laten later latest latex latin lation laugh launch lava law lay layer layout lazy lea lead leader leaf league lean lear learn lease least leave lech leck lector led leda lede leden ledge ledged ledger lee leed leep leer lees leet left leg legacy legal legate legend leger leges lei leigh lek lemma len lend lene length lens lent leo ler les less lesson lest let lete lett letter lev levant level lever lew lex lexia ley liable lias lice lich lichen licit lick lid lide lie lied lief lier lif life lift light ligne like lim lime limit lin line linear lined linen liner ling linge linger linha linie lining link linked links linky lint lion lip lis lish list listed listen lit lite liter little liv live living liz loa load loaded loader loan lob lobal local locale loch lock locked locker lod lof log loge logged logger logic login logo logos loin loir long loo lood look lookup loom loon loop loot lop lope lord lose loss lost lot lots lotte lou love lover low lower lox loyd luc luck lug lum lunes lung lur lush lut lux lying lys lysis mac mack macro mad made mag mage magic mah mail mailer main maine maint major make maker making mal malar mall mallow mam man mana manage mand mande manent manes mani mania mann mano mans manse mant manual manuel many mao map mapper mar march mare margin marine mark marked marker market markup mars mart marvin mary mas masa mask masked mass massa mast master mat match mate mater math matrix matter max may maya maybe maze meal mean mede media median medio medium meet meg mein mel meld mele melon mem member memo memory men meng ment mental mentor menu mer mere merge merk mero mes mesa mese mesh mess messe messer mester met meta metal mete meteor meter method metic metric mica mico micro mid middle mien mig might mil mile milk mill mime min mina mind mine miner ming mino minor mint minus minute mir mirror mise miss mist mite mitt mix mixed mob mobile mock mod modal mode model modern modify module mog moil moire moment mon money mong mongo mono mont month monton moo moon moor mooth mor more morgen mort most mostly mot mother motion motor mount mouse mouth move movie moving mrs much mud mult mum mun mund mung munity mus museum music must mute mux naa naam nab nable nach nae nag naio nais nak nam nama name nan nance nancy nant nap nar nard nast nat nation native nature nay nea neal near neath neb neck ned nee need needle needs neet nef nei nell nelly neo ness nest nesty net nete never new news next nias nice nici nick nid night nil nim nine ning nisse nit nod node nog noise noma nome non nonce none noop nor norm normal north nose nostic not note notice notify nou noun nous nova novo now nth nub nul null number numero nun nut nye oak oban obe obi object occur och ock ocracy ocular oda odal odd ode odel odin odium odor ods odz oes off offer office offset oft often ogle ohia oil oint oka okee oki okia okra old olden older ole oleg olid olio olive olla olm ology olor olson oman omar omber omega omen omer omina omit ona once one oner onium only ons ontal onto onus onym onza oodles oons oord opal opaque ope open opera opsy opt optic option opus ora oracle orage orang orange orb orbit orc orca order ordu ore orf organ orgia orias orient origin orna orris ort ory osc ose ossal osse ostic otate other otic otis oto otto otus ouch ouf ough ought ounce ounds ours oust out outed outen outer outing output ova oval oven over ovine ovis owe ower owing owl owler own owner oxide oxy oxygen oyer paar pac pace paced pack packer packet pad page pager pagina pail pain paint pair paired pais pal pam pan pand panel pang panic pant pants pap paper paque par para param parate parcel pard paren parent parer pari paring park parse parser part party pass passen past paste pat patch path pathy pau pause paw pawn pay payer pea peace peak peaker peat ped peed peer peg pele pell pen pend pent people pep per peri period perk perm permit person pert perty pes peso pet phase phasis phi phil pho phon phone phonic phony phot photo phrase pia pic pick picked picker pickle pie pier pig pik pile pill pillar pilot pin pine ping pink pip pipe pir piro pit pitch pivot pix pizza place placer plain plan planet plant plash plass plat plate play player please pled plex pliant plied plier pliers plies plot ploy pluck plug plural plus ply pod poi point poke pol polar pole policy polis poly pom pon pond ponder pone ponent pong pont pony pool poor pop poral port porta portal ported porter porto pose poser posing posit poss post postal posted poster pot pow power pox pray prefer prefix prep preset press prest pretty price priced prim prima prime primer print prior pro prob probe prod prof profit prog prompt proof prop proper props prote proto prove proved prow proxy pseudo psi pst psych puan pub public pul pull pulse pump pun punt pur pure purple puru push put python qua quad quake quan quant quare quart quat queen query quest quet queue quick quid quiet quila quin quina quip quire quis quit quite quiz quo quot quota quote raad rab rabbit race rach rack rad rada radio radius raff raft rag rage rah raid rail rain rais raise raised raiser raj rale ram rama rame ran rana rance rand random rang range rank rant rap rapid rapper rare ras rase rash rat rate rated rather rating ratio ration raul raw rax ray rea reach react read reader ready reak real really realm ream rear reason reb recent recipe reck record rect red redd rede redo reduce redux ree reef reek reem reen rees reet ref refer refix refund reg region reh rein reis reit reject rel reland relay reload remain reman remark remote remove renal rename rend render renew rent rep repair repeat repen reply report resent reset resh resize resp rest result resume ret retain retan retch retry return reuse rev reve revet review reward rex rhein rho ria rial rib ric rice rich richt rick rid ridden ride ridge rie rier riff rift rig right rik rim rine ring ringer rink rio riot rip rise risk rist rit rita rite rive river rix roach road rob robe robot roc rock rocket rod rodd roe rog roger roi roit rok roke roker role rolled roller rolley roman rome ron rone rong roof rook room roon root rope ropy rosa rose ross rot rota rotate rote rottle roud rough round roup route router rove row rowing rox roy rub ruby ruck rud ruff rug rule rum run runner rupa rus rush rust rut ruta sab sad safe sage said sak sal salary sale salt sam same sample san sand sans sap sar sass sat save saved saving say scala scalar scale scaled scan scape scar scene schema scheme school schule scient scious scope score screen scribe script scroll sea seal sealed search season seat sec second secret sect sector secure seed seeing seek seen seer seg segue seid seit sele select self seller semble semi sen send sender sense sensor sept ser sera seri serial series sero sert serve server servo sess set sett setter setup seven sey sha shade shader shadow shake shall shan shape share sharp shaw shay she shed sheet shell shen sheng shi shield shift shim shin shine ship shire shirt shiv sho shock shoe shop shore short shot should show shown shu sia sib sic sid side sie sig sigma sign signal sil silent silver sim simple sin since sing single sink sip sir sis sit six size sizes skal skat sker ski skill skim skin skip sky sla slam slash sled sleep slice slick slide slider slot slow slug small smart smarty smith smooth snake snap snow soap sob soc social sock socket soe soever soft soil sol solar sold sole solid solo solute solve solver some son song sons soon sorry sort sorted sou sound source south soy spa space spam span spann spar spark spart spawn spec sped speech speed spell spent sphere spiel spill spin spire spired splice split spoken spor sport sports spot spread spring sprite spur spy square ssi stable stack staff stag stage stake stall stamp stan stance stand star start stash state static status staw stay stead steady steam steel steen stein stell stem sten step stern stick sticks sticky stid still stim stime sting stock stocks stod stof stoff stone stood stop store storm story stra stract strain strand strap stre stream street streng stress strict stride strike string strip stripe strix stroke strom strong stu stub stud studio study stuff stum sty style sub submit subset such suffix suite summer sup super sur sure surf survey sus swap sweet swift swiper switch symbol sync syntax system taa tab tabla table tables tablet tach tag tai tail tain taj take taken taking tal talk tam tan tank tap tar tara tare target task taste tat tau tax tay tea teach team tear tec tech ted tee teen teg teil tele tell tema temp temper tempo tempt ten tenant tensor tent tera teras teri term termin tern terna ternal terne test teste tested tester text tez tha thai than thane thank thanks that the their them theme then these theta they thin thing think third this tho thon thorn those though thouse thread three throw thumb thus thy tic tick ticker ticket tid tie tier tig tight til tile tim time timer times tin ting tiny tip title titre toa toast tod today toe tog toggle toi token tol tom ton tone tong too tool toon top topia topic tops tor torch tot total tou touch tour tout tower town tox toy tra trace track tract trade trag trail train trait tram tran trap trash travel tray tree trend trent tri trial trica trim trin trip tron truck true trust truth try trying tube tum tun tur turn turned tweet twig two type uang ubi uca udal udder udi udo uds ugh uji uke ula ule ull ulla uller ulling ultima ultimo ulu umber umble umbo ume ump umph umu una unable unal unami unbind unca uncate unci uncia unde unden under undo undy unie union unique unit unity unken unless unlink unlock unsafe unset untar until unto unused unwrap unze update upload upo upon upper ura ural uran urate urban urd urde urdu ure urent urf urge urgent urger uri uria urlar urn urna urnal urning uro urs ursa ursal ursus uru urus usable usage usar use used user ush usher ussels ust uster usual usun uta utas utch ute utile utter utu utum uva vai vain vair val vale vali valid vall valor value valuer van vang vara vare vari varna vary vas vast vat vault veal vector veda vedic vee veen veer vei veil vela vell velo velte vend vendor vent venter venue venus vera verb verd verify verity vern versal verse versed verst vert vertex very vest vester vet via vic vice video vie vier view viewer vill villa ville vim vina vince vine vino viol vip vira viral viron virus vis visa vise vision visit visor vista visual vita vive vod voet vog voice void vol vole volent volt volume vote vum waar wab wad wadi wag wagon wah wain wait waka wake wale wali walk walker wall wallet wan wand wander wandle wane wang want wany wap war ward warden ware warf warm warn warp wart was wash washed washer wat watch water wave wax way wayne ways weak wealth weapon wear web wed wee weekly ween weep weet wei weka well welt wem wen wend went`.split(` `));function Y(e,t){return e?`${e}_${t}`:t}async function Ie(e,t){if(!e||typeof e!=`string`)throw Error(`input must be a non-empty string`);let n=Fe.parse(t??{}),r=n.words??8;if(!globalThis.crypto?.subtle)throw Error(`idAgent.from() requires Web Crypto API (crypto.subtle). Use HTTPS in browsers.`);let i=new TextEncoder,a=i.encode(n.namespace??`id-agent`),o=await globalThis.crypto.subtle.importKey(`raw`,a,{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),s=await globalThis.crypto.subtle.sign(`HMAC`,o,i.encode(e)),c=new DataView(s),l=Array(r);for(let e=0;e<r;e++)l[e]=J[c.getUint16(e*2)%4096];return Y(n.prefix,l.join(`-`))}function Le(){let e=(e=>{let t=Pe.parse(e??{}),n=Ne(t.words??8,J);return Y(t.prefix,n.join(`-`))});return e.from=(e,t)=>Ie(e,t),e}var Re=Le();Math.log2(J.length),new Set(J);var X={test:`t`,suite:`s`,hook:`h`,observation:`obs`,run:`r`};function Z(e){return Re({prefix:e,words:10})}function Q(){return Z(X.test)}function ze(){return Z(X.suite)}function Be(){return Z(X.hook)}var $=[{name:`Linear`,slug:`linear`},{name:`Vercel`,slug:`vercel`},{name:`Notion`,slug:`notion`},{name:`Stripe`,slug:`stripe`},{name:`GitHub`,slug:`github`},{name:`Slack`,slug:`slack`},{name:`Figma`,slug:`figma`},{name:`Shopify`,slug:`shopify`},{name:`Datadog`,slug:`datadog`},{name:`Supabase`,slug:`supabase`}];$.map(e=>e.name),$.map(e=>e.slug);function Ve(e){let t=String(e),n=0;for(let e=0;e<t.length;e+=1)n=n*31+t.charCodeAt(e)>>>0;return n}function He(e){return $[Ve(e)%$.length]}function Ue(e){return He(e).slug}export{u as a,Ue as i,ze as n,Q as r,Be as t};
@@ -1 +1 @@
1
- import{Qn as e,Ut as t}from"./index-Bvtm2F6f.js";var n=e();function r({icon:e,title:r,description:i,actionLabel:a,onAction:o}){return(0,n.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[50vh] p-8`,children:[(0,n.jsx)(`div`,{className:`rounded-full bg-muted p-4 mb-4`,children:(0,n.jsx)(e,{className:`h-8 w-8 text-muted-foreground`})}),(0,n.jsx)(`h3`,{className:`text-lg font-semibold mb-1`,children:r}),(0,n.jsx)(`p`,{className:`text-muted-foreground text-center mb-6 max-w-sm`,children:i}),a&&o&&(0,n.jsx)(t,{onClick:o,children:a})]})}export{r as t};
1
+ import{Qn as e,Ut as t}from"./index-B4FdO6Vk.js";var n=e();function r({icon:e,title:r,description:i,actionLabel:a,onAction:o}){return(0,n.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[50vh] p-8`,children:[(0,n.jsx)(`div`,{className:`rounded-full bg-muted p-4 mb-4`,children:(0,n.jsx)(e,{className:`h-8 w-8 text-muted-foreground`})}),(0,n.jsx)(`h3`,{className:`text-lg font-semibold mb-1`,children:r}),(0,n.jsx)(`p`,{className:`text-muted-foreground text-center mb-6 max-w-sm`,children:i}),a&&o&&(0,n.jsx)(t,{onClick:o,children:a})]})}export{r as t};
@@ -1 +1 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
1
+ import{Jn as e}from"./index-B4FdO6Vk.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
@@ -1 +1 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};
1
+ import{Jn as e}from"./index-B4FdO6Vk.js";var t=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{t};
@@ -1 +1 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]);export{t};
1
+ import{Jn as e}from"./index-B4FdO6Vk.js";var t=e(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]);export{t};
@@ -1 +1 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]);export{t};
1
+ import{Jn as e}from"./index-B4FdO6Vk.js";var t=e(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{d as t,f as n,i as r,n as i,o as a,r as o,t as s,u as c}from"./tab-console-BQFkZJG_.js";import{i as ee,n as l,o as u,s as d,t as te,u as ne}from"./select-CeVjgiKI.js";import{C as f,c as re,i as p,n as m,r as h,w as g}from"./id-badge-NwZYoNfB.js";import{r as ie}from"./monaco-editor-DNT0Mzki.js";import{t as _}from"./circle-x-yPIxYoz1.js";import{t as ae}from"./copy-Clw3wvSn.js";import{t as v}from"./eye-CZrufbYE.js";import{t as oe}from"./file-search-DHHwYVza.js";import{c as se}from"./split-button-DcY8ames.js";import{t as y}from"./refresh-cw-C_0AkMuu.js";import{t as ce}from"./square-D71GHEET.js";import{a as b}from"./dist-m_OM4Je_.js";import{t as x}from"./scroll-area-CnATfQoe.js";import{t as S}from"./switch-ByV5GV5L.js";import{i as C,n as le,r as ue,t as de}from"./tabs-DrB_Acb3.js";import{B as w,Fn as fe,Gn as pe,H as T,Ht as E,Jn as me,Nn as he,Pn as D,Qn as O,Rn as ge,Un as _e,Ut as k,Vt as A,W as j,Wn as ve,Wt as M,bt as N,er as ye,or as be,pr as P,qt as xe,tr as F,zn as I}from"./index-Bvtm2F6f.js";import{t as L}from"./badge-DrW2vGVJ.js";import{n as Se,r as Ce,t as we}from"./resizable-BGEcNRZO.js";import{t as R}from"./empty-state-BTvOA5lp.js";import{t as z}from"./display-step-NqsJgW_B.js";var B=me(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Te=me(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),V=e(P(),1);function H(e){function t(e){if(h(e)){e.flow=!1;for(let n of e.items)t(n.value)}if(p(e)){e.flow=!1;for(let n of e.items)t(n)}}t(e.contents)}function Ee(e){function t(e){return h(e)?(e.items=e.items.filter(e=>!t(e.value)),e.items.length===0):!1}t(e.contents)}var De=[`name`,`test-id`,`target`,`use`,`meta`,`context`,`steps`];function Oe(e){function t(e,n){if(h(e)){n?e.items.sort((e,t)=>{let n=De.indexOf(String(e.key)),r=De.indexOf(String(t.key));return(n===-1?De.length:n)-(r===-1?De.length:r)}):e.items.sort((e,t)=>String(e.key).localeCompare(String(t.key)));for(let n of e.items)t(n.value,!1)}}t(e.contents,!0)}function ke(e){return Ee(e),H(e),Oe(e),e.toString()}function Ae(e){let t=(0,V.useRef)(null),{doc:n,error:r}=(0,V.useMemo)(()=>{if(!e)return{doc:null,error:null};try{let n=m(e);return t.current=n,{doc:n,error:null}}catch(e){return{doc:t.current,error:e instanceof Error?e.message:`Invalid YAML`}}},[e]);return{doc:n,error:r,getIn:(0,V.useCallback)(e=>{if(n)return n.getIn(e)},[n]),setIn:(0,V.useCallback)((t,n)=>{let r=m(e);return r.setIn(t,n),ke(r)},[e]),deleteIn:(0,V.useCallback)(t=>{let n=m(e);return n.deleteIn(t),ke(n)},[e])}}var U=O(),je=[{value:`chromium`,label:`Chromium`},{value:`firefox`,label:`Firefox`},{value:`webkit`,label:`WebKit`}];function W(e){return e==null?``:`${e} (inherited)`}function Me(e){return e===!0?`(inherited: on)`:e===!1?`(inherited: off)`:`(inherited)`}function G(e){return e===`preserve`?`Preserve app data (inherited)`:e===`reset`?`Reset app data (inherited)`:`Select app state`}function Ne({content:e,onChange:t,selectedTarget:n,showMeta:r=!0}){let{getIn:i,setIn:a,deleteIn:o}=Ae(e);function s(e,n){t(n===``||n==null?o(e):a(e,n))}function c(e,n,r){t(n===(r??!1)?o(e):a(e,n))}let{targets:ne,globalUse:f}=re(),p=n?ne[n]?.platform:void 0,m=p===`android`||p===`ios`,h=i([`use`,`browser`,`name`]),g=i([`use`,`browser`,`headless`]),ie=i([`use`,`browser`,`viewport`,`width`]),_=i([`use`,`browser`,`viewport`,`height`]),ae=i([`use`,`timeout`,`step`]),v=i([`use`,`timeout`,`test`]),oe=i([`use`,`timeout`,`navigation`]),se=i([`use`,`healing`,`maxAttempts`]),y=i([`use`,`planner`,`maxSubActions`]),ce=i([`use`,`planner`,`previousStepCount`]),x=i([`use`,`logCapture`,`console`]),C=i([`use`,`logCapture`,`network`]),le=i([`use`,`llm`]),ue=i([`use`,`parallel`]),de=i([`use`,`device`]),w=i([`use`,`mobile`,`appState`]),fe=i([`meta`,`retries`]),pe=i([`meta`,`record`]),T=f?.browser?.headless,me=f?.logCapture?.console,he=f?.logCapture?.network,D=f?.parallel,O=f?.mobile?.appState,ge=r?`Select a device for this mobile test.`:`Select a device for this mobile suite.`;function _e(e){t(e===O?o([`use`,`mobile`,`appState`]):a([`use`,`mobile`,`appState`],e))}return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-1 opacity-50`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Not applicable to mobile targets`})]}),(0,U.jsx)(A,{})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Engine`}),(0,U.jsxs)(te,{value:h??``,onValueChange:e=>s([`use`,`browser`,`name`],e||void 0),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:W(f?.browser?.name??`chromium`)})}),(0,U.jsx)(l,{children:je.map(e=>(0,U.jsx)(ee,{value:e.value,children:e.label},e.value))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Headless `,g===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(T)})]}),(0,U.jsx)(S,{checked:g??T??!0,onCheckedChange:e=>c([`use`,`browser`,`headless`],e,T)})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport W`}),(0,U.jsx)(E,{type:`number`,value:ie??``,onChange:e=>s([`use`,`browser`,`viewport`,`width`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.width??1280),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport H`}),(0,U.jsx)(E,{type:`number`,value:_??``,onChange:e=>s([`use`,`browser`,`viewport`,`height`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.height??720),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{})]}),m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Mobile`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Device`}),(0,U.jsx)(E,{value:de??``,onChange:e=>s([`use`,`device`],e.target.value||void 0),placeholder:ge,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`App state`}),(0,U.jsxs)(te,{value:w??``,onValueChange:e=>_e(e),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:G(O)})}),(0,U.jsxs)(l,{children:[(0,U.jsx)(ee,{value:`preserve`,children:`Preserve app data`}),(0,U.jsx)(ee,{value:`reset`,children:`Reset app data`})]})]})]})]}),(0,U.jsx)(A,{})]}):null,(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Timeouts`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Step`}),(0,U.jsx)(E,{value:ae??``,onChange:e=>s([`use`,`timeout`,`step`],e.target.value||void 0),placeholder:W(f?.timeout?.step??`30s`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Test`}),(0,U.jsx)(E,{value:v??``,onChange:e=>s([`use`,`timeout`,`test`],e.target.value||void 0),placeholder:W(f?.timeout?.test??`5m`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Navigation`}),(0,U.jsx)(E,{value:oe??``,onChange:e=>s([`use`,`timeout`,`navigation`],e.target.value||void 0),placeholder:W(f?.timeout?.navigation??`15s`),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Agent`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Heal Attempts`}),(0,U.jsx)(E,{type:`number`,min:0,value:se??``,onChange:e=>s([`use`,`healing`,`maxAttempts`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.healing?.maxAttempts??3),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Sub-Actions`}),(0,U.jsx)(E,{type:`number`,min:1,value:y??``,onChange:e=>s([`use`,`planner`,`maxSubActions`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.maxSubActions??5),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Prev Steps`}),(0,U.jsx)(E,{type:`number`,min:0,value:ce??``,onChange:e=>s([`use`,`planner`,`previousStepCount`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.previousStepCount??3),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Log Capture`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Console `,x===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(me)})]}),(0,U.jsx)(S,{checked:x??me??!1,onCheckedChange:e=>c([`use`,`logCapture`,`console`],e,me)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Network `,C===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(he)})]}),(0,U.jsx)(S,{checked:C??he??!1,onCheckedChange:e=>c([`use`,`logCapture`,`network`],e,he)})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`LLM`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`LLM Config`}),(0,U.jsx)(E,{value:le??``,onChange:e=>s([`use`,`llm`],e.target.value||void 0),placeholder:W(f?.llm??`default`),className:`h-7 text-xs`})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Execution`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Parallel `,ue===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(D)})]}),(0,U.jsx)(S,{checked:ue??D??!1,onCheckedChange:e=>c([`use`,`parallel`],e,D)})]}),r&&(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Retries`}),(0,U.jsx)(E,{type:`number`,min:0,value:fe??``,onChange:e=>s([`meta`,`retries`],e.target.value?Number(e.target.value):void 0),placeholder:`0 (inherited)`,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Record `,pe===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(inherited: off)`})]}),(0,U.jsx)(`div`,{className:`flex items-center h-7`,children:(0,U.jsx)(S,{checked:pe??!1,onCheckedChange:e=>c([`meta`,`record`],e,!1)})})]})]})]})]})}function Pe({runId:e,onClose:n}){let[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(`connecting`),[s,c]=(0,V.useState)(),[ee,l]=(0,V.useState)(0),u=(0,V.useRef)(null);if((0,V.useEffect)(()=>{if(!e)return;let t=!1;i([]),o(`connecting`),c(void 0),l(0);let n=Date.now();u.current=setInterval(()=>{t||l(Date.now()-n)},200);let r=N(e,{onRunStart:()=>{t||o(`running`)},onStepStart:e=>{t||(o(`running`),i(t=>[...t,{name:e.stepName,status:`running`}]))},onStepComplete:e=>{t||i(t=>{let n=!1;return t.map(t=>n||t.name!==e.stepName||t.status!==`running`?t:(n=!0,{...t,status:be(e.status),duration:e.duration,error:e.error??void 0}))})},onRunComplete:e=>{if(t)return;let n=F(e.status);c(n.normalized),o(n.normalized===`passed`?`complete`:`error`),i(t=>t.map(t=>t.status===`running`?{...t,status:ye(e.status)}:t)),u.current&&clearInterval(u.current)},onRunError:e=>{t||(o(`error`),i(t=>[...t,{name:`Run Error`,status:`failed`,error:e.error}]),u.current&&clearInterval(u.current))}});return()=>{t=!0,u.current&&clearInterval(u.current),r.close()}},[e]),!e)return null;let d=s?F(s):null,te=a===`connecting`?`Connecting...`:a===`running`?`Running`:d?.label??(a===`complete`?`Passed`:`Failed`);return(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a===`running`||a===`connecting`?(0,U.jsx)(g,{className:`size-4 text-primary`}):d?.normalized===`passed`||a===`complete`?(0,U.jsx)(_e,{className:`size-4 text-emerald-500`}):d?.normalized===`cancelled`?(0,U.jsx)(ce,{className:`size-4 text-muted-foreground`}):d?.normalized===`flaky`||d?.normalized===`healed`?(0,U.jsx)(y,{className:`size-4 text-amber-500`}):(0,U.jsx)(_,{className:`size-4 text-red-500`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:te}),(a===`running`||a===`connecting`)&&(0,U.jsxs)(L,{variant:`outline`,className:`text-xs gap-1`,children:[(0,U.jsx)(t,{className:`size-3`}),xe(ee)]})]}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-xs`,onClick:n,children:(0,U.jsx)(he,{className:`size-3.5`})})]}),(0,U.jsx)(x,{className:`flex-1 [&>[data-slot=scroll-area-viewport]>div]:!block`,children:(0,U.jsxs)(`div`,{className:`p-3 space-y-1.5`,children:[r.map((e,t)=>(0,U.jsxs)(`div`,{className:M(`relative overflow-hidden flex items-start gap-2 rounded-md border px-3 py-2 text-sm`,e.status===`running`&&`live-running-surface border-border/60 bg-primary/5`,e.status===`passed`&&`border-emerald-500/20 bg-emerald-500/5`,e.status===`failed`&&`border-destructive/20 bg-destructive/5`,e.status===`cancelled`&&`border-border/60 bg-muted/30`,e.status===`flaky`&&`border-amber-500/20 bg-amber-500/5`,e.status!==`running`&&e.status!==`passed`&&e.status!==`failed`&&e.status!==`cancelled`&&e.status!==`flaky`&&`border-border/60 bg-card/40`),children:[e.status===`running`?(0,U.jsx)(g,{className:`size-3.5 mt-0.5 shrink-0 text-primary`}):e.status===`passed`||e.status===`completed`?(0,U.jsx)(_e,{className:`size-3.5 mt-0.5 text-emerald-500 shrink-0`}):e.status===`cancelled`?(0,U.jsx)(ce,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}):e.status===`flaky`?(0,U.jsx)(y,{className:`size-3.5 mt-0.5 text-amber-500 shrink-0`}):(0,U.jsx)(_,{className:`size-3.5 mt-0.5 text-red-500 shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 min-w-0 break-words`,children:e.name}),e.duration!==void 0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:xe(e.duration)})]},`${e.name}-${t}`)),r.length===0&&a===`connecting`&&(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Waiting for events...`})]})})]})}function Fe({ariaTree:e,onRefresh:t,isExecuting:n}){return e?(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-end px-3 py-1 border-b border-border/50`,children:t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,"aria-label":`Refresh ARIA tree`,children:[(0,U.jsx)(y,{className:`size-3`}),`Refresh`]})}),(0,U.jsx)(x,{className:`flex-1`,children:(0,U.jsx)(`pre`,{className:`font-mono text-xs p-3 whitespace-pre-wrap`,children:e})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:`Run a step or click Fetch to capture the accessibility tree`}),t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1.5 text-xs px-2.5 py-1 rounded border border-border hover:bg-muted transition-colors disabled:opacity-50`,children:[(0,U.jsx)(y,{className:`size-3`}),`Fetch`]})]})}function K(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:e.phaseDurations?.observe??null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:e.phaseDurations?.plan??null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:e.phaseDurations?.execute??null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),e.verifierReasoning&&t.push({key:`verifier`,label:`Verifier`,icon:c,content:e.verifierReasoning,duration:e.phaseDurations?.verify??null}),t}function Ie(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}function Le({step:e,subAction:t}){if(t){let e=K(t);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Sub-action #`,t.index+1]}),(0,U.jsx)(`span`,{className:`text-xs font-medium ${t.result===`success`?`text-emerald-500`:`text-red-500`}`,children:t.result}),t.confidence!=null&&(0,U.jsx)(a,{confidence:t.confidence})]}),(0,U.jsx)(r,{mode:`static`,sections:e}),t.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:t.error})]})}let n=Ie(e);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Step #`,e.stepOrder+1]}),e.confidence!=null&&(0,U.jsx)(a,{confidence:e.confidence})]}),n.length>0?(0,U.jsx)(r,{mode:`static`,sections:n}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No reasoning data yet.`}),e.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:e.error})]})}function Re({screenshot:e,connectionState:t,onReconnect:n}){return(0,U.jsx)(`div`,{className:`relative flex h-full w-full items-center justify-center overflow-hidden bg-background`,children:e?(0,U.jsx)(`img`,{src:e,alt:`Browser preview`,className:`max-w-full max-h-full object-contain`}):t===`connecting`||t===`connected`&&!e?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(I,{className:`h-6 w-6 animate-spin`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Connecting to browser...`})]}):t===`disconnected`||t===`error`?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(Te,{className:`h-6 w-6`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Browser disconnected`}),n&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:n,children:`Reconnect`})]}):null})}var ze={idle:{label:`Ready`,tone:`bg-muted-foreground/35`},connecting:{label:`Connecting`,tone:`bg-primary animate-pulse`},connected:{label:`Connected`,tone:`bg-emerald-500`},executing:{label:`Executing`,tone:`bg-primary animate-pulse`},disconnected:{label:`Disconnected`,tone:`bg-amber-500`},error:{label:`Error`,tone:`bg-destructive`}};function Be(e){switch(e){case`invalid`:return{label:`Draft invalid`,className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`};case`saved`:return{label:`Saved draft`,className:`border-border/70 bg-background text-muted-foreground`};default:return{label:`Using unsaved draft`,className:`border-primary/25 bg-primary/10 text-primary`}}}function Ve(e,t){let n=e.trim();if(!n)return``;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return n;if(n.startsWith(`/`))try{return new URL(n,t??`https://example.com`).toString()}catch{return n}return/^[\w.-]+(?::\d+)?(?:[/?#]|$)/.test(n)?`https://${n}`:n}function He({hook:e}){return e.status===`passed`?(0,U.jsxs)(L,{className:`border-emerald-500/20 bg-emerald-500/15 text-emerald-500`,children:[(0,U.jsx)(_e,{className:`size-3`}),`Passed`]}):e.status===`failed`?(0,U.jsxs)(L,{variant:`destructive`,children:[(0,U.jsx)(fe,{className:`size-3`}),`Failed`]}):e.status===`running`?(0,U.jsxs)(L,{className:`border-primary/20 bg-primary/15 text-primary`,children:[(0,U.jsx)(I,{className:`size-3 animate-spin`}),`Running`]}):(0,U.jsx)(L,{variant:`outline`,children:`Pending`})}function Ue({hook:e}){return!e.variables||Object.keys(e.variables).length===0?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`This hook did not emit any variables`}):(0,U.jsx)(`div`,{className:`space-y-2 p-4`,children:Object.entries(e.variables).map(([e,t])=>(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e}),(0,U.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all font-mono text-xs`,children:t})]},e))})}function We({hook:e}){return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(D,{className:`size-4 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,U.jsx)(L,{variant:`outline`,className:`font-mono text-[10px]`,children:e.id}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:e.phase}),(0,U.jsx)(He,{hook:e}),e.duration!=null&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),e.stdout&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stdout`}),(0,U.jsx)(`pre`,{className:`rounded-md border bg-background/80 p-3 text-xs whitespace-pre-wrap break-all`,children:e.stdout})]}),e.stderr&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stderr`}),(0,U.jsx)(`pre`,{className:`rounded-md border border-destructive/20 bg-destructive/5 p-3 text-xs whitespace-pre-wrap break-all text-destructive`,children:e.stderr})]}),e.variables&&Object.keys(e.variables).length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Emitted Variables`}),(0,U.jsx)(Ue,{hook:e})]}),!e.stdout&&!e.stderr&&(!e.variables||Object.keys(e.variables).length===0)&&!e.error&&(0,U.jsx)(R,{icon:D,title:`No hook output yet`,description:`Connect a live session, run a teardown hook, or end the current session to capture hook output.`})]})}function Ge(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.status!==`idle`||n.phases.length>0||n.executionHistory.length>0||n.consoleLogs.length>0||n.networkLogs.length>0)return n}return null}function Ke(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:return`border-destructive/20 bg-destructive/10 text-destructive`;case`cancelled`:return`border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400`;default:return`border-border/70 bg-background text-muted-foreground`}}function qe(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:case`healed`:case`flaky`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:case`cancelled`:case`skipped`:return`border-destructive/20 bg-destructive/10 text-destructive`;default:return`border-border/70 bg-background text-muted-foreground`}}function Je({test:e,selectedStep:t,subAction:n}){let r=e.liveSteps.map(e=>z(e,e.stepIndex));return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.path})]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,Ke(e.status)),children:e.status}),typeof e.duration==`number`&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Setup Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestSetupHooks.length>0?e.perTestSetupHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test setup hooks`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Teardown Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestTeardownHooks.length>0?e.perTestTeardownHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test teardown hooks`})]})]}),r.length>0?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Steps`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>{let r=t?.id===e.id,i=e.subActionsData??[];return(0,U.jsxs)(`div`,{className:M(`overflow-hidden rounded-md border bg-background/80`,r&&`border-primary/30 ring-1 ring-primary/20`),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[(0,U.jsxs)(`span`,{className:`shrink-0 text-sm font-medium`,children:[`Step #`,e.stepOrder+1]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,qe(e.status)),children:e.status}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.name}),e.duration>0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),i.length>0?(0,U.jsx)(`div`,{className:`divide-y divide-border/60`,children:i.map(t=>(0,U.jsx)(`div`,{className:M(r&&n?.index===t.index&&`bg-primary/5`),children:(0,U.jsx)(Le,{step:e,subAction:t})},`${e.id}-sub-${t.index}`))}):(0,U.jsx)(Le,{step:e,subAction:r?n:null})]},e.id)})})]}):(0,U.jsx)(`div`,{className:`rounded-md border border-dashed px-4 py-6 text-sm text-muted-foreground`,children:`This test has not produced any live step detail yet. Run it from the queue to inspect reasoning, console, network, and hook output.`})]})}function q({connectionState:e,isLaunching:t,targetName:n,targetLabel:r,platform:a,screenshot:c,currentUrl:ee,pendingNavigation:l,steps:u,setupHooks:d,teardownHooks:te,tests:re=[],selection:p,runningStepId:m,terminalState:h,draftState:g,ariaTree:_,errorMessage:v,devtoolsTab:b,canRunAll:S,isRunningAll:w,isStoppingRunAll:T,setupHooksStale:E=!1,onDevtoolsTabChange:me,onRunAll:he,onStopAll:D,onEndSession:O,onRestartSession:ge,showEndSessionAction:_e=!1,onCloseLiveMode:A,onStartFreshSession:j,onBack:N,onForward:ye,onRefresh:be,onNavigate:P,onRequestAriaTree:xe,executionUnit:F=`step`,runAllLabel:Te,stopAllLabel:H,liveSessionNumber:Ee=null,unitRowsSlot:De}){let[Oe,ke]=(0,V.useState)(!1),[Ae,je]=(0,V.useState)(``),[W,Me]=(0,V.useState)(!1),G=t?`connecting`:e,Ne=h?{label:h.reason===`ended`?`Ended`:`Disconnected`,tone:h.reason===`ended`?`bg-muted-foreground/45`:`bg-amber-500`}:ze[G],Pe=(0,V.useMemo)(()=>u.map((e,t)=>z(e,t)),[u]),K=F===`test`,Ie=!K,He=(0,V.useMemo)(()=>[...d,...te],[d,te]),Ke=(0,V.useMemo)(()=>m||(Ge(u)?.id??null),[m,u]),qe=p&&`stepId`in p?p.stepId:Ke,q=(0,V.useMemo)(()=>Pe.find(e=>e.id===qe)??null,[Pe,qe]),Ye=(0,V.useMemo)(()=>p?.type!==`subaction`||!q?null:q.subActionsData?.[p.subIndex]??null,[p,q]),Xe=(0,V.useMemo)(()=>u.find(e=>e.id===q?.id)??null,[q,u]),J=(0,V.useMemo)(()=>p?.type===`hook`?He.find(e=>e.id===p.hookId)??null:null,[p,He]),Y=(0,V.useMemo)(()=>!K||!p?null:p.type===`test`||p.type===`test-hook`?re[p.testIndex]??null:`stepId`in p?re.find(e=>e.liveSteps.some(e=>e.id===p.stepId))??null:null,[p,K,re]),Ze=(0,V.useMemo)(()=>!K||p?.type!==`suite-hook`?null:(p.phase===`setup`?d:te).find(e=>e.id===p.hookId)??null,[p,d,K,te]),Qe=(0,V.useMemo)(()=>{if(!K||p?.type!==`test-hook`)return null;let e=re[p.testIndex];return e?(p.phase===`setup`?e.perTestSetupHooks:e.perTestTeardownHooks).find(e=>e.id===p.hookId)??null:null},[p,K,re]),X=(0,V.useMemo)(()=>{if(!K||!Y)return null;if(p&&`stepId`in p){let e=Y.liveSteps.find(e=>e.id===p.stepId);if(e)return e}if(Y.runningStepIndex!==null){let e=Y.liveSteps.find(e=>e.stepIndex===Y.runningStepIndex);if(e)return e}return Ge(Y.liveSteps)},[p,Y,K]),Z=(0,V.useMemo)(()=>X?z(X,X.stepIndex):null,[X]),$e=(0,V.useMemo)(()=>p?.type!==`subaction`||!Z?null:Z.subActionsData?.[p.subIndex]??null,[p,Z]),et=(0,V.useMemo)(()=>Y?.liveSteps.map(e=>z(e,e.stepIndex))??[],[Y]),tt=X?.executionLogs??[],nt=Xe?.executionLogs??[],Q=Be(g),$=a===`web`?ee||r||`Configured start URL`:r||(a===`android`?`Android device`:`iOS device`);(0,V.useEffect)(()=>{W||je($)},[$,W]);let rt=(0,V.useMemo)(()=>{if(K){let e=re.find(e=>e.status===`running`);return e?`Running ${e.name}`:null}if(!m)return null;let e=Pe.find(e=>e.id===m);return e?`Running step ${e.stepOrder+1}`:`Running current step`},[Pe,m,K,re]),it=async()=>{$&&(await navigator.clipboard.writeText($),ke(!0),window.setTimeout(()=>ke(!1),1500))},at=()=>{let e=Ve(Ae,ee);if(!e){je($);return}je(e),Me(!1),P(e)},ot=!K&&!!(p&&p.type!==`hook`&&!q);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card/30`,children:[(0,U.jsxs)(`div`,{className:`border-b px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:n||`Live Session`}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:Ne.label}),(e===`connected`||e===`executing`)&&typeof Ee==`number`&&(0,U.jsxs)(L,{variant:`outline`,"aria-live":`polite`,className:`text-[10px] tracking-wider font-medium text-muted-foreground bg-muted/50 border-border/50`,children:[`Session #`,Ee]}),rt&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:rt})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a===`web`?(0,U.jsx)(se,{className:`size-3.5 shrink-0`}):(0,U.jsx)(f,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,title:$,children:$})]}),v&&!h&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-2xl text-xs text-destructive [overflow-wrap:anywhere]`,children:v})]}),!h&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px]`,Q.className),children:Q.label}),E&&(0,U.jsx)(L,{className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`,children:`Restart required`}),Ie&&(w?(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:D,disabled:T,children:[T?(0,U.jsx)(I,{className:`size-3.5 animate-spin`}):(0,U.jsx)(ce,{className:`size-3.5`}),T?`Stopping...`:H??`Stop All Steps`]}):(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:he,disabled:!S,children:[(0,U.jsx)(ie,{className:`size-3.5`}),Te??`Run All Steps`]})),_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})]})]}),E&&!h&&(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-start justify-between gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,U.jsx)(fe,{className:`mt-0.5 size-4 shrink-0`}),(0,U.jsx)(`span`,{children:`Hook order or names changed after this live session started. Continue using the current disposable session, or restart to apply the latest setup and teardown hooks.`})]}),ge&&(0,U.jsx)(k,{type:`button`,size:`sm`,className:`shrink-0`,onClick:ge,children:`Restart Live Session`})]}),!h&&(a===`web`?(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:N,disabled:G===`executing`||G===`idle`,"aria-label":`Go back`,children:(0,U.jsx)(pe,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:ye,disabled:G===`executing`||G===`idle`,"aria-label":`Go forward`,children:(0,U.jsx)(ve,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:be,disabled:G===`executing`||G===`idle`,"aria-label":`Refresh page`,children:(0,U.jsx)(y,{className:`size-3.5`})})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 rounded-full border bg-background px-3 py-2`,children:[l?(0,U.jsx)(I,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`}):(0,U.jsx)(se,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`input`,{value:Ae,title:$,onFocus:()=>Me(!0),onBlur:()=>{Me(!1),je($)},onChange:e=>je(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),at()),e.key===`Escape`&&(e.preventDefault(),Me(!1),je($))},disabled:G===`executing`||G===`idle`,className:M(`min-w-0 flex-1 bg-transparent text-sm outline-none`,W?`text-left`:`text-center`)})]}),(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-1`,children:(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:it,disabled:!$,"aria-label":Oe?`URL copied`:`Copy URL`,title:Oe?`URL copied`:`Copy URL`,children:Oe?(0,U.jsx)(ne,{className:`size-3.5`}):(0,U.jsx)(ae,{className:`size-3.5`})})})]}):(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})}))]}),F===`test`&&De,(0,U.jsxs)(Ce,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[(0,U.jsx)(Se,{defaultSize:62,minSize:32,children:h?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-lg flex-col items-center gap-4 rounded-lg border bg-background/80 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:h.title}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:h.description})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[A&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:A,children:`Close Live Mode`}),j&&(0,U.jsx)(k,{size:`sm`,onClick:j,children:`Start Fresh Session`})]})]})}):G===`idle`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-4 rounded-lg border bg-background/70 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:`Live mode is target-scoped`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This workspace runs the current builder draft against the selected target. Sessions are disposable and draft changes only persist when you save the test.`})]})]})}):(0,U.jsx)(Re,{screenshot:c,connectionState:G})}),(0,U.jsx)(we,{withHandle:!0}),(0,U.jsx)(Se,{defaultSize:38,minSize:20,children:(0,U.jsxs)(de,{value:b,onValueChange:e=>me(e),className:`flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(ue,{variant:`line`,className:`h-9 justify-start rounded-none border-b px-3`,children:[(0,U.jsx)(C,{value:`reasoning`,className:`rounded-none text-xs`,children:`Reasoning`}),(0,U.jsx)(C,{value:`env`,className:`rounded-none text-xs`,children:`Env`}),(0,U.jsx)(C,{value:`network`,className:`rounded-none text-xs`,children:`Network`}),(0,U.jsx)(C,{value:`console`,className:`rounded-none text-xs`,children:`Console`}),(0,U.jsx)(C,{value:`aria`,className:`rounded-none text-xs`,children:`ARIA Tree`})]}),(0,U.jsx)(le,{value:`reasoning`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(x,{className:`h-full`,children:K?Ze?(0,U.jsx)(We,{hook:Ze}):Qe?(0,U.jsx)(We,{hook:Qe}):Y?(0,U.jsx)(Je,{test:Y,selectedStep:Z,subAction:$e}):(0,U.jsx)(R,{icon:oe,title:`Select a test to inspect it`,description:`Choose a test in the live queue to see its reasoning, logs, hooks, and network activity.`}):J?(0,U.jsx)(We,{hook:J}):q?(0,U.jsx)(Le,{step:q,subAction:Ye}):ot?(0,U.jsx)(R,{icon:oe,title:`Selection is no longer available`,description:`Pick another step in the builder to inspect its reasoning.`}):(0,U.jsx)(R,{icon:oe,title:`No reasoning yet`,description:`Run a step from the builder or use Run All Steps to populate the live reasoning trace.`})})}),(0,U.jsx)(le,{value:`env`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:X,executionLogs:tt})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test-owned hook or run a step to inspect variables and runJS output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:J})}):Xe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:Xe,executionLogs:nt})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect variables and runJS output`})}),(0,U.jsx)(le,{value:`network`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze||Qe?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a test step to inspect requests.`}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:Z,allSteps:et,platform:a})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect its network activity`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a step to inspect requests.`}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:q,allSteps:Pe,platform:a})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect network activity`})}),(0,U.jsx)(le,{value:`console`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:Z,allSteps:et,executionLogs:tt,isHookStep:tt.length>0})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect console output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:J})}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:q,allSteps:Pe,executionLogs:nt,isHookStep:nt.length>0})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect console output`})}),(0,U.jsx)(le,{value:`aria`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(Fe,{ariaTree:_,onRefresh:xe,isExecuting:G===`executing`})})]})})]})]})}function Ye(){return typeof window<`u`&&window.localStorage!==void 0}function Xe(){if(!Ye())return!1;try{return window.localStorage.getItem(`agent-qa:live-debug`)===`1`}catch{return!1}}function J(e,t,n){if(!Xe())return;let r=`[agent-qa live:${e}] ${t}`;if(n){console.info(r,n);return}console.info(r)}function Y(e,t){let n=typeof e==`string`?{instruction:e}:e;return{id:t?.id??n.draftId??crypto.randomUUID(),draftId:n.draftId??t?.draftId??null,instruction:n.instruction,status:t?.status??`idle`,duration:t?.duration,error:t?.error,phases:t?.phases??[],executionHistory:t?.executionHistory??[],capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[],executionGeneration:t?.executionGeneration??0}}function Ze(e,t){return{id:e.hookId,executionId:t?.executionId??null,name:e.name??t?.name??e.hookId,phase:e.phase,status:t?.status??`pending`,duration:t?.duration,stdout:t?.stdout??null,stderr:t?.stderr??null,variables:t?.variables??null,error:t?.error,createdAt:t?.createdAt}}function Qe(e,t){return{...Y({draftId:t?.draftId,instruction:e.instruction},t),id:t?.id??crypto.randomUUID(),stepIndex:e.stepIndex}}function X(e,t){let n=e.findIndex(e=>e.id===t.id);return n===-1?[...e,t]:e.map((e,r)=>r===n?{...e,...t}:e)}function Z(e,t,n){let r=e.find(e=>e.stepIndex===t.stepIndex),i={...Qe(t,r),...n};return[...r?e.map(e=>e.stepIndex===t.stepIndex?i:e):[...e,i]].sort((e,t)=>e.stepIndex-t.stepIndex)}function $e(e,t){let n=t.map(e=>({draftId:e.draftId,instruction:e.instruction}));if(e.length===n.length&&e.every((e,t)=>e.instruction===n[t].instruction&&e.draftId===n[t].draftId))return e;let r=new Map(e.filter(e=>!!e.draftId).map(e=>[e.draftId,e]));return n.map((t,n)=>Y(t,t.draftId?r.get(t.draftId):e[n]))}function et(e,t,n){if(e.length===t.length&&e.every((e,r)=>e.id===t[r]&&e.phase===n))return e;let r=new Map(e.map(e=>[e.id,e]));return t.map(e=>Ze({hookId:e,phase:n},r.get(e)))}function tt(e,t,n){return{id:n?.id??`${e.testId}:${e.path}:${t}`,draftId:e.draftId??n?.draftId??null,testId:e.testId,path:e.path,name:e.name,status:n?.status??`idle`,duration:n?.duration,error:n?.error,testExecutionId:n?.testExecutionId??null,liveSteps:n?.liveSteps??[],runningStepIndex:n?.runningStepIndex??null,perTestSetupHooks:n?.perTestSetupHooks??[],perTestTeardownHooks:n?.perTestTeardownHooks??[],lastRunAt:n?.lastRunAt}}function nt(e,t){let n=e.findIndex(e=>e.testExecutionId===t.testExecutionId);if(n!==-1)return n;let r=e.findIndex(e=>e.testId===t.testId&&e.name===t.testName);return r===-1?t.testIndex>=0&&t.testIndex<e.length?t.testIndex:-1:r}function Q(e,t,n){let r=nt(e,t);return r===-1?e:e.map((e,t)=>t===r?n(e):e)}function $(e){return e.scope===`test`}function rt(e,t={}){let n=t.steps,r=t.tests,i=t.setupHooks??[],a=t.teardownHooks??[],o=t.allowReconnect??!n,[s,c]=(0,V.useState)(`idle`),[ee,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(()=>et([],i,`setup`)),[te,ne]=(0,V.useState)(()=>et([],a,`teardown`)),[f,re]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[ie,_]=(0,V.useState)(null),[ae,v]=(0,V.useState)(null),[oe,se]=(0,V.useState)([]),[y,ce]=(0,V.useState)(`web`),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),[le,ue]=(0,V.useState)(!1),[de,w]=(0,V.useState)([]),[fe,pe]=(0,V.useState)(null),[T,E]=(0,V.useState)(!1),[me,he]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(0),ge=(0,V.useRef)(null),_e=(0,V.useRef)(null),k=(0,V.useRef)(`idle`),A=(0,V.useRef)([]),j=(0,V.useRef)(null),ve=(0,V.useRef)(!1),M=(0,V.useRef)(null),N=(0,V.useRef)(null),ye=(0,V.useRef)(!1),be=(0,V.useRef)(0),P=(0,V.useRef)(`web`),xe=(0,V.useRef)(null),F=(0,V.useRef)(!!n),I=(0,V.useRef)(null),L=(0,V.useRef)([]),Se=(0,V.useRef)(null),Ce=(0,V.useRef)(!1),we=(0,V.useRef)(null);k.current=s,A.current=ee,j.current=ae,P.current=y,F.current=!!n,L.current=de,Se.current=fe;let R=(0,V.useCallback)(()=>{_e.current&&=(clearInterval(_e.current),null)},[]),z=(0,V.useCallback)(e=>{let t=D.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),B=(0,V.useCallback)(e=>{R(),_e.current=setInterval(()=>{document.hidden||z({type:`get-screenshot`})},e)},[R,z]),Te=(0,V.useCallback)(()=>new Promise(e=>{N.current=e,setTimeout(()=>{N.current===e&&(N.current=null,e())},5e3)}),[]),H=(0,V.useCallback)(()=>{let e=xe.current;e&&(xe.current=null,l(t=>$e(t,e)))},[]),Ee=(0,V.useCallback)(e=>{D.current&&=(J(`hook`,`closing previous websocket before reconnect`,{sessionId:e}),D.current.close(),null),c(`connecting`),ve.current=!1,J(`hook`,`connecting websocket`,{sessionId:e});let t=`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}/api/live-editor/ws?sessionId=${e}`,n=new WebSocket(t);D.current=n,n.onopen=()=>{O.current=0,J(`hook`,`websocket opened`,{sessionId:e})},n.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}switch(n.type){case`session-ready`:{let t=n.platform??`web`;ce(t),P.current=t;let r=n.interactive!==!1;c(r?`connected`:`error`),_(n.error??null),J(`hook`,`session ready`,{sessionId:e,platform:t,interactive:r}),r&&B(t===`web`?1e3:2e3);break}case`hook-start`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0,createdAt:e.createdAt};if(e.owner.scope===`suite`)(e.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===e.phase&&I.current.hookId===e.hookId&&(I.current={...I.current,executionId:e.executionId});else if($(e.owner)){let n=e.owner;w(r=>Q(r,n,n=>({...n,perTestSetupHooks:e.phase===`setup`?X(n.perTestSetupHooks,t):n.perTestSetupHooks,perTestTeardownHooks:e.phase===`teardown`?X(n.perTestTeardownHooks,t):n.perTestTeardownHooks})))}break}case`hook-complete`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt};if(e.owner.scope===`suite`)(t.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===t.phase&&I.current.hookId===t.id&&(!I.current.executionId||I.current.executionId===t.executionId)&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H());else if($(e.owner)){let n=e.owner;w(e=>Q(e,n,e=>({...e,perTestSetupHooks:t.phase===`setup`?X(e.perTestSetupHooks,t):e.perTestSetupHooks,perTestTeardownHooks:t.phase===`teardown`?X(e.perTestTeardownHooks,t):e.perTestTeardownHooks})))}break}case`step-phase`:l(e=>e.map((e,t)=>t===j.current&&e.status===`running`&&e.executionGeneration===be.current?{...e,phases:[...e.phases,{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]}:e));break;case`step-complete`:{let t=n.result,r=j.current,i=t?.status===`passed`?`passed`:`failed`;l(e=>e.map((e,n)=>n===r&&e.status===`running`?{...e,status:i,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]}:e)),v(null),c(`connected`),J(`hook`,`step completed`,{sessionId:e,stepIndex:r??void 0,status:i}),B(P.current===`web`?1e3:2e3),M.current?.({status:i}),M.current=null,N.current?.(),N.current=null,H();break}case`test-start`:{let e=n.test;Se.current=e.testIndex,pe(e.testIndex),w(t=>Q(t,e,t=>({...t,status:`running`,duration:void 0,error:void 0,testExecutionId:e.testExecutionId,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]})));break}case`test-step-start`:{let e=n.step;w(t=>Q(t,e,t=>({...t,status:`running`,testExecutionId:e.testExecutionId,runningStepIndex:e.stepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,duration:void 0,error:void 0,phases:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[]})})));break}case`test-step-phase`:{let e=n.step;w(t=>Q(t,e,t=>({...t,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,phases:[...t.liveSteps.find(t=>t.stepIndex===e.stepIndex)?.phases??[],{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]})})));break}case`test-step-complete`:{let e=n.step,t=n.result;w(n=>Q(n,e,n=>({...n,runningStepIndex:n.runningStepIndex===e.stepIndex?null:n.runningStepIndex,liveSteps:Z(n.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:t?.status??`failed`,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]})})));break}case`test-step-cancelled`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`cancelled`})})));break}case`test-step-error`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`failed`,error:n.error})})));break}case`test-complete`:{let e=n.test,t=n.result,r=t?.status??`failed`,i=t?.error;if(!i&&r===`failed`&&Array.isArray(t?.stepResults)){let e=t.stepResults.find(e=>e?.status===`failed`);e?.error&&(i=`Step ${t.stepResults.indexOf(e)+1} failed: ${e.error}`)}w(n=>Q(n,e,n=>({...n,status:r,duration:t?.duration,error:i,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString(),liveSteps:Array.isArray(t?.stepResults)?t.stepResults.reduce((e,t,r)=>{let i=n.liveSteps.find(e=>e.stepIndex===r);return i?Z(e,{stepIndex:r,instruction:i.instruction},{status:t?.status??i.status,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??i.consoleLogs,networkLogs:t?.networkLogs??i.networkLogs,variableSnapshot:t?.variableSnapshot??i.variableSnapshot,originalStepName:t?.originalStepName??i.originalStepName,subActionsData:t?.subActionsData??i.subActionsData,executionLogs:t?.executionLogs??i.executionLogs}):e},n.liveSteps):n.liveSteps,perTestSetupHooks:Array.isArray(t?.setupHookExecutions)?t.setupHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestSetupHooks,perTestTeardownHooks:Array.isArray(t?.teardownHookExecutions)?t.teardownHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestTeardownHooks}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let a=we.current;we.current=null,a?.({status:r});break}case`test-error`:{let e=n.test;w(t=>Q(t,e,t=>({...t,status:`failed`,error:n.error,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString()}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let t=we.current;we.current=null,t?.({status:`failed`});break}case`step-error`:J(`hook`,`step failed`,{sessionId:e,stepIndex:j.current??void 0,error:n.error}),l(e=>e.map((e,t)=>t===j.current?e.status===`cancelling`?{...e,status:`cancelled`}:e.status===`running`?{...e,status:`failed`,error:n.error}:e:e)),v(null),c(`connected`),B(P.current===`web`?1e3:2e3),M.current?.({status:`failed`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-cancelled`:l(e=>e.map((e,t)=>t===j.current&&(e.status===`running`||e.status===`cancelling`)?{...e,status:`cancelled`}:e)),v(null),c(`connected`),J(`hook`,`step cancelled`,{sessionId:e,stepIndex:j.current??void 0}),B(P.current===`web`?1e3:2e3),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-busy`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3)),_(`Step already in progress: ${n.currentStep}`);break;case`screenshot`:re(`data:image/jpeg;base64,${n.data}`);break;case`navigate-complete`:m(n.url??null),g(null);break;case`session-state`:n.state&&`currentUrl`in n.state&&m(n.state.currentUrl??null),n.state?.interactive===!1&&(c(`error`),_(n.state.terminalError??`Live session is not ready`));break;case`device-logs`:se(e=>[...e,...n.entries]);break;case`aria-tree`:x(n.tree);break;case`session-terminated`:c(`disconnected`),g(null),I.current=null,R(),H(),J(`hook`,`session terminated by server`,{sessionId:e});break;case`error`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H()),_(n.message),J(`hook`,`server reported error`,{sessionId:e,message:n.message});break}},n.onclose=()=>{if(D.current=null,R(),ve.current){J(`hook`,`websocket closed after local termination`,{sessionId:e});return}if(J(`hook`,`websocket closed unexpectedly`,{sessionId:e,allowReconnect:o,reconnectCount:O.current}),c(`disconnected`),g(null),I.current=null,l(e=>e.map(e=>e.status===`running`||e.status===`cancelling`?{...e,status:`cancelled`}:e)),j.current=null,v(null),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H(),o&&O.current<3){let t=2**O.current*1e3;O.current++,J(`hook`,`scheduling reconnect`,{sessionId:e,delay:t,reconnectCount:O.current}),ge.current=setTimeout(()=>Ee(e),t)}},n.onerror=()=>{J(`hook`,`websocket error event`,{sessionId:e})}},[o,H,R,B]);(0,V.useEffect)(()=>{if(n){if(k.current===`executing`){xe.current=n,J(`hook`,`queued external step sync while executing`,{stepCount:n.length});return}xe.current=null,J(`hook`,`syncing external steps`,{stepCount:n.length}),l(e=>$e(e,n))}},[n]),(0,V.useEffect)(()=>{d(e=>et(e,i,`setup`))},[i]),(0,V.useEffect)(()=>{ne(e=>et(e,a,`teardown`))},[a]),(0,V.useEffect)(()=>{r&&w(e=>{let t=new Map(e.map(e=>[`${e.testId}::${e.path}`,e]));return r.map((e,n)=>tt(e,n,t.get(`${e.testId}::${e.path}`)))})},[r]),(0,V.useEffect)(()=>{if(!e){c(`idle`),l(n?$e([],n):[]),d(et([],i,`setup`)),ne(et([],a,`teardown`)),re(null),m(null),g(null),_(null),I.current=null,se([]),ce(`web`),x(null),C(!1),ue(!1),w(r?.map((e,t)=>tt(e,t))??[]),pe(null),E(!1),he(!1);return}return Ee(e),()=>{R(),ge.current&&=(clearTimeout(ge.current),null),D.current&&=(J(`hook`,`cleaning up websocket for session effect`,{sessionId:e}),D.current.close(),null)}},[R,Ee,e]),(0,V.useEffect)(()=>{s===`executing`?B(y===`web`?500:1e3):s===`connected`?B(y===`web`?1e3:2e3):R()},[s,y,B,R]),(0,V.useEffect)(()=>{let e=()=>{if(document.hidden)R();else{let e=k.current,t=P.current;e===`executing`?B(t===`web`?500:1e3):e===`connected`&&B(t===`web`?1e3:2e3)}};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[R,B]);let De=(0,V.useCallback)(e=>{if(F.current)return;let t=A.current.length;l(t=>[...t,{id:crypto.randomUUID(),draftId:null,instruction:e,status:`running`,phases:[],executionHistory:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:0}]),v(t),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:e,stepIndex:t})},[z]),Oe=(0,V.useCallback)(async(t,n)=>{let r=A.current[t];if(!r||!r.instruction.trim())return;if(j.current!==null){let e=j.current;ye.current=!0,l(t=>t.map((t,n)=>n===e&&t.status===`running`?{...t,status:`cancelling`}:t)),z({type:`cancel-step`}),await Te()}be.current++;let i=be.current;j.current=t,v(t),l(e=>e.map((e,n)=>n===t?{...e,status:`running`,phases:[],executionHistory:e.phases.length>0?[...e.executionHistory,{phases:e.phases,status:e.status,duration:e.duration,error:e.error,timestamp:new Date().toISOString()}]:e.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:e)),c(`executing`),_(null),J(`hook`,`executing step`,{sessionId:e,stepIndex:t,instruction:r.instruction,testName:n?.testName}),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:t,draft:n})},[z,e,Te]),ke=(0,V.useCallback)(async(t,n)=>{if(k.current!==`connected`){_(`Live session is busy or not ready`);return}I.current={phase:t,hookId:n},(t===`setup`?d:ne)(e=>e.map(e=>e.id===n?{...e,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0}:e)),c(`executing`),_(null),J(`hook`,`executing hook`,{sessionId:e,phase:t,hookId:n}),z({type:`execute-hook`,phase:t,hookId:n})},[z,e]),Ae=(0,V.useCallback)(()=>{F.current||l(e=>[...e,Y(``)])},[]),U=(0,V.useCallback)(e=>{F.current||l(t=>t.filter((t,n)=>n!==e))},[]),je=(0,V.useCallback)((e,t)=>{F.current||l(n=>n.map((n,r)=>r===e?{...n,instruction:t}:n))},[]),W=(0,V.useCallback)((e,t)=>{if(F.current)return;l(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r});let n=j.current;if(n!==null){let r=n;n===e?r=t:e<n&&t>=n?r=n-1:e>n&&t<=n&&(r=n+1),r!==n&&(j.current=r,v(r))}},[]),Me=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0)),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),J(`hook`,`cancelling active step`,{sessionId:e}),z({type:`cancel-step`})},[S,z,e]),G=(0,V.useCallback)(()=>{z({type:`get-screenshot`})},[z]),Ne=(0,V.useCallback)(()=>{g({action:`refresh`}),z({type:`refresh-page`})},[z]),Pe=(0,V.useCallback)(()=>{g({action:`back`}),z({type:`go-back`})},[z]),Fe=(0,V.useCallback)(()=>{g({action:`forward`}),z({type:`go-forward`})},[z]),K=(0,V.useCallback)(()=>{z({type:`get-aria-tree`})},[z]),Ie=(0,V.useCallback)(e=>{g({action:`navigate`,targetUrl:e}),z({type:`navigate`,url:e})},[z]),Le=(0,V.useCallback)((e,t)=>new Promise(n=>{M.current=n;let r=A.current[e];if(!r||!r.instruction.trim()){M.current=null,n({status:`skipped`});return}be.current++;let i=be.current;j.current=e,v(e),l(t=>t.map((t,n)=>n===e?{...t,status:`running`,phases:[],executionHistory:t.phases.length>0?[...t.executionHistory,{phases:t.phases,status:t.status,duration:t.duration,error:t.error,timestamp:new Date().toISOString()}]:t.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:t)),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:e,draft:t})}),[z]),Re=(0,V.useCallback)(async t=>{if(S)return;ye.current=!1;let n=A.current.length;C(!0),ue(!1),J(`hook`,`running all steps`,{sessionId:e,stepCount:n});try{for(let e=0;e<n&&!ye.current;e++){if(!A.current[e].instruction.trim())continue;let n=await Le(e,t);if(n.status===`failed`||n.status===`cancelled`)break}}finally{ye.current=!1,C(!1),ue(!1)}},[Le,S,e]),ze=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),j.current!==null&&z({type:`cancel-step`}))},[S,z]),Be=(0,V.useCallback)((e,t)=>new Promise(n=>{we.current=n;let r=L.current[e];if(!r){we.current=null,n({status:`skipped`});return}let i=crypto.randomUUID();Se.current=e,pe(e),w(t=>t.map((t,n)=>n===e?{...t,status:`running`,duration:void 0,error:void 0,testExecutionId:i,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]}:t)),c(`executing`),_(null),z({type:`execute-test`,testExecutionId:i,testId:r.testId,path:r.path,testIndex:e,draft:t})}),[z]),Ve=(0,V.useCallback)(async(e,t)=>{L.current[e]&&await Be(e,t)},[Be]),He=(0,V.useCallback)(async e=>{if(T)return;Ce.current=!1;let t=L.current.length;E(!0),he(!1);try{for(let n=0;n<t&&!Ce.current;n++){let t=await Be(n,e);if(t.status===`failed`||t.status===`cancelled`)break}}finally{Ce.current=!1,E(!1),he(!1)}},[Be,T]),Ue=(0,V.useCallback)(()=>{T&&(Ce.current=!0,he(!0),Se.current!==null&&z({type:`cancel-step`}))},[T,z]);return{connectionState:s,steps:ee,setupHooks:u,teardownHooks:te,screenshot:f,currentUrl:p,pendingNavigation:h,error:ie,executeStep:De,executeStepByIndex:Oe,executeHookById:ke,cancelStep:Me,requestScreenshot:G,refreshPage:Ne,goBack:Pe,goForward:Fe,navigate:Ie,runAll:Re,cancelRunAll:ze,terminateSession:(0,V.useCallback)(()=>{ye.current=!0,C(!1),ue(!1),ve.current=!0,J(`hook`,`terminating session`,{sessionId:e}),z({type:`terminate-session`})},[z,e]),addStep:Ae,removeStep:U,updateStepInstruction:je,reorderSteps:W,runningStepIndex:ae,runningStepId:ae===null?null:ee[ae]?.id??null,sessionId:e,isTerminated:ve.current,deviceLogs:oe,platform:y,ariaTree:b,requestAriaTree:K,isRunningAll:S,isStoppingRunAll:le,tests:de,executeTestByIndex:Ve,runAllTests:He,cancelRunAllTests:Ue,runningTestIndex:fe,isRunningAllTests:T,isStoppingRunAllTests:me}}function it(e){try{let t=m(e);if(t.errors.length>0)return{};let n=t.toJSON(),r=n?.use?.mobile?.appState;return{headless:n?.use?.browser?.headless,device:typeof n?.use?.device==`string`?n.use.device:void 0,appState:r===`preserve`||r===`reset`?r:void 0}}catch{return{}}}function at(e){let t=e.targets[e.targetName];if(!t)throw Error(`Selected target "${e.targetName}" was not found in workspace config`);let n=it(e.content),r=n.headless??e.globalUse?.browser?.headless;if(t.platform===`web`){if(!t.url)throw Error(`Selected web target "${e.targetName}" is missing a URL`);return{platform:`web`,url:t.url,headless:r}}return{platform:t.platform,targetName:e.targetName,useDeviceName:n.device,appState:n.appState??e.globalUse?.mobile?.appState,bundleId:t.bundleId,appPackage:t.appPackage,appActivity:t.appActivity,headless:r}}var ot=[{namespace:`runJS`,name:`document.title`,label:`Page title`},{namespace:`runJS`,name:`Date.now()`,label:`Current timestamp`},{namespace:`runJS`,name:`window.location.href`,label:`Current URL`},{namespace:`runJS`,name:`document.querySelector('...').textContent`,label:`Extract element text`}];function st(e){let[t,n]=(0,V.useState)([]),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let t=!1;c(!0);let r=[T().then(e=>{t||n(e.keys)}).catch(()=>{t||n([])}),j().then(e=>{t||i(e.hooks.map(e=>({id:e.id,name:e.name})))}).catch(()=>{t||i([])})];return e&&r.push(w(e).then(e=>{t||o(e.names)}).catch(()=>{t||o([])})),Promise.allSettled(r).then(()=>{t||c(!1)}),()=>{t=!0}},[e]),{suggestions:(0,V.useMemo)(()=>{let e=[];for(let n of t)e.push({namespace:`env`,name:n,label:`env`});for(let t of r)e.push({namespace:`runHook`,name:t.name,label:`hook`,insertValue:t.id,description:t.id});for(let t of a)e.push({namespace:`capture`,name:t,label:`captured`});return e.push(...ot),e},[t,r,a]),isLoading:s}}var ct=/^[a-zA-Z0-9._-]+$/,lt=/\.(yaml|yml)$/;function ut(e){return e.trim().replace(/\\/g,`/`).replace(/^\.\//,``)}function dt(e){let t=ut(e).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replace(/\*\*\//g,`__DIRSTAR__`).replace(/\*\*/g,`__DIRSTAR__`).replace(/\*/g,`[^/]*`).replace(/__DIRSTAR__/g,`(?:.*/)?`);return RegExp(`^${t}$`)}function ft(e,t){let n=ut(e);return t.some(e=>dt(e).test(n))}function pt(e){let t=e.trim();if(!t)return`Filename is required`;if(t.includes(`..`))return`Path must not contain '..' segments`;if(t.startsWith(`/`))return`Path must be relative, not absolute`;let n=t.split(`/`);for(let e of n){if(!e)return`Path contains empty segment (double slash)`;if(!ct.test(e))return`Path must contain only letters, numbers, hyphens, dots, underscores, and forward slashes, ending with .yaml or .yml`}let r=n[n.length-1];return lt.test(r)?null:`File must end with .yaml or .yml`}function mt(e,t,n){let r=pt(e);if(r)return r;let i=(t??[]).map(e=>e.trim()).filter(Boolean);return i.length===0?`workspace.${n} must contain at least one pattern`:ft(e.trim(),i)?null:`File path must match one of your workspace's ${n} patterns (${i.join(`, `)})`}export{J as a,Ne as c,rt as i,st as n,q as o,at as r,Pe as s,mt as t};
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{d as t,f as n,i as r,n as i,o as a,r as o,t as s,u as c}from"./tab-console-BORDNFzI.js";import{i as ee,n as l,o as u,s as d,t as te,u as ne}from"./select-D5oFJNaq.js";import{C as f,c as re,i as p,n as m,r as h,w as g}from"./id-badge-BmmZdbHv.js";import{r as ie}from"./monaco-editor-DF4W-NC-.js";import{t as _}from"./circle-x-B7AOkLOS.js";import{t as ae}from"./copy-CEZJVgtu.js";import{t as v}from"./eye-YQHiLgt4.js";import{t as oe}from"./file-search-LR6NeRNh.js";import{c as se}from"./split-button-wGcE-JDx.js";import{t as y}from"./refresh-cw-RAow1kax.js";import{t as ce}from"./square-CgFZz_zK.js";import{a as b}from"./dist-wK15YRiu.js";import{t as x}from"./scroll-area-BmkJ1y7Q.js";import{t as S}from"./switch-CPd0R3ri.js";import{i as C,n as le,r as ue,t as de}from"./tabs-DzjvuMEX.js";import{B as w,Fn as fe,Gn as pe,H as T,Ht as E,Jn as me,Nn as he,Pn as D,Qn as O,Rn as ge,Un as _e,Ut as k,Vt as A,W as j,Wn as ve,Wt as M,bt as N,er as ye,or as be,pr as P,qt as xe,tr as F,zn as I}from"./index-B4FdO6Vk.js";import{t as L}from"./badge-CC1v3nk4.js";import{n as Se,r as Ce,t as we}from"./resizable-B2X6KlcC.js";import{t as R}from"./empty-state-BfgY0UGA.js";import{t as z}from"./display-step-CO4k5dQA.js";var B=me(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Te=me(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),V=e(P(),1);function H(e){function t(e){if(h(e)){e.flow=!1;for(let n of e.items)t(n.value)}if(p(e)){e.flow=!1;for(let n of e.items)t(n)}}t(e.contents)}function Ee(e){function t(e){return h(e)?(e.items=e.items.filter(e=>!t(e.value)),e.items.length===0):!1}t(e.contents)}var De=[`name`,`test-id`,`target`,`use`,`meta`,`context`,`steps`];function Oe(e){function t(e,n){if(h(e)){n?e.items.sort((e,t)=>{let n=De.indexOf(String(e.key)),r=De.indexOf(String(t.key));return(n===-1?De.length:n)-(r===-1?De.length:r)}):e.items.sort((e,t)=>String(e.key).localeCompare(String(t.key)));for(let n of e.items)t(n.value,!1)}}t(e.contents,!0)}function ke(e){return Ee(e),H(e),Oe(e),e.toString()}function Ae(e){let t=(0,V.useRef)(null),{doc:n,error:r}=(0,V.useMemo)(()=>{if(!e)return{doc:null,error:null};try{let n=m(e);return t.current=n,{doc:n,error:null}}catch(e){return{doc:t.current,error:e instanceof Error?e.message:`Invalid YAML`}}},[e]);return{doc:n,error:r,getIn:(0,V.useCallback)(e=>{if(n)return n.getIn(e)},[n]),setIn:(0,V.useCallback)((t,n)=>{let r=m(e);return r.setIn(t,n),ke(r)},[e]),deleteIn:(0,V.useCallback)(t=>{let n=m(e);return n.deleteIn(t),ke(n)},[e])}}var U=O(),je=[{value:`chromium`,label:`Chromium`},{value:`firefox`,label:`Firefox`},{value:`webkit`,label:`WebKit`}];function W(e){return e==null?``:`${e} (inherited)`}function Me(e){return e===!0?`(inherited: on)`:e===!1?`(inherited: off)`:`(inherited)`}function G(e){return e===`preserve`?`Preserve app data (inherited)`:e===`reset`?`Reset app data (inherited)`:`Select app state`}function Ne({content:e,onChange:t,selectedTarget:n,showMeta:r=!0}){let{getIn:i,setIn:a,deleteIn:o}=Ae(e);function s(e,n){t(n===``||n==null?o(e):a(e,n))}function c(e,n,r){t(n===(r??!1)?o(e):a(e,n))}let{targets:ne,globalUse:f}=re(),p=n?ne[n]?.platform:void 0,m=p===`android`||p===`ios`,h=i([`use`,`browser`,`name`]),g=i([`use`,`browser`,`headless`]),ie=i([`use`,`browser`,`viewport`,`width`]),_=i([`use`,`browser`,`viewport`,`height`]),ae=i([`use`,`timeout`,`step`]),v=i([`use`,`timeout`,`test`]),oe=i([`use`,`timeout`,`navigation`]),se=i([`use`,`healing`,`maxAttempts`]),y=i([`use`,`planner`,`maxSubActions`]),ce=i([`use`,`planner`,`previousStepCount`]),x=i([`use`,`logCapture`,`console`]),C=i([`use`,`logCapture`,`network`]),le=i([`use`,`llm`]),ue=i([`use`,`parallel`]),de=i([`use`,`device`]),w=i([`use`,`mobile`,`appState`]),fe=i([`meta`,`retries`]),pe=i([`meta`,`record`]),T=f?.browser?.headless,me=f?.logCapture?.console,he=f?.logCapture?.network,D=f?.parallel,O=f?.mobile?.appState,ge=r?`Select a device for this mobile test.`:`Select a device for this mobile suite.`;function _e(e){t(e===O?o([`use`,`mobile`,`appState`]):a([`use`,`mobile`,`appState`],e))}return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-1 opacity-50`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Not applicable to mobile targets`})]}),(0,U.jsx)(A,{})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Browser`}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Engine`}),(0,U.jsxs)(te,{value:h??``,onValueChange:e=>s([`use`,`browser`,`name`],e||void 0),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:W(f?.browser?.name??`chromium`)})}),(0,U.jsx)(l,{children:je.map(e=>(0,U.jsx)(ee,{value:e.value,children:e.label},e.value))})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Headless `,g===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(T)})]}),(0,U.jsx)(S,{checked:g??T??!0,onCheckedChange:e=>c([`use`,`browser`,`headless`],e,T)})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport W`}),(0,U.jsx)(E,{type:`number`,value:ie??``,onChange:e=>s([`use`,`browser`,`viewport`,`width`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.width??1280),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Viewport H`}),(0,U.jsx)(E,{type:`number`,value:_??``,onChange:e=>s([`use`,`browser`,`viewport`,`height`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.browser?.viewport?.height??720),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{})]}),m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Mobile`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Device`}),(0,U.jsx)(E,{value:de??``,onChange:e=>s([`use`,`device`],e.target.value||void 0),placeholder:ge,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`App state`}),(0,U.jsxs)(te,{value:w??``,onValueChange:e=>_e(e),children:[(0,U.jsx)(u,{className:`w-full h-7 text-xs`,children:(0,U.jsx)(d,{placeholder:G(O)})}),(0,U.jsxs)(l,{children:[(0,U.jsx)(ee,{value:`preserve`,children:`Preserve app data`}),(0,U.jsx)(ee,{value:`reset`,children:`Reset app data`})]})]})]})]}),(0,U.jsx)(A,{})]}):null,(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Timeouts`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Step`}),(0,U.jsx)(E,{value:ae??``,onChange:e=>s([`use`,`timeout`,`step`],e.target.value||void 0),placeholder:W(f?.timeout?.step??`30s`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Test`}),(0,U.jsx)(E,{value:v??``,onChange:e=>s([`use`,`timeout`,`test`],e.target.value||void 0),placeholder:W(f?.timeout?.test??`5m`),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Navigation`}),(0,U.jsx)(E,{value:oe??``,onChange:e=>s([`use`,`timeout`,`navigation`],e.target.value||void 0),placeholder:W(f?.timeout?.navigation??`15s`),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Agent`}),(0,U.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Heal Attempts`}),(0,U.jsx)(E,{type:`number`,min:0,value:se??``,onChange:e=>s([`use`,`healing`,`maxAttempts`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.healing?.maxAttempts??3),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Sub-Actions`}),(0,U.jsx)(E,{type:`number`,min:1,value:y??``,onChange:e=>s([`use`,`planner`,`maxSubActions`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.maxSubActions??5),className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Prev Steps`}),(0,U.jsx)(E,{type:`number`,min:0,value:ce??``,onChange:e=>s([`use`,`planner`,`previousStepCount`],e.target.value?Number(e.target.value):void 0),placeholder:W(f?.planner?.previousStepCount??3),className:`h-7 text-xs`})]})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Log Capture`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Console `,x===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(me)})]}),(0,U.jsx)(S,{checked:x??me??!1,onCheckedChange:e=>c([`use`,`logCapture`,`console`],e,me)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Network `,C===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(he)})]}),(0,U.jsx)(S,{checked:C??he??!1,onCheckedChange:e=>c([`use`,`logCapture`,`network`],e,he)})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`LLM`}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`LLM Config`}),(0,U.jsx)(E,{value:le??``,onChange:e=>s([`use`,`llm`],e.target.value||void 0),placeholder:W(f?.llm??`default`),className:`h-7 text-xs`})]})]}),(0,U.jsx)(A,{}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Execution`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Parallel `,ue===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:Me(D)})]}),(0,U.jsx)(S,{checked:ue??D??!1,onCheckedChange:e=>c([`use`,`parallel`],e,D)})]}),r&&(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(b,{className:`text-[11px] text-muted-foreground`,children:`Retries`}),(0,U.jsx)(E,{type:`number`,min:0,value:fe??``,onChange:e=>s([`meta`,`retries`],e.target.value?Number(e.target.value):void 0),placeholder:`0 (inherited)`,className:`h-7 text-xs`})]}),(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsxs)(b,{className:`text-[11px] text-muted-foreground`,children:[`Record `,pe===void 0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`(inherited: off)`})]}),(0,U.jsx)(`div`,{className:`flex items-center h-7`,children:(0,U.jsx)(S,{checked:pe??!1,onCheckedChange:e=>c([`meta`,`record`],e,!1)})})]})]})]})]})}function Pe({runId:e,onClose:n}){let[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(`connecting`),[s,c]=(0,V.useState)(),[ee,l]=(0,V.useState)(0),u=(0,V.useRef)(null);if((0,V.useEffect)(()=>{if(!e)return;let t=!1;i([]),o(`connecting`),c(void 0),l(0);let n=Date.now();u.current=setInterval(()=>{t||l(Date.now()-n)},200);let r=N(e,{onRunStart:()=>{t||o(`running`)},onStepStart:e=>{t||(o(`running`),i(t=>[...t,{name:e.stepName,status:`running`}]))},onStepComplete:e=>{t||i(t=>{let n=!1;return t.map(t=>n||t.name!==e.stepName||t.status!==`running`?t:(n=!0,{...t,status:be(e.status),duration:e.duration,error:e.error??void 0}))})},onRunComplete:e=>{if(t)return;let n=F(e.status);c(n.normalized),o(n.normalized===`passed`?`complete`:`error`),i(t=>t.map(t=>t.status===`running`?{...t,status:ye(e.status)}:t)),u.current&&clearInterval(u.current)},onRunError:e=>{t||(o(`error`),i(t=>[...t,{name:`Run Error`,status:`failed`,error:e.error}]),u.current&&clearInterval(u.current))}});return()=>{t=!0,u.current&&clearInterval(u.current),r.close()}},[e]),!e)return null;let d=s?F(s):null,te=a===`connecting`?`Connecting...`:a===`running`?`Running`:d?.label??(a===`complete`?`Passed`:`Failed`);return(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a===`running`||a===`connecting`?(0,U.jsx)(g,{className:`size-4 text-primary`}):d?.normalized===`passed`||a===`complete`?(0,U.jsx)(_e,{className:`size-4 text-emerald-500`}):d?.normalized===`cancelled`?(0,U.jsx)(ce,{className:`size-4 text-muted-foreground`}):d?.normalized===`flaky`||d?.normalized===`healed`?(0,U.jsx)(y,{className:`size-4 text-amber-500`}):(0,U.jsx)(_,{className:`size-4 text-red-500`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:te}),(a===`running`||a===`connecting`)&&(0,U.jsxs)(L,{variant:`outline`,className:`text-xs gap-1`,children:[(0,U.jsx)(t,{className:`size-3`}),xe(ee)]})]}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-xs`,onClick:n,children:(0,U.jsx)(he,{className:`size-3.5`})})]}),(0,U.jsx)(x,{className:`flex-1 [&>[data-slot=scroll-area-viewport]>div]:!block`,children:(0,U.jsxs)(`div`,{className:`p-3 space-y-1.5`,children:[r.map((e,t)=>(0,U.jsxs)(`div`,{className:M(`relative overflow-hidden flex items-start gap-2 rounded-md border px-3 py-2 text-sm`,e.status===`running`&&`live-running-surface border-border/60 bg-primary/5`,e.status===`passed`&&`border-emerald-500/20 bg-emerald-500/5`,e.status===`failed`&&`border-destructive/20 bg-destructive/5`,e.status===`cancelled`&&`border-border/60 bg-muted/30`,e.status===`flaky`&&`border-amber-500/20 bg-amber-500/5`,e.status!==`running`&&e.status!==`passed`&&e.status!==`failed`&&e.status!==`cancelled`&&e.status!==`flaky`&&`border-border/60 bg-card/40`),children:[e.status===`running`?(0,U.jsx)(g,{className:`size-3.5 mt-0.5 shrink-0 text-primary`}):e.status===`passed`||e.status===`completed`?(0,U.jsx)(_e,{className:`size-3.5 mt-0.5 text-emerald-500 shrink-0`}):e.status===`cancelled`?(0,U.jsx)(ce,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}):e.status===`flaky`?(0,U.jsx)(y,{className:`size-3.5 mt-0.5 text-amber-500 shrink-0`}):(0,U.jsx)(_,{className:`size-3.5 mt-0.5 text-red-500 shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 min-w-0 break-words`,children:e.name}),e.duration!==void 0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:xe(e.duration)})]},`${e.name}-${t}`)),r.length===0&&a===`connecting`&&(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground text-center py-8`,children:`Waiting for events...`})]})})]})}function Fe({ariaTree:e,onRefresh:t,isExecuting:n}){return e?(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-end px-3 py-1 border-b border-border/50`,children:t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,"aria-label":`Refresh ARIA tree`,children:[(0,U.jsx)(y,{className:`size-3`}),`Refresh`]})}),(0,U.jsx)(x,{className:`flex-1`,children:(0,U.jsx)(`pre`,{className:`font-mono text-xs p-3 whitespace-pre-wrap`,children:e})})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-sm text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:`Run a step or click Fetch to capture the accessibility tree`}),t&&(0,U.jsxs)(`button`,{type:`button`,onClick:t,disabled:n,className:`flex items-center gap-1.5 text-xs px-2.5 py-1 rounded border border-border hover:bg-muted transition-colors disabled:opacity-50`,children:[(0,U.jsx)(y,{className:`size-3`}),`Fetch`]})]})}function K(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:e.phaseDurations?.observe??null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:e.phaseDurations?.plan??null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:e.phaseDurations?.execute??null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),e.verifierReasoning&&t.push({key:`verifier`,label:`Verifier`,icon:c,content:e.verifierReasoning,duration:e.phaseDurations?.verify??null}),t}function Ie(e){let t=[];return e.observation&&t.push({key:`observation`,label:`Observation`,icon:v,content:e.observation,duration:null}),e.reasoning&&t.push({key:`reasoning`,label:`Reasoning`,icon:n,content:e.reasoning,duration:null}),e.plannedAction!=null&&t.push({key:`plannedAction`,label:`Planned Action`,icon:ge,content:null,duration:null,children:(0,U.jsx)(`pre`,{className:`max-w-full min-w-0 text-[10px] font-mono bg-muted/30 rounded-sm p-2 overflow-x-auto whitespace-pre-wrap break-words`,children:typeof e.plannedAction==`string`?e.plannedAction:JSON.stringify(e.plannedAction,null,2)})}),t}function Le({step:e,subAction:t}){if(t){let e=K(t);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Sub-action #`,t.index+1]}),(0,U.jsx)(`span`,{className:`text-xs font-medium ${t.result===`success`?`text-emerald-500`:`text-red-500`}`,children:t.result}),t.confidence!=null&&(0,U.jsx)(a,{confidence:t.confidence})]}),(0,U.jsx)(r,{mode:`static`,sections:e}),t.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:t.error})]})}let n=Ie(e);return(0,U.jsxs)(`div`,{className:`p-3 space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[`Step #`,e.stepOrder+1]}),e.confidence!=null&&(0,U.jsx)(a,{confidence:e.confidence})]}),n.length>0?(0,U.jsx)(r,{mode:`static`,sections:n}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No reasoning data yet.`}),e.error&&(0,U.jsx)(`div`,{className:`bg-destructive/10 text-destructive rounded-sm p-2 text-xs break-words [overflow-wrap:anywhere]`,children:e.error})]})}function Re({screenshot:e,connectionState:t,onReconnect:n}){return(0,U.jsx)(`div`,{className:`relative flex h-full w-full items-center justify-center overflow-hidden bg-background`,children:e?(0,U.jsx)(`img`,{src:e,alt:`Browser preview`,className:`max-w-full max-h-full object-contain`}):t===`connecting`||t===`connected`&&!e?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(I,{className:`h-6 w-6 animate-spin`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Connecting to browser...`})]}):t===`disconnected`||t===`error`?(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,U.jsx)(Te,{className:`h-6 w-6`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Browser disconnected`}),n&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:n,children:`Reconnect`})]}):null})}var ze={idle:{label:`Ready`,tone:`bg-muted-foreground/35`},connecting:{label:`Connecting`,tone:`bg-primary animate-pulse`},connected:{label:`Connected`,tone:`bg-emerald-500`},executing:{label:`Executing`,tone:`bg-primary animate-pulse`},disconnected:{label:`Disconnected`,tone:`bg-amber-500`},error:{label:`Error`,tone:`bg-destructive`}};function Be(e){switch(e){case`invalid`:return{label:`Draft invalid`,className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`};case`saved`:return{label:`Saved draft`,className:`border-border/70 bg-background text-muted-foreground`};default:return{label:`Using unsaved draft`,className:`border-primary/25 bg-primary/10 text-primary`}}}function Ve(e,t){let n=e.trim();if(!n)return``;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n))return n;if(n.startsWith(`/`))try{return new URL(n,t??`https://example.com`).toString()}catch{return n}return/^[\w.-]+(?::\d+)?(?:[/?#]|$)/.test(n)?`https://${n}`:n}function He({hook:e}){return e.status===`passed`?(0,U.jsxs)(L,{className:`border-emerald-500/20 bg-emerald-500/15 text-emerald-500`,children:[(0,U.jsx)(_e,{className:`size-3`}),`Passed`]}):e.status===`failed`?(0,U.jsxs)(L,{variant:`destructive`,children:[(0,U.jsx)(fe,{className:`size-3`}),`Failed`]}):e.status===`running`?(0,U.jsxs)(L,{className:`border-primary/20 bg-primary/15 text-primary`,children:[(0,U.jsx)(I,{className:`size-3 animate-spin`}),`Running`]}):(0,U.jsx)(L,{variant:`outline`,children:`Pending`})}function Ue({hook:e}){return!e.variables||Object.keys(e.variables).length===0?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`This hook did not emit any variables`}):(0,U.jsx)(`div`,{className:`space-y-2 p-4`,children:Object.entries(e.variables).map(([e,t])=>(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e}),(0,U.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all font-mono text-xs`,children:t})]},e))})}function We({hook:e}){return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(D,{className:`size-4 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,U.jsx)(L,{variant:`outline`,className:`font-mono text-[10px]`,children:e.id}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:e.phase}),(0,U.jsx)(He,{hook:e}),e.duration!=null&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),e.stdout&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stdout`}),(0,U.jsx)(`pre`,{className:`rounded-md border bg-background/80 p-3 text-xs whitespace-pre-wrap break-all`,children:e.stdout})]}),e.stderr&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`stderr`}),(0,U.jsx)(`pre`,{className:`rounded-md border border-destructive/20 bg-destructive/5 p-3 text-xs whitespace-pre-wrap break-all text-destructive`,children:e.stderr})]}),e.variables&&Object.keys(e.variables).length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Emitted Variables`}),(0,U.jsx)(Ue,{hook:e})]}),!e.stdout&&!e.stderr&&(!e.variables||Object.keys(e.variables).length===0)&&!e.error&&(0,U.jsx)(R,{icon:D,title:`No hook output yet`,description:`Connect a live session, run a teardown hook, or end the current session to capture hook output.`})]})}function Ge(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.status!==`idle`||n.phases.length>0||n.executionHistory.length>0||n.consoleLogs.length>0||n.networkLogs.length>0)return n}return null}function Ke(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:return`border-destructive/20 bg-destructive/10 text-destructive`;case`cancelled`:return`border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400`;default:return`border-border/70 bg-background text-muted-foreground`}}function qe(e){switch(e){case`running`:return`border-primary/20 bg-primary/10 text-primary`;case`passed`:case`healed`:case`flaky`:return`border-emerald-500/20 bg-emerald-500/10 text-emerald-500`;case`failed`:case`cancelled`:case`skipped`:return`border-destructive/20 bg-destructive/10 text-destructive`;default:return`border-border/70 bg-background text-muted-foreground`}}function Je({test:e,selectedStep:t,subAction:n}){let r=e.liveSteps.map(e=>z(e,e.stepIndex));return(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.path})]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,Ke(e.status)),children:e.status}),typeof e.duration==`number`&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),e.error&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-full rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-sm text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Setup Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestSetupHooks.length>0?e.perTestSetupHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test setup hooks`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/80 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Teardown Hooks`}),(0,U.jsx)(`div`,{className:`mt-2 text-sm`,children:e.perTestTeardownHooks.length>0?e.perTestTeardownHooks.map(e=>`${e.name} (${e.status})`).join(`, `):`No per-test teardown hooks`})]})]}),r.length>0?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Steps`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>{let r=t?.id===e.id,i=e.subActionsData??[];return(0,U.jsxs)(`div`,{className:M(`overflow-hidden rounded-md border bg-background/80`,r&&`border-primary/30 ring-1 ring-primary/20`),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2`,children:[(0,U.jsxs)(`span`,{className:`shrink-0 text-sm font-medium`,children:[`Step #`,e.stepOrder+1]}),(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px] uppercase tracking-wide`,qe(e.status)),children:e.status}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.name}),e.duration>0&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.duration<1e3?`${e.duration}ms`:`${(e.duration/1e3).toFixed(1)}s`})]}),i.length>0?(0,U.jsx)(`div`,{className:`divide-y divide-border/60`,children:i.map(t=>(0,U.jsx)(`div`,{className:M(r&&n?.index===t.index&&`bg-primary/5`),children:(0,U.jsx)(Le,{step:e,subAction:t})},`${e.id}-sub-${t.index}`))}):(0,U.jsx)(Le,{step:e,subAction:r?n:null})]},e.id)})})]}):(0,U.jsx)(`div`,{className:`rounded-md border border-dashed px-4 py-6 text-sm text-muted-foreground`,children:`This test has not produced any live step detail yet. Run it from the queue to inspect reasoning, console, network, and hook output.`})]})}function q({connectionState:e,isLaunching:t,targetName:n,targetLabel:r,platform:a,screenshot:c,currentUrl:ee,pendingNavigation:l,steps:u,setupHooks:d,teardownHooks:te,tests:re=[],selection:p,runningStepId:m,terminalState:h,draftState:g,ariaTree:_,errorMessage:v,devtoolsTab:b,canRunAll:S,isRunningAll:w,isStoppingRunAll:T,setupHooksStale:E=!1,onDevtoolsTabChange:me,onRunAll:he,onStopAll:D,onEndSession:O,onRestartSession:ge,showEndSessionAction:_e=!1,onCloseLiveMode:A,onStartFreshSession:j,onBack:N,onForward:ye,onRefresh:be,onNavigate:P,onRequestAriaTree:xe,executionUnit:F=`step`,runAllLabel:Te,stopAllLabel:H,liveSessionNumber:Ee=null,unitRowsSlot:De}){let[Oe,ke]=(0,V.useState)(!1),[Ae,je]=(0,V.useState)(``),[W,Me]=(0,V.useState)(!1),G=t?`connecting`:e,Ne=h?{label:h.reason===`ended`?`Ended`:`Disconnected`,tone:h.reason===`ended`?`bg-muted-foreground/45`:`bg-amber-500`}:ze[G],Pe=(0,V.useMemo)(()=>u.map((e,t)=>z(e,t)),[u]),K=F===`test`,Ie=!K,He=(0,V.useMemo)(()=>[...d,...te],[d,te]),Ke=(0,V.useMemo)(()=>m||(Ge(u)?.id??null),[m,u]),qe=p&&`stepId`in p?p.stepId:Ke,q=(0,V.useMemo)(()=>Pe.find(e=>e.id===qe)??null,[Pe,qe]),Ye=(0,V.useMemo)(()=>p?.type!==`subaction`||!q?null:q.subActionsData?.[p.subIndex]??null,[p,q]),Xe=(0,V.useMemo)(()=>u.find(e=>e.id===q?.id)??null,[q,u]),J=(0,V.useMemo)(()=>p?.type===`hook`?He.find(e=>e.id===p.hookId)??null:null,[p,He]),Y=(0,V.useMemo)(()=>!K||!p?null:p.type===`test`||p.type===`test-hook`?re[p.testIndex]??null:`stepId`in p?re.find(e=>e.liveSteps.some(e=>e.id===p.stepId))??null:null,[p,K,re]),Ze=(0,V.useMemo)(()=>!K||p?.type!==`suite-hook`?null:(p.phase===`setup`?d:te).find(e=>e.id===p.hookId)??null,[p,d,K,te]),Qe=(0,V.useMemo)(()=>{if(!K||p?.type!==`test-hook`)return null;let e=re[p.testIndex];return e?(p.phase===`setup`?e.perTestSetupHooks:e.perTestTeardownHooks).find(e=>e.id===p.hookId)??null:null},[p,K,re]),X=(0,V.useMemo)(()=>{if(!K||!Y)return null;if(p&&`stepId`in p){let e=Y.liveSteps.find(e=>e.id===p.stepId);if(e)return e}if(Y.runningStepIndex!==null){let e=Y.liveSteps.find(e=>e.stepIndex===Y.runningStepIndex);if(e)return e}return Ge(Y.liveSteps)},[p,Y,K]),Z=(0,V.useMemo)(()=>X?z(X,X.stepIndex):null,[X]),$e=(0,V.useMemo)(()=>p?.type!==`subaction`||!Z?null:Z.subActionsData?.[p.subIndex]??null,[p,Z]),et=(0,V.useMemo)(()=>Y?.liveSteps.map(e=>z(e,e.stepIndex))??[],[Y]),tt=X?.executionLogs??[],nt=Xe?.executionLogs??[],Q=Be(g),$=a===`web`?ee||r||`Configured start URL`:r||(a===`android`?`Android device`:`iOS device`);(0,V.useEffect)(()=>{W||je($)},[$,W]);let rt=(0,V.useMemo)(()=>{if(K){let e=re.find(e=>e.status===`running`);return e?`Running ${e.name}`:null}if(!m)return null;let e=Pe.find(e=>e.id===m);return e?`Running step ${e.stepOrder+1}`:`Running current step`},[Pe,m,K,re]),it=async()=>{$&&(await navigator.clipboard.writeText($),ke(!0),window.setTimeout(()=>ke(!1),1500))},at=()=>{let e=Ve(Ae,ee);if(!e){je($);return}je(e),Me(!1),P(e)},ot=!K&&!!(p&&p.type!==`hook`&&!q);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card/30`,children:[(0,U.jsxs)(`div`,{className:`border-b px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:n||`Live Session`}),(0,U.jsx)(L,{variant:`outline`,className:`text-[10px] uppercase tracking-wide`,children:Ne.label}),(e===`connected`||e===`executing`)&&typeof Ee==`number`&&(0,U.jsxs)(L,{variant:`outline`,"aria-live":`polite`,className:`text-[10px] tracking-wider font-medium text-muted-foreground bg-muted/50 border-border/50`,children:[`Session #`,Ee]}),rt&&(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:rt})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a===`web`?(0,U.jsx)(se,{className:`size-3.5 shrink-0`}):(0,U.jsx)(f,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,title:$,children:$})]}),v&&!h&&(0,U.jsx)(`div`,{className:`min-w-0 max-w-2xl text-xs text-destructive [overflow-wrap:anywhere]`,children:v})]}),!h&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(L,{variant:`outline`,className:M(`text-[10px]`,Q.className),children:Q.label}),E&&(0,U.jsx)(L,{className:`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`,children:`Restart required`}),Ie&&(w?(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:D,disabled:T,children:[T?(0,U.jsx)(I,{className:`size-3.5 animate-spin`}):(0,U.jsx)(ce,{className:`size-3.5`}),T?`Stopping...`:H??`Stop All Steps`]}):(0,U.jsxs)(k,{variant:`outline`,size:`sm`,onClick:he,disabled:!S,children:[(0,U.jsx)(ie,{className:`size-3.5`}),Te??`Run All Steps`]})),_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})]})]}),E&&!h&&(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-start justify-between gap-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:[(0,U.jsx)(fe,{className:`mt-0.5 size-4 shrink-0`}),(0,U.jsx)(`span`,{children:`Hook order or names changed after this live session started. Continue using the current disposable session, or restart to apply the latest setup and teardown hooks.`})]}),ge&&(0,U.jsx)(k,{type:`button`,size:`sm`,className:`shrink-0`,onClick:ge,children:`Restart Live Session`})]}),!h&&(a===`web`?(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:N,disabled:G===`executing`||G===`idle`,"aria-label":`Go back`,children:(0,U.jsx)(pe,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:ye,disabled:G===`executing`||G===`idle`,"aria-label":`Go forward`,children:(0,U.jsx)(ve,{className:`size-3.5`})}),(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:be,disabled:G===`executing`||G===`idle`,"aria-label":`Refresh page`,children:(0,U.jsx)(y,{className:`size-3.5`})})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 rounded-full border bg-background px-3 py-2`,children:[l?(0,U.jsx)(I,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`}):(0,U.jsx)(se,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`input`,{value:Ae,title:$,onFocus:()=>Me(!0),onBlur:()=>{Me(!1),je($)},onChange:e=>je(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),at()),e.key===`Escape`&&(e.preventDefault(),Me(!1),je($))},disabled:G===`executing`||G===`idle`,className:M(`min-w-0 flex-1 bg-transparent text-sm outline-none`,W?`text-left`:`text-center`)})]}),(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-1`,children:(0,U.jsx)(k,{variant:`ghost`,size:`icon-sm`,onClick:it,disabled:!$,"aria-label":Oe?`URL copied`:`Copy URL`,title:Oe?`URL copied`:`Copy URL`,children:Oe?(0,U.jsx)(ne,{className:`size-3.5`}):(0,U.jsx)(ae,{className:`size-3.5`})})})]}):(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:_e&&(0,U.jsxs)(k,{variant:`destructive`,size:`sm`,onClick:O,children:[(0,U.jsx)(ce,{className:`size-3.5`}),`End Live Session`]})}))]}),F===`test`&&De,(0,U.jsxs)(Ce,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[(0,U.jsx)(Se,{defaultSize:62,minSize:32,children:h?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-lg flex-col items-center gap-4 rounded-lg border bg-background/80 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:h.title}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:h.description})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[A&&(0,U.jsx)(k,{variant:`outline`,size:`sm`,onClick:A,children:`Close Live Mode`}),j&&(0,U.jsx)(k,{size:`sm`,onClick:j,children:`Start Fresh Session`})]})]})}):G===`idle`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 py-8`,children:(0,U.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-4 rounded-lg border bg-background/70 px-6 py-8 text-center`,children:[(0,U.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,U.jsx)(B,{className:`size-6 text-muted-foreground`})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:`Live mode is target-scoped`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This workspace runs the current builder draft against the selected target. Sessions are disposable and draft changes only persist when you save the test.`})]})]})}):(0,U.jsx)(Re,{screenshot:c,connectionState:G})}),(0,U.jsx)(we,{withHandle:!0}),(0,U.jsx)(Se,{defaultSize:38,minSize:20,children:(0,U.jsxs)(de,{value:b,onValueChange:e=>me(e),className:`flex h-full min-h-0 flex-col`,children:[(0,U.jsxs)(ue,{variant:`line`,className:`h-9 justify-start rounded-none border-b px-3`,children:[(0,U.jsx)(C,{value:`reasoning`,className:`rounded-none text-xs`,children:`Reasoning`}),(0,U.jsx)(C,{value:`env`,className:`rounded-none text-xs`,children:`Env`}),(0,U.jsx)(C,{value:`network`,className:`rounded-none text-xs`,children:`Network`}),(0,U.jsx)(C,{value:`console`,className:`rounded-none text-xs`,children:`Console`}),(0,U.jsx)(C,{value:`aria`,className:`rounded-none text-xs`,children:`ARIA Tree`})]}),(0,U.jsx)(le,{value:`reasoning`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(x,{className:`h-full`,children:K?Ze?(0,U.jsx)(We,{hook:Ze}):Qe?(0,U.jsx)(We,{hook:Qe}):Y?(0,U.jsx)(Je,{test:Y,selectedStep:Z,subAction:$e}):(0,U.jsx)(R,{icon:oe,title:`Select a test to inspect it`,description:`Choose a test in the live queue to see its reasoning, logs, hooks, and network activity.`}):J?(0,U.jsx)(We,{hook:J}):q?(0,U.jsx)(Le,{step:q,subAction:Ye}):ot?(0,U.jsx)(R,{icon:oe,title:`Selection is no longer available`,description:`Pick another step in the builder to inspect its reasoning.`}):(0,U.jsx)(R,{icon:oe,title:`No reasoning yet`,description:`Run a step from the builder or use Run All Steps to populate the live reasoning trace.`})})}),(0,U.jsx)(le,{value:`env`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:X,executionLogs:tt})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test-owned hook or run a step to inspect variables and runJS output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(Ue,{hook:J})}):Xe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(o,{step:Xe,executionLogs:nt})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect variables and runJS output`})}),(0,U.jsx)(le,{value:`network`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze||Qe?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a test step to inspect requests.`}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:Z,allSteps:et,platform:a})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect its network activity`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-sm text-muted-foreground`,children:`Hooks do not capture browser network activity. Select a step to inspect requests.`}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(i,{step:q,allSteps:Pe,platform:a})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect network activity`})}),(0,U.jsx)(le,{value:`console`,className:`m-0 flex-1 overflow-hidden`,children:K?Ze?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Ze})}):Qe?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:Qe})}):X?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:Z,allSteps:et,executionLogs:tt,isHookStep:tt.length>0})}):Y?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Run this test to inspect console output`}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a test to inspect it`}):J?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(We,{hook:J})}):q?(0,U.jsx)(x,{className:`h-full`,children:(0,U.jsx)(s,{step:q,allSteps:Pe,executionLogs:nt,isHookStep:nt.length>0})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Select a step to inspect console output`})}),(0,U.jsx)(le,{value:`aria`,className:`m-0 flex-1 overflow-hidden`,children:(0,U.jsx)(Fe,{ariaTree:_,onRefresh:xe,isExecuting:G===`executing`})})]})})]})]})}function Ye(){return typeof window<`u`&&window.localStorage!==void 0}function Xe(){if(!Ye())return!1;try{return window.localStorage.getItem(`agent-qa:live-debug`)===`1`}catch{return!1}}function J(e,t,n){if(!Xe())return;let r=`[agent-qa live:${e}] ${t}`;if(n){console.info(r,n);return}console.info(r)}function Y(e,t){let n=typeof e==`string`?{instruction:e}:e;return{id:t?.id??n.draftId??crypto.randomUUID(),draftId:n.draftId??t?.draftId??null,instruction:n.instruction,status:t?.status??`idle`,duration:t?.duration,error:t?.error,phases:t?.phases??[],executionHistory:t?.executionHistory??[],capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[],executionGeneration:t?.executionGeneration??0}}function Ze(e,t){return{id:e.hookId,executionId:t?.executionId??null,name:e.name??t?.name??e.hookId,phase:e.phase,status:t?.status??`pending`,duration:t?.duration,stdout:t?.stdout??null,stderr:t?.stderr??null,variables:t?.variables??null,error:t?.error,createdAt:t?.createdAt}}function Qe(e,t){return{...Y({draftId:t?.draftId,instruction:e.instruction},t),id:t?.id??crypto.randomUUID(),stepIndex:e.stepIndex}}function X(e,t){let n=e.findIndex(e=>e.id===t.id);return n===-1?[...e,t]:e.map((e,r)=>r===n?{...e,...t}:e)}function Z(e,t,n){let r=e.find(e=>e.stepIndex===t.stepIndex),i={...Qe(t,r),...n};return[...r?e.map(e=>e.stepIndex===t.stepIndex?i:e):[...e,i]].sort((e,t)=>e.stepIndex-t.stepIndex)}function $e(e,t){let n=t.map(e=>({draftId:e.draftId,instruction:e.instruction}));if(e.length===n.length&&e.every((e,t)=>e.instruction===n[t].instruction&&e.draftId===n[t].draftId))return e;let r=new Map(e.filter(e=>!!e.draftId).map(e=>[e.draftId,e]));return n.map((t,n)=>Y(t,t.draftId?r.get(t.draftId):e[n]))}function et(e,t,n){if(e.length===t.length&&e.every((e,r)=>e.id===t[r]&&e.phase===n))return e;let r=new Map(e.map(e=>[e.id,e]));return t.map(e=>Ze({hookId:e,phase:n},r.get(e)))}function tt(e,t,n){return{id:n?.id??`${e.testId}:${e.path}:${t}`,draftId:e.draftId??n?.draftId??null,testId:e.testId,path:e.path,name:e.name,status:n?.status??`idle`,duration:n?.duration,error:n?.error,testExecutionId:n?.testExecutionId??null,liveSteps:n?.liveSteps??[],runningStepIndex:n?.runningStepIndex??null,perTestSetupHooks:n?.perTestSetupHooks??[],perTestTeardownHooks:n?.perTestTeardownHooks??[],lastRunAt:n?.lastRunAt}}function nt(e,t){let n=e.findIndex(e=>e.testExecutionId===t.testExecutionId);if(n!==-1)return n;let r=e.findIndex(e=>e.testId===t.testId&&e.name===t.testName);return r===-1?t.testIndex>=0&&t.testIndex<e.length?t.testIndex:-1:r}function Q(e,t,n){let r=nt(e,t);return r===-1?e:e.map((e,t)=>t===r?n(e):e)}function $(e){return e.scope===`test`}function rt(e,t={}){let n=t.steps,r=t.tests,i=t.setupHooks??[],a=t.teardownHooks??[],o=t.allowReconnect??!n,[s,c]=(0,V.useState)(`idle`),[ee,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(()=>et([],i,`setup`)),[te,ne]=(0,V.useState)(()=>et([],a,`teardown`)),[f,re]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[ie,_]=(0,V.useState)(null),[ae,v]=(0,V.useState)(null),[oe,se]=(0,V.useState)([]),[y,ce]=(0,V.useState)(`web`),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(!1),[le,ue]=(0,V.useState)(!1),[de,w]=(0,V.useState)([]),[fe,pe]=(0,V.useState)(null),[T,E]=(0,V.useState)(!1),[me,he]=(0,V.useState)(!1),D=(0,V.useRef)(null),O=(0,V.useRef)(0),ge=(0,V.useRef)(null),_e=(0,V.useRef)(null),k=(0,V.useRef)(`idle`),A=(0,V.useRef)([]),j=(0,V.useRef)(null),ve=(0,V.useRef)(!1),M=(0,V.useRef)(null),N=(0,V.useRef)(null),ye=(0,V.useRef)(!1),be=(0,V.useRef)(0),P=(0,V.useRef)(`web`),xe=(0,V.useRef)(null),F=(0,V.useRef)(!!n),I=(0,V.useRef)(null),L=(0,V.useRef)([]),Se=(0,V.useRef)(null),Ce=(0,V.useRef)(!1),we=(0,V.useRef)(null);k.current=s,A.current=ee,j.current=ae,P.current=y,F.current=!!n,L.current=de,Se.current=fe;let R=(0,V.useCallback)(()=>{_e.current&&=(clearInterval(_e.current),null)},[]),z=(0,V.useCallback)(e=>{let t=D.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},[]),B=(0,V.useCallback)(e=>{R(),_e.current=setInterval(()=>{document.hidden||z({type:`get-screenshot`})},e)},[R,z]),Te=(0,V.useCallback)(()=>new Promise(e=>{N.current=e,setTimeout(()=>{N.current===e&&(N.current=null,e())},5e3)}),[]),H=(0,V.useCallback)(()=>{let e=xe.current;e&&(xe.current=null,l(t=>$e(t,e)))},[]),Ee=(0,V.useCallback)(e=>{D.current&&=(J(`hook`,`closing previous websocket before reconnect`,{sessionId:e}),D.current.close(),null),c(`connecting`),ve.current=!1,J(`hook`,`connecting websocket`,{sessionId:e});let t=`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}/api/live-editor/ws?sessionId=${e}`,n=new WebSocket(t);D.current=n,n.onopen=()=>{O.current=0,J(`hook`,`websocket opened`,{sessionId:e})},n.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}switch(n.type){case`session-ready`:{let t=n.platform??`web`;ce(t),P.current=t;let r=n.interactive!==!1;c(r?`connected`:`error`),_(n.error??null),J(`hook`,`session ready`,{sessionId:e,platform:t,interactive:r}),r&&B(t===`web`?1e3:2e3);break}case`hook-start`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0,createdAt:e.createdAt};if(e.owner.scope===`suite`)(e.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===e.phase&&I.current.hookId===e.hookId&&(I.current={...I.current,executionId:e.executionId});else if($(e.owner)){let n=e.owner;w(r=>Q(r,n,n=>({...n,perTestSetupHooks:e.phase===`setup`?X(n.perTestSetupHooks,t):n.perTestSetupHooks,perTestTeardownHooks:e.phase===`teardown`?X(n.perTestTeardownHooks,t):n.perTestTeardownHooks})))}break}case`hook-complete`:{let e=n.hook,t={id:e.hookId,executionId:e.executionId,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt};if(e.owner.scope===`suite`)(t.phase===`setup`?d:ne)(e=>X(e,t)),I.current&&I.current.phase===t.phase&&I.current.hookId===t.id&&(!I.current.executionId||I.current.executionId===t.executionId)&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H());else if($(e.owner)){let n=e.owner;w(e=>Q(e,n,e=>({...e,perTestSetupHooks:t.phase===`setup`?X(e.perTestSetupHooks,t):e.perTestSetupHooks,perTestTeardownHooks:t.phase===`teardown`?X(e.perTestTeardownHooks,t):e.perTestTeardownHooks})))}break}case`step-phase`:l(e=>e.map((e,t)=>t===j.current&&e.status===`running`&&e.executionGeneration===be.current?{...e,phases:[...e.phases,{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]}:e));break;case`step-complete`:{let t=n.result,r=j.current,i=t?.status===`passed`?`passed`:`failed`;l(e=>e.map((e,n)=>n===r&&e.status===`running`?{...e,status:i,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]}:e)),v(null),c(`connected`),J(`hook`,`step completed`,{sessionId:e,stepIndex:r??void 0,status:i}),B(P.current===`web`?1e3:2e3),M.current?.({status:i}),M.current=null,N.current?.(),N.current=null,H();break}case`test-start`:{let e=n.test;Se.current=e.testIndex,pe(e.testIndex),w(t=>Q(t,e,t=>({...t,status:`running`,duration:void 0,error:void 0,testExecutionId:e.testExecutionId,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]})));break}case`test-step-start`:{let e=n.step;w(t=>Q(t,e,t=>({...t,status:`running`,testExecutionId:e.testExecutionId,runningStepIndex:e.stepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,duration:void 0,error:void 0,phases:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[]})})));break}case`test-step-phase`:{let e=n.step;w(t=>Q(t,e,t=>({...t,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`running`,phases:[...t.liveSteps.find(t=>t.stepIndex===e.stepIndex)?.phases??[],{phase:n.phase,text:n.data?.text,confidence:n.data?.confidence,action:n.data?.action,success:n.data?.success,duration:n.data?.duration,timestamp:new Date().toISOString()}]})})));break}case`test-step-complete`:{let e=n.step,t=n.result;w(n=>Q(n,e,n=>({...n,runningStepIndex:n.runningStepIndex===e.stepIndex?null:n.runningStepIndex,liveSteps:Z(n.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:t?.status??`failed`,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??[],networkLogs:t?.networkLogs??[],variableSnapshot:t?.variableSnapshot??null,originalStepName:t?.originalStepName??null,subActionsData:t?.subActionsData??null,executionLogs:t?.executionLogs??[]})})));break}case`test-step-cancelled`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`cancelled`})})));break}case`test-step-error`:{let e=n.step;w(t=>Q(t,e,t=>({...t,runningStepIndex:t.runningStepIndex===e.stepIndex?null:t.runningStepIndex,liveSteps:Z(t.liveSteps,{stepIndex:e.stepIndex,instruction:e.stepInstruction},{status:`failed`,error:n.error})})));break}case`test-complete`:{let e=n.test,t=n.result,r=t?.status??`failed`,i=t?.error;if(!i&&r===`failed`&&Array.isArray(t?.stepResults)){let e=t.stepResults.find(e=>e?.status===`failed`);e?.error&&(i=`Step ${t.stepResults.indexOf(e)+1} failed: ${e.error}`)}w(n=>Q(n,e,n=>({...n,status:r,duration:t?.duration,error:i,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString(),liveSteps:Array.isArray(t?.stepResults)?t.stepResults.reduce((e,t,r)=>{let i=n.liveSteps.find(e=>e.stepIndex===r);return i?Z(e,{stepIndex:r,instruction:i.instruction},{status:t?.status??i.status,duration:t?.duration,error:t?.error,capturedVariables:t?.capturedVariables,consoleLogs:t?.consoleLogs??i.consoleLogs,networkLogs:t?.networkLogs??i.networkLogs,variableSnapshot:t?.variableSnapshot??i.variableSnapshot,originalStepName:t?.originalStepName??i.originalStepName,subActionsData:t?.subActionsData??i.subActionsData,executionLogs:t?.executionLogs??i.executionLogs}):e},n.liveSteps):n.liveSteps,perTestSetupHooks:Array.isArray(t?.setupHookExecutions)?t.setupHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestSetupHooks,perTestTeardownHooks:Array.isArray(t?.teardownHookExecutions)?t.teardownHookExecutions.map(e=>({id:e.hookId,executionId:e.executionId??null,name:e.hookName,phase:e.phase,status:e.status,duration:e.duration,stdout:e.stdout??null,stderr:e.stderr??null,variables:e.variables??null,error:e.error,createdAt:e.createdAt})):n.perTestTeardownHooks}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let a=we.current;we.current=null,a?.({status:r});break}case`test-error`:{let e=n.test;w(t=>Q(t,e,t=>({...t,status:`failed`,error:n.error,testExecutionId:e.testExecutionId,runningStepIndex:null,lastRunAt:new Date().toISOString()}))),Se.current=null,pe(null),c(`connected`),B(P.current===`web`?1e3:2e3);let t=we.current;we.current=null,t?.({status:`failed`});break}case`step-error`:J(`hook`,`step failed`,{sessionId:e,stepIndex:j.current??void 0,error:n.error}),l(e=>e.map((e,t)=>t===j.current?e.status===`cancelling`?{...e,status:`cancelled`}:e.status===`running`?{...e,status:`failed`,error:n.error}:e:e)),v(null),c(`connected`),B(P.current===`web`?1e3:2e3),M.current?.({status:`failed`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-cancelled`:l(e=>e.map((e,t)=>t===j.current&&(e.status===`running`||e.status===`cancelling`)?{...e,status:`cancelled`}:e)),v(null),c(`connected`),J(`hook`,`step cancelled`,{sessionId:e,stepIndex:j.current??void 0}),B(P.current===`web`?1e3:2e3),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H();break;case`step-busy`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3)),_(`Step already in progress: ${n.currentStep}`);break;case`screenshot`:re(`data:image/jpeg;base64,${n.data}`);break;case`navigate-complete`:m(n.url??null),g(null);break;case`session-state`:n.state&&`currentUrl`in n.state&&m(n.state.currentUrl??null),n.state?.interactive===!1&&(c(`error`),_(n.state.terminalError??`Live session is not ready`));break;case`device-logs`:se(e=>[...e,...n.entries]);break;case`aria-tree`:x(n.tree);break;case`session-terminated`:c(`disconnected`),g(null),I.current=null,R(),H(),J(`hook`,`session terminated by server`,{sessionId:e});break;case`error`:g(null),I.current&&(I.current=null,c(`connected`),B(P.current===`web`?1e3:2e3),H()),_(n.message),J(`hook`,`server reported error`,{sessionId:e,message:n.message});break}},n.onclose=()=>{if(D.current=null,R(),ve.current){J(`hook`,`websocket closed after local termination`,{sessionId:e});return}if(J(`hook`,`websocket closed unexpectedly`,{sessionId:e,allowReconnect:o,reconnectCount:O.current}),c(`disconnected`),g(null),I.current=null,l(e=>e.map(e=>e.status===`running`||e.status===`cancelling`?{...e,status:`cancelled`}:e)),j.current=null,v(null),M.current?.({status:`cancelled`}),M.current=null,N.current?.(),N.current=null,H(),o&&O.current<3){let t=2**O.current*1e3;O.current++,J(`hook`,`scheduling reconnect`,{sessionId:e,delay:t,reconnectCount:O.current}),ge.current=setTimeout(()=>Ee(e),t)}},n.onerror=()=>{J(`hook`,`websocket error event`,{sessionId:e})}},[o,H,R,B]);(0,V.useEffect)(()=>{if(n){if(k.current===`executing`){xe.current=n,J(`hook`,`queued external step sync while executing`,{stepCount:n.length});return}xe.current=null,J(`hook`,`syncing external steps`,{stepCount:n.length}),l(e=>$e(e,n))}},[n]),(0,V.useEffect)(()=>{d(e=>et(e,i,`setup`))},[i]),(0,V.useEffect)(()=>{ne(e=>et(e,a,`teardown`))},[a]),(0,V.useEffect)(()=>{r&&w(e=>{let t=new Map(e.map(e=>[`${e.testId}::${e.path}`,e]));return r.map((e,n)=>tt(e,n,t.get(`${e.testId}::${e.path}`)))})},[r]),(0,V.useEffect)(()=>{if(!e){c(`idle`),l(n?$e([],n):[]),d(et([],i,`setup`)),ne(et([],a,`teardown`)),re(null),m(null),g(null),_(null),I.current=null,se([]),ce(`web`),x(null),C(!1),ue(!1),w(r?.map((e,t)=>tt(e,t))??[]),pe(null),E(!1),he(!1);return}return Ee(e),()=>{R(),ge.current&&=(clearTimeout(ge.current),null),D.current&&=(J(`hook`,`cleaning up websocket for session effect`,{sessionId:e}),D.current.close(),null)}},[R,Ee,e]),(0,V.useEffect)(()=>{s===`executing`?B(y===`web`?500:1e3):s===`connected`?B(y===`web`?1e3:2e3):R()},[s,y,B,R]),(0,V.useEffect)(()=>{let e=()=>{if(document.hidden)R();else{let e=k.current,t=P.current;e===`executing`?B(t===`web`?500:1e3):e===`connected`&&B(t===`web`?1e3:2e3)}};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[R,B]);let De=(0,V.useCallback)(e=>{if(F.current)return;let t=A.current.length;l(t=>[...t,{id:crypto.randomUUID(),draftId:null,instruction:e,status:`running`,phases:[],executionHistory:[],consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:0}]),v(t),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:e,stepIndex:t})},[z]),Oe=(0,V.useCallback)(async(t,n)=>{let r=A.current[t];if(!r||!r.instruction.trim())return;if(j.current!==null){let e=j.current;ye.current=!0,l(t=>t.map((t,n)=>n===e&&t.status===`running`?{...t,status:`cancelling`}:t)),z({type:`cancel-step`}),await Te()}be.current++;let i=be.current;j.current=t,v(t),l(e=>e.map((e,n)=>n===t?{...e,status:`running`,phases:[],executionHistory:e.phases.length>0?[...e.executionHistory,{phases:e.phases,status:e.status,duration:e.duration,error:e.error,timestamp:new Date().toISOString()}]:e.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:e)),c(`executing`),_(null),J(`hook`,`executing step`,{sessionId:e,stepIndex:t,instruction:r.instruction,testName:n?.testName}),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:t,draft:n})},[z,e,Te]),ke=(0,V.useCallback)(async(t,n)=>{if(k.current!==`connected`){_(`Live session is busy or not ready`);return}I.current={phase:t,hookId:n},(t===`setup`?d:ne)(e=>e.map(e=>e.id===n?{...e,status:`running`,duration:void 0,stdout:null,stderr:null,variables:null,error:void 0}:e)),c(`executing`),_(null),J(`hook`,`executing hook`,{sessionId:e,phase:t,hookId:n}),z({type:`execute-hook`,phase:t,hookId:n})},[z,e]),Ae=(0,V.useCallback)(()=>{F.current||l(e=>[...e,Y(``)])},[]),U=(0,V.useCallback)(e=>{F.current||l(t=>t.filter((t,n)=>n!==e))},[]),je=(0,V.useCallback)((e,t)=>{F.current||l(n=>n.map((n,r)=>r===e?{...n,instruction:t}:n))},[]),W=(0,V.useCallback)((e,t)=>{if(F.current)return;l(n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r});let n=j.current;if(n!==null){let r=n;n===e?r=t:e<n&&t>=n?r=n-1:e>n&&t<=n&&(r=n+1),r!==n&&(j.current=r,v(r))}},[]),Me=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0)),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),J(`hook`,`cancelling active step`,{sessionId:e}),z({type:`cancel-step`})},[S,z,e]),G=(0,V.useCallback)(()=>{z({type:`get-screenshot`})},[z]),Ne=(0,V.useCallback)(()=>{g({action:`refresh`}),z({type:`refresh-page`})},[z]),Pe=(0,V.useCallback)(()=>{g({action:`back`}),z({type:`go-back`})},[z]),Fe=(0,V.useCallback)(()=>{g({action:`forward`}),z({type:`go-forward`})},[z]),K=(0,V.useCallback)(()=>{z({type:`get-aria-tree`})},[z]),Ie=(0,V.useCallback)(e=>{g({action:`navigate`,targetUrl:e}),z({type:`navigate`,url:e})},[z]),Le=(0,V.useCallback)((e,t)=>new Promise(n=>{M.current=n;let r=A.current[e];if(!r||!r.instruction.trim()){M.current=null,n({status:`skipped`});return}be.current++;let i=be.current;j.current=e,v(e),l(t=>t.map((t,n)=>n===e?{...t,status:`running`,phases:[],executionHistory:t.phases.length>0?[...t.executionHistory,{phases:t.phases,status:t.status,duration:t.duration,error:t.error,timestamp:new Date().toISOString()}]:t.executionHistory,error:void 0,duration:void 0,consoleLogs:[],networkLogs:[],variableSnapshot:null,originalStepName:null,subActionsData:null,executionLogs:[],executionGeneration:i}:t)),c(`executing`),_(null),z({type:`execute-step`,stepInstruction:r.instruction,stepIndex:e,draft:t})}),[z]),Re=(0,V.useCallback)(async t=>{if(S)return;ye.current=!1;let n=A.current.length;C(!0),ue(!1),J(`hook`,`running all steps`,{sessionId:e,stepCount:n});try{for(let e=0;e<n&&!ye.current;e++){if(!A.current[e].instruction.trim())continue;let n=await Le(e,t);if(n.status===`failed`||n.status===`cancelled`)break}}finally{ye.current=!1,C(!1),ue(!1)}},[Le,S,e]),ze=(0,V.useCallback)(()=>{S&&(ye.current=!0,ue(!0),l(e=>e.map((e,t)=>t===j.current&&e.status===`running`?{...e,status:`cancelling`}:e)),j.current!==null&&z({type:`cancel-step`}))},[S,z]),Be=(0,V.useCallback)((e,t)=>new Promise(n=>{we.current=n;let r=L.current[e];if(!r){we.current=null,n({status:`skipped`});return}let i=crypto.randomUUID();Se.current=e,pe(e),w(t=>t.map((t,n)=>n===e?{...t,status:`running`,duration:void 0,error:void 0,testExecutionId:i,runningStepIndex:null,liveSteps:[],perTestSetupHooks:[],perTestTeardownHooks:[]}:t)),c(`executing`),_(null),z({type:`execute-test`,testExecutionId:i,testId:r.testId,path:r.path,testIndex:e,draft:t})}),[z]),Ve=(0,V.useCallback)(async(e,t)=>{L.current[e]&&await Be(e,t)},[Be]),He=(0,V.useCallback)(async e=>{if(T)return;Ce.current=!1;let t=L.current.length;E(!0),he(!1);try{for(let n=0;n<t&&!Ce.current;n++){let t=await Be(n,e);if(t.status===`failed`||t.status===`cancelled`)break}}finally{Ce.current=!1,E(!1),he(!1)}},[Be,T]),Ue=(0,V.useCallback)(()=>{T&&(Ce.current=!0,he(!0),Se.current!==null&&z({type:`cancel-step`}))},[T,z]);return{connectionState:s,steps:ee,setupHooks:u,teardownHooks:te,screenshot:f,currentUrl:p,pendingNavigation:h,error:ie,executeStep:De,executeStepByIndex:Oe,executeHookById:ke,cancelStep:Me,requestScreenshot:G,refreshPage:Ne,goBack:Pe,goForward:Fe,navigate:Ie,runAll:Re,cancelRunAll:ze,terminateSession:(0,V.useCallback)(()=>{ye.current=!0,C(!1),ue(!1),ve.current=!0,J(`hook`,`terminating session`,{sessionId:e}),z({type:`terminate-session`})},[z,e]),addStep:Ae,removeStep:U,updateStepInstruction:je,reorderSteps:W,runningStepIndex:ae,runningStepId:ae===null?null:ee[ae]?.id??null,sessionId:e,isTerminated:ve.current,deviceLogs:oe,platform:y,ariaTree:b,requestAriaTree:K,isRunningAll:S,isStoppingRunAll:le,tests:de,executeTestByIndex:Ve,runAllTests:He,cancelRunAllTests:Ue,runningTestIndex:fe,isRunningAllTests:T,isStoppingRunAllTests:me}}function it(e){try{let t=m(e);if(t.errors.length>0)return{};let n=t.toJSON(),r=n?.use?.mobile?.appState;return{headless:n?.use?.browser?.headless,device:typeof n?.use?.device==`string`?n.use.device:void 0,appState:r===`preserve`||r===`reset`?r:void 0}}catch{return{}}}function at(e){let t=e.targets[e.targetName];if(!t)throw Error(`Selected target "${e.targetName}" was not found in workspace config`);let n=it(e.content),r=n.headless??e.globalUse?.browser?.headless;if(t.platform===`web`){if(!t.url)throw Error(`Selected web target "${e.targetName}" is missing a URL`);return{platform:`web`,url:t.url,headless:r}}return{platform:t.platform,targetName:e.targetName,useDeviceName:n.device,appState:n.appState??e.globalUse?.mobile?.appState,bundleId:t.bundleId,appPackage:t.appPackage,appActivity:t.appActivity,headless:r}}var ot=[{namespace:`runJS`,name:`document.title`,label:`Page title`},{namespace:`runJS`,name:`Date.now()`,label:`Current timestamp`},{namespace:`runJS`,name:`window.location.href`,label:`Current URL`},{namespace:`runJS`,name:`document.querySelector('...').textContent`,label:`Extract element text`}];function st(e){let[t,n]=(0,V.useState)([]),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{let t=!1;c(!0);let r=[T().then(e=>{t||n(e.keys)}).catch(()=>{t||n([])}),j().then(e=>{t||i(e.hooks.map(e=>({id:e.id,name:e.name})))}).catch(()=>{t||i([])})];return e&&r.push(w(e).then(e=>{t||o(e.names)}).catch(()=>{t||o([])})),Promise.allSettled(r).then(()=>{t||c(!1)}),()=>{t=!0}},[e]),{suggestions:(0,V.useMemo)(()=>{let e=[];for(let n of t)e.push({namespace:`env`,name:n,label:`env`});for(let t of r)e.push({namespace:`runHook`,name:t.name,label:`hook`,insertValue:t.id,description:t.id});for(let t of a)e.push({namespace:`capture`,name:t,label:`captured`});return e.push(...ot),e},[t,r,a]),isLoading:s}}var ct=/^[a-zA-Z0-9._-]+$/,lt=/\.(yaml|yml)$/;function ut(e){return e.trim().replace(/\\/g,`/`).replace(/^\.\//,``)}function dt(e){let t=ut(e).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replace(/\*\*\//g,`__DIRSTAR__`).replace(/\*\*/g,`__DIRSTAR__`).replace(/\*/g,`[^/]*`).replace(/__DIRSTAR__/g,`(?:.*/)?`);return RegExp(`^${t}$`)}function ft(e,t){let n=ut(e);return t.some(e=>dt(e).test(n))}function pt(e){let t=e.trim();if(!t)return`Filename is required`;if(t.includes(`..`))return`Path must not contain '..' segments`;if(t.startsWith(`/`))return`Path must be relative, not absolute`;let n=t.split(`/`);for(let e of n){if(!e)return`Path contains empty segment (double slash)`;if(!ct.test(e))return`Path must contain only letters, numbers, hyphens, dots, underscores, and forward slashes, ending with .yaml or .yml`}let r=n[n.length-1];return lt.test(r)?null:`File must end with .yaml or .yml`}function mt(e,t,n){let r=pt(e);if(r)return r;let i=(t??[]).map(e=>e.trim()).filter(Boolean);return i.length===0?`workspace.${n} must contain at least one pattern`:ft(e.trim(),i)?null:`File path must match one of your workspace's ${n} patterns (${i.join(`, `)})`}export{J as a,Ne as c,rt as i,st as n,q as o,at as r,Pe as s,mt as t};
@@ -1 +1 @@
1
- import{Jn as e}from"./index-Bvtm2F6f.js";var t=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);export{t};
1
+ import{Jn as e}from"./index-B4FdO6Vk.js";var t=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as ee,t as te}from"./select-CeVjgiKI.js";import{t as ne}from"./monaco-editor-DNT0Mzki.js";import{t as re}from"./refresh-cw-C_0AkMuu.js";import{t as ie}from"./use-page-title-B1t9-5_U.js";import{a as i,t as a}from"./dist-m_OM4Je_.js";import{t as ae}from"./scroll-area-CnATfQoe.js";import{t as oe}from"./switch-ByV5GV5L.js";import{$n as o,A as se,Fn as ce,G as le,Ht as s,Qn as c,S as l,T as ue,Ut as de,Wt as u,Yt as fe,cr as pe,lr as me,pr as d,r as he,wt as ge}from"./index-Bvtm2F6f.js";import{i as _e,n as f,r as ve,t as ye}from"./hook-runtime-JF-0oZpz.js";import{a as be,i as xe,n as Se,o as Ce,r as we,t as Te}from"./use-hook-run-session-x-d_iodT.js";import{t as Ee}from"./empty-state-BTvOA5lp.js";var p=e(d(),1),m=c();function De({title:e,body:t,tone:n=`warning`,children:r}){return(0,m.jsxs)(`div`,{className:`rounded-sm border px-4 py-3 text-sm ${n===`error`?`border-destructive/30 bg-destructive/10`:n===`neutral`?`border-border bg-muted/40`:`border-amber-500/30 bg-amber-500/10`}`,children:[(0,m.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t}),r?(0,m.jsx)(`div`,{className:`mt-3`,children:r}):null]})}function Oe(e){if(e===0)return`0ms`;for(let t of[{suffix:`d`,value:864e5},{suffix:`h`,value:36e5},{suffix:`m`,value:6e4},{suffix:`s`,value:1e3}])if(e%t.value===0)return`${e/t.value}${t.suffix}`;return`${e}ms`}function h(e){return JSON.stringify({name:e.name,runtime:e.runtime,file:e.file,timeout:e.timeout,network:e.network,source:e.source})}function g(e,t){return e.find(e=>e.field===t)??null}function ke(e){return Array.isArray(e)}function Ae(e){switch(e){case`javascript`:return`JavaScript`;case`typescript`:return`TypeScript`;case`python`:return`Python`;case`shell`:return`Shell`;default:return e}}function _(){let{id:e}=me(),c=pe(),d=fe(),_=!e,v=e??``,y=(0,p.useMemo)(()=>f(`node`),[]),b=(0,p.useRef)(_?a():v),[x,S]=(0,p.useState)(b.current),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(`node`),[D,O]=(0,p.useState)(y.file),[k,A]=(0,p.useState)(`30s`),[j,M]=(0,p.useState)(!0),[N,P]=(0,p.useState)(y.source),[F,I]=(0,p.useState)([]),[je,L]=(0,p.useState)(!_),[Me,R]=(0,p.useState)(!1),[Ne,Pe]=(0,p.useState)(!1),[Fe,z]=(0,p.useState)(null),[Ie,B]=(0,p.useState)([]),[Le,V]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(!1),[He,Ue]=(0,p.useState)(()=>h({name:``,runtime:`node`,file:y.file,timeout:`30s`,network:!0,source:y.source})),H=(0,p.useRef)(y.file),U=(0,p.useRef)(y.source);ie(_?`New Hook`:C.trim()||`Hook`);let W=h({name:C,runtime:T,file:D,timeout:k,network:j,source:N})!==He,We=F.find(e=>e.code===`file_missing`)??null,G=Te({hookId:x}),K=_e(T),Ge=Ae(K),q=(0,p.useMemo)(()=>_||!x||W?`Save this hook to run the latest changes.`:F.length>0?F.map(e=>e.message).join(` `):null,[F,x,_,W]);(0,p.useEffect)(()=>{if(_){S(b.current),R(!1);return}let e=!1;return L(!0),le(v).then(t=>{if(e)return;let n=Oe(t.hook.timeout),r=t.source??``;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),z(null),V(null),B([]),R(!1),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r}).catch(t=>{if(!e){if(t instanceof l&&t.status===404){R(!0);return}z(t instanceof Error?t.message:`Failed to load hook`)}}).finally(()=>{e||L(!1)}),()=>{e=!0}},[_,v]);function Ke(e){if(_){let t=f(e,C);(D===H.current||!D.trim())&&O(t.file),(N===U.current||!N.trim())&&P(t.source),H.current=t.file,U.current=t.source}E(e)}function qe(e){if(w(e),!_)return;let t=f(T,e);(D===H.current||!D.trim())&&O(t.file),H.current=t.file}function Je(){if(!_)return;let e=a();b.current=e,S(e)}async function Ye(){Pe(!0),z(null),V(null),B([]);let e={hook:{id:x,name:C.trim(),runtime:T,file:D.trim(),timeout:k.trim(),network:j},source:N};try{let t=_?await ue(e):await ge(x,e),n=Oe(t.hook.timeout),r=t.source??N;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r,_&&c(o.hookEdit(t.hook.id),{replace:!0})}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.fieldErrors;t===`validation_failed`&&ke(n)?(I(n),z(`Couldn't save this hook. Fix the highlighted issues and try again.`)):z(e.message)}else z(e instanceof Error?e.message:`Failed to save hook`)}finally{Pe(!1)}}async function Xe(e=!1){if(!(_||!x)){ze(!0),V(null);try{await se(x,{force:e}),c(o.hooks)}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.references;if(t===`hook_in_use`&&Array.isArray(n)){B(n);return}V(e.message)}else V(e instanceof Error?e.message:`Failed to delete hook`)}finally{ze(!1)}}}function Ze(){V(null),B([]),Ve(!0)}function Qe(e){Ve(e),e||(V(null),B([]))}async function $e(){q||await G.submitRun()}if(je)return(0,m.jsx)(he,{});if(Me)return(0,m.jsx)(Ee,{icon:ce,title:`Hook not found`,description:`This hook doesn't exist or could not be loaded.`,actionLabel:`View All Hooks`,onAction:()=>c(o.hooks)});let J=g(F,`name`),Y=g(F,`runtime`),X=g(F,`file`),Z=g(F,`timeout`),Q=g(F,`network`),$=(0,m.jsxs)(`div`,{className:u(`p-3`,d?`space-y-3`:`flex h-full min-h-0 flex-col gap-3 overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`space-y-3 shrink-0`,children:[Fe?(0,m.jsx)(De,{title:`Couldn't save this hook.`,body:Fe,tone:`error`}):null,We?(0,m.jsx)(De,{title:`Hook file missing`,body:`This hook is still registered, but its source file can't be found. Update the path or recreate the file, then save again.`}):null,(0,m.jsxs)(`section`,{className:`space-y-3`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-name`,children:`Hook name`}),(0,m.jsx)(s,{id:`hook-name`,value:C,onChange:e=>qe(e.currentTarget.value),placeholder:`Capture auth session`,"aria-invalid":!!J}),J?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:J.message}):null]}),_?(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-id`,children:`Hook ID`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(s,{id:`hook-id`,value:x,readOnly:!0,disabled:!0,"aria-label":`Hook ID`}),(0,m.jsx)(de,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:Je,"aria-label":`Generate new hook ID`,children:(0,m.jsx)(re,{className:`size-3.5`})})]})]}):null,(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-file`,children:`File path`}),(0,m.jsx)(s,{id:`hook-file`,value:D,onChange:e=>O(e.currentTarget.value),placeholder:`./hooks/login.js`,"aria-invalid":!!X}),X?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:X.message}):null]}),(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_minmax(0,0.8fr)]`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-runtime`,children:`Runtime`}),(0,m.jsxs)(te,{value:T,onValueChange:e=>Ke(e),children:[(0,m.jsx)(r,{id:`hook-runtime`,"aria-invalid":!!Y,children:(0,m.jsx)(ee,{placeholder:`Runtime`})}),(0,m.jsx)(n,{children:ye.map(e=>(0,m.jsx)(t,{value:e,children:ve(e).label},e))})]}),Y?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Y.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-timeout`,children:`Timeout`}),(0,m.jsx)(s,{id:`hook-timeout`,value:k,onChange:e=>A(e.currentTarget.value),placeholder:`5s`,"aria-invalid":!!Z}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Examples: 5s, 10m, 250ms`}),Z?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Z.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-network`,children:`Network`}),(0,m.jsxs)(`div`,{className:`flex h-10 items-center justify-between rounded-sm border bg-background/70 px-3`,children:[(0,m.jsx)(`span`,{className:`text-sm text-foreground`,children:j?`Enabled`:`Disabled`}),(0,m.jsx)(oe,{id:`hook-network`,checked:j,onCheckedChange:M,"aria-invalid":!!Q})]}),Q?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Q.message}):null]})]})]})]}),(0,m.jsxs)(`section`,{className:u(`space-y-2`,d?``:`flex min-h-[300px] flex-1 flex-col overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Source`}),(0,m.jsx)(`span`,{className:`rounded-sm border px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Ge})]}),(0,m.jsx)(ne,{value:N,onChange:P,onSave:Ye,language:K,className:u(`rounded-sm`,d?`h-[360px] min-h-[320px]`:`h-full min-h-[300px] flex-1`)})]})]}),et=d?(0,m.jsx)(ae,{className:`h-full`,children:$}):$,tt=(0,m.jsx)(we,{baselineCount:G.baselineVariables.length,baselineFilePath:G.baselineFilePath,baselineInfo:G.baselineInfo,isBaselineLoading:G.isBaselineLoading,overrideRows:G.overrideRows,overridingRowIds:G.overridingRowIds,recentRuns:G.recentRuns,selectedRunId:G.selectedRunId,isRunning:G.isRunning,runDisabledReason:q,runError:G.runError,onAddOverride:()=>G.addOverrideRow(),onUpdateOverride:G.updateOverrideRow,onRemoveOverride:G.removeOverrideRow,onRun:()=>{$e()},onSelectRun:G.selectRun}),nt=(0,m.jsx)(xe,{selectedRun:G.selectedRun});return(0,m.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,m.jsx)(be,{hookName:C.trim()||`New Hook`,isCreateMode:_,mode:`edit`,hookHref:_?void 0:o.hookView(x),editHref:_?void 0:o.hookEdit(x),unsaved:W,isSaving:Ne,isRunning:G.isRunning,isDeleting:Re,onSave:Ye,onRun:_?void 0:()=>{$e()},runDisabled:!!q,onDelete:_?void 0:Ze}),(0,m.jsx)(Se,{isMobile:d,leftPane:et,rightTopPane:tt,rightBottomPane:nt}),_?null:(0,m.jsx)(Ce,{open:Be,onOpenChange:Qe,hook:{id:x,name:C.trim()||`Hook`,runtime:T,file:D},isDeleting:Re,deleteError:Le,blockedReferences:Ie,onDelete:()=>{Xe(!1)},onForceDelete:()=>{Xe(!0)}})]})}export{_ as default};
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{i as t,n,o as r,s as ee,t as te}from"./select-D5oFJNaq.js";import{t as ne}from"./monaco-editor-DF4W-NC-.js";import{t as re}from"./refresh-cw-RAow1kax.js";import{t as ie}from"./use-page-title-B4YPyIzc.js";import{a as i,t as a}from"./dist-wK15YRiu.js";import{t as ae}from"./scroll-area-BmkJ1y7Q.js";import{t as oe}from"./switch-CPd0R3ri.js";import{$n as o,A as se,Fn as ce,G as le,Ht as s,Qn as c,S as l,T as ue,Ut as de,Wt as u,Yt as fe,cr as pe,lr as me,pr as d,r as he,wt as ge}from"./index-B4FdO6Vk.js";import{i as _e,n as f,r as ve,t as ye}from"./hook-runtime-CTRviwQE.js";import{a as be,i as xe,n as Se,o as Ce,r as we,t as Te}from"./use-hook-run-session-DH_86Jtn.js";import{t as Ee}from"./empty-state-BfgY0UGA.js";var p=e(d(),1),m=c();function De({title:e,body:t,tone:n=`warning`,children:r}){return(0,m.jsxs)(`div`,{className:`rounded-sm border px-4 py-3 text-sm ${n===`error`?`border-destructive/30 bg-destructive/10`:n===`neutral`?`border-border bg-muted/40`:`border-amber-500/30 bg-amber-500/10`}`,children:[(0,m.jsx)(`div`,{className:`font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:t}),r?(0,m.jsx)(`div`,{className:`mt-3`,children:r}):null]})}function Oe(e){if(e===0)return`0ms`;for(let t of[{suffix:`d`,value:864e5},{suffix:`h`,value:36e5},{suffix:`m`,value:6e4},{suffix:`s`,value:1e3}])if(e%t.value===0)return`${e/t.value}${t.suffix}`;return`${e}ms`}function h(e){return JSON.stringify({name:e.name,runtime:e.runtime,file:e.file,timeout:e.timeout,network:e.network,source:e.source})}function g(e,t){return e.find(e=>e.field===t)??null}function ke(e){return Array.isArray(e)}function Ae(e){switch(e){case`javascript`:return`JavaScript`;case`typescript`:return`TypeScript`;case`python`:return`Python`;case`shell`:return`Shell`;default:return e}}function _(){let{id:e}=me(),c=pe(),d=fe(),_=!e,v=e??``,y=(0,p.useMemo)(()=>f(`node`),[]),b=(0,p.useRef)(_?a():v),[x,S]=(0,p.useState)(b.current),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(`node`),[D,O]=(0,p.useState)(y.file),[k,A]=(0,p.useState)(`30s`),[j,M]=(0,p.useState)(!0),[N,P]=(0,p.useState)(y.source),[F,I]=(0,p.useState)([]),[je,L]=(0,p.useState)(!_),[Me,R]=(0,p.useState)(!1),[Ne,Pe]=(0,p.useState)(!1),[Fe,z]=(0,p.useState)(null),[Ie,B]=(0,p.useState)([]),[Le,V]=(0,p.useState)(null),[Re,ze]=(0,p.useState)(!1),[Be,Ve]=(0,p.useState)(!1),[He,Ue]=(0,p.useState)(()=>h({name:``,runtime:`node`,file:y.file,timeout:`30s`,network:!0,source:y.source})),H=(0,p.useRef)(y.file),U=(0,p.useRef)(y.source);ie(_?`New Hook`:C.trim()||`Hook`);let W=h({name:C,runtime:T,file:D,timeout:k,network:j,source:N})!==He,We=F.find(e=>e.code===`file_missing`)??null,G=Te({hookId:x}),K=_e(T),Ge=Ae(K),q=(0,p.useMemo)(()=>_||!x||W?`Save this hook to run the latest changes.`:F.length>0?F.map(e=>e.message).join(` `):null,[F,x,_,W]);(0,p.useEffect)(()=>{if(_){S(b.current),R(!1);return}let e=!1;return L(!0),le(v).then(t=>{if(e)return;let n=Oe(t.hook.timeout),r=t.source??``;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),z(null),V(null),B([]),R(!1),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r}).catch(t=>{if(!e){if(t instanceof l&&t.status===404){R(!0);return}z(t instanceof Error?t.message:`Failed to load hook`)}}).finally(()=>{e||L(!1)}),()=>{e=!0}},[_,v]);function Ke(e){if(_){let t=f(e,C);(D===H.current||!D.trim())&&O(t.file),(N===U.current||!N.trim())&&P(t.source),H.current=t.file,U.current=t.source}E(e)}function qe(e){if(w(e),!_)return;let t=f(T,e);(D===H.current||!D.trim())&&O(t.file),H.current=t.file}function Je(){if(!_)return;let e=a();b.current=e,S(e)}async function Ye(){Pe(!0),z(null),V(null),B([]);let e={hook:{id:x,name:C.trim(),runtime:T,file:D.trim(),timeout:k.trim(),network:j},source:N};try{let t=_?await ue(e):await ge(x,e),n=Oe(t.hook.timeout),r=t.source??N;S(t.hook.id),w(t.hook.name),E(t.hook.runtime),O(t.hook.file),A(n),M(t.hook.network),P(r),I(t.fieldErrors),Ue(h({name:t.hook.name,runtime:t.hook.runtime,file:t.hook.file,timeout:n,network:t.hook.network,source:r})),H.current=t.hook.file,U.current=r,_&&c(o.hookEdit(t.hook.id),{replace:!0})}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.fieldErrors;t===`validation_failed`&&ke(n)?(I(n),z(`Couldn't save this hook. Fix the highlighted issues and try again.`)):z(e.message)}else z(e instanceof Error?e.message:`Failed to save hook`)}finally{Pe(!1)}}async function Xe(e=!1){if(!(_||!x)){ze(!0),V(null);try{await se(x,{force:e}),c(o.hooks)}catch(e){if(e instanceof l){let t=e.payload?.error,n=e.payload?.references;if(t===`hook_in_use`&&Array.isArray(n)){B(n);return}V(e.message)}else V(e instanceof Error?e.message:`Failed to delete hook`)}finally{ze(!1)}}}function Ze(){V(null),B([]),Ve(!0)}function Qe(e){Ve(e),e||(V(null),B([]))}async function $e(){q||await G.submitRun()}if(je)return(0,m.jsx)(he,{});if(Me)return(0,m.jsx)(Ee,{icon:ce,title:`Hook not found`,description:`This hook doesn't exist or could not be loaded.`,actionLabel:`View All Hooks`,onAction:()=>c(o.hooks)});let J=g(F,`name`),Y=g(F,`runtime`),X=g(F,`file`),Z=g(F,`timeout`),Q=g(F,`network`),$=(0,m.jsxs)(`div`,{className:u(`p-3`,d?`space-y-3`:`flex h-full min-h-0 flex-col gap-3 overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`space-y-3 shrink-0`,children:[Fe?(0,m.jsx)(De,{title:`Couldn't save this hook.`,body:Fe,tone:`error`}):null,We?(0,m.jsx)(De,{title:`Hook file missing`,body:`This hook is still registered, but its source file can't be found. Update the path or recreate the file, then save again.`}):null,(0,m.jsxs)(`section`,{className:`space-y-3`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-name`,children:`Hook name`}),(0,m.jsx)(s,{id:`hook-name`,value:C,onChange:e=>qe(e.currentTarget.value),placeholder:`Capture auth session`,"aria-invalid":!!J}),J?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:J.message}):null]}),_?(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-id`,children:`Hook ID`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(s,{id:`hook-id`,value:x,readOnly:!0,disabled:!0,"aria-label":`Hook ID`}),(0,m.jsx)(de,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:Je,"aria-label":`Generate new hook ID`,children:(0,m.jsx)(re,{className:`size-3.5`})})]})]}):null,(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-file`,children:`File path`}),(0,m.jsx)(s,{id:`hook-file`,value:D,onChange:e=>O(e.currentTarget.value),placeholder:`./hooks/login.js`,"aria-invalid":!!X}),X?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:X.message}):null]}),(0,m.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_minmax(0,0.8fr)]`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-runtime`,children:`Runtime`}),(0,m.jsxs)(te,{value:T,onValueChange:e=>Ke(e),children:[(0,m.jsx)(r,{id:`hook-runtime`,"aria-invalid":!!Y,children:(0,m.jsx)(ee,{placeholder:`Runtime`})}),(0,m.jsx)(n,{children:ye.map(e=>(0,m.jsx)(t,{value:e,children:ve(e).label},e))})]}),Y?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Y.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-timeout`,children:`Timeout`}),(0,m.jsx)(s,{id:`hook-timeout`,value:k,onChange:e=>A(e.currentTarget.value),placeholder:`5s`,"aria-invalid":!!Z}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Examples: 5s, 10m, 250ms`}),Z?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Z.message}):null]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(i,{htmlFor:`hook-network`,children:`Network`}),(0,m.jsxs)(`div`,{className:`flex h-10 items-center justify-between rounded-sm border bg-background/70 px-3`,children:[(0,m.jsx)(`span`,{className:`text-sm text-foreground`,children:j?`Enabled`:`Disabled`}),(0,m.jsx)(oe,{id:`hook-network`,checked:j,onCheckedChange:M,"aria-invalid":!!Q})]}),Q?(0,m.jsx)(`p`,{className:`text-xs text-destructive`,children:Q.message}):null]})]})]})]}),(0,m.jsxs)(`section`,{className:u(`space-y-2`,d?``:`flex min-h-[300px] flex-1 flex-col overflow-hidden`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Source`}),(0,m.jsx)(`span`,{className:`rounded-sm border px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Ge})]}),(0,m.jsx)(ne,{value:N,onChange:P,onSave:Ye,language:K,className:u(`rounded-sm`,d?`h-[360px] min-h-[320px]`:`h-full min-h-[300px] flex-1`)})]})]}),et=d?(0,m.jsx)(ae,{className:`h-full`,children:$}):$,tt=(0,m.jsx)(we,{baselineCount:G.baselineVariables.length,baselineFilePath:G.baselineFilePath,baselineInfo:G.baselineInfo,isBaselineLoading:G.isBaselineLoading,overrideRows:G.overrideRows,overridingRowIds:G.overridingRowIds,recentRuns:G.recentRuns,selectedRunId:G.selectedRunId,isRunning:G.isRunning,runDisabledReason:q,runError:G.runError,onAddOverride:()=>G.addOverrideRow(),onUpdateOverride:G.updateOverrideRow,onRemoveOverride:G.removeOverrideRow,onRun:()=>{$e()},onSelectRun:G.selectRun}),nt=(0,m.jsx)(xe,{selectedRun:G.selectedRun});return(0,m.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,m.jsx)(be,{hookName:C.trim()||`New Hook`,isCreateMode:_,mode:`edit`,hookHref:_?void 0:o.hookView(x),editHref:_?void 0:o.hookEdit(x),unsaved:W,isSaving:Ne,isRunning:G.isRunning,isDeleting:Re,onSave:Ye,onRun:_?void 0:()=>{$e()},runDisabled:!!q,onDelete:_?void 0:Ze}),(0,m.jsx)(Se,{isMobile:d,leftPane:et,rightTopPane:tt,rightBottomPane:nt}),_?null:(0,m.jsx)(Ce,{open:Be,onOpenChange:Qe,hook:{id:x,name:C.trim()||`Hook`,runtime:T,file:D},isDeleting:Re,deleteError:Le,blockedReferences:Ie,onDelete:()=>{Xe(!1)},onForceDelete:()=>{Xe(!0)}})]})}export{_ as default};