@capagents/forgeqe 2.9.7 → 2.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/HOW_TO_USE.md +91 -34
  2. package/dist/docs-site/docs/index.html +54 -5
  3. package/dist/docs-site/docs/search.js +1 -1
  4. package/dist/forgeqe.js +1980 -1875
  5. package/dist/web/assets/Agent-B0R4tnqF.js +8 -0
  6. package/dist/web/assets/ApiTests-CqWPHWCs.js +10 -0
  7. package/dist/web/assets/Browse-DlbTQPA8.js +2 -0
  8. package/dist/web/assets/{Chat-Baph1nlV.js → Chat-DtI3dgGs.js} +3 -3
  9. package/dist/web/assets/CommandPalette-BTI3Q3sc.js +1 -0
  10. package/dist/web/assets/{Compare-B7barE31.js → Compare-BMcHYq3I.js} +1 -1
  11. package/dist/web/assets/Cost-BcZ6gC9M.js +1 -0
  12. package/dist/web/assets/{Data-DGKi3KHS.js → Data-Cbl35RTK.js} +4 -4
  13. package/dist/web/assets/Desktop-D4JLSUnE.js +1 -0
  14. package/dist/web/assets/DesktopReview-vyosGOyC.js +1 -0
  15. package/dist/web/assets/Evidence-MDaV4ttv.js +1 -0
  16. package/dist/web/assets/{Explore-pa8l7kiC.js → Explore-yjmJHnzH.js} +2 -2
  17. package/dist/web/assets/Features-kXt6Um2p.js +1 -0
  18. package/dist/web/assets/{Flags-DcWTBteQ.js → Flags-CdLXiacX.js} +2 -2
  19. package/dist/web/assets/Flaky-BZx54uo3.js +1 -0
  20. package/dist/web/assets/Impact-_t7bwCwP.js +3 -0
  21. package/dist/web/assets/Jobs-D4PIAcdO.js +5 -0
  22. package/dist/web/assets/KindPage-CGfjoezZ.js +6 -0
  23. package/dist/web/assets/Migration-OGOnRmUX.js +2 -0
  24. package/dist/web/assets/Product-DycPE2MI.js +7 -0
  25. package/dist/web/assets/Production-DqnrcSfn.js +1 -0
  26. package/dist/web/assets/Quality-C__pEYpt.js +1 -0
  27. package/dist/web/assets/Readiness-j22NEcwR.js +1 -0
  28. package/dist/web/assets/Record-D7h6g_aw.js +2 -0
  29. package/dist/web/assets/Regression-ByBOHx96.js +5 -0
  30. package/dist/web/assets/RelationGraph-D_ZVeOBh.js +1 -0
  31. package/dist/web/assets/Reports-BGs_YnwI.js +2 -0
  32. package/dist/web/assets/{Response-Vh2lEWnS.js → Response-DWF22-5i.js} +2 -2
  33. package/dist/web/assets/{RunDiff-CVnhT7JE.js → RunDiff-YxrBVtxF.js} +1 -1
  34. package/dist/web/assets/Runs-CP3CgO6s.js +2 -0
  35. package/dist/web/assets/Steps-BDSeIznj.js +2 -0
  36. package/dist/web/assets/TestCases-BzuM4M4t.js +1 -0
  37. package/dist/web/assets/TestData-CRmYpEgE.js +2 -0
  38. package/dist/web/assets/TestDebt-D3I2zyGE.js +1 -0
  39. package/dist/web/assets/Tosca-jVIQnyZv.js +3 -0
  40. package/dist/web/assets/{WhatsNew-CuCua9dD.js → WhatsNew-EKniIJ6W.js} +1 -1
  41. package/dist/web/assets/dataParts-DRO6c2Kb.js +3 -0
  42. package/dist/web/assets/{families-B0QIuAe3.js → families-zlLgApNV.js} +1 -1
  43. package/dist/web/assets/filters-CflRmNDz.js +1 -0
  44. package/dist/web/assets/flowLayout-cXVJhLpH.js +1 -0
  45. package/dist/web/assets/{fold-CeQ84ypG.js → fold-D9yUIbTt.js} +1 -1
  46. package/dist/web/assets/frame--ur6lpMR.js +4 -0
  47. package/dist/web/assets/index-DwUumNPZ.css +2 -0
  48. package/dist/web/assets/index-GLMqsotN.js +66 -0
  49. package/dist/web/assets/{logos-DN9jLn4q.js → logos-CdIbTq_J.js} +1 -1
  50. package/dist/web/assets/markdown-nTIj9lyp.js +10 -0
  51. package/dist/web/assets/{palette-BdMPhc9j.js → palette-D5_w8xup.js} +1 -1
  52. package/dist/web/assets/{parts-z_AE9U-M.js → parts-C53RxMcR.js} +1 -1
  53. package/dist/web/assets/{productParts-C4vc_bLJ.js → productParts-DK3ULNpv.js} +1 -1
  54. package/dist/web/assets/qualityParts-BPBFzuHH.js +1 -0
  55. package/dist/web/assets/{recordTest-GvGQjhR4.js → recordTest-CqxnF953.js} +1 -1
  56. package/dist/web/assets/{rows-CiR4hGkv.js → rows-BVHC-HKz.js} +1 -1
  57. package/dist/web/assets/{segmented-DANusepM.js → segmented-CAf_qz5Z.js} +1 -1
  58. package/dist/web/assets/{thread-CyTIuLgk.js → thread-B4g66SWA.js} +2 -2
  59. package/dist/web/assets/{usePageChat-DOTAHsIS.js → usePageChat-BU6VEv0K.js} +1 -1
  60. package/dist/web/index.html +5 -4
  61. package/docs/BUSINESS_ASSURANCE.md +105 -0
  62. package/docs/user-guide.html +54 -5
  63. package/forgeqe.example.yaml +1 -0
  64. package/package.json +1 -1
  65. package/prompts/README.md +4 -0
  66. package/prompts/api-tests.md +2 -0
  67. package/prompts/brain.md +11 -0
  68. package/prompts/business-interview.md +43 -0
  69. package/prompts/business-persona.md +3 -1
  70. package/prompts/business-strategist.md +44 -0
  71. package/prompts/heal.md +3 -1
  72. package/prompts/persona-own.md +47 -0
  73. package/prompts/requests-rule.md +14 -0
  74. package/prompts/test-agent.md +5 -2
  75. package/py/forgeqe_engine/cli.py +5 -0
  76. package/py/forgeqe_engine/recordsession.py +134 -9
  77. package/py/forgeqe_engine/webrecord_page.py +18 -9
  78. package/skills/cypress-typescript/SKILL.md +35 -0
  79. package/dist/web/assets/Agent-I5mRol1P.js +0 -7
  80. package/dist/web/assets/ApiTests--JGFKbOa.js +0 -10
  81. package/dist/web/assets/Browse-CIcl1j4N.js +0 -2
  82. package/dist/web/assets/CommandPalette-Dd0seTKQ.js +0 -1
  83. package/dist/web/assets/Cost-CGXZTXSz.js +0 -1
  84. package/dist/web/assets/Desktop-wfNhaxat.js +0 -1
  85. package/dist/web/assets/DesktopReview-Cxn3mgKO.js +0 -1
  86. package/dist/web/assets/Evidence-BZ-WKU9t.js +0 -1
  87. package/dist/web/assets/Features-JDMSSUpb.js +0 -1
  88. package/dist/web/assets/Flaky-DnHWlzlk.js +0 -1
  89. package/dist/web/assets/ForceGraph-BLYMwmyj.js +0 -1
  90. package/dist/web/assets/Impact-Dn5PPQ5Z.js +0 -3
  91. package/dist/web/assets/Jobs-CNhlUenm.js +0 -5
  92. package/dist/web/assets/KindPage-BPwFdxHe.js +0 -6
  93. package/dist/web/assets/Migration-DsGwJd40.js +0 -2
  94. package/dist/web/assets/Product-DsolJU4Y.js +0 -7
  95. package/dist/web/assets/Production-Cnh3wWiK.js +0 -1
  96. package/dist/web/assets/Quality-W_rQ6nRf.js +0 -1
  97. package/dist/web/assets/Readiness-IWAIRZwC.js +0 -1
  98. package/dist/web/assets/Record-DOImb7O7.js +0 -2
  99. package/dist/web/assets/Regression-DQuiIAFx.js +0 -5
  100. package/dist/web/assets/Reports-C16UVZtQ.js +0 -2
  101. package/dist/web/assets/Runs-CI8NJB1v.js +0 -2
  102. package/dist/web/assets/Steps-Bwe4WAjy.js +0 -2
  103. package/dist/web/assets/TestCases-D5oOzYL4.js +0 -1
  104. package/dist/web/assets/TestData-27tyi6OD.js +0 -2
  105. package/dist/web/assets/TestDebt-D9k3uAiS.js +0 -1
  106. package/dist/web/assets/Tosca-CMmixiPy.js +0 -3
  107. package/dist/web/assets/dataParts-D06wI4i1.js +0 -3
  108. package/dist/web/assets/filters-mFECJpMB.js +0 -1
  109. package/dist/web/assets/frame-BcGZt823.js +0 -4
  110. package/dist/web/assets/index-CotEpFLY.js +0 -75
  111. package/dist/web/assets/index-VgSzQGK8.css +0 -2
  112. package/dist/web/assets/qualityParts-Cfirt7dZ.js +0 -1
