@capagents/forgeqe 3.3.5 → 3.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_USE.md +65 -7
- package/dist/docs-site/docs/area-mobile/index.html +33 -7
- package/dist/docs-site/docs/area-operations/index.html +50 -7
- package/dist/docs-site/docs/area-quality/index.html +15 -2
- package/dist/docs-site/docs/area-test-cases/index.html +41 -27
- package/dist/docs-site/docs/mobile/index.html +33 -7
- package/dist/docs-site/docs/overview/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +3957 -3772
- package/dist/web/assets/{3d-force-graph-KUdc_88B.js → 3d-force-graph-Bsispdm1.js} +1 -1
- package/dist/web/assets/Agent-39FbaH7G.js +10 -0
- package/dist/web/assets/{AgentWork-DmCMV4YL.js → AgentWork-BugEUl60.js} +1 -1
- package/dist/web/assets/ApiTests-B9rtwCbe.js +17 -0
- package/dist/web/assets/{Browse-BjPPdirz.js → Browse-Dl2Lneca.js} +1 -1
- package/dist/web/assets/Chat-DocT7FlH.js +3 -0
- package/dist/web/assets/{CommandPalette-BBGtkkz4.js → CommandPalette-B7YPDCOk.js} +1 -1
- package/dist/web/assets/{Compare-CVvpgS-7.js → Compare-D6XsFmmb.js} +1 -1
- package/dist/web/assets/Cost-DvbuXS6u.js +1 -0
- package/dist/web/assets/Data-BmZHJkfj.js +6 -0
- package/dist/web/assets/Desktop-DD3F69ih.js +1 -0
- package/dist/web/assets/{DesktopReview-Bcs7E_SB.js → DesktopReview-BR0LtVFw.js} +2 -2
- package/dist/web/assets/Evidence-OqAiYzrl.js +1 -0
- package/dist/web/assets/Explore-QNyusEFo.js +2 -0
- package/dist/web/assets/{Features-D-HIDQqF.js → Features-N3_77mz-.js} +1 -1
- package/dist/web/assets/Flags-Yv4Ttmmh.js +2 -0
- package/dist/web/assets/Flaky-Bg2f2K1U.js +1 -0
- package/dist/web/assets/Impact-CpxvVnKj.js +3 -0
- package/dist/web/assets/Jobs-_gZTxoaG.js +5 -0
- package/dist/web/assets/KindPage-Amr6R7Ym.js +6 -0
- package/dist/web/assets/{LiveDevice-jFCQ_zeU.js → LiveDevice-j7NZXIJZ.js} +1 -1
- package/dist/web/assets/Migration-DfPYzTfk.js +8 -0
- package/dist/web/assets/Mobile-fIhhQPsp.js +1 -0
- package/dist/web/assets/Observability-13DkrRp2.js +1 -0
- package/dist/web/assets/{OwnItems-CedxNuRy.js → OwnItems-BdiPfdTw.js} +3 -3
- package/dist/web/assets/PageAgent-CC8Ha6vu.js +1 -0
- package/dist/web/assets/Product-CnXkqwQm.js +6 -0
- package/dist/web/assets/Production-5mTIt4sr.js +1 -0
- package/dist/web/assets/Quality-DbLcbP1X.js +1 -0
- package/dist/web/assets/Readiness-BG1xmC09.js +1 -0
- package/dist/web/assets/Record-sFth-2I1.js +1 -0
- package/dist/web/assets/Regression-Dd4y8I1z.js +5 -0
- package/dist/web/assets/{RelationGraph-CBY9FhUu.js → RelationGraph-Blfs7PhK.js} +1 -1
- package/dist/web/assets/Reports-HQkTX4Kr.js +2 -0
- package/dist/web/assets/Requirements-DmhUNCIP.js +2 -0
- package/dist/web/assets/Responsive-D18eYdCh.js +3 -0
- package/dist/web/assets/RunDiff-75a-smeg.js +1 -0
- package/dist/web/assets/{Settings-VqVLvH-Z.js → Settings-BaodIliH.js} +15 -15
- package/dist/web/assets/{Steps-6x6JVBmk.js → Steps-ZPH_rTJh.js} +1 -1
- package/dist/web/assets/TestData-DUlTo5qt.js +2 -0
- package/dist/web/assets/TestManagement-DUMGdHDw.js +4 -0
- package/dist/web/assets/{WhatsNew-BwV-yle3.js → WhatsNew-BrVNacPl.js} +1 -1
- package/dist/web/assets/{agentSettingsSheet-CUOx_y4s.js → agentSettingsSheet-UCqUtdjq.js} +1 -1
- package/dist/web/assets/{api-BsiuHmJq.js → api-D8-lxyQi.js} +1 -1
- package/dist/web/assets/{dataParts-_X5zGtE9.js → dataParts-C0C67bVQ.js} +3 -3
- package/dist/web/assets/{desktopAppPath-D3mGDKPz.js → desktopAppPath-B89LKvjx.js} +1 -1
- package/dist/web/assets/{flowTheme-DKuXe5nP.js → flowTheme-BNKwRxun.js} +1 -1
- package/dist/web/assets/frame-C8sL1yo-.js +13 -0
- package/dist/web/assets/index-BFG13fbg.js +55 -0
- package/dist/web/assets/index-DBnWgocz.css +2 -0
- package/dist/web/assets/{markdown-CwgDQU8m.js → markdown-CxsWgpYs.js} +1 -1
- package/dist/web/assets/{nav-B_68FVw_.js → nav-DYgvAJu-.js} +1 -1
- package/dist/web/assets/{pageBack-CbyKfisx.js → pageBack-BefA2rh7.js} +1 -1
- package/dist/web/assets/{palette-6YAAmgkD.js → palette-BgJTq_Ot.js} +1 -1
- package/dist/web/assets/parts-BNpm4gXC.js +1 -0
- package/dist/web/assets/{productParts-CUvTBJkC.js → productParts-ZEi0sPIk.js} +1 -1
- package/dist/web/assets/{qualityParts-BFDaQh7A.js → qualityParts-DtsD70Qh.js} +1 -1
- package/dist/web/assets/{recordTest-7uIZiqOW.js → recordTest-Bz5ryzpS.js} +1 -1
- package/dist/web/assets/{stepper-C6U4inhc.js → stepper-CONWT_tv.js} +1 -1
- package/dist/web/assets/{wizardParts-fa6KdWVg.js → wizardParts-CulZqqjz.js} +1 -1
- package/dist/web/index.html +8 -8
- package/docs/ForgeQE-Static-Analysis-Report-30112026.pdf +0 -0
- package/docs/ForgeQE-Static-Analysis-Report-5bbf0da7.html +207 -0
- package/docs/MOBILE.md +35 -7
- package/docs/user-guide.html +139 -43
- package/env.example.yaml +2 -0
- package/package.json +1 -1
- package/py/forgeqe_engine/persona.py +2 -1
- package/py/forgeqe_mobile/service.py +9 -1
- package/dist/web/assets/Agent-d4YX63iA.js +0 -10
- package/dist/web/assets/ApiTests-C_L2iJ8s.js +0 -17
- package/dist/web/assets/Chat-DNiUvy2O.js +0 -3
- package/dist/web/assets/Cost-DJnZYyQP.js +0 -1
- package/dist/web/assets/Data-DEWYrB9n.js +0 -6
- package/dist/web/assets/Desktop-Bm6ObXhU.js +0 -1
- package/dist/web/assets/Evidence-D5fORfDF.js +0 -1
- package/dist/web/assets/Explore-Dhwu33Xf.js +0 -2
- package/dist/web/assets/Flags-DEitGv3r.js +0 -2
- package/dist/web/assets/Flaky-F5NHbFgI.js +0 -1
- package/dist/web/assets/Impact-eg2nHsiv.js +0 -3
- package/dist/web/assets/Jobs-GBUaaYcw.js +0 -5
- package/dist/web/assets/KindPage-CaXbIzyO.js +0 -6
- package/dist/web/assets/Migration-ZhSPJ6QL.js +0 -8
- package/dist/web/assets/Mobile-ClrjICJt.js +0 -1
- package/dist/web/assets/Observability-CQ7WAuBH.js +0 -1
- package/dist/web/assets/PageAgent-CDYs-i-n.js +0 -1
- package/dist/web/assets/Product-DyhX2TYr.js +0 -6
- package/dist/web/assets/Production-DSDdBODO.js +0 -1
- package/dist/web/assets/Quality-CdrPT4WV.js +0 -1
- package/dist/web/assets/Readiness-C9qM2rKO.js +0 -1
- package/dist/web/assets/Record-C790-f2w.js +0 -1
- package/dist/web/assets/Regression-PDhRTDKs.js +0 -5
- package/dist/web/assets/Reports-BBRMV5V8.js +0 -2
- package/dist/web/assets/Requirements-DRz1Yudy.js +0 -2
- package/dist/web/assets/Responsive-DZXESkT1.js +0 -3
- package/dist/web/assets/RunDiff-CsND-A6h.js +0 -1
- package/dist/web/assets/TestData-hIJO8oL4.js +0 -2
- package/dist/web/assets/TestManagement-SBq56JNZ.js +0 -4
- package/dist/web/assets/frame-CgBYYtdw.js +0 -13
- package/dist/web/assets/index-D10waU4_.js +0 -55
- package/dist/web/assets/index-DVlmTifI.css +0 -2
- package/dist/web/assets/parts-ClnDV-6r.js +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/paletteCommands-Isq1rLs-.js","assets/route-oDy8sV6H.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-BDur5s0O.js","assets/sectionList-B651VPon.js","assets/line-icons-CwCZidXs.js","assets/coverage-pqIlfEP0.js","assets/logos-P2LOMyTK.js","assets/utils-DJRAScIl.js","assets/jsx-runtime-LKYXHABd.js","assets/CommandPalette-BBGtkkz4.js","assets/preload-helper-BupTYkQW.js","assets/palette-6YAAmgkD.js","assets/api-BsiuHmJq.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{F as r,H as i,L as a,R as o,V as s,c,d as l,l as u,p as d,s as f,t as p}from"./preload-helper-BupTYkQW.js";import{n as m,t as h}from"./utils-DJRAScIl.js";import{t as g}from"./jsx-runtime-LKYXHABd.js";import{F as _,G as v,K as y,L as b,R as x,U as S,a as C,i as w,j as T,n as ee,u as E}from"./palette-6YAAmgkD.js";import{M as D,d as O,f as k,i as A,m as j,t as te,x as M}from"./sectionList-B651VPon.js";import{$ as ne,ft as re,h as ie,mt as ae,rt as oe,s as se,tt as ce,u as N,y as le}from"./api-BsiuHmJq.js";import{C as ue,S as de,_ as P,a as fe,b as F,g as pe,i as I,l as me,o as he,p as ge,r as _e,v as ve,x as L,y as ye}from"./pageBack-CbyKfisx.js";import{$n as be,$t as xe,A as Se,An as Ce,Ar as we,At as Te,B as Ee,Bn as De,Bt as Oe,C as ke,Cn as Ae,Ct as je,Dn as Me,Dr as Ne,Dt as Pe,E as Fe,En as Ie,Et as Le,Ft as Re,Hn as ze,I as Be,It as Ve,Jn as He,Jt as Ue,K as We,Kt as Ge,Lr as Ke,Mn as qe,N as Je,Nn as Ye,O as Xe,On as Ze,Pn as Qe,Pr as $e,Pt as et,Q as tt,Qt as nt,Rr as rt,Sr as it,St as at,Tt as ot,U as st,V as ct,Vn as lt,Vt as ut,W as dt,Wn as ft,Xn as pt,Xt as mt,Y as ht,Zn as gt,Zt as _t,_r as vt,b as yt,br as bt,c as xt,d as St,dr as Ct,dt as wt,en as Tt,f as Et,fn as Dt,g as Ot,gn as kt,gt as At,h as jt,hr as Mt,i as Nt,in as Pt,ir as Ft,jt as It,k as Lt,kn as Rt,l as zt,lr as Bt,lt as Vt,m as Ht,mn as Ut,mr as Wt,mt as Gt,n as Kt,nn as qt,nr as Jt,o as Yt,on as Xt,pr as Zt,q as Qt,qn as $t,r as en,s as tn,sn as nn,t as rn,tr as an,tt as on,u as sn,ur as cn,v as ln,vr as un,vt as dn,w as fn,wn as pn,x as mn,xr as hn,xt as gn,y as _n,yn as vn,yr as yn,z as bn}from"./line-icons-CwCZidXs.js";import{a as xn,c as Sn,d as Cn,f as wn,l as Tn,n as En,o as Dn,s as On,t as kn}from"./nav-B_68FVw_.js";var R=e(t(),1),z=g();function An({open:e,onClose:t,title:n,description:r,children:i,footer:a,wide:o,bare:s}){let c=(0,R.useRef)(null),l=(0,R.useId)(),u=(0,R.useRef)({title:n,description:r,children:i,footer:a});e&&(u.current={title:n,description:r,children:i,footer:a});let[d,f]=(0,R.useState)(!1),p=e?{title:n,description:r,children:i,footer:a}:u.current;return(0,R.useEffect)(()=>{let t=c.current;if(!t)return;if(e){t.classList.remove(`is-closing`),f(!1),t.open||t.showModal();return}if(!t.open)return;if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return t.close();t.classList.add(`is-closing`),f(!0);let n=setTimeout(()=>{t.classList.remove(`is-closing`),f(!1),t.close()},150);return()=>clearTimeout(n)},[e]),(0,z.jsxs)(`dialog`,{ref:c,"aria-labelledby":s?void 0:l,"aria-label":s?n:void 0,onCancel:e=>{e.target===c.current&&(e.preventDefault(),t())},onClick:e=>{e.target===c.current&&t()},className:h(y,`sheet bg-canvas backdrop-blur-none fixed inset-y-0 right-0 left-auto m-0 h-[calc(100dvh/var(--ui-zoom))] max-h-none w-full rounded-r-none border-0 p-0 backdrop:bg-[rgba(15,23,42,0.2)]`,o?`max-w-[760px]`:`max-w-[480px]`),children:[(e||d)&&s&&(0,z.jsx)(`div`,{className:`h-full`,children:p.children}),(e||d)&&!s&&(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-4 px-6 pt-6 pb-4`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsx)(`h2`,{id:l,className:`m-0 text-headline-sm`,children:p.title}),p.description&&(0,z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-muted`,children:p.description})]}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close`,"data-tip":`Close`,onClick:t,className:`-mt-1 -mr-2`,children:(0,z.jsx)(rt,{size:20,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{className:`sheet-body flex-1 overflow-y-auto px-6 pb-6`,children:p.children}),(0,z.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 px-6 py-4`,children:p.footer})]})]})}var jn=new Map,Mn=!1,Nn=()=>typeof document>`u`?null:document,Pn=()=>Nn()?.visibilityState===`hidden`;function Fn(){if(!Pn())for(let e of[...jn.values()])e()}function In(e,t){let n=setInterval(()=>{Pn()||e()},t);jn.set(n,e);let r=Nn();return r&&!Mn&&(r.addEventListener(`visibilitychange`,Fn),Mn=!0),n}function Ln(e){if(e==null)return;clearInterval(e),jn.delete(e);let t=Nn();t&&Mn&&jn.size===0&&(t.removeEventListener(`visibilitychange`,Fn),Mn=!1)}function Rn({open:e,id:t,className:n,children:r}){let[i,a]=(0,R.useState)(e),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(e);return(0,R.useEffect)(()=>{if(e){a(!0);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>s(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}}s(!1),l(!1);let t=setTimeout(()=>a(!1),320);return()=>clearTimeout(t)},[e]),i?(0,z.jsx)(`div`,{id:t,inert:!e||void 0,className:h(`collapse-box`,o&&`is-open`),onTransitionEnd:t=>{t.target===t.currentTarget&&t.propertyName===`grid-template-rows`&&(e?l(!0):a(!1))},children:(0,z.jsx)(`div`,{className:h(`min-h-0 min-w-0`,c?`overflow-visible`:`overflow-hidden`),children:(0,z.jsx)(`div`,{className:n,children:r})})}):null}var zn=null,Bn=e=>void(zn=e),Vn=/password|secret|token|api.?key|\bkey\b|credential|\bprod(uction)?\b|\bprd\b|\blive\b/i,Hn=1e3,Un=60,Wn=e=>e.replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g,` `).replace(/\s+/g,` `).trim();function Gn(e){let t=new Set,n=[];for(let r of e){let e=Wn(r.label).slice(0,Un);if(!e||r.kind===`link`&&!/^#\/[^\s]*$/.test(r.href??``))continue;let i=`${r.kind} ${e.toLowerCase()}`;if(t.has(i)||(t.add(i),(r.kind===`setting`||r.kind===`field`||r.kind===`button`)&&Vn.test(e)))continue;let a=r.value===void 0?void 0:Wn(r.value).slice(0,Un);if(n.push({ref:`c${n.length+1}`,kind:r.kind,label:e,...a===void 0?{}:{value:a},from:r}),n.length>=120)break}return n}var Kn=e=>e.map(e=>`${e.ref} ${e.kind}: ${e.label}${e.value===void 0?``:` (now: ${e.value||`empty`})`}`).join(`
|
|
3
|
-
`);function qn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(typeof n.ref!=`string`||!/^c\d{1,3}$/.test(n.ref)||typeof n.label!=`string`)return null;let r=typeof n.text==`string`?Wn(n.text).slice(0,Hn):``;return{ref:n.ref,label:Wn(n.label),text:r}}function Jn(e,t){let n=e.find(e=>e.ref===t.ref);return!n||n.label.toLowerCase()!==t.label.toLowerCase()?`The page changed since it was read: read it again.`:(n.kind===`search`||n.kind===`field`)&&!t.text?`Say what to type into “${n.label}”.`:n.kind===`setting`&&!t.text?`Say what to set “${n.label}” to.`:n.kind!==`search`&&n.kind!==`setting`&&n.kind!==`field`&&t.text?`“${n.label}” takes a click, not text.`:n}var Yn=()=>/^#\/settings(?:\/|$)/.test(location.hash)&&!/^#\/settings\/secrets/.test(location.hash);function Xn(e){let t=e.id?document.querySelector(`label[for="${CSS.escape(e.id)}"]`):null,n=e.getAttribute(`aria-labelledby`)?.split(/\s+/).map(e=>document.getElementById(e)?.innerText||``).join(` `);return e.getAttribute(`aria-label`)||t?.innerText||n||e.closest(`label`)?.innerText||``}function Zn(e){return e instanceof HTMLInputElement&&e.type===`checkbox`?e.checked?`on`:`off`:e.getAttribute(`role`)===`switch`?e.getAttribute(`aria-checked`)===`true`?`on`:`off`:e instanceof HTMLSelectElement?e.selectedOptions[0]?.text||``:e.value??``}function Qn(){let e=[],t=e=>e.offsetParent!==null&&!e.closest(`[aria-label="Talk"]`)&&!e.closest(`[inert]`),n=e=>e.getAttribute(`aria-label`)||e.innerText||e.getAttribute(`placeholder`)||e.getAttribute(`title`)||``,r=Yn();for(let i of document.querySelectorAll(`a[href^="#/"], [role="tab"], [role="radiogroup"] [role="radio"], input, textarea, select, [role="switch"], button, [role="button"]`)){if(!t(i))continue;let a=i.disabled||i.readOnly||i.getAttribute(`aria-disabled`)===`true`;if(!i.closest(`dialog[open], [role='dialog'], [role='alertdialog']`)||i.matches(`button, [role='button']`)&&/^(cancel|close|no|back|not now)$/i.test(Wn(n(i)))){if(i instanceof HTMLTextAreaElement)a||e.push({kind:r?`setting`:`field`,label:Xn(i)||i.placeholder||`Text`,value:r?Zn(i):void 0,el:i});else if(i.matches(`button, [role='button']`)&&!i.matches(`[role='tab'], [role='radio'], [role='switch']`))a||e.push({kind:`button`,label:n(i),el:i});else if(!(i instanceof HTMLInputElement&&[`hidden`,`password`,`file`,`submit`,`button`,`image`,`reset`].includes(i.type))){if(i instanceof HTMLInputElement&&i.type!==`checkbox`&&i.type!==`radio`){let t=`${i.getAttribute(`aria-label`)||``} ${i.placeholder||``} ${i.type}`;if(a)continue;/search|filter|find/i.test(t)?e.push({kind:`search`,label:i.getAttribute(`aria-label`)||i.placeholder||`Search`,el:i}):r?e.push({kind:`setting`,label:Xn(i),value:Zn(i),el:i}):e.push({kind:`field`,label:Xn(i)||i.placeholder||`Text`,el:i})}else i instanceof HTMLSelectElement||i.getAttribute(`role`)===`switch`||i instanceof HTMLInputElement&&i.type===`checkbox`?r&&!a&&e.push({kind:`setting`,label:Xn(i)||n(i),value:Zn(i),el:i}):i.matches(`a`)?e.push({kind:`link`,label:n(i),href:i.getAttribute(`href`)||``,el:i}):i instanceof HTMLInputElement||e.push({kind:i.getAttribute(`role`)===`tab`?`tab`:`option`,label:n(i),el:i})}}}return e}var $n=()=>Gn(Qn());function er(e){let t=$n(),n=((document.querySelector(`[data-screen]`)??document.body).innerText||``).replace(/[ \t]+/g,` `).replace(/\n{3,}/g,`
|
|
4
|
-
|
|
5
|
-
`).trim(),r=Kn(t);return`${r?`Controls (page_act takes a ref and its label):\n${r}\n\n`:``}Page text:\n${n}`.slice(0,e)}function tr(e,t){if(e instanceof HTMLInputElement&&e.type===`checkbox`){let n=nr(t);return n===null?`Say on or off.`:(e.checked!==n&&e.click(),null)}if(e.getAttribute(`role`)===`switch`){let n=nr(t);return n===null?`Say on or off.`:(e.getAttribute(`aria-checked`)===`true`!==n&&e.click(),null)}if(e instanceof HTMLSelectElement){let n=[...e.options].find(e=>e.text.trim().toLowerCase()===t.toLowerCase()||e.value.toLowerCase()===t.toLowerCase());return n?(e.value=n.value,e.dispatchEvent(new Event(`change`,{bubbles:!0})),null):`It is one of: ${[...e.options].map(e=>e.text.trim()).filter(Boolean).slice(0,8).join(`, `)}.`}let n=e;return Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,`value`)?.set?.call(n,t),n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0})),null}var nr=e=>/^(on|yes|true|enabled?|shown?)$/i.test(e)?!0:!/^(off|no|false|disabled?|hidden)$/i.test(e)&&null;async function rr(e){let t=qn(e);if(!t)return`That is not a control of this page.`;let n=Jn($n(),t);if(typeof n==`string`)return n;let r=n.from.el;if(n.kind===`setting`||n.kind===`option`&&Yn()){let e=n.kind===`setting`?t.text:n.label;return zn?await zn(n.kind===`setting`?`Change ${n.label} to ${e}?`:`Switch to ${e}?`)?n.kind===`option`?(r.click(),`Switched to ${e}. Settings saves it.`):tr(r,t.text)??`Changed ${n.label} to ${t.text}. Settings saves it.`:`Not changed: the person did not say yes.`:`Changing a setting needs Talk on: ask the person to change it on the page.`}if(n.kind===`button`)return zn?await zn(`Press ${n.label}?`)?(r.click(),`Pressed ${n.label}.`):`Not pressed: the person did not say yes.`:`Pressing a button needs Talk on: ask the person to press it.`;if(n.kind===`field`){let e=r instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;return Object.getOwnPropertyDescriptor(e,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed into ${n.label}.`}return n.kind===`search`&&r instanceof HTMLInputElement?(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed “${t.text}” into ${n.label}.`):(r.click(),n.kind===`link`?`Opened ${n.label}.`:`Picked ${n.label}.`)}var ir=[`open`,`open_run`,`open_chat`,`search`,`back`,`new_chat`,`set`,`read`,`act`],ar={theme:[`light`,`dark`,`system`],sidebar:[`open`,`closed`],browser:[`shown`,`hidden`],talk:[`off`]},or=8e3,sr=/^(?:latest|last|newest|most recent)?$/i,cr=/^[A-Za-z0-9_-]{1,80}$/,lr=e=>e.replace(/[\u0000-\u001f\u007f]+/g,` `).trim().slice(0,1200);function ur(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||!cr.test(t.id)||!ir.includes(t.action))return null;let n=typeof t.what==`string`?lr(t.what):void 0;return{id:t.id,action:t.action,...n?{what:n}:{}}}function dr(e,t){let n=e=>{let t=e.toLowerCase().replace(/[^a-z]/g,``).replace(/c(?=[eiy])/g,`s`).replace(/c/g,`k`).replace(/ph/g,`f`).replace(/sh/g,`s`);return((/^[aeiou]/.test(t)?`a`:``)+t.replace(/[aeiouyhw]/g,``)).replace(/(.)\1+/g,`$1`)},r=t.replace(/^(the|a|an|my)\s+|\s+(page|section|settings?)$/gi,``).toLowerCase().replace(/[^a-z]/g,``),i=n(r);if(i.length<2)return[];let a=e.filter(e=>e.kind!==`field`).map(e=>{let t=e.label.toLowerCase().replace(/[^a-z]/g,``),a=fr(i,n(t))/Math.max(i.length,n(t).length);return{label:e.label,sound:a,d:a+.5*Math.abs(r.length-t.length)/Math.max(r.length,t.length)}}).filter(e=>e.sound<=.5).sort((e,t)=>e.d-t.d);return[...new Set(a.map(e=>e.label))].slice(0,3)}function fr(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=n[0];n[0]=r;for(let a=1;a<=t.length;a++){let o=n[a];n[a]=Math.min(n[a]+1,n[a-1]+1,i+(e[r-1]===t[a-1]?0:1)),i=o}}return n[t.length]}var pr=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,``);function mr(e,t){let n=pr(t),r=n.length>=4?e.filter(e=>e.kind!==`field`&&pr(e.label)===n):[];return r.length===1?r[0]:void 0}var hr=/^(?:settings\s*[›>:/-]\s*(.+)|(?:the\s+)?(.+?)\s+settings?)$/i;async function gr(e,t){let r=(e.what||``).trim();switch(e.action){case`open`:{let e=await t.commands(),n=hr.exec(r),i=n?(n[1]||n[2]||``).trim():``,a=r?i&&ee(e.filter(e=>e.kind===`setting`),i.toLowerCase())||ee(e,r.toLowerCase())||mr(e,r):void 0;if(!a){let t=dr(e,r);return`Nothing in ForgeQE is called “${r}”.${t.length?` The nearest: ${t.join(`, `)}.`:``}`}return t.go(a.href)===!1?`${a.label} is already open.`:`Opened ${a.label}.`}case`open_run`:{let e=await t.runs(),i=sr.test(r)?e[0]:e.find(e=>e.name===r)??e.find(e=>e.title.toLowerCase()===r.toLowerCase());return i?(t.go(n(`runs`,encodeURIComponent(i.name))),`Opened the run “${i.title||i.name}”.`):e.length?`No run is called “${r}”.`:`There are no runs yet.`}case`open_chat`:{let e=await t.chats(),i=sr.test(r)?e.find(e=>e.id!==t.current):e.find(e=>e.id===r)??e.find(e=>e.title.toLowerCase()===r.toLowerCase());return i?(t.go(n(`chats`,i.id)),`Opened the chat “${i.title}”.`):`No chat is called “${r}”.`}case`search`:return r?(t.find(r),`Searching for “${r}”.`):`Nothing to search for.`;case`back`:return t.back(),`Went back.`;case`new_chat`:return t.go(n()),`Opened a new chat.`;case`set`:{let[e,n,...i]=r.split(` `),a=e&&Object.hasOwn(ar,e)?ar[e]:void 0;return!a||!n||i.length||!a.includes(n)?`That cannot be changed from here.`:t.set?await t.set(e,n):`That cannot be changed from here.`}case`read`:return(t.screen?.(or)??``).slice(0,or);case`act`:return t.actOn?await t.actOn(r):`That cannot be done from here.`}}var _r=new Set;function vr(e,t){_r.has(e.id)||(_r.add(e.id),t(e))}function yr(e,t,n,r){let i=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(n&&e){if(i.current!==e){i.current=e;for(let e of t)_r.add(e.id)}else for(let e of t)_r.has(e.id)||(_r.add(e.id),r(e))}},[e,t.length,n])}var br=(0,R.createContext)(null);function xr({pages:e,find:t,set:n,children:r}){let i=(0,R.useRef)(null),a=(0,R.useCallback)(r=>({commands:()=>i.current??=p(()=>import(`./paletteCommands-Isq1rLs-.js`).then(t=>t.everyCommand(e)),__vite__mapDeps([0,1,2,3,4,5,6])),runs:async()=>(await ne.list()).runs.map(e=>({name:e.name,title:e.title})),chats:async()=>(await le.list()).chats.map(e=>({id:e.id,title:e.title})),find:t,go:e=>location.hash.replace(/^#/,``)===e.replace(/^#/,``)?(window.dispatchEvent(new HashChangeEvent(`hashchange`)),!1):(location.hash=e,!0),back:()=>history.back(),...r?{current:r}:{},...n?{set:(e,t)=>n(e,t,r)}:{},screen:er,actOn:rr}),[e,t,n]),o=(0,R.useCallback)(async(e,t)=>{let n=await gr(e,a(t)).catch(e=>`That did not work: ${e.message}`);return t&&/^act_[a-f0-9]{16}$/.test(e.id)&&await le.screen(t,e.id,n).catch(()=>{}),n},[a]),s=(0,R.useMemo)(()=>({act:o}),[o]);return(0,z.jsx)(br.Provider,{value:s,children:r})}function Sr(){let e=(0,R.useContext)(br);return e?e.act:async()=>``}var Cr=16e3;function wr(e,t){if(!e.length||!(t>0))return new Int16Array;let n=t/Cr,r=Math.floor(e.length/n),i=new Int16Array(r);for(let t=0;t<r;t++){let r=Math.floor(t*n),a=Math.max(r+1,Math.floor((t+1)*n)),o=0;for(let t=r;t<a;t++)o+=e[t]??0;let s=Math.max(-1,Math.min(1,o/(a-r)));i[t]=Math.round(s<0?s*32768:s*32767)}return i}function Tr(e){let t;try{t=atob(e)}catch{return new Float32Array}let n=Math.floor(t.length/2),r=new Float32Array(n);for(let e=0;e<n;e++){let n=t.charCodeAt(2*e)|t.charCodeAt(2*e+1)<<8;n>=32768&&(n-=65536),r[e]=n/32768}return r}var Er=(0,R.createContext)(null);function Dr(){let e=(0,R.useContext)(Er);if(!e)throw Error(`useTalk outside TalkProvider`);return e}var Or=e=>{try{return localStorage.getItem(e)}catch{return null}},kr=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},Ar=()=>{let e=Or(`forgeqe.voice.eagerness`);return e===`eager`||e===`patient`?e:`normal`},jr=e=>kr(`forgeqe.voice.eagerness`,e),Mr=null;function Nr(e=!1){return(e||!Mr)&&(Mr=re.status()),Mr.catch(()=>Mr=null),Mr}var Pr=()=>/^#\/chats\/([a-f0-9]{18})(?:[/?]|$)/.exec(location.hash)?.[1]??null,Fr=320;function Ir({children:e}){let[t,n]=(0,R.useState)(`off`),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),d=Sr(),f=(0,R.useRef)(null),m=(0,R.useRef)(null),h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useRef)([]),v=(0,R.useRef)(0),y=(0,R.useRef)(0),b=(0,R.useRef)(new Int16Array),x=(0,R.useRef)({hearing:!1,thinking:!1,speaking:!1}),S=(0,R.useRef)(null),C=(0,R.useRef)(0),w=(0,R.useRef)(new Map),T=(0,R.useCallback)(()=>{let e=x.current;n(e.hearing?`hearing`:e.speaking?`speaking`:e.thinking?`thinking`:`listening`)},[]),ee=(0,R.useCallback)(e=>{y.current=e;let t=m.current,n=h.current;if(!t||!n)return;let r=t.currentTime;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(0,r+.08);let i=_.current;_.current=[],v.current=0,setTimeout(()=>{for(let e of i)try{e.stop()}catch{}n.gain.setValueAtTime(1,t.currentTime)},90),x.current.speaking=!1,T()},[T]),E=(0,R.useCallback)((e,t,n)=>{let r=m.current,i=h.current;if(!r||!i||e<y.current)return;let a=Tr(n);if(!a.length||!(t>=8e3&&t<=48e3))return;let o=r.createBuffer(1,a.length,t);o.copyToChannel(a,0);let s=r.createBufferSource();s.buffer=o,s.connect(i),v.current=Math.max(v.current,r.currentTime+.04),s.start(v.current),v.current+=o.duration,_.current.push(s),s.onended=()=>{_.current=_.current.filter(e=>e!==s),_.current.length||(x.current.speaking=!1,T())},x.current.speaking=!0,T()},[T]),D=(0,R.useCallback)(e=>{let t;try{t=JSON.parse(e)}catch{return}let n=e=>typeof e==`string`?e:``;switch(t.type){case`audio`:typeof t.gen==`number`&&typeof t.rate==`number`&&E(t.gen,t.rate,n(t.pcm));break;case`interrupt`:typeof t.gen==`number`&&ee(t.gen);break;case`chat`:{if(t.id===null){S.current=null,i(null),u(null);break}let e=n(t.id);if(!/^[a-f0-9]{18}$/.test(e))break;S.current=e,i(e);break}case`caption`:{let e=n(t.text).slice(0,300);t.who===`you`?u({who:`you`,text:e}):u(t=>({who:`atlas`,text:t?.who===`atlas`?`${t.text} ${e}`.slice(-300):e}));break}case`state`:for(let e of[`hearing`,`thinking`,`speaking`])typeof t[e]==`boolean`&&(x.current[e]=t[e]);typeof t.thinking==`boolean`&&o(t.thinking),T();break;case`app_action`:{let e=ur(t);e&&(C.current=Date.now(),vr(e,e=>d(e,S.current??void 0)));break}case`confirmed`:{let e=w.current.get(n(t.id));w.current.delete(n(t.id)),e?.(t.yes===!0);break}case`error`:c(n(t.message).slice(0,300))}},[d,ee,E,T]),O=()=>{Bn(null);for(let e of w.current.values())e(!1);w.current.clear();try{f.current?.close()}catch{}f.current=null,g.current?.getTracks().forEach(e=>e.stop()),g.current=null,m.current?.close().catch(()=>{}),m.current=null,h.current=null,_.current=[],v.current=0,b.current=new Int16Array},k=(0,R.useCallback)(()=>{O(),x.current={hearing:!1,thinking:!1,speaking:!1},S.current=null,i(null),u(null),n(`off`),o(!1)},[]),A=(0,R.useCallback)(async()=>{if(!f.current){c(``),n(`connecting`);try{if(!(await Nr()).ready)throw Error(`Speech is not set up on this computer yet: Settings › Voice.`);re.warm().catch(()=>{});let e=new AudioContext;m.current=e;let t=e.createGain();t.connect(e.destination),h.current=t;let r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}});g.current=r;let{default:a}=await p(async()=>{let{default:e}=await import(`./capture.worklet-C65DyLpl.js`);return{default:e}},[]);await e.audioWorklet.addModule(a);let o=new AudioWorkletNode(e,`forgeqe-capture`);e.createMediaStreamSource(r).connect(o),o.port.onmessage=t=>{let n=wr(t.data,e.sampleRate),r=new Int16Array(b.current.length+n.length);r.set(b.current),r.set(n,b.current.length);let i=0;for(;r.length-i>=Fr;i+=Fr)f.current?.readyState===WebSocket.OPEN&&f.current.send(r.slice(i,i+Fr).buffer);b.current=r.slice(i)},S.current=Pr(),i(S.current);let{ticket:s}=await re.ticket(S.current,Ar()),c=new WebSocket(`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/voice/session?ticket=${s}`);c.binaryType=`arraybuffer`,c.onmessage=e=>typeof e.data==`string`&&D(e.data),c.onopen=()=>{x.current={hearing:!1,thinking:!1,speaking:!1},n(`listening`),Bn(e=>new Promise(t=>{if(c.readyState!==WebSocket.OPEN)return t(!1);let n=Math.random().toString(36).slice(2,12);w.current.set(n,t),setTimeout(()=>w.current.get(n)===t&&(w.current.delete(n),t(!1)),35e3),c.send(JSON.stringify({type:`confirm`,id:n,text:e.slice(0,200)}))}))},c.onclose=()=>{f.current===c&&(O(),n(`off`))},f.current=c}catch(e){O(),n(`off`),c(e.name===`NotAllowedError`?`The browser was not allowed to use the microphone: allow it in the address bar, then try again.`:e.message)}}},[D]);(0,R.useEffect)(()=>()=>O(),[]),(0,R.useEffect)(()=>{let e=()=>{let e=()=>_.current.length?setTimeout(e,300):k();setTimeout(e,1500)};return window.addEventListener(`forgeqe:talk-off`,e),()=>window.removeEventListener(`forgeqe:talk-off`,e)},[k]),(0,R.useEffect)(()=>{if(t===`off`)return;let e=()=>{if(Date.now()-C.current<3e3)return;let e=Pr(),t=location.hash===``||location.hash===`#`||location.hash===`#/`;(e||t)&&(e??null)!==S.current&&f.current?.readyState===WebSocket.OPEN&&f.current.send(JSON.stringify({type:`page`,chat:e}))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[t]);let j=(0,R.useMemo)(()=>({phase:t,chat:r,working:a,error:s,line:l,start:()=>void A(),end:k,dismiss:()=>c(``)}),[t,r,a,s,l,A,k]);return(0,z.jsx)(Er.Provider,{value:j,children:e})}function Lr({chat:e,disabled:t}){let n=Dr(),[r,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{Nr().then(e=>i(e.ready)).catch(()=>i(!1))},[]);let a=Vr(n,e),o=r===!1;return(0,z.jsx)(L,{variant:`icon`,size:`icon`,className:h(`flex-none`,a&&`bg-accent-soft text-accent-fg`),"aria-label":`Talk`,"aria-pressed":a,disabled:o||t&&!a,"data-tip":o?`Talk needs a one-time setup: Settings › Voice`:a?`End the talk`:`Talk to Atlas: speech stays on this computer`,onClick:()=>{if(a)return n.end();n.phase!==`off`&&n.end(),n.start()},children:(0,z.jsx)(xt,{"aria-hidden":`true`})})}function Rr({chat:e}){let t=Dr(),n=Vr(t,e);if(!n&&!t.error)return null;let r=n&&t.phase!==`thinking`;return(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`-mt-1 mb-4 flex flex-col gap-2 border-b border-line-soft pb-4 text-body-sm`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-x-2 gap-y-1`,children:[r?(0,z.jsx)(ye,{state:Ur[t.phase],px:18}):(0,z.jsx)(xt,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,z.jsx)(`span`,{className:`font-medium`,children:n?Hr[t.phase]:`Talk stopped`}),n&&(0,z.jsx)(`span`,{className:`text-muted`,children:`Talk over Atlas any time; it stops and listens.`}),(0,z.jsx)(`span`,{className:`flex-auto`}),n?(0,z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:t.end,children:`End`}):(0,z.jsx)(L,{variant:`icon`,size:`icon-xs`,type:`button`,"aria-label":`Close the note`,"data-tip":`Close the note`,onClick:t.dismiss,children:(0,z.jsx)(rt,{size:14,"aria-hidden":`true`})})]}),t.error&&(0,z.jsx)(`p`,{className:h(ue.fail,`m-0`),children:t.error})]})}function zr({rail:e=!1}){let t=Dr(),n=t.phase!==`off`,r=()=>n?t.end():t.start();return e?(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Talk`,"aria-pressed":n,"data-tip":`Talk to Atlas`,"data-tip-side":`left`,onClick:r,className:h(`size-9`,n&&`bg-accent-soft text-accent-fg`),children:(0,z.jsx)(xt,{strokeWidth:1.8,"aria-hidden":`true`})}):(0,z.jsxs)(L,{size:`sm`,"aria-pressed":n,onClick:r,className:`w-full justify-start px-2`,children:[(0,z.jsx)(xt,{strokeWidth:1.8,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`flex-1 text-left`,children:`Talk`})]})}function Br(){let e=Dr(),[t,r]=(0,R.useState)(location.hash);(0,R.useEffect)(()=>{let e=()=>r(location.hash);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let i=t===``||t===`#`||t===`#/`;return e.phase===`off`||(e.chat?Pr()===e.chat:i)?null:(0,z.jsxs)(`div`,{role:`region`,"aria-label":`Talk`,"aria-live":`polite`,className:h(y,`fixed right-4 bottom-4 z-30 flex max-w-[min(560px,calc(100vw-32px))] items-center gap-2 text-body-sm`),children:[e.phase===`thinking`?(0,z.jsx)(xt,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}):(0,z.jsx)(ye,{state:Ur[e.phase],px:18}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.line?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-muted`,children:e.line.who===`you`?`You: `:`Atlas: `}),e.line.text]}):(0,z.jsx)(`span`,{className:`font-medium`,children:Hr[e.phase]})}),e.chat&&(0,z.jsx)(`a`,{href:n(`chats`,e.chat),className:h(de({variant:`ghost`,size:`sm`}),`no-underline`),children:`Open the chat`}),(0,z.jsx)(L,{variant:`ghost`,size:`sm`,type:`button`,onClick:e.end,children:`End`})]})}var Vr=(e,t)=>e.phase!==`off`&&(e.chat??null)===t,Hr={off:`Talk stopped`,connecting:`Starting Talk…`,listening:`Listening. Just talk.`,hearing:`Hearing you…`,thinking:`Listening while Atlas works.`,speaking:`Speaking.`},Ur={off:`idle`,connecting:`waiting`,listening:`waiting`,hearing:`recording`,thinking:`thinking`,speaking:`writing`},Wr={pass:`bg-pass-soft text-pass shadow-none`,warn:`bg-warn-soft text-warn shadow-none`,fail:`bg-fail-soft text-fail shadow-none`,info:`bg-accent-soft text-accent-fg shadow-none`},Gr={md:`size-9`,lg:`size-10`,xl:`size-14`},Kr={md:18,lg:20,xl:28},qr={md:20,lg:24,xl:32},Jr={md:`size-[18px]`,lg:`size-5`,xl:`size-7`};function Yr({icon:e,logo:t,pixel:n,tone:r,size:i=`md`,className:a}){return(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-icon-tile":``,className:h(`inline-flex flex-none items-center justify-center rounded-base`,l,r&&Wr[r],Gr[i],a),children:n?(0,z.jsx)(d,{name:n,px:qr[i]}):t?(0,z.jsx)(t,{className:Jr[i]}):e?(0,z.jsx)(F,{icon:e,size:Kr[i]}):null})}var Xr=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function Zr(e,t){let n=e;for(let e of t)n=Xr(n)[e];return n}var Qr=e=>e===void 0||e===``||typeof e==`number`&&Number.isNaN(e);function $r(e,t,n){let[r,...i]=t;if(r===void 0)return e;let a={...e},o=i.length?$r(Xr(e[r]),i,n):n;return Qr(o)||i.length&&Qr(n)&&!Object.keys(Xr(o)).length?delete a[r]:a[r]=o,a}function ei(e,t,n){let r={};for(let[i,a]of Object.entries(e))r[i===t?n:i]=a;return r}function ti(e,t){if(!(t in e))return t;for(let n=2;;n++)if(!(`${t}-${n}`in e))return`${t}-${n}`}var ni=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function ri({checked:e,onChange:t,label:n,id:r,disabled:i}){return(0,z.jsx)(`button`,{type:`button`,role:`switch`,id:r,"aria-checked":e,"aria-label":n,disabled:i,onClick:()=>t(!e),className:h(`relative h-5 w-9 flex-none cursor-pointer rounded-full border-0 p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`bg-accent`:`bg-line`),children:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:h(`absolute top-1/2 size-4 -translate-y-1/2 rounded-full bg-white shadow-[0_1px_2px_var(--shadow-float-ink)] left-0.5 transition-transform`,e&&`translate-x-4`)})})}function ii(e){return{label:`All agents`,href:n(`agents`)}}var ai=`orchestrator`;function oi(e){return e.page?k(e.page)??A.find(e=>e.id===`orchestrator`):A.find(t=>t.agent!==`forgeqe`&&e.title.startsWith(`${j(t.agent).name}: `))??A.find(e=>e.id===`orchestrator`)}var si=(e,t)=>t.filter(t=>oi(t)?.id===e.id);function ci(e,t){if(e[0]!==`chats`||!e[1]||!t)return e;let n=oi(t);return n&&n.agent!==`forgeqe`?[`agents`,n.id]:e}function li(e){let t=e[0]===`chats`?e[1]:void 0,[n,r]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!t)return;let e=!1;return le.events(t,2**53-1,!1).then(n=>!e&&r({id:t,title:n.title,...n.page?{page:n.page}:{}}),()=>{}),()=>{e=!0}},[t]),ci(e,n&&n.id===t?n:null)}var ui=`rounded-base border border-line bg-bg shadow-none in-[.rounded-lg.bg-bg]:shadow-none`,di=`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,fi=`px-4 py-2 text-right text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,pi=`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,mi=`h-12 cursor-pointer border-t border-line-soft align-middle transition-colors duration-150 hover:bg-tint data-[state=selected]:bg-tint-hover`,hi=`px-4 py-2`,gi=`px-4 py-2 text-right whitespace-nowrap tabular-nums`,_i=new Set([`className`,`style`,`key`,`ref`,`id`,`role`,`type`,`colSpan`,`rowSpan`,`scope`,`data-tip-side`]);function vi(e,t=0){if(e==null||typeof e==`boolean`||typeof e==`function`||t>12)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>vi(e,t+1)).join(` `);if((0,R.isValidElement)(e))return vi(e.props,t+1);if(typeof e==`object`){let n=[];for(let[r,i]of Object.entries(e))_i.has(r)||r.startsWith(`on`)||r.startsWith(`aria-`)||n.push(vi(i,t+1));return n.join(` `)}return``}function yi(e){return R.Children.toArray((0,R.isValidElement)(e)&&e.type===R.Fragment?e.props.children:e)}function bi(e,t=0){if(e==null||typeof e==`boolean`||t>12)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>bi(e,t+1)).join(` `);if(!(0,R.isValidElement)(e))return``;let n=e.props;return typeof n.className==`string`&&/(^|\s)sr-only(\s|$)/.test(n.className)||n.onCheckedChange!==void 0?``:bi(n.children,t+1)}function xi(e){return(0,R.isValidElement)(e)?e.type===`tr`?e:e.type===R.Fragment?R.Children.toArray(e.props.children).find(e=>(0,R.isValidElement)(e)&&e.type===`tr`)??null:null:null}var Si=/^[-+]?(?:\d{1,3}(?:,\d{3})+|\d+)?(?:\.\d+)?\s*(?:%|ms|s|m|h|d|x|kb|mb|gb)?$/i;function Ci(e){if(!(0,R.isValidElement)(e))return``;let t=e.props,n=t[`data-sort`];if(typeof n==`number`)return n;if(typeof n==`string`)return Si.test(n.trim())&&/\d/.test(n)?parseFloat(n.replace(/,/g,``)):n.toLowerCase();let r=t[`data-tip`];if(typeof r==`string`&&/\d{1,4}[/.-]\d{1,2}[/.-]\d{1,4}/.test(r)){let e=Date.parse(r);if(Number.isFinite(e))return e}let i=bi(t.children).replace(/\s+/g,` `).trim();return i&&/\d/.test(i)&&Si.test(i)?parseFloat(i.replace(/,/g,``)):i.toLowerCase()}function wi(e,t,n){if(!t.size||!(0,R.isValidElement)(e))return e;let r=e=>{let r=R.Children.toArray(e.props.children);return r.length===n?(0,R.cloneElement)(e,void 0,r.filter((e,n)=>!t.has(n))):e};return e.type===`tr`?r(e):e.type===R.Fragment?(0,R.cloneElement)(e,void 0,R.Children.toArray(e.props.children).map(e=>(0,R.isValidElement)(e)&&e.type===`tr`?r(e):e)):e}function Ti(e){if(!(0,R.isValidElement)(e))return e;if(e.type===`tr`)return(0,R.cloneElement)(e,{"data-row":``});if(e.type===R.Fragment){let t=!1;return(0,R.cloneElement)(e,void 0,R.Children.toArray(e.props.children).map(e=>t||!(0,R.isValidElement)(e)||e.type!==`tr`?e:(t=!0,(0,R.cloneElement)(e,{"data-row":``}))))}return e}function Ei({on:e,dir:t,num:n,onClick:r,children:i}){let a=e&&t===`asc`?tn:Nt;return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:h(`group -mx-2 inline-flex cursor-pointer items-center gap-1 rounded-sm border-0 bg-transparent px-2 py-1 font-medium tracking-wide uppercase transition-colors duration-150 hover:text-ink focus-visible:outline-2 focus-visible:outline-accent`,e?`text-ink`:`text-muted`,n&&`flex-row-reverse`),children:[i,e?(0,z.jsx)(a,{size:12,"aria-hidden":`true`,className:`flex-none`}):(0,z.jsx)(Se,{size:12,"aria-hidden":`true`,className:`flex-none opacity-50 transition-opacity duration-150 group-hover:opacity-100`})]})}function Di({label:e,head:t,children:n,empty:i=`None.`,size:a=25,resetKey:o,fixed:s=!1,minWidth:c,className:l,search:d=!0,sortable:f=!0,columns:p=!0,placeholder:m,tools:g,end:_,selection:v,height:y,count:b=!0,framed:x=!1}){let S=R.Children.toArray(n),[C,w]=(0,R.useState)(``),T=C.toLowerCase().split(/\s+/).filter(Boolean),ee=(0,R.useMemo)(()=>d?S.map(e=>vi(e).toLowerCase()):[],[n,d]),E=T.length?S.filter((e,t)=>T.every(e=>ee[t].includes(e))):S,D=yi(t),O=D.map(e=>(0,R.isValidElement)(e)&&e.type===`th`?bi(e.props.children).replace(/\s+/g,` `).trim():``),k=(0,R.useMemo)(()=>S.every(e=>xi(e)?R.Children.toArray(xi(e).props.children).length===D.length:!1),[n,D.length]),[A,j]=(0,R.useState)(null),te=f&&k&&S.length>1,M=(0,R.useMemo)(()=>{if(!te||!A||!O[A.col])return E;let e=A.dir===`asc`?1:-1;return E.map(e=>({r:e,v:Ci(R.Children.toArray(xi(e).props.children)[A.col])})).toSorted((t,n)=>(typeof t.v==`number`&&typeof n.v==`number`?t.v-n.v:String(t.v).localeCompare(String(n.v),void 0,{numeric:!0,sensitivity:`base`}))*e).map(e=>e.r)},[E,A,te]),ne=e=>{if(A?.col===e)return j({col:e,dir:A.dir===`asc`?`desc`:`asc`});let t=E.length?Ci(R.Children.toArray(xi(E[0]).props.children)[e]):``;j({col:e,dir:typeof t==`number`?`desc`:`asc`})},re=O.flatMap((e,t)=>e?[t]:[]),ie=p&&k?re.slice(1):[],[ae,oe]=(0,R.useState)([]),se=new Set(ae.map(Number).filter(e=>ie.includes(e))),ce=D.map((e,t)=>{if(!te||!O[t]||!(0,R.isValidElement)(e)||e.type!==`th`)return e;let n=e,r=A?.col===t,i=/(^|\s)text-right(\s|$)/.test(n.props.className??``);return(0,R.cloneElement)(n,{"aria-sort":r?A.dir===`asc`?`ascending`:`descending`:`none`},(0,z.jsx)(Ei,{on:r,dir:A?.dir??`asc`,num:i,onClick:()=>ne(t),children:n.props.children}))}).filter((e,t)=>!se.has(t)),N=ie.length>=2?(0,z.jsx)(Mi,{columns:ie.map(e=>({id:String(e),label:O[e]})),hidden:ae,onChange:oe}):null,[le,ue]=(0,R.useState)(0);(0,R.useEffect)(()=>ue(0),[o,C,A]);let de=(0,R.useRef)(null),[P,fe]=(0,R.useState)(null),F=(0,R.useRef)(0),pe=()=>{let e=de.current;if(!y||!e)return;let t=e.querySelector(`thead`)?.offsetHeight??0,n=e.querySelectorAll(`tbody > tr[data-row]`);for(let t of n.length?n:e.querySelectorAll(`tbody > tr`))F.current=Math.max(F.current,t.offsetHeight);F.current&&fe(Math.max(1,Math.min(a,Math.floor((e.clientHeight-t)/F.current))))};(0,R.useEffect)(()=>{let e=de.current;if(!y||!e||typeof ResizeObserver>`u`)return;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(F.current=0),t=e.clientWidth,pe()});return n.observe(e),()=>n.disconnect()},[y,a]);let I=y?P??a:a,me=Math.max(1,Math.ceil(M.length/I)),he=Math.min(le,me-1),_e=M.slice(he*I,he*I+I).map(e=>Ti(wi(e,se,D.length)));(0,R.useEffect)(pe,[he,I,M,ae]);let[ve,ye]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let e=de.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>ye(e.scrollWidth>e.clientWidth+1),n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),t(),()=>n.disconnect()},[y]);let be=D.length-se.size,xe=_||N?(0,z.jsxs)(z.Fragment,{children:[N,_]}):null;return(0,z.jsxs)(`div`,{className:h(u,`@container overflow-hidden p-0 in-[.rounded-lg.bg-bg]:shadow-none in-[.panel]:shadow-none`,x&&ui,l),children:[(d||g||xe)&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line-soft px-2 py-2`,children:[d&&(0,z.jsxs)(`label`,{className:`relative flex min-w-0 w-full max-w-[320px] flex-[0_1_320px] items-center`,children:[(0,z.jsx)(He,{size:14,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 text-muted`}),(0,z.jsxs)(`span`,{className:`sr-only`,children:[`Find in `,e.toLowerCase()]}),(0,z.jsx)(r,{size:`sm`,type:`search`,value:C,spellCheck:!1,placeholder:m??`Find in ${e.toLowerCase()}`,onChange:e=>w(e.target.value),className:`pl-8`})]}),g,T.length>0&&(0,z.jsxs)(`span`,{className:`text-body-sm whitespace-nowrap text-muted`,role:`status`,children:[M.length,` of `,S.length]}),xe&&(0,z.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:xe})]}),!!v?.count&&(0,z.jsxs)(`div`,{role:`region`,"aria-label":`Selected ${e.toLowerCase()}`,className:`flex flex-wrap items-center justify-between gap-2 border-b border-line-soft bg-surface-muted px-4 py-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-body-sm font-medium text-ink tabular-nums`,role:`status`,children:[v.count,` selected`]}),(0,z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:v.onClear,children:`Clear`})]}),v.actions&&(0,z.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,children:v.actions})]}),(0,z.jsx)(`div`,{ref:de,...ve?{tabIndex:0,role:`region`,"aria-label":`${e}, scrolls`}:{},className:h(`relative overflow-x-auto focus-visible:outline-offset-[-2px]`,y&&`overflow-y-hidden`),style:y?{height:y}:void 0,children:(0,z.jsxs)(`table`,{"aria-label":e,className:h(`w-full border-collapse text-body-sm`,s&&`table-fixed`),style:c?{minWidth:c}:void 0,children:[(0,z.jsx)(`thead`,{children:(0,z.jsx)(`tr`,{className:`h-10 bg-surface-muted text-left align-middle text-muted`,children:ce})}),(0,z.jsxs)(`tbody`,{children:[_e,!M.length&&(0,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:Math.max(1,be),className:`px-4 py-4 text-center text-muted`,children:T.length&&S.length?`Nothing matches.`:i})})]})]})}),M.length>0&&(b||M.length>I)&&(0,z.jsx)(ge,{page:he,size:I,total:M.length,onPage:ue,label:`Pages of ${e.toLowerCase()}`})]})}var Oi=`max(320px, calc(var(--screen) - 288px))`;function ki(e,t,n=`asc`){return e.key===t?{key:t,dir:e.dir===`asc`?`desc`:`asc`}:{key:t,dir:n}}function Ai(e,t,n){let r=n[t.key],i=t.dir===`asc`?1:-1;return e.toSorted((e,t)=>{let n=r(e),a=r(t);return(typeof n==`number`&&typeof a==`number`?n-a:String(n).localeCompare(String(a),void 0,{sensitivity:`base`,numeric:!0}))*i})}function ji({col:e,sort:t,onSort:n,first:r=`asc`,num:i=!1,className:a,children:o}){let s=t.key===e;return(0,z.jsx)(`th`,{scope:`col`,"aria-sort":s?t.dir===`asc`?`ascending`:`descending`:`none`,className:h(i?fi:di,a),children:(0,z.jsx)(Ei,{on:s,dir:t.dir,num:i,onClick:()=>n(ki(t,e,r)),children:o})})}function Mi({columns:e,hidden:t,onChange:n}){let[r,i]=(0,R.useState)(!1);return(0,z.jsxs)(`span`,{className:`relative inline-block`,children:[(0,z.jsxs)(L,{size:`sm`,variant:`outline`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(!r),children:[(0,z.jsx)(Qt,{"aria-hidden":`true`}),`Columns`,(0,z.jsx)(Fe,{"aria-hidden":`true`})]}),(0,z.jsx)(S,{open:r,onClose:()=>i(!1),label:`Columns to show`,align:`end`,className:`min-w-[200px]`,children:e.map(e=>{let r=!t.includes(e.id);return(0,z.jsx)(v,{role:`menuitemcheckbox`,checked:r,onSelect:()=>n(r?[...t,e.id]:t.filter(t=>t!==e.id)),children:(0,z.jsx)(`span`,{className:`flex-1`,children:e.label})},e.id)})})]})}function Ni({children:e,className:t}){return(0,z.jsx)(`kbd`,{className:h(f,`inline-flex min-h-5 items-center rounded-full px-2 font-sans text-label-sm text-ink-2 shadow-[inset_0_-1px_0_var(--shadow-float-ink)]`,t),children:e})}var Pi={x:0,y:0,w:0,h:0,on:!1},Fi=(e,t)=>e.on===t.on&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h;function Ii(e,t){if(!t||!t.isConnected||t.closest(`[inert]`)||!t.offsetHeight)return Pi;let n=0,r=0,i=t;for(;i&&i!==e;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===e?{x:n,y:r,w:t.offsetWidth,h:t.offsetHeight,on:!0}:Pi}function Li(e,t,n){let[r,i]=(0,R.useState)(Pi),a=(0,R.useCallback)(()=>{let n=e.current;if(!n)return;let r=Ii(n,n.querySelector(t));i(e=>Fi(e,r)?e:r)},[e,t]);return(0,R.useLayoutEffect)(a,[n,a]),(0,R.useLayoutEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(a);n.observe(t);for(let e of Array.from(t.children))n.observe(e);return()=>n.disconnect()},[a]),r}var Ri=new Map,zi=1500;function Bi({pill:e,className:t,memory:n,children:r}){let[i,a]=(0,R.useState)(()=>{let e=n?Ri.get(n):void 0;return e&&Date.now()-e.at<zi?e.pill:void 0});(0,R.useEffect)(()=>{n&&e.on&&Ri.set(n,{pill:e,at:Date.now()})},[n,e]),(0,R.useEffect)(()=>{if(!i||!e.on)return;let t=0,n=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>a(void 0))});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}},[i,e.on]);let o=i&&e.on?i:e,s=(0,R.useRef)(!1),c=s.current;return o.on&&(s.current=!0),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:h(`pointer-events-none absolute top-0 left-0 z-0 motion-reduce:transition-none`,c&&`transition-[transform,width,height,opacity] duration-(--motion) ease-out`,t),style:{transform:`translate(${o.x}px, ${o.y}px)`,width:o.w,height:o.h,opacity:+!!o.on},children:r})}var Vi=`flex w-fit max-w-full flex-wrap gap-1 rounded-full bg-surface-strong p-1`,Hi=e=>h(`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-full border-0 px-4 text-body-sm font-medium whitespace-nowrap`,e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),Ui=`rounded-full bg-bg shadow-sm`,Wi=(e,t)=>h(Hi(e),`relative z-10 transition-colors duration-(--motion-fast)`,e&&t&&`bg-transparent shadow-none`);function Gi({icon:e}){return typeof e==`object`&&e&&`pixel`in e?(0,z.jsx)(d,{name:e.pixel,px:18,className:`flex-none`}):(0,z.jsx)(F,{icon:e,size:16,className:`flex-none`})}function Ki(e,t,n,r,i){let a=n===`ArrowRight`?e[(t+1)%e.length]:n===`ArrowLeft`?e[(t-1+e.length)%e.length]:void 0;return a?(i(a.id),document.getElementById(`${r}-${a.id}`)?.focus(),!0):!1}function qi({tabs:e,current:t,onPick:n,hrefOf:r,label:i,className:a,prefix:o=`tab`}){let s=o===`tab`?c:`${o}-panel`,l=(0,R.useRef)(null),u=Li(l,`[aria-selected="true"], [aria-current="page"]`,t);(0,R.useEffect)(()=>{let e=l.current?.querySelector(`[aria-selected="true"], [aria-current="page"]`),t=l.current;if(!e||!t)return;let n=e.offsetLeft-t.offsetLeft;n<t.scrollLeft?t.scrollLeft=n:n+e.offsetWidth>t.scrollLeft+t.clientWidth&&(t.scrollLeft=n+e.offsetWidth-t.clientWidth)},[t]);let d=h(`relative mb-6`,Vi,`flex-nowrap overflow-x-auto [scrollbar-width:thin]`,a),f=e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Gi,{icon:e.icon}),e.label,e.n!==void 0&&e.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]}),p=e=>h(Wi(t===e.id,u.on),`flex-none focus-visible:outline-offset-[-2px]`,e.mono&&`font-mono text-body-sm font-normal`);return r?(0,z.jsxs)(`nav`,{ref:l,"aria-label":i,className:d,children:[(0,z.jsx)(Bi,{pill:u,className:Ui,memory:`tabs:${i}`}),e.map(e=>(0,z.jsx)(`a`,{id:`${o}-${e.id}`,href:r(e.id),"aria-current":t===e.id?`page`:void 0,className:h(p(e),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:f(e)},e.id))]}):(0,z.jsxs)(`div`,{ref:l,role:`tablist`,"aria-label":i,className:d,children:[(0,z.jsx)(Bi,{pill:u,className:Ui}),e.map((r,i)=>(0,z.jsx)(`button`,{id:`${o}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${s}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n?.(r.id),onKeyDown:t=>{n&&Ki(e,i,t.key,o,n)&&t.preventDefault()},className:p(r),children:f(r)},r.id))]})}function Ji({tabs:e,current:t,onPick:n,label:r,className:i,prefix:a=`tab`}){let o=a===`tab`?c:`${a}-panel`,s=(0,R.useRef)(null),l=Li(s,`[aria-selected="true"]`,t);return(0,z.jsxs)(`div`,{ref:s,role:`tablist`,"aria-label":r,className:h(`relative mb-6 flex flex-wrap gap-x-6 border-b border-line-soft`,i),children:[(0,z.jsx)(Bi,{pill:l,className:`border-b-2 border-ink`}),e.map((r,i)=>(0,z.jsxs)(`button`,{id:`${a}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${o}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n(r.id),onKeyDown:t=>{Ki(e,i,t.key,a,n)&&t.preventDefault()},className:h(`relative z-10 -mb-px inline-flex min-h-11 cursor-pointer items-center gap-2 border-0 border-b-2 bg-transparent px-1 text-body-sm font-medium transition-colors duration-(--motion-fast)`,r.mono&&`font-mono text-body-sm font-normal`,t===r.id?h(`text-ink`,l.on?`border-transparent`:`border-ink`):`border-transparent text-muted hover:text-ink`),children:[r.label,r.n!==void 0&&r.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,r.tone||`text-muted`),children:r.n})]},r.id))]})}function Yi({links:e,current:t,label:n,className:r}){let i=(0,R.useRef)(null),a=Li(i,`[aria-current="page"]`,t);return(0,z.jsxs)(`nav`,{ref:i,"aria-label":n,className:h(`relative`,Vi,r),children:[(0,z.jsx)(Bi,{pill:a,className:Ui,memory:`links:${n}`}),e.map(e=>(0,z.jsxs)(`a`,{href:e.href,"aria-current":t===e.id?`page`:void 0,className:h(Wi(t===e.id,a.on),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:[(0,z.jsx)(Gi,{icon:e.icon}),e.label]},e.id))]})}function Xi({options:e,value:t,onChange:n,label:r,labelledBy:i,disabled:a=!1,className:o}){let s=e.filter(e=>!e.disabled&&!a),c=(0,R.useRef)(null),l=Li(c,`[aria-checked="true"]`,t),u=(e,t)=>{let a=s.findIndex(t=>t.id===e),o=s[(a+t+s.length)%s.length];o&&(n(o.id),document.querySelector(`[data-choice="${CSS.escape(o.id)}"][data-group="${CSS.escape(r||i||``)}"]`)?.focus())};return(0,z.jsxs)(`span`,{ref:c,role:`radiogroup`,"aria-label":r,"aria-labelledby":i,className:h(`relative`,Vi,o),children:[(0,z.jsx)(Bi,{pill:l,className:Ui}),e.map(e=>{let o=a||!!e.disabled;return(0,z.jsxs)(`button`,{type:`button`,role:`radio`,"data-choice":e.id,"data-group":r||i||``,"aria-checked":t===e.id,"aria-disabled":o||void 0,tabIndex:t===e.id?0:-1,"data-tip":e.tip,onClick:()=>!o&&n(e.id),onKeyDown:t=>{(t.key===`ArrowRight`||t.key===`ArrowLeft`)&&(t.preventDefault(),u(e.id,t.key===`ArrowRight`?1:-1))},className:h(Wi(t===e.id,l.on),o&&`cursor-not-allowed opacity-50`),children:[e.icon,e.label,e.n!==void 0&&e.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]},e.id)})]})}var Zi={line:16,inset:24},Qi={line:8,inset:16},$i=(0,R.createContext)(null),ea=`relative z-10 flex h-8 short:h-7 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-body-sm no-underline outline-none select-none focus-visible:ring-2 focus-visible:ring-accent`;function ta({offsets:e,width:t,className:n,style:r}){if(!e.length)return null;let i=e[e.length-1],a=i+1;return(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:t,height:a,viewBox:`0 0 ${t} ${a}`,fill:`none`,style:r,className:h(`pointer-events-none absolute top-0 z-0 text-line-strong`,n),children:[(0,z.jsx)(`path`,{d:`M0.5 0 V${i-5}`,stroke:`currentColor`,strokeWidth:`1`}),e.map((e,n)=>(0,z.jsx)(`path`,{d:`M0.5 ${e-5} Q0.5 ${e} 5.5 ${e} H${t-.5}`,stroke:`currentColor`,strokeWidth:`1`},n))]})}function na({lines:e,label:t,className:n,children:r}){let i=(0,R.useRef)(null),[a,o]=(0,R.useState)([]),s=R.Children.count(r),c=(0,R.useCallback)(()=>{let t=i.current;if(!t||!e)return;let n=Array.from(t.children).filter(e=>e.tagName.toLowerCase()!==`svg`&&!e.hasAttribute(`data-tree-group`)).map(e=>{let n=e.matches(`[data-tree-row]`)?e:e.querySelector(`[data-tree-row]`);if(!n)return 0;let r=0,i=n;for(;i&&i!==t;)r+=i.offsetTop,i=i.offsetParent;return i===t?Math.round(r+n.offsetHeight/2):0}).filter(e=>e>0);o(e=>e.join()===n.join()?e:n)},[e]);return(0,R.useLayoutEffect)(()=>{if(c(),!i.current||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(c);return e.observe(i.current),()=>e.disconnect()},[s,c]),(0,z.jsxs)(`div`,{ref:i,role:`group`,"aria-label":t,className:h(`relative flex flex-col gap-px`,n),style:e?{paddingLeft:e.inset}:void 0,children:[e&&(0,z.jsx)(ta,{offsets:a,width:e.inset-e.line,style:{left:e.line}}),r]})}function ra(){let e=(0,R.useContext)($i);return{onPointerEnter:t=>t.pointerType===`mouse`&&e?.hover(t.currentTarget),onFocus:t=>t.currentTarget.matches(`:focus-visible`)&&e?.hover(t.currentTarget)}}function ia({href:e,label:t,current:n,icon:r,badge:i,after:a,tip:o,className:s}){let c=ra(),l=(0,z.jsxs)(`a`,{href:e,"data-tree-row":``,"aria-current":n?`page`:void 0,"data-tip":o,"data-tip-side":o?`right`:void 0,...c,className:h(ea,n?`font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:text-ink`,a&&`pr-8`,s),children:[r??(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`size-[18px] flex-none`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),i]});return a?(0,z.jsxs)(`div`,{className:`group relative`,children:[l,a]}):l}function aa(e,t,n){let[r,i]=(0,R.useState)(t),a=e??r;return[a,()=>{e===void 0&&i(!a),n?.(!a)}]}function oa({href:e,label:t}){return(0,z.jsx)(`a`,{href:e,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:h(de({variant:`icon`,size:`icon-xs`}),`absolute top-1/2 right-[30px] z-20 -translate-y-1/2 bg-surface-strong opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-accent`),children:(0,z.jsx)(Yt,{size:14,strokeWidth:2,"aria-hidden":`true`})})}function sa({label:e,href:t,current:n,className:r,children:i}){let a=(0,R.useId)(),o=`flex h-7 short:h-6 items-center rounded-sm px-2 text-body-sm font-medium text-muted no-underline`;return(0,z.jsxs)(`div`,{"data-tree-group":``,role:`group`,"aria-labelledby":a,className:h(`flex flex-col gap-px`,r),children:[t?(0,z.jsx)(`a`,{id:a,href:t,"aria-current":n?`page`:void 0,className:h(o,`hover:text-ink`,n&&`text-(--side-current-ink)`),children:e}):(0,z.jsx)(`span`,{id:a,className:o,children:e}),i]})}function ca({label:e,icon:t,badge:n,href:r,hrefLabel:i,current:a,open:o,defaultOpen:s=!1,onOpenChange:c,children:l,className:u}){let[d,f]=aa(o,s,c),p=(0,R.useId)(),m=ra();return(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-px`,u),children:[(0,z.jsxs)(`div`,{className:`group relative`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":d,"aria-controls":p,"aria-current":a?`page`:void 0,onClick:f,...m,className:h(ea,`cursor-pointer text-left`,a?`font-medium text-(--side-current-ink)`:`text-ink-2 hover:text-ink`),children:[t,(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n,(0,z.jsx)(Xe,{size:14,strokeWidth:2,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,d&&`rotate-90`)})]}),r&&(0,z.jsx)(oa,{href:r,label:i||`Open ${e}`})]}),(0,z.jsx)(Rn,{open:d,id:p,children:(0,z.jsx)(na,{lines:Qi,label:e,children:l})})]})}function la({label:e,icon:t,href:n,hrefLabel:r,current:i,lines:a,open:o,defaultOpen:s=!0,onOpenChange:c,children:l,className:u}){let[d,f]=aa(o,s,c),p=(0,R.useId)(),m=ra();return(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-px`,u),children:[(0,z.jsxs)(`div`,{className:`group relative`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":d,"aria-controls":p,"aria-current":i?`page`:void 0,onClick:f,...m,className:h(ea,`cursor-pointer text-left font-medium`,i?`text-(--side-current-ink)`:t?`text-ink`:`text-muted hover:text-ink`),children:[t,(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,z.jsx)(Fe,{size:14,strokeWidth:2,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,!d&&`-rotate-90`)})]}),n&&(0,z.jsx)(oa,{href:n,label:r||`Open ${e}`})]}),(0,z.jsx)(Rn,{open:d,id:p,children:(0,z.jsx)(na,{lines:a,label:e,children:l})})]})}function ua({routeKey:e,className:t,children:n}){let r=(0,R.useRef)(null),i=(0,R.useRef)(null),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)(Pi),l=(0,R.useCallback)(()=>{let e=r.current;if(!e)return;let t=[...e.querySelectorAll(`[data-tree-row][aria-current="page"]`)].map(t=>Ii(e,t)).filter(e=>e.on);o(e=>e.length===t.length&&e.every((e,n)=>Fi(e,t[n]))?e:t);let n=i.current?.getAttribute(`aria-current`)===`page`?Pi:Ii(e,i.current);c(e=>Fi(e,n)?e:n)},[]);(0,R.useLayoutEffect)(l,[e,l]),(0,R.useLayoutEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(l);t.observe(e);let n=new MutationObserver(l);return n.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`aria-current`,`inert`],childList:!0}),()=>{t.disconnect(),n.disconnect()}},[l]);let u=(0,R.useRef)({hover:e=>{i.current=e,l()}}).current;return(0,z.jsx)($i.Provider,{value:u,children:(0,z.jsxs)(`div`,{ref:r,onPointerLeave:()=>u.hover(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u.hover(null)},className:h(`relative flex w-full flex-col gap-px`,t),children:[(0,z.jsx)(Bi,{pill:s,className:`rounded-sm bg-surface-strong/60`}),a.map((e,t)=>(0,z.jsx)(Bi,{pill:e,className:`rounded-sm bg-(--side-current-bg)`},t)),n]})})}var da=`flex h-8 short:h-7 items-center gap-2 rounded-full px-4 text-body-sm no-underline`,fa=e=>e?`bg-(--side-current-bg) font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-tint hover:text-ink`,pa=e=>e.id===`agents`?{href:n(`agents`),label:e.label}:{label:e.label},ma=/^[A-Za-z0-9][\w.-]{0,120}$/;function ha(e){let[t,r,i,a]=e;if(t===`responsive`&&r===`runs`&&i)return{middle:{href:n(`responsive`,`runs`),label:`Runs`},here:`Run`};if(t===`product`&&r===`services`&&i)return{middle:{href:n(`product`,`architecture`,`services`),label:`Services`},here:`Service`};if(t===`agents`&&r===`custom`&&i&&i!==`new`)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`category`,`custom`),label:`Custom agents`},here:`Custom agent`};if(t===`agents`&&r===`teams`&&i)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`category`,`custom`),label:`Custom agents`},here:i===`new`?`New team`:`Team`};if(t===`test-management`&&r===`cases`&&i)return{middle:{href:n(`test-management`,`cases`),label:`Test cases`},here:`Test case`};if(t===`test-management`&&r===`tests`&&i)return{middle:{href:n(`test-management`,`tests`),label:`Automated tests`},here:`Test`};if(t===`test-management`&&r===`suites`&&i)return{middle:{href:n(`test-management`,`suites`),label:`Suites`},here:`Suite`};if(t===`agents`&&r===`basal`&&i===`tests`&&a)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`basal`,`tests`),label:`BASAL tests`},here:`Test`};if((t===`migration`||t===`tosca`)&&r&&ma.test(r)&&i===`compare`)return{middle:{href:n(`migration`,r),label:`Conversion`},here:`Compare`}}function ga(e){if(!e.length)return;if(e[0]===`settings`){let t=te.find(t=>t.id===(e[1]||`models`));return t?{parent:{href:n(`settings`),label:`Settings`},here:{label:t.label}}:void 0}let t=On(e),r=ha(e);if(r&&(r.parent||t))return{parent:r.parent??pa(t.category),middle:r.middle,here:{label:r.here}};let i=e[0]===`agents`&&e[1]&&e[1]!==`category`&&e[1]!==`custom`?O(e[1]):void 0;if(i)return{parent:{href:n(`agents`),label:`Agents`},here:{label:j(i.agent).name,href:e.length>2?n(`agents`,i.id):void 0}};if(!t)return;let a=Sn(t.item,e),o=t.item.path.length>0&&e.length>a;return{parent:pa(t.category),here:{label:t.item.label,href:o?n(...t.item.path):void 0}}}var _a={good:`pass`,bad:`fail`,same:`neutral`},va={good:`text-pass`,bad:`text-fail`,same:`text-muted`};function ya(e){return e.dir===`same`||e.good===void 0?`same`:e.good?`good`:`bad`}function ba({children:e,label:t,className:n}){return(0,z.jsx)(`section`,{"aria-label":t,className:h(u,`grid grid-cols-[repeat(auto-fit,minmax(min(100%,150px),1fr))] overflow-hidden p-0`,n),children:e})}function B({label:e,value:t,note:n,icon:r,period:i,change:a,tone:o,big:s,compact:c,className:l}){let u=a&&ya(a),d=a?.dir===`up`?hn:a?.dir===`down`?bt:void 0;return(0,z.jsxs)(`div`,{className:h(`-mr-px -mb-px flex min-w-0 flex-col border-r border-b border-line-soft`,c?`gap-1 px-4 py-2`:`gap-1 px-6 py-4`,l),children:[(0,z.jsxs)(`span`,{className:h(`flex min-w-0 items-center gap-2 font-medium text-ink`,`text-body-sm`),children:[r&&(0,z.jsx)(F,{icon:r,size:14,className:`flex-none text-muted`}),(0,z.jsx)(`span`,{className:`min-w-0`,children:e})]}),i&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:i}),(0,z.jsxs)(`span`,{className:h(`flex flex-wrap items-center gap-x-2 gap-y-1`,c?`mt-0`:i?`mt-2`:`mt-1`),children:[(0,z.jsx)(`span`,{className:h(`tabular-nums`,s?`text-headline-md`:c?`text-headline-sm`:`text-headline-md`,o),children:t}),a&&u&&(0,z.jsx)(`span`,{"aria-hidden":a.against?!0:void 0,className:`inline-flex`,children:(0,z.jsxs)(pe,{tone:_a[u],icon:!1,className:`tabular-nums`,children:[d&&(0,z.jsx)(d,{size:12,strokeWidth:2.5,"aria-hidden":`true`,className:`flex-none`}),a.text]})})]}),(n||a?.against)&&(0,z.jsx)(`span`,{className:h(`text-muted tabular-nums`,c?`truncate text-body-sm`:`text-body-sm`),children:a?.against&&u?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:va[u],children:a.amount??a.text}),` `,a.against,n?(0,z.jsxs)(z.Fragment,{children:[` · `,n]}):null]}):n})]})}var xa=(0,R.createContext)({pending:{},set:()=>{},saved:new Set,vars:{},store:`the credential store`}),Sa=()=>(0,R.useContext)(xa);function Ca(e){return/[\\/]/.test(e)?`ForgeQE's private credentials file (readable only by you)`:e}var wa=/^[A-Za-z_][A-Za-z0-9_]*$/;function Ta(e,t){return t in e.pending?e.pending[t]===null?`removing`:`pending`:e.saved.has(t)?`saved`:e.vars[t]?`environment`:`missing`}var Ea={pending:`Not saved yet`,removing:`Removed when you save`,saved:`Saved`,environment:`Set in the environment`,missing:`Not set`},Da=(e,t)=>[`pending`,`saved`,`environment`].includes(Ta(e,t));function Oa({name:e}){let t=Sa();if(!e)return null;if(!wa.test(e))return(0,z.jsx)(`span`,{className:`text-body-sm text-fail`,children:`Not a variable name`});let n=Ta(t,e);return(0,z.jsx)(`span`,{className:h(`text-body-sm`,n===`saved`||n===`environment`?`text-pass`:n===`missing`?`text-muted`:`text-accent-fg`),children:Ea[n]})}var ka=/user|email|login|client_id|account/i;function Aa({id:e,name:t,field:n,onRename:i,compact:a}){let o=Sa(),s=(0,R.useId)(),c=e||s,[l,u]=(0,R.useState)(!1),d=Ta(o,t),f=typeof o.pending[t]==`string`?o.pending[t]:``,p=ka.test(n)||ka.test(t);return(0,z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(r,{id:c,"aria-label":e?void 0:n,type:p?`text`:`password`,autoComplete:`off`,spellCheck:!1,value:f,disabled:!wa.test(t),placeholder:d===`saved`?`Saved. Type a new value to replace it`:d===`environment`?`Set in the environment. Type a value to save one`:p?`Type it once`:`Paste it once`,onChange:e=>o.set(t,e.target.value||void 0)}),d===`saved`&&(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,onClick:()=>o.set(t,null),"aria-label":`Remove the saved value of ${t}`,"data-tip":`Remove the saved value of ${t}`,children:(0,z.jsx)(yn,{"aria-hidden":`true`})}),d===`removing`&&(0,z.jsxs)(L,{size:`sm`,"data-tip":`Keep the saved value of ${t}`,onClick:()=>o.set(t,void 0),children:[(0,z.jsx)(fn,{"aria-hidden":`true`}),`Keep`]})]}),!a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body-sm text-muted`,children:[(0,z.jsx)(Oa,{name:t}),(0,z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),l&&i?(0,z.jsx)(r,{size:`sm`,"aria-label":`Variable name`,autoFocus:!0,defaultValue:t,spellCheck:!1,onBlur:e=>{let n=e.target.value.trim();n&&wa.test(n)&&n!==t&&i(n),u(!1)},onKeyDown:e=>w(e)&&e.target.blur(),className:`max-w-[260px] font-mono`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[`Kept as `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:t})]}),i&&(0,z.jsxs)(L,{variant:`link`,size:`inline`,onClick:()=>u(!0),"data-tip":`Change the variable's name`,children:[(0,z.jsx)(qe,{"aria-hidden":`true`}),`Rename`]})]})]})]})}function ja({name:e}){return(0,z.jsx)(Oa,{name:e})}function Ma({id:e,name:t,field:n,named:r,onName:i}){let a=Sa();return(0,z.jsx)(Na,{onFirstValue:()=>{!r&&t&&i(t)},secrets:a,children:(0,z.jsx)(Aa,{id:e,name:t,field:n,onRename:i})})}function Na({secrets:e,onFirstValue:t,children:n}){return(0,z.jsx)(xa.Provider,{value:{...e,set:(n,r)=>{r&&t(),e.set(n,r)}},children:n})}function Pa({label:e,help:t,htmlFor:n,children:r,className:i,stacked:a,yamlKey:o}){let s=o?(0,z.jsx)(`code`,{className:`font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:o}):null;return a?(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-4 py-4`,i),children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[n?(0,z.jsx)(`label`,{htmlFor:n,className:`text-body-sm leading-snug font-medium text-ink`,children:e}):(0,z.jsx)(`span`,{className:`text-body-sm leading-snug font-medium text-ink`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm leading-relaxed text-ink-2`,children:t}),s]}),(0,z.jsx)(`div`,{className:`[&>*]:max-w-none`,children:r})]}):(0,z.jsxs)(`div`,{className:h(`flex min-h-16 flex-wrap items-center gap-x-10 gap-y-4 border-t border-line-soft py-4`,i),children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[n?(0,z.jsx)(`label`,{htmlFor:n,className:`text-body-sm leading-snug font-medium text-ink`,children:e}):(0,z.jsx)(`span`,{className:`text-body-sm leading-snug font-medium text-ink`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm leading-relaxed text-ink-2`,children:t}),s]}),r!=null&&r!==!1&&(0,z.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,children:r})]})}var Fa=`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,Ia={"By how you asked":Ut,"Test runs":Qe,"Speech on this computer":xt,Conversation:kt,"What went wrong":it,"What ForgeQE found":At,Questions:Be,"The bug":_n,"What is attached":Ce,Send:pt,"Test case ids":vt,"Where runs happen":Dt,"The browser window":en,"Limits and checks":un,"Remote browser, set here":st,"Where tests go":Le,"How hard it tries":De,"Help it gets":Tt,Reports:Vt,"Memory and replays":ln,Suites:Pt,"Flaky tests":an,"Release readiness":lt,"Regression packs in a pipeline":pn,"Defect analysis":_n,Accessibility:rn,"Performance and visual changes":Te,"API tests":$e,"The product":Ot,"Instructions and knowledge":Ht,Capabilities:Ke,"Project report":ke,"Report datasets":Zt,"Running in parallel":Qt,Driver:tt,Appium:Jt,"Devices on this computer":mt,"TestMu AI devices":st,"BrowserStack devices":st,"Browser devices":nt,"Appium on this computer":Jt,Maestro:Wt,"Windows desktop apps":vn,Runtime:ht,"Tests in a container":at,"The coding agents' workspace":dt,"Browser in a container":Re,"How skills are used":Ve,Budgets:we,"Project folder":je,"ForgeQE in this folder":ot,Repository:Le,"Features to download":pn,Onboarding:lt,"This computer":mt,"A model":Ft,"Models file":wt,"Default model":Ft,"Product knowledge graph":Ae,Repositories:Le,"Documents and links":xe,"Search service":Ht,Documents:xe,"The product and its knowledge":Ot,"Building the graph":Ke,"The team's knowledge":Ne,"Agent names":Mt,"Custom agents":jt,"Sign-ins":Ue,"Recent runs":Oe,"Saved runs":De,"Test data":Zt,"Areas of work":ft,"Which model a call gets":ft,Alerts:St,"When to alert":Kt,Apps:nt,"By kind of run":be,"By run, newest first":Oe,Guides:Ht,"Last 30 days":mn,"Latest problems":it,"Links in alerts":qt,"Model calls":kt,Plans:Xt,"Recent requests":Ge,"Results and bugs":Ee,"What used the most":gn,"Send a test":pt,Services:gt,"Tools used":Ke,"What runs":Qe,"Check the agent's domain knowledge":zt,"Test cases and bugs":ct,"Browser grids":st,Notifications:sn,"Other tools":Et},La=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),Ra=h(`settings-card`,u);function za({children:e,className:t}){return(0,z.jsx)(`div`,{className:h(Ra,t),children:e})}function Ba(e){return R.Children.toArray(e).flatMap(e=>(0,R.isValidElement)(e)&&e.type===R.Fragment?Ba(e.props.children):[e])}function V({children:e}){let t=[],n=[],r=null,i=()=>{r?.items.length&&n.push((0,z.jsx)(za,{children:r.items},r.key)),r=null};return Ba(e).forEach((e,a)=>{(0,R.isValidElement)(e)&&Ha.has(e.type)?(i(),n.push(e)):((0,R.isValidElement)(e)&&e.type===H&&i(),r||(r={key:`card-${a}`,items:[]},t.push(r)),r.items.push(e))}),i(),(0,z.jsx)(z.Fragment,{children:n})}var Va=e=>typeof e==`string`?e.trim().replace(/^\d+\.\s*/,``):``;function H({children:e,help:t,first:n,icon:r}){let i=r??Ia[Va(e)];return(0,z.jsxs)(`div`,{"data-group-title":``,"data-tour":La(Va(e)),className:h(`mb-4 flex flex-col gap-2`,n?`mt-0`:`mt-10`),children:[(0,z.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-body-lg leading-snug font-medium text-ink`,children:[i&&(0,z.jsx)(F,{icon:i,size:18,className:`flex-none text-icon`}),e]}),t&&(0,z.jsx)(`p`,{className:h(`m-0 text-body-sm leading-relaxed text-ink-2`,i&&`pl-8`),children:t})]})}var Ha=new Set([V]),Ua=e=>Array.isArray(e)?e.map(String).join(`, `):typeof e==`string`?e:``,Wa=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Ga({id:e,value:t,onChange:n,placeholder:i,mono:a}){let[o,s]=(0,R.useState)(Ua(t)),[c,l]=(0,R.useState)(t);return JSON.stringify(c)!==JSON.stringify(t)&&(l(t),s(Ua(t))),(0,z.jsx)(r,{id:e,value:o,placeholder:i,className:h(a&&`font-mono text-body-sm`),onChange:e=>{s(e.target.value);let t=Wa(e.target.value);l(t.length?t:void 0),n(t.length?t:void 0)}})}function Ka({def:e,edit:t,base:n,stacked:i}){let s=(0,R.useId)(),c=e.key?[...n,...e.key.split(`.`)]:n,l=Zr(t.value,c),u=e=>t.set($r(t.value,c,e)),d=`w-full`,f=t.file?c.join(`.`):void 0,p;switch(e.type){case`switch`:{let t=l===void 0?!!e.default:l===!0||l===`true`||l===`on`;return(0,z.jsx)(Pa,{label:e.label,help:e.help,yamlKey:f,children:(0,z.jsx)(ri,{checked:t,onChange:u,label:e.label})})}case`select`:p=(0,z.jsxs)(a,{id:s,value:String(l===void 0?e.default??``:l),onChange:e=>u(e.target.value!==`false`&&e.target.value),className:`w-full`,children:[e.default===void 0&&(0,z.jsx)(`option`,{value:``,children:e.emptyLabel||`Not set`}),e.options.map(e=>(0,z.jsx)(`option`,{value:e.value,children:e.label},e.value))]});break;case`number`:p=(0,z.jsx)(r,{id:s,type:`number`,inputMode:`numeric`,value:l==null?``:String(l),placeholder:e.default===void 0?e.placeholder:String(e.default),onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:`w-full`});break;case`list`:p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(Ga,{id:s,value:l,onChange:u,placeholder:e.placeholder})});break;case`kv`:p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(qa,{id:s,value:l,onChange:u,placeholder:e.placeholder})});break;case`textarea`:p=(0,z.jsx)(o,{id:s,rows:3,value:l===void 0?``:String(l),placeholder:e.placeholder,onChange:e=>u(e.target.value),className:d});break;case`var`:{let t=String(l??e.default??e.placeholder??``);return p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(Ma,{id:s,name:t,field:e.key,named:l!==void 0||e.default!==void 0,onName:e=>u(e)})}),(0,z.jsx)(Pa,{label:e.label.replace(/ variable$/,``),help:e.help,htmlFor:s,stacked:i,yamlKey:f,children:p})}default:p=(0,z.jsx)(r,{id:s,type:e.type===`url`?`url`:`text`,value:l===void 0?``:String(l),placeholder:e.placeholder??(e.default===void 0?void 0:String(e.default)),spellCheck:e.type===`text`,onChange:e=>u(e.target.value),className:h(d,e.type===`path`&&`font-mono text-body-sm`)})}return(0,z.jsx)(Pa,{label:e.label,help:e.help,htmlFor:s,stacked:i,yamlKey:f,children:p})}function qa({id:e,value:t,onChange:n,placeholder:r}){let i=e=>Object.entries(e&&typeof e==`object`&&!Array.isArray(e)?e:{}).map(([e,t])=>`${e} = ${typeof t==`object`?JSON.stringify(t):String(t)}`).join(`
|
|
6
|
-
`),[a,s]=(0,R.useState)(i(t)),[c,l]=(0,R.useState)(t);return JSON.stringify(c)!==JSON.stringify(t)&&(l(t),s(i(t))),(0,z.jsx)(o,{id:e,rows:3,value:a,spellCheck:!1,placeholder:r??`NAME = value`,className:`font-mono`,onChange:e=>{s(e.target.value);let t={};for(let n of e.target.value.split(`
|
|
7
|
-
`)){let e=n.indexOf(`=`),r=(e<0?n:n.slice(0,e)).trim();if(!r)continue;let i=e<0?``:n.slice(e+1).trim();t[r]=/^-?\d+(\.\d+)?$/.test(i)?Number(i):i===`true`||i!==`false`&&i}let r=Object.keys(t).length?t:void 0;l(r),n(r)}})}function Ja({defs:e,edit:t,base:n,stacked:r}){let i=Zr(t.value,n),a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};return(0,z.jsx)(z.Fragment,{children:e.filter(e=>!e.when||e.when(a)).map(e=>(0,z.jsx)(Ka,{def:e,edit:t,base:n,stacked:r},e.key))})}function Ya({title:e,meta:t,state:n,open:r,onToggle:i,lead:a,actions:o,children:s,expandable:c}){let l=(0,R.useId)();return(0,z.jsxs)(`div`,{className:`border-t border-line-soft`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 py-4`,children:[a,c===!1?(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:t})]}):(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":l,onClick:i,className:`flex min-w-0 flex-[1_1_260px] cursor-pointer items-center gap-4 border-0 bg-transparent p-0 text-left text-ink`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:t})]}),(0,z.jsx)(Fe,{size:18,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform`,r&&`rotate-180`)})]}),n,o]}),c!==!1&&(0,z.jsx)(Rn,{open:r,id:l,children:(0,z.jsx)(`div`,{className:`mb-4 border-l-2 border-line-soft pb-2 pl-4 sm:pl-6 [&>*:first-child]:border-t-0`,children:s})})]})}function Xa(e){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),a=(0,R.useCallback)(()=>{i(``),e().then(n,e=>i(e.message))},[e]);return(0,R.useEffect)(a,[a]),{data:t,error:r,reload:a}}function Za({error:e,reload:t}){return e?(0,z.jsxs)(`div`,{role:`alert`,className:h(u,`flex flex-col items-start gap-4`),children:[(0,z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:e}),(0,z.jsxs)(L,{size:`sm`,onClick:t,children:[(0,z.jsx)(ze,{"aria-hidden":`true`}),`Retry`]})]}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 py-4 text-body-sm text-muted`,children:`Loading…`})}function U(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Qa(e){return`${U(e.input)} read${e.cached?` (${U(e.cached)} from cache)`:``} · ${U(e.output)} written`}var W=null;function $a(e){W=e}function G(e,t){if(!t)return`—`;let n=W?.to,r=W?.perEur?.[t],i=n?W?.perEur?.[n]:void 0,[a,o]=n&&n!==t&&r&&i?[e/r*i,n]:[e,t];try{let e=Math.abs(a)>=1e4;return new Intl.NumberFormat(void 0,{style:`currency`,currency:o,...e?{notation:`compact`,maximumFractionDigits:1}:{maximumFractionDigits:Math.abs(a)<1?3:2}}).format(a)}catch{return`${a.toFixed(2)} ${o}`}}function eo(e){if(!W?.perEur||!e||W.to===e||!W.perEur[e])return``;let t=G(1,e);return`Shown in ${W.to}, converted from ${e} at the European Central Bank's rate of ${W.date}: ${new Intl.NumberFormat(void 0,{style:`currency`,currency:e}).format(1)} = ${t}.`}var K=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})},to=e=>e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} bytes`;function no({head:e,children:t,label:n,height:r}){let i=R.Children.toArray(t).map(e=>(0,R.isValidElement)(e)&&e.type===q?(0,z.jsx)(R.Fragment,{children:q(e.props)},e.key):e);return(0,z.jsx)(Di,{label:n,...r?{height:r}:{},head:e.map((e,t)=>(0,z.jsx)(`th`,{scope:`col`,className:t>0?fi:di,children:e},e||t)),children:i})}function q({cells:e,sort:t}){return(0,z.jsx)(`tr`,{className:`border-t border-line-soft`,children:e.map((e,n)=>(0,z.jsx)(`td`,{"data-sort":t?.[n],className:h(n>0?gi:hi,`align-top`,n===0&&`min-w-[200px]`),children:e},n))})}var ro={title:`How skills are used`,base:[`skills`],fields:[{key:`enabled`,label:`Use skills`,type:`switch`,default:!0},{key:`external`,label:`Also read Claude and agent skills`,help:`~/.claude/skills, ~/.agents/skills, and the repository's own.`,type:`switch`,default:!1},{key:`dirs`,label:`More skill folders`,help:`Comma separated. They win over the others.`,type:`list`,placeholder:`../shared-skills`},{key:`browser_max_chars`,label:`Skill text per browser run`,help:`Characters.`,type:`number`,default:6e3}]},io={"no match":`not run before`,"not a rerun":`not run before`,"not a recorded goal":`not run before`,"no recorded run matches":`not run before`,"its last run did not pass":`its last run failed`,"marked stale":`its saved steps are out of date`,"more than one recorded start page for this goal":`saved from more than one start page`};function ao(e,t){return e===`tier0`?t===`shadow`?`Test mode: AI ran it, could have replayed`:`Replayed for free`:`AI: ${io[e]||e}`}function oo({edit:e}){let{data:t,error:n,reload:r}=Xa(N.registry),[i,a]=(0,R.useState)(!1),o=String(Zr(e.value,[`registry`,`mode`])??`on`);return(0,z.jsxs)(V,{children:[(0,z.jsx)(Pa,{label:`Replay passed runs for free`,help:o===`shadow`?`In test mode now: ForgeQE only notes what it would have replayed, and the AI runs everything. Turn it on to use replays.`:`If the page changed, the AI takes over.`,yamlKey:e.file?`registry.mode`:void 0,children:(0,z.jsx)(ri,{checked:o===`on`,onChange:t=>e.set($r(e.value,[`registry`,`mode`],t?`on`:`off`)),label:`Replay passed runs for free`})}),t?!t.exists||t.plans.length===0?(0,z.jsx)(P,{children:`Nothing to replay yet. When a run passes, ForgeQE saves its steps, and running it again is free.`}):(0,z.jsxs)(V,{children:[(0,z.jsxs)(ba,{label:`Replays`,className:`mt-4`,children:[(0,z.jsx)(B,{icon:De,label:`Free reruns`,value:String(t.replayed),note:`of ${m(t.total,`run`)}`}),(0,z.jsx)(B,{icon:Ye,label:`Tokens saved`,value:U(t.tokensSaved),note:`${m(t.plans.length,`passed run`)} ready to replay`})]}),(0,z.jsxs)(L,{variant:`link`,size:`inline`,"aria-expanded":i,"aria-controls":`replay-details`,onClick:()=>a(!i),"data-tip":i?`Hide details`:`Show details`,className:`mt-2 self-start`,children:[i?(0,z.jsx)(Lt,{"aria-hidden":`true`}):(0,z.jsx)(Fe,{"aria-hidden":`true`}),i?`Less`:`Details`]}),(0,z.jsxs)(Rn,{open:i,id:`replay-details`,children:[(0,z.jsx)(H,{first:!0,children:`Saved runs`}),(0,z.jsx)(no,{label:`Saved runs`,head:[`Goal`,`Passed`,`Failed`,`Tokens the first time`,`Last used`],children:t.plans.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`line-clamp-2`,children:e.goal}),e.stale&&(0,z.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Out of date: the AI runs it next time`})]}),e.successes,e.failures,e.firstTokens?U(e.firstTokens):`—`,K(e.lastAt)],sort:[void 0,void 0,void 0,e.firstTokens??-1,new Date(e.lastAt).getTime()||0]},e.id))}),(0,z.jsx)(H,{children:`Recent runs`}),t.requests.length===0?(0,z.jsx)(P,{children:`No runs yet.`}):(0,z.jsx)(no,{label:`Recent runs`,head:[`Request`,`How it ran`,`Result`,`Tokens`,`When`],children:t.requests.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsx)(`span`,{className:`line-clamp-2`,children:e.request||e.planGoal||e.id}),ao(e.decision,e.mode),e.outcome||`—`,U(e.tokens),K(e.startedAt)],sort:[void 0,void 0,void 0,e.tokens,new Date(e.startedAt).getTime()||0]},e.id))})]})]}):(0,z.jsx)(Za,{error:n,reload:r})]})}function so(){let{data:e,error:t,reload:n}=Xa(N.logs),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(``);return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Kept in `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.dir}),`. Secrets are replaced with their names before a log is shown.`]}),a&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-body-sm text-fail`,children:a}),e.logs.length===0?(0,z.jsx)(P,{children:`No session logs yet. ForgeQE writes one for each chat, run and suite.`}):e.logs.map(e=>(0,z.jsxs)(`div`,{className:`flex min-h-[60px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-2`,children:[(0,z.jsx)(Yr,{icon:$t}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm break-all`,children:e.name}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.modified),`, `,to(e.size)]})]}),(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open ${e.name}`,"data-tip":`Open ${e.name}`,onClick:()=>{o(``),N.log(e.name).then(i,e=>o(e.message))},children:(0,z.jsx)($t,{"aria-hidden":`true`})})]},e.name)),(0,z.jsx)(An,{wide:!0,open:!!r,onClose:()=>i(null),title:r?.name||``,description:r?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,z.jsxs)(L,{onClick:()=>i(null),children:[(0,z.jsx)(rt,{"aria-hidden":`true`}),`Close`]}),children:r&&(0,z.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap break-all`,children:(0,z.jsx)(_e,{text:r.text})})})]}):(0,z.jsx)(Za,{error:t,reload:n})}var co={error:`Error`,tool:`Tool call failed`,run:`Run failed`,engine:`Browser engine stopped`,agent:`Agent error`,model:`Model call failed`},lo={chat:`Chat`,start:`Shell`,run:`Run`,suite:`Suite`,code:`Write tests`,heal:`Heal`,monitor:`Monitor`,mcp:`MCP`,explore:`Explore`};function uo(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(``);return{show:e=>{r(``),N.log(e).then(t,e=>r(e.message))},error:n,sheet:(0,z.jsx)(An,{wide:!0,open:!!e,onClose:()=>t(null),title:e?.name||``,description:e?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,z.jsxs)(L,{onClick:()=>t(null),children:[(0,z.jsx)(rt,{"aria-hidden":`true`}),`Close`]}),children:e&&(0,z.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-body-sm leading-relaxed break-all whitespace-pre-wrap`,children:(0,z.jsx)(_e,{text:e.text})})})}}function fo({entries:e}){let[t,n]=(0,R.useState)(-1);return e.length?(0,z.jsx)(z.Fragment,{children:e.map((e,r)=>(0,z.jsx)(Ya,{lead:(0,z.jsx)(Yr,{icon:Oe}),title:`${e.action}: ${e.file}`,meta:`${K(e.at)}, ${e.user} on ${e.machine}, ${e.changes.length} change${e.changes.length===1?``:`s`}`,open:t===r,onToggle:()=>n(t===r?-1:r),children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 py-4`,children:e.changes.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-body-sm`,children:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.key}),(0,z.jsx)(`span`,{className:`text-muted`,children:e.before===void 0?(0,z.jsxs)(z.Fragment,{children:[`added `,(0,z.jsx)(`span`,{className:`text-ink`,children:e.after})]}):e.after===void 0?(0,z.jsxs)(z.Fragment,{children:[`removed `,(0,z.jsx)(`span`,{className:`text-ink line-through`,children:e.before})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-ink line-through`,children:e.before}),` → `,(0,z.jsx)(`span`,{className:`text-ink`,children:e.after})]})})]},t))})},r))}):(0,z.jsx)(P,{children:`No changes made in Settings yet.`})}function po(){let{data:e,error:t,reload:n}=Xa(N.audit),[r,i]=(0,R.useState)(`summary`),a=uo();if(!e)return(0,z.jsx)(Za,{error:t,reload:n});let o=e.summary,s=o.totals,c=e=>e?`${e} failed`:`None failed`;return(0,z.jsxs)(V,{children:[(0,z.jsx)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:`The last 30 days, from the session logs on this machine and its usage ledger. Model calls count every project on this machine.`}),(0,z.jsx)(Ji,{label:`Audit`,current:r,onPick:i,tabs:[{id:`summary`,label:`Summary`},{id:`problems`,label:`Problems (${o.problems.length})`},{id:`sessions`,label:`Sessions (${o.sessions.length})`},{id:`changes`,label:`Settings changes (${e.entries.length})`}]}),a.error&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-body-sm text-fail`,children:a.error}),(0,z.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,children:[r===`summary`&&(0,z.jsxs)(V,{children:[(0,z.jsxs)(ba,{label:`Activity summary`,children:[(0,z.jsx)(B,{icon:kt,label:`Sessions`,value:String(s.sessions),note:s.replays?`${s.replays} request${s.replays===1?``:`s`} replayed without the agent`:void 0}),(0,z.jsx)(B,{icon:Ke,label:`Tool calls`,value:String(s.toolCalls),note:c(s.toolErrors)}),(0,z.jsx)(B,{icon:Qe,label:`Runs`,value:String(s.runs),note:c(s.runsFailed)}),(0,z.jsx)(B,{icon:Ft,label:`Model calls`,value:String(s.modelCalls),note:c(s.modelErrors)}),(0,z.jsx)(B,{icon:it,label:`Errors`,value:String(s.errors),note:s.escalations?`${s.escalations} switch${s.escalations===1?``:`es`} to a stronger model`:void 0})]}),o.problems.length>0&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{children:`Latest problems`}),(0,z.jsx)(mo,{problems:o.problems.slice(0,5),onLog:a.show}),o.problems.length>5&&(0,z.jsxs)(L,{variant:`link`,size:`inline`,onClick:()=>i(`problems`),"data-tip":`All ${o.problems.length} problems`,className:`mt-4 self-start`,children:[(0,z.jsx)(Yt,{"aria-hidden":`true`}),`All (`,o.problems.length,`)`]})]}),(0,z.jsx)(H,{children:`Tools used`}),o.tools.length===0?(0,z.jsx)(P,{children:`No tool calls logged in the last 30 days.`}):(0,z.jsx)(no,{label:`Tools used`,head:[`Tool`,`Calls`,`Failed`,`Average time`],children:o.tools.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.name}),e.calls,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,e.calls?`${(e.ms/e.calls/1e3).toFixed(1)} s`:`—`],sort:[void 0,e.calls,e.errors,e.calls?e.ms/e.calls:-1]},e.name))}),(0,z.jsx)(H,{children:`Model calls`}),o.models.length===0?(0,z.jsx)(P,{children:`No model calls in the usage ledger in the last 30 days.`}):(0,z.jsx)(no,{label:`Model calls`,head:[`Model`,`Calls`,`Failed`,`Tokens`],children:o.models.map(e=>(0,z.jsx)(q,{cells:[e.model,e.calls,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,U(e.tokens)],sort:[void 0,e.calls,e.errors,e.tokens]},e.model))})]}),r===`problems`&&(o.problems.length?(0,z.jsx)(mo,{problems:o.problems,onLog:a.show}):(0,z.jsx)(P,{children:`Nothing failed in the last 30 days.`})),r===`sessions`&&(o.sessions.length?(0,z.jsx)(no,{label:`Sessions`,height:`max(320px, calc(var(--screen) - 288px))`,head:[`Session`,`Tool calls`,`Runs`,`Errors`,`Tokens`,``],children:o.sessions.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:lo[e.command]||e.command}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.started),e.model?`, ${e.model}`:``]})]}),e.toolErrors?`${e.tools} (${e.toolErrors} failed)`:e.tools,e.runsFailed?`${e.runs} (${e.runsFailed} failed)`:e.runs,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,U(e.tokens),(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log of the ${lo[e.command]||e.command} session at ${K(e.started)}`,"data-tip":`Open the log of the ${lo[e.command]||e.command} session at ${K(e.started)}`,onClick:()=>a.show(e.log),children:(0,z.jsx)($t,{"aria-hidden":`true`})})],sort:[void 0,e.tools,e.runs,e.errors,e.tokens]},e.log))}):(0,z.jsx)(P,{children:`No sessions logged in the last 30 days.`})),r===`changes`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Every change made in Settings, kept in `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.file}),`. Changes made to the files by hand are not here.`]}),(0,z.jsx)(fo,{entries:e.entries})]})]}),a.sheet]})}function mo({problems:e,onLog:t}){return(0,z.jsx)(z.Fragment,{children:e.map((e,n)=>(0,z.jsxs)(`div`,{className:`flex min-h-[64px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,z.jsx)(Yr,{icon:e.kind===`run`||e.kind===`tool`?bn:it,tone:`fail`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:co[e.kind]}),(0,z.jsx)(`span`,{className:`text-body-sm break-words text-ink-2`,children:e.text}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.at),`, `,lo[e.command]||e.command]})]}),e.log&&(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log for: ${e.text.slice(0,60)}`,"data-tip":`Open the log for: ${e.text.slice(0,60)}`,onClick:()=>t(e.log),children:(0,z.jsx)($t,{"aria-hidden":`true`})})]},n))})}var ho={title:`Budgets`,help:`Money in the model's price currency, or GitHub Copilot premium requests. They only warn, at 80, 90 and 100 percent, and never stop a run. Day and month count every ForgeQE process on this machine.`,base:[`budget`],fields:[{key:`run`,label:`Per browser run`,type:`number`},{key:`day`,label:`Per day`,type:`number`},{key:`month`,label:`Per month`,type:`number`},{key:`currency`,label:`Currency`,type:`text`,placeholder:`USD`},{key:`premium_requests.run`,label:`Premium requests per browser run`,help:`GitHub Copilot: each call uses the model's multiplier, 0 for a model included in your plan.`,type:`number`},{key:`premium_requests.day`,label:`Premium requests per day`,type:`number`},{key:`premium_requests.month`,label:`Premium requests per month`,type:`number`}]},go={suite:`Suites`,monitor:`Monitor rounds`,run:`Browser runs`,explore:`Exploratory`,api:`API tests`,desktop:`Desktop runs`,mobile:`Mobile runs`},_o={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploratory`,api:`API test`,desktop:`Desktop run`,mobile:`Mobile run`,chat:`Chat`,"custom agent":`Custom agent`,talk:`Talk`,"browser test":`Browser run`,"mobile test":`Mobile run`},vo=e=>_o[e]||e.charAt(0).toUpperCase()+e.slice(1);function yo({days:e,currency:t}){let[n,r]=(0,R.useState)(-1),i=e.reduce((e,t)=>e+t.input+t.output,0),a=e.filter(e=>e.runs>0).length,o=e.reduce((e,t)=>t.input+t.output>e.input+e.output?t:e,e[0]),s=n>=0?e[n]:e[e.length-1],c=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:c(s.day)}),`: `,U(s.input+s.output),` tokens, `,s.runs,` run`,s.runs===1?``:`s`,t?`, ${G(s.amount,t)}`:``]}),(0,z.jsx)(I,{series:[{values:e.map(e=>e.input+e.output)}],label:`Tokens a day for the last 30 days: ${U(i)} in all, on ${a} days with runs; the busiest was ${c(o.day)} with ${U(o.input+o.output)}.`,hover:n,onHover:r,className:`h-[160px]`,axis:[c(e[0].day),c(e[e.length-1].day)]})]})}function bo({rows:e,currency:t,label:n}){if(!e.length)return(0,z.jsx)(P,{children:`Nothing yet.`});let r=Math.max(1,e.reduce((e,t)=>e+t.sum.input+t.sum.output,0));return(0,z.jsx)(he,{label:n,rows:e.map(e=>{let n=e.sum.input+e.sum.output;return{key:e.name,label:e.name,value:U(n),sub:t&&e.sum.amount?G(e.sum.amount,t):`tokens`,share:n/r}})})}var xo=e=>{let t=Math.round(e*100)/100;return`${t} premium request${t===1?``:`s`}`};function So({label:e,spent:t,limit:n,currency:r,premium:i}){let a=e=>i?xo(e):G(e,r),o=t/n*100,s=o>=100?`fail`:o>=80?`warn`:`ok`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-body-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),(0,z.jsxs)(`span`,{className:h(`tabular-nums`,s===`fail`?`text-fail`:s===`warn`?`text-warn`:`text-ink-2`),children:[a(t),` of `,a(n),s===`fail`?`, over budget`:s===`warn`?`, ${Math.round(o)} percent used`:``]})]}),(0,z.jsx)(fe,{value:t,limit:n,label:`${e}: ${a(t)} of ${a(n)}`})]})}function Co({edit:e}){let{data:t,error:r,reload:i}=Xa(N.tokenomics),a=(0,z.jsx)(Ja,{defs:ho.fields,edit:e,base:ho.base});if(!t)return(0,z.jsx)(Za,{error:r,reload:i});let o=t,s=o.currency,c=o.totals.input+o.totals.output,l=o.budget,d=l?.currency||o.spent?.currency||s,f=o.project?.days30.calls?o.project:void 0,p=f?f.days30.input+f.days30.output:0;return(0,z.jsxs)(V,{children:[f&&(0,z.jsxs)(V,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Every model call made for this project from `,o.days[0]?.day,` to today: chats, runs and the agents they started, each priced when it was made. These are the figures the workspace panel shows. `,(0,z.jsx)(`a`,{href:n(`cost`),children:`Cost and model usage`}),` breaks them down by agent, job and model, priced at today's prices.`]}),(0,z.jsxs)(ba,{label:`All model calls, last 30 days`,children:[(0,z.jsx)(B,{icon:We,label:`Tokens`,value:U(p),note:Qa(f.days30)}),(0,z.jsx)(B,{icon:we,label:`Cost`,value:f.currency?G(f.days30.amount,f.currency):`—`,note:f.currency?`When each call was made`:`No prices known`}),(0,z.jsx)(B,{icon:Te,label:`Calls`,value:f.days30.calls.toLocaleString(),note:`${U(f.today.input+f.today.output)} tokens today`}),(0,z.jsx)(B,{icon:on,label:`Read from cache`,value:f.days30.input?`${Math.round(f.days30.cached/f.days30.input*100)}%`:`—`,note:`Of the tokens read`})]}),eo(f.currency)&&(0,z.jsx)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:eo(f.currency)}),f.byChannel&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{help:`The same calls, by how the request was made: said aloud through Talk, or typed (and everything else ForgeQE ran).`,children:`By how you asked`}),(0,z.jsx)(bo,{label:`Tokens by how you asked`,currency:f.currency,rows:[{name:`Voice (Talk), ${f.byChannel.voice.calls.toLocaleString()} calls`,sum:{runs:0,...f.byChannel.voice}},{name:`Typed and other, ${f.byChannel.typed.calls.toLocaleString()} calls`,sum:{runs:0,...f.byChannel.typed}}]})]}),!!f.top?.length&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{help:`Every chat, custom agent, test run and writing job of the last 30 days, by the model calls it made.`,children:`What used the most`}),(0,z.jsx)(no,{label:`Work that used the most tokens`,head:[`Work`,`Kind`,`Tokens`,`Cost`,`When`],children:f.top.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`line-clamp-2`,children:[e.title,e.voice?(0,z.jsx)(`span`,{className:`text-muted`,children:` · by voice`}):null]}),vo(e.kind),U(e.tokens),e.amount!==void 0&&f.currency?G(e.amount,f.currency):`—`,e.startedAt?K(e.startedAt):`—`],sort:[void 0,void 0,e.tokens,e.amount??-1,e.startedAt&&new Date(e.startedAt).getTime()||0]},e.id))})]}),(0,z.jsx)(H,{children:`Test runs`})]}),o.totals.runs===0?(0,z.jsx)(P,{children:`No test runs with token counts in the last 30 days. Every run and suite ForgeQE reports on is counted here; chats are not.`}):(0,z.jsxs)(V,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`From `,o.totals.runs,` run`,o.totals.runs===1?``:`s`,` in this project's reports in the last 30 days`,o.from?`, ${o.from} to ${o.to}`:``,`: test runs only, not chats. Models and agents come from the `,o.totals.withCalls,` run`,o.totals.withCalls===1?``:`s`,` that kept their model calls.`]}),(0,z.jsxs)(ba,{label:`Test runs, last 30 days`,children:[(0,z.jsx)(B,{icon:We,label:`Tokens`,value:U(c),note:Qa(o.totals)}),(0,z.jsx)(B,{icon:we,label:`Cost`,value:G(o.totals.amount,s),note:o.totals.unpriced?`${o.totals.unpriced} run${o.totals.unpriced===1?``:`s`} had no price`:s?`At the models' prices`:`No prices known`}),(0,z.jsx)(B,{icon:Te,label:`Per run`,value:U(Math.round(c/o.totals.runs)),note:s?G(o.totals.amount/o.totals.runs,s):void 0}),(0,z.jsx)(B,{icon:on,label:`Read from cache`,value:o.totals.input?`${Math.round(o.totals.cached/o.totals.input*100)}%`:`—`,note:`Of the tokens read`})]}),eo(o.currency)&&f?.currency!==o.currency&&(0,z.jsx)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:eo(o.currency)}),o.otherCurrency>0&&(0,z.jsxs)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:[o.otherCurrency,` run`,o.otherCurrency===1?` was`:`s were`,` priced in another currency and left out of the cost.`]}),(0,z.jsx)(H,{children:`Last 30 days`}),(0,z.jsx)(yo,{days:o.days,currency:s}),(0,z.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-x-10 gap-y-8`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,z.jsx)(`h3`,{className:`m-0 text-body-lg font-medium`,children:`By model`}),(0,z.jsx)(bo,{label:`Tokens by model`,rows:o.byModel.map(e=>({name:e.model,sum:e})),currency:s})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,z.jsx)(`h3`,{className:`m-0 text-body-lg font-medium`,children:`By agent`}),(0,z.jsx)(bo,{label:`Tokens by agent`,rows:o.byAgent.map(e=>({name:e.agent,sum:e})),currency:s})]})]}),(0,z.jsx)(H,{children:`By kind of run`}),(0,z.jsx)(bo,{label:`Tokens by kind of run`,rows:o.byKind.map(e=>({name:`${go[e.kind]||e.kind} (${e.runs})`,sum:e})),currency:s})]}),(0,z.jsx)(H,{help:ho.help,children:ho.title}),l&&o.spent&&(l.day||l.month)?(0,z.jsxs)(`div`,{className:h(u,`mb-4 flex flex-col gap-4`),children:[l.day?(0,z.jsx)(So,{label:`Today`,spent:o.spent.today,limit:l.day,currency:d}):null,l.month?(0,z.jsx)(So,{label:`This month`,spent:o.spent.month,limit:l.month,currency:d}):null]}):null,l?.premium&&o.spent&&(l.premium.day||l.premium.month)?(0,z.jsxs)(`div`,{className:h(u,`mb-4 flex flex-col gap-4`),children:[l.premium.day?(0,z.jsx)(So,{label:`Premium requests today`,spent:o.spent.premiumToday||0,limit:l.premium.day,premium:!0}):null,l.premium.month?(0,z.jsx)(So,{label:`Premium requests this month`,spent:o.spent.premiumMonth||0,limit:l.premium.month,premium:!0}):null]}):null,a]})}var J=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Y=e=>typeof e==`string`?e:e==null?``:String(e),wo=e=>e.replace(/(?:\s*\[(?:They spoke while you were talking; they heard up to: |Running elsewhere in ForgeQE now, as data: )[^\n]*\])+\s*$/,``),To=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,Eo=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function X(e,t=400){return To(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function Do(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function Oo(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${X(e||t,120)}](${t})`:X(e)}var ko=e=>[Do(Y(J(e).id)),X(Y(J(e).title),200)].filter(Boolean).join(` `);function Ao(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function jo(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var Z=(e,t)=>({tone:e,kind:`item`,md:t}),Mo=(e,t)=>({tone:e,kind:`sub`,md:t});function No(e,t=``){let n=t||(e.agent&&e.agent!==`forgeqe`?`**${X(Y(e.agent))}:** `:``);switch(e.kind){case`info`:return Z(`info`,`${n}${X(Y(e.text))}`);case`start`:return Z(`dim`,`${n}→ ${Do(Y(e.tool))}${e.text&&e.text!==e.tool?` ${X(Y(e.text),200)}`:``}`);case`tool`:{let t=J(e.file),r=J(e.shell).exit,i=typeof r==`number`&&r!==0?` (exit code ${r})`:``;return Z(e.ok===!1?`warn`:`dim`,`${n}${e.ok===!1?`⚠`:`✓`} ${X(Y(e.text)||Y(e.tool),240)}${i}${t.path?` (${X(Y(t.action))} ${Do(Y(t.path))})`:``}`)}case`say`:{let t=Ao(Y(e.text));return t?Z(`say`,`${n}*${X(t)}*`):null}case`test`:return Number(e.attempt)>0?Z(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} **Test, attempt ${X(Y(e.attempt))}:** ${X(Y(e.text),240)}`):Z(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} ${X(Y(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(J):[],r=t.find(e=>e.status===`in_progress`);return Z(`info`,`${n}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${r?`; now: ${X(Y(r.text))}`:``}`)}case`review`:return Z(e.approved?`ok`:`warn`,`${n}**Review, attempt ${X(Y(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${X(Y(e.summary),240)}`);case`attempt`:return Z(`warn`,`${n}**Attempt ${X(Y(e.attempt))} of ${X(Y(e.max))}:** ${X(Y(e.why),240)}`);case`answer`:return Z(`dim`,`${n}Attempt ${X(Y(e.attempt))}: ${X(Y(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(Y).join(`, `)}`,240)}`);case`context`:return e.compacted?Z(`info`,`${n}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function Po(e,t=``){switch(e.type){case`log`:return Z(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${X(Y(e.text))}`);case`step`:return Z(`dim`,`${t}**Step ${X(Y(e.step))}** · ${e.source===`memory`?`from memory`:X(Y(e.category))} · ${Oo(Y(e.title)||`untitled`,Y(e.url))}`);case`memory`:return Z(`info`,`${t}↻ ${X(Y(e.text))}`);case`thought`:return Mo(`think`,`*${X(Y(e.text))}*`);case`outcome`:return Mo(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${X(Y(e.text),300)}`);case`done`:{let n=J(e.result);return Z(n.status===`complete`?`ok`:`fail`,`${t}**${X(Y(n.status))}:** ${X(Y(n.summary))}`)}case`code`:return No(e,t);default:return null}}function Fo(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${X(Y(e.goal),200)}${e.url?` · ${Oo(Y(e.url).replace(/^https?:\/\//,``),Y(e.url))}`:``}`};case`run-event`:return Po(J(e.event));case`run-done`:{let t=J(e.result),n=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return Z(n?`ok`:`fail`,`${n?`✓`:`✗`} **Run ${n?`passed`:`failed`}**${Eo(e.ms)}: ${X(Y(e.error)||Y(t.summary))}${e.runDir?` · ${Do(Y(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${X(Y(e.parallel))} at once`};case`suite-event`:{let t=J(e.event);if(t.type===`case-start`)return Z(`info`,`**Case ${Number(t.index)+1} of ${X(Y(t.total))}:** ${ko(t.case)}`);if(t.type===`case-event`)return Po(J(t.event),`${Do(Y(J(t.case).id))} `);if(t.type===`case-done`){let e=J(t.result);return Z(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${ko(e.case)}: **${X(Y(e.status))}**${Eo(e.ms)}${e.summary?`. ${X(Y(e.summary),240)}`:``}`)}return t.type===`code-start`?Z(`info`,`${Do(Y(J(t.case).id))} writing its test`):t.type===`writeback`?Z(`dim`,`Posted the result back: ${X(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(J(e.suite).results)?J(e.suite).results:[]).map(J),n=t.filter(e=>e.status===`passed`).length;return Z(n===t.length?`ok`:`fail`,`**Suite: ${n} of ${t.length} passed**${Eo(J(e.suite).ms)}`)}case`info`:return Z(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,X(Y(e.text)));case`agent`:return No(J(J(e.event)),`**Quill:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${X(Y(e.goal),200)}`};case`code-done`:{let t=Y(J(e.result).status);return e.error?Z(`fail`,`✗ **Test not written**${Eo(e.ms)}: ${X(Y(e.error),240)}`):!t||t===`passed`?Z(`ok`,`✓ **Test written**${Eo(e.ms)}`):t===`stopped`?Z(`warn`,`**Test writing stopped**${Eo(e.ms)}`):Z(`fail`,`✗ **Test not finished**${Eo(e.ms)} (${X(t,40)})`)}case`card`:{let t=J(e.card),n=(Array.isArray(t.body)?t.body:[]).map(Y).filter(Boolean);return Z(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${X(Y(t.title))}**${t.stats?` · ${X(Y(t.stats))}`:``}${n.length?`: ${X(n.join(`; `),300)}`:``}`)}case`report`:return Z(`ok`,`✓ Report saved: ${X(Y(e.title))}`);case`call-start`:return Z(`dim`,`→ ${X(Y(e.text),240)}`);case`call`:return Z(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${X(Y(e.text),240)}`);default:return null}}function Io(e){let t=Y(e.at)||Y(e.t),n=null;switch(e.type){case`user`:n=Z(`you`,`**You:** ${X(wo(Y(e.text)),240)}`);break;case`agent`:n=No(J(e.event));break;case`tool`:n=Fo(J(e.event));break;case`ask`:n=Z(`you`,`**Asked:** ${X(Y(J(e.question).title))}`);break;case`wait`:n=Z(`you`,`**Waiting for you:** ${X(Y(e.prompt))}`);break;case`answered`:n=Z(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:X(Y(e.label))}`);break;case`turn_done`:n=Z(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${X(Y(e.error),300)}`:``}`);break;case`settings`:n=Z(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:n=Z(`you`,`**Model:** ${X(Y(J(e.profile).name),80)}`);break;case`settings_applied`:n=Z(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:n={tone:`dim`,kind:`out`,md:Y(e.text)};break;case`error`:n=Z(`warn`,`⚠ ${X(Y(e.message))}`);break;case`fatal`:n=Z(`fail`,`✗ **ForgeQE cannot go on:** ${X(Y(e.message))}`);break;case`exit`:n=Z(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${X(Y(e.code))})`:``}${e.message?`: ${X(Y(e.message))}`:``}`)}return n?{at:t,...n,plain:n.kind===`out`?n.md:jo(n.md)}:null}var Lo=new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`}),Ro=new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function zo(e){let t=e?Date.parse(e):NaN;if(!Number.isFinite(t))return``;let n=new Date(t);return`${Lo.format(n)} ${Ro.format(n)}`}function Bo(e,t){let n=t?[`## ${X(t,200)}`,``]:[],r=[],i=()=>{if(!r.length)return;let e=Math.max(2,...r.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);n.push(``,`${t}text`,...r,t,``),r=[]};for(let t of e){let e=zo(t.at),a=e?`\`${e}\``:``;t.kind===`out`?r.push(e?`${e} ${t.md}`:t.md):(i(),t.kind===`head`?n.push(``,`#### ${t.md}${a?` ${a}`:``}`,``):t.kind===`sub`?n.push(` - ${t.md}`):n.push(`- ${a?`${a} `:``}${t.md}`))}return i(),n.join(`
|
|
8
|
-
`).replace(/\n{3,}/g,`
|
|
9
|
-
|
|
10
|
-
`).trim()+`
|
|
11
|
-
`}var Vo=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0;function Ho(e){let t=Q(e),n=Vo(t.input),r=Vo(t.output);if(n===void 0||r===void 0)return;let i=Vo(t.cached),a=Vo(t.ms),o=Vo(t.premium);return{input:n,output:r,...i?{cached:i}:{},...a===void 0?{}:{ms:a},...o===void 0?t.copilot===!0?{copilot:!0}:{}:{premium:o}}}var Uo=e=>{let t=Q(e);return typeof t.input==`number`&&typeof t.output==`number`?{input:t.input,output:t.output,cached:typeof t.cached==`number`?t.cached:void 0}:void 0};function Wo(e,t){let n=(e?.cached||0)+(t?.cached||0);return{input:(e?.input||0)+(t?.input||0),output:(e?.output||0)+(t?.output||0),...n?{cached:n}:{}}}var Q=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},$=e=>typeof e==`string`?e:e==null?``:String(e),Go=[[/^(product_(knowledge|docs|code|runs?)|services|database_schema)$/,`Product knowledge`],[/^page_memory$/,`Memory`],[/^playbook$/,`Playbook`],[/^(requirements_file|trace_criteria)$/,`Requirements`],[/^read_confluence$/,`Confluence pages`],[/^read_mapping_file$/,`Mapping file`]],Ko={github:`GitHub`,gitlab:`GitLab`,azure_devops:`Azure DevOps`,atlassian:`Jira`,confluence:`Confluence`,notify:`Notifications`,sentry:`Sentry`,browserstack:`BrowserStack`,testmu:`TestMu`,dataverse:`Dataverse`,aws:`AWS`,azure:`Azure`,gcp:`Google Cloud`,postman:`Postman`},qo=20;function Jo(e,t,n){let r=(e,t)=>{t&&e.length<qo&&!e.includes(t)&&e.push(t)},i=t.toLowerCase();if(i===`skill`){let t=(n||``).trim();/^[\w.:-]{1,64}$/.test(t)&&r(e.skills,t);return}let a=i.replace(/^forgeqe_/,``),o=Go.find(([e])=>e.test(a));if(o)return r(e.knowledge,o[1]);if(Object.hasOwn(Ko,a))return r(e.systems,Ko[a]);let s=os.find(([e])=>e.test(a))?.[1];s&&r(e.systems,s)}function Yo(e,t){let n=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0,r=e.sections??=[];for(let e of Array.isArray(t.sections)?t.sections:[]){let t=$(e).replace(/\s+/g,` `).trim().slice(0,160);t&&r.length<qo&&!r.includes(t)&&r.push(t)}let i=e.text??={sent:0,whole:0};i.sent+=n(t.sent),i.whole+=n(t.whole)}var Xo=[[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`Finding test cases`,`searching`],[/environment|logins/,`Preparing the environment`,`handing`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`Running in the browser`,`browsing`],[/comment_on_pr/,`Commenting on the pull request`,`working`],[/write_back|post_result|post_results|file_bugs|create_bugs/,`Posting the result`,`working`],[/heal_api_contracts/,`Healing the API contracts`,`retrying`],[/run_api_contracts/,`Running the API contracts`,`working`],[/run_api_scenarios/,`Running the API scenarios`,`working`],[/run_api_load/,`Load testing the API`,`working`],[/run_api_security/,`Checking the API's security`,`working`],[/api_find_calls/,`Looking up API calls`,`working`],[/api_delete_set/,`Deleting an API`,`working`],[/api_edit_call/,`Changing a call`,`working`],[/api_rename_folder/,`Renaming a folder`,`working`],[/api_move_calls/,`Moving calls`,`working`],[/api_contracts|api_new_set|api_add_calls|api_import_collection/,`Making API contracts`,`working`],[/write_test|heal/,`Writing the test`,`writing`],[/run_tests/,`Running the tests`,`working`],[/^(bash|shell)$/,`Running a command`,`working`],[/read_confluence|read|grep|glob|list|webfetch/,`Reading`,`reading`],[/edit|write|patch/,`Changing the code`,`writing`],[/task/,`Handing work to another agent`,`handing`]],Zo=/^(test|attempt|info|review)$/,Qo=/run_test_cases|browser_run|run_suite|write_test/,$o=[[/(^|_)skill/,`skill`],[/code_element/,`element`],[/code_outline/,`outline`],[/code_references/,`references`],[/code_impact|(^|_)impact/,`impact`],[/code_find|find_tests/,`find`],[/code_test_file/,`testfile`],[/code_command|code_status|run_tests|bash|shell/,`run`],[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`cases`],[/environment|logins/,`environment`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`browser`],[/comment_on_pr|write_back|post_result|post_results|file_bugs|create_bugs/,`post`],[/grep|glob|search/,`search`],[/webfetch|websearch|fetch/,`web`],[/(^|_)list/,`list`],[/read/,`read`],[/edit|write|patch/,`edit`],[/task/,`task`]];function es(e){let t=e.toLowerCase();return $o.find(([e])=>e.test(t))?.[1]??`work`}function ts(e){let t=/^(.*?\(attempt \d+\/\d+\))\s*:\s*([\s\S]+)$/.exec(e)??/^([^:\n]{1,160}?):\s+([\s\S]{40,})$/.exec(e),n=(t?t[1]:e).replace(/\s*\(attempt \d+\/\d+\)$/,``).replace(/(^|\s)(?:[\w.-]+[\\/])+([\w.-]+)/g,`$1$2`);return{summary:n.length>140?`${n.slice(0,139)}…`:n,detail:t?t[2].trim():``}}var ns=[[/find_test_cases|story_test_cases|check_test_cases/,`forgeqe-find`],[/run_test_cases|browser_run|run_goal|run_direct|suite|explore_run/,`engine`],[/write_test/,`forgeqe-test`],[/heal(?!_api_contracts)/,`forgeqe-heal`],[/review_pr|pr_review/,`forgeqe-pr-review`],[/api_plan/,`forgeqe-api-plan`],[/write_api|api_test/,`forgeqe-api`],[/perf_write/,`forgeqe-perf`],[/explore_plan|plan_charters/,`forgeqe-explore-plan`],[/defect_rca|root_cause/,`forgeqe-defect-rca`],[/insights|forgeqe_bi|defect_intelligence/,`forgeqe-bi`],[/refine/,`forgeqe-refine`]];function rs(e){let t=e.toLowerCase();if(!cs(t))return ns.find(([e])=>e.test(t))?.[1]}var is=[[/write_api_tests/,`forgeqe-api`,`Write the API tests`],[/perf_write/,`forgeqe-perf`,`Write the load test plan`],[/(?<!run_)api_scenarios$/,`forgeqe-api-plan`,`Plan the API scenarios`]];function as(e){let t=e.toLowerCase();if(cs(t))return;let n=is.find(([e])=>e.test(t));return n?{agent:n[1],task:n[2]}:void 0}var os=[[/^(azure_devops|ado|azuredevops)_/,`Azure DevOps`],[/^(jira|atlassian)_/,`Jira`],[/^confluence_/,`Confluence`],[/^github_/,`GitHub`],[/^xray_/,`Xray`],[/^testrail_/,`TestRail`],[/^zephyr_/,`Zephyr Scale`],[/^qtest_/,`qTest`]],ss=/(^|_)(create|update|add|delete|remove|post|comment|link|unlink|upload|set|assign|transition|edit|merge|close|reopen|queue|trigger|run|push|move|copy|import|write|publish|approve|vote|lock|unlock)(_|$)/;function cs(e){let t=e.toLowerCase();if(!t.startsWith(`forgeqe_`))return os.find(([e])=>e.test(t))?.[1]}var ls=e=>{let t=Q(e);return typeof t.diff==`string`&&t.diff?{diff:t.diff,added:Number(t.added)||0,removed:Number(t.removed)||0}:void 0},us=e=>Array.isArray(e)?e.map($).filter(Boolean):[];function ds(e,t,n){let r=$(e.status)||(t?`failed`:``);return{status:r,ok:!t&&/^(passed|pass|written|ok|known_defect)$/i.test(r),...$(e.testFile)?{testFile:$(e.testFile)}:{},...$(e.testName)?{testName:$(e.testName)}:{},...$(e.command)?{command:$(e.command)}:{},...typeof e.attempts==`number`?{attempts:e.attempts}:{},...typeof e.maxAttempts==`number`?{maxAttempts:e.maxAttempts}:{},changed:us(e.changed),reused:us(e.reused),...n?{runDir:n}:{},...t?{error:t}:{},...$(e.notes)?{notes:$(e.notes)}:{}}}function fs(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=Q(n),r=(typeof n==`string`?n:$(e.label)||$(e.request)).replace(/\s+/g,` `).trim(),i=(typeof n==`string`?n:$(e.request)||$(e.label)).trim();r&&i&&!t.some(e=>e.label.toLowerCase()===r.toLowerCase())&&t.push({label:r.length>60?`${r.slice(0,59)}…`:r,request:i})}return t.slice(0,4)}function ps(e){let t=e.toLowerCase(),n=cs(t);if(n)return ss.test(t.replace(/^[a-z]+_/,``))?{label:`Updating ${n}`,orb:`working`}:{label:`Reading ${n}`,orb:`reading`};for(let[e,n,r]of Xo)if(e.test(t))return{label:n,orb:r};let r=t.replace(/^forgeqe_/,``).replace(/[_-]+/g,` `).trim();return{label:r?r[0].toUpperCase()+r.slice(1):`Working`,orb:`working`}}function ms(e,t){return{id:e,user:t,steps:[],parts:[],next:[],asks:[],waits:[],log:[],plan:[],changes:[],tests:[],reports:[],actions:[]}}function hs(e){let t=Q(e);return[$(t.id),$(t.title)].filter(Boolean).join(`: `)}function gs(e,t){if(!t)return;let n=e.trim();if(!n)return t;if(t.trim().toLowerCase()!==n.toLowerCase())return t.slice(0,n.length).toLowerCase()===n.toLowerCase()&&/^[\s:·—-]/.test(t.slice(n.length))?t.slice(n.length).replace(/^[\s:·—-]+/,``)||void 0:t}function _s(e){let t=e.split(`
|
|
12
|
-
`)[0].trim(),n=e.includes(`
|
|
13
|
-
`)?`${t} …`:t;return n.length>80?`${n.slice(0,79)}…`:n}function vs(e,t,n){let r=Q(e),i=typeof r.command==`string`?r.command:``;if(!i)return;let a=typeof r.exit==`number`&&Number.isInteger(r.exit)?r.exit:void 0,o=typeof r.output==`string`?r.output:``;return{arg:_s(i),step:{command:i,...o?{output:o}:{},shell:{...a===void 0?{}:{exit:a},...t?n===`running`?{started:t}:{ended:t}:{}}}}}function ys(e){let t=[],n=(e,r,i)=>{for(let a of e){let e=a.handoff?.agent||a.agent||r;if(a.shell&&a.command){let n=a.status===`running`?i?`running`:`stopped`:a.status===`fail`?`fail`:a.status===`ok`?`ok`:`stopped`;t.push({key:a.key,command:a.command,status:n,...a.shell.exit===void 0?{}:{exit:a.shell.exit},...e?{agent:e}:{},...a.shell.started?{started:a.shell.started}:{},...a.shell.ended?{ended:a.shell.ended}:{}})}a.children&&n(a.children,e,i)}};for(let t of e.turns)n(t.steps,void 0,!t.outcome&&!e.ended);return t}function bs(e){let t={turns:[],notes:[]},n=new Map,r=e=>(typeof e==`string`?n.get(e):void 0)??t.turns.at(-1),i=(e,t)=>{let n=e=>{for(let r of e){if(r.key===t)return r;let e=r.children&&n(r.children);if(e)return e}};return n(e.steps)},a=(e,t,n)=>{let r={lines:[],...t},i=gs(r.label,r.arg);if(i?r.arg=i:delete r.arg,n)n.push(r);else{let t=e.plan.find(e=>e.status===`active`)??e.plan.find(e=>e.status===`pending`)??e.plan.at(-1);t&&(r.phase=t.text),e.steps.push(r)}return r},o=(e,t,n)=>{let r=t.parent?i(e,`c:${$(t.parent)}`):void 0;if(r)return r.children??=[];let o=$(t.agent);if(!o&&Zo.test($(t.kind))){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);return t?s(t):void 0}if(!n||!o||o===`forgeqe`)return;let c=e.steps.findLast(e=>e.status===`running`);return c||=a(e,{key:`ag:${o}:${e.steps.length}`,label:j(o).name,status:`running`,orb:`handing`,agent:o}),c.agent??=o,s(c)},s=e=>{let t=e.children??=[],n=t.at(-1);return n&&n.key.startsWith(`try:`)&&n.status===`running`?n.children??=[]:t},c=(e,t)=>{let n=e?.children?.at(-1);if(!n||!n.key.startsWith(`try:`)||n.status!==`running`)return;let r=[...n.children||[]].reverse().find(e=>e.key.startsWith(`t:`)||!!e.review),i=t??(r?r.review?r.review.approved:r.status===`ok`:void 0);n.status=i===void 0?`info`:i?`ok`:`fail`},l,u=new Map,d=new Map,f=0,p=e=>{let n=t.agents??=[],r=n.find(t=>t.agent===e);return r||n.push(r={agent:e,usage:{input:0,output:0},at:0}),r.at=++f,r},m=(e,n,r,s)=>{let f=$(n.kind),m=$(n.id);if(f===`output`){let t=m?i(e,`c:${m}`):void 0;t?.shell&&t.status===`running`&&typeof n.text==`string`&&n.text&&(t.output=n.text);return}if((f===`start`||f===`tool`)&&Qo.test($(n.tool))&&!cs($(n.tool)))return;let h=o(e,n,r),g=Q(n.delegate),_=$(n.tool)||$(n.text),v=$(g.agent)?{agent:$(g.agent),task:$(g.task)}:!r&&!h?as($(n.tool)):void 0;if(f===`start`){if(v)a(e,{key:`c:${m}`,label:`Hands off to ${M(j(v.agent).name)}`,arg:v.task||void 0,status:`running`,orb:`handing`,agent:v.agent,handoff:v,children:[]},h);else{let{label:t,orb:r}=ps(_),i=h?void 0:rs($(n.tool)),o=vs(n.shell,s,`running`);a(e,{key:`c:${m}`,label:t,arg:o?o.arg:$(n.text)&&$(n.text)!==$(n.tool)?$(n.text):void 0,status:`running`,orb:r,icon:es(_),...i?{agent:i}:{},...o?o.step:{}},h)}}else if(f===`tool`){n.ok!==!1&&$(n.tool)&&Jo(t.uses??={skills:[],knowledge:[],systems:[]},$(n.tool),$(n.skill));let r=m?i(e,`c:${m}`):void 0,o=Q(n.file),c=ls(n.change);if(c&&$(o.path)){let t=e.changes.find(e=>e.path===$(o.path));t?Object.assign(t,{diff:`${t.diff}\n${c.diff}`,added:t.added+c.added,removed:t.removed+c.removed}):e.changes.push({path:$(o.path),...c,...$(n.agent)?{agent:$(n.agent)}:{}})}let l=vs(n.shell,s,`ended`);if(r)r.status=n.ok===!1?`fail`:`ok`,r.handoff&&$(g.result)&&(r.handoff.result=$(g.result)),l&&(r.command=l.step.command,r.shell={...r.shell,...l.step.shell},l.step.output?r.output=l.step.output:delete r.output);else if(v)a(e,{key:`c:${m||e.steps.length}`,label:`Hands off to ${M(j(v.agent).name)}`,arg:v.task||void 0,status:n.ok===!1?`fail`:`ok`,orb:`handing`,agent:v.agent,handoff:{...v,...$(g.result)?{result:$(g.result)}:{}},children:[]},h);else{let{label:t,orb:r}=ps(_),i=h?void 0:rs($(n.tool));a(e,{key:`c:${m||e.steps.length}`,label:t,arg:l?l.arg:$(o.path)||$(n.text)||void 0,status:n.ok===!1?`fail`:`ok`,orb:r,icon:es(_),...i?{agent:i}:{},...c?{change:c}:{},...l?l.step:{}},h)}r&&c&&(r.change=c)}else if(f===`stream`||f===`say`){if(r)return;let t=e.parts.find(e=>e.id===m);t?t.text=f===`say`?$(n.text):t.text+$(n.text):e.parts.push({id:m||`p${e.parts.length}`,text:$(n.text)})}else if(f===`plan`){if(h||n.agent&&n.agent!==`forgeqe`)return;let t=Array.isArray(n.items)?n.items.map(Q):[],r=e=>e===`completed`?`done`:e===`in_progress`?`active`:e===`cancelled`?`skipped`:`pending`;e.plan=t.map(e=>({text:$(e.text),status:r(e.status)})).filter(e=>e.text)}else if(f===`test`){let t=Number(n.attempt)||0;if(t>0){let{summary:r,detail:i}=ts($(n.text));a(e,{key:`t:${t}:${e.steps.length}`,label:`Test, attempt ${t}`,arg:r||void 0,status:n.ok?`ok`:`fail`,orb:`retrying`,icon:`test`,...i?{output:i}:{},...l?{command:l}:{}},h),l=void 0}else if(n.ok&&/\bconnected$/i.test($(n.text)))return;else a(e,{key:`t:${e.steps.length}`,label:$(n.text)||(n.ok?`Checked`:`Check failed`),status:n.ok?`ok`:`fail`,orb:/connect|mcp/i.test($(n.text))?`waiting`:`working`},h)}else if(f===`attempt`){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);if(!t)return;c(t);let r=$(n.fixing)||$(n.why);(t.children??=[]).push({key:`try:${$(n.attempt)}:${t.children.length}`,label:`Attempt ${$(n.attempt)} of ${$(n.max)}`,arg:r?r.length>120?`${r.slice(0,119)}…`:r:void 0,status:`running`,orb:`retrying`,icon:`retry`,lines:r.length>120?[{text:r}]:[],children:[]})}else if(f===`review`){let t=(Array.isArray(n.issues)?n.issues:[]).map(Q).map(e=>({kind:$(e.kind)===`standards`?`standards`:`correctness`,...$(e.file)?{file:$(e.file)}:{},problem:$(e.problem),...$(e.fix)?{fix:$(e.fix)}:{}})).filter(e=>e.problem).slice(0,20),r=n.approved===!0,i=(h??e.steps).length;a(e,{key:`r:${$(n.attempt)}:${i}`,label:r?`Review approved`:`Review asked for changes`,arg:t.length?`${t.length} ${t.length===1?`issue`:`issues`}`:void 0,status:r?`ok`:`fail`,orb:`thinking`,agent:`forgeqe-review`,icon:`review`,review:{approved:r,summary:$(n.summary),issues:t}},h)}else if(f===`context`||f===`usage`){let e=$(n.agent)||`forgeqe`,r=p(e);f===`context`&&typeof n.tokens==`number`&&typeof n.limit==`number`&&(r.context={tokens:n.tokens,limit:n.limit,compactsAt:typeof n.compactsAt==`number`?n.compactsAt:void 0},e===`forgeqe`&&(t.context=r.context));let i=f===`usage`?Uo(n.usage):void 0;if(i){let n=u.get(e);n&&(i.input<n.input||i.output<n.output)&&d.set(e,Wo(d.get(e),n)),u.set(e,i),r.usage=Wo(d.get(e),i),t.usage=(t.agents||[]).reduce((e,t)=>Wo(e,t.usage),void 0)}}else if(f===`info`){let t=(h??e.steps).at(-1),r=/^ForgeQE runs the test:\s*([\s\S]+)$/.exec($(n.text));r?l=r[1].trim():t&&t.lines.push({text:$(n.text)})}},h,g=(e,n,r)=>{let o=$(n.type);if(o===`docs`)return Yo(t.uses??={skills:[],knowledge:[],systems:[]},n);if(o===`ui-action`){let t=ur(n);t&&!e.actions.some(e=>e.id===t.id)&&e.actions.push(t)}else if(o===`run-start`)a(e,{key:`run:${e.steps.length}`,label:`Running in the browser`,arg:$(n.goal),status:`running`,orb:`browsing`,agent:`engine`});else if(o===`run-event`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)),r=Q(n.event);if(!t)return;r.type===`outcome`?t.lines.push({text:`Step ${$(r.step)}: ${$(r.action)||$(r.text)}`,ok:r.ok===!0||r.ok!==!1&&void 0}):r.type===`log`&&(r.level!==`info`||r.progress)&&t.lines.push({text:$(r.text),ok:r.level!==`error`&&void 0})}else if(o===`run-done`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)&&e.status===`running`),r=Q(n.result),i=!n.error&&(r.outcome===`passed`||!r.outcome&&r.status===`complete`);if(t){t.status=i?`ok`:`fail`;let e=$(n.error)||$(r.summary);e&&t.lines.push({text:e,ok:!!i})}$(n.runDir)&&e.reports.push({label:i?`Browser run report`:`Browser run report (failed)`,path:$(n.runDir)})}else if(o===`suite-start`){let t=Array.isArray(n.cases)?n.cases:[];a(e,{key:`suite:${e.steps.length}`,label:`Running ${t.length} test case${t.length===1?``:`s`}`,status:`running`,orb:`working`,agent:`engine`})}else if(o===`suite-event`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Q(n.event);if(t&&r.type===`case-done`){let e=Q(r.result);t.lines.push({text:`${hs(e.case)}: ${$(e.status)}`,ok:e.status===`passed`})}}else if(o===`suite-done`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Array.isArray(Q(n.suite).results)?Q(n.suite).results.map(Q):[];if(t){let e=r.filter(e=>e.status!==`passed`).length;t.status=e?`fail`:`ok`,t.arg=`${r.length-e} of ${r.length} passed`}}else if(o===`card`){let t=Q(n.card);a(e,{key:`card:${e.steps.length}`,label:$(t.title),arg:$(t.stats)||void 0,status:t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,orb:`working`,lines:(Array.isArray(t.body)?t.body:[]).map(e=>({text:$(e)}))})}else if(o===`call-start`&&!n.quiet)a(e,{key:`call:${$(n.id)}`,label:$(n.text),status:`running`,orb:`working`});else if(o===`call`&&!n.quiet){let t=n.id?i(e,`call:${$(n.id)}`):void 0;t?t.status=n.ok===!1?`fail`:`ok`:a(e,{key:`call:${e.steps.length}`,label:$(n.text),status:n.ok===!1?`fail`:`ok`,orb:`working`})}else if(o===`code-start`)h=$(n.runDir)||void 0,a(e,{key:`code:${e.steps.length}`,label:`Hands off to Quill`,arg:$(n.goal),status:`running`,orb:`writing`,agent:`forgeqe-test`,handoff:{agent:`forgeqe-test`,task:$(n.goal)},children:[]});else if(o===`code-done`){let t=e.steps.findLast(e=>e.key.startsWith(`code:`)&&e.status===`running`);c(t),t&&(t.status=n.error?`fail`:`ok`,n.error&&t.lines.push({text:$(n.error),ok:!1}));let r=[],i=(e=[])=>e.forEach(e=>(r.push(e),i(e.children)));i(t?.children);let a=r.filter(e=>e.key.startsWith(`t:`)),o=r.filter(e=>e.review);e.tests.push({...ds(Q(n.result),$(n.error),h),...t?{runs:a.length,failedRuns:a.filter(e=>e.status===`fail`).length,reviews:o.length}:{},...o.length?{review:o.at(-1).review}:{}}),h=void 0}else if(o===`agent`)m(e,Q(n.event),!0,r);else if(o===`info`){let t=e.steps.at(-1);t?t.lines.push({text:$(n.text),ok:n.ok===!0||n.ok!==!1&&void 0}):a(e,{key:`info:${e.steps.length}`,label:$(n.text),status:n.ok===!1?`fail`:`info`,orb:`working`})}else o===`report`&&(a(e,{key:`report:${e.steps.length}`,label:`Report saved`,arg:$(n.title),status:`ok`,orb:`working`}),$(n.html)&&e.reports.push({label:$(n.title)||`Report`,path:$(n.html)}))};for(let r of e){_(r);let e=Io(r);e&&(typeof r.id==`string`&&n.get(r.id)||typeof r.turn==`string`&&n.get(r.turn)||t.turns.at(-1))?.log.push(e)}return t;function _(e){switch(e.type){case`user`:{let r=ms($(e.id),wo($(e.text)));t.turns.push(r),n.set(r.id,r);break}case`ready`:{t.ended=void 0,t.fatal=void 0;let n=Q(e.profile);n.name&&(t.model={name:$(n.name),provider:$(n.provider)}),t.writeTests=e.writeTests!==!1,t.headed=e.headed===!0;break}case`models`:case`model`:{let n=Q(e.profile);n.name&&(t.model={name:$(n.name),provider:$(n.provider)}),e.type===`models`&&Array.isArray(e.models)&&(t.models=e.models.map(e=>({name:$(Q(e).name),provider:$(Q(e).provider)})).filter(e=>e.name));break}case`settings`:typeof e.writeTests==`boolean`&&(t.writeTests=e.writeTests),typeof e.headed==`boolean`&&(t.headed=e.headed);break;case`turn_start`:{let t=r(e.id);t&&(t.started=$(e.t)||$(e.at));break}case`agent`:{let t=r(e.id);t&&m(t,Q(e.event),!1,$(e.t)||void 0);break}case`tool`:{let t=r(e.id);t&&g(t,Q(e.event),$(e.t)||void 0);break}case`ask`:{let t=r(e.turn),n=Q(e.question);t?.asks.push({id:$(e.id),title:$(n.title),detail:$(n.detail)||void 0,lines:Array.isArray(n.lines)?n.lines.map($):[],options:(Array.isArray(n.options)?n.options:[]).map(e=>({id:$(Q(e).id),label:$(Q(e).label)}))});break}case`wait`:r(e.turn)?.waits.push({id:$(e.id),prompt:$(e.prompt)});break;case`answered`:for(let n of t.turns){let t=n.asks.find(t=>t.id===e.ask);t&&(t.answer=$(e.label));let r=n.waits.find(t=>t.id===e.ask);r&&(r.answer=e.ok===!0)}break;case`turn_done`:{let n=r(e.id);if(!n)break;n.outcome=e.outcome,n.reply=$(e.reply),n.next=fs(e.next),n.error=$(e.error)||void 0,n.ended=$(e.t)||$(e.at),n.spent=Ho(e.spent),t.agents?.length||(t.usage=Uo(e.usage)??t.usage);let i=e=>{for(let t of e)t.status===`running`&&(t.status=n.outcome===`done`?`ok`:`info`),t.children&&i(t.children)};if(i(n.steps),n.outcome===`done`)for(let e of n.plan)e.status===`active`&&(e.status=`done`);break}case`error`:e.code!==`busy`&&t.notes.push($(e.message));break;case`fatal`:t.fatal=$(e.message);break;case`exit`:t.ended={code:typeof e.code==`number`?e.code:null,stderr:Array.isArray(e.stderr)?e.stderr.map($):void 0,message:$(e.message)||void 0}}}}function xs(e){let t=e.asks.find(e=>e.answer===void 0),n=e.waits.find(e=>e.answer===void 0);if(t||n)return{text:`Waiting for you…`,orb:`waiting`};let r=e.steps.findLast(e=>e.status===`running`);return r?{text:`${r.label}…`,orb:r.orb}:e.parts.some(e=>e.text.trim())&&e.steps.length?{text:`Writing a reply…`,orb:`writing`}:{text:`Thinking…`,orb:`thinking`}}function Ss(e){if(!e.started||!e.ended)return`Done`;let t=Math.max(1,Math.round((Date.parse(e.ended)-Date.parse(e.started))/1e3)),n=e.outcome===`stopped`?`Stopped after`:`Worked for`;return t<60?`${n} ${t} second${t===1?``:`s`}`:`${n} ${Math.floor(t/60)} min ${t%60} s`}function Cs(e){let t=Math.max(0,Math.round(e));for(let[e,n]of[[1e9,`B`],[1e6,`M`],[1e3,`K`]])if(t>=e*.99995)return`${(t/e).toFixed(1)}${n}`;return String(t)}function ws(e){if(e===0)return`included in your plan`;let t=Number(e.toFixed(2));return`${t} premium request${t===1?``:`s`}`}function Ts(e){if(e<6e4)return`${(Math.max(0,e)/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return t<3600?`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`:`${Math.floor(t/3600)}h ${String(Math.floor(t%3600/60)).padStart(2,`0`)}m`}function Es(e,t){let n=e?Date.parse(e):NaN;if(Number.isNaN(n))return``;let r=Math.max(0,Math.floor((t-n)/1e3)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=String(r%60).padStart(2,`0`);return i?`${i}:${String(a).padStart(2,`0`)}:${o}`:`${a}:${o}`}var Ds={running:`active`,ok:`done`,fail:`failed`,info:`note`};function Os(e,t){let n=e=>e===`active`&&!t?`done`:e;if(!e.plan.length)return e.steps.map(e=>({key:e.key,label:e.label,status:n(Ds[e.status]),steps:[],step:e}));let r=new Set(e.plan.map(e=>e.text)),i=new Map,a=``;for(let t of e.steps)t.phase&&r.has(t.phase)&&(a=t.phase),i.set(a,[...i.get(a)||[],t]);let o=e=>e.some(e=>e.status===`running`),s=[],c=i.get(``)||[];c.length&&s.push({key:`plan:start`,label:`Getting started`,status:n(o(c)?`active`:`done`),steps:c});let l=e.plan.map((e,n)=>{let r=i.get(e.text)||[],a=e.status===`done`?`done`:e.status===`skipped`?`skipped`:e.status===`active`||o(r)?`active`:`pending`;return{key:`plan:${n}`,label:e.text,status:a===`active`&&!t?`pending`:a,steps:r}});return[...s,...ks(l)]}function ks(e){let t=e.findIndex(e=>e.status===`active`);return t<0?e:e.map((e,n)=>e.status===`skipped`||e.status===`failed`||n===t?e:{...e,status:n<t?`done`:`pending`})}function As(e){let t=e.filter(e=>e.status===`running`).reverse(),n=e.filter(e=>e.status!==`running`).reverse();return[...t,...n].slice(0,Math.max(8,t.length))}var js=`forgeqe-sidebar-panels`,Ms={env:gt,chat:kt,usage:We,background:ut,commands:cn,changes:Gt,outputs:Pe};function Ns(e){return null}function Ps(){let[e,t]=(0,R.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(js)||`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`boolean`)):{}}catch{return{}}}),n=(t,n)=>e[t]??n;return[n,(r,i)=>{let a={...e,[r]:!n(r,i)};t(a);try{localStorage.setItem(js,JSON.stringify(a))}catch{}}]}function Fs({children:e}){let[t,n]=Ps(),r=R.Children.toArray(e).filter(e=>(0,R.isValidElement)(e)&&e.type===Ns).map(e=>e.props),a=r.map(e=>t(e.id,e.initial??!0));return(0,z.jsx)(`div`,{className:`flex flex-col`,children:r.map((e,t)=>{let o=a[t],s=t===0||a[t-1],c=t===r.length-1||a[t+1];return(0,z.jsxs)(`section`,{"aria-labelledby":`panel-${e.id}`,className:h(f,`overflow-hidden transition-[margin,border-radius] duration-200 ease-out motion-reduce:transition-none`,o?h(`rounded-lg`,t>0&&`mt-2`,t<r.length-1&&`mb-2`):h(t>0&&!a[t-1]&&`mt-px`,s?`rounded-t-lg`:`rounded-t-sm`,c?`rounded-b-lg`:`rounded-b-sm`)),children:[(0,z.jsx)(`h3`,{id:`panel-${e.id}`,className:`m-0`,children:(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>n(e.id,e.initial??!0),className:h(i,`min-h-11 gap-2 rounded-none px-2 py-1 font-medium`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 flex-none items-center justify-center`,children:(0,z.jsx)(F,{icon:Ms[e.id]??_t,size:16})}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.count!==void 0&&(0,z.jsx)(`span`,{className:`flex-none text-body-sm font-normal text-muted tabular-nums`,children:e.count}),(0,z.jsx)(Fe,{size:14,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform duration-200`,!o&&`-rotate-90`)})]})}),(0,z.jsx)(Rn,{open:o,className:`flex flex-col px-1 pb-2`,children:e.children})]},e.id)})})}function Is({icon:e,label:t,value:n,to:r,title:a}){let o=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(F,{icon:e,size:14,className:`flex-none`}),(0,z.jsx)(`span`,{className:`max-w-[120px] flex-none truncate text-body-sm text-muted`,children:t}),(0,z.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-right text-body-sm leading-snug [overflow-wrap:anywhere] text-ink`,children:n})]}),s=`min-h-7 gap-2 px-2 py-1`;return r?(0,z.jsx)(`a`,{href:r,"data-tip":a,className:h(i,s),children:o}):(0,z.jsx)(`div`,{"data-tip":a,className:h(`flex items-center`,s),children:o})}function Ls({icon:e,label:t,value:n,detail:r,to:a,title:o,onClick:s,open:c,muted:l}){let u=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(F,{icon:e,size:16,className:`mt-1 flex-none text-muted`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`text-body-sm leading-tight text-muted`,children:t}),(0,z.jsx)(`span`,{className:h(`line-clamp-2 text-body-sm leading-snug font-medium [overflow-wrap:anywhere]`,l?`text-muted`:`text-ink`),children:n}),r&&(0,z.jsx)(`span`,{className:`truncate text-body-sm leading-snug text-muted`,children:r})]}),(a||s)&&(0,z.jsx)(Xe,{size:14,"aria-hidden":`true`,className:h(`mt-1 flex-none text-muted opacity-0 transition-[opacity,transform] group-hover:opacity-100 group-focus-visible:opacity-100`,c&&`rotate-90 opacity-100`)})]}),d=`group items-start gap-4 px-2 py-2`;return s?(0,z.jsx)(`button`,{type:`button`,"aria-expanded":c,"data-tip":o,onClick:s,className:h(i,d),children:u}):a?(0,z.jsx)(`a`,{href:a,"data-tip":o,className:h(i,d),children:u}):(0,z.jsx)(`div`,{"data-tip":o,className:h(`flex w-full text-left`,d),children:u})}var Rs=e=>`Tokens used, added up over every model call: ${Qa(e)}. Each call reads the conversation so far again, so this grows past the context window.`,zs=`How much of the model's context window the conversation fills now. It drops when the conversation is compacted.`;function Bs({title:e,n:t,to:n}){let r=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`flex-1`,children:e}),t!==void 0&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:t})]}),i=`flex min-h-7 items-end gap-2 px-2 pb-1 text-label-md text-muted`;return n?(0,z.jsx)(`a`,{href:n,"data-tip":`Open ${e}`,className:h(i,`no-underline hover:text-ink`),children:r}):(0,z.jsx)(`span`,{className:i,children:r})}function Vs({icon:e,text:t,value:n,tip:r}){return(0,z.jsxs)(`li`,{"data-tip":r??t,className:`flex min-h-7 items-center gap-2 px-2`,children:[(0,z.jsx)(`span`,{className:`flex size-4 flex-none items-center justify-center text-muted`,"aria-hidden":`true`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-ink`,children:t}),n!==void 0&&(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-ink tabular-nums`,children:n})]})}function Hs({a:e,working:t}){let n=j(e.agent),r=e.context&&e.context.limit>0?e.context:null,i=r?Math.min(1,r.tokens/r.limit):0,a=r?r.tokens>=(r.compactsAt??r.limit*.8):!1;return(0,z.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1`,children:[(0,z.jsxs)(`span`,{className:`flex min-h-6 items-center gap-2`,"data-tip":Rs(e.usage),children:[(0,z.jsx)(C,{agent:e.agent,px:16,decorative:!0,working:t}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-ink`,children:n.name}),(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-ink tabular-nums`,children:U(e.usage.input+e.usage.output)})]}),r&&(0,z.jsxs)(`span`,{className:`flex items-center gap-2 pl-6`,"data-tip":`${zs} ${U(r.tokens)} of ${U(r.limit)}.`,"aria-label":`Context ${Math.round(i*100)}% full: ${U(r.tokens)} of ${U(r.limit)}`,children:[(0,z.jsx)(me,{share:i,marks:[],fill:a?`bg-warn`:`bg-accent`,className:`h-1 flex-1`}),(0,z.jsxs)(`span`,{className:h(`w-10 flex-none text-right text-label-sm tabular-nums`,a?`text-warn`:`text-muted`),children:[Math.round(i*100),`%`]})]})]})}var Us=[{id:`skills`,label:`Skills`,to:n(`skills`),icon:e=>(0,z.jsx)(qs,{name:e})},{id:`knowledge`,label:`Knowledge`,to:n(`knowledge`,`notes`),icon:()=>(0,z.jsx)(F,{icon:dn,size:14})},{id:`sections`,label:`Document sections`,to:n(`knowledge`,`notes`),icon:()=>(0,z.jsx)(F,{icon:Ht,size:14})},{id:`systems`,label:`Systems`,icon:()=>(0,z.jsx)(F,{icon:gt,size:14})}];function Ws(e,t,n){let r=e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean),i=e=>r.map(t=>Object.hasOwn(e,t)?e[t]:void 0).find(Boolean);return i(t)??i(n)}var Gs=()=>(0,z.jsx)(F,{icon:Ft,size:14}),Ks=(0,R.lazy)(()=>p(()=>import(`./logos-P2LOMyTK.js`).then(e=>e.c).then(e=>({default:({name:t})=>{let n=Ws(t,e.FRAMEWORK_LOGOS,e.LANGUAGE_LOGOS);return n?(0,z.jsx)(n,{width:15,height:15,"aria-hidden":`true`}):(0,z.jsx)(Gs,{})}})),__vite__mapDeps([7,2,3,8,9,5])));function qs({name:e}){return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(Gs,{}),children:(0,z.jsx)(Ks,{name:e})})}function Js({uses:e}){let t=Us.map(t=>({...t,names:e?.[t.id]||[]})).filter(e=>e.names.length);return(0,z.jsx)(z.Fragment,{children:t.map(t=>(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(Bs,{title:t.label,n:t.names.length,...t.to?{to:t.to}:{}}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.names.map(e=>(0,z.jsx)(Vs,{icon:t.icon(e),text:e},e))}),t.id===`sections`&&e?.text&&e.text.whole>e.text.sent&&(0,z.jsxs)(`span`,{"data-tip":`${e.text.sent.toLocaleString()} of ${e.text.whole.toLocaleString()} characters`,className:`px-2 pl-8 text-body-sm text-muted`,children:[Math.round((1-e.text.sent/e.text.whole)*100),`% less text than the whole documents`]})]},t.id))})}function Ys({value:e,max:t,warnAt:n,label:r}){return(0,z.jsx)(fe,{value:e,limit:t,warnAt:n&&t>0?Math.min(1,n/t):.8,label:r,className:`mt-1`})}var Xs=e=>{try{return e?new URL(e).host:``}catch{return``}},Zs=e=>e.split(/[\\/]/).filter(Boolean).pop()||e;function Qs({path:e,icon:t,extra:n}){let[r,a]=(0,R.useState)(``);return(0,z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tip":`Open ${e}`,onClick:async()=>a(await ve(e)),className:h(i,`min-h-8 gap-2 py-0`),children:[(0,z.jsx)(F,{icon:t,size:15,className:`flex-none text-muted`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-sm text-accent-fg`,children:Zs(e)}),n]}),r&&(0,z.jsx)(`span`,{className:`px-4 text-body-sm text-fail`,children:r})]})}function $s(e,t){let n=e?Date.parse(e):NaN,r=t?Date.parse(t):NaN;if(Number.isNaN(n)||Number.isNaN(r))return``;let i=Math.max(0,Math.round((r-n)/1e3));return i<60?`${i}s`:`${Math.floor(i/60)} min`}function ec({c:e}){let t=e.status===`running`?tc(e.started):$s(e.started,e.ended),n=e.status===`running`?`Running`:e.status===`ok`?`Done`:e.status===`stopped`?`Stopped`:e.exit===void 0?`Failed`:`Exit code ${e.exit}`;return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`div`,{tabIndex:0,"data-tip":e.command,"aria-label":`${e.command}. ${n}${t?`, ${t}`:``}`,className:`flex items-start gap-2 px-4 py-2`,children:[e.status===`running`?(0,z.jsx)(nn,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,z.jsx)(F,{icon:e.status===`ok`?Je:bn,size:15,className:h(`mt-1 flex-none`,e.status===`ok`?`text-pass`:e.status===`fail`?`text-fail`:`text-muted`)}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-body-sm text-ink`,children:_s(e.command)}),(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:[e.agent?j(e.agent).name:``,n,t].filter(Boolean).join(` · `)})]})]})})}function tc(e){let t=e?Date.parse(e):NaN;if(Number.isNaN(t))return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<60?`${n}s`:`${Math.floor(n/60)} min`}function nc({chat:e}){let[t,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)([]);(0,R.useEffect)(()=>{let e=!1,t=()=>ie.list().then(t=>!e&&d(t.tasks),()=>{});t();let n=In(t,4e3);return()=>{e=!0,Ln(n)}},[]);let f=location.hash.replace(/^#\/?/,``),p=e?.commands??[],g=As(p),_=u.filter(e=>e.to!==f);(0,R.useEffect)(()=>{let e=!1,t=()=>ce.state().then(t=>{if(!e){if(r(t),!t.ready)return a(null);ae.get().then(t=>!e&&a(t),()=>{})}},()=>{});return t(),window.addEventListener(`hashchange`,t),()=>{e=!0,window.removeEventListener(`hashchange`,t)}},[]),(0,R.useEffect)(()=>{if(!t?.ready)return;let n=!1,r=()=>N.tokenomics().then(e=>!n&&s(e),()=>{});r();let i=In(r,e?.busy?3e4:18e4);return()=>{n=!0,Ln(i)}},[t?.ready,t?.project,e?.busy]);let v=t?t.project.split(/[\\/]/).filter(Boolean).pop()||t.project:``,y=i?.codeRepo||i?.repo,b=o?.days.find(e=>e.day===new Date().toISOString().slice(0,10)),x=i?.environment,S=(e,t)=>`${U(e.input+e.output)} tokens${t&&e.amount?` · ${G(e.amount,t)}`:``}`,C=o?.project?S(o.project.today,o.project.currency):b?S(b,o?.currency):void 0,w=o?o.project?{tokens:o.project.days30.input+o.project.days30.output,cost:o.project.currency&&o.project.days30.amount?G(o.project.days30.amount,o.project.currency):void 0,title:`Every model call made for this project in the last 30 days.`}:{tokens:o.totals.input+o.totals.output,cost:o.currency&&o.totals.amount?G(o.totals.amount,o.currency):void 0,title:`Test runs of this project in the last 30 days.`}:void 0;return(0,z.jsxs)(Fs,{children:[(0,z.jsx)(Ns,{id:`env`,title:`Environment`,initial:!1,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,z.jsx)(Ls,{icon:je,label:`Project`,value:t?.ready?v:`Not set up`,muted:!t?.ready,to:n(`settings`,`setup`),title:t?.project}),i&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ls,{icon:It,label:i.codeRepo?`Tests go to`:`Repository`,value:y?y.name:`Not a git repository`,muted:!y,detail:y?.branch?`Branch ${y.branch}`:y?.commit?`Commit ${y.commit}`:void 0,title:y?`${y.root}${y.commit?` @ ${y.commit}`:``}`:void 0,to:n(`settings`,`tests`)}),(0,z.jsx)(Ls,{icon:gt,label:`Test environment`,value:x?.active?x.active:x?.names.length?`None active`:`None yet`,muted:!x?.active,detail:x?.active&&Xs(x.startUrl)||void 0,title:x?.names.length?`${x.names.length} environment${x.names.length===1?``:`s`}: ${x.names.join(`, `)}${x.apps.length?`. Apps: ${x.apps.join(`, `)}`:``}`:void 0,to:n(`settings`,`environments`)}),(0,z.jsx)(Ls,{icon:wt,label:`Files`,value:`${i.files.filter(e=>e.exists).length} in this project`,onClick:()=>l(!c),open:c}),(0,z.jsx)(Rn,{open:c,children:(0,z.jsx)(`ul`,{className:`m-0 mb-1 ml-10 flex list-none flex-col gap-1 p-0`,children:i.files.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`a`,{href:n(`settings`,`files`),"data-tip":e.path,className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-0 flex-col items-start gap-0 px-2 py-1`,!e.exists&&`opacity-60`),children:[(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.label}),(0,z.jsx)(`span`,{className:`truncate font-mono text-body-sm text-ink`,children:e.path})]})},e.label))})})]})]})}),e&&(0,z.jsx)(Ns,{id:`chat`,title:`This chat`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.agents?.length&&e.usage?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[(0,z.jsx)(Vs,{icon:(0,z.jsx)(F,{icon:We,size:14}),text:`Tokens used`,value:(0,z.jsx)(`span`,{className:`font-medium`,children:U(e.usage.input+e.usage.output)}),tip:Rs(e.usage)}),(0,z.jsxs)(`li`,{"data-tip":Qa(e.usage),className:`truncate px-2 pl-8 text-body-sm text-muted tabular-nums`,children:[U(e.usage.input),` read · `,U(e.usage.output),` written`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(Bs,{title:`Agents`,n:e.agents.length}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.agents.toSorted((e,t)=>t.at-e.at).map((t,n)=>(0,z.jsx)(Hs,{a:t,working:!!e.busy&&n===0},t.agent))})]})]}):(0,z.jsx)(`p`,{className:`m-0 px-2 py-1 text-body-sm text-muted`,children:e.busy?`Counted as soon as the agent's first model call comes back.`:`No model calls in this chat yet.`}),(0,z.jsx)(Js,{uses:e.uses})]})}),t?.ready&&(0,z.jsx)(Ns,{id:`usage`,title:`This project`,children:(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[w&&(0,z.jsxs)(`a`,{href:n(`settings`,`tokenomics`),"data-tip":w.title,className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`my-1 px-2`),children:[(0,z.jsx)(Yr,{icon:_t,size:`lg`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[(0,z.jsx)(`span`,{className:`text-headline-sm text-ink tabular-nums`,children:U(w.tokens)}),` tokens`]}),(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:w.cost?`${w.cost} · last 30 days`:`Last 30 days`})]})]}),(0,z.jsx)(Is,{icon:yt,label:`Today`,value:(0,z.jsx)(`span`,{className:`tabular-nums`,children:C??`Nothing yet`}),title:o?.project?`Every model call made for this project today: chats, runs and the agents they started.`:`Test runs of this project today.`,to:n(`settings`,`tokenomics`)}),o?.spent&&o.budget?.month?(0,z.jsxs)(`div`,{className:`px-2 py-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2 text-body-sm text-muted`,children:[(0,z.jsx)(`span`,{className:`flex-1`,children:`This month, this computer`}),(0,z.jsxs)(`span`,{className:`text-ink tabular-nums`,children:[G(o.spent.month,o.spent.currency),` of `,G(o.budget.month,o.budget.currency||o.spent.currency)]})]}),(0,z.jsx)(Ys,{value:o.spent.month,max:o.budget.month,label:`This month's spend`})]}):null]})}),_.length>0&&(0,z.jsx)(Ns,{id:`background`,title:`Background tasks`,count:_.length,children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:_.map((e,t)=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`a`,{href:n(...e.to.split(`/`).filter(Boolean)),className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start gap-2`),children:[(0,z.jsx)(nn,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-body-sm text-ink`,children:e.label}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e.detail||`Running`,tc(e.startedAt)&&` · ${tc(e.startedAt)}`]})]})]})},`${e.kind}-${t}`))})}),p.length>0&&(0,z.jsxs)(Ns,{id:`commands`,title:`Commands`,count:p.length,children:[(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:g.map(e=>(0,z.jsx)(ec,{c:e},e.key))}),p.length>g.length&&(0,z.jsxs)(`span`,{className:`px-4 pb-1 text-body-sm text-muted`,children:[m(p.length-g.length,`earlier command`),` in the chat`]})]}),e?.changes&&e.changes.length>0&&(0,z.jsxs)(Ns,{id:`changes`,title:`Changes`,count:e.changes.length,children:[(0,z.jsxs)(`span`,{className:`px-4 pb-1 font-mono text-body-sm tabular-nums`,children:[m(e.changes.length,`file`),` · `,(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map(e=>(0,z.jsx)(Qs,{path:e.path,icon:Gt,extra:(0,z.jsxs)(`span`,{className:`flex-none font-mono text-body-sm tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})},e.path))}),e.onCreatePr&&(0,z.jsx)(`div`,{className:`px-2 pt-2 pb-1`,children:(0,z.jsxs)(L,{size:`sm`,variant:`primary`,disabled:e.busy,"data-tip":e.busy?`When ForgeQE has finished`:`Ask ForgeQE to open a pull request with these changes`,onClick:e.onCreatePr,className:`w-full justify-center`,children:[(0,z.jsx)(et,{"aria-hidden":`true`}),`Pull request`]})})]}),e?.outputs&&e.outputs.length>0&&(0,z.jsx)(Ns,{id:`outputs`,title:`Outputs`,count:e.outputs.length,children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.outputs.map(e=>(0,z.jsx)(Qs,{path:e.path,icon:e.kind===`test`?wt:/\.html?$/i.test(e.path)?Vt:e.kind===`report`?Pe:dn,extra:(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-muted`,children:e.label})},e.path))})})]})}var rc=24;function ic(e,t,n){if(!t||!n||e.length<t*n*4)return null;let r=(e,n)=>(n*t+e)*4,i=[r(0,0),r(t-1,0),r(0,n-1),r(t-1,n-1)],a=i.every(t=>e[t+3]>=250),o=a&&i.every(t=>[0,1,2].every(n=>Math.abs(e[t+n]-e[i[0]+n])<=rc));if(a&&!o)return null;let s=[0,1,2].map(t=>e[i[0]+t]),c=t=>a?[0,1,2].every(n=>Math.abs(e[t+n]-s[n])<=rc):e[t+3]<16,l=t,u=n,d=-1,f=-1;for(let e=0;e<n;e++)for(let n=0;n<t;n++)c(r(n,e))||(n<l&&(l=n),n>d&&(d=n),e<u&&(u=e),e>f&&(f=e));if(d<0)return null;let p=Math.round(Math.max(d-l+1,f-u+1)*.02),m={x:Math.max(0,l-p),y:Math.max(0,u-p),w:0,h:0};return m.w=Math.min(t,d+1+p)-m.x,m.h=Math.min(n,f+1+p)-m.y,m.w>=t*.96&&m.h>=n*.96?null:m}function ac(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The logo could not be read.`)),r.src=e})}function oc(e){let t=e.naturalWidth||0,n=e.naturalHeight||0;if(!t||!n)return null;let r=Math.min(1,1024/Math.max(t,n))||1,i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t*r)),i.height=Math.max(1,Math.round(n*r));let a=i.getContext(`2d`,{willReadFrequently:!0});return a?(a.drawImage(e,0,0,i.width,i.height),{canvas:i,ctx:a}):null}async function sc(e){let t=oc(await ac(e));if(!t)return null;let{canvas:n,ctx:r}=t,i=ic(r.getImageData(0,0,n.width,n.height).data,n.width,n.height);if(!i)return null;let a=document.createElement(`canvas`);return a.width=i.w,a.height=i.h,a.getContext(`2d`)?.drawImage(n,i.x,i.y,i.w,i.h,0,0,i.w,i.h),a}var cc=new Map;function lc(e){return cc.has(e)||cc.set(e,sc(e).then(t=>t?t.toDataURL(`image/png`):e).catch(()=>e)),cc.get(e)}var uc=20971520,dc=[1,.75,.5,.35],fc=[[`image/png`,void 0],[`image/webp`,.92],[`image/webp`,.8]];async function pc(e,t){for(let n of dc)for(let[r,i]of fc){let a=await e(n,r,i);if(a&&a.type===r&&a.size<=t)return a}return null}function mc(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??Error(`the file could not be read`)),r.readAsDataURL(e)})}var hc={"image/png":`.png`,"image/webp":`.webp`};async function gc(e,t){let n=t=>new File([t],e.name.replace(/\.[^.]+$/,``)+hc[t.type],{type:t.type});if(e.size>t){if(e.type===`image/svg+xml`)throw Error(`${e.name} is over ${t/1024} KB.`);if(e.size>20971520)throw Error(`${e.name} is over ${uc/1024/1024} MB: save a smaller copy and upload that.`);let r=await ac(await mc(e)).catch(()=>null),i=r&&oc(r);if(!i)throw Error(`${e.name} could not be read: save it again as PNG or JPEG and upload that.`);let{canvas:a,ctx:o}=i,s=ic(o.getImageData(0,0,a.width,a.height).data,a.width,a.height)??{x:0,y:0,w:a.width,h:a.height},c=await pc((e,t,n)=>{let r=document.createElement(`canvas`);r.width=Math.max(1,Math.round(s.w*e)),r.height=Math.max(1,Math.round(s.h*e));let i=r.getContext(`2d`);return i?(i.imageSmoothingQuality=`high`,i.drawImage(a,s.x,s.y,s.w,s.h,0,0,r.width,r.height),new Promise(e=>r.toBlob(e,t,n))):Promise.resolve(null)},t);if(!c)throw Error(`${e.name} could not be made smaller than ${t/1024} KB: save a smaller copy and upload that.`);return n(c)}try{let r=await sc(await mc(e));if(!r)return e;let i=await new Promise(e=>r.toBlob(e,`image/png`));return!i||i.size>t?e:n(i)}catch{return e}}var _c=`/assets/forgeqe-logo-D3CwM2Jl.png`,vc=`/assets/forgeqe-logo-white-CoE-hF2l.png`,yc=`/assets/forgeqe-mark-ZLd4S3hw.png`;function bc(e){let[t,n]=(0,R.useState)({});return(0,R.useEffect)(()=>{if(!e)return;let t=!0;return lc(e).then(r=>t&&n({from:e,to:r})),()=>{t=!1}},[e]),e&&t.from===e?t.to:e}var xc=e=>`#${e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`;function Sc(e){try{let t=document.createElement(`canvas`);t.width=t.height=32;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return null;n.drawImage(e,0,0,32,32);let r=n.getImageData(0,0,32,32).data,i=(e,t)=>[...r.subarray((t*32+e)*4,(t*32+e)*4+4)],a=[i(1,1),i(30,1),i(1,30),i(30,30)];if(a.every(e=>e[3]>=200))return{kind:`background`,colour:xc([0,1,2].map(e=>a.reduce((t,n)=>t+n[e],0)/4))};let o=[0,0,0],s=0;for(let e=0;e<r.length;e+=4)if(r[e+3]>=200){for(let t=0;t<3;t++)o[t]+=r[e+t];s++}return s?{kind:`ink`,colour:xc(o.map(e=>e/s))}:null}catch{return null}}var Cc=`h-auto w-auto min-h-10 max-h-[112px] max-w-full object-contain`,wc=`h-11 w-auto max-w-[168px] object-contain object-left`;function Tc({aspect:e,alone:t,own:n,size:r,circle:i}){let a=e>1.6,o=a||t;if(n&&(!r||r===`auto`))return o?!a&&(e<=1.25||i)?{cls:i?`size-14 rounded-full object-cover`:`size-14 object-contain`,grow:!1,auto:!0}:{cls:Cc,grow:!0,auto:!0}:{cls:i?`size-10 rounded-full object-cover`:`size-10 object-contain`,grow:!1,auto:!0};let s=r===`large`;return i?{cls:`${t?s?`size-16`:`size-11`:s?`size-12`:`size-8`} rounded-full object-cover`,grow:!1,auto:!1}:o?{cls:s?Cc:wc,grow:s,auto:!1}:{cls:s?`size-12 object-contain`:`size-8 object-contain`,grow:!1,auto:!1}}function Ec({theme:e,compact:t=!1,onPlate:n}){let{mode:r}=E(),i=r===`dark`?vc:_c,a=bc(e.logo)||i,[o,s]=(0,R.useState)(e.logo?1:2.1),[c,l]=(0,R.useState)(null),u=o>1.6,d=Tc({aspect:o,alone:!!e.logo&&!e.name,own:!!e.logo,size:t?`standard`:e.logoSize,circle:e.logoFrame===`circle`&&!u}),f=d.auto&&!e.logoFrame&&c?.kind===`background`,p=e.logo&&e.logoFrame!==`tile`&&!f?T(c,_(e,r)):null,m=f&&!!T(c,_(e,r));(0,R.useEffect)(()=>n?.(!!p),[p,n]);let g=e.logo?e.logoFrame===`circle`&&u?`rounded`:e.logoFrame||(d.auto&&c?.kind===`background`?`rounded`:`plain`):`plain`,v=d.cls,y=(0,z.jsx)(`img`,{src:a,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&s(t.naturalWidth/t.naturalHeight),l(Sc(t))},className:h(`block min-w-0`,d.grow?`flex-initial`:`flex-none`,v,g===`rounded`&&`overflow-hidden rounded-sm`,m&&`shadow-[0_0_0_1px_rgb(0_0_0/0.12)]`)});return(0,z.jsxs)(`span`,{className:h(`flex min-w-0 items-center gap-2`,d.grow&&`flex-1`),children:[g===`tile`||p?(0,z.jsx)(`span`,{style:p?{background:p}:void 0,className:h(`flex items-center justify-center rounded-base p-2`,!p&&`bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.06)]`,d.grow?`min-w-0 flex-initial`:`flex-none`),children:y}):y,!u&&e.name&&(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]})}function Dc({theme:e}){let{mode:t}=E(),[n,r]=(0,R.useState)(1),[i,a]=(0,R.useState)(null),o=bc(e.logoMark||e.logo),s=!!o&&(!!e.logoMark||n<=1.6),c=s?T(i,_(e,t)):null;return s?(0,z.jsx)(`span`,{style:c?{background:c}:void 0,className:h(`flex size-9 items-center justify-center rounded-base`,c&&`p-1`),children:(0,z.jsx)(`img`,{src:o,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&r(t.naturalWidth/t.naturalHeight),a(Sc(t))},className:h(`block size-full object-contain`,e.logoFrame===`circle`?`rounded-full`:`rounded-sm`)})}):(0,z.jsxs)(`span`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center`,children:[(0,z.jsx)(`img`,{src:yc,alt:``,className:`block size-9 object-contain`}),o&&!e.logoMark&&(0,z.jsx)(`img`,{src:o,alt:``,className:`hidden`,onLoad:e=>e.currentTarget.naturalHeight&&r(e.currentTarget.naturalWidth/e.currentTarget.naturalHeight)})]})}var Oc=`/assets/capgemini-mark-D6aZFnD3.png`,kc=`m 153.2175,21.2782 c 3.4962,0 6.1962,-2.8462 6.2312,-6.225 -0.245,-1.475 -0.7625,-4.2037 -4.585,-4.2037 -4.19,0 -5.5762,5.8487 -8.985,9.6237 -0.2737,2.1438 -2.305,4.0625 -4.8387,4.385 0.62,0.6488 2.0025,1.0013 3.6525,1.0013 3.0175,0 6.67,-0.9088 8.5837,-2.7988 -2.5537,0.035 -4.1937,-1.6062 -4.355,-3.8762 1.245,1.5087 2.6513,2.0937 4.2963,2.0937`,Ac=`m 126.3725,11.972 c 0,-1.86 -0.1125,-3.1 -1.3288,-3.1 -0.5562,0 -0.825,0.1125 -1.3087,0.2725 0.43,6.28 -0.9913,11.8125 -2.7238,11.8125 -2.2712,0 -1.1387,-13.4625 -5.9475,-13.4625 -4.4387,0 -5.0787,10.7475 -5.5812,10.7475 -0.3425,0 -0.395,-2.8225 -0.3763,-4.9763 0.1863,-1.03 0.2888,-1.9575 0.2888,-2.6612 0,-1 -0.41,-2.7288 -2.6813,-1.865 0.079,7.6862 -1.46,12.3287 -3.1937,12.3287 -2.5388,0 -2.5675,-6.9675 -2.5675,-8.8862 0,-1.875 0.1362,-4.38 -2.6513,-3.4913 -0.415,6.7038 -2.1737,11.7625 -3.2812,11.7625 -1.6513,0 -1.3188,-11.5812 -4.8888,-11.5812 -3.2125,0 -4.2037,10.9712 -4.8725,10.9712 -1.1962,0 0.3763,-12.3487 -4.2625,-12.3487 -2.4312,0 -3.3987,4.1212 -4.3512,8.735 -0.185,0.8937 -0.375,0.9237 -0.41,-0.087 -0.024,-0.8588 -0.029,-1.7238 -0.019,-2.5825 1.1663,-4.6388 -0.2587,-6.3525 -2.4075,-5.1175 0.6938,8.56 -3.2375,12.7437 -6.25,12.7437 -1.0887,0 -1.9487,-0.4637 -2.5875,-1.1962 3.6125,-2.2163 5.2188,-4.76 5.2188,-7.2463 0,-2.69 -1.5475,-4.2425 -4.1163,-4.2425 -3.5837,0 -5.59,3.6913 -5.59,6.8313 0,1.6887 0.3175,3.125 0.835,4.3062 -1.2312,0.5863 -2.3925,1.0938 -3.4725,1.5863 -0.098,-3.2275 -0.4587,-6.615 -0.7362,-9.745 -1.91,-0.5275 -2.4663,0.39 -2.6125,2.0887 -0.3425,3.8775 -1.7775,6.285 -3.0475,6.285 -0.9525,0 -1.5375,-1.1625 -1.6063,-2.3975 -0.3562,-6.2162 4.6875,-7.945 7.3288,-7.0412 0.5475,-1.3725 -0.054,-2.3588 -2.4363,-2.3588 -2.8862,0 -5.0437,1.7538 -6.6262,4.0038 -1.0538,1.5 -2.275,2.5637 -3.8963,3.8487 0.044,-0.3662 0.064,-0.7375 0.064,-1.1037 0,-4.38 -2.3738,-6.3038 -4.6388,-6.3038 -1.875,0 -3.0562,1.1225 -3.74,2.8513 -0.1662,-1.7338 -0.5125,-2.48 -1.5187,-2.48 -0.43,0 -1.03,0.1212 -1.67,0.4337 0.2925,0.9675 0.405,3.1113 0.405,4.5175 0,5.2675 -1.5088,7.6313 -2.9588,7.6313 -1.66,0 -1.9237,-6.25 -2.065,-8.6813 -0.2587,-0.098 -0.5325,-0.1512 -0.8112,-0.1512 -1.5038,0 -1.6988,2.0162 -2.07,3.8712 -0.41,2.0563 -1.5913,4.6388 -3.345,4.6388 -1.0588,0 -1.7238,-1.02 -1.8063,-2.8563 -0.1712,-3.725 2.93,-8.14 7.7788,-6.7675 0.6337,-1.4837 -0.3625,-2.6125 -2.3738,-2.6125 -3.545,0 -6.475,2.6513 -7.7537,5.7913 -1.2988,2.8812 -3.57,7.11 -8.1888,7.11 C 6.26,21.7975 3.76,18.95 3.76,12.9787 c 0,-5.1462 3.2462,-10.035 6.7087,-10.035 2.4213,0 2.9838,2.3838 2.7688,4.62 1.255,1.005 3.31,0.067 3.31,-2.4462 0,-1.7338 -1.4063,-4.6738 -5.9513,-4.6738 C 4.9712,0.4437 0,6.055 0,13.4225 0,20.5612 3.6225,24.78 8.75,24.78 c 3.2375,0 6.2887,-1.845 8.3937,-5.2538 0.5325,2.9838 2.5638,4.2388 4.0863,4.2388 2.4662,0 4.0775,-1.5975 4.9562,-3.755 0.5475,2.1625 1.7038,3.765 3.6288,3.765 1.3525,0 2.4112,-0.6888 3.2075,-1.7875 -0.3175,7.5187 -0.7125,12.3137 3.73,11.3725 -0.6875,-2.1388 -0.9075,-6.0313 -0.9075,-9.5275 0,-9.565 1.5775,-12.7138 3.555,-12.7138 1.435,0 1.8987,1.825 1.8987,3.7738 0,1.045 -0.1025,2.2462 -0.3662,3.325 -2.4313,1.5337 -4.37,2.745 -4.37,4.2825 0,1.2162 0.9037,1.3275 1.685,1.3275 1.865,0 4.1112,-1.83 5.3512,-5.2825 1.0838,-0.6588 2.1725,-1.4113 3.2125,-2.4363 -0.034,0.3513 -0.054,0.7025 -0.054,1.0638 0,3.4275 1.4987,5.5037 3.8962,5.5037 1.88,0 3.2863,-1.3337 4.2825,-3.33 0.064,1.1513 0.1025,2.2113 0.1175,3.1825 -3.8087,1.7638 -8.0225,3.55 -8.0225,8.5213 0,2.5725 1.855,4.5062 4.2725,4.5062 5.3075,0 6.5188,-5.6 6.5675,-12.1087 1.7288,-0.7475 3.0125,-1.3238 4.4975,-2.0613 1.2688,1.5925 2.9975,2.3888 4.58,2.3888 2.9925,0 5.2438,-1.5875 7.05,-4.805 0.3175,2.4462 0.9525,4.805 2.2563,4.805 2.3725,0 2.8562,-12.4125 4.6187,-12.4125 1.3525,0 0.245,13.4275 3.8138,13.4275 3.0562,0 3.6275,-11.8163 5.1175,-11.8163 1.055,0 1.1325,10.8013 4.4625,10.8013 1.6362,0 3.4137,-1.9688 4.3012,-6.09 0.42,2.745 1.8025,6.09 4.5075,6.09 1.5775,0 2.935,-1.5975 3.9838,-3.7163 0.2887,2.1825 0.9037,3.7163 2.1,3.7163 3.11,0 3.0075,-12.3838 5.4687,-12.3838 1.9188,0 1.3288,12.3838 5.8988,12.3838 2.1725,0 3.2025,-1.8513 3.8187,-4.18 0.8388,3.4225 2.2013,4.18 3.315,4.18 0.7075,0 1.245,-0.25 1.9488,-1.085 -3.5363,-1.5325 -3.2375,-7.1138 -3.2375,-10.7175 m -74.8438,21.27 c -1.0987,0 -1.68,-1.045 -1.68,-2.2225 0,-3.1788 2.3338,-4.8625 5.205,-6.3125 -0.1275,6.9425 -1.7437,8.535 -3.525,8.535 m 14.2775,-22.51 c 1.0688,0 1.6788,0.9812 1.5713,2.3925 -0.1213,1.655 -1.3275,3.555 -3.4275,5.0437 -1.0938,-3.115 -0.2775,-7.4362 1.8562,-7.4362 M 99.6722,6.035 c 1.0162,-0.034 1.7287,-0.9075 1.7337,-1.9475 0.01,-1.04 -0.6987,-1.8613 -1.7187,-1.8225 -1.02,0.035 -1.85,0.9087 -1.855,1.9487 -0.01,1.04 0.82,1.855 1.84,1.8213 m 25.3325,0.5275 c 0.9275,-0.034 1.685,-0.8638 1.685,-1.855 0,-0.9913 -0.7425,-1.7675 -1.67,-1.7388 -0.9288,0.034 -1.685,0.8688 -1.69,1.86 -0.01,0.9913 0.7475,1.7675 1.675,1.7338 m 34.4387,8.2425 c -0.079,-3.9263 -1.9437,-7.2363 -4.825,-9.8788 -2.1875,-1.9962 -4.785,-3.515 -7.5087,-4.6575 -0.215,-0.092 -0.44,-0.1812 -0.66,-0.2687 -3.3538,4.0187 -14.965,7.0162 -14.965,15.44 0,3.29 2.08,6.3712 5.1312,7.6075 1.7725,0.6687 3.54,0.7025 5.3125,0.1062 1.5775,-0.5175 2.8713,-1.4937 3.95,-2.68 3.4088,-3.775 4.795,-9.6187 8.98,-9.6187 3.8275,0 4.345,2.7237 4.59,4.1987 0,-0.01 0,-0.1075 -0.01,-0.2487`;function jc({rail:e=!1}){let{mode:t}=E();return e?(0,z.jsx)(`img`,{src:Oc,alt:`Capgemini`,"data-tip":`Capgemini`,"data-tip-side":`left`,className:`mb-1 size-8 flex-none object-contain`}):(0,z.jsxs)(`svg`,{viewBox:`-1.06668594 -1.06668594 161.58207188 37.68956988`,role:`img`,"aria-label":`Capgemini`,className:`ml-2 h-8 w-auto max-w-[180px] flex-none overflow-visible`,shapeRendering:`geometricPrecision`,children:[(0,z.jsx)(`path`,{fill:t===`dark`?`#fff`:`#12ABDB`,fillRule:`evenodd`,d:kc}),(0,z.jsx)(`path`,{fill:t===`dark`?`#fff`:`#0070AD`,fillRule:`evenodd`,d:Ac})]})}function Mc({item:e}){return e.agent?(0,z.jsx)(C,{agent:e.agent,px:18,decorative:!0}):(0,z.jsx)(d,{name:b[e.id]||x[e.id]||`feature`,px:18})}var Nc={id:`settings`,label:`Settings`};function Pc(){let e=(e,t,n,r,i)=>({id:e,label:t,meta:n,href:r,words:i,kind:`page`});return[...kn.filter(e=>e.item.path[0]!==`settings`).map(t=>e(t.item.id,t.item.label,`${t.category.label} · ${t.area.label}`,Dn(t.item),[t.item.words,t.item.about].filter(Boolean).join(` `))),e(Nc.id,Nc.label,`Every setting`,n(Nc.id))]}var Fc=Pc(),Ic=(0,R.lazy)(()=>p(()=>import(`./CommandPalette-BBGtkkz4.js`),__vite__mapDeps([10,2,3,11,8,9,12,4,5,13,0,1,6]))),Lc=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),Rc=()=>Lc()?`⌘K`:`Ctrl K`;function zc({route:e}){let{find:t}=(0,R.useContext)(Uc),n=ga(e);return(0,z.jsxs)(`header`,{className:`hidden h-(--top-bar) flex-none items-center gap-6 bg-canvas px-8 md:flex`,children:[(0,z.jsx)(`nav`,{"aria-label":`Where you are`,className:`flex min-w-0 flex-[1_1_0] items-center gap-2 text-body-sm`,children:n&&(0,z.jsxs)(z.Fragment,{children:[[n.parent,...n.middle?[n.middle]:[]].map(e=>(0,z.jsxs)(R.Fragment,{children:[e.href?(0,z.jsx)(`a`,{href:e.href,className:`flex-none text-muted no-underline hover:text-ink`,children:e.label}):(0,z.jsx)(`span`,{className:`flex-none text-muted`,children:e.label}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`/`})]},e.href??e.label)),n.here.href?(0,z.jsx)(`a`,{href:n.here.href,"aria-current":`page`,className:`min-w-0 truncate font-medium text-ink no-underline hover:text-accent-fg`,children:n.here.label}):(0,z.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate font-medium text-ink`,children:n.here.label})]})}),(0,z.jsxs)(L,{variant:`field`,onClick:t,"aria-keyshortcuts":Lc()?`Meta+K`:`Control+K`,className:`w-full max-w-[560px] flex-[0_1_560px]`,children:[(0,z.jsx)(He,{size:16,strokeWidth:1.8,"aria-hidden":`true`,className:`text-icon`}),(0,z.jsx)(`span`,{className:`flex-1 truncate text-left`,children:`Search pages, agents and settings`}),(0,z.jsx)(Ni,{children:Rc()})]}),(0,z.jsx)(`span`,{className:`flex-[1_1_0]`,"aria-hidden":`true`})]})}function Bc(){let{find:e}=(0,R.useContext)(Uc);return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Search (${Rc()})`,"data-tip":`Search`,onClick:e,className:`size-9 flex-none`,children:(0,z.jsx)(He,{strokeWidth:1.8,"aria-hidden":`true`})})}var Vc=da,Hc=fa,Uc=(0,R.createContext)({hidden:!1,open:()=>{},setChat:()=>{},find:()=>{}});function Wc(e){let{setChat:t}=(0,R.useContext)(Uc),n=JSON.stringify(e);(0,R.useEffect)(()=>(t(e),()=>t(null)),[n,t])}var Gc=`forgeqe-sidebar`,Kc=()=>{try{return localStorage.getItem(Gc)===`closed`}catch{return!1}};function qc({className:e}){let{open:t}=(0,R.useContext)(Uc);return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,onClick:t,className:h(`inline-flex md:hidden`,e),children:(0,z.jsx)(Me,{strokeWidth:1.8,"aria-hidden":`true`})})}function Jc(){return(0,z.jsxs)(`div`,{className:`theme-side sticky top-0 z-20 flex items-center gap-1 px-4 py-2 md:hidden`,children:[(0,z.jsx)(qc,{}),(0,z.jsx)(`span`,{className:`ml-1 flex min-w-0 flex-1`,children:(0,z.jsx)(pl,{compact:!0})}),(0,z.jsx)(Bc,{})]})}function Yc({item:e,current:t}){let r=t===e.id;return(0,z.jsxs)(`a`,{href:n(e.id),"aria-current":r?`page`:void 0,className:h(Vc,Hc(r)),children:[(0,z.jsx)(Mc,{item:e}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label})]})}function Xc({current:e,rail:t=!1}){let r=!e;return t?(0,z.jsx)(`a`,{href:n(),"aria-label":`New chat`,"data-tip":`New chat`,"data-tip-side":`right`,"aria-current":r?`page`:void 0,className:h(al,`mt-2`,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(Bt,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`})}):(0,z.jsxs)(`a`,{href:n(),"aria-current":r?`page`:void 0,className:h(Vc,Hc(r)),children:[(0,z.jsx)(Bt,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`}),`New chat`]})}function Zc(e){let t=On(e);return t&&t.item.path.length?{category:t.category.id,area:xn(t.area)?t.area.id:void 0}:{}}var Qc=`forgeqe-sidebar-unfold`;function $c(e){let t=`c:${e}`;try{let e=tl(localStorage.getItem(el));e.includes(t)||localStorage.setItem(el,JSON.stringify([...e,t]))}catch{}window.dispatchEvent(new CustomEvent(Qc,{detail:t}))}var el=`forgeqe-sidebar-open`;function tl(e){let t=new Set([...En.flatMap(e=>[`c:${e.id}`,...e.areas.map(t=>`a:${e.id}/${t.id}`)])]);try{let n=JSON.parse(e||`[]`);return Array.isArray(n)?[...new Set(n.filter(e=>typeof e==`string`&&t.has(e)))]:[]}catch{return[]}}var nl=()=>{try{return tl(localStorage.getItem(el))}catch{return[]}};function rl(e){let t=Zc(e);return[t.category&&`c:${t.category}`,t.category&&t.area&&`a:${t.category}/${t.area}`].filter(e=>!!e)}function il({current:e,route:t,place:n=t,onClose:r}){let i=t.join(`/`),a=n.join(`/`),[o,s]=(0,R.useState)(()=>new Set([...nl(),...rl(n)]));(0,R.useEffect)(()=>s(e=>rl(n).every(t=>e.has(t))?e:new Set([...e,...rl(n)])),[i,a]),(0,R.useEffect)(()=>{let e=e=>{let t=tl(JSON.stringify([e.detail]))[0];t&&s(e=>e.has(t)?e:new Set([...e,t]))};return window.addEventListener(Qc,e),()=>window.removeEventListener(Qc,e)},[]);let c=e=>t=>s(n=>{let r=new Set(n);t?r.add(e):r.delete(e);try{localStorage.setItem(el,JSON.stringify([...r]))}catch{}return r}),{pins:l,toggle:u}=wn(),f=On(n)?.item.id,p=l.map(e=>kn.find(t=>t.item.id===e)).filter(e=>!!e),m=e=>f===e.id&&!(e.id===`chats`&&t[1]),h=e=>{let t=l.includes(e.id),n=`${t?`Unpin`:`Pin`} ${e.label}`;return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":n,"aria-pressed":t,"data-tip":n,"data-tip-side":`right`,onClick:()=>u(e.id),className:`absolute top-1/2 right-1 z-20 size-6 -translate-y-1/2 text-muted opacity-0 group-hover:opacity-100 hover:text-ink focus-visible:opacity-100`,children:(0,z.jsx)(Ct,{size:13,strokeWidth:1.8,fill:t?`currentColor`:`none`,"aria-hidden":`true`})})},g=e=>(0,z.jsx)(ia,{href:Dn(e),label:e.label,current:m(e),icon:(0,z.jsx)(d,{name:e.icon,px:18}),after:h(e)},e.id),_=e=>(0,z.jsx)(ia,{href:Dn(e),label:e.label,current:f===e.id,icon:(0,z.jsx)(d,{name:e.icon,px:18}),after:h(e)},e.id);return(0,z.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-[248px] min-[1440px]:w-[264px] flex-col px-4 py-4 short:py-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-10 items-center gap-1 pl-2`,children:[(0,z.jsx)(pl,{}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close the sidebar`,"data-tip":`Close the sidebar`,onClick:r,className:`size-8 flex-none`,children:(0,z.jsx)(Ie,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{className:`mt-4 flex flex-col gap-px short:mt-2`,children:(0,z.jsx)(Xc,{current:e})}),(0,z.jsx)(`div`,{className:`-mx-4 mt-2 flex min-h-0 flex-1 flex-col overflow-y-auto px-4 pb-6 [mask-image:linear-gradient(to_bottom,black_calc(100%-28px),transparent)]`,children:(0,z.jsxs)(ua,{routeKey:`${i}|${a}`,className:`gap-4 short:gap-2`,children:[(0,z.jsx)(sa,{label:`Pinned`,children:p.length?p.map(e=>_(e.item)):(0,z.jsx)(`span`,{className:`px-2 text-body-sm text-muted`,children:`Star a page below to pin it here.`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[(0,z.jsx)(`span`,{className:`flex h-7 short:h-6 items-center px-2 text-body-sm font-medium text-muted`,children:`Browse`}),En.map(e=>(0,z.jsx)(la,{label:e.label,icon:(0,z.jsx)(d,{name:e.icon,px:18}),lines:Zi,open:o.has(`c:${e.id}`),onOpenChange:c(`c:${e.id}`),children:e.areas.map(t=>xn(t)?(0,z.jsx)(ca,{label:t.label,badge:!o.has(`a:${e.id}/${t.id}`)&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:Cn(t).length}),open:o.has(`a:${e.id}/${t.id}`),onOpenChange:c(`a:${e.id}/${t.id}`),children:Cn(t).map(g)},t.id):Cn(t).map(g))},e.id))]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-none items-center gap-1 pt-2 short:pt-1`,children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(Yc,{item:Nc,current:e})}),(0,z.jsx)(cl,{}),(0,z.jsx)(ul,{icon:!0})]})]})}var al=h(de({variant:`icon`,size:`icon`}),`size-9 flex-none`);function ol({item:e,current:t}){let r=t===e.id;return(0,z.jsx)(`a`,{href:n(e.id),"aria-current":r?`page`:void 0,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`right`,className:h(al,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(Mc,{item:e})})}function sl({current:e,route:t,onOpen:r}){let{theme:i}=E(),{pins:a}=wn(),o=i.name||`ForgeQE`,s=On(t),c=s?.item.path.length?s.category.id:``,l=(e,t,n,r)=>(0,z.jsx)(`a`,{href:e,"aria-current":r?`page`:void 0,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:h(al,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(d,{name:n,px:18})},e),u=a.map(e=>kn.find(t=>t.item.id===e)).filter(e=>!!e);return(0,z.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-16 flex-col items-center gap-px py-4`,children:[(0,z.jsx)(`a`,{href:n(),"aria-label":`${o}, home`,"data-tip":o,"data-tip-side":`right`,className:`mb-1 flex min-h-10 items-center justify-center no-underline`,children:(0,z.jsx)(Dc,{theme:i})}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,"data-tip-side":`right`,onClick:r,className:`size-9`,children:(0,z.jsx)(Me,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,z.jsx)(Xc,{current:e,rail:!0}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center gap-px overflow-y-auto`,children:[(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Browse`,className:`flex flex-col items-center gap-px`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),En.map(e=>(0,z.jsx)(`button`,{type:`button`,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`right`,"aria-current":c===e.id?`true`:void 0,onClick:()=>{$c(e.id),r()},className:h(al,`cursor-pointer`,c===e.id&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(d,{name:e.icon,px:18})},e.id))]}),u.length>0&&(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Pinned`,className:`flex flex-col items-center gap-px`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),u.map(e=>l(Dn(e.item),e.item.label,e.item.icon,s?.item.id===e.item.id))]})]}),(0,z.jsxs)(`div`,{className:`flex flex-none flex-col items-center gap-px pt-2`,children:[(0,z.jsx)(cl,{rail:!0}),(0,z.jsx)(ul,{icon:!0,rail:!0}),(0,z.jsx)(ol,{item:Nc,current:e})]})]})}function cl({rail:e=!1}){return(0,z.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Help`,"data-tip":`Help`,"data-tip-side":e?`right`:void 0,className:al,children:(0,z.jsx)(d,{name:b.help,px:18})})}var ll=[{id:`system`,label:`System`},{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}];function ul({icon:e=!1,rail:t=!1}){let{choice:n,setChoice:r}=E(),i=ll.findIndex(e=>e.id===n),a=ll[i],o=ll[(i+1)%ll.length],s=`Dark/Light: now ${a.label===`System`?`as the computer is`:a.label.toLowerCase()}. Switch to ${o.label===`System`?`as the computer is`:o.label.toLowerCase()}`;return(0,z.jsxs)(`button`,{type:`button`,"aria-label":s,"data-tip":s,"data-tip-side":t?`right`:void 0,onClick:()=>r(o.id),className:e?al:h(Vc,Hc(!1),`w-full cursor-pointer border-0 bg-transparent text-left`),children:[(0,z.jsx)(d,{name:b.theme,px:18}),!e&&(0,z.jsxs)(`span`,{className:`flex flex-1 items-baseline justify-between gap-2`,children:[`Dark/Light`,(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:a.label===`System`?`Auto`:a.label})]})]})}function dl(e){return[{id:`env`,label:`Environment`},...e?[{id:`chat`,label:`This chat`}]:[],{id:`usage`,label:`This project`},...e?.commands?.length?[{id:`commands`,label:`Commands · ${e.commands.length}`}]:[],...e?.changes?.length?[{id:`changes`,label:`Changes · ${e.changes.length}`}]:[],...e?.outputs?.length?[{id:`outputs`,label:`Outputs · ${e.outputs.length}`}]:[]]}function fl({stats:e,onOpen:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-14 flex-col items-center gap-1 bg-canvas py-4`,children:[(0,z.jsx)(jc,{rail:!0}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,"data-tip-side":`left`,onClick:()=>t(),children:(0,z.jsx)(Rt,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-1 h-px w-6 bg-line`}),dl(e).map(e=>(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`left`,onClick:()=>t(e.id),className:`size-9 flex-none`,children:(0,z.jsx)(Mc,{item:e})},e.id)),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsx)(zr,{rail:!0})]})}function pl({compact:e=!1}){let{theme:t}=E(),r=t.name||`ForgeQE`;return(0,z.jsx)(`a`,{href:n(),"aria-label":`${r}, home`,className:`-ml-2 flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-body-lg font-medium text-ink no-underline hover:text-ink`,children:(0,z.jsx)(Ec,{theme:t,compact:e})})}function ml(){let[e,t]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},[]),e?(0,z.jsx)(`p`,{role:`alert`,className:h(ue.fail,`mx-4 mt-4 mb-0`),children:oe()}):null}function hl({stats:e,onClose:t,focus:n}){let r=(0,R.useRef)(null);return(0,R.useEffect)(()=>{n&&(r.current?.querySelector(`#panel-${n.id}`))?.scrollIntoView({block:`start`,behavior:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[n]),(0,z.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-[264px] flex-col bg-canvas`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-4`,children:[(0,z.jsx)(jc,{}),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close the workspace panel`,"data-tip":`Close the workspace panel`,"data-tip-side":`left`,onClick:t,children:(0,z.jsx)(Ze,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{ref:r,className:`min-h-0 flex-1 overflow-y-auto px-4 pt-1 pb-4`,children:(0,z.jsx)(nc,{chat:e})}),(0,z.jsx)(`div`,{className:`px-4 py-4`,children:(0,z.jsx)(zr,{})})]})}var gl=`forgeqe-workspace-panel`,_l=`forgeqe:workspace-fold`,vl=()=>{try{return localStorage.getItem(gl)!==`closed`}catch{return!0}},yl=220;function bl({open:e,side:t,label:n,wideAt:r,onClose:i,className:a,children:o}){let c=(0,R.useRef)(null),l=s(e,150);(0,R.useEffect)(()=>{let t=c.current;t&&(e&&!t.open?t.showModal():!l&&t.open&&t.close())},[e,l]),(0,R.useEffect)(()=>{if(!e)return;let t=window.matchMedia(r);if(t.matches)return i();let n=()=>t.matches&&i();return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e,r,i]);let u=t===`left`?`aside`:`div`;return(0,z.jsx)(`dialog`,{ref:c,"aria-label":n,onCancel:e=>{e.target===c.current&&(e.preventDefault(),i())},className:h(`drawer fixed inset-0 z-40 m-0 h-auto max-h-none w-auto max-w-none overflow-hidden border-0 bg-transparent p-0 text-ink backdrop:bg-transparent`,!e&&`is-closing`,a),children:l&&(0,z.jsxs)(`div`,{inert:!e||void 0,className:`absolute inset-0`,children:[(0,z.jsx)(`div`,{"aria-hidden":`true`,className:`drawer-dim absolute inset-0 bg-[rgba(15,23,42,0.28)]`,onClick:i}),(0,z.jsx)(u,{className:h(`drawer-box absolute inset-y-0 max-w-[85vw] shadow-menu`,t===`left`?`drawer-left left-0`:`right-0`),children:o})]})})}function xl(e,t,n){let r=(e??``).replace(/\s+/g,` `).trim().slice(0,80);return n||!r?t:`${r} · ${t}`}function Sl(e,t,n){(0,R.useEffect)(()=>{let e=document.querySelector(`[data-screen]`);if(!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`h1`),r=xl(n?.textContent,D(),!!n?.hasAttribute(`data-app-title`));document.title!==r&&(document.title=r)},r=()=>t||=requestAnimationFrame(n);r();let i=new MutationObserver(r);return i.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{i.disconnect(),t&&cancelAnimationFrame(t)}},[e,t,n])}function Cl(e){e.preventDefault();let t=document.querySelector(`[data-screen] main`)??document.querySelector(`[data-screen]`);t&&(t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus())}function wl({current:e,route:t=e?[e]:[],children:n}){let[r,i]=(0,R.useState)(Kc),[a,o]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(vl),[f,p]=(0,R.useState)(!1),m=(0,R.useCallback)(()=>l(!1),[]),g=(0,R.useCallback)(()=>p(!1),[]),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(``),C=t.join(`/`);(0,R.useEffect)(()=>Tn(t),[C]);let{theme:w}=E();Sl(e,C,w.appName);let T=li(t),ee=()=>{l(!1),S(``),b(!0),v(!0)},D=(0,R.useCallback)(e=>{l(!1),S(e),b(!0),v(!0)},[]);(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),S(``),b(!0),v(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let O=s(!r,yl),k=s(u,yl),[A,j]=(0,R.useState)(null),te=()=>window.matchMedia(`(min-width: 1600px)`).matches,M=e=>{d(e);try{localStorage.setItem(gl,e?`open`:`closed`)}catch{}};(0,R.useEffect)(()=>{let e=e=>d(e.detail!==!0&&vl());return window.addEventListener(_l,e),()=>window.removeEventListener(_l,e)},[]),(0,R.useEffect)(()=>{if(!f)return;let e=()=>p(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[f]);let ne=e=>{i(e);try{localStorage.setItem(Gc,e?`closed`:`open`)}catch{}};(0,R.useEffect)(()=>{if(!c)return;let e=()=>l(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[c]);let re=()=>window.matchMedia(`(min-width: 768px)`).matches,{setChoice:ie}=E(),ae=async(e,t,n)=>e===`theme`?(ie(t),`The look is ${t} now.`):e===`talk`?(window.dispatchEvent(new Event(`forgeqe:talk-off`)),`Talk is ending.`):e===`sidebar`?(re()?ne(t===`closed`):l(t===`open`),`The sidebar is ${t}.`):n?(await le.settings(n,{headed:t===`shown`}),`Browser runs in this chat are ${t} now.`):`Browser runs are set per chat: open one first.`,oe=e===`settings`||e===`welcome`,se=e=>{te()?M(!0):p(!0),j(e?{id:e,at:Date.now()}:null)};return(0,z.jsx)(Uc.Provider,{value:{hidden:r,open:()=>re()?ne(!1):l(!0),setChat:o,find:ee},children:(0,z.jsx)(xr,{pages:Fc,find:D,set:ae,children:(0,z.jsx)(Ir,{children:(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) bg-canvas`,children:[(0,z.jsx)(`a`,{href:`#content`,onClick:Cl,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-sm focus:bg-accent focus:px-4 focus:py-2 focus:text-body-sm focus:font-medium focus:text-accent-ink focus:no-underline`,children:`Skip to content`}),(0,z.jsxs)(`aside`,{style:{viewTransitionName:`app-sidebar`},className:h(`side-box sticky top-0 h-(--screen) flex-none overflow-hidden`,r?`w-16`:`w-[248px] min-[1440px]:w-[264px]`,oe?`hidden`:`hidden md:block`),children:[(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 left-0`,r&&`invisible opacity-0`),children:O&&(0,z.jsx)(il,{current:e,route:t,place:T,onClose:()=>ne(!0)})}),(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 left-0`,!r&&`invisible opacity-0`),children:(0,z.jsx)(sl,{current:e,route:T,onOpen:()=>ne(!1)})})]}),(0,z.jsx)(bl,{open:c,side:`left`,label:`Sidebar`,wideAt:`(min-width: 768px)`,onClose:m,className:`md:hidden`,children:(0,z.jsx)(il,{current:e,route:t,place:T,onClose:()=>l(!1)})}),(0,z.jsxs)(`div`,{"data-screen":!0,className:`relative flex min-w-0 flex-1 flex-col`,children:[e!==`welcome`&&(0,z.jsx)(zc,{route:t}),(0,z.jsx)(ml,{}),(0,z.jsx)(`div`,{"data-page-area":!0,className:`flex min-w-0 flex-1 flex-col`,children:n}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,onClick:()=>se(),className:h(`absolute top-2 right-3 z-30 md:hidden`,oe&&`hidden`),children:(0,z.jsx)(Rt,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsxs)(`div`,{style:{viewTransitionName:`app-panel`},className:h(`side-box sticky top-0 h-(--screen) w-14 flex-none overflow-hidden`,u&&`min-[1600px]:w-[264px]`,oe?`hidden`:`hidden md:block`),children:[(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 right-0 hidden min-[1600px]:block`,!u&&`invisible opacity-0`),children:k&&(0,z.jsx)(hl,{stats:a,focus:A,onClose:()=>M(!1)})}),(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 right-0`,u&&`min-[1600px]:invisible min-[1600px]:opacity-0`),children:(0,z.jsx)(fl,{stats:a,onOpen:se})})]}),y&&(0,z.jsx)(R.Suspense,{fallback:null,children:(0,z.jsx)(Ic,{open:_,onClose:()=>v(!1),pages:Fc,query:x})}),(0,z.jsx)(bl,{open:f,side:`right`,label:`Workspace panel`,wideAt:`(min-width: 1600px)`,onClose:g,className:`min-[1600px]:hidden`,children:(0,z.jsx)(hl,{stats:a,focus:A,onClose:()=>p(!1)})}),(0,z.jsx)(Br,{})]})})})})}var Tl=`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,El=`box-border flex flex-col [--frame-left:max(0px,calc((100cqw_-_1320px)/2))] ml-(--frame-left) mr-auto w-[calc(100%_-_var(--frame-left))] max-w-[1320px] px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,Dl=`[--page-w:100cqw]`,Ol=`@container [--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_48px))] md:[--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_96px))] w-(--wide-w) max-w-none self-start ml-[calc((100%_-_var(--wide-w))/2)]`;export{Aa as $,Za as A,ti as At,U as B,Ar as Bt,Ss as C,mi as Ct,Ao as D,oi as Dt,zo as E,ii as Et,Co as F,$r as Ft,Ja as G,Ln as Gt,Fa as H,Sr as Ht,eo as I,Yr as It,Ha as J,H as K,In as Kt,G as L,Lr as Lt,oo as M,Xr as Mt,ro as N,ei as Nt,po as O,si as Ot,no as P,ni as Pt,ja as Q,Qa as R,Rr as Rt,Ts as S,pi as St,Bo as T,ai as Tt,Ya as U,yr as Ut,Xa as V,Nr as Vt,Ka as W,Rn as Wt,Ra as X,Pa as Y,za as Z,Os as _,ji as _t,_l as a,B as at,Es as b,di as bt,wl as c,fa as ct,Ec as d,Xi as dt,Oa as et,Dc as f,Ji as ft,bs as g,Oi as gt,xs as h,Di as ht,Dl as i,Sa as it,so as j,Zr as jt,q as k,ri as kt,Rc as l,Yi as lt,gc as m,Mi as mt,El as n,Da as nt,qc as o,ba as ot,uc as p,Ni as pt,V as q,An as qt,Ol as r,Ca as rt,Jc as s,da as st,Tl as t,xa as tt,Wc as u,qi as ut,ys as v,hi as vt,Io as w,Ai as wt,Cs as x,fi as xt,ws as y,gi as yt,$a as z,jr as zt};
|