@capagents/forgeqe 3.0.2 → 3.0.3

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 (64) hide show
  1. package/dist/forgeqe.js +1722 -1722
  2. package/dist/web/assets/{Agent-CNIwgz9P.js → Agent-Bha4Lr91.js} +1 -1
  3. package/dist/web/assets/{ApiTests-CuflKFaz.js → ApiTests-xhnOnRi9.js} +2 -2
  4. package/dist/web/assets/{Browse-D6cvDJW3.js → Browse-DPfzCrMZ.js} +2 -2
  5. package/dist/web/assets/{Chat-BwlScUXP.js → Chat-DuLj5IPw.js} +1 -1
  6. package/dist/web/assets/{CommandPalette-Dkb2OOQX.js → CommandPalette-CAAPFMZn.js} +1 -1
  7. package/dist/web/assets/{Compare-Esy5n-kR.js → Compare-DZfbMjDK.js} +1 -1
  8. package/dist/web/assets/{Cost-BIoJmbfg.js → Cost-PNcsRgPW.js} +1 -1
  9. package/dist/web/assets/{Data-3Q5bGxT5.js → Data-DaKzcO_S.js} +1 -1
  10. package/dist/web/assets/{Desktop-CsEWht_F.js → Desktop-sXYXYwRy.js} +1 -1
  11. package/dist/web/assets/{DesktopReview-BUfM70Ju.js → DesktopReview-Bz6bfPkM.js} +1 -1
  12. package/dist/web/assets/{Evidence-DEDtYoZr.js → Evidence-CijYL67k.js} +1 -1
  13. package/dist/web/assets/{Explore-AXLdkUHT.js → Explore-DZ5PoVZp.js} +1 -1
  14. package/dist/web/assets/{Features-DcDbE20H.js → Features-BvZfZIb7.js} +1 -1
  15. package/dist/web/assets/{Flags-CSKvhaye.js → Flags-B_-HOAeZ.js} +1 -1
  16. package/dist/web/assets/{Flaky-B48EUqK0.js → Flaky-CWyV0rE3.js} +1 -1
  17. package/dist/web/assets/{Impact-BTLqgWf6.js → Impact-BqHiKxoG.js} +1 -1
  18. package/dist/web/assets/{Jobs-C2UViADN.js → Jobs-DUfRHoko.js} +1 -1
  19. package/dist/web/assets/{KindPage-DBWC-d0o.js → KindPage-Dj3vryGF.js} +1 -1
  20. package/dist/web/assets/{Migration-TR5UJVZD.js → Migration-CP3o4tLy.js} +1 -1
  21. package/dist/web/assets/{Product-CDAzt1hG.js → Product-BeHmrA7Z.js} +1 -1
  22. package/dist/web/assets/{Production-sUNlZeSF.js → Production-Dakb3WS-.js} +1 -1
  23. package/dist/web/assets/{Quality-C9Z0FYjK.js → Quality-CcrANX20.js} +1 -1
  24. package/dist/web/assets/{Readiness-Qse6Oxo-.js → Readiness-DvYQ17Oh.js} +1 -1
  25. package/dist/web/assets/{Record-BPd38INk.js → Record-V7x9VxRQ.js} +1 -1
  26. package/dist/web/assets/{Regression-Brk_1yqk.js → Regression-DgXh0V-X.js} +1 -1
  27. package/dist/web/assets/{RelationGraph-CV8NXesZ.js → RelationGraph-evMcSFoO.js} +1 -1
  28. package/dist/web/assets/{Reports-C4U0fIue.js → Reports--eyV0Gfp.js} +1 -1
  29. package/dist/web/assets/{Response-B1iCzkHo.js → Response-B1S-n787.js} +1 -1
  30. package/dist/web/assets/{RunDiff-DUREV_nk.js → RunDiff-DwEopDsx.js} +1 -1
  31. package/dist/web/assets/{Runs-B--vjy7q.js → Runs-B6bSGdrI.js} +1 -1
  32. package/dist/web/assets/{Steps-Bt1rmBc3.js → Steps-DxPqrmZK.js} +1 -1
  33. package/dist/web/assets/{TestCases-CVSJIPFl.js → TestCases-93xQKkMT.js} +1 -1
  34. package/dist/web/assets/{TestData-_sZDpddH.js → TestData-BiW5r9gA.js} +1 -1
  35. package/dist/web/assets/{TestDebt-D5NgM75J.js → TestDebt-CE62ftuJ.js} +1 -1
  36. package/dist/web/assets/{Tosca-BcfNYUdZ.js → Tosca-CrvuVNqG.js} +1 -1
  37. package/dist/web/assets/{WhatsNew-BtwiaM4Q.js → WhatsNew-lX-LhWKt.js} +1 -1
  38. package/dist/web/assets/{agentLink-BD93RYQ0.js → agentLink-ZQZx1pK-.js} +1 -1
  39. package/dist/web/assets/{dataParts-CxOVAp8R.js → dataParts-LCnV1x8c.js} +1 -1
  40. package/dist/web/assets/{families-BLmK1isi.js → families-DLmHA4rL.js} +1 -1
  41. package/dist/web/assets/filters-CorGh2vA.js +1 -0
  42. package/dist/web/assets/{fold-GeY4MiIu.js → fold-pif2b5qg.js} +1 -1
  43. package/dist/web/assets/frame-BgpCUEoM.js +18 -0
  44. package/dist/web/assets/index-0YhzcgZJ.css +2 -0
  45. package/dist/web/assets/{index-9ELkRoKH.js → index-CEVZ8F8_.js} +4 -4
  46. package/dist/web/assets/{logos-COH9UQgY.js → logos-gqcS1A90.js} +1 -1
  47. package/dist/web/assets/{markdown-DoF5NaZz.js → markdown-BcuknPlh.js} +1 -1
  48. package/dist/web/assets/{paletteCommands-BlCwQKjX.js → paletteCommands-qeRU49pp.js} +1 -1
  49. package/dist/web/assets/{parts-Bx4MyFXM.js → parts-C7nGHnut.js} +1 -1
  50. package/dist/web/assets/{productParts-DTtbe-g-.js → productParts-3lWHIbdH.js} +1 -1
  51. package/dist/web/assets/{qualityParts-DbH_PNDs.js → qualityParts-B-TQusS6.js} +1 -1
  52. package/dist/web/assets/{recordTest-Brs1Sw9O.js → recordTest-BmD8jtw0.js} +1 -1
  53. package/dist/web/assets/{rows-vliRYT-Z.js → rows-vVKLONno.js} +1 -1
  54. package/dist/web/assets/{segmented-Bisag9SK.js → segmented-Bi4QAoQY.js} +1 -1
  55. package/dist/web/assets/{usePageChat-B-4sWqvn.js → usePageChat-De5Fn1X3.js} +1 -1
  56. package/dist/web/index.html +5 -5
  57. package/package.json +1 -1
  58. package/prompts/brain.md +3 -0
  59. package/prompts/talk.md +2 -2
  60. package/py/forgeqe_engine/video.py +0 -8
  61. package/py/forgeqe_voice/worker.py +10 -2
  62. package/dist/web/assets/filters-YzD0tZES.js +0 -1
  63. package/dist/web/assets/frame-CaTNV7DF.js +0 -18
  64. package/dist/web/assets/index-B_mKjNAi.css +0 -2