@@ -0,0 +1 @@
1
+ import{$n as e,Ar as t,Ir as n,Mn as r,Nr as i}from"./line-icons-CQ-3V8ax.js";import{B as a,R as o,Zt as s}from"./filters-CflRmNDz.js";function c(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return l(this.cover(t,n),t,n,e)}function l(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function u(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=1/0,a=i,o=-i,s=o;for(let c=0,l,u,d;c<t;++c)isNaN(u=+this._x.call(null,l=e[c]))||isNaN(d=+this._y.call(null,l))?n[c]=NaN:(n[c]=u,r[c]=d,u<i&&(i=u),u>o&&(o=u),d<a&&(a=d),d>s&&(s=d));if(i>o||a>s)return this;this.cover(i,a).cover(o,s);for(let i=0;i<t;++i)l(this,n[i],r[i],e[i]);return this}function d(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function f(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function p(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function m(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function h(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,h,g;for(p&&f.push(new m(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);h=f.pop();)if(!(!(p=h.node)||(o=h.x0)>u||(s=h.y0)>d||(c=h.x1)<i||(l=h.y1)<a)){if(p.length){var _=(o+c)/2,v=(s+l)/2;f.push(new m(p[3],_,v,c,l),new m(p[2],o,v,_,l),new m(p[1],_,s,c,v),new m(p[0],o,s,_,v)),(g=(t>=v)<<1|e>=_)&&(h=f[f.length-1],f[f.length-1]=f[f.length-1-g],f[f.length-1-g]=h)}else{var y=e-+this._x.call(null,p.data),b=t-+this._y.call(null,p.data),x=y*y+b*b;if(x<n){var S=Math.sqrt(n=x);i=e-S,a=t-S,u=e+S,d=t+S,r=p.data}}}return r}function g(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function _(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function v(){return this._root}function y(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function b(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new m(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new m(i,l,u,s,c)),(i=r[2])&&t.push(new m(i,a,u,l,c)),(i=r[1])&&t.push(new m(i,l,o,s,u)),(i=r[0])&&t.push(new m(i,a,o,l,u))}return this}function x(e){var t=[],n=[],r;for(this._root&&t.push(new m(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new m(a,o,s,u,d)),(a=i[1])&&t.push(new m(a,u,s,c,d)),(a=i[2])&&t.push(new m(a,o,d,u,l)),(a=i[3])&&t.push(new m(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function S(e){return e[0]}function C(e){return arguments.length?(this._x=e,this):this._x}function w(e){return e[1]}function T(e){return arguments.length?(this._y=e,this):this._y}function E(e,t,n){var r=new D(t??S,n??w,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function D(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ee(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var O=E.prototype=D.prototype;O.copy=function(){var e=new D(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ee(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ee(r));return e},O.add=c,O.addAll=u,O.cover=d,O.data=f,O.extent=p,O.find=h,O.remove=g,O.removeAll=_,O.root=v,O.size=y,O.visit=b,O.visitAfter=x,O.x=C,O.y=T;function k(e){return function(){return e}}function A(e){return(e()-.5)*1e-6}function te(e){return e.x+e.vx}function ne(e){return e.y+e.vy}function re(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=k(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=E(t,te,ne).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=A(r),_+=h*h),g===0&&(g=A(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),c(),o):e},o}function ie(e){return e.index}function j(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function ae(e){var t=ie,n=d,r,i=k(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||A(l),m=f.y+f.vy-d.y-d.vy||A(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=j(u,d.source)),typeof d.target!=`object`&&(d.target=j(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:k(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:k(+e),h(),f):i},f}var oe={value:()=>{}};function M(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new N(n)}function N(e){this._=e}function P(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}N.prototype=M.prototype={constructor:N,on:function(e,t){var n=this._,r=P(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=se(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=F(n[i],e.name,t);else if(t==null)for(i in n)n[i]=F(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new N(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function se(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function F(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=oe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var I=0,L=0,R=0,z=1e3,B,V,H=0,U=0,W=0,G=typeof performance==`object`&&performance.now?performance:Date,ce=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function K(){return U||=(ce(le),G.now()+W)}function le(){U=0}function q(){this._call=this._time=this._next=null}q.prototype=J.prototype={constructor:q,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?K():+n)+(t==null?0:+t),!this._next&&V!==this&&(V?V._next=this:B=this,V=this),this._call=e,this._time=n,me()},stop:function(){this._call&&(this._call=null,this._time=1/0,me())}};function J(e,t,n){var r=new q;return r.restart(e,t,n),r}function ue(){K(),++I;for(var e=B,t;e;)(t=U-e._time)>=0&&e._call.call(void 0,t),e=e._next;--I}function de(){U=(H=G.now())+W,I=L=0;try{ue()}finally{I=0,pe(),U=0}}function fe(){var e=G.now(),t=e-H;t>z&&(W-=t,H=e)}function pe(){for(var e,t=B,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:B=n);V=e,me(r)}function me(e){I||(L&&=clearTimeout(L),e-U>24?(e<1/0&&(L=setTimeout(de,Math.ceil(e-G.now()-W)+1)),R&&=clearInterval(R)):(R||=(H=G.now(),setInterval(fe,z)),I=1,ce(de)))}function Y(e,t,n){var r=new q;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var X=1664525,he=1013904223,Z=4294967296;function ge(){let e=1;return()=>(e=(X*e+he)%Z)/Z}function _e(e){return e.x}function ve(e){return e.y}var ye=10,be=Math.PI*(3-Math.sqrt(5));function xe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=J(d),l=M(`tick`,`end`),u=ge();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=ye*Math.sqrt(.5+t),a=t*be;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function Se(){var e,t,n,r,i=k(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=E(e,_e,ve).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=A(n),m+=d*d),f===0&&(f=A(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=A(n),m+=d*d),f===0&&(f=A(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:k(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function Ce(e){var t=k(.1),n,r,i;typeof e!=`function`&&(e=k(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:k(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),o(),a):e},a}function we(e){var t=k(.1),n,r,i;typeof e!=`function`&&(e=k(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:k(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),o(),a):e},a}var Q=n(i(),1);function Te(e,t){let n=[];for(let r of e)for(let e=0;e<12;e++)n.push({x:r.x+Math.cos(e/12*2*Math.PI)*t,y:r.y+Math.sin(e/12*2*Math.PI)*t});if(n.length<3)return n;let r=[...n].sort((e,t)=>e.x-t.x||e.y-t.y),i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e of[...r].reverse()){for(;o.length>=2&&i(o[o.length-2],o[o.length-1],e)<=0;)o.pop();o.push(e)}return[...a.slice(0,-1),...o.slice(0,-1)]}function Ee(e,t,n=3){let r=new Map;for(let t of e)t.from!==t.to&&r.set(t.to,[...r.get(t.to)||[],t.from]);let i=new Map,a=[t];for(let e=1;e<=n&&a.length;e++){let n=[];for(let o of a)for(let a of r.get(o)||[])a===t||i.has(a)||(i.set(a,e),n.push(a));a=n}return i}var De=e=>{let t=new Map;for(let n of e)n.from!==n.to&&(t.set(n.from,(t.get(n.from)||0)+1),t.set(n.to,(t.get(n.to)||0)+1));return t};function Oe(e,t=[]){let n=[...new Set(e.map(e=>e.type))];return[...t.filter(e=>n.includes(e)),...n.filter(e=>!t.includes(e)).sort((e,t)=>e.localeCompare(t))]}function ke(e,t,n=[],r={},i=1.6){let a=r.left||[],o=r.right||[],s=Oe(e,n),c=s.filter(e=>!a.includes(e)&&!o.includes(e)),l={left:s.filter(e=>a.includes(e)),right:s.filter(e=>o.includes(e))},u=t=>e.filter(e=>e.type===t).sort((e,t)=>e.id.localeCompare(t.id)),d=e=>u(e).every(e=>e.r<=3.5),f=e=>d(e)?26:130,p=e=>d(e)?26:92,m=(e,t)=>Math.max(1,Math.ceil(u(e).length/Math.max(2,Math.floor(t/f(e))))),h=e=>c.reduce((t,n)=>t+m(n,e)*p(n)+34+(d(n)?10:0),0),g=Math.max(0,...[...l.left,...l.right].map(e=>u(e).length*70+34)),_=Math.max(520,Math.max(...c.map(e=>Math.min(u(e).length,6)*f(e)),0));for(let e=0;e<3;e++)_=Math.max(520,Math.max(h(_),g)*i-(l.left.length?190:0)-(l.right.length?190:0));let v=Math.max(h(_),g,126),y=new Map;for(let e of t)e.from!==e.to&&(y.set(e.from,[...y.get(e.from)||[],e.to]),y.set(e.to,[...y.get(e.to)||[],e.from]));let b=new Map,x=[],S=[],C=-v/2;for(let e of c){let t=u(e),n=m(e,_),r=p(e),i=n*r+34+(d(e)?10:0);S.push({t:e,list:t,y0:C,lines:n,lineH:r}),x.push({type:e,x0:-_/2,x1:_/2,y0:C,y1:C+i-8}),C+=i}let w=e=>{let t=Math.ceil(e.list.length/e.lines);e.list.forEach((n,r)=>{let i=Math.floor(r/t),a=Math.min(t,e.list.length-i*t),o=r-i*t;b.set(n.id,{x:-_/2+(o+.5)*_/a,y:e.y0+34+(e.lineH<92?4:16)+i*e.lineH})})};S.forEach(w);let T={left:-_/2-24-95,right:_/2+24+95};for(let e of[`left`,`right`])l[e].forEach((t,n,r)=>{let i=u(t),a=v/r.length,o=-v/2+n*a;x.push({type:t,x0:T[e]-95,x1:T[e]+95,y0:o,y1:o+a-8,side:e}),i.forEach((t,n)=>b.set(t.id,{x:T[e],y:o+34+(n+.5)*(a-34-8)/i.length}))});for(let e=0;e<6;e++)for(let e of S){let t=new Set(e.list.map(e=>e.id)),n=e=>{let n=(y.get(e.id)||[]).filter(e=>!t.has(e)&&b.has(e));return n.length?n.reduce((e,t)=>e+b.get(t).x,0)/n.length:b.get(e.id).x},r=e.list.map(e=>({n:e,k:n(e)}));r.sort((e,t)=>e.k-t.k||e.n.id.localeCompare(t.n.id)),e.list=r.map(e=>e.n),w(e)}return{at:b,tiers:x,extent:{x0:l.left.length?T.left-95:-_/2,x1:l.right.length?T.right+95:_/2,y0:-v/2,y1:v/2}}}function Ae(e,t,n=[],r=1.6){let i=Oe(e,n),a=De(t),o=Math.max(3,...e.map(e=>e.r)),s=(2*o+7)*.58,c=i.map(t=>{let n=e.filter(e=>e.type===t).sort((e,t)=>(a.get(t.id)||0)-(a.get(e.id)||0)||e.id.localeCompare(t.id));return{type:t,spots:n.map((e,t)=>{let r=s*Math.sqrt(t+(n.length>1?.5:0)),i=t*2.39996323;return{id:e.id,x:Math.cos(i)*r,y:Math.sin(i)*r}}),r:(n.length>1?s*Math.sqrt(n.length-.5):0)+o+14}}),l=Math.max(1,Math.min(c.length,Math.round(Math.sqrt(c.length*r)))),u=[];for(let e=0;e<c.length;e+=l)u.push(c.slice(e,e+l));let d=u.map(e=>2*Math.max(...e.map(e=>e.r))+46),f=d.reduce((e,t)=>e+t,0),p=new Map,m=[],h=-f/2,g=0;u.forEach((e,t)=>{let n=e.reduce((e,t)=>e+2*t.r+46,0);g=Math.max(g,n);let r=-n/2,i=h+d[t]/2;for(let t of e){let e=r+t.r+23;m.push({type:t.type,x:e,y:i,r:t.r});for(let n of t.spots)p.set(n.id,{x:e+n.x,y:i+n.y});r+=2*t.r+46}h+=d[t]});let _=new Set(c.flatMap(e=>e.spots[0]?[e.spots[0].id]:[]));return{at:p,areas:m,extent:{x0:-g/2,x1:g/2,y0:-f/2-10,y1:f/2},hubs:_}}var je={ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`,ArrowDown:`down`};function Me(e,t,n){let r=e.find(e=>e.id===t);if(!r)return e[0]?.id??t;let i=null;for(let a of e){if(a.id===t)continue;let e=a.x-r.x,o=a.y-r.y,s=n===`right`?e:n===`left`?-e:n===`down`?o:-o,c=Math.abs(n===`left`||n===`right`?o:e);if(s<=.5)continue;let l=s+2*c;(!i||l<i.score)&&(i={id:a.id,score:l})}return i?.id??t}function Ne(e){if(!e.length)return null;let t=e.reduce((e,t)=>e+t.x,0)/e.length,n=e.reduce((e,t)=>e+t.y,0)/e.length;return e.reduce((e,r)=>Math.hypot(r.x-t,r.y-n)<Math.hypot(e.x-t,e.y-n)?r:e).id}var Pe=(e,t)=>e.filter(e=>e.from===t||e.to===t);function Fe(e,t){let n=Pe(e,t.node);if(!n.length)return{node:t.node};let r=n[(t.edge?n.findIndex(e=>e.id===t.edge):-1)+1];return r?{node:t.node,edge:r.id}:{node:t.node}}function Ie(e,t){let n=e.find(e=>e.id===t.edge);return n?{node:n.from===t.node?n.to:n.from}:t}function Le(e,t,n,r=48){let i=e.x+t.x*e.k,a=e.y+t.y*e.k;return i>=r&&i<=n.w-r&&a>=r&&a<=n.h-r?e:{...e,x:n.w/2-t.x*e.k,y:n.h/2-t.y*e.k}}function Re(e,t,n){let r=Math.min(4,Math.max(.1,e.k*t)),i=n.w/2,a=n.h/2;return{k:r,x:i-(i-e.x)/e.k*r,y:a-(a-e.y)/e.k*r}}var $=s(),ze=[`#ef6c35`,`#1f4e8c`,`#2b9b74`,`#e2447a`,`#7b8190`,`#f2a33a`,`#3f7fd8`,`#8e5bd6`,`#14a1b5`,`#b8456b`,`#5c8d3e`,`#c27c2c`],Be=`#e2447a`,Ve=`var(--color-muted)`,He=150,Ue=14,We=40;function Ge({title:n,nodes:i,edges:s,colourOfType:c,types:l,typesTitle:u,picked:d,onPick:f,detail:p,onRefresh:m,refreshing:h,ringOf:g,groupByType:_,edgesPickable:v=!0,height:y,hint:b,bare:x,colourOf:S,legend:C,lit:w,onHover:T,namedOf:E,outlines:D,outlineColourOf:ee,onGroupPick:O,spacing:k=1,layout:A=`force`,order:te,sides:ne,quietLines:ie}){let j=(0,Q.useRef)(null),[,oe]=(0,Q.useState)(0),[M,N]=(0,Q.useState)({x:0,y:0,k:1}),[P,se]=(0,Q.useState)(!1),F=(0,Q.useRef)(!1),I=(0,Q.useRef)(!1),L=(0,Q.useRef)(()=>{}),R=(0,Q.useRef)(null),z=(0,Q.useRef)({}),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(!1),[ce,K]=(0,Q.useState)(``),le=(0,Q.useId)(),{nodes:q,edges:J}=(0,Q.useMemo)(()=>{let e=i.map((e,t)=>({id:e.id,n:e,x:Math.cos(t*2.4)*(40+t*1.5),y:Math.sin(t*2.4)*(40+t*1.5)})),t=new Set(e.map(e=>e.id)),n=new Set;return{nodes:e,edges:s.filter(e=>t.has(e.from)&&t.has(e.to)&&!n.has(e.id)&&!!n.add(e.id)).map(e=>({id:e.id,source:e.from,target:e.to,from:e.from,to:e.to,label:e.label}))}},[i,s]);(0,Q.useEffect)(()=>{if(A!==`force`){let e=q.map(e=>({id:e.id,type:e.n.type,r:e.n.r??6})),t=J.map(e=>({from:e.from,to:e.to})),n=j.current,r=n&&n.clientHeight>260?n.clientWidth/(n.clientHeight-150):1.6,i=A===`tiers`?ke(e,t,te,ne,Math.min(3.2,Math.max(.8,r))):Ae(e,t,te);for(let e of q){let t=i.at.get(e.id);t&&(e.x=t.x,e.y=t.y,e.vx=0,e.vy=0)}z.current={extent:i.extent,...`tiers`in i?{tiers:i.tiers}:{areas:i.areas,hubs:i.hubs}};let a=xe(q).alpha(0).stop(),o=0;return a.on(`tick`,()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>oe(e=>e+1))}),R.current=a,F.current=!1,oe(e=>e+1),()=>{a.stop(),cancelAnimationFrame(o)}}z.current={};let e=[...new Set(q.map(e=>e.n.type))],t=!!(_&&e.length>1),n=new Map,r=new Map,i=new Map;for(let e of q)n.set(e.n.type,(n.get(e.n.type)||0)+1),r.set(e.n.type,(r.get(e.n.type)||0)+(e.n.r??6)),i.set(e.n.type,Math.max(i.get(e.n.type)||0,e.n.r??6));let a=e=>Math.sqrt(n.get(e)||1)*(2*((r.get(e)||6)/(n.get(e)||1))+14)+2*(i.get(e)||6)+(D?60:30),o=e.reduce((e,t)=>e+a(t),0),s=Math.max(140,o/(2*Math.PI)),c=0,l=new Map(e.map(e=>{let n=c+a(e)/2;c+=a(e);let r=n/o*2*Math.PI;return[e,t?{x:Math.cos(r)*s,y:Math.sin(r)*s}:{x:0,y:0}]})),u=t?D?.3:.12:.07,d=xe(q).force(`link`,ae(J).id(e=>e.id).distance(80*k).strength(e=>t&&e.source.n.type!==e.target.n.type?D?.01:.05:t?.12:.3)).force(`charge`,Se().strength((q.length>300?-60:-150)*k).distanceMax(360*k)).force(`collide`,re(e=>(e.n.r??6)+10)).force(`x`,Ce(e=>l.get(e.n.type).x).strength(u)).force(`y`,we(e=>l.get(e.n.type).y).strength(u)).alphaDecay(.028);d.stop(),d.tick(260),F.current=!1;let f=0;return d.on(`tick`,()=>{cancelAnimationFrame(f),f=requestAnimationFrame(()=>oe(e=>e+1))}),d.on(`end`,()=>{I.current||L.current()}),d.alpha(.2).restart(),R.current=d,oe(e=>e+1),()=>{d.stop(),cancelAnimationFrame(f)}},[q,J,_,D,k,A,te?.join(`\0`),JSON.stringify(ne??{}),A!==`force`&&P]);let ue=()=>{let e=j.current;if(!e||!q.length)return;let t=q.map(e=>e.x??0),n=q.map(e=>e.y??0),r=z.current.extent,[i,a,o,s]=r?[r.x0-30,r.x1+30,r.y0-30,r.y1+120]:[Math.min(...t)-40,Math.max(...t)+120,Math.min(...n)-60,Math.max(...n)+40],c=Math.max(r?.3:.75,Math.min(1.6,e.clientWidth/Math.max(1,a-i),e.clientHeight/Math.max(1,s-o)));N({k:c,x:e.clientWidth/2-(i+a)/2*c,y:e.clientHeight/2-(o+s)/2*c})};L.current=ue,(0,Q.useEffect)(()=>{!F.current&&q.length&&j.current?.clientWidth&&(F.current=!0,ue())}),(0,Q.useEffect)(()=>{F.current=!1},[P]),(0,Q.useEffect)(()=>{let e=j.current;if(!e)return;let t=t=>{I.current=!0,t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;N(e=>{let n=Math.min(4,Math.max(.1,e.k*Math.exp(-t.deltaY*(t.ctrlKey?.01:.0015))));return{k:n,x:r-(r-e.x)/e.k*n,y:i-(i-e.y)/e.k*n}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let de=(0,Q.useRef)(null),fe=(e,t)=>{I.current=!0,e.stopPropagation(),G(!1),e.target.setPointerCapture?.(e.pointerId),de.current={kind:t?`node`:`pan`,id:t,sx:e.clientX,sy:e.clientY,vx:M.x,vy:M.y,moved:!1}},pe=e=>{let t=de.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(Math.abs(n)+Math.abs(r)>3&&(t.moved=!0),t.kind===`pan`)N(e=>({...e,x:t.vx+n,y:t.vy+r}));else if(t.moved){let n=q.find(e=>e.id===t.id),r=j.current.getBoundingClientRect();n&&(n.fx=(e.clientX-r.left-M.x)/M.k,n.fy=(e.clientY-r.top-M.y)/M.k,R.current?.alphaTarget(.15).restart())}},me=()=>{let e=de.current;if(de.current=null,e){if(e.kind===`node`){let t=q.find(t=>t.id===e.id);t&&(t.fx=null,t.fy=null),R.current?.alphaTarget(0),e.moved||(f(d?.kind===`node`&&d.id===e.id?null:{kind:`node`,id:e.id}),V({node:e.id}))}else e.moved||f(null)}},Y=new Map(q.map(e=>[e.id,e])),X=new Set,he=new Set,Z=w===void 0?d?.kind===`node`?d.id:!d&&H?H:null:null;if(w){for(let e of w)X.add(e);for(let e of J)w.has(e.from)&&w.has(e.to)&&he.add(e.id)}else if(w!==null){if(Z){X.add(Z);for(let e of J)(e.from===Z||e.to===Z)&&(he.add(e.id),X.add(e.from),X.add(e.to))}else if(d?.kind===`edge`){let e=J.find(e=>e.id===d.id);e&&(he.add(e.id),X.add(e.from),X.add(e.to))}}let ge=w===void 0?!!(Z||d):!!w,_e=q.length<=(A===`areas`?40:He),ve=J.length<=We,ye=e=>`M ${e.x-e.r} ${e.y} a ${e.r} ${e.r} 0 1 0 ${2*e.r} 0 a ${e.r} ${e.r} 0 1 0 ${-2*e.r} 0 Z`,be=D&&z.current.areas?z.current.areas.map(e=>({t:e.type,d:ye(e),top:{x:e.x,y:e.y-e.r-6/M.k},colour:ee?.(e.type)??c(e.type)})):D?[...new Set(q.map(e=>e.n.type))].map(e=>{let t=q.filter(t=>t.n.type===e),n=Math.max(...t.map(e=>e.n.r??6))+12,r=Te(t.map(e=>({x:e.x??0,y:e.y??0})),n),i=r.reduce((e,t)=>t.y<e.y?t:e,r[0]??{x:0,y:0});return{t:e,d:r.length>2?`M ${r.map(e=>`${e.x.toFixed(1)} ${e.y.toFixed(1)}`).join(` L `)} Z`:``,top:{x:i.x,y:i.y-6/M.k},colour:ee?.(e)??c(e)}}):[],Ee=new Map,De=e=>{let t=Y.get(e.from),n=Y.get(e.to);if(!t||!n)return null;let r=[e.from,e.to].sort().join(`|`),i=Ee.get(r)??0;Ee.set(r,i+1);let[a,o,s,c]=[t.x??0,t.y??0,n.x??0,n.y??0];if(A===`tiers`){let e=i*12,t=Math.abs(s-a)>Math.abs(c-o)*1.4,[n,r,l,u]=Math.abs(c-o)<1?[a,o-46-e,s,c-46-e]:t?[(a+s)/2,o+e,(a+s)/2,c+e]:[a+e,(o+c)/2,s+e,(o+c)/2];return{d:`M${a},${o} C${n},${r} ${l},${u} ${s},${c}`,mx:.125*a+.375*n+.375*l+.125*s,my:.125*o+.375*r+.375*u+.125*c}}let l=s-a,u=c-o,d=Math.hypot(l,u)||1,f=((A===`areas`?.1:.18)+i*.14)*d,p=(a+s)/2-u/d*f,m=(o+c)/2+l/d*f;return{d:`M${a},${o} Q${p},${m} ${s},${c}`,mx:.25*a+.5*p+.25*s,my:.25*o+.5*m+.25*c}},Oe=e=>Y.get(e)?.n.name??e,ze=e=>{if(!e)return K(``);let t=Y.get(e.node);if(!t)return K(``);let n=Pe(J,e.node),r=e.edge?n.find(t=>t.id===e.edge):void 0;if(r){let t=r.from===e.node?r.to:r.from;return K(`${r.label}: ${Oe(r.from)} to ${Oe(r.to)}, ${n.indexOf(r)+1} of ${n.length}. F goes to ${Oe(t)}.`)}K(`${t.n.name}, ${t.n.type}. ${n.length} relationship${n.length===1?``:`s`}.`)},Ge=()=>({w:j.current?.clientWidth??0,h:j.current?.clientHeight??0}),Ke=e=>{V(e),T?.(e?.node??null),ze(e);let t=e&&Y.get(e.node);t&&N(e=>Le(e,{x:t.x??0,y:t.y??0},Ge()))},qe=()=>q.map(e=>({id:e.id,x:e.x??0,y:e.y??0})),Je=e=>{if(e.target!==e.currentTarget||e.altKey||e.ctrlKey||e.metaKey)return;G(!0);let t=B&&Y.has(B.node)?B:null,n=je[e.key],r=!0;if((n&&e.shiftKey||[`+`,`=`,`-`,`_`].includes(e.key))&&(I.current=!0),n&&e.shiftKey)N(e=>({...e,x:e.x+(n===`left`?60:n===`right`?-60:0),y:e.y+(n===`up`?60:n===`down`?-60:0)}));else if(n){let e=t?.node??Ne(qe());e&&Ke(t?{node:Me(qe(),e,n)}:{node:e})}else if(e.key===`Home`){let e=Ne(qe());e&&Ke({node:e})}else if(e.key===`r`||e.key===`R`)t?Ke(Fe(J,t)):r=!1;else if(e.key===`f`||e.key===`F`)t?.edge?Ke(Ie(J,t)):r=!1;else if(e.key===`Enter`||e.key===` `){if(t){let e=t.edge?{kind:`edge`,id:t.edge}:{kind:`node`,id:t.node},n=d?.kind!==e.kind||d.id!==e.id;f(n?e:null),K(n?`Details of ${t.edge?`the relationship`:Oe(t.node)} are open beside the graph. Escape closes them.`:`Details closed.`)}else{let e=Ne(qe());e&&Ke({node:e})}}else e.key===`Escape`?d?(f(null),K(`Details closed.`)):P?se(!1):r=!1:e.key===`+`||e.key===`=`?N(e=>Re(e,1.25,Ge())):e.key===`-`||e.key===`_`?N(e=>Re(e,.8,Ge())):e.key===`0`?ue():r=!1;r&&e.preventDefault()},Ye=W&&B&&Y.has(B.node)?B:null;return(0,$.jsxs)(`div`,{className:a(`flex flex-col overflow-hidden border border-line bg-bg`,P?`fixed inset-0 z-50`:x?`relative size-full border-0`:`relative rounded-[12px]`),style:P||x?void 0:{height:y??`max(600px, calc(var(--screen) - 280px))`},children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-[14px] font-semibold text-ink`,children:n}),b&&(0,$.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:b})]}),m&&(0,$.jsxs)(o,{size:`sm`,disabled:h,onClick:m,"data-tip":`Read the population again`,children:[(0,$.jsx)(r,{"aria-hidden":`true`}),`Refresh`]}),(0,$.jsx)(o,{size:`icon-sm`,variant:`outline`,"aria-pressed":P,"aria-label":P?`Leave full screen`:`Full screen`,"data-tip":P?`Leave full screen`:`Full screen`,onClick:()=>se(e=>!e),children:(0,$.jsx)(e,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{ref:j,tabIndex:0,role:`application`,"aria-roledescription":`graph`,"aria-label":`${n}: ${q.length} nodes and ${J.length} relationships`,"aria-describedby":le,className:`relative flex-1 touch-none overflow-hidden select-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,onKeyDown:Je,onBlur:e=>{e.target===e.currentTarget&&(G(!1),T?.(null))},style:{backgroundImage:`radial-gradient(var(--color-line) 1px, transparent 1px)`,backgroundSize:`18px 18px`},onPointerDown:e=>fe(e),onPointerMove:pe,onPointerUp:me,onPointerCancel:me,children:[(0,$.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 size-full`,children:(0,$.jsxs)(`g`,{transform:`translate(${M.x},${M.y}) scale(${M.k})`,children:[(z.current.tiers||[]).map(e=>{let t=c(e.type);return(0,$.jsxs)(`g`,{className:`pointer-events-none`,opacity:ge?.55:1,children:[(0,$.jsx)(`rect`,{x:e.x0,y:e.y0,width:e.x1-e.x0,height:e.y1-e.y0,rx:14,fill:t,fillOpacity:.05,stroke:t,strokeOpacity:.3,strokeWidth:1.2/M.k}),(0,$.jsx)(`text`,{x:e.x0+14,y:e.y0+20,fill:t,fontWeight:600,fontSize:11,style:{letterSpacing:`0.06em`,textTransform:`uppercase`},children:e.type})]},`tier:${e.type}`)}),be.map(e=>(0,$.jsxs)(`g`,{className:`pointer-events-none`,opacity:ge?.4:1,children:[e.d&&(0,$.jsx)(`path`,{d:e.d,fill:e.colour,fillOpacity:.05,stroke:e.colour,strokeOpacity:.45,strokeWidth:1.2/M.k,strokeLinejoin:`round`}),(0,$.jsx)(`text`,{x:e.top.x,y:e.top.y,textAnchor:`middle`,fill:e.colour,fontWeight:600,fontSize:Math.max(10,12/M.k),className:O?`pointer-events-auto cursor-pointer hover:underline`:void 0,onPointerDown:O?e=>e.stopPropagation():void 0,onClick:O?()=>O(e.t):void 0,"data-tip":O?`Open ${e.t}`:void 0,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:4/M.k},children:e.t})]},`hull:${e.t}`)),J.map(e=>{let t=De(e);if(!t)return null;let n=he.has(e.id);return(0,$.jsxs)(`g`,{opacity:ge&&!n?.35:1,children:[(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:n?Be:Ve,strokeOpacity:n?1:ie?.2:A===`areas`?J.length>60?.12:.22:A===`tiers`&&J.length>60?.14:.45,strokeWidth:n?2.2:1}),Ye?.edge===e.id&&(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:`var(--color-ink)`,strokeWidth:2.5,strokeDasharray:`4 3`}),v&&(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:`transparent`,strokeWidth:10,className:`cursor-pointer`,onPointerDown:e=>e.stopPropagation(),onClick:t=>(t.stopPropagation(),f(d?.kind===`edge`&&d.id===e.id?null:{kind:`edge`,id:e.id}))}),(ve&&A!==`areas`&&!ie||n)&&e.label&&(0,$.jsx)(`text`,{x:t.mx,y:t.my,textAnchor:`middle`,fontSize:A===`tiers`?9.5:8,fill:n?Be:`var(--color-muted)`,className:`pointer-events-none`,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:3},children:e.label})]},e.id)}),q.map(e=>{let t=X.has(e.id),n=ge&&!t,r=e.n.r??6,i=g?.(e.id),a=A===`areas`?t||M.k>=3||!!z.current.hubs?.has(e.id)||Ye?.node===e.id||!!E?.(e.id):A===`tiers`?r>3.5&&_e||t||M.k>=2||Ye?.node===e.id||!!E?.(e.id):_e||t||M.k>=1.3||r>=12||Ye?.node===e.id||!!E?.(e.id);return(0,$.jsxs)(`g`,{transform:`translate(${e.x??0},${e.y??0})`,opacity:n?i?.75:.3:1,className:`cursor-pointer`,onPointerDown:t=>fe(t,e.id),onPointerEnter:()=>(U(e.id),T?.(e.id)),onPointerLeave:()=>(U(t=>t===e.id?null:t),T?.(null)),children:[i&&(0,$.jsx)(`circle`,{r:r+3.5,fill:`none`,stroke:i,strokeWidth:2.5}),d?.kind===`node`&&d.id===e.id&&(0,$.jsx)(`circle`,{r:r+5,fill:`none`,stroke:Be,strokeWidth:2}),Ye?.node===e.id&&(0,$.jsx)(`circle`,{r:r+9,fill:`none`,stroke:`var(--color-ink)`,strokeWidth:2,strokeDasharray:Ye.edge?`2 3`:void 0}),(0,$.jsx)(`circle`,{r,fill:S?S(e.id):c(e.n.type),stroke:`var(--color-bg)`,strokeWidth:2}),a&&(0,$.jsx)(`text`,{x:A===`tiers`?0:r+4,y:A===`tiers`?r+15:3,textAnchor:A===`tiers`?`middle`:void 0,fontSize:A===`tiers`?12:9,fill:`var(--color-ink-2)`,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:3},children:e.n.name})]},e.id)})]})}),p&&(0,$.jsxs)(`section`,{"aria-label":p.title,className:`absolute top-3 right-3 z-10 flex max-h-[calc(100%-24px)] w-[300px] max-w-[calc(100%-24px)] flex-col overflow-y-auto rounded-[12px] border border-line bg-bg shadow-lg`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-3`,children:[(0,$.jsx)(`h4`,{className:`m-0 flex-1 text-[14px] font-semibold text-ink`,children:p.title}),p.pill&&(0,$.jsx)(`span`,{className:`rounded-full px-2.5 py-0.5 text-[12px] font-medium text-white`,style:{background:p.pill.colour},children:p.pill.text}),(0,$.jsx)(o,{variant:`icon`,size:`icon-sm`,"aria-label":`Close the details`,"data-tip":`Close the details`,onClick:()=>f(null),children:(0,$.jsx)(t,{"aria-hidden":`true`})})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3 px-4 py-3 text-[13px]`,children:p.body})]}),(0,$.jsxs)(`section`,{"aria-label":u,className:`absolute bottom-3 left-3 z-10 max-w-[calc(100%-24px)] rounded-[12px] border border-line bg-bg px-4 py-3 shadow-md`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`h4`,{className:`m-0 mb-2 text-[11px] font-semibold tracking-[0.08em] text-[color:var(--color-warn)] uppercase`,children:u}),(0,$.jsxs)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-x-4 gap-y-1.5 p-0 text-[12.5px] text-ink-2 @md:grid-cols-2 @2xl:grid-cols-3`,children:[C?C.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:a(`size-2.5 flex-none rounded-full`,e.ring&&`size-3 border-2`),style:e.ring?{borderColor:e.colour}:{background:e.colour}}),e.label,e.n!==void 0&&(0,$.jsx)(`span`,{className:`text-muted tabular-nums`,children:e.n})]},e.label)):l.slice(0,Ue).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 flex-none rounded-full`,style:{background:c(e)}}),e]},e)),!C&&l.length>Ue&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,l.length-Ue,` more`]})]})]}),(0,$.jsx)(`p`,{id:le,className:a(`absolute top-3 left-3 z-10 m-0 max-w-[calc(100%-340px)] rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[12px] text-ink-2 shadow-md`,!W&&`sr-only`),children:`Arrows move to the nearest one · R its relationships · F follows one · Enter details · Escape closes · + − zoom · 0 fits · Shift+arrows pan`})]}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,children:ce})]})}function Ke({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[96px_1fr] gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-muted`,children:[e,`:`]}),(0,$.jsx)(`span`,{className:`min-w-0 text-ink [overflow-wrap:anywhere]`,children:t})]})}function qe({title:e,children:t}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-t border-line-soft pt-3`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-ink`,children:[e,`:`]}),t]})}var Je=({children:e})=>(0,$.jsx)(`span`,{className:`rounded-full border border-line px-2.5 py-0.5 text-[12px] text-ink-2`,children:e});export{ze as a,Y as c,Ge as i,J as l,Ke as n,Ee as o,qe as r,K as s,Je as t,M as u};
@@ -0,0 +1,2 @@
1
+ import{Ir as e,L as t,M as n,Mn as r,Nr as i,Nt as a,T as o,ht as s,j as c,ln as l,ot as u}from"./line-icons-CQ-3V8ax.js";import{B as d,It as f,R as p,V as m,Zt as h,f as g,i as _,l as v,m as y,o as b,u as x,z as S}from"./filters-CflRmNDz.js";import{Ot as C,R as w,V as T,lt as E,r as D,t as O,ut as k,vt as A}from"./frame--ur6lpMR.js";import{n as j}from"./markdown-nTIj9lyp.js";import{i as M,r as N}from"./index-GLMqsotN.js";import{t as P}from"./segmented-CAf_qz5Z.js";import{r as F}from"./families-zlLgApNV.js";var I=e(i(),1),L=h(),R={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},z=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},B=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function V(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var H=50;function U({r:e}){let r=V(e),i=e.scope===`page`?s:r.tone===`pass`?c:r.tone===`fail`?t:n;return(0,L.jsx)(i,{size:16,"aria-label":r.label,className:d(`flex-none`,r.tone===`pass`?`text-pass`:r.tone===`fail`?`text-fail`:r.tone===`warn`?`text-warn`:`text-muted`)})}var W=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},G=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function K({title:e,note:t,children:n,className:r}){return(0,L.jsxs)(`section`,{className:d(`flex min-w-0 flex-col rounded-[14px] card border px-4 py-3.5`,r),children:[(0,L.jsx)(`h3`,{className:`m-0 text-[15px] font-semibold`,children:e}),t&&(0,L.jsx)(`p`,{className:`m-0 mt-0.5 text-[12.5px] text-muted`,children:t}),(0,L.jsx)(`div`,{className:`mt-3 flex min-w-0 flex-col`,children:n})]})}function q({part:e,whole:t,tone:n,label:r}){return(0,L.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,L.jsx)(`span`,{className:d(`block h-full rounded-full transition-[width] duration-200 ease-out`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,L.jsx)(`span`,{className:`text-[12.5px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function J({days:e}){let[t,n]=(0,I.useState)(null),r=e.slice(-30);if(!r.length)return(0,L.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[12.5px] text-ink-2`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,L.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[11px] text-muted tabular-nums`,children:s.map(e=>(0,L.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,L.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,L.jsx)(`span`,{"aria-hidden":`true`,className:d(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,L.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-[3px]`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,L.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,L.jsxs)(`div`,{className:d(`flex w-full flex-col justify-end gap-[2px] transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,L.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,L.jsx)(`span`,{className:d(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,L.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-surface-muted px-3 py-2 text-[12.5px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,L.jsx)(`b`,{className:`block text-ink`,children:W(l.day)}),(0,L.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,G([l]),`%`]}),(0,L.jsx)(`span`,{className:`block text-muted`,children:m(l.runs,`run`)})]})]}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-[3px] text-[11px] text-muted`,children:r.map((e,t)=>(0,L.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,L.jsx)(`span`,{className:d(t/c%2==1&&`hidden @2xl:inline`),children:W(e.day)})},e.day))})]}),(0,L.jsxs)(`table`,{className:`sr-only`,children:[(0,L.jsx)(`caption`,{children:`Cases by day`}),(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Day`}),(0,L.jsx)(`th`,{children:`Runs`}),(0,L.jsx)(`th`,{children:`Passed`}),(0,L.jsx)(`th`,{children:`Failed`})]})}),(0,L.jsx)(`tbody`,{children:r.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:e.day}),(0,L.jsx)(`td`,{children:e.runs}),(0,L.jsx)(`td`,{children:e.passed}),(0,L.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function Y({project:e,build:n,onBuilt:i}){let[o,s]=(0,I.useState)(n),[c,h]=(0,I.useState)(``),_=!!o?.running;(0,I.useEffect)(()=>{if(!_)return;let e=setInterval(async()=>{try{let e=await f.buildStatus();s(e),e&&!e.running&&i()}catch{}},1200);return()=>clearInterval(e)},[_,i]);let b=e.cases?Math.round(e.passed/e.cases*100):null,C=G(e.days.slice(-7)),D=G(e.days.slice(-14,-7)),O=C!==null&&D!==null?C-D:null,A=[{label:`Runs`,value:String(e.runs),sub:e.runs?`${W(String(e.from).slice(0,10))} – ${W(String(e.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(e.cases),sub:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,L.jsxs)(`span`,{className:d(e.failed&&`text-fail`),children:[e.failed,` failed`]})]})},{label:`Tokens`,value:T(e.tokens),sub:e.cost?w(e.cost.amount,e.cost.currency):void 0}];return(0,L.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,L.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:e.page?`The HTML report was built ${z(e.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),e.page&&(0,L.jsxs)(p,{size:`sm`,"data-tip":`Open the HTML report`,onClick:async()=>h(await x(e.page.file)),children:[(0,L.jsx)(u,{"aria-hidden":`true`}),`Report`]}),(0,L.jsx)(p,{size:`sm`,variant:`outline`,disabled:_,"data-tip":e.page?`Build the HTML report again`:`Build the HTML report`,onClick:async()=>{h(``);try{s(await f.build())}catch(e){h(e.message)}},children:_?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(y,{state:`working`,px:14}),`Building…`]}):e.page?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(r,{"aria-hidden":`true`}),`Rebuild`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(a,{"aria-hidden":`true`}),`Build`]})})]}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:c}),o&&(o.running||o.ok===!1)&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!o.running&&(0,L.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,L.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-3 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:o.lines.length?o.lines.join(`
2
+ `):`Starting…`})]}),e.runs?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(k,{label:`Project numbers`,children:[(0,L.jsx)(E,{label:`Pass rate`,big:!0,value:b===null?`–`:`${b}%`,tone:b!==null&&b<80?`text-fail`:void 0,change:O===null?void 0:{text:O===0?`Same`:`${O>0?`+`:`−`}${Math.abs(O)} ${Math.abs(O)===1?`point`:`points`}`,dir:O>0?`up`:O<0?`down`:`same`,good:O>0,against:O===0?`as the week before`:`on the week before`}}),A.map(e=>(0,L.jsx)(E,{label:e.label,value:e.value,note:e.sub},e.label))]}),(0,L.jsx)(K,{title:`Cases by day`,note:`The last ${m(Math.min(30,e.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,L.jsx)(J,{days:e.days})}),(0,L.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,L.jsx)(K,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:e.failing.length===0?(0,L.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,L.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.failing.slice(0,8).map(e=>(0,L.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(t,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[14px]`,"data-tip":e.title,children:[e.id&&(0,L.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,L.jsx)(`span`,{className:`flex-none text-[12px] text-muted`,children:N(e.lastFailed)})]}),(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-3 pl-[22px]`,children:[(0,L.jsx)(q,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[12.5px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,L.jsx)(K,{title:`Defects`,note:`Failures grouped by their cause.`,children:e.defects.length===0?(0,L.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,L.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.defects.slice(0,8).map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,"data-tip":e.title,children:e.title}),(0,L.jsxs)(`span`,{className:`text-[12.5px] whitespace-nowrap text-muted tabular-nums`,children:[m(e.cases,`case`),` · `,m(e.runs,`run`),e.lastSeen?` · ${N(e.lastSeen)}`:``]})]},e.title))})}),(0,L.jsx)(K,{title:`Flaky`,note:`Cases that both passed and failed.`,children:e.flaky.length===0?(0,L.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,L.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.flaky.slice(0,8).map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,L.jsxs)(`span`,{className:`min-w-0 truncate text-[14px]`,"data-tip":e.title,children:[e.id&&(0,L.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink-2`,children:e.id}),` `,e.title]}),(0,L.jsx)(q,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,L.jsx)(K,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:e.kinds.length===0?(0,L.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,L.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.kinds.map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[14px]`,children:R[e.scope]||e.scope}),(0,L.jsx)(`span`,{className:`text-[12.5px] text-muted tabular-nums`,children:m(e.runs,`run`)}),(0,L.jsx)(q,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,L.jsx)(v,{icon:u,title:`No runs yet`,action:(0,L.jsxs)(`a`,{className:S({size:`sm`}),href:g(),"data-tip":`Start a chat`,children:[(0,L.jsx)(l,{"aria-hidden":`true`}),`Chat`]}),children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})}function X({sub:e}){let[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(``),[a,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[m,h]=(0,I.useState)(`all`),[g,v]=(0,I.useState)(H),[y,S]=(0,I.useState)(``),w=(0,I.useCallback)(()=>{f.list().then(n,e=>i(e.message))},[]);(0,I.useEffect)(w,[w]);let T=e===`project`?`project`:`execution`,E=t?.rows??null,k=c.toLowerCase().split(/\s+/).filter(Boolean),W=(0,I.useMemo)(()=>(E||[]).filter(e=>(!a||e.scope===a)&&k.every(t=>`${e.title} ${e.id} ${R[e.scope]}`.toLowerCase().includes(t))),[E,a,c]),G=W.filter(e=>V(e).tone===`fail`).length,K=m===`failed`?W.filter(e=>V(e).tone===`fail`):W;(0,I.useEffect)(()=>v(H),[a,c,m]);let q=[...new Set((E||[]).map(e=>e.scope))];return(0,L.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,L.jsx)(D,{}),(0,L.jsxs)(`main`,{className:d(O,`@container flex-auto gap-4`),children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,L.jsx)(C,{pixel:A.reports,size:`lg`}),(0,L.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,L.jsx)(P,{label:`Runs and reports`,links:F,current:T===`project`?`reports-project`:`reports`})]}),r&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:r}),!t&&!r&&(0,L.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&T===`project`&&(0,L.jsx)(Y,{project:t.project,build:t.build,onBuilt:w}),t&&T===`execution`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(_,{id:`report-search`,label:`Find a report`,value:c,onChange:l}),[[`all`,`All`,W.length],[`failed`,`Failed`,G]].map(([e,t,n])=>(0,L.jsxs)(`button`,{type:`button`,"aria-pressed":m===e,onClick:()=>h(e),className:d(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium`,m===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,L.jsx)(`span`,{className:d(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),q.length>1&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,L.jsxs)(b,{size:`sm`,id:`report-kind`,value:a,onChange:e=>s(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,L.jsx)(`option`,{value:``,children:`Every kind`}),q.map(e=>(0,L.jsx)(`option`,{value:e,children:R[e]},e))]})]})]}),y&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:y}),(0,L.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,L.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,L.jsx)(`span`,{children:`Report`}),(0,L.jsx)(`span`,{children:`Kind`}),(0,L.jsx)(`span`,{children:`Result`}),(0,L.jsx)(`span`,{className:`text-right`,children:`When`}),(0,L.jsx)(`span`,{})]}),(0,L.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-1.5`,children:[K.length===0&&(0,L.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:t.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),K.slice(0,g).map((e,t,n)=>{let r=M(e.startedAt),i=V(e);return(0,L.jsxs)(`li`,{className:`contents`,children:[(t===0||M(n[t-1].startedAt)!==r)&&(0,L.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,L.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 hover:bg-surface-muted @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,L.jsx)(U,{r:e}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,L.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),(0,L.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[R[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,N(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,L.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:R[e.scope]}),(0,L.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,L.jsx)(`span`,{className:d(i.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:i.label}),B(e.ms)?` · ${B(e.ms)}`:``]}),(0,L.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,"data-tip":z(e.startedAt),children:N(e.startedAt)}),(0,L.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,L.jsx)(p,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.title} in a new tab`,"data-tip":`Open the report of ${e.title} in a new tab`,onClick:async()=>S(await x(e.report)),children:(0,L.jsx)(u,{"aria-hidden":`true`})}):(0,L.jsx)(j,{path:e.folder,children:`Folder`})})]})]},e.key)})]}),(K.length>g||t.total>t.rows.length)&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-line-soft px-4 py-2.5 text-[13px] text-muted`,children:[(0,L.jsxs)(`span`,{children:[`Showing `,Math.min(g,K.length),` of `,K.length,t.total>t.rows.length?` (the newest ${t.rows.length} of ${t.total})`:``]}),K.length>g&&(0,L.jsxs)(p,{size:`sm`,onClick:()=>v(g+H),children:[(0,L.jsx)(o,{"aria-hidden":`true`}),`More (`,Math.min(H,K.length-g),`)`]})]})]})]})]})]})}export{X as Reports};
@@ -1,4 +1,4 @@
1
- import{A as e,Ar as t,Bn as n,C as r,Fn as i,Ir as a,J as o,Nr as s,Ot as c,T as l,Tt as u,Un as d,Vn as f,Wn as p,Z as m,_n as h,cn as ee,dt as te,ft as g,ht as ne,jt as _,kr as re,lr as ie,nn as v,o as ae,pt as oe,qn as se,rr as ce,tn as le,tt as ue,wt as de,yt as y,z as fe}from"./line-icons-CQ-3V8ax.js";import{B as b,R as x,V as S,_ as pe,c as me,h as C,m as w,qt as he}from"./filters-mFECJpMB.js";import{Dt as T,Lt as E,Ut as D,Yt as O,gt as ge,kt as k}from"./frame-BcGZt823.js";import{d as _e,l as A,u as j}from"./index-CotEpFLY.js";import{c as ve,i as ye,o as M,r as N,s as P,t as be}from"./thread-CyTIuLgk.js";var F=a(s(),1),I=he();function L({diff:e,className:t}){let n=0,r=0,i=e.split(`
2
- `).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,I.jsx)(`div`,{className:b(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,I.jsx)(`table`,{className:`w-full border-collapse`,children:(0,I.jsx)(`tbody`,{children:i.map(e=>(0,I.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,I.jsx)(`td`,{"aria-hidden":`true`,className:b(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,I.jsxs)(`td`,{className:b(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,I.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}function R({review:e,className:t}){return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,I.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{className:b(`mt-px flex-none rounded-full px-2 py-px text-[11.5px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[e.file&&(0,I.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,I.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,I.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var xe={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function z({status:e,orb:n,px:i=20,spin:a=!1}){let o={width:i,height:i};return e===`active`&&a?(0,I.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:o,children:(0,I.jsx)(v,{size:i-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,I.jsx)(w,{state:n,px:i,label:`At work`}):e===`done`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:o,children:(0,I.jsx)(r,{size:i*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:o,children:(0,I.jsx)(t,{size:i*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:o,children:(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,I.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:b(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:o})}var Se=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ce={read:ne,search:f,list:de,edit:g,run:ie,element:m,outline:le,references:c,impact:h,find:oe,testfile:y,web:_,environment:p,cases:fe,browser:_,post:d,test:y,retry:i,review:se,task:u,work:re},we={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},B={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function Te({kind:e,status:t}){let n=b(`mt-px flex size-4 flex-none items-center justify-center`,we[t]);if(e===`skill`)return(0,I.jsxs)(`span`,{role:`img`,"aria-label":B[t],className:b(n,`relative`),children:[(0,I.jsx)(pe,{name:ge.skills,px:15}),(t===`done`||t===`failed`)&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:b(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Ce[e];return(0,I.jsx)(`span`,{role:`img`,"aria-label":B[t],className:n,children:(0,I.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Ee({status:e}){return e===`active`?(0,I.jsx)(v,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,I.jsx)(`span`,{role:`img`,"aria-label":B[e],className:b(`mt-[7px] size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function V({text:e,label:t}){let[n,i]=(0,F.useState)(!1);return(0,I.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,I.jsx)(r,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:13,"aria-hidden":`true`})})}function De({step:e,failed:t}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 font-mono text-[12px] leading-relaxed`,children:[e.command&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,I.jsx)(V,{text:e.command,label:`Copy the command`})]}),e.output&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,I.jsx)(`pre`,{className:b(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[12px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,I.jsx)(V,{text:e.output,label:`Copy the output`})]})]})}var Oe=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function H({text:e}){return(0,I.jsx)(`span`,{className:b(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Oe(e)&&`font-mono text-[12px]`),children:e})}function ke({step:e}){return(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,I.jsxs)(`li`,{className:b(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,I.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,I.jsx)(j,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function U({agent:e,named:t=!0,working:n=!1}){let r=D(e);return(0,I.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,"data-tip":r.name,children:[(0,I.jsx)(k,{agent:e,px:18,decorative:t,working:n}),t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function W({step:e,from:t,live:n}){let r=e.handoff.agent,i=D(r);return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,I.jsx)(k,{agent:t,px:18}),(0,I.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:b(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{})]}),(0,I.jsx)(k,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,I.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,I.jsx)(H,{text:e.arg})]})}function G({step:e,working:t,from:n=E}){let r=e.agent||n,i=K(e),a=Se(e,t),[o,s]=(0,F.useState)(null),c=o??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&a===`active`),u=(0,I.jsxs)(I.Fragment,{children:[e.handoff?(0,I.jsx)(z,{status:a,orb:e.orb,px:14,spin:!0}):!(e.icon&&r===n)&&(0,I.jsx)(Ee,{status:a}),e.handoff?(0,I.jsx)(W,{step:e,from:n,live:a===`active`}):(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[r!==n||!e.icon?(0,I.jsx)(U,{agent:r,named:r!==n,working:a===`active`}):(0,I.jsx)(Te,{kind:e.icon,status:a}),(0,I.jsx)(`span`,{className:b(`[overflow-wrap:anywhere]`,a===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,I.jsx)(H,{text:e.arg}),e.change&&(0,I.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,I.jsx)(l,{size:14,"aria-hidden":`true`,className:b(`mt-0.5 ml-auto flex-none text-muted transition-transform`,c&&`rotate-180`)})]});return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,I.jsx)(`button`,{type:`button`,"aria-expanded":c,onClick:()=>s(!c),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:u}):(0,I.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:u}),i&&(0,I.jsx)(T,{open:c,children:(0,I.jsx)(q,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})})]})}var K=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function q({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-1.5 border-l border-dotted py-1 pl-3`,r),style:{borderColor:a?`${D(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,I.jsx)(De,{step:e,failed:e.status===`fail`}),e.review&&(0,I.jsx)(R,{review:e.review}),e.lines.length>0&&(0,I.jsx)(ke,{step:e}),e.change&&(0,I.jsx)(L,{diff:e.change.diff}),i.length>0&&(0,I.jsx)(`ul`,{"aria-label":a?`What ${O(D(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,I.jsx)(G,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`text-muted`,children:[O(D(e.handoff.agent).name,!0),` answered`]}),(0,I.jsx)(j,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Ae({node:e,last:t,working:n,now:r,orbed:i}){let a=e.step?[]:e.steps,o=e.step,s=a.length>0||!!r||!!o&&K(o),[c,u]=(0,F.useState)(null),d=c??(e.status===`active`||e.status===`failed`),f=o?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,I.jsx)(`span`,{className:`mt-[3px]`,children:(0,I.jsx)(z,{status:e.status,orb:f,spin:!i})}),!t&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:b(`mt-1.5 min-h-4 w-0 flex-1 border-l border-dotted`,xe[e.status])})]}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[s?(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,I.jsx)(J,{node:e}),(0,I.jsx)(l,{size:14,"aria-hidden":`true`,className:b(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,I.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,I.jsx)(`div`,{className:`min-h-7`,children:(0,I.jsx)(J,{node:e})}),s&&(0,I.jsx)(T,{open:d,className:`mt-0.5`,children:o?(0,I.jsx)(q,{step:o,working:n,from:`forgeqe`,className:`mt-1`}):(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,I.jsx)(G,{step:e,working:n},e.key)),r&&(0,I.jsx)(`li`,{children:(0,I.jsx)(Y,{live:r,className:`px-1.5`})})]})})]})]})}function J({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,I.jsx)(W,{step:n,from:E,live:e.status===`active`}):(0,I.jsxs)(`span`,{className:b(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,I.jsx)(U,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,I.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,I.jsx)(`span`,{children:e.label})}):(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,I.jsx)(H,{text:n.arg})]})}var je={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function Me(e){let[t,n]=(0,F.useState)(()=>Date.now());(0,F.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Y({live:e,orb:t=!1,className:n}){let r=Me(e.latest?.at);return(0,I.jsxs)(`div`,{className:b(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,I.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,I.jsx)(w,{state:e.orb,px:20,label:`At work`}):(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,I.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,I.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,I.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,I.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-[12px]`,je[e.latest.tone]),children:e.latest.plain}),(0,I.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Ne({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,I.jsx)(Y,{live:n,orb:!0});let i=N(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,I.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,I.jsx)(`li`,{className:`flex gap-3`,children:(0,I.jsx)(Y,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,I.jsx)(Ae,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Pe={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function X({label:e,children:t}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,I.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Z({text:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,I.jsx)(C,{icon:ce,size:14,className:`mt-0.5 flex-none text-muted`}),(0,I.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,I.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await _e(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:14,"aria-hidden":`true`})})]})}function Fe(e){if(e.runs===void 0)return e.attempts===void 0?``:S(e.attempts,`attempt`);let t=`${S(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${S(e.reviews,`review`)}`:t}function Q({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,I.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,I.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ie({t:e}){let t=Fe(e);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(y,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,I.jsx)(`span`,{className:`text-[15px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,I.jsx)(me,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Pe[e.status]||e.status||`Not written`}),t&&(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,I.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-3`,children:[(e.testFile||e.testName)&&(0,I.jsx)(X,{label:`Test`,children:(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,I.jsx)(A,{path:e.testFile}),e.testName&&(0,I.jsx)(Q,{name:e.testName})]})}),e.command&&(0,I.jsx)(X,{label:`Run it`,children:(0,I.jsx)(Z,{text:e.command})}),e.review&&(0,I.jsx)(X,{label:e.review.approved?`Review`:`Review asked`,children:(0,I.jsx)(R,{review:e.review})}),e.runDir&&(0,I.jsx)(X,{label:`From the run`,children:(0,I.jsx)(A,{path:e.runDir})}),e.reused.length>0&&(0,I.jsx)(X,{label:`Reused`,children:(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsx)(A,{path:e})},e))})})]}),e.error&&(0,I.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Le({c:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,I.jsx)(l,{size:15,"aria-hidden":`true`,className:b(`transition-transform`,!t&&`-rotate-90`)})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,I.jsx)(A,{path:e.path})}),(0,I.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,I.jsx)(T,{open:t,children:(0,I.jsx)(L,{diff:e.diff,className:`mb-2 ml-9`})})]})}function Re({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,I.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,I.jsx)(Ie,{t:e},t)),t.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,I.jsx)(A,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-3`),children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,I.jsx)(te,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,I.jsxs)(`span`,{className:`font-normal text-muted`,children:[S(e.changes.length+r.length,`file`),e.changes.length>0&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,I.jsx)(Le,{c:e},e.path)),r.map(e=>(0,I.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,I.jsx)(A,{path:e})},e))]})]})]})}var ze={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink`,you:`text-accent-fg`,think:`text-muted italic`};function Be({line:e,start:t}){let[n,r]=(0,F.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,I.jsxs)(`li`,{className:`mt-3 flex items-baseline gap-3 border-b border-line-soft pb-1 first:mt-0`,children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:P(t,e.at)}),(0,I.jsx)(j,{text:e.md,className:`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`})]}):(0,I.jsxs)(`li`,{className:b(`flex items-baseline gap-3 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:P(t,e.at)}),e.kind===`out`?(0,I.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,I.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:b(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,I.jsx)(j,{text:e.md,className:b(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[12px] [&_p]:my-0`,ze[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:e,start:t,live:n,name:i,timeline:a=!1}){let s=(0,F.useRef)(null),c=(0,F.useRef)(!0),[l,u]=(0,F.useState)(!1),d=(0,F.useMemo)(()=>M(e,t),[e,t]);(0,F.useEffect)(()=>{c.current&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[d]);let f=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,I.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex-1`,children:[a?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,I.jsx)(`button`,{type:`button`,"aria-label":l?`Copied`:`Copy the activity log as Markdown`,"data-tip":l?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(d),u(!0),setTimeout(()=>u(!1),1500)}catch{}},className:f,children:l?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:14,"aria-hidden":`true`})}),(0,I.jsx)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,"data-tip":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=i,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:f,children:(0,I.jsx)(C,{icon:ue,size:14})})]}),(0,I.jsx)(`div`,{ref:s,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;c.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:b(`overflow-y-auto py-2`,a?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:a?(0,I.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,I.jsx)(Be,{line:e,start:t},n))}):(0,I.jsx)(j,{text:d,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function Ve({ask:e,live:n,onAnswer:r}){let i=n&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-3`,i?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,I.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,I.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),i?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,I.jsx)(x,{size:`sm`,onClick:()=>r(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,I.jsxs)(x,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:[(0,I.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function He({wait:n,live:r,onProceed:i}){let a=r&&n.answer===void 0;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-3`,a?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(e,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.prompt})]}),a?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(x,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>i(!0),children:[(0,I.jsx)(ae,{"aria-hidden":`true`}),`Continue`]}),(0,I.jsxs)(x,{size:`sm`,onClick:()=>i(!1),children:[(0,I.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:n.answer===void 0?`Not done`:n.answer?`You continued`:`You cancelled`})]})}function Ue({turn:e,live:t,onAnswer:r,onProceed:i}){let a=t&&!e.outcome,[o,s]=(0,F.useState)(null),c=o??a,u=be(e),d=a?u.text:ye(e),f=e.parts.map(e=>ve(e.text)).filter(Boolean),[p,m]=(0,F.useState)(!1),h=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,I.jsx)(k,{agent:`forgeqe`,px:34,working:a,className:`mt-0.5`})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:b(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,I.jsx)(`span`,{"aria-live":`polite`,children:d}),(e.steps.length>0||e.plan.length>0)&&(0,I.jsx)(l,{size:16,"aria-hidden":`true`,className:b(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":p,onClick:()=>m(!p),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,I.jsx)(C,{icon:n,size:14}),`Activity log`,(0,I.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,I.jsx)(T,{open:(c||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,I.jsx)(Ne,{turn:e,working:a,folded:!c,live:{...u,latest:h,events:e.log.length,onLog:()=>m(!0)}})}),(0,I.jsx)(T,{open:p,children:(0,I.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,I.jsx)(Ve,{ask:e,live:a,onAnswer:t=>r(e.id,t)},e.id)),e.waits.map(e=>(0,I.jsx)(He,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),e.outcome&&e.reply?(0,I.jsx)(j,{text:e.reply}):f.length>0&&(0,I.jsx)(j,{text:f.join(`
1
+ import{A as e,Ar as t,Bn as n,C as r,Fn as i,Ir as a,J as o,Nr as s,Ot as c,T as l,Tt as u,Un as d,Vn as f,Wn as p,Z as m,_n as h,cn as ee,dt as te,ft as g,ht as ne,jt as _,kr as re,lr as ie,nn as v,o as ae,pt as oe,qn as se,rr as ce,tn as le,tt as ue,wt as de,yt as y,z as fe}from"./line-icons-CQ-3V8ax.js";import{B as b,R as x,V as S,Zt as pe,_ as me,c as he,h as C,m as w}from"./filters-CflRmNDz.js";import{Gt as T,Zt as E,jt as D,kt as O,vt as ge,zt as k}from"./frame--ur6lpMR.js";import{i as _e,n as A,r as j}from"./markdown-nTIj9lyp.js";import{c as ve,i as ye,o as M,r as N,s as P,t as be}from"./thread-B4g66SWA.js";var F=a(s(),1),I=pe();function L({diff:e,className:t}){let n=0,r=0,i=e.split(`
2
+ `).flatMap((e,t)=>{if(/^(diff |index |--- |\+\+\+ )/.test(e))return[];let i=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);return i?(n=Number(i[1]),r=Number(i[2]),[{key:t,kind:`hunk`,text:e,a:``,b:``}]):e.startsWith(`+`)?[{key:t,kind:`add`,text:e.slice(1),a:``,b:String(r++)}]:e.startsWith(`-`)?[{key:t,kind:`del`,text:e.slice(1),a:String(n++),b:``}]:e.startsWith(`\\`)?[{key:t,kind:`hunk`,text:e,a:``,b:``}]:[{key:t,kind:`same`,text:e.startsWith(` `)?e.slice(1):e,a:String(n++),b:String(r++)}]});return(0,I.jsx)(`div`,{className:b(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[12px] leading-[1.6]`,t),children:(0,I.jsx)(`table`,{className:`w-full border-collapse`,children:(0,I.jsx)(`tbody`,{children:i.map(e=>(0,I.jsxs)(`tr`,{className:e.kind===`add`?`bg-pass-soft`:e.kind===`del`?`bg-fail-soft`:e.kind===`hunk`?`bg-surface-muted`:void 0,children:[(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,I.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,I.jsx)(`td`,{"aria-hidden":`true`,className:b(`w-4 align-top select-none`,e.kind===`add`?`text-pass`:e.kind===`del`?`text-fail`:`text-muted`),children:e.kind===`add`?`+`:e.kind===`del`?`−`:``}),(0,I.jsxs)(`td`,{className:b(`pr-3 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,I.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}function R({review:e,className:t}){return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,I.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,I.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{className:b(`mt-px flex-none rounded-full px-2 py-px text-[11.5px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[e.file&&(0,I.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,I.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,I.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var xe={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function z({status:e,orb:n,px:i=20,spin:a=!1}){let o={width:i,height:i};return e===`active`&&a?(0,I.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:o,children:(0,I.jsx)(v,{size:i-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,I.jsx)(w,{state:n,px:i,label:`At work`}):e===`done`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:o,children:(0,I.jsx)(r,{size:i*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:o,children:(0,I.jsx)(t,{size:i*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,I.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:o,children:(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,I.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:b(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:o})}var Se=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ce={read:ne,search:f,list:de,edit:g,run:ie,element:m,outline:le,references:c,impact:h,find:oe,testfile:y,web:_,environment:p,cases:fe,browser:_,post:d,test:y,retry:i,review:se,task:u,work:re},we={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},B={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function Te({kind:e,status:t}){let n=b(`mt-px flex size-4 flex-none items-center justify-center`,we[t]);if(e===`skill`)return(0,I.jsxs)(`span`,{role:`img`,"aria-label":B[t],className:b(n,`relative`),children:[(0,I.jsx)(me,{name:ge.skills,px:15}),(t===`done`||t===`failed`)&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:b(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Ce[e];return(0,I.jsx)(`span`,{role:`img`,"aria-label":B[t],className:n,children:(0,I.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Ee({status:e}){return e===`active`?(0,I.jsx)(v,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,I.jsx)(`span`,{role:`img`,"aria-label":B[e],className:b(`mt-[7px] size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function V({text:e,label:t}){let[n,i]=(0,F.useState)(!1);return(0,I.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,I.jsx)(r,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:13,"aria-hidden":`true`})})}function De({step:e,failed:t}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 py-0.5 font-mono text-[12px] leading-relaxed`,children:[e.command&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,I.jsx)(V,{text:e.command,label:`Copy the command`})]}),e.output&&(0,I.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,I.jsx)(`pre`,{className:b(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[12px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,I.jsx)(V,{text:e.output,label:`Copy the output`})]})]})}var Oe=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function H({text:e}){return(0,I.jsx)(`span`,{className:b(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-1.5 py-0.5 text-[12.5px] text-ink-2`,Oe(e)&&`font-mono text-[12px]`),children:e})}function ke({step:e}){return(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:e.lines.map((e,t)=>(0,I.jsxs)(`li`,{className:b(`flex gap-1.5 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,I.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,I.jsx)(j,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]},t))})}function U({agent:e,named:t=!0,working:n=!1}){let r=T(e);return(0,I.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-1.5`,"data-tip":r.name,children:[(0,I.jsx)(D,{agent:e,px:18,decorative:t,working:n}),t&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`font-medium`,style:{color:r.hue},children:r.name}),(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}function W({step:e,from:t,live:n}){let r=e.handoff.agent,i=T(r);return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,I.jsx)(D,{agent:t,px:18}),(0,I.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:b(`handoff-flow flex-none`,n&&`is-live`),style:{color:i.hue},children:[(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{}),(0,I.jsx)(`span`,{})]}),(0,I.jsx)(D,{agent:r,px:20,decorative:!0,working:n,className:`handoff-in`}),(0,I.jsx)(`span`,{className:`font-medium`,style:{color:i.hue},children:i.name}),e.arg&&(0,I.jsx)(H,{text:e.arg})]})}function G({step:e,working:t,from:n=k}){let r=e.agent||n,i=K(e),a=Se(e,t),[o,s]=(0,F.useState)(null),c=o??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&a===`active`),u=(0,I.jsxs)(I.Fragment,{children:[e.handoff?(0,I.jsx)(z,{status:a,orb:e.orb,px:14,spin:!0}):!(e.icon&&r===n)&&(0,I.jsx)(Ee,{status:a}),e.handoff?(0,I.jsx)(W,{step:e,from:n,live:a===`active`}):(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[r!==n||!e.icon?(0,I.jsx)(U,{agent:r,named:r!==n,working:a===`active`}):(0,I.jsx)(Te,{kind:e.icon,status:a}),(0,I.jsx)(`span`,{className:b(`[overflow-wrap:anywhere]`,a===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,I.jsx)(H,{text:e.arg}),e.change&&(0,I.jsxs)(`span`,{className:`font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,I.jsx)(l,{size:14,"aria-hidden":`true`,className:b(`mt-0.5 ml-auto flex-none text-muted transition-transform`,c&&`rotate-180`)})]});return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,I.jsx)(`button`,{type:`button`,"aria-expanded":c,onClick:()=>s(!c),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-1.5 py-1.5 text-left text-[13.5px] hover:bg-surface-muted`,children:u}):(0,I.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-1.5 py-1.5 text-[13.5px]`,children:u}),i&&(0,I.jsx)(O,{open:c,children:(0,I.jsx)(q,{step:e,working:t,from:n,className:`mb-1 ml-[13px]`})})]})}var K=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function q({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-1.5 border-l border-dotted py-1 pl-3`,r),style:{borderColor:a?`${T(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,I.jsx)(De,{step:e,failed:e.status===`fail`}),e.review&&(0,I.jsx)(R,{review:e.review}),e.lines.length>0&&(0,I.jsx)(ke,{step:e}),e.change&&(0,I.jsx)(L,{diff:e.change.diff}),i.length>0&&(0,I.jsx)(`ul`,{"aria-label":a?`What ${E(T(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,I.jsx)(G,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[13px]`,children:[(0,I.jsxs)(`span`,{className:`text-muted`,children:[E(T(e.handoff.agent).name,!0),` answered`]}),(0,I.jsx)(j,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Ae({node:e,last:t,working:n,now:r,orbed:i}){let a=e.step?[]:e.steps,o=e.step,s=a.length>0||!!r||!!o&&K(o),[c,u]=(0,F.useState)(null),d=c??(e.status===`active`||e.status===`failed`),f=o?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,I.jsx)(`span`,{className:`mt-[3px]`,children:(0,I.jsx)(z,{status:e.status,orb:f,spin:!i})}),!t&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:b(`mt-1.5 min-h-4 w-0 flex-1 border-l border-dotted`,xe[e.status])})]}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[s?(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-1.5 border-0 bg-transparent p-0 text-left`,children:[(0,I.jsx)(J,{node:e}),(0,I.jsx)(l,{size:14,"aria-hidden":`true`,className:b(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,I.jsx)(`span`,{className:`mt-0.5 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[11.5px] font-medium text-accent-fg`,children:`In progress`})]}):(0,I.jsx)(`div`,{className:`min-h-7`,children:(0,I.jsx)(J,{node:e})}),s&&(0,I.jsx)(O,{open:d,className:`mt-0.5`,children:o?(0,I.jsx)(q,{step:o,working:n,from:`forgeqe`,className:`mt-1`}):(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,I.jsx)(G,{step:e,working:n},e.key)),r&&(0,I.jsx)(`li`,{children:(0,I.jsx)(Y,{live:r,className:`px-1.5`})})]})})]})]})}function J({node:e}){let t=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,n=e.step;return n?.handoff?(0,I.jsx)(W,{step:n,from:k,live:e.status===`active`}):(0,I.jsxs)(`span`,{className:b(`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,I.jsx)(U,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`}),e.status===`active`?(0,I.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,I.jsx)(`span`,{children:e.label})}):(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,I.jsx)(H,{text:n.arg})]})}var je={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function Me(e){let[t,n]=(0,F.useState)(()=>Date.now());(0,F.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?`${i}s ago`:`${Math.floor(i/60)} min ago`}function Y({live:e,orb:t=!1,className:n}){let r=Me(e.latest?.at);return(0,I.jsxs)(`div`,{className:b(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,I.jsx)(`span`,{className:`mt-0.5 flex size-4 flex-none items-center justify-center`,children:t?(0,I.jsx)(w,{state:e.orb,px:20,label:`At work`}):(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,I.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`shimmer text-[13.5px] font-medium text-muted`,children:(0,I.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,I.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,I.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-[12px]`,je[e.latest.tone]),children:e.latest.plain}),(0,I.jsxs)(`span`,{className:`flex-none text-[11.5px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Ne({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,I.jsx)(Y,{live:n,orb:!0});let i=N(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=[...i].reverse().find(e=>e.status===`active`);return(0,I.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,I.jsx)(`li`,{className:`flex gap-3`,children:(0,I.jsx)(Y,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,I.jsx)(Ae,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Pe={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function X({label:e,children:t}){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,I.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Z({text:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,I.jsx)(C,{icon:ce,size:14,className:`mt-0.5 flex-none text-muted`}),(0,I.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12.5px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,I.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await _e(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:14,"aria-hidden":`true`})})]})}function Fe(e){if(e.runs===void 0)return e.attempts===void 0?``:S(e.attempts,`attempt`);let t=`${S(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${S(e.reviews,`review`)}`:t}function Q({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,I.jsx)(`span`,{className:`font-mono text-[12.5px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,I.jsx)(`span`,{className:`font-mono text-[11.5px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ie({t:e}){let t=Fe(e);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(y,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,I.jsx)(`span`,{className:`text-[15px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,I.jsx)(he,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Pe[e.status]||e.status||`Not written`}),t&&(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,I.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-3`,children:[(e.testFile||e.testName)&&(0,I.jsx)(X,{label:`Test`,children:(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,I.jsx)(A,{path:e.testFile}),e.testName&&(0,I.jsx)(Q,{name:e.testName})]})}),e.command&&(0,I.jsx)(X,{label:`Run it`,children:(0,I.jsx)(Z,{text:e.command})}),e.review&&(0,I.jsx)(X,{label:e.review.approved?`Review`:`Review asked`,children:(0,I.jsx)(R,{review:e.review})}),e.runDir&&(0,I.jsx)(X,{label:`From the run`,children:(0,I.jsx)(A,{path:e.runDir})}),e.reused.length>0&&(0,I.jsx)(X,{label:`Reused`,children:(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,I.jsx)(`li`,{className:`min-w-0`,children:(0,I.jsx)(A,{path:e})},e))})})]}),e.error&&(0,I.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Le({c:e}){let[t,n]=(0,F.useState)(!1);return(0,I.jsxs)(`li`,{className:`flex flex-col`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>n(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,I.jsx)(l,{size:15,"aria-hidden":`true`,className:b(`transition-transform`,!t&&`-rotate-90`)})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,I.jsx)(A,{path:e.path})}),(0,I.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,I.jsx)(O,{open:t,children:(0,I.jsx)(L,{diff:e.diff,className:`mb-2 ml-9`})})]})}function Re({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,I.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,I.jsx)(Ie,{t:e},t)),t.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,I.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,I.jsx)(A,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-3`),children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,I.jsx)(te,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,I.jsxs)(`span`,{className:`font-normal text-muted`,children:[S(e.changes.length+r.length,`file`),e.changes.length>0&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,I.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,I.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,I.jsx)(Le,{c:e},e.path)),r.map(e=>(0,I.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-9`,children:(0,I.jsx)(A,{path:e})},e))]})]})]})}var ze={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink`,you:`text-accent-fg`,think:`text-muted italic`};function Be({line:e,start:t}){let[n,r]=(0,F.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,I.jsxs)(`li`,{className:`mt-3 flex items-baseline gap-3 border-b border-line-soft pb-1 first:mt-0`,children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:P(t,e.at)}),(0,I.jsx)(j,{text:e.md,className:`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`})]}):(0,I.jsxs)(`li`,{className:b(`flex items-baseline gap-3 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,I.jsx)(`span`,{className:`w-12 flex-none font-mono text-[11.5px] text-muted tabular-nums`,children:P(t,e.at)}),e.kind===`out`?(0,I.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[12px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,I.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:b(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,I.jsx)(j,{text:e.md,className:b(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[12px] [&_p]:my-0`,ze[e.tone],i&&!n&&`line-clamp-2`)})})]})}function $({lines:e,start:t,live:n,name:i,timeline:a=!1}){let s=(0,F.useRef)(null),c=(0,F.useRef)(!0),[l,u]=(0,F.useState)(!1),d=(0,F.useMemo)(()=>M(e,t),[e,t]);(0,F.useEffect)(()=>{c.current&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[d]);let f=`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[12px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,I.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex-1`,children:[a?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,I.jsx)(`button`,{type:`button`,"aria-label":l?`Copied`:`Copy the activity log as Markdown`,"data-tip":l?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(d),u(!0),setTimeout(()=>u(!1),1500)}catch{}},className:f,children:l?(0,I.jsx)(r,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,I.jsx)(o,{size:14,"aria-hidden":`true`})}),(0,I.jsx)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,"data-tip":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([d],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=i,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:f,children:(0,I.jsx)(C,{icon:ue,size:14})})]}),(0,I.jsx)(`div`,{ref:s,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;c.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:b(`overflow-y-auto py-2`,a?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:a?(0,I.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,I.jsx)(Be,{line:e,start:t},n))}):(0,I.jsx)(j,{text:d,className:`text-[13px] leading-[1.6] [&_code]:text-[12px] [&_h4]:mt-3 [&_h4]:mb-1 [&_li]:my-0.5 [&_pre]:text-[12px] [&_ul]:my-1`})})]})}function Ve({ask:e,live:n,onAnswer:r}){let i=n&&e.answer===void 0;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-3`,i?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,I.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,I.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),i?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,I.jsx)(x,{size:`sm`,onClick:()=>r(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,I.jsxs)(x,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:[(0,I.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function He({wait:n,live:r,onProceed:i}){let a=r&&n.answer===void 0;return(0,I.jsxs)(`div`,{className:b(`flex flex-col gap-3`,a?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-3`:`py-1`),children:[(0,I.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(e,{size:18,"aria-hidden":`true`,className:`mt-0.5 flex-none text-accent-fg`}),(0,I.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:n.prompt})]}),a?(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsxs)(x,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>i(!0),children:[(0,I.jsx)(ae,{"aria-hidden":`true`}),`Continue`]}),(0,I.jsxs)(x,{size:`sm`,onClick:()=>i(!1),children:[(0,I.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]}):(0,I.jsx)(`span`,{className:`text-sm text-muted`,children:n.answer===void 0?`Not done`:n.answer?`You continued`:`You cancelled`})]})}function Ue({turn:e,live:t,onAnswer:r,onProceed:i}){let a=t&&!e.outcome,[o,s]=(0,F.useState)(null),c=o??a,u=be(e),d=a?u.text:ye(e),f=e.parts.map(e=>ve(e.text)).filter(Boolean),[p,m]=(0,F.useState)(!1),h=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,I.jsxs)(`div`,{className:`flex gap-3`,children:[(0,I.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,I.jsx)(D,{agent:`forgeqe`,px:34,working:a,className:`mt-0.5`})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 pt-1.5`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:b(`flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,I.jsx)(`span`,{"aria-live":`polite`,children:d}),(e.steps.length>0||e.plan.length>0)&&(0,I.jsx)(l,{size:16,"aria-hidden":`true`,className:b(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":p,onClick:()=>m(!p),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,I.jsx)(C,{icon:n,size:14}),`Activity log`,(0,I.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,I.jsx)(O,{open:(c||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,I.jsx)(Ne,{turn:e,working:a,folded:!c,live:{...u,latest:h,events:e.log.length,onLog:()=>m(!0)}})}),(0,I.jsx)(O,{open:p,children:(0,I.jsx)($,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,I.jsx)(Ve,{ask:e,live:a,onAnswer:t=>r(e.id,t)},e.id)),e.waits.map(e=>(0,I.jsx)(He,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),e.outcome&&e.reply?(0,I.jsx)(j,{text:e.reply}):f.length>0&&(0,I.jsx)(j,{text:f.join(`
3
3
 
4
4
  `)}),(0,I.jsx)(Re,{turn:e}),e.error&&(0,I.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,I.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{L as i,Ue as n,Z as r,$ as t};
@@ -1 +1 @@
1
- import{Ir as e,L as t,N as n,Nr as r,T as i,dt as a,gr as o,j as s,ln as c}from"./line-icons-CQ-3V8ax.js";import{B as l,Nt as u,R as d,d as f,f as p,l as m,o as h,qt as g,rt as _,t as v,z as y}from"./filters-mFECJpMB.js";import{Dt as b,Et as x,gt as S,r as C,t as w}from"./frame-BcGZt823.js";import{r as T}from"./index-CotEpFLY.js";import{t as E}from"./segmented-DANusepM.js";import{r as D}from"./families-B0QIuAe3.js";import{_ as O,o as k}from"./qualityParts-Cfirt7dZ.js";var A=e(r(),1),j=g(),M={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},N=e=>`${(e/1e3).toFixed(1)}s`,P=e=>`${e.goal.slice(0,80)} · ${e.status} · ${T(e.at)}`;function F(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function I({run:e,step:t}){let[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&u.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`No screenshot`}):n?(0,j.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,j.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`Not in this run`})}function L({step:e,other:n}){if(!e)return(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Not in this run`});let r=e.ok?s:t,i=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),a=n?e.calls.filter(e=>!i.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,j.jsx)(r,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:l(`mt-0.5 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,j.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${N(e.ms)}`:``]}),e.error&&(0,j.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error}),a.slice(0,3).map(e=>(0,j.jsxs)(`span`,{className:l(`truncate font-mono text-[12px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,j.jsx)(`span`,{className:`truncate text-[12px] text-warn`,"data-tip":e,children:e},e))]})}function R({row:e,i:t,a:n,b:r,focus:a,open:o,onToggle:s}){let c=e.a?.n,u=e.b?.n;return(0,j.jsxs)(`li`,{id:a?`look-here`:void 0,className:l(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-3 px-3 py-2 text-[13px]`,children:[(0,j.jsx)(`span`,{className:`pt-0.5 text-muted tabular-nums`,"data-tip":c!==void 0&&u!==void 0&&c!==u?`Step ${c} of the first run, ${u} of the second`:void 0,children:c!==void 0&&u!==void 0&&c!==u?`${c}·${u}`:c??u??t+1}),(0,j.jsx)(L,{step:e.a,other:e.b}),(0,j.jsx)(L,{step:e.b,other:e.a}),(0,j.jsx)(d,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,j.jsx)(i,{"aria-hidden":`true`,className:l(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-3 pb-2 pl-[3.75rem] text-[12.5px] text-ink-2`,children:[a&&e.kind&&(0,j.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,M[e.kind].label]}),e.differences.map(e=>(0,j.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,j.jsx)(b,{open:o,children:(0,j.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 px-3 pb-3 @2xl:grid-cols-2`,children:[(0,j.jsx)(I,{run:n,step:e.a}),(0,j.jsx)(I,{run:r,step:e.b})]})})]})}function z({runs:e,a:t,b:n}){let[r,i]=(0,A.useState)(t??``),[o,s]=(0,A.useState)(n??``);(0,A.useEffect)(()=>{i(t??``),s(n??``)},[t,n]);let{same:c,other:l}=F(e,r);return(0,j.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&o&&r!==o&&(location.hash=p(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(o)}`))},children:[(0,j.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,j.jsxs)(h,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,j.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))]})]}),(0,j.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,j.jsxs)(h,{size:`sm`,value:o,onChange:e=>s(e.target.value),disabled:!r,children:[(0,j.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),c.length>0&&(0,j.jsx)(`optgroup`,{label:`Same test`,children:c.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))}),(0,j.jsx)(`optgroup`,{label:c.length?`Other runs`:`Runs`,children:l.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))})]})]}),(0,j.jsxs)(d,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!o||r===o,children:[(0,j.jsx)(a,{"aria-hidden":`true`}),`Compare`]})]})}function B({sub:e}){let[t,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(null),[s,h]=(0,A.useState)(``),[g,b]=(0,A.useState)(`all`),[T,P]=(0,A.useState)(new Set),[F,I]=(0,A.useState)(``),[L,B]=(0,A.useMemo)(()=>{let t=(e?f(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,A.useEffect)(()=>{u.runs().then(e=>r(e.runs),e=>h(e.message))},[]),(0,A.useEffect)(()=>{let e=!1;if(a(null),I(``),L&&B)return u.diff(L,B).then(t=>{e||(a(t),h(``),P(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&h(t.message)),()=>{e=!0}},[L,B]);let V=async()=>{if(i)try{let{id:e}=await _.start(`Compare the browser runs ${i.a.id} and ${i.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=p(`chats`,e)}catch(e){I(e.message)}},H=i?.rows??[],U=H.map((e,t)=>({r:e,i:t})).filter(({r:e})=>g===`all`||!e.same),W=e=>e===void 0?void 0:H[e]?.b?.n??H[e]?.a?.n,G=W(i?.first),K=W(i?.focus);return(0,j.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,j.jsx)(C,{}),(0,j.jsxs)(`main`,{className:l(w,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,j.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(x,{pixel:S[`run-diff`],size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,j.jsx)(E,{label:`Runs and reports`,links:D,current:`run-diff`})]}),(0,j.jsx)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),!t&&!s&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,j.jsx)(m,{icon:o,title:`Two runs are needed`,action:(0,j.jsxs)(`a`,{className:y({size:`sm`}),href:p(`record`),"data-tip":`Record a flow`,children:[(0,j.jsx)(n,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,j.jsx)(z,{runs:t,a:L,b:B}),L&&B&&!i&&!s&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),i&&(0,j.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,j.jsx)(k,{label:`Verdict`,value:i.first===void 0?`Same`:`Differ`,tone:i.first===void 0?`text-pass`:`text-warn`,sub:i.first===void 0?`every step alike`:`from step ${G??`?`}`}),(0,j.jsx)(k,{label:`Steps differing`,value:i.counts.differing,tone:i.counts.differing?`text-warn`:void 0,sub:`of ${H.length} lined up`}),(0,j.jsx)(k,{label:`Steps`,value:`${i.a.steps} · ${i.b.steps}`,sub:`first · second`}),(0,j.jsx)(k,{label:`Time`,value:`${N(i.a.ms)} · ${N(i.b.ms)}`,sub:`first · second`}),(0,j.jsx)(k,{label:`Calls answered otherwise`,value:i.counts.calls,tone:i.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,j.jsx)(k,{label:`New browser errors`,value:i.counts.errors,tone:i.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[i.a,i.b].map((e,t)=>(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,j.jsx)(`span`,{className:`text-[12px] text-muted`,children:t?`Second run`:`First run`}),(0,j.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,j.jsxs)(`span`,{className:`truncate text-[12.5px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,O(e.at),` · `,e.host??e.id]})]},e.id))}),!i.sameGoal&&(0,j.jsx)(`p`,{className:`m-0 text-[12.5px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),i.kind&&(0,j.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 rounded-[12px] bg-warn-soft px-3 py-2.5 text-[13px]`,children:[(0,j.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-warn`}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,j.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,K??`?`,` of the second run: `,M[i.kind].label]}),(0,j.jsx)(`span`,{className:`text-ink-2`,children:M[i.kind].hint}),i.first!==i.focus&&i.first!==void 0&&H[i.first]?.kind&&(0,j.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,G,`: `,M[H[i.first].kind].label.toLowerCase(),`.`]})]}),(0,j.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:`smooth`,block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,j.jsx)(v,{items:[{id:`all`,label:`All steps`,n:H.length},{id:`diff`,label:`Only differences`,n:i.counts.differing,alert:!0}],value:g,onChange:b})}),(0,j.jsxs)(d,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void V(),className:`ml-auto`,children:[(0,j.jsx)(c,{"aria-hidden":`true`}),`Chat`]})]}),F&&(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:F}),(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-3 bg-surface-muted px-3 py-1.5 text-[11.5px] text-muted`,children:[(0,j.jsx)(`span`,{children:`Step`}),(0,j.jsx)(`span`,{children:`First run`}),(0,j.jsx)(`span`,{children:`Second run`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),U.length?(0,j.jsx)(`ol`,{className:`m-0 list-none p-0`,children:U.map(({r:e,i:t})=>(0,j.jsx)(R,{row:e,i:t,a:i.a.id,b:i.b.id,focus:t===i.focus,open:T.has(t),onToggle:()=>{let e=new Set(T);e.has(t)?e.delete(t):e.add(t),P(e)}},t))}):(0,j.jsx)(`p`,{className:`m-0 border-t border-line-soft px-3 py-3 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{M as KIND_TEXT,B as RunDiff,F as choicesFor};
1
+ import{Ir as e,L as t,N as n,Nr as r,T as i,dt as a,gr as o,j as s,ln as c}from"./line-icons-CQ-3V8ax.js";import{B as l,Lt as u,R as d,Zt as f,d as p,f as m,l as h,o as g,st as _,t as v,z as y}from"./filters-CflRmNDz.js";import{Ot as b,kt as x,r as S,t as C,vt as w}from"./frame--ur6lpMR.js";import{r as T}from"./index-GLMqsotN.js";import{t as E}from"./segmented-CAf_qz5Z.js";import{_ as D,o as O}from"./qualityParts-BPBFzuHH.js";import{r as k}from"./families-zlLgApNV.js";var A=e(r(),1),j=f(),M={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},N=e=>`${(e/1e3).toFixed(1)}s`,P=e=>`${e.goal.slice(0,80)} · ${e.status} · ${T(e.at)}`;function F(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function I({run:e,step:t}){let[n,r]=(0,A.useState)(``),[i,a]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&u.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`No screenshot`}):n?(0,j.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,j.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,j.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-3 py-6 text-center text-[12.5px] text-muted`,children:`Not in this run`})}function L({step:e,other:n}){if(!e)return(0,j.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:`Not in this run`});let r=e.ok?s:t,i=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),a=n?e.calls.filter(e=>!i.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5`,children:[(0,j.jsx)(r,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:l(`mt-0.5 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,j.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${N(e.ms)}`:``]}),e.error&&(0,j.jsx)(`span`,{className:`text-[12.5px] text-fail [overflow-wrap:anywhere]`,children:e.error}),a.slice(0,3).map(e=>(0,j.jsxs)(`span`,{className:l(`truncate font-mono text-[12px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,j.jsx)(`span`,{className:`truncate text-[12px] text-warn`,"data-tip":e,children:e},e))]})}function R({row:e,i:t,a:n,b:r,focus:a,open:o,onToggle:s}){let c=e.a?.n,u=e.b?.n;return(0,j.jsxs)(`li`,{id:a?`look-here`:void 0,className:l(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-3 px-3 py-2 text-[13px]`,children:[(0,j.jsx)(`span`,{className:`pt-0.5 text-muted tabular-nums`,"data-tip":c!==void 0&&u!==void 0&&c!==u?`Step ${c} of the first run, ${u} of the second`:void 0,children:c!==void 0&&u!==void 0&&c!==u?`${c}·${u}`:c??u??t+1}),(0,j.jsx)(L,{step:e.a,other:e.b}),(0,j.jsx)(L,{step:e.b,other:e.a}),(0,j.jsx)(d,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,j.jsx)(i,{"aria-hidden":`true`,className:l(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-3 pb-2 pl-[3.75rem] text-[12.5px] text-ink-2`,children:[a&&e.kind&&(0,j.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,M[e.kind].label]}),e.differences.map(e=>(0,j.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,j.jsx)(x,{open:o,children:(0,j.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-3 px-3 pb-3 @2xl:grid-cols-2`,children:[(0,j.jsx)(I,{run:n,step:e.a}),(0,j.jsx)(I,{run:r,step:e.b})]})})]})}function z({runs:e,a:t,b:n}){let[r,i]=(0,A.useState)(t??``),[o,s]=(0,A.useState)(n??``);(0,A.useEffect)(()=>{i(t??``),s(n??``)},[t,n]);let{same:c,other:l}=F(e,r);return(0,j.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&o&&r!==o&&(location.hash=m(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(o)}`))},children:[(0,j.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,j.jsxs)(g,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,j.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))]})]}),(0,j.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,j.jsxs)(g,{size:`sm`,value:o,onChange:e=>s(e.target.value),disabled:!r,children:[(0,j.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),c.length>0&&(0,j.jsx)(`optgroup`,{label:`Same test`,children:c.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))}),(0,j.jsx)(`optgroup`,{label:c.length?`Other runs`:`Runs`,children:l.map(e=>(0,j.jsx)(`option`,{value:e.id,children:P(e)},e.id))})]})]}),(0,j.jsxs)(d,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!o||r===o,children:[(0,j.jsx)(a,{"aria-hidden":`true`}),`Compare`]})]})}function B({sub:e}){let[t,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(null),[s,f]=(0,A.useState)(``),[g,x]=(0,A.useState)(`all`),[T,P]=(0,A.useState)(new Set),[F,I]=(0,A.useState)(``),[L,B]=(0,A.useMemo)(()=>{let t=(e?p(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,A.useEffect)(()=>{u.runs().then(e=>r(e.runs),e=>f(e.message))},[]),(0,A.useEffect)(()=>{let e=!1;if(a(null),I(``),L&&B)return u.diff(L,B).then(t=>{e||(a(t),f(``),P(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&f(t.message)),()=>{e=!0}},[L,B]);let V=async()=>{if(i)try{let{id:e}=await _.start(`Compare the browser runs ${i.a.id} and ${i.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=m(`chats`,e)}catch(e){I(e.message)}},H=i?.rows??[],U=H.map((e,t)=>({r:e,i:t})).filter(({r:e})=>g===`all`||!e.same),W=e=>e===void 0?void 0:H[e]?.b?.n??H[e]?.a?.n,G=W(i?.first),K=W(i?.focus);return(0,j.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,j.jsx)(S,{}),(0,j.jsxs)(`main`,{className:l(C,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,j.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(b,{pixel:w[`run-diff`],size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,j.jsx)(E,{label:`Runs and reports`,links:k,current:`run-diff`})]}),(0,j.jsx)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),s&&(0,j.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:s}),!t&&!s&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,j.jsx)(h,{icon:o,title:`Two runs are needed`,action:(0,j.jsxs)(`a`,{className:y({size:`sm`}),href:m(`record`),"data-tip":`Record a flow`,children:[(0,j.jsx)(n,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,j.jsx)(z,{runs:t,a:L,b:B}),L&&B&&!i&&!s&&(0,j.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),i&&(0,j.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,j.jsx)(O,{label:`Verdict`,value:i.first===void 0?`Same`:`Differ`,tone:i.first===void 0?`text-pass`:`text-warn`,sub:i.first===void 0?`every step alike`:`from step ${G??`?`}`}),(0,j.jsx)(O,{label:`Steps differing`,value:i.counts.differing,tone:i.counts.differing?`text-warn`:void 0,sub:`of ${H.length} lined up`}),(0,j.jsx)(O,{label:`Steps`,value:`${i.a.steps} · ${i.b.steps}`,sub:`first · second`}),(0,j.jsx)(O,{label:`Time`,value:`${N(i.a.ms)} · ${N(i.b.ms)}`,sub:`first · second`}),(0,j.jsx)(O,{label:`Calls answered otherwise`,value:i.counts.calls,tone:i.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,j.jsx)(O,{label:`New browser errors`,value:i.counts.errors,tone:i.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[i.a,i.b].map((e,t)=>(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,j.jsx)(`span`,{className:`text-[12px] text-muted`,children:t?`Second run`:`First run`}),(0,j.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,j.jsxs)(`span`,{className:`truncate text-[12.5px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,D(e.at),` · `,e.host??e.id]})]},e.id))}),!i.sameGoal&&(0,j.jsx)(`p`,{className:`m-0 text-[12.5px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),i.kind&&(0,j.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 rounded-[12px] bg-warn-soft px-3 py-2.5 text-[13px]`,children:[(0,j.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-warn`}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,j.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,K??`?`,` of the second run: `,M[i.kind].label]}),(0,j.jsx)(`span`,{className:`text-ink-2`,children:M[i.kind].hint}),i.first!==i.focus&&i.first!==void 0&&H[i.first]?.kind&&(0,j.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,G,`: `,M[H[i.first].kind].label.toLowerCase(),`.`]})]}),(0,j.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:`smooth`,block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,j.jsx)(v,{items:[{id:`all`,label:`All steps`,n:H.length},{id:`diff`,label:`Only differences`,n:i.counts.differing,alert:!0}],value:g,onChange:x})}),(0,j.jsxs)(d,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void V(),className:`ml-auto`,children:[(0,j.jsx)(c,{"aria-hidden":`true`}),`Chat`]})]}),F&&(0,j.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:F}),(0,j.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-3 bg-surface-muted px-3 py-1.5 text-[11.5px] text-muted`,children:[(0,j.jsx)(`span`,{children:`Step`}),(0,j.jsx)(`span`,{children:`First run`}),(0,j.jsx)(`span`,{children:`Second run`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),U.length?(0,j.jsx)(`ol`,{className:`m-0 list-none p-0`,children:U.map(({r:e,i:t})=>(0,j.jsx)(R,{row:e,i:t,a:i.a.id,b:i.b.id,focus:t===i.focus,open:T.has(t),onToggle:()=>{let e=new Set(T);e.has(t)?e.delete(t):e.add(t),P(e)}},t))}):(0,j.jsx)(`p`,{className:`m-0 border-t border-line-soft px-3 py-3 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{M as KIND_TEXT,B as RunDiff,F as choicesFor};
@@ -0,0 +1,2 @@
1
+ import{$n as e,Ar as t,D as n,Dt as r,Fn as i,Ir as a,L as o,M as s,Mt as c,Nn as l,Nr as u,O as d,T as f,U as p,Vn as m,Xt as h,Zn as g,_,_t as v,a as ee,at as y,f as b,j as x,kr as S,ln as C,lr as w,nr as te,ot as T,rn as E,rr as ne,y as D,yt as O}from"./line-icons-CQ-3V8ax.js";import{B as k,R as A,Rt as j,V as M,Zt as re,c as N,d as ie,f as P,h as F,i as ae,l as oe,n as se,o as ce,st as le,t as ue,u as de,z as fe}from"./filters-CflRmNDz.js";import{Et as pe,Gt as me,Ot as he,V as I,kt as ge,r as _e,t as ve,vt as ye,z as be}from"./frame--ur6lpMR.js";import{n as L,r as R}from"./markdown-nTIj9lyp.js";import{i as xe,r as Se}from"./index-GLMqsotN.js";import{r as Ce,t as we}from"./Response-DWF22-5i.js";import{i as Te,r as Ee,t as De}from"./segmented-CAf_qz5Z.js";import{a as Oe,c as ke}from"./thread-B4g66SWA.js";import{r as Ae}from"./families-zlLgApNV.js";var z=a(u(),1),B=re(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},je={execution:O,report:y,coding:p,chat:C};function Me({kind:e}){let t=je[e];return(0,B.jsx)(F,{icon:t,size:14,className:`flex-none text-muted`})}var Ne={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},H=e=>Ne[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Pe={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Fe=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function U({title:e,icon:t,children:n,aside:r}){return(0,B.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-line-soft pt-6 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,B.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function Ie({path:e,label:t=`Report`}){let[n,r]=(0,z.useState)(``);return(0,B.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,B.jsxs)(A,{"data-tip":`Open the report`,onClick:async()=>r(await de(e)),children:[(0,B.jsx)(T,{"aria-hidden":`true`}),t]}),n&&(0,B.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function Le({items:e,first:t,render:n}){let[r,i]=(0,z.useState)(!1);return(0,B.jsxs)(B.Fragment,{children:[(r?e:e.slice(0,t)).map(n),e.length>t&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[r?(0,B.jsx)(d,{size:14,"aria-hidden":`true`}):(0,B.jsx)(f,{size:14,"aria-hidden":`true`}),r?`Less`:`All (${e.length})`]})]})}function Re({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,B.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,B.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,B.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,B.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function ze({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Pe[e.scope]||e.scope,Fe(e.ms),e.tokens?`${I(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,B.jsx)(Ie,{path:e.report})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsxs)(`span`,{className:`text-[22px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(N,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(N,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(N,{tone:`warn`,children:[e.counts.other,` other`]}),(0,B.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,B.jsx)(Re,{c:e.counts}),e.cases.length>0&&(0,B.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Le,{items:[...e.cases].sort((e,t)=>Number(H(t.status).tone===`fail`)-Number(H(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(N,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-1.5 font-mono text-[12px] text-muted`,children:e.id}),e.title,e.device&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,B.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Fe(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,B.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,B.jsx)(L,{path:e.folder})]})]})}function Be({list:e}){let t=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,B.jsx)(U,{title:`Execution summary`,icon:(0,B.jsx)(F,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[M(e.length,`run`),` · `,t.passed,` of `,t.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,B.jsx)(ze,{e},`${e.folder||e.title}-${t}`)):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ve({list:e}){return(0,B.jsxs)(U,{title:`Report summary`,icon:(0,B.jsx)(F,{icon:y,size:18}),children:[e.length===0&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-line-soft pt-3 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,B.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,B.jsx)(Ie,{path:e.path})]}),e.stats&&(0,B.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,B.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-3 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[12px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[18px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,B.jsx)(He,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function He({text:e,height:t=220}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(t),c=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{c.current&&!n&&a(c.current.scrollHeight>t+8)},[e,t,n]),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{ref:c,style:o===void 0?void 0:{maxHeight:o},onTransitionEnd:e=>e.target===e.currentTarget&&n&&s(void 0),className:k(`transition-[max-height] duration-200 ease-out`,o!==void 0&&`relative overflow-hidden`),children:[(0,B.jsx)(R,{text:e,className:`text-sm`}),!n&&i&&(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||i)&&(0,B.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=c.current?.scrollHeight??t;if(r(!n),pe())return s(n?t:void 0);s(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>s(t)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[n?(0,B.jsx)(d,{size:14,"aria-hidden":`true`}):(0,B.jsx)(f,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ue(e){let t=e.join(`
2
+ `),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function We({e}){let[t,r]=(0,z.useState)(!1),i=e.action===`write`?`New`:`Edited`;return(0,B.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,B.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-1.5 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,B.jsx)(n,{size:16,"aria-hidden":`true`,className:k(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:i}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})}),(0,B.jsxs)(`span`,{className:`flex-none font-mono text-[12px] tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,B.jsx)(ge,{open:t,className:`pb-3 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,B.jsx)(R,{text:Ue(e.diffs)}):null})]})}var Ge={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{className:`pt-0.5 text-[13px] text-muted`,children:e}),(0,B.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ke({c:e,files:t}){let n=e.edits.reduce((e,t)=>e+t.added,0),r=e.edits.reduce((e,t)=>e+t.removed,0),i=e.tests.filter(e=>!e.ok).length,a=e.reviews.at(-1),o=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,B.jsxs)(U,{title:`Code changes`,icon:(0,B.jsx)(F,{icon:p,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[M(e.edits.length,`file`),` · `,(0,B.jsxs)(`span`,{className:`text-pass`,children:[`+`,n]}),` `,(0,B.jsxs)(`span`,{className:`text-fail`,children:[`−`,r]})]}):o.length?(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:M(o.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,o=t.status===`error`||t.status===`failed`;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(O,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:o?`text-fail`:`text-warn`}),(0,B.jsx)(`span`,{className:`text-[15px] font-semibold`,children:r?`Test written`:o?`Test not finished`:H(t.status).label}),(0,B.jsx)(N,{tone:r?`pass`:o?`fail`:`warn`,children:H(t.status).label}),e.tests.length>0&&(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[M(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${M(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-5 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-3`,children:[t.testFile&&(0,B.jsx)(W,{label:`Test`,children:(0,B.jsx)(L,{path:t.testFile})}),t.command&&(0,B.jsx)(W,{label:`Run it`,children:(0,B.jsx)(Ce,{text:t.command})}),(t.review||a)&&(0,B.jsx)(W,{label:`Review`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(N,{tone:(t.review??a).approved?`pass`:`warn`,children:(t.review??a).approved?`Approved`:`Changes asked`})}),(t.review?.summary||a?.summary)&&(0,B.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||a?.summary})]})}),t.notes&&(0,B.jsx)(W,{label:`Notes`,children:(0,B.jsx)(R,{text:t.notes,className:`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`})})]}),t.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,B.jsx)(Le,{items:e.edits,first:8,render:e=>(0,B.jsx)(We,{e},e.path)})})]}),o.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,B.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:o.map(e=>(0,B.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-3 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[12px] text-muted`,children:Ge[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(L,{path:e.path})})]},e.path))}),(0,B.jsx)(`p`,{className:`m-0 text-[12.5px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!o.length&&!e.results.length&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,B.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function qe({final:e,answer:t}){let n=e.from===`agent`?t?.files??[]:[],r=e.from!==`agent`,i=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),a="`".repeat(i+1);return(0,B.jsxs)(U,{title:`Final message`,icon:(0,B.jsx)(v,{size:18,"aria-hidden":`true`}),aside:(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,B.jsx)(He,{text:r?`${a}text\n${e.text}\n${a}`:ke(e.text),height:420}),n.length>0&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),n.map(e=>(0,B.jsx)(L,{path:e},e))]})]})}var Je={rule:{icon:b,label:`Rulebook`},decision:{icon:r,label:`Test decisions`},memory:{icon:_,label:`Page memory`},replay:{icon:l,label:`Replays`},model:{icon:g,label:`Model`},skill:{icon:c,label:`Skills`}};function Ye({list:e}){let t=Object.keys(Je).filter(t=>e.some(e=>e.kind===t));return(0,B.jsx)(U,{title:`Learnings`,icon:(0,B.jsx)(F,{icon:h,size:18}),aside:e.length?(0,B.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-3`,children:t.map(t=>{let{icon:n,label:r}=Je[t];return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,B.jsxs)(`h4`,{className:`m-0 flex items-center gap-1.5 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(F,{icon:n,size:14}),r]}),(0,B.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-0.5 border-t border-line-soft py-1.5 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function Xe({run:e}){let t=[];return(e.executions.length||e.kind===`execution`)&&t.push({kind:`execution`,node:(0,B.jsx)(Be,{list:e.executions},`e`)}),(e.reports.length||e.kind===`report`)&&t.push({kind:`report`,node:(0,B.jsx)(Ve,{list:e.reports},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&t.push({kind:`coding`,node:(0,B.jsx)(Ke,{c:e.coding,files:e.files},`c`)}),t.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,B.jsx)(B.Fragment,{children:t.map(e=>e.node)})}var Ze={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},Qe={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},$e=e=>Qe[e]||e.charAt(0).toUpperCase()+e.slice(1),G=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},K=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),q=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,J=e=>e.usage.input+e.usage.output;function et(e){let[t,n]=(0,z.useState)(Date.now());return(0,z.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function tt({r:e}){return e.origin.kind===`web`?(0,B.jsxs)(`a`,{href:P(`chats`,e.origin.chat),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:C,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:P(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(F,{icon:D,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted`,children:[(0,B.jsx)(F,{icon:w,size:14}),`Terminal`]})}function Y({status:e}){let t=Ze[e].label;return e===`running`?(0,B.jsx)(E,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(x,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(o,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,B.jsx)(s,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!J(e)&&!e.files.length&&!e.outputs.length&&K(e,0)<2;function nt(e){return/^forgeqe(-|$)|^engine$/.test(e)?me(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-3 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,B.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`h3`,{className:`m-0 mb-1 text-[14px] font-semibold`,children:e}),t]})}var rt={rerun:i,write_test:te,investigate:m,fix_test:S},it={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function at({actions:e}){let[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await le.start(e.prompt,{});location.hash=P(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,B.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,B.jsxs)(A,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,B.jsx)(F,{icon:rt[e.kind],size:16,className:`flex-none`}),(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:it[e.kind]}),e.note&&(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,B.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,B.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var ot=e=>`\`${e.replace(/`/g,``)}\``,st=[`summary`,`conversation`,`activity`,`details`],ct=e=>st.find(t=>t===e)??`summary`;function lt({name:n,tab:r}){let[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),u=ct(r),d=e=>location.hash=e===`summary`?P(`runs`,encodeURIComponent(n)):P(`runs`,encodeURIComponent(n),e),f=(0,z.useCallback)(()=>{j.detail(n).then(e=>{a(e),s(``)},e=>s(e.message))},[n]);(0,z.useEffect)(f,[f]);let p=i?.status===`running`;(0,z.useEffect)(()=>{if(!p)return;let e=setInterval(f,2e3);return()=>clearInterval(e)},[f,p]);let m=et(p),h=(0,z.useMemo)(()=>(i?.events??[]).map(Oe).filter(e=>!!e),[i?.events]),g=async()=>{l(!0),s(``);try{await j.cancel(n),f()}catch(e){s(e.message)}finally{l(!1)}},_=(0,B.jsxs)(`a`,{href:P(`runs`),className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,B.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!i)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_,o?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail`,children:o}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let v=Ze[i.status],y=!i.replies.length,b=!!i.final||i.executions.length>0||i.reports.length>0||!!(i.coding&&(i.coding.edits.length||i.coding.results.length))||i.learnings.length>0||i.outputs.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:y?`Command`:`Conversation`,n:i.replies.length||void 0},{id:`activity`,label:`Activity`,n:h.length||void 0},{id:`details`,label:`Details`}],S=new Set([...i.reports.map(e=>e.path),...i.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),C=i.outputs.filter(e=>!S.has(e.path)),w=i.context?.limit?Math.round(i.context.tokens/i.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[_,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:i.title}),(0,B.jsx)(N,{tone:v.tone,children:v.label})]}),(0,B.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(Me,{kind:i.kind}),V[i.kind]]}),`· `,(0,B.jsx)(tt,{r:i}),`· `,G(i.startedAt),` · `,p?`running for `:`took `,q(K(i,m)),` · `,I(J(i)),` tokens`,i.profile?.model?` · ${i.profile.model}`:``]})]}),i.cancel&&(0,B.jsxs)(A,{variant:`danger`,disabled:c,"data-tip":i.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void g(),children:[i.cancel===`chat`?(0,B.jsx)(e,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(t,{"aria-hidden":`true`}),c?`Stopping…`:i.cancel===`chat`?`Stop`:`Cancel`]})]}),o&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:o}),i.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,i.error]}),!p&&(0,B.jsx)(at,{actions:i.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:Ee,children:x.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":u===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>d(e.id),className:Te(u===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[12px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${u}`,"aria-labelledby":`run-tab-${u}`,className:`flex min-w-0 flex-col gap-6`,children:[u===`summary`&&(0,B.jsxs)(B.Fragment,{children:[i.final&&(0,B.jsx)(qe,{final:i.final,answer:i.answer}),(0,B.jsx)(Xe,{run:i}),C.length>0&&(0,B.jsx)(Q,{title:`What it produced (${C.length})`,children:C.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(L,{path:e.path})},e.path))}),i.learnings.length>0&&(0,B.jsx)(Ye,{list:i.learnings}),!b&&(0,B.jsx)(oe,{className:`py-4`,children:p?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),u===`conversation`&&(y?(0,B.jsx)(R,{text:ot(i.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:i.replies.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2.5 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-0.5`})}),e.text&&(0,B.jsx)(R,{text:ke(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),u===`activity`&&(i.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-3 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,B.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):h.length?(0,B.jsx)(we,{timeline:!0,lines:h,start:i.startedAt,live:p,name:`forgeqe-run-${i.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),u===`details`&&(0,B.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-8 @3xl:grid-cols-2`,children:[(0,B.jsxs)(Q,{title:`Numbers`,children:[(0,B.jsx)(Z,{label:p?`Running for`:`Took`,children:q(K(i,m))}),(0,B.jsx)(Z,{label:`Tokens`,children:(0,B.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`span`,{children:[I(J(i)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,be(i.usage)]})]}),(i.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5 text-[13px]`,children:i.byAgent.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:nt(e.agent)}),(0,B.jsx)(`span`,{className:`text-muted tabular-nums`,children:I(e.input+e.output)})]},e.agent))})]})}),(0,B.jsxs)(Z,{label:`Context`,children:[i.context?I(i.context.tokens):`–`,w!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,I(i.context.limit),` (`,w,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[i.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,M(i.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(tt,{r:i})}),(0,B.jsx)(Z,{label:`Command`,children:$e(i.command)}),(0,B.jsx)(Z,{label:`Model`,children:i.profile?[i.profile.name,i.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:i.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-0.5`,children:i.agents.map(e=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:nt(e.name)}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:M(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[i.archived?(0,B.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,B.jsx)(L,{path:`.forgeqe/logs/${i.name}`}),i.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),i.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:P(`jobs`,encodeURIComponent(i.origin.kind===`job`?i.origin.job:i.job.name)),children:i.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:ot(i.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[i.job.schedule,!i.job.enabled&&` (disabled)`,i.job.nextAt&&i.job.enabled?` · next ${G(i.job.nextAt)}`:``]}),i.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[i.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,i.job.run.status.replace(`_`,` `),i.job.run.exitCode!==void 0&&i.job.run.exitCode!==null?`, exit ${i.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${i.files.length})`,children:i.files.length?[...i.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)).map(e=>(0,B.jsx)(Z,{label:e.action===`write`?`Written`:e.action===`edit`?`Edited`:e.action===`delete`?`Deleted`:e.action?e.action.charAt(0).toUpperCase()+e.action.slice(1):`Changed`,children:e.action===`delete`?(0,B.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path}):(0,B.jsx)(L,{path:e.path})},e.path)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:`No files changed.`})}),(0,B.jsx)(Q,{title:`Notifications`,children:i.notifications.length?i.notifications.map(e=>(0,B.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,B.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,B.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:i.origin.kind===`terminal`||i.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}var $=25;function ut({runs:e}){let t=et(e.some(e=>e.status===`running`)),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(`all`),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(0);(0,z.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,h=n.toLowerCase().split(/\s+/).filter(Boolean),g=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&h.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),_={all:g.length,running:g.filter(e=>e.status===`running`).length,failed:g.filter(e=>e.status===`failed`).length},v=i===`all`?g:g.filter(e=>e.status===i),ee=Math.max(1,Math.ceil(v.length/$)),y=Math.min(f,ee-1),b=v.slice(y*$,y*$+$),x=e.filter(e=>e.status!==`running`&&!X(e)),S=x.filter(e=>e.status===`failed`).length,w=x.length?x.reduce((e,n)=>e+K(n,t),0)/x.length:NaN,te=e.reduce((e,t)=>e+J(t),0),T=[...new Set(e.map(e=>e.kind))],E=[...new Set(e.map(e=>e.origin.kind))],D={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,B.jsx)(oe,{icon:ne,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:fe({size:`sm`}),href:P(),"data-tip":`Start a chat`,children:[(0,B.jsx)(C,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:k(`tabular-nums`,S?`text-fail`:`text-ink`),children:S}),` failed`,x.length?` (${Math.round(S/x.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:I(te)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(w))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(ae,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(ue,{items:[{id:`all`,label:`All`,n:_.all},{id:`running`,label:`Running`,n:_.running},{id:`failed`,label:`Failed`,n:_.failed,alert:!0}],value:i,onChange:a}),T.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Any kind`}),T.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]}),E.length>1&&(0,B.jsxs)(ce,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-7 pl-3`,children:[(0,B.jsx)(`option`,{value:``,children:`Started anywhere`}),E.map(e=>(0,B.jsx)(`option`,{value:e,children:D[e]||e},e))]})]}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[12px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{className:`w-4`}),(0,B.jsx)(`span`,{children:`Run`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Started by`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,B.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,B.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-1.5`,children:[b.length===0&&(0,B.jsx)(`li`,{className:`px-3 py-4 text-sm text-muted`,children:`Nothing matches.`}),b.map((e,n)=>{let r=xe(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||xe(b[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-3 pt-3 pb-1 text-[12px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:P(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 rounded-[10px] px-3 py-1.5 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,B.jsx)(Y,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[14px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[12px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[12px] text-muted @3xl:hidden`,children:[V[e.kind],D[e.origin.kind],q(K(e,t)),`${I(J(e))} tokens`].join(` · `)})]}),(0,B.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-1.5 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,B.jsx)(Me,{kind:e.kind}),V[e.kind]]}),(0,B.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:D[e.origin.kind]||e.origin.kind}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:q(K(e,t))}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:I(J(e))}),(0,B.jsx)(`span`,{className:`text-right text-[12.5px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:Se(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(se,{page:y,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${M(m,`empty session`)}`:`${M(m,`empty session`)} hidden`})]})})]})]})}function dt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{j.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,z.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,z.useEffect)(()=>{if(e)return;let t=setInterval(a,o?3e3:2e4);return()=>clearInterval(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ie(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(_e,{}),(0,B.jsx)(`main`,{className:k(ve,`@container flex-auto gap-4`),children:l?(0,B.jsx)(lt,{name:l,tab:c},l):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(he,{pixel:ye.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(De,{label:`Runs and reports`,links:Ae,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,B.jsx)(ut,{runs:t})]})})]})}export{dt as Runs,Y as StatusIcon,ct as runTab};
@@ -0,0 +1,2 @@
1
+ import{Ar as e,C as t,Ir as n,Nr as r,nn as i,rt as a}from"./line-icons-CQ-3V8ax.js";import{B as o,Zt as s,c,f as l,i as u,l as d,n as f,qt as p,z as m}from"./filters-CflRmNDz.js";import{a as h,t as g}from"./markdown-nTIj9lyp.js";import{d as _}from"./parts-C53RxMcR.js";var v=n(r(),1),y=s();function b({error:e}){return e?(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e}):null}var x=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,S={ok:{label:`Ready to start`,tone:`pass`},limits:{label:`Ready, with limits`,tone:`warn`},blocked:{label:`Not possible`,tone:`fail`}},C={converted:{label:`Converted`,tone:`pass`},partial:{label:`Needs review`,tone:`warn`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`},running:{label:`Running`,tone:`running`}},w={converted:{label:`Converted`,tone:`pass`},written:{label:`Written`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`},blocked:{label:`Not possible`,tone:`warn`},skipped:{label:`Skipped`,tone:`neutral`}},T={setup:`Set-up`,page:`Page`,test:`Test`},E=e=>e.engine?e.engine===`mobile`?`Mobile workflow`:`Desktop workflow`:T[e.kind],D={matched:{label:`In the test`,dot:`bg-pass`},missing:{label:`Missing from the test`,dot:`bg-fail`},elided:{label:`Not needed: this branch never runs`,dot:`bg-line-strong`},marked:{label:`Left for a person to finish`,dot:`bg-warn`}},O=e=>e.route===`web`||e.route===`api`||(e.routes?.web??0)>0||(e.routes?.api??0)>0||(e.workflow?.steps??0)>0;function k(e){if(e.workflow&&e.workflow.steps>0)return`${e.workflow.engine===`mobile`?`Mobile`:`Desktop`} workflow${e.workflow.skipped?` + notes`:``}`;let t=e.route===`web`||(e.routes?.web??0)>0,n=e.route===`api`||(e.routes?.api??0)>0,r=(e.unsupported??0)>0||(e.routes?.unsupported??0)>0;return`${t&&n?`Web and API`:n?`API`:`Web`}${r?` + notes`:``}`}var A={web:`Web`,api:`API`,desktop:`Desktop`,mobile:`Mobile`,data:`Data`,mixed:`Mixed`,unsupported:`Not supported`},j={prepare:`Prepare`,setup:`Set up`,pages:`Pages`,tests:`Tests`,validate:`Validate`,review:`Review`},M=[`prepare`,`setup`,`pages`,`tests`,`validate`,`review`];function N(e,t){if(!t)return 0;if(t.status===`converted`||t.stages?.review.status===`done`)return 100;let n=t.stages?.validate.status===`done`?8:0,r=Math.min(t.units.length,e.units.length);return Math.min(99,Math.round(r/Math.max(1,e.units.length)*90+n))}function P(e){let t=e?.status||`pending`,n=e?.startedAt&&e?.endedAt?_(Date.parse(e.endedAt)-Date.parse(e.startedAt)):``;return t===`running`?e?.startedAt?`Running · ${_(Date.now()-Date.parse(e.startedAt))}`:`Running`:t===`done`?e?.note||(n?`Done · ${n}`:`Done`):t===`failed`?e?.note||`Did not finish`:t===`skipped`?e?.note||`Skipped`:`Waiting`}function F({states:n}){return(0,y.jsx)(`ol`,{"aria-label":`Stages`,className:`m-0 flex w-full min-w-0 list-none items-center gap-1 p-0 @xl:gap-2`,children:M.map((r,a)=>{let s=n?.[r],c=s?.status||`pending`,l=c===`done`||c===`skipped`,u=c===`running`||c===`failed`,d=P(s);return(0,y.jsxs)(`li`,{"data-tip":`${j[r]}: ${d}`,className:o(`relative flex items-center gap-1 @xl:gap-2`,a<M.length-1&&`flex-1`),"aria-current":c===`running`?`step`:void 0,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,className:o(`inline-flex size-5 flex-none items-center justify-center rounded-full text-[11px] font-semibold tabular-nums @xl:size-6`,l?`bg-pass text-white`:c===`running`?`border-2 border-accent bg-accent-soft text-accent-fg`:c===`failed`?`bg-fail text-white`:`border border-line bg-bg text-muted`),children:l?(0,y.jsx)(t,{size:12,strokeWidth:3}):c===`failed`?(0,y.jsx)(e,{size:12,strokeWidth:3}):c===`running`?(0,y.jsx)(i,{size:12,strokeWidth:2.5,className:`animate-spin`}):a+1}),(0,y.jsxs)(`span`,{className:o(`flex-none text-[13px] whitespace-nowrap`,u?`inline`:`hidden @xl:inline`,c===`running`?`font-medium text-accent-fg`:c===`failed`?`font-medium text-fail`:c===`pending`?`text-muted`:`text-ink`),children:[j[r],u&&(0,y.jsx)(`span`,{className:`ml-1.5 hidden font-normal text-muted @3xl:inline`,children:d})]}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[j[r],`: `,d]}),a<M.length-1&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,y.jsx)(`span`,{className:o(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,l?`w-full`:`w-0`)})})]},r)})})}function I(e){return e?`literal`in e?JSON.stringify(e.literal):`env`in e?`env ${String(e.env)}${e.secret?` (secret)`:``}`:`var`in e?`variable ${String(e.var)}`:`param`in e?`parameter ${String(e.param)}`:`data`in e?`test data ${String(e.data)}`:`expr`in e?`expression ${String(e.expr)}`:`concat`in e&&Array.isArray(e.concat)?e.concat.map(I).join(` + `):``:``}var L={exact:`is`,contains:`contains`,not:`is not`,gt:`is more than`,gte:`is at least`,lt:`is less than`,lte:`is at most`,exists:`is there`,absent:`is not there`},R=new Set([`gt`,`gte`,`lt`,`lte`]);function z(e){let t=e.expected;return t&&`literal`in t&&/^-?\d+(\.\d+)?$/.test(String(t.literal))&&(R.has(e.match||``)||e.op===`api_status`)?String(t.literal):I(t)}function B(e,t,n){return e===`api_status`||t===`status`?`the status`:e===`api_header`||t===`header`?`the header ${n}`:e===`api_body`||t===`body`?`the body`:`the JSON value ${n}`}function V(e){if(e.op===`api_request`){let t=e.method&&`literal`in e.method?String(e.method.literal):``,n=[e.endpoint,e.resource].filter(Boolean).map(e=>I(e)).join(` + `),r=(e,t,n)=>{let r=e?Object.keys(e).length:0;return r?`${r} ${r===1?t:n}`:``},i=[e.payload?.fields?.length?`${e.payload.fields.length} body ${e.payload.fields.length===1?`field`:`fields`}`:e.payload?.raw?`a body`:``,r(e.pathParams,`path parameter`,`path parameters`),r(e.query,`query parameter`,`query parameters`),r(e.headers,`header`,`headers`)].filter(Boolean);return`Call ${t?`${t} `:e.method?`(method ${I(e.method)}) `:``}${n||`with no address`}${i.length?`, with ${i.join(`, `)}`:``}`}if(e.kind===`assert`&&(e.op===`api_status`||e.op===`api_header`||e.op===`api_json`||e.op===`api_body`)){let t=B(e.op,void 0,e.target),n=e.match||`exact`;return`Check ${t} of the response ${L[n]||`is`}${n===`exists`||n===`absent`?``:` ${z(e)}`}`}return e.op===`api_store`?`Read ${B(void 0,e.property,e.target)} of the response into ${e.var}`:null}function H(e){let t=V(e);if(t!==null)return t;let n=e.target?e.target.slice(e.target.indexOf(`.`)+1).replace(/_/g,` `):``;if(e.kind===`action`){let t=e.op===`navigate`?`Open ${I(e.value)}`:e.op===`close`?`Close the browser`:e.op===`fill`?`Fill ${n} with ${I(e.value)}`:e.op===`press`?`Press ${e.key} on ${n}`:e.op===`select`?`Select in ${n}`:`${e.op[0].toUpperCase()}${e.op.slice(1)} ${n}`;return e.optional?`${t} (if it is there)`:t}return e.kind===`assert`?`Check ${n} ${e.op===`text`||e.op===`value`?`${e.match===`contains`?`contains`:`is`} ${I(e.expected)}`:`is ${e.op}`}${e.wait?`, waiting`:``}`:e.kind===`store`?`Read ${n} into ${e.var}`:e.kind===`set_var`?`Set ${e.var} to ${I(e.value)}`:e.kind===`wait`?`Wait ${e.ms} ms`:e.kind===`unsupported`?e.reason||`Cannot be converted`:e.name||e.kind}var U=(e,t)=>t?l(`tosca`,e,`compare`,encodeURIComponent(t)):l(`tosca`,e,`compare`),W=50,G={before:`Before`,after:`After`,block:`Reusable block`,folder:`Folder`};function K({nodes:e,status:t,pick:n,onPick:r,depth:i=0}){return(0,y.jsx)(`ul`,{className:o(`m-0 flex list-none flex-col p-0`,i>0&&`ml-3 border-l border-line-soft pl-3`),children:e.map((e,a)=>{if(e.kind===`group`)return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[G[e.role||`folder`]||`Folder`,`: `,(0,y.jsx)(`span`,{className:`text-ink-2`,children:e.name})]}),(0,y.jsx)(K,{nodes:e.body||[],status:t,pick:n,onPick:r,depth:i+1})]},`g${a}`);if(e.kind===`if`||e.kind===`loop`){let o=e.condition;return(0,y.jsxs)(`li`,{className:`flex flex-col gap-1 py-1`,children:[(0,y.jsxs)(`span`,{className:`text-[12px] font-medium text-muted`,children:[e.kind===`if`?`If`:`Loop`,` `,e.name,`: `,(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2`,children:o?.tosca}),o?.constant!==void 0&&(0,y.jsxs)(`span`,{children:[` · always `,o.constant?`true`:`false`]})]}),[`then`,`else`,`loop`].map(a=>e[a]?.length?(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,y.jsx)(`span`,{className:`ml-3 text-[12px] text-muted`,children:a===`then`?`Then`:a===`else`?`Else`:`Each time`}),(0,y.jsx)(K,{nodes:e[a],status:t,pick:n,onPick:r,depth:i+1})]},a):null)]},`i${a}`)}let s=e.id?t.get(e.id):void 0,c=s?D[s]:void 0;return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,onClick:()=>r(e),className:o(`flex w-full min-w-0 cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,n===e.id?`bg-accent-soft`:`bg-transparent hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":c?.label||`Not converted yet`,"data-tip":c?.label||`Not converted yet`,className:o(`mt-1.5 size-2 flex-none rounded-full`,c?.dot||`bg-line`)}),(0,y.jsx)(`span`,{className:`w-9 flex-none font-mono text-[12px] text-muted`,children:e.id}),(0,y.jsxs)(`span`,{className:o(`min-w-0 flex-1 [overflow-wrap:anywhere]`,e.kind===`unsupported`?`text-warn`:`text-ink`),children:[H(e),e.tosca?.step&&(0,y.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[`Tosca step "`,e.tosca.step,`"`]})]})]})},e.id||a)})})}function q(e,t){for(let n of e){if(n.id===t)return n;for(let e of[`body`,`then`,`else`,`loop`]){let r=n[e]&&q(n[e],t);if(r)return r}}}function J({view:e,pick:t,engine:n}){let r=e.target,i=r?.text||``,a=i.split(`
2
+ `),s=(0,v.useMemo)(()=>i?h(i,r?.lang||`plaintext`):null,[i,r?.lang]),c=(0,v.useMemo)(()=>{if(!t)return new Set;let e=RegExp(`tosca:[\\sn\\d,]*\\b${t}\\b`,`i`);return new Set(a.flatMap((t,n)=>e.test(t)?[n]:[]))},[t,i]),l=(0,v.useRef)(null);(0,v.useEffect)(()=>{l.current?.scrollIntoView({block:`center`,behavior:`smooth`})},[t,c.size]);let u=Math.min(...c);return(0,y.jsxs)(`figure`,{className:`pane-swap m-0 flex min-h-0 min-w-0 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`figcaption`,{className:`flex min-h-10 items-center gap-2 border-b border-line-soft pr-1 pl-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:n?E({kind:`test`,engine:n}):`Converted test`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px] text-ink-2`,"data-tip":r?.path,children:r?.path||``}),i&&(0,y.jsx)(g,{text:i,label:`Copy ${r?.path||`the test`}`})]}),i?(0,y.jsxs)(`div`,{className:`flex min-h-[260px] flex-1 overflow-auto font-mono text-[12.5px] leading-[1.6]`,children:[(0,y.jsx)(`pre`,{"aria-hidden":`true`,className:`m-0 min-h-full flex-none self-stretch border-r border-line-soft py-3 text-right text-muted select-none`,children:a.map((e,t)=>(0,y.jsx)(`span`,{ref:t===u?l:void 0,className:o(`block px-3`,c.has(t)&&`bg-accent-soft font-semibold text-accent-fg`),children:t+1},t))}),(0,y.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 px-3 py-3`,children:(0,y.jsx)(`code`,{className:`hljs`,children:s})})]}):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] flex-1 items-center justify-center px-4 text-center text-sm text-muted`,children:r?`Not written yet.`:`This test case is left out of the plan.`}),t&&i&&(0,y.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft px-3 py-2 text-[12.5px] text-muted`,children:c.size?`${t} is done on line ${[...c].map(e=>e+1).join(`, `)}.`:`No line of the test is marked ${t}.`})]})}function Y({view:e,node:t}){if(!t?.target)return null;let[n,r]=t.target.split(`.`),i=e.pages.find(e=>e.id===n),a=i?.elements.find(e=>e.id===r);return a?(0,y.jsxs)(`section`,{"aria-label":`Locators Tosca recorded`,className:`flex flex-col gap-2 rounded-[12px] card border px-4 py-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`font-medium`,children:[a.name,` `,(0,y.jsxs)(`span`,{className:`font-normal text-muted`,children:[`on `,i?.name,a.scope?.length?`, inside ${a.scope.join(` › `)}`:``,a.nth===void 0?``:`, number ${a.nth+1}`]})]}),a.locators.length?(0,y.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:a.locators.slice(0,6).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`w-14 flex-none text-[12px] text-muted`,children:e.strategy}),(0,y.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.strategy===`role`?`${e.role} "${e.name}"`:e.attr?`[${e.attr}="${e.value}"]`:e.value}),e.fragile&&(0,y.jsx)(c,{tone:`warn`,children:`Fragile`})]},t))}):(0,y.jsx)(`span`,{className:`text-muted`,children:`Tosca recorded no locator for it.`})]}):null}function X({id:e,plan:t,result:n,initial:r,full:i,onPick:s}){let c=t.cases.filter(e=>e.included),[l,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(r||c[0]?.id||``),[b,S]=(0,v.useState)(null),[C,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``);(0,v.useEffect)(()=>{g&&(D(``),p.case(e,g).then(S,e=>D(e.message)))},[e,g,n?.units.length,n?.status]),(0,v.useEffect)(()=>{T(``),g&&s?.(g)},[g]);let O=new Map((b?.fidelity||[]).map(e=>[e.id,e.status])),k=c.filter(e=>!l||e.name.toLowerCase().includes(l.toLowerCase())),[j,M]=(0,v.useState)(0);(0,v.useEffect)(()=>M(0),[l]),(0,v.useEffect)(()=>{let e=k.findIndex(e=>e.id===g);e>=0&&Math.floor(e/W)!==j&&M(Math.floor(e/W))},[g]);let N=k.slice(j*W,j*W+W),P=e=>n?.units.find(t=>t.kind===`test`&&t.case===e);if(!c.length)return(0,y.jsx)(d,{center:!0,className:`py-6`,children:`No test case of this plan is converted.`});let F=(0,y.jsxs)(`div`,{className:o(`grid grid-cols-[minmax(0,1fr)] gap-4 @5xl:grid-cols-[220px_minmax(0,1fr)_minmax(0,1fr)]`,i?`@5xl:min-h-0 @5xl:flex-1`:`@5xl:h-[calc(var(--screen)-368px)] @5xl:min-h-[540px]`),children:[(0,y.jsxs)(`nav`,{"aria-label":`Test cases`,className:`flex max-h-[320px] min-h-0 min-w-0 flex-col gap-2 overflow-hidden rounded-[14px] card border p-3 @5xl:max-h-none`,children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-1`,children:[(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:`Test cases`}),(0,y.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[c.filter(e=>P(e.id)?.status===`converted`).length,` converted · `,c.some(e=>P(e.id)?.status===`written`)?`${c.filter(e=>P(e.id)?.status===`written`).length} written · `:``,c.filter(e=>[`failed`,`blocked`].includes(P(e.id)?.status||``)).length,` failed · `,x(c.length,`test case`)]})]}),(0,y.jsx)(u,{id:`find-a-case`,label:`Find a test case`,value:l,onChange:h,className:`max-w-none flex-none`}),(0,y.jsxs)(`ul`,{className:`m-0 flex min-h-0 flex-1 list-none flex-col gap-0.5 overflow-y-auto p-0`,children:[N.map(e=>{let t=P(e.id);return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":g===e.id,onClick:()=>_(e.id),className:o(`flex w-full cursor-pointer items-start gap-2 rounded-[8px] border-0 px-2 py-1.5 text-left text-[13px]`,g===e.id?`bg-accent-soft text-ink`:`bg-transparent text-ink-2 hover:bg-surface-muted`),children:[(0,y.jsx)(`span`,{role:`img`,"aria-label":t?w[t.status].label:`Waiting`,className:o(`mt-1.5 size-2 flex-none rounded-full`,t?.status===`converted`?`bg-pass`:t?.status===`failed`?`bg-fail`:t?.status===`blocked`?`bg-warn`:`bg-line`)}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:[e.name,(0,y.jsxs)(`span`,{className:`block text-[12px] text-muted`,children:[x(e.steps,`step`),` · `,x(e.asserts,`check`),t?.fidelity?` · ${t.fidelity.matched}/${t.fidelity.required} in the test`:``]})]})]})},e.id)}),!N.length&&(0,y.jsx)(`li`,{className:`px-2 py-3 text-[13px] text-muted`,children:`No test case matches.`})]}),k.length>W&&(0,y.jsx)(f,{page:j,size:W,total:k.length,onPage:M,label:`Test case pages`})]}),(0,y.jsxs)(`section`,{"aria-label":`Tosca steps`,className:`flex min-h-[360px] min-w-0 flex-col gap-3 overflow-hidden`,children:[E&&(0,y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:E}),(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-[12px] card border`,children:[(0,y.jsxs)(`header`,{className:`flex min-h-10 flex-wrap items-center gap-2 border-b border-line-soft px-3 py-1.5`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-muted uppercase`,children:`Tosca steps`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:b?.name}),b&&t.cases.find(e=>e.id===g)&&(0,y.jsx)(`span`,{className:`text-[12px] text-muted`,children:A[t.cases.find(e=>e.id===g).route]||``})]}),(0,y.jsx)(`div`,{className:`pane-swap min-h-0 flex-1 overflow-y-auto px-2 py-2`,children:b?(0,y.jsx)(K,{nodes:b.body,status:O,pick:C,onPick:e=>T(e.id||``)}):E?(0,y.jsx)(`p`,{className:`m-0 px-2 text-sm text-muted`,children:`Nothing to show.`}):(0,y.jsx)(`p`,{role:`status`,className:`m-0 px-2 text-sm text-muted`,children:`Loading…`})},b?.case||``),b&&(b.env.length>0||b.warnings.length>0)&&(0,y.jsxs)(`footer`,{className:`flex flex-col gap-1 border-t border-line-soft px-3 py-2 text-[12.5px] text-ink-2`,children:[b.env.length>0&&(0,y.jsxs)(`span`,{children:[`Environment variables: `,b.env.map(e=>`${e.name}${e.secret?` (secret)`:``}`).join(`, `),`.`]}),b.warnings.slice(0,3).map(e=>(0,y.jsx)(`span`,{className:`text-warn`,children:e},e))]})]}),b&&(0,y.jsx)(Y,{view:b,node:q(b.body,C)})]}),b?(0,y.jsx)(J,{view:b,pick:C,engine:t.units.find(e=>e.kind===`test`&&e.case===b.case)?.engine},b.case):(0,y.jsx)(`p`,{className:`m-0 flex min-h-[260px] items-center justify-center rounded-[12px] card border px-4 text-center text-sm text-muted`,children:E?`Nothing to show.`:`Loading…`})]});return i?F:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`flex justify-end`,children:(0,y.jsxs)(`a`,{href:U(e,g),target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Tosca steps beside the converted test, in a tab of their own`,className:m({variant:`ghost`,size:`sm`}),children:[(0,y.jsx)(a,{"aria-hidden":`true`}),`Open in a new tab`]})}),F]})}export{C as a,j as c,S as d,k as f,N as g,E as h,b as i,F as l,x as m,U as n,A as o,O as p,D as r,M as s,X as t,w as u};
@@ -0,0 +1 @@
1
+ import{$t as e,Ar as t,C as n,Ft as r,Ir as i,Nr as a,R as o,en as s,gr as c,it as l,o as u,rt as d}from"./line-icons-CQ-3V8ax.js";import{B as f,Gt as p,R as m,Zt as h,a as g,d as _,et as v,f as y,h as b,l as x,t as S}from"./filters-CflRmNDz.js";import{Ot as C,at as w,nt as T,r as E,rt as D,st as O,t as k,vt as A}from"./frame--ur6lpMR.js";import{o as j}from"./markdown-nTIj9lyp.js";import{r as M,s as N}from"./index-GLMqsotN.js";var P=i(a(),1),F=h(),I=[{id:`azure_devops`,label:`Azure DevOps`},{id:`jira`,label:`Jira`},{id:`testrail`,label:`TestRail`},{id:`zephyr`,label:`Zephyr Scale`},{id:`qtest`,label:`qTest`}],L=e=>I.some(t=>t.id===e),R=e=>e&&j(e)===`web`?e:void 0,z=(e,t)=>`${e} ${t}${e===1?``:`s`}`,B=e=>`${e.kind}:${e.id}`;function V(e){return e.found===`reuse`||e.kind===`link`?`Link`:e.found===`extends`||e.kind===`extend`?`Add ${z((e.insert??[]).reduce((e,t)=>e+t.steps.length,0),`step`)}`:`Update steps`}function H(e,t){let n=`Story ${t} asks for it: ${e.wrote}`,r=e.link?{link:!0}:{};return e.kind===`link`?{kind:`link`,id:e.id}:e.kind===`extend`?{kind:`extend`,id:e.id,insert:e.insert??[],reason:n,...r}:{kind:`update`,id:e.id,steps:e.steps??[],reason:n,...r}}function U(){let[e,t]=(0,P.useState)(I.map(e=>e.id)),[n,r]=(0,P.useState)(``);return(0,P.useEffect)(()=>{v.settings().then(e=>{let n=e.config.sources??{},r=I.map(e=>e.id).filter(e=>n[e]&&typeof n[e]==`object`);r.length&&t(r)},e=>r(`The settings could not be read, so every system is offered: ${e.message}`))},[]),{systems:I.filter(t=>e.includes(t.id)),error:n}}function W({id:e,icon:t,title:n,children:r}){return(0,F.jsxs)(`section`,{"aria-labelledby":e,className:`flex min-w-0 flex-col gap-3`,children:[(0,F.jsxs)(`h2`,{id:e,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,F.jsx)(b,{icon:t,size:18,className:`text-accent-fg`}),n]}),r]})}function G({view:i,onApplied:a,onError:u}){let[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(null),C=i.story.id,E=i.proposals.filter(e=>h.includes(B(e))),k=async()=>{let e=E.map(e=>H(e,C));b(!0);try{let t=await p.preview(i.system,C,e);v({lines:t.lines,changes:e}),u(``)}catch(e){u(e.message)}finally{b(!1)}},A=async()=>{if(_){b(!0);try{let e=await p.apply(i.system,C,_.changes);S({applied:e.applied,failed:e.failed}),v(null),g([]),u(``),a()}catch(e){u(e.message)}finally{b(!1)}}},j=R(i.story.url);return(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,F.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-lg font-semibold [overflow-wrap:anywhere]`,children:[j?(0,F.jsxs)(`a`,{href:j,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[C,(0,F.jsx)(d,{size:14,"aria-hidden":`true`})]}):(0,F.jsx)(`span`,{children:C}),i.story.title&&(0,F.jsx)(`span`,{className:`font-normal text-ink-2`,children:i.story.title})]}),i.changed&&(0,F.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,"data-tip":new Date(i.changed.when).toLocaleString(),children:[`The story's `,i.changed.field,` changed `,M(i.changed.when),`.`]})]}),(0,F.jsx)(W,{id:`cases-h`,icon:e,title:`Linked cases`,children:(0,F.jsx)(T,{label:`Linked cases`,empty:`No test case is linked to this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Case`}),(0,F.jsx)(`th`,{className:w,children:`Title`}),(0,F.jsx)(`th`,{className:f(w,`text-right`),children:`Steps`}),(0,F.jsx)(`th`,{className:w,children:`State`})]}),children:i.cases.map(e=>{let t=R(e.url);return(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:f(D,`whitespace-nowrap`),children:t?(0,F.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[e.id,(0,F.jsx)(d,{size:12,"aria-hidden":`true`})]}):e.id}),(0,F.jsx)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:e.title}),(0,F.jsx)(`td`,{className:f(D,`text-right tabular-nums`),children:e.steps}),(0,F.jsx)(`td`,{className:f(D,e.stale?`text-warn`:`text-muted`),children:e.stale?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(c,{size:13,"aria-hidden":`true`,className:`flex-none`}),`older than the story's last change`]}):e.changed?(0,F.jsxs)(`span`,{"data-tip":new Date(e.changed).toLocaleString(),children:[`changed `,M(e.changed)]}):`–`})]},e.id)})})}),(0,F.jsx)(W,{id:`criteria-h`,icon:o,title:`Acceptance criteria`,children:(0,F.jsx)(T,{label:`Acceptance criteria`,empty:`No acceptance criteria were read for this story.`,head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:w,children:`Criterion`}),(0,F.jsx)(`th`,{className:w,children:`Cases`})]}),children:i.criteria.map((e,t)=>(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:e.text}),(0,F.jsx)(`td`,{className:f(D,e.cases.length?`text-ink-2`:`text-warn`),children:e.cases.length?e.cases.join(`, `):`no case`})]},t))})}),(0,F.jsxs)(W,{id:`proposals-h`,icon:s,title:`Proposed changes`,children:[(0,F.jsx)(T,{label:`Proposed changes`,empty:`No change is waiting. save_test_cases in a chat proposes them.`,tools:(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y||!E.length||!!_,"data-tip":`Review ${z(E.length,`change`)}`,onClick:()=>void k(),children:[(0,F.jsx)(l,{"aria-hidden":`true`}),`Review (`,E.length,`)`]}),head:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`th`,{className:f(w,`w-10`),children:(0,F.jsx)(`span`,{className:`sr-only`,children:`Pick`})}),(0,F.jsx)(`th`,{className:w,children:`Change`}),(0,F.jsx)(`th`,{className:w,children:`Existing case`}),(0,F.jsx)(`th`,{className:w,children:`The agent wrote`})]}),children:i.proposals.map(e=>{let t=B(e);return(0,F.jsxs)(`tr`,{className:O,children:[(0,F.jsx)(`td`,{className:D,children:(0,F.jsx)(N,{"aria-label":`${V(e)}: ${e.id} ${e.title}`,checked:h.includes(t),disabled:y||!!_,onCheckedChange:e=>g(e?[...h,t]:h.filter(e=>e!==t))})}),(0,F.jsxs)(`td`,{className:f(D,`whitespace-nowrap font-medium`),children:[V(e),e.link&&e.kind!==`link`&&(0,F.jsx)(`span`,{className:`block text-[12px] font-normal text-muted`,children:`and link it`})]}),(0,F.jsxs)(`td`,{className:f(D,`[overflow-wrap:anywhere]`),children:[(0,F.jsx)(`span`,{className:`font-mono text-[12px] text-ink-2`,children:e.id}),` `,e.title]}),(0,F.jsx)(`td`,{className:f(D,`text-ink-2 [overflow-wrap:anywhere]`),children:e.wrote})]},t)})}),_&&(0,F.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Apply the changes`,className:`flex flex-col gap-2 rounded-[10px] border border-accent-line bg-accent-soft p-3 text-[13px]`,children:[(0,F.jsxs)(`span`,{className:`font-medium`,children:[`Apply `,z(_.changes.length,`change`),` to `,I.find(e=>e.id===i.system)?.label,`?`]}),(0,F.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-ink-2`,children:_.lines.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(m,{size:`sm`,variant:`primary`,disabled:y,onClick:()=>void A(),children:[(0,F.jsx)(n,{"aria-hidden":`true`}),`Apply`]}),(0,F.jsxs)(m,{size:`sm`,disabled:y,onClick:()=>v(null),children:[(0,F.jsx)(t,{"aria-hidden":`true`}),`Cancel`]})]})]}),x&&x.applied.length>0&&(0,F.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Applied: `,x.applied.join(`, `)]}),x&&x.failed.length>0&&(0,F.jsxs)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:[`Not applied: `,x.failed.map(e=>`${e.id||`a change`}: ${e.error}`).join(`; `)]})]}),(0,F.jsx)(W,{id:`changes-h`,icon:r,title:`Recent changes`,children:i.changes.length?(0,F.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:i.changes.map((e,t)=>(0,F.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},t))}):(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`ForgeQE has not changed this story's cases.`})}),i.notes.map((e,t)=>(0,F.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:e},t))]})}function K({sub:t}){let{systems:n,error:r}=U(),i=t?t.indexOf(`/`):-1,a=i>0?t.slice(0,i):t,o=L(a)?a:void 0,s=o&&i>0?_(t.slice(i+1)):``,[c,l]=(0,P.useState)(o??`azure_devops`),[d,h]=(0,P.useState)(s),[v,b]=(0,P.useState)(null),[w,T]=(0,P.useState)(``),[D,O]=(0,P.useState)(!1);(0,P.useEffect)(()=>{o&&l(o),h(s)},[o,s]),(0,P.useEffect)(()=>{!o&&n.length&&!n.some(e=>e.id===c)&&l(n[0].id)},[n,c,o]);let j=(0,P.useCallback)(()=>{!o||!s?b(null):(O(!0),p.view(o,s).then(e=>{b(e),T(``),O(!1)},e=>{T(e.message),O(!1)}))},[o,s]);return(0,P.useEffect)(()=>b(null),[o,s]),(0,P.useEffect)(j,[j]),(0,F.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,F.jsx)(E,{}),(0,F.jsxs)(`main`,{className:f(k,`@container flex-auto gap-4`),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(C,{pixel:A[`test-cases`],size:`lg`}),(0,F.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test cases`})]}),(0,F.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-ink-2`,children:[`A story's test cases in your test management system: which are older than the story's last change, which acceptance criteria no case covers, and the changes save_test_cases proposed. Tick the ones to make; nothing is written until you review and apply them. The tests that run them are on `,(0,F.jsx)(`a`,{href:y(`regression`),children:`Regression`}),`; their results on `,(0,F.jsx)(`a`,{href:y(`runs`),children:`Runs`}),`.`]}),(0,F.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=d.trim();if(!t)return;let n=y(`test-cases`,c,encodeURIComponent(t));location.hash===n?j():location.hash=n},className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{role:`group`,"aria-label":`System`,className:`flex flex-wrap gap-1.5`,children:(0,F.jsx)(S,{items:n,value:c,onChange:l})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,F.jsxs)(`label`,{className:`flex min-w-0 flex-[0_1_320px] flex-col gap-1 text-[13px] font-medium`,children:[`Story`,(0,F.jsx)(g,{value:d,maxLength:120,spellCheck:!1,placeholder:c===`azure_devops`?`1234`:c===`qtest`?`5678`:c===`testrail`?`R12`:`SHOP-12`,onChange:e=>h(e.target.value)})]}),(0,F.jsxs)(m,{type:`submit`,variant:`primary`,disabled:!d.trim()||D,"data-tip":`Open the story's test cases`,children:[(0,F.jsx)(u,{"aria-hidden":`true`}),`Open`]})]})]}),[r,w].filter(Boolean).map(e=>(0,F.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e},e)),D&&(0,F.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),v&&(0,F.jsx)(G,{view:v,onApplied:j,onError:T},`${v.system}:${v.story.id}`),!s&&!v&&(0,F.jsx)(x,{icon:e,title:`No story opened yet`,children:`Pick the system and type a story's id to see its linked test cases, its acceptance criteria and which cases trace to them. When save_test_cases runs in a chat for a story, the changes it proposes to existing cases show here to apply.`})]})]})}export{K as TestCases};
@@ -0,0 +1,2 @@
1
+ import{Ar as e,C as t,D as n,Fr as r,Ir as i,Mn as a,Nr as o,Q as s,Qn as c,T as l,a as u,it as d,ln as f,pr as p,tt as m,yt as h}from"./line-icons-CQ-3V8ax.js";import{B as g,R as _,V as v,Zt as y,a as b,c as x,dt as S,f as C,h as w,l as T,o as E,st as D,t as O,z as k}from"./filters-CflRmNDz.js";import{Ot as A,at as j,ct as M,it as ee,nt as N,ot as P,r as F,rt as I,t as te,vt as ne}from"./frame--ur6lpMR.js";import{r as L}from"./index-GLMqsotN.js";import{n as re}from"./segmented-CAf_qz5Z.js";import{a as ie,c as R,f as z,i as B,n as V,o as H,r as U,s as W,t as G,u as K}from"./dataParts-DRO6c2Kb.js";var q=r({Requests:()=>Q,TestData:()=>$}),J=i(o(),1),Y=y(),X=[`requests`,`kept`,`specs`,`batches`],Z={fetch:`kept`,request:`requests`,gen:`specs`,files:`specs`,insert:`specs`,batches:`batches`,clean:`batches`},ae=e=>Object.values(e.row_counts||{}).reduce((e,t)=>e+t,0);function oe({e,kept:t,busy:n,act:r}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 px-1 py-2`,children:[(0,Y.jsxs)(`dl`,{className:`m-0 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`Asked for`}),(0,Y.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`When`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[new Date(e.at).toLocaleString(),e.ms===void 0?``:` · answered in ${(e.ms/1e3).toFixed(1)} s`]}),(0,Y.jsx)(`dt`,{className:`text-muted`,children:`How`}),(0,Y.jsxs)(`dd`,{className:`m-0`,children:[e.source===`fetch`?`A kept request fetched again, with no model`:`Asked the DB agent for ${e.asked===`existing`?`existing rows`:e.asked===`new`?`new rows`:`either`}`,e.name?(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.name})]}):null]}),e.why&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted`,children:`The answer`}),(0,Y.jsx)(`dd`,{className:`m-0`,children:e.why})]})]}),e.error&&(0,Y.jsx)(R,{text:e.error}),Object.entries(e.sample||{}).map(([t,n])=>(0,Y.jsx)(K,{title:t===`result`?`Rows found`:t,rows:n,total:e.row_counts?.[t]??n.length},t)),e.sql&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`The query`}),(0,Y.jsx)(V,{label:`SQL`,children:e.sql})]}),e.script_preview?.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:`INSERT script`}),(0,Y.jsx)(V,{label:`INSERT script`,children:e.script_preview.join(`
2
+ `)})]}):null,t&&e.name&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(_,{size:`sm`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"data-tip":`Fetch again`,children:[(0,Y.jsx)(a,{"aria-hidden":`true`}),`Refresh`]})})]})}function Q({view:e,log:t,busy:r,act:i}){let[a,o]=(0,J.useState)(`all`),[s,c]=(0,J.useState)(``),[u,d]=(0,J.useState)(``),[p,m]=(0,J.useState)(``),_=t??[],v=(0,J.useMemo)(()=>[...new Set(_.map(e=>e.requester))].sort(),[t]),y=(0,J.useMemo)(()=>[...new Set(_.map(e=>e.database).filter(Boolean))].sort(),[t]),b=_.filter(e=>!e.ok).length,S=_.filter(e=>(a===`all`||a===`ok`===e.ok)&&(!s||e.requester===s)&&(!u||e.database===u)),w=new Set(e.requests.map(e=>e.name));return t===null?(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading the requests…`}):_.length?(0,Y.jsx)(N,{label:`Requests`,resetKey:`${a}|${s}|${u}`,minWidth:760,fixed:!0,placeholder:`Find a request`,tools:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{value:a,onChange:o,items:[{id:`all`,label:`All`,n:_.length},{id:`ok`,label:`Answered`,n:_.length-b},{id:`failed`,label:`Failed`,n:b,alert:!0}]}),v.length>1&&(0,Y.jsxs)(E,{size:`sm`,"aria-label":`Who asked`,value:s,onChange:e=>c(e.target.value),className:`w-[180px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Anyone`}),v.map(e=>(0,Y.jsx)(`option`,{children:e},e))]}),y.length>1&&(0,Y.jsxs)(E,{size:`sm`,"aria-label":`Database`,value:u,onChange:e=>d(e.target.value),className:`w-[160px]`,children:[(0,Y.jsx)(`option`,{value:``,children:`Any database`}),y.map(e=>(0,Y.jsx)(`option`,{children:e},e))]})]}),head:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`th`,{className:g(j,`w-9`),children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Open`})}),(0,Y.jsx)(`th`,{className:g(j,`w-[110px]`),children:`When`}),(0,Y.jsx)(`th`,{className:g(j,`w-[150px]`),children:`Who asked`}),(0,Y.jsx)(`th`,{className:j,children:`What for`}),(0,Y.jsx)(`th`,{className:g(j,`w-[110px]`),children:`Database`}),(0,Y.jsx)(`th`,{className:g(j,`w-[140px]`),children:`Answer`}),(0,Y.jsx)(`th`,{className:g(P,`w-[70px]`),children:`Rows`})]}),empty:`No requests match these filters. Pick All and Anyone to see every request.`,children:S.map(e=>{let t=p===e.id;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`tr`,{className:g(M,t&&`bg-surface-muted`),onClick:()=>m(t?``:e.id),children:[(0,Y.jsx)(`td`,{className:g(I,`pr-0`),children:(0,Y.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":t?`Close the request`:`Open the request`,onClick:n=>(n.stopPropagation(),m(t?``:e.id)),className:`flex cursor-pointer items-center border-0 bg-transparent p-0 text-muted`,children:t?(0,Y.jsx)(l,{size:16,"aria-hidden":`true`}):(0,Y.jsx)(n,{size:16,"aria-hidden":`true`})})}),(0,Y.jsx)(`td`,{className:g(I,`whitespace-nowrap text-muted`),"data-tip":new Date(e.at).toLocaleString(),children:L(e.at)}),(0,Y.jsx)(`td`,{className:g(I,`truncate`),"data-tip":e.requester,children:e.requester}),(0,Y.jsxs)(`td`,{className:g(I,`truncate`),"data-tip":e.need,children:[e.need,e.source===`fetch`?(0,Y.jsx)(`span`,{className:`text-muted`,children:` · fetched again`}):null]}),(0,Y.jsx)(`td`,{className:g(I,`truncate`),"data-tip":e.database,children:e.database||(0,Y.jsx)(`span`,{className:`text-muted`,children:`—`})}),(0,Y.jsx)(`td`,{className:g(I,`whitespace-nowrap`),children:(0,Y.jsx)(x,{tone:e.ok?`pass`:`fail`,children:e.ok?H[e.kind||``]||`Answered`:`Failed`})}),(0,Y.jsx)(`td`,{className:ee,children:e.ok?ae(e):``})]}),t&&(0,Y.jsx)(`tr`,{className:`border-t border-line-soft bg-surface-muted/40`,children:(0,Y.jsx)(`td`,{colSpan:7,className:`max-w-0 px-4 py-2`,children:(0,Y.jsx)(oe,{e,kept:!!e.name&&w.has(e.name),busy:r,act:i})})})]},e.id)})}):(0,Y.jsx)(T,{icon:h,title:`No test data asked for yet`,action:(0,Y.jsxs)(`a`,{href:C(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(k({size:`sm`}),`no-underline`),children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Ask`]}),children:`The agents ask before a test runs, or you can ask yourself.`})}function se({view:e,job:t,busy:n,act:r,onNote:i}){let o=t&&!t.running&&t.kind===`fetch`?t:null,s=o?.result;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Each request is kept in test-data/requests with its query or INSERT script. Fetch one again to get the same data with no model: a query reads the rows there now, a spec makes the same rows.`}),o&&(0,Y.jsxs)(`section`,{"aria-label":`Fetched ${o.target}`,className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsx)(`h2`,{className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:o.target}),s&&!s.ok&&(0,Y.jsx)(R,{text:s.error||`It could not fetch the data.`}),s?.ok&&(0,Y.jsx)(G,{r:s,onNote:i})]}),e.requests.length===0?(0,Y.jsxs)(T,{className:`py-3`,children:[`No kept requests yet. Each request the DB agent answers is kept here; `,(0,Y.jsx)(`a`,{href:C(`data`,`ask`,`test-data`),children:`ask for test data`}),` to make the first.`]}):(0,Y.jsx)(W,{items:e.requests,text:e=>`${e.need} ${e.name} ${e.database} ${e.requester||``}`,label:`Kept requests`,size:15,children:e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.need}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,e.database,` · `,H[e.kind],e.rows?` · ${v(e.rows,`row`)}`:``,e.created?` · ${L(e.created)}`:``,e.requester?` · asked by ${e.requester}`:``]})]}),(0,Y.jsx)(_,{size:`icon`,variant:`icon`,disabled:n,onClick:()=>r(`fetch`,{name:e.name}),"aria-label":`Fetch ${e.name} again`,"data-tip":`Fetch ${e.name} again`,className:`size-8`,children:(0,Y.jsx)(a,{"aria-hidden":`true`})})]},e.name)})]})}function ce({view:t,job:n,busy:r,act:i,onNote:a}){let[o,c]=(0,J.useState)(t.specs[0]??``),[l,u]=(0,J.useState)(``),[p,g]=(0,J.useState)(``),[v,y]=(0,J.useState)(`csv`),[x,S]=(0,J.useState)(!1),O={spec:o,...l?{db:l}:{},...p?{seed:p}:{}},k=n&&!n.running?n:null,A=k&&[`gen`,`files`,`insert`].includes(k.kind)&&k.target===o?k.result:void 0,j=t.databases.find(e=>e.name===l),M=async()=>{try{let{id:e}=await D.start(`Write a test data spec for this project (a YAML file with tables: under test-data/), from the database's schema. Show me the spec and a preview before you save it.`,{});location.hash=C(`chats`,e)}catch(e){a(e.message)}};return(0,Y.jsxs)(`section`,{"aria-labelledby":`spec-h`,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsxs)(`h2`,{id:`spec-h`,className:`m-0 flex flex-1 items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(w,{icon:h,size:18,className:`text-accent-fg`}),`Make test data from a spec`]}),(0,Y.jsxs)(_,{variant:`ghost`,onClick:()=>void M(),"data-tip":`Write a spec in a chat`,children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Chat`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`A spec is a YAML file with tables: and what goes in each column. The same spec and seed make the same data again, so a test or a pipeline can rely on it. No model is used.`}),t.specs.length===0?(0,Y.jsx)(T,{className:`py-3`,children:`No specs in this project yet: a YAML file with tables: in test-data/, data/ or specs/. Write one in a chat, from a database's schema.`}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[14px] card border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[2_1_260px] flex-col gap-1.5 text-sm font-medium`,children:[`Spec`,(0,Y.jsx)(E,{value:o,onChange:e=>c(e.target.value),children:t.specs.map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_180px] flex-col gap-1.5 text-sm font-medium`,children:[`Database`,(0,Y.jsxs)(E,{value:l,onChange:e=>u(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`The spec's own`}),t.databases.map(e=>(0,Y.jsxs)(`option`,{value:e.name,children:[e.name,e.writable?``:` (read only)`]},e.name))]})]}),(0,Y.jsxs)(`label`,{className:`flex w-[120px] flex-col gap-1.5 text-sm font-medium`,children:[`Seed`,(0,Y.jsx)(b,{value:p,inputMode:`numeric`,placeholder:`Random`,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,9))})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(_,{variant:x?void 0:`primary`,disabled:r||!o,onClick:()=>i(`gen`,O),children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Preview`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsxs)(_,{disabled:r||!o,onClick:()=>i(`gen`,{...O,mode:`files`,format:v}),"data-tip":`Write files (${v})`,children:[(0,Y.jsx)(m,{"aria-hidden":`true`}),`Export`]}),(0,Y.jsx)(E,{"aria-label":`File format`,value:v,onChange:e=>y(e.target.value),className:`w-[88px]`,children:[`csv`,`json`,`sql`].map(e=>(0,Y.jsx)(`option`,{children:e},e))})]}),(0,Y.jsxs)(_,{disabled:r||!o||!j?.writable,"data-tip":j?.writable?`Insert into ${j.name}`:`Pick a writable database to insert into`,onClick:()=>S(!0),children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Insert`]})]}),x&&j&&(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Insert test data`,className:`flex flex-col gap-3 rounded-[12px] border border-warn bg-warn-soft p-4`,children:[(0,Y.jsxs)(`span`,{className:`font-medium`,children:[`Insert the rows of `,o,` into `,j.name,`?`]}),(0,Y.jsx)(`span`,{className:`text-sm text-ink-2`,children:`They go in as one batch, which you can remove again under Batches. Only on a test database.`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(_,{variant:`primary`,onClick:()=>{S(!1),i(`gen`,{...O,mode:`insert`,confirmed:!0})},children:[(0,Y.jsx)(s,{"aria-hidden":`true`}),`Insert`]}),(0,Y.jsxs)(_,{onClick:()=>S(!1),"data-tip":`Don't insert`,children:[(0,Y.jsx)(e,{"aria-hidden":`true`}),`Cancel`]})]})]}),A&&!A.ok&&(0,Y.jsx)(R,{text:A.error||`It did not make the data.`}),A?.ok&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A.batch&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Inserted as batch `,(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:A.batch}),`.`]}),A.files?.length?(0,Y.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[`Wrote`,A.files.map(e=>(0,Y.jsx)(U,{file:e,onNote:a},e))]}):null,(0,Y.jsx)(B,{r:A})]})]})]})}function le({view:e,job:n,busy:r,act:i}){let a=e.databases.filter(e=>e.writable),[o,s]=(0,J.useState)(a[0]?.name??``),[l,u]=(0,J.useState)(``),f=n&&!n.running?n:null,m=f?.kind===`batches`?(Array.isArray(f.result)?f.result.flatMap(e=>e.batches||[]):f.result?.batches)??[]:null;return(0,Y.jsxs)(`section`,{"aria-labelledby":`batch-h`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`h2`,{id:`batch-h`,className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Y.jsx)(w,{icon:c,size:18,className:`text-accent-fg`}),`Inserted batches`]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[70ch] text-sm leading-relaxed text-ink-2`,children:`Rows inserted from a spec go in as a batch. Remove a batch to take exactly those rows out again, children first.`}),a.length===0?(0,Y.jsx)(T,{className:`py-3`,children:`No writable database: test data is inserted only into one marked writable in Settings, Databases.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{"aria-label":`Database`,value:o,onChange:e=>s(e.target.value),className:`w-[220px]`,children:a.map(e=>(0,Y.jsx)(`option`,{children:e.name},e.name))}),(0,Y.jsxs)(_,{disabled:r||!o,onClick:()=>i(`batches`,{db:o}),"data-tip":`List batches`,children:[(0,Y.jsx)(d,{"aria-hidden":`true`}),`Show`]})]}),m&&m.length===0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No batches in `,f?.target,`.`]}),m&&m.length>0&&(0,Y.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:m.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] flex-wrap items-center gap-3 border-t border-line-soft py-2.5 text-sm first:border-t-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.batch}),(0,Y.jsxs)(`span`,{className:`text-[12px] text-muted`,children:[(0,Y.jsx)(`span`,{"data-tip":new Date(e.created).toLocaleString(),children:L(e.created)}),e.spec?` · ${e.spec}`:``,` ·`,` `,Object.entries(e.rows).map(([e,t])=>`${e} ${t}`).join(`, `)]})]}),l===e.batch?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-[13px] text-warn`,children:[`Remove its rows from `,f?.target,`?`]}),(0,Y.jsxs)(_,{variant:`danger`,size:`sm`,onClick:()=>{u(``),i(`clean`,{db:f?.target,batch:e.batch,confirmed:!0})},children:[(0,Y.jsx)(p,{"aria-hidden":`true`}),`Remove`]}),(0,Y.jsxs)(_,{size:`sm`,onClick:()=>u(``),children:[(0,Y.jsx)(t,{"aria-hidden":`true`}),`Keep`]})]}):(0,Y.jsx)(_,{size:`icon`,variant:`icon`,disabled:r,onClick:()=>u(e.batch),"aria-label":`Remove batch ${e.batch}`,"data-tip":`Remove batch ${e.batch}`,className:`size-8`,children:(0,Y.jsx)(p,{"aria-hidden":`true`})})]},e.batch))}),f?.kind===`clean`&&f.result?.ok&&(0,Y.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-pass-soft px-3 py-2 text-sm text-pass`,children:[`Removed:`,` `,Object.entries(f.result.removed||{}).map(([e,t])=>`${e} ${t}`).join(`, `)]})]})]})}function $({sub:e}){let{view:t,error:n,busy:r,act:i,stop:a,job:o}=z(),[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(``),p=X.includes(e)?e:`requests`,m=o&&!o.running?o.endedAt:``;(0,J.useEffect)(()=>{S.log().then(c,e=>d(e.message))},[m]);let h=(s||[]).filter(e=>!e.ok).length,_=new Set((s||[]).map(e=>e.requester)).size,y={requests:`Requests${s?` (${s.length})`:``}`,kept:`Kept${t?` (${t.requests.length})`:``}`,specs:`Specs${t?` (${t.specs.length})`:``}`,batches:`Batches`};return(0,Y.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,Y.jsx)(F,{}),(0,Y.jsxs)(`main`,{className:g(te,`@container flex-auto gap-4`),children:[(0,Y.jsxs)(`a`,{href:C(`data`,`databases`),className:`inline-flex w-fit items-center gap-1.5 text-sm`,children:[(0,Y.jsx)(u,{size:16,"aria-hidden":`true`}),`All databases`]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(A,{pixel:ne[`test-data`],size:`lg`}),(0,Y.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Test data`}),(0,Y.jsxs)(`a`,{href:C(`data`,`ask`,`test-data`),"data-tip":`Ask for test data`,className:g(k(),`no-underline`),children:[(0,Y.jsx)(f,{"aria-hidden":`true`}),`Ask`]})]}),(0,Y.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2`,children:`Every request for test data: which agent asked, what for, when, and what the DB agent sent back. Kept requests fetch the same data again with no model; specs make data you can insert as batches and remove again.`}),s&&s.length>0&&(0,Y.jsxs)(`p`,{className:`m-0 text-sm text-ink-2 tabular-nums`,children:[v(s.length,`request`),` · `,v(_,`asker`),` · `,(0,Y.jsxs)(`span`,{className:h?`text-fail`:``,children:[h,` failed`]}),t?` · ${t.requests.length} kept`:``]}),(n||l)&&(0,Y.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-3 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:n||l}),!t&&!n&&(0,Y.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(re,{label:`Test data`,current:p,onPick:e=>location.hash=C(`test-data`,e),tabs:X.map(e=>({id:e,label:y[e]}))}),o&&(o.running?Z[o.kind]!==void 0:Z[o.kind]===p)&&(0,Y.jsx)(ie,{job:o,onStop:a}),(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`,children:[p===`requests`&&(0,Y.jsx)(Q,{view:t,log:s,busy:r,act:i}),p===`kept`&&(0,Y.jsx)(se,{view:t,job:o,busy:r,act:i,onNote:d}),p===`specs`&&(0,Y.jsx)(ce,{view:t,job:o,busy:r,act:i,onNote:d}),p===`batches`&&(0,Y.jsx)(le,{view:t,job:o,busy:r,act:i})]})]})]})]})}export{q as n,Q as t};