@zaip-ai/cli 7.5.0 → 7.6.0
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/README.md +12 -20
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.js +1 -1
- package/dist/services/codex-task-delivery-authority-template.d.ts.map +1 -1
- package/dist/services/codex-task-delivery-authority-template.js +39 -1
- package/dist/services/codex-task-delivery-authority-template.js.map +1 -1
- package/dist/services/global-codex-project-trust.d.ts +1 -1
- package/dist/services/global-codex-project-trust.d.ts.map +1 -1
- package/dist/services/global-codex-project-trust.js +46 -11
- package/dist/services/global-codex-project-trust.js.map +1 -1
- package/dist/services/global-codex-project-trust.test.js +35 -4
- package/dist/services/global-codex-project-trust.test.js.map +1 -1
- package/dist/services/install-agents-template.js +2 -2
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/install-target-windows.test.d.ts +2 -0
- package/dist/services/install-target-windows.test.d.ts.map +1 -0
- package/dist/services/install-target-windows.test.js +39 -0
- package/dist/services/install-target-windows.test.js.map +1 -0
- package/dist/services/install-target.d.ts +6 -0
- package/dist/services/install-target.d.ts.map +1 -0
- package/dist/services/install-target.js +89 -0
- package/dist/services/install-target.js.map +1 -0
- package/dist/services/install-target.test.d.ts +2 -0
- package/dist/services/install-target.test.d.ts.map +1 -0
- package/dist/services/install-target.test.js +47 -0
- package/dist/services/install-target.test.js.map +1 -0
- package/dist/services/logger.js +5 -3
- package/dist/services/logger.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/config/agents/discovery.json +1 -1
- package/templates/.agents/dashboard/.zaip-managed.json +72 -32
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{ProjectSettingsPage-BCsdQtWG.js → ProjectSettingsPage-86kLUrXm.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{TraceabilityWorkspace-BN8FwP5S.js → TraceabilityWorkspace-BZ1rH1vl.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{index-uIVtG2ZR.js → index-C4uiRYHu.js} +2 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{traceability-DFY7ZDlu.css → traceability-s5SzQnzt.css} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-vQx9R6BQ.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +3 -3
- package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-fixture.mjs +117 -0
- package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-lab.mjs +246 -0
- package/templates/.agents/dashboard/apps/frontend/e2e/release-delivery-receipt.mjs +65 -0
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-runtime-status.ts +5 -1
- package/templates/.agents/dashboard/apps/frontend/src/release-delivery.test.tsx +78 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.dom.test.ts +28 -6
- package/templates/.agents/dashboard/apps/frontend/src/use-runtime-status.ts +18 -7
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/modules/traceability/src/contracts.ts +11 -0
- package/templates/.agents/dashboard/modules/traceability/src/react/ReleaseDeliveryPanel.tsx +60 -0
- package/templates/.agents/dashboard/modules/traceability/src/react/TaskTracePanel.tsx +9 -57
- package/templates/.agents/dashboard/modules/traceability/src/react/release-delivery-panel.css +26 -0
- package/templates/.agents/dashboard/modules/traceability/src/react/trace-date-format.ts +33 -0
- package/templates/.agents/dashboard/modules/traceability/src/react/trace-stage-labels.ts +28 -0
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +236 -235
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +81 -81
- package/templates/.agents/dashboard/packages/local-runtime/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +236 -235
- package/templates/.agents/dashboard/packages/local-runtime/src/server-release-receipt.ts +71 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-release-delivery.ts +120 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +5 -4
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/stack-dependencies.json +3 -3
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/design/.zaip-managed.json +4 -4
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/design-system-maker/build.json +94 -79
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/requirements/autonomous-assurance.md +1 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +1 -1
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/landing-page-forms.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +1 -1
- package/templates/.agents/requirements/site-performance.md +1 -1
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +1 -1
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/historical-catalog-b6b6516200bdb412c92063e887ccef329d7c5193b5610cba5346e97c71301394.mjs +318 -0
- package/templates/.agents/runtime/bin/zaip.mjs +149 -109
- package/templates/.agents/runtime/checksums.sha256 +6 -5
- package/templates/.agents/runtime/manifest.json +2 -1
- package/templates/.agents/runtime/provenance.json +4 -4
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-contract.mjs +49 -70
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deploy-idempotent-intent.test.mjs +39 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-next-release.mjs +57 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/deployment-request.mjs +15 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-intent.mjs +4 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-A3ZCURGS.mjs → chunk-CJ5ZQF6M.mjs} +6 -6
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-ZOGCYGYB.mjs → chunk-EQTZ3Y7R.mjs} +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-FMNUSV2P.mjs +139 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/{chunk-7SBOEN6U.mjs → chunk-LWS3QVJO.mjs} +2 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/lifecycle-records.mjs +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/manifest.json +14 -13
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/native-authority.mjs +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/proof.mjs +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/run-records.mjs +1 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-schema.mjs +1 -1
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/template-manifest.json +141 -92
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-Boz50W9b.js +0 -1
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/publication-proof-runtime/chunks/chunk-NJOFXS7P.mjs +0 -137
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-DnxpHJSo.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-YfoKMzCQ.js","assets/cost-monitor-BESDS3aE.css","assets/dashboard-localization-BVBhiAAS.js","assets/DashboardHelpDialog-DRI_XwUf.css","assets/PricingSettingsDialog-DsFTUwhL.js","assets/ProjectSettingsPage-
|
|
2
|
-
import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n,a as r,b as i,g as a,i as o,n as s,o as c,r as l,t as u,w as d}from"./cost-monitor-YfoKMzCQ.js";import{t as f}from"./react-vendor-rGvJzdn5.js";import{n as p,t as m}from"./traceability-Boz50W9b.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var h=e(t(),1),g=f(),_=n();function v({children:e}){let t=typeof document>`u`?null:document.getElementById(`dashboard-toasts`);return t?(0,_.createPortal)(e,t):e}var y=d();function b({locale:e}){let t=e===`pt-BR`?[`Definição`,`Planejamento`,`Pronto para Executar`,`Execução`,`Verificação`]:[`Definition`,`Planning`,`Ready to Execute`,`Execution`,`Verification`];return(0,y.jsxs)(`main`,{"aria-busy":`true`,"aria-live":`polite`,"aria-label":e===`pt-BR`?`Preparando dashboard`:`Preparing dashboard`,className:`app-skeleton`,role:`status`,children:[(0,y.jsxs)(`header`,{className:`app-skeleton-header`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,y.jsx)(`h1`,{children:`Dashboard ZAIP AIOS`})]}),(0,y.jsxs)(`div`,{className:`app-skeleton-actions`,children:[(0,y.jsx)(`span`,{}),(0,y.jsx)(`span`,{}),(0,y.jsx)(`span`,{})]})]}),(0,y.jsx)(`section`,{className:`app-skeleton-kpis`,"aria-hidden":`true`,children:Array.from({length:4},(e,t)=>`skeleton-kpi-${t}`).map(e=>(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,y.jsx)(`span`,{className:`app-skeleton-value`}),(0,y.jsx)(`span`,{className:`app-skeleton-line`})]},e))}),(0,y.jsxs)(`section`,{className:`app-skeleton-panels`,"aria-hidden":`true`,children:[(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`div`,{className:`app-skeleton-chart`})]}),(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`div`,{className:`app-skeleton-chart app-skeleton-chart-small`})]})]}),(0,y.jsx)(`section`,{className:`app-skeleton-board`,"aria-hidden":`true`,children:t.map((e,t)=>(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`h2`,{children:e}),Array.from({length:t%2==0?2:1},(t,n)=>`${e}-${n}`).map(e=>(0,y.jsxs)(`div`,{className:`app-skeleton-card`,children:[(0,y.jsx)(`span`,{className:`app-skeleton-line`}),(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`span`,{className:`app-skeleton-pill`})]},e))]},e))})]})}function x(e,t){let n=t===`pt-BR`;return e===`costs`?n?{title:`Carregando Monitor de Custos…`,detail:`Isso costuma levar poucos segundos.`}:{title:`Loading Cost Monitor…`,detail:`This usually takes a few seconds.`}:e===`traceability`?n?{title:`Carregando Rastreabilidade…`,detail:`Estamos preparando as 6 etapas da task.`}:{title:`Loading Traceability…`,detail:`Preparing the task's 6 stages.`}:n?{title:`Atualizando dados do dashboard…`,detail:`Você pode continuar navegando.`}:{title:`Refreshing dashboard data…`,detail:`You can keep navigating.`}}function S({area:e,locale:t}){let n=x(e,t);return(0,y.jsxs)(`section`,{"aria-busy":`true`,"aria-live":`polite`,className:`app-loading-panel`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:n.title}),(0,y.jsx)(`span`,{children:n.detail})]})]})}function C({area:e,locale:t}){let n=x(e,t);return(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:n.title}),(0,y.jsx)(`span`,{children:n.detail})]})]})})}function w({locale:e,onRetry:t}){return(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-loading-panel app-loading-panel-error`,role:`status`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:e===`pt-BR`?`Não foi possível carregar os custos`:`Couldn't load costs`}),(0,y.jsx)(`span`,{children:e===`pt-BR`?`A tela continua disponível. Tente novamente quando quiser.`:`The dashboard remains available. Try again whenever you want.`})]}),(0,y.jsx)(`button`,{onClick:t,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Try again`})]})}function T({costsLoaded:e,currency:t,snapshotCurrency:n}){return!e||n!==t}function E({aborted:e,currentCurrency:t,currentPeriod:n,currentRequestVersion:r,requestVersion:i,requestedCurrency:a,requestedPeriod:o}){return!e&&i===r&&a===t&&o.from===n.from&&o.to===n.to}function D(e,t){return e===t}function O(e,t,n,r){return D(e,t)&&n.from===r.from&&n.to===r.to}function k(e){return e instanceof DOMException&&e.name===`AbortError`}function A(e,t){return e===t}function j(e,t,n){return D(e,t)&&!n.aborted}function ee(e,t){let n=e=>[...new Map(e.map(e=>[e.id,e])).values()];return{...e,prds:n([...e.prds,...t.flatMap(e=>e.prds)]),specs:n([...e.specs,...t.flatMap(e=>e.specs)]),tasks:n([...e.tasks,...t.flatMap(e=>e.tasks)]),changes:n([...e.changes,...t.flatMap(e=>e.changes)])}}function te(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>{e.current?.focus()},[]),(0,y.jsx)(`div`,{"aria-busy":`true`,"aria-live":`polite`,className:`period-transition-overlay`,onKeyDownCapture:e=>e.preventDefault(),ref:e,role:`status`,tabIndex:-1,children:(0,y.jsxs)(`div`,{className:`period-transition-overlay__content`,children:[(0,y.jsx)(`i`,{"aria-hidden":`true`,className:`period-transition-overlay__spinner`}),(0,y.jsx)(`span`,{className:`period-transition-overlay__label`,children:`Carregando...`})]})})}function ne({pending:e,children:t}){return(0,y.jsx)(`div`,{"aria-hidden":e||void 0,inert:e,children:t})}var M={"pt-BR":{action:`Tentar novamente`,guidance:`Abra a pasta dashboard dentro de .agents e dê dois cliques novamente no arquivo executável.`,title:`Não foi possível carregar o dashboard`},"en-US":{action:`Try again`,guidance:`Open the dashboard folder inside .agents, then double-click the executable file again.`,title:`Unable to load the dashboard`}};function re({children:e,error:t,globalLoadingPending:n,locale:r,onRefresh:i,operations:a,snapshotNotice:o,setupRoute:s}){if(s!==null)return s;if(t&&a===null){let e=M[r];return(0,y.jsx)(`main`,{className:`app-loading-boundary`,"aria-labelledby":`dashboard-load-error-title`,children:(0,y.jsxs)(`section`,{className:`app-loading-boundary__card`,role:`alert`,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:`app-loading-boundary__status-icon`,children:(0,y.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{d:`M12 8v4m0 4h.01M10.29 3.86 2.82 16.5A2 2 0 0 0 4.54 19.5h14.92a2 2 0 0 0 1.72-3L13.71 3.86a2 2 0 0 0-3.42 0Z`})})}),(0,y.jsxs)(`div`,{className:`app-loading-boundary__content`,children:[(0,y.jsx)(`p`,{className:`app-loading-boundary__eyebrow`,children:r===`pt-BR`?`Dashboard indisponível`:`Dashboard unavailable`}),(0,y.jsx)(`h1`,{id:`dashboard-load-error-title`,children:e.title}),(0,y.jsx)(`p`,{children:e.guidance})]}),(0,y.jsx)(`button`,{onClick:i,type:`button`,children:e.action})]})})}return a===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(b,{locale:r}),o,n?(0,y.jsx)(te,{}):null,(0,y.jsx)(C,{area:`operations`,locale:r})]}):e}function ie(e){let t=new Set(e.blocked.map(e=>e.id));return{reconciled:e.reconciled_ids.filter(e=>!t.has(e)).length,blocked:e.blocked.length,notReconciled:e.not_reconciled.length}}function ae(e){let t=new Set(e.blocked.map(e=>e.id));return e.reconciled_ids.filter(e=>!t.has(e)).map(t=>{let n=e.outcomes?.find(e=>e.id===t);return{id:t,reason:n?.reason??null,status:n?.status??null}})}function N(e,t){return e===null?``:t===`pt-BR`?{completed:`Concluído`,delivered:`Entregue`,failed:`Falha técnica`,blocked:`Bloqueado`,cancelled:`Cancelado`}[e]??e:e}var P={"Invocation is still running":`A invocação ainda está em execução. Foi preservada intencionalmente; isso não indica falha do comando.`,"Host terminated without delivery evidence":`O host encerrou sem evidências de entrega.`,"Host interrupted":`O host foi interrompido.`,"Child attempt stopped":`A tentativa do subagente foi encerrada.`,"Execution orphaned after the reconciliation grace period":`A execução ficou sem orquestrador ativo após o período de tolerância da reconciliação.`};function oe(e,t){if(e===null)return t===`pt-BR`?`Motivo não informado.`:`No reason provided.`;if(t===`en-US`)return e;let n=e.match(/^Explicit orphan reconciliation found no active host invocation or terminal work outcome; repair is required before resuming \(Run (\S+)\)\.$/);if(n)return`A Run ${n[1]} ficou sem invocação ativa do host e sem evidência de um desfecho de entrega. A reconciliação registrou a interrupção; a entrega exige reparo e validação antes de retomar.`;let r=e.match(/^Execution (\S+) has no active orchestrator agent call after the reconciliation grace period\.?$/);return r?`A execução ${r[1]} não tem uma chamada de agente orquestrador ativa após o período de tolerância da reconciliação.`:P[e.trim().replace(/\.$/,``)]??e}function se({result:e,locale:t,onDismiss:n}){let[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),o=t===`pt-BR`,s=ie(e),c=o?`Resultado da reconciliação manual`:`Manual reconciliation result`,l={reconciled:o?`Outros estados registrados`:`Other recorded outcomes`,blocked:o?`Desfechos bloqueados`:`Blocked outcomes`,notReconciled:o?`Não reconciliados`:`Not reconciled`},u=`${l.reconciled}: ${s.reconciled} · ${l.blocked}: ${s.blocked} · ${l.notReconciled}: ${s.notReconciled}`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{className:`app-reconciliation-result`,"aria-label":c,children:[(0,y.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,y.jsx)(`strong`,{children:c}),(0,y.jsx)(`p`,{children:u})]}),(0,y.jsxs)(`div`,{className:`app-reconciliation-actions`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,"aria-haspopup":`dialog`,onClick:()=>i(!0),children:o?`Veja mais`:`View details`}),(0,y.jsx)(`button`,{type:`button`,onClick:n,children:o?`Fechar`:`Dismiss`})]})]})}),r?(0,y.jsx)(ce,{result:e,locale:t,title:c,summary:u,labels:l,onClose:()=>i(!1),restoreFocus:()=>a.current?.focus({preventScroll:!0})}):null]})}function ce({result:e,locale:t,title:n,summary:r,labels:i,onClose:a,restoreFocus:o}){let s=(0,h.useRef)(null),c=(0,h.useRef)(o),l=(0,h.useId)(),u=t===`pt-BR`;(0,h.useEffect)(()=>{let e=s.current;if(!e)return;let t=document.body.style.overflow;return e.showModal(),document.body.style.overflow=`hidden`,()=>{e.close(),document.body.style.overflow=t,c.current()}},[]);let d=[{label:i.reconciled,items:ae(e),reasons:!0},{label:i.blocked,items:e.blocked,reasons:!0},{label:i.notReconciled,items:e.not_reconciled,reasons:!0}];return(0,y.jsxs)(`dialog`,{ref:s,className:`app-reconciliation-dialog`,"aria-labelledby":l,"aria-modal":`true`,onCancel:e=>{e.preventDefault(),a()},onKeyDown:e=>{if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not(:disabled), summary, [tabindex="0"]`)).filter(e=>e.getClientRects().length>0),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},children:[(0,y.jsxs)(`header`,{children:[(0,y.jsx)(`h2`,{id:l,children:n}),(0,y.jsx)(`button`,{type:`button`,onClick:a,children:u?`Fechar detalhes`:`Close details`})]}),(0,y.jsxs)(`section`,{className:`app-reconciliation-details`,tabIndex:0,"aria-label":u?`Itens da reconciliação`:`Reconciliation items`,children:[(0,y.jsx)(`p`,{children:r}),(0,y.jsx)(`p`,{children:u?`A reconciliação registra o estado real de cada item. Desfechos bloqueados aparecem somente na categoria de bloqueios; um estado registrado não significa entrega concluída.`:`Reconciliation records each item's actual state. Blocked outcomes appear only in the blocked category; a recorded state does not imply completed delivery.`}),(0,y.jsx)(`p`,{children:u?`Última telemetria indica a coleta de tokens medidos. Registrar estados ou atualizar o snapshot sem novos tokens não altera esse horário.`:`Last telemetry means measured token collection. Recording states or refreshing the snapshot without new tokens does not change that time.`}),e.diagnostics?(0,y.jsxs)(`p`,{children:[u?`Reconciliação executada em`:`Reconciliation executed at`,` `,new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(e.diagnostics.completed_at)),` · Job: `,(0,y.jsx)(`code`,{children:e.diagnostics.job_id}),` · `,`Logs`,`: `,(0,y.jsx)(`code`,{children:e.diagnostics.log_directory})]}):null,(0,y.jsx)(`p`,{children:u?`Invocações ainda em execução são preservadas intencionalmente. Permanecer não reconciliado por esse motivo não indica falha do comando.`:`Invocations that are still running are intentionally preserved. Remaining unreconciled for this reason does not indicate a command failure.`}),d.map(e=>(0,y.jsxs)(`section`,{"aria-label":e.label,children:[(0,y.jsxs)(`h3`,{children:[e.label,` (`,e.items.length,`)`]}),e.items.length===0?(0,y.jsx)(`p`,{children:u?`Nenhum item nesta categoria.`:`No items in this category.`}):(0,y.jsx)(`ul`,{children:F(e.items).map(({item:n,key:r})=>(0,y.jsxs)(`li`,{children:[(0,y.jsx)(`code`,{children:n.id}),`status`in n&&typeof n.status==`string`?(0,y.jsx)(`p`,{children:N(n.status,t)}):null,e.reasons?(0,y.jsx)(`p`,{children:oe(n.reason,t)}):null,e.reasons&&n.reason!==null&&oe(n.reason,t)!==n.reason?(0,y.jsxs)(`details`,{children:[(0,y.jsx)(`summary`,{children:u?`Motivo original`:`Original reason`}),(0,y.jsx)(`p`,{children:n.reason})]}):null]},r))})]},e.label))]})]})}function F(e){let t=new Map;return e.map(e=>{let n=JSON.stringify([e.id,e.reason]),r=(t.get(n)??0)+1;return t.set(n,r),{item:e,key:`${n}:${r}`}})}var le=`modulepreload`,ue=function(e){return`/`+e},de={},I=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ue(t,n),t=s(t),t in de)return;de[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:le,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},L=(0,h.lazy)(async()=>({default:(await I(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-DnxpHJSo.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function fe({costLocale:e,documentDetail:t,helpOpen:n,loadingArea:r,reconciliationResult:a,refreshDialog:o,showTrace:l,trace:u,traceLink:d,traceMacroLoading:f,traceLoadingTaskId:g,closeDocument:_,onCloseHelp:b,onCloseTrace:x,onDismissReconciliation:S,onOpenDocument:w,onOpenTrace:T,onOpenTraceChange:E,onOpenTraceMacro:D,onRefreshCancel:O,onRefreshFromDialog:k,setTraceLink:A}){return(0,y.jsxs)(y.Fragment,{children:[l?null:g?(0,y.jsx)(m,{locale:e,taskId:g}):u?(0,y.jsx)(p,{locale:e,onClose:x,onOpenChange:E,onOpenPrd:e=>D(`PRD`,e),onOpenSpec:e=>D(`SPEC`,e),trace:u}):null,d?.kind===`change`?(0,y.jsx)(i,{details:{kind:`change`,row:d.row},locale:e,onClose:()=>A(null)}):null,d?.kind===`macro`?(0,y.jsx)(c,{label:d.label,locale:e,onClose:()=>A(null),onOpenDocument:w,onOpenTrace:e=>{A(null),T(e)},row:d.row,runs:d.projection.runs,specs:d.projection.specs,tasks:d.projection.tasks}):null,t?(0,y.jsx)(s,{detail:t.detail,error:t.error,label:t.label,locale:e,loading:!t.detail&&!t.error,onClose:_,onRetry:()=>w(t.kind,t.preview.id),preview:t.preview}):null,n?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(L,{locale:e,onClose:b})}):null,o===`choose`?(0,y.jsx)(`div`,{className:`app-refresh-dialog-backdrop`,children:(0,y.jsxs)(`section`,{"aria-label":`Atualizar dashboard`,"aria-modal":`true`,className:`app-refresh-dialog`,role:`dialog`,children:[(0,y.jsx)(`h2`,{children:e===`pt-BR`?`Atualizar dashboard`:`Refresh dashboard`}),(0,y.jsx)(`p`,{children:e===`pt-BR`?`Escolha uma atualização rápida ou reconcilie os itens que ainda estão em aberto.`:`Choose a quick refresh or reconcile work items that are still open.`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`button`,{onClick:()=>k(!1),type:`button`,children:e===`pt-BR`?`Apenas atualizar dados`:`Refresh data only`}),(0,y.jsx)(`button`,{onClick:()=>k(!0),type:`button`,children:e===`pt-BR`?`Reconciliar itens abertos`:`Reconcile open work`})]}),(0,y.jsx)(`button`,{className:`app-refresh-cancel`,onClick:O,type:`button`,children:e===`pt-BR`?`Cancelar`:`Cancel`})]})}):null,o===`refreshing`||o===`reconciling`?(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:o===`reconciling`?e===`pt-BR`?`Reconciliando itens em aberto…`:`Reconciling open work…`:e===`pt-BR`?`Atualizando dados…`:`Refreshing data…`}),(0,y.jsx)(`span`,{children:e===`pt-BR`?`Você pode continuar usando o dashboard.`:`You can keep using the dashboard.`})]})]})}):null,a!==null&&o===null?(0,y.jsx)(se,{result:a,locale:e,onDismiss:S}):null,(r!==null||f!==null)&&o===null?(0,y.jsx)(C,{area:f===null?r??`operations`:`operations`,locale:e}):null]})}var pe=(0,h.lazy)(async()=>({default:(await I(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-DsFTUwhL.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),me=(0,h.lazy)(async()=>({default:(await I(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-BCsdQtWG.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),he=(0,h.lazy)(async()=>({default:(await I(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-DZ2mnR6k.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),ge=`/setup-pricing`,_e=`/setup-project`,ve=`/cost-calculation-guide`;function ye(e){let{api:t,costLocale:n,fxRate:r,navigate:i,pathname:a,pricing:o,refresh:s,setFxRate:c,setPricing:l}=e;return a===`/setup-pricing`?o===null?(0,y.jsxs)(`main`,{className:`app-state`,children:[(0,y.jsx)(`p`,{children:n===`pt-BR`?`Configuração do projeto`:`Project settings`}),(0,y.jsx)(`h1`,{children:n===`pt-BR`?`Carregando catálogo de preços…`:`Loading pricing catalog…`}),(0,y.jsx)(`button`,{onClick:()=>i(`/`),type:`button`,children:n===`pt-BR`?`Voltar ao dashboard`:`Back to dashboard`})]}):(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(pe,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`),onSave:async e=>{l(await t.savePricing(e)),await s()},onSaveFxRate:async e=>{c(await t.saveFxRate(e)),await s()}})}):a===`/cost-calculation-guide`&&o!==null?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(he,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(me,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var be=(0,h.lazy)(async()=>({default:(await I(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-BN8FwP5S.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function xe({costs:e,costLocale:t,currency:n,dashboardView:r,failedArea:i,lastUpdatedAt:a,loadCostDetail:o,loadCostReadModelPage:s,loadCostRunPage:c,loadCostGroupPage:l,loadingArea:d,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:m,onLocaleChange:g,onOpenTrace:_,onLoadMoreTraceTasks:v,onRefresh:b,onRetry:x,onSelectTraceTask:C,onOpenTraceChange:T,onOpenTraceMacro:E,operations:D,selectedTraceTaskId:O,trace:k,traceLoadingTaskId:A,traceTasksHasMore:j,traceTasksLoading:ee,traceTasks:te}){return r===`cost-monitor`?e===null?()=>i===`costs`?(0,y.jsx)(w,{locale:t,onRetry:x}):(0,y.jsx)(S,{area:`costs`,locale:t}):r=>(0,y.jsx)(h.Suspense,{fallback:(0,y.jsx)(S,{area:`costs`,locale:t}),children:(0,y.jsx)(u,{currency:n,data:e,embedded:!0,globalFilters:r,lastUpdatedAt:a,locale:t,loading:d===`costs`,loadDetail:o,loadReadModelPage:s,loadRunPage:c,loadGroupPage:l,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:m,onLocaleChange:g,onOpenTrace:_,onRefresh:b,operations:D})}):r===`traceability`?()=>(0,y.jsx)(h.Suspense,{fallback:(0,y.jsx)(S,{area:`operations`,locale:t}),children:(0,y.jsx)(be,{loadingTaskId:A,locale:t,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),onLoadMoreTasks:v,onSelectTask:C,selectedTaskId:O,tasks:te.length>0?te:D.tasks,hasMoreTasks:j,isLoadingTasks:ee,trace:k})}):r===null?(0,y.jsx)(`span`,{"aria-hidden":`true`,hidden:!0}):void 0}function Se({currency:e,locale:t,onCurrencyChange:n,onHelpOpen:r,onNavigate:i,pricingSetupPath:a,projectSetupPath:o,costCalculationGuidePath:s}){return(0,y.jsxs)(`div`,{className:`dashboard-global-settings`,children:[(0,y.jsxs)(`label`,{children:[(0,y.jsx)(`span`,{children:t===`pt-BR`?`Moeda`:`Currency`}),(0,y.jsxs)(`select`,{"aria-label":t===`pt-BR`?`Moeda`:`Currency`,onChange:e=>n(e.target.value),value:e,children:[(0,y.jsx)(`option`,{value:`BRL`,children:`BRL · Real brasileiro`}),(0,y.jsx)(`option`,{value:`USD`,children:`USD · US Dollar`})]})]}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:r,type:`button`,children:t===`pt-BR`?`Central de Ajuda`:`Open help and guides`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(a),type:`button`,children:t===`pt-BR`?`Configurar preços e câmbio`:`Configure pricing and FX`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(o),type:`button`,children:t===`pt-BR`?`Configurar projeto`:`Configure project`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(s),type:`button`,children:t===`pt-BR`?`Guia de cálculo de custos`:`Cost calculation guide`})]})}var Ce={preset:`all`,range:o(`this-month`)};function R(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function we(e,t){let n=R(e),r=R(t);return n.from===r.from&&n.to===r.to}function Te({model:e}){let{operations:t,error:n,globalLoadingPending:r,costLocale:i,refresh:a,snapshotNotice:o,setupRoute:s,failedArea:c,retryLastLoad:u,costs:d,currency:f,dashboardView:p,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:g,loadCostRunPage:_,loadCostGroupPage:v,loadingArea:b,setDisplayedCosts:x,setCurrency:S,setCostSurfaceLoading:C,changeDashboardLocale:w,loadMoreTraceTasks:T,openTrace:E,setRefreshDialog:D,setSelectedTraceTaskId:O,openTraceChange:k,openTraceMacro:A,renderedOperations:j,selectedTraceTaskId:ee,trace:M,traceLoadingTaskId:ie,traceMacroLoading:ae,traceTasksHasMore:N,traceTasksLoading:P,traceTasks:oe,capabilityNavigation:se,boardTotals:ce,boardKindTotals:F,boardExportSource:le,detailExportSource:ue,boardStates:de,operationsPeriod:I,entityPage:L,dashboardIdentity:pe,operationsLoading:me,factualCostFact:he,factualCostPeriods:ye,setOperationsSurfaceLoading:be,operationsSurfaceLoading:Ce,currentCostByRun:R,loadOperationsEntityPage:Te,loadOperationsLifecyclePage:Ee,loadOperationsDetails:De,entityPageKind:z,loadFilteredOperationsPage:Oe,loadFilteredBoard:ke,loadWorkListFilters:B,loadWorkListPage:V,workListFiltersRef:H,boardFiltersRef:Ae,workListPage:je,overviewStatusPages:Me,loadOverviewStatusPage:U,overviewClassificationPages:Ne,loadOverviewClassificationPage:Pe,openDocument:W,api:G,setError:Fe,operationsPeriodRef:Ie,setOperationsPeriod:Le,operationsDetailLoadedRef:Re,operationsDetailCancelRef:ze,operationsDetailAbortRef:Be,operationsPageAbortRef:Ve,resetWorkListPage:He,operationsPageRequestVersionRef:Ue,refreshVersion:We,costSummaryAbortRef:Ge,costSummaryRequestVersion:Ke,setEntityPage:qe,costsLoadedRef:Je,setCosts:Ye,setPeriodTransitionPending:Xe,periodTransitionVersionRef:Ze,setLoadingArea:Qe,navigate:$e,setHelpOpen:K,closeDocument:et,documentDetail:tt,helpOpen:nt,reconciliationResult:rt,setReconciliationResult:it,refreshDialog:at,setTrace:ot,traceLink:st,setTraceLink:ct,refreshFromDialog:lt}=e,{loadMoreBoard:ut,overviewStatusPageKey:dt,overviewClassificationPageKey:ft,boardRequestVersionRef:pt,boardAbortControllersRef:mt,boardInFlightRef:ht,boardInitialPageRef:gt,boardLoadedRef:_t,setBoardTotals:vt,setBoardKindTotals:yt,setBoardStates:bt,setOverviewStatusPages:q,setOverviewClassificationPages:xt,setOperationsLoading:J}=e;return(0,y.jsxs)(re,{error:n,globalLoadingPending:r,locale:i,onRefresh:()=>void a(),operations:t,snapshotNotice:o,setupRoute:s,children:[(0,y.jsxs)(ne,{pending:r,children:[n?(0,y.jsxs)(`div`,{"aria-live":`assertive`,className:`app-warning app-error`,role:`alert`,children:[(0,y.jsx)(`span`,{children:n}),c?(0,y.jsx)(`button`,{onClick:u,type:`button`,children:i===`pt-BR`?`Tentar novamente`:`Try again`}):null,(0,y.jsx)(`button`,{"aria-label":i===`pt-BR`?`Fechar erro`:`Dismiss error`,onClick:()=>Fe(null),type:`button`,children:`×`})]}):null,(0,y.jsx)(l,{alternateContent:xe({costs:d,costLocale:i,currency:f,dashboardView:p,failedArea:c,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:g,loadCostRunPage:_,loadCostGroupPage:v,loadingArea:b,onActiveDataChange:x,onCurrencyChange:S,onLoadingChange:C,onLocaleChange:w,onLoadMoreTraceTasks:T,onOpenTrace:e=>void E(e),onRefresh:()=>D(`choose`),onRetry:u,onSelectTraceTask:e=>{O(e),E(e)},onOpenTraceChange:k,onOpenTraceMacro:A,operations:j,selectedTraceTaskId:ee,trace:M,traceLoadingTaskId:ie,traceTasksHasMore:N,traceTasksLoading:P,traceTasks:oe}),capabilityNavigation:se,boardTotals:ce,boardKindTotals:F,boardExportSource:le,detailExportSource:ue,boardStates:de,data:j,lastUpdatedAt:m,datePreset:I.preset,dateRange:I.range,entityPage:L,dashboardTitle:pe.title,repositoryName:pe.repositoryName,loading:me,locale:i,currency:f,factualCostFact:he,costLoading:d===null&&c!==`costs`,factualCostPeriods:ye,onLoadingChange:be,resolveRunCost:d===null?void 0:e=>R.get(e)??null,onLocaleChange:w,onDetailDataRequest:e=>{let t=e===`conversations`?`conversations`:e===`executions`?`executions`:e===`runs`?`runs`:null;t===null?e===`changes`||e===`decisions`?Ee(e):De():Te(t)},onLoadMacroMetrics:()=>{t?.summary.overview_metrics?.macro_metrics===void 0&&De()},onEntityPageChange:e=>{z===`changes`||z===`decisions`?Ee(z,e):Te(z,e)},onEntityFiltersChange:Oe,onBoardFiltersChange:ke,onWorkListFiltersChange:B,onWorkListPageChange:e=>void V(H.current,e),onBoardTypeChange:e=>ke({...Ae.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void V({...H.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void ut(e),workListPage:je,statusPage:(e,t)=>Me[dt(e,t)],onLoadStatusPage:(e,t,n)=>void U(e,t,n),classificationPage:(e,t)=>Ne[ft(e,t)],onLoadClassificationPage:(e,t,n)=>void Pe(e,t,n),onOpenDocument:(e,t)=>void W(e,t),onOpenMacro:(e,t)=>void A(e===`prd`?`PRD`:`SPEC`,t),onOpenTask:E,onPriorityChange:async e=>{try{await G.saveWorkPriority(e)}catch(e){throw Fe(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(we(Ie.current,n)){Le(n);return}Re.current=!1,ze.current?.(),ze.current=null,Be.current?.abort(),Be.current=null,Ve.current?.abort(),Ve.current=null,He(),++Ue.current,pt.current+=1;for(let e of mt.current.values())e.abort();mt.current.clear(),ht.current.clear(),gt.current.clear(),_t.current={},vt({}),yt({}),bt({}),q({}),xt({}),++We.current,Ge.current?.abort(),Ge.current=null,++Ke.current,qe({offset:0,total:null,loading:!1,error:null}),Je.current=!1,Ye(null),x(null),J(!0),Ze.current+=1,Xe(!0),Qe(`operations`),Le(n)},onRefresh:()=>D(`choose`),settings:(0,y.jsx)(Se,{costCalculationGuidePath:ve,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>K(!0),onNavigate:$e,pricingSetupPath:ge,projectSetupPath:_e})}),(0,y.jsx)(fe,{closeDocument:et,costLocale:i,documentDetail:tt,helpOpen:nt,loadingArea:b??(d===null&&c!==`costs`?`costs`:Ce||Object.values(de).some(e=>e.loading)?`operations`:null),operations:j,reconciliationResult:rt,refreshDialog:at,showTrace:p===`traceability`,trace:M,traceLink:st,traceMacroLoading:ae,traceLoadingTaskId:ie,onCloseHelp:()=>K(!1),onCloseTrace:()=>ot(null),onDismissReconciliation:()=>it(null),onOpenDocument:(e,t)=>void W(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:A,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void lt(e),setTraceLink:e=>ct(e)})]}),r?(0,y.jsx)(te,{}):null]})}var Ee=(e,t)=>`${e}:${t}`,De=(e,t)=>`${e}:${t}`,z=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],Oe=`/zaip-cost-monitor`,ke=`zaip-dashboard-session-token`,B=`zaip-dashboard-locale`,V=`zaip-dashboard-currency`;function H(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function Ae(e){return e.replace(/\/+$/,``)===Oe?`cost-monitor`:null}function je(){let e=new URL(window.location.href),t=e.searchParams.get(`token`)??window.localStorage.getItem(`zaip-dashboard-session-token`)??window.sessionStorage.getItem(`zaip-dashboard-session-token`)??``;return t&&(window.localStorage.setItem(ke,t),window.sessionStorage.setItem(ke,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var Me=6e4,U=18e4;async function Ne(e,t,n=Me,r){let i=new AbortController,a=()=>i.abort();r?.addEventListener(`abort`,a,{once:!0}),r?.aborted&&i.abort();let o=window.setTimeout(()=>i.abort(),n);try{return await fetch(e,{...t,signal:i.signal})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`A leitura demorou mais de ${Math.ceil(n/1e3)} segundos. Tente novamente.`):e}finally{window.clearTimeout(o),r?.removeEventListener(`abort`,a)}}var Pe=class{token;constructor(e){this.token=e}ready(){return this.get(`/api/v2/ready`)}captureTelemetry(){return this.post(`/api/v2/capture-telemetry`)}dashboardIdentity(){return this.get(`/api/v2/dashboard-identity`)}operations(e,t=`detail`,n,r=!1){let i=`${a.operations}?scope=${t}${r?`&fresh=1`:``}`;return this.get(G(i,e),n)}sqliteViewPage(e,t,n={},r){let i=new URLSearchParams({view:e,offset:String(n.offset??0)});return n.limit!==void 0&&i.set(`limit`,String(n.limit)),n.query&&i.set(`query`,n.query),n.status&&i.set(`status`,n.status),n.risk&&i.set(`risk`,n.risk),n.provider&&i.set(`provider`,n.provider),n.model&&i.set(`model`,n.model),n.agent&&i.set(`agent`,n.agent),n.phase&&i.set(`phase`,n.phase),n.origin&&i.set(`origin`,n.origin),n.workType&&i.set(`workType`,n.workType),n.priority&&i.set(`priority`,n.priority),n.kind&&i.set(`kind`,n.kind),this.get(G(`/api/v2/sqlite-views?${i.toString()}`,t),r)}operationsBoard(e,t,n=0,r,i,o=4){let s=new URLSearchParams({scope:`board`,stage:t,offset:String(n),limit:String(o)});return r?.query&&s.set(`query`,r.query),r?.status&&s.set(`status`,r.status),r?.risk&&s.set(`risk`,r.risk),r?.origin&&s.set(`origin`,r.origin),r?.kind&&s.set(`kind`,r.kind),this.get(G(`${a.operations}?${s.toString()}`,e),i)}traceabilityTasks(e=0,t=10){let n=new URLSearchParams({scope:`traceability`,offset:String(e),limit:String(t)});return this.get(`${a.operations}?${n}`)}operationsClassification(e,t,n,r=0,i,o=50){let s=new URLSearchParams({scope:`classification`,kind:t,classification:n,offset:String(r),limit:String(o)});return this.get(G(`${a.operations}?${s.toString()}`,e),i)}operationsEntityPage(e,t,n=0,r,i){let o=W(t,n,r);return this.get(G(`${a.operations}/runs?${o}`,e),i)}operationsLifecyclePage(e,t,n=0,r,i){let o=W(t,n,r);return this.get(G(`${a.operations}/entities?${o}`,e),i)}operationsReadModelPage(e,t,n=0,r=50,i=``,o){let s=new URLSearchParams({kind:t,offset:String(n),limit:String(r)});return i&&s.set(`query`,i),this.get(G(`${a.operations}/read-models?${s.toString()}`,e),o)}costMonitor(e=`BRL`,t,n=`detail`,r,i,o=!1){let s=new URLSearchParams({currency:e,scope:n});o&&s.set(`fresh`,`1`);for(let[e,t]of Object.entries(i??{}))t&&s.set(e,t);return this.get(G(`${a.costMonitor}?${s.toString()}`,t),r)}costMonitorRuns(e=`BRL`,t,n,r=100,i,o){let s=new URLSearchParams({currency:e,scope:`runs`,offset:String(n),limit:String(r)});for(let[e,t]of Object.entries(o??{}))t&&s.set(e,t);return this.get(G(`${a.costMonitor}?${s.toString()}`,t),i)}snapshot(e=`BRL`,t){return this.get(G(`${a.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(G(`${a.reconcileOpenWork}?currency=${e}`,t),U)}refreshProjection(e=`BRL`,t){return this.post(G(`${a.refreshProjection}?currency=${e}`,t),U)}task(e){return this.get(a.task(e))}prd(e){return this.get(a.prd(e))}spec(e){return this.get(a.spec(e))}taskTrace(e,t){return this.get(a.taskTrace(e),t)}pricing(){return this.get(`/api/v2/pricing`)}async savePricing(e){let t=await fetch(`/api/v2/pricing`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok)throw Error(`Pricing update failed with HTTP ${t.status}`);return await t.json()}fxRate(){return this.get(`/api/v2/fx-rate`)}agentCatalog(){return this.get(a.agentCatalog)}agentPortraitUrl(e){return`/api/v2/agent-catalog-assets/${encodeURIComponent(e)}?token=${encodeURIComponent(this.token)}`}projectSettings(){return this.get(a.projectSettings)}projectOverview(){return this.get(`${a.projectSettings}/overview`)}async saveWorkPriority(e){let t=await fetch(a.workPriority,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({item_ids:e})});if(!t.ok)throw Error(`Work priority update failed with HTTP ${t.status}`);return await t.json()}async saveProjectSettings(e){let t=await fetch(a.projectSettings,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Project settings update failed with HTTP ${t.status}`)}return await t.json()}async saveAgentCatalog(e){let t=e.map(({nickname_candidates:e,...t})=>t),n=await fetch(a.agentCatalog,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({agents:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Agent catalog update failed with HTTP ${n.status}`)}return await n.json()}async saveFxRate(e){let t=await fetch(`/api/v2/fx-rate`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({rate:e})});if(!t.ok)throw Error(`FX update failed with HTTP ${t.status}`);return await t.json()}async get(e,t){let n=await Ne(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},Me,t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}async post(e,t=Me){let n=await Ne(e,{method:`POST`,headers:{"x-zaip-session":this.token}},t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}};function W(e,t,n){let r=new URLSearchParams({kind:e,offset:String(t),limit:`100`});return n?.query&&r.set(`query`,n.query),n?.status&&r.set(`status`,n.status),n?.risk&&r.set(`risk`,n.risk),r.toString()}function G(e,t){if(t===void 0)return e;let n=new URL(e,`http://dashboard.local`);return t.from!==null&&n.searchParams.set(`from`,t.from),t.to!==null&&n.searchParams.set(`to`,t.to),`${n.pathname}${n.search}`}function Fe(e){return e.projection_refresh_completed}function Ie(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&Fe(e)}}var Le={"pt-BR":{label:`Áreas do dashboard`,operations:`Operação`,operationsHint:`Trabalho em andamento e priorização`,costs:`Monitor de Custos`,costsHint:`Tempo, tokens e custo`,traceability:`Rastreabilidade`,traceabilityHint:`Ciclo completo em 6 etapas`},"en-US":{label:`Dashboard areas`,operations:`Operations`,operationsHint:`Lifecycle and work in progress`,costs:`Cost Monitor`,costsHint:`Time, tokens, and cost`,traceability:`Traceability`,traceabilityHint:`Complete 6-stage lifecycle`}};function Re({activeView:e,locale:t,onChange:n}){let r=Le[t],i=e=>{n(e),window.requestAnimationFrame(()=>{document.querySelector(`.dashboard-global-controls`)?.scrollIntoView({behavior:`smooth`,block:`start`})})};return(0,y.jsxs)(`nav`,{"aria-label":r.label,className:`dashboard-capability-nav`,children:[(0,y.jsxs)(`button`,{"aria-current":e===`cost-monitor`?`page`:void 0,className:e===`cost-monitor`?`is-active`:void 0,onClick:()=>i(`cost-monitor`),type:`button`,children:[(0,y.jsx)(Be,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.costs}),(0,y.jsx)(`small`,{children:r.costsHint})]})]}),(0,y.jsxs)(`button`,{"aria-current":e===`operations`?`page`:void 0,className:e===`operations`?`is-active`:void 0,onClick:()=>i(`operations`),type:`button`,children:[(0,y.jsx)(ze,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.operations}),(0,y.jsx)(`small`,{children:r.operationsHint})]})]}),(0,y.jsxs)(`button`,{"aria-current":e===`traceability`?`page`:void 0,className:e===`traceability`?`is-active`:void 0,onClick:()=>i(`traceability`),type:`button`,children:[(0,y.jsx)(Ve,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.traceability}),(0,y.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function ze(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-square-kanban`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`rect`,{height:`18`,rx:`2`,width:`18`,x:`3`,y:`3`}),(0,y.jsx)(`path`,{d:`M8 7v7`}),(0,y.jsx)(`path`,{d:`M12 7v4`}),(0,y.jsx)(`path`,{d:`M16 7v9`})]})}function Be(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-circle-dollar-sign`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}),(0,y.jsx)(`path`,{d:`M12 18V6`})]})}function Ve(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-route`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`6`,cy:`19`,r:`3`}),(0,y.jsx)(`path`,{d:`M9 19h6.5a3.5 3.5 0 0 0 0-7h-7a3.5 3.5 0 0 1 0-7H18`}),(0,y.jsx)(`circle`,{cx:`18`,cy:`5`,r:`3`})]})}function He(e){h.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Ue(e,t,n){return(0,y.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,y.jsx)(Re,{activeView:e,locale:t,onChange:n})})}function We(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function Ge(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function Ke(e,t,n){let r=t??e;if(r?.currency!==n)return{fact:{state:`unavailable`,knownSum:null,coverage:null},periods:void 0};let i=r.overview.coverage[n===`USD`?`usd`:`brl`],a=n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,o={known:i,total:r.overview.run_count};return{fact:a===null?{state:`unavailable`,knownSum:null,coverage:o}:i<r.overview.run_count?{state:`partial`,knownSum:a,coverage:o}:{state:`complete`,knownSum:a,coverage:o},periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}}var qe={title:`Dashboard ZAIP AIOS`,repositoryName:``};function Je(e,t){let n=typeof t.title==`string`?t.title.trim():``,r=typeof t.repository_name==`string`?t.repository_name.trim():``;return{title:n||e.title,repositoryName:r}}function Ye(e,t,n,r,i,a,o,s){s(null),e===`costs`?r():e===`traceability`&&t?i(t):e===`operations`&&n!==null?a():o()}function Xe(e,t,n,r,i,a,o,s,c){return ye({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function Ze(e){return async t=>{if(e.setDashboardView(t),window.scrollTo({left:0,top:0}),t===`cost-monitor`?T({costsLoaded:e.costsLoadedRef.current,currency:e.currency,snapshotCurrency:e.costs?.currency})&&(e.costSummaryAbortRef.current===null||e.costSummaryAbortRef.current.signal.aborted)&&e.loadCostSummary():e.costSummaryAbortRef.current?.abort(),t===`traceability`){let t=e.traceTasks;if(t.length===0){let n=e.boardRequestVersionRef.current;if(t=await e.loadMoreTraceTasks(!1,!0),n!==e.boardRequestVersionRef.current)return;e.setTraceTasks(t)}let n=t.toSorted((e,t)=>Date.parse(t.finished_at??t.updated_at)-Date.parse(e.finished_at??e.updated_at)),r=n.find(e=>e.status===`completed`)??n[0];r&&(e.setSelectedTraceTaskId(r.id),e.openTrace(r.id));return}e.setTrace(null),e.setTraceLoadingTaskId(null)}}function Qe(e,t=new Date){return e.preset===`custom`?e:e.preset===`all`?{...e,range:o(`this-month`,t)}:{...e,range:o(e.preset,t)}}function $e(e=new Date){let t=r(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let n=e.getTime(),i=n+1800*60*1e3;for(;r(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-n>1;){let e=Math.floor((n+i)/2);r(new Date(e).toISOString(),`day`)===t?n=e:i=e}return Math.max(1,i-e.getTime()+25)}function K(e){return typeof e==`number`?e:null}function et(e){return typeof e==`number`?{known_sum:e,unknown:0,complete:!0,coverage_ratio:1}:{known_sum:0,unknown:1,complete:!1,coverage_ratio:0}}function tt(e){return Object.hasOwn(e,`total_duration`)?K(e.total_duration):K(e.cost_monitor_total_duration)}function nt(e,t){let n=e?.[`${t}_known_count`],r=e?.[`${t}_unknown_count`];return typeof n!=`number`||typeof r!=`number`?et(e?.[t]):{known_sum:typeof e?.[t]==`number`?e[t]:0,unknown:r,complete:r===0&&n>0,coverage_ratio:n+r>0?n/(n+r):0}}function rt(e,t){let n=t.totals,r=e=>nt(n,e);return{data_source:`lifecycle_daily_read_models`,snapshot_id:t.snapshot_id??null,source_latest_at:t.snapshot_updated_at??null,kind:e,offset:t.offset,limit:t.limit,total:t.total_count,has_more:t.has_more,next_cursor:null,subtotal:{entity_count:typeof n?.entity_count==`number`?n.entity_count:t.total_count,run_count:r(`invocation_count`),activity_count:r(`activity_count`),unattributed_cost_brl:K(n?.unattributed_cost_brl),unattributed_activity_count:K(n?.unattributed_activity_count),orphan_cost_brl:K(n?.orphan_cost_brl),orphan_activity_count:K(n?.orphan_activity_count),metrics:{duration:r(`total_duration`),total_tokens:r(`total_tokens`),cost_brl:r(`total_cost_brl`),cost_usd:r(`total_cost_usd`)}},rows:t.rows.map(t=>({id:String(t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??t.id??`unavailable`),title:String(t.title??t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??`Unavailable`),kind:e===`tasks`?`task`:e===`specs`?`spec`:e===`prds`?`prd`:e===`executions`?`execution`:`conversation`,status:typeof t.status==`string`?t.status:null,risk:typeof t.risk==`string`?t.risk:null,occurred_at:typeof t.occurred_at==`string`?t.occurred_at:typeof t.started_at==`string`?t.started_at:typeof t.last_day==`string`?`${t.last_day}T12:00:00.000Z`:``,parent_id:null,run_count:Number(t.invocation_count??0),activity_count:K(t.activity_count),cost_currency:`BRL`,metrics:{duration:nt(t,`total_duration`),total_tokens:nt(t,`total_tokens`),cost:nt(t,`total_cost_brl`)}}))}}function it(e,t,n){let{filters:r,query:i}=e;return{offset:t,limit:n,...i===void 0||i===``?{}:{query:i},...r.provider?{provider:r.provider}:{},...r.model?{model:r.model}:{},...r.agent?{agent:r.agent}:{},...r.phase?{phase:r.phase}:{},...r.status?{status:r.status}:{},...r.origin?{origin:r.origin}:{},...r.workType?{workType:r.workType}:{},...r.priority?{priority:r.priority}:{},...r.risk?{risk:r.risk}:{}}}function at(e){let t=tt(e),n=Number(e.duration_unknown??+(t===null)),r=t??K(e.duration_known)??0;return{key:String(e.key??e.period_key??`total`),label:String(e.label??e.key??e.period_key??``),latest_started_at:typeof e.latest_started_at==`string`?e.latest_started_at:``,persona:typeof e.persona==`string`?e.persona:null,job:typeof e.job==`string`?e.job:null,run_count:Number(e.total_run_count??e.invocation_count??0),task_count:K(e.task_count),conversation_count:K(e.conversation_count),prd_count:K(e.prd_count),spec_count:K(e.spec_count),evidence_count:K(e.evidence_count),test_count:K(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:K(e.total_tokens),estimated_usd:K(e.total_cost_usd),estimated_brl:K(e.total_cost_brl),duration_ms:t,duration:{known_sum:r,unknown:n,complete:n===0,coverage_ratio:+(n===0)},coverage:{events:0,tokens:0,usd:0,brl:0}}}async function ot(e,t){let{from:n,limit:r,offset:i,signal:a,to:o,view:s}=t,c=n===void 0||o===void 0?void 0:{from:n,to:o};if(s===`daily`){let n=await e.sqliteViewPage(`cost_monitor_daily`,c,it(t,i,r),a);return{snapshot_id:n.snapshot_id??null,snapshot_updated_at:n.snapshot_updated_at??null,offset:n.offset,limit:n.limit,total_count:n.total_count,has_more:n.has_more,rows:n.rows.map(at),...n.period_averages===void 0?{}:{period_averages:n.period_averages},...n.totals===void 0?{}:{totals:at(n.totals)}}}let l={monthly:`cost_monitor_monthly`,annual:`cost_monitor_annual`,agents:`cost_monitor_zaip_agents`,models:`cost_monitor_models`,providers:`cost_monitor_providers`}[s],u=await e.sqliteViewPage(l,c,it(t,i,r),a);return{snapshot_id:u.snapshot_id??null,snapshot_updated_at:u.snapshot_updated_at??null,offset:u.offset,limit:u.limit,total_count:u.total_count,has_more:u.has_more,rows:u.rows.map(at),...u.period_averages===void 0?{}:{period_averages:u.period_averages},...u.totals===void 0?{}:{totals:at(u.totals)}}}async function st(e,t){let{filters:n,from:r,limit:i=10,offset:a,signal:o,to:s}=t,c=await e.sqliteViewPage(`cost_monitor_agent_invocations`,r===void 0||s===void 0?void 0:{from:r,to:s},{offset:a,limit:i,...n?.query?{query:n.query}:{},...n?.provider?{provider:n.provider}:{},...n?.model?{model:n.model}:{},...n?.agent?{agent:n.agent}:{},...n?.phase?{phase:n.phase}:{},...n?.status?{status:n.status}:{},...n?.priority?{priority:n.priority}:{},...n?.risk?{risk:n.risk}:{},...n?.origin?{origin:n.origin}:{},...n?.workType?{workType:n.workType}:{}},o);return{page_only:!0,runs:c.rows.map(ct),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function ct(e){let t=(e,t)=>typeof e==`string`?e:t,n=e=>typeof e==`number`?e:null,r=t(e.agent_invocation_id,`unavailable`),i=typeof e.task_id==`string`?e.task_id:null,a=typeof e.spec_id==`string`?e.spec_id:null,o=typeof e.prd_id==`string`?e.prd_id:null,s=t(e.phase,`execution`),c=e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`estimated`||e.duration_provenance===`legacy_inferred`?e.duration_provenance:`unavailable`,l=Object.hasOwn(e,`calculated_cost_usd`)?n(e.calculated_cost_usd):n(e.cost_usd),u=n(e.current_fx_rate)??n(e.fx_rate),d=n(e.recorded_cost_usd)??n(e.recorded_usd),f=Object.hasOwn(e,`recorded_fx_rate`)?n(e.recorded_fx_rate):n(e.fx_rate),p=n(e.recorded_brl)??(!Object.hasOwn(e,`recorded_brl`)&&d!==null?n(e.cost_brl):null),m=l!==null&&u!==null?Math.round(l*u*1e6)/1e6:null;return{run_id:r,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:t(e.run_id,r),task_id:i,task_title:t(e.task_title,i??`Tarefa avulsa`),task_status:t(e.task_status,`unavailable`),priority:t(e.priority,`unavailable`),risk:t(e.risk,`unavailable`),spec_id:a,prd_id:o,change_id:typeof e.change_id==`string`?e.change_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_role:e.invocation_kind===`subagent`?`subagent`:`orchestrator`,run_kind:e.run_kind===`subrun`?`subrun`:`run`,run_purpose:`execution`,requires_finalizer:!1,client:t(e.client,`unavailable`),agent:t(e.zaip_agent,`unavailable`),agent_name:t(e.zaip_agent,`unavailable`),provider:typeof e.provider==`string`?e.provider:null,model:t(e.model,`unavailable`),requested_model:t(e.requested_model,`unavailable`),reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,effective_reasoning_effort:typeof e.effective_reasoning_effort==`string`?e.effective_reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,call_count:n(e.llm_call_count),status:t(e.status,`completed`),phase:s,origin:o===null?a===null?i===null?`conversation`:`task`:`spec`:`prd`,work_type:e.work_type===`rework`?`rework`:`new`,started_at:t(e.occurred_at,``),finished_at:typeof e.finished_at==`string`?e.finished_at:null,duration_ms:n(e.duration_ms),duration_provenance:c,estimation_basis:typeof e.estimation_basis==`string`?e.estimation_basis:null,source_started_at:typeof e.source_started_at==`string`?e.source_started_at:null,source_finished_at:typeof e.source_finished_at==`string`?e.source_finished_at:null,capture_lag_ms:n(e.capture_lag_ms),event_count:n(e.source_event_count),input_tokens:n(e.input_tokens),cached_input_tokens:n(e.cached_input_tokens),output_tokens:n(e.output_tokens),reasoning_tokens:n(e.reasoning_tokens),total_tokens:n(e.total_tokens),uncached_input_tokens:n(e.uncached_input_tokens),visible_output_tokens:n(e.visible_output_tokens),input_rate_usd_per_million:n(e.input_rate_usd_per_million),cached_input_rate_usd_per_million:n(e.cached_input_rate_usd_per_million),output_rate_usd_per_million:n(e.output_rate_usd_per_million),reasoning_rate_usd_per_million:n(e.reasoning_rate_usd_per_million),context_input_multiplier:n(e.context_input_multiplier),context_output_multiplier:n(e.context_output_multiplier),speed_cost_multiplier:n(e.speed_cost_multiplier),standard_cost_usd:n(e.standard_cost_usd),speed_uplift_usd:n(e.speed_uplift_usd),input_cost_usd:n(e.input_cost_usd),cached_input_cost_usd:n(e.cached_input_cost_usd),output_cost_usd:n(e.output_cost_usd),reasoning_cost_usd:n(e.reasoning_cost_usd),fx_rate:u,estimated_usd:l,estimated_brl:m,recorded_usd:d,recorded_brl:p,recorded_fx_rate:f,coverage:{events:0,tokens:0,usd:0,brl:0},artifact_path:`.agents/records/runs/${r}`}}function lt(e){return{loadCostDetail:(0,h.useCallback)(async()=>{throw Error(`SQLite Cost Monitor loads the selected paginated view; full detail is disabled.`)},[]),loadCostReadModelPage:(0,h.useCallback)(async({filters:t,from:n,kind:r,limit:i,offset:a,query:o,signal:s,to:c})=>{let l={tasks:`cost_monitor_tasks`,specs:`cost_monitor_specs`,prds:`cost_monitor_prds`,executions:`cost_monitor_executions`,conversations:`cost_monitor_conversations`}[r];return rt(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...t.query||o?{query:t.query||o}:{},...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.agent?{agent:t.agent}:{},...t.phase?{phase:t.phase}:{},...t.status?{status:t.status}:{},...t.origin?{origin:t.origin}:{},...t.workType?{workType:t.workType}:{},...t.priority?{priority:t.priority}:{},...t.risk?{risk:t.risk}:{}},s))},[e]),loadCostRunPage:(0,h.useCallback)(t=>st(e,t),[e]),loadCostGroupPage:(0,h.useCallback)(t=>ot(e,t),[e])}}function ut(e,t){return!1}function dt(e,t=window,n=0){let r=!1,i=!1,a=new AbortController,o=t.setTimeout(()=>{r||i||(i=!0,e(a.signal))},n);return()=>{r||(r=!0,a.abort(),t.clearTimeout(o))}}var ft=2e3,pt=5e3,mt=1e4,ht=3e4,gt=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function _t(e,t){return e===`visible`?pt:t>0?ht:mt}function vt(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function yt(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function bt({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function q(e){let t=!1,n,r=null,i=0,a=0,o=e.updating(),s=!1,c=async()=>{if(!t){e.updating()&&!o&&(o=!0,a=0,s=!1),o&&a++;try{let n=await e.ready();if(t)return;i=0;let a=yt(n.snapshot_state,n.snapshot_revision);if(a&&vt(r,n.snapshot_revision)||o&&n.snapshot_state===`current`){let i=await e.reload();if(t)return;i&&(a&&(r=n.snapshot_revision??null),o=!1,e.settled())}else r===null&&a&&(r=n.snapshot_revision??null)}catch{i++}t||(o&&a>=90&&!s&&(s=!0,e.exhausted(gt)),n=setTimeout(()=>void c(),o&&!s?ft:_t(e.visibility(),i)))}};return c(),()=>{t=!0,n!==void 0&&clearTimeout(n)}}function xt({api:e,costLocale:t,currency:n,dashboardView:r,loadOperationsDetails:i,operations:a,operationsDetailAbortRef:o,operationsDetailCancelRef:s,operationsPageAbortRef:c,pathname:l,pricing:u,refresh:d,refreshVersion:f,snapshotUpdating:p,setSnapshotUpdating:m,setError:g,setFxRate:_,setPathname:v,setPricing:y}){let b=(0,h.useRef)(!1),x=(0,h.useRef)(0),S=(0,h.useRef)(p);S.current=p,(0,h.useEffect)(()=>(d(),()=>{s.current?.(),s.current=null,o.current?.abort(),o.current=null,c.current?.abort(),c.current=null,++f.current}),[o,s,c,d,f]),(0,h.useEffect)(()=>{let e=()=>{let e=Date.now();bt({inFlight:b.current,lastRefreshAt:x.current,now:e,visibilityState:document.visibilityState})&&(x.current=e,b.current=!0,d(!1,!1,!0).finally(()=>{b.current=!1}))};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[d]),(0,h.useEffect)(()=>q({ready:()=>e.ready(),reload:()=>d(!1,!1,!1,!0),updating:()=>S.current,visibility:()=>document.visibilityState,settled:()=>m(!1),exhausted:e=>{m(!1),g(e)}}),[e,d,g,m]),(0,h.useEffect)(()=>{if(!ut(r,a?.summary.overview_metrics?.partial===!0))return;let e=dt(async e=>{await i(e)});return s.current=e,()=>{s.current===e&&(s.current=null),e()}},[r,i,a?.summary.overview_metrics?.partial,s]),(0,h.useEffect)(()=>window.localStorage.setItem(B,t),[t]),(0,h.useEffect)(()=>window.localStorage.setItem(V,n),[n]),(0,h.useEffect)(()=>{[`/`,`/setup-pricing`,`/setup-project`,`/cost-calculation-guide`].includes(window.location.pathname)||(window.history.replaceState(null,``,`/${window.location.search}${window.location.hash}`),v(`/`))},[v]),(0,h.useEffect)(()=>{let e=()=>v(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,h.useEffect)(()=>{![`/setup-pricing`,`/cost-calculation-guide`].includes(l)||u!==null||Promise.all([e.pricing(),e.fxRate()]).then(([e,t])=>{y(e),_(t)}).catch(e=>g(String(e)))},[e,l,u,g,_,y])}var J={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}};function St(e,t,n){let r=e=>e===`intake`||e===`orchestration`||e===`execution`||e===`review`||e===`audit`||e===`finalization`?e:`execution`,i=n.rows.map(e=>({id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status===`running`||e.status===`failed`||e.status===`cancelled`?e.status:`completed`,phase:e.phase??`execution`,entrypoint:e.conversation_id===null?`task`:`conversation`,work_type:`new`,run_role:e.run_kind===`subrun`?`subagent`:`orchestrator`,run_kind:e.run_kind??`run`,run_purpose:r(e.run_purpose),requires_finalizer:!1,parent_run_id:e.parent_run_id,client:e.client??`unknown`,agent:e.agent??`unknown`,agent_name:e.agent??`unknown`,agent_persona:e.agent_persona??null,agent_job:e.agent_job??null,provider:e.provider??null,model:e.model??`unknown`,reasoning_effort:e.reasoning_effort??null,effective_model:e.model??null,effective_reasoning_effort:e.reasoning_effort??null,effective_config_mixed:e.pricing_mixed??!1,service_tier:e.service_tier??null,call_count:e.llm_call_count??null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:null,prd_id:null,change_id:null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms===void 0?e.duration_ms:e.source_duration_ms,duration_provenance:e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`legacy_inferred`||e.duration_provenance===`estimated`?e.duration_provenance:`unavailable`,llm_call_count:e.llm_call_count??null,input_tokens:e.input_tokens??null,cached_input_tokens:e.cached_input_tokens??null,uncached_input_tokens:e.uncached_input_tokens??null,output_tokens:e.output_tokens??null,reasoning_tokens:e.reasoning_tokens??null,visible_output_tokens:e.visible_output_tokens??null,input_rate_usd_per_million:e.input_rate_usd_per_million??null,cached_input_rate_usd_per_million:e.cached_input_rate_usd_per_million??null,output_rate_usd_per_million:e.output_rate_usd_per_million??null,reasoning_rate_usd_per_million:e.reasoning_rate_usd_per_million??null,context_input_multiplier:e.context_input_multiplier??null,context_output_multiplier:e.context_output_multiplier??null,speed_cost_multiplier:e.speed_cost_multiplier??null,pricing_scenario:e.pricing_scenario??null,standard_cost_usd:e.standard_cost_usd??null,speed_uplift_usd:e.speed_uplift_usd??null,input_cost_usd:e.input_cost_usd??null,cached_input_cost_usd:e.cached_input_cost_usd??null,output_cost_usd:e.output_cost_usd??null,reasoning_cost_usd:e.reasoning_cost_usd??null,calculated_cost_usd:e.calculated_cost_usd??null,recorded_cost_usd:e.recorded_cost_usd??null,cost_variance_usd:e.cost_variance_usd??null,cost_usd:e.cost_usd??null,cost_brl:e.currency===`BRL`?e.cost:null,fx_rate:e.fx_rate??null,pricing_segment_count:e.pricing_segment_count??null,pricing_mixed:e.pricing_mixed??!1,pricing_model:e.pricing_model??null,pricing_source:e.pricing_source??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},usage:{conversation:J,planning:J,execution:{...J,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},total:{...J,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},new_work:J,rework:J}}));return{...e,runs:i,executions:t===`executions`||t===`conversations`?n.rows.map((e,n)=>{let r=i[n];if(r===void 0)throw Error(`Operations entity page must have a projected run for every row.`);let a=r.execution_id??r.conversation_id,o=e.status??`unavailable`;return{id:a,kind:t===`conversations`?`interaction`:`delivery`,created_at:r.started_at,status:o,work_status:o,origin:t===`conversations`?{type:`interaction`,conversation_id:r.conversation_id}:{type:`task`,task_id:r.task_id??`unavailable`},dag:{nodes:[],topological_order:[]},result:null,artifact_path:`.agents/records/executions/${a}`,agent_call_count:0,orchestrator_run_count:0,subagent_run_count:0,finalizer_run_count:0,finalized_task_count:0,llm_call_count:0,llm_call_count_complete:!1,task_count:0,spec_count:0,prd_count:0,duration_ms:r.source_duration_ms??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},total_tokens:r.usage.total.tokens.total,cost_brl:r.usage.total.cost.brl}}):e.executions}}function Y(e){if(typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Ct({api:e,entityFiltersRef:t,operationsPageAbortRef:n,operationsPageRequestVersionRef:r,operationsPeriod:i,operationsPeriodRef:a,refreshVersion:o,setEntityPage:s,setEntityPageKind:c,setOperations:l}){return{loadOperationsEntityPage:(0,h.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=R(i),_=()=>j(m,r.current,p.signal)&&O(h,o.current,g,R(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t={runs:`operations_agent_invocations`,executions:`operations_executions`,conversations:`operations_conversations`}[u],n=await e.sqliteViewPage(t,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),r={kind:u,offset:n.offset,limit:n.limit,total:n.total_count,aggregation:`canonical_entity`,rows:n.rows.map(e=>({id:String(e.agent_invocation_id??e.execution_id??e.conversation_id??e.id),started_at:String(e.occurred_at??e.started_at??`1970-01-01T00:00:00.000Z`),finished_at:typeof e.finished_at==`string`?e.finished_at:null,task_id:typeof e.task_id==`string`?e.task_id:null,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:typeof e.conversation_id==`string`?e.conversation_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_kind:e.invocation_kind===`delegated`||e.invocation_kind===`subagent`?`subrun`:e.invocation_kind===`orchestrator`?`run`:null,run_purpose:typeof e.purpose==`string`?e.purpose:null,phase:typeof e.phase==`string`?e.phase:null,status:typeof e.status==`string`?e.status:null,agent:typeof e.zaip_agent==`string`?e.zaip_agent:null,agent_persona:typeof e.zaip_agent_persona==`string`?e.zaip_agent_persona:null,agent_job:typeof e.zaip_agent_job==`string`?e.zaip_agent_job:null,client:typeof e.client==`string`?e.client:null,provider:typeof e.provider==`string`?e.provider:null,model:typeof e.model==`string`?e.model:null,reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,duration_ms:typeof e.duration_ms==`number`?e.duration_ms:typeof e.total_duration==`number`?e.total_duration:null,source_duration_ms:typeof e.source_duration_ms==`number`?e.source_duration_ms:null,duration_provenance:typeof e.duration_provenance==`string`?e.duration_provenance:null,llm_call_count:typeof e.llm_call_count==`number`?e.llm_call_count:null,input_tokens:typeof e.input_tokens==`number`?e.input_tokens:null,cached_input_tokens:typeof e.cached_input_tokens==`number`?e.cached_input_tokens:null,uncached_input_tokens:typeof e.uncached_input_tokens==`number`?e.uncached_input_tokens:null,output_tokens:typeof e.output_tokens==`number`?e.output_tokens:null,reasoning_tokens:typeof e.reasoning_tokens==`number`?e.reasoning_tokens:null,visible_output_tokens:typeof e.visible_output_tokens==`number`?e.visible_output_tokens:null,total_tokens:typeof e.total_tokens==`number`?e.total_tokens:null,input_rate_usd_per_million:typeof e.input_rate_usd_per_million==`number`?e.input_rate_usd_per_million:null,cached_input_rate_usd_per_million:typeof e.cached_input_rate_usd_per_million==`number`?e.cached_input_rate_usd_per_million:null,output_rate_usd_per_million:typeof e.output_rate_usd_per_million==`number`?e.output_rate_usd_per_million:null,reasoning_rate_usd_per_million:typeof e.reasoning_rate_usd_per_million==`number`?e.reasoning_rate_usd_per_million:null,context_input_multiplier:typeof e.context_input_multiplier==`number`?e.context_input_multiplier:null,context_output_multiplier:typeof e.context_output_multiplier==`number`?e.context_output_multiplier:null,speed_cost_multiplier:typeof e.speed_cost_multiplier==`number`?e.speed_cost_multiplier:null,pricing_scenario:typeof e.pricing_scenario==`string`?e.pricing_scenario:null,standard_cost_usd:typeof e.standard_cost_usd==`number`?e.standard_cost_usd:null,speed_uplift_usd:typeof e.speed_uplift_usd==`number`?e.speed_uplift_usd:null,input_cost_usd:typeof e.input_cost_usd==`number`?e.input_cost_usd:null,cached_input_cost_usd:typeof e.cached_input_cost_usd==`number`?e.cached_input_cost_usd:null,output_cost_usd:typeof e.output_cost_usd==`number`?e.output_cost_usd:null,reasoning_cost_usd:typeof e.reasoning_cost_usd==`number`?e.reasoning_cost_usd:null,calculated_cost_usd:typeof e.calculated_cost_usd==`number`?e.calculated_cost_usd:null,recorded_cost_usd:typeof e.recorded_cost_usd==`number`?e.recorded_cost_usd:null,cost_variance_usd:typeof e.cost_variance_usd==`number`?e.cost_variance_usd:null,cost_usd:typeof e.cost_usd==`number`?e.cost_usd:null,fx_rate:typeof e.fx_rate==`number`?e.fx_rate:null,pricing_segment_count:typeof e.pricing_segment_count==`number`?e.pricing_segment_count:null,pricing_mixed:e.pricing_mixed===1||e.pricing_mixed===!0,pricing_model:typeof e.audit_pricing_model==`string`?e.audit_pricing_model:typeof e.pricing_model==`string`?e.pricing_model:null,pricing_source:typeof e.audit_pricing_source==`string`?e.audit_pricing_source:typeof e.pricing_source==`string`?e.pricing_source:null,cost:typeof e.total_cost_brl==`number`?e.total_cost_brl:typeof e.cost_brl==`number`?e.cost_brl:null,currency:`BRL`}))};if(!_())return;l(e=>e===null?e:St(e,u,r)),s({offset:r.offset,total:r.total,loading:!1,error:null,aggregation:r.aggregation})}catch(e){if(!_()||k(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l]),loadOperationsLifecyclePage:(0,h.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=R(i),_=()=>j(m,r.current,p.signal)&&O(h,o.current,g,R(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t=await e.sqliteViewPage(u===`changes`?`operations_changes`:`operations_decisions`,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),n=u===`changes`?t.rows.map(e=>{let t=String(e.source_type),n=String(e.source_id);return{id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:null,status:typeof e.status==`string`?e.status:`unclassified`,risk:typeof e.risk==`string`?e.risk:`unclassified`,source:t===`spec`?{type:`spec`,spec_id:n}:t===`prd`?{type:`prd`,prd_id:n,spec_id:null}:{type:`task`,task_id:n},requirement_ids:Y(e.requirement_ids_json),acceptance_ids:Y(e.acceptance_ids_json),task_ids:Y(e.task_ids_json),result:typeof e.result==`string`?e.result:null,artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id)}}):t.rows.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),origin:e.origin===`human`?`human`:`agent`,scope_type:e.scope_type===`execution`?`execution`:`change`,scope_id:String(e.scope_id),artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:`1970-01-01T00:00:00.000Z`})),r={kind:u,offset:t.offset,limit:t.limit,total:t.total_count,rows:n};if(!_())return;l(e=>e===null?e:{...e,...u===`changes`?{changes:r.rows}:{decisions:r.rows}}),s({offset:r.offset,total:r.total,loading:!1,error:null})}catch(e){if(!_()||k(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l])}}function wt({api:e,operations:t,isOperationsDetailLoaded:n,setError:r,setFailedArea:i,setLoadingArea:a}){let[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)([]),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),m=(0,h.useRef)(0),g=(0,h.useRef)(0),_=(0,h.useRef)(0),v=(0,h.useRef)(null),[y,b]=(0,h.useState)(null),x=(0,h.useRef)(null),[S,C]=(0,h.useState)(null),[w,T]=(0,h.useState)(``);async function E(n){_.current+=1,v.current?.abort(),b(null),p(null);let o=++g.current;x.current?.abort();let l=new AbortController;x.current=l,r(null),i(null),s(null),C(n),a(`traceability`),await new Promise(e=>window.requestAnimationFrame(()=>e()));try{let r=await e.taskTrace(n,l.signal);if(g.current!==o)return!1;let i=c.find(e=>e.id===n)??t?.tasks.find(e=>e.id===n);return s({...r,task_title:i?.title||r.task_title||n,task_risk:i?.risk||r.task_risk||null,task_created_at:i?.created_at||r.task_created_at||null,task_progress:r.task_progress??i?.progress??0}),!0}catch(e){return l.signal.aborted||g.current!==o?!1:(r(e instanceof Error?e.message:String(e)),i(`traceability`),!1)}finally{g.current===o&&(x.current===l&&(x.current=null),C(null),a(e=>e===`traceability`?null:e))}}function D(e){let n=t?.changes.find(t=>t.id===e);n!==void 0&&(s(null),p({kind:`change`,row:n}))}async function O(o,c){let l=++_.current;v.current?.abort(),v.current=null,g.current+=1,x.current?.abort(),x.current=null,C(null),a(e=>e===`traceability`?null:e),r(null),i(null),s(null),p(null);let u=(o===`PRD`?t?.prds:t?.specs)?.find(e=>e.id===c&&e.kind===o.toLowerCase());if(u&&t&&n()){b(null),p({kind:`macro`,label:o,row:u,projection:t});return}let d=new AbortController;v.current=d,b({label:o,id:c});try{let t=await e.operations(void 0,`detail`,d.signal);if(l!==_.current||d.signal.aborted)return;let n=(o===`PRD`?t.prds:t.specs).find(e=>e.id===c&&e.kind===o.toLowerCase());if(!n)throw Error(`${o} ${c} not found`);p({kind:`macro`,label:o,row:n,projection:t})}catch(e){if(l!==_.current||d.signal.aborted)return;r(e instanceof Error?e.message:String(e))}finally{l===_.current&&(v.current===d&&(v.current=null),b(null))}}async function k(n,r){let i=(n===`prd`?t?.prds:t?.specs)?.find(e=>e.id===r)??(f?.kind===`macro`?(n===`prd`?f.projection.prds:f.projection.specs).find(e=>e.id===r):void 0);if(!i)return;let a=++m.current,o=n===`prd`?`PRD`:`SPEC`;d({kind:n,label:o,preview:i});try{let t=n===`prd`?await e.prd(r):await e.spec(r);if(m.current!==a)return;d({kind:n,label:o,preview:i,detail:t})}catch(e){if(m.current!==a)return;d({kind:n,label:o,preview:i,error:e instanceof Error?e.message:String(e)})}}function A(){m.current+=1,d(null)}return{closeDocument:A,documentDetail:u,openDocument:k,openTrace:E,openTraceChange:D,openTraceMacro:O,selectedTraceTaskId:w,setSelectedTraceTaskId:T,setTrace:s,setTraceLink:p,setTraceLoadingTaskId:C,setTraceTasks:l,trace:o,traceLink:f,traceMacroLoading:y,traceLoadingTaskId:S,traceTasks:c}}function Tt({cursor:e,page:t,tasks:n}){let r=new Map(n.map(e=>[e.id,e]));for(let e of t.tasks)r.set(e.id,e);let i=e.offset+t.tasks.length;return{tasks:[...r.values()],cursor:t.tasks.length===0||i>=t.total?{offset:0,stageIndex:e.stageIndex+1}:{...e,offset:i}}}function X(e,t,n){return Math.min(t,e+n)}function Et(e,t,n){let r=(0,h.useRef)(t),i=(0,h.useRef)({offset:0,stageIndex:0}),a=(0,h.useRef)(!1),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{r.current=t},[t]),{loadMoreTraceTasks:(0,h.useCallback)(async(t=!1,o=!1)=>{if(a.current||(o&&(i.current={offset:0,stageIndex:0},r.current=[],n([]),s(!0)),i.current.stageIndex>=1))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=await e.traceabilityTasks(a.offset,10),s=Tt({cursor:a,page:o,tasks:r.current});if(r.current=s.tasks,n(r.current),i.current=s.cursor,o.tasks.length>0&&!t)break}while(i.current.stageIndex<1);return s(i.current.stageIndex<1),r.current}finally{a.current=!1,l(!1)}},[e,n]),traceTasksHasMore:o,traceTasksLoading:c}}function Z(e,t){let n=e.snapshot_id??e.snapshot_updated_at;if(n!=null&&n!==(t.snapshot_id??t.snapshot_updated_at))throw Error(`Os dados mudaram durante a exportação. Atualize a página e exporte novamente.`)}async function*Dt(e,t){let n=e;for(;;){if(n.rows.length===0)return;yield n.rows;let r=n.offset+n.rows.length;if(!n.has_more||r>=n.total_count)return;n=await t(r),Z(e,n)}}function Ot({api:e,boardAbortControllersRef:t,boardFilterKeyRef:n,boardFiltersRef:r,boardInFlightRef:i,boardInitialPageRef:a,boardLoadedRef:o,boardRequestVersionRef:s,dashboardView:c,operations:l,operationsPeriod:u,operationsPeriodRef:d,overviewStatusInFlightRef:f,quickOverviewMetricsRef:p,setBoardKindTotals:m,setBoardStates:g,setBoardTotals:_,setOperations:v,setOverviewClassificationPages:y,setOverviewStatusPages:b}){let x=(0,h.useCallback)(()=>{s.current+=1;for(let e of t.current.values())e.abort();t.current.clear(),i.current.clear(),a.current.clear(),o.current={},_({}),m({}),g({}),b({}),y({})},[t,i,a,o,s,m,g,_,y,b]),S=(0,h.useCallback)(async n=>{if(l===null||i.current.has(n))return;i.current.add(n),t.current.get(n)?.abort();let a=new AbortController;t.current.set(n,a);let c=s.current,f=R(u);g(e=>({...e,[n]:{loading:!0,error:null}}));let p=o.current[n]??0;try{let t=await e.operationsBoard(f,n,p,r.current,a.signal,10);if(a.signal.aborted||c!==s.current||f.from!==R(d.current).from||f.to!==R(d.current).to)return;v(e=>e===null?e:{...ee(e,[t]),summary:e.summary}),_(e=>({...e,[n]:t.total})),m(e=>({...e,[n]:t.totals_by_kind})),o.current={...o.current,[n]:p+t.prds.length+t.specs.length+t.tasks.length}}catch(e){if(a.signal.aborted||c!==s.current||k(e))return;g(t=>({...t,[n]:{loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{c===s.current&&(i.current.delete(n),t.current.get(n)===a&&t.current.delete(n),g(e=>e[n]?.error===null?{...e,[n]:{loading:!1,error:null}}:e))}},[e,t,r,i,o,s,l,u,d,m,g,_,v]),C=(0,h.useCallback)(e=>{let t={...e,kind:e.kind??r.current.kind??``},i=`${t.query}|${t.status}|${t.risk}|${t.origin??``}|${t.kind}`;i!==n.current&&(n.current=i,r.current=t,x(),v(e=>e===null?e:{...e,prds:[],specs:[],tasks:[],changes:[],summary:i===`||||`&&p.current!==void 0?{...e.summary,overview_metrics:p.current}:e.summary}))},[n,r,p,x,v]),w=(0,h.useCallback)(async(t,n,r)=>{let i=Ee(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(u);b(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsBoard(c,t,r,{kind:n===`task`?`all-tasks`:n});if(o!==s.current||c.from!==R(d.current).from||c.to!==R(d.current).to)return;let l=n===`task`?a.tasks:n===`spec`?a.specs:a.prds;b(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||k(e))return;b(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,b]),T=(0,h.useCallback)(async(t,n,r)=>{let i=De(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(u);y(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsClassification(c,t,n,r);if(o!==s.current||c.from!==R(d.current).from||c.to!==R(d.current).to)return;let l=t===`task`?a.tasks:t===`spec`?a.specs:a.prds;y(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||k(e))return;y(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,y]),E=(0,h.useCallback)(t=>{let n={...r.current,...t},i=R(u);return{prepare:async()=>{let t=await Promise.all(z.map(t=>e.operationsBoard(i,t,0,n))),r=e=>[...e.prds.map(({kind:e,...t})=>({kind:`prd`,...t})),...e.specs.map(({kind:e,...t})=>({kind:`spec`,...t})),...e.tasks.map(e=>({...e,kind:e.spec_id===null?`standalone-task`:`task`}))];for(let e of t)Z(t[0],e);return{totalRows:t.reduce((e,t)=>e+t.total,0),metadata:{source:`operations_work_kanban`,snapshot_id:t[0]?.snapshot_id??null,snapshot_updated_at:t[0]?.snapshot_updated_at??null,filters:n,period:i??`all`},...t[0]?.financial_summary===void 0?{}:{financialSummary:t[0].financial_summary},pages:async function*(){for(let a of t){let t=a,o=0;for(;;){let s=r(t);if(s.length===0||(o+=s.length,yield s,o>=t.total))break;t=await e.operationsBoard(i,t.stage,o,n),Z(a,t)}}}}}}},[e,r,u]);return(0,h.useEffect)(()=>{if(c!==`operations`||l===null)return;let e=!1,t=s.current,n=()=>!e&&t===s.current,r=async()=>{if(!n())return;let e=z.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let t=0;t<e.length&&n();t+=3){let r=e.slice(t,t+3);if(!n())return;for(let e of r)a.current.add(e);await Promise.all(r.map(e=>S(e)))}},o=window.setTimeout(()=>void r(),0);return()=>{e=!0,window.clearTimeout(o)}},[i,a,s,c,S,l]),{boardExportSource:E,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function Q(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function kt(e,t,n){return e===`explicit`||t!==n}function At(e,t){return{...e,kind:e.kind??t.kind??``}}var jt={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function Mt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,h.useState)(jt),a=(0,h.useRef)({query:``,status:``,risk:``}),o=(0,h.useRef)(null),s=(0,h.useRef)(0),c=(0,h.useRef)(null),l=(0,h.useCallback)(async(r,l=0,u=`explicit`)=>{let d=R(t),f=At(r,a.current),p=Q(f,d);if(!kt(u,p,c.current))return;o.current?.abort();let m=new AbortController;o.current=m;let h=++s.current;a.current=f,c.current=p;let g=f.kind||`all`;i(e=>({...e,offset:l,typeFilter:g,loading:!0,error:null}));try{let t=await e.sqliteViewPage(`operations_work_list`,d,{offset:l,limit:10,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{},...f.origin?{origin:f.origin}:{},...g===`all`?{}:{kind:g}},m.signal);if(m.signal.aborted||h!==s.current||d.from!==R(n.current).from||d.to!==R(n.current).to)return;i({offset:t.offset,limit:t.limit,total:t.total_count,hasMore:t.has_more,typeFilter:g,rows:t.rows,loading:!1,error:null})}catch(e){if(m.signal.aborted||h!==s.current)return;c.current===p&&(c.current=null),i(t=>({...t,offset:l,typeFilter:g,loading:!1,error:e instanceof Error?e.message:String(e)}))}finally{o.current===m&&(o.current=null)}},[e,t,n]),u=(0,h.useCallback)(()=>{o.current?.abort(),o.current=null,++s.current,c.current=null,i(jt)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,h.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}function Nt(){let[e,t]=(0,h.useState)(H),[n,r]=(0,h.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),i=(0,h.useRef)(n);return i.current=n,{costLocale:e,currency:n,setCurrency:r,currencyRef:i,changeDashboardLocale:(0,h.useCallback)(e=>{t(e),r(e===`en-US`?`USD`:`BRL`)},[])}}function Pt({api:e,operationsPeriod:t}){return(0,h.useCallback)((n,r)=>{let i=R(t);if(n===`work-kanban`)return;let a={"work-list":`operations_work_list`,changes:`operations_changes`,decisions:`operations_decisions`,executions:`operations_executions`,runs:`operations_agent_invocations`,conversations:`operations_conversations`,daily:`operations_daily`,monthly:`operations_monthly`,yearly:`operations_annual`}[n];if(a===void 0)return;let o=e=>({offset:e,limit:100,...r.query?{query:r.query}:{},...r.status?{status:r.status}:{},...r.risk?{risk:r.risk}:{},...r.origin?{origin:r.origin}:{},...a===`operations_work_list`&&r.kind?{kind:r.kind}:{}});return{prepare:async()=>{let t=await e.sqliteViewPage(a,i,o(0));return{totalRows:t.total_count,metadata:{source:a,snapshot_id:t.snapshot_id??null,snapshot_updated_at:t.snapshot_updated_at??null,filters:r,period:i??`all`},...t.financial_summary===void 0?{}:{financialSummary:t.financial_summary},pages:()=>Dt(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var Ft=1500;function It({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function Lt(e,t,n){let[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(!e||!t||r){o(!1);return}let n=window.setTimeout(()=>o(!0),Ft);return()=>window.clearTimeout(n)},[t,r,e]),It({snapshotUpdating:e,initialDataPending:t,dismissed:r,delayElapsed:a})?(0,y.jsxs)(`div`,{"aria-live":`polite`,className:`app-notice app-snapshot-status`,role:`status`,children:[(0,y.jsx)(`span`,{children:`Exibindo o último snapshot local validado. Os dados canônicos estão sendo atualizados em segundo plano e estarão atuais na próxima abertura.`}),(0,y.jsx)(`button`,{"aria-label":n===`pt-BR`?`Fechar aviso de atualização do snapshot`:`Dismiss snapshot update notice`,onClick:()=>i(!0),type:`button`,children:`×`})]}):null}function Rt(){He(je());let[e,t]=(0,h.useState)(!1),n=(0,h.useMemo)(je,[]),r=(0,h.useMemo)(()=>new Pe(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=lt(r),[c,l]=(0,h.useState)(()=>Ae(window.location.pathname)),u=(0,h.useRef)(c);u.current=c;let[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)({offset:0,total:null,loading:!1,error:null}),[g,_]=(0,h.useState)(`runs`),v=(0,h.useRef)({query:``,status:``,risk:``}),[y,b]=(0,h.useState)({}),[x,S]=(0,h.useState)({}),[C,w]=(0,h.useState)({}),[j,ee]=(0,h.useState)({}),[te,ne]=(0,h.useState)({}),[M,re]=(0,h.useState)(null),[ie,ae]=(0,h.useState)(null),{costLocale:N,currency:P,setCurrency:oe,currencyRef:se,changeDashboardLocale:ce}=Nt(),[F,le]=(0,h.useState)(()=>Ce),ue=F.preset===`all`?null:F.range.start,de=F.preset===`all`?null:F.range.end,I=(0,h.useMemo)(()=>({from:ue,to:de}),[ue,de]),L=(0,h.useRef)(F);L.current=F;let fe=(0,h.useRef)(null),[pe,me]=(0,h.useState)(!1),[he,ge]=(0,h.useState)(null),[_e,ve]=(0,h.useState)(null),[ye,be]=(0,h.useState)(window.location.pathname),[xe,Se]=(0,h.useState)(!0),[we,Te]=(0,h.useState)(!1),[,z]=(0,h.useState)(!1),[,Oe]=(0,h.useState)(!1),[ke,B]=(0,h.useState)(`operations`),[V,H]=(0,h.useState)(null),[Me,U]=(0,h.useState)(null);(0,h.useEffect)(()=>{r.captureTelemetry().then(()=>t(!0)).catch(()=>{})},[r]);let[Ne,W]=(0,h.useState)(null),[G,Fe]=(0,h.useState)(null),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)(qe),Ve=(0,h.useCallback)(e=>{Be(t=>Je(t,e))},[]);(0,h.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||Ve(t)}).catch(()=>{}),()=>{e=!0}},[r,Ve]);let K=(0,h.useRef)(!1),{closeDocument:et,documentDetail:tt,openDocument:nt,openTrace:rt,openTraceChange:it,openTraceMacro:at,traceMacroLoading:ot,selectedTraceTaskId:st,setSelectedTraceTaskId:ct,setTrace:ut,setTraceLink:dt,setTraceLoadingTaskId:ft,setTraceTasks:pt,trace:mt,traceLink:ht,traceLoadingTaskId:gt,traceTasks:_t}=wt({api:r,operations:d,isOperationsDetailLoaded:()=>K.current,setError:W,setFailedArea:H,setLoadingArea:B}),{loadMoreTraceTasks:vt,traceTasksHasMore:yt,traceTasksLoading:bt}=Et(r,_t,pt),q=(0,h.useRef)(0),J=(0,h.useRef)(0),St=(0,h.useRef)(!1),Y=(0,h.useRef)(0),Tt=(0,h.useRef)(0),X=(0,h.useRef)(null),Z=(0,h.useRef)(!1),Dt=(0,h.useRef)(null),Q=(0,h.useRef)(null),kt=(0,h.useRef)(null),At=(0,h.useRef)(0),jt=(0,h.useRef)({}),Ft=(0,h.useRef)(new Set),It=(0,h.useRef)(new Map),Rt=(0,h.useRef)(new Set),zt=(0,h.useRef)(new Set),Bt=(0,h.useRef)({query:``,status:``,risk:``,origin:``,kind:``}),Vt=(0,h.useRef)(`||||`),Ht=(0,h.useRef)(0),Ut=(0,h.useRef)(void 0),{workListPage:Wt,workListFiltersRef:Gt,loadWorkListFilters:Kt,loadWorkListPage:qt,resetWorkListPage:Jt}=Mt({api:r,operationsPeriod:F,operationsPeriodRef:L}),Yt=(0,h.useRef)(!1),$=(0,h.useCallback)(async(e=!0,n=!1,i=!1,a=!1)=>{Dt.current?.(),Dt.current=null,Q.current?.abort(),Q.current=null,Ht.current+=1;for(let e of It.current.values())e.abort();It.current.clear(),Ft.current.clear(),zt.current.clear(),jt.current={},b({}),S({}),w({}),ee({}),ne({});let o=++q.current,s=J.current,c=u.current,l=I,d=()=>D(o,q.current)&&O(o,q.current,l,R(L.current));e&&(Se(!0),B(`operations`)),W(null),H(null);try{if(n){let e=await r.reconcileOpenWork(P,l),n=Ie(e,d());if(Fe(n.reconciliation),n.dismissProgressDialog&&U(null),!n.applySnapshotState)return!1;if(t(e.snapshot_state===`updating`),n.reloadQuickProjection){let e=await r.operations(l,`quick`,void 0,!0);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,K.current=!1,Re(e.summary.latest_token_collected_at??null)}}else if(i){let e=await r.refreshProjection(P,l);if(!d())return!1;f(e.operations),Ut.current=e.operations.summary.overview_metrics,K.current=!0,re(e.costs),Z.current=!0,ae(null);let t=e.dashboard;t&&Be(e=>Je(e,t)),Re(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,Yt.current),P===`USD`||a?r.costMonitor(P,l,`summary`):Promise.resolve(null)]);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,K.current=!1,t!==null&&(re(t),Z.current=!1,ae(null)),Re(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(W(e instanceof Error?e.message:String(e)),H(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&A(s,J.current)&&Oe(!1),e&&d()&&(Se(!1),B(e=>e===`operations`?null:e))}},[r,P,I]),Xt=(0,h.useCallback)(async e=>{if(K.current||St.current||e?.aborted)return null;Q.current?.abort();let t=e===void 0?new AbortController:null,n=e??t?.signal;if(n===void 0)return null;t!==null&&(Q.current=t),St.current=!0,Y.current+=1,B(`costs`),H(null);try{let e=++q.current,t=R(F),i=()=>D(e,q.current)&&O(e,q.current,t,R(L.current)),a=await r.operations(t,`detail`,n);return i()?(f(a),K.current=!0,a):null}catch(e){return n.aborted||k(e)?null:(W(e instanceof Error?e.message:String(e)),H(`operations`),null)}finally{t!==null&&Q.current===t&&(Q.current=null),St.current=!1,Y.current=Math.max(0,Y.current-1),Y.current===0&&B(e=>e===`costs`?null:e)}},[r,F]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=Ct({api:r,entityFiltersRef:v,operationsPageAbortRef:kt,operationsPageRequestVersionRef:At,operationsPeriod:F,operationsPeriodRef:L,refreshVersion:q,setEntityPage:m,setEntityPageKind:_,setOperations:f}),$t=(0,h.useCallback)((e,t)=>{v.current=t,e===`changes`||e===`decisions`?Qt(e,0,t):Zt(e,0,t)},[Zt,Qt]),{boardExportSource:en,loadFilteredBoard:tn,loadMoreBoard:nn,loadOverviewClassificationPage:rn,loadOverviewStatusPage:an,resetBoard:on}=Ot({api:r,boardAbortControllersRef:It,boardFilterKeyRef:Vt,boardFiltersRef:Bt,boardInFlightRef:Ft,boardInitialPageRef:zt,boardLoadedRef:jt,boardRequestVersionRef:Ht,dashboardView:c,operations:d,operationsPeriod:F,operationsPeriodRef:L,overviewStatusInFlightRef:Rt,quickOverviewMetricsRef:Ut,setBoardKindTotals:S,setBoardStates:w,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:ne,setOverviewStatusPages:ee}),sn=Pt({api:r,operationsPeriod:F}),cn=async e=>{e&&Fe(null),U(e?`reconciling`:`refreshing`);try{await $(!1,e,!e)}finally{U(null)}};(0,h.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{le(e=>{let t=Qe(e);return t!==e&&(fe.current=t),t}),t()},$e())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,h.useEffect)(()=>{fe.current===F&&(fe.current=null,$(!1,!1,!0,!0))},[F,$]),xt({api:r,costLocale:N,currency:P,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:Q,operationsDetailCancelRef:Dt,operationsPageAbortRef:kt,pathname:ye,pricing:he,refresh:$,refreshVersion:q,setSnapshotUpdating:t,setError:W,setFxRate:ve,setPathname:be,setPricing:ge,snapshotUpdating:e});let ln=We(be),un=(0,h.useCallback)(async()=>{X.current?.abort();let e=new AbortController;X.current=e;let t=++Tt.current,n=R(F);Y.current+=1,B(`costs`),W(null),H(null);try{let i=await r.costMonitor(P,n,`summary`,e.signal),a=R(L.current);if(!E({aborted:e.signal.aborted,currentCurrency:se.current,currentPeriod:a,currentRequestVersion:Tt.current,requestVersion:t,requestedCurrency:P,requestedPeriod:n}))return;re(i),Z.current=!0,ae(null)}catch(n){if(e.signal.aborted||t!==Tt.current)return;W(n instanceof Error?n.message:String(n)),H(`costs`)}finally{Y.current=Math.max(0,Y.current-1),Y.current===0&&B(e=>e===`costs`?null:e),X.current===e&&(X.current=null)}},[r,P,F,se]);(0,h.useEffect)(()=>{P!==`USD`||M?.currency===P||un()},[M?.currency,P,un]),(0,h.useEffect)(()=>{d===null||V===`costs`||X.current!==null||T({costsLoaded:Z.current,currency:P,snapshotCurrency:M?.currency})&&un()},[M?.currency,P,V,un,d]);let dn=Ze({setDashboardView:l,costsLoadedRef:Z,currency:P,costs:M,loadCostSummary:un,costSummaryAbortRef:X,traceTasks:_t,boardRequestVersionRef:Ht,loadMoreTraceTasks:vt,setTraceTasks:pt,setSelectedTraceTaskId:ct,openTrace:rt,setTrace:ut,setTraceLoadingTaskId:ft}),fn=Ge(M,ie,P),{fact:pn,periods:mn}=Ke(M,ie,P),hn=()=>Ye(V,st,d,un,rt,Xt,$,W),gn=Xe(r,N,_e,ln,ye,he,$,ve,ge);return{loadMoreBoard:nn,overviewStatusPageKey:Ee,overviewClassificationPageKey:De,boardRequestVersionRef:Ht,boardAbortControllersRef:It,boardInFlightRef:Ft,boardInitialPageRef:zt,boardLoadedRef:jt,setBoardTotals:b,setBoardKindTotals:S,setBoardStates:w,setOverviewStatusPages:ee,setOverviewClassificationPages:ne,setOperationsLoading:Se,operations:d,error:Ne,globalLoadingPending:P===`USD`&&M?.currency!==P,costLocale:N,refresh:async()=>{await $()},snapshotNotice:Lt(e,d===null&&xe,N),setupRoute:gn,failedArea:V,retryLastLoad:hn,costs:M,currency:P,dashboardView:c,lastUpdatedAt:Le,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:ke,setDisplayedCosts:ae,setCurrency:oe,setCostSurfaceLoading:z,changeDashboardLocale:ce,loadMoreTraceTasks:vt,openTrace:rt,setRefreshDialog:U,setSelectedTraceTaskId:ct,openTraceChange:it,openTraceMacro:at,selectedTraceTaskId:st,traceMacroLoading:ot,trace:mt,traceLoadingTaskId:gt,traceTasksHasMore:yt,traceTasksLoading:bt,traceTasks:_t,capabilityNavigation:Ue(c,N,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:C,operationsPeriod:F,entityPage:p,dashboardIdentity:ze,operationsLoading:xe,factualCostFact:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:Te,operationsSurfaceLoading:we,currentCostByRun:fn,loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt,loadOperationsDetails:Xt,entityPageKind:g,loadFilteredOperationsPage:$t,loadFilteredBoard:tn,loadWorkListPage:qt,loadWorkListFilters:Kt,workListFiltersRef:Gt,boardFiltersRef:Bt,workListPage:Wt,overviewStatusPages:j,loadOverviewStatusPage:an,overviewClassificationPages:te,loadOverviewClassificationPage:rn,openDocument:nt,api:r,setError:W,operationsPeriodRef:L,setOperationsPeriod:le,operationsDetailLoadedRef:K,operationsDetailCancelRef:Dt,operationsDetailAbortRef:Q,operationsPageAbortRef:kt,resetWorkListPage:Jt,operationsPageRequestVersionRef:At,resetBoard:on,refreshVersion:q,costSummaryAbortRef:X,costSummaryRequestVersion:Tt,setEntityPage:m,costsLoadedRef:Z,setCosts:re,setPeriodTransitionPending:Oe,periodTransitionVersionRef:J,setLoadingArea:B,navigate:ln,setHelpOpen:me,closeDocument:et,documentDetail:tt,helpOpen:pe,reconciliationResult:G,setReconciliationResult:Fe,refreshDialog:Me,setTrace:ut,traceLink:ht,setTraceLoadingTaskId:ft,setTraceLink:dt,refreshFromDialog:cn,renderedOperations:d}}async function zt(e){let t=await fetch(`/api/v2/health`,{cache:`no-store`,signal:e}),n=await t.json();if(!t.ok||n?.kind!==`zaip-dashboard-sqlite-runtime`||typeof n.workspace!=`string`||typeof n.workspace_name!=`string`||![`initialized`,`missing`,`invalid`].includes(n.lifecycle_manifest_state))throw Error(`Identidade do Dashboard indisponível`);return n}function Bt(){let[e,t]=(0,h.useState)(null),[n,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{let e=!1,n;async function i(){n=new AbortController;let i=setTimeout(()=>n.abort(),4e3);try{let i=await zt(n.signal);e||(t(i),r(!1))}catch{e||r(!0)}finally{clearTimeout(i)}}return i(),()=>{e=!0,n?.abort()}},[]),{status:e,unavailable:n}}function Vt({status:e,unavailable:t=!1}){let n=e?.lifecycle_manifest_state;return n!==`missing`&&n!==`invalid`?!e?.projection_refresh_failure&&!t?null:(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{className:`app-refresh-status workspace-health-toast`,role:`alert`,"aria-atomic":`true`,"aria-label":`Saúde do Dashboard`,children:[(0,y.jsx)(`span`,{className:`workspace-health-toast__icon`,"aria-hidden":`true`,children:`!`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:t?`Não foi possível consultar a saúde do Dashboard`:`O Dashboard precisa de atenção`}),(0,y.jsx)(`p`,{children:t?`A conexão com o dashboard está indisponível.`:`Não foi possível atualizar os dados do dashboard.`}),(0,y.jsx)(`p`,{children:`Atualize a página. Se o problema continuar, abra novamente o executável do dashboard.`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`Atualizar página`})]})]})}):(0,y.jsx)(`aside`,{className:`workspace-status`,"aria-label":`Saúde do Dashboard`,children:n===`missing`||n===`invalid`?(0,y.jsxs)(`div`,{className:`workspace-status__warning`,role:`alert`,children:[(0,y.jsx)(`strong`,{children:n===`missing`?`Lifecycle não inicializado`:`Manifesto do lifecycle inválido`}),(0,y.jsx)(`p`,{children:`Os dados deste workspace estão indisponíveis. Na pasta do projeto, execute:`}),(0,y.jsx)(`code`,{children:`node .agents/runtime/bin/zaip.mjs manifest rebuild --confirm-full-scan`})]}):null})}function Ht(){let e=Rt(),t=Bt();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Vt,{...t}),t.status?.lifecycle_manifest_state===`initialized`?(0,y.jsx)(Te,{model:e}):null]})}var Ut=document.getElementById(`root`);if(!Ut)throw Error(`Elemento #root não encontrado`);(0,g.createRoot)(Ut).render((0,y.jsx)(h.StrictMode,{children:(0,y.jsx)(Ht,{})}));export{X as n,Bt as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardHelpDialog-DnxpHJSo.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/cost-monitor-YfoKMzCQ.js","assets/cost-monitor-BESDS3aE.css","assets/dashboard-localization-BVBhiAAS.js","assets/DashboardHelpDialog-DRI_XwUf.css","assets/PricingSettingsDialog-DsFTUwhL.js","assets/ProjectSettingsPage-86kLUrXm.js","assets/ProjectSettingsPage-CQMhvzvJ.css","assets/CostCalculationGuidePage-DZ2mnR6k.js","assets/TraceabilityWorkspace-BZ1rH1vl.js","assets/traceability-vQx9R6BQ.js","assets/icons-vendor-DSdQAua1.js","assets/traceability-s5SzQnzt.css","assets/TraceabilityWorkspace-DvvavDLY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e}from"./rolldown-runtime-Bh1tDfsg.js";import{E as t,T as n,a as r,b as i,g as a,i as o,n as s,o as c,r as l,t as u,w as d}from"./cost-monitor-YfoKMzCQ.js";import{t as f}from"./react-vendor-rGvJzdn5.js";import{n as p,t as m}from"./traceability-vQx9R6BQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var h=e(t(),1),g=f(),_=n();function v({children:e}){let t=typeof document>`u`?null:document.getElementById(`dashboard-toasts`);return t?(0,_.createPortal)(e,t):e}var y=d();function b({locale:e}){let t=e===`pt-BR`?[`Definição`,`Planejamento`,`Pronto para Executar`,`Execução`,`Verificação`]:[`Definition`,`Planning`,`Ready to Execute`,`Execution`,`Verification`];return(0,y.jsxs)(`main`,{"aria-busy":`true`,"aria-live":`polite`,"aria-label":e===`pt-BR`?`Preparando dashboard`:`Preparing dashboard`,className:`app-skeleton`,role:`status`,children:[(0,y.jsxs)(`header`,{className:`app-skeleton-header`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,y.jsx)(`h1`,{children:`Dashboard ZAIP AIOS`})]}),(0,y.jsxs)(`div`,{className:`app-skeleton-actions`,children:[(0,y.jsx)(`span`,{}),(0,y.jsx)(`span`,{}),(0,y.jsx)(`span`,{})]})]}),(0,y.jsx)(`section`,{className:`app-skeleton-kpis`,"aria-hidden":`true`,children:Array.from({length:4},(e,t)=>`skeleton-kpi-${t}`).map(e=>(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-short`}),(0,y.jsx)(`span`,{className:`app-skeleton-value`}),(0,y.jsx)(`span`,{className:`app-skeleton-line`})]},e))}),(0,y.jsxs)(`section`,{className:`app-skeleton-panels`,"aria-hidden":`true`,children:[(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`div`,{className:`app-skeleton-chart`})]}),(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`div`,{className:`app-skeleton-chart app-skeleton-chart-small`})]})]}),(0,y.jsx)(`section`,{className:`app-skeleton-board`,"aria-hidden":`true`,children:t.map((e,t)=>(0,y.jsxs)(`article`,{children:[(0,y.jsx)(`h2`,{children:e}),Array.from({length:t%2==0?2:1},(t,n)=>`${e}-${n}`).map(e=>(0,y.jsxs)(`div`,{className:`app-skeleton-card`,children:[(0,y.jsx)(`span`,{className:`app-skeleton-line`}),(0,y.jsx)(`span`,{className:`app-skeleton-line app-skeleton-line-medium`}),(0,y.jsx)(`span`,{className:`app-skeleton-pill`})]},e))]},e))})]})}function x(e,t){let n=t===`pt-BR`;return e===`costs`?n?{title:`Carregando Monitor de Custos…`,detail:`Isso costuma levar poucos segundos.`}:{title:`Loading Cost Monitor…`,detail:`This usually takes a few seconds.`}:e===`traceability`?n?{title:`Carregando Rastreabilidade…`,detail:`Estamos preparando as 6 etapas da task.`}:{title:`Loading Traceability…`,detail:`Preparing the task's 6 stages.`}:n?{title:`Atualizando dados do dashboard…`,detail:`Você pode continuar navegando.`}:{title:`Refreshing dashboard data…`,detail:`You can keep navigating.`}}function S({area:e,locale:t}){let n=x(e,t);return(0,y.jsxs)(`section`,{"aria-busy":`true`,"aria-live":`polite`,className:`app-loading-panel`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:n.title}),(0,y.jsx)(`span`,{children:n.detail})]})]})}function C({area:e,locale:t}){let n=x(e,t);return(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:n.title}),(0,y.jsx)(`span`,{children:n.detail})]})]})})}function w({locale:e,onRetry:t}){return(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-loading-panel app-loading-panel-error`,role:`status`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:e===`pt-BR`?`Não foi possível carregar os custos`:`Couldn't load costs`}),(0,y.jsx)(`span`,{children:e===`pt-BR`?`A tela continua disponível. Tente novamente quando quiser.`:`The dashboard remains available. Try again whenever you want.`})]}),(0,y.jsx)(`button`,{onClick:t,type:`button`,children:e===`pt-BR`?`Tentar novamente`:`Try again`})]})}function T({costsLoaded:e,currency:t,snapshotCurrency:n}){return!e||n!==t}function E({aborted:e,currentCurrency:t,currentPeriod:n,currentRequestVersion:r,requestVersion:i,requestedCurrency:a,requestedPeriod:o}){return!e&&i===r&&a===t&&o.from===n.from&&o.to===n.to}function D(e,t){return e===t}function O(e,t,n,r){return D(e,t)&&n.from===r.from&&n.to===r.to}function k(e){return e instanceof DOMException&&e.name===`AbortError`}function A(e,t){return e===t}function j(e,t,n){return D(e,t)&&!n.aborted}function ee(e,t){let n=e=>[...new Map(e.map(e=>[e.id,e])).values()];return{...e,prds:n([...e.prds,...t.flatMap(e=>e.prds)]),specs:n([...e.specs,...t.flatMap(e=>e.specs)]),tasks:n([...e.tasks,...t.flatMap(e=>e.tasks)]),changes:n([...e.changes,...t.flatMap(e=>e.changes)])}}function te(){let e=(0,h.useRef)(null);return(0,h.useEffect)(()=>{e.current?.focus()},[]),(0,y.jsx)(`div`,{"aria-busy":`true`,"aria-live":`polite`,className:`period-transition-overlay`,onKeyDownCapture:e=>e.preventDefault(),ref:e,role:`status`,tabIndex:-1,children:(0,y.jsxs)(`div`,{className:`period-transition-overlay__content`,children:[(0,y.jsx)(`i`,{"aria-hidden":`true`,className:`period-transition-overlay__spinner`}),(0,y.jsx)(`span`,{className:`period-transition-overlay__label`,children:`Carregando...`})]})})}function ne({pending:e,children:t}){return(0,y.jsx)(`div`,{"aria-hidden":e||void 0,inert:e,children:t})}var M={"pt-BR":{action:`Tentar novamente`,guidance:`Abra a pasta dashboard dentro de .agents e dê dois cliques novamente no arquivo executável.`,title:`Não foi possível carregar o dashboard`},"en-US":{action:`Try again`,guidance:`Open the dashboard folder inside .agents, then double-click the executable file again.`,title:`Unable to load the dashboard`}};function re({children:e,error:t,globalLoadingPending:n,locale:r,onRefresh:i,operations:a,snapshotNotice:o,setupRoute:s}){if(s!==null)return s;if(t&&a===null){let e=M[r];return(0,y.jsx)(`main`,{className:`app-loading-boundary`,"aria-labelledby":`dashboard-load-error-title`,children:(0,y.jsxs)(`section`,{className:`app-loading-boundary__card`,role:`alert`,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:`app-loading-boundary__status-icon`,children:(0,y.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,children:(0,y.jsx)(`path`,{d:`M12 8v4m0 4h.01M10.29 3.86 2.82 16.5A2 2 0 0 0 4.54 19.5h14.92a2 2 0 0 0 1.72-3L13.71 3.86a2 2 0 0 0-3.42 0Z`})})}),(0,y.jsxs)(`div`,{className:`app-loading-boundary__content`,children:[(0,y.jsx)(`p`,{className:`app-loading-boundary__eyebrow`,children:r===`pt-BR`?`Dashboard indisponível`:`Dashboard unavailable`}),(0,y.jsx)(`h1`,{id:`dashboard-load-error-title`,children:e.title}),(0,y.jsx)(`p`,{children:e.guidance})]}),(0,y.jsx)(`button`,{onClick:i,type:`button`,children:e.action})]})})}return a===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(b,{locale:r}),o,n?(0,y.jsx)(te,{}):null,(0,y.jsx)(C,{area:`operations`,locale:r})]}):e}function ie(e){let t=new Set(e.blocked.map(e=>e.id));return{reconciled:e.reconciled_ids.filter(e=>!t.has(e)).length,blocked:e.blocked.length,notReconciled:e.not_reconciled.length}}function ae(e){let t=new Set(e.blocked.map(e=>e.id));return e.reconciled_ids.filter(e=>!t.has(e)).map(t=>{let n=e.outcomes?.find(e=>e.id===t);return{id:t,reason:n?.reason??null,status:n?.status??null}})}function N(e,t){return e===null?``:t===`pt-BR`?{completed:`Concluído`,delivered:`Entregue`,failed:`Falha técnica`,blocked:`Bloqueado`,cancelled:`Cancelado`}[e]??e:e}var P={"Invocation is still running":`A invocação ainda está em execução. Foi preservada intencionalmente; isso não indica falha do comando.`,"Host terminated without delivery evidence":`O host encerrou sem evidências de entrega.`,"Host interrupted":`O host foi interrompido.`,"Child attempt stopped":`A tentativa do subagente foi encerrada.`,"Execution orphaned after the reconciliation grace period":`A execução ficou sem orquestrador ativo após o período de tolerância da reconciliação.`};function oe(e,t){if(e===null)return t===`pt-BR`?`Motivo não informado.`:`No reason provided.`;if(t===`en-US`)return e;let n=e.match(/^Explicit orphan reconciliation found no active host invocation or terminal work outcome; repair is required before resuming \(Run (\S+)\)\.$/);if(n)return`A Run ${n[1]} ficou sem invocação ativa do host e sem evidência de um desfecho de entrega. A reconciliação registrou a interrupção; a entrega exige reparo e validação antes de retomar.`;let r=e.match(/^Execution (\S+) has no active orchestrator agent call after the reconciliation grace period\.?$/);return r?`A execução ${r[1]} não tem uma chamada de agente orquestrador ativa após o período de tolerância da reconciliação.`:P[e.trim().replace(/\.$/,``)]??e}function se({result:e,locale:t,onDismiss:n}){let[r,i]=(0,h.useState)(!1),a=(0,h.useRef)(null),o=t===`pt-BR`,s=ie(e),c=o?`Resultado da reconciliação manual`:`Manual reconciliation result`,l={reconciled:o?`Outros estados registrados`:`Other recorded outcomes`,blocked:o?`Desfechos bloqueados`:`Blocked outcomes`,notReconciled:o?`Não reconciliados`:`Not reconciled`},u=`${l.reconciled}: ${s.reconciled} · ${l.blocked}: ${s.blocked} · ${l.notReconciled}: ${s.notReconciled}`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{className:`app-reconciliation-result`,"aria-label":c,children:[(0,y.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,y.jsx)(`strong`,{children:c}),(0,y.jsx)(`p`,{children:u})]}),(0,y.jsxs)(`div`,{className:`app-reconciliation-actions`,children:[(0,y.jsx)(`button`,{ref:a,type:`button`,"aria-haspopup":`dialog`,onClick:()=>i(!0),children:o?`Veja mais`:`View details`}),(0,y.jsx)(`button`,{type:`button`,onClick:n,children:o?`Fechar`:`Dismiss`})]})]})}),r?(0,y.jsx)(ce,{result:e,locale:t,title:c,summary:u,labels:l,onClose:()=>i(!1),restoreFocus:()=>a.current?.focus({preventScroll:!0})}):null]})}function ce({result:e,locale:t,title:n,summary:r,labels:i,onClose:a,restoreFocus:o}){let s=(0,h.useRef)(null),c=(0,h.useRef)(o),l=(0,h.useId)(),u=t===`pt-BR`;(0,h.useEffect)(()=>{let e=s.current;if(!e)return;let t=document.body.style.overflow;return e.showModal(),document.body.style.overflow=`hidden`,()=>{e.close(),document.body.style.overflow=t,c.current()}},[]);let d=[{label:i.reconciled,items:ae(e),reasons:!0},{label:i.blocked,items:e.blocked,reasons:!0},{label:i.notReconciled,items:e.not_reconciled,reasons:!0}];return(0,y.jsxs)(`dialog`,{ref:s,className:`app-reconciliation-dialog`,"aria-labelledby":l,"aria-modal":`true`,onCancel:e=>{e.preventDefault(),a()},onKeyDown:e=>{if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not(:disabled), summary, [tabindex="0"]`)).filter(e=>e.getClientRects().length>0),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},children:[(0,y.jsxs)(`header`,{children:[(0,y.jsx)(`h2`,{id:l,children:n}),(0,y.jsx)(`button`,{type:`button`,onClick:a,children:u?`Fechar detalhes`:`Close details`})]}),(0,y.jsxs)(`section`,{className:`app-reconciliation-details`,tabIndex:0,"aria-label":u?`Itens da reconciliação`:`Reconciliation items`,children:[(0,y.jsx)(`p`,{children:r}),(0,y.jsx)(`p`,{children:u?`A reconciliação registra o estado real de cada item. Desfechos bloqueados aparecem somente na categoria de bloqueios; um estado registrado não significa entrega concluída.`:`Reconciliation records each item's actual state. Blocked outcomes appear only in the blocked category; a recorded state does not imply completed delivery.`}),(0,y.jsx)(`p`,{children:u?`Última telemetria indica a coleta de tokens medidos. Registrar estados ou atualizar o snapshot sem novos tokens não altera esse horário.`:`Last telemetry means measured token collection. Recording states or refreshing the snapshot without new tokens does not change that time.`}),e.diagnostics?(0,y.jsxs)(`p`,{children:[u?`Reconciliação executada em`:`Reconciliation executed at`,` `,new Intl.DateTimeFormat(t,{dateStyle:`short`,timeStyle:`medium`}).format(new Date(e.diagnostics.completed_at)),` · Job: `,(0,y.jsx)(`code`,{children:e.diagnostics.job_id}),` · `,`Logs`,`: `,(0,y.jsx)(`code`,{children:e.diagnostics.log_directory})]}):null,(0,y.jsx)(`p`,{children:u?`Invocações ainda em execução são preservadas intencionalmente. Permanecer não reconciliado por esse motivo não indica falha do comando.`:`Invocations that are still running are intentionally preserved. Remaining unreconciled for this reason does not indicate a command failure.`}),d.map(e=>(0,y.jsxs)(`section`,{"aria-label":e.label,children:[(0,y.jsxs)(`h3`,{children:[e.label,` (`,e.items.length,`)`]}),e.items.length===0?(0,y.jsx)(`p`,{children:u?`Nenhum item nesta categoria.`:`No items in this category.`}):(0,y.jsx)(`ul`,{children:F(e.items).map(({item:n,key:r})=>(0,y.jsxs)(`li`,{children:[(0,y.jsx)(`code`,{children:n.id}),`status`in n&&typeof n.status==`string`?(0,y.jsx)(`p`,{children:N(n.status,t)}):null,e.reasons?(0,y.jsx)(`p`,{children:oe(n.reason,t)}):null,e.reasons&&n.reason!==null&&oe(n.reason,t)!==n.reason?(0,y.jsxs)(`details`,{children:[(0,y.jsx)(`summary`,{children:u?`Motivo original`:`Original reason`}),(0,y.jsx)(`p`,{children:n.reason})]}):null]},r))})]},e.label))]})]})}function F(e){let t=new Map;return e.map(e=>{let n=JSON.stringify([e.id,e.reason]),r=(t.get(n)??0)+1;return t.set(n,r),{item:e,key:`${n}:${r}`}})}var le=`modulepreload`,ue=function(e){return`/`+e},de={},I=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ue(t,n),t=s(t),t in de)return;de[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:le,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},L=(0,h.lazy)(async()=>({default:(await I(async()=>{let{DashboardHelpDialog:e}=await import(`./DashboardHelpDialog-DnxpHJSo.js`);return{DashboardHelpDialog:e}},__vite__mapDeps([0,1,2,3,4,5]))).DashboardHelpDialog}));function fe({costLocale:e,documentDetail:t,helpOpen:n,loadingArea:r,reconciliationResult:a,refreshDialog:o,showTrace:l,trace:u,traceLink:d,traceMacroLoading:f,traceLoadingTaskId:g,closeDocument:_,onCloseHelp:b,onCloseTrace:x,onDismissReconciliation:S,onOpenDocument:w,onOpenTrace:T,onOpenTraceChange:E,onOpenTraceMacro:D,onRefreshCancel:O,onRefreshFromDialog:k,setTraceLink:A}){return(0,y.jsxs)(y.Fragment,{children:[l?null:g?(0,y.jsx)(m,{locale:e,taskId:g}):u?(0,y.jsx)(p,{locale:e,onClose:x,onOpenChange:E,onOpenPrd:e=>D(`PRD`,e),onOpenSpec:e=>D(`SPEC`,e),trace:u}):null,d?.kind===`change`?(0,y.jsx)(i,{details:{kind:`change`,row:d.row},locale:e,onClose:()=>A(null)}):null,d?.kind===`macro`?(0,y.jsx)(c,{label:d.label,locale:e,onClose:()=>A(null),onOpenDocument:w,onOpenTrace:e=>{A(null),T(e)},row:d.row,runs:d.projection.runs,specs:d.projection.specs,tasks:d.projection.tasks}):null,t?(0,y.jsx)(s,{detail:t.detail,error:t.error,label:t.label,locale:e,loading:!t.detail&&!t.error,onClose:_,onRetry:()=>w(t.kind,t.preview.id),preview:t.preview}):null,n?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(L,{locale:e,onClose:b})}):null,o===`choose`?(0,y.jsx)(`div`,{className:`app-refresh-dialog-backdrop`,children:(0,y.jsxs)(`section`,{"aria-label":`Atualizar dashboard`,"aria-modal":`true`,className:`app-refresh-dialog`,role:`dialog`,children:[(0,y.jsx)(`h2`,{children:e===`pt-BR`?`Atualizar dashboard`:`Refresh dashboard`}),(0,y.jsx)(`p`,{children:e===`pt-BR`?`Escolha uma atualização rápida ou reconcilie os itens que ainda estão em aberto.`:`Choose a quick refresh or reconcile work items that are still open.`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`button`,{onClick:()=>k(!1),type:`button`,children:e===`pt-BR`?`Apenas atualizar dados`:`Refresh data only`}),(0,y.jsx)(`button`,{onClick:()=>k(!0),type:`button`,children:e===`pt-BR`?`Reconciliar itens abertos`:`Reconcile open work`})]}),(0,y.jsx)(`button`,{className:`app-refresh-cancel`,onClick:O,type:`button`,children:e===`pt-BR`?`Cancelar`:`Cancel`})]})}):null,o===`refreshing`||o===`reconciling`?(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{"aria-live":`polite`,className:`app-refresh-status`,role:`status`,children:[(0,y.jsx)(`i`,{}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:o===`reconciling`?e===`pt-BR`?`Reconciliando itens em aberto…`:`Reconciling open work…`:e===`pt-BR`?`Atualizando dados…`:`Refreshing data…`}),(0,y.jsx)(`span`,{children:e===`pt-BR`?`Você pode continuar usando o dashboard.`:`You can keep using the dashboard.`})]})]})}):null,a!==null&&o===null?(0,y.jsx)(se,{result:a,locale:e,onDismiss:S}):null,(r!==null||f!==null)&&o===null?(0,y.jsx)(C,{area:f===null?r??`operations`:`operations`,locale:e}):null]})}var pe=(0,h.lazy)(async()=>({default:(await I(async()=>{let{PricingSettingsPage:e}=await import(`./PricingSettingsDialog-DsFTUwhL.js`);return{PricingSettingsPage:e}},__vite__mapDeps([6,1,2,3,4]))).PricingSettingsPage})),me=(0,h.lazy)(async()=>({default:(await I(async()=>{let{ProjectSettingsPage:e}=await import(`./ProjectSettingsPage-86kLUrXm.js`);return{ProjectSettingsPage:e}},__vite__mapDeps([7,1,2,3,8]))).ProjectSettingsPage})),he=(0,h.lazy)(async()=>({default:(await I(async()=>{let{CostCalculationGuidePage:e}=await import(`./CostCalculationGuidePage-DZ2mnR6k.js`);return{CostCalculationGuidePage:e}},__vite__mapDeps([9,1,2,3]))).CostCalculationGuidePage})),ge=`/setup-pricing`,_e=`/setup-project`,ve=`/cost-calculation-guide`;function ye(e){let{api:t,costLocale:n,fxRate:r,navigate:i,pathname:a,pricing:o,refresh:s,setFxRate:c,setPricing:l}=e;return a===`/setup-pricing`?o===null?(0,y.jsxs)(`main`,{className:`app-state`,children:[(0,y.jsx)(`p`,{children:n===`pt-BR`?`Configuração do projeto`:`Project settings`}),(0,y.jsx)(`h1`,{children:n===`pt-BR`?`Carregando catálogo de preços…`:`Loading pricing catalog…`}),(0,y.jsx)(`button`,{onClick:()=>i(`/`),type:`button`,children:n===`pt-BR`?`Voltar ao dashboard`:`Back to dashboard`})]}):(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(pe,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`),onSave:async e=>{l(await t.savePricing(e)),await s()},onSaveFxRate:async e=>{c(await t.saveFxRate(e)),await s()}})}):a===`/cost-calculation-guide`&&o!==null?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(he,{catalog:o,fxRate:r,locale:n,onClose:()=>i(`/`)})}):a===`/setup-project`?(0,y.jsx)(h.Suspense,{fallback:null,children:(0,y.jsx)(me,{api:t,locale:n,onClose:()=>i(`/`)})}):null}var be=(0,h.lazy)(async()=>({default:(await I(async()=>{let{TraceabilityWorkspace:e}=await import(`./TraceabilityWorkspace-BZ1rH1vl.js`);return{TraceabilityWorkspace:e}},__vite__mapDeps([10,1,2,3,11,12,13,14]))).TraceabilityWorkspace}));function xe({costs:e,costLocale:t,currency:n,dashboardView:r,failedArea:i,lastUpdatedAt:a,loadCostDetail:o,loadCostReadModelPage:s,loadCostRunPage:c,loadCostGroupPage:l,loadingArea:d,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:m,onLocaleChange:g,onOpenTrace:_,onLoadMoreTraceTasks:v,onRefresh:b,onRetry:x,onSelectTraceTask:C,onOpenTraceChange:T,onOpenTraceMacro:E,operations:D,selectedTraceTaskId:O,trace:k,traceLoadingTaskId:A,traceTasksHasMore:j,traceTasksLoading:ee,traceTasks:te}){return r===`cost-monitor`?e===null?()=>i===`costs`?(0,y.jsx)(w,{locale:t,onRetry:x}):(0,y.jsx)(S,{area:`costs`,locale:t}):r=>(0,y.jsx)(h.Suspense,{fallback:(0,y.jsx)(S,{area:`costs`,locale:t}),children:(0,y.jsx)(u,{currency:n,data:e,embedded:!0,globalFilters:r,lastUpdatedAt:a,locale:t,loading:d===`costs`,loadDetail:o,loadReadModelPage:s,loadRunPage:c,loadGroupPage:l,onActiveDataChange:f,onCurrencyChange:p,onLoadingChange:m,onLocaleChange:g,onOpenTrace:_,onRefresh:b,operations:D})}):r===`traceability`?()=>(0,y.jsx)(h.Suspense,{fallback:(0,y.jsx)(S,{area:`operations`,locale:t}),children:(0,y.jsx)(be,{loadingTaskId:A,locale:t,onOpenChange:T,onOpenPrd:e=>E(`PRD`,e),onOpenSpec:e=>E(`SPEC`,e),onLoadMoreTasks:v,onSelectTask:C,selectedTaskId:O,tasks:te.length>0?te:D.tasks,hasMoreTasks:j,isLoadingTasks:ee,trace:k})}):r===null?(0,y.jsx)(`span`,{"aria-hidden":`true`,hidden:!0}):void 0}function Se({currency:e,locale:t,onCurrencyChange:n,onHelpOpen:r,onNavigate:i,pricingSetupPath:a,projectSetupPath:o,costCalculationGuidePath:s}){return(0,y.jsxs)(`div`,{className:`dashboard-global-settings`,children:[(0,y.jsxs)(`label`,{children:[(0,y.jsx)(`span`,{children:t===`pt-BR`?`Moeda`:`Currency`}),(0,y.jsxs)(`select`,{"aria-label":t===`pt-BR`?`Moeda`:`Currency`,onChange:e=>n(e.target.value),value:e,children:[(0,y.jsx)(`option`,{value:`BRL`,children:`BRL · Real brasileiro`}),(0,y.jsx)(`option`,{value:`USD`,children:`USD · US Dollar`})]})]}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:r,type:`button`,children:t===`pt-BR`?`Central de Ajuda`:`Open help and guides`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(a),type:`button`,children:t===`pt-BR`?`Configurar preços e câmbio`:`Configure pricing and FX`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(o),type:`button`,children:t===`pt-BR`?`Configurar projeto`:`Configure project`}),(0,y.jsx)(`button`,{className:`dashboard-help-open`,onClick:()=>i(s),type:`button`,children:t===`pt-BR`?`Guia de cálculo de custos`:`Cost calculation guide`})]})}var Ce={preset:`all`,range:o(`this-month`)};function R(e){return e.preset===`all`?{from:null,to:null}:{from:e.range.start,to:e.range.end}}function we(e,t){let n=R(e),r=R(t);return n.from===r.from&&n.to===r.to}function Te({model:e}){let{operations:t,error:n,globalLoadingPending:r,costLocale:i,refresh:a,snapshotNotice:o,setupRoute:s,failedArea:c,retryLastLoad:u,costs:d,currency:f,dashboardView:p,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:g,loadCostRunPage:_,loadCostGroupPage:v,loadingArea:b,setDisplayedCosts:x,setCurrency:S,setCostSurfaceLoading:C,changeDashboardLocale:w,loadMoreTraceTasks:T,openTrace:E,setRefreshDialog:D,setSelectedTraceTaskId:O,openTraceChange:k,openTraceMacro:A,renderedOperations:j,selectedTraceTaskId:ee,trace:M,traceLoadingTaskId:ie,traceMacroLoading:ae,traceTasksHasMore:N,traceTasksLoading:P,traceTasks:oe,capabilityNavigation:se,boardTotals:ce,boardKindTotals:F,boardExportSource:le,detailExportSource:ue,boardStates:de,operationsPeriod:I,entityPage:L,dashboardIdentity:pe,operationsLoading:me,factualCostFact:he,factualCostPeriods:ye,setOperationsSurfaceLoading:be,operationsSurfaceLoading:Ce,currentCostByRun:R,loadOperationsEntityPage:Te,loadOperationsLifecyclePage:Ee,loadOperationsDetails:De,entityPageKind:z,loadFilteredOperationsPage:Oe,loadFilteredBoard:ke,loadWorkListFilters:B,loadWorkListPage:V,workListFiltersRef:H,boardFiltersRef:Ae,workListPage:je,overviewStatusPages:Me,loadOverviewStatusPage:U,overviewClassificationPages:Ne,loadOverviewClassificationPage:Pe,openDocument:W,api:G,setError:Fe,operationsPeriodRef:Ie,setOperationsPeriod:Le,operationsDetailLoadedRef:Re,operationsDetailCancelRef:ze,operationsDetailAbortRef:Be,operationsPageAbortRef:Ve,resetWorkListPage:He,operationsPageRequestVersionRef:Ue,refreshVersion:We,costSummaryAbortRef:Ge,costSummaryRequestVersion:Ke,setEntityPage:qe,costsLoadedRef:Je,setCosts:Ye,setPeriodTransitionPending:Xe,periodTransitionVersionRef:Ze,setLoadingArea:Qe,navigate:$e,setHelpOpen:K,closeDocument:et,documentDetail:tt,helpOpen:nt,reconciliationResult:rt,setReconciliationResult:it,refreshDialog:at,setTrace:ot,traceLink:st,setTraceLink:ct,refreshFromDialog:lt}=e,{loadMoreBoard:ut,overviewStatusPageKey:dt,overviewClassificationPageKey:ft,boardRequestVersionRef:pt,boardAbortControllersRef:mt,boardInFlightRef:ht,boardInitialPageRef:gt,boardLoadedRef:_t,setBoardTotals:vt,setBoardKindTotals:yt,setBoardStates:bt,setOverviewStatusPages:q,setOverviewClassificationPages:xt,setOperationsLoading:J}=e;return(0,y.jsxs)(re,{error:n,globalLoadingPending:r,locale:i,onRefresh:()=>void a(),operations:t,snapshotNotice:o,setupRoute:s,children:[(0,y.jsxs)(ne,{pending:r,children:[n?(0,y.jsxs)(`div`,{"aria-live":`assertive`,className:`app-warning app-error`,role:`alert`,children:[(0,y.jsx)(`span`,{children:n}),c?(0,y.jsx)(`button`,{onClick:u,type:`button`,children:i===`pt-BR`?`Tentar novamente`:`Try again`}):null,(0,y.jsx)(`button`,{"aria-label":i===`pt-BR`?`Fechar erro`:`Dismiss error`,onClick:()=>Fe(null),type:`button`,children:`×`})]}):null,(0,y.jsx)(l,{alternateContent:xe({costs:d,costLocale:i,currency:f,dashboardView:p,failedArea:c,lastUpdatedAt:m,loadCostDetail:h,loadCostReadModelPage:g,loadCostRunPage:_,loadCostGroupPage:v,loadingArea:b,onActiveDataChange:x,onCurrencyChange:S,onLoadingChange:C,onLocaleChange:w,onLoadMoreTraceTasks:T,onOpenTrace:e=>void E(e),onRefresh:()=>D(`choose`),onRetry:u,onSelectTraceTask:e=>{O(e),E(e)},onOpenTraceChange:k,onOpenTraceMacro:A,operations:j,selectedTraceTaskId:ee,trace:M,traceLoadingTaskId:ie,traceTasksHasMore:N,traceTasksLoading:P,traceTasks:oe}),capabilityNavigation:se,boardTotals:ce,boardKindTotals:F,boardExportSource:le,detailExportSource:ue,boardStates:de,data:j,lastUpdatedAt:m,datePreset:I.preset,dateRange:I.range,entityPage:L,dashboardTitle:pe.title,repositoryName:pe.repositoryName,loading:me,locale:i,currency:f,factualCostFact:he,costLoading:d===null&&c!==`costs`,factualCostPeriods:ye,onLoadingChange:be,resolveRunCost:d===null?void 0:e=>R.get(e)??null,onLocaleChange:w,onDetailDataRequest:e=>{let t=e===`conversations`?`conversations`:e===`executions`?`executions`:e===`runs`?`runs`:null;t===null?e===`changes`||e===`decisions`?Ee(e):De():Te(t)},onLoadMacroMetrics:()=>{t?.summary.overview_metrics?.macro_metrics===void 0&&De()},onEntityPageChange:e=>{z===`changes`||z===`decisions`?Ee(z,e):Te(z,e)},onEntityFiltersChange:Oe,onBoardFiltersChange:ke,onWorkListFiltersChange:B,onWorkListPageChange:e=>void V(H.current,e),onBoardTypeChange:e=>ke({...Ae.current,kind:e===`all`?``:e}),onWorkListTypeChange:e=>void V({...H.current,kind:e===`all`?``:e}),onLoadMoreBoard:e=>void ut(e),workListPage:je,statusPage:(e,t)=>Me[dt(e,t)],onLoadStatusPage:(e,t,n)=>void U(e,t,n),classificationPage:(e,t)=>Ne[ft(e,t)],onLoadClassificationPage:(e,t,n)=>void Pe(e,t,n),onOpenDocument:(e,t)=>void W(e,t),onOpenMacro:(e,t)=>void A(e===`prd`?`PRD`:`SPEC`,t),onOpenTask:E,onPriorityChange:async e=>{try{await G.saveWorkPriority(e)}catch(e){throw Fe(e instanceof Error?e.message:String(e)),e}},onDateChange:(e,t)=>{let n={preset:e,range:t};if(we(Ie.current,n)){Le(n);return}Re.current=!1,ze.current?.(),ze.current=null,Be.current?.abort(),Be.current=null,Ve.current?.abort(),Ve.current=null,He(),++Ue.current,pt.current+=1;for(let e of mt.current.values())e.abort();mt.current.clear(),ht.current.clear(),gt.current.clear(),_t.current={},vt({}),yt({}),bt({}),q({}),xt({}),++We.current,Ge.current?.abort(),Ge.current=null,++Ke.current,qe({offset:0,total:null,loading:!1,error:null}),Je.current=!1,Ye(null),x(null),J(!0),Ze.current+=1,Xe(!0),Qe(`operations`),Le(n)},onRefresh:()=>D(`choose`),settings:(0,y.jsx)(Se,{costCalculationGuidePath:ve,currency:f,locale:i,onCurrencyChange:S,onHelpOpen:()=>K(!0),onNavigate:$e,pricingSetupPath:ge,projectSetupPath:_e})}),(0,y.jsx)(fe,{closeDocument:et,costLocale:i,documentDetail:tt,helpOpen:nt,loadingArea:b??(d===null&&c!==`costs`?`costs`:Ce||Object.values(de).some(e=>e.loading)?`operations`:null),operations:j,reconciliationResult:rt,refreshDialog:at,showTrace:p===`traceability`,trace:M,traceLink:st,traceMacroLoading:ae,traceLoadingTaskId:ie,onCloseHelp:()=>K(!1),onCloseTrace:()=>ot(null),onDismissReconciliation:()=>it(null),onOpenDocument:(e,t)=>void W(e,t),onOpenTrace:e=>void E(e),onOpenTraceChange:k,onOpenTraceMacro:A,onRefreshCancel:()=>D(null),onRefreshFromDialog:e=>void lt(e),setTraceLink:e=>ct(e)})]}),r?(0,y.jsx)(te,{}):null]})}var Ee=(e,t)=>`${e}:${t}`,De=(e,t)=>`${e}:${t}`,z=[`definition`,`planning`,`ready`,`executing`,`verifying`,`completed`,`blocked`,`cancelled`,`failed`],Oe=`/zaip-cost-monitor`,ke=`zaip-dashboard-session-token`,B=`zaip-dashboard-locale`,V=`zaip-dashboard-currency`;function H(){return window.localStorage.getItem(`zaip-dashboard-locale`)===`en-US`?`en-US`:`pt-BR`}function Ae(e){return e.replace(/\/+$/,``)===Oe?`cost-monitor`:null}function je(){let e=new URL(window.location.href),t=e.searchParams.get(`token`)??window.localStorage.getItem(`zaip-dashboard-session-token`)??window.sessionStorage.getItem(`zaip-dashboard-session-token`)??``;return t&&(window.localStorage.setItem(ke,t),window.sessionStorage.setItem(ke,t)),e.searchParams.has(`token`)&&(e.searchParams.delete(`token`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}var Me=6e4,U=18e4;async function Ne(e,t,n=Me,r){let i=new AbortController,a=()=>i.abort();r?.addEventListener(`abort`,a,{once:!0}),r?.aborted&&i.abort();let o=window.setTimeout(()=>i.abort(),n);try{return await fetch(e,{...t,signal:i.signal})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?Error(`A leitura demorou mais de ${Math.ceil(n/1e3)} segundos. Tente novamente.`):e}finally{window.clearTimeout(o),r?.removeEventListener(`abort`,a)}}var Pe=class{token;constructor(e){this.token=e}ready(){return this.get(`/api/v2/ready`)}captureTelemetry(){return this.post(`/api/v2/capture-telemetry`)}dashboardIdentity(){return this.get(`/api/v2/dashboard-identity`)}operations(e,t=`detail`,n,r=!1){let i=`${a.operations}?scope=${t}${r?`&fresh=1`:``}`;return this.get(G(i,e),n)}sqliteViewPage(e,t,n={},r){let i=new URLSearchParams({view:e,offset:String(n.offset??0)});return n.limit!==void 0&&i.set(`limit`,String(n.limit)),n.query&&i.set(`query`,n.query),n.status&&i.set(`status`,n.status),n.risk&&i.set(`risk`,n.risk),n.provider&&i.set(`provider`,n.provider),n.model&&i.set(`model`,n.model),n.agent&&i.set(`agent`,n.agent),n.phase&&i.set(`phase`,n.phase),n.origin&&i.set(`origin`,n.origin),n.workType&&i.set(`workType`,n.workType),n.priority&&i.set(`priority`,n.priority),n.kind&&i.set(`kind`,n.kind),this.get(G(`/api/v2/sqlite-views?${i.toString()}`,t),r)}operationsBoard(e,t,n=0,r,i,o=4){let s=new URLSearchParams({scope:`board`,stage:t,offset:String(n),limit:String(o)});return r?.query&&s.set(`query`,r.query),r?.status&&s.set(`status`,r.status),r?.risk&&s.set(`risk`,r.risk),r?.origin&&s.set(`origin`,r.origin),r?.kind&&s.set(`kind`,r.kind),this.get(G(`${a.operations}?${s.toString()}`,e),i)}traceabilityTasks(e=0,t=10){let n=new URLSearchParams({scope:`traceability`,offset:String(e),limit:String(t)});return this.get(`${a.operations}?${n}`)}operationsClassification(e,t,n,r=0,i,o=50){let s=new URLSearchParams({scope:`classification`,kind:t,classification:n,offset:String(r),limit:String(o)});return this.get(G(`${a.operations}?${s.toString()}`,e),i)}operationsEntityPage(e,t,n=0,r,i){let o=W(t,n,r);return this.get(G(`${a.operations}/runs?${o}`,e),i)}operationsLifecyclePage(e,t,n=0,r,i){let o=W(t,n,r);return this.get(G(`${a.operations}/entities?${o}`,e),i)}operationsReadModelPage(e,t,n=0,r=50,i=``,o){let s=new URLSearchParams({kind:t,offset:String(n),limit:String(r)});return i&&s.set(`query`,i),this.get(G(`${a.operations}/read-models?${s.toString()}`,e),o)}costMonitor(e=`BRL`,t,n=`detail`,r,i,o=!1){let s=new URLSearchParams({currency:e,scope:n});o&&s.set(`fresh`,`1`);for(let[e,t]of Object.entries(i??{}))t&&s.set(e,t);return this.get(G(`${a.costMonitor}?${s.toString()}`,t),r)}costMonitorRuns(e=`BRL`,t,n,r=100,i,o){let s=new URLSearchParams({currency:e,scope:`runs`,offset:String(n),limit:String(r)});for(let[e,t]of Object.entries(o??{}))t&&s.set(e,t);return this.get(G(`${a.costMonitor}?${s.toString()}`,t),i)}snapshot(e=`BRL`,t){return this.get(G(`${a.snapshot}?currency=${e}`,t))}reconcileOpenWork(e=`BRL`,t){return this.post(G(`${a.reconcileOpenWork}?currency=${e}`,t),U)}refreshProjection(e=`BRL`,t){return this.post(G(`${a.refreshProjection}?currency=${e}`,t),U)}task(e){return this.get(a.task(e))}prd(e){return this.get(a.prd(e))}spec(e){return this.get(a.spec(e))}taskTrace(e,t){return this.get(a.taskTrace(e),t)}pricing(){return this.get(`/api/v2/pricing`)}async savePricing(e){let t=await fetch(`/api/v2/pricing`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok)throw Error(`Pricing update failed with HTTP ${t.status}`);return await t.json()}fxRate(){return this.get(`/api/v2/fx-rate`)}agentCatalog(){return this.get(a.agentCatalog)}agentPortraitUrl(e){return`/api/v2/agent-catalog-assets/${encodeURIComponent(e)}?token=${encodeURIComponent(this.token)}`}projectSettings(){return this.get(a.projectSettings)}projectOverview(){return this.get(`${a.projectSettings}/overview`)}async saveWorkPriority(e){let t=await fetch(a.workPriority,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({item_ids:e})});if(!t.ok)throw Error(`Work priority update failed with HTTP ${t.status}`);return await t.json()}async saveProjectSettings(e){let t=await fetch(a.projectSettings,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`Project settings update failed with HTTP ${t.status}`)}return await t.json()}async saveAgentCatalog(e){let t=e.map(({nickname_candidates:e,...t})=>t),n=await fetch(a.agentCatalog,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({agents:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Agent catalog update failed with HTTP ${n.status}`)}return await n.json()}async saveFxRate(e){let t=await fetch(`/api/v2/fx-rate`,{method:`PUT`,headers:{"content-type":`application/json`,"x-zaip-session":this.token},body:JSON.stringify({rate:e})});if(!t.ok)throw Error(`FX update failed with HTTP ${t.status}`);return await t.json()}async get(e,t){let n=await Ne(e,{cache:`no-cache`,headers:{"x-zaip-session":this.token}},Me,t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}async post(e,t=Me){let n=await Ne(e,{method:`POST`,headers:{"x-zaip-session":this.token}},t);if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Dashboard API failed with HTTP ${n.status}`)}return await n.json()}};function W(e,t,n){let r=new URLSearchParams({kind:e,offset:String(t),limit:`100`});return n?.query&&r.set(`query`,n.query),n?.status&&r.set(`status`,n.status),n?.risk&&r.set(`risk`,n.risk),r.toString()}function G(e,t){if(t===void 0)return e;let n=new URL(e,`http://dashboard.local`);return t.from!==null&&n.searchParams.set(`from`,t.from),t.to!==null&&n.searchParams.set(`to`,t.to),`${n.pathname}${n.search}`}function Fe(e){return e.projection_refresh_completed}function Ie(e,t){return{reconciliation:e.reconciliation,dismissProgressDialog:!0,applySnapshotState:t,reloadQuickProjection:t&&Fe(e)}}var Le={"pt-BR":{label:`Áreas do dashboard`,operations:`Operação`,operationsHint:`Trabalho em andamento e priorização`,costs:`Monitor de Custos`,costsHint:`Tempo, tokens e custo`,traceability:`Rastreabilidade`,traceabilityHint:`Ciclo completo em 6 etapas`},"en-US":{label:`Dashboard areas`,operations:`Operations`,operationsHint:`Lifecycle and work in progress`,costs:`Cost Monitor`,costsHint:`Time, tokens, and cost`,traceability:`Traceability`,traceabilityHint:`Complete 6-stage lifecycle`}};function Re({activeView:e,locale:t,onChange:n}){let r=Le[t],i=e=>{n(e),window.requestAnimationFrame(()=>{document.querySelector(`.dashboard-global-controls`)?.scrollIntoView({behavior:`smooth`,block:`start`})})};return(0,y.jsxs)(`nav`,{"aria-label":r.label,className:`dashboard-capability-nav`,children:[(0,y.jsxs)(`button`,{"aria-current":e===`cost-monitor`?`page`:void 0,className:e===`cost-monitor`?`is-active`:void 0,onClick:()=>i(`cost-monitor`),type:`button`,children:[(0,y.jsx)(Be,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.costs}),(0,y.jsx)(`small`,{children:r.costsHint})]})]}),(0,y.jsxs)(`button`,{"aria-current":e===`operations`?`page`:void 0,className:e===`operations`?`is-active`:void 0,onClick:()=>i(`operations`),type:`button`,children:[(0,y.jsx)(ze,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.operations}),(0,y.jsx)(`small`,{children:r.operationsHint})]})]}),(0,y.jsxs)(`button`,{"aria-current":e===`traceability`?`page`:void 0,className:e===`traceability`?`is-active`:void 0,onClick:()=>i(`traceability`),type:`button`,children:[(0,y.jsx)(Ve,{}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:r.traceability}),(0,y.jsx)(`small`,{children:r.traceabilityHint})]})]})]})}function ze(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-square-kanban`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`rect`,{height:`18`,rx:`2`,width:`18`,x:`3`,y:`3`}),(0,y.jsx)(`path`,{d:`M8 7v7`}),(0,y.jsx)(`path`,{d:`M12 7v4`}),(0,y.jsx)(`path`,{d:`M16 7v9`})]})}function Be(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-circle-dollar-sign`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,y.jsx)(`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}),(0,y.jsx)(`path`,{d:`M12 18V6`})]})}function Ve(){return(0,y.jsxs)(`svg`,{"aria-hidden":`true`,className:`lucide lucide-route`,viewBox:`0 0 24 24`,children:[(0,y.jsx)(`circle`,{cx:`6`,cy:`19`,r:`3`}),(0,y.jsx)(`path`,{d:`M9 19h6.5a3.5 3.5 0 0 0 0-7h-7a3.5 3.5 0 0 1 0-7H18`}),(0,y.jsx)(`circle`,{cx:`18`,cy:`5`,r:`3`})]})}function He(e){h.useEffect(()=>{if(!e)return;let t=new EventSource(`/api/v2/browser-lease?token=${encodeURIComponent(e)}`);return()=>t.close()},[e])}function Ue(e,t,n){return(0,y.jsx)(`div`,{className:`dashboard-capability-shell dashboard-capability-shell--${e??`initial`}`,children:(0,y.jsx)(Re,{activeView:e,locale:t,onChange:n})})}function We(e){return t=>{window.history.pushState(null,``,t),e(t),window.scrollTo({left:0,top:0})}}function Ge(e,t,n){return new Map((t??e)?.runs.map(e=>[e.run_id,n===`USD`?e.estimated_usd:e.estimated_brl])??[])}function Ke(e,t,n){let r=t??e;if(r?.currency!==n)return{fact:{state:`unavailable`,knownSum:null,coverage:null},periods:void 0};let i=r.overview.coverage[n===`USD`?`usd`:`brl`],a=n===`USD`?r.overview.estimated_usd:r.overview.estimated_brl,o={known:i,total:r.overview.run_count};return{fact:a===null?{state:`unavailable`,knownSum:null,coverage:o}:i<r.overview.run_count?{state:`partial`,knownSum:a,coverage:o}:{state:`complete`,knownSum:a,coverage:o},periods:{day:r.groups.daily,month:r.groups.monthly,year:r.groups.annual}}}var qe={title:`Dashboard ZAIP AIOS`,repositoryName:``};function Je(e,t){let n=typeof t.title==`string`?t.title.trim():``,r=typeof t.repository_name==`string`?t.repository_name.trim():``;return{title:n||e.title,repositoryName:r}}function Ye(e,t,n,r,i,a,o,s){s(null),e===`costs`?r():e===`traceability`&&t?i(t):e===`operations`&&n!==null?a():o()}function Xe(e,t,n,r,i,a,o,s,c){return ye({api:e,costLocale:t,fxRate:n,navigate:r,pathname:i,pricing:a,refresh:async()=>{await o()},setFxRate:s,setPricing:c})}function Ze(e){return async t=>{if(e.setDashboardView(t),window.scrollTo({left:0,top:0}),t===`cost-monitor`?T({costsLoaded:e.costsLoadedRef.current,currency:e.currency,snapshotCurrency:e.costs?.currency})&&(e.costSummaryAbortRef.current===null||e.costSummaryAbortRef.current.signal.aborted)&&e.loadCostSummary():e.costSummaryAbortRef.current?.abort(),t===`traceability`){let t=e.traceTasks;if(t.length===0){let n=e.boardRequestVersionRef.current;if(t=await e.loadMoreTraceTasks(!1,!0),n!==e.boardRequestVersionRef.current)return;e.setTraceTasks(t)}let n=t.toSorted((e,t)=>Date.parse(t.finished_at??t.updated_at)-Date.parse(e.finished_at??e.updated_at)),r=n.find(e=>e.status===`completed`)??n[0];r&&(e.setSelectedTraceTaskId(r.id),e.openTrace(r.id));return}e.setTrace(null),e.setTraceLoadingTaskId(null)}}function Qe(e,t=new Date){return e.preset===`custom`?e:e.preset===`all`?{...e,range:o(`this-month`,t)}:{...e,range:o(e.preset,t)}}function $e(e=new Date){let t=r(e.toISOString(),`day`);if(t===null)throw RangeError(`Invalid Sao Paulo day anchor`);let n=e.getTime(),i=n+1800*60*1e3;for(;r(new Date(i).toISOString(),`day`)===t;)i+=360*60*1e3;for(;i-n>1;){let e=Math.floor((n+i)/2);r(new Date(e).toISOString(),`day`)===t?n=e:i=e}return Math.max(1,i-e.getTime()+25)}function K(e){return typeof e==`number`?e:null}function et(e){return typeof e==`number`?{known_sum:e,unknown:0,complete:!0,coverage_ratio:1}:{known_sum:0,unknown:1,complete:!1,coverage_ratio:0}}function tt(e){return Object.hasOwn(e,`total_duration`)?K(e.total_duration):K(e.cost_monitor_total_duration)}function nt(e,t){let n=e?.[`${t}_known_count`],r=e?.[`${t}_unknown_count`];return typeof n!=`number`||typeof r!=`number`?et(e?.[t]):{known_sum:typeof e?.[t]==`number`?e[t]:0,unknown:r,complete:r===0&&n>0,coverage_ratio:n+r>0?n/(n+r):0}}function rt(e,t){let n=t.totals,r=e=>nt(n,e);return{data_source:`lifecycle_daily_read_models`,snapshot_id:t.snapshot_id??null,source_latest_at:t.snapshot_updated_at??null,kind:e,offset:t.offset,limit:t.limit,total:t.total_count,has_more:t.has_more,next_cursor:null,subtotal:{entity_count:typeof n?.entity_count==`number`?n.entity_count:t.total_count,run_count:r(`invocation_count`),activity_count:r(`activity_count`),unattributed_cost_brl:K(n?.unattributed_cost_brl),unattributed_activity_count:K(n?.unattributed_activity_count),orphan_cost_brl:K(n?.orphan_cost_brl),orphan_activity_count:K(n?.orphan_activity_count),metrics:{duration:r(`total_duration`),total_tokens:r(`total_tokens`),cost_brl:r(`total_cost_brl`),cost_usd:r(`total_cost_usd`)}},rows:t.rows.map(t=>({id:String(t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??t.id??`unavailable`),title:String(t.title??t.task_id??t.spec_id??t.prd_id??t.execution_id??t.conversation_id??`Unavailable`),kind:e===`tasks`?`task`:e===`specs`?`spec`:e===`prds`?`prd`:e===`executions`?`execution`:`conversation`,status:typeof t.status==`string`?t.status:null,risk:typeof t.risk==`string`?t.risk:null,occurred_at:typeof t.occurred_at==`string`?t.occurred_at:typeof t.started_at==`string`?t.started_at:typeof t.last_day==`string`?`${t.last_day}T12:00:00.000Z`:``,parent_id:null,run_count:Number(t.invocation_count??0),activity_count:K(t.activity_count),cost_currency:`BRL`,metrics:{duration:nt(t,`total_duration`),total_tokens:nt(t,`total_tokens`),cost:nt(t,`total_cost_brl`)}}))}}function it(e,t,n){let{filters:r,query:i}=e;return{offset:t,limit:n,...i===void 0||i===``?{}:{query:i},...r.provider?{provider:r.provider}:{},...r.model?{model:r.model}:{},...r.agent?{agent:r.agent}:{},...r.phase?{phase:r.phase}:{},...r.status?{status:r.status}:{},...r.origin?{origin:r.origin}:{},...r.workType?{workType:r.workType}:{},...r.priority?{priority:r.priority}:{},...r.risk?{risk:r.risk}:{}}}function at(e){let t=tt(e),n=Number(e.duration_unknown??+(t===null)),r=t??K(e.duration_known)??0;return{key:String(e.key??e.period_key??`total`),label:String(e.label??e.key??e.period_key??``),latest_started_at:typeof e.latest_started_at==`string`?e.latest_started_at:``,persona:typeof e.persona==`string`?e.persona:null,job:typeof e.job==`string`?e.job:null,run_count:Number(e.total_run_count??e.invocation_count??0),task_count:K(e.task_count),conversation_count:K(e.conversation_count),prd_count:K(e.prd_count),spec_count:K(e.spec_count),evidence_count:K(e.evidence_count),test_count:K(e.validation_count),event_count:Number(e.source_event_count??0),total_tokens:K(e.total_tokens),estimated_usd:K(e.total_cost_usd),estimated_brl:K(e.total_cost_brl),duration_ms:t,duration:{known_sum:r,unknown:n,complete:n===0,coverage_ratio:+(n===0)},coverage:{events:0,tokens:0,usd:0,brl:0}}}async function ot(e,t){let{from:n,limit:r,offset:i,signal:a,to:o,view:s}=t,c=n===void 0||o===void 0?void 0:{from:n,to:o};if(s===`daily`){let n=await e.sqliteViewPage(`cost_monitor_daily`,c,it(t,i,r),a);return{snapshot_id:n.snapshot_id??null,snapshot_updated_at:n.snapshot_updated_at??null,offset:n.offset,limit:n.limit,total_count:n.total_count,has_more:n.has_more,rows:n.rows.map(at),...n.period_averages===void 0?{}:{period_averages:n.period_averages},...n.totals===void 0?{}:{totals:at(n.totals)}}}let l={monthly:`cost_monitor_monthly`,annual:`cost_monitor_annual`,agents:`cost_monitor_zaip_agents`,models:`cost_monitor_models`,providers:`cost_monitor_providers`}[s],u=await e.sqliteViewPage(l,c,it(t,i,r),a);return{snapshot_id:u.snapshot_id??null,snapshot_updated_at:u.snapshot_updated_at??null,offset:u.offset,limit:u.limit,total_count:u.total_count,has_more:u.has_more,rows:u.rows.map(at),...u.period_averages===void 0?{}:{period_averages:u.period_averages},...u.totals===void 0?{}:{totals:at(u.totals)}}}async function st(e,t){let{filters:n,from:r,limit:i=10,offset:a,signal:o,to:s}=t,c=await e.sqliteViewPage(`cost_monitor_agent_invocations`,r===void 0||s===void 0?void 0:{from:r,to:s},{offset:a,limit:i,...n?.query?{query:n.query}:{},...n?.provider?{provider:n.provider}:{},...n?.model?{model:n.model}:{},...n?.agent?{agent:n.agent}:{},...n?.phase?{phase:n.phase}:{},...n?.status?{status:n.status}:{},...n?.priority?{priority:n.priority}:{},...n?.risk?{risk:n.risk}:{},...n?.origin?{origin:n.origin}:{},...n?.workType?{workType:n.workType}:{}},o);return{page_only:!0,runs:c.rows.map(ct),run_page:{offset:c.offset,limit:c.limit,total:c.total_count,has_more:c.has_more}}}function ct(e){let t=(e,t)=>typeof e==`string`?e:t,n=e=>typeof e==`number`?e:null,r=t(e.agent_invocation_id,`unavailable`),i=typeof e.task_id==`string`?e.task_id:null,a=typeof e.spec_id==`string`?e.spec_id:null,o=typeof e.prd_id==`string`?e.prd_id:null,s=t(e.phase,`execution`),c=e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`estimated`||e.duration_provenance===`legacy_inferred`?e.duration_provenance:`unavailable`,l=Object.hasOwn(e,`calculated_cost_usd`)?n(e.calculated_cost_usd):n(e.cost_usd),u=n(e.current_fx_rate)??n(e.fx_rate),d=n(e.recorded_cost_usd)??n(e.recorded_usd),f=Object.hasOwn(e,`recorded_fx_rate`)?n(e.recorded_fx_rate):n(e.fx_rate),p=n(e.recorded_brl)??(!Object.hasOwn(e,`recorded_brl`)&&d!==null?n(e.cost_brl):null),m=l!==null&&u!==null?Math.round(l*u*1e6)/1e6:null;return{run_id:r,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:t(e.run_id,r),task_id:i,task_title:t(e.task_title,i??`Tarefa avulsa`),task_status:t(e.task_status,`unavailable`),priority:t(e.priority,`unavailable`),risk:t(e.risk,`unavailable`),spec_id:a,prd_id:o,change_id:typeof e.change_id==`string`?e.change_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_role:e.invocation_kind===`subagent`?`subagent`:`orchestrator`,run_kind:e.run_kind===`subrun`?`subrun`:`run`,run_purpose:`execution`,requires_finalizer:!1,client:t(e.client,`unavailable`),agent:t(e.zaip_agent,`unavailable`),agent_name:t(e.zaip_agent,`unavailable`),provider:typeof e.provider==`string`?e.provider:null,model:t(e.model,`unavailable`),requested_model:t(e.requested_model,`unavailable`),reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,effective_reasoning_effort:typeof e.effective_reasoning_effort==`string`?e.effective_reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,call_count:n(e.llm_call_count),status:t(e.status,`completed`),phase:s,origin:o===null?a===null?i===null?`conversation`:`task`:`spec`:`prd`,work_type:e.work_type===`rework`?`rework`:`new`,started_at:t(e.occurred_at,``),finished_at:typeof e.finished_at==`string`?e.finished_at:null,duration_ms:n(e.duration_ms),duration_provenance:c,estimation_basis:typeof e.estimation_basis==`string`?e.estimation_basis:null,source_started_at:typeof e.source_started_at==`string`?e.source_started_at:null,source_finished_at:typeof e.source_finished_at==`string`?e.source_finished_at:null,capture_lag_ms:n(e.capture_lag_ms),event_count:n(e.source_event_count),input_tokens:n(e.input_tokens),cached_input_tokens:n(e.cached_input_tokens),output_tokens:n(e.output_tokens),reasoning_tokens:n(e.reasoning_tokens),total_tokens:n(e.total_tokens),uncached_input_tokens:n(e.uncached_input_tokens),visible_output_tokens:n(e.visible_output_tokens),input_rate_usd_per_million:n(e.input_rate_usd_per_million),cached_input_rate_usd_per_million:n(e.cached_input_rate_usd_per_million),output_rate_usd_per_million:n(e.output_rate_usd_per_million),reasoning_rate_usd_per_million:n(e.reasoning_rate_usd_per_million),context_input_multiplier:n(e.context_input_multiplier),context_output_multiplier:n(e.context_output_multiplier),speed_cost_multiplier:n(e.speed_cost_multiplier),standard_cost_usd:n(e.standard_cost_usd),speed_uplift_usd:n(e.speed_uplift_usd),input_cost_usd:n(e.input_cost_usd),cached_input_cost_usd:n(e.cached_input_cost_usd),output_cost_usd:n(e.output_cost_usd),reasoning_cost_usd:n(e.reasoning_cost_usd),fx_rate:u,estimated_usd:l,estimated_brl:m,recorded_usd:d,recorded_brl:p,recorded_fx_rate:f,coverage:{events:0,tokens:0,usd:0,brl:0},artifact_path:`.agents/records/runs/${r}`}}function lt(e){return{loadCostDetail:(0,h.useCallback)(async()=>{throw Error(`SQLite Cost Monitor loads the selected paginated view; full detail is disabled.`)},[]),loadCostReadModelPage:(0,h.useCallback)(async({filters:t,from:n,kind:r,limit:i,offset:a,query:o,signal:s,to:c})=>{let l={tasks:`cost_monitor_tasks`,specs:`cost_monitor_specs`,prds:`cost_monitor_prds`,executions:`cost_monitor_executions`,conversations:`cost_monitor_conversations`}[r];return rt(r,await e.sqliteViewPage(l,n===void 0||c===void 0?void 0:{from:n,to:c},{offset:a,limit:i,...t.query||o?{query:t.query||o}:{},...t.provider?{provider:t.provider}:{},...t.model?{model:t.model}:{},...t.agent?{agent:t.agent}:{},...t.phase?{phase:t.phase}:{},...t.status?{status:t.status}:{},...t.origin?{origin:t.origin}:{},...t.workType?{workType:t.workType}:{},...t.priority?{priority:t.priority}:{},...t.risk?{risk:t.risk}:{}},s))},[e]),loadCostRunPage:(0,h.useCallback)(t=>st(e,t),[e]),loadCostGroupPage:(0,h.useCallback)(t=>ot(e,t),[e])}}function ut(e,t){return!1}function dt(e,t=window,n=0){let r=!1,i=!1,a=new AbortController,o=t.setTimeout(()=>{r||i||(i=!0,e(a.signal))},n);return()=>{r||(r=!0,a.abort(),t.clearTimeout(o))}}var ft=2e3,pt=5e3,mt=1e4,ht=3e4,gt=`A atualização do snapshot não foi concluída. Os dados exibidos podem estar desatualizados.`;function _t(e,t){return e===`visible`?pt:t>0?ht:mt}function vt(e,t){return e!==null&&typeof t==`string`&&t.length>0&&e!==t}function yt(e,t){return(e===`current`||e===`updating`)&&typeof t==`string`&&t.length>0}function bt({inFlight:e,lastRefreshAt:t,now:n,visibilityState:r}){return r===`visible`&&!e&&n-t>=5e3}function q(e){let t=!1,n,r=null,i=0,a=0,o=e.updating(),s=!1,c=async()=>{if(!t){e.updating()&&!o&&(o=!0,a=0,s=!1),o&&a++;try{let n=await e.ready();if(t)return;i=0;let a=yt(n.snapshot_state,n.snapshot_revision);if(a&&vt(r,n.snapshot_revision)||o&&n.snapshot_state===`current`){let i=await e.reload();if(t)return;i&&(a&&(r=n.snapshot_revision??null),o=!1,e.settled())}else r===null&&a&&(r=n.snapshot_revision??null)}catch{i++}t||(o&&a>=90&&!s&&(s=!0,e.exhausted(gt)),n=setTimeout(()=>void c(),o&&!s?ft:_t(e.visibility(),i)))}};return c(),()=>{t=!0,n!==void 0&&clearTimeout(n)}}function xt({api:e,costLocale:t,currency:n,dashboardView:r,loadOperationsDetails:i,operations:a,operationsDetailAbortRef:o,operationsDetailCancelRef:s,operationsPageAbortRef:c,pathname:l,pricing:u,refresh:d,refreshVersion:f,snapshotUpdating:p,setSnapshotUpdating:m,setError:g,setFxRate:_,setPathname:v,setPricing:y}){let b=(0,h.useRef)(!1),x=(0,h.useRef)(0),S=(0,h.useRef)(p);S.current=p,(0,h.useEffect)(()=>(d(),()=>{s.current?.(),s.current=null,o.current?.abort(),o.current=null,c.current?.abort(),c.current=null,++f.current}),[o,s,c,d,f]),(0,h.useEffect)(()=>{let e=()=>{let e=Date.now();bt({inFlight:b.current,lastRefreshAt:x.current,now:e,visibilityState:document.visibilityState})&&(x.current=e,b.current=!0,d(!1,!1,!0).finally(()=>{b.current=!1}))};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[d]),(0,h.useEffect)(()=>q({ready:()=>e.ready(),reload:()=>d(!1,!1,!1,!0),updating:()=>S.current,visibility:()=>document.visibilityState,settled:()=>m(!1),exhausted:e=>{m(!1),g(e)}}),[e,d,g,m]),(0,h.useEffect)(()=>{if(!ut(r,a?.summary.overview_metrics?.partial===!0))return;let e=dt(async e=>{await i(e)});return s.current=e,()=>{s.current===e&&(s.current=null),e()}},[r,i,a?.summary.overview_metrics?.partial,s]),(0,h.useEffect)(()=>window.localStorage.setItem(B,t),[t]),(0,h.useEffect)(()=>window.localStorage.setItem(V,n),[n]),(0,h.useEffect)(()=>{[`/`,`/setup-pricing`,`/setup-project`,`/cost-calculation-guide`].includes(window.location.pathname)||(window.history.replaceState(null,``,`/${window.location.search}${window.location.hash}`),v(`/`))},[v]),(0,h.useEffect)(()=>{let e=()=>v(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[v]),(0,h.useEffect)(()=>{![`/setup-pricing`,`/cost-calculation-guide`].includes(l)||u!==null||Promise.all([e.pricing(),e.fxRate()]).then(([e,t])=>{y(e),_(t)}).catch(e=>g(String(e)))},[e,l,u,g,_,y])}var J={events:0,tokens:{input:null,cached_input:null,output:null,reasoning:null,total:null},cost:{usd:null,brl:null},coverage:{events:0,tokens:0,usd:0,brl:0}};function St(e,t,n){let r=e=>e===`intake`||e===`orchestration`||e===`execution`||e===`review`||e===`audit`||e===`finalization`?e:`execution`,i=n.rows.map(e=>({id:e.id,artifact_path:`.agents/records/runs/${e.id}`,status:e.status===`running`||e.status===`failed`||e.status===`cancelled`?e.status:`completed`,phase:e.phase??`execution`,entrypoint:e.conversation_id===null?`task`:`conversation`,work_type:`new`,run_role:e.run_kind===`subrun`?`subagent`:`orchestrator`,run_kind:e.run_kind??`run`,run_purpose:r(e.run_purpose),requires_finalizer:!1,parent_run_id:e.parent_run_id,client:e.client??`unknown`,agent:e.agent??`unknown`,agent_name:e.agent??`unknown`,agent_persona:e.agent_persona??null,agent_job:e.agent_job??null,provider:e.provider??null,model:e.model??`unknown`,reasoning_effort:e.reasoning_effort??null,effective_model:e.model??null,effective_reasoning_effort:e.reasoning_effort??null,effective_config_mixed:e.pricing_mixed??!1,service_tier:e.service_tier??null,call_count:e.llm_call_count??null,terminal_call_count:null,failed_call_count:null,cancelled_call_count:null,conversation_id:e.conversation_id??e.id,execution_id:e.execution_id,task_id:e.task_id,spec_id:null,prd_id:null,change_id:null,started_at:e.started_at,finished_at:e.finished_at,duration_ms:e.duration_ms,source_duration_ms:e.source_duration_ms===void 0?e.duration_ms:e.source_duration_ms,duration_provenance:e.duration_provenance===`observed`||e.duration_provenance===`reconciled`||e.duration_provenance===`legacy_inferred`||e.duration_provenance===`estimated`?e.duration_provenance:`unavailable`,llm_call_count:e.llm_call_count??null,input_tokens:e.input_tokens??null,cached_input_tokens:e.cached_input_tokens??null,uncached_input_tokens:e.uncached_input_tokens??null,output_tokens:e.output_tokens??null,reasoning_tokens:e.reasoning_tokens??null,visible_output_tokens:e.visible_output_tokens??null,input_rate_usd_per_million:e.input_rate_usd_per_million??null,cached_input_rate_usd_per_million:e.cached_input_rate_usd_per_million??null,output_rate_usd_per_million:e.output_rate_usd_per_million??null,reasoning_rate_usd_per_million:e.reasoning_rate_usd_per_million??null,context_input_multiplier:e.context_input_multiplier??null,context_output_multiplier:e.context_output_multiplier??null,speed_cost_multiplier:e.speed_cost_multiplier??null,pricing_scenario:e.pricing_scenario??null,standard_cost_usd:e.standard_cost_usd??null,speed_uplift_usd:e.speed_uplift_usd??null,input_cost_usd:e.input_cost_usd??null,cached_input_cost_usd:e.cached_input_cost_usd??null,output_cost_usd:e.output_cost_usd??null,reasoning_cost_usd:e.reasoning_cost_usd??null,calculated_cost_usd:e.calculated_cost_usd??null,recorded_cost_usd:e.recorded_cost_usd??null,cost_variance_usd:e.cost_variance_usd??null,cost_usd:e.cost_usd??null,cost_brl:e.currency===`BRL`?e.cost:null,fx_rate:e.fx_rate??null,pricing_segment_count:e.pricing_segment_count??null,pricing_mixed:e.pricing_mixed??!1,pricing_model:e.pricing_model??null,pricing_source:e.pricing_source??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},usage:{conversation:J,planning:J,execution:{...J,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},total:{...J,events:e.llm_call_count??0,tokens:{input:e.input_tokens??null,cached_input:e.cached_input_tokens??null,output:e.output_tokens??null,reasoning:e.reasoning_tokens??null,total:e.total_tokens},cost:{usd:e.cost_usd??null,brl:e.currency===`BRL`?e.cost:null}},new_work:J,rework:J}}));return{...e,runs:i,executions:t===`executions`||t===`conversations`?n.rows.map((e,n)=>{let r=i[n];if(r===void 0)throw Error(`Operations entity page must have a projected run for every row.`);let a=r.execution_id??r.conversation_id,o=e.status??`unavailable`;return{id:a,kind:t===`conversations`?`interaction`:`delivery`,created_at:r.started_at,status:o,work_status:o,origin:t===`conversations`?{type:`interaction`,conversation_id:r.conversation_id}:{type:`task`,task_id:r.task_id??`unavailable`},dag:{nodes:[],topological_order:[]},result:null,artifact_path:`.agents/records/executions/${a}`,agent_call_count:0,orchestrator_run_count:0,subagent_run_count:0,finalizer_run_count:0,finalized_task_count:0,llm_call_count:0,llm_call_count_complete:!1,task_count:0,spec_count:0,prd_count:0,duration_ms:r.source_duration_ms??null,...e.lifecycle_elapsed_ms===void 0?{}:{lifecycle_elapsed_ms:e.lifecycle_elapsed_ms},total_tokens:r.usage.total.tokens.total,cost_brl:r.usage.total.cost.brl}}):e.executions}}function Y(e){if(typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Ct({api:e,entityFiltersRef:t,operationsPageAbortRef:n,operationsPageRequestVersionRef:r,operationsPeriod:i,operationsPeriodRef:a,refreshVersion:o,setEntityPage:s,setEntityPageKind:c,setOperations:l}){return{loadOperationsEntityPage:(0,h.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=R(i),_=()=>j(m,r.current,p.signal)&&O(h,o.current,g,R(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t={runs:`operations_agent_invocations`,executions:`operations_executions`,conversations:`operations_conversations`}[u],n=await e.sqliteViewPage(t,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),r={kind:u,offset:n.offset,limit:n.limit,total:n.total_count,aggregation:`canonical_entity`,rows:n.rows.map(e=>({id:String(e.agent_invocation_id??e.execution_id??e.conversation_id??e.id),started_at:String(e.occurred_at??e.started_at??`1970-01-01T00:00:00.000Z`),finished_at:typeof e.finished_at==`string`?e.finished_at:null,task_id:typeof e.task_id==`string`?e.task_id:null,execution_id:typeof e.execution_id==`string`?e.execution_id:null,conversation_id:typeof e.conversation_id==`string`?e.conversation_id:null,parent_run_id:typeof e.parent_agent_invocation_id==`string`?e.parent_agent_invocation_id:null,run_kind:e.invocation_kind===`delegated`||e.invocation_kind===`subagent`?`subrun`:e.invocation_kind===`orchestrator`?`run`:null,run_purpose:typeof e.purpose==`string`?e.purpose:null,phase:typeof e.phase==`string`?e.phase:null,status:typeof e.status==`string`?e.status:null,agent:typeof e.zaip_agent==`string`?e.zaip_agent:null,agent_persona:typeof e.zaip_agent_persona==`string`?e.zaip_agent_persona:null,agent_job:typeof e.zaip_agent_job==`string`?e.zaip_agent_job:null,client:typeof e.client==`string`?e.client:null,provider:typeof e.provider==`string`?e.provider:null,model:typeof e.model==`string`?e.model:null,reasoning_effort:typeof e.reasoning_effort==`string`?e.reasoning_effort:null,service_tier:typeof e.service_tier==`string`?e.service_tier:null,duration_ms:typeof e.duration_ms==`number`?e.duration_ms:typeof e.total_duration==`number`?e.total_duration:null,source_duration_ms:typeof e.source_duration_ms==`number`?e.source_duration_ms:null,duration_provenance:typeof e.duration_provenance==`string`?e.duration_provenance:null,llm_call_count:typeof e.llm_call_count==`number`?e.llm_call_count:null,input_tokens:typeof e.input_tokens==`number`?e.input_tokens:null,cached_input_tokens:typeof e.cached_input_tokens==`number`?e.cached_input_tokens:null,uncached_input_tokens:typeof e.uncached_input_tokens==`number`?e.uncached_input_tokens:null,output_tokens:typeof e.output_tokens==`number`?e.output_tokens:null,reasoning_tokens:typeof e.reasoning_tokens==`number`?e.reasoning_tokens:null,visible_output_tokens:typeof e.visible_output_tokens==`number`?e.visible_output_tokens:null,total_tokens:typeof e.total_tokens==`number`?e.total_tokens:null,input_rate_usd_per_million:typeof e.input_rate_usd_per_million==`number`?e.input_rate_usd_per_million:null,cached_input_rate_usd_per_million:typeof e.cached_input_rate_usd_per_million==`number`?e.cached_input_rate_usd_per_million:null,output_rate_usd_per_million:typeof e.output_rate_usd_per_million==`number`?e.output_rate_usd_per_million:null,reasoning_rate_usd_per_million:typeof e.reasoning_rate_usd_per_million==`number`?e.reasoning_rate_usd_per_million:null,context_input_multiplier:typeof e.context_input_multiplier==`number`?e.context_input_multiplier:null,context_output_multiplier:typeof e.context_output_multiplier==`number`?e.context_output_multiplier:null,speed_cost_multiplier:typeof e.speed_cost_multiplier==`number`?e.speed_cost_multiplier:null,pricing_scenario:typeof e.pricing_scenario==`string`?e.pricing_scenario:null,standard_cost_usd:typeof e.standard_cost_usd==`number`?e.standard_cost_usd:null,speed_uplift_usd:typeof e.speed_uplift_usd==`number`?e.speed_uplift_usd:null,input_cost_usd:typeof e.input_cost_usd==`number`?e.input_cost_usd:null,cached_input_cost_usd:typeof e.cached_input_cost_usd==`number`?e.cached_input_cost_usd:null,output_cost_usd:typeof e.output_cost_usd==`number`?e.output_cost_usd:null,reasoning_cost_usd:typeof e.reasoning_cost_usd==`number`?e.reasoning_cost_usd:null,calculated_cost_usd:typeof e.calculated_cost_usd==`number`?e.calculated_cost_usd:null,recorded_cost_usd:typeof e.recorded_cost_usd==`number`?e.recorded_cost_usd:null,cost_variance_usd:typeof e.cost_variance_usd==`number`?e.cost_variance_usd:null,cost_usd:typeof e.cost_usd==`number`?e.cost_usd:null,fx_rate:typeof e.fx_rate==`number`?e.fx_rate:null,pricing_segment_count:typeof e.pricing_segment_count==`number`?e.pricing_segment_count:null,pricing_mixed:e.pricing_mixed===1||e.pricing_mixed===!0,pricing_model:typeof e.audit_pricing_model==`string`?e.audit_pricing_model:typeof e.pricing_model==`string`?e.pricing_model:null,pricing_source:typeof e.audit_pricing_source==`string`?e.audit_pricing_source:typeof e.pricing_source==`string`?e.pricing_source:null,cost:typeof e.total_cost_brl==`number`?e.total_cost_brl:typeof e.cost_brl==`number`?e.cost_brl:null,currency:`BRL`}))};if(!_())return;l(e=>e===null?e:St(e,u,r)),s({offset:r.offset,total:r.total,loading:!1,error:null,aggregation:r.aggregation})}catch(e){if(!_()||k(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l]),loadOperationsLifecyclePage:(0,h.useCallback)(async(u,d=0,f=t.current)=>{n.current?.abort();let p=new AbortController;n.current=p;let m=++r.current,h=o.current,g=R(i),_=()=>j(m,r.current,p.signal)&&O(h,o.current,g,R(a.current));c(u),s({offset:d,total:null,loading:!0,error:null});try{let t=await e.sqliteViewPage(u===`changes`?`operations_changes`:`operations_decisions`,g,{offset:d,limit:100,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{}},p.signal),n=u===`changes`?t.rows.map(e=>{let t=String(e.source_type),n=String(e.source_id);return{id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:null,status:typeof e.status==`string`?e.status:`unclassified`,risk:typeof e.risk==`string`?e.risk:`unclassified`,source:t===`spec`?{type:`spec`,spec_id:n}:t===`prd`?{type:`prd`,prd_id:n,spec_id:null}:{type:`task`,task_id:n},requirement_ids:Y(e.requirement_ids_json),acceptance_ids:Y(e.acceptance_ids_json),task_ids:Y(e.task_ids_json),result:typeof e.result==`string`?e.result:null,artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id)}}):t.rows.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:String(e.id),origin:e.origin===`human`?`human`:`agent`,scope_type:e.scope_type===`execution`?`execution`:`change`,scope_id:String(e.scope_id),artifact_path:typeof e.source_path==`string`?e.source_path:String(e.id),created_at:typeof e.occurred_at==`string`?e.occurred_at:`1970-01-01T00:00:00.000Z`})),r={kind:u,offset:t.offset,limit:t.limit,total:t.total_count,rows:n};if(!_())return;l(e=>e===null?e:{...e,...u===`changes`?{changes:r.rows}:{decisions:r.rows}}),s({offset:r.offset,total:r.total,loading:!1,error:null})}catch(e){if(!_()||k(e))return;s({offset:d,total:null,loading:!1,error:e instanceof Error?e.message:String(e)})}finally{n.current===p&&(n.current=null)}},[e,t,n,r,i,a,o,s,c,l])}}function wt({api:e,operations:t,isOperationsDetailLoaded:n,setError:r,setFailedArea:i,setLoadingArea:a}){let[o,s]=(0,h.useState)(null),[c,l]=(0,h.useState)([]),[u,d]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),m=(0,h.useRef)(0),g=(0,h.useRef)(0),_=(0,h.useRef)(0),v=(0,h.useRef)(null),[y,b]=(0,h.useState)(null),x=(0,h.useRef)(null),[S,C]=(0,h.useState)(null),[w,T]=(0,h.useState)(``);async function E(n){_.current+=1,v.current?.abort(),b(null),p(null);let o=++g.current;x.current?.abort();let l=new AbortController;x.current=l,r(null),i(null),s(null),C(n),a(`traceability`),await new Promise(e=>window.requestAnimationFrame(()=>e()));try{let r=await e.taskTrace(n,l.signal);if(g.current!==o)return!1;let i=c.find(e=>e.id===n)??t?.tasks.find(e=>e.id===n);return s({...r,task_title:i?.title||r.task_title||n,task_risk:i?.risk||r.task_risk||null,task_created_at:i?.created_at||r.task_created_at||null,task_progress:r.task_progress??i?.progress??0}),!0}catch(e){return l.signal.aborted||g.current!==o?!1:(r(e instanceof Error?e.message:String(e)),i(`traceability`),!1)}finally{g.current===o&&(x.current===l&&(x.current=null),C(null),a(e=>e===`traceability`?null:e))}}function D(e){let n=t?.changes.find(t=>t.id===e);n!==void 0&&(s(null),p({kind:`change`,row:n}))}async function O(o,c){let l=++_.current;v.current?.abort(),v.current=null,g.current+=1,x.current?.abort(),x.current=null,C(null),a(e=>e===`traceability`?null:e),r(null),i(null),s(null),p(null);let u=(o===`PRD`?t?.prds:t?.specs)?.find(e=>e.id===c&&e.kind===o.toLowerCase());if(u&&t&&n()){b(null),p({kind:`macro`,label:o,row:u,projection:t});return}let d=new AbortController;v.current=d,b({label:o,id:c});try{let t=await e.operations(void 0,`detail`,d.signal);if(l!==_.current||d.signal.aborted)return;let n=(o===`PRD`?t.prds:t.specs).find(e=>e.id===c&&e.kind===o.toLowerCase());if(!n)throw Error(`${o} ${c} not found`);p({kind:`macro`,label:o,row:n,projection:t})}catch(e){if(l!==_.current||d.signal.aborted)return;r(e instanceof Error?e.message:String(e))}finally{l===_.current&&(v.current===d&&(v.current=null),b(null))}}async function k(n,r){let i=(n===`prd`?t?.prds:t?.specs)?.find(e=>e.id===r)??(f?.kind===`macro`?(n===`prd`?f.projection.prds:f.projection.specs).find(e=>e.id===r):void 0);if(!i)return;let a=++m.current,o=n===`prd`?`PRD`:`SPEC`;d({kind:n,label:o,preview:i});try{let t=n===`prd`?await e.prd(r):await e.spec(r);if(m.current!==a)return;d({kind:n,label:o,preview:i,detail:t})}catch(e){if(m.current!==a)return;d({kind:n,label:o,preview:i,error:e instanceof Error?e.message:String(e)})}}function A(){m.current+=1,d(null)}return{closeDocument:A,documentDetail:u,openDocument:k,openTrace:E,openTraceChange:D,openTraceMacro:O,selectedTraceTaskId:w,setSelectedTraceTaskId:T,setTrace:s,setTraceLink:p,setTraceLoadingTaskId:C,setTraceTasks:l,trace:o,traceLink:f,traceMacroLoading:y,traceLoadingTaskId:S,traceTasks:c}}function Tt({cursor:e,page:t,tasks:n}){let r=new Map(n.map(e=>[e.id,e]));for(let e of t.tasks)r.set(e.id,e);let i=e.offset+t.tasks.length;return{tasks:[...r.values()],cursor:t.tasks.length===0||i>=t.total?{offset:0,stageIndex:e.stageIndex+1}:{...e,offset:i}}}function X(e,t,n){return Math.min(t,e+n)}function Et(e,t,n){let r=(0,h.useRef)(t),i=(0,h.useRef)({offset:0,stageIndex:0}),a=(0,h.useRef)(!1),[o,s]=(0,h.useState)(!1),[c,l]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{r.current=t},[t]),{loadMoreTraceTasks:(0,h.useCallback)(async(t=!1,o=!1)=>{if(a.current||(o&&(i.current={offset:0,stageIndex:0},r.current=[],n([]),s(!0)),i.current.stageIndex>=1))return r.current;a.current=!0,l(!0);try{do{let a=i.current,o=await e.traceabilityTasks(a.offset,10),s=Tt({cursor:a,page:o,tasks:r.current});if(r.current=s.tasks,n(r.current),i.current=s.cursor,o.tasks.length>0&&!t)break}while(i.current.stageIndex<1);return s(i.current.stageIndex<1),r.current}finally{a.current=!1,l(!1)}},[e,n]),traceTasksHasMore:o,traceTasksLoading:c}}function Z(e,t){let n=e.snapshot_id??e.snapshot_updated_at;if(n!=null&&n!==(t.snapshot_id??t.snapshot_updated_at))throw Error(`Os dados mudaram durante a exportação. Atualize a página e exporte novamente.`)}async function*Dt(e,t){let n=e;for(;;){if(n.rows.length===0)return;yield n.rows;let r=n.offset+n.rows.length;if(!n.has_more||r>=n.total_count)return;n=await t(r),Z(e,n)}}function Ot({api:e,boardAbortControllersRef:t,boardFilterKeyRef:n,boardFiltersRef:r,boardInFlightRef:i,boardInitialPageRef:a,boardLoadedRef:o,boardRequestVersionRef:s,dashboardView:c,operations:l,operationsPeriod:u,operationsPeriodRef:d,overviewStatusInFlightRef:f,quickOverviewMetricsRef:p,setBoardKindTotals:m,setBoardStates:g,setBoardTotals:_,setOperations:v,setOverviewClassificationPages:y,setOverviewStatusPages:b}){let x=(0,h.useCallback)(()=>{s.current+=1;for(let e of t.current.values())e.abort();t.current.clear(),i.current.clear(),a.current.clear(),o.current={},_({}),m({}),g({}),b({}),y({})},[t,i,a,o,s,m,g,_,y,b]),S=(0,h.useCallback)(async n=>{if(l===null||i.current.has(n))return;i.current.add(n),t.current.get(n)?.abort();let a=new AbortController;t.current.set(n,a);let c=s.current,f=R(u);g(e=>({...e,[n]:{loading:!0,error:null}}));let p=o.current[n]??0;try{let t=await e.operationsBoard(f,n,p,r.current,a.signal,10);if(a.signal.aborted||c!==s.current||f.from!==R(d.current).from||f.to!==R(d.current).to)return;v(e=>e===null?e:{...ee(e,[t]),summary:e.summary}),_(e=>({...e,[n]:t.total})),m(e=>({...e,[n]:t.totals_by_kind})),o.current={...o.current,[n]:p+t.prds.length+t.specs.length+t.tasks.length}}catch(e){if(a.signal.aborted||c!==s.current||k(e))return;g(t=>({...t,[n]:{loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{c===s.current&&(i.current.delete(n),t.current.get(n)===a&&t.current.delete(n),g(e=>e[n]?.error===null?{...e,[n]:{loading:!1,error:null}}:e))}},[e,t,r,i,o,s,l,u,d,m,g,_,v]),C=(0,h.useCallback)(e=>{let t={...e,kind:e.kind??r.current.kind??``},i=`${t.query}|${t.status}|${t.risk}|${t.origin??``}|${t.kind}`;i!==n.current&&(n.current=i,r.current=t,x(),v(e=>e===null?e:{...e,prds:[],specs:[],tasks:[],changes:[],summary:i===`||||`&&p.current!==void 0?{...e.summary,overview_metrics:p.current}:e.summary}))},[n,r,p,x,v]),w=(0,h.useCallback)(async(t,n,r)=>{let i=Ee(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(u);b(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsBoard(c,t,r,{kind:n===`task`?`all-tasks`:n});if(o!==s.current||c.from!==R(d.current).from||c.to!==R(d.current).to)return;let l=n===`task`?a.tasks:n===`spec`?a.specs:a.prds;b(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||k(e))return;b(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,b]),T=(0,h.useCallback)(async(t,n,r)=>{let i=De(t,n),a=f.current;if(a.has(i))return;a.add(i);let o=s.current,c=R(u);y(e=>({...e,[i]:{items:r===0?[]:e[i]?.items??[],total:e[i]?.total??0,loading:!0,error:null}}));try{let a=await e.operationsClassification(c,t,n,r);if(o!==s.current||c.from!==R(d.current).from||c.to!==R(d.current).to)return;let l=t===`task`?a.tasks:t===`spec`?a.specs:a.prds;y(e=>({...e,[i]:{items:r===0?l:[...e[i]?.items??[],...l],total:a.total,loading:!1,error:null}}))}catch(e){if(o!==s.current||k(e))return;y(t=>({...t,[i]:{items:t[i]?.items??[],total:t[i]?.total??0,loading:!1,error:e instanceof Error?e.message:String(e)}}))}finally{a.delete(i)}},[e,s,u,d,f,y]),E=(0,h.useCallback)(t=>{let n={...r.current,...t},i=R(u);return{prepare:async()=>{let t=await Promise.all(z.map(t=>e.operationsBoard(i,t,0,n))),r=e=>[...e.prds.map(({kind:e,...t})=>({kind:`prd`,...t})),...e.specs.map(({kind:e,...t})=>({kind:`spec`,...t})),...e.tasks.map(e=>({...e,kind:e.spec_id===null?`standalone-task`:`task`}))];for(let e of t)Z(t[0],e);return{totalRows:t.reduce((e,t)=>e+t.total,0),metadata:{source:`operations_work_kanban`,snapshot_id:t[0]?.snapshot_id??null,snapshot_updated_at:t[0]?.snapshot_updated_at??null,filters:n,period:i??`all`},...t[0]?.financial_summary===void 0?{}:{financialSummary:t[0].financial_summary},pages:async function*(){for(let a of t){let t=a,o=0;for(;;){let s=r(t);if(s.length===0||(o+=s.length,yield s,o>=t.total))break;t=await e.operationsBoard(i,t.stage,o,n),Z(a,t)}}}}}}},[e,r,u]);return(0,h.useEffect)(()=>{if(c!==`operations`||l===null)return;let e=!1,t=s.current,n=()=>!e&&t===s.current,r=async()=>{if(!n())return;let e=z.filter(e=>!a.current.has(e)&&!i.current.has(e));for(let t=0;t<e.length&&n();t+=3){let r=e.slice(t,t+3);if(!n())return;for(let e of r)a.current.add(e);await Promise.all(r.map(e=>S(e)))}},o=window.setTimeout(()=>void r(),0);return()=>{e=!0,window.clearTimeout(o)}},[i,a,s,c,S,l]),{boardExportSource:E,loadFilteredBoard:C,loadMoreBoard:S,loadOverviewClassificationPage:T,loadOverviewStatusPage:w,resetBoard:x}}function Q(e,t){return JSON.stringify([e.query,e.status,e.risk,e.origin??``,e.kind??``,t.from??``,t.to??``])}function kt(e,t,n){return e===`explicit`||t!==n}function At(e,t){return{...e,kind:e.kind??t.kind??``}}var jt={offset:0,limit:10,total:null,hasMore:!1,typeFilter:`all`,rows:[],loading:!1,error:null};function Mt({api:e,operationsPeriod:t,operationsPeriodRef:n}){let[r,i]=(0,h.useState)(jt),a=(0,h.useRef)({query:``,status:``,risk:``}),o=(0,h.useRef)(null),s=(0,h.useRef)(0),c=(0,h.useRef)(null),l=(0,h.useCallback)(async(r,l=0,u=`explicit`)=>{let d=R(t),f=At(r,a.current),p=Q(f,d);if(!kt(u,p,c.current))return;o.current?.abort();let m=new AbortController;o.current=m;let h=++s.current;a.current=f,c.current=p;let g=f.kind||`all`;i(e=>({...e,offset:l,typeFilter:g,loading:!0,error:null}));try{let t=await e.sqliteViewPage(`operations_work_list`,d,{offset:l,limit:10,...f.query?{query:f.query}:{},...f.status?{status:f.status}:{},...f.risk?{risk:f.risk}:{},...f.origin?{origin:f.origin}:{},...g===`all`?{}:{kind:g}},m.signal);if(m.signal.aborted||h!==s.current||d.from!==R(n.current).from||d.to!==R(n.current).to)return;i({offset:t.offset,limit:t.limit,total:t.total_count,hasMore:t.has_more,typeFilter:g,rows:t.rows,loading:!1,error:null})}catch(e){if(m.signal.aborted||h!==s.current)return;c.current===p&&(c.current=null),i(t=>({...t,offset:l,typeFilter:g,loading:!1,error:e instanceof Error?e.message:String(e)}))}finally{o.current===m&&(o.current=null)}},[e,t,n]),u=(0,h.useCallback)(()=>{o.current?.abort(),o.current=null,++s.current,c.current=null,i(jt)},[]);return{workListPage:r,workListFiltersRef:a,loadWorkListFilters:(0,h.useCallback)(e=>l(e,0,`filter-hydration`),[l]),loadWorkListPage:l,resetWorkListPage:u}}function Nt(){let[e,t]=(0,h.useState)(H),[n,r]=(0,h.useState)(()=>window.localStorage.getItem(`zaip-dashboard-currency`)===`USD`?`USD`:`BRL`),i=(0,h.useRef)(n);return i.current=n,{costLocale:e,currency:n,setCurrency:r,currencyRef:i,changeDashboardLocale:(0,h.useCallback)(e=>{t(e),r(e===`en-US`?`USD`:`BRL`)},[])}}function Pt({api:e,operationsPeriod:t}){return(0,h.useCallback)((n,r)=>{let i=R(t);if(n===`work-kanban`)return;let a={"work-list":`operations_work_list`,changes:`operations_changes`,decisions:`operations_decisions`,executions:`operations_executions`,runs:`operations_agent_invocations`,conversations:`operations_conversations`,daily:`operations_daily`,monthly:`operations_monthly`,yearly:`operations_annual`}[n];if(a===void 0)return;let o=e=>({offset:e,limit:100,...r.query?{query:r.query}:{},...r.status?{status:r.status}:{},...r.risk?{risk:r.risk}:{},...r.origin?{origin:r.origin}:{},...a===`operations_work_list`&&r.kind?{kind:r.kind}:{}});return{prepare:async()=>{let t=await e.sqliteViewPage(a,i,o(0));return{totalRows:t.total_count,metadata:{source:a,snapshot_id:t.snapshot_id??null,snapshot_updated_at:t.snapshot_updated_at??null,filters:r,period:i??`all`},...t.financial_summary===void 0?{}:{financialSummary:t.financial_summary},pages:()=>Dt(t,t=>e.sqliteViewPage(a,i,o(t)))}}}},[e,t])}var Ft=1500;function It({snapshotUpdating:e,initialDataPending:t,dismissed:n,delayElapsed:r}){return e&&t&&!n&&r}function Lt(e,t,n){let[r,i]=(0,h.useState)(!1),[a,o]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(!e||!t||r){o(!1);return}let n=window.setTimeout(()=>o(!0),Ft);return()=>window.clearTimeout(n)},[t,r,e]),It({snapshotUpdating:e,initialDataPending:t,dismissed:r,delayElapsed:a})?(0,y.jsxs)(`div`,{"aria-live":`polite`,className:`app-notice app-snapshot-status`,role:`status`,children:[(0,y.jsx)(`span`,{children:`Exibindo o último snapshot local validado. Os dados canônicos estão sendo atualizados em segundo plano e estarão atuais na próxima abertura.`}),(0,y.jsx)(`button`,{"aria-label":n===`pt-BR`?`Fechar aviso de atualização do snapshot`:`Dismiss snapshot update notice`,onClick:()=>i(!0),type:`button`,children:`×`})]}):null}function Rt(){He(je());let[e,t]=(0,h.useState)(!1),n=(0,h.useMemo)(je,[]),r=(0,h.useMemo)(()=>new Pe(n),[n]),{loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s}=lt(r),[c,l]=(0,h.useState)(()=>Ae(window.location.pathname)),u=(0,h.useRef)(c);u.current=c;let[d,f]=(0,h.useState)(null),[p,m]=(0,h.useState)({offset:0,total:null,loading:!1,error:null}),[g,_]=(0,h.useState)(`runs`),v=(0,h.useRef)({query:``,status:``,risk:``}),[y,b]=(0,h.useState)({}),[x,S]=(0,h.useState)({}),[C,w]=(0,h.useState)({}),[j,ee]=(0,h.useState)({}),[te,ne]=(0,h.useState)({}),[M,re]=(0,h.useState)(null),[ie,ae]=(0,h.useState)(null),{costLocale:N,currency:P,setCurrency:oe,currencyRef:se,changeDashboardLocale:ce}=Nt(),[F,le]=(0,h.useState)(()=>Ce),ue=F.preset===`all`?null:F.range.start,de=F.preset===`all`?null:F.range.end,I=(0,h.useMemo)(()=>({from:ue,to:de}),[ue,de]),L=(0,h.useRef)(F);L.current=F;let fe=(0,h.useRef)(null),[pe,me]=(0,h.useState)(!1),[he,ge]=(0,h.useState)(null),[_e,ve]=(0,h.useState)(null),[ye,be]=(0,h.useState)(window.location.pathname),[xe,Se]=(0,h.useState)(!0),[we,Te]=(0,h.useState)(!1),[,z]=(0,h.useState)(!1),[,Oe]=(0,h.useState)(!1),[ke,B]=(0,h.useState)(`operations`),[V,H]=(0,h.useState)(null),[Me,U]=(0,h.useState)(null);(0,h.useEffect)(()=>{r.captureTelemetry().then(()=>t(!0)).catch(()=>{})},[r]);let[Ne,W]=(0,h.useState)(null),[G,Fe]=(0,h.useState)(null),[Le,Re]=(0,h.useState)(null),[ze,Be]=(0,h.useState)(qe),Ve=(0,h.useCallback)(e=>{Be(t=>Je(t,e))},[]);(0,h.useEffect)(()=>{let e=!1;return r.dashboardIdentity().then(t=>{e||Ve(t)}).catch(()=>{}),()=>{e=!0}},[r,Ve]);let K=(0,h.useRef)(!1),{closeDocument:et,documentDetail:tt,openDocument:nt,openTrace:rt,openTraceChange:it,openTraceMacro:at,traceMacroLoading:ot,selectedTraceTaskId:st,setSelectedTraceTaskId:ct,setTrace:ut,setTraceLink:dt,setTraceLoadingTaskId:ft,setTraceTasks:pt,trace:mt,traceLink:ht,traceLoadingTaskId:gt,traceTasks:_t}=wt({api:r,operations:d,isOperationsDetailLoaded:()=>K.current,setError:W,setFailedArea:H,setLoadingArea:B}),{loadMoreTraceTasks:vt,traceTasksHasMore:yt,traceTasksLoading:bt}=Et(r,_t,pt),q=(0,h.useRef)(0),J=(0,h.useRef)(0),St=(0,h.useRef)(!1),Y=(0,h.useRef)(0),Tt=(0,h.useRef)(0),X=(0,h.useRef)(null),Z=(0,h.useRef)(!1),Dt=(0,h.useRef)(null),Q=(0,h.useRef)(null),kt=(0,h.useRef)(null),At=(0,h.useRef)(0),jt=(0,h.useRef)({}),Ft=(0,h.useRef)(new Set),It=(0,h.useRef)(new Map),Rt=(0,h.useRef)(new Set),zt=(0,h.useRef)(new Set),Bt=(0,h.useRef)({query:``,status:``,risk:``,origin:``,kind:``}),Vt=(0,h.useRef)(`||||`),Ht=(0,h.useRef)(0),Ut=(0,h.useRef)(void 0),{workListPage:Wt,workListFiltersRef:Gt,loadWorkListFilters:Kt,loadWorkListPage:qt,resetWorkListPage:Jt}=Mt({api:r,operationsPeriod:F,operationsPeriodRef:L}),Yt=(0,h.useRef)(!1),$=(0,h.useCallback)(async(e=!0,n=!1,i=!1,a=!1)=>{Dt.current?.(),Dt.current=null,Q.current?.abort(),Q.current=null,Ht.current+=1;for(let e of It.current.values())e.abort();It.current.clear(),Ft.current.clear(),zt.current.clear(),jt.current={},b({}),S({}),w({}),ee({}),ne({});let o=++q.current,s=J.current,c=u.current,l=I,d=()=>D(o,q.current)&&O(o,q.current,l,R(L.current));e&&(Se(!0),B(`operations`)),W(null),H(null);try{if(n){let e=await r.reconcileOpenWork(P,l),n=Ie(e,d());if(Fe(n.reconciliation),n.dismissProgressDialog&&U(null),!n.applySnapshotState)return!1;if(t(e.snapshot_state===`updating`),n.reloadQuickProjection){let e=await r.operations(l,`quick`,void 0,!0);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,K.current=!1,Re(e.summary.latest_token_collected_at??null)}}else if(i){let e=await r.refreshProjection(P,l);if(!d())return!1;f(e.operations),Ut.current=e.operations.summary.overview_metrics,K.current=!0,re(e.costs),Z.current=!0,ae(null);let t=e.dashboard;t&&Be(e=>Je(e,t)),Re(e.projection.latest_token_collected_at??null)}else{let[e,t]=await Promise.all([r.operations(l,`quick`,void 0,Yt.current),P===`USD`||a?r.costMonitor(P,l,`summary`):Promise.resolve(null)]);if(!d())return!1;Yt.current=!1,f(e),Ut.current=e.summary.overview_metrics,K.current=!1,t!==null&&(re(t),Z.current=!1,ae(null)),Re(e.summary.latest_token_collected_at??null)}return!0}catch(e){return d()?(W(e instanceof Error?e.message:String(e)),H(c===`cost-monitor`?`costs`:`operations`),!1):!1}finally{d()&&A(s,J.current)&&Oe(!1),e&&d()&&(Se(!1),B(e=>e===`operations`?null:e))}},[r,P,I]),Xt=(0,h.useCallback)(async e=>{if(K.current||St.current||e?.aborted)return null;Q.current?.abort();let t=e===void 0?new AbortController:null,n=e??t?.signal;if(n===void 0)return null;t!==null&&(Q.current=t),St.current=!0,Y.current+=1,B(`costs`),H(null);try{let e=++q.current,t=R(F),i=()=>D(e,q.current)&&O(e,q.current,t,R(L.current)),a=await r.operations(t,`detail`,n);return i()?(f(a),K.current=!0,a):null}catch(e){return n.aborted||k(e)?null:(W(e instanceof Error?e.message:String(e)),H(`operations`),null)}finally{t!==null&&Q.current===t&&(Q.current=null),St.current=!1,Y.current=Math.max(0,Y.current-1),Y.current===0&&B(e=>e===`costs`?null:e)}},[r,F]),{loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt}=Ct({api:r,entityFiltersRef:v,operationsPageAbortRef:kt,operationsPageRequestVersionRef:At,operationsPeriod:F,operationsPeriodRef:L,refreshVersion:q,setEntityPage:m,setEntityPageKind:_,setOperations:f}),$t=(0,h.useCallback)((e,t)=>{v.current=t,e===`changes`||e===`decisions`?Qt(e,0,t):Zt(e,0,t)},[Zt,Qt]),{boardExportSource:en,loadFilteredBoard:tn,loadMoreBoard:nn,loadOverviewClassificationPage:rn,loadOverviewStatusPage:an,resetBoard:on}=Ot({api:r,boardAbortControllersRef:It,boardFilterKeyRef:Vt,boardFiltersRef:Bt,boardInFlightRef:Ft,boardInitialPageRef:zt,boardLoadedRef:jt,boardRequestVersionRef:Ht,dashboardView:c,operations:d,operationsPeriod:F,operationsPeriodRef:L,overviewStatusInFlightRef:Rt,quickOverviewMetricsRef:Ut,setBoardKindTotals:S,setBoardStates:w,setBoardTotals:b,setOperations:f,setOverviewClassificationPages:ne,setOverviewStatusPages:ee}),sn=Pt({api:r,operationsPeriod:F}),cn=async e=>{e&&Fe(null),U(e?`reconciling`:`refreshing`);try{await $(!1,e,!e)}finally{U(null)}};(0,h.useEffect)(()=>{let e=null,t=()=>{e=window.setTimeout(()=>{le(e=>{let t=Qe(e);return t!==e&&(fe.current=t),t}),t()},$e())};return t(),()=>{e!==null&&window.clearTimeout(e)}},[]),(0,h.useEffect)(()=>{fe.current===F&&(fe.current=null,$(!1,!1,!0,!0))},[F,$]),xt({api:r,costLocale:N,currency:P,dashboardView:c,loadOperationsDetails:Xt,operations:d,operationsDetailAbortRef:Q,operationsDetailCancelRef:Dt,operationsPageAbortRef:kt,pathname:ye,pricing:he,refresh:$,refreshVersion:q,setSnapshotUpdating:t,setError:W,setFxRate:ve,setPathname:be,setPricing:ge,snapshotUpdating:e});let ln=We(be),un=(0,h.useCallback)(async()=>{X.current?.abort();let e=new AbortController;X.current=e;let t=++Tt.current,n=R(F);Y.current+=1,B(`costs`),W(null),H(null);try{let i=await r.costMonitor(P,n,`summary`,e.signal),a=R(L.current);if(!E({aborted:e.signal.aborted,currentCurrency:se.current,currentPeriod:a,currentRequestVersion:Tt.current,requestVersion:t,requestedCurrency:P,requestedPeriod:n}))return;re(i),Z.current=!0,ae(null)}catch(n){if(e.signal.aborted||t!==Tt.current)return;W(n instanceof Error?n.message:String(n)),H(`costs`)}finally{Y.current=Math.max(0,Y.current-1),Y.current===0&&B(e=>e===`costs`?null:e),X.current===e&&(X.current=null)}},[r,P,F,se]);(0,h.useEffect)(()=>{P!==`USD`||M?.currency===P||un()},[M?.currency,P,un]),(0,h.useEffect)(()=>{d===null||V===`costs`||X.current!==null||T({costsLoaded:Z.current,currency:P,snapshotCurrency:M?.currency})&&un()},[M?.currency,P,V,un,d]);let dn=Ze({setDashboardView:l,costsLoadedRef:Z,currency:P,costs:M,loadCostSummary:un,costSummaryAbortRef:X,traceTasks:_t,boardRequestVersionRef:Ht,loadMoreTraceTasks:vt,setTraceTasks:pt,setSelectedTraceTaskId:ct,openTrace:rt,setTrace:ut,setTraceLoadingTaskId:ft}),fn=Ge(M,ie,P),{fact:pn,periods:mn}=Ke(M,ie,P),hn=()=>Ye(V,st,d,un,rt,Xt,$,W),gn=Xe(r,N,_e,ln,ye,he,$,ve,ge);return{loadMoreBoard:nn,overviewStatusPageKey:Ee,overviewClassificationPageKey:De,boardRequestVersionRef:Ht,boardAbortControllersRef:It,boardInFlightRef:Ft,boardInitialPageRef:zt,boardLoadedRef:jt,setBoardTotals:b,setBoardKindTotals:S,setBoardStates:w,setOverviewStatusPages:ee,setOverviewClassificationPages:ne,setOperationsLoading:Se,operations:d,error:Ne,globalLoadingPending:P===`USD`&&M?.currency!==P,costLocale:N,refresh:async()=>{await $()},snapshotNotice:Lt(e,d===null&&xe,N),setupRoute:gn,failedArea:V,retryLastLoad:hn,costs:M,currency:P,dashboardView:c,lastUpdatedAt:Le,loadCostDetail:i,loadCostReadModelPage:a,loadCostRunPage:o,loadCostGroupPage:s,loadingArea:ke,setDisplayedCosts:ae,setCurrency:oe,setCostSurfaceLoading:z,changeDashboardLocale:ce,loadMoreTraceTasks:vt,openTrace:rt,setRefreshDialog:U,setSelectedTraceTaskId:ct,openTraceChange:it,openTraceMacro:at,selectedTraceTaskId:st,traceMacroLoading:ot,trace:mt,traceLoadingTaskId:gt,traceTasksHasMore:yt,traceTasksLoading:bt,traceTasks:_t,capabilityNavigation:Ue(c,N,e=>void dn(e)),boardTotals:y,boardKindTotals:x,boardExportSource:en,detailExportSource:sn,boardStates:C,operationsPeriod:F,entityPage:p,dashboardIdentity:ze,operationsLoading:xe,factualCostFact:pn,factualCostPeriods:mn,setOperationsSurfaceLoading:Te,operationsSurfaceLoading:we,currentCostByRun:fn,loadOperationsEntityPage:Zt,loadOperationsLifecyclePage:Qt,loadOperationsDetails:Xt,entityPageKind:g,loadFilteredOperationsPage:$t,loadFilteredBoard:tn,loadWorkListPage:qt,loadWorkListFilters:Kt,workListFiltersRef:Gt,boardFiltersRef:Bt,workListPage:Wt,overviewStatusPages:j,loadOverviewStatusPage:an,overviewClassificationPages:te,loadOverviewClassificationPage:rn,openDocument:nt,api:r,setError:W,operationsPeriodRef:L,setOperationsPeriod:le,operationsDetailLoadedRef:K,operationsDetailCancelRef:Dt,operationsDetailAbortRef:Q,operationsPageAbortRef:kt,resetWorkListPage:Jt,operationsPageRequestVersionRef:At,resetBoard:on,refreshVersion:q,costSummaryAbortRef:X,costSummaryRequestVersion:Tt,setEntityPage:m,costsLoadedRef:Z,setCosts:re,setPeriodTransitionPending:Oe,periodTransitionVersionRef:J,setLoadingArea:B,navigate:ln,setHelpOpen:me,closeDocument:et,documentDetail:tt,helpOpen:pe,reconciliationResult:G,setReconciliationResult:Fe,refreshDialog:Me,setTrace:ut,traceLink:ht,setTraceLoadingTaskId:ft,setTraceLink:dt,refreshFromDialog:cn,renderedOperations:d}}var zt=class extends Error{};async function Bt(e){let t=await fetch(`/api/v2/health`,{cache:`no-store`,signal:e});if(t.status>=500)throw new zt(`Dashboard temporariamente indisponível`);if(!t.ok)throw Error(`Identidade do Dashboard indisponível`);let n=await t.json();if(n?.kind!==`zaip-dashboard-sqlite-runtime`||typeof n.workspace!=`string`||typeof n.workspace_name!=`string`||![`initialized`,`missing`,`invalid`].includes(n.lifecycle_manifest_state))throw Error(`Identidade do Dashboard indisponível`);return n}function Vt(){let[e,t]=(0,h.useState)(null),[n,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{let e=!1,n,i=[4e3,8e3,16e3],a;async function o(s){n=new AbortController;let c=setTimeout(()=>n.abort(),i[s]);try{let i=await Bt(n.signal);e||(t(i),r(!1))}catch(t){if(e)return;(n.signal.aborted||t instanceof TypeError||t instanceof zt)&&s+1<i.length?a=setTimeout(()=>void o(s+1),250*(s+1)):r(!0)}finally{clearTimeout(c)}}return o(0),()=>{e=!0,clearTimeout(a),n?.abort()}},[]),{status:e,unavailable:n}}function Ht({status:e,unavailable:t=!1}){let n=e?.lifecycle_manifest_state;return n!==`missing`&&n!==`invalid`?!e?.projection_refresh_failure&&!t?null:(0,y.jsx)(v,{children:(0,y.jsxs)(`section`,{className:`app-refresh-status workspace-health-toast`,role:`alert`,"aria-atomic":`true`,"aria-label":`Saúde do Dashboard`,children:[(0,y.jsx)(`span`,{className:`workspace-health-toast__icon`,"aria-hidden":`true`,children:`!`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`strong`,{children:t?`Não foi possível consultar a saúde do Dashboard`:`O Dashboard precisa de atenção`}),(0,y.jsx)(`p`,{children:t?`A conexão com o dashboard está indisponível.`:`Não foi possível atualizar os dados do dashboard.`}),(0,y.jsx)(`p`,{children:`Atualize a página. Se o problema continuar, abra novamente o executável do dashboard.`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`Atualizar página`})]})]})}):(0,y.jsx)(`aside`,{className:`workspace-status`,"aria-label":`Saúde do Dashboard`,children:n===`missing`||n===`invalid`?(0,y.jsxs)(`div`,{className:`workspace-status__warning`,role:`alert`,children:[(0,y.jsx)(`strong`,{children:n===`missing`?`Lifecycle não inicializado`:`Manifesto do lifecycle inválido`}),(0,y.jsx)(`p`,{children:`Os dados deste workspace estão indisponíveis. Na pasta do projeto, execute:`}),(0,y.jsx)(`code`,{children:`node .agents/runtime/bin/zaip.mjs manifest rebuild --confirm-full-scan`})]}):null})}function Ut(){let e=Rt(),t=Vt();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ht,{...t}),t.status?.lifecycle_manifest_state===`initialized`?(0,y.jsx)(Te,{model:e}):null]})}var Wt=document.getElementById(`root`);if(!Wt)throw Error(`Elemento #root não encontrado`);(0,g.createRoot)(Wt).render((0,y.jsx)(h.StrictMode,{children:(0,y.jsx)(Ut,{})}));export{X as n,Vt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.trace-navigation-progress span{background:#64748b4d;border-radius:999px;width:18px;height:3px}.trace-navigation-progress span[data-passed=true]{background:#38bdf85c}.trace-navigation-progress span[data-active=true]{background:#7dd3fc;width:28px}.trace-panel .trace-all-stages-button{color:#7c8ca3;background:0 0;border:0;align-items:center;gap:7px;min-height:32px;padding:5px 9px;font-size:.7rem;display:inline-flex}.trace-panel .trace-all-stages-button:hover{color:#7dd3fc;background:#38bdf814}.trace-navigation-action:disabled{cursor:not-allowed;opacity:.34}.trace-document{z-index:210;width:min(900px,100% - 2rem);position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.trace-document pre{border:1px solid var(--line);color:#d2deee;white-space:pre-wrap;background:#08111feb;border-radius:16px;max-height:72vh;padding:1rem;line-height:1.65;overflow:auto}@media (width<=1180px){.trace-stage-menu,.trace-loading-stages{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width<=860px){.trace-backdrop{padding:14px}.trace-panel{padding:22px}.trace-metrics,.trace-overview,.trace-loading-metrics,.trace-task-summary,.trace-stage-menu{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=560px){.trace-heading-icon{display:none}.trace-metrics,.trace-overview,.trace-stage-menu,.trace-stage-metrics,.trace-stage-navigation{grid-template-columns:1fr}.trace-panel .trace-navigation-action{width:100%;max-width:none}.trace-navigation-center{grid-row:1}.trace-navigation-next{justify-self:stretch}.trace-loading-identifiers,.trace-loading-metrics,.trace-loading-stages,.trace-task-summary{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){.trace-loading-icon svg,.trace-loading-status svg,.trace-loading-identifiers span:after,.trace-loading-metrics span:after,.trace-loading-stages span:after{animation:none}}.trace-embedded{width:100%}.trace-embedded .trace-panel{width:100%;max-height:none;box-shadow:none}.trace-usage-strip{background:#09101d75;border:1px solid #94a3b81f;border-radius:11px;grid-template-columns:repeat(3,minmax(0,1fr));width:min(420px,100%);margin:10px 0 0 auto;display:grid;overflow:hidden}.trace-panel-header .trace-heading{flex:auto;min-width:0}.trace-header-actions{flex:none;align-items:center;gap:12px;min-width:290px;margin-left:auto;display:flex}.trace-header-actions>.trace-usage-strip{width:290px;min-width:290px;max-width:290px;flex:0 0 290px;inline-size:290px;min-inline-size:290px;max-inline-size:290px;margin:0}.trace-usage-strip>div{min-width:0;padding:8px 13px 9px}.trace-usage-strip>div+div{border-left:1px solid #94a3b81a}.trace-usage-strip dt{color:#64748b;letter-spacing:.08em;text-transform:uppercase;align-items:center;gap:6px;font-size:.56rem;font-weight:700;display:flex}.trace-usage-strip dd{color:#dce8f7;text-overflow:ellipsis;white-space:nowrap;margin:4px 0 0;font-size:.78rem;font-weight:750;overflow:hidden}.trace-usage-coverage{background:#f59e0b;border-radius:999px;flex:none;width:5px;height:5px;box-shadow:0 0 0 3px #f59e0b14}.trace-usage-coverage[data-complete=true]{background:#38bdf8;box-shadow:0 0 0 3px #38bdf814}.trace-usage-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (width<=560px){.trace-usage-strip{width:100%}.trace-usage-strip>div{padding-inline:10px}}@media (width<=900px){.trace-panel-header{flex-wrap:wrap}.trace-header-actions{justify-content:flex-end;width:100%;margin-left:0}.trace-header-actions>.trace-usage-strip{flex:420px;width:min(420px,100%)}}.trace-backdrop{z-index:100;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#020612d1;place-items:center;padding:28px;display:grid;position:fixed;inset:0}.trace-panel,.trace-document{background:radial-gradient(circle at 8% 0,#38bdf814,#0000 28%),linear-gradient(#0a0e18fc,#080d18fc);border:1px solid #94a3b82e;border-radius:24px;width:min(1500px,100%);max-height:94vh;padding:30px;overflow:auto;box-shadow:0 36px 120px #0000008f}.trace-panel-header,.trace-document>header{justify-content:space-between;align-items:flex-start;gap:24px;display:flex}.trace-heading{align-items:center;gap:14px;display:flex}.trace-heading-icon{color:#7dd3fc;background:#0ea5e91a;border:1px solid #38bdf838;border-radius:14px;flex:none;place-items:center;width:46px;height:46px;display:grid}.trace-panel header h2,.trace-document header h2{color:#f8fafc;letter-spacing:-.03em;margin:4px 0 0;font-size:clamp(1.35rem,2vw,1.75rem)}.trace-heading p,.trace-panel small,.trace-document small{color:var(--muted);overflow-wrap:anywhere}.trace-heading p{margin:6px 0 0;font-size:.82rem}.trace-heading-title{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.trace-title-prefix{color:#7dd3fc;font-weight:650}.trace-mode-badge,.trace-risk-badge{color:#7dd3fc;letter-spacing:.03em;background:#0ea5e91c;border:1px solid #38bdf847;border-radius:999px;align-items:center;gap:6px;padding:5px 9px;font-size:.66rem;font-weight:750;display:inline-flex}.trace-risk-badge[data-risk=lite]{color:#93c5fd;background:#3b82f61c;border-color:#60a5fa47}.trace-risk-badge[data-risk=standard]{color:#fde68a;background:#f59e0b1f;border-color:#fbbf244d}.trace-risk-badge[data-risk=critical]{color:#fca5a5;background:#ef44441f;border-color:#f8717152}.trace-panel button,.trace-document button{min-height:40px;color:var(--text);cursor:pointer;background:#0f172aad;border:1px solid #94a3b829;border-radius:12px;padding:.65rem .85rem}.trace-panel .trace-close-button,.trace-document .trace-close-button{color:#94a3b8;background:#0f172ad1;border-radius:50%;flex:none;place-items:center;width:42px;height:42px;min-height:42px;padding:0;transition:all .16s;display:grid}.trace-panel .trace-close-button:hover,.trace-document .trace-close-button:hover{color:#f8fafc;background:#1e293bf2;border-color:#7dd3fc73;transform:rotate(3deg)}.trace-panel button:focus-visible,.trace-document button:focus-visible{outline-offset:3px;outline:2px solid #38bdf8}.trace-task-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:18px;display:grid}.trace-task-summary article{color:#7dd3fc;background:#09101d8f;border:1px solid #94a3b81f;border-radius:12px;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;min-height:58px;padding:10px 12px;display:grid}.trace-task-summary-content{gap:4px;min-width:0;display:grid}.trace-task-summary span{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.58rem;font-weight:700}.trace-task-summary strong{color:#cbd5e1;text-overflow:ellipsis;white-space:nowrap;font-size:.72rem;overflow:hidden}.trace-task-progress-content{grid-template-columns:1fr auto}.trace-task-progress progress{accent-color:#60a5fa;border:0;border-radius:999px;grid-column:1/-1;width:100%;height:5px;overflow:hidden}.trace-task-progress progress::-webkit-progress-bar{background:#64748b3d;border-radius:999px}.trace-task-progress progress::-webkit-progress-value{background:linear-gradient(90deg,#38bdf8,#60a5fa);border-radius:999px}.trace-task-badges{align-items:center;gap:5px;min-width:0;display:flex}.trace-task-classification .trace-mode-badge,.trace-task-classification .trace-risk-badge{letter-spacing:.01em;text-transform:none;white-space:nowrap;gap:4px;padding:3px 6px;font-size:.56rem}.trace-task-classification .trace-task-badges .trace-mode-badge{color:#f8fafc}.trace-loading-panel{overflow:hidden}.trace-loading-icon svg,.trace-loading-status svg{animation:.9s linear infinite trace-spin}.trace-loading-status{color:#7dd3fc;background:#0ea5e914;border:1px solid #38bdf82e;border-radius:999px;align-items:center;gap:7px;padding:7px 10px;font-size:.68rem;font-weight:700;display:inline-flex}.trace-loading-identifiers,.trace-loading-metrics,.trace-loading-stages{gap:12px;margin-top:20px;display:grid}.trace-loading-identifiers{grid-template-columns:repeat(2,minmax(0,1fr))}.trace-loading-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}.trace-loading-stages{grid-template-columns:repeat(6,minmax(0,1fr))}.trace-loading-identifiers span,.trace-loading-metrics span,.trace-loading-stages span{background:#0f172a94;border:1px solid #94a3b81a;border-radius:14px;position:relative;overflow:hidden}.trace-loading-identifiers span{height:56px}.trace-loading-metrics span{height:116px}.trace-loading-stages span{height:218px}.trace-loading-identifiers span:after,.trace-loading-metrics span:after,.trace-loading-stages span:after{content:"";background:linear-gradient(100deg,#0000 25%,#7dd3fc14 50%,#0000 75%);animation:1.4s ease-in-out infinite trace-shimmer;position:absolute;inset:0;transform:translate(-100%)}@keyframes trace-spin{to{transform:rotate(360deg)}}@keyframes trace-shimmer{to{transform:translate(100%)}}.trace-overview{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:18px;display:grid}.trace-overview article{background:linear-gradient(145deg,#0f172abd,#09101dad);border:1px solid #94a3b824;border-radius:12px;min-width:0;min-height:52px;padding:0;position:relative;overflow:hidden}.trace-overview article:before{content:"";opacity:.72;background:#38bdf8;width:2px;position:absolute;inset:0 auto 0 0}.trace-overview article[data-empty=true]{background:#09101d6b}.trace-overview article[data-empty=true]:before{opacity:.55;background:#475569}.trace-panel .trace-identifier-navigation,.trace-identifier-static{width:100%;min-height:50px;color:inherit;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:7px 10px 7px 11px;display:grid}.trace-panel .trace-identifier-navigation{cursor:pointer;transition:background .15s,color .15s}.trace-panel .trace-identifier-navigation>svg{color:#64748b;transition:all .15s}.trace-panel .trace-identifier-navigation:hover,.trace-panel .trace-identifier-navigation:focus-visible{background:#0ea5e917}.trace-panel .trace-identifier-navigation:hover>svg,.trace-panel .trace-identifier-navigation:focus-visible>svg{color:#7dd3fc;transform:translate(2px)}.trace-identifier-content{gap:3px;min-width:0;display:grid}.trace-identifier-content>span{color:#64748b;letter-spacing:.1em;text-transform:uppercase;align-items:center;gap:5px;font-size:.58rem;font-weight:700;display:inline-flex}.trace-identifier-content>strong{color:#cbd5e1;text-overflow:ellipsis;-webkit-user-select:all;user-select:all;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.68rem;line-height:1.35;overflow:hidden}.trace-identifier-copy{box-sizing:border-box;color:#bfdbfe;cursor:pointer;background:#090e19d1;border:1px solid #60a5fa61;border-radius:8px;place-self:center;place-items:center;width:30px;height:30px;margin:0 2px 0 0;padding:0;display:grid}.trace-identifier-copy:hover,.trace-identifier-copy:focus-visible{background:#1e3a5fe6;border-color:#60a5fa}.trace-overview article[data-empty=true] .trace-identifier-content>strong{color:#64748b;font-family:inherit;font-weight:500}.trace-metrics{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px;display:grid}.trace-metrics article{background:#09101d8f;border:1px solid #94a3b824;border-radius:17px;grid-template-columns:auto 1fr;align-items:start;gap:4px 12px;min-height:116px;padding:18px;display:grid;position:relative;overflow:hidden}.trace-metrics article:after{content:"";background:#38bdf80a;border-radius:50%;width:110px;height:110px;position:absolute;bottom:-42px;right:-28px}.trace-metric-icon{color:#7dd3fc;background:#38bdf81a;border-radius:10px;place-items:center;width:34px;height:34px;display:grid}.trace-metrics div{gap:5px;display:grid}.trace-metrics strong{color:#f8fafc;letter-spacing:-.05em;font-size:2rem;line-height:.9}.trace-metrics div span{color:#94a3b8;letter-spacing:.06em;text-transform:uppercase;font-size:.7rem;font-weight:700}.trace-metrics small{color:#64748b;grid-column:2;font-size:.68rem}.trace-stage-menu{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-top:22px;display:grid}.trace-panel .trace-stage-menu-button{--trace-stage-accent:#7dd3fc;--trace-stage-border:#60a5fa3d;--trace-stage-glow:#0284c71f;--trace-stage-surface:linear-gradient(155deg, #121e33f2, #0a111fe6);--trace-stage-surface-hover:linear-gradient(155deg, #142741fa, #0b1728f5);border-color:var(--trace-stage-border);background:var(--trace-stage-surface);text-align:left;flex-direction:column;align-items:flex-start;min-height:218px;padding:18px;transition:border-color .16s,background .16s,transform .16s;display:flex;position:relative;overflow:hidden;box-shadow:inset 0 1px #ffffff06,0 8px 22px #02061729}.trace-panel .trace-stage-menu-button:hover{border-color:var(--trace-stage-accent);background:var(--trace-stage-surface-hover);box-shadow:inset 0 1px 0 #ffffff0b, 0 14px 34px var(--trace-stage-glow);transform:translateY(-3px)}.trace-panel .trace-stage-menu-button:active{transform:translateY(-1px)}.trace-stage-menu-button:before{background:var(--trace-stage-accent);content:"";opacity:1;width:2px;position:absolute;inset:0 auto 0 0}.trace-stage-number{color:var(--trace-stage-accent);letter-spacing:-.04em;font-size:1.5rem;font-weight:750;line-height:1}.trace-stage-icon{color:var(--trace-stage-accent);opacity:.48;position:absolute;top:17px;right:17px}.trace-stage-menu-button strong{color:#e2e8f0;min-height:42px;margin-top:20px;font-size:.86rem;line-height:1.35}.trace-stage-menu-button em{color:#7c8ca3;margin-top:10px;font-size:.69rem;font-style:normal;line-height:1.5}.trace-stage-action{border-top:1px solid #94a3b81a;justify-content:space-between;align-items:center;width:100%;margin-top:auto;padding-top:14px;display:flex}.trace-stage-menu-button .trace-stage-action small,.trace-stage-action>span{color:var(--trace-stage-accent);align-items:center;gap:5px;padding:0;display:inline-flex}.trace-stage-menu-button[data-stage=definition]{--trace-stage-accent:#c4b5fd;--trace-stage-border:#a78bfa85;--trace-stage-glow:#7c3aed24;--trace-stage-surface:linear-gradient(155deg, #46376f80, #1e1934d1);--trace-stage-surface-hover:linear-gradient(155deg, #503e7f94, #231c3de6)}.trace-stage-menu-button[data-stage=planning]{--trace-stage-accent:#6f91d8;--trace-stage-border:#3758a4ad;--trace-stage-glow:#1e3a8a33;--trace-stage-surface:linear-gradient(155deg, #14274ec7, #09142beb);--trace-stage-surface-hover:linear-gradient(155deg, #1a3160d6, #0b1935f5)}.trace-stage-menu-button[data-stage=execution]{--trace-stage-accent:#fde68a;--trace-stage-border:#fbbf2485;--trace-stage-glow:#b4530929;--trace-stage-surface:linear-gradient(155deg, #5c400d7a, #2a1f0ccc);--trace-stage-surface-hover:linear-gradient(155deg, #6949108f, #31240de0)}.trace-stage-menu-button[data-stage=decisions]{--trace-stage-accent:#fdba74;--trace-stage-border:#f973168a;--trace-stage-glow:#c2410c2b;--trace-stage-surface:linear-gradient(155deg, #68300d80, #311b0cd6);--trace-stage-surface-hover:linear-gradient(155deg, #78370f94, #3a1f0deb)}.trace-stage-menu-button[data-stage=verification]{--trace-stage-accent:#fca5a5;--trace-stage-border:#f8717185;--trace-stage-glow:#b91c1c29;--trace-stage-surface:linear-gradient(155deg, #5b263080, #30181fd1);--trace-stage-surface-hover:linear-gradient(155deg, #692b3794, #391b24e6)}.trace-stage-menu-button[data-stage=evidence]{--trace-stage-accent:#86efac;--trace-stage-border:#34d39980;--trace-stage-glow:#05966929;--trace-stage-surface:linear-gradient(155deg, #164f3d80, #0f2b24d1);--trace-stage-surface-hover:linear-gradient(155deg, #195b4694, #11332ae6)}.trace-stage-action>span{opacity:.82;font-size:.64rem;font-weight:700;transition:opacity .16s}.trace-stage-menu-button:hover .trace-stage-action>span{opacity:1}.trace-stage-detail{margin-top:22px}.trace-stage-detail>header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.trace-stage-detail h3{color:var(--muted);margin:5px 0 0;font-size:1rem;font-weight:500}.trace-stage-detail header p{color:var(--accent);margin:0;font-weight:800}.trace-stage-metrics{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0;display:grid}.trace-stage-metrics article{background:#0f2035b8;border:1px solid #94a3b829;border-radius:16px;gap:8px;min-height:112px;padding:18px;display:grid}.trace-stage-metrics span{color:var(--muted);text-transform:uppercase;font-size:.72rem}.trace-stage-metrics strong{color:var(--accent);align-self:end;font-size:2.25rem;line-height:1}.trace-stage-documents{gap:9px;display:grid}.trace-stage-documents small{color:var(--muted);overflow-wrap:anywhere}.trace-document-group{background:#08111f94;border:1px solid #94a3b826;border-radius:14px;gap:8px;padding:12px;display:grid}.trace-document-group h4{color:var(--accent);letter-spacing:.06em;text-transform:uppercase;margin:0;font-size:.78rem}.trace-document-group h4 small{color:var(--muted);font-weight:400}.trace-document-group button{text-align:left;gap:5px;width:100%;display:grid}.trace-stage-empty{color:var(--muted)}.trace-stage-navigation{border-top:1px solid #94a3b81f;grid-template-columns:minmax(180px,1fr) auto minmax(180px,1fr);align-items:center;gap:18px;margin-top:24px;padding-top:18px;display:grid}.trace-panel .trace-navigation-action{color:#94a3b8;text-align:left;background:#0f172a9e;border-color:#94a3b829;align-items:center;gap:12px;width:min(100%,260px);min-height:58px;padding:10px 14px;transition:all .16s;display:flex}.trace-panel .trace-navigation-action:hover:not(:disabled){color:#7dd3fc;background:#0ea5e914;border-color:#38bdf857;transform:translateY(-1px)}.trace-navigation-action>span{gap:3px;min-width:0;display:grid}.trace-navigation-action small{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.61rem;font-weight:700}.trace-navigation-action strong{color:#dbeafe;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;overflow:hidden}.trace-navigation-next{text-align:right;justify-content:flex-end;justify-self:end}.trace-navigation-center{place-items:center;gap:8px;min-width:190px;display:grid}.trace-navigation-center>small{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.66rem;font-weight:700}.trace-navigation-progress{gap:6px;display:flex}.trace-stage-dialog-backdrop{z-index:180;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#020612d6;place-items:center;padding:28px;display:grid;position:fixed;inset:0}.trace-stage-dialog{z-index:1;background:#0b1120;border:1px solid #60a5fa47;border-radius:20px;width:min(1120px,100%);max-height:min(820px,100vh - 56px);padding:30px;position:relative;overflow:auto;box-shadow:0 28px 80px #0000008c}.trace-stage-dialog-backdrop-dismiss{cursor:default;background:0 0;border:0;width:100%;position:absolute;inset:0}.trace-stage-dialog-close{z-index:2;float:right;color:#aebdd1;cursor:pointer;background:#111827;border:1px solid #94a3b83d;border-radius:50%;place-items:center;width:42px;height:42px;display:grid;position:sticky;top:0}.trace-stage-dialog-close:hover{color:#eff6ff;border-color:#60a5fa80}.trace-stage-dialog button{min-height:40px;color:var(--text);cursor:pointer;background:#0f172aad;border:1px solid #94a3b829;border-radius:12px;padding:.65rem .85rem}.trace-stage-dialog .trace-stage-dialog-close{background:#111827;border-radius:50%;width:42px;height:42px;min-height:42px;padding:0}.trace-stage-dialog .trace-document-group button{text-align:left;background:#0f1d31c7;gap:5px;width:100%;display:grid}.trace-stage-dialog .trace-document-group button:hover{background:#0ea5e917;border-color:#38bdf85c}.trace-stage-dialog .trace-navigation-action{color:#94a3b8;text-align:left;background:#0f172a9e;border-color:#94a3b829;align-items:center;gap:12px;width:min(100%,260px);min-height:58px;padding:10px 14px;display:flex}.trace-stage-dialog .trace-navigation-action:hover:not(:disabled){color:#7dd3fc;background:#0ea5e914;border-color:#38bdf857}.trace-stage-dialog .trace-all-stages-button{color:#7c8ca3;background:0 0;border:0;align-items:center;gap:7px;min-height:32px;padding:5px 9px;font-size:.7rem;display:inline-flex}@media (width<=720px){.trace-stage-dialog-backdrop{padding:12px}.trace-stage-dialog{max-height:calc(100vh - 24px);padding:20px}}
|
|
1
|
+
.trace-navigation-progress span{background:#64748b4d;border-radius:999px;width:18px;height:3px}.trace-navigation-progress span[data-passed=true]{background:#38bdf85c}.trace-navigation-progress span[data-active=true]{background:#7dd3fc;width:28px}.trace-panel .trace-all-stages-button{color:#7c8ca3;background:0 0;border:0;align-items:center;gap:7px;min-height:32px;padding:5px 9px;font-size:.7rem;display:inline-flex}.trace-panel .trace-all-stages-button:hover{color:#7dd3fc;background:#38bdf814}.trace-navigation-action:disabled{cursor:not-allowed;opacity:.34}.trace-document{z-index:210;width:min(900px,100% - 2rem);position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.trace-document pre{border:1px solid var(--line);color:#d2deee;white-space:pre-wrap;background:#08111feb;border-radius:16px;max-height:72vh;padding:1rem;line-height:1.65;overflow:auto}@media (width<=1180px){.trace-stage-menu,.trace-loading-stages{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width<=860px){.trace-backdrop{padding:14px}.trace-panel{padding:22px}.trace-metrics,.trace-overview,.trace-loading-metrics,.trace-task-summary,.trace-stage-menu{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=560px){.trace-heading-icon{display:none}.trace-metrics,.trace-overview,.trace-stage-menu,.trace-stage-metrics,.trace-stage-navigation{grid-template-columns:1fr}.trace-panel .trace-navigation-action{width:100%;max-width:none}.trace-navigation-center{grid-row:1}.trace-navigation-next{justify-self:stretch}.trace-loading-identifiers,.trace-loading-metrics,.trace-loading-stages,.trace-task-summary{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){.trace-loading-icon svg,.trace-loading-status svg,.trace-loading-identifiers span:after,.trace-loading-metrics span:after,.trace-loading-stages span:after{animation:none}}.trace-embedded{width:100%}.trace-embedded .trace-panel{width:100%;max-height:none;box-shadow:none}.trace-usage-strip{background:#09101d75;border:1px solid #94a3b81f;border-radius:11px;grid-template-columns:repeat(3,minmax(0,1fr));width:min(420px,100%);margin:10px 0 0 auto;display:grid;overflow:hidden}.trace-panel-header .trace-heading{flex:auto;min-width:0}.trace-header-actions{flex:none;align-items:center;gap:12px;min-width:290px;margin-left:auto;display:flex}.trace-header-actions>.trace-usage-strip{width:290px;min-width:290px;max-width:290px;flex:0 0 290px;inline-size:290px;min-inline-size:290px;max-inline-size:290px;margin:0}.trace-usage-strip>div{min-width:0;padding:8px 13px 9px}.trace-usage-strip>div+div{border-left:1px solid #94a3b81a}.trace-usage-strip dt{color:#64748b;letter-spacing:.08em;text-transform:uppercase;align-items:center;gap:6px;font-size:.56rem;font-weight:700;display:flex}.trace-usage-strip dd{color:#dce8f7;text-overflow:ellipsis;white-space:nowrap;margin:4px 0 0;font-size:.78rem;font-weight:750;overflow:hidden}.trace-usage-coverage{background:#f59e0b;border-radius:999px;flex:none;width:5px;height:5px;box-shadow:0 0 0 3px #f59e0b14}.trace-usage-coverage[data-complete=true]{background:#38bdf8;box-shadow:0 0 0 3px #38bdf814}.trace-usage-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (width<=560px){.trace-usage-strip{width:100%}.trace-usage-strip>div{padding-inline:10px}}@media (width<=900px){.trace-panel-header{flex-wrap:wrap}.trace-header-actions{justify-content:flex-end;width:100%;margin-left:0}.trace-header-actions>.trace-usage-strip{flex:420px;width:min(420px,100%)}}.trace-backdrop{z-index:100;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#020612d1;place-items:center;padding:28px;display:grid;position:fixed;inset:0}.trace-panel,.trace-document{background:radial-gradient(circle at 8% 0,#38bdf814,#0000 28%),linear-gradient(#0a0e18fc,#080d18fc);border:1px solid #94a3b82e;border-radius:24px;width:min(1500px,100%);max-height:94vh;padding:30px;overflow:auto;box-shadow:0 36px 120px #0000008f}.trace-panel-header,.trace-document>header{justify-content:space-between;align-items:flex-start;gap:24px;display:flex}.trace-heading{align-items:center;gap:14px;display:flex}.trace-heading-icon{color:#7dd3fc;background:#0ea5e91a;border:1px solid #38bdf838;border-radius:14px;flex:none;place-items:center;width:46px;height:46px;display:grid}.trace-panel header h2,.trace-document header h2{color:#f8fafc;letter-spacing:-.03em;margin:4px 0 0;font-size:clamp(1.35rem,2vw,1.75rem)}.trace-heading p,.trace-panel small,.trace-document small{color:var(--muted);overflow-wrap:anywhere}.trace-heading p{margin:6px 0 0;font-size:.82rem}.trace-heading-title{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.trace-title-prefix{color:#7dd3fc;font-weight:650}.trace-mode-badge,.trace-risk-badge{color:#7dd3fc;letter-spacing:.03em;background:#0ea5e91c;border:1px solid #38bdf847;border-radius:999px;align-items:center;gap:6px;padding:5px 9px;font-size:.66rem;font-weight:750;display:inline-flex}.trace-risk-badge[data-risk=lite]{color:#93c5fd;background:#3b82f61c;border-color:#60a5fa47}.trace-risk-badge[data-risk=standard]{color:#fde68a;background:#f59e0b1f;border-color:#fbbf244d}.trace-risk-badge[data-risk=critical]{color:#fca5a5;background:#ef44441f;border-color:#f8717152}.trace-panel button,.trace-document button{min-height:40px;color:var(--text);cursor:pointer;background:#0f172aad;border:1px solid #94a3b829;border-radius:12px;padding:.65rem .85rem}.trace-panel .trace-close-button,.trace-document .trace-close-button{color:#94a3b8;background:#0f172ad1;border-radius:50%;flex:none;place-items:center;width:42px;height:42px;min-height:42px;padding:0;transition:all .16s;display:grid}.trace-panel .trace-close-button:hover,.trace-document .trace-close-button:hover{color:#f8fafc;background:#1e293bf2;border-color:#7dd3fc73;transform:rotate(3deg)}.trace-panel button:focus-visible,.trace-document button:focus-visible{outline-offset:3px;outline:2px solid #38bdf8}.trace-task-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:18px;display:grid}.trace-task-summary article{color:#7dd3fc;background:#09101d8f;border:1px solid #94a3b81f;border-radius:12px;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;min-height:58px;padding:10px 12px;display:grid}.trace-task-summary-content{gap:4px;min-width:0;display:grid}.trace-task-summary span{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.58rem;font-weight:700}.trace-task-summary strong{color:#cbd5e1;text-overflow:ellipsis;white-space:nowrap;font-size:.72rem;overflow:hidden}.trace-task-progress-content{grid-template-columns:1fr auto}.trace-task-progress progress{accent-color:#60a5fa;border:0;border-radius:999px;grid-column:1/-1;width:100%;height:5px;overflow:hidden}.trace-task-progress progress::-webkit-progress-bar{background:#64748b3d;border-radius:999px}.trace-task-progress progress::-webkit-progress-value{background:linear-gradient(90deg,#38bdf8,#60a5fa);border-radius:999px}.trace-task-badges{align-items:center;gap:5px;min-width:0;display:flex}.trace-task-classification .trace-mode-badge,.trace-task-classification .trace-risk-badge{letter-spacing:.01em;text-transform:none;white-space:nowrap;gap:4px;padding:3px 6px;font-size:.56rem}.trace-task-classification .trace-task-badges .trace-mode-badge{color:#f8fafc}.trace-loading-panel{overflow:hidden}.trace-loading-icon svg,.trace-loading-status svg{animation:.9s linear infinite trace-spin}.trace-loading-status{color:#7dd3fc;background:#0ea5e914;border:1px solid #38bdf82e;border-radius:999px;align-items:center;gap:7px;padding:7px 10px;font-size:.68rem;font-weight:700;display:inline-flex}.trace-loading-identifiers,.trace-loading-metrics,.trace-loading-stages{gap:12px;margin-top:20px;display:grid}.trace-loading-identifiers{grid-template-columns:repeat(2,minmax(0,1fr))}.trace-loading-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}.trace-loading-stages{grid-template-columns:repeat(6,minmax(0,1fr))}.trace-loading-identifiers span,.trace-loading-metrics span,.trace-loading-stages span{background:#0f172a94;border:1px solid #94a3b81a;border-radius:14px;position:relative;overflow:hidden}.trace-loading-identifiers span{height:56px}.trace-loading-metrics span{height:116px}.trace-loading-stages span{height:218px}.trace-loading-identifiers span:after,.trace-loading-metrics span:after,.trace-loading-stages span:after{content:"";background:linear-gradient(100deg,#0000 25%,#7dd3fc14 50%,#0000 75%);animation:1.4s ease-in-out infinite trace-shimmer;position:absolute;inset:0;transform:translate(-100%)}@keyframes trace-spin{to{transform:rotate(360deg)}}@keyframes trace-shimmer{to{transform:translate(100%)}}.trace-overview{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:18px;display:grid}.trace-overview article{background:linear-gradient(145deg,#0f172abd,#09101dad);border:1px solid #94a3b824;border-radius:12px;min-width:0;min-height:52px;padding:0;position:relative;overflow:hidden}.trace-overview article:before{content:"";opacity:.72;background:#38bdf8;width:2px;position:absolute;inset:0 auto 0 0}.trace-overview article[data-empty=true]{background:#09101d6b}.trace-overview article[data-empty=true]:before{opacity:.55;background:#475569}.trace-panel .trace-identifier-navigation,.trace-identifier-static{width:100%;min-height:50px;color:inherit;text-align:left;background:0 0;border:0;border-radius:11px;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:7px 10px 7px 11px;display:grid}.trace-panel .trace-identifier-navigation{cursor:pointer;transition:background .15s,color .15s}.trace-panel .trace-identifier-navigation>svg{color:#64748b;transition:all .15s}.trace-panel .trace-identifier-navigation:hover,.trace-panel .trace-identifier-navigation:focus-visible{background:#0ea5e917}.trace-panel .trace-identifier-navigation:hover>svg,.trace-panel .trace-identifier-navigation:focus-visible>svg{color:#7dd3fc;transform:translate(2px)}.trace-identifier-content{gap:3px;min-width:0;display:grid}.trace-identifier-content>span{color:#64748b;letter-spacing:.1em;text-transform:uppercase;align-items:center;gap:5px;font-size:.58rem;font-weight:700;display:inline-flex}.trace-identifier-content>strong{color:#cbd5e1;text-overflow:ellipsis;-webkit-user-select:all;user-select:all;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.68rem;line-height:1.35;overflow:hidden}.trace-identifier-copy{box-sizing:border-box;color:#bfdbfe;cursor:pointer;background:#090e19d1;border:1px solid #60a5fa61;border-radius:8px;place-self:center;place-items:center;width:30px;height:30px;margin:0 2px 0 0;padding:0;display:grid}.trace-identifier-copy:hover,.trace-identifier-copy:focus-visible{background:#1e3a5fe6;border-color:#60a5fa}.trace-overview article[data-empty=true] .trace-identifier-content>strong{color:#64748b;font-family:inherit;font-weight:500}.trace-metrics{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:16px;display:grid}.trace-metrics article{background:#09101d8f;border:1px solid #94a3b824;border-radius:17px;grid-template-columns:auto 1fr;align-items:start;gap:4px 12px;min-height:116px;padding:18px;display:grid;position:relative;overflow:hidden}.trace-metrics article:after{content:"";background:#38bdf80a;border-radius:50%;width:110px;height:110px;position:absolute;bottom:-42px;right:-28px}.trace-metric-icon{color:#7dd3fc;background:#38bdf81a;border-radius:10px;place-items:center;width:34px;height:34px;display:grid}.trace-metrics div{gap:5px;display:grid}.trace-metrics strong{color:#f8fafc;letter-spacing:-.05em;font-size:2rem;line-height:.9}.trace-metrics div span{color:#94a3b8;letter-spacing:.06em;text-transform:uppercase;font-size:.7rem;font-weight:700}.trace-metrics small{color:#64748b;grid-column:2;font-size:.68rem}.trace-stage-menu{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-top:22px;display:grid}.trace-panel .trace-stage-menu-button{--trace-stage-accent:#7dd3fc;--trace-stage-border:#60a5fa3d;--trace-stage-glow:#0284c71f;--trace-stage-surface:linear-gradient(155deg, #121e33f2, #0a111fe6);--trace-stage-surface-hover:linear-gradient(155deg, #142741fa, #0b1728f5);border-color:var(--trace-stage-border);background:var(--trace-stage-surface);text-align:left;flex-direction:column;align-items:flex-start;min-height:218px;padding:18px;transition:border-color .16s,background .16s,transform .16s;display:flex;position:relative;overflow:hidden;box-shadow:inset 0 1px #ffffff06,0 8px 22px #02061729}.trace-panel .trace-stage-menu-button:hover{border-color:var(--trace-stage-accent);background:var(--trace-stage-surface-hover);box-shadow:inset 0 1px 0 #ffffff0b, 0 14px 34px var(--trace-stage-glow);transform:translateY(-3px)}.trace-panel .trace-stage-menu-button:active{transform:translateY(-1px)}.trace-stage-menu-button:before{background:var(--trace-stage-accent);content:"";opacity:1;width:2px;position:absolute;inset:0 auto 0 0}.trace-stage-number{color:var(--trace-stage-accent);letter-spacing:-.04em;font-size:1.5rem;font-weight:750;line-height:1}.trace-stage-icon{color:var(--trace-stage-accent);opacity:.48;position:absolute;top:17px;right:17px}.trace-stage-menu-button strong{color:#e2e8f0;min-height:42px;margin-top:20px;font-size:.86rem;line-height:1.35}.trace-stage-menu-button em{color:#7c8ca3;margin-top:10px;font-size:.69rem;font-style:normal;line-height:1.5}.trace-stage-action{border-top:1px solid #94a3b81a;justify-content:space-between;align-items:center;width:100%;margin-top:auto;padding-top:14px;display:flex}.trace-stage-menu-button .trace-stage-action small,.trace-stage-action>span{color:var(--trace-stage-accent);align-items:center;gap:5px;padding:0;display:inline-flex}.trace-stage-menu-button[data-stage=definition]{--trace-stage-accent:#c4b5fd;--trace-stage-border:#a78bfa85;--trace-stage-glow:#7c3aed24;--trace-stage-surface:linear-gradient(155deg, #46376f80, #1e1934d1);--trace-stage-surface-hover:linear-gradient(155deg, #503e7f94, #231c3de6)}.trace-stage-menu-button[data-stage=planning]{--trace-stage-accent:#6f91d8;--trace-stage-border:#3758a4ad;--trace-stage-glow:#1e3a8a33;--trace-stage-surface:linear-gradient(155deg, #14274ec7, #09142beb);--trace-stage-surface-hover:linear-gradient(155deg, #1a3160d6, #0b1935f5)}.trace-stage-menu-button[data-stage=execution]{--trace-stage-accent:#fde68a;--trace-stage-border:#fbbf2485;--trace-stage-glow:#b4530929;--trace-stage-surface:linear-gradient(155deg, #5c400d7a, #2a1f0ccc);--trace-stage-surface-hover:linear-gradient(155deg, #6949108f, #31240de0)}.trace-stage-menu-button[data-stage=decisions]{--trace-stage-accent:#fdba74;--trace-stage-border:#f973168a;--trace-stage-glow:#c2410c2b;--trace-stage-surface:linear-gradient(155deg, #68300d80, #311b0cd6);--trace-stage-surface-hover:linear-gradient(155deg, #78370f94, #3a1f0deb)}.trace-stage-menu-button[data-stage=verification]{--trace-stage-accent:#fca5a5;--trace-stage-border:#f8717185;--trace-stage-glow:#b91c1c29;--trace-stage-surface:linear-gradient(155deg, #5b263080, #30181fd1);--trace-stage-surface-hover:linear-gradient(155deg, #692b3794, #391b24e6)}.trace-stage-menu-button[data-stage=evidence]{--trace-stage-accent:#86efac;--trace-stage-border:#34d39980;--trace-stage-glow:#05966929;--trace-stage-surface:linear-gradient(155deg, #164f3d80, #0f2b24d1);--trace-stage-surface-hover:linear-gradient(155deg, #195b4694, #11332ae6)}.trace-stage-action>span{opacity:.82;font-size:.64rem;font-weight:700;transition:opacity .16s}.trace-stage-menu-button:hover .trace-stage-action>span{opacity:1}.trace-stage-detail{margin-top:22px}.trace-stage-detail>header{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.trace-stage-detail h3{color:var(--muted);margin:5px 0 0;font-size:1rem;font-weight:500}.trace-stage-detail header p{color:var(--accent);margin:0;font-weight:800}.trace-stage-metrics{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0;display:grid}.trace-stage-metrics article{background:#0f2035b8;border:1px solid #94a3b829;border-radius:16px;gap:8px;min-height:112px;padding:18px;display:grid}.trace-stage-metrics span{color:var(--muted);text-transform:uppercase;font-size:.72rem}.trace-stage-metrics strong{color:var(--accent);align-self:end;font-size:2.25rem;line-height:1}.trace-stage-documents{gap:9px;display:grid}.trace-stage-documents small{color:var(--muted);overflow-wrap:anywhere}.trace-document-group{background:#08111f94;border:1px solid #94a3b826;border-radius:14px;gap:8px;padding:12px;display:grid}.trace-document-group h4{color:var(--accent);letter-spacing:.06em;text-transform:uppercase;margin:0;font-size:.78rem}.trace-document-group h4 small{color:var(--muted);font-weight:400}.trace-document-group button{text-align:left;gap:5px;width:100%;display:grid}.trace-stage-empty{color:var(--muted)}.trace-stage-navigation{border-top:1px solid #94a3b81f;grid-template-columns:minmax(180px,1fr) auto minmax(180px,1fr);align-items:center;gap:18px;margin-top:24px;padding-top:18px;display:grid}.trace-panel .trace-navigation-action{color:#94a3b8;text-align:left;background:#0f172a9e;border-color:#94a3b829;align-items:center;gap:12px;width:min(100%,260px);min-height:58px;padding:10px 14px;transition:all .16s;display:flex}.trace-panel .trace-navigation-action:hover:not(:disabled){color:#7dd3fc;background:#0ea5e914;border-color:#38bdf857;transform:translateY(-1px)}.trace-navigation-action>span{gap:3px;min-width:0;display:grid}.trace-navigation-action small{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.61rem;font-weight:700}.trace-navigation-action strong{color:#dbeafe;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;overflow:hidden}.trace-navigation-next{text-align:right;justify-content:flex-end;justify-self:end}.trace-navigation-center{place-items:center;gap:8px;min-width:190px;display:grid}.trace-navigation-center>small{color:#64748b;letter-spacing:.08em;text-transform:uppercase;font-size:.66rem;font-weight:700}.trace-navigation-progress{gap:6px;display:flex}.trace-stage-dialog-backdrop{z-index:180;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#020612d6;place-items:center;padding:28px;display:grid;position:fixed;inset:0}.trace-stage-dialog{z-index:1;background:#0b1120;border:1px solid #60a5fa47;border-radius:20px;width:min(1120px,100%);max-height:min(820px,100vh - 56px);padding:30px;position:relative;overflow:auto;box-shadow:0 28px 80px #0000008c}.trace-stage-dialog-backdrop-dismiss{cursor:default;background:0 0;border:0;width:100%;position:absolute;inset:0}.trace-stage-dialog-close{z-index:2;float:right;color:#aebdd1;cursor:pointer;background:#111827;border:1px solid #94a3b83d;border-radius:50%;place-items:center;width:42px;height:42px;display:grid;position:sticky;top:0}.trace-stage-dialog-close:hover{color:#eff6ff;border-color:#60a5fa80}.trace-stage-dialog button{min-height:40px;color:var(--text);cursor:pointer;background:#0f172aad;border:1px solid #94a3b829;border-radius:12px;padding:.65rem .85rem}.trace-stage-dialog .trace-stage-dialog-close{background:#111827;border-radius:50%;width:42px;height:42px;min-height:42px;padding:0}.trace-stage-dialog .trace-document-group button{text-align:left;background:#0f1d31c7;gap:5px;width:100%;display:grid}.trace-stage-dialog .trace-document-group button:hover{background:#0ea5e917;border-color:#38bdf85c}.trace-stage-dialog .trace-navigation-action{color:#94a3b8;text-align:left;background:#0f172a9e;border-color:#94a3b829;align-items:center;gap:12px;width:min(100%,260px);min-height:58px;padding:10px 14px;display:flex}.trace-stage-dialog .trace-navigation-action:hover:not(:disabled){color:#7dd3fc;background:#0ea5e914;border-color:#38bdf857}.trace-stage-dialog .trace-all-stages-button{color:#7c8ca3;background:0 0;border:0;align-items:center;gap:7px;min-height:32px;padding:5px 9px;font-size:.7rem;display:inline-flex}@media (width<=720px){.trace-stage-dialog-backdrop{padding:12px}.trace-stage-dialog{max-height:calc(100vh - 24px);padding:20px}}.trace-release-delivery{border:1px solid var(--line);overflow-wrap:anywhere;border-radius:12px;margin-block:1.25rem;padding:1rem}.trace-release-delivery h3,.trace-release-delivery dd{margin:0}.trace-release-delivery dl{grid-template-columns:repeat(auto-fit,minmax(min(100%,9rem),1fr));gap:.75rem;display:grid}.trace-release-delivery dt{color:var(--muted)}.trace-release-delivery p{margin:.5rem 0 0}
|