@@ -1 +1 @@
1
- import{Lr as e,Nn as t,Pr as n,er as r,jr as i}from"./line-icons-DBwNPSmu.js";import{V as a,en as o,z as s}from"./filters-YzD0tZES.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=e(n(),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 $=o(),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:e,nodes:n,edges:o,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=n.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)),r=new Set;return{nodes:e,edges:o.filter(e=>t.has(e.from)&&t.has(e.to)&&!r.has(e.id)&&!!r.add(e.id)).map(e=>({id:e.id,source:e.from,target:e.to,from:e.from,to:e.to,label:e.label}))}},[n,o]);(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`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),b&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:b})]}),m&&(0,$.jsxs)(s,{size:`sm`,disabled:h,onClick:m,"data-tip":`Read the population again`,children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Refresh`]}),(0,$.jsx)(s,{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)(r,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{ref:j,tabIndex:0,role:`application`,"aria-roledescription":`graph`,"aria-label":`${e}: ${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-4`,children:[(0,$.jsx)(`h4`,{className:`m-0 flex-1 text-[13px] font-semibold text-ink`,children:p.title}),p.pill&&(0,$.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[13px] font-medium text-white`,style:{background:p.pill.colour},children:p.pill.text}),(0,$.jsx)(s,{variant:`icon`,size:`icon-sm`,"aria-label":`Close the details`,"data-tip":`Close the details`,onClick:()=>f(null),children:(0,$.jsx)(i,{"aria-hidden":`true`})})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-4 px-4 py-4 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-4 shadow-md`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`h4`,{className:`m-0 mb-2 text-[13px] 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-2 p-0 text-[13px] text-ink-2 @md:grid-cols-2 @2xl:grid-cols-3`,children:[C?C.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,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-2`,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-4 py-2 text-[13px] 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-2 border-t border-line-soft pt-4`,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 py-1 text-[13px] 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};
1
+ import{Lr as e,Nn as t,Pr as n,er as r,jr as i}from"./line-icons-DBwNPSmu.js";import{V as a,en as o,z as s}from"./filters-CorGh2vA.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=e(n(),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 $=o(),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:e,nodes:n,edges:o,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=n.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)),r=new Set;return{nodes:e,edges:o.filter(e=>t.has(e.from)&&t.has(e.to)&&!r.has(e.id)&&!!r.add(e.id)).map(e=>({id:e.id,source:e.from,target:e.to,from:e.from,to:e.to,label:e.label}))}},[n,o]);(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`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),b&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:b})]}),m&&(0,$.jsxs)(s,{size:`sm`,disabled:h,onClick:m,"data-tip":`Read the population again`,children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Refresh`]}),(0,$.jsx)(s,{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)(r,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{ref:j,tabIndex:0,role:`application`,"aria-roledescription":`graph`,"aria-label":`${e}: ${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-4`,children:[(0,$.jsx)(`h4`,{className:`m-0 flex-1 text-[13px] font-semibold text-ink`,children:p.title}),p.pill&&(0,$.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[13px] font-medium text-white`,style:{background:p.pill.colour},children:p.pill.text}),(0,$.jsx)(s,{variant:`icon`,size:`icon-sm`,"aria-label":`Close the details`,"data-tip":`Close the details`,onClick:()=>f(null),children:(0,$.jsx)(i,{"aria-hidden":`true`})})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-4 px-4 py-4 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-4 shadow-md`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`h4`,{className:`m-0 mb-2 text-[13px] 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-2 p-0 text-[13px] text-ink-2 @md:grid-cols-2 @2xl:grid-cols-3`,children:[C?C.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,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-2`,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-4 py-2 text-[13px] 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-2 border-t border-line-soft pt-4`,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 py-1 text-[13px] 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};
@@ -1,2 +1,2 @@
1
- import{L as e,Lr as t,M as n,Nn as r,Nt as i,Pr as a,T as o,ht as s,j as c,ln as l,ot as u}from"./line-icons-DBwNPSmu.js";import{B as d,H as f,Lt as p,V as m,en as h,h as g,i as _,l as v,o as y,p as b,u as x,z as S}from"./filters-YzD0tZES.js";import{K as C,q as w,r as T,t as E,tt as D,un as O,w as k,x as A}from"./frame-CaTNV7DF.js";import{n as j}from"./markdown-DoF5NaZz.js";import{i as M,r as N}from"./index-9ELkRoKH.js";import{t as P}from"./segmented-Bisag9SK.js";import{r as F}from"./families-BLmK1isi.js";var I=t(a(),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:t}){let r=V(t),i=t.scope===`page`?s:r.tone===`pass`?c:r.tone===`fail`?e:n;return(0,L.jsx)(i,{size:16,"aria-label":r.label,className:m(`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:m(`flex min-w-0 flex-col rounded-[14px] card border px-4 py-4`,r),children:[(0,L.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:e}),t&&(0,L.jsx)(`p`,{className:`m-0 mt-1 text-[13px] text-muted`,children:t}),(0,L.jsx)(`div`,{className:`mt-4 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:m(`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-[13px] 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-[13px] text-ink-2`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,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-[13px] 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:m(`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-1`,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:m(`flex w-full flex-col justify-end gap-1 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:m(`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-4 py-2 text-[13px] 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:f(l.runs,`run`)})]})]}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-1 text-[13px] 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:m(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:t,build:n,onBuilt:a}){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 p.buildStatus();s(e),e&&!e.running&&a()}catch{}},1200);return()=>clearInterval(e)},[_,a]);let y=t.cases?Math.round(t.passed/t.cases*100):null,T=G(t.days.slice(-7)),E=G(t.days.slice(-14,-7)),D=T!==null&&E!==null?T-E:null,O=[{label:`Runs`,value:String(t.runs),sub:t.runs?`${W(String(t.from).slice(0,10))} – ${W(String(t.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(t.cases),sub:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[t.passed,` passed`]}),` · `,(0,L.jsxs)(`span`,{className:m(t.failed&&`text-fail`),children:[t.failed,` failed`]})]})},{label:`Tokens`,value:k(t.tokens),sub:t.cost?A(t.cost.amount,t.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:t.page?`The HTML report was built ${z(t.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),t.page&&(0,L.jsxs)(S,{size:`sm`,"data-tip":`Open the HTML report`,onClick:async()=>h(await x(t.page.file)),children:[(0,L.jsx)(u,{"aria-hidden":`true`}),`Report`]}),(0,L.jsx)(S,{size:`sm`,variant:`outline`,disabled:_,"data-tip":t.page?`Build the HTML report again`:`Build the HTML report`,onClick:async()=>{h(``);try{s(await p.build())}catch(e){h(e.message)}},children:_?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(g,{state:`working`,px:14}),`Building…`]}):t.page?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(r,{"aria-hidden":`true`}),`Rebuild`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(i,{"aria-hidden":`true`}),`Build`]})})]}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 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-4 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-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:o.lines.length?o.lines.join(`
1
+ import{L as e,Lr as t,M as n,Nn as r,Nt as i,Pr as a,T as o,ht as s,j as c,ln as l,ot as u}from"./line-icons-DBwNPSmu.js";import{B as d,H as f,Lt as p,V as m,en as h,h as g,i as _,l as v,o as y,p as b,u as x,z as S}from"./filters-CorGh2vA.js";import{K as C,q as w,r as T,t as E,tt as D,un as O,w as k,x as A}from"./frame-BgpCUEoM.js";import{n as j}from"./markdown-BcuknPlh.js";import{i as M,r as N}from"./index-CEVZ8F8_.js";import{t as P}from"./segmented-Bi4QAoQY.js";import{r as F}from"./families-DLmHA4rL.js";var I=t(a(),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:t}){let r=V(t),i=t.scope===`page`?s:r.tone===`pass`?c:r.tone===`fail`?e:n;return(0,L.jsx)(i,{size:16,"aria-label":r.label,className:m(`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:m(`flex min-w-0 flex-col rounded-[14px] card border px-4 py-4`,r),children:[(0,L.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:e}),t&&(0,L.jsx)(`p`,{className:`m-0 mt-1 text-[13px] text-muted`,children:t}),(0,L.jsx)(`div`,{className:`mt-4 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:m(`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-[13px] 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-[13px] text-ink-2`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,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-[13px] 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:m(`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-1`,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:m(`flex w-full flex-col justify-end gap-1 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:m(`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-4 py-2 text-[13px] 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:f(l.runs,`run`)})]})]}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-1 text-[13px] 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:m(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:t,build:n,onBuilt:a}){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 p.buildStatus();s(e),e&&!e.running&&a()}catch{}},1200);return()=>clearInterval(e)},[_,a]);let y=t.cases?Math.round(t.passed/t.cases*100):null,T=G(t.days.slice(-7)),E=G(t.days.slice(-14,-7)),D=T!==null&&E!==null?T-E:null,O=[{label:`Runs`,value:String(t.runs),sub:t.runs?`${W(String(t.from).slice(0,10))} – ${W(String(t.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(t.cases),sub:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[t.passed,` passed`]}),` · `,(0,L.jsxs)(`span`,{className:m(t.failed&&`text-fail`),children:[t.failed,` failed`]})]})},{label:`Tokens`,value:k(t.tokens),sub:t.cost?A(t.cost.amount,t.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:t.page?`The HTML report was built ${z(t.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),t.page&&(0,L.jsxs)(S,{size:`sm`,"data-tip":`Open the HTML report`,onClick:async()=>h(await x(t.page.file)),children:[(0,L.jsx)(u,{"aria-hidden":`true`}),`Report`]}),(0,L.jsx)(S,{size:`sm`,variant:`outline`,disabled:_,"data-tip":t.page?`Build the HTML report again`:`Build the HTML report`,onClick:async()=>{h(``);try{s(await p.build())}catch(e){h(e.message)}},children:_?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(g,{state:`working`,px:14}),`Building…`]}):t.page?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(r,{"aria-hidden":`true`}),`Rebuild`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(i,{"aria-hidden":`true`}),`Build`]})})]}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 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-4 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-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:o.lines.length?o.lines.join(`
2
2
  `):`Starting…`})]}),t.runs?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(w,{label:`Project numbers`,children:[(0,L.jsx)(C,{label:`Pass rate`,big:!0,value:y===null?`–`:`${y}%`,tone:y!==null&&y<80?`text-fail`:void 0,change:D===null?void 0:{text:D===0?`Same`:`${D>0?`+`:`−`}${Math.abs(D)} ${Math.abs(D)===1?`point`:`points`}`,dir:D>0?`up`:D<0?`down`:`same`,good:D>0,against:D===0?`as the week before`:`on the week before`}}),O.map(e=>(0,L.jsx)(C,{label:e.label,value:e.value,note:e.sub},e.label))]}),(0,L.jsx)(K,{title:`Cases by day`,note:`The last ${f(Math.min(30,t.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,L.jsx)(J,{days:t.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:t.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:t.failing.slice(0,8).map(t=>(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)(e,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,"data-tip":t.title,children:[t.id&&(0,L.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:t.id}),` `,t.title]}),(0,L.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:N(t.lastFailed)})]}),(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-4 pl-6`,children:[(0,L.jsx)(q,{part:t.failed,whole:t.runs,tone:`fail`,label:`failed ${t.failed} of ${t.runs}`}),t.summary&&(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[13px] text-muted`,children:t.summary.replace(/[*_`#>[\]]/g,``)})]})]},t.id||t.title))})}),(0,L.jsx)(K,{title:`Defects`,note:`Failures grouped by their cause.`,children:t.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:t.defects.slice(0,8).map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_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-[13px]`,"data-tip":e.title,children:e.title}),(0,L.jsxs)(`span`,{className:`text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[f(e.cases,`case`),` · `,f(e.runs,`run`),e.lastSeen?` · ${N(e.lastSeen)}`:``]})]},e.title))})}),(0,L.jsx)(K,{title:`Flaky`,note:`Cases that both passed and failed.`,children:t.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:t.flaky.slice(0,8).map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 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-[13px]`,"data-tip":e.title,children:[e.id&&(0,L.jsx)(`span`,{className:`font-mono text-[13px] 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:t.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:t.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-[13px]`,children:R[e.scope]||e.scope}),(0,L.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:f(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:d({size:`sm`}),href:b(),"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)(``),[d,f]=(0,I.useState)(`all`),[h,g]=(0,I.useState)(H),[v,b]=(0,I.useState)(``),C=(0,I.useCallback)(()=>{p.list().then(n,e=>i(e.message))},[]);(0,I.useEffect)(C,[C]);let w=e===`project`?`project`:`execution`,k=t?.rows??null,A=c.toLowerCase().split(/\s+/).filter(Boolean),W=(0,I.useMemo)(()=>(k||[]).filter(e=>(!a||e.scope===a)&&A.every(t=>`${e.title} ${e.id} ${R[e.scope]}`.toLowerCase().includes(t))),[k,a,c]),G=W.filter(e=>V(e).tone===`fail`).length,K=d===`failed`?W.filter(e=>V(e).tone===`fail`):W;(0,I.useEffect)(()=>g(H),[a,c,d]);let q=[...new Set((k||[]).map(e=>e.scope))];return(0,L.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,L.jsx)(T,{}),(0,L.jsxs)(`main`,{className:m(E,`@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)(D,{pixel:O.reports,size:`lg`}),(0,L.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,L.jsx)(P,{label:`Runs and reports`,links:F,current:w===`project`?`reports-project`:`reports`})]}),r&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 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&&w===`project`&&(0,L.jsx)(Y,{project:t.project,build:t.build,onBuilt:C}),t&&w===`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":d===e,onClick:()=>f(e),className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-4 text-[13px] font-medium`,d===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:m(`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)(y,{size:`sm`,id:`report-kind`,value:a,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,L.jsx)(`option`,{value:``,children:`Every kind`}),q.map(e=>(0,L.jsx)(`option`,{value:e,children:R[e]},e))]})]})]}),v&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:v}),(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-[13px] 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-2`,children:[K.length===0&&(0,L.jsx)(`li`,{className:`px-4 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,h).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-4 pt-4 pb-1 text-[13px] 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-4 rounded-[10px] px-4 py-2 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-[13px] font-medium`,"data-tip":e.title,children:e.title}),(0,L.jsx)(`span`,{className:`truncate text-[13px] 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:m(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)(S,{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()=>b(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>h||t.total>t.rows.length)&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:[(0,L.jsxs)(`span`,{children:[`Showing `,Math.min(h,K.length),` of `,K.length,t.total>t.rows.length?` (the newest ${t.rows.length} of ${t.total})`:``]}),K.length>h&&(0,L.jsxs)(S,{size:`sm`,onClick:()=>g(h+H),children:[(0,L.jsx)(o,{"aria-hidden":`true`}),`More (`,Math.min(H,K.length-h),`)`]})]})]})]})]})]})}export{X as Reports};
