@humwick/server 0.130.3 → 0.130.4
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/docs/openapi.json +103 -1
- package/package.json +6 -6
- package/public/assets/{MessageBubble-Bq9kr21N.js → MessageBubble-BOkmEvgZ.js} +2 -2
- package/public/assets/{PlanGraphPanel-Dqiroy06.js → PlanGraphPanel-BkaDJp0r.js} +2 -2
- package/public/assets/{TraceView-DYU962-H.js → TraceView-B99Uu2yT.js} +2 -2
- package/public/assets/{VaultDecisionCard-DhPfzioE.js → VaultDecisionCard-DUIfTTFF.js} +2 -2
- package/public/assets/{activity-DzCcQTee.js → activity-ZIX0N1El.js} +2 -2
- package/public/assets/{agent-lineage-SgDt9i3T.js → agent-lineage-kq9TPYFw.js} +2 -2
- package/public/assets/agent-liveness-DSQY1Aa_.js +2 -0
- package/public/assets/{agent-name-CcY3Aijy.js → agent-name-C_7F4DFR.js} +2 -2
- package/public/assets/{agent-profiles-cxtRBn6O.js → agent-profiles-BNOcrGcY.js} +2 -2
- package/public/assets/{agent-project-badge-DGYbIhaI.js → agent-project-badge-B6yAh70a.js} +2 -2
- package/public/assets/{agent-tools-DHbftV0N.js → agent-tools-CcrhmOzF.js} +2 -2
- package/public/assets/{agent-type-icon-CY113sp-.js → agent-type-icon-CXSLrKiq.js} +2 -2
- package/public/assets/{agents-BPzY7IlQ.js → agents-DIZG97_X.js} +2 -2
- package/public/assets/{analytics-DENFPv_a.js → analytics-rasmoPjR.js} +2 -2
- package/public/assets/{artifact-viewer-KRvSc7sl.js → artifact-viewer-tBpTrEPb.js} +2 -2
- package/public/assets/{artifacts-C9gSmL3s.js → artifacts-BNkrynP1.js} +2 -2
- package/public/assets/{artifacts-DT-HkI5O.js → artifacts-Bjq-ZyBA.js} +2 -2
- package/public/assets/{automation-BsmjQhKD.js → automation-Cx422L3L.js} +2 -2
- package/public/assets/{backlog-8NYH_62t.js → backlog-RuFQ8PUu.js} +2 -2
- package/public/assets/{busy-health-D3hwvYb4.js → busy-health-BvNQ9g5x.js} +2 -2
- package/public/assets/{channels-DCJ5WL7O.js → channels-DNbKAS0I.js} +2 -2
- package/public/assets/{chat-DAIl357U.js → chat-Bp3Fx73h.js} +2 -2
- package/public/assets/{code-preview-CzrZfr9U.js → code-preview-KIRZA6cz.js} +2 -2
- package/public/assets/{connectors-xTxtlyou.js → connectors-k7vO4vvc.js} +2 -2
- package/public/assets/{cosmos-BpebFLK2.js → cosmos-BuVoq1aw.js} +2 -2
- package/public/assets/{crate-agent-BHvI5wXC.js → crate-agent-irqlt4NH.js} +2 -2
- package/public/assets/{dependency-graph-DGT0o3wJ.js → dependency-graph-D_rurNBz.js} +2 -2
- package/public/assets/{deploys-hqWOHSHE.js → deploys-yzZqIpxE.js} +2 -2
- package/public/assets/{display-CDeH4I8T.js → display-BemJG1f_.js} +2 -2
- package/public/assets/{files-BTeGVmTg.js → files-DXWcrxOz.js} +2 -2
- package/public/assets/{fleet-DgXtNgCa.js → fleet-TEuOCZXE.js} +2 -2
- package/public/assets/{fleet-metrics-BHEt5yc_.js → fleet-metrics-BGoDAFI-.js} +2 -2
- package/public/assets/{formatted-body-impl-CAe664Z8.js → formatted-body-impl-BB9eq9nN.js} +2 -2
- package/public/assets/{formatted-body-MLtodyPp.js → formatted-body-qy2nTD_1.js} +3 -3
- package/public/assets/{host-providers-dialog-mapF4Fj9.js → host-providers-dialog-BGPHxuwT.js} +2 -2
- package/public/assets/{index-CqqgOI5R.js → index-BC5XZc0z.js} +5 -5
- package/public/assets/{index-MYAIwYTX.css → index-D8Rp9pz2.css} +1 -1
- package/public/assets/{insights-DNyf7IzF.js → insights-C-KQG0h-.js} +2 -2
- package/public/assets/{integrations-DlYOHq7T.js → integrations-ClPRPyKU.js} +2 -2
- package/public/assets/{issue-ref-chip-CeWBNWn7.js → issue-ref-chip-DbH8J9Ak.js} +2 -2
- package/public/assets/{log-viewer-Cib8nqdE.js → log-viewer-PH4zVn24.js} +2 -2
- package/public/assets/{maintenance-DSn1cPm7.js → maintenance-5lV43uTL.js} +2 -2
- package/public/assets/{managed-agents-C3CkM81m.js → managed-agents-BdgU35aX.js} +2 -2
- package/public/assets/{markdown-preview-W4VQQPAv.js → markdown-preview-DNT4OUwQ.js} +3 -3
- package/public/assets/{markdown-preview-impl-CMsTdhjq.js → markdown-preview-impl-CnCcPy0A.js} +2 -2
- package/public/assets/{memory-BV17qtO4.js → memory--GgWH1gH.js} +2 -2
- package/public/assets/{messages-Bm_1AqSA.js → messages-CzFl_97O.js} +2 -2
- package/public/assets/{orchestrators-Dg-vfP09.js → orchestrators-CVvJVkzv.js} +2 -2
- package/public/assets/overview-DsrZvE86.js +2 -0
- package/public/assets/{pairs-8o9nuG3V.js → pairs-D2d0d2py.js} +2 -2
- package/public/assets/{profile-icon-BsRyBMea.js → profile-icon-_SMuSbYF.js} +2 -2
- package/public/assets/{project-profile-instructions-DETKFn_E.js → project-profile-instructions-Apn15y43.js} +2 -2
- package/public/assets/{projects-M_m6AHws.js → projects-D3B6kto5.js} +2 -2
- package/public/assets/{prompt-settings-C_mNCgeL.js → prompt-settings-DnPB6Ez6.js} +2 -2
- package/public/assets/provider-display-bWwiuedV.js +2 -0
- package/public/assets/{registry-DDHHHE5N.js → registry-D790cIhN.js} +2 -2
- package/public/assets/{run-card-Dt4I4jaP.js → run-card-BCro-Odj.js} +2 -2
- package/public/assets/{secrets-BkVwxI5O.js → secrets-CVXvfvbU.js} +2 -2
- package/public/assets/{service-access-settings-Crq-6a-B.js → service-access-settings-D3Xxqb9w.js} +2 -2
- package/public/assets/{settings-CYcavMFu.js → settings-CoUC7Jci.js} +2 -2
- package/public/assets/{shipping-H6gzEeZB.js → shipping-D_Lp9n_J.js} +2 -2
- package/public/assets/{stats-BJVeWkpV.js → stats-CXiNjB9S.js} +2 -2
- package/public/assets/{status-dot-BcHyw1Vw.js → status-dot-C703YIy1.js} +2 -2
- package/public/assets/store-BgDALGIX.js +9 -0
- package/public/assets/{tasks-qJjlQPpx.js → tasks-DO0WpJCx.js} +2 -2
- package/public/assets/{teams-Cd5Sk1uX.js → teams-FGkdi_tL.js} +2 -2
- package/public/assets/{terminal-viewer-CpY5_m7W.js → terminal-viewer-Dh8dSC7e.js} +3 -3
- package/public/assets/{terminal-viewer-impl-DI_2llFR.js → terminal-viewer-impl-B5Zriip3.js} +2 -2
- package/public/assets/{use-agent-terminal-0yJA_buM.js → use-agent-terminal-CRUVDvLC.js} +2 -2
- package/public/assets/{use-decisions-uJXHf34W.js → use-decisions-CoaqRh4l.js} +2 -2
- package/public/assets/{use-project-list-CpWl6eHQ.js → use-project-list-X-BgT53X.js} +2 -2
- package/public/assets/{use-selectors-BdxBW8mL.js → use-selectors-0X_UZkk-.js} +2 -2
- package/public/assets/{user-avatar-3IndfpOc.js → user-avatar-CkLhVBGu.js} +2 -2
- package/public/assets/{versioned-prompt-editor-CIVg7XB1.js → versioned-prompt-editor-BkTi7eim.js} +2 -2
- package/public/assets/{work-queue-B9rnLwHZ.js → work-queue-DDOLEyKo.js} +2 -2
- package/public/assets/{workflow-marker-X8wxyhzC.js → workflow-marker-CzOsB8BM.js} +2 -2
- package/public/assets/{workflows-o5YyMFW7.js → workflows-DJilvmRM.js} +2 -2
- package/public/assets/{workspaces-CzEGoAng.js → workspaces-CHcfbLR3.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +29 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapters/claude-api.ts +1 -1
- package/runner/src/provider-setup.ts +2 -2
- package/src/auth/login-link.ts +35 -0
- package/src/cli/index.ts +7 -1
- package/src/cli/init.ts +53 -0
- package/src/cli/orchestrator.ts +1 -7
- package/src/cli/setup.ts +6 -4
- package/src/db/spawn-delegation.ts +2 -1
- package/src/db/workflow-execution.ts +3 -3
- package/src/dev.ts +4 -13
- package/src/init.ts +299 -0
- package/src/invite-link.ts +16 -9
- package/src/routes/auth.ts +30 -2
- package/src/routes/host-providers.ts +18 -0
- package/src/routes/index.ts +5 -2
- package/src/routes/orchestrator-bootstrap.ts +2 -0
- package/src/routes/secrets-backup.ts +2 -3
- package/src/routes/secrets-import.ts +2 -3
- package/src/routes/secrets-vault.ts +5 -7
- package/src/runtime-install.ts +30 -0
- package/src/server.ts +4 -4
- package/src/services/auth-context.ts +6 -0
- package/src/services/provider-api-key.ts +73 -0
- package/src/setup.ts +47 -8
- package/src/utils.ts +7 -0
- package/public/assets/agent-liveness-Bq-s73jW.js +0 -2
- package/public/assets/overview-DcYCrvlr.js +0 -2
- package/public/assets/provider-display-BEeLXC_D.js +0 -2
- package/public/assets/store-DKPDIZBe.js +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,u as t}from"./dist-DeW2Y1R5.js";import{P as n}from"./provider-display-
|
|
2
|
-
//# sourceMappingURL=agent-lineage-
|
|
1
|
+
import{n as e,u as t}from"./dist-DeW2Y1R5.js";import{P as n}from"./provider-display-bWwiuedV.js";import{Z as r,f as i,t as a}from"./display-BemJG1f_.js";import{t as o}from"./agent-liveness-DSQY1Aa_.js";import{t as s}from"./cpu-Dndy84IU.js";import{t as c}from"./eye-BAP6fHrX.js";import{t as l}from"./git-branch-yxhV0m8E.js";import{t as u}from"./layers-DEfClY-v.js";import{t as d}from"./lock-BW8MPKw_.js";import{t as f}from"./rocket-BmO1qSu-.js";import{t as p}from"./terminal-Bl2u7KxT.js";import{t as m}from"./badge-DqJRtj_p.js";var h=e(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),g=e(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),_=e(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),v=e(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),y=e(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),b=e(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),x=t();function S({agent:e,compact:t=!1}){let n=N(e);return n.length===0?null:(0,x.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.slice(0,t?4:void 0).map(e=>(0,x.jsx)(m,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})}function C({agent:e,compact:t=!1,className:n=``}){let r=T(e);return(0,x.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 ${n}`,children:r.map(e=>{let n=e.Icon;return(0,x.jsxs)(`span`,{title:e.title,className:`inline-flex h-5 min-w-5 items-center justify-center gap-1 rounded-md border px-1.5 text-[10px] leading-none ${e.className}`,children:[(0,x.jsx)(n,{className:`h-3 w-3 shrink-0`}),!t&&(0,x.jsx)(`span`,{children:e.label})]},e.key)})})}function w({agent:e}){let t=e.context;if(!t)return null;let n=I(t);if(n===null)return(0,x.jsxs)(`div`,{className:`space-y-1`,title:L(t),children:[(0,x.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:`collecting`}),(0,x.jsx)(`span`,{children:`--`})]}),(0,x.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full w-0 bg-muted-foreground/30`})})]});let r=Math.round(n*100),i=r>=80?`bg-tone-danger`:r>=60?`bg-tone-yellow`:`bg-tone-success`;return(0,x.jsxs)(`div`,{className:`space-y-1`,title:L(t),children:[(0,x.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:t.lifecycleState}),(0,x.jsxs)(`span`,{children:[r,`%`]})]}),(0,x.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,x.jsx)(`div`,{className:`h-full ${i}`,style:{width:`${Math.max(0,Math.min(100,r))}%`}})})]})}function T(e){let t=D(e),n=O(e),r=k(e);return[{key:`origin`,label:t?`Relay`:`External`,title:t?`Humwick spawned this agent`:`Externally started agent registered with Humwick`,Icon:t?f:_,className:t?`border-tone-sky/30 bg-tone-sky/10 text-tone-sky-fg`:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`},n,...E(e),r]}function E(e){let t=e.meta?.launchMode;return t===`headless`?[{key:`launchMode`,label:`Headless`,title:`Launch mode: headless (persistent pipe, no terminal)`,Icon:s,className:`border-tone-fuchsia/30 bg-tone-fuchsia/10 text-tone-fuchsia-fg`}]:t===`interactive`?[{key:`launchMode`,label:`Interactive`,title:`Launch mode: interactive (terminal)`,Icon:p,className:`border-tone-teal/30 bg-tone-teal/10 text-tone-teal-fg`}]:[]}function D(e){return typeof e.meta?.spawnRequestId==`string`||typeof e.meta?.policyName==`string`||typeof e.meta?.automationRunId==`string`}function O(e){let t=String(e.providerCapabilities?.session?.approvalMode||e.meta?.approvalMode||`guarded`).toLowerCase();return t===`open`?{key:`approval`,label:`Open`,title:`Approval mode: open`,Icon:y,className:`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`}:t===`read-only`?{key:`approval`,label:`Read-only`,title:`Approval mode: read-only`,Icon:c,className:`border-tone-info/30 bg-tone-info/10 text-tone-info-fg`}:{key:`approval`,label:`Guarded`,title:`Approval mode: guarded`,Icon:d,className:`border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`}}function k(e){let t=A(e.meta?.workspace),r=n(t.requestedMode)||n(e.meta?.workspaceMode),i=n(t.mode),a=r&&r!==`inherit`?r:i&&r!==`inherit`?i:`default`;return a===`isolated`?{key:`workspace`,label:`Isolated`,title:`Workspace: isolated worktree`,Icon:l,iconColor:`text-tone-violet-fg`,className:`border-tone-violet/30 bg-tone-violet/10 text-tone-violet-fg`}:a===`shared`?{key:`workspace`,label:`Shared`,title:`Workspace: shared repo checkout`,Icon:b,iconColor:`text-tone-cyan-fg`,className:`border-tone-cyan/30 bg-tone-cyan/10 text-tone-cyan-fg`}:{key:`workspace`,label:`Default`,title:i?`Workspace: default/inherit, resolved to ${i}`:`Workspace: default/inherit`,Icon:u,iconColor:`text-tone-neutral-fg`,className:`border-tone-neutral/30 bg-tone-neutral/10 text-tone-neutral-fg`}}function A(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function j(e){let t=A(e.meta?.workspace),i=n(e.branchWorkspaceProjectRoot)||n(t.repoRoot)||n(t.sourceCwd)||n(e.meta?.cwd);return i?r(i,2):``}function M(e){return!!(e.context||e.providerCapabilities?.context)}function N(e){let t=e.providerCapabilities,n=e.context,r=[];t?.lifecycle.managed?r.push(`managed`):t&&r.push(`bridge`),t?.session?.approvalMode===`read-only`?r.push(`read-only`):t?.session?.fileWrite&&r.push(`write`),t?.session?.shell&&r.push(`shell`),(t?.model?.alias||t?.model?.id)&&r.push(String(t.model.alias||t.model.id));let i=a(e).length;if(i&&r.push(i===1?`1 subagent`:`${i} subagents`),n){let e=I(n);r.push(e===null?`ctx collecting`:`${Math.round(e*100)}% ctx`)}return r}function P({context:e,expected:t=!!e,size:n=26,className:r}){let i=I(e);if(i===null&&!t)return null;let a=n>=24?3:2.5,o=n/2,s=o-a,c=2*Math.PI*s,l=i===null?c:c*(1-i),u=i===null,d=u?`text-muted-foreground`:i>.8?`text-tone-danger-fg`:i>.5?`text-tone-yellow-fg`:`text-tone-success-fg`,f=u?null:Math.round(i*100);return(0,x.jsxs)(`div`,{className:`relative shrink-0 ${u?`opacity-70`:``} ${r??``}`,style:{width:n,height:n},title:L(e),children:[(0,x.jsxs)(`svg`,{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:`rotate-[-90deg]`,children:[(0,x.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,className:`stroke-muted-foreground/20`}),(0,x.jsx)(`circle`,{cx:o,cy:o,r:s,fill:`none`,strokeWidth:a,strokeDasharray:c,strokeDashoffset:l,strokeLinecap:`round`,className:`${d} stroke-current transition-all duration-500`})]}),(0,x.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-semibold leading-none ${u?`text-muted-foreground`:d}`,style:{fontSize:n>=24?8:7},children:u?`?`:f})]})}function F(e){let t=e.context;return!t?.tokensUsed&&!t?.tokensMax?null:t.tokensUsed&&t.tokensMax?`${R(t.tokensUsed)} / ${R(t.tokensMax)}`:t.tokensUsed?R(t.tokensUsed):t.tokensMax?R(t.tokensMax):null}function I(e){return!e||typeof e.utilization!=`number`||!Number.isFinite(e.utilization)?null:Math.min(1,Math.max(0,e.utilization))}function L(e){if(!e)return`Context: collecting; provider has not reported usage yet`;let t=I(e),n=`${e.source}/${e.confidence}`,r=Number.isFinite(e.lastUpdatedAt)?new Date(e.lastUpdatedAt).toLocaleString():`unknown`;return t===null?`Context: unknown; ${n}; updated ${r}`:`Context: ${Math.round(t*100)}%; ${n}; updated ${r}`}function R(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function z(e,t){return!!e.spawnedBy&&o(t,e)}function B(e,t){let n=new Map;for(let r of e){if(!r.spawnedBy||!z(r,t))continue;let e=n.get(r.spawnedBy);e?e.push(r):n.set(r.spawnedBy,[r])}return n}function V(e,t,n,r=new Set){let i=B(e,n),a=[],o=new Set,s=U(e,n).map(e=>({agent:e,depth:0,parent:e.spawnedBy?t[e.spawnedBy]??null:null})).reverse();for(;s.length;){let e=s.pop();if(o.has(e.agent.id))continue;o.add(e.agent.id);let t=i.get(e.agent.id)??[];if(r.has(e.agent.id))a.push({...e,children:t,folded:t.length?H(e.agent.id,i):void 0});else{a.push({...e,children:t});for(let n=t.length-1;n>=0;n--)s.push({agent:t[n],depth:e.depth+1,parent:e.agent})}}return a}function H(e,t){let n=[],r=new Set([e]),i=[...t.get(e)??[]].reverse();for(;i.length;){let e=i.pop();if(r.has(e.id))continue;r.add(e.id),n.push(e);let a=t.get(e.id)??[];for(let e=a.length-1;e>=0;e--)i.push(a[e])}return n}function U(e,t){let n=new Set(e.map(e=>e.id));return e.filter(e=>e.spawnedBy&&!z(e,t)?!1:!z(e,t)||!e.spawnedBy||!n.has(e.spawnedBy))}function W(e){return[...e].sort((e,t)=>i(e).localeCompare(i(t)))}export{g as _,S as a,P as c,k as d,F as f,_ as g,v as h,U as i,M as l,y as m,B as n,C as o,b as p,W as r,w as s,V as t,j as u,h as v};
|
|
2
|
+
//# sourceMappingURL=agent-lineage-kq9TPYFw.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{$ as n,f as r,p as i}from"./display-
|
|
2
|
-
//# sourceMappingURL=agent-name-
|
|
1
|
+
import{o as e,u as t}from"./dist-DeW2Y1R5.js";import{$ as n,f as r,p as i}from"./display-BemJG1f_.js";import{t as a}from"./workflow-marker-CzOsB8BM.js";var o=t();function s({agent:t,fallback:n,className:i}){return(0,o.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 align-bottom`,children:[(0,o.jsx)(`span`,{className:e(`truncate`,i),children:t?r(t):n??`?`}),(0,o.jsx)(a,{agent:t})]})}function c({target:t,agentsById:r,className:a}){let c=n(t,r);return c?(0,o.jsx)(s,{agent:c,className:a}):(0,o.jsx)(`span`,{className:e(`truncate`,a),children:i(t,r)})}export{c as n,s as t};
|
|
2
|
+
//# sourceMappingURL=agent-name-C_7F4DFR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=agent-profiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{M as i,r as a,t as o}from"./provider-display-bWwiuedV.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dialog-uuJ9_geR.js";import{t as m}from"./chevron-right-iljytE0x.js";import{t as h}from"./copy-DFxhHRtV.js";import{t as g}from"./download-KgtpDbt5.js";import{t as _}from"./eye-BAP6fHrX.js";import{n as v,t as y}from"./user-cog-CKcouW1J.js";import{t as b}from"./loader-circle-BfPd4kOD.js";import{t as x}from"./pencil-B1Hf2V_J.js";import{t as S}from"./plus-D5Ek4e2S.js";import{t as C}from"./trash-2-FbcSq927.js";import{t as w}from"./button-Do6Z3vvn.js";import{t as T}from"./badge-DqJRtj_p.js";import{t as E}from"./project-profile-instructions-Apn15y43.js";var D=e(t(),1),O=n();function k(e){let t=o(),n=e.provider??``;return n&&n!==`any`&&t.includes(n)?n:t[0]??n}function A(e){if(Array.isArray(e))return e.map(A);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n===`files`&&Array.isArray(r)?t[n]=r.map(e=>{if(e&&typeof e==`object`&&typeof e.content==`string`){let t=e.content;return{...e,content:`<${t.length} chars elided>`}}return A(e)}):t[n]=A(r);return t}return e}function j({profile:e,open:t,onOpenChange:n}){let m=r(e=>e.apiCall),[h,_]=(0,D.useState)(()=>k(e)),[v,y]=(0,D.useState)(!1),[x,S]=(0,D.useState)(null),[C,T]=(0,D.useState)(null),E=(0,D.useCallback)(async t=>{y(!0),S(null);try{let n=await m(`GET`,`/agent-profiles/${encodeURIComponent(e.name)}/resolved?provider=${t}`);T(n.profile)}catch(e){T(null),S(i(e))}finally{y(!1)}},[m,e.name]);(0,D.useEffect)(()=>{if(t){let t=k(e);_(t),E(t)}},[t,e,E]);function j(e){e!==h&&(_(e),E(e))}function M(){if(!C)return;let t=new Blob([JSON.stringify(C,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.name}.${h}.resolved.json`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}let N=C?JSON.stringify(A(C),null,2):``;return(0,O.jsx)(p,{open:t,onOpenChange:n,children:(0,O.jsxs)(d,{className:`max-w-3xl`,children:[(0,O.jsxs)(u,{children:[(0,O.jsxs)(f,{className:`font-mono text-sm`,children:[e.name,` — resolved projection`]}),(0,O.jsxs)(c,{children:[`The fully-resolved agent-profile projection (`,(0,O.jsx)(`code`,{children:`withResolvedProvisioning`}),`) for the selected provider. File contents are elided below; download the full JSON for the complete bundle.`]})]}),(0,O.jsxs)(l,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Provider`}),(0,O.jsx)(`div`,{className:`flex items-center gap-1`,children:o().map(e=>(0,O.jsx)(w,{variant:e===h?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs`,disabled:v,onClick:()=>j(e),children:a(e)},e))}),(0,O.jsx)(`div`,{className:`flex-1`}),(0,O.jsxs)(w,{size:`sm`,className:`h-7 gap-1 text-xs`,disabled:v||!C,onClick:M,children:[(0,O.jsx)(g,{className:`h-3.5 w-3.5`}),`Download full JSON`]})]}),(0,O.jsx)(`div`,{className:`min-h-[16rem] rounded-md border border-border bg-muted/30 p-3`,children:v?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(b,{className:`h-3.5 w-3.5 animate-spin`}),`Resolving projection…`]}):x?(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:x}):C?(0,O.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed`,children:N}):(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No projection available.`})})]}),(0,O.jsx)(s,{children:(0,O.jsx)(w,{variant:`outline`,size:`sm`,onClick:()=>n(!1),children:`Close`})})]})})}function M({relay:e}){return(0,O.jsx)(`div`,{className:`flex items-center gap-1`,children:[{key:`ctx`,on:e.context},{key:`skl`,on:e.skills},{key:`plg`,on:e.plugins},{key:`stl`,on:e.statusLine}].map(e=>(0,O.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.on?`bg-tone-success`:`bg-muted-foreground/30`}`,title:`${e.key}: ${e.on?`on`:`off`}`},e.key))})}function N({profile:e}){let t=r(e=>e.openProfileModal),n=r(e=>e.deleteProfile),i=e.builtIn===!0,[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`group flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-4 ${s?`sm:col-span-2 lg:col-span-3`:``}`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-2 gap-y-1`,children:[(0,O.jsxs)(`div`,{className:`min-w-[10rem] flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,O.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":!0,children:e.icon?.trim()||`•`}),(0,O.jsx)(`span`,{className:`min-w-0 font-mono text-sm font-medium [overflow-wrap:anywhere]`,children:e.name}),i&&(0,O.jsx)(T,{variant:`secondary`,className:`text-[10px]`,children:`Built-in`}),e.overridden&&(0,O.jsx)(T,{variant:`outline`,className:`text-[10px] border-tone-warning/30 bg-tone-warning/10 text-tone-warning-fg`,children:`Overridden`})]}),e.description&&(0,O.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,O.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5 opacity-100 transition-opacity [@media(hover:hover)]:sm:opacity-0 [@media(hover:hover)]:sm:group-hover:opacity-100 [@media(hover:hover)]:sm:group-focus-within:opacity-100`,children:[(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`View`,onClick:()=>t(`view`,e),children:(0,O.jsx)(_,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Edit`,onClick:()=>t(`edit`,e),children:(0,O.jsx)(x,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Duplicate`,onClick:()=>t(`duplicate`,e),children:(0,O.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7`,title:`Resolved projection`,onClick:()=>o(!0),children:(0,O.jsx)(v,{className:`h-3.5 w-3.5`})}),(!i||e.overridden)&&(0,O.jsx)(w,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 text-destructive`,title:i?`Reset to default`:`Delete`,onClick:()=>n(e),children:(0,O.jsx)(C,{className:`h-3.5 w-3.5`})})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,O.jsx)(T,{variant:`outline`,children:e.provider||`any`}),(0,O.jsxs)(T,{variant:`outline`,children:[`fs: `,e.permissions.filesystem]}),e.permissions.mode&&(0,O.jsx)(T,{variant:`outline`,children:e.permissions.mode})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground`,children:[(0,O.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Relay `,(0,O.jsx)(M,{relay:e.relay})]}),e.instructions.globalInstructions===`ignore`&&(0,O.jsx)(`span`,{className:`text-tone-warning-fg`,children:`global: ignore`}),Object.keys(e.env||{}).length>0&&(0,O.jsxs)(`span`,{children:[Object.keys(e.env).length,` env vars`]})]}),(0,O.jsxs)(`div`,{className:`-mx-1 border-t border-border pt-2`,children:[(0,O.jsxs)(w,{variant:`ghost`,size:`sm`,className:`h-8 gap-1 px-1 text-xs`,"aria-expanded":s,onClick:()=>c(!s),children:[(0,O.jsx)(m,{className:`h-3.5 w-3.5 transition-transform ${s?`rotate-90`:``}`}),`Project instructions`]}),s&&(0,O.jsx)(`div`,{className:`px-1 pt-1`,children:(0,O.jsx)(E,{profile:e.name})})]}),(0,O.jsx)(j,{profile:e,open:a,onOpenChange:o})]})}function P(){let e=r(e=>e.agentProfiles),t=r(e=>e.openProfileModal),n=e.filter(e=>e.builtIn),i=e.filter(e=>!e.builtIn);return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,O.jsx)(y,{className:`h-5 w-5 text-primary`}),`Agent Profiles`]}),(0,O.jsx)(T,{variant:`outline`,children:e.length}),(0,O.jsx)(`div`,{className:`flex-1`}),(0,O.jsxs)(w,{size:`sm`,className:`gap-1`,onClick:()=>t(`create`),children:[(0,O.jsx)(S,{className:`h-3.5 w-3.5`}),`Create Profile`]})]}),n.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Built-in`}),(0,O.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:n.map(e=>(0,O.jsx)(N,{profile:e},e.name))})]}),i.length>0&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Custom`}),(0,O.jsx)(`div`,{className:`grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(e=>(0,O.jsx)(N,{profile:e},e.name))})]}),e.length===0&&(0,O.jsx)(`div`,{className:`py-12 text-center text-sm text-muted-foreground`,children:`No agent profiles found. Create one to configure agent behavior.`})]})}export{P as AgentProfilesView};
|
|
2
|
+
//# sourceMappingURL=agent-profiles-BNOcrGcY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-
|
|
2
|
-
//# sourceMappingURL=agent-project-badge-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-BgDALGIX.js";import{t as a}from"./boxes-Cv7Wq3h4.js";var o=t(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),s=e(n(),1),c=r();function l({agent:e,className:t=``,onNavigate:n}){let r=typeof e.meta?.cwd==`string`?e.meta.cwd:``,o=i(e=>r?e.projectByCwd[r]:null),l=i(e=>e.fetchProjectForCwd),u=i(e=>e.openProjectFocus);return(0,s.useEffect)(()=>{r&&l(r)},[r,l]),o?(0,c.jsxs)(`button`,{type:`button`,title:`Project: ${o.title||o.slug} — open in Projects`,onClick:e=>{e.stopPropagation(),n?.(),u(o.id)},className:`inline-flex h-5 max-w-full items-center gap-1 rounded-full border border-tone-indigo/30 bg-tone-indigo/10 px-1.5 text-[10px] font-medium text-tone-indigo-fg transition-colors hover:bg-tone-indigo/20 ${t}`,children:[(0,c.jsx)(a,{className:`h-3 w-3 shrink-0`}),(0,c.jsx)(`span`,{className:`truncate`,children:o.title||o.slug})]}):null}export{o as n,l as t};
|
|
2
|
+
//# sourceMappingURL=agent-project-badge-B6yAh70a.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-DKPDIZBe.js";import{et as o,v as s,y as c}from"./display-CDeH4I8T.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./globe-Cl5fXtqs.js";import{t as d}from"./refresh-cw-CfpvQcUn.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{n as m}from"./agent-name-CcY3Aijy.js";var h=e(n(),1),g={total:0,perDay:[],perBackend:[],topErrors:[],agents:[],statuses:[]};function _(e){let[t,n]=(0,h.useState)([]),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(g),[s,c]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)([]),_=(0,h.useRef)(!1),v=(0,h.useRef)(0),{tool:y,windowMs:b,status:x,agentId:S,backend:C}=e,w=(0,h.useCallback)(async e=>{if(_.current)return;_.current=!0;let t=++v.current;p(!0);let r=Date.now()-b,a=new URLSearchParams({since:String(r),limit:`1000`});for(let[e,t]of Object.entries({tool:y,status:x,agentId:S,backend:C}))t&&a.set(e,t);let s=m.current.filter(e=>e.time>=r);e&&(a.set(`beforeTime`,String(e.beforeTime)),a.set(`beforeId`,e.beforeId));try{let u=async()=>{let n=await l(`GET`,`/web-tool-calls?${a}`),r=[...n.calls];for(;!e&&s[0]&&n.nextCursor&&!n.calls.some(e=>e.id===s[0].id)&&n.calls.at(-1).time>=s[0].time;)if(a.set(`beforeTime`,String(n.nextCursor.beforeTime)),a.set(`beforeId`,n.nextCursor.beforeId),n=await l(`GET`,`/web-tool-calls?${a}`),r.push(...n.calls),t!==v.current)return{calls:[],nextCursor:null};return{calls:r,nextCursor:n.nextCursor}},f=new URLSearchParams({since:String(r)});y&&f.set(`tool`,y);let[p,h,g]=await Promise.all([u(),e?Promise.resolve(null):l(`GET`,`/web-tool-calls/summary?${f}`),e?Promise.resolve(null):l(`GET`,`/web-search/budget`)]);if(t!==v.current)return;let _=new Map(s.map(e=>[e.id,e]));for(let e of p.calls)_.set(e.id,e);let b=[..._.values()].sort((e,t)=>t.time-e.time||(e.id<t.id?1:e.id>t.id?-1:0));m.current=b,n(b),e||s.length===0?i(p.nextCursor):i(e=>e&&e.beforeTime>=r?e:null),h&&o(h),g&&c(g),d(null)}catch(e){t===v.current&&d(e.message)}finally{t===v.current&&(_.current=!1,p(!1))}},[y,b,x,S,C]);return(0,h.useEffect)(()=>{w();let e=setInterval(()=>{document.visibilityState!==`hidden`&&w()},1e4);return()=>{clearInterval(e),v.current++,_.current=!1}},[w]),{calls:t,cursor:r,summary:a,budget:s,error:u,loading:f,refresh:()=>w(),loadOlder:()=>r?w(r):Promise.resolve()}}var v=r(),y=1440*60*1e3,b=[[`24h`,y],[`7d`,7*y],[`30d`,30*y]],x=[[``,`All web tools`],[`search`,`Web search`],[`fetch`,`Web fetch`]],S=`h-8 min-w-0 rounded-md border border-input bg-background px-2 text-sm`;function C({budget:e}){if(!e)return null;let n=Math.min(100,Math.round(e.requests/e.cap*100)),r=n>=100?`danger`:n>=80?`warning`:`success`;return(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`brave-budget`,children:[(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Brave budget · `,e.month,` (UTC)`]}),(0,v.jsxs)(`div`,{className:`mt-1 text-lg font-semibold`,children:[e.requests,` / `,e.cap,` `,(0,v.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`requests (`,n,`%)`]})]}),(0,v.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:t(`h-full`,`bg-tone-${r}`),style:{width:`${n}%`}})})]})}function w({summary:e,budget:n}){let r=Math.max(1,...e.perDay.map(e=>e.calls));return(0,v.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,v.jsx)(C,{budget:n}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Calls per day`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perDay.slice(0,7).map(e=>(0,v.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`w-20 shrink-0 font-mono text-muted-foreground`,children:e.day.slice(5)}),(0,v.jsx)(`span`,{className:`h-2 rounded-full bg-tone-info`,style:{width:`${Math.max(2,e.calls/r*60)}%`}}),(0,v.jsx)(`span`,{children:e.calls})]},e.day)),e.perDay.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error rate per backend`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perBackend.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono`,children:e.backend}),(0,v.jsxs)(`span`,{className:t(e.errors>0&&`font-semibold text-tone-danger-fg`),children:[Math.round(e.errors/e.calls*100),`% · `,e.errors,`/`,e.calls]})]},e.backend)),e.perBackend.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Top errors`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.topErrors.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono text-tone-danger-fg`,children:e.status}),(0,v.jsx)(`span`,{children:e.count})]},e.status)),e.topErrors.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No errors`})]})]})]})}function T({label:e,children:t}){return(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,v.jsx)(`dd`,{className:`break-words font-mono`,children:t})]})}function E({call:e,now:n,open:r,onToggle:a}){let l=i(e=>e.agentsById),u=e.status===`success`;return(0,v.jsxs)(`li`,{className:t(`rounded-md border border-border`,!u&&`border-tone-danger/40 bg-tone-danger/5`),"data-testid":`tool-call-row`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 px-3 py-2 text-left`,"aria-expanded":r,onClick:a,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,v.jsx)(p,{className:t(`border`,u?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-tone-danger/40 bg-tone-danger/10 text-tone-danger-fg`),children:e.status}),(0,v.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,v.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e.backend}),(0,v.jsx)(`span`,{className:`min-w-0 max-w-[10rem] truncate`,children:(0,v.jsx)(m,{target:e.agentId,agentsById:l})}),(0,v.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,title:s(e.time),children:[o(n,e.time),` · `,e.durationMs,` ms`]})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-sm`,title:e.input,children:e.input})]}),r&&(0,v.jsxs)(`dl`,{className:`grid gap-2 border-t border-border px-3 py-2 text-xs sm:grid-cols-2`,children:[(0,v.jsx)(T,{label:`Time`,children:s(e.time)}),(0,v.jsx)(T,{label:`Provider / model / effort`,children:[e.provider,e.model,e.effort].map(e=>e??`–`).join(` / `)}),(0,v.jsx)(T,{label:`Input`,children:e.input}),(0,v.jsx)(T,{label:`Result size`,children:c(e.resultSize)}),(0,v.jsx)(T,{label:`Cache hit`,children:e.cacheHit===null?`unknown`:e.cacheHit?`yes`:`no`}),(0,v.jsx)(T,{label:`Fallback chain`,children:e.fallbackChain.length?e.fallbackChain.join(` → `):`–`}),e.error&&(0,v.jsx)(T,{label:`Error`,children:e.error}),(0,v.jsx)(T,{label:`Call id`,children:e.id})]})]})}function D(){let[e,t]=(0,h.useState)({tool:``,windowMs:y,status:``,agentId:``,backend:``});return(0,v.jsx)(O,{filters:e,onFilters:t},JSON.stringify(e))}function O({filters:e,onFilters:n}){let r=a(),{tool:i,windowMs:o,status:s,agentId:c,backend:l}=e,{calls:m,cursor:g,summary:y,budget:C,error:T,loading:D,refresh:O,loadOlder:k}=_(e),[A,j]=(0,h.useState)(null),M=y.perBackend.reduce((e,t)=>e+t.errors,0);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,v.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agent Tools`}),(0,v.jsx)(p,{variant:`secondary`,children:y.total}),M>0&&(0,v.jsxs)(p,{variant:`destructive`,children:[M,` errors`]})]}),(0,v.jsxs)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void O(),children:[(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`select`,{"aria-label":`Tool`,className:S,value:i,onChange:t=>n({...e,tool:t.target.value}),children:x.map(([e,t])=>(0,v.jsx)(`option`,{value:e,children:t},e))}),(0,v.jsx)(`select`,{"aria-label":`Time window`,className:S,value:o,onChange:t=>n({...e,windowMs:Number(t.target.value)}),children:b.map(([e,t])=>(0,v.jsx)(`option`,{value:t,children:e},e))}),(0,v.jsxs)(`select`,{"aria-label":`Status`,className:S,value:s,onChange:t=>n({...e,status:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any status`}),(0,v.jsx)(`option`,{value:`error`,children:`All errors`}),y.statuses.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Agent`,className:t(S,`max-w-[10rem]`),value:c,onChange:t=>n({...e,agentId:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any agent`}),y.agents.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Backend`,className:S,value:l,onChange:t=>n({...e,backend:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any backend`}),y.perBackend.map(e=>(0,v.jsx)(`option`,{value:e.backend,children:e.backend},e.backend))]})]}),T&&(0,v.jsx)(`div`,{className:`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-2 text-sm text-tone-danger-fg`,children:T}),(0,v.jsx)(w,{summary:y,budget:C}),m.length===0?(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:D?`Loading calls…`:`No tool calls match`}):(0,v.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,v.jsx)(E,{call:e,now:r,open:A===e.id,onToggle:()=>j(A===e.id?null:e.id)},e.id))}),g&&(0,v.jsx)(`div`,{className:`text-center`,children:(0,v.jsx)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void k(),children:`Load older calls`})})]})}export{D as AgentToolsView};
|
|
2
|
-
//# sourceMappingURL=agent-tools-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i,wt as a}from"./store-BgDALGIX.js";import{et as o,v as s,y as c}from"./display-BemJG1f_.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./globe-Cl5fXtqs.js";import{t as d}from"./refresh-cw-CfpvQcUn.js";import{t as f}from"./button-Do6Z3vvn.js";import{t as p}from"./badge-DqJRtj_p.js";import{n as m}from"./agent-name-C_7F4DFR.js";var h=e(n(),1),g={total:0,perDay:[],perBackend:[],topErrors:[],agents:[],statuses:[]};function _(e){let[t,n]=(0,h.useState)([]),[r,i]=(0,h.useState)(null),[a,o]=(0,h.useState)(g),[s,c]=(0,h.useState)(null),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(!1),m=(0,h.useRef)([]),_=(0,h.useRef)(!1),v=(0,h.useRef)(0),{tool:y,windowMs:b,status:x,agentId:S,backend:C}=e,w=(0,h.useCallback)(async e=>{if(_.current)return;_.current=!0;let t=++v.current;p(!0);let r=Date.now()-b,a=new URLSearchParams({since:String(r),limit:`1000`});for(let[e,t]of Object.entries({tool:y,status:x,agentId:S,backend:C}))t&&a.set(e,t);let s=m.current.filter(e=>e.time>=r);e&&(a.set(`beforeTime`,String(e.beforeTime)),a.set(`beforeId`,e.beforeId));try{let u=async()=>{let n=await l(`GET`,`/web-tool-calls?${a}`),r=[...n.calls];for(;!e&&s[0]&&n.nextCursor&&!n.calls.some(e=>e.id===s[0].id)&&n.calls.at(-1).time>=s[0].time;)if(a.set(`beforeTime`,String(n.nextCursor.beforeTime)),a.set(`beforeId`,n.nextCursor.beforeId),n=await l(`GET`,`/web-tool-calls?${a}`),r.push(...n.calls),t!==v.current)return{calls:[],nextCursor:null};return{calls:r,nextCursor:n.nextCursor}},f=new URLSearchParams({since:String(r)});y&&f.set(`tool`,y);let[p,h,g]=await Promise.all([u(),e?Promise.resolve(null):l(`GET`,`/web-tool-calls/summary?${f}`),e?Promise.resolve(null):l(`GET`,`/web-search/budget`)]);if(t!==v.current)return;let _=new Map(s.map(e=>[e.id,e]));for(let e of p.calls)_.set(e.id,e);let b=[..._.values()].sort((e,t)=>t.time-e.time||(e.id<t.id?1:e.id>t.id?-1:0));m.current=b,n(b),e||s.length===0?i(p.nextCursor):i(e=>e&&e.beforeTime>=r?e:null),h&&o(h),g&&c(g),d(null)}catch(e){t===v.current&&d(e.message)}finally{t===v.current&&(_.current=!1,p(!1))}},[y,b,x,S,C]);return(0,h.useEffect)(()=>{w();let e=setInterval(()=>{document.visibilityState!==`hidden`&&w()},1e4);return()=>{clearInterval(e),v.current++,_.current=!1}},[w]),{calls:t,cursor:r,summary:a,budget:s,error:u,loading:f,refresh:()=>w(),loadOlder:()=>r?w(r):Promise.resolve()}}var v=r(),y=1440*60*1e3,b=[[`24h`,y],[`7d`,7*y],[`30d`,30*y]],x=[[``,`All web tools`],[`search`,`Web search`],[`fetch`,`Web fetch`]],S=`h-8 min-w-0 rounded-md border border-input bg-background px-2 text-sm`;function C({budget:e}){if(!e)return null;let n=Math.min(100,Math.round(e.requests/e.cap*100)),r=n>=100?`danger`:n>=80?`warning`:`success`;return(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`brave-budget`,children:[(0,v.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Brave budget · `,e.month,` (UTC)`]}),(0,v.jsxs)(`div`,{className:`mt-1 text-lg font-semibold`,children:[e.requests,` / `,e.cap,` `,(0,v.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`requests (`,n,`%)`]})]}),(0,v.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,v.jsx)(`div`,{className:t(`h-full`,`bg-tone-${r}`),style:{width:`${n}%`}})})]})}function w({summary:e,budget:n}){let r=Math.max(1,...e.perDay.map(e=>e.calls));return(0,v.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,v.jsx)(C,{budget:n}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Calls per day`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perDay.slice(0,7).map(e=>(0,v.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`w-20 shrink-0 font-mono text-muted-foreground`,children:e.day.slice(5)}),(0,v.jsx)(`span`,{className:`h-2 rounded-full bg-tone-info`,style:{width:`${Math.max(2,e.calls/r*60)}%`}}),(0,v.jsx)(`span`,{children:e.calls})]},e.day)),e.perDay.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error rate per backend`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.perBackend.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono`,children:e.backend}),(0,v.jsxs)(`span`,{className:t(e.errors>0&&`font-semibold text-tone-danger-fg`),children:[Math.round(e.errors/e.calls*100),`% · `,e.errors,`/`,e.calls]})]},e.backend)),e.perBackend.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No calls`})]})]}),(0,v.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Top errors`}),(0,v.jsxs)(`ul`,{className:`mt-1 space-y-1`,children:[e.topErrors.map(e=>(0,v.jsxs)(`li`,{className:`flex items-center justify-between gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`truncate font-mono text-tone-danger-fg`,children:e.status}),(0,v.jsx)(`span`,{children:e.count})]},e.status)),e.topErrors.length===0&&(0,v.jsx)(`li`,{className:`text-xs text-muted-foreground`,children:`No errors`})]})]})]})}function T({label:e,children:t}){return(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,v.jsx)(`dd`,{className:`break-words font-mono`,children:t})]})}function E({call:e,now:n,open:r,onToggle:a}){let l=i(e=>e.agentsById),u=e.status===`success`;return(0,v.jsxs)(`li`,{className:t(`rounded-md border border-border`,!u&&`border-tone-danger/40 bg-tone-danger/5`),"data-testid":`tool-call-row`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`block w-full min-w-0 px-3 py-2 text-left`,"aria-expanded":r,onClick:a,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,v.jsx)(p,{className:t(`border`,u?`border-tone-success/30 bg-tone-success/10 text-tone-success-fg`:`border-tone-danger/40 bg-tone-danger/10 text-tone-danger-fg`),children:e.status}),(0,v.jsx)(`span`,{className:`font-medium`,children:e.tool}),(0,v.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:e.backend}),(0,v.jsx)(`span`,{className:`min-w-0 max-w-[10rem] truncate`,children:(0,v.jsx)(m,{target:e.agentId,agentsById:l})}),(0,v.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,title:s(e.time),children:[o(n,e.time),` · `,e.durationMs,` ms`]})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-sm`,title:e.input,children:e.input})]}),r&&(0,v.jsxs)(`dl`,{className:`grid gap-2 border-t border-border px-3 py-2 text-xs sm:grid-cols-2`,children:[(0,v.jsx)(T,{label:`Time`,children:s(e.time)}),(0,v.jsx)(T,{label:`Provider / model / effort`,children:[e.provider,e.model,e.effort].map(e=>e??`–`).join(` / `)}),(0,v.jsx)(T,{label:`Input`,children:e.input}),(0,v.jsx)(T,{label:`Result size`,children:c(e.resultSize)}),(0,v.jsx)(T,{label:`Cache hit`,children:e.cacheHit===null?`unknown`:e.cacheHit?`yes`:`no`}),(0,v.jsx)(T,{label:`Fallback chain`,children:e.fallbackChain.length?e.fallbackChain.join(` → `):`–`}),e.error&&(0,v.jsx)(T,{label:`Error`,children:e.error}),(0,v.jsx)(T,{label:`Call id`,children:e.id})]})]})}function D(){let[e,t]=(0,h.useState)({tool:``,windowMs:y,status:``,agentId:``,backend:``});return(0,v.jsx)(O,{filters:e,onFilters:t},JSON.stringify(e))}function O({filters:e,onFilters:n}){let r=a(),{tool:i,windowMs:o,status:s,agentId:c,backend:l}=e,{calls:m,cursor:g,summary:y,budget:C,error:T,loading:D,refresh:O,loadOlder:k}=_(e),[A,j]=(0,h.useState)(null),M=y.perBackend.reduce((e,t)=>e+t.errors,0);return(0,v.jsxs)(`div`,{className:`space-y-4`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,v.jsx)(u,{className:`h-5 w-5 text-muted-foreground`}),(0,v.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agent Tools`}),(0,v.jsx)(p,{variant:`secondary`,children:y.total}),M>0&&(0,v.jsxs)(p,{variant:`destructive`,children:[M,` errors`]})]}),(0,v.jsxs)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void O(),children:[(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`select`,{"aria-label":`Tool`,className:S,value:i,onChange:t=>n({...e,tool:t.target.value}),children:x.map(([e,t])=>(0,v.jsx)(`option`,{value:e,children:t},e))}),(0,v.jsx)(`select`,{"aria-label":`Time window`,className:S,value:o,onChange:t=>n({...e,windowMs:Number(t.target.value)}),children:b.map(([e,t])=>(0,v.jsx)(`option`,{value:t,children:e},e))}),(0,v.jsxs)(`select`,{"aria-label":`Status`,className:S,value:s,onChange:t=>n({...e,status:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any status`}),(0,v.jsx)(`option`,{value:`error`,children:`All errors`}),y.statuses.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Agent`,className:t(S,`max-w-[10rem]`),value:c,onChange:t=>n({...e,agentId:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any agent`}),y.agents.map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))]}),(0,v.jsxs)(`select`,{"aria-label":`Backend`,className:S,value:l,onChange:t=>n({...e,backend:t.target.value}),children:[(0,v.jsx)(`option`,{value:``,children:`Any backend`}),y.perBackend.map(e=>(0,v.jsx)(`option`,{value:e.backend,children:e.backend},e.backend))]})]}),T&&(0,v.jsx)(`div`,{className:`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-2 text-sm text-tone-danger-fg`,children:T}),(0,v.jsx)(w,{summary:y,budget:C}),m.length===0?(0,v.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:D?`Loading calls…`:`No tool calls match`}):(0,v.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,v.jsx)(E,{call:e,now:r,open:A===e.id,onToggle:()=>j(A===e.id?null:e.id)},e.id))}),g&&(0,v.jsx)(`div`,{className:`text-center`,children:(0,v.jsx)(f,{size:`sm`,variant:`outline`,disabled:D,onClick:()=>void k(),children:`Load older calls`})})]})}export{D as AgentToolsView};
|
|
2
|
+
//# sourceMappingURL=agent-tools-CcrhmOzF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t,u as n}from"./dist-DeW2Y1R5.js";import{w as r}from"./provider-display-
|
|
2
|
-
//# sourceMappingURL=agent-type-icon-
|
|
1
|
+
import{n as e,o as t,u as n}from"./dist-DeW2Y1R5.js";import{w as r}from"./provider-display-bWwiuedV.js";import{s as i}from"./display-BemJG1f_.js";import{t as a}from"./bot-B0NpDNhr.js";import{t as o}from"./messages-square-DVM1ZtcI.js";import{t as s}from"./plug-vIyO9_P8.js";import{t as c}from"./workflow-marker-CzOsB8BM.js";import{t as l}from"./server-CZIRjFyY.js";import{t as u}from"./provider-brand-icon-_67JR7Zh.js";var d=e(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),f=n(),p={codex:`text-tone-info-fg bg-tone-info/10 border-tone-info/25`,claude:`text-tone-orange-fg bg-tone-orange/10 border-tone-orange/25`,opencode:`text-tone-cyan-fg bg-tone-cyan/10 border-tone-cyan/25`,user:`text-tone-success-fg bg-tone-success/10 border-tone-success/25`,system:`text-tone-purple-fg bg-tone-purple/10 border-tone-purple/25`,channel:`text-tone-info-fg bg-tone-info/10 border-tone-info/25`,agent:`text-tone-neutral-fg bg-tone-neutral/10 border-tone-neutral/25`},m={user:d,system:l,channel:o,agent:a};function h({agent:e,className:n}){let o=i(e),l=e?.id===r,d=m[o]||a;return(0,f.jsxs)(`span`,{title:l?`Claude app connector`:void 0,className:t(`relative inline-flex items-center justify-center w-5 h-5 rounded-md border text-sm`,p[o]||p.agent,n),children:[l?(0,f.jsx)(s,{className:`w-3.5 h-3.5`}):(0,f.jsx)(u,{provider:o,fallback:d,className:`w-3.5 h-3.5`}),(0,f.jsx)(c,{agent:e,className:`h-2 w-2`,corner:!0})]})}export{d as n,h as t};
|
|
2
|
+
//# sourceMappingURL=agent-type-icon-CXSLrKiq.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Bt as i,Ct as a,t as o}from"./store-DKPDIZBe.js";import{O as s,r as c,t as l}from"./provider-display-BEeLXC_D.js";import{Z as u,a as d,et as f,f as p,n as m,nt as h,o as g,r as _,rt as v}from"./display-CDeH4I8T.js";import{t as y}from"./api-CIIVBtAV.js";import{a as b,i as x,n as S,r as C,t as w}from"./popover-8w1TWKMG.js";import{t as T}from"./switch-DuCA7mrB.js";import{_ as E,a as ee,h as te,i as D,n as O,o as ne,r as k,s as re,v as A}from"./agent-lineage-SgDt9i3T.js";import{t as j}from"./circle-arrow-up-B432r0Kk.js";import{t as M}from"./circle-UESLMi2-.js";import{t as ie}from"./flag-CnEG9PH-.js";import{t as N}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as ae}from"./link-6RR7Hy3-.js";import{t as P}from"./message-square-C-1G8dMM.js";import{t as oe}from"./minimize-2-BkK6XoMP.js";import{n as se,t as ce}from"./agent-project-badge-DGYbIhaI.js";import{n as F,t as I}from"./pin-DcsKeXxr.js";import{t as L}from"./plus-D5Ek4e2S.js";import{t as le}from"./power-6tZOhYPg.js";import{t as ue}from"./terminal-Bl2u7KxT.js";import{t as de}from"./trash-2-FbcSq927.js";import{t as R}from"./triangle-alert-BBNhfgMi.js";import{t as z}from"./agent-type-icon-CY113sp-.js";import{t as fe}from"./users-C7B3u9jv.js";import{t as B}from"./wrench-C7-4CgnY.js";import{t as V}from"./x-Bge17hWJ.js";import{t as H}from"./button-Do6Z3vvn.js";import{t as U}from"./badge-DqJRtj_p.js";import{t as pe}from"./copy-button-CjOj4HEf.js";import{t as me}from"./agent-name-CcY3Aijy.js";import{c as W,d as G,f as K,p as q,t as he,u as ge}from"./use-selectors-BdxBW8mL.js";import{t as J}from"./status-dot-BcHyw1Vw.js";import{t as _e}from"./terminal-viewer-CpY5_m7W.js";import{n as ve,t as ye}from"./profile-icon-BsRyBMea.js";import{r as be,t as xe}from"./card-C4QJ4hCW.js";import{t as Y}from"./user-avatar-3IndfpOc.js";import{t as Se}from"./use-agent-terminal-0yJA_buM.js";var X=e(n(),1),Z=r();function Ce({agent:e}){let t=o(e=>e.sessionUser),n=o(e=>e.fetchAgents),[r,i]=(0,X.useState)(!1),[a,c]=(0,X.useState)(``);return t&&t.role!==`admin`&&t.id!==e.principalUserId||e.id===`system`||s(e.id)?null:(0,Z.jsxs)(`div`,{className:`mt-2 text-xs`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(T,{"aria-label":`Share ${e.name||e.id}`,checked:e.visibility===`shared`,disabled:r,onCheckedChange:async t=>{i(!0),c(``);try{await y(`PUT`,`/agents/${encodeURIComponent(e.id)}/visibility`,{visibility:t?`shared`:`private`}),await n()}catch(e){c(e instanceof Error?e.message:`Could not save sharing`)}finally{i(!1)}}}),`Shared with everyone`]}),a&&(0,Z.jsx)(`p`,{role:`alert`,children:a})]})}var Q={idle:{label:`idle`,tip:`Branch worktree — nothing to land yet.`,className:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,Icon:M},changes:{label:`changes`,tip:`Unlanded work in this branch — use "Mark workspace ready" to land it.`,className:`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20`,Icon:N},ready:{label:`ready`,tip:`Handed off — the relay auto-merge will land it (~2 min sweep).`,className:`bg-tone-info/10 text-tone-info-fg border-tone-info/20`,Icon:j},steward:{label:`steward`,tip:`Under reconciliation — a steward is landing it. No action needed.`,className:`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/20`,Icon:B},blocked:{label:`blocked`,tip:`Escalated — the auto-merge/steward path is stuck. Needs human attention.`,className:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20`,Icon:R}};function we({state:e,onClick:n,iconOnly:r=!1,className:i}){let a=Q[e],{Icon:o}=a,s=!!n,c=s?`${a.tip} Click to open this workspace.`:a.tip;return(0,Z.jsxs)(`span`,{role:s?`button`:void 0,tabIndex:s?0:void 0,title:c,onClick:n,onKeyDown:s?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n?.(e))}:void 0,className:t(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,a.className,s&&`cursor-pointer hover:brightness-125 focus:outline-none focus:ring-1 focus:ring-current`,i),children:[(0,Z.jsx)(o,{className:`h-2.5 w-2.5 shrink-0`}),!r&&(0,Z.jsx)(`span`,{children:a.label})]})}function $(e,t){let n=e.keep;return n&&(n.until===void 0||n.until>t)?n:void 0}function Te(e){return`Kept ${e.until?`until ${new Date(e.until).toLocaleString()}`:`until cleared`}${e.reason?` — ${e.reason}`:``}. Excluded from idle digests and automatic cleanup.`}function Ee({agent:e,now:t}){let n=o(e=>e.setAgentKeep),r=$(e,t);return r?(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":`true`,title:`${Te(r)} Click to release.`,className:`mt-1 inline-flex h-5 items-center gap-1 rounded-full border border-tone-sky/30 bg-tone-sky/10 px-1.5 text-[10px] font-medium text-tone-sky-fg hover:bg-tone-sky/15`,onClick:t=>{t.stopPropagation(),n(e,!1)},children:[(0,Z.jsx)(I,{className:`h-3 w-3`}),`Kept`]}):null}function De({agent:e,now:t}){let n=o(e=>e.setAgentKeep),r=!!$(e,t);return(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,"aria-pressed":r,title:r?`Release keep`:`Keep — exclude from idle digests and automatic cleanup`,onClick:()=>void n(e,!r),children:r?(0,Z.jsx)(F,{className:`w-3 h-3`}):(0,Z.jsx)(I,{className:`w-3 h-3`})})}function Oe({agent:e}){let t=o(e=>e.users.length>1),n=o(t=>e.principalUserId?t.usersById[e.principalUserId]:void 0);if(!t||!e.principalUserId)return null;let r=n?.displayName||n?.handle||e.principalUserId;return(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1 text-[10px] text-muted-foreground`,"data-testid":`agent-principal`,title:`Works for ${r}`,children:[(0,Z.jsx)(Y,{user:n,address:`user:${e.principalUserId}`,distinct:!0,className:`size-3.5 rounded text-[8px]`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`for `,r]})]})}function ke(e,t){return e.agent===t.agent&&e.parentAgent===t.parentAgent&&i(e.childAgents??[],t.childAgents??[])}var Ae=(0,X.memo)(function({agent:e,childAgents:t=[],parentAgent:n}){let r=a();o(e=>e.set);let i=o(e=>e.switchView),c=o(e=>e.openInboxThread),l=o(e=>e.openAgentDetail),y=o(e=>e.openPairInvite),T=o(e=>e.openRename),E=o(e=>e.openConfirm),D=o(e=>e.doAgentAction),O=o(e=>e.doDeleteAgent),k=o(e=>e.openFilesForAgent),A=o(e=>e.workspaceAction),j=o(e=>e.openWorkspaceFocus),{terminalOpen:M,terminalTarget:N,terminalOpening:F,openTerminal:I,closeTerminal:L}=Se(e.id),R=ge(),B=d(r,e,he(e),R[e.id]||null),V=g(e,`shutdown`),W=g(e,`compact`),G=g(e,`clearContext`),K=!!(e.providerCapabilities?.terminal?.live?.read||e.providerCapabilities?.terminal?.attach?.create),q=_(e,K),Y=m(e),X=n?p(n):e.spawnedBy,Q=t.length>0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xe,{className:`group hover:border-tone-neutral transition-colors cursor-pointer`,onClick:()=>l(e),children:(0,Z.jsxs)(be,{className:`p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 mb-2.5`,children:[(0,Z.jsx)(J,{agent:e,now:r,className:`mt-0.5`}),(0,Z.jsx)(z,{agent:e}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,Z.jsx)(ye,{profile:ve(e),className:`text-sm shrink-0`}),(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:p(e)})]}),(0,Z.jsx)(`div`,{className:`text-xs mt-0.5 ${h(B.tone)}`,children:B.label}),typeof e.meta?.cwd==`string`&&e.meta.cwd&&(0,Z.jsx)(`button`,{type:`button`,className:`mt-0.5 block max-w-full truncate font-mono text-[10px] text-muted-foreground hover:text-foreground`,title:`Open ${e.meta.cwd} in Files`,onClick:t=>{t.stopPropagation(),k(e)},children:u(e.meta.cwd)}),e.landState&&(0,Z.jsxs)(`div`,{className:`mt-1 text-[10px] text-tone-violet-fg`,children:[e.landState,e.landWaitReason?` · ${e.landWaitReason}`:``]}),(0,Z.jsx)(ce,{agent:e,className:`mt-1`}),(0,Z.jsx)(Ee,{agent:e,now:r}),(0,Z.jsx)(Oe,{agent:e})]}),e.branchState&&e.branchWorkspaceId&&(0,Z.jsx)(we,{state:e.branchState,className:`mt-0.5 shrink-0`,onClick:t=>{t.stopPropagation(),j(e.branchWorkspaceId)}})]}),B.badges.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:B.badges.map(e=>(0,Z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium ${e.className}`,children:e.label},e.label))}),(Q||e.spawnedBy&&X)&&(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,onClick:e=>e.stopPropagation(),children:[Q&&(0,Z.jsxs)(w,{children:[(0,Z.jsx)(b,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex h-6 max-w-full items-center gap-1.5 rounded-full border border-tone-sky/30 bg-tone-sky/10 px-2 text-[10px] font-medium text-tone-sky-fg transition-colors hover:bg-tone-sky/15`,title:`${t.length} live child ${t.length===1?`agent`:`agents`}`,children:[(0,Z.jsx)(fe,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:t.length}),(0,Z.jsx)(`span`,{className:`flex -space-x-1`,children:t.slice(0,4).map(e=>(0,Z.jsx)(J,{agent:e,now:r,className:`h-2 w-2 ring-1 ring-background`},e.id))})]})}),(0,Z.jsxs)(S,{align:`start`,className:`w-80`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(C,{children:(0,Z.jsx)(x,{children:`Team`})}),(0,Z.jsx)(`div`,{className:`space-y-1.5`,children:t.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(J,{agent:e,now:r,className:`mt-1`}),(0,Z.jsx)(z,{agent:e}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-xs font-medium`,children:p(e)}),(0,Z.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.providerCapabilities?.model?.alias||e.providerCapabilities?.model?.id||e.providerCapabilities?.model?.provider||e.status})]}),(0,Z.jsx)(U,{variant:`outline`,className:`h-4 px-1.5 text-[9px]`,children:e.status})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex gap-1`,children:[(0,Z.jsx)(H,{size:`xs`,variant:`outline`,onClick:()=>l(e),children:`Open`}),(0,Z.jsxs)(H,{size:`xs`,variant:`ghost`,onClick:()=>{c(e.id),i(`chat`)},children:[(0,Z.jsx)(P,{className:`h-3 w-3`}),`Chat`]})]})]},e.id))})]})]}),e.spawnedBy&&X&&(0,Z.jsx)(U,{variant:`outline`,className:`max-w-full text-[10px] text-muted-foreground`,children:(0,Z.jsxs)(`span`,{className:`truncate`,children:[`spawned by `,(0,Z.jsx)(me,{agent:n,fallback:e.spawnedBy})]})})]}),(0,Z.jsx)(Ce,{agent:e}),(e.tags.length>0||v(e.capabilities).length>0)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:[e.tags.slice(0,3).map(e=>(0,Z.jsx)(U,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e)),v(e.capabilities).slice(0,2).map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))]}),(0,Z.jsxs)(`div`,{className:`space-y-2 mb-2`,children:[(0,Z.jsx)(ne,{agent:e}),(0,Z.jsx)(ee,{agent:e,compact:!0}),(0,Z.jsx)(re,{agent:e})]}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:!s(e.id)&&e.id!==`system`&&f(r,e.lastSeen)}),(0,Z.jsxs)(`div`,{className:`flex gap-1 mt-2.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(pe,{value:e.id,label:`Copy agent ID`,size:`icon`,className:`h-7 w-7`,iconClassName:`w-3 h-3`}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Chat`,onClick:()=>{c(e.id),i(`chat`)},children:(0,Z.jsx)(P,{className:`w-3 h-3`})}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Pair`,onClick:()=>y(e.id),children:(0,Z.jsx)(ae,{className:`w-3 h-3`})}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Rename`,onClick:()=>T(e),children:(0,Z.jsx)(se,{className:`w-3 h-3`})}),K&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Terminal`,disabled:F,onClick:()=>void I(),children:(0,Z.jsx)(ue,{className:`w-3 h-3`})}),(e.branchState===`changes`||e.branchState===`idle`)&&e.branchWorkspaceId&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-warning-fg hover:text-tone-warning-fg`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>E(`Mark Workspace Ready`,`Mark ${p(e)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>A(e.branchWorkspaceId,`ready`)),children:(0,Z.jsx)(ie,{className:`w-3 h-3`})}),e.kind!==`user`&&e.id!==`system`&&(0,Z.jsx)(De,{agent:e,now:r}),W&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Compact`,onClick:()=>E(`Compact Agent`,`Compact context for ${p(e)}?`,()=>D(e,`compact`,`agents-grid`)),children:(0,Z.jsx)(oe,{className:`w-3 h-3`})}),G&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Clear Context`,onClick:()=>E(`Clear Context`,`Clear context for ${p(e)}?`,()=>D(e,`clearContext`,`agents-grid`)),children:(0,Z.jsx)(te,{className:`w-3 h-3`})}),V&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Shutdown`,onClick:()=>E(`Shutdown Agent`,`Shutdown ${p(e)}?`,()=>D(e,`shutdown`,`agents-grid`)),children:(0,Z.jsx)(le,{className:`w-3 h-3`})}),Y&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Forget stale agent`,onClick:()=>E(`Forget Agent`,`Forget ${p(e)}?`,()=>O(e.id)),children:(0,Z.jsx)(de,{className:`w-3 h-3`})})]})]})}),N&&(0,Z.jsx)(_e,{open:M,onOpenChange:L,orchestratorId:N.orchestratorId,session:N.session,interactive:N.interactive||q,canWrite:q,onSessionChanged:()=>void I()})]})},ke);function je(){let e=o(e=>e.agentPresetFilter),t=o(e=>e.agentStatusFilter),n=o(e=>e.agentTagFilter),r=o(e=>e.agentHostFilter),i=o(e=>e.agentSort),s=o(e=>e.agentSortDir),u=o(e=>e.showOffline),d=o(e=>e.setShowOffline),f=W(),p=o(e=>e.set),m=o(e=>e.openAgentSpawn),h=o(e=>e.agentsById),g=a(),_=G(),v=q(),y=K(),b=O(_,g),x=D(_,g),S=e||t||n||r;function C(){p({agentPresetFilter:``,agentStatusFilter:``,agentTagFilter:``,agentHostFilter:``})}function w(){p({agentSortDir:s===`asc`?`desc`:`asc`})}return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`select`,{value:e,onChange:e=>p({agentPresetFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`All agents`}),(0,Z.jsx)(`option`,{value:`active`,children:`Active`}),l().map(e=>(0,Z.jsx)(`option`,{value:e,children:c(e)},e)),(0,Z.jsx)(`option`,{value:`paired`,children:`Paired`}),(0,Z.jsx)(`option`,{value:`unpaired`,children:`Unpaired`}),(0,Z.jsx)(`option`,{value:`offline_stale`,children:`Offline / Stale`})]}),(0,Z.jsxs)(`select`,{value:t,onChange:e=>p({agentStatusFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any status`}),(0,Z.jsx)(`option`,{value:`online`,children:`Online`}),(0,Z.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,Z.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,Z.jsx)(`option`,{value:`offline`,children:`Offline`}),(0,Z.jsx)(`option`,{value:`starting`,children:`Starting`})]}),v.length>0&&(0,Z.jsxs)(`select`,{value:n,onChange:e=>p({agentTagFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any tag`}),v.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),y.length>1&&(0,Z.jsxs)(`select`,{value:r,onChange:e=>p({agentHostFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any host`}),y.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),(0,Z.jsxs)(`select`,{value:i,onChange:e=>p({agentSort:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:`status`,children:`Sort: Status`}),(0,Z.jsx)(`option`,{value:`name`,children:`Sort: Name`}),(0,Z.jsx)(`option`,{value:`lastSeen`,children:`Sort: Last seen`}),(0,Z.jsx)(`option`,{value:`created`,children:`Sort: Created`})]}),(0,Z.jsx)(H,{size:`icon`,variant:`outline`,className:`h-8 w-8`,title:`Toggle sort direction`,onClick:w,children:s===`asc`?(0,Z.jsx)(E,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(A,{className:`w-3.5 h-3.5`})}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground cursor-pointer select-none`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`rounded`}),`Show offline`,f>0?` (${f})`:``]}),S&&(0,Z.jsxs)(H,{size:`sm`,variant:`ghost`,className:`h-8 text-muted-foreground hover:text-foreground gap-1`,onClick:C,children:[(0,Z.jsx)(V,{className:`w-3 h-3`}),`Clear filters`]}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsxs)(H,{size:`sm`,onClick:m,className:`gap-1`,children:[(0,Z.jsx)(L,{className:`w-3.5 h-3.5`}),`Spawn`]})})]}),x.length===0?(0,Z.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No agents match the current filters.`}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-3`,children:x.map(e=>(0,Z.jsx)(Ae,{agent:e,parentAgent:e.spawnedBy?h[e.spawnedBy]??null:null,childAgents:k(b.get(e.id)??[])},e.id))})]})}export{je as AgentsView};
|
|
2
|
-
//# sourceMappingURL=agents-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{Bt as i,Ct as a,t as o}from"./store-BgDALGIX.js";import{O as s,r as c,t as l}from"./provider-display-bWwiuedV.js";import{Z as u,a as d,et as f,f as p,n as m,nt as h,o as g,r as _,rt as v}from"./display-BemJG1f_.js";import{t as y}from"./api-CIIVBtAV.js";import{a as b,i as x,n as S,r as C,t as w}from"./popover-8w1TWKMG.js";import{t as T}from"./switch-DuCA7mrB.js";import{_ as E,a as ee,h as te,i as D,n as O,o as ne,r as k,s as re,v as A}from"./agent-lineage-kq9TPYFw.js";import{t as j}from"./circle-arrow-up-B432r0Kk.js";import{t as M}from"./circle-UESLMi2-.js";import{t as ie}from"./flag-CnEG9PH-.js";import{t as N}from"./git-commit-horizontal-DS1pJ_SS.js";import{t as ae}from"./link-6RR7Hy3-.js";import{t as P}from"./message-square-C-1G8dMM.js";import{t as oe}from"./minimize-2-BkK6XoMP.js";import{n as se,t as ce}from"./agent-project-badge-B6yAh70a.js";import{n as F,t as I}from"./pin-DcsKeXxr.js";import{t as L}from"./plus-D5Ek4e2S.js";import{t as le}from"./power-6tZOhYPg.js";import{t as ue}from"./terminal-Bl2u7KxT.js";import{t as de}from"./trash-2-FbcSq927.js";import{t as R}from"./triangle-alert-BBNhfgMi.js";import{t as z}from"./agent-type-icon-CXSLrKiq.js";import{t as fe}from"./users-C7B3u9jv.js";import{t as B}from"./wrench-C7-4CgnY.js";import{t as V}from"./x-Bge17hWJ.js";import{t as H}from"./button-Do6Z3vvn.js";import{t as U}from"./badge-DqJRtj_p.js";import{t as pe}from"./copy-button-CjOj4HEf.js";import{t as me}from"./agent-name-C_7F4DFR.js";import{c as W,d as G,f as K,p as q,t as he,u as ge}from"./use-selectors-0X_UZkk-.js";import{t as J}from"./status-dot-C703YIy1.js";import{t as _e}from"./terminal-viewer-Dh8dSC7e.js";import{n as ve,t as ye}from"./profile-icon-_SMuSbYF.js";import{r as be,t as xe}from"./card-C4QJ4hCW.js";import{t as Y}from"./user-avatar-CkLhVBGu.js";import{t as Se}from"./use-agent-terminal-CRUVDvLC.js";var X=e(n(),1),Z=r();function Ce({agent:e}){let t=o(e=>e.sessionUser),n=o(e=>e.fetchAgents),[r,i]=(0,X.useState)(!1),[a,c]=(0,X.useState)(``);return t&&t.role!==`admin`&&t.id!==e.principalUserId||e.id===`system`||s(e.id)?null:(0,Z.jsxs)(`div`,{className:`mt-2 text-xs`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(T,{"aria-label":`Share ${e.name||e.id}`,checked:e.visibility===`shared`,disabled:r,onCheckedChange:async t=>{i(!0),c(``);try{await y(`PUT`,`/agents/${encodeURIComponent(e.id)}/visibility`,{visibility:t?`shared`:`private`}),await n()}catch(e){c(e instanceof Error?e.message:`Could not save sharing`)}finally{i(!1)}}}),`Shared with everyone`]}),a&&(0,Z.jsx)(`p`,{role:`alert`,children:a})]})}var Q={idle:{label:`idle`,tip:`Branch worktree — nothing to land yet.`,className:`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/20`,Icon:M},changes:{label:`changes`,tip:`Unlanded work in this branch — use "Mark workspace ready" to land it.`,className:`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/20`,Icon:N},ready:{label:`ready`,tip:`Handed off — the relay auto-merge will land it (~2 min sweep).`,className:`bg-tone-info/10 text-tone-info-fg border-tone-info/20`,Icon:j},steward:{label:`steward`,tip:`Under reconciliation — a steward is landing it. No action needed.`,className:`bg-tone-orange/10 text-tone-orange-fg border-tone-orange/20`,Icon:B},blocked:{label:`blocked`,tip:`Escalated — the auto-merge/steward path is stuck. Needs human attention.`,className:`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/20`,Icon:R}};function we({state:e,onClick:n,iconOnly:r=!1,className:i}){let a=Q[e],{Icon:o}=a,s=!!n,c=s?`${a.tip} Click to open this workspace.`:a.tip;return(0,Z.jsxs)(`span`,{role:s?`button`:void 0,tabIndex:s?0:void 0,title:c,onClick:n,onKeyDown:s?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n?.(e))}:void 0,className:t(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,a.className,s&&`cursor-pointer hover:brightness-125 focus:outline-none focus:ring-1 focus:ring-current`,i),children:[(0,Z.jsx)(o,{className:`h-2.5 w-2.5 shrink-0`}),!r&&(0,Z.jsx)(`span`,{children:a.label})]})}function $(e,t){let n=e.keep;return n&&(n.until===void 0||n.until>t)?n:void 0}function Te(e){return`Kept ${e.until?`until ${new Date(e.until).toLocaleString()}`:`until cleared`}${e.reason?` — ${e.reason}`:``}. Excluded from idle digests and automatic cleanup.`}function Ee({agent:e,now:t}){let n=o(e=>e.setAgentKeep),r=$(e,t);return r?(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":`true`,title:`${Te(r)} Click to release.`,className:`mt-1 inline-flex h-5 items-center gap-1 rounded-full border border-tone-sky/30 bg-tone-sky/10 px-1.5 text-[10px] font-medium text-tone-sky-fg hover:bg-tone-sky/15`,onClick:t=>{t.stopPropagation(),n(e,!1)},children:[(0,Z.jsx)(I,{className:`h-3 w-3`}),`Kept`]}):null}function De({agent:e,now:t}){let n=o(e=>e.setAgentKeep),r=!!$(e,t);return(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,"aria-pressed":r,title:r?`Release keep`:`Keep — exclude from idle digests and automatic cleanup`,onClick:()=>void n(e,!r),children:r?(0,Z.jsx)(F,{className:`w-3 h-3`}):(0,Z.jsx)(I,{className:`w-3 h-3`})})}function Oe({agent:e}){let t=o(e=>e.users.length>1),n=o(t=>e.principalUserId?t.usersById[e.principalUserId]:void 0);if(!t||!e.principalUserId)return null;let r=n?.displayName||n?.handle||e.principalUserId;return(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1 text-[10px] text-muted-foreground`,"data-testid":`agent-principal`,title:`Works for ${r}`,children:[(0,Z.jsx)(Y,{user:n,address:`user:${e.principalUserId}`,distinct:!0,className:`size-3.5 rounded text-[8px]`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`for `,r]})]})}function ke(e,t){return e.agent===t.agent&&e.parentAgent===t.parentAgent&&i(e.childAgents??[],t.childAgents??[])}var Ae=(0,X.memo)(function({agent:e,childAgents:t=[],parentAgent:n}){let r=a();o(e=>e.set);let i=o(e=>e.switchView),c=o(e=>e.openInboxThread),l=o(e=>e.openAgentDetail),y=o(e=>e.openPairInvite),T=o(e=>e.openRename),E=o(e=>e.openConfirm),D=o(e=>e.doAgentAction),O=o(e=>e.doDeleteAgent),k=o(e=>e.openFilesForAgent),A=o(e=>e.workspaceAction),j=o(e=>e.openWorkspaceFocus),{terminalOpen:M,terminalTarget:N,terminalOpening:F,openTerminal:I,closeTerminal:L}=Se(e.id),R=ge(),B=d(r,e,he(e),R[e.id]||null),V=g(e,`shutdown`),W=g(e,`compact`),G=g(e,`clearContext`),K=!!(e.providerCapabilities?.terminal?.live?.read||e.providerCapabilities?.terminal?.attach?.create),q=_(e,K),Y=m(e),X=n?p(n):e.spawnedBy,Q=t.length>0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xe,{className:`group hover:border-tone-neutral transition-colors cursor-pointer`,onClick:()=>l(e),children:(0,Z.jsxs)(be,{className:`p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 mb-2.5`,children:[(0,Z.jsx)(J,{agent:e,now:r,className:`mt-0.5`}),(0,Z.jsx)(z,{agent:e}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,Z.jsx)(ye,{profile:ve(e),className:`text-sm shrink-0`}),(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:p(e)})]}),(0,Z.jsx)(`div`,{className:`text-xs mt-0.5 ${h(B.tone)}`,children:B.label}),typeof e.meta?.cwd==`string`&&e.meta.cwd&&(0,Z.jsx)(`button`,{type:`button`,className:`mt-0.5 block max-w-full truncate font-mono text-[10px] text-muted-foreground hover:text-foreground`,title:`Open ${e.meta.cwd} in Files`,onClick:t=>{t.stopPropagation(),k(e)},children:u(e.meta.cwd)}),e.landState&&(0,Z.jsxs)(`div`,{className:`mt-1 text-[10px] text-tone-violet-fg`,children:[e.landState,e.landWaitReason?` · ${e.landWaitReason}`:``]}),(0,Z.jsx)(ce,{agent:e,className:`mt-1`}),(0,Z.jsx)(Ee,{agent:e,now:r}),(0,Z.jsx)(Oe,{agent:e})]}),e.branchState&&e.branchWorkspaceId&&(0,Z.jsx)(we,{state:e.branchState,className:`mt-0.5 shrink-0`,onClick:t=>{t.stopPropagation(),j(e.branchWorkspaceId)}})]}),B.badges.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:B.badges.map(e=>(0,Z.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium ${e.className}`,children:e.label},e.label))}),(Q||e.spawnedBy&&X)&&(0,Z.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,onClick:e=>e.stopPropagation(),children:[Q&&(0,Z.jsxs)(w,{children:[(0,Z.jsx)(b,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex h-6 max-w-full items-center gap-1.5 rounded-full border border-tone-sky/30 bg-tone-sky/10 px-2 text-[10px] font-medium text-tone-sky-fg transition-colors hover:bg-tone-sky/15`,title:`${t.length} live child ${t.length===1?`agent`:`agents`}`,children:[(0,Z.jsx)(fe,{className:`h-3 w-3`}),(0,Z.jsx)(`span`,{children:t.length}),(0,Z.jsx)(`span`,{className:`flex -space-x-1`,children:t.slice(0,4).map(e=>(0,Z.jsx)(J,{agent:e,now:r,className:`h-2 w-2 ring-1 ring-background`},e.id))})]})}),(0,Z.jsxs)(S,{align:`start`,className:`w-80`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(C,{children:(0,Z.jsx)(x,{children:`Team`})}),(0,Z.jsx)(`div`,{className:`space-y-1.5`,children:t.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(J,{agent:e,now:r,className:`mt-1`}),(0,Z.jsx)(z,{agent:e}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-xs font-medium`,children:p(e)}),(0,Z.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.providerCapabilities?.model?.alias||e.providerCapabilities?.model?.id||e.providerCapabilities?.model?.provider||e.status})]}),(0,Z.jsx)(U,{variant:`outline`,className:`h-4 px-1.5 text-[9px]`,children:e.status})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex gap-1`,children:[(0,Z.jsx)(H,{size:`xs`,variant:`outline`,onClick:()=>l(e),children:`Open`}),(0,Z.jsxs)(H,{size:`xs`,variant:`ghost`,onClick:()=>{c(e.id),i(`chat`)},children:[(0,Z.jsx)(P,{className:`h-3 w-3`}),`Chat`]})]})]},e.id))})]})]}),e.spawnedBy&&X&&(0,Z.jsx)(U,{variant:`outline`,className:`max-w-full text-[10px] text-muted-foreground`,children:(0,Z.jsxs)(`span`,{className:`truncate`,children:[`spawned by `,(0,Z.jsx)(me,{agent:n,fallback:e.spawnedBy})]})})]}),(0,Z.jsx)(Ce,{agent:e}),(e.tags.length>0||v(e.capabilities).length>0)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 mb-2`,children:[e.tags.slice(0,3).map(e=>(0,Z.jsx)(U,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e)),v(e.capabilities).slice(0,2).map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))]}),(0,Z.jsxs)(`div`,{className:`space-y-2 mb-2`,children:[(0,Z.jsx)(ne,{agent:e}),(0,Z.jsx)(ee,{agent:e,compact:!0}),(0,Z.jsx)(re,{agent:e})]}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:!s(e.id)&&e.id!==`system`&&f(r,e.lastSeen)}),(0,Z.jsxs)(`div`,{className:`flex gap-1 mt-2.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(pe,{value:e.id,label:`Copy agent ID`,size:`icon`,className:`h-7 w-7`,iconClassName:`w-3 h-3`}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Chat`,onClick:()=>{c(e.id),i(`chat`)},children:(0,Z.jsx)(P,{className:`w-3 h-3`})}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Pair`,onClick:()=>y(e.id),children:(0,Z.jsx)(ae,{className:`w-3 h-3`})}),(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Rename`,onClick:()=>T(e),children:(0,Z.jsx)(se,{className:`w-3 h-3`})}),K&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Terminal`,disabled:F,onClick:()=>void I(),children:(0,Z.jsx)(ue,{className:`w-3 h-3`})}),(e.branchState===`changes`||e.branchState===`idle`)&&e.branchWorkspaceId&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-warning-fg hover:text-tone-warning-fg`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>E(`Mark Workspace Ready`,`Mark ${p(e)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>A(e.branchWorkspaceId,`ready`)),children:(0,Z.jsx)(ie,{className:`w-3 h-3`})}),e.kind!==`user`&&e.id!==`system`&&(0,Z.jsx)(De,{agent:e,now:r}),W&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Compact`,onClick:()=>E(`Compact Agent`,`Compact context for ${p(e)}?`,()=>D(e,`compact`,`agents-grid`)),children:(0,Z.jsx)(oe,{className:`w-3 h-3`})}),G&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7`,title:`Clear Context`,onClick:()=>E(`Clear Context`,`Clear context for ${p(e)}?`,()=>D(e,`clearContext`,`agents-grid`)),children:(0,Z.jsx)(te,{className:`w-3 h-3`})}),V&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Shutdown`,onClick:()=>E(`Shutdown Agent`,`Shutdown ${p(e)}?`,()=>D(e,`shutdown`,`agents-grid`)),children:(0,Z.jsx)(le,{className:`w-3 h-3`})}),Y&&(0,Z.jsx)(H,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-tone-danger-fg hover:text-tone-danger-fg`,title:`Forget stale agent`,onClick:()=>E(`Forget Agent`,`Forget ${p(e)}?`,()=>O(e.id)),children:(0,Z.jsx)(de,{className:`w-3 h-3`})})]})]})}),N&&(0,Z.jsx)(_e,{open:M,onOpenChange:L,orchestratorId:N.orchestratorId,session:N.session,interactive:N.interactive||q,canWrite:q,onSessionChanged:()=>void I()})]})},ke);function je(){let e=o(e=>e.agentPresetFilter),t=o(e=>e.agentStatusFilter),n=o(e=>e.agentTagFilter),r=o(e=>e.agentHostFilter),i=o(e=>e.agentSort),s=o(e=>e.agentSortDir),u=o(e=>e.showOffline),d=o(e=>e.setShowOffline),f=W(),p=o(e=>e.set),m=o(e=>e.openAgentSpawn),h=o(e=>e.agentsById),g=a(),_=G(),v=q(),y=K(),b=O(_,g),x=D(_,g),S=e||t||n||r;function C(){p({agentPresetFilter:``,agentStatusFilter:``,agentTagFilter:``,agentHostFilter:``})}function w(){p({agentSortDir:s===`asc`?`desc`:`asc`})}return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`select`,{value:e,onChange:e=>p({agentPresetFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`All agents`}),(0,Z.jsx)(`option`,{value:`active`,children:`Active`}),l().map(e=>(0,Z.jsx)(`option`,{value:e,children:c(e)},e)),(0,Z.jsx)(`option`,{value:`paired`,children:`Paired`}),(0,Z.jsx)(`option`,{value:`unpaired`,children:`Unpaired`}),(0,Z.jsx)(`option`,{value:`offline_stale`,children:`Offline / Stale`})]}),(0,Z.jsxs)(`select`,{value:t,onChange:e=>p({agentStatusFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any status`}),(0,Z.jsx)(`option`,{value:`online`,children:`Online`}),(0,Z.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,Z.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,Z.jsx)(`option`,{value:`offline`,children:`Offline`}),(0,Z.jsx)(`option`,{value:`starting`,children:`Starting`})]}),v.length>0&&(0,Z.jsxs)(`select`,{value:n,onChange:e=>p({agentTagFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any tag`}),v.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),y.length>1&&(0,Z.jsxs)(`select`,{value:r,onChange:e=>p({agentHostFilter:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:``,children:`Any host`}),y.map(e=>(0,Z.jsx)(`option`,{value:e,children:e},e))]}),(0,Z.jsxs)(`select`,{value:i,onChange:e=>p({agentSort:e.target.value}),className:`h-8 rounded-md border border-border bg-card text-sm px-2 text-foreground`,children:[(0,Z.jsx)(`option`,{value:`status`,children:`Sort: Status`}),(0,Z.jsx)(`option`,{value:`name`,children:`Sort: Name`}),(0,Z.jsx)(`option`,{value:`lastSeen`,children:`Sort: Last seen`}),(0,Z.jsx)(`option`,{value:`created`,children:`Sort: Created`})]}),(0,Z.jsx)(H,{size:`icon`,variant:`outline`,className:`h-8 w-8`,title:`Toggle sort direction`,onClick:w,children:s===`asc`?(0,Z.jsx)(E,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(A,{className:`w-3.5 h-3.5`})}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground cursor-pointer select-none`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),className:`rounded`}),`Show offline`,f>0?` (${f})`:``]}),S&&(0,Z.jsxs)(H,{size:`sm`,variant:`ghost`,className:`h-8 text-muted-foreground hover:text-foreground gap-1`,onClick:C,children:[(0,Z.jsx)(V,{className:`w-3 h-3`}),`Clear filters`]}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsxs)(H,{size:`sm`,onClick:m,className:`gap-1`,children:[(0,Z.jsx)(L,{className:`w-3.5 h-3.5`}),`Spawn`]})})]}),x.length===0?(0,Z.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No agents match the current filters.`}):(0,Z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-3`,children:x.map(e=>(0,Z.jsx)(Ae,{agent:e,parentAgent:e.spawnedBy?h[e.spawnedBy]??null:null,childAgents:k(b.get(e.id)??[])},e.id))})]})}export{je as AgentsView};
|
|
2
|
+
//# sourceMappingURL=agents-DIZG97_X.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-BgDALGIX.js";import{M as a,r as o,t as s}from"./provider-display-bWwiuedV.js";import{o as c}from"./artifacts-Bjq-ZyBA.js";import{t as l}from"./api-CIIVBtAV.js";import{t as u}from"./themes-G5j9m1Ji.js";import{i as d,r as f,t as p}from"./tabs-jZgNvNHr.js";import{t as m}from"./bot-B0NpDNhr.js";import{t as h}from"./clock-BWPPBh1_.js";import{n as g,t as _}from"./repeat-hl4p_Klo.js";import{t as v}from"./message-square-C-1G8dMM.js";import{t as y}from"./wrench-C7-4CgnY.js";import{t as b}from"./agent-name-C_7F4DFR.js";import{o as x,r as S,s as C,t as w}from"./card-C4QJ4hCW.js";import{r as T}from"./shipping-stats-BiMTsA4A.js";var E=[`iterate`,`delivery`,`land`,`mainCi`],D=e(n(),1);function O(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function A(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function M(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ae(r.key),r)}}function N(e,t,n){return t&&M(e.prototype,t),n&&M(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function P(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=se(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function F(e){var t=ee();return function(){var n,r=L(e);if(t){var i=L(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return k(e)}(this,n)}}function I(e,t,n){return(t=ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},L(e)}function R(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ne(e,t)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(ee=function(){return!!e})()}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?te(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(e,t)}function re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(e,t)||se(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ie(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}(e)||se(e)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function ae(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:t+``}function oe(e){return oe=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},oe(e)}function se(e,t){if(e){if(typeof e==`string`)return O(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}var B=function(){function e(){A(this,e)}return N(e,[{key:`shadeRGBColor`,value:function(e,t){var n=t.split(`,`),r=e<0?0:255,i=e<0?-1*e:e,a=parseInt(n[0].slice(4),10),o=parseInt(n[1],10),s=parseInt(n[2],10);return`rgb(`+(Math.round((r-a)*i)+a)+`,`+(Math.round((r-o)*i)+o)+`,`+(Math.round((r-s)*i)+s)+`)`}},{key:`shadeHexColor`,value:function(e,t){var n=parseInt(t.slice(1),16),r=e<0?0:255,i=e<0?-1*e:e,a=n>>16,o=n>>8&255,s=255&n;return`#`+(16777216+65536*(Math.round((r-a)*i)+a)+256*(Math.round((r-o)*i)+o)+(Math.round((r-s)*i)+s)).toString(16).slice(1)}},{key:`shadeColor`,value:function(t,n){return e.isColorHex(n)?this.shadeHexColor(t,n):this.shadeRGBColor(t,n)}}],[{key:`bind`,value:function(e,t){return function(){return e.apply(t,arguments)}}},{key:`isObject`,value:function(e){return e&&oe(e)===`object`&&!Array.isArray(e)&&e!=null}},{key:`is`,value:function(e,t){return Object.prototype.toString.call(t)===`[object `+e+`]`}},{key:`isSafari`,value:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}},{key:`listToArray`,value:function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n}},{key:`extend`,value:function(e,t){var n=this;typeof Object.assign!=`function`&&(Object.assign=function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!=null)for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t});var r=Object.assign({},e);return this.isObject(e)&&this.isObject(t)&&Object.keys(t).forEach((function(i){n.isObject(t[i])&&i in e?r[i]=n.extend(e[i],t[i]):Object.assign(r,I({},i,t[i]))})),r}},{key:`extendArray`,value:function(t,n){var r=[];return t.map((function(t){r.push(e.extend(n,t))})),t=r}},{key:`monthMod`,value:function(e){return e%12}},{key:`clone`,value:function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new WeakMap;if(e===null||oe(e)!==`object`)return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){t=[],n.set(e,t);for(var r=0;r<e.length;r++)t[r]=this.clone(e[r],n)}else if(e instanceof Date)t=new Date(e.getTime());else for(var i in t={},n.set(e,t),e)e.hasOwnProperty(i)&&(t[i]=this.clone(e[i],n));return t}},{key:`log10`,value:function(e){return Math.log(e)/Math.LN10}},{key:`roundToBase10`,value:function(e){return 10**Math.floor(Math.log10(e))}},{key:`roundToBase`,value:function(e,t){return t**+Math.floor(Math.log(e)/Math.log(t))}},{key:`parseNumber`,value:function(e){return e===null?e:parseFloat(e)}},{key:`stripNumber`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Number.isInteger(e)?e:parseFloat(e.toPrecision(t))}},{key:`randomId`,value:function(){return(Math.random()+1).toString(36).substring(4)}},{key:`noExponents`,value:function(e){return e.toString().includes(`e`)?Math.round(e):e}},{key:`elementExists`,value:function(e){return!(!e||!e.isConnected)}},{key:`getDimensions`,value:function(e){var t=getComputedStyle(e,null),n=e.clientHeight,r=e.clientWidth;return n-=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),[r-=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),n]}},{key:`getBoundingClientRect`,value:function(e){var t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:e.clientWidth,height:e.clientHeight,x:t.left,y:t.top}}},{key:`getLargestStringFromArr`,value:function(e){return e.reduce((function(e,t){return Array.isArray(t)&&(t=t.reduce((function(e,t){return e.length>t.length?e:t}))),e.length>t.length?e:t}),0)}},{key:`hexToRgba`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`#999999`,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.6;e.substring(0,1)!==`#`&&(e=`#999999`);var n=e.replace(`#`,``);n=n.match(RegExp(`(.{`+n.length/3+`})`,`g`));for(var r=0;r<n.length;r++)n[r]=parseInt(n[r].length===1?n[r]+n[r]:n[r],16);return t!==void 0&&n.push(t),`rgba(`+n.join(`,`)+`)`}},{key:`getOpacityFromRGBA`,value:function(e){return parseFloat(e.replace(/^.*,(.+)\)/,`$1`))}},{key:`rgb2hex`,value:function(e){return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&e.length===4?`#`+(`0`+parseInt(e[1],10).toString(16)).slice(-2)+(`0`+parseInt(e[2],10).toString(16)).slice(-2)+(`0`+parseInt(e[3],10).toString(16)).slice(-2):``}},{key:`isColorHex`,value:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(e)}},{key:`getPolygonPos`,value:function(e,t){for(var n=[],r=2*Math.PI/t,i=0;i<t;i++){var a={};a.x=e*Math.sin(i*r),a.y=-e*Math.cos(i*r),n.push(a)}return n}},{key:`polarToCartesian`,value:function(e,t,n,r){var i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}},{key:`escapeString`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`x`,n=e.toString().slice();return n=n.replace(/[` ~!@#$%^&*()|+\=?;:'",.<>{}[\]\\/]/gi,t)}},{key:`negToZero`,value:function(e){return e<0?0:e}},{key:`moveIndexInArray`,value:function(e,t,n){if(n>=e.length)for(var r=n-e.length+1;r--;)e.push(void 0);return e.splice(n,0,e.splice(t,1)[0]),e}},{key:`extractNumber`,value:function(e){return parseFloat(e.replace(/[^\d.]*/g,``))}},{key:`findAncestor`,value:function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e}},{key:`setELstyles`,value:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e.style.key=t[n])}},{key:`preciseAddition`,value:function(e,t){var n=(String(e).split(`.`)[1]||``).length,r=(String(t).split(`.`)[1]||``).length,i=10**Math.max(n,r);return(Math.round(e*i)+Math.round(t*i))/i}},{key:`isNumber`,value:function(e){return!isNaN(e)&&parseFloat(Number(e))===e&&!isNaN(parseInt(e,10))}},{key:`isFloat`,value:function(e){return Number(e)===e&&e%1!=0}},{key:`isMsEdge`,value:function(){var e=window.navigator.userAgent,t=e.indexOf(`Edge/`);return t>0&&parseInt(e.substring(t+5,e.indexOf(`.`,t)),10)}},{key:`getGCD`,value:function(e,t){var n=10**((arguments.length>2&&arguments[2]!==void 0?arguments[2]:7)-Math.floor(Math.log10(Math.max(e,t))));for(e=Math.round(Math.abs(e)*n),t=Math.round(Math.abs(t)*n);t;){var r=t;t=e%t,e=r}return e/n}},{key:`getPrimeFactors`,value:function(e){for(var t=[],n=2;e>=2;)e%n==0?(t.push(n),e/=n):n++;return t}},{key:`mod`,value:function(e,t){var n=10**((arguments.length>2&&arguments[2]!==void 0?arguments[2]:7)-Math.floor(Math.log10(Math.max(e,t))));return(e=Math.round(Math.abs(e)*n))%(t=Math.round(Math.abs(t)*n))/n}}]),e}(),ce=function(){function e(t){A(this,e),this.ctx=t,this.w=t.w}return N(e,[{key:`animateLine`,value:function(e,t,n,r){e.attr(t).animate(r).attr(n)}},{key:`animateMarker`,value:function(e,t,n,r){e.attr({opacity:0}).animate(t).attr({opacity:1}).after((function(){r()}))}},{key:`animateRect`,value:function(e,t,n,r,i){e.attr(t).animate(r).attr(n).after((function(){return i()}))}},{key:`animatePathsGradually`,value:function(e){var t=e.el,n=e.realIndex,r=e.j,i=e.fill,a=e.pathFrom,o=e.pathTo,s=e.speed,c=e.delay,l=this.w,u=0;l.config.chart.animations.animateGradually.enabled&&(u=l.config.chart.animations.animateGradually.delay),l.config.chart.animations.dynamicAnimation.enabled&&l.globals.dataChanged&&l.config.chart.type!==`bar`&&(u=0),this.morphSVG(t,n,r,l.config.chart.type!==`line`||l.globals.comboCharts?i:`stroke`,a,o,s,c*u)}},{key:`showDelayedElements`,value:function(){this.w.globals.delayedElements.forEach((function(e){var t=e.el;t.classList.remove(`apexcharts-element-hidden`),t.classList.add(`apexcharts-hidden-element-shown`)}))}},{key:`animationCompleted`,value:function(e){var t=this.w;t.globals.animationEnded||(t.globals.animationEnded=!0,this.showDelayedElements(),typeof t.config.chart.events.animationEnd==`function`&&t.config.chart.events.animationEnd(this.ctx,{el:e,w:t}))}},{key:`morphSVG`,value:function(e,t,n,r,i,a,o,s){var c=this,l=this.w;i||=e.attr(`pathFrom`),a||=e.attr(`pathTo`);var u=function(e){return l.config.chart.type===`radar`&&(o=1),`M 0 ${l.globals.gridHeight}`};(!i||i.indexOf(`undefined`)>-1||i.indexOf(`NaN`)>-1)&&(i=u()),(!a.trim()||a.indexOf(`undefined`)>-1||a.indexOf(`NaN`)>-1)&&(a=u()),l.globals.shouldAnimate||(o=1),e.plot(i).animate(1,s).plot(i).animate(o,s).plot(a).after((function(){B.isNumber(n)?n===l.globals.series[l.globals.maxValsInArrayIndex].length-2&&l.globals.shouldAnimate&&c.animationCompleted(e):r!==`none`&&l.globals.shouldAnimate&&(!l.globals.comboCharts&&t===l.globals.series.length-1||l.globals.comboCharts)&&c.animationCompleted(e),c.showDelayedElements()}))}}]),e}(),le={},ue=[];function V(e,t){if(Array.isArray(e))for(let n of e)V(n,t);else if(typeof e!=`object`)fe(Object.getOwnPropertyNames(t)),le[e]=Object.assign(le[e]||{},t);else for(let t in e)V(t,e[t])}function de(e){return le[e]||{}}function fe(e){ue.push(...e)}function pe(e,t){let n,r=e.length,i=[];for(n=0;n<r;n++)i.push(t(e[n]));return i}function me(e){return e%360*Math.PI/180}function he(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ge(e,t,n,r){return t!=null&&n!=null||(r||=e.bbox(),t==null?t=r.width/r.height*n:n??=r.height/r.width*t),{width:t,height:n}}function _e(e,t){let n=e.origin,r=e.ox==null?e.originX==null?`center`:e.originX:e.ox,i=e.oy==null?e.originY==null?`center`:e.originY:e.oy;n!=null&&([r,i]=Array.isArray(n)?n:typeof n==`object`?[n.x,n.y]:[n,n]);let a=typeof r==`string`,o=typeof i==`string`;if(a||o){let{height:e,width:n,x:s,y:c}=t.bbox();a&&(r=r.includes(`left`)?s:r.includes(`right`)?s+n:s+n/2),o&&(i=i.includes(`top`)?c:i.includes(`bottom`)?c+e:c+e/2)}return[r,i]}var ve=new Set([`desc`,`metadata`,`title`]),ye=e=>ve.has(e.nodeName),be=(e,t,n={})=>{let r={...t};for(let e in r)r[e].valueOf()===n[e]&&delete r[e];Object.keys(r).length?e.node.setAttribute(`data-svgjs`,JSON.stringify(r)):(e.node.removeAttribute(`data-svgjs`),e.node.removeAttribute(`svgjs:data`))},xe=`http://www.w3.org/2000/svg`,Se=`http://www.w3.org/2000/xmlns/`,Ce=`http://www.w3.org/1999/xlink`,H={window:typeof window>`u`?null:window,document:typeof document>`u`?null:document};function we(){return H.window}var Te=class{},Ee={},De=`___SYMBOL___ROOT___`;function Oe(e,t=xe){return H.document.createElementNS(t,e)}function ke(e,t=!1){if(e instanceof Te)return e;if(typeof e==`object`)return je(e);if(e==null)return new Ee[De];if(typeof e==`string`&&e.charAt(0)!==`<`)return je(H.document.querySelector(e));let n=t?H.document.createElement(`div`):Oe(`svg`);return n.innerHTML=e,e=je(n.firstChild),n.removeChild(n.firstChild),e}function U(e,t){return t&&(t instanceof H.window.Node||t.ownerDocument&&t instanceof t.ownerDocument.defaultView.Node)?t:Oe(e)}function Ae(e){if(!e)return null;if(e.instance instanceof Te)return e.instance;if(e.nodeName===`#document-fragment`)return new Ee.Fragment(e);let t=he(e.nodeName||`Dom`);return t===`LinearGradient`||t===`RadialGradient`?t=`Gradient`:Ee[t]||(t=`Dom`),new Ee[t](e)}var je=Ae;function W(e,t=e.name,n=!1){return Ee[t]=e,n&&(Ee[De]=e),fe(Object.getOwnPropertyNames(e.prototype)),e}var Me=1e3;function Ne(e){return`Svgjs`+he(e)+Me++}function Pe(e){for(let t=e.children.length-1;t>=0;t--)Pe(e.children[t]);return e.id&&=Ne(e.nodeName),e}function G(e,t){let n,r;for(r=(e=Array.isArray(e)?e:[e]).length-1;r>=0;r--)for(n in t)e[r].prototype[n]=t[n]}function K(e){return function(...t){let n=t[t.length-1];return!n||n.constructor!==Object||n instanceof Array?e.apply(this,t):e.apply(this,t.slice(0,-1)).attr(n)}}V(`Dom`,{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},prev:function(){return this.siblings()[this.position()-1]},forward:function(){let e=this.position();return this.parent().add(this.remove(),e+1),this},backward:function(){let e=this.position();return this.parent().add(this.remove(),e?e-1:0),this},front:function(){return this.parent().add(this.remove()),this},back:function(){return this.parent().add(this.remove(),0),this},before:function(e){(e=ke(e)).remove();let t=this.position();return this.parent().add(e,t),this},after:function(e){(e=ke(e)).remove();let t=this.position();return this.parent().add(e,t+1),this},insertBefore:function(e){return(e=ke(e)).before(this),this},insertAfter:function(e){return(e=ke(e)).after(this),this}});var Fe=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,Ie=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Le=/rgb\((\d+),(\d+),(\d+)\)/,Re=/(#[a-z_][a-z0-9\-_]*)/i,ze=/\)\s*,?\s*/,Be=/\s/g,Ve=/^#[a-f0-9]{3}$|^#[a-f0-9]{6}$/i,He=/^rgb\(/,Ue=/^(\s+)?$/,We=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ge=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,Ke=/[\s,]+/,qe=/[MLHVCSQTAZ]/i;function Je(e){let t=Math.max(0,Math.min(255,Math.round(e))).toString(16);return t.length===1?`0`+t:t}function Ye(e,t){for(let n=t.length;n--;)if(e[t[n]]==null)return!1;return!0}function Xe(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}V(`Dom`,{classes:function(){let e=this.attr(`class`);return e==null?[]:e.trim().split(Ke)},hasClass:function(e){return this.classes().indexOf(e)!==-1},addClass:function(e){if(!this.hasClass(e)){let t=this.classes();t.push(e),this.attr(`class`,t.join(` `))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr(`class`,this.classes().filter((function(t){return t!==e})).join(` `)),this},toggleClass:function(e){return this.hasClass(e)?this.removeClass(e):this.addClass(e)}}),V(`Dom`,{css:function(e,t){let n={};if(arguments.length===0)return this.node.style.cssText.split(/\s*;\s*/).filter((function(e){return!!e.length})).forEach((function(e){let t=e.split(/\s*:\s*/);n[t[0]]=t[1]})),n;if(arguments.length<2){if(Array.isArray(e)){for(let t of e){let e=t;n[t]=this.node.style.getPropertyValue(e)}return n}if(typeof e==`string`)return this.node.style.getPropertyValue(e);if(typeof e==`object`)for(let t in e)this.node.style.setProperty(t,e[t]==null||Ue.test(e[t])?``:e[t])}return arguments.length===2&&this.node.style.setProperty(e,t==null||Ue.test(t)?``:t),this},show:function(){return this.css(`display`,``)},hide:function(){return this.css(`display`,`none`)},visible:function(){return this.css(`display`)!==`none`}}),V(`Dom`,{data:function(e,t,n){if(e==null)return this.data(pe(function(e,t){let n,r=e.length,i=[];for(n=0;n<r;n++)t(e[n])&&i.push(e[n]);return i}(this.node.attributes,(e=>e.nodeName.indexOf(`data-`)===0)),(e=>e.nodeName.slice(5))));if(e instanceof Array){let t={};for(let n of e)t[n]=this.data(n);return t}if(typeof e==`object`)for(t in e)this.data(t,e[t]);else if(arguments.length<2)try{return JSON.parse(this.attr(`data-`+e))}catch{return this.attr(`data-`+e)}else this.attr(`data-`+e,t===null?null:!0===n||typeof t==`string`||typeof t==`number`?t:JSON.stringify(t));return this}}),V(`Dom`,{remember:function(e,t){if(typeof arguments[0]==`object`)for(let t in e)this.remember(t,e[t]);else{if(arguments.length===1)return this.memory()[e];this.memory()[e]=t}return this},forget:function(){if(arguments.length===0)this._memory={};else for(let e=arguments.length-1;e>=0;e--)delete this.memory()[arguments[e]];return this},memory:function(){return this._memory=this._memory||{}}});var Ze=class e{constructor(...e){this.init(...e)}static isColor(t){return t&&(t instanceof e||this.isRgb(t)||this.test(t))}static isRgb(e){return e&&typeof e.r==`number`&&typeof e.g==`number`&&typeof e.b==`number`}static random(t=`vibrant`,n){let{random:r,round:i,sin:a,PI:o}=Math;if(t===`vibrant`){let t=24*r()+57,n=38*r()+45,i=360*r();return new e(t,n,i,`lch`)}if(t===`sine`){let t=i(80*a(2*o*(n??=r())/.5+.01)+150),s=i(50*a(2*o*n/.5+4.6)+200),c=i(100*a(2*o*n/.5+2.3)+150);return new e(t,s,c)}if(t===`pastel`){let t=8*r()+86,n=17*r()+9,i=360*r();return new e(t,n,i,`lch`)}if(t===`dark`){let t=10+10*r(),n=50*r()+86,i=360*r();return new e(t,n,i,`lch`)}if(t===`rgb`){let t=255*r(),n=255*r(),i=255*r();return new e(t,n,i)}if(t===`lab`){let t=100*r(),n=256*r()-128,i=256*r()-128;return new e(t,n,i,`lab`)}if(t===`grey`){let t=255*r();return new e(t,t,t)}throw Error(`Unsupported random color mode`)}static test(e){return typeof e==`string`&&(Ve.test(e)||He.test(e))}cmyk(){let{_a:t,_b:n,_c:r}=this.rgb(),[i,a,o]=[t,n,r].map((e=>e/255)),s=Math.min(1-i,1-a,1-o);return s===1?new e(0,0,0,1,`cmyk`):new e((1-i-s)/(1-s),(1-a-s)/(1-s),(1-o-s)/(1-s),s,`cmyk`)}hsl(){let{_a:t,_b:n,_c:r}=this.rgb(),[i,a,o]=[t,n,r].map((e=>e/255)),s=Math.max(i,a,o),c=Math.min(i,a,o),l=(s+c)/2,u=s===c,d=s-c;return new e(360*(u?0:s===i?((a-o)/d+(a<o?6:0))/6:s===a?((o-i)/d+2)/6:s===o?((i-a)/d+4)/6:0),100*(u?0:l>.5?d/(2-s-c):d/(s+c)),100*l,`hsl`)}init(e=0,t=0,n=0,r=0,i=`rgb`){if(e||=0,this.space)for(let e in this.space)delete this[this.space[e]];if(typeof e==`number`)i=typeof r==`string`?r:i,r=typeof r==`string`?0:r,Object.assign(this,{_a:e,_b:t,_c:n,_d:r,space:i});else if(e instanceof Array)this.space=t||(typeof e[3]==`string`?e[3]:e[4])||`rgb`,Object.assign(this,{_a:e[0],_b:e[1],_c:e[2],_d:e[3]||0});else if(e instanceof Object){let n=function(e,t){let n=Ye(e,`rgb`)?{_a:e.r,_b:e.g,_c:e.b,_d:0,space:`rgb`}:Ye(e,`xyz`)?{_a:e.x,_b:e.y,_c:e.z,_d:0,space:`xyz`}:Ye(e,`hsl`)?{_a:e.h,_b:e.s,_c:e.l,_d:0,space:`hsl`}:Ye(e,`lab`)?{_a:e.l,_b:e.a,_c:e.b,_d:0,space:`lab`}:Ye(e,`lch`)?{_a:e.l,_b:e.c,_c:e.h,_d:0,space:`lch`}:Ye(e,`cmyk`)?{_a:e.c,_b:e.m,_c:e.y,_d:e.k,space:`cmyk`}:{_a:0,_b:0,_c:0,space:`rgb`};return n.space=t||n.space,n}(e,t);Object.assign(this,n)}else if(typeof e==`string`)if(He.test(e)){let t=e.replace(Be,``),[n,r,i]=Le.exec(t).slice(1,4).map((e=>parseInt(e)));Object.assign(this,{_a:n,_b:r,_c:i,_d:0,space:`rgb`})}else{if(!Ve.test(e))throw Error(`Unsupported string format, can't construct Color`);{let[,t,n,r]=Ie.exec(function(e){return e.length===4?[`#`,e.substring(1,2),e.substring(1,2),e.substring(2,3),e.substring(2,3),e.substring(3,4),e.substring(3,4)].join(``):e}(e)).map(e=>parseInt(e,16));Object.assign(this,{_a:t,_b:n,_c:r,_d:0,space:`rgb`})}}let{_a:a,_b:o,_c:s,_d:c}=this,l=this.space===`rgb`?{r:a,g:o,b:s}:this.space===`xyz`?{x:a,y:o,z:s}:this.space===`hsl`?{h:a,s:o,l:s}:this.space===`lab`?{l:a,a:o,b:s}:this.space===`lch`?{l:a,c:o,h:s}:this.space===`cmyk`?{c:a,m:o,y:s,k:c}:{};Object.assign(this,l)}lab(){let{x:t,y:n,z:r}=this.xyz();return new e(116*n-16,500*(t-n),200*(n-r),`lab`)}lch(){let{l:t,a:n,b:r}=this.lab(),i=Math.sqrt(n**2+r**2),a=180*Math.atan2(r,n)/Math.PI;return a<0&&(a*=-1,a=360-a),new e(t,i,a,`lch`)}rgb(){if(this.space===`rgb`)return this;if((t=this.space)===`lab`||t===`xyz`||t===`lch`){let{x:t,y:n,z:r}=this;if(this.space===`lab`||this.space===`lch`){let{l:e,a:i,b:a}=this;if(this.space===`lch`){let{c:e,h:t}=this,n=Math.PI/180;i=e*Math.cos(n*t),a=e*Math.sin(n*t)}let o=(e+16)/116,s=i/500+o,c=o-a/200,l=16/116,u=.008856,d=7.787;t=.95047*(s**3>u?s**3:(s-l)/d),n=1*(o**3>u?o**3:(o-l)/d),r=1.08883*(c**3>u?c**3:(c-l)/d)}let i=3.2406*t+-1.5372*n+-.4986*r,a=-.9689*t+1.8758*n+.0415*r,o=.0557*t+-.204*n+1.057*r,s=Math.pow,c=.0031308,l=i>c?1.055*s(i,1/2.4)-.055:12.92*i,u=a>c?1.055*s(a,1/2.4)-.055:12.92*a,d=o>c?1.055*s(o,1/2.4)-.055:12.92*o;return new e(255*l,255*u,255*d)}if(this.space===`hsl`){let{h:t,s:n,l:r}=this;if(t/=360,n/=100,r/=100,n===0)return r*=255,new e(r,r,r);let i=r<.5?r*(1+n):r+n-r*n,a=2*r-i,o=255*Xe(a,i,t+1/3),s=255*Xe(a,i,t),c=255*Xe(a,i,t-1/3);return new e(o,s,c)}if(this.space===`cmyk`){let{c:t,m:n,y:r,k:i}=this,a=255*(1-Math.min(1,t*(1-i)+i)),o=255*(1-Math.min(1,n*(1-i)+i)),s=255*(1-Math.min(1,r*(1-i)+i));return new e(a,o,s)}return this;var t}toArray(){let{_a:e,_b:t,_c:n,_d:r,space:i}=this;return[e,t,n,r,i]}toHex(){let[e,t,n]=this._clamped().map(Je);return`#${e}${t}${n}`}toRgb(){let[e,t,n]=this._clamped();return`rgb(${e},${t},${n})`}toString(){return this.toHex()}xyz(){let{_a:t,_b:n,_c:r}=this.rgb(),[i,a,o]=[t,n,r].map((e=>e/255)),s=i>.04045?((i+.055)/1.055)**2.4:i/12.92,c=a>.04045?((a+.055)/1.055)**2.4:a/12.92,l=o>.04045?((o+.055)/1.055)**2.4:o/12.92,u=(.4124*s+.3576*c+.1805*l)/.95047,d=(.2126*s+.7152*c+.0722*l)/1,f=(.0193*s+.1192*c+.9505*l)/1.08883,p=u>.008856?u**(1/3):7.787*u+16/116,m=d>.008856?d**(1/3):7.787*d+16/116,h=f>.008856?f**(1/3):7.787*f+16/116;return new e(p,m,h,`xyz`)}_clamped(){let{_a:e,_b:t,_c:n}=this.rgb(),{max:r,min:i,round:a}=Math;return[e,t,n].map((e=>r(0,i(a(e),255))))}},q=class e{constructor(...e){this.init(...e)}clone(){return new e(this)}init(e,t){let n=Array.isArray(e)?{x:e[0],y:e[1]}:typeof e==`object`?{x:e.x,y:e.y}:{x:e,y:t};return this.x=n.x==null?0:n.x,this.y=n.y==null?0:n.y,this}toArray(){return[this.x,this.y]}transform(e){return this.clone().transformO(e)}transformO(e){J.isMatrixLike(e)||(e=new J(e));let{x:t,y:n}=this;return this.x=e.a*t+e.c*n+e.e,this.y=e.b*t+e.d*n+e.f,this}};function Qe(e,t,n){return Math.abs(t-e)<(n||1e-6)}var J=class e{constructor(...e){this.init(...e)}static formatTransforms(e){let t=e.flip===`both`||!0===e.flip,n=e.flip&&(t||e.flip===`x`)?-1:1,r=e.flip&&(t||e.flip===`y`)?-1:1,i=e.skew&&e.skew.length?e.skew[0]:isFinite(e.skew)?e.skew:isFinite(e.skewX)?e.skewX:0,a=e.skew&&e.skew.length?e.skew[1]:isFinite(e.skew)?e.skew:isFinite(e.skewY)?e.skewY:0,o=e.scale&&e.scale.length?e.scale[0]*n:isFinite(e.scale)?e.scale*n:isFinite(e.scaleX)?e.scaleX*n:n,s=e.scale&&e.scale.length?e.scale[1]*r:isFinite(e.scale)?e.scale*r:isFinite(e.scaleY)?e.scaleY*r:r,c=e.shear||0,l=e.rotate||e.theta||0,u=new q(e.origin||e.around||e.ox||e.originX,e.oy||e.originY),d=u.x,f=u.y,p=new q(e.position||e.px||e.positionX||NaN,e.py||e.positionY||NaN),m=p.x,h=p.y,g=new q(e.translate||e.tx||e.translateX,e.ty||e.translateY),_=g.x,v=g.y,y=new q(e.relative||e.rx||e.relativeX,e.ry||e.relativeY);return{scaleX:o,scaleY:s,skewX:i,skewY:a,shear:c,theta:l,rx:y.x,ry:y.y,tx:_,ty:v,ox:d,oy:f,px:m,py:h}}static fromArray(e){return{a:e[0],b:e[1],c:e[2],d:e[3],e:e[4],f:e[5]}}static isMatrixLike(e){return e.a!=null||e.b!=null||e.c!=null||e.d!=null||e.e!=null||e.f!=null}static matrixMultiply(e,t,n){let r=e.a*t.a+e.c*t.b,i=e.b*t.a+e.d*t.b,a=e.a*t.c+e.c*t.d,o=e.b*t.c+e.d*t.d,s=e.e+e.a*t.e+e.c*t.f,c=e.f+e.b*t.e+e.d*t.f;return n.a=r,n.b=i,n.c=a,n.d=o,n.e=s,n.f=c,n}around(e,t,n){return this.clone().aroundO(e,t,n)}aroundO(e,t,n){let r=e||0,i=t||0;return this.translateO(-r,-i).lmultiplyO(n).translateO(r,i)}clone(){return new e(this)}decompose(e=0,t=0){let n=this.a,r=this.b,i=this.c,a=this.d,o=this.e,s=this.f,c=n*a-r*i,l=c>0?1:-1,u=l*Math.sqrt(n*n+r*r),d=Math.atan2(l*r,l*n),f=180/Math.PI*d,p=Math.cos(d),m=Math.sin(d),h=(n*i+r*a)/c,g=i*u/(h*n-r)||a*u/(h*r+n);return{scaleX:u,scaleY:g,shear:h,rotate:f,translateX:o-e+e*p*u+t*(h*p*u-m*g),translateY:s-t+e*m*u+t*(h*m*u+p*g),originX:e,originY:t,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}equals(t){if(t===this)return!0;let n=new e(t);return Qe(this.a,n.a)&&Qe(this.b,n.b)&&Qe(this.c,n.c)&&Qe(this.d,n.d)&&Qe(this.e,n.e)&&Qe(this.f,n.f)}flip(e,t){return this.clone().flipO(e,t)}flipO(e,t){return e===`x`?this.scaleO(-1,1,t,0):e===`y`?this.scaleO(1,-1,0,t):this.scaleO(-1,-1,e,t||e)}init(t){let n=e.fromArray([1,0,0,1,0,0]);return t=t instanceof St?t.matrixify():typeof t==`string`?e.fromArray(t.split(Ke).map(parseFloat)):Array.isArray(t)?e.fromArray(t):typeof t==`object`&&e.isMatrixLike(t)?t:typeof t==`object`?new e().transform(t):arguments.length===6?e.fromArray([].slice.call(arguments)):n,this.a=t.a==null?n.a:t.a,this.b=t.b==null?n.b:t.b,this.c=t.c==null?n.c:t.c,this.d=t.d==null?n.d:t.d,this.e=t.e==null?n.e:t.e,this.f=t.f==null?n.f:t.f,this}inverse(){return this.clone().inverseO()}inverseO(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.e,a=this.f,o=e*r-t*n;if(!o)throw Error(`Cannot invert `+this);let s=r/o,c=-t/o,l=-n/o,u=e/o,d=-(s*i+l*a),f=-(c*i+u*a);return this.a=s,this.b=c,this.c=l,this.d=u,this.e=d,this.f=f,this}lmultiply(e){return this.clone().lmultiplyO(e)}lmultiplyO(t){let n=t instanceof e?t:new e(t);return e.matrixMultiply(n,this,this)}multiply(e){return this.clone().multiplyO(e)}multiplyO(t){let n=t instanceof e?t:new e(t);return e.matrixMultiply(this,n,this)}rotate(e,t,n){return this.clone().rotateO(e,t,n)}rotateO(e,t=0,n=0){e=me(e);let r=Math.cos(e),i=Math.sin(e),{a,b:o,c:s,d:c,e:l,f:u}=this;return this.a=a*r-o*i,this.b=o*r+a*i,this.c=s*r-c*i,this.d=c*r+s*i,this.e=l*r-u*i+n*i-t*r+t,this.f=u*r+l*i-t*i-n*r+n,this}scale(){return this.clone().scaleO(...arguments)}scaleO(e,t=e,n=0,r=0){arguments.length===3&&(r=n,n=t,t=e);let{a:i,b:a,c:o,d:s,e:c,f:l}=this;return this.a=i*e,this.b=a*t,this.c=o*e,this.d=s*t,this.e=c*e-n*e+n,this.f=l*t-r*t+r,this}shear(e,t,n){return this.clone().shearO(e,t,n)}shearO(e,t=0,n=0){let{a:r,b:i,c:a,d:o,e:s,f:c}=this;return this.a=r+i*e,this.c=a+o*e,this.e=s+c*e-n*e,this}skew(){return this.clone().skewO(...arguments)}skewO(e,t=e,n=0,r=0){arguments.length===3&&(r=n,n=t,t=e),e=me(e),t=me(t);let i=Math.tan(e),a=Math.tan(t),{a:o,b:s,c,d:l,e:u,f:d}=this;return this.a=o+s*i,this.b=s+o*a,this.c=c+l*i,this.d=l+c*a,this.e=u+d*i-r*i,this.f=d+u*a-n*a,this}skewX(e,t,n){return this.skew(e,0,t,n)}skewY(e,t,n){return this.skew(0,e,t,n)}toArray(){return[this.a,this.b,this.c,this.d,this.e,this.f]}toString(){return`matrix(`+this.a+`,`+this.b+`,`+this.c+`,`+this.d+`,`+this.e+`,`+this.f+`)`}transform(t){if(e.isMatrixLike(t))return new e(t).multiplyO(this);let n=e.formatTransforms(t),{x:r,y:i}=new q(n.ox,n.oy).transform(this),a=new e().translateO(n.rx,n.ry).lmultiplyO(this).translateO(-r,-i).scaleO(n.scaleX,n.scaleY).skewO(n.skewX,n.skewY).shearO(n.shear).rotateO(n.theta).translateO(r,i);if(isFinite(n.px)||isFinite(n.py)){let e=new q(r,i).transform(a),t=isFinite(n.px)?n.px-e.x:0,o=isFinite(n.py)?n.py-e.y:0;a.translateO(t,o)}return a.translateO(n.tx,n.ty),a}translate(e,t){return this.clone().translateO(e,t)}translateO(e,t){return this.e+=e||0,this.f+=t||0,this}valueOf(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}};function $e(){if(!$e.nodes){let e=ke().size(2,0);e.node.style.cssText=[`opacity: 0`,`position: absolute`,`left: -100%`,`top: -100%`,`overflow: hidden`].join(`;`),e.attr(`focusable`,`false`),e.attr(`aria-hidden`,`true`),$e.nodes={svg:e,path:e.path().node}}if(!$e.nodes.svg.node.parentNode){let e=H.document.body||H.document.documentElement;$e.nodes.svg.addTo(e)}return $e.nodes}function et(e){return!(e.width||e.height||e.x||e.y)}W(J,`Matrix`);var tt=class e{constructor(...e){this.init(...e)}addOffset(){return this.x+=H.window.pageXOffset,this.y+=H.window.pageYOffset,new e(this)}init(e){return e=typeof e==`string`?e.split(Ke).map(parseFloat):Array.isArray(e)?e:typeof e==`object`?[e.left==null?e.x:e.left,e.top==null?e.y:e.top,e.width,e.height]:arguments.length===4?[].slice.call(arguments):[0,0,0,0],this.x=e[0]||0,this.y=e[1]||0,this.width=this.w=e[2]||0,this.height=this.h=e[3]||0,this.x2=this.x+this.w,this.y2=this.y+this.h,this.cx=this.x+this.w/2,this.cy=this.y+this.h/2,this}isNulled(){return et(this)}merge(t){let n=Math.min(this.x,t.x),r=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width)-n,a=Math.max(this.y+this.height,t.y+t.height)-r;return new e(n,r,i,a)}toArray(){return[this.x,this.y,this.width,this.height]}toString(){return this.x+` `+this.y+` `+this.width+` `+this.height}transform(t){t instanceof J||(t=new J(t));let n=1/0,r=-1/0,i=1/0,a=-1/0;return[new q(this.x,this.y),new q(this.x2,this.y),new q(this.x,this.y2),new q(this.x2,this.y2)].forEach((function(e){e=e.transform(t),n=Math.min(n,e.x),r=Math.max(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.y)})),new e(n,i,r-n,a-i)}};function nt(e,t,n){let r;try{if(r=t(e.node),et(r)&&(i=e.node)!==H.document&&!(H.document.documentElement.contains||function(e){for(;e.parentNode;)e=e.parentNode;return e===H.document}).call(H.document.documentElement,i))throw Error(`Element not in the dom`)}catch{r=n(e)}var i;return r}V({viewbox:{viewbox(e,t,n,r){return e==null?new tt(this.attr(`viewBox`)):this.attr(`viewBox`,new tt(e,t,n,r))},zoom(e,t){let{width:n,height:r}=this.attr([`width`,`height`]);if((n||r)&&typeof n!=`string`&&typeof r!=`string`||(n=this.node.clientWidth,r=this.node.clientHeight),!n||!r)throw Error(`Impossible to get absolute width and height. Please provide an absolute width and height attribute on the zooming element`);let i=this.viewbox(),a=n/i.width,o=r/i.height,s=Math.min(a,o);if(e==null)return s;let c=s/e;c===1/0&&(c=(2**53-1)/100),t||=new q(n/2/a+i.x,r/2/o+i.y);let l=new tt(i).transform(new J({scale:c,origin:t}));return this.viewbox(l)}}}),W(tt,`Box`);var rt=class extends Array{constructor(e=[],...t){if(super(e,...t),typeof e==`number`)return this;this.length=0,this.push(...e)}};G([rt],{each(e,...t){return typeof e==`function`?this.map(((t,n,r)=>e.call(t,t,n,r))):this.map((n=>n[e](...t)))},toArray(){return Array.prototype.concat.apply([],this)}});var it=[`toArray`,`constructor`,`each`];function at(e,t){return new rt(pe((t||H.document).querySelectorAll(e),(function(e){return Ae(e)})))}rt.extend=function(e){e=e.reduce(((e,t)=>(it.includes(t)||t[0]===`_`||(t in Array.prototype&&(e[`$`+t]=Array.prototype[t]),e[t]=function(...e){return this.each(t,...e)}),e)),{}),G([rt],e)};var ot=0,st={};function ct(e){let t=e.getEventHolder();return t===H.window&&(t=st),t.events||={},t.events}function lt(e){return e.getEventTarget()}function ut(e,t,n,r,i){let a=n.bind(r||e),o=ke(e),s=ct(o),c=lt(o);t=Array.isArray(t)?t:t.split(Ke),n._svgjsListenerId||=++ot,t.forEach((function(e){let t=e.split(`.`)[0],r=e.split(`.`)[1]||`*`;s[t]=s[t]||{},s[t][r]=s[t][r]||{},s[t][r][n._svgjsListenerId]=a,c.addEventListener(t,a,i||!1)}))}function dt(e,t,n,r){let i=ke(e),a=ct(i),o=lt(i);(typeof n!=`function`||(n=n._svgjsListenerId))&&(t=Array.isArray(t)?t:(t||``).split(Ke)).forEach((function(e){let t=e&&e.split(`.`)[0],s=e&&e.split(`.`)[1],c,l;if(n)a[t]&&a[t][s||`*`]&&(o.removeEventListener(t,a[t][s||`*`][n],r||!1),delete a[t][s||`*`][n]);else if(t&&s){if(a[t]&&a[t][s]){for(l in a[t][s])dt(o,[t,s].join(`.`),l);delete a[t][s]}}else if(s)for(e in a)for(c in a[e])s===c&&dt(o,[e,s].join(`.`));else if(t){if(a[t]){for(c in a[t])dt(o,[t,c].join(`.`));delete a[t]}}else{for(e in a)dt(o,e);(function(e){let t=e.getEventHolder();t===H.window&&(t=st),t.events&&={}})(i)}}))}var ft=class extends Te{addEventListener(){}dispatch(e,t,n){return function(e,t,n,r){let i=lt(e);return t instanceof H.window.Event||(t=new H.window.CustomEvent(t,{detail:n,cancelable:!0,...r})),i.dispatchEvent(t),t}(this,e,t,n)}dispatchEvent(e){let t=this.getEventHolder().events;if(!t)return!0;let n=t[e.type];for(let t in n)for(let r in n[t])n[t][r](e);return!e.defaultPrevented}fire(e,t,n){return this.dispatch(e,t,n),this}getEventHolder(){return this}getEventTarget(){return this}off(e,t,n){return dt(this,e,t,n),this}on(e,t,n,r){return ut(this,e,t,n,r),this}removeEventListener(){}};function pt(){}W(ft,`EventTarget`);var mt=400,ht=`>`,gt=0,_t={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":`miter`,"stroke-linecap":`butt`,fill:`#000000`,stroke:`#000000`,opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":`#000000`,"text-anchor":`start`},vt=class extends Array{constructor(...e){super(...e),this.init(...e)}clone(){return new this.constructor(this)}init(e){return typeof e==`number`||(this.length=0,this.push(...this.parse(e))),this}parse(e=[]){return e instanceof Array?e:e.trim().split(Ke).map(parseFloat)}toArray(){return Array.prototype.concat.apply([],this)}toSet(){return new Set(this)}toString(){return this.join(` `)}valueOf(){let e=[];return e.push(...this),e}},Y=class e{constructor(...e){this.init(...e)}convert(t){return new e(this.value,t)}divide(t){return t=new e(t),new e(this/t,this.unit||t.unit)}init(t,n){return n=Array.isArray(t)?t[1]:n,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=n||``,typeof t==`number`?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:typeof t==`string`?(n=t.match(Fe))&&(this.value=parseFloat(n[1]),n[5]===`%`?this.value/=100:n[5]===`s`&&(this.value*=1e3),this.unit=n[5]):t instanceof e&&(this.value=t.valueOf(),this.unit=t.unit),this}minus(t){return t=new e(t),new e(this-t,this.unit||t.unit)}plus(t){return t=new e(t),new e(this+t,this.unit||t.unit)}times(t){return t=new e(t),new e(this*t,this.unit||t.unit)}toArray(){return[this.value,this.unit]}toJSON(){return this.toString()}toString(){return(this.unit===`%`?~~(1e8*this.value)/1e6:this.unit===`s`?this.value/1e3:this.value)+this.unit}valueOf(){return this.value}},yt=new Set([`fill`,`stroke`,`color`,`bgcolor`,`stop-color`,`flood-color`,`lighting-color`]),bt=[],xt=class e extends ft{constructor(e,t){super(),this.node=e,this.type=e.nodeName,t&&e!==t&&this.attr(t)}add(e,t){return(e=ke(e)).removeNamespace&&this.node instanceof H.window.SVGElement&&e.removeNamespace(),t==null?this.node.appendChild(e.node):e.node!==this.node.childNodes[t]&&this.node.insertBefore(e.node,this.node.childNodes[t]),this}addTo(e,t){return ke(e).put(this,t)}children(){return new rt(pe(this.node.children,(function(e){return Ae(e)})))}clear(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}clone(e=!0,t=!0){this.writeDataToDom();let n=this.node.cloneNode(e);return t&&(n=Pe(n)),new this.constructor(n)}each(e,t){let n=this.children(),r,i;for(r=0,i=n.length;r<i;r++)e.apply(n[r],[r,n]),t&&n[r].each(e,t);return this}element(t,n){return this.put(new e(Oe(t),n))}first(){return Ae(this.node.firstChild)}get(e){return Ae(this.node.childNodes[e])}getEventHolder(){return this.node}getEventTarget(){return this.node}has(e){return this.index(e)>=0}html(e,t){return this.xml(e,t,`http://www.w3.org/1999/xhtml`)}id(e){return e!==void 0||this.node.id||(this.node.id=Ne(this.type)),this.attr(`id`,e)}index(e){return[].slice.call(this.node.childNodes).indexOf(e.node)}last(){return Ae(this.node.lastChild)}matches(e){let t=this.node,n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector||null;return n&&n.call(t,e)}parent(e){let t=this;if(!t.node.parentNode)return null;if(t=Ae(t.node.parentNode),!e)return t;do if(typeof e==`string`?t.matches(e):t instanceof e)return t;while(t=Ae(t.node.parentNode));return t}put(e,t){return e=ke(e),this.add(e,t),e}putIn(e,t){return ke(e).add(this,t)}remove(){return this.parent()&&this.parent().removeElement(this),this}removeElement(e){return this.node.removeChild(e.node),this}replace(e){return e=ke(e),this.node.parentNode&&this.node.parentNode.replaceChild(e.node,this.node),e}round(e=2,t=null){let n=10**e,r=this.attr(t);for(let e in r)typeof r[e]==`number`&&(r[e]=Math.round(r[e]*n)/n);return this.attr(r),this}svg(e,t){return this.xml(e,t,xe)}toString(){return this.id()}words(e){return this.node.textContent=e,this}wrap(e){let t=this.parent();if(!t)return this.addTo(e);let n=t.index(this);return t.put(e,n).put(this)}writeDataToDom(){return this.each((function(){this.writeDataToDom()})),this}xml(e,t,n){if(typeof e==`boolean`&&(n=t,t=e,e=null),e==null||typeof e==`function`){t=t==null||t,this.writeDataToDom();let n=this;if(e!=null){if(n=Ae(n.node.cloneNode(!0)),t){let t=e(n);if(n=t||n,!1===t)return``}n.each((function(){let t=e(this),n=t||this;!1===t?this.remove():t&&this!==n&&this.replace(n)}),!0)}return t?n.node.outerHTML:n.node.innerHTML}t=t!=null&&t;let r=Oe(`wrapper`,n),i=H.document.createDocumentFragment();r.innerHTML=e;for(let e=r.children.length;e--;)i.appendChild(r.firstElementChild);let a=this.parent();return t?this.replace(i)&&a:this.add(i)}};G(xt,{attr:function(e,t,n){if(e==null){e={},t=this.node.attributes;for(let n of t)e[n.nodeName]=We.test(n.nodeValue)?parseFloat(n.nodeValue):n.nodeValue;return e}if(e instanceof Array)return e.reduce(((e,t)=>(e[t]=this.attr(t),e)),{});if(typeof e==`object`&&e.constructor===Object)for(t in e)this.attr(t,e[t]);else if(t===null)this.node.removeAttribute(e);else{if(t==null)return(t=this.node.getAttribute(e))==null?_t[e]:We.test(t)?parseFloat(t):t;typeof(t=bt.reduce(((t,n)=>n(e,t,this)),t))==`number`?t=new Y(t):yt.has(e)&&Ze.isColor(t)?t=new Ze(t):t.constructor===Array&&(t=new vt(t)),e===`leading`?this.leading&&this.leading(t):typeof n==`string`?this.node.setAttributeNS(n,e,t.toString()):this.node.setAttribute(e,t.toString()),!this.rebuild||e!==`font-size`&&e!==`x`||this.rebuild()}return this},find:function(e){return at(e,this.node)},findOne:function(e){return Ae(this.node.querySelector(e))}}),W(xt,`Dom`);var St=class extends xt{constructor(e,t){super(e,t),this.dom={},this.node.instance=this,(e.hasAttribute(`data-svgjs`)||e.hasAttribute(`svgjs:data`))&&this.setData(JSON.parse(e.getAttribute(`data-svgjs`))??JSON.parse(e.getAttribute(`svgjs:data`))??{})}center(e,t){return this.cx(e).cy(t)}cx(e){return e==null?this.x()+this.width()/2:this.x(e-this.width()/2)}cy(e){return e==null?this.y()+this.height()/2:this.y(e-this.height()/2)}defs(){let e=this.root();return e&&e.defs()}dmove(e,t){return this.dx(e).dy(t)}dx(e=0){return this.x(new Y(e).plus(this.x()))}dy(e=0){return this.y(new Y(e).plus(this.y()))}getEventHolder(){return this}height(e){return this.attr(`height`,e)}move(e,t){return this.x(e).y(t)}parents(e=this.root()){let t=typeof e==`string`;t||(e=ke(e));let n=new rt,r=this;for(;(r=r.parent())&&r.node!==H.document&&r.nodeName!==`#document-fragment`&&(n.push(r),t||r.node!==e.node)&&(!t||!r.matches(e));)if(r.node===this.root().node)return null;return n}reference(e){if(!(e=this.attr(e)))return null;let t=(e+``).match(Re);return t?ke(t[1]):null}root(){let e=this.parent(function(e){return Ee[e]}(De));return e&&e.root()}setData(e){return this.dom=e,this}size(e,t){let n=ge(this,e,t);return this.width(new Y(n.width)).height(new Y(n.height))}width(e){return this.attr(`width`,e)}writeDataToDom(){return be(this,this.dom),super.writeDataToDom()}x(e){return this.attr(`x`,e)}y(e){return this.attr(`y`,e)}};G(St,{bbox:function(){return new tt(nt(this,(e=>e.getBBox()),(e=>{try{let t=e.clone().addTo($e().svg).show(),n=t.node.getBBox();return t.remove(),n}catch(t){throw Error(`Getting bbox of element "${e.node.nodeName}" is not possible: ${t.toString()}`)}})))},rbox:function(e){let t=new tt(nt(this,(e=>e.getBoundingClientRect()),(e=>{throw Error(`Getting rbox of element "${e.node.nodeName}" is not possible`)})));return e?t.transform(e.screenCTM().inverseO()):t.addOffset()},inside:function(e,t){let n=this.bbox();return e>n.x&&t>n.y&&e<n.x+n.width&&t<n.y+n.height},point:function(e,t){return new q(e,t).transformO(this.screenCTM().inverseO())},ctm:function(){return new J(this.node.getCTM())},screenCTM:function(){try{if(typeof this.isRoot==`function`&&!this.isRoot()){let e=this.rect(1,1),t=e.node.getScreenCTM();return e.remove(),new J(t)}return new J(this.node.getScreenCTM())}catch{return console.warn(`Cannot get CTM from SVG node ${this.node.nodeName}. Is the element rendered?`),new J}}}),W(St,`Element`);var Ct={stroke:[`color`,`width`,`opacity`,`linecap`,`linejoin`,`miterlimit`,`dasharray`,`dashoffset`],fill:[`color`,`opacity`,`rule`],prefix:function(e,t){return t===`color`?e:e+`-`+t}};[`fill`,`stroke`].forEach((function(e){let t={},n;t[e]=function(t){if(t===void 0)return this.attr(e);if(typeof t==`string`||t instanceof Ze||Ze.isRgb(t)||t instanceof St)this.attr(e,t);else for(n=Ct[e].length-1;n>=0;n--)t[Ct[e][n]]!=null&&this.attr(Ct.prefix(e,Ct[e][n]),t[Ct[e][n]]);return this},V([`Element`,`Runner`],t)})),V([`Element`,`Runner`],{matrix:function(e,t,n,r,i,a){return e==null?new J(this):this.attr(`transform`,new J(e,t,n,r,i,a))},rotate:function(e,t,n){return this.transform({rotate:e,ox:t,oy:n},!0)},skew:function(e,t,n,r){return arguments.length===1||arguments.length===3?this.transform({skew:e,ox:t,oy:n},!0):this.transform({skew:[e,t],ox:n,oy:r},!0)},shear:function(e,t,n){return this.transform({shear:e,ox:t,oy:n},!0)},scale:function(e,t,n,r){return arguments.length===1||arguments.length===3?this.transform({scale:e,ox:t,oy:n},!0):this.transform({scale:[e,t],ox:n,oy:r},!0)},translate:function(e,t){return this.transform({translate:[e,t]},!0)},relative:function(e,t){return this.transform({relative:[e,t]},!0)},flip:function(e=`both`,t=`center`){return`xybothtrue`.indexOf(e)===-1&&(t=e,e=`both`),this.transform({flip:e,origin:t},!0)},opacity:function(e){return this.attr(`opacity`,e)}}),V(`radius`,{radius:function(e,t=e){return(this._element||this).type===`radialGradient`?this.attr(`r`,new Y(e)):this.rx(e).ry(t)}}),V(`Path`,{length:function(){return this.node.getTotalLength()},pointAt:function(e){return new q(this.node.getPointAtLength(e))}}),V([`Element`,`Runner`],{font:function(e,t){if(typeof e==`object`){for(t in e)this.font(t,e[t]);return this}return e===`leading`?this.leading(t):e===`anchor`?this.attr(`text-anchor`,t):e===`size`||e===`family`||e===`weight`||e===`stretch`||e===`variant`||e===`style`?this.attr(`font-`+e,t):this.attr(e,t)}}),V(`Element`,[`click`,`dblclick`,`mousedown`,`mouseup`,`mouseover`,`mouseout`,`mousemove`,`mouseenter`,`mouseleave`,`touchstart`,`touchmove`,`touchleave`,`touchend`,`touchcancel`,`contextmenu`,`wheel`,`pointerdown`,`pointermove`,`pointerup`,`pointerleave`,`pointercancel`].reduce((function(e,t){return e[t]=function(e){return e===null?this.off(t):this.on(t,e),this},e}),{})),V(`Element`,{untransform:function(){return this.attr(`transform`,null)},matrixify:function(){return(this.attr(`transform`)||``).split(ze).slice(0,-1).map((function(e){let t=e.trim().split(`(`);return[t[0],t[1].split(Ke).map((function(e){return parseFloat(e)}))]})).reverse().reduce((function(e,t){return t[0]===`matrix`?e.lmultiply(J.fromArray(t[1])):e[t[0]].apply(e,t[1])}),new J)},toParent:function(e,t){if(this===e)return this;if(ye(this.node))return this.addTo(e,t);let n=this.screenCTM(),r=e.screenCTM().inverse();return this.addTo(e,t).untransform().transform(r.multiply(n)),this},toRoot:function(e){return this.toParent(this.root(),e)},transform:function(e,t){if(e==null||typeof e==`string`){let t=new J(this).decompose();return e==null?t:t[e]}J.isMatrixLike(e)||(e={...e,origin:_e(e,this)});let n=new J(!0===t?this:t||!1).transform(e);return this.attr(`transform`,n)}});var wt=class e extends St{flatten(){return this.each((function(){if(this instanceof e)return this.flatten().ungroup()})),this}ungroup(e=this.parent(),t=e.index(this)){return t=t===-1?e.children().length:t,this.each((function(n,r){return r[r.length-n-1].toParent(e,t)})),this.remove()}};W(wt,`Container`);var Tt=class extends wt{constructor(e,t=e){super(U(`defs`,e),t)}flatten(){return this}ungroup(){return this}};W(Tt,`Defs`);var Et=class extends St{};function Dt(e){return this.attr(`rx`,e)}function Ot(e){return this.attr(`ry`,e)}function kt(e){return e==null?this.cx()-this.rx():this.cx(e+this.rx())}function At(e){return e==null?this.cy()-this.ry():this.cy(e+this.ry())}function jt(e){return this.attr(`cx`,e)}function Mt(e){return this.attr(`cy`,e)}function Nt(e){return e==null?2*this.rx():this.rx(new Y(e).divide(2))}function Pt(e){return e==null?2*this.ry():this.ry(new Y(e).divide(2))}W(Et,`Shape`);var Ft=Object.freeze({__proto__:null,cx:jt,cy:Mt,height:Pt,rx:Dt,ry:Ot,width:Nt,x:kt,y:At}),It=class extends Et{constructor(e,t=e){super(U(`ellipse`,e),t)}size(e,t){let n=ge(this,e,t);return this.rx(new Y(n.width).divide(2)).ry(new Y(n.height).divide(2))}};G(It,Ft),V(`Container`,{ellipse:K((function(e=0,t=e){return this.put(new It).size(e,t).move(0,0)}))}),W(It,`Ellipse`);var Lt=class extends xt{constructor(e=H.document.createDocumentFragment()){super(e)}xml(e,t,n){if(typeof e==`boolean`&&(n=t,t=e,e=null),e==null||typeof e==`function`){let e=new xt(Oe(`wrapper`,n));return e.add(this.node.cloneNode(!0)),e.xml(!1,n)}return super.xml(e,!1,n)}};function Rt(e,t){return(this._element||this).type===`radialGradient`?this.attr({fx:new Y(e),fy:new Y(t)}):this.attr({x1:new Y(e),y1:new Y(t)})}function zt(e,t){return(this._element||this).type===`radialGradient`?this.attr({cx:new Y(e),cy:new Y(t)}):this.attr({x2:new Y(e),y2:new Y(t)})}W(Lt,`Fragment`);var Bt=Object.freeze({__proto__:null,from:Rt,to:zt}),Vt=class extends wt{constructor(e,t){super(U(e+`Gradient`,typeof e==`string`?null:e),t)}attr(e,t,n){return e===`transform`&&(e=`gradientTransform`),super.attr(e,t,n)}bbox(){return new tt}targets(){return at(`svg [fill*=`+this.id()+`]`)}toString(){return this.url()}update(e){return this.clear(),typeof e==`function`&&e.call(this,this),this}url(){return`url(#`+this.id()+`)`}};G(Vt,Bt),V({Container:{gradient(...e){return this.defs().gradient(...e)}},Defs:{gradient:K((function(e,t){return this.put(new Vt(e)).update(t)}))}}),W(Vt,`Gradient`);var Ht=class extends wt{constructor(e,t=e){super(U(`pattern`,e),t)}attr(e,t,n){return e===`transform`&&(e=`patternTransform`),super.attr(e,t,n)}bbox(){return new tt}targets(){return at(`svg [fill*=`+this.id()+`]`)}toString(){return this.url()}update(e){return this.clear(),typeof e==`function`&&e.call(this,this),this}url(){return`url(#`+this.id()+`)`}};V({Container:{pattern(...e){return this.defs().pattern(...e)}},Defs:{pattern:K((function(e,t,n){return this.put(new Ht).update(n).attr({x:0,y:0,width:e,height:t,patternUnits:`userSpaceOnUse`})}))}}),W(Ht,`Pattern`);var Ut=class extends Et{constructor(e,t=e){super(U(`image`,e),t)}load(e,t){if(!e)return this;let n=new H.window.Image;return ut(n,`load`,(function(e){let r=this.parent(Ht);this.width()===0&&this.height()===0&&this.size(n.width,n.height),r instanceof Ht&&r.width()===0&&r.height()===0&&r.size(this.width(),this.height()),typeof t==`function`&&t.call(this,e)}),this),ut(n,`load error`,(function(){dt(n)})),this.attr(`href`,n.src=e,Ce)}};bt.push(function(e,t,n){return e!==`fill`&&e!==`stroke`||Ge.test(t)&&(t=n.root().defs().image(t)),t instanceof Ut&&(t=n.root().defs().pattern(0,0,(e=>{e.add(t)}))),t}),V({Container:{image:K((function(e,t){return this.put(new Ut).size(0,0).load(e,t)}))}}),W(Ut,`Image`);var Wt=class extends vt{bbox(){let e=-1/0,t=-1/0,n=1/0,r=1/0;return this.forEach((function(i){e=Math.max(i[0],e),t=Math.max(i[1],t),n=Math.min(i[0],n),r=Math.min(i[1],r)})),new tt(n,r,e-n,t-r)}move(e,t){let n=this.bbox();if(e-=n.x,t-=n.y,!isNaN(e)&&!isNaN(t))for(let n=this.length-1;n>=0;n--)this[n]=[this[n][0]+e,this[n][1]+t];return this}parse(e=[0,0]){let t=[];(e=e instanceof Array?Array.prototype.concat.apply([],e):e.trim().split(Ke).map(parseFloat)).length%2!=0&&e.pop();for(let n=0,r=e.length;n<r;n+=2)t.push([e[n],e[n+1]]);return t}size(e,t){let n,r=this.bbox();for(n=this.length-1;n>=0;n--)r.width&&(this[n][0]=(this[n][0]-r.x)*e/r.width+r.x),r.height&&(this[n][1]=(this[n][1]-r.y)*t/r.height+r.y);return this}toLine(){return{x1:this[0][0],y1:this[0][1],x2:this[1][0],y2:this[1][1]}}toString(){let e=[];for(let t=0,n=this.length;t<n;t++)e.push(this[t].join(`,`));return e.join(` `)}transform(e){return this.clone().transformO(e)}transformO(e){J.isMatrixLike(e)||(e=new J(e));for(let t=this.length;t--;){let[n,r]=this[t];this[t][0]=e.a*n+e.c*r+e.e,this[t][1]=e.b*n+e.d*r+e.f}return this}},Gt=Object.freeze({__proto__:null,MorphArray:Wt,height:function(e){let t=this.bbox();return e==null?t.height:this.size(t.width,e)},width:function(e){let t=this.bbox();return e==null?t.width:this.size(e,t.height)},x:function(e){return e==null?this.bbox().x:this.move(e,this.bbox().y)},y:function(e){return e==null?this.bbox().y:this.move(this.bbox().x,e)}}),Kt=class extends Et{constructor(e,t=e){super(U(`line`,e),t)}array(){return new Wt([[this.attr(`x1`),this.attr(`y1`)],[this.attr(`x2`),this.attr(`y2`)]])}move(e,t){return this.attr(this.array().move(e,t).toLine())}plot(e,t,n,r){return e==null?this.array():(e=t===void 0?new Wt(e).toLine():{x1:e,y1:t,x2:n,y2:r},this.attr(e))}size(e,t){let n=ge(this,e,t);return this.attr(this.array().size(n.width,n.height).toLine())}};G(Kt,Gt),V({Container:{line:K((function(...e){return Kt.prototype.plot.apply(this.put(new Kt),e[0]==null?[0,0,0,0]:e)}))}}),W(Kt,`Line`);var qt=class extends wt{constructor(e,t=e){super(U(`marker`,e),t)}height(e){return this.attr(`markerHeight`,e)}orient(e){return this.attr(`orient`,e)}ref(e,t){return this.attr(`refX`,e).attr(`refY`,t)}toString(){return`url(#`+this.id()+`)`}update(e){return this.clear(),typeof e==`function`&&e.call(this,this),this}width(e){return this.attr(`markerWidth`,e)}};function Jt(e,t){return function(n){return n==null?this[e]:(this[e]=n,t&&t.call(this),this)}}V({Container:{marker(...e){return this.defs().marker(...e)}},Defs:{marker:K((function(e,t,n){return this.put(new qt).size(e,t).ref(e/2,t/2).viewbox(0,0,e,t).attr(`orient`,`auto`).update(n)}))},marker:{marker(e,t,n,r){let i=[`marker`];return e!==`all`&&i.push(e),i=i.join(`-`),e=arguments[1]instanceof qt?arguments[1]:this.defs().marker(t,n,r),this.attr(i,e)}}}),W(qt,`Marker`);var Yt={"-":function(e){return e},"<>":function(e){return-Math.cos(e*Math.PI)/2+.5},">":function(e){return Math.sin(e*Math.PI/2)},"<":function(e){return 1-Math.cos(e*Math.PI/2)},bezier:function(e,t,n,r){return function(i){return i<0?e>0?t/e*i:n>0?r/n*i:0:i>1?n<1?(1-r)/(1-n)*i+(r-n)/(1-n):e<1?(1-t)/(1-e)*i+(t-e)/(1-e):1:3*i*(1-i)**2*t+3*i**2*(1-i)*r+i**3}},steps:function(e,t=`end`){t=t.split(`-`).reverse()[0];let n=e;return t===`none`?--n:t===`both`&&++n,(r,i=!1)=>{let a=Math.floor(r*e),o=r*a%1==0;return t!==`start`&&t!==`both`||++a,i&&o&&--a,r>=0&&a<0&&(a=0),r<=1&&a>n&&(a=n),a/n}}},Xt=class{done(){return!1}},Zt=class extends Xt{constructor(e=ht){super(),this.ease=Yt[e]||e}step(e,t,n){return typeof e==`number`?e+(t-e)*this.ease(n):n<1?e:t}},Qt=class extends Xt{constructor(e){super(),this.stepper=e}done(e){return e.done}step(e,t,n,r){return this.stepper(e,t,n,r)}};function $t(){let e=(this._duration||500)/1e3,t=this._overshoot||0,n=Math.PI,r=Math.log(t/100+1e-10),i=-r/Math.sqrt(n*n+r*r),a=3.9/(i*e);this.d=2*i*a,this.k=a*a}G(class extends Qt{constructor(e=500,t=0){super(),this.duration(e).overshoot(t)}step(e,t,n,r){if(typeof e==`string`)return e;if(r.done=n===1/0,n===1/0)return t;if(n===0)return e;n>100&&(n=16),n/=1e3;let i=r.velocity||0,a=-this.d*i-this.k*(e-t),o=e+i*n+a*n*n/2;return r.velocity=i+a*n,r.done=Math.abs(t-o)+Math.abs(i)<.002,r.done?t:o}},{duration:Jt(`_duration`,$t),overshoot:Jt(`_overshoot`,$t)}),G(class extends Qt{constructor(e=.1,t=.01,n=0,r=1e3){super(),this.p(e).i(t).d(n).windup(r)}step(e,t,n,r){if(typeof e==`string`)return e;if(r.done=n===1/0,n===1/0)return t;if(n===0)return e;let i=t-e,a=(r.integral||0)+i*n,o=(i-(r.error||0))/n,s=this._windup;return!1!==s&&(a=Math.max(-s,Math.min(a,s))),r.error=i,r.integral=a,r.done=Math.abs(i)<.001,r.done?t:e+(this.P*i+this.I*a+this.D*o)}},{windup:Jt(`_windup`),p:Jt(`P`),i:Jt(`I`),d:Jt(`D`)});var en={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},tn={M:function(e,t,n){return t.x=n.x=e[0],t.y=n.y=e[1],[`M`,t.x,t.y]},L:function(e,t){return t.x=e[0],t.y=e[1],[`L`,e[0],e[1]]},H:function(e,t){return t.x=e[0],[`H`,e[0]]},V:function(e,t){return t.y=e[0],[`V`,e[0]]},C:function(e,t){return t.x=e[4],t.y=e[5],[`C`,e[0],e[1],e[2],e[3],e[4],e[5]]},S:function(e,t){return t.x=e[2],t.y=e[3],[`S`,e[0],e[1],e[2],e[3]]},Q:function(e,t){return t.x=e[2],t.y=e[3],[`Q`,e[0],e[1],e[2],e[3]]},T:function(e,t){return t.x=e[0],t.y=e[1],[`T`,e[0],e[1]]},Z:function(e,t,n){return t.x=n.x,t.y=n.y,[`Z`]},A:function(e,t){return t.x=e[5],t.y=e[6],[`A`,e[0],e[1],e[2],e[3],e[4],e[5],e[6]]}},nn=`mlhvqtcsaz`.split(``);for(let e=0,t=nn.length;e<t;++e)tn[nn[e]]=function(e){return function(t,n,r){if(e===`H`)t[0]+=n.x;else if(e===`V`)t[0]+=n.y;else if(e===`A`)t[5]+=n.x,t[6]+=n.y;else for(let e=0,r=t.length;e<r;++e)t[e]=t[e]+(e%2?n.y:n.x);return tn[e](t,n,r)}}(nn[e].toUpperCase());function rn(e){return e.segment.length&&e.segment.length-1===en[e.segment[0].toUpperCase()]}function an(e,t){e.inNumber&&on(e,!1);let n=qe.test(t);if(n)e.segment=[t];else{let t=e.lastCommand,n=t.toLowerCase();e.segment=[n===`m`?t===n?`l`:`L`:t]}return e.inSegment=!0,e.lastCommand=e.segment[0],n}function on(e,t){if(!e.inNumber)throw Error(`Parser Error`);e.number&&e.segment.push(parseFloat(e.number)),e.inNumber=t,e.number=``,e.pointSeen=!1,e.hasExponent=!1,rn(e)&&sn(e)}function sn(e){e.inSegment=!1,e.absolute&&(e.segment=function(e){return tn[e.segment[0]](e.segment.slice(1),e.p,e.p0)}(e)),e.segments.push(e.segment)}function cn(e){if(!e.segment.length)return!1;let t=e.segment[0].toUpperCase()===`A`,n=e.segment.length;return t&&(n===4||n===5)}function ln(e){return e.lastToken.toUpperCase()===`E`}var un=new Set([` `,`,`,` `,`
|
|
@@ -907,4 +907,4 @@ rect.legend-mouseover-inactive,
|
|
|
907
907
|
.apexcharts-disable-transitions * {
|
|
908
908
|
transition: none !important;
|
|
909
909
|
}`;var c=e.opts.chart?.nonce||e.w.config.chart.nonce;c&&s.setAttribute(`nonce`,c),a?i.prepend(s):o.head.appendChild(s)}var l=e.create(e.w.config.series,{});if(!l)return t(e);e.mount(l).then((function(){typeof e.w.config.chart.events.mounted==`function`&&e.w.config.chart.events.mounted(e,e.w),e.events.fireEvent(`mounted`,[e,e.w]),t(l)})).catch((function(e){n(e)}))}else n(Error(`Element not found`))}))}},{key:`create`,value:function(e,t){var n=this,r=this.w;new Ii(this).initModules();var i=this.w.globals;if(i.noData=!1,i.animationEnded=!1,!B.elementExists(this.el)||((this.responsive.checkResponsiveConfig(t),r.config.xaxis.convertedCatToNumeric)&&new mr(r.config).convertCatToNumericXaxis(r.config,this.ctx),this.core.setupElements(),r.config.chart.type===`treemap`&&(r.config.grid.show=!1,r.config.yaxis[0].show=!1),i.svgWidth===0))return i.animationEnded=!0,null;var a=e;e.forEach((function(e,t){e.hidden&&(a=n.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:t}))}));var o=tr.checkComboSeries(a,r.config.chart.type);i.comboCharts=o.comboCharts,i.comboBarCount=o.comboBarCount;var s=a.every((function(e){return e.data&&e.data.length===0}));(a.length===0||s&&i.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(a),this.theme.init(),new yr(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),i.noData&&i.collapsedSeries.length!==i.series.length&&!r.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),i.axisCharts&&(this.core.coreCalculations(),r.config.xaxis.type!==`category`&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=r.globals.minX,this.ctx.toolbar.maxX=r.globals.maxX),this.formatters.heatmapLabelFormatters(),new tr(this).getLargestMarkerSize(),this.dimensions.plotCoords();var c=this.core.xySettings();this.grid.createGridMask();var l=this.core.plotChartType(a,c),u=new xr(this);return u.bringForward(),r.config.dataLabels.background.enabled&&u.dataLabelsBackground(),this.core.shiftGraphPosition(),r.globals.dataPoints>50&&r.globals.dom.elWrap.classList.add(`apexcharts-disable-transitions`),{elGraph:l,xyRatios:c,dimensions:{plot:{left:r.globals.translateX,top:r.globals.translateY,width:r.globals.gridWidth,height:r.globals.gridHeight}}}}},{key:`mount`,value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=this,r=n.w;return new Promise((function(i,a){if(n.el===null)return a(Error(`Not enough data to display or target element not found`));(t===null||r.globals.allSeriesCollapsed)&&n.series.handleNoData(),n.grid=new Er(n);var o,s,c=n.grid.drawGrid();if((n.annotations=new dr(n),n.annotations.drawImageAnnos(),n.annotations.drawTextAnnos(),r.config.grid.position===`back`)&&(c&&r.globals.dom.elGraphical.add(c.el),c!=null&&(o=c.elGridBorders)!=null&&o.node&&r.globals.dom.elGraphical.add(c.elGridBorders)),Array.isArray(t.elGraph))for(var l=0;l<t.elGraph.length;l++)r.globals.dom.elGraphical.add(t.elGraph[l]);else r.globals.dom.elGraphical.add(t.elGraph);r.config.grid.position===`front`&&(c&&r.globals.dom.elGraphical.add(c.el),c!=null&&(s=c.elGridBorders)!=null&&s.node&&r.globals.dom.elGraphical.add(c.elGridBorders)),r.config.xaxis.crosshairs.position===`front`&&n.crosshairs.drawXCrosshairs(),r.config.yaxis[0].crosshairs.position===`front`&&n.crosshairs.drawYCrosshairs(),r.config.chart.type!==`treemap`&&n.axes.drawAxis(r.config.chart.type,c);var u=new Tr(e.ctx,c),d=new kr(e.ctx,c);if(c!==null&&(u.xAxisLabelCorrections(c.xAxisTickWidth),d.setYAxisTextAlignments(),r.config.yaxis.map((function(e,t){r.globals.ignoreYAxisIndexes.indexOf(t)===-1&&d.yAxisTitleRotate(t,e.opposite)}))),n.annotations.drawAxesAnnotations(),!r.globals.noData){if(r.config.tooltip.enabled&&!r.globals.noData&&n.w.globals.tooltip.drawTooltip(t.xyRatios),r.globals.axisCharts&&(r.globals.isXNumeric||r.config.xaxis.convertedCatToNumeric||r.globals.isRangeBar))(r.config.chart.zoom.enabled||r.config.chart.selection&&r.config.chart.selection.enabled||r.config.chart.pan&&r.config.chart.pan.enabled)&&n.zoomPanSelection.init({xyRatios:t.xyRatios});else{var f=r.config.chart.toolbar.tools;[`zoom`,`zoomin`,`zoomout`,`selection`,`pan`,`reset`].forEach((function(e){f[e]=!1}))}r.config.chart.toolbar.show&&!r.globals.allSeriesCollapsed&&n.toolbar.createToolbar()}r.globals.memory.methodsToExec.length>0&&r.globals.memory.methodsToExec.forEach((function(e){e.method(e.params,!1,e.context)})),r.globals.axisCharts||r.globals.noData||n.core.resizeNonAxisCharts(),i(n)}))}},{key:`destroy`,value:function(){window.removeEventListener(`resize`,this.windowResizeHandler),function(e,t){var n=Ri.get(t);n&&(n.disconnect(),Ri.delete(t))}(this.el.parentNode,this.parentResizeHandler);var e=this.w.config.chart.id;e&&Apex._chartInstances.forEach((function(t,n){t.id===B.escapeString(e)&&Apex._chartInstances.splice(n,1)})),new Li(this.ctx).clear({isUpdating:!1})}},{key:`updateOptions`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],i=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],o=this.w;return o.globals.selection=void 0,this.lastUpdateOptions&&JSON.stringify(this.lastUpdateOptions)===JSON.stringify(e)?this:(this.lastUpdateOptions=B.clone(e),e.series&&(this.series.resetSeries(!1,!0,!1),e.series.length&&e.series[0].data&&(e.series=e.series.map((function(e,n){return t.updateHelpers._extendSeries(e,n)}))),this.updateHelpers.revertDefaultAxisMinMax()),e.xaxis&&(e=this.updateHelpers.forceXAxisUpdate(e)),e.yaxis&&(e=this.updateHelpers.forceYAxisUpdate(e)),o.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),e.theme&&(e=this.theme.updateThemeOptions(e)),this.updateHelpers._updateOptions(e,n,r,i,a))}},{key:`updateSeries`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(e,t,n)}},{key:`appendSeries`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],r=this.w.config.series.slice();return r.push(e),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(r,t,n)}},{key:`appendData`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this;n.w.globals.dataChanged=!0,n.series.getPreviousPaths();for(var r=n.w.config.series.slice(),i=0;i<r.length;i++)if(e[i]!==null&&e[i]!==void 0)for(var a=0;a<e[i].data.length;a++)r[i].data.push(e[i].data[a]);return n.w.config.series=r,t&&(n.w.globals.initialSeries=B.clone(n.w.config.series)),this.update()}},{key:`update`,value:function(e){var t=this;return new Promise((function(n,r){if(t.lastUpdateOptions&&JSON.stringify(t.lastUpdateOptions)===JSON.stringify(e))return n(t);t.lastUpdateOptions=B.clone(e),new Li(t.ctx).clear({isUpdating:!0});var i=t.create(t.w.config.series,e);if(!i)return n(t);t.mount(i).then((function(){typeof t.w.config.chart.events.updated==`function`&&t.w.config.chart.events.updated(t,t.w),t.events.fireEvent(`updated`,[t,t.w]),t.w.globals.isDirty=!0,n(t)})).catch((function(e){r(e)}))}))}},{key:`getSyncedCharts`,value:function(){var e=this.getGroupedCharts(),t=[this];return e.length&&(t=[],e.forEach((function(e){t.push(e)}))),t}},{key:`getGroupedCharts`,value:function(){var e=this;return Apex._chartInstances.filter((function(e){if(e.group)return!0})).map((function(t){return e.w.config.chart.group===t.group?t.chart:e}))}},{key:`toggleSeries`,value:function(e){return this.series.toggleSeries(e)}},{key:`highlightSeriesOnLegendHover`,value:function(e,t){return this.series.toggleSeriesOnHover(e,t)}},{key:`showSeries`,value:function(e){this.series.showSeries(e)}},{key:`hideSeries`,value:function(e){this.series.hideSeries(e)}},{key:`highlightSeries`,value:function(e){this.series.highlightSeries(e)}},{key:`isSeriesHidden`,value:function(e){this.series.isSeriesHidden(e)}},{key:`resetSeries`,value:function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.series.resetSeries(e,t)}},{key:`addEventListener`,value:function(e,t){this.events.addEventListener(e,t)}},{key:`removeEventListener`,value:function(e,t){this.events.removeEventListener(e,t)}},{key:`addXaxisAnnotation`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=this;n&&(r=n),r.annotations.addXaxisAnnotationExternal(e,t,r)}},{key:`addYaxisAnnotation`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=this;n&&(r=n),r.annotations.addYaxisAnnotationExternal(e,t,r)}},{key:`addPointAnnotation`,value:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=this;n&&(r=n),r.annotations.addPointAnnotationExternal(e,t,r)}},{key:`clearAnnotations`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=this;e&&(t=e),t.annotations.clearAnnotations(t)}},{key:`removeAnnotation`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=this;t&&(n=t),n.annotations.removeAnnotation(n,e)}},{key:`getChartArea`,value:function(){return this.w.globals.dom.baseEl.querySelector(`.apexcharts-inner`)}},{key:`getSeriesTotalXRange`,value:function(e,t){return this.coreUtils.getSeriesTotalsXRange(e,t)}},{key:`getHighestValueInSeries`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Or(this.ctx).getMinYMaxY(e).highestY}},{key:`getLowestValueInSeries`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Or(this.ctx).getMinYMaxY(e).lowestY}},{key:`getSeriesTotal`,value:function(){return this.w.globals.seriesTotals}},{key:`toggleDataPointSelection`,value:function(e,t){return this.updateHelpers.toggleDataPointSelection(e,t)}},{key:`zoomX`,value:function(e,t){this.ctx.toolbar.zoomUpdateOptions(e,t)}},{key:`setLocale`,value:function(e){this.localization.setCurrentLocaleValues(e)}},{key:`dataURI`,value:function(e){return new wr(this.ctx).dataURI(e)}},{key:`getSvgString`,value:function(e){return new wr(this.ctx).getSvgString(e)}},{key:`exportToCSV`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new wr(this.ctx).exportToCSV(e)}},{key:`paper`,value:function(){return this.w.globals.dom.Paper}},{key:`_parentResizeCallback`,value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:`_windowResize`,value:function(){var e=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){e.w.globals.resized=!0,e.w.globals.dataChanged=!1,e.ctx.update()}),150)}},{key:`_windowResizeHandler`,value:function(){var e=this.w.config.chart.redrawOnWindowResize;typeof e==`function`&&(e=e()),e&&this._windowResize()}}],[{key:`getChartByID`,value:function(e){var t=B.escapeString(e);if(Apex._chartInstances){var n=Apex._chartInstances.filter((function(e){return e.id===t}))[0];return n&&n.chart}}},{key:`initOnLoad`,value:function(){for(var t=document.querySelectorAll(`[data-apexcharts]`),n=0;n<t.length;n++)new e(t[n],JSON.parse(t[n].getAttribute(`data-options`))).render()}},{key:`exec`,value:function(e,t){var n=this.getChartByID(e);if(n){n.w.globals.isExecCalled=!0;var r=null;if(n.publicMethods.indexOf(t)!==-1){var i=[...arguments].slice(2);r=n[t].apply(n,i)}return r}}},{key:`merge`,value:function(e,t){return B.extend(e,t)}}]),e}(),$=r();function Bi({height:e,children:t}){return(0,$.jsx)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm`,style:{height:e},children:t})}function Vi(e,t,n,r){let i=(0,D.useRef)(null),a=(0,D.useRef)(null);(0,D.useEffect)(()=>{let n=document.getElementById(e);if((!r||!n||a.current!==n)&&(i.current?.destroy(),i.current=null,a.current=null,!r||!n))return;let o=t();if(i.current)i.current.updateOptions(o,!1,!1);else{o.chart={...o.chart,animations:{enabled:!0,dynamicAnimation:{enabled:!0,speed:300}}};let e=new zi(n,o);e.render(),i.current=e,a.current=n}},n),(0,D.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}var Hi={iterate:`Iterate`,delivery:`Delivery`,land:`Land gate`,mainCi:`Main CI`},Ui=[{name:`gate slot queue avg`,part:`heavySlot`,color:`#f59e0b`}],Wi={iterate:Ui,delivery:Ui,land:[{name:`land lane avg`,part:`lane`,color:`#38bdf8`},{name:`heavy-gate slot avg`,part:`heavySlot`,color:`#f59e0b`}],mainCi:[{name:`CI runner queue avg`,part:`runner`,color:`#38bdf8`}]},Gi={pass:`#10b981`,fail:`#ef4444`,infra:`#f59e0b`,timeout:`#8b5cf6`},Ki={pass:`text-tone-success-fg`,fail:`text-tone-danger-fg`,infra:`text-tone-warning-fg`,timeout:`text-tone-violet-fg`};function qi(e){return e===`7d`?`7d`:e===`14d`||e===`30d`?`30d`:`24h`}var Ji=e=>typeof e==`number`?T(e):`—`,Yi=e=>e===null?null:Math.round(e/6e3)/10;function Xi({label:e,summary:t}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 text-sm tabular-nums`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e}),[`avg`,`p50`,`p90`,`min`,`max`].map(e=>(0,$.jsx)(`span`,{className:`text-right`,children:Ji(t[e])},e))]})}function Zi({stats:e,isDark:n}){let r=t=>e.buckets.map(e=>({x:e.start,y:t(e)})),i=e.outcomes.pass+e.outcomes.fail+e.outcomes.infra+e.outcomes.timeout,a=n?`rgba(255,255,255,0.45)`:`rgba(0,0,0,0.45)`,o=()=>({theme:{mode:n?`dark`:`light`},grid:{borderColor:n?`rgba(255,255,255,0.06)`:`rgba(0,0,0,0.08)`,strokeDashArray:3},xaxis:{type:`datetime`,labels:{datetimeUTC:!1,style:{colors:a,fontSize:`10px`}}},legend:{labels:{colors:n?`rgba(255,255,255,0.65)`:`rgba(0,0,0,0.65)`},fontSize:`11px`},dataLabels:{enabled:!1},tooltip:{theme:n?`dark`:`light`}}),s={labels:{style:{colors:a},formatter:e=>`${e}m`},min:0},c=e.wait.count>0,l=e.duration.count>0;return Vi(`gates-${e.kind}-outcomes`,()=>({...o(),chart:{type:`bar`,stacked:!0,height:180,background:`transparent`,toolbar:{show:!1},fontFamily:`inherit`},colors:Object.values(Gi),series:Object.keys(Gi).map(e=>({name:e,data:r(t=>t.outcomes[e])})),yaxis:{labels:{style:{colors:a}},forceNiceScale:!0}}),[e,n],i>0),Vi(`gates-${e.kind}-wait`,()=>({...o(),chart:{type:`line`,height:180,background:`transparent`,toolbar:{show:!1},fontFamily:`inherit`},stroke:{width:2,curve:`smooth`},colors:[...(Wi[e.kind]??[]).map(e=>e.color),`#a1a1aa`],series:[...(Wi[e.kind]??[]).map(({name:e,part:t})=>({name:e,data:r(e=>Yi(e.waitParts[t]??null))})),{name:`total p90`,data:r(e=>Yi(e.wait.p90))}],yaxis:s}),[e,n],c),Vi(`gates-${e.kind}-duration`,()=>({...o(),chart:{type:`line`,height:180,background:`transparent`,toolbar:{show:!1},fontFamily:`inherit`},stroke:{width:2,curve:`smooth`},colors:[`#818cf8`,`#22c55e`,`#f43f5e`,`#a1a1aa`],series:[{name:`avg`,data:r(e=>Yi(e.duration.avg))},{name:`p50`,data:r(e=>Yi(e.duration.p50))},{name:`p90`,data:r(e=>Yi(e.duration.p90))},{name:`max`,data:r(e=>Yi(e.duration.max))}],yaxis:s}),[e,n],l),(0,$.jsxs)(w,{"data-testid":`gates-kind-${e.kind}`,children:[(0,$.jsx)(x,{className:`pb-2`,children:(0,$.jsxs)(C,{className:`text-sm font-medium flex flex-wrap items-baseline gap-x-3`,children:[Hi[e.kind],(0,$.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground tabular-nums`,children:[i,` runs · `,Object.keys(Ki).map(n=>(0,$.jsxs)(`span`,{className:t(`ml-2`,Ki[n]),children:[e.outcomes[n],` `,n]},n))]}),e.historySince!==null&&(0,$.jsxs)(`span`,{className:`text-xs font-normal text-tone-warning-fg`,"data-testid":`gates-${e.kind}-history-since`,title:`Older runs were not recorded, or are still being loaded from GitHub`,children:[`history since `,new Date(e.historySince).toLocaleDateString([],{month:`short`,day:`numeric`})]})]})}),(0,$.jsxs)(S,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{}),(0,$.jsx)(`span`,{className:`text-right`,children:`avg`}),(0,$.jsx)(`span`,{className:`text-right`,children:`p50`}),(0,$.jsx)(`span`,{className:`text-right`,children:`p90`}),(0,$.jsx)(`span`,{className:`text-right`,children:`min`}),(0,$.jsx)(`span`,{className:`text-right`,children:`max`})]}),(0,$.jsx)(Xi,{label:`Wait`,summary:e.wait}),(0,$.jsx)(Xi,{label:`Duration`,summary:e.duration})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Outcomes`}),i>0?(0,$.jsx)(`div`,{id:`gates-${e.kind}-outcomes`}):(0,$.jsx)(Bi,{height:180,children:`No runs`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Wait (minutes)`}),c?(0,$.jsx)(`div`,{id:`gates-${e.kind}-wait`}):(0,$.jsx)(Bi,{height:180,children:`Not recorded`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:`Run duration (minutes)`}),l?(0,$.jsx)(`div`,{id:`gates-${e.kind}-duration`}):(0,$.jsx)(Bi,{height:180,children:`Not recorded`})]})]})]})]})}function Qi({stats:e}){return e.runs.length===0?(0,$.jsx)(Bi,{height:80,children:`No gate runs in this period`}):(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`gates-runs`,children:[(0,$.jsx)(`thead`,{className:`text-[11px] text-muted-foreground text-left`,children:(0,$.jsx)(`tr`,{children:[`Time`,`Gate`,`Task / branch / sha`,`Host`,`Wait`,`Duration`,`Outcome`,`Failing step`,`Log`].map(e=>(0,$.jsx)(`th`,{className:`px-2 py-1 font-normal`,children:e},e))})}),(0,$.jsx)(`tbody`,{children:e.runs.map(e=>(0,$.jsxs)(`tr`,{className:`border-t border-border/50`,children:[(0,$.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap tabular-nums`,children:new Date(e.at).toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}),(0,$.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap`,children:Hi[e.kind]}),(0,$.jsxs)(`td`,{className:`px-2 py-1 max-w-[18rem] truncate`,title:[e.branch,e.sha].filter(Boolean).join(` @ `),children:[e.taskId!==null&&(0,$.jsxs)(`span`,{className:`mr-1`,children:[`T`,e.taskId]}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.branch??``,e.sha?` ${e.sha.slice(0,9)}`:``]})]}),(0,$.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap text-muted-foreground`,children:e.host??`—`}),(0,$.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums`,children:Ji(e.waitMs)}),(0,$.jsxs)(`td`,{className:`px-2 py-1 text-right tabular-nums`,children:[Ji(e.durationMs),e.gateTimings?.length?(0,$.jsxs)(`details`,{className:`text-left min-w-[12rem]`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Per gate`}),e.gateTimings.map((e,t)=>(0,$.jsxs)(`div`,{title:`Start: ${e.startedAt===void 0?`unknown`:new Date(e.startedAt).toISOString()} · End: ${e.endedAt===void 0?`unknown`:new Date(e.endedAt).toISOString()}`,children:[e.name,`: `,Ji(e.durationMs),` · exit `,e.exitCode??`unknown`,e.attempt?` · attempt ${e.attempt}`:``]},t))]}):null]}),(0,$.jsx)(`td`,{className:t(`px-2 py-1`,Ki[e.outcome]),children:e.outcome}),(0,$.jsx)(`td`,{className:`px-2 py-1 max-w-[14rem] truncate`,title:e.failingStep??``,children:e.failingStep??``}),(0,$.jsx)(`td`,{className:`px-2 py-1`,children:e.logArtifactId?(0,$.jsx)(`button`,{type:`button`,className:`underline text-muted-foreground hover:text-foreground`,onClick:()=>c(e.logArtifactId),children:`log`}):e.logUrl?(0,$.jsx)(`a`,{className:`underline text-muted-foreground hover:text-foreground`,href:e.logUrl,target:`_blank`,rel:`noreferrer`,children:`log`}):(0,$.jsx)(`span`,{className:`text-muted-foreground`,title:`No log was captured for this run`,children:`—`})})]},`${e.kind}:${e.id}`))})]})})}function $i({period:e,isDark:t}){let n=i(e=>e.connected),r=qi(e),[o,s]=(0,D.useState)([]),[c,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(null);return(0,D.useEffect)(()=>{n&&l(`GET`,`/projects`).then(e=>s(e.projects??[])).catch(()=>{})},[n]),(0,D.useEffect)(()=>{if(!n)return;let e=!0;return l(`GET`,`/gates/stats?${new URLSearchParams({period:r,...c?{projectId:c}:{}})}`).then(t=>{e&&(f(t),m(null))}).catch(t=>{e&&m(a(t))}),()=>{e=!1}},[r,c,n]),(0,$.jsxs)(`div`,{className:`space-y-4`,"data-testid":`gates-panel`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,$.jsxs)(`select`,{"aria-label":`Gate project`,className:`h-8 rounded-md border border-border bg-background px-2 text-sm`,value:c,onChange:e=>u(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:`All projects`}),o.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.title??e.slug},e.id))]}),(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Window `,r,`. Iterate and delivery count gate runs started through relay_run.`]})]}),p&&(0,$.jsx)(`div`,{role:`alert`,className:`rounded-md border border-tone-danger/40 bg-tone-danger/10 px-3 py-2 text-sm`,children:p}),d&&E.map(e=>{let n=d.kinds.find(t=>t.kind===e);return n?(0,$.jsx)(Zi,{stats:n,isDark:t},e):null}),d&&(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{className:`pb-2`,children:(0,$.jsxs)(C,{className:`text-sm font-medium`,children:[`Last `,d.runs.length,` runs`]})}),(0,$.jsx)(S,{children:(0,$.jsx)(Qi,{stats:d})})]})]})}function ea({inputTokens:e,cacheReadTokens:t}){let n=e+t;return n<=0?null:t/n}function ta(e){return e===null?`—`:`${Math.round(e*100)}%`}var na=30,ra=[{id:`1h`,label:`1h`,ms:36e5},{id:`6h`,label:`6h`,ms:216e5},{id:`24h`,label:`24h`,ms:864e5},{id:`7d`,label:`7d`,ms:6048e5},{id:`14d`,label:`14d`,ms:12096e5},{id:`30d`,label:`30d`,ms:2592e6}];function ia(e){return ra.find(t=>t.id===e)?.ms??864e5}var aa=[`Chat`,`Replies`,`Channel`,`Pair`,`Work items`],oa={Chat:`#3b82f6`,Replies:`#06b6d4`,Channel:`#8b5cf6`,Pair:`#f59e0b`,"Work items":`#10b981`},sa=[`tool`,`reasoning`,`narration`,`response`],ca={tool:`Tool calls`,reasoning:`Reasoning`,narration:`Narration`,response:`Responses`},la={tool:`#3b82f6`,reasoning:`#a855f7`,narration:`#f59e0b`,response:`#10b981`},ua={claude:`#f97316`,"claude-b":`#fb923c`,codex:`#22c55e`},da=[`#3b82f6`,`#a855f7`,`#06b6d4`,`#ec4899`];function fa(e,t){return ua[e]??da[t%da.length]}function pa(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function ma(e){if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return r?`${n}m ${r}s`:`${n}m`}function ha(e,t){let n=ia(t)<=864e5;return e.map(e=>{let t=new Date(e.start);return n?t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})})}function ga({label:e,value:t,sub:n,icon:r,className:i}){return(0,$.jsx)(w,{children:(0,$.jsx)(S,{className:`pt-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg ${i}`,children:(0,$.jsx)(r,{className:`w-4 h-4`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums leading-tight`,children:t}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e}),n&&(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground/70 truncate`,children:n})]})]})})})}function _a({label:e,value:t,accent:n}){return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/60 bg-muted/30 p-3`,children:[(0,$.jsx)(`p`,{className:`text-xl font-semibold tabular-nums ${n??``}`,children:t}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:e})]})}function va(){let e=i(e=>e.analyticsPeriod),t=i(e=>e.setAnalyticsPeriod);return(0,$.jsx)(`div`,{className:`flex items-center gap-1 bg-muted rounded-lg p-1`,children:ra.map(n=>(0,$.jsx)(`button`,{onClick:()=>t(n.id),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors ${e===n.id?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`}`,children:n.label},n.id))})}function ya(){let e=i(e=>e.analyticsPeriod),t=i(e=>e.analyticsTab),n=i(e=>e.setAnalyticsTab),r=i(e=>e.theme),a=u.find(e=>e.id===r)?.dark??!0;return(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 flex-wrap`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Analytics`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Fleet activity over the selected window — not point-in-time status`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,$.jsx)(p,{value:t,onValueChange:e=>n(e),children:(0,$.jsxs)(f,{children:[(0,$.jsx)(d,{value:`overview`,children:`Overview`}),(0,$.jsx)(d,{value:`gates`,children:`Gates`})]})}),(0,$.jsx)(va,{})]})]}),t===`gates`?(0,$.jsx)($i,{period:e,isDark:a}):(0,$.jsx)(ba,{period:e,isDark:a})]})}function ba({period:e,isDark:t}){let n=i(e=>e.analyticsData),r=t?{text:`rgba(255,255,255,0.45)`,grid:`rgba(255,255,255,0.06)`,legend:`rgba(255,255,255,0.65)`}:{text:`rgba(0,0,0,0.45)`,grid:`rgba(0,0,0,0.08)`,legend:`rgba(0,0,0,0.65)`},a={chart:{background:`transparent`,toolbar:{show:!1},fontFamily:`inherit`},theme:{mode:t?`dark`:`light`},grid:{borderColor:r.grid,strokeDashArray:3},tooltip:{theme:t?`dark`:`light`},dataLabels:{enabled:!1}},[c,u]=(0,D.useState)({}),d=i(e=>e.connected),f=i(e=>e.agentsById);(0,D.useEffect)(()=>{if(!d)return;let t=!1,n=Date.now()-ia(e),r=s();return Promise.all(r.map(e=>l(`GET`,`/provider-quotas/history?provider=${e}&sinceMs=${n}&limit=5000`).then(t=>({provider:e,snapshots:t})).catch(()=>({provider:e,snapshots:[]})))).then(e=>{if(t)return;let n={};for(let t of e)n[t.provider]=t.snapshots;u(n)}),()=>{t=!0}},[e,d]);let[p,T]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(!d)return;let e=!1;return l(`GET`,`/metrics/lead-time?windowDays=${na}`).then(t=>{e||T(t)}).catch(()=>{e||T(null)}),()=>{e=!0}},[d]);let[E,O]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(!d)return;let t=!1;return l(`GET`,`/stats/token-usage?period=${e}`).then(e=>{t||O(e)}).catch(()=>{t||O(null)}),()=>{t=!0}},[e,d]);let k=(0,D.useMemo)(()=>{let e=[],t=Object.keys(c).sort();for(let n=0;n<t.length;n++){let r=t[n],i=c[r],a=[];for(let e of i){if(!e.quota)continue;let t=e.quota.windows.find(e=>e.name===`five_hour`||e.name===`primary`);t&&a.push([e.capturedAt,Math.round(t.utilization*100)])}a.length>0&&e.push({name:`${o(r)} 5h`,data:a,color:fa(r,n)})}return e},[c]),A=(0,D.useMemo)(()=>ha(n?.work.buckets??[],e),[n,e]),M=(0,D.useMemo)(()=>sa.flatMap(e=>{let t=(n?.work.buckets??[]).map(t=>t.counts[e]??0);return t.some(e=>e>0)?[{name:ca[e],data:t,color:la[e]}]:[]}),[n]),N=(0,D.useMemo)(()=>aa.flatMap(e=>{let t=(n?.conversation.buckets??[]).map(t=>t.counts[e]??0);return t.some(e=>e>0)?[{name:e,data:t,color:oa[e]}]:[]}),[n]),P=(0,D.useMemo)(()=>{let e=n?.work.totals,t=e?sa.filter(t=>(e[t]??0)>0):[];return{labels:t.map(e=>ca[e]),values:t.map(t=>e[t]),colors:t.map(e=>la[e])}},[n]),F=(0,D.useMemo)(()=>[{name:`Prompts`,data:(n?.user.buckets??[]).map(e=>e.prompts),color:`#06b6d4`}],[n]),I=(0,D.useMemo)(()=>[{name:`Spawns`,data:(n?.fleet.buckets??[]).map(e=>e.registrations),color:`#8b5cf6`}],[n]),L=(0,D.useMemo)(()=>{let e=n?.heatmap??Array.from({length:7},()=>Array(24).fill(0));return[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`].map((t,n)=>({name:t,data:(e[n]??Array(24).fill(0)).map((e,t)=>({x:String(t).padStart(2,`0`),y:e}))}))},[n]),R={categories:A,labels:{style:{colors:r.text,fontSize:`11px`},rotate:-30,hideOverlappingLabels:!0},axisBorder:{show:!1},axisTicks:{show:!1}},ee={labels:{style:{colors:r.text,fontSize:`11px`}}};Vi(`an-work`,()=>({...a,chart:{...a.chart,type:`area`,height:260,stacked:!0},series:M,colors:M.map(e=>e.color),xaxis:R,yaxis:ee,fill:{type:`gradient`,gradient:{shadeIntensity:.8,opacityFrom:.65,opacityTo:.15,stops:[0,100]}},stroke:{curve:`smooth`,width:2},legend:{position:`top`,horizontalAlign:`left`,labels:{colors:r.legend},fontSize:`11px`}}),[M,A,t],M.length>0),Vi(`an-conversation`,()=>({...a,chart:{...a.chart,type:`area`,height:220,stacked:!0},series:N,colors:N.map(e=>e.color),xaxis:R,yaxis:ee,fill:{type:`gradient`,gradient:{shadeIntensity:.8,opacityFrom:.6,opacityTo:.12,stops:[0,100]}},stroke:{curve:`smooth`,width:2},legend:{position:`top`,horizontalAlign:`left`,labels:{colors:r.legend},fontSize:`11px`}}),[N,A,t],N.length>0),Vi(`an-toptools`,()=>({...a,chart:{...a.chart,type:`bar`,height:260},series:[{name:`Calls`,data:(n?.work.topTools??[]).map(e=>e.count)}],colors:[`#3b82f6`],plotOptions:{bar:{horizontal:!0,borderRadius:3,barHeight:`70%`,distributed:!1}},xaxis:{categories:(n?.work.topTools??[]).map(e=>e.name),labels:{style:{colors:r.text,fontSize:`11px`}},axisBorder:{show:!1},axisTicks:{show:!1}},yaxis:{labels:{style:{colors:r.text,fontSize:`11px`},maxWidth:220}},dataLabels:{enabled:!0,style:{fontSize:`10px`,colors:[t?`white`:`black`]},offsetX:24,formatter:e=>pa(e)},tooltip:{...a.tooltip,y:{formatter:e=>`${e} calls`}}}),[n?.work.topTools,t],(n?.work.topTools.length??0)>0),Vi(`an-composition`,()=>({...a,chart:{...a.chart,type:`donut`,height:260},series:P.values,labels:P.labels,colors:P.colors,legend:{position:`bottom`,labels:{colors:r.legend},fontSize:`11px`},plotOptions:{pie:{donut:{size:`62%`}}},stroke:{width:0}}),[P,t],P.values.length>0),Vi(`an-prompts`,()=>({...a,chart:{...a.chart,type:`area`,height:120,sparkline:{enabled:!0}},series:F,colors:[`#06b6d4`],fill:{type:`gradient`,gradient:{opacityFrom:.45,opacityTo:.05}},stroke:{curve:`smooth`,width:2},tooltip:{...a.tooltip,x:{show:!1}}}),[F,t],(n?.user.prompts??0)>0),Vi(`an-spawns`,()=>({...a,chart:{...a.chart,type:`bar`,height:200},series:I,colors:[`#8b5cf6`],plotOptions:{bar:{borderRadius:3,columnWidth:`60%`}},xaxis:R,yaxis:{...ee,labels:{...ee.labels,formatter:e=>String(Math.round(e))}}}),[I,A,t],(n?.fleet.registrations??0)>0),Vi(`an-heatmap`,()=>({...a,chart:{...a.chart,type:`heatmap`,height:240},series:L,colors:[`#3b82f6`],xaxis:{labels:{style:{colors:r.text,fontSize:`10px`}},axisBorder:{show:!1},axisTicks:{show:!1}},yaxis:ee,plotOptions:{heatmap:{radius:3,enableShades:!0,shadeIntensity:.6,colorScale:{ranges:[{from:0,to:0,color:t?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.04)`,name:`idle`}]}}}}),[L,t],(n?.conversation.total??0)+(n?.work.toolCalls??0)>0),Vi(`an-quota`,()=>({...a,chart:{...a.chart,type:`line`,height:240},series:k.map(e=>({name:e.name,data:e.data})),colors:k.map(e=>e.color),xaxis:{type:`datetime`,labels:{style:{colors:r.text,fontSize:`11px`},datetimeUTC:!1},axisBorder:{show:!1},axisTicks:{show:!1}},yaxis:{min:0,max:100,labels:{style:{colors:r.text,fontSize:`11px`},formatter:e=>`${Math.round(e)}%`}},stroke:{curve:`stepline`,width:2},legend:{position:`top`,horizontalAlign:`left`,labels:{colors:r.legend},fontSize:`11px`},tooltip:{...a.tooltip,x:{format:`MMM dd, HH:mm`},y:{formatter:e=>`${e}%`}},annotations:{yaxis:[{y:93,borderColor:r.grid,strokeDashArray:4,label:{text:`target (93%)`,style:{color:r.text,fontSize:`9px`,background:`transparent`},position:`left`}}]}}),[k,t],k.length>0);let te=n?.user,z=n?.fleet,ne=z?.leaderboard??[],re=Math.max(1,...ne.map(e=>e.toolCalls+e.messages));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,$.jsx)(ga,{label:`Active agents`,sub:`sent activity this period`,value:z?.activeAgents??0,icon:m,className:`bg-tone-success/10 text-tone-success-fg`}),(0,$.jsx)(ga,{label:`Provider turns`,value:pa(n?.work.turns??0),icon:_,className:`bg-tone-info/10 text-tone-info-fg`}),(0,$.jsx)(ga,{label:`Tool calls`,value:pa(n?.work.toolCalls??0),icon:y,className:`bg-tone-violet/10 text-tone-violet-fg`}),(0,$.jsx)(ga,{label:`Human prompts`,sub:te&&te.prompts>0?`${Math.round(te.replyRate*100)}% replied`:void 0,value:pa(te?.prompts??0),icon:v,className:`bg-tone-cyan/10 text-tone-cyan-fg`}),(0,$.jsx)(ga,{label:`Median idea→proven (${na}d)`,sub:p&&p.ideaToProven.count>0?`${p.ideaToProven.count} sample(s)`:`awaiting proven events`,value:p?.ideaToProven.p50==null?`–`:ma(p.ideaToProven.p50),icon:h,className:`bg-tone-warning/10 text-tone-warning-fg`})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Agent work over time`})}),(0,$.jsx)(S,{children:M.length===0?(0,$.jsx)(Bi,{height:260,children:`No agent activity in this period`}):(0,$.jsx)(`div`,{id:`an-work`})})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Quota utilization`})}),(0,$.jsx)(S,{children:k.length===0?(0,$.jsx)(Bi,{height:240,children:`No quota history in this period`}):(0,$.jsx)(`div`,{id:`an-quota`})})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsxs)(C,{className:`text-sm flex items-center gap-1.5`,children:[(0,$.jsx)(g,{className:`w-3.5 h-3.5 text-tone-warning-fg`}),` Token usage`]})}),(0,$.jsx)(S,{children:!E||E.total.reports===0?(0,$.jsx)(Bi,{height:140,children:`No token usage reported in this period`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 xl:grid-cols-8 gap-3 mb-4`,children:[(0,$.jsx)(_a,{label:`Total tokens`,value:pa(E.total.totalTokens),accent:`text-tone-warning-fg`}),(0,$.jsx)(_a,{label:`Input`,value:pa(E.total.inputTokens)}),(0,$.jsx)(_a,{label:`Output`,value:pa(E.total.outputTokens)}),(0,$.jsx)(_a,{label:`Cache read`,value:pa(E.total.cacheReadTokens)}),(0,$.jsx)(_a,{label:`Cache hit %`,value:ta(ea(E.total)),accent:`text-tone-success-fg`}),(0,$.jsx)(_a,{label:`Cache write`,value:pa(E.total.cacheWriteTokens)}),(0,$.jsx)(_a,{label:`Reasoning`,value:pa(E.total.reasoningOutputTokens)}),(0,$.jsx)(_a,{label:`Reports`,value:pa(E.total.reports)})]}),(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`div`,{className:`space-y-1.5 min-w-[720px]`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-[1fr_repeat(7,minmax(4.5rem,auto))] gap-3 px-2 text-[11px] text-muted-foreground uppercase tracking-wide`,children:[(0,$.jsx)(`span`,{children:`Provider`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Reports`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Input`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Output`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Cache R`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Cache hit`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Cache W`}),(0,$.jsx)(`span`,{className:`text-right`,children:`Total`})]}),E.providers.map((e,t)=>(0,$.jsxs)(`div`,{className:`relative grid grid-cols-[1fr_repeat(7,minmax(4.5rem,auto))] gap-3 px-2 py-1.5 rounded-md overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 opacity-10`,style:{width:`${e.totalTokens/Math.max(1,E.total.totalTokens)*100}%`,background:fa(e.provider,t)}}),(0,$.jsxs)(`span`,{className:`relative truncate text-sm font-medium flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:fa(e.provider,t)}}),o(e.provider)]}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm text-muted-foreground`,children:pa(e.reports)}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm`,children:pa(e.inputTokens)}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm`,children:pa(e.outputTokens)}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm text-muted-foreground`,children:pa(e.cacheReadTokens)}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm text-tone-success-fg`,children:ta(ea(e))}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm text-muted-foreground`,children:pa(e.cacheWriteTokens)}),(0,$.jsx)(`span`,{className:`relative text-right tabular-nums text-sm font-medium text-tone-warning-fg`,children:pa(e.totalTokens)})]},e.provider))]})})]})})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Top tools`})}),(0,$.jsx)(S,{children:(n?.work.topTools.length??0)===0?(0,$.jsx)(Bi,{height:260,children:`No tool calls in this period`}):(0,$.jsx)(`div`,{id:`an-toptools`})})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Turn composition`})}),(0,$.jsx)(S,{children:P.values.length===0?(0,$.jsx)(Bi,{height:260,children:`No agent activity in this period`}):(0,$.jsx)(`div`,{id:`an-composition`})})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Conversation volume`})}),(0,$.jsx)(S,{children:N.length===0?(0,$.jsx)(Bi,{height:220,children:`No messages in this period`}):(0,$.jsx)(`div`,{id:`an-conversation`})})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`User interaction`})}),(0,$.jsxs)(S,{children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,$.jsx)(_a,{label:`Prompts`,value:pa(te?.prompts??0),accent:`text-tone-cyan-fg`}),(0,$.jsx)(_a,{label:`Reply rate`,value:te&&te.prompts>0?`${Math.round(te.replyRate*100)}%`:`—`}),(0,$.jsx)(_a,{label:`Median reply`,value:te?.latencyMs?ma(te.latencyMs.median):`—`,accent:`text-tone-success-fg`}),(0,$.jsx)(_a,{label:`Avg reply`,value:te?.latencyMs?ma(te.latencyMs.avg):`—`}),(0,$.jsx)(_a,{label:`p90 reply`,value:te?.latencyMs?ma(te.latencyMs.p90):`—`}),(0,$.jsx)(_a,{label:`Replied`,value:pa(te?.replied??0)})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-3 mb-1`,children:`Prompts over time`}),(te?.prompts??0)===0?(0,$.jsx)(Bi,{height:120,children:`No prompts in this period`}):(0,$.jsx)(`div`,{id:`an-prompts`})]})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Fleet activity`})}),(0,$.jsxs)(S,{children:[(0,$.jsxs)(`div`,{className:`flex gap-6 mb-3 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold tabular-nums`,children:z?.registrations??0}),` `,(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`spawns`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold tabular-nums text-tone-violet-fg`,children:z?.spawnedByAgent??0}),` `,(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`by agents`})]})]}),(z?.registrations??0)===0?(0,$.jsx)(Bi,{height:200,children:`No agents started in this period`}):(0,$.jsx)(`div`,{id:`an-spawns`})]})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Busiest hours`})}),(0,$.jsx)(S,{children:(n?.conversation.total??0)+(n?.work.toolCalls??0)===0?(0,$.jsx)(Bi,{height:240,children:`No data for heatmap`}):(0,$.jsx)(`div`,{id:`an-heatmap`})})]})]}),(0,$.jsxs)(w,{children:[(0,$.jsx)(x,{children:(0,$.jsx)(C,{className:`text-sm`,children:`Most active agents`})}),(0,$.jsx)(S,{children:ne.length===0?(0,$.jsx)(Bi,{height:120,children:`No agent activity in this period`}):(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto_auto] gap-4 px-2 text-[11px] text-muted-foreground uppercase tracking-wide`,children:[(0,$.jsx)(`span`,{children:`Agent`}),(0,$.jsx)(`span`,{className:`text-right w-16`,children:`Turns`}),(0,$.jsx)(`span`,{className:`text-right w-16`,children:`Tools`}),(0,$.jsx)(`span`,{className:`text-right w-16`,children:`Msgs`})]}),ne.map(e=>(0,$.jsxs)(`div`,{className:`relative grid grid-cols-[1fr_auto_auto_auto] gap-4 px-2 py-1.5 rounded-md overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-tone-info/10`,style:{width:`${(e.toolCalls+e.messages)/re*100}%`}}),(0,$.jsx)(`span`,{className:`relative min-w-0 text-sm font-medium`,children:(0,$.jsx)(b,{agent:f[e.id],fallback:e.label||e.id})}),(0,$.jsx)(`span`,{className:`relative text-right w-16 tabular-nums text-sm`,children:pa(e.turns)}),(0,$.jsx)(`span`,{className:`relative text-right w-16 tabular-nums text-sm text-tone-violet-fg`,children:pa(e.toolCalls)}),(0,$.jsx)(`span`,{className:`relative text-right w-16 tabular-nums text-sm text-muted-foreground`,children:pa(e.messages)})]},e.id))]})})]})]})}export{ya as AnalyticsView};
|
|
910
|
-
//# sourceMappingURL=analytics-
|
|
910
|
+
//# sourceMappingURL=analytics-rasmoPjR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{t as a,wt as o}from"./store-
|
|
2
|
-
//# sourceMappingURL=artifact-viewer-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,o as n,p as r,u as i}from"./dist-DeW2Y1R5.js";import{t as a,wt as o}from"./store-BgDALGIX.js";import{M as s}from"./provider-display-bWwiuedV.js";import{i as c,l,n as u,r as d,s as f,t as p}from"./artifacts-Bjq-ZyBA.js";import{_ as m,et as h,v as g,y as _}from"./display-BemJG1f_.js";import{a as v,n as y,t as b}from"./api-CIIVBtAV.js";import{a as ee,i as x,n as S,o as C,r as w,s as T,t as E}from"./dialog-uuJ9_geR.js";import{t as D}from"./circle-alert-CryagaZd.js";import{t as O}from"./download-KgtpDbt5.js";import{t as k}from"./file-text-CKuoMR2U.js";import{n as A,t as j}from"./markdown-preview-DNT4OUwQ.js";import{t as M}from"./loader-circle-BfPd4kOD.js";import{t as N}from"./minimize-2-BkK6XoMP.js";import{n as P,t as F}from"./pin-DcsKeXxr.js";import{t as I}from"./button-Do6Z3vvn.js";import{t as L}from"./badge-DqJRtj_p.js";import{t as R}from"./copy-button-CjOj4HEf.js";import{n as z,t as B}from"./task-chip-CYj0mpoL.js";import{t as V}from"./agent-name-C_7F4DFR.js";var H=t(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),U=t(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),W=e(r(),1),G=i();function K({artifact:e}){let[t,n]=(0,W.useState)(!!e.pinned),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(null);async function c(){i(!0),o(null);try{let r=await b(`PUT`,`/artifacts/${encodeURIComponent(e.id)}/pin`,{pinned:!t});n(!!r.pinned),d()}catch(e){o(s(e))}finally{i(!1)}}return(0,G.jsxs)(`span`,{className:`inline-flex max-w-full flex-wrap items-center gap-1`,children:[t&&(0,G.jsx)(L,{variant:`secondary`,children:`Pinned`}),(0,G.jsxs)(I,{size:`sm`,variant:`ghost`,disabled:r,onClick:()=>void c(),"aria-label":`${t?`Unpin`:`Pin`} ${e.filename??e.id}`,title:t?`Allow automatic cleanup`:`Keep from automatic cleanup`,children:[t?(0,G.jsx)(P,{className:`h-3.5 w-3.5`}):(0,G.jsx)(F,{className:`h-3.5 w-3.5`}),t?`Unpin`:`Pin`]}),a&&(0,G.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:a})]})}var q=512*1024,J=e=>`/artifacts/${encodeURIComponent(e)}/content`;function Y(){let e=l();return(0,G.jsx)(E,{open:e!==null,onOpenChange:e=>{e||c()},children:e&&(0,G.jsx)(Q,{id:e},e)})}function X({uploader:e,agentsById:t,className:r}){let i=t[e];return i?(0,G.jsx)(V,{agent:i,className:r}):(0,G.jsx)(`span`,{className:n(`truncate`,r),title:e,children:f(e,t)})}function Z({view:e,className:t}){return(0,G.jsx)(e===`image`?H:e===`binary`?A:k,{"aria-hidden":!0,className:n(`shrink-0`,t)})}function Q({id:e}){let[t,r]=(0,W.useState)(null),[i,c]=(0,W.useState)({state:`loading`}),[l,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(!1),E=a(e=>e.agentsById),D=o();(0,W.useEffect)(()=>{let t=new AbortController,n=null;return(async()=>{try{let i=await b(`GET`,`/artifacts/${encodeURIComponent(e)}`);if(t.signal.aborted)return;r(i);let a=u(i);if(a===`binary`)return c({state:`binary`});if(a===`image`){let r=await y(J(e));return t.signal.aborted?void 0:(n=URL.createObjectURL(r),c({state:`image`,url:n}))}let o=await v(J(e),q,t.signal);if(t.signal.aborted)return;c(o.text.includes(`\0`)?{state:`binary`}:{state:`text`,text:o.text})}catch(e){t.signal.aborted||c({state:`error`,message:s(e)})}})(),()=>{t.abort(),n&&URL.revokeObjectURL(n)}},[e]);async function k(){if(t){m(!0);try{let n=i.state===`image`?i.url:URL.createObjectURL(await y(J(e))),r=document.createElement(`a`);r.href=n,r.download=p(t),document.body.appendChild(r),r.click(),r.remove(),i.state!==`image`&&setTimeout(()=>URL.revokeObjectURL(n),0)}catch(e){c({state:`error`,message:s(e)})}finally{m(!1)}}}let A=t?u(t):`text`,j=t!==null&&i.state===`text`&&t.size>q;return(0,G.jsxs)(w,{className:`w-[calc(100%-1rem)] max-w-5xl gap-3 sm:w-[calc(100%-2rem)]`,"aria-describedby":void 0,"data-testid":`artifact-viewer`,children:[(0,G.jsxs)(C,{className:`min-w-0 pr-8`,children:[(0,G.jsxs)(T,{className:`flex min-w-0 items-center gap-2 leading-snug`,children:[(0,G.jsx)(Z,{view:A,className:`h-4 w-4 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t?p(t):e})]}),t&&(0,G.jsx)(x,{asChild:!0,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:t.id}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:t.kind}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:_(t.size)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{className:`min-w-0 break-all`,children:t.mediaType}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{title:g(t.createdAt),children:h(D,t.createdAt)}),t.uploader&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[`by `,(0,G.jsx)(X,{uploader:t.uploader,agentsById:E,className:`font-medium text-foreground`})]})]})]})}),t?.links&&t.links.length>0&&(0,G.jsx)(te,{links:t.links})]}),(0,G.jsx)(S,{className:n(`rounded-md`,i.state===`image`&&l&&`overflow-x-auto`),children:(0,G.jsx)(ne,{artifact:t,view:A,content:i,zoomed:l,onToggleZoom:()=>d(e=>!e)})}),(0,G.jsxs)(ee,{className:`flex-row flex-wrap items-center justify-end gap-2 sm:flex-row`,children:[j&&t&&(0,G.jsxs)(`span`,{className:`mr-auto text-xs text-muted-foreground`,children:[`Showing the first `,_(q),` of `,_(t.size)]}),i.state===`image`&&(0,G.jsxs)(I,{variant:`outline`,size:`sm`,onClick:()=>d(e=>!e),children:[l?(0,G.jsx)(N,{}):(0,G.jsx)(U,{}),l?`Fit`:`Actual size`]}),t&&(0,G.jsx)(K,{artifact:t}),(0,G.jsx)(R,{value:e,label:`Copy id`,copiedLabel:`Copied`,showText:!0,size:`sm`,variant:`outline`}),(0,G.jsxs)(I,{size:`sm`,onClick:()=>void k(),disabled:!t||f,children:[f?(0,G.jsx)(M,{className:`animate-spin`}):(0,G.jsx)(O,{}),`Download`]})]})]})}function te({links:e}){let t=a(e=>e.openTaskDetailById);return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:e.map(e=>{let n=e.id,r=Number(e.entityId);return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e.entityType===`task`&&Number.isSafeInteger(r)?(0,G.jsx)(B,{id:r,title:e.title,onClick:()=>{c(),t(r)}}):(0,G.jsx)(z,{label:e.entityType===`message`?m(e.entityId):`${e.entityType} ${e.entityId}`,title:e.title}),e.role&&(0,G.jsx)(`span`,{children:e.role})]},n)})})}function $({icon:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 py-8 text-center text-sm text-muted-foreground`,children:[e,t]})}function ne({artifact:e,view:t,content:r,zoomed:i,onToggleZoom:a}){return r.state===`error`?(0,G.jsx)($,{icon:(0,G.jsx)(D,{className:`h-5 w-5 text-tone-danger-fg`}),children:(0,G.jsx)(`span`,{className:`text-tone-danger-fg`,children:r.message})}):!e||r.state===`loading`?(0,G.jsx)($,{icon:(0,G.jsx)(M,{className:`h-5 w-5 animate-spin`}),children:`Loading…`}):r.state===`binary`?(0,G.jsxs)($,{icon:(0,G.jsx)(A,{className:`h-6 w-6`}),children:[`No preview for `,e.mediaType,`. Download it to open it.`]}):r.state===`image`?(0,G.jsx)(`button`,{type:`button`,onClick:a,className:n(`block w-full`,i?`cursor-zoom-out`:`cursor-zoom-in`),title:i?`Fit to screen`:`Actual size`,children:(0,G.jsx)(`img`,{src:r.url,alt:p(e),className:i?`max-w-none`:`mx-auto max-h-[calc(var(--dialog-max-h)-12rem)] max-w-full object-contain`})}):t===`markdown`?(0,G.jsx)(j,{content:r.text,path:e.filename??`${e.id}.md`}):(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-5 [overflow-wrap:anywhere]`,children:t===`json`?re(r.text):r.text})}function re(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}export{U as a,K as i,Y as n,H as o,X as r,Z as t};
|
|
2
|
+
//# sourceMappingURL=artifact-viewer-tBpTrEPb.js.map
|