decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
6 lines • 103 kB
JavaScript
import{c as ue,r as xe,d as ns,a6 as ht,b as _e,j as t,B as je,t as dt,a_ as Yt,an as as,K as bt,i as Et,a7 as As,m as ot,gK as _s,o as cs,h as Us,e3 as Ks,ad as Vs,u as qs,n as _t,E as Wt,R as Hs,dZ as Bs,hk as Js,T as Gs,W as Qs,I as Xt}from"./index-ztdGKvBm.js";import{S as Ys}from"./search-input-BQ8Dp8aD.js";import{E as Ht}from"./empty-state-I_cTbW85.js";import{R as Ws}from"./require-capability-BvMWopKN.js";import{f as js}from"./pair-DmyTA2cC.js";import{b as ts}from"./use-connection-CcG4QE1K.js";import{g as Ps}from"./connection-slug-BNBBglpK.js";import{B as Lt}from"./badge-DcUertOZ.js";import{P as ds,a as ms,b as us}from"./popover-C4oz5B-L.js";import{c as Pt,T as Dt,a as Rt,b as Xs}from"./tooltip-Bm0P1gm_.js";import{B as fs,e as Kt,bz as Zs,aw as Ns,L as el}from"./agent-icon-BYWtutu9.js";import{i as tl}from"./Key01-CaJGjh13.js";import{i as sl}from"./Play-BCFOaioW.js";import{MonacoCodeEditor as bs}from"./monaco-editor-CLzWWWtl.js";import{u as ll}from"./use-mcp-client-2MG3LveS.js";import{u as rl}from"./repository-binding-D_Xc1yRH.js";import{n as Ot}from"./LinkBroken01-DfUhihLM.js";import{c as il}from"./SwitchHorizontal01-CMdpIiQk.js";import{s as ol}from"./Plus-DWySsEmB.js";import{s as nl}from"./Trash01-BxBhF2b8.js";import{M as $t}from"./multi-select-DT2CaFLR.js";import{b as yt,a as wt,c as $e,d as St,S as It}from"./select-CxXZwsSr.js";import{e as ys,T as al}from"./time-range-picker-BJPUtKv4.js";import{T as cl}from"./textarea-viSdm6BE.js";import{C as Ds}from"./collection-tabs-Cju2BOrS.js";import{S as dl}from"./switch-B81oLbqr.js";import{L as ml}from"./label-8UxgpYiA.js";import{I as Ct}from"./integration-icon-Bo-3z9o3.js";import{A as ul,a as fl,b as xl}from"./alert-CxbB9CEj.js";import{K as gt}from"./monitoring-stats-row-B4nREvBy.js";import{b as Bt}from"./use-entitlements-Gn1rhCN5.js";import{g as pl,b as ws,f as Nt,c as Zt,d as gl,e as Ss,a as xs,h as hl,i as ps,T as vl,j as jl,r as Nl,k as bl}from"./thread-sheet-body-CC8y_ZHb.js";import{u as yl}from"./useSuspenseInfiniteQuery-Pk4rU2Ft.js";import{c as wl,S as Sl,b as Rs,a as Ls}from"./sheet-C-umRrOH.js";import{c as De,b as vt,d as Jt,e as Gt,T as he,a as Qt}from"./table-C3AdbrSy.js";import{t as ss}from"./ChevronDown-XsLJSrfl.js";import{n as ls}from"./ChevronUp-BQktpZWC.js";import{u as Os}from"./use-id-selection-DNp_iXDg.js";import{u as Fs}from"./use-infinite-scroll-DdrDrAAo.js";import{u as Il}from"./useInfiniteQuery-Ypmdjx1e.js";import{g as Cl}from"./task-status-DYgcNbkh.js";import{u as Tl,d as kl}from"./use-automations-BF2lxi1L.js";import{A as Ml}from"./automation-runs-Dto_jEAs.js";import{i as _l}from"./ArrowLeft-B0PZnf1E.js";import{E as Is}from"./empty-state-DM4xv3sa.js";import{O as zs}from"./watch-sse-pool-DdfLfQcH.js";import{c as Pl,r as Dl,O as Rl,h as Ll}from"./order-monitor-day-BS6DbEul.js";import{F as Ol}from"./feature-gate-DMrFeUy1.js";import"./SearchMd-BD2qldmS.js";import"./access-gate-ZixeoVbg.js";import"./capability-load-error-CCChPOz4.js";import"./Tool01-BCJ5kyrz.js";import"./ArrowRight-mzMrxxYI.js";import"./collapsible-CadTVXY4.js";import"./use-copy-DT4_uVrH.js";import"./usage-stats-B0_Yl-r0.js";import"./utils-CVEq3hMx.js";import"./markdown-CJR_ooUO.js";import"./chat-context-DFEln8mI.js";import"./use-panel-navigate-0z93k6Ut.js";import"./thread-route-CfpvvkkL.js";import"./use-project-scope-BwqdbGG4.js";import"./use-view-draft-kind-BopwZu5H.js";import"./use-blog-view-DMfZjkz0.js";import"./use-organization-settings-C2vcrj4S.js";import"./schema-Bb-DbvPZ.js";import"./task-board-i6qU2BVR.js";import"./thread-intent-DyZ5A9F9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./session-runtime-DBl1Hlcw.js";import"./use-ai-providers-Ct2xvYDX.js";import"./use-current-view-DBmQQ8uy.js";import"./use-in-settings-CFQ9B3W2.js";import"./use-decopilot-events-43RPCkUH.js";import"./use-org-fs-D9dHgOYs.js";import"./use-mobile-C_hdQY5I.js";import"./File02-DaYek2y9.js";import"./gateway-client-B4qzR3sF.js";import"./form-DlZ0KMAb.js";import"./UserCheck01-k-4bTA2h.js";import"./task-key-Bt60Ndov.js";import"./use-task-board-items-D2aUd0HA.js";import"./config-LEYSFIMn.js";import"./AlertCircle-BlMH0XE7.js";import"./CheckCircle-DZ8MNpCP.js";import"./Eye-kjjhS0vP.js";import"./task-route-C3cK6F8S.js";import"./project-index-C2IrSomv.js";import"./UserSquare-CafFh5_d.js";import"./shell-layout-UF80oiAz.js";import"./Globe04-CeAQ1YNm.js";import"./use-deployment-admin-Cr4LWHG9.js";import"./admin-fetch-BhTJlAsX.js";import"./XClose-CmTuu4UN.js";import"./use-org-notice-Bg0zOPPj.js";import"./Monitor01-DMFbvudn.js";import"./Zap-CBJ7My90.js";import"./command-C3tlrKUq.js";import"./index-DMpANy5-.js";import"./project-icon-fQqckccl.js";import"./use-navigate-to-agent-Cw8_3uU5.js";import"./use-debounced-value-DO5dvp6c.js";import"./new-project-dialog-BW6Lh52P.js";import"./repository-picker-CSaozawA.js";import"./github-icon-Bq9Ot22_.js";import"./collection-search-DkVgkcUC.js";import"./BookOpen01-DU-B3R7s.js";import"./ShoppingBag01-BbjW7cod.js";import"./new-project-store-DID5OVrt.js";import"./legacy-admin-welcome-dialog-plmLACwz.js";import"./drawer-CROtV2u4.js";import"./required-auth-layout-Cwtu4iIe.js";import"./use-org-sso-_fzcS8V-.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-DU6s3Olv.js";import"./types-5-cDe_8u.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./Image01-BcIZ5mtf.js";import"./use-mcp-prompts-qJSiAdA5.js";import"./use-thread-outputs-BK5BfLdO.js";import"./file-type-icon-CdjLDWdN.js";import"./index-CDQbtG2e.js";import"./ArrowUp-D5DDc3Cp.js";import"./ChevronSelectorVertical-CB0fn1Nq.js";import"./CreditCard01-MY4ouqtl.js";import"./MessageCircle01-BG1RhOiZ.js";import"./Fingerprint04-B2fDIuT8.js";import"./LayoutLeft-DDtN-od-.js";import"./Minus-hZzPDO0w.js";import"./Sun-O9TdKcV_.js";import"./Upload01-q-rKSvZf.js";import"./Users01-DM58_gUL.js";import"./editor-ipOJFDhA.js";import"./auth-C82OPjUx.js";import"./checkbox-QUuOza1H.js";import"./index-BdQq_4o_.js";import"./scroll-area-Dm3EbBj1.js";import"./calendar-DNzaYWCQ.js";import"./chart-DsKJdJFH.js";import"./CategoricalChart-wSsXuALZ.js";import"./index-rjS4IUT9.js";import"./tooltipContext-CSDtg0Lk.js";import"./CartesianChart-fywgd4bq.js";import"./AreaChart-CFi6-0Iq.js";import"./infiniteQueryObserver-C3KEOANj.js";import"./useQueries-GZbpaWZ_.js";import"./ReferenceLine-CCZuWAGw.js";import"./feature-paywall-DL1BXqDM.js";import"./plan-ladder-C3ogU-RT.js";const rs={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3},Fl=["eq","contains","exists","in"];function zl(s){return Fl.includes(s)}function jt(s){return s.filter(e=>e.key.trim()).map(e=>{const l=encodeURIComponent(e.key.trim()),i=encodeURIComponent(e.value||"");return`${l}:${e.operator}:${i}`}).join(",")}function $l(s){return!s||typeof s!="string"?[]:s.split(",").map(e=>{if(!e)return;const[l,i,...m]=e.split(":"),o=l?decodeURIComponent(l):"";if(o.trim())return{key:o,operator:i&&zl(i)?i:"eq",value:decodeURIComponent(m.join(":")||"")}}).filter(e=>e!==void 0)}function Vt(s){return s.filter(e=>e.key.trim()).map(e=>{switch(e.operator){case"eq":return`${e.key}=${e.value}`;case"contains":return`${e.key}~${e.value}`;case"exists":return`${e.key}?`;case"in":return`${e.key}@${e.value}`}}).join(`
`)}function Cs(s){return s.trim()?s.split(`
`).map(e=>e.trim()).filter(e=>e.length>0).map(e=>{if(e.endsWith("?"))return{key:e.slice(0,-1),operator:"exists",value:""};if(e.includes("=")){const[l,...i]=e.split("=");return{key:l||"",operator:"eq",value:i.join("=")}}if(e.includes("~")){const[l,...i]=e.split("~");return{key:l||"",operator:"contains",value:i.join("~")}}if(e.includes("@")){const[l,...i]=e.split("@");return{key:l||"",operator:"in",value:i.join("@")}}return{key:e,operator:"exists",value:""}}):[]}function El(s){const e={},l={},i=[],m={};for(const o of s)if(o.key.trim())switch(o.operator){case"eq":o.value&&(e[o.key]=o.value);break;case"contains":o.value&&(l[o.key]=`%${o.value}%`);break;case"exists":i.push(o.key);break;case"in":o.value&&(m[o.key]=o.value);break}return{properties:Object.keys(e).length>0?e:void 0,propertyPatterns:Object.keys(l).length>0?l:void 0,propertyKeys:i.length>0?i:void 0,propertyInValues:Object.keys(m).length>0?m:void 0}}function Ts(s){if(!s)return{content:"null",isTruncated:!1,originalSize:4};const e=s._decocms_truncated;if(typeof e=="string"&&e.length>0)return{content:e,isTruncated:!0,originalSize:e.length};let l;try{l=JSON.stringify(s,null,2)}catch{return{content:"[Unable to serialize JSON]",isTruncated:!1,originalSize:0}}const i=l.length;return i<=rs.maxJsonRenderSize?{content:l,isTruncated:!1,originalSize:i}:{content:l.slice(0,rs.maxJsonRenderSize)+`
... [TRUNCATED - content too large to display]`,isTruncated:!0,originalSize:i}}function Al(s){const e=ue.c(167),{log:l}=s,[i,m]=xe.useState(!1),[o,u]=xe.useState(!1),d=ns(),{org:c}=ht(),r=_e(),g=ts(),h=Ts(l.input),f=Ts(l.output),n=Ul;let w;e[0]!==l.input||e[1]!==l.output||e[2]!==r?(w=async ge=>{const pe=n(ge==="input"?l.input:l.output);try{await navigator.clipboard.writeText(pe),ge==="input"?(m(!0),setTimeout(()=>m(!1),2e3)):(u(!0),setTimeout(()=>u(!1),2e3))}catch{dt.error(r("monitoring.types.failedToCopy"))}},e[0]=l.input,e[1]=l.output,e[2]=r,e[3]=w):w=e[3];const a=w;let T;e[4]!==l.id||e[5]!==l.input||e[6]!==l.output||e[7]!==l.toolName?(T=ge=>{const pe=n(ge==="input"?l.input:l.output),ye=new Blob([pe],{type:"application/json"}),Pe=URL.createObjectURL(ye),Me=document.createElement("a");Me.href=Pe,Me.download=`${l.toolName}-${ge}-${l.id}.json`,Me.click(),URL.revokeObjectURL(Pe)},e[4]=l.id,e[5]=l.input,e[6]=l.output,e[7]=l.toolName,e[8]=T):T=e[8];const j=T;let y;e[9]!==g||e[10]!==l.connectionId||e[11]!==l.input||e[12]!==l.toolName||e[13]!==d||e[14]!==c||e[15]!==r?(y=()=>{const ge=g.find(ye=>ye.id===l.connectionId);if(!ge){dt.error(r("monitoring.types.connectionNotFound"));return}const pe=crypto.randomUUID();sessionStorage.setItem(`replay-${pe}`,JSON.stringify(l.input)),d({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:c.slug,appSlug:Ps(ge),collectionName:"tools",itemId:encodeURIComponent(l.toolName)},search:{replayId:pe}})},e[9]=g,e[10]=l.connectionId,e[11]=l.input,e[12]=l.toolName,e[13]=d,e[14]=c,e[15]=r,e[16]=y):y=e[16];const v=y,[p,M]=xe.useState(!1);let x;e[17]!==l.requestId||e[18]!==r?(x=async()=>{try{await navigator.clipboard.writeText(l.requestId),M(!0),setTimeout(()=>M(!1),2e3)}catch{dt.error(r("monitoring.types.failedToCopy"))}},e[17]=l.requestId,e[18]=r,e[19]=x):x=e[19];const S=x;let I;e[20]!==l.timestamp?(I=new Date(l.timestamp).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[20]=l.timestamp,e[21]=I):I=e[21];const b=I,C="text-sm px-5 md:px-6 py-5 space-y-5";let _;e[22]!==r?(_=r("monitoring.types.timestamp"),e[22]=r,e[23]=_):_=e[23];let P;e[24]!==_?(P=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:_}),e[24]=_,e[25]=P):P=e[25];let k;e[26]!==b?(k=t.jsx("div",{className:"text-sm text-foreground",children:b}),e[26]=b,e[27]=k):k=e[27];let D;e[28]!==P||e[29]!==k?(D=t.jsxs("div",{children:[P,k]}),e[28]=P,e[29]=k,e[30]=D):D=e[30];let L;e[31]!==r?(L=r("monitoring.types.duration"),e[31]=r,e[32]=L):L=e[32];let U;e[33]!==L?(U=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:L}),e[33]=L,e[34]=U):U=e[34];let J;e[35]!==l.durationMs?(J=t.jsxs("div",{className:"text-sm font-mono text-foreground",children:[l.durationMs,"ms"]}),e[35]=l.durationMs,e[36]=J):J=e[36];let Q;e[37]!==U||e[38]!==J?(Q=t.jsxs("div",{children:[U,J]}),e[37]=U,e[38]=J,e[39]=Q):Q=e[39];let N;e[40]!==r?(N=r("monitoring.types.user"),e[40]=r,e[41]=N):N=e[41];let O;e[42]!==N?(O=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:N}),e[42]=N,e[43]=O):O=e[43];let F;e[44]!==l.userName?(F=t.jsx("div",{className:"text-sm text-foreground",children:l.userName}),e[44]=l.userName,e[45]=F):F=e[45];let q;e[46]!==O||e[47]!==F?(q=t.jsxs("div",{children:[O,F]}),e[46]=O,e[47]=F,e[48]=q):q=e[48];let $;e[49]!==l.virtualMcpName||e[50]!==r?($=l.virtualMcpName&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r("monitoring.types.agent")}),t.jsx("div",{className:"text-sm text-foreground",children:l.virtualMcpName})]}),e[49]=l.virtualMcpName,e[50]=r,e[51]=$):$=e[51];let W;e[52]!==r?(W=r("monitoring.types.requestId"),e[52]=r,e[53]=W):W=e[53];let K;e[54]!==W?(K=t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:W}),e[54]=W,e[55]=K):K=e[55];let B;e[56]!==l.requestId?(B=t.jsx("code",{className:"font-mono text-foreground text-2xs",children:l.requestId}),e[56]=l.requestId,e[57]=B):B=e[57];let V;e[58]!==r?(V=r("monitoring.types.copyRequestId"),e[58]=r,e[59]=V):V=e[59];let Y;e[60]!==p?(Y=p?t.jsx(Yt,{size:12}):t.jsx(Kt,{size:12}),e[60]=p,e[61]=Y):Y=e[61];let R;e[62]!==S||e[63]!==V||e[64]!==Y?(R=t.jsx(je,{size:"icon",variant:"ghost",onClick:S,"aria-label":V,className:"h-5 w-5 text-muted-foreground hover:text-foreground",children:Y}),e[62]=S,e[63]=V,e[64]=Y,e[65]=R):R=e[65];let E;e[66]!==B||e[67]!==R?(E=t.jsxs("div",{className:"flex items-center gap-1",children:[B,R]}),e[66]=B,e[67]=R,e[68]=E):E=e[68];let H;e[69]!==K||e[70]!==E?(H=t.jsxs("div",{children:[K,E]}),e[69]=K,e[70]=E,e[71]=H):H=e[71];let A;e[72]!==l.userAgent||e[73]!==r?(A=l.userAgent&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r("monitoring.types.client")}),t.jsx("div",{className:"text-sm font-mono text-foreground",children:l.userAgent})]}),e[72]=l.userAgent,e[73]=r,e[74]=A):A=e[74];let Z;e[75]!==l.properties||e[76]!==d||e[77]!==c||e[78]!==r?(Z=l.properties&&Object.keys(l.properties).length>0&&t.jsxs("div",{className:"md:col-span-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1.5",children:r("monitoring.types.properties")}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(l.properties).map(ge=>{const[pe,ye]=ge;return t.jsxs(ds,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs(Lt,{variant:"secondary",className:"font-mono cursor-pointer hover:bg-secondary-hover",children:[pe,"=",ye]})}),t.jsx(us,{className:"w-auto p-1",align:"end",children:t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsxs(je,{variant:"menu",className:"text-xs",onClick:()=>{const Pe={key:pe,operator:"eq",value:ye};d({to:"/$org/settings/monitor",params:{org:c.slug},search:{tab:"overview",propertyFilters:jt([Pe])}})},children:[t.jsx(fs,{size:14,className:"mr-2"}),r("monitoring.types.filterByProperty")]}),t.jsxs(je,{variant:"menu",className:"text-xs",onClick:async()=>{try{await navigator.clipboard.writeText(`${pe}=${ye}`),dt.success(r("monitoring.types.copiedFilter"))}catch{dt.error(r("monitoring.types.failedToCopy"))}},children:[t.jsx(Kt,{size:14,className:"mr-2"}),r("monitoring.types.copyFilter")]}),t.jsxs(je,{variant:"menu",className:"text-xs",onClick:async()=>{try{await navigator.clipboard.writeText(pe),dt.success(r("monitoring.types.copiedKey"))}catch{dt.error(r("monitoring.types.failedToCopy"))}},children:[t.jsx(tl,{size:14,className:"mr-2"}),r("monitoring.types.copyKey")]}),t.jsxs(je,{variant:"menu",className:"text-xs",onClick:async()=>{try{await navigator.clipboard.writeText(ye),dt.success(r("monitoring.types.copiedValue"))}catch{dt.error(r("monitoring.types.failedToCopy"))}},children:[t.jsx(Zs,{size:14,className:"mr-2"}),r("monitoring.types.copyValue")]})]})})]},pe)})})]}),e[75]=l.properties,e[76]=d,e[77]=c,e[78]=r,e[79]=Z):Z=e[79];let ee;e[80]!==D||e[81]!==Q||e[82]!==q||e[83]!==$||e[84]!==H||e[85]!==A||e[86]!==Z?(ee=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[D,Q,q,$,H,A,Z]}),e[80]=D,e[81]=Q,e[82]=q,e[83]=$,e[84]=H,e[85]=A,e[86]=Z,e[87]=ee):ee=e[87];let G;e[88]!==l.errorMessage||e[89]!==r?(G=l.errorMessage&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-destructive mb-1",children:r("monitoring.types.error")}),t.jsx("div",{className:"text-destructive font-mono text-xs bg-destructive/10 p-2 rounded break-all",children:l.errorMessage})]}),e[88]=l.errorMessage,e[89]=r,e[90]=G):G=e[90];const de="space-y-4";let re;e[91]!==r?(re=r("monitoring.types.input"),e[91]=r,e[92]=re):re=e[92];let ie;e[93]!==re?(ie=t.jsx("span",{className:"text-xs text-muted-foreground select-none",children:re}),e[93]=re,e[94]=ie):ie=e[94];const me=h.isTruncated&&t.jsxs("span",{className:"text-xs text-warning",children:["(",js(h.originalSize)," -"," ",r("monitoring.types.truncated"),")"]});let te;e[95]!==ie||e[96]!==me?(te=t.jsxs("div",{className:"flex items-center gap-2",children:[ie,me]}),e[95]=ie,e[96]=me,e[97]=te):te=e[97];let oe;e[98]!==v||e[99]!==l.input||e[100]!==r?(oe=l.input&&t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx(je,{size:"icon",variant:"ghost",onClick:v,"aria-label":r("monitoring.types.replayToolCall"),className:"text-muted-foreground hover:text-foreground",children:t.jsx(sl,{size:14})})}),t.jsx(Rt,{children:r("monitoring.types.replayToolCall")})]}),e[98]=v,e[99]=l.input,e[100]=r,e[101]=oe):oe=e[101];let se;e[102]!==j||e[103]!==h||e[104]!==r?(se=h.isTruncated&&t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx(je,{size:"icon",variant:"ghost",onClick:()=>j("input"),"aria-label":r("monitoring.types.downloadFullInput"),className:"text-muted-foreground hover:text-foreground",children:t.jsx(Ns,{size:14})})}),t.jsx(Rt,{children:r("monitoring.types.downloadFullInput")})]}),e[102]=j,e[103]=h,e[104]=r,e[105]=se):se=e[105];let X;e[106]!==a?(X=()=>a("input"),e[106]=a,e[107]=X):X=e[107];let ne;e[108]!==r?(ne=r("monitoring.types.copyInput"),e[108]=r,e[109]=ne):ne=e[109];let ae;e[110]!==i?(ae=i?t.jsx(Yt,{size:14}):t.jsx(Kt,{size:14}),e[110]=i,e[111]=ae):ae=e[111];let ce;e[112]!==X||e[113]!==ne||e[114]!==ae?(ce=t.jsx(je,{size:"icon",variant:"ghost",onClick:X,"aria-label":ne,className:"text-muted-foreground hover:text-foreground",children:ae}),e[112]=X,e[113]=ne,e[114]=ae,e[115]=ce):ce=e[115];let z;e[116]!==oe||e[117]!==se||e[118]!==ce?(z=t.jsxs("div",{className:"flex items-center gap-1",children:[oe,se,ce]}),e[116]=oe,e[117]=se,e[118]=ce,e[119]=z):z=e[119];let le;e[120]!==te||e[121]!==z?(le=t.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 border-b border-border",children:[te,z]}),e[120]=te,e[121]=z,e[122]=le):le=e[122];let fe;e[123]!==h?(fe=t.jsx("div",{className:"h-[200px] md:h-[280px] overflow-auto",children:t.jsx(bs,{code:h.content,language:"json",height:"100%",readOnly:!0})}),e[123]=h,e[124]=fe):fe=e[124];let ve;e[125]!==le||e[126]!==fe?(ve=t.jsx("div",{children:t.jsxs("div",{className:"rounded-lg overflow-hidden border border-border",children:[le,fe]})}),e[125]=le,e[126]=fe,e[127]=ve):ve=e[127];const Ge="rounded-lg overflow-hidden border border-border",Qe="flex items-center justify-between p-1 pl-4 border-b border-border",Ee="flex items-center gap-2";let Re;e[128]!==r?(Re=r("monitoring.types.output"),e[128]=r,e[129]=Re):Re=e[129];let Le;e[130]!==Re?(Le=t.jsx("span",{className:"text-xs text-muted-foreground select-none",children:Re}),e[130]=Re,e[131]=Le):Le=e[131];const Oe=f.isTruncated&&t.jsxs("span",{className:"text-xs text-warning",children:["(",js(f.originalSize)," -"," ",r("monitoring.types.truncated"),")"]});let we;e[132]!==Le||e[133]!==Oe?(we=t.jsxs("div",{className:Ee,children:[Le,Oe]}),e[132]=Le,e[133]=Oe,e[134]=we):we=e[134];let Fe;e[135]!==j||e[136]!==f.isTruncated||e[137]!==r?(Fe=f.isTruncated&&t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx(je,{size:"icon",variant:"ghost",onClick:()=>j("output"),"aria-label":r("monitoring.types.downloadFullOutput"),className:"text-muted-foreground hover:text-foreground",children:t.jsx(Ns,{size:14})})}),t.jsx(Rt,{children:r("monitoring.types.downloadFullOutput")})]}),e[135]=j,e[136]=f.isTruncated,e[137]=r,e[138]=Fe):Fe=e[138];let Ye;e[139]!==a?(Ye=()=>a("output"),e[139]=a,e[140]=Ye):Ye=e[140];let Se;e[141]!==r?(Se=r("monitoring.types.copyOutput"),e[141]=r,e[142]=Se):Se=e[142];let Ie;e[143]!==o?(Ie=o?t.jsx(Yt,{size:14}):t.jsx(Kt,{size:14}),e[143]=o,e[144]=Ie):Ie=e[144];let Ne;e[145]!==Ye||e[146]!==Se||e[147]!==Ie?(Ne=t.jsx(je,{size:"icon",variant:"ghost",onClick:Ye,"aria-label":Se,className:"text-muted-foreground hover:text-foreground",children:Ie}),e[145]=Ye,e[146]=Se,e[147]=Ie,e[148]=Ne):Ne=e[148];let be;e[149]!==Fe||e[150]!==Ne?(be=t.jsxs("div",{className:"flex items-center gap-1",children:[Fe,Ne]}),e[149]=Fe,e[150]=Ne,e[151]=be):be=e[151];let Ce;e[152]!==we||e[153]!==be?(Ce=t.jsxs("div",{className:Qe,children:[we,be]}),e[152]=we,e[153]=be,e[154]=Ce):Ce=e[154];let Te;e[155]!==f.content?(Te=t.jsx("div",{className:"h-[200px] md:h-[280px] overflow-auto",children:t.jsx(bs,{code:f.content,language:"json",height:"100%",readOnly:!0})}),e[155]=f.content,e[156]=Te):Te=e[156];let ke;e[157]!==Ce||e[158]!==Te?(ke=t.jsx("div",{children:t.jsxs("div",{className:Ge,children:[Ce,Te]})}),e[157]=Ce,e[158]=Te,e[159]=ke):ke=e[159];let ze;e[160]!==ve||e[161]!==ke?(ze=t.jsxs("div",{className:de,children:[ve,ke]}),e[160]=ve,e[161]=ke,e[162]=ze):ze=e[162];let Ae;return e[163]!==ee||e[164]!==G||e[165]!==ze?(Ae=t.jsxs("div",{className:C,children:[ee,G,ze]}),e[163]=ee,e[164]=G,e[165]=ze,e[166]=Ae):Ae=e[166],Ae}function Ul(s){return JSON.stringify(s,null,2)}const $s="decopilot";async function Es(s,e){return await s.call("MONITORING_STATS",e)}function Kl(s,e){const l=ue.c(12),{org:i}=ht(),m=as();let o,u,d;l[0]!==i.id||l[1]!==s?(d={...s,excludeConnectionIds:[$s,...s.excludeConnectionIds??[]]},u=Et,o=bt.monitoringStatsToolCalls(i.id,JSON.stringify(d)),l[0]=i.id,l[1]=s,l[2]=o,l[3]=u,l[4]=d):(o=l[2],u=l[3],d=l[4]);let c;l[5]!==m||l[6]!==d?(c=()=>Es(m,d),l[5]=m,l[6]=d,l[7]=c):c=l[7];let r;return l[8]!==e||l[9]!==o||l[10]!==c?(r={queryKey:o,queryFn:c,staleTime:3e4,retry:!1,...e},l[8]=e,l[9]=o,l[10]=c,l[11]=r):r=l[11],u(r)}function Vl(s,e){const l=ue.c(12),{org:i}=ht(),m=as();let o,u,d;l[0]!==i.id||l[1]!==s?(d={...s,connectionIds:[$s],topN:5,llmUsage:!0,userIds:s.userIds?.length?s.userIds:void 0},u=Et,o=bt.monitoringStatsLlm(i.id,JSON.stringify(d)),l[0]=i.id,l[1]=s,l[2]=o,l[3]=u,l[4]=d):(o=l[2],u=l[3],d=l[4]);let c;l[5]!==m||l[6]!==d?(c=()=>Es(m,d),l[5]=m,l[6]=d,l[7]=c):c=l[7];let r;return l[8]!==e||l[9]!==o||l[10]!==c?(r={queryKey:o,queryFn:c,staleTime:3e4,retry:!1,...e},l[8]=e,l[9]=o,l[10]=c,l[11]=r):r=l[11],u(r)}function ql(s,e){const l=ue.c(13),{org:i}=ht(),m=as(),o=s.virtualMcpIds?.length?s.virtualMcpIds:void 0;let u,d,c;l[0]!==i.id||l[1]!==s||l[2]!==o?(c={...s,virtualMcpIds:o},d=Et,u=bt.monitoringHeatmap(i.id,JSON.stringify(c)),l[0]=i.id,l[1]=s,l[2]=o,l[3]=u,l[4]=d,l[5]=c):(u=l[3],d=l[4],c=l[5]);let r;l[6]!==m||l[7]!==c?(r=async()=>await m.call("MONITORING_HEATMAP",c),l[6]=m,l[7]=c,l[8]=r):r=l[8];let g;return l[9]!==e||l[10]!==u||l[11]!==r?(g={queryKey:u,queryFn:r,staleTime:3e4,retry:!1,...e},l[9]=e,l[10]=u,l[11]=r,l[12]=g):g=l[12],d(g)}function mt(s){const e=ue.c(20),{title:l,value:i,action:m,children:o,className:u}=s;let d;e[0]!==u?(d=ot("pt-4 px-4 pb-6 gap-8",u),e[0]=u,e[1]=d):d=e[1];let c;e[2]!==l?(c=t.jsx("span",{className:"text-sm text-foreground/70",children:l}),e[2]=l,e[3]=c):c=e[3];let r;e[4]!==i?(r=t.jsx("span",{className:"text-4xl font-normal",children:i}),e[4]=i,e[5]=r):r=e[5];let g;e[6]!==c||e[7]!==r?(g=t.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[c,r]}),e[6]=c,e[7]=r,e[8]=g):g=e[8];let h;e[9]!==m?(h=m&&t.jsx("div",{className:"shrink-0",children:m}),e[9]=m,e[10]=h):h=e[10];let f;e[11]!==g||e[12]!==h?(f=t.jsxs("div",{className:"flex items-start justify-between",children:[g,h]}),e[11]=g,e[12]=h,e[13]=f):f=e[13];let n;e[14]!==o?(n=o&&t.jsx("div",{className:"flex flex-col gap-6",children:o}),e[14]=o,e[15]=n):n=e[15];let w;return e[16]!==d||e[17]!==f||e[18]!==n?(w=t.jsxs(_s,{className:d,children:[f,n]}),e[16]=d,e[17]=f,e[18]=n,e[19]=w):w=e[19],w}function es(s){const e=ue.c(14),{metrics:l,connections:i,mode:m,total:o}=s,{org:u}=ht(),d=ns();let c,r,g;if(e[0]!==i||e[1]!==l||e[2]!==m||e[3]!==d||e[4]!==u||e[5]!==o){g=Symbol.for("react.early_return_sentinel");e:{const f=i??[],n=new Map(l.map(Bl));let w;e[9]!==m?(w=(T,j)=>{const y=Ss(T.metric,m);return Ss(j.metric,m)-y},e[9]=m,e[10]=w):w=e[10];const a=f.map(T=>({connection:T,metric:n.get(T.id)})).filter(Hl).sort(w).slice(0,4);if(a.length===0){g=null;break e}c="flex flex-col",r=a.map((T,j)=>{const{connection:y,metric:v}=T,p=o>0?(v.calls/o*100).toFixed(1):"0.0",M=m==="errors"?`${v.errorRate.toFixed(1)}%`:`${p}%`,x=j===a.length-1;return t.jsxs("div",{className:ot("flex items-center h-10 px-3 cursor-pointer hover:bg-accent transition-colors",!x&&"border-b border-border/50"),onClick:()=>d({to:"/$org/settings/connections/$appSlug",params:{org:u.slug,appSlug:Ps(y)}}),children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2 min-w-0",children:[t.jsx(Ct,{icon:y.icon,name:y.title,size:"xs",fallbackIcon:t.jsx(Ot,{}),className:"shrink-0 size-6! min-w-6! rounded-md"}),t.jsx("span",{className:"text-sm text-muted-foreground flex-1 truncate",children:y.title})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 px-3",children:[t.jsx("span",{className:"text-sm text-foreground/30 tabular-nums",children:M}),t.jsx("span",{className:"text-sm text-foreground tabular-nums",children:gl(v,m)})]})]},y.id)})}e[0]=i,e[1]=l,e[2]=m,e[3]=d,e[4]=u,e[5]=o,e[6]=c,e[7]=r,e[8]=g}else c=e[6],r=e[7],g=e[8];if(g!==Symbol.for("react.early_return_sentinel"))return g;let h;return e[11]!==c||e[12]!==r?(h=t.jsx("div",{className:c,children:r}),e[11]=c,e[12]=r,e[13]=h):h=e[13],h}function Hl(s){return s.metric}function Bl(s){return[s.connectionId,s]}const ks=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function Ms(s){let e=0;for(let l=0;l<s.length;l++)e=e*31+s.charCodeAt(l)>>>0;return ks[e%ks.length]}function zt(s){const e=ue.c(21),{models:l,mode:i}=s,m=i===void 0?"calls":i;if(!Bt()||l.length===0)return null;let u;e[0]!==m?(u=a=>m==="tokens"?(a.inputTokens??0)+(a.outputTokens??0):m==="cost"?a.costUsd??0:a.calls,e[0]=m,e[1]=u):u=e[1];const d=u;let c;e[2]!==m?(c=a=>m==="cost"?xs(a):m==="tokens"?Nt(a):a.toLocaleString(),e[2]=m,e[3]=c):c=e[3];const r=c;let g;e[4]!==d?(g=(a,T)=>a+d(T),e[4]=d,e[5]=g):g=e[5];const h=l.reduce(g,0);let f,n;if(e[6]!==r||e[7]!==l||e[8]!==h||e[9]!==d){let a;e[12]!==d?(a=(y,v)=>d(v)-d(y),e[12]=d,e[13]=a):a=e[13];const T=[...l].sort(a).slice(0,4);f="flex flex-col";let j;e[14]!==r||e[15]!==h||e[16]!==d?(j=(y,v,p)=>{const M=d(y),x=h>0?(M/h*100).toFixed(1):"0.0",S=v===p.length-1;return t.jsxs("div",{className:ot("flex items-center h-10 px-3",!S&&"border-b border-border/50"),children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2 min-w-0",children:[t.jsx("div",{className:"size-6 rounded-md border border-border/10 shadow-sm flex items-center justify-center shrink-0",style:{backgroundColor:`color-mix(in oklch, ${Ms(y.toolName)} 18%, transparent)`},children:t.jsx(Ot,{size:14,style:{color:Ms(y.toolName)}})}),t.jsx("span",{className:"text-sm text-muted-foreground flex-1 truncate",children:y.toolName})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0 px-3",children:[t.jsxs("span",{className:"text-sm text-foreground/30 tabular-nums",children:[x,"%"]}),t.jsx("span",{className:"text-sm text-foreground tabular-nums",children:r(M)})]})]},y.toolName)},e[14]=r,e[15]=h,e[16]=d,e[17]=j):j=e[17],n=T.map(j),e[6]=r,e[7]=l,e[8]=h,e[9]=d,e[10]=f,e[11]=n}else f=e[10],n=e[11];let w;return e[18]!==f||e[19]!==n?(w=t.jsx("div",{className:f,children:n}),e[18]=f,e[19]=n,e[20]=w):w=e[20],w}const Jl=12,Gl=8;function Ql(s,e){if(s===0)return"bg-muted-foreground/10";const l=e>0?s/e:0;return l<=.15?"bg-success/25":l<=.4?"bg-success/45":l<=.7?"bg-success/70":"bg-success"}function Yl(s){const e=ue.c(35),{cells:l,virtualMcps:i,metric:m}=s,o=_e();if(l.length===0){let j;e[0]!==o?(j=o("orgs.overview.noHeatmapData"),e[0]=o,e[1]=j):j=e[1];let y;return e[2]!==j?(y=t.jsx("div",{className:"flex items-center justify-center h-20 text-sm text-muted-foreground",children:j}),e[2]=j,e[3]=y):y=e[3],y}let u,d,c,r,g,h,f,n;if(e[4]!==l||e[5]!==m||e[6]!==o||e[7]!==i){const{topTools:j,topAgentIds:y,cellMap:v,maxValue:p}=hl(l,m,Jl,Gl);let M;e[16]!==o||e[17]!==i?(M=I=>I===""?o("orgs.overview.noAgent"):i.find(b=>b.id===I)?.title??I,e[16]=o,e[17]=i,e[18]=M):M=e[18];const x=M;u=Xs,n=0,f="overflow-x-auto",d="grid gap-1 min-w-max";const S=`140px repeat(${j.length}, 28px)`;e[19]!==S?(c={gridTemplateColumns:S},e[19]=S,e[20]=c):c=e[20],e[21]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{}),e[21]=r):r=e[21],g=j.map(Wl),h=y.map(I=>t.jsxs(xe.Fragment,{children:[t.jsx("div",{className:"text-xs text-muted-foreground truncate flex items-center pr-2",title:x(I),children:x(I)}),j.map(b=>{const C=v.get(`${I}::${b}`),_=C?.[m]??0;return t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx("div",{className:ot("aspect-square rounded-[2px]",Ql(_,p))})}),t.jsx(Rt,{children:o("orgs.overview.heatmapCellTooltip",{agent:x(I),tool:b,calls:C?.calls??0,errors:C?.errors??0,outputSize:Nt(C?.outputSize??0)})})]},b)})]},I||"none")),e[4]=l,e[5]=m,e[6]=o,e[7]=i,e[8]=u,e[9]=d,e[10]=c,e[11]=r,e[12]=g,e[13]=h,e[14]=f,e[15]=n}else u=e[8],d=e[9],c=e[10],r=e[11],g=e[12],h=e[13],f=e[14],n=e[15];let w;e[22]!==d||e[23]!==c||e[24]!==r||e[25]!==g||e[26]!==h?(w=t.jsxs("div",{className:d,style:c,children:[r,g,h]}),e[22]=d,e[23]=c,e[24]=r,e[25]=g,e[26]=h,e[27]=w):w=e[27];let a;e[28]!==f||e[29]!==w?(a=t.jsx("div",{className:f,children:w}),e[28]=f,e[29]=w,e[30]=a):a=e[30];let T;return e[31]!==u||e[32]!==n||e[33]!==a?(T=t.jsx(u,{delayDuration:n,children:a}),e[31]=u,e[32]=n,e[33]=a,e[34]=T):T=e[34],T}function Wl(s){return t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx("div",{className:"h-[80px] flex items-end justify-center pb-1 text-2xs text-muted-foreground overflow-hidden [writing-mode:vertical-rl]",children:s})}),t.jsx(Rt,{children:s})]},s)}function Xl(s){const e=ue.c(143),{displayDateRange:l,connectionIds:i,excludeConnectionIds:m,toolName:o,status:u,connections:d,isStreaming:c,streamingRefetchInterval:r,llmUserIds:g,virtualMcpIds:h,virtualMcps:f}=s,n=_e(),w=pl(l),a=c?r:!1;let T;e[0]!==a?(T={refetchInterval:a},e[0]=a,e[1]=T):T=e[1];const{data:j,isError:y}=Kl({interval:w,startDate:l.startDate.toISOString(),endDate:l.endDate.toISOString(),connectionIds:i.length>0?i:void 0,excludeConnectionIds:m,toolNames:o?[o]:void 0,status:u},T);let v;e[2]!==a?(v={refetchInterval:a},e[2]=a,e[3]=v):v=e[3];const{data:p,isError:M}=Vl({interval:w,startDate:l.startDate.toISOString(),endDate:l.endDate.toISOString(),userIds:g?.length?g:void 0},v);let x;e[4]!==l.startDate?(x=l.startDate.toISOString(),e[4]=l.startDate,e[5]=x):x=e[5];let S;e[6]!==l.endDate?(S=l.endDate.toISOString(),e[6]=l.endDate,e[7]=S):S=e[7];let I;e[8]!==m||e[9]!==x||e[10]!==S||e[11]!==h?(I={startDate:x,endDate:S,virtualMcpIds:h,excludeConnectionIds:m},e[8]=m,e[9]=x,e[10]=S,e[11]=h,e[12]=I):I=e[12];let b;e[13]!==a?(b={refetchInterval:a},e[13]=a,e[14]=b):b=e[14];const{data:C}=ql(I,b),_=y||M,P=j?{totalCalls:j.totalCalls,totalErrors:j.totalErrors,avgDurationMs:j.avgDurationMs,p95DurationMs:j.p95DurationMs,data:ws(j.timeseries,l,w)}:{totalCalls:0,totalErrors:0,avgDurationMs:0,p95DurationMs:0,data:[]},k=p?{totalCalls:p.totalCalls,totalErrors:p.totalErrors,avgDurationMs:p.avgDurationMs,p95DurationMs:p.p95DurationMs,data:ws(p.timeseries,l,w)}:{totalCalls:0,totalErrors:0,avgDurationMs:0,p95DurationMs:0,data:[]};let D;e[15]!==p?.topTools?(D=p?.topTools??[],e[15]=p?.topTools,e[16]=D):D=e[16];const L=D,U=p?.totalInputTokens??0,J=p?.totalOutputTokens??0,Q=p?.totalTokens??0,N=p?.totalCostUsd??0,O=Bt();let F;e[17]!==j?.connectionBreakdown?(F=j?.connectionBreakdown??[],e[17]=j?.connectionBreakdown,e[18]=F):F=e[18];const q=F,[$,W]=xe.useState("avg"),[K,B]=xe.useState("calls");let V;e[19]!==_||e[20]!==n?(V=_&&t.jsxs(ul,{variant:"destructive",children:[t.jsx(As,{}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(fl,{children:n("orgs.overview.failedToLoadTitle")}),t.jsx(xl,{children:n("orgs.overview.failedToLoadDescription")})]})]}),e[19]=_,e[20]=n,e[21]=V):V=e[21];let Y;e[22]!==n?(Y=n("orgs.overview.toolCalls"),e[22]=n,e[23]=Y):Y=e[23];const R=P.totalCalls.toLocaleString(),E=P.data;let H;e[24]!==n?(H=n("orgs.overview.toolCallsAriaLabel"),e[24]=n,e[25]=H):H=e[25];let A;e[26]!==n?(A=n("orgs.overview.toolCallHeatmap"),e[26]=n,e[27]=A):A=e[27];let Z;e[28]!==K||e[29]!==C?.cells?(Z=K==="calls"?(C?.cells??[]).reduce(er,0).toLocaleString():Nt((C?.cells??[]).reduce(Zl,0)),e[28]=K,e[29]=C?.cells,e[30]=Z):Z=e[30];let ee;e[31]===Symbol.for("react.memo_cache_sentinel")?(ee=ct=>B(ct),e[31]=ee):ee=e[31];let G;e[32]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx(yt,{variant:"pill",size:"sm",className:"w-[140px]",children:t.jsx(wt,{})}),e[32]=G):G=e[32];let de;e[33]!==n?(de=n("orgs.overview.heatmapMetricCalls"),e[33]=n,e[34]=de):de=e[34];let re;e[35]!==de?(re=t.jsx($e,{value:"calls",children:de}),e[35]=de,e[36]=re):re=e[36];let ie;e[37]!==n?(ie=n("orgs.overview.heatmapMetricOutputSize"),e[37]=n,e[38]=ie):ie=e[38];let me;e[39]!==ie?(me=t.jsx($e,{value:"outputSize",children:ie}),e[39]=ie,e[40]=me):me=e[40];let te;e[41]!==re||e[42]!==me?(te=t.jsxs(St,{children:[re,me]}),e[41]=re,e[42]=me,e[43]=te):te=e[43];let oe;e[44]!==K||e[45]!==te?(oe=t.jsxs(It,{value:K,onValueChange:ee,children:[G,te]}),e[44]=K,e[45]=te,e[46]=oe):oe=e[46];let se;e[47]!==C?.cells?(se=C?.cells??[],e[47]=C?.cells,e[48]=se):se=e[48];let X;e[49]!==K||e[50]!==se||e[51]!==f?(X=t.jsx(Yl,{cells:se,virtualMcps:f,metric:K}),e[49]=K,e[50]=se,e[51]=f,e[52]=X):X=e[52];let ne;e[53]!==A||e[54]!==Z||e[55]!==oe||e[56]!==X?(ne=t.jsx(mt,{title:A,value:Z,action:oe,children:X}),e[53]=A,e[54]=Z,e[55]=oe,e[56]=X,e[57]=ne):ne=e[57];let ae;e[58]!==n?(ae=n("orgs.overview.latency"),e[58]=n,e[59]=ae):ae=e[59];const ce=Zt($==="avg"?P.avgDurationMs:P.p95DurationMs);let z;e[60]===Symbol.for("react.memo_cache_sentinel")?(z=ct=>W(ct),e[60]=z):z=e[60];let le;e[61]===Symbol.for("react.memo_cache_sentinel")?(le=t.jsx(yt,{variant:"pill",size:"sm",className:"w-[120px]",children:t.jsx(wt,{})}),e[61]=le):le=e[61];let fe;e[62]!==n?(fe=n("orgs.overview.latencyAvg"),e[62]=n,e[63]=fe):fe=e[63];let ve;e[64]!==fe?(ve=t.jsx($e,{value:"avg",children:fe}),e[64]=fe,e[65]=ve):ve=e[65];let Ge;e[66]!==n?(Ge=n("orgs.overview.latencyP95"),e[66]=n,e[67]=Ge):Ge=e[67];let Qe;e[68]!==Ge?(Qe=t.jsx($e,{value:"p95",children:Ge}),e[68]=Ge,e[69]=Qe):Qe=e[69];let Ee;e[70]!==ve||e[71]!==Qe?(Ee=t.jsxs(St,{children:[ve,Qe]}),e[70]=ve,e[71]=Qe,e[72]=Ee):Ee=e[72];let Re;e[73]!==$||e[74]!==Ee?(Re=t.jsxs(It,{value:$,onValueChange:z,children:[le,Ee]}),e[73]=$,e[74]=Ee,e[75]=Re):Re=e[75];const Le=P.data;let Oe;e[76]!==$||e[77]!==n?(Oe=n("orgs.overview.latencyAriaLabel",{type:$==="avg"?n("orgs.overview.average"):"P95"}),e[76]=$,e[77]=n,e[78]=Oe):Oe=e[78];let we;e[79]!==n?(we=n("orgs.overview.errors"),e[79]=n,e[80]=we):we=e[80];const Fe=P.totalErrors.toLocaleString(),Ye=P.data;let Se;e[81]!==n?(Se=n("orgs.overview.errorsAriaLabel"),e[81]=n,e[82]=Se):Se=e[82];let Ie;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ie=t.jsx("div",{className:"h-px flex-1 bg-border"}),e[83]=Ie):Ie=e[83];let Ne;e[84]!==n?(Ne=n("orgs.overview.aiUsage"),e[84]=n,e[85]=Ne):Ne=e[85];let be;e[86]!==Ne?(be=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:Ne}),e[86]=Ne,e[87]=be):be=e[87];let Ce;e[88]===Symbol.for("react.memo_cache_sentinel")?(Ce=t.jsx("div",{className:"h-px flex-1 bg-border"}),e[88]=Ce):Ce=e[88];let Te;e[89]!==be?(Te=t.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[Ie,be,Ce]}),e[89]=be,e[90]=Te):Te=e[90];let ke;e[91]!==n?(ke=n("orgs.overview.aiCalls"),e[91]=n,e[92]=ke):ke=e[92];const ze=k.totalCalls.toLocaleString(),Ae=k.data;let ge;e[93]!==n?(ge=n("orgs.overview.aiCallsAriaLabel"),e[93]=n,e[94]=ge):ge=e[94];let pe;e[95]!==L?(pe=t.jsx(zt,{models:L,mode:"calls"}),e[95]=L,e[96]=pe):pe=e[96];let ye;e[97]!==n?(ye=n("orgs.overview.tokens"),e[97]=n,e[98]=ye):ye=e[98];let Pe;e[99]!==Q?(Pe=Nt(Q),e[99]=Q,e[100]=Pe):Pe=e[100];let Me;e[101]!==U?(Me=Nt(U),e[101]=U,e[102]=Me):Me=e[102];let Ue;e[103]!==n?(Ue=n("orgs.overview.tokensIn"),e[103]=n,e[104]=Ue):Ue=e[104];let Ke;e[105]!==J?(Ke=Nt(J),e[105]=J,e[106]=Ke):Ke=e[106];let Ve;e[107]!==n?(Ve=n("orgs.overview.tokensOut"),e[107]=n,e[108]=Ve):Ve=e[108];let We;e[109]!==Me||e[110]!==Ue||e[111]!==Ke||e[112]!==Ve?(We=t.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[Me," ",Ue," ·"," ",Ke," ",Ve]}),e[109]=Me,e[110]=Ue,e[111]=Ke,e[112]=Ve,e[113]=We):We=e[113];const ut=k.data;let Xe;e[114]!==n?(Xe=n("orgs.overview.tokensAriaLabel"),e[114]=n,e[115]=Xe):Xe=e[115];let Ze;e[116]!==L?(Ze=t.jsx(zt,{models:L,mode:"tokens"}),e[116]=L,e[117]=Ze):Ze=e[117];let et;e[118]!==n?(et=n("orgs.overview.aiLatency"),e[118]=n,e[119]=et):et=e[119];const ft=Zt(k.avgDurationMs);let tt;e[120]!==n?(tt=n("orgs.overview.p95Prefix"),e[120]=n,e[121]=tt):tt=e[121];const xt=k.data;let st;e[122]!==n?(st=n("orgs.overview.aiLatencyAriaLabel"),e[122]=n,e[123]=st):st=e[123];let lt;e[124]!==L?(lt=t.jsx(zt,{models:L,mode:"calls"}),e[124]=L,e[125]=lt):lt=e[125];const nt=mt;let qe;e[126]!==n?(qe=n("orgs.overview.aiErrors"),e[126]=n,e[127]=qe):qe=e[127];const at=k.totalErrors.toLocaleString(),pt=k.data;let He;e[128]!==n?(He=n("orgs.overview.aiErrorsAriaLabel"),e[128]=n,e[129]=He):He=e[129];let Be;e[130]!==k.data||e[131]!==He?(Be=t.jsx(gt,{data:pt,dataKey:"errors",colorNum:3,chartHeight:"h-[80px] md:h-[120px]",ariaLabel:He}),e[130]=k.data,e[131]=He,e[132]=Be):Be=e[132];let Je;e[133]!==L||e[134]!==k.totalErrors||e[135]!==n?(Je=k.totalErrors===0?t.jsx("div",{className:"flex items-center justify-center h-20 text-sm text-muted-foreground",children:n("orgs.overview.noAiErrors")}):t.jsx(zt,{models:L,mode:"calls"}),e[133]=L,e[134]=k.totalErrors,e[135]=n,e[136]=Je):Je=e[136];let rt;return e[137]!==nt||e[138]!==qe||e[139]!==at||e[140]!==Be||e[141]!==Je?(rt=t.jsxs(nt,{title:qe,value:at,children:[Be,Je]}),e[137]=nt,e[138]=qe,e[139]=at,e[140]=Be,e[141]=Je,e[142]=rt):rt=e[142],t.jsxs("div",{className:"flex flex-col gap-4 px-4 md:px-8 pt-2 pb-6 max-w-[1200px] mx-auto w-full overflow-auto",children:[V,t.jsxs(mt,{title:Y,value:R,children:[t.jsx(gt,{data:E,dataKey:"calls",colorNum:1,chartHeight:"h-[120px] md:h-[180px]",variant:"area",ariaLabel:H}),t.jsx(es,{metrics:q,connections:d,mode:"requests",total:P.totalCalls})]}),ne,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs(mt,{title:ae,value:ce,action:Re,children:[t.jsx(gt,{data:Le,dataKey:$,colorNum:4,chartHeight:"h-[120px] md:h-[180px]",ariaLabel:Oe}),t.jsx(es,{metrics:q,connections:d,mode:"latency",total:P.totalCalls})]}),t.jsxs(mt,{title:we,value:Fe,children:[t.jsx(gt,{data:Ye,dataKey:"errors",colorNum:3,chartHeight:"h-[120px] md:h-[180px]",ariaLabel:Se}),P.totalErrors===0?t.jsx("div",{className:"flex items-center justify-center h-20 text-sm text-muted-foreground",children:n("orgs.overview.noErrors")}):t.jsx(es,{metrics:q,connections:d,mode:"errors",total:P.totalErrors})]})]}),Te,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs(mt,{title:ke,value:ze,children:[t.jsx(gt,{data:Ae,dataKey:"calls",colorNum:1,chartHeight:"h-[80px] md:h-[120px]",ariaLabel:ge}),pe]}),t.jsxs(mt,{title:ye,value:Pe,action:We,children:[t.jsx(gt,{data:ut,dataKey:"totalTokens",colorNum:2,chartHeight:"h-[80px] md:h-[120px]",ariaLabel:Xe}),Ze]}),O?t.jsxs(mt,{title:n("orgs.overview.cost"),value:N>0?xs(N):"—",action:N===0?t.jsx("span",{className:"text-xs text-muted-foreground",children:n("orgs.overview.noCostData")}):void 0,children:[t.jsx(gt,{data:k.data,dataKey:"costUsd",colorNum:5,chartHeight:"h-[80px] md:h-[120px]",ariaLabel:n("orgs.overview.costAriaLabel")}),N>0?t.jsx(zt,{models:L,mode:"cost"}):t.jsx("div",{className:"flex items-center justify-center h-20 text-center text-xs text-muted-foreground px-4",children:n("orgs.overview.costProvidersNotice")})]}):null]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs(mt,{title:et,value:ft,action:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[tt,Zt(k.p95DurationMs)]}),children:[t.jsx(gt,{data:xt,dataKey:"avg",colorNum:4,chartHeight:"h-[80px] md:h-[120px]",ariaLabel:st}),lt]}),rt]})]})}function Zl(s,e){return s+e.outputSize}function er(s,e){return s+e.calls}function Mt(s){const e=ue.c(8),{className:l}=s;let i;e[0]!==l?(i=ot("pt-4 px-4 pb-6 gap-8",l),e[0]=l,e[1]=i):i=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-10 w-14 rounded bg-muted animate-pulse"})]}),t.jsx("div",{className:"h-8 w-[120px] rounded-md bg-muted animate-pulse"})]}),e[2]=m):m=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"h-[180px] w-full rounded bg-muted/60 animate-pulse"}),e[3]=o):o=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=Array.from({length:4}).map(tr),e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsxs("div",{className:"flex flex-col gap-6",children:[o,t.jsxs("div",{className:"flex flex-col",children:[u,t.jsx("div",{className:"flex items-center h-10 px-4 gap-2",children:t.jsx("div",{className:"h-4 w-14 rounded bg-muted animate-pulse"})})]})]}),e[5]=d):d=e[5];let c;return e[6]!==i?(c=t.jsxs(_s,{className:i,children:[m,d]}),e[6]=i,e[7]=c):c=e[7],c}function tr(s,e){return t.jsxs("div",{className:ot("flex items-center h-10 px-3",e<3&&"border-b border-border/50"),children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx("div",{className:"size-6 rounded-md bg-muted animate-pulse shrink-0"}),t.jsx("div",{className:"h-4 w-24 rounded bg-muted animate-pulse"})]}),t.jsxs("div",{className:"flex items-center gap-2 px-3",children:[t.jsx("div",{className:"h-4 w-10 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-4 w-10 rounded bg-muted animate-pulse"})]})]},e)}function sr(){const s=ue.c(4);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Mt,{}),s[0]=e):e=s[0];let l,i;s[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(Mt,{}),t.jsx(Mt,{})]}),i=t.jsx("div",{className:"border-t border-border"}),s[1]=l,s[2]=i):(l=s[1],i=s[2]);let m;return s[3]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"flex flex-col gap-4 px-4 md:px-8 pt-8 md:pt-12 pb-6 max-w-[1200px] mx-auto w-full",children:[e,l,i,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsx(Mt,{}),t.jsx(Mt,{}),t.jsx(Mt,{})]})]}),s[3]=m):m=s[3],m}function lr(s){const e=ue.c(49),{log:l,connection:i,virtualMcpName:m,virtualMcpIcon:o,onClick:u,lastLogRef:d}=s,c=_e();let r,g;if(e[0]!==l.timestamp){const L=new Date(l.timestamp);r=L.toLocaleDateString("en-US",{month:"short",day:"numeric"}),g=L.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[0]=l.timestamp,e[1]=r,e[2]=g}else r=e[1],g=e[2];const h=g,f=i?.icon||null,n=i?.title??l.connectionId;let w;e[3]!==f||e[4]!==n?(w=t.jsx(De,{className:"w-12 md:w-16 px-2 md:px-4",children:t.jsx("div",{className:"flex items-center justify-center",children:t.jsx(Ct,{icon:f,name:n,size:"xs",className:"shadow-edge"})})}),e[3]=f,e[4]=n,e[5]=w):w=e[5];let a;e[6]!==l.toolName?(a=t.jsx("div",{className:"font-medium text-foreground truncate block",children:l.toolName}),e[6]=l.toolName,e[7]=a):a=e[7];const T=i?.title??l.connectionId;let j;e[8]!==T?(j=t.jsx("div",{className:"text-muted-foreground truncate block text-xs",children:T}),e[8]=T,e[9]=j):j=e[9];let y;e[10]!==a||e[11]!==j?(y=t.jsxs(De,{className:"min-w-0 pr-2 md:pr-4",children:[a,j]}),e[10]=a,e[11]=j,e[12]=y):y=e[12];let v;e[13]!==o||e[14]!==m?(v=t.jsx(De,{className:"w-36 md:w-44 px-2 md:px-3 text-muted-foreground",children:m?t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Ct,{icon:o,name:m,size:"xs",fallbackIcon:t.jsx(Ot,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),t.jsx("span",{className:"truncate",children:m})]}):t.jsx("span",{className:"text-muted-foreground/40",children:"—"})}),e[13]=o,e[14]=m,e[15]=v):v=e[15];let p;e[16]!==l.userImage||e[17]!==l.userName?(p=t.jsx(cs,{url:l.userImage,fallback:l.userName,shape:"circle",size:"2xs",className:"shrink-0"}),e[16]=l.userImage,e[17]=l.userName,e[18]=p):p=e[18];let M;e[19]!==l.userName?(M=t.jsx("span",{className:"truncate",children:l.userName}),e[19]=l.userName,e[20]=M):M=e[20];let x;e[21]!==p||e[22]!==M?(x=t.jsx(De,{className:"w-28 md:w-36 px-2 md:px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p,M]})}),e[21]=p,e[22]=M,e[23]=x):x=e[23];let S;e[24]!==r?(S=t.jsx("div",{children:r}),e[24]=r,e[25]=S):S=e[25];let I;e[26]!==h?(I=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:h}),e[26]=h,e[27]=I):I=e[27];let b;e[28]!==S||e[29]!==I?(b=t.jsxs(De,{className:"w-32 md:w-40 px-2 md:px-3 text-muted-foreground",children:[S,I]}),e[28]=S,e[29]=I,e[30]=b):b=e[30];let C;e[31]!==l.durationMs?(C=t.jsxs(De,{className:"w-16 md:w-20 px-2 md:px-3 text-muted-foreground font-mono",children:[l.durationMs,"ms"]}),e[31]=l.durationMs,e[32]=C):C=e[32];const _=l.isError?"destructive":"success";let P;e[33]!==l.isError||e[34]!==c?(P=l.isError?c("monitoring.logRow.statusError"):c("monitoring.logRow.statusOk"),e[33]=l.isError,e[34]=c,e[35]=P):P=e[35];let k;e[36]!==_||e[37]!==P?(k=t.jsx(De,{className:"w-16 md:w-24 px-2 md:px-3 pr-3 md:pr-5",children:t.jsx("div",{className:"flex items-center justify-end",children:t.jsx(Lt,{variant:_,className:"px-1.5 md:px-2 py-0.5 md:py-1",children:P})})}),e[36]=_,e[37]=P,e[38]=k):k=e[38];let D;return e[39]!==d||e[40]!==u||e[41]!==x||e[42]!==b||e[43]!==C||e[44]!==k||e[45]!==w||e[46]!==y||e[47]!==v?(D=t.jsxs(vt,{ref:d,className:"h-14 md:h-16 transition-colors cursor-pointer hover:bg-accent border-b-0",onClick:u,children:[w,y,v,x,b,C,k]}),e[39]=d,e[40]=u,e[41]=x,e[42]=b,e[43]=C,e[44]=k,e[45]=w,e[46]=y,e[47]=v,e[48]=D):D=e[48],D}function rr(s){const e=ue.c(79),{connectionIds:l,virtualMcpIds:i,tool:m,status:o,search:u,logs:d,hasMore:c,onLoadMore:r,isLoadingMore:g,connections:h,virtualMcps:f,membersData:n,client:w}=s,a=_e(),T=h??[],j=f??[],y=Fs(r,c,g),v=ps(n),p=new Map(v.map(nr)),M=new Map(j.map(or));let S=d.map(z=>{const le=p.get(z.userId??""),fe=z.virtualMcpId?M.get(z.virtualMcpId):null;return{...z,userName:le?.name??z.userId??"Unknown",userImage:le?.image??void 0,virtualMcpName:fe?.title??null,virtualMcpIcon:fe?.icon??null}});if(l.length>1){let z;e[0]!==l?(z=le=>l.includes(le.connectionId),e[0]=l,e[1]=z):z=e[1],S=S.filter(z)}if(i.length>1){let z;e[2]!==i?(z=le=>le.virtualMcpId&&i.includes(le.virtualMcpId),e[2]=i,e[3]=z):z=e[3],S=S.filter(z)}const I=new Map(T.map(ir));if(u){const z=u.toLowerCase();S=S.filter(le=>le.toolName.toLowerCase().includes(z)||(I.get(le.connectionId)?.title??le.connectionId).toLowerCase().includes(z)||le.errorMessage?.toLowerCase().includes(z))}const b=Os(S),C=b.selected;let _;e[4]!==C?.id?(_=bt.monitoringLogDetail(C?.id??""),e[4]=C?.id,e[5]=_):_=e[5];let P;e[6]!==w||e[7]!==C?(P=async()=>{if(!w)throw new Error("MCP client is not available");const z=await w.callTool({name:"MONITORING_LOG_GET",arguments:{id:C.id}});return z.structuredContent??z},e[6]=w,e[7]=C,e[8]=P):P=e[8];const k=C!==null;let D;e[9]!==_||e[10]!==P||e[11]!==k?(D={queryKey:_,queryFn:P,enabled:k},e[9]=_,e[10]=P,e[11]=k,e[12]=D):D=e[12];const L=Et(D),U=L.data?.log;let J;e[13]!==U||e[14]!==C?(J=C&&U?{...C,input:U.input,output:U.output}:C,e[13]=U,e[14]=C,e[15]=J):J=e[15];const Q=J;if(S.length===0){let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("img",{src:"/empty-state-logs.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),e[16]=z):z=e[16];let le;e[17]!==a?(le=a("orgs.audit.noLogsFound"),e[17]=a,e[18]=le):le=e[18];let fe;e[19]!==l.length||e[20]!==u||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==i.length?(fe=u||l.length>0||i.length>0||m||o!=="all"?a("orgs.audit.noLogsMatchFilters"):a("orgs.audit.noLogsInTimeRange"),e[19]=l.length,e[20]=u,e[21]=o,e[22]=a,e[23]=m,e[24]=i.length,e[25]=fe):fe=e[25];let ve;return e[26]!==le||e[27]!==fe?(ve=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ht,{image:z,title:le,description:fe})}),e[26]=le,e[27]=fe,e[28]=ve):ve=e[28],ve}const N="flex-1 flex flex-col min-w-0",O="flex-1 min-w-0 pt-1",F="min-w-[600px] md:min-w-0",q=Gt,$="w-full border-collapse";let W;e[29]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx(he,{className:"w-5"}),e[29]=W):W=e[29];let K;e[30]!==a?(K=a("orgs.audit.toolConnection"),e[30]=a,e[31]=K):K=e[31];let B;e[32]!==K?(B=t.jsx(he,{className:"pr-2 md:pr-4 font-normal text-meta",children:K}),e[32]=K,e[33]=B):B=e[33];let V;e[34]!==a?(V=a("orgs.audit.agent"),e[34]=a,e[35]=V):V=e[35];let Y;e[36]!==V?(Y=t.jsx(he,{className:"w-36 md:w-44 px-2 md:px-3 font-normal text-meta",children:V}),e[36]=V,e[37]=Y):Y=e[37];let R;e[38]!==a?(R=a("orgs.audit.user"),e[38]=a,e[39]=R):R=e[39];let E;e[40]!==R?(E=t.jsx(he,{className:"w-28 md:w-36 px-2 md:px-3 font-normal text-meta",children:R}),e[40]=R,e[41]=E):E=e[41];let H;e[42]!==a?(H=a("orgs.audit.date"),e[42]=a,e[43]=H):H=e[43];let A;e[44]!==H?(A=t.jsx(he,{className:"w-32 md:w-40 px-2 md:px-3 font-normal text-meta",children:H}),e[44]=H,e[45]=A):A=e[45];let Z;e[46]!==a?(Z=a("orgs.audit.latency"),e[46]=a,e[47]=Z):Z=e[47];let ee;e[48]!==Z?(ee=t.jsx(he,{className:"w-16 md:w-20 px-2 md:px-3 font-normal text-meta",children:Z}),e[48]=Z,e[49]=ee):ee=e[49];let G;e[50]!==a?(G=a("orgs.audit.status"),e[50]=a,e[51]=G):G=e[51];let de;e[52]!==G?(de=t.jsx(he,{className:"w-16 md:w-24 px-2 md:px-3 font-normal text-meta text-right pr-3 md:pr-5",children:G}),e[52]=G,e[53]=de):de=e[53];let re;e[54]!==B||e[55]!==Y||e[56]!==E||e[57]!==A||e[58]!==ee||e[59]!==de?(re=t.jsx(Qt,{className:"border-b-0 z-20",children:t.jsxs(vt,{className:"h-9 hover:bg-transparent border-b border-border",children:[W,B,Y,E,A,ee,de]})}),e[54]=B,e[55]=Y,e[56]=E,e[57]=A,e[58]=ee,e[59]=de,e[60]=re):re=e[60];const ie=Jt,me=S.map((z,le)=>t.jsx(lr,{log:z,connection:I.get(z.connectionId),virtualMcpName:z.virtualMcpName??"",virtualMcpIcon:z.virtualMcpIcon,onClick:()=>b.select(z.id),lastLogRef:le===S.length-1?y:void 0},z.id));let te;e[61]!==ie||e[62]!==me?(te=t.jsx(ie,{children:me}),e[61]=ie,e[62]=me,e[63]=te):te=e[63];let oe;e[64]!==q||e[65]!==re||e[66]!==te?(oe=t.jsx("div",{className:O,children:t.jsx("div",{className:F,children:t.jsxs(q,{className:$,children:[re,te]})})}),e[64]=q,e[65]=re,e[66]=te,e[67]=oe):oe=e[67];let se;e[68]!==b?(se=z=>{z||b.close()},e[68]=b,e[69]=se):se=e[69];const X=C&&t.jsxs(t.Fragment,{children:[t.jsx(wl,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(Ct,{icon:I.get(C.connectionId)?.icon||null,name:I.get(C.connectionId)?.title??C.connectionId,size:"sm",className:"shadow-sm shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx(Sl,{className:"text-sm leading-snug truncate",children:C.toolName}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:I.get(C.connectionId)?.title??C.connectionId})]})]}),t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[t.jsx(je,{size:"icon-sm",variant:"ghost",onClick:b.prev,disabled:b.index===0,className:"text-muted-foreground","aria-label":a("orgs.audit.previousEntry"),children:t.jsx(ls,{size:14})}),t.jsx(je,{size:"icon-sm",variant:"ghost",onClick:b.next,disabled:b.index===S.length-1,className:"text-muted-foreground","aria-label":a("orgs.audit.nextEntry"),children:t.jsx(ss,{size:14})})]})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:L.isLoading?t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx(Us,{className:"size-5 text-muted-foreground"})}):L.isError?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-3 text-sm text-muted-foreground",children:[t.jsx("p",{children:a("orgs.audit.failedLoadLogDetails")}),t.jsx(je,{variant:"outline",size:"sm",onClick:()=>L.refetch(),children:a("orgs.audit.retry")})]}):t.jsx(Al,{log:Q})})]});let ne;e[70]!==X?(ne=t.jsx(Ls,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:X}),e[70]=X,e[71]=ne):ne=e[71];let ae;e[72]!==b.isOpen||e[73]!==se||e[74]!==ne?(ae=t.jsx(Rs,{open:b.isOpen,onOpenChange:se,children:ne}),e[72]=b.isOpen,e[73]=se,e[74]=ne,e[75]=ae):ae=e[75];let ce;return e[76]!==oe||e[77]!==ae?(ce=t.jsxs("div",{className:N,children:[oe,ae]}),e[76]=oe,e[77]=ae,e[78]=ce):ce=e[78],ce}function ir(s){return[s.id,s]}function or(s){return[s.id,s]}function nr(s){return[s.userId,s.user]}function ar(){const s=ue.c(8);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(he,{className:"w-12 md:w-16 px-2 md:px-4"}),s[0]=e):e=s[0];let l;s[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(he,{className:"pr-2 md:pr-4",children:t.jsx("div",{className:"h-3 w-24 rounded bg-muted animate-pulse"})}),s[1]=l):l=s[1];let i;s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(he,{className:"w-24 md:w-32 px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-12 rounded bg-muted animate-pulse"})}),s[2]=i):i=s[2];let m;s[3]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(he,{className:"w-20 md:w-24 px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-16 rounded bg-muted animate-pulse"})}),s[3]=m):m=s[3];let o;s[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(he,{className:"w-32 md:w-40 px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-10 rounded bg-muted animate-pulse"})}),s[4]=o):o=s[4];let u;s[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(he,{className:"w-16 md:w-20 px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-10 rounded bg-muted animate-pulse ml-auto"})}),s[5]=u):u=s[5];let d;s[6]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Qt,{className:"border-b-0 z-20",children:t.jsxs(vt,{className:"h-9 hover:bg-transparent border-b border-border",children:[e,l,i,m,o,u,t.jsx(he,{className:"w-16 md:w-24 px-2 md:px-3 pr-3 md:pr-5",children:t.jsx("div",{className:"h-3 w-12 rounded bg-muted animate-pulse ml-auto"})})]})}),s[6]=d):d=s[6];let c;return s[7]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:t.jsx("div",{className:"mx-auto w-full max-w-[1200px] px-4 md:px-8 flex flex-col flex-1 min-h-0",children:t.jsxs(Gt,{className:"w-full border-collapse",children:[d,t.jsx(Jt,{children:Array.from({length:8}).map(cr)})]})})}),s[7]=c):c=s[7],c}function cr(s,e){return t.jsxs(vt,{className:"h-14 border-b border-border hover:bg-transparent",children:[t.jsx("td",{className:"px-2 md:px-4",children:t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse"})}),t.jsx("td",{className:"pr-2 md:pr-4",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"h-3.5 w-32 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-2.5 w-20 rounded bg-muted animate-pulse"})]})}),t.jsx("td",{className:"px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-16 rounded bg-muted animate-pulse"})}),t.jsx("td",{className:"px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})}),t.jsx("td",{className:"px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-16 rounded bg-muted animate-pulse"})}),t.jsx("td",{className:"px-2 md:px-3",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-2.5 w-20 rounded bg-muted animate-pulse"})]})}),t.jsx("td",{className:"px-2 md:px-3",children:t.jsx("div",{className:"h-3 w-10 rounded bg-muted animate-pulse ml-auto"})}),t.jsx("td",{className:"px-2 md:px-3 pr-3 md:pr-5",children:t.jsx("div",{className:"h-5 w-14 rounded-full bg-muted animate-pulse ml-auto"})})]},e)}const qt=Object.assign(rr,{Skeleton:ar});function dr(s){const e=ue.c(34),{client:l,locator:i,baseParams:m,pageSize:o,isStreaming:u,streamingRefetchInterval:d,connectionIds:c,virtualMcpIds:r,tool:g,status:h,searchQuery:f,allConnections:n,allVirtualMcps:w,membersData:a}=s;let T;e[0]!==m||e[1]!==i?(T=bt.monitoringLogsInfinite(i,JSON.stringify(m)),e[0]=m,e[1]=i,e[2]=T):T=e[2];let j;e[3]!==m||e[4]!==l||e[5]!==o?(j=async L=>{const{pageParam:U}=L,J=U===void 0?0:U;if(!l)throw new Error("MCP client is not available");const Q=await l.callTool({name:"MONITORING_LOGS_LIST",arguments:{...m,limit:o,offset:J}});return Q.structuredContent??Q},e[3]=m,e[4]=l,e[5]=o,e[6]=j):j=e[6];let y;e[7]!==o?(y=(L,U)=>{if(!((L?.logs?.length??0)<o))return U.length*o},e[7]=o,e[8]=y):y=e[8];const v=u?d:!1;let p;e[9]!==T||e[10]!==j||e[11]!==y||e[12]!==v?(p={queryKey:T,queryFn:j,initialPageParam:0,getNextPageParam:y,staleTime:0,refetchInterval:v},e[9]=T,e[10]=j,e[11]=y,e[12]=v,e[13]=p):p=e[13];const{data:M,fetchNextPage:x,hasNextPage:S,isFetchingNextPage:I}=yl(p);let b;e[14]!==M.pages?(b=M.pages.flatMap(mr),e[14]=M.pages,e[15]=b):b=e[15];const C=b;let _;e[16]!==x||e[17]!==S||e[18]!==I?(_=()=>{S&&!I&&x()},e[16]=x,e[17]=S,e[18]=I,e[19]=_):_=e[19];const P=_,k=S??!1;let D;return e[20]!==n||e[21]!==w||e[22]!==l||e[23]!==c||e[24]!==P||e[25]!==I||e[26]!==a||e[27]!==C||e[28]!==f||e[29]!==h||e[30]!==k||e[31]!==g||e[32]!==r?(D=t.jsx("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:t.jsx("div",{className:"mx-auto w-full max-w-[1200px] px-4 md:px-8 flex flex-col flex-1 min-h-0",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:t.jsx(qt,{connectionIds:c,virtualMcpIds:r,tool:g,status:h,search:f,logs:C,hasMore:k,onLoadMore:P,isLoadingMore:I,connections:n,virtualMcps:w,membersData:a,client:l})})})}),e[20]=n,e[21]=w,e[22]=l,e[23]=c,e[24]=P,e[25]=I,e[26]=a,e[27]=C,e[28]=f,e[29]=h,e[30]=k,e[31]=g,e[32]=r,e[33]=D):D=e[33],D}function mr(s){return s.logs??[]}function ur(s){const e=ue.c(95),{thread:l,usage:i,members:m,connections:o,virtualMcps:u,onClick:d,lastRowRef:c}=s,r=_e(),g=Bt();let h,f;if(e[0]!==o||e[1]!==l||e[2]!==u){const R=jl(l);h=Nl(R,u,o,"—"),f=bl(R,u,o),e[0]=o,e[1]=l,e[2]=u,e[3]=h,e[4]=f}else h=e[3],f=e[4];const n=f;let w;if(e[5]!==m||e[6]!==l.created_by){const R=ps(m);let E;e[8]!==l.created_by?(E=H=>H.userId===l.created_by,e[8]=l.created_by,e[9]=E):E=e[9],w=R.find(E),e[5]=m,e[6]=l.created_by,e[7]=w}else w=e[7];const a=w;let T;e[10]!==a?.user.email||e[11]!==a?.user.name||e[12]!==l.created_by?(T=a?.user.name??a?.user.email??l.created_by?.substring(0,8)??"—",e[10]=a?.user.email,e[11]=a?.user.name,e[12]=l.created_by,e[13]=T):T=e[13];const j=T,y=a?.user.image??void 0;let v,p;if(e[14]!==l.created_at){const R=new Date(l.created_at);v=R.toLocaleDateString("en-US",{month:"short",day:"numeric"}),p=R.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[14]=l.created_at,e[15]=v,e[16]=p}else v=e[15],p=e[16];const M=p;let x,S,I,b,C,_,P,k,D,L,U,J,Q;if(e[17]!==n||e[18]!==h||e[19]!==c||e[20]!==d||e[21]!==r||e[22]!==l.status||e[23]!==l.title||e[24]!==y||e[25]!==j){const R=Cl(l.status),E=R.icon;S=vt,I=c,b="h-14 md:h-16 cursor-pointer hover:bg-accent transition-colors border-b-0",C=d,e[39]!==l.title?(_=t.jsx(De,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:t.jsx("div",{className:"font-medium text-foreground truncate",children:l.title})}),e[39]=l.title,e[40]=_):_=e[40];let H;e[41]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(Ot,{}),e[41]=H):H=e[41];let A;e[42]!==n||e[43]!==h?(A=t.jsx(Ct,{icon:n,name:h,size:"xs",fallbackIcon:H,className:"shrink-0 size-5! min-w-5! rounded-md"}),e[42]=n,e[43]=h,e[44]=A):A=e[44];let Z;e[45]!==h?(Z=t.jsx("span",{className:"truncate",children:h}),e[45]=h,e[46]=Z):Z=e[46],e[47]!==A||e[48]!==Z?(P=t.jsx(De,{className:"w-36 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A,Z]})}),e[47]=A,e[48]=Z,e[49]=P):P=e[49];let ee;e[50]!==y||e[51]!==j?(ee=t.jsx(cs,{url:y,fallback:j,shape:"circle",size:"2xs",className:"shrink-0"}),e[50]=y,e[51]=j,e[52]=ee):ee=e[52];let G;e[53]!==j?(G=t.jsx("span",{className:"truncate",children:j}),e[53]=j,e[54]=G):G=e[54],e[55]!==ee||e[56]!==G?(k=t.jsx(De,{className:"w-28 px-3 text-muted-foreground",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[ee,G]})}),e[55]=ee,e[56]=G,e[57]=k):k=e[57],x=De,Q="w-24 px-3",U="flex items-center gap-1.5",J=t.jsx(E,{size:14,className:R.iconClassName}),D=ot("text-sm",R.labelColor),L=r(R.labelKey),e[17]=n,e[18]=h,e[19]=c,e[20]=d,e[21]=r,e[22]=l.status,e[23]=l.title,e[24]=y,e[25]=j,e[26]=x,e[27]=S,e[28]=I,e[29]=b,e[30]=C,e[31]=_,e[32]=P,e[33]=k,e[34]=D,e[35]=L,e[36]=U,e[37]=J,e[38]=Q}else x=e[26],S=e[27],I=e[28],b=e[29],C=e[30],_=e[31],P=e[32],k=e[33],D=e[34],L=e[35],U=e[36],J=e[37],Q=e[38];let N;e[58]!==D||e[59]!==L?(N=t.jsx("span",{className:D,children:L}),e[58]=D,e[59]=L,e[60]=N):N=e[60];let O;e[61]!==N||e[62]!==U||e[63]!==J?(O=t.jsxs("div",{className:U,children:[J,N]}),e[61]=N,e[62]=U,e[63]=J,e[64]=O):O=e[64];let F;e[65]!==x||e[66]!==O||e[67]!==Q?(F=t.jsx(x,{className:Q,children:O}),e[65]=x,e[66]=O,e[67]=Q,e[68]=F):F=e[68];let q;e[69]!==i?(q=i?Nt(i.totalTokens):"—",e[69]=i,e[70]=q):q=e[70];let $;e[71]!==q?($=t.jsx(De,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:q}),e[71]=q,e[72]=$):$=e[72];let W;e[73]!==g||e[74]!==i?(W=g&&t.jsx(De,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:i&&i.costUsd>0?xs(i.costUsd):"—"}),e[73]=g,e[74]=i,e[75]=W):W=e[75];let K;e[76]!==v?(K=t.jsx("div",{children:v}),e[76]=v,e[77]=K):K=e[77];let B;e[78]!==M?(B=t.jsx("div",{className:"text-xs text-muted-foreground/60",children:M}),e[78]=M,e[79]=B):B=e[79];let V;e[80]!==K||e[81]!==B?(V=t.jsxs(De,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[K,B]}),e[80]=K,e[81]=B,e[82]=V):V=e[82];let Y;return e[83]!==S||e[84]!==I||e[85]!==b||e[86]!==C||e[87]!==_||e[88]!==P||e[89]!==k||e[90]!==F||e[91]!==$||e[92]!==W||e[93]!==V?(Y=t.jsxs(S,{ref:I,className:b,onClick:C,children:[_,P,k,F,$,W,V]}),e[83]=S,e[84]=I,e[85]=b,e[86]=C,e[87]=_,e[88]=P,e[89]=k,e[90]=F,e[91]=$,e[92]=W,e[93]=V,e[94]=Y):Y=e[94],Y}function fr(){const s=ue.c(4),e=_e();let l;s[0]!==e?(l=e("orgs.threads.loading"),s[0]=e,s[1]=l):l=s[1];let i;return s[2]!==l?(i=t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:l})}),s[2]=l,s[3]=i):i=s[3],i}function xr(s){const e=ue.c(9),{hasActiveFilters:l,t:i}=s,m=l?"orgs.threads.noMatchingChats":"orgs.threads.noChatsInTimeRange";let o;e[0]!==i||e[1]!==m?(o=i(m),e[0]=i,e[1]=m,e[2]=o):o=e[2];const u=l?"orgs.threads.tryAdjustingFilters":"orgs.threads.tryExpandingTimeRange";let d;e[3]!==i||e[4]!==u?(d=i(u),e[3]=i,e[4]=u,e[5]=d):d=e[5];let c;return e[6]!==o||e[7]!==d?(c=t.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:t.jsx(Ht,{title:o,description:d})}),e[6]=o,e[7]=d,e[8]=c):c=e[8],c}function pr(){const s=ue.c(4),e=_e();let l;s[0]!==e?(l=e("orgs.threads.loadingMore"),s[0]=e,s[1]=l):l=s[1];let i;return s[2]!==l?(i=t.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:l}),s[2]=l,s[3]=i):i=s[3],i}const is=50;function gr(s){const e=ue.c(25),{client:l,locator:i,membersData:m,allConnections:o,allVirtualMcps:u,dateRange:d,searchQuery:c,filterAgentIds:r,filterUserIds:g,filterStatus:h,filterSource:f}=s,n=_e(),w=Bt(),a=d.startDate.toISOString(),T=d.endDate.toISOString(),j=JSON.stringify({startDate:a,endDate:T,search:c,agentIds:r,userIds:g,status:h,source:f}),{data:y,fetchNextPage:v,hasNextPage:p,isFetchingNextPage:M,isLoading:x}=Il({queryKey:bt.threadsInfinite(i,j),queryFn:async R=>{const{pageParam:E}=R,H=E===void 0?0:E;if(!l)throw new Error("MCP client is not available");const A=await l.callTool({name:"COLLECTION_THREADS_LIST",arguments:{limit:is,offset:H,startDate:a,endDate:T,...c?{search:c}:{},...r&&r.length>0?{agentId:r[0]}:{},...g&&g.length>0?{userId:g[0]}:{},...h&&h!=="all"?{status:h}:{},...f&&f!=="all"?{source:f}:{}}});return A.structuredContent??A},initialPageParam:0,getNextPageParam:br,staleTime:3e4}),S=(y?.pages??[]).flatMap(Nr),I=S.map(jr),{data:b}=Et({queryKey:bt.monitoringThreadUsage(i,JSON.stringify({ids:I,startDate:a,endDate:T})),queryFn:async()=>{if(!l)throw new Error("MCP client is not available");const R=await l.callTool({name:"MONITORING_THREAD_USAGE",arguments:{threadIds:I,startDate:a,endDate:T}});return R.structuredContent??R},enabled:!!l&&I.length>0,staleTime:3e4}),C=new Map((b?.items??[]).map(vr)),[_,P]=xe.useState(null),[k,D]=xe.useState("desc");let L;e[0]!==_?(L=R=>{_===R?D(hr):(P(R),D("desc"))},e[0]=_,e[1]=L):L=e[1];const U=L,J=R=>{const E=C.get(R);return E?_==="cost"?E.costUsd:E.totalTokens:0},Q=_?[...S].sort((R,E)=>{const H=J(R.id),A=J(E.id);return k==="desc"?A-H:H-A}):S,N=Os(Q),O=N.selected;let F;e[2]!==v||e[3]!==p||e[4]!==M?(F=()=>{p&&!M&&v()},e[2]=v,e[3]=p,e[4]=M,e[5]=F):F=e[5];const $=Fs(F,p??!1,M),W=!!c||(r?.length??0)>0||(g?.length??0)>0||!!(h&&h!=="all")||!!(f&&f!=="all");let K;e[6]!==N?(K=R=>{R||N.close()},e[6]=N,e[7]=K):K=e[7];let B;e[8]!==o||e[9]!==u||e[10]!==l||e[11]!==Q||e[12]!==i||e[13]!==m||e[14]!==O||e[15]!==N.index||e[16]!==N.next||e[17]!==N.prev?(B=O&&t.jsx(vl,{thread:O,client:l,locator:i,connections:o,virtualMcps:u,members:m,nav:{index:N.index,total:Q.length,onPrev:N.prev,onNext:N.next}}),e[8]=o,e[9]=u,e[10]=l,e[11]=Q,e[12]=i,e[13]=m,e[14]=O,e[15]=N.index,e[16]=N.next,e[17]=N.prev,e[18]=B):B=e[18];let V;e[19]!==B?(V=t.jsx(Ls,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:B}),e[19]=B,e[20]=V):V=e[20];let Y;return e[21]!==N.isOpen||e[22]!==K||e[23]!==V?(Y=t.jsx(Rs,{open:N.isOpen,onOpenChange:K,children:V}),e[21]=N.isOpen,e[22]=K,e[23]=V,e[24]=Y):Y=e[24],t.jsxs("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:[t.jsx("div",{className:"mx-auto w-full max-w-[1200px] px-4 md:px-8 flex flex-col flex-1 min-h-0",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:t.jsx("div",{className:"flex-1 min-w-0 pt-1",children:t.jsx("div",{className:"min-w-0",children:x?t.jsx(fr,{}):S.length===0?t.jsx(xr,{hasActiveFilters:W,t:n}):t.jsxs(t.Fragment,{children:[t.jsxs(Gt,{className:"w-full border-collapse",children:[t.jsx(Qt,{className:"border-b-0 z-20",children:t.jsxs(vt,{className:"h-9 hover:bg-transparent border-b border-border",children:[t.jsx(he,{className:"pl-4 font-normal text-meta",children:n("orgs.threads.title")}),t.jsx(he,{className:"w-36 px-3 font-normal text-meta",children:n("orgs.threads.agent")}),t.jsx(he,{className:"w-28 px-3 font-normal text-meta",children:n("orgs.threads.user")}),t.jsx(he,{className:"w-24 px-3 font-normal text-meta",children:n("orgs.threads.status")}),t.jsx(he,{className:"w-24 px-3 font-normal text-meta text-right",children:t.jsxs("button",{type:"button",onClick:()=>U("tokens"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors",children:[n("orgs.threads.tokens"),_==="tokens"&&(k==="desc"?t.jsx(ss,{size:12}):t.jsx(ls,{size:12}))]})}),w&&t.jsx(he,{className:"w-24 px-3 font-normal text-meta text-right",children:t.jsxs("button",{type:"button",onClick:()=>U("cost"),className:"inline-flex items-center gap-1 ml-auto hover:text-foreground transition-colors",children:[n("orgs.threads.cost"),_==="cost"&&(k==="desc"?t.jsx(ss,{size:12}):t.jsx(ls,{size:12}))]})}),t.jsx(he,{className:"w-32 px-3 pr-5 font-normal text-meta",children:n("orgs.threads.date")})]})}),t.jsx(Jt,{children:Q.map((R,E)=>t.jsx(ur,{thread:R,usage:C.get(R.id),members:m,connections:o,virtualMcps:u,onClick:()=>N.select(R.id),lastRowRef:E===Q.length-1?$:void 0},R.id))})]}),M&&t.jsx(pr,{})]})})})})}),Y]})}function hr(s){return s==="desc"?"asc":"desc"}function vr(s){return[s.threadId,{calls:s.calls,inputTokens:s.inputTokens,outputTokens:s.outputTokens,totalTokens:s.totalTokens,costUsd:s.costUsd}]}function jr(s){return s.id}function Nr(s){return s.items??[]}function br(s,e){const l=s,i=e;if(!((l?.items?.length??0)<is))return i.length*is}function yr(s){const e=ue.c(123),{filterAgentIds:l,filterUserIds:i,filterStatus:m,filterSource:o,virtualMcpOptions:u,memberOptions:d,activeFiltersCount:c,onUpdateFilters:r}=s,[g,h]=xe.useState(!1),f=_e();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(fs,{size:16}),e[0]=n):n=e[0];let w;e[1]!==f?(w=f("orgs.threadsFiltersPopover.filters"),e[1]=f,e[2]=w):w=e[2];let a;e[3]!==w?(a=t.jsx("span",{className:"hidden sm:inline",children:w}),e[3]=w,e[4]=a):a=e[4];let T;e[5]!==c?(T=c>0&&t.jsxs(t.Fragment,{children:[t.jsx(Lt,{variant:"default",size:"sm",className:"sm:hidden absolute -top-1.5 -right-1.5 min-w-4 leading-none",children:c}),t.jsx(Lt,{variant:"default",size:"icon",className:"hidden sm:flex ml-1",children:c})]}),e[5]=c,e[6]=T):T=e[6];let j;e[7]!==a||e[8]!==T?(j=t.jsx(ms,{asChild:!0,children:t.jsxs(je,{variant:"outline",className:"relative",children:[n,a,T]})}),e[7]=a,e[8]=T,e[9]=j):j=e[9];let y;e[10]!==f?(y=f("orgs.threadsFiltersPopover.filterChats"),e[10]=f,e[11]=y):y=e[11];let v;e[12]!==y?(v=t.jsx("h4",{className:"font-medium text-sm",children:y}),e[12]=y,e[13]=v):v=e[13];let p;e[14]!==f?(p=f("orgs.threadsFiltersPopover.agent"),e[14]=f,e[15]=p):p=e[15];let M;e[16]!==p?(M=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:p}),e[16]=p,e[17]=M):M=e[17];let x;e[18]!==r?(x=ce=>r({filterAgentIds:ce.slice(0,1)}),e[18]=r,e[19]=x):x=e[19];let S;e[20]!==f?(S=f("orgs.threadsFiltersPopover.allAgents"),e[20]=f,e[21]=S):S=e[21];let I;e[22]!==l||e[23]!==x||e[24]!==S||e[25]!==u?(I=t.jsx($t,{options:u,defaultValue:l,onValueChange:x,placeholder:S,className:"w-full",maxCount:1}),e[22]=l,e[23]=x,e[24]=S,e[25]=u,e[26]=I):I=e[26];let b;e[27]!==I||e[28]!==M?(b=t.jsxs("div",{children:[M,I]}),e[27]=I,e[28]=M,e[29]=b):b=e[29];let C;e[30]!==f?(C=f("orgs.threadsFiltersPopover.user"),e[30]=f,e[31]=C):C=e[31];let _;e[32]!==C?(_=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:C}),e[32]=C,e[33]=_):_=e[33];let P;e[34]!==r?(P=ce=>r({filterUserIds:ce.slice(0,1)}),e[34]=r,e[35]=P):P=e[35];let k;e[36]!==f?(k=f("orgs.threadsFiltersPopover.allUsers"),e[36]=f,e[37]=k):k=e[37];let D;e[38]!==i||e[39]!==d||e[40]!==P||e[41]!==k?(D=t.jsx($t,{options:d,defaultValue:i,onValueChange:P,placeholder:k,className:"w-full",maxCount:1}),e[38]=i,e[39]=d,e[40]=P,e[41]=k,e[42]=D):D=e[42];let L;e[43]!==_||e[44]!==D?(L=t.jsxs("div",{children:[_,D]}),e[43]=_,e[44]=D,e[45]=L):L=e[45];let U;e[46]!==f?(U=f("orgs.threadsFiltersPopover.status"),e[46]=f,e[47]=U):U=e[47];let J;e[48]!==U?(J=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:U}),e[48]=U,e[49]=J):J=e[49];let Q;e[50]!==r?(Q=ce=>r({filterStatus:ce}),e[50]=r,e[51]=Q):Q=e[51];let N;e[52]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(yt,{className:"w-full",children:t.jsx(wt,{})}),e[52]=N):N=e[52];let O;e[53]!==f?(O=f("orgs.threadsFiltersPopover.allStatuses"),e[53]=f,e[54]=O):O=e[54];let F;e[55]!==O?(F=t.jsx($e,{value:"all",children:O}),e[55]=O,e[56]=F):F=e[56];let q;e[57]!==f?(q=f("orgs.threadsFiltersPopover.completed"),e[57]=f,e[58]=q):q=e[58];let $;e[59]!==q?($=t.jsx($e,{value:"completed",children:q}),e[59]=q,e[60]=$):$=e[60];let W;e[61]!==f?(W=f("orgs.threadsFiltersPopover.active"),e[61]=f,e[62]=W):W=e[62];let K;e[63]!==W?(K=t.jsx($e,{value:"active",children:W}),e[63]=W,e[64]=K):K=e[64];let B;e[65]!==f?(B=f("orgs.threadsFiltersPopover.failed"),e[65]=f,e[66]=B):B=e[66];let V;e[67]!==B?(V=t.jsx($e,{value:"failed",children:B}),e[67]=B,e[68]=V):V=e[68];let Y;e[69]!==F||e[70]!==$||e[71]!==K||e[72]!==V?(Y=t.jsxs(St,{children:[F,$,K,V]}),e[69]=F,e[70]=$,e[71]=K,e[72]=V,e[73]=Y):Y=e[73];let R;e[74]!==m||e[75]!==Q||e[76]!==Y?(R=t.jsxs(It,{value:m,onValueChange:Q,children:[N,Y]}),e[74]=m,e[75]=Q,e[76]=Y,e[77]=R):R=e[77];let E;e[78]!==J||e[79]!==R?(E=t.jsxs("div",{children:[J,R]}),e[78]=J,e[79]=R,e[80]=E):E=e[80];let H;e[81]!==f?(H=f("orgs.threadsFiltersPopover.source"),e[81]=f,e[82]=H):H=e[82];let A;e[83]!==H?(A=t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:H}),e[83]=H,e[84]=A):A=e[84];let Z;e[85]!==r?(Z=ce=>r({filterSource:ce}),e[85]=r,e[86]=Z):Z=e[86];let ee;e[87]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(yt,{className:"w-full",children:t.jsx(wt,{})}),e[87]=ee):ee=e[87];let G;e[88]!==f?(G=f("orgs.threadsFiltersPopover.allSources"),e[88]=f,e[89]=G):G=e[89];let de;e[90]!==G?(de=t.jsx($e,{value:"all",children:G}),e[90]=G,e[91]=de):de=e[91];let re;e[92]!==f?(re=f("orgs.threadsFiltersPopover.sourceJira"),e[92]=f,e[93]=re):re=e[93];let ie;e[94]!==re?(ie=t.jsx($e,{value:"jira",children:re}),e[94]=re,e[95]=ie):ie=e[95];let me;e[96]!==de||e[97]!==ie?(me=t.jsxs(St,{children:[de,ie]}),e[96]=de,e[97]=ie,e[98]=me):me=e[98];let te;e[99]!==o||e[100]!==Z||e[101]!==me?(te=t.jsxs(It,{value:o,onValueChange:Z,children:[ee,me]}),e[99]=o,e[100]=Z,e[101]=me,e[102]=te):te=e[102];let oe;e[103]!==A||e[104]!==te?(oe=t.jsxs("div",{children:[A,te]}),e[103]=A,e[104]=te,e[105]=oe):oe=e[105];let se;e[106]!==b||e[107]!==L||e[108]!==E||e[109]!==oe?(se=t.jsxs("div",{className:"space-y-3",children:[b,L,E,oe]}),e[106]=b,e[107]=L,e[108]=E,e[109]=oe,e[110]=se):se=e[110];let X;e[111]!==c||e[112]!==r||e[113]!==f?(X=c>0&&t.jsx(je,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{r({filterAgentIds:[],filterUserIds:[],filterStatus:"all",filterSource:"all"}),h(!1)},children:f("orgs.threadsFiltersPopover.clearAllFilters")}),e[111]=c,e[112]=r,e[113]=f,e[114]=X):X=e[114];let ne;e[115]!==se||e[116]!==X||e[117]!==v?(ne=t.jsx(us,{align:"end",className:"w-[280px]",children:t.jsxs("div",{className:"space-y-4",children:[v,se,X]})}),e[115]=se,e[116]=X,e[117]=v,e[118]=ne):ne=e[118];let ae;return e[119]!==g||e[120]!==ne||e[121]!==j?(ae=t.jsxs(ds,{open:g,onOpenChange:h,children:[j,ne]}),e[119]=g,e[120]=ne,e[121]=j,e[122]=ae):ae=e[122],ae}function wr(s){const e=ue.c(16),{dateRange:l}=s,i=_e(),{data:m,isLoading:o}=Tl(void 0);let u;e[0]!==m?(u=m===void 0?[]:m,e[0]=m,e[1]=u):u=e[1];const d=u,[c,r]=xe.useState(null),g=c??d[0]?.id??null,{data:h}=kl(g??"");let f;e[2]!==l.startDate?(f=l.startDate.toISOString(),e[2]=l.startDate,e[3]=f):f=e[3];let n;e[4]!==l.endDate?(n=l.endDate.toISOString(),e[4]=l.endDate,e[5]=n):n=e[5];let w;e[6]!==f||e[7]!==n?(w={startDate:f,endDate:n},e[6]=f,e[7]=n,e[8]=w):w=e[8];const a=w;let T;return e[9]!==h||e[10]!==d||e[11]!==g||e[12]!==o||e[13]!==a||e[14]!==i?(T=t.jsx("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:t.jsx("div",{className:"mx-auto w-full max-w-[1200px] px-4 md:px-8 flex flex-col flex-1 min-h-0 gap-5 pt-1",children:o?t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:i("orgs.automations.loading")}):d.length===0?t.jsx("div",{className:"py-16",children:t.jsx(Ht,{title:i("orgs.automations.emptyTitle"),description:i("orgs.automations.emptyDescription")})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(It,{value:g??"",onValueChange:j=>r(j),children:[t.jsx(yt,{variant:"pill",size:"sm",className:"w-72",children:t.jsx(wt,{placeholder:i("orgs.automations.selectPlaceholder")})}),t.jsx(St,{children:d.map(Ir)})]})}),h?t.jsx(Ml,{automationId:h.id,triggerIds:h.triggers.map(Sr),range:a}):t.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:i("orgs.automations.loading")})]})})}),e[9]=h,e[10]=d,e[11]=g,e[12]=o,e[13]=a,e[14]=i,e[15]=T):T=e[15],T}function Sr(s){return s.id}function Ir(s){return t.jsx($e,{value:s.id,children:s.name},s.id)}function Cr(s){const e=ue.c(12),{store:l,onSelect:i}=s,m=_e();let o;e[0]!==i?(o=r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),i())},e[0]=i,e[1]=o):o=e[1];let u;e[2]!==l.title?(u=t.jsx(De,{className:"font-medium text-foreground",children:l.title}),e[2]=l.title,e[3]=u):u=e[3];let d;e[4]!==l.rules||e[5]!==m?(d=zs.map(r=>{const g=l.rules.find(h=>h.rule===r);return t.jsx(De,{children:g?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ll,{status:g.status}),t.jsx("span",{className:"text-xs text-muted-foreground",children:m("orderMonitor.since",{ago:Vs(new Date(g.since))})})]}),t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:m("orderMonitor.observedOfExpected",{observed:g.verdict.observed,expected:Math.round(g.verdict.expected)})})]}):t.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})},r)}),e[4]=l.rules,e[5]=m,e[6]=d):d=e[6];let c;return e[7]!==i||e[8]!==o||e[9]!==u||e[10]!==d?(c=t.jsxs(vt,{className:"cursor-pointer",role:"button",tabIndex:0,onClick:i,onKeyDown:o,children:[u,d]}),e[7]=i,e[8]=o,e[9]=u,e[10]=d,e[11]=c):c=e[11],c}function Tr(s){const e=ue.c(61),{orgSlug:l,store:i,at:m,onSelect:o}=s,u=_e(),d=Pl(l,!0);let c;e[0]!==d.data?(c=d.data??[],e[0]=d.data,e[1]=c):c=e[1];const r=c;if(d.isLoading){let v;return e[2]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Ks,{className:"m-4 h-40"}),e[2]=v):v=e[2],v}if(d.error){let v;e[3]!==u?(v=u("orderMonitor.storesErrorTitle"),e[3]=u,e[4]=v):v=e[4];let p;return e[5]!==d.error.message||e[6]!==v?(p=t.jsx(Is,{title:v,description:d.error.message}),e[5]=d.error.message,e[6]=v,e[7]=p):p=e[7],p}let g;e[8]!==i||e[9]!==r?(g=i?r.find(v=>v.connectionId===i):void 0,e[8]=i,e[9]=r,e[10]=g):g=e[10];const h=g;if(i){let v;e[11]!==o?(v=()=>o({}),e[11]=o,e[12]=v):v=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(_l,{className:"size-4"}),e[13]=p):p=e[13];let M;e[14]!==u?(M=u("orderMonitor.allStores"),e[14]=u,e[15]=M):M=e[15];let x;e[16]!==v||e[17]!==M?(x=t.jsxs(je,{variant:"ghost",size:"sm",onClick:v,className:"gap-1",children:[p,M]}),e[16]=v,e[17]=M,e[18]=x):x=e[18];const S=h?.title??i;let I;e[19]!==S?(I=t.jsx("h2",{className:"text-base font-semibold text-foreground",children:S}),e[19]=S,e[20]=I):I=e[20];let b;e[21]!==x||e[22]!==I?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[x,I]}),e[21]=x,e[22]=I,e[23]=b):b=e[23];let C;e[24]!==o||e[25]!==i?(C=k=>o({store:i,at:k}),e[24]=o,e[25]=i,e[26]=C):C=e[26];let _;e[27]!==m||e[28]!==l||e[29]!==i||e[30]!==C?(_=t.jsx(Rl,{orgSlug:l,connectionId:i,at:m,onAtChange:C}),e[27]=m,e[28]=l,e[29]=i,e[30]=C,e[31]=_):_=e[31];let P;return e[32]!==_||e[33]!==b?(P=t.jsxs("div",{className:"mx-auto flex w-full max-w-[1200px] flex-col gap-4 px-4 pt-1 pb-6 md:px-10",children:[b,_]}),e[32]=_,e[33]=b,e[34]=P):P=e[34],P}if(r.length===0){let v;e[35]!==u?(v=u("orderMonitor.noStoresTitle"),e[35]=u,e[36]=v):v=e[36];let p;e[37]!==u?(p=u("orderMonitor.noStoresBody"),e[37]=u,e[38]=p):p=e[38];let M;return e[39]!==v||e[40]!==p?(M=t.jsx(Is,{title:v,description:p}),e[39]=v,e[40]=p,e[41]=M):M=e[41],M}let f;e[42]!==u?(f=u("orderMonitor.store"),e[42]=u,e[43]=f):f=e[43];let n;e[44]!==f?(n=t.jsx(he,{children:f}),e[44]=f,e[45]=n):n=e[45];let w;e[46]!==u?(w=zs.map(v=>t.jsx(he,{children:Dl(v,u)},v)),e[46]=u,e[47]=w):w=e[47];let a;e[48]!==n||e[49]!==w?(a=t.jsx(Qt,{children:t.jsxs(vt,{children:[n,w]})}),e[48]=n,e[49]=w,e[50]=a):a=e[50];let T;if(e[51]!==o||e[52]!==r){let v;e[54]!==o?(v=p=>t.jsx(Cr,{store:p,onSelect:()=>o({store:p.connectionId})},p.connectionId),e[54]=o,e[55]=v):v=e[55],T=r.map(v),e[51]=o,e[52]=r,e[53]=T}else T=e[53];let j;e[56]!==T?(j=t.jsx(Jt,{children:T}),e[56]=T,e[57]=j):j=e[57];let y;return e[58]!==a||e[59]!==j?(y=t.jsx("div",{className:"mx-auto w-full max-w-[1200px] overflow-auto px-4 pt-1 pb-6 md:px-10",children:t.jsxs(Gt,{children:[a,j]})}),e[58]=a,e[59]=j,e[60]=y):y=e[60],y}const kr=[];function gs(){const s=ue.c(25),e=_e(),l=Bs();let i;s[0]!==e?(i=e("orgs.monitoring.chats"),s[0]=e,s[1]=i):i=s[1];let m;s[2]!==i?(m={id:"threads",label:i},s[2]=i,s[3]=m):m=s[3];let o;s[4]!==e?(o=e("orgs.monitoring.overview"),s[4]=e,s[5]=o):o=s[5];let u;s[6]!==o?(u={id:"overview",label:o},s[6]=o,s[7]=u):u=s[7];let d;s[8]!==e?(d=e("orgs.monitoring.audit"),s[8]=e,s[9]=d):d=s[9];let c;s[10]!==d?(c={id:"audit",label:d},s[10]=d,s[11]=c):c=s[11];let r;s[12]!==e?(r=e("orgs.monitoring.automations"),s[12]=e,s[13]=r):r=s[13];let g;s[14]!==r?(g={id:"automations",label:r},s[14]=r,s[15]=g):g=s[15];let h;s[16]!==l.orderMonitorEnabled||s[17]!==e?(h=l.orderMonitorEnabled===!0?[{id:"stores",label:e("orderMonitor.storesTab")}]:[],s[16]=l.orderMonitorEnabled,s[17]=e,s[18]=h):h=s[18];let f;return s[19]!==m||s[20]!==u||s[21]!==c||s[22]!==g||s[23]!==h?(f=[m,u,c,g,...h],s[19]=m,s[20]=u,s[21]=c,s[22]=g,s[23]=h,s[24]=f):f=s[24],f}function os(s){const e=ue.c(10),{tab:l}=s,{org:i}=ht(),m=gs();let o;e[0]!==l||e[1]!==m?(o=m.find(g=>g.id===l)??m.find(Mr),e[0]=l,e[1]=m,e[2]=o):o=e[2];const u=o;let d;e[3]!==i.slug?(d={link:{to:"/$org/settings/monitor",params:{org:i.slug}}},e[3]=i.slug,e[4]=d):d=e[4];let c;e[5]!==u?(c=u?[{key:"monitor-tab",label:u.label}]:[],e[5]=u,e[6]=c):c=e[6];let r;return e[7]!==d||e[8]!==c?(r=t.jsx(_t.Breadcrumbs,{after:"page",parent:d,items:c}),e[7]=d,e[8]=c,e[9]=r):r=e[9],r}function Mr(s){return s.id==="overview"}const _r=[{value:"eq",labelKey:"orgs.monitoring.operatorEquals"},{value:"contains",labelKey:"orgs.monitoring.operatorContains"},{value:"in",labelKey:"orgs.monitoring.operatorIn"},{value:"exists",labelKey:"orgs.monitoring.operatorExists"}];function Pr({connectionIds:s,virtualMcpIds:e,tool:l,status:i,hideSystem:m,propertyFilters:o,connectionOptions:u,virtualMcpOptions:d,activeFiltersCount:c,onUpdateFilters:r,onConnectionSearchChange:g,memberOptions:h,llmUserIds:f=kr,onLlmUserIdsChange:n,showMemberFilter:w}){const a=_e(),[T,j]=xe.useState(!1),[y,v]=xe.useState("form"),[p,M]=xe.useState(l),[x,S]=xe.useState(o),[I,b]=xe.useState(Vt(o)),C=xe.useRef(l),_=xe.useRef(jt(o));C.current!==l&&(C.current=l,p!==l&&M(l));const P=jt(o);_.current!==P&&(_.current=P,S(o),b(Vt(o)));const k=(N,O)=>{const F=[...x],q=F[N];q&&(F[N]={key:O.key??q.key,operator:O.operator??q.operator,value:O.value??q.value},S(F))},D=()=>{S([...x,{key:"",operator:"eq",value:""}])},L=N=>{const O=x.filter((F,q)=>q!==N);S(O),b(Vt(O)),r({propertyFilters:jt(O)})},U=()=>{r({propertyFilters:jt(x)})},J=()=>{const N=Cs(I);S(N),r({propertyFilters:jt(N)})},Q=()=>{if(y==="raw"){const N=Cs(I);S(N),v("form")}else b(Vt(x)),v("raw")};return t.jsxs(ds,{open:T,onOpenChange:j,children:[t.jsx(ms,{asChild:!0,children:t.jsxs(je,{variant:"outline",className:"relative",children:[t.jsx(fs,{size:16}),t.jsx("span",{className:"hidden sm:inline",children:a("orgs.monitoring.filters")}),c>0&&t.jsxs(t.Fragment,{children:[t.jsx(Lt,{variant:"default",size:"sm",className:"sm:hidden absolute -top-1.5 -right-1.5 min-w-4 leading-none",children:c}),t.jsx(Lt,{variant:"default",size:"icon",className:"hidden sm:flex ml-1",children:c})]})]})}),t.jsx(us,{align:"end",className:"w-[320px]",children:t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{children:t.jsx("h4",{className:"font-medium text-sm mb-3",children:a("orgs.monitoring.filterLogs")})}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ml,{htmlFor:"hide-system-calls",className:"text-xs font-medium text-muted-foreground cursor-pointer",children:a("orgs.monitoring.hideSystemCalls")}),t.jsx(dl,{id:"hide-system-calls",checked:m,onCheckedChange:N=>r({hideSystem:!!N})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:a("orgs.monitoring.connections")}),t.jsx($t,{options:u,defaultValue:s,onValueChange:N=>r({connectionId:N}),onSearchChange:g,placeholder:a("orgs.monitoring.allServers"),className:"w-full",maxCount:2})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:a("orgs.monitoring.agents")}),t.jsx($t,{options:d,defaultValue:e,onValueChange:N=>r({virtualMcpId:N}),placeholder:a("orgs.monitoring.allAgents"),className:"w-full",maxCount:2})]}),w&&t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:a("orgs.monitoring.members")}),t.jsx($t,{options:h??[],defaultValue:f,onValueChange:N=>n?.(N),placeholder:a("orgs.monitoring.allMembers"),className:"w-full",maxCount:2}),t.jsx("p",{className:"text-2xs text-muted-foreground mt-1",children:a("orgs.monitoring.filtersAiUsageOnly")})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:a("orgs.monitoring.toolName")}),t.jsx(Xt,{id:"filter-tool",placeholder:a("orgs.monitoring.filterByToolPlaceholder"),value:p,onChange:N=>M(N.target.value),onBlur:()=>{p!==l&&r({tool:p})},onKeyDown:N=>{N.key==="Enter"&&p!==l&&r({tool:p})},className:"w-full"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1.5 block",children:a("orgs.monitoring.status")}),t.jsxs(It,{value:i,onValueChange:N=>r({status:N}),children:[t.jsx(yt,{className:"w-full",children:t.jsx(wt,{})}),t.jsxs(St,{children:[t.jsx($e,{value:"all",children:a("orgs.monitoring.allStatus")}),t.jsx($e,{value:"success",children:a("orgs.monitoring.successOnly")}),t.jsx($e,{value:"errors",children:a("orgs.monitoring.errorsOnly")})]})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:a("orgs.monitoring.propertyFilters")}),t.jsxs(Pt,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx(je,{variant:"ghost",size:"icon-xs",onClick:Q,children:y==="raw"?t.jsx(il,{size:14}):t.jsx(el,{size:14})})}),t.jsx(Rt,{children:a(y==="raw"?"orgs.monitoring.switchToFormView":"orgs.monitoring.switchToRawText")})]})]}),y==="raw"?t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(cl,{placeholder:a("orgs.monitoring.pastePropertyFiltersPlaceholder"),value:I,onChange:N=>b(N.target.value),onBlur:J,onKeyDown:N=>{N.key==="Enter"&&N.metaKey&&J()},className:"font-mono text-sm min-h-[80px] resize-none"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[a("orgs.monitoring.onePerLine")," ",t.jsx("code",{className:"bg-muted px-1 rounded",children:"key=value"})," ",t.jsx("code",{className:"bg-muted px-1 rounded",children:"key~contains"})," ",t.jsx("code",{className:"bg-muted px-1 rounded",children:"key@in_list"})," ",t.jsx("code",{className:"bg-muted px-1 rounded",children:"key?"})]})]}):t.jsxs("div",{className:"space-y-3",children:[x.map((N,O)=>t.jsxs("div",{className:"p-2.5 rounded-md border border-border bg-muted/30 space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:a("orgs.monitoring.filter",{number:(O+1).toString()})}),t.jsx(je,{variant:"ghost-destructive",size:"icon-xs",onClick:()=>L(O),children:t.jsx(nl,{size:12})})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(Xt,{placeholder:a("orgs.monitoring.keyPlaceholder"),value:N.key,onChange:F=>k(O,{key:F.target.value}),onBlur:U,onKeyDown:F=>{F.key==="Enter"&&U()},className:"flex-1 font-mono text-sm"}),t.jsxs(It,{value:N.operator,onValueChange:F=>{const q=[...x],$=q[O];$&&(q[O]={...$,operator:F,value:F==="exists"?"":$.value},S(q),r({propertyFilters:jt(q)}))},children:[t.jsx(yt,{className:"w-28",children:t.jsx(wt,{})}),t.jsx(St,{children:_r.map(F=>t.jsx($e,{value:F.value,children:a(F.labelKey)},F.value))})]})]}),N.operator!=="exists"&&t.jsx(Xt,{placeholder:a("orgs.monitoring.valuePlaceholder"),value:N.value,onChange:F=>k(O,{value:F.target.value}),onBlur:U,onKeyDown:F=>{F.key==="Enter"&&U()},className:"w-full font-mono text-sm"})]},O)),t.jsxs(je,{variant:"outline",size:"sm",className:"w-full",onClick:D,children:[t.jsx(ol,{size:14,className:"mr-1.5"}),a("orgs.monitoring.addFilter")]})]})]})]}),c>0&&t.jsx(je,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>{M(""),S([]),b(""),r({connectionId:[],virtualMcpId:[],tool:"",status:"all",propertyFilters:""}),j(!1)},children:a("orgs.monitoring.clearAllFilters")})]})})]})}function Dr(s){const e=ue.c(195),{tab:l,dateRange:i,displayDateRange:m,connectionIds:o,virtualMcpIds:u,tool:d,status:c,search:r,streaming:g,hideSystem:h,activeFiltersCount:f,from:n,to:w,propertyFilters:a,store:T,at:j,onUpdateFilters:y,onTimeRangeChange:v,onStreamingToggle:p,onTabChange:M}=s,x=_e(),S=ts(),I=rl(),{data:b}=Js(),[C,_]=xe.useState(""),k=xe.useDeferredValue(C)||void 0;let D;e[0]!==k?(D={searchTerm:k},e[0]=k,e[1]=D):D=e[1];const L=ts(D);let U;e[2]!==L?(U=L??[],e[2]=L,e[3]=U):U=e[3];let J;e[4]!==U?(J=U.map(Or),e[4]=U,e[5]=J):J=e[5];const Q=J;let N;e[6]!==I?(N=I.map(Lr),e[6]=I,e[7]=N):N=e[7];const O=N,{pageSize:F,streamingRefetchInterval:q}=rs,{org:$,locator:W}=ht();let K;e[8]!==$.id||e[9]!==$.slug?(K={connectionId:Gs,orgId:$.id,orgSlug:$.slug},e[8]=$.id,e[9]=$.slug,e[10]=K):K=e[10];const B=ll(K);let V;e[11]!==a?(V=El(a),e[11]=a,e[12]=V):V=e[12];const Y=V;let R;e[13]!==h||e[14]!==$.id?(R=h?[Qs.SELF($.id)]:void 0,e[13]=h,e[14]=$.id,e[15]=R):R=e[15];const E=R;let H;e[16]===Symbol.for("react.memo_cache_sentinel")?(H=[],e[16]=H):H=e[16];const[A,Z]=xe.useState(H);let ee;e[17]===Symbol.for("react.memo_cache_sentinel")?(ee=[],e[17]=ee):ee=e[17];const[G,de]=xe.useState(ee);let re;e[18]===Symbol.for("react.memo_cache_sentinel")?(re=[],e[18]=re):re=e[18];const[ie,me]=xe.useState(re),[te,oe]=xe.useState("all"),[se,X]=xe.useState("all"),ne=(G.length>0?1:0)+(ie.length>0?1:0)+(te!=="all"?1:0)+(se!=="all"?1:0);let ae;e[19]!==b?(ae=ps(b).map(Rr),e[19]=b,e[20]=ae):ae=e[20];const ce=ae;let z;e[21]!==i.startDate?(z=i.startDate.toISOString(),e[21]=i.startDate,e[22]=z):z=e[22];let le;e[23]!==i.endDate?(le=i.endDate.toISOString(),e[23]=i.endDate,e[24]=le):le=e[24];const fe=o.length===1?o[0]:void 0,ve=u.length===1?u[0]:void 0,Ge=d||void 0,Qe=c==="errors"?!0:c==="success"?!1:void 0;let Ee;e[25]!==E||e[26]!==Y||e[27]!==z||e[28]!==le||e[29]!==fe||e[30]!==ve||e[31]!==Ge||e[32]!==Qe?(Ee={startDate:z,endDate:le,connectionId:fe,excludeConnectionIds:E,virtualMcpId:ve,toolName:Ge,isError:Qe,...Y},e[25]=E,e[26]=Y,e[27]=z,e[28]=le,e[29]=fe,e[30]=ve,e[31]=Ge,e[32]=Qe,e[33]=Ee):Ee=e[33];const Re=Ee,Le=gs();let Oe;e[34]!==l?(Oe=t.jsx(os,{tab:l}),e[34]=l,e[35]=Oe):Oe=e[35];let we;e[36]!==M||e[37]!==Le?(we=it=>{const Ft=Le.find(Ut=>Ut.id===it);Ft&&M(Ft.id)},e[36]=M,e[37]=Le,e[38]=we):we=e[38];let Fe;e[39]!==we||e[40]!==l||e[41]!==Le?(Fe=t.jsx(Ds,{placement:"page",tabs:Le,activeTab:l,onTabChange:we}),e[39]=we,e[40]=l,e[41]=Le,e[42]=Fe):Fe=e[42];const Ye=l==="stores"&&"hidden";let Se;e[43]!==Ye?(Se=ot("flex items-center gap-2",Ye),e[43]=Ye,e[44]=Se):Se=e[44];let Ie;e[45]!==f||e[46]!==o||e[47]!==Q||e[48]!==C||e[49]!==h||e[50]!==g||e[51]!==A||e[52]!==ce||e[53]!==p||e[54]!==y||e[55]!==a||e[56]!==c||e[57]!==x||e[58]!==l||e[59]!==d||e[60]!==u||e[61]!==O?(Ie=(l==="overview"||l==="audit")&&t.jsxs(t.Fragment,{children:[t.jsxs(je,{variant:g?"secondary":"outline",className:"gap-1.5",onClick:p,children:[g&&t.jsx("span",{className:"size-2 rounded-full bg-success animate-pulse"}),t.jsx("span",{children:x("orgs.monitoring.live")}),g&&t.jsx("span",{className:"text-muted-foreground text-xs",children:"3s"})]}),t.jsx(Pr,{connectionIds:o,virtualMcpIds:u,tool:d,status:c,hideSystem:h,propertyFilters:a,connectionOptions:Q,virtualMcpOptions:O,activeFiltersCount:f,onUpdateFilters:y,connectionSearchTerm:C,onConnectionSearchChange:_,memberOptions:ce,llmUserIds:A,onLlmUserIdsChange:Z,showMemberFilter:l==="overview"})]}),e[45]=f,e[46]=o,e[47]=Q,e[48]=C,e[49]=h,e[50]=g,e[51]=A,e[52]=ce,e[53]=p,e[54]=y,e[55]=a,e[56]=c,e[57]=x,e[58]=l,e[59]=d,e[60]=u,e[61]=O,e[62]=Ie):Ie=e[62];let Ne;e[63]!==ce||e[64]!==l||e[65]!==ne||e[66]!==G||e[67]!==se||e[68]!==te||e[69]!==ie||e[70]!==O?(Ne=l==="threads"&&t.jsx(yr,{filterAgentIds:G,filterUserIds:ie,filterStatus:te,filterSource:se,virtualMcpOptions:O,memberOptions:ce,activeFiltersCount:ne,onUpdateFilters:it=>{const{filterAgentIds:Ft,filterUserIds:Ut,filterStatus:hs,filterSource:vs}=it;Ft!==void 0&&de(Ft),Ut!==void 0&&me(Ut),hs!==void 0&&oe(hs),vs!==void 0&&X(vs)}}),e[63]=ce,e[64]=l,e[65]=ne,e[66]=G,e[67]=se,e[68]=te,e[69]=ie,e[70]=O,e[71]=Ne):Ne=e[71];let be;e[72]!==n||e[73]!==w?(be={from:n,to:w},e[72]=n,e[73]=w,e[74]=be):be=e[74];let Ce;e[75]!==x?(Ce=x("monitoring.timeRangePicker.absoluteTimeRange"),e[75]=x,e[76]=Ce):Ce=e[76];let Te;e[77]!==x?(Te=x("monitoring.timeRangePicker.from"),e[77]=x,e[78]=Te):Te=e[78];let ke;e[79]!==x?(ke=x("monitoring.timeRangePicker.to"),e[79]=x,e[80]=ke):ke=e[80];let ze;e[81]!==x?(ze=x("monitoring.timeRangePicker.applyTimeRange"),e[81]=x,e[82]=ze):ze=e[82];let Ae;e[83]!==Ce||e[84]!==Te||e[85]!==ke||e[86]!==ze?(Ae={absoluteTimeRange:Ce,from:Te,to:ke,applyTimeRange:ze},e[83]=Ce,e[84]=Te,e[85]=ke,e[86]=ze,e[87]=Ae):Ae=e[87];let ge;e[88]!==x?(ge=x("monitoring.timeRangePicker.last5Minutes"),e[88]=x,e[89]=ge):ge=e[89];let pe;e[90]!==ge?(pe={label:ge,from:"now-5m",to:"now",value:"5m"},e[90]=ge,e[91]=pe):pe=e[91];let ye;e[92]!==x?(ye=x("monitoring.timeRangePicker.last15Minutes"),e[92]=x,e[93]=ye):ye=e[93];let Pe;e[94]!==ye?(Pe={label:ye,from:"now-15m",to:"now",value:"15m"},e[94]=ye,e[95]=Pe):Pe=e[95];let Me;e[96]!==x?(Me=x("monitoring.timeRangePicker.last30Minutes"),e[96]=x,e[97]=Me):Me=e[97];let Ue;e[98]!==Me?(Ue={label:Me,from:"now-30m",to:"now",value:"30m"},e[98]=Me,e[99]=Ue):Ue=e[99];let Ke;e[100]!==x?(Ke=x("monitoring.timeRangePicker.last1Hour"),e[100]=x,e[101]=Ke):Ke=e[101];let Ve;e[102]!==Ke?(Ve={label:Ke,from:"now-1h",to:"now",value:"1h"},e[102]=Ke,e[103]=Ve):Ve=e[103];let We;e[104]!==x?(We=x("monitoring.timeRangePicker.last3Hours"),e[104]=x,e[105]=We):We=e[105];let ut;e[106]!==We?(ut={label:We,from:"now-3h",to:"now",value:"3h"},e[106]=We,e[107]=ut):ut=e[107];let Xe;e[108]!==x?(Xe=x("monitoring.timeRangePicker.last6Hours"),e[108]=x,e[109]=Xe):Xe=e[109];let Ze;e[110]!==Xe?(Ze={label:Xe,from:"now-6h",to:"now",value:"6h"},e[110]=Xe,e[111]=Ze):Ze=e[111];let et;e[112]!==x?(et=x("monitoring.timeRangePicker.last12Hours"),e[112]=x,e[113]=et):et=e[113];let ft;e[114]!==et?(ft={label:et,from:"now-12h",to:"now",value:"12h"},e[114]=et,e[115]=ft):ft=e[115];let tt;e[116]!==x?(tt=x("monitoring.timeRangePicker.last24Hours"),e[116]=x,e[117]=tt):tt=e[117];let xt;e[118]!==tt?(xt={label:tt,from:"now-24h",to:"now",value:"24h"},e[118]=tt,e[119]=xt):xt=e[119];let st;e[120]!==x?(st=x("monitoring.timeRangePicker.last2Days"),e[120]=x,e[121]=st):st=e[121];let lt;e[122]!==st?(lt={label:st,from:"now-2d",to:"now",value:"2d"},e[122]=st,e[123]=lt):lt=e[123];let nt;e[124]!==x?(nt=x("monitoring.timeRangePicker.last7Days"),e[124]=x,e[125]=nt):nt=e[125];let qe;e[126]!==nt?(qe={label:nt,from:"now-7d",to:"now",value:"7d"},e[126]=nt,e[127]=qe):qe=e[127];let at;e[128]!==x?(at=x("monitoring.timeRangePicker.last30Days"),e[128]=x,e[129]=at):at=e[129];let pt;e[130]!==at?(pt={label:at,from:"now-30d",to:"now",value:"30d"},e[130]=at,e[131]=pt):pt=e[131];let He;e[132]!==pe||e[133]!==Pe||e[134]!==Ue||e[135]!==Ve||e[136]!==ut||e[137]!==Ze||e[138]!==ft||e[139]!==xt||e[140]!==lt||e[141]!==qe||e[142]!==pt?(He=[pe,Pe,Ue,Ve,ut,Ze,ft,xt,lt,qe,pt],e[132]=pe,e[133]=Pe,e[134]=Ue,e[135]=Ve,e[136]=ut,e[137]=Ze,e[138]=ft,e[139]=xt,e[140]=lt,e[141]=qe,e[142]=pt,e[143]=He):He=e[143];let Be;e[144]!==v||e[145]!==be||e[146]!==Ae||e[147]!==He?(Be=t.jsx(al,{value:be,onChange:v,labels:Ae,quickRanges:He}),e[144]=v,e[145]=be,e[146]=Ae,e[147]=He,e[148]=Be):Be=e[148];let Je;e[149]!==Se||e[150]!==Ie||e[151]!==Ne||e[152]!==Be?(Je=t.jsxs("div",{className:Se,children:[Ie,Ne,Be]}),e[149]=Se,e[150]=Ie,e[151]=Ne,e[152]=Be,e[153]=Je):Je=e[153];let rt;e[154]!==Fe||e[155]!==Je?(rt=t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[Fe,Je]}),e[154]=Fe,e[155]=Je,e[156]=rt):rt=e[156];let ct;e[157]!==y||e[158]!==r||e[159]!==x||e[160]!==l?(ct=(l==="audit"||l==="threads")&&t.jsx(Ys,{value:r,onChange:it=>y({search:it}),placeholder:x(l==="threads"?"orgs.monitoring.searchByTitlePlaceholder":"orgs.monitoring.searchByToolPlaceholder"),onKeyDown:it=>{it.key==="Escape"&&(y({search:""}),it.target.blur())},className:"w-full md:w-[375px]"}),e[157]=y,e[158]=r,e[159]=x,e[160]=l,e[161]=ct):ct=e[161];let Tt;e[162]!==Oe||e[163]!==rt||e[164]!==ct?(Tt=t.jsx(_t.Container,{className:"!pb-4",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[Oe,rt,ct]})}),e[162]=Oe,e[163]=rt,e[164]=ct,e[165]=Tt):Tt=e[165];let kt;e[166]!==S||e[167]!==I||e[168]!==j||e[169]!==Re||e[170]!==B||e[171]!==o||e[172]!==i||e[173]!==m||e[174]!==E||e[175]!==g||e[176]!==A||e[177]!==W||e[178]!==b||e[179]!==y||e[180]!==$.slug||e[181]!==r||e[182]!==c||e[183]!==T||e[184]!==l||e[185]!==G||e[186]!==se||e[187]!==te||e[188]!==ie||e[189]!==d||e[190]!==u?(kt=l==="stores"?t.jsx("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:t.jsx(Ol,{feature:"monitoring",children:t.jsx(Tr,{orgSlug:$.slug,store:T,at:j,onSelect:it=>y({store:it.store,at:it.at})})})}):l==="automations"?t.jsx(wr,{dateRange:i}):l==="threads"?t.jsx(gr,{client:B,locator:W,membersData:b,allConnections:S,allVirtualMcps:I,dateRange:i,searchQuery:r,filterAgentIds:G,filterUserIds:ie,filterStatus:te,filterSource:se}):l==="audit"?t.jsx(xe.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex flex-col overflow-auto md:overflow-hidden",children:t.jsx(qt.Skeleton,{})}),children:t.jsx(dr,{client:B,locator:W,baseParams:Re,pageSize:F,isStreaming:g,streamingRefetchInterval:q,connectionIds:o,virtualMcpIds:u,tool:d,status:c,searchQuery:r,allConnections:S,allVirtualMcps:I,membersData:b})}):t.jsx("div",{className:"flex-1 flex flex-col overflow-auto min-w-0",children:t.jsx(Xl,{displayDateRange:m,connectionIds:o,excludeConnectionIds:E,toolName:d||void 0,status:c==="errors"?"error":c==="success"?"success":void 0,connections:S,isStreaming:g,streamingRefetchInterval:q,llmUserIds:A,virtualMcpIds:u,virtualMcps:I})}),e[166]=S,e[167]=I,e[168]=j,e[169]=Re,e[170]=B,e[171]=o,e[172]=i,e[173]=m,e[174]=E,e[175]=g,e[176]=A,e[177]=W,e[178]=b,e[179]=y,e[180]=$.slug,e[181]=r,e[182]=c,e[183]=T,e[184]=l,e[185]=G,e[186]=se,e[187]=te,e[188]=ie,e[189]=d,e[190]=u,e[191]=kt):kt=e[191];let At;return e[192]!==Tt||e[193]!==kt?(At=t.jsxs(t.Fragment,{children:[Tt,kt]}),e[192]=Tt,e[193]=kt,e[194]=At):At=e[194],At}function Rr(s){const e=s.user.name??s.user.email??s.userId,l=s.user.image??void 0;return{value:s.userId,label:e,icon:i=>{const{className:m}=i;return t.jsx(cs,{url:l,fallback:e,shape:"circle",size:"2xs",className:ot("shrink-0",m)})}}}function Lr(s){const e=s.icon,l=s.title??"Super Agent";return{value:s.id??"",label:l,icon:i=>{const{className:m}=i;return t.jsx(Ct,{icon:e,name:l,size:"xs",fallbackIcon:t.jsx(Ot,{}),className:ot("size-4! min-w-4! rounded-sm shrink-0",m)})}}}function Or(s){const e=s.icon,l=s.title||s.id;return{value:s.id,label:l,icon:i=>{const{className:m}=i;return t.jsx(Ct,{icon:e,name:l,size:"xs",fallbackIcon:t.jsx(Ot,{}),className:ot("size-4! min-w-4! rounded-sm shrink-0",m)})}}}function kn(){const s=ue.c(85),e=_e(),l=gs(),{org:i}=ht(),m=ns();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/monitor"},s[0]=o):o=s[0];const u=qs(o),{tab:d,from:c,to:r,connectionId:g,virtualMcpId:h,tool:f,search:n,status:w,streaming:a,propertyFilters:T,hideSystem:j,store:y,at:v}=u,p=d===void 0?"threads":d;let M;s[1]!==g?(M=g===void 0?[]:g,s[1]=g,s[2]=M):M=s[2];const x=M;let S;s[3]!==h?(S=h===void 0?[]:h,s[3]=h,s[4]=S):S=s[4];const I=S,b=a===void 0?!0:a,C=T===void 0?"":T,_=j===void 0?!1:j,P=$l(C);let k;s[5]!==m||s[6]!==i.slug||s[7]!==u?(k=X=>{m({to:"/$org/settings/monitor",params:{org:i.slug},search:{...u,...X}})},s[5]=m,s[6]=i.slug,s[7]=u,s[8]=k):k=s[8];const D=k,[L,U]=xe.useState(zr);let J;s[9]!==D?(J=X=>{U(Date.now()),D({from:X.from,to:X.to})},s[9]=D,s[10]=J):J=s[10];const Q=J;let N,O,F;if(s[11]!==L||s[12]!==c||s[13]!==b||s[14]!==r){const X=new Date(L),ne=ys(c,X),ae=ys(r,X);F=ne.date||new Date(L-864e5);const ce=ae.date||X;N={startDate:F,endDate:ce},O=ce,b&&r==="now"&&(O=new Date(ce),O.setHours(O.getHours()+1)),s[11]=L,s[12]=c,s[13]=b,s[14]=r,s[15]=N,s[16]=O,s[17]=F}else N=s[15],O=s[16],F=s[17];let q;s[18]!==O||s[19]!==F?(q={startDate:F,endDate:O},s[18]=O,s[19]=F,s[20]=q):q=s[20];const $=q;let W=0;x.length>0&&W++,I.length>0&&W++,f&&W++,w!=="all"&&W++,_&&W++;const K=P.filter(Fr);K.length>0&&(W=W+K.length);let B;s[21]!==p?(B=t.jsx(_t.Container,{className:"!pb-3",children:t.jsx(os,{tab:p})}),s[21]=p,s[22]=B):B=s[22];let V;s[23]!==e?(V=e("orgs.monitoring.failedLoadTitle"),s[23]=e,s[24]=V):V=s[24];let Y;s[25]!==e?(Y=e("orgs.monitoring.failedLoadDescription"),s[25]=e,s[26]=Y):Y=s[26];let R;s[27]!==V||s[28]!==Y?(R=t.jsx(_t.Content,{children:t.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:t.jsx(Ht,{title:V,description:Y})})}),s[27]=V,s[28]=Y,s[29]=R):R=s[29];let E;s[30]!==B||s[31]!==R?(E=t.jsxs(t.Fragment,{children:[B,R]}),s[30]=B,s[31]=R,s[32]=E):E=s[32];let H;s[33]!==p?(H=t.jsx(os,{tab:p}),s[33]=p,s[34]=H):H=s[34];let A;s[35]!==l||s[36]!==D?(A=X=>{const ne=l.find(ae=>ae.id===X);ne&&D({tab:ne.id})},s[35]=l,s[36]=D,s[37]=A):A=s[37];let Z;s[38]!==A||s[39]!==p||s[40]!==l?(Z=t.jsx(Ds,{placement:"page",tabs:l,activeTab:p,onTabChange:A}),s[38]=A,s[39]=p,s[40]=l,s[41]=Z):Z=s[41];let ee;s[42]!==H||s[43]!==Z?(ee=t.jsx(_t.Container,{className:"!pb-3",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[H,Z]})}),s[42]=H,s[43]=Z,s[44]=ee):ee=s[44];let G;s[45]!==p?(G=p==="threads"?t.jsx("div",{className:"flex-1 flex flex-col overflow-auto md:overflow-hidden",children:t.jsx(qt.Skeleton,{})}):p==="audit"?t.jsx("div",{className:"flex-1 flex flex-col overflow-auto md:overflow-hidden",children:t.jsx(qt.Skeleton,{})}):t.jsx("div",{className:"flex-1 flex flex-col overflow-auto",children:t.jsx(sr,{})}),s[45]=p,s[46]=G):G=s[46];let de;s[47]!==ee||s[48]!==G?(de=t.jsxs(t.Fragment,{children:[ee,G]}),s[47]=ee,s[48]=G,s[49]=de):de=s[49];let re;s[50]!==Q?(re=X=>{Wt("monitoring_time_range_changed",{from:X.from,to:X.to}),Q(X)},s[50]=Q,s[51]=re):re=s[51];let ie;s[52]!==b||s[53]!==D?(ie=()=>{Wt("monitoring_live_toggled",{enabled:!b}),D({streaming:!b})},s[52]=b,s[53]=D,s[54]=ie):ie=s[54];let me;s[55]!==p||s[56]!==D?(me=X=>{X!==p&&Wt("monitoring_tab_changed",{from_tab:p,to_tab:X}),D({tab:X})},s[55]=p,s[56]=D,s[57]=me):me=s[57];let te;s[58]!==W||s[59]!==v||s[60]!==x||s[61]!==$||s[62]!==N||s[63]!==c||s[64]!==_||s[65]!==P||s[66]!==n||s[67]!==w||s[68]!==y||s[69]!==b||s[70]!==re||s[71]!==ie||s[72]!==me||s[73]!==p||s[74]!==r||s[75]!==f||s[76]!==D||s[77]!==I?(te=t.jsx(Dr,{tab:p,dateRange:$,displayDateRange:N,connectionIds:x,virtualMcpIds:I,tool:f,status:w,search:n,streaming:b,hideSystem:_,activeFiltersCount:W,from:c,to:r,propertyFilters:P,store:y,at:v,onUpdateFilters:D,onTimeRangeChange:re,onStreamingToggle:ie,onTabChange:me}),s[58]=W,s[59]=v,s[60]=x,s[61]=$,s[62]=N,s[63]=c,s[64]=_,s[65]=P,s[66]=n,s[67]=w,s[68]=y,s[69]=b,s[70]=re,s[71]=ie,s[72]=me,s[73]=p,s[74]=r,s[75]=f,s[76]=D,s[77]=I,s[78]=te):te=s[78];let oe;s[79]!==de||s[80]!==te?(oe=t.jsx(xe.Suspense,{fallback:de,children:te}),s[79]=de,s[80]=te,s[81]=oe):oe=s[81];let se;return s[82]!==E||s[83]!==oe?(se=t.jsx(Ws,{capability:"monitoring:view",area:"monitoring",children:t.jsx(_t,{children:t.jsx(Hs,{fallback:E,children:oe})})}),s[82]=E,s[83]=oe,s[84]=se):se=s[84],se}function Fr(s){return s.key.trim()}function zr(){return Date.now()}export{kn as default};