@@ -1,4 +1,4 @@
1
- import{A as e,Ar as t,C as n,Gn as r,Hn as i,In as a,J as o,Jn as s,Lr as c,Ot as l,Pr as u,T as d,Tt as f,Vn as ee,Wn as p,Z as m,cn as h,dt as g,ft as _,ht as v,ir as te,jr as y,jt as b,nn as x,o as ne,pt as re,tn as ie,tt as ae,ur as oe,vn as se,wt as ce,yt as S,z as le}from"./line-icons-DBwNPSmu.js";import{H as C,V as w,c as ue,en as de,g as T,h as E,v as fe,z as D}from"./filters-YzD0tZES.js";import{An as pe,Ft as O,Nt as k,_t as me,ft as he,gt as A,ht as ge,jt as j,ot as _e,pt as ve,un as ye,ut as be,vn as M,wn as N}from"./frame-CaTNV7DF.js";import{i as xe,n as P,r as F}from"./markdown-DoF5NaZz.js";import{t as Se}from"./fold-GeY4MiIu.js";var I=c(u(),1),L=de();function R({diff:e,className:t}){let n=0,r=0,i=e.split(`
1
+ import{A as e,Ar as t,C as n,Gn as r,Hn as i,In as a,J as o,Jn as s,Lr as c,Ot as l,Pr as u,T as d,Tt as f,Vn as ee,Wn as p,Z as m,cn as h,dt as g,ft as _,ht as v,ir as te,jr as y,jt as b,nn as x,o as ne,pt as re,tn as ie,tt as ae,ur as oe,vn as se,wt as ce,yt as S,z as le}from"./line-icons-DBwNPSmu.js";import{H as C,V as w,c as ue,en as de,g as T,h as E,v as fe,z as D}from"./filters-CorGh2vA.js";import{An as pe,Ft as O,Nt as k,_t as me,ft as he,gt as A,ht as ge,jt as j,ot as _e,pt as ve,un as ye,ut as be,vn as M,wn as N}from"./frame-BgpCUEoM.js";import{i as xe,n as P,r as F}from"./markdown-BcuknPlh.js";import{t as Se}from"./fold-pif2b5qg.js";var I=c(u(),1),L=de();function R({diff:e,className:t}){let n=0,r=0,i=e.split(`
2
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,L.jsx)(`div`,{className:w(`max-h-[420px] overflow-auto rounded-[10px] border border-line-soft bg-bg font-mono text-[13px] leading-[1.6]`,t),children:(0,L.jsx)(`table`,{className:`w-full border-collapse`,children:(0,L.jsx)(`tbody`,{children:i.map(e=>(0,L.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,L.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.a}),(0,L.jsx)(`td`,{className:`w-10 px-2 text-right align-top text-muted tabular-nums select-none`,children:e.b}),(0,L.jsx)(`td`,{"aria-hidden":`true`,className:w(`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,L.jsxs)(`td`,{className:w(`pr-4 align-top whitespace-pre`,e.kind===`hunk`?`text-muted`:`text-ink`),children:[(0,L.jsx)(`span`,{className:`sr-only`,children:e.kind===`add`?`added: `:e.kind===`del`?`removed: `:``}),e.text||` `]})]},e.key))})})})}function z({review:e,className:t}){return(0,L.jsxs)(`div`,{className:w(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,L.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,L.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,L.jsx)(`span`,{className:w(`mt-px flex-none rounded-full px-2 py-px text-[13px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.file&&(0,L.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,L.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,L.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var Ce={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 B({status:e,orb:t,px:r=20,spin:i=!1}){let a={width:r,height:r};return e===`active`&&i?(0,L.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:a,children:(0,L.jsx)(x,{size:r-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,L.jsx)(E,{state:t,px:r,label:`At work`}):e===`done`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:a,children:(0,L.jsx)(n,{size:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:a,children:(0,L.jsx)(y,{size:r*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,L.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:a,children:(0,L.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,L.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:w(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:a})}var we=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Te={read:v,search:i,list:ce,edit:_,run:oe,element:m,outline:ie,references:l,impact:se,find:re,testfile:S,web:b,environment:r,cases:le,browser:b,post:p,test:S,retry:a,review:s,task:f,work:t},Ee={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`},V={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function De({kind:e,status:t}){let n=w(`mt-px flex size-4 flex-none items-center justify-center`,Ee[t]);if(e===`skill`)return(0,L.jsxs)(`span`,{role:`img`,"aria-label":V[t],className:w(n,`relative`),children:[(0,L.jsx)(fe,{name:ye.skills,px:15}),(t===`done`||t===`failed`)&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:w(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Te[e];return(0,L.jsx)(`span`,{role:`img`,"aria-label":V[t],className:n,children:(0,L.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function Oe({status:e}){return e===`active`?(0,L.jsx)(x,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,L.jsx)(`span`,{role:`img`,"aria-label":V[e],className:w(`mt-2 size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function H({text:e,label:t}){let[r,i]=(0,I.useState)(!1);return(0,L.jsx)(`button`,{type:`button`,"aria-label":r?`Copied`:t,"data-tip":r?`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:r?(0,L.jsx)(n,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,L.jsx)(o,{size:13,"aria-hidden":`true`})})}function ke({step:e,failed:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 py-1 font-mono text-[13px] leading-relaxed`,children:[e.command&&(0,L.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,L.jsx)(H,{text:e.command,label:`Copy the command`})]}),e.output&&(0,L.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,L.jsx)(`pre`,{className:w(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[13px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,L.jsx)(H,{text:e.output,label:`Copy the output`})]})]})}var Ae=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function U({text:e}){return(0,L.jsx)(`span`,{className:w(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,Ae(e)&&`font-mono text-[13px]`),children:e})}function je(e){return{count:e.length,failed:e.filter(e=>e.ok===!1).length,latest:e[e.length-1]}}function W({line:e}){return(0,L.jsxs)(`li`,{className:w(`flex gap-2 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,L.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,L.jsx)(F,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]})}function Me({step:e}){let[t,n]=(0,I.useState)(!1),r=e.lines.length>3&&!t,{count:i,failed:a,latest:o}=je(e.lines);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.lines.length>3&&(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex w-fit cursor-pointer items-center gap-1 rounded-md border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink-2`,children:[(0,L.jsxs)(`span`,{children:[t?`Hide`:`Show`,` `,i,` lines`,a>0&&(0,L.jsxs)(`span`,{className:`text-fail`,children:[` · `,a,` failed`]})]}),(0,L.jsx)(d,{size:13,"aria-hidden":`true`,className:w(`transition-transform`,t&&`rotate-180`)})]}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:r?o&&(0,L.jsx)(W,{line:o}):e.lines.map((e,t)=>(0,L.jsx)(W,{line:e},t))})]})}function G({agent:e,named:t=!0,working:n=!1,state:r}){let i=N(e),a=O(e);return(0,L.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-2`,"data-tip":i.name,children:[(0,L.jsx)(k,{agent:e,px:24,decorative:t,working:n,state:r}),t&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-medium`,style:{color:a},children:i.name}),(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}var K=e=>e===`active`?`thinking`:e===`failed`?`failed`:e===`done`?`done`:`idle`;function q({step:e,from:t,to:n,live:r}){let i=N(n),a=O(n),o=r?`thinking`:e.status===`fail`?`failed`:e.status===`ok`?`done`:`idle`;return(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsx)(k,{agent:t,px:24}),(0,L.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:w(`handoff-flow flex-none`,r&&`is-live`),style:{color:a},children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]}),(0,L.jsx)(k,{agent:n,px:28,decorative:!0,state:o,className:`handoff-in`}),(0,L.jsx)(`span`,{className:`font-medium`,style:{color:a},children:i.name}),!e.handoff&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`}),(0,L.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,r?`text-ink`:`text-ink-2`),children:e.label})]}),e.arg&&(0,L.jsx)(U,{text:e.arg})]})}function J({step:e,working:t,from:n=M}){let r=e.agent||n,i=Y(e),a=we(e,t),[o,s]=(0,I.useState)(null),c=o??((!!e.handoff||!!e.agent||e.key.startsWith(`try:`))&&a===`active`),l=(0,L.jsxs)(L.Fragment,{children:[e.handoff||r!==n?(0,L.jsx)(B,{status:a,orb:e.orb,px:14,spin:!0}):!e.icon&&(0,L.jsx)(Oe,{status:a}),e.handoff||r!==n?(0,L.jsx)(q,{step:e,from:n,to:e.handoff?.agent??r,live:a===`active`}):(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.icon?(0,L.jsx)(De,{kind:e.icon,status:a}):(0,L.jsx)(G,{agent:r,named:!1,working:a===`active`,state:K(a)}),(0,L.jsx)(`span`,{className:w(`[overflow-wrap:anywhere]`,a===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,L.jsx)(U,{text:e.arg}),e.change&&(0,L.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),i&&(0,L.jsx)(d,{size:14,"aria-hidden":`true`,className:w(`mt-1 ml-auto flex-none text-muted transition-transform`,c&&`rotate-180`)})]});return(0,L.jsxs)(`li`,{className:`flex flex-col`,children:[i?(0,L.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-2 py-2 text-left text-[13px] hover:bg-surface-muted`,children:l}):(0,L.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-2 py-2 text-[13px]`,children:l}),i&&(0,L.jsx)(j,{open:c,children:(0,L.jsx)(X,{step:e,working:t,from:n,className:`mb-1 ml-4`})})]})}var Y=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function X({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,L.jsxs)(`div`,{className:w(`flex flex-col gap-2 border-l border-dotted py-1 pl-4`,r),style:{borderColor:a?`${N(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,L.jsx)(ke,{step:e,failed:e.status===`fail`}),e.review&&(0,L.jsx)(z,{review:e.review}),e.lines.length>0&&(0,L.jsx)(Me,{step:e}),e.change&&(0,L.jsx)(R,{diff:e.change.diff}),i.length>0&&(0,L.jsx)(`ul`,{"aria-label":a?`What ${pe(N(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,L.jsx)(J,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,L.jsxs)(`span`,{className:`text-muted`,children:[pe(N(e.handoff.agent).name,!0),` answered`]}),(0,L.jsx)(F,{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 Ne({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&&Y(o),[c,l]=(0,I.useState)(null),u=c??(e.status===`active`||e.status===`failed`),f=o?.orb??[...a].reverse().find(e=>e.status===`running`)?.orb??r?.orb??`thinking`;return(0,L.jsxs)(`li`,{className:`flex gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,L.jsx)(`span`,{className:`mt-1`,children:(0,L.jsx)(B,{status:e.status,orb:f,spin:!i})}),!t&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:w(`mt-2 min-h-4 w-0 flex-1 border-l border-dotted`,Ce[e.status])})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[s?(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":u,onClick:()=>l(!u),className:`flex min-h-7 w-full cursor-pointer items-start gap-2 border-0 bg-transparent p-0 text-left`,children:[(0,L.jsx)(Z,{node:e}),(0,L.jsx)(d,{size:14,"aria-hidden":`true`,className:w(`mt-1 flex-none text-muted transition-transform`,u&&`rotate-180`)}),e.status===`active`&&(0,L.jsx)(`span`,{className:`mt-1 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[13px] font-medium text-accent-fg`,children:`In progress`})]}):(0,L.jsx)(`div`,{className:`min-h-7`,children:(0,L.jsx)(Z,{node:e})}),s&&(0,L.jsx)(j,{open:u,className:`mt-1`,children:o?(0,L.jsx)(X,{step:o,working:n,from:`forgeqe`,className:`mt-1`}):(0,L.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[a.map(e=>(0,L.jsx)(J,{step:e,working:n},e.key)),r&&(0,L.jsx)(`li`,{children:(0,L.jsx)(Q,{live:r,className:`px-2`})})]})})]})]})}function Z({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||n?.agent&&n.agent!==`forgeqe`?(0,L.jsx)(q,{step:n,from:M,to:n.handoff?.agent??n.agent,live:e.status===`active`}):(0,L.jsxs)(`span`,{className:w(`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm font-medium`,t,e.status===`skipped`&&`line-through`),children:[n&&(0,L.jsx)(G,{agent:n.agent||`forgeqe`,named:!!n.agent&&n.agent!==`forgeqe`,working:e.status===`active`,state:K(e.status)}),e.status===`active`?(0,L.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,L.jsx)(`span`,{children:e.label})}):(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),n?.arg&&(0,L.jsx)(U,{text:n.arg})]})}var Pe={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 Fe(e){let[t,n]=(0,I.useState)(()=>Date.now());(0,I.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 Q({live:e,orb:t=!1,className:n}){let r=Fe(e.latest?.at);return(0,L.jsxs)(`div`,{className:w(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,L.jsx)(`span`,{className:`mt-1 flex size-4 flex-none items-center justify-center`,children:t?(0,L.jsx)(E,{state:e.orb,px:20,label:`At work`}):(0,L.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,L.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,L.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,L.jsx)(`span`,{className:`shimmer text-[13px] font-medium text-muted`,children:(0,L.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,L.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,L.jsx)(`span`,{className:w(`min-w-0 truncate font-mono text-[13px]`,Pe[e.latest.tone]),children:e.latest.plain}),(0,L.jsxs)(`span`,{className:`flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Ie({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,L.jsx)(Q,{live:n,orb:!0});let i=he(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,L.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,L.jsx)(`li`,{className:`flex gap-4`,children:(0,L.jsx)(Q,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,L.jsx)(Ne,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Le={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function $({label:e,children:t}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,L.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function Re({text:e}){let[t,r]=(0,I.useState)(!1);return(0,L.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,L.jsx)(T,{icon:te,size:14,className:`mt-1 flex-none text-muted`}),(0,L.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await xe(e)&&(r(!0),setTimeout(()=>r(!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,L.jsx)(n,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,L.jsx)(o,{size:14,"aria-hidden":`true`})})]})}function ze(e){if(e.runs===void 0)return e.attempts===void 0?``:C(e.attempts,`attempt`);let t=`${C(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${C(e.reviews,`review`)}`:t}function Be({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,L.jsx)(`span`,{className:`font-mono text-[13px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,L.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ve({t:e}){let t=ze(e);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsx)(S,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,L.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,L.jsx)(ue,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Le[e.status]||e.status||`Not written`}),t&&(0,L.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,L.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-4`,children:[(e.testFile||e.testName)&&(0,L.jsx)($,{label:`Test`,children:(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,L.jsx)(P,{path:e.testFile}),e.testName&&(0,L.jsx)(Be,{name:e.testName})]})}),e.command&&(0,L.jsx)($,{label:`Run it`,children:(0,L.jsx)(Re,{text:e.command})}),e.review&&(0,L.jsx)($,{label:e.review.approved?`Review`:`Review asked`,children:(0,L.jsx)(z,{review:e.review})}),e.runDir&&(0,L.jsx)($,{label:`From the run`,children:(0,L.jsx)(P,{path:e.runDir})}),e.reused.length>0&&(0,L.jsx)($,{label:`Reused`,children:(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,L.jsx)(`li`,{className:`min-w-0`,children:(0,L.jsx)(P,{path:e})},e))})})]}),e.error&&(0,L.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function He({c:e}){let[t,n]=(0,I.useState)(!1);return(0,L.jsxs)(`li`,{className:`flex flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,L.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,L.jsx)(d,{size:15,"aria-hidden":`true`,className:w(`transition-transform`,!t&&`-rotate-90`)})}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,L.jsx)(P,{path:e.path})}),(0,L.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,L.jsx)(j,{open:t,children:(0,L.jsx)(R,{diff:e.diff,className:`mb-2 ml-10`})})]})}function Ue({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,L.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,L.jsx)(Ve,{t:e},t)),t.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,L.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,L.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,L.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,L.jsx)(P,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,L.jsxs)(`div`,{className:w(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-4`),children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,L.jsx)(g,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,L.jsxs)(`span`,{className:`font-normal text-muted`,children:[C(e.changes.length+r.length,`file`),e.changes.length>0&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,L.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,L.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,L.jsx)(He,{c:e},e.path)),r.map(e=>(0,L.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-10`,children:(0,L.jsx)(P,{path:e})},e))]})]})]})}var We=1.5;function Ge(e,t){if(e>=t)return t;let n=t-e;return Math.min(t,e+Math.max(We,n/45))}function Ke(e,t){return Math.min(Math.floor(t),e.length)}var qe=()=>typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;function Je(e,t){let n=(0,I.useRef)(t);t&&(n.current=!0);let r=n.current&&!qe(),[i,a]=(0,I.useState)(()=>r?0:e.length),o=(0,I.useRef)(i),s=(0,I.useRef)(e);s.current!==e&&(o.current=Ke(e,o.current),s.current=e),r||(o.current=e.length),(0,I.useEffect)(()=>{if(!r||o.current>=e.length){a(o.current);return}let t=0,n=()=>{o.current=Ge(o.current,e.length),a(o.current),o.current<e.length&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>cancelAnimationFrame(t)},[e,r]);let c=Math.min(Math.floor(r?i:e.length),e.length);return{shown:e.slice(0,c),typing:c<e.length}}var Ye={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 Xe({line:e,start:t}){let[n,r]=(0,I.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,L.jsxs)(`li`,{className:`mt-4 flex items-baseline gap-4 border-b border-line-soft pb-1 first:mt-0`,children:[(0,L.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:A(t,e.at)}),(0,L.jsx)(F,{text:e.md,className:`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`})]}):(0,L.jsxs)(`li`,{className:w(`flex items-baseline gap-4 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,L.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:A(t,e.at)}),e.kind===`out`?(0,L.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,L.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:w(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,L.jsx)(F,{text:e.md,className:w(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[13px] [&_p]:my-0`,Ye[e.tone],i&&!n&&`line-clamp-2`)})})]})}function Ze({lines:e,start:t,live:r,name:i,timeline:a=!1}){let s=(0,I.useRef)(null),c=(0,I.useRef)(!0),[l,u]=(0,I.useState)(!1),d=(0,I.useMemo)(()=>ge(e,t),[e,t]);(0,I.useEffect)(()=>{c.current&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[d]);let f=`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,L.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[13px] text-muted`,children:[(0,L.jsxs)(`span`,{className:`flex-1`,children:[a?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,r&&` · live`]}),(0,L.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,L.jsx)(n,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,L.jsx)(o,{size:14,"aria-hidden":`true`})}),(0,L.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,L.jsx)(T,{icon:ae,size:14})})]}),(0,L.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:w(`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,L.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,L.jsx)(Xe,{line:e,start:t},n))}):(0,L.jsx)(F,{text:d,className:`text-[13px] leading-[1.6] [&_code]:text-[13px] [&_h4]:mt-4 [&_h4]:mb-1 [&_h6]:mt-4 [&_h6]:mb-1 [&_h6]:text-ink [&_li]:my-1 [&_pre]:text-[13px] [&_ul]:my-1`})})]})}function Qe({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,L.jsxs)(`div`,{className:w(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(h,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,L.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,L.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,L.jsx)(D,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,L.jsxs)(D,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:[(0,L.jsx)(y,{"aria-hidden":`true`}),`Cancel`]})]}):(0,L.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function $e({wait:t,live:n,onProceed:r}){let i=n&&t.answer===void 0;return(0,L.jsxs)(`div`,{className:w(`flex flex-col gap-4`,i?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,L.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(e,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,L.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t.prompt})]}),i?(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(D,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>r(!0),children:[(0,L.jsx)(ne,{"aria-hidden":`true`}),`Continue`]}),(0,L.jsxs)(D,{size:`sm`,onClick:()=>r(!1),children:[(0,L.jsx)(y,{"aria-hidden":`true`}),`Cancel`]})]}):(0,L.jsx)(`span`,{className:`text-sm text-muted`,children:t.answer===void 0?`Not done`:t.answer?`You continued`:`You cancelled`})]})}function et(e,t){let[n,r]=(0,I.useState)(!1),i=(0,I.useRef)(t);return(0,I.useEffect)(()=>{let n=t>i.current;if(i.current=t,!e||!n)return void(e||r(!1));r(!0);let a=setTimeout(()=>r(!1),900);return()=>clearTimeout(a)},[e,t]),n}function tt({turn:e,live:t,onAnswer:n,onProceed:r}){let i=t&&!e.outcome,[a,o]=(0,I.useState)(null),s=a??i,c=be(e),l=i?c.text:ve(e),u=e.parts.map(e=>me(e.text)).filter(Boolean),f=Je(e.outcome&&e.reply?e.reply:u.join(`
3
3
 
4
4
  `),i),p=(0,I.useMemo)(()=>_e(f.shown),[f.shown]),m=et(i,u.reduce((e,t)=>e+t.length,0)),h=f.typing||m,[g,_]=(0,I.useState)(!1),v=[...e.log].reverse().find(e=>e.tone!==`you`&&e.tone!==`say`);return(0,L.jsxs)(`div`,{className:`flex gap-4`,children:[(0,L.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,L.jsx)(k,{agent:`forgeqe`,px:34,working:i,state:h?`speaking`:i?`thinking`:e.outcome===`done`?`done`:e.outcome===`failed`?`failed`:`idle`,className:`mt-1`})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 pt-2`,children:[(e.steps.length>0||i||e.log.length>0)&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":s,disabled:!e.steps.length&&!e.plan.length,onClick:()=>o(!s),className:w(`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,i&&`shimmer`),children:[(0,L.jsx)(`span`,{"aria-live":`polite`,children:l}),(e.steps.length>0||e.plan.length>0)&&(0,L.jsx)(d,{size:16,"aria-hidden":`true`,className:w(`transition-transform`,s&&`rotate-180`)})]}),e.log.length>0&&(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":g,onClick:()=>_(!g),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,L.jsx)(T,{icon:ee,size:14}),`Activity log`,(0,L.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,L.jsx)(j,{open:(s||i)&&(e.steps.length>0||e.plan.length>0||i),children:(0,L.jsx)(Ie,{turn:e,working:i,folded:!s,live:{...c,latest:v,events:e.log.length,onLog:()=>_(!0)}})}),(0,L.jsx)(j,{open:g,children:(0,L.jsx)(Ze,{lines:e.log,start:e.started||e.log[0]?.at,live:i,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,L.jsx)(Qe,{ask:e,live:i,onAnswer:t=>n(e.id,t)},e.id)),e.waits.map(e=>(0,L.jsx)($e,{wait:e,live:i,onProceed:t=>r(e.id,t)},e.id)),p.body&&(0,L.jsx)(F,{text:p.body,className:w((f.typing||i)&&`typing-caret`)}),p.sources&&!f.typing&&!i&&(0,L.jsx)(Se,{title:`Sources`,children:(0,L.jsx)(F,{text:p.sources,className:`text-muted`})}),(0,L.jsx)(Ue,{turn:e}),e.error&&(0,L.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,L.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{R as i,tt as n,Re as r,Ze as t};
@@ -1 +1 @@
1
- import{L as e,Lr as t,N as n,Pr as r,T as i,_r as a,dt as o,j as s,ln as c}from"./line-icons-DBwNPSmu.js";import{B as l,Rt as u,V as d,ct as f,en as p,f as m,l as h,o as g,p as _,t as v,z as y}from"./filters-YzD0tZES.js";import{jt as b,r as x,t as S,tt as C,un as w}from"./frame-CaTNV7DF.js";import{r as T}from"./index-9ELkRoKH.js";import{t as E}from"./segmented-Bisag9SK.js";import{_ as D,o as O}from"./qualityParts-DbH_PNDs.js";import{r as k}from"./families-BLmK1isi.js";var A=t(r(),1),j=p(),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-4 py-6 text-center text-[13px] 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-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function L({step:t,other:n}){if(!t)return(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let r=t.ok?s:e,i=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),a=n?t.calls.filter(e=>!i.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,j.jsx)(r,{size:14,"aria-label":t.ok?`Passed`:`Failed`,className:d(`mt-1 flex-none`,t.ok?`text-pass`:`text-fail`)}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t.action||`–`})]}),(0,j.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":t.title?`${t.title} · ${t.page}`:t.page,children:[t.page,typeof t.ms==`number`?` · ${N(t.ms)}`:``]}),t.error&&(0,j.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:t.error}),a.slice(0,3).map(e=>(0,j.jsxs)(`span`,{className:d(`truncate font-mono text-[13px]`,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}`)),t.problems.slice(0,2).map(e=>(0,j.jsx)(`span`,{className:`truncate text-[13px] 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,l=e.b?.n;return(0,j.jsxs)(`li`,{id:a?`look-here`:void 0,className:d(`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-4 px-4 py-2 text-[13px]`,children:[(0,j.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??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)(y,{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:d(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] 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-4 px-4 pb-4 @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??``),[a,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&&a&&r!==a&&(location.hash=_(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},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:a,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)(y,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,j.jsx)(o,{"aria-hidden":`true`}),`Compare`]})]})}function B({sub:e}){let[t,r]=(0,A.useState)(null),[i,o]=(0,A.useState)(null),[s,p]=(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?m(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=>p(e.message))},[]),(0,A.useEffect)(()=>{let e=!1;if(o(null),I(``),L&&B)return u.diff(L,B).then(t=>{e||(o(t),p(``),P(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&p(t.message)),()=>{e=!0}},[L,B]);let V=async()=>{if(i)try{let{id:e}=await f.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=_(`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)(x,{}),(0,j.jsxs)(`main`,{className:d(S,`@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-4`,children:[(0,j.jsx)(C,{pixel:w[`run-diff`],size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[25px] 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-measure 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-4 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:a,title:`Two runs are needed`,action:(0,j.jsxs)(`a`,{className:l({size:`sm`}),href:_(`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-4`,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-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] 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-[13px] 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-[13px] 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-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,j.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,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-2`,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)(y,{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-4 bg-surface-muted px-4 py-2 text-[13px] 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-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{M as KIND_TEXT,B as RunDiff,F as choicesFor};
1
+ import{L as e,Lr as t,N as n,Pr as r,T as i,_r as a,dt as o,j as s,ln as c}from"./line-icons-DBwNPSmu.js";import{B as l,Rt as u,V as d,ct as f,en as p,f as m,l as h,o as g,p as _,t as v,z as y}from"./filters-CorGh2vA.js";import{jt as b,r as x,t as S,tt as C,un as w}from"./frame-BgpCUEoM.js";import{r as T}from"./index-CEVZ8F8_.js";import{t as E}from"./segmented-Bi4QAoQY.js";import{_ as D,o as O}from"./qualityParts-B-TQusS6.js";import{r as k}from"./families-DLmHA4rL.js";var A=t(r(),1),j=p(),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-4 py-6 text-center text-[13px] 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-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function L({step:t,other:n}){if(!t)return(0,j.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let r=t.ok?s:e,i=new Set((n?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),a=n?t.calls.filter(e=>!i.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,j.jsx)(r,{size:14,"aria-label":t.ok?`Passed`:`Failed`,className:d(`mt-1 flex-none`,t.ok?`text-pass`:`text-fail`)}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t.action||`–`})]}),(0,j.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":t.title?`${t.title} · ${t.page}`:t.page,children:[t.page,typeof t.ms==`number`?` · ${N(t.ms)}`:``]}),t.error&&(0,j.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:t.error}),a.slice(0,3).map(e=>(0,j.jsxs)(`span`,{className:d(`truncate font-mono text-[13px]`,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}`)),t.problems.slice(0,2).map(e=>(0,j.jsx)(`span`,{className:`truncate text-[13px] 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,l=e.b?.n;return(0,j.jsxs)(`li`,{id:a?`look-here`:void 0,className:d(`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-4 px-4 py-2 text-[13px]`,children:[(0,j.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??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)(y,{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:d(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] 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-4 px-4 pb-4 @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??``),[a,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&&a&&r!==a&&(location.hash=_(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},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:a,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)(y,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,j.jsx)(o,{"aria-hidden":`true`}),`Compare`]})]})}function B({sub:e}){let[t,r]=(0,A.useState)(null),[i,o]=(0,A.useState)(null),[s,p]=(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?m(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=>p(e.message))},[]),(0,A.useEffect)(()=>{let e=!1;if(o(null),I(``),L&&B)return u.diff(L,B).then(t=>{e||(o(t),p(``),P(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&p(t.message)),()=>{e=!0}},[L,B]);let V=async()=>{if(i)try{let{id:e}=await f.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=_(`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)(x,{}),(0,j.jsxs)(`main`,{className:d(S,`@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-4`,children:[(0,j.jsx)(C,{pixel:w[`run-diff`],size:`lg`}),(0,j.jsx)(`h1`,{className:`m-0 text-[25px] 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-measure 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-4 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:a,title:`Two runs are needed`,action:(0,j.jsxs)(`a`,{className:l({size:`sm`}),href:_(`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-4`,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-1`,children:[(0,j.jsx)(`span`,{className:`text-[13px] 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-[13px] 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-[13px] 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-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,j.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,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-2`,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)(y,{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-4 bg-surface-muted px-4 py-2 text-[13px] 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-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{M as KIND_TEXT,B as RunDiff,F as choicesFor};
@@ -1,2 +1,2 @@
1
- import{Ar as e,D as t,Dt as n,Hn as r,In as i,L as a,Lr as o,M as s,Mt as c,O as l,Pn as u,Pr as d,Qn as f,T as p,U as m,Xt as h,_ as g,_t as _,a as v,at as y,er as b,f as x,ir as ee,j as S,jr as C,ln as w,ot as te,rn as ne,rr as T,ur as E,y as D,yt as O}from"./line-icons-DBwNPSmu.js";import{B as re,H as k,V as A,c as j,ct as ie,en as ae,f as oe,g as M,i as se,l as ce,n as le,o as ue,p as N,t as de,u as fe,z as P,zt as F}from"./filters-YzD0tZES.js";import{It as pe,S as me,_t as he,jt as ge,mt as _e,r as ve,t as ye,tt as be,un as xe,w as I,wn as Se}from"./frame-CaTNV7DF.js";import{n as L,r as R}from"./markdown-DoF5NaZz.js";import{i as Ce,r as we}from"./index-9ELkRoKH.js";import{r as Te,t as Ee}from"./Response-B1iCzkHo.js";import{i as De,r as Oe,t as ke}from"./segmented-Bisag9SK.js";import{r as Ae}from"./families-BLmK1isi.js";var z=o(d(),1),B=ae(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},je={execution:O,report:y,coding:m,chat:w};function Me({kind:e}){let t=je[e];return(0,B.jsx)(M,{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-4 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)(P,{"data-tip":`Open the report`,onClick:async()=>r(await fe(e)),children:[(0,B.jsx)(te,{"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)(l,{size:14,"aria-hidden":`true`}):(0,B.jsx)(p,{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-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,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-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(j,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(j,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(j,{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-4 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(j,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-2 font-mono text-[13px] 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)(M,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[k(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)(M,{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-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,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-4 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[20px] 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:A(`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)(l,{size:14,"aria-hidden":`true`}):(0,B.jsx)(p,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ue(e){let t=e.join(`
1
+ import{Ar as e,D as t,Dt as n,Hn as r,In as i,L as a,Lr as o,M as s,Mt as c,O as l,Pn as u,Pr as d,Qn as f,T as p,U as m,Xt as h,_ as g,_t as _,a as v,at as y,er as b,f as x,ir as ee,j as S,jr as C,ln as w,ot as te,rn as ne,rr as T,ur as E,y as D,yt as O}from"./line-icons-DBwNPSmu.js";import{B as re,H as k,V as A,c as j,ct as ie,en as ae,f as oe,g as M,i as se,l as ce,n as le,o as ue,p as N,t as de,u as fe,z as P,zt as F}from"./filters-CorGh2vA.js";import{It as pe,S as me,_t as he,jt as ge,mt as _e,r as ve,t as ye,tt as be,un as xe,w as I,wn as Se}from"./frame-BgpCUEoM.js";import{n as L,r as R}from"./markdown-BcuknPlh.js";import{i as Ce,r as we}from"./index-CEVZ8F8_.js";import{r as Te,t as Ee}from"./Response-B1S-n787.js";import{i as De,r as Oe,t as ke}from"./segmented-Bi4QAoQY.js";import{r as Ae}from"./families-DLmHA4rL.js";var z=o(d(),1),B=ae(),V={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},je={execution:O,report:y,coding:m,chat:w};function Me({kind:e}){let t=je[e];return(0,B.jsx)(M,{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-4 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)(P,{"data-tip":`Open the report`,onClick:async()=>r(await fe(e)),children:[(0,B.jsx)(te,{"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)(l,{size:14,"aria-hidden":`true`}):(0,B.jsx)(p,{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-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,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-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,B.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,B.jsxs)(j,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,B.jsxs)(j,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,B.jsxs)(j,{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-4 border-t border-line-soft py-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,B.jsx)(j,{tone:H(e.status).tone,children:H(e.status).label})}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,B.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,B.jsx)(`span`,{className:`mr-2 font-mono text-[13px] 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)(M,{icon:O,size:18}),aside:e.length>1?(0,B.jsxs)(`span`,{className:`text-sm text-muted`,children:[k(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)(M,{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-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,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-4 py-2`,children:[(0,B.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,B.jsx)(`dd`,{className:`m-0 text-[20px] 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:A(`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)(l,{size:14,"aria-hidden":`true`}):(0,B.jsx)(p,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Ue(e){let t=e.join(`
2
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[n,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-2 text-sm`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-label":`${n?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${n?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>r(!n),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)(t,{size:16,"aria-hidden":`true`,className:A(`transition-transform duration-200`,n&&`rotate-90`)})}),(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] 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-[13px] 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:n,className:`pb-4 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-1 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)(M,{icon:m,size:18}),aside:e.edits.length?(0,B.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[k(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:k(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-4 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-[16px] font-semibold`,children:r?`Test written`:o?`Test not finished`:H(t.status).label}),(0,B.jsx)(j,{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:[k(e.tests.length,`test run`),i?` (${i} failed)`:``,e.reviews.length?` · ${k(e.reviews.length,`review`)}`:``]})]}),(0,B.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-4`,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)(Te,{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)(j,{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-4 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-4 border-t border-line-soft text-sm first:border-t-0`,children:[(0,B.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] 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-[13px] 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)(_,{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}`:he(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:x,label:`Rulebook`},decision:{icon:n,label:`Test decisions`},memory:{icon:g,label:`Page memory`},replay:{icon:u,label:`Replays`},model:{icon:f,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)(M,{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-4`,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-2 text-[13px] font-medium text-muted`,children:[(0,B.jsx)(M,{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-1 border-t border-line-soft py-2 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:N(`chats`,e.origin.chat),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(M,{icon:w,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,B.jsxs)(`a`,{href:N(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(M,{icon:D,size:14}),`Job`]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted`,children:[(0,B.jsx)(M,{icon:E,size:14}),`Terminal`]})}function Y({status:e}){let t=Ze[e].label;return e===`running`?(0,B.jsx)(ne,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,B.jsx)(S,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,B.jsx)(a,{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)?Se(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-4 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-[13px] font-semibold`,children:e}),t]})}var rt={rerun:i,write_test:T,investigate:r,fix_test:e},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 ie.start(e.prompt,{});location.hash=N(`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)(P,{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)(M,{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-[13px] 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:e,tab:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=ct(t),l=t=>location.hash=t===`summary`?N(`runs`,encodeURIComponent(e)):N(`runs`,encodeURIComponent(e),t),u=(0,z.useCallback)(()=>{F.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,z.useEffect)(u,[u]);let d=n?.status===`running`;(0,z.useEffect)(()=>{if(!d)return;let e=setInterval(u,2e3);return()=>clearInterval(e)},[u,d]);let f=et(d),p=(0,z.useMemo)(()=>(n?.events??[]).map(_e).filter(e=>!!e),[n?.events]),m=async()=>{s(!0),a(``);try{await F.cancel(e),u()}catch(e){a(e.message)}finally{s(!1)}},h=(0,B.jsxs)(`a`,{href:N(`runs`),className:`inline-flex items-center gap-2 text-sm`,children:[(0,B.jsx)(v,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,i?(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}):(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let g=Ze[n.status],_=!n.replies.length,y=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0,x=[{id:`summary`,label:`Summary`},{id:`conversation`,label:_?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:p.length||void 0},{id:`details`,label:`Details`}],ee=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),S=n.outputs.filter(e=>!ee.has(e.path)),w=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null;return(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[h,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,B.jsx)(`h2`,{className:`m-0 min-w-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,B.jsx)(j,{tone:g.tone,children:g.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-2`,children:[(0,B.jsx)(Me,{kind:n.kind}),V[n.kind]]}),`· `,(0,B.jsx)(tt,{r:n}),`· `,G(n.startedAt),` · `,d?`running for `:`took `,q(K(n,f)),` · `,I(J(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,B.jsxs)(P,{variant:`danger`,disabled:o,"data-tip":n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void m(),children:[n.cancel===`chat`?(0,B.jsx)(b,{fill:`currentColor`,"aria-hidden":`true`}):(0,B.jsx)(C,{"aria-hidden":`true`}),o?`Stopping…`:n.cancel===`chat`?`Stop`:`Cancel`]})]}),i&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,B.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!d&&(0,B.jsx)(at,{actions:n.actions??[]}),(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`This run`,className:Oe,children:x.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`tab`,id:`run-tab-${e.id}`,"aria-selected":c===e.id,"aria-controls":`run-panel-${e.id}`,onClick:()=>l(e.id),className:De(c===e.id),children:[e.label,e.n!==void 0&&(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:e.n})]},e.id))}),(0,B.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${c}`,"aria-labelledby":`run-tab-${c}`,className:`flex min-w-0 flex-col gap-6`,children:[c===`summary`&&(0,B.jsxs)(B.Fragment,{children:[n.final&&(0,B.jsx)(qe,{final:n.final,answer:n.answer}),(0,B.jsx)(Xe,{run:n}),S.length>0&&(0,B.jsx)(Q,{title:`What it produced (${S.length})`,children:S.map(e=>(0,B.jsx)(Z,{label:e.label,children:(0,B.jsx)(L,{path:e.path})},e.path))}),n.learnings.length>0&&(0,B.jsx)(Ye,{list:n.learnings}),!y&&(0,B.jsx)(ce,{className:`py-4`,children:d?`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.`})]}),c===`conversation`&&(_?(0,B.jsx)(R,{text:ot(n.prompt),className:`text-sm [&_p]:my-0`}):(0,B.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.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 text-sm max-w-[85%]`,children:(0,B.jsx)(R,{text:e.ask,className:`[&_p]:my-1`})}),e.text&&(0,B.jsx)(R,{text:he(e.text),className:`text-sm`}),e.error&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),c===`activity`&&(n.archived?(0,B.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 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.`]}):p.length?(0,B.jsx)(Ee,{timeline:!0,lines:p,start:n.startedAt,live:d,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),c===`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:d?`Running for`:`Took`,children:q(K(n,f))}),(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(n)),` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`· `,me(n.usage)]})]}),(n.byAgent?.length??0)>1&&(0,B.jsx)(`span`,{className:`flex flex-col gap-1 text-[13px]`,children:n.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:[n.context?I(n.context.tokens):`–`,w!==null&&(0,B.jsxs)(`span`,{className:`text-muted`,children:[` of `,I(n.context.limit),` (`,w,`%)`]})]}),(0,B.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,B.jsxs)(`span`,{className:`text-muted`,children:[`in `,k(n.turns,`turn`)]})]})]}),(0,B.jsxs)(Q,{title:`Session`,children:[(0,B.jsx)(Z,{label:`Started by`,children:(0,B.jsx)(tt,{r:n})}),(0,B.jsx)(Z,{label:`Command`,children:$e(n.command)}),(0,B.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,B.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,B.jsx)(`span`,{className:`flex flex-col gap-1`,children:n.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:k(e.calls,`call`)})]},e.name))}):(0,B.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,B.jsxs)(Z,{label:`Log`,children:[n.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/${n.name}`}),n.truncated&&(0,B.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,B.jsxs)(Q,{title:`Job`,children:[(0,B.jsx)(Z,{label:`Job`,children:(0,B.jsx)(`a`,{href:N(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,B.jsx)(Z,{label:`Runs`,children:(0,B.jsx)(R,{text:ot(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,B.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${G(n.job.nextAt)}`:``]}),n.job.run&&(0,B.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,B.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:n.files.length?[...n.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:n.notifications.length?n.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:n.origin.kind===`terminal`||n.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)(()=>{let e=e=>{let t=e.detail??{};(t.status===`all`||t.status===`running`||t.status===`failed`)&&a(t.status),typeof t.query==`string`&&r(t.query.replace(/[\u0000-\u001f\u007f]+/g,` `).slice(0,100))};return window.addEventListener(`forgeqe:runs-filter`,e),()=>window.removeEventListener(`forgeqe:runs-filter`,e)},[]),(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),y=Math.max(1,Math.ceil(v.length/$)),b=Math.min(f,y-1),x=v.slice(b*$,b*$+$),S=e.filter(e=>e.status!==`running`&&!X(e)),C=S.filter(e=>e.status===`failed`).length,te=S.length?S.reduce((e,n)=>e+K(n,t),0)/S.length:NaN,ne=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)(ce,{icon:ee,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:re({size:`sm`}),href:N(),"data-tip":`Start a chat`,children:[(0,B.jsx)(w,{"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-4`,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:A(`tabular-nums`,C?`text-fail`:`text-ink`),children:C}),` failed`,S.length?` (${Math.round(C/S.length*100)}%)`:``]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:I(ne)}),` tokens`]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`b`,{className:`text-ink tabular-nums`,children:q(Math.round(te))}),` on average`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(se,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,B.jsx)(de,{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)(ue,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,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)(ue,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-8 pl-4`,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-[13px] 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-2`,children:[x.length===0&&(0,B.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),x.map((e,n)=>{let r=Ce(e.startedAt);return(0,B.jsxs)(`li`,{className:`contents`,children:[(n===0||Ce(x[n-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`a`,{href:N(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 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-[13px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,B.jsx)(`span`,{className:`truncate text-[13px] text-fail`,children:e.error}):(0,B.jsx)(`span`,{className:`truncate text-[13px] 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-2 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-[13px] text-muted tabular-nums`,"data-tip":G(e.startedAt),children:we(e.startedAt)})]})]},e.name)})]}),(0,B.jsx)(le,{page:b,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 ${k(m,`empty session`)}`:`${k(m,`empty session`)} hidden`})]})})]})]})}function dt({sub:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),a=(0,z.useCallback)(()=>{F.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?oe(s):``;return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(ve,{}),(0,B.jsx)(`main`,{className:A(ye,`@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-4`,children:[(0,B.jsx)(be,{pixel:xe.runs,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,B.jsx)(ke,{label:`Runs and reports`,links:Ae,current:`runs`})]}),(0,B.jsx)(`p`,{className:`m-0 max-w-measure 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-4 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};