@lacneu/atrium 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-CQwLWARe.js +1 -0
- package/dist/assets/AdvancedFilter-Dsn2CdBY.js +1 -0
- package/dist/assets/AgentFilesTab-Cnvrgsf0.js +3 -0
- package/dist/assets/AnomaliesTab-Dc0ZBmMT.js +1 -0
- package/dist/assets/AuditTab-Bi5vISLS.js +1 -0
- package/dist/assets/BridgeTab-H12vdjQc.js +1 -0
- package/dist/assets/ChatDefaultsTab-rV2R20Ad.js +1 -0
- package/dist/assets/{DataTableShell-B3BNv6WF.js → DataTableShell-67hI2aZh.js} +1 -1
- package/dist/assets/{DetailChips-D3pYF8yO.js → DetailChips-CTU-lZny.js} +1 -1
- package/dist/assets/FeedbacksTab-CLE-RiFB.js +1 -0
- package/dist/assets/{FieldLabel-qmnobZin.js → FieldLabel-D8l7ss4W.js} +2 -2
- package/dist/assets/FilesTab-DlWojbFd.js +1 -0
- package/dist/assets/{FilterBar-CoklwXid.js → FilterBar-DZBiB1MF.js} +1 -1
- package/dist/assets/GroupsTab-CdmZ136v.js +1 -0
- package/dist/assets/InstancesTab-BcQzLsnJ.js +1 -0
- package/dist/assets/IntegrationsTab-DFEnr5e6.js +1 -0
- package/dist/assets/{KpiTab-TPPhIZkF.js → KpiTab-BNADRVU3.js} +1 -1
- package/dist/assets/PreferencesTab-CJUrE633.js +1 -0
- package/dist/assets/PromptInjectionsTab-C0cMSQ8x.js +2 -0
- package/dist/assets/RolesTab-Bwgnt5Nh.js +1 -0
- package/dist/assets/ServiceAccountsTab-C-KmfNqX.js +1 -0
- package/dist/assets/SubAgentReportsTab-DP-c7pwV.js +1 -0
- package/dist/assets/ThemeShowroom-ioH8EI6M.js +1 -0
- package/dist/assets/{TimeRangePicker-WuBOXKuJ.js → TimeRangePicker-BJ_SDnZN.js} +1 -1
- package/dist/assets/TracesTab-CfxNJ_IN.js +1 -0
- package/dist/assets/UsersTab-C9upk4jg.js +1 -0
- package/dist/assets/{button-68hHQyd5.js → button-HRR8tdJ2.js} +1 -1
- package/dist/assets/{card-D3vxkef_.js → card-DdObfJrM.js} +1 -1
- package/dist/assets/chevrons-up-down-DLfMeWLX.js +1 -0
- package/dist/assets/compatView-Ihz_y_lK.js +1 -0
- package/dist/assets/dispatchErrorInfo-CiUDlf_q.js +1 -0
- package/dist/assets/dist-CKhDstdM.js +44 -0
- package/dist/assets/dist-CkXWG_t8.js +1 -0
- package/dist/assets/{dist-C6DxU1UR.js → dist-DErYNbMW.js} +1 -1
- package/dist/assets/dist-DdcF2Plv.js +5 -0
- package/dist/assets/{highlighted-body-OFNGDK62-DcZOC2_L.js → highlighted-body-OFNGDK62-rg7WOukZ.js} +1 -1
- package/dist/assets/index-DR0RpyTI.js +226 -0
- package/dist/assets/index-GVGG9WDP.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-CHQslKq1.js +1 -0
- package/dist/assets/roleDescriptions-B8pJ6mkq.js +1 -0
- package/dist/assets/{table-Cpg7ktx0.js → table-fGxqLVNE.js} +1 -1
- package/dist/assets/{tabs-CtLuGbAQ.js → tabs-Bh17c652.js} +1 -1
- package/dist/assets/x-Dnhgu6fy.js +1 -0
- package/dist/index.html +8 -8
- package/package.json +1 -1
- package/dist/assets/AccessTab-4Szc9p6w.js +0 -1
- package/dist/assets/AdvancedFilter-D2FHLsw8.js +0 -1
- package/dist/assets/AgentFilesTab-BofZ6dXp.js +0 -3
- package/dist/assets/AnomaliesTab-DcDI0Qxb.js +0 -1
- package/dist/assets/AuditTab-B9OVOaMk.js +0 -1
- package/dist/assets/BridgeTab-O4yoOOWe.js +0 -1
- package/dist/assets/ChatDefaultsTab-N7IYhqPS.js +0 -1
- package/dist/assets/FeedbacksTab-j1FhO3wH.js +0 -1
- package/dist/assets/FilesTab-BXiIbC-7.js +0 -1
- package/dist/assets/GroupsTab-D1J-hU9y.js +0 -1
- package/dist/assets/InstancesTab-7ARxZmYf.js +0 -1
- package/dist/assets/IntegrationsTab-Br5kj26O.js +0 -1
- package/dist/assets/PreferencesTab-BupPod-f.js +0 -1
- package/dist/assets/PromptInjectionsTab-DtZt6j5Q.js +0 -2
- package/dist/assets/RolesTab-DXsb5m-B.js +0 -1
- package/dist/assets/ServiceAccountsTab-B-52afce.js +0 -1
- package/dist/assets/ThemeShowroom-Be_qxq8e.js +0 -1
- package/dist/assets/TracesTab-yKQseHFP.js +0 -1
- package/dist/assets/UsersTab-CLrNYSaP.js +0 -1
- package/dist/assets/chevrons-up-down-BkvysMN2.js +0 -1
- package/dist/assets/compatView-BP3AGXoN.js +0 -1
- package/dist/assets/dispatchErrorInfo-CLr8uAMF.js +0 -1
- package/dist/assets/dist-C6pbjAJm.js +0 -5
- package/dist/assets/dist-DC2Oibm5.js +0 -44
- package/dist/assets/dist-DZxb8Lg7.js +0 -1
- package/dist/assets/index-DGI4ATru.js +0 -226
- package/dist/assets/index-_QyGJ5uY.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-nP3LXHgd.js +0 -1
- package/dist/assets/roleDescriptions-CU2PycEu.js +0 -1
- package/dist/assets/x-YTR7quzM.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Ad as i,Cd as ee,Dd as a,Ed as te,Fd as o,Ju as s,Md as c,Nd as l,Od as ne,Pd as u,Qu as d,Sd as f,Td as p,Xu as m,Yu as h,Zu as re,_d as ie,ad as ae,bd as oe,cd as g,dd as se,eT as _,ed as ce,fd as v,gd as le,hd as ue,id as de,jd as fe,kd as pe,ld as me,md as he,nd as ge,oT as y,od as b,pd as x,qu as S,rd as C,sT as w,sd as T,td as E,ud as D,vd as O,wd as k,xd as A,yd as j}from"./dist-DC2Oibm5.js";import{n as M}from"./TimeRangePicker-WuBOXKuJ.js";import{A as N,At as P,X as F,_ as I,a as L,b as R,j as _e,kt as z,ot as ve,r as ye,v as B,x as V,y as H}from"./index-DGI4ATru.js";import{t as be}from"./FilterBar-CoklwXid.js";import{t as xe}from"./DataTableShell-B3BNv6WF.js";import{t as U}from"./dispatchErrorInfo-CLr8uAMF.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?o():e===`acknowledged`?u():l()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,o=e.status===q?K:e.status,s=e.severity??K,l=e.kind??K,[u,m]=(0,W.useState)(K),h=ye(e.from,e.to),{from:S,to:U}=M(h),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),Me=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=N(),Q=y(_.anomalies.resolveAnomaly),Fe=(w(_.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=w(_.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:S,to:U,anomalyStatus:o===K?void 0:o,severity:s===K?void 0:s,source:u===K?void 0:u,kind:l===K?void 0:l}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||s!==K||u!==K||l!==K||h.kind!==`relative`||h.from!==Ee.from;function Re(){m(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:c(),description:(0,G.jsxs)(G.Fragment,{children:[fe(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,i(),` `,(0,G.jsx)(`strong`,{children:pe()}),`.`,` `,ne()]}),confirmLabel:a()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(te(),e.kind)}catch(e){Z.error(p(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(k(),e.kind)}catch(e){Z.error(ee(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,G.jsx)(`strong`,{children:A()}),` `,oe(),` `,(0,G.jsx)(`strong`,{children:j()}),` `,O(),` `,(0,G.jsx)(`strong`,{children:ie()}),` `,le(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:ue()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:he(),timeRange:h,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,G.jsxs)(I,{value:o,onValueChange:Y,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:x()}),Se.map(e=>(0,G.jsx)(H,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(I,{value:s,onValueChange:Me,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:v()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:se()}),we.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]}),(0,G.jsxs)(I,{value:u,onValueChange:m,children:[(0,G.jsx)(R,{size:`sm`,className:`w-32`,children:(0,G.jsx)(V,{placeholder:D()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:me()}),Te.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]}),(0,G.jsxs)(I,{value:l,onValueChange:Ne,children:[(0,G.jsx)(R,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:g()})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(H,{value:K,children:T()}),Ie.map(e=>(0,G.jsx)(H,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:b(),rows:$,emptyHint:o===`open`?ae():de(),rowActions:e=>Fe&&e.status===`open`?[{label:C(),onSelect:()=>void ze(e)},{label:ge(),onSelect:()=>void Be(e)}]:[],columns:[{header:E(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:g(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:v(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ce(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:D(),cell:e=>(0,G.jsx)(F,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:r(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:d(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:re(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Oe({row:e}){let t=z(),n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,m()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(F,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,G.jsx)(F,{variant:`secondary`,children:s()}):(0,G.jsx)(F,{variant:`outline`,children:S()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Bf as i,Df as a,Ef as o,Ff as s,If as c,Lf as l,Mf as u,Nf as ee,Of as d,Pf as f,Rf as p,eT as m,jf as h,kf as g,sT as _,zf as v}from"./dist-DC2Oibm5.js";import{n as y}from"./TimeRangePicker-WuBOXKuJ.js";import{At as b,_ as x,a as S,b as C,i as w,kt as T,o as E,r as D,t as O,v as k,x as A,y as j}from"./index-DGI4ATru.js";import{t as M}from"./FilterBar-CoklwXid.js";import{t as N}from"./AdvancedFilter-D2FHLsw8.js";import{t as P}from"./DataTableShell-B3BNv6WF.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=_(m.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:p(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(x,{value:O,onValueChange:q,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{placeholder:l()})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:c()}),$.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]}),(0,I.jsxs)(x,{value:B,onValueChange:J,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:s()}),(0,I.jsx)(j,{value:`yes`,children:f()}),(0,I.jsx)(j,{value:`no`,children:ee()})]})]}),(0,I.jsxs)(x,{value:V,onValueChange:Y,children:[(0,I.jsx)(C,{size:`sm`,className:`w-40`,children:(0,I.jsx)(A,{placeholder:u()})}),(0,I.jsxs)(k,{children:[(0,I.jsx)(j,{value:R,children:h()}),te.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:r(),rows:Q,emptyHint:g(),columns:[{header:d(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:l(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:u(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,A as i,As as a,B as o,Bc as s,Bs as c,Ds as l,E as u,Es as d,F as f,Fc as p,Fs as m,Gc as ee,Gs as h,Hc as te,Hs as g,I as _,Ic as ne,Is as v,Jc as y,Js as re,Kc as ie,Ks as ae,L as oe,Ls as se,M as ce,Ms as le,N as ue,Ns as de,Os as fe,P as pe,Ps as me,Qs as b,R as he,Rs as ge,Ts as _e,Uc as ve,Us as ye,V as be,Vc as xe,Vs as Se,Wc as Ce,Ws as we,Xs as Te,Yc as Ee,Ys as De,Zs as Oe,ac as ke,cc as Ae,dc as je,eT as x,ec as Me,fc as Ne,iT as Pe,ic as Fe,j as Ie,js as Le,ks as Re,lc as ze,nc as Be,oT as Ve,oc as He,pc as Ue,qs as We,rc as Ge,sT as S,sc as Ke,tT as C,tc as qe,uc as Je,z as Ye,zc as Xe,zs as w}from"./dist-DC2Oibm5.js";import{i as T,r as Ze}from"./dist-DZxb8Lg7.js";import{t as Qe}from"./chevrons-up-down-BkvysMN2.js";import{i as $e,n as E,o as et,r as tt,s as nt}from"./FieldLabel-qmnobZin.js";import{t as D}from"./button-68hHQyd5.js";import{$ as rt,A as it,Dt as O,E as at,H as ot,Ot as st,Q as ct,St as lt,U as ut,V as dt,X as k,Z as A,_ as j,_t as ft,b as M,et as pt,kt as mt,mt as N,nt as ht,ot as gt,rt as _t,v as P,x as F,y as I}from"./index-DGI4ATru.js";import{a as vt,i as L,n as yt,o as R,r as z,t as bt}from"./table-Cpg7ktx0.js";import{t as xt}from"./FilterBar-CoklwXid.js";import{a as B,n as St,o as V,r as H,s as Ct,t as wt}from"./compatView-BP3AGXoN.js";import{t as U}from"./dispatchErrorInfo-CLr8uAMF.js";var Tt=C(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Et=C(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&G(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,Nt={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function Lt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*It(t.key,e,r)})}function Rt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function zt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Y(e.label,t.label))}function Bt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(Nt),[i,o]=(0,W.useState)(null),s=(0,W.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),l=(0,W.useMemo)(()=>Rt(s),[s]),u=(0,W.useMemo)(()=>zt(s),[s]),d=(0,W.useMemo)(()=>Bt(s),[s]),f=(0,W.useMemo)(()=>Lt(Ft(s,n),i),[s,n,i]);function p(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(xt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:c(),onReset:()=>r(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(j,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(F,{placeholder:ge()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(I,{value:q,children:w()}),l.map(e=>(0,Z.jsx)(I,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(j,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(F,{placeholder:se()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(I,{value:q,children:w()}),u.map(e=>(0,Z.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(j,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(F,{placeholder:v()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(I,{value:q,children:w()}),d.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))]})]})]}),f.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Z.jsxs)(bt,{className:`oc-conn__table`,children:[(0,Z.jsx)(vt,{children:(0,Z.jsxs)(R,{children:[(0,Z.jsx)(Q,{label:me(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:de(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:le(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:Le(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:a(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(L,{children:Re()}),(0,Z.jsx)(Q,{label:fe(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(yt,{children:f.map(e=>(0,Z.jsx)(Ht,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(L,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Qe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?U(e.lastErrorCode):null,n=kt(e)?U(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(W.Fragment,{children:[(0,Z.jsxs)(R,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(z,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(z,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(z,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(z,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(z,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(z,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:g({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(z,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(R,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(z,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Ut(e){return e===`connected`?l():e===`error`?d():_e()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:l()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:d()}):(0,Z.jsx)(k,{variant:`outline`,children:_e()})}function Gt(){return S(x.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=S(x.compat.getBridgeCompat,{}),n=S(x.me.getMe,{host:gt})?.role===`admin`,i=S(x.admin.listInstances,n?{}:`skip`),a=mt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=jt(e?e.targets:[],t?t.targets:[],i??[]),c=t?.compat??null,l=t===void 0?`loading`:t===null?`nodata`:`ready`,d=c!==null&&St(c,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(qt,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:r()}),s.map(e=>(0,Z.jsx)(Jt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:c,compatStatus:l,compatReachable:t?.reachable??!0},e.key)),d?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):null]})}function qt({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:B(t.bridgeVersion)}),` · `,Ye(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?he():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Oe()});let i=G(e.targets),a=!e.reachable,o=Dt(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,Z.jsx)(O,{size:22}):a?(0,Z.jsx)(Et,{size:22}):(0,Z.jsx)(N,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?Te():a?De():re({count:i.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Tt,{size:12,"aria-hidden":!0}),` `,We({time:c})]}),l?(0,Z.jsx)(`span`,{children:ae({time:l})}):null,r]}),a?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:h()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Ct(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:wt(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,W.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(ft,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`?`destructive`:`secondary`,children:H(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:be()}),(0,Z.jsx)(Yt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(T,{size:13,"aria-hidden":!0}):(0,Z.jsx)(st,{size:13,"aria-hidden":!0}),we({count:t.length})]}),f?(0,Z.jsx)(Vt,{connections:t,displayByInstance:s}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:f()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:pe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:he()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:B(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(ct,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(_t,{children:Ee({instance:e.displayName??e.name})}),(0,Z.jsx)(pt,{children:y()})]}),(0,Z.jsx)(Zt,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(O,{"aria-hidden":!0}):(0,Z.jsx)(N,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ge():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Be()]}):null}function Zt({instance:e,onClose:t}){let n=Ve(x.admin.upsertInstanceConfig),r=Pe(x.bridge.validateMediaPaths),i=it(),[a,o]=(0,W.useState)(()=>$e(e.config??{})),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,m]=(0,W.useState)(null),h=a.inboundMediaMode===`shared-fs`,g=a.mediaMode===`shared-fs`,_=h||g;async function v(){d(!0),m(null);try{m(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(Ke(),e)}finally{d(!1)}}async function y(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:tt(a,r)}),t()}catch(e){i.error(xe(),e)}finally{l(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ie(),help:s()}),(0,Z.jsxs)(j,{value:a.mediaMode,onValueChange:e=>o({...a,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(P,{children:nt.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:ee(),help:Xe()}),(0,Z.jsxs)(j,{value:a.inboundMediaMode,onValueChange:e=>o({...a,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(P,{children:et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ce(),help:ne()}),(0,Z.jsx)(A,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>o({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),_&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[h&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Ue(),help:Ne()}),(0,Z.jsx)(A,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>o({...a,inboundAgentMount:e.target.value})})]}),g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:je(),help:Je()}),(0,Z.jsx)(A,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>o({...a,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(at,{checked:a.rehydration,onCheckedChange:e=>o({...a,rehydration:e===!0})}),(0,Z.jsx)(E,{label:ve(),help:p()})]}),_&&f!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:f.reachable?!f.inbound&&!f.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(N,{"aria-hidden":!0}),Me({reason:f.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ke(),result:f.inbound}),(0,Z.jsx)($,{label:Fe(),result:f.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(N,{"aria-hidden":!0}),qe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[_&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:u,children:[u?(0,Z.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,u?Ae():ze()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void y(),disabled:c,children:te()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(dt,{children:[(0,Z.jsx)(ut,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ue():ce({count:e.length}),(0,Z.jsx)(T,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Ie()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Kt as BridgeTab,Xt as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Dw as a,G as o,H as s,J as ee,K as te,Q as ne,U as re,W as ie,X as ae,Y as oe,Z as se,an as ce,eT as c,et as l,fn as u,iT as d,on as le,q as ue,qc as f,sT as p,un as m,yy as h}from"./dist-DC2Oibm5.js";import{t as g}from"./button-68hHQyd5.js";import{A as _,B as de,D as fe,F as pe,I as me,L as he,N as v,P as y,R as b,_ as x,b as S,g as C,h as w,mt as T,v as E,x as D,y as O,z as k}from"./index-DGI4ATru.js";import{i as A}from"./compatView-BP3AGXoN.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var P=n();function F(){let e=d(c.agentFiles.getChatDefaults),t=d(c.agentFiles.setChatDefaults),n=_(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=p(c.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=p(c.compat.forInstance,U?{instanceName:U}:`skip`),K=U?fe(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(ue()),await X()}catch(e){n.error(te(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:C(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:le()},{id:`standard`,label:ce()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,P.jsxs)(x,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(S,{size:`sm`,"aria-label":i(),children:(0,P.jsx)(D,{})}),(0,P.jsx)(E,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[oe(),` `,(0,P.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:m()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:se()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(g,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?u():ee()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:o()})]}),(0,P.jsx)(v,{open:ge,onOpenChange:z,children:(0,P.jsxs)(me,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(de,{children:ie()}),(0,P.jsx)(he,{children:re()})]}),(0,P.jsxs)(b,{children:[(0,P.jsx)(pe,{children:h()}),(0,P.jsx)(y,{onClick:()=>void be(),children:s()})]})]})})]})}export{F as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Ah as i,Bh as a,Ch as o,Dh as s,Eh as c,Fh as l,Gh as u,Hh as d,Ih as f,Jh as p,Kh as ee,Lh as te,Mh as m,Nh as h,Oh as g,Ph as _,Qh as v,Rh as ne,Sh as y,Th as b,Uh as re,Vh as ie,Wh as x,Xh as S,Yh as C,Zh as w,_h as T,ah as E,bh as D,ch as O,dh as k,eT as A,eg as j,fh as M,gh as N,hh as P,ih as F,jh as I,kh as L,lh as R,mh as z,ng as B,nh as ae,oT as V,oh as H,ph as U,qh as W,rh as G,sT as K,sh as q,tg as J,th as oe,uh as se,vh as ce,wh as le,xh as ue,yh as de,zh as fe}from"./dist-DC2Oibm5.js";import{t as pe}from"./button-68hHQyd5.js";import{j as me}from"./index-DGI4ATru.js";import{t as he}from"./DataTableShell-B3BNv6WF.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>B(),incorrect:()=>J(),incoherence:()=>j(),formatting:()=>r(),latency:()=>v(),api_error:()=>w(),other:()=>S()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:p()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:W()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:C()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=V(A.feedback.respondToFeedback),[o,p]=(0,Y.useState)(e.thread),[v,y]=(0,Y.useState)(``),[b,S]=(0,Y.useState)(!1);async function C(){let t=v.trim();if(!(!t||b)){S(!0);try{await r({feedbackId:e._id,text:t}),p(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),y(``)}finally{S(!1)}}}let w=[];try{w=n.contextJson?JSON.parse(n.contextJson):[]}catch{w=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${ee()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?re():d()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:a(),value:v,maxLength:2e3,rows:3,onChange:e=>y(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void C(),disabled:!v.trim()||b,children:b?fe():ne()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||f()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||f()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,w.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h({count:n.contextCount??w.length,truncated:n.contextTruncated?m():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?g({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[s(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,c()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=K(A.feedback.listForAdmin,{}),t=V(A.feedback.readSnapshot),n=V(A.feedback.deleteFeedback),r=me(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)({});async function l(e){if(i===e._id){a(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}a(e._id)}async function u(e){await r({title:G(),description:ae(),confirmLabel:oe(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,X.jsx)(`strong`,{children:le()}),` `,o()]}),(0,X.jsx)(he,{title:y(),rows:e,emptyHint:ue(),isExpanded:e=>i===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,X.jsx)(ge,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:D(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:de(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:ce(),cell:e=>e.messageRole===`user`?T():N(),sort:e=>e.messageRole},{header:P(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${z({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:M(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:k(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:se()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:O()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:i===e._id?H():E(),onSelect:()=>void l(e)},{label:F(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as ee,AC as te,BC as r,DC as i,Dw as a,EC as ne,FC as re,GC as o,HC as s,IC as c,JC as l,KC as u,LC as d,MC as f,NC as ie,OC as ae,PC as oe,QC as se,RC as ce,TC as le,UC as p,VC as ue,WC as m,XC as de,YC as fe,ZC as pe,aw as me,eT as h,ew as he,iw as ge,jC as _e,kC as ve,kw as ye,nw as g,oT as _,qC as v,rw as y,sT as b,tw as x,wC as S,yy as C,zC as w}from"./dist-DC2Oibm5.js";import{t as T}from"./button-68hHQyd5.js";import{A as E,B as D,F as O,G as k,I as A,K as j,L as M,N,P,R as be,Tt as F,W as xe,X as Se,Y as Ce,_ as I,b as L,ht as we,v as R,wt as Te,x as z,y as B,yt as Ee,z as De}from"./index-DGI4ATru.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-Cpg7ktx0.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return l();case`audio`:return v();case`video`:return u();case`pdf`:return o();case`document`:return m();case`archive`:return p();default:return s()}}function J(){let[e,t]=(0,W.useState)(K),[n,o]=(0,W.useState)(K),[s,l]=(0,W.useState)(K),[u,p]=(0,W.useState)(K),[m,v]=(0,W.useState)(null),J=_(h.files.softDelete),Y=E();function je(){t(K),o(K),l(K),p(K)}async function Me(){let e=m;if(v(null),e)try{await J({fileId:e.id}),Y.success(_e())}catch(e){Y.error(te(),e)}}let X=b(h.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:s===K?void 0:s,category:u===K?void 0:u}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(ye(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||s!==K||u!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(I,{value:e,onValueChange:t,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":ge(),children:(0,G.jsx)(z,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:y()}),(0,G.jsx)(B,{value:`inbound`,children:g()}),(0,G.jsx)(B,{value:`outbound`,children:x()})]})]}),(0,G.jsxs)(I,{value:n,onValueChange:o,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":he(),children:(0,G.jsx)(z,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:ee()}),Q.chats.map(e=>(0,G.jsx)(B,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(I,{value:s,onValueChange:l,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":se(),children:(0,G.jsx)(z,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:pe()}),Q.instances.map(e=>(0,G.jsx)(B,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(I,{value:u,onValueChange:p,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":de(),children:(0,G.jsx)(z,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(B,{value:K,children:fe()}),Q.categories.map(e=>(0,G.jsx)(B,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?le():ne()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:ue()}),(0,G.jsx)(V,{children:r()}),(0,G.jsx)(V,{children:w()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{children:d()}),(0,G.jsx)(V,{className:`text-right`,children:c()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Se,{variant:`secondary`,children:e.direction===`inbound`?g():x()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(xe,{children:[(0,G.jsx)(Ce,{asChild:!0,children:(0,G.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ie(),children:(0,G.jsx)(Te,{size:16})})}),(0,G.jsxs)(k,{align:`end`,children:[e.url?(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(F,{size:14}),re()]})}):(0,G.jsxs)(j,{disabled:!0,children:[(0,G.jsx)(F,{size:14}),i()]}),(0,G.jsxs)(j,{variant:`destructive`,onSelect:()=>v({id:e._id,filename:e.filename}),children:[(0,G.jsx)(we,{size:14}),f()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:S({cap:Fe})}):null]}),(0,G.jsx)(N,{open:m!==null,onOpenChange:e=>!e&&v(null),children:(0,G.jsxs)(A,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(D,{children:ve()}),(0,G.jsx)(M,{children:ae()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(O,{children:C()}),(0,G.jsx)(P,{onClick:()=>void Me(),children:f()})]})]})})]})}export{J as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,An as i,Ar as a,Bn as o,Cr as s,Dn as c,Dr as l,En as u,Er as d,Fn as f,Gn as p,Hn as m,In as h,Jn as g,Kn as _,Ln as v,Mn as y,Mr as b,Nn as x,Nr as S,On as C,Or as w,Pn as T,Qn as E,Rn as D,Sr as ee,Tn as O,Tr as te,Un as k,Vn as A,Wn as j,Xn as ne,Yn as M,Zn as re,_r as N,ar as ie,br as ae,cr as oe,dr as se,eT as P,er as F,fr as ce,gr as le,hr as ue,ir as I,jn as de,jr as fe,kn as pe,kr as me,lr as he,mr as ge,nr as _e,oT as L,or as ve,pr as ye,qn as be,rr as xe,sT as R,sr as Se,tT as z,tr as Ce,ur as we,vr as Te,wn as Ee,wr as De,xr as Oe,yr as ke,zn as Ae}from"./dist-DC2Oibm5.js";import{t as je}from"./x-YTR7quzM.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-CtLuGbAQ.js";import{t as H}from"./button-68hHQyd5.js";import{$ as Pe,A as U,E as W,Ot as Fe,Q as Ie,X as G,Z as K,_ as Le,_t as q,b as Re,et as ze,gt as J,j as Be,m as Ve,nt as He,ot as Ue,rt as We,v as Ge,x as Ke,y as qe}from"./index-DGI4ATru.js";import{t as Je}from"./FilterBar-CoklwXid.js";import{t as Ye}from"./DataTableShell-B3BNv6WF.js";import{t as Y}from"./DetailChips-D3pYF8yO.js";var Xe=z(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=z(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=z(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return F();case`user`:return r();case`pending`:return E();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=R(P.groups.listGroups,{}),t=R(P.me.getMe,{host:Ue})?.role===`admin`,n=L(P.groups.createGroup),r=L(P.groups.updateGroup),i=L(P.groups.deleteGroup),o=Be(),f=U(),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)($),[y,x]=(0,Z.useState)(null),[C,T]=(0,Z.useState)(``),E=(0,Z.useMemo)(()=>{if(!e)return e;let t=C.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,C]);function D(){g(null),v($),m(!0)}function O(e){g(e),v({name:e.name,description:e.description??``}),m(!0)}async function k(){try{h?await r({groupId:h._id,name:_.name,description:_.description}):await n({name:_.name,description:_.description||void 0}),v($),g(null),m(!1)}catch(e){f.error(c(),e)}}async function A(e){if(await o({title:ge({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:ce(),cancelLabel:ae(),destructive:!0}))try{await i({groupId:e._id})}catch(e){f.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Q.jsx)(Je,{q:C,onQChange:T,onReset:()=>T(``),canReset:C!==``,searchPlaceholder:te()}),(0,Q.jsx)(Ye,{title:S(),rows:E,addLabel:fe(),onAdd:t?D:void 0,emptyHint:a(),columns:[{header:me(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:De(),onSelect:()=>x({groupId:e._id,name:e.name})},...t?[{label:s(),onSelect:()=>O(e)},{label:ee(),variant:`destructive`,onSelect:()=>void A(e)}]:[]]}),(0,Q.jsx)(Ve,{open:p,onOpenChange:m,title:h?Te():ke(),description:N(),canSubmit:!!_.name.trim(),onSubmit:k,submitLabel:Oe(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:le()}),(0,Q.jsx)(K,{value:_.name,onChange:e=>v({..._,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(K,{value:_.description,onChange:e=>v({..._,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:y?.groupId??null,groupName:y?.name??``,open:y!==null,onOpenChange:e=>{e||x(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),xe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":Ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[_e(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=R(P.groups.getGroup,n&&e?{groupId:e}:`skip`),s=R(P.groups.listAssignableInstances,n?{}:`skip`),c=R(P.groups.listAssignableUsers,n?{}:`skip`),l=L(P.groups.addMember),u=L(P.groups.removeMember),d=L(P.groups.bulkSetMembers),f=L(P.groups.setGroupManager),p=U(),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`members`),[S,C]=(0,Z.useState)(1),[w,T]=(0,Z.useState)(new Set),E=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),ee=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),te=a?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{h(``),v(``),x(`members`),C(1),E.current=null},[n,e]),(0,Z.useEffect)(()=>{C(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&E.current!==e&&(E.current=e,T(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,Z.useMemo)(()=>c?$e(c,m,w):[],[c,m,w]);async function j(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(O(),e)}}async function ne(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(pe(),e)}}let N=rt(A,e=>D.has(e.userId)),ae=A.filter(e=>D.has(e.userId)).length,F=it(A,S,ot);async function ce(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:N!==`all`})}catch(e){p.error(O(),e)}}return(0,Q.jsx)(Ie,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(We,{children:se({name:t})}),(0,Q.jsx)(ze,{children:we()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),he(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),Se(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),o(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:m,onChange:e=>h(e.target.value),placeholder:oe(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=ee.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:t,onCheckedChange:()=>void j(e.userId,t),"aria-label":re({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&te?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?i():de(),title:r?i():de(),onClick:()=>void ne(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":y(),title:y(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:F.page,pageCount:F.pageCount,onPage:C})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:g,onChange:e=>v(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=R(P.groups.listAssignableAgents,{instanceName:t}),o=L(P.groups.assignAgentToGroup),s=L(P.groups.removeAgentFromGroup),c=L(P.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let _=f.filter(e=>e.presentInLastOk!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(Ee(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(Ee(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:k()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?j():p()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(W,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":ne({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":A(),title:A(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:m()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=R(P.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(P.charts.assignChartToGroup),r=L(P.charts.removeChartFromGroup),i=L(P.charts.setGroupDefaultChart),a=L(P.charts.addChartToGroupPool),o=L(P.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:M()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(C(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(W,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":T(),title:T(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:x()}):null,u?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":h({name:e.name}),title:h({name:e.name}),onClick:()=>void g(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ke,{placeholder:v()})}),(0,Q.jsx)(Ge,{children:l.map(e=>(0,Q.jsx)(qe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:D()}):null:null]})}export{at as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Ap as a,Bp as o,Cm as s,Cp as c,Dm as l,Dp as u,Em as d,Ep as f,Fp as p,Gf as m,Gp as h,Hf as g,Hp as _,Ip as v,Jf as y,Jp as b,Kf as x,Kp as S,Lc as C,Lp as w,Mp as ee,Np as T,Op as E,Pp as te,Qf as D,Qp as O,Rc as k,Rp as ne,Sm as re,Sp as ie,Tm as ae,Tp as oe,Uf as se,Up as ce,Vf as le,Vp as ue,Wf as de,Wp as fe,Xf as pe,Xp as me,Yf as he,Yp as ge,Zf as _e,Zp as ve,_m as ye,_p as be,am as xe,ap as Se,bm as Ce,bp as we,cb as Te,cm as Ee,cp as A,dm as De,dp as j,eT as M,em as Oe,ep as ke,fm as Ae,fp as je,gm as Me,gp as Ne,hm as Pe,hp as Fe,iT as N,im as Ie,ip as Le,jp as Re,kp as ze,lm as Be,lp as Ve,mm as He,mp as Ue,nm as We,np as Ge,oT as P,om as Ke,op as qe,pm as F,pp as I,qf as Je,qp as Ye,rm as Xe,rp as Ze,sT as L,sb as R,sm as Qe,sp as $e,tm as et,tp as tt,um as nt,up as rt,vm as it,vp as at,wm as ot,wp as st,xm as ct,xp as lt,ym as ut,yp as dt,zp as ft}from"./dist-DC2Oibm5.js";import{a as pt,c as mt}from"./FieldLabel-qmnobZin.js";import{t as z}from"./button-68hHQyd5.js";import{$ as B,A as V,E as H,H as ht,Q as U,U as gt,V as _t,X as W,Z as G,_ as K,b as q,et as vt,j as yt,m as bt,nt as xt,rt as St,v as Ct,x as wt,y as J}from"./index-DGI4ATru.js";import{t as Tt}from"./DataTableShell-B3BNv6WF.js";import{InstanceConfigDialog as Et}from"./BridgeTab-O4yoOOWe.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Dt=new Set(X),Ot=`conversational`;function kt(e){let t=new Set((e??[]).filter(e=>Dt.has(e)));return t.size===0?[Ot]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:pt},At={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function jt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Mt(){let e=L(M.admin.listInstances,{}),t=L(M.agents.listAllInstanceAgents,{}),n=P(M.admin.upsertInstance),r=P(M.admin.deleteInstance),a=V(),[o,c]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null);async function S(){try{await n({instanceId:b??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),f(Q),x(null),c(!1)}catch(e){a.error(ae(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ot(),(0,Z.jsx)(`strong`,{children:s()}),re()]}),(0,Z.jsx)(Tt,{title:ct(),rows:e,addLabel:Ce(),onAdd:()=>{x(null),f(Q),c(!0)},emptyHint:ut(),columns:[{header:it(),cell:e=>e.name,sort:e=>e.name},{header:ye(),cell:e=>(0,Z.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Me(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Pe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:l(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?g():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:De(),onSelect:()=>{x(e._id),f(jt(e)),c(!0)}},{label:d(),onSelect:()=>m(e.name)},{label:me(),onSelect:()=>y(e)},{label:He(),onSelect:()=>_(e)},{label:F(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(bt,{open:o,onOpenChange:c,title:b?nt():Ae(),description:Ee(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:S,submitLabel:Qe(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Ke(),children:[(0,Z.jsx)(G,{value:u.name,disabled:b!==null,onChange:e=>f({...u,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Be()}):null]}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsxs)(K,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(wt,{})}),(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:Ie(),children:(0,Z.jsx)(G,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(G,{value:u.bridgeUrl,placeholder:We(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:et(),children:(0,Z.jsx)(G,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:k(),children:[(0,Z.jsxs)(K,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(wt,{})}),(0,Z.jsx)(Ct,{children:mt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:C()})]}),(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsx)(G,{value:u.gatewayVersion,placeholder:i(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:O(),children:(0,Z.jsx)(G,{value:u.gatewayHttpUrl,placeholder:ve(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Et,{instance:h,onClose:()=>_(null)},h._id):null,v?(0,Z.jsx)(Nt,{instance:v,onClose:()=>y(null)},v._id):null]})}function Nt({instance:e,onClose:t}){let n=L(M.instanceSecrets.listInstanceSecretStatus,{}),r=At[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(U,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(B,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(St,{children:ge({instance:e.displayName??e.name})}),(0,Z.jsx)(vt,{children:b()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(It,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ft,{instance:e})}),(0,Z.jsx)(Pt,{instance:e})]})})}function Pt({instance:e}){let t=N(M.instanceSync.forceInstanceSync),n=V(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(E());break;case`no_agents`:n.success(f());break;case`no_bridge_url`:n.error(oe());break;case`deploy_misconfigured`:n.error(st());break;case`unauthorized`:n.error(ie());break;case`not_served`:n.error(lt());break;default:n.error(c());break}}catch(e){n.error(u(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?ze():a()})})]})}function Ft({instance:e}){let t=L(M.bridgeAuth.listBridgeAuthStatus,{}),n=N(M.bridgeAuth.mintBridgeSecret),r=P(M.bridgeAuth.revokeBridgeSecret),i=V(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(I(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ue())}catch(e){i.error(I(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:dt(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:at()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:f?`outline`:`secondary`,children:f?`${fe()} · ${d.prefix}…${d.lastFour}`:ce()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Ne():be()}),f?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Fe()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:je()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?Te():R()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:j()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let r=N(M.instanceSecrets.setInstanceSecret),i=P(M.instanceSecrets.clearInstanceSecret),a=N(M.deviceIdentity.generateDeviceIdentity),s=V(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(null),[g,y]=(0,Y.useState)(!1),b=n!==null,x=t===`deviceIdentity`,C=t===`token`?Ye():t===`deviceIdentity`?S():h();async function E(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),y(!1),s.success(ne())}catch(e){s.error(w(),e)}finally{d(!1)}}}async function D(){if(!u){d(!0);try{await i({instanceId:e,field:t}),m(null),y(!1),s.success(v())}catch(e){s.error(w(),e)}finally{d(!1)}}}async function O(){if(!u){d(!0);try{m(await a({instanceId:e})),y(!1),s.success(T())}catch(e){s.error(Re(),e)}finally{d(!1)}}}let k=f?`openclaw devices approve ${f.id}`:``;async function re(){if(k)try{await navigator.clipboard.writeText(k),y(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(W,{variant:b?`outline`:`secondary`,children:b?fe():ce()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:b?ue():_(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void E(),disabled:u||c.trim().length===0,children:o()}),x?(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void O(),disabled:u,children:p()}):null,b?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void D(),disabled:u,children:ft()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:T()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:k}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void re(),children:g?Te():R()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),y(!1)},children:j()})]}):null]})}var Lt={conversational:Ze,documentary:tt},Rt={conversational:Ge,documentary:ke},zt=e=>(Lt[e]??(()=>e))(),Bt=e=>(Rt[e]??(()=>``))();function Vt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:$e()}),t.map(e=>(0,Z.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(gt,{asChild:!0,children:(0,Z.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:qe()})}),(0,Z.jsxs)(ht,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Se()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Le()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(H,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:zt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Bt(r)})]})]},r)})})]})]})]})}function Ht({instanceName:e,open:t,onOpenChange:n}){let i=L(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=P(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=P(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=P(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=P(M.agents.removeInstanceAgent),l=yt(),u=V();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(A(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(A(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(A(),e)}}async function h(t,n){if(e&&await l({title:_e({name:n}),description:pe(),confirmLabel:he(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(y())}catch(e){u.error(A(),e)}}return(0,Z.jsx)(U,{open:t,onOpenChange:n,children:(0,Z.jsxs)(B,{className:`oc-access`,children:[(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(St,{children:rt({name:e??``})}),(0,Z.jsx)(vt,{children:Ve()})]}),i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:i.discovery===null?x():i.discovery.lastPollOk?m():de({error:i.discovery.error??`?`})}),i.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i.agents.map(e=>{let t=e.presentInLastOk===!1,n=i.defaultAgentId===e.agentId,a=e.displayName??e.agentId,o=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(H,{checked:e.enabled,disabled:t,"aria-label":a,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[e.emoji?`${e.emoji} `:``,a]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:le()}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,a),children:D()})]}):n?(0,Z.jsx)(W,{variant:`default`,children:g()}):(0,Z.jsx)(z,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:r()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:o,onToggle:t=>void p(e.agentId,t,o)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Mt as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ag as r,Bg as i,Cg as a,Dg as o,Eg as ee,Fg as s,Gg as c,Hg as l,Ig as u,Jg as d,Kg as f,Lg as te,Mg as ne,Ng as re,Og as ie,Pg as ae,Rg as oe,Sg as se,Tg as ce,Ug as p,Vg as le,Wg as m,Yg as h,_g as g,ag as _,bg as v,cg as y,dg as b,eT as x,fg as S,gg as C,hg as w,ig as T,jg as E,kg as D,lg as O,mg as k,oT as A,og as j,pg as M,qg as N,rg as ue,sT as P,sg as F,ug as I,vg as L,wg as R,xg as z,yg as B,zg as V}from"./dist-DC2Oibm5.js";import{E as H,X as U,Z as W,_ as G,b as K,v as q,x as de,y as fe}from"./index-DGI4ATru.js";import{t as pe}from"./DataTableShell-B3BNv6WF.js";var J=t(e(),1),Y=n();function me(){let e=P(x.integrations.status.status,{}),t=A(x.admin.setIntegrationConfig),[n,H]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&H(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:h()});let G=n,K=(e,t,n)=>H({...G,[e]:{...G[e],[t]:n}}),q=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,Y.jsx)(`strong`,{children:N()}),` `,f()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(U,{variant:`secondary`,children:c()}):(0,Y.jsx)(U,{variant:`outline`,children:m()}):(0,Y.jsx)(U,{variant:`outline`,children:p()}),note:le(),children:[(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(W,{value:G.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>K(`langfuse`,`host`,e.target.value),onBlur:()=>q(`langfuse`,{host:G.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:s(),checked:G.langfuse.enabled??!0,onChange:e=>{K(`langfuse`,`enabled`,e),q(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(U,{variant:`secondary`,children:c()}):(0,Y.jsx)(U,{variant:`outline`,children:m()}):(0,Y.jsx)(U,{variant:`outline`,children:p()}),note:i(),children:[(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)(W,{value:G.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>K(`opik`,`baseUrl`,e.target.value),onBlur:()=>q(`opik`,{baseUrl:G.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:te(),children:(0,Y.jsx)(W,{value:G.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||u(),onChange:e=>K(`opik`,`workspace`,e.target.value),onBlur:()=>q(`opik`,{workspace:G.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:s(),checked:G.opik.enabled??!0,onChange:e=>{K(`opik`,`enabled`,e),q(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(U,{variant:`outline`,children:l()}),note:re(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)($,{value:G.tts.auto??`off`,options:[[`off`,E()],[`always`,r()],[`inbound`,D()],[`tagged`,ie()]],onChange:e=>{K(`tts`,`auto`,e),q(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:o(),children:(0,Y.jsx)($,{value:G.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,ee()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{K(`tts`,`provider`,e),q(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:ce(),children:(0,Y.jsx)(W,{value:G.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>K(`tts`,`model`,e.target.value),onBlur:()=>q(`tts`,{model:G.tts.model??``})})}),(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)(W,{value:G.tts.voice??``,placeholder:a(),onChange:e=>K(`tts`,`voice`,e.target.value),onBlur:()=>q(`tts`,{voice:G.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:se(),status:(0,Y.jsx)(U,{variant:`outline`,children:l()}),note:e.secrets.openai?z():v(),children:[(0,Y.jsx)(Q,{label:B(),checked:G.talk.enabled??!1,onChange:e=>{K(`talk`,`enabled`,e),q(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:L(),children:(0,Y.jsx)($,{value:G.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{K(`talk`,`realtimeProvider`,e),q(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)(W,{value:G.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>K(`talk`,`realtimeModel`,e.target.value),onBlur:()=>q(`talk`,{realtimeModel:G.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)(W,{value:G.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>K(`talk`,`voice`,e.target.value),onBlur:()=>q(`talk`,{voice:G.talk.voice??``})})}),(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)($,{value:G.talk.transport??`webrtc`,options:[[`webrtc`,w()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{K(`talk`,`transport`,e),q(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:k(),children:(0,Y.jsx)(W,{value:G.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>K(`talk`,`speechLocale`,e.target.value),onBlur:()=>q(`talk`,{speechLocale:G.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:M(),checked:G.talk.interruptOnSpeech??!0,onChange:e=>{K(`talk`,`interruptOnSpeech`,e),q(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:S()}),(0,Y.jsx)(U,{variant:`outline`,children:b()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[I(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:O(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:y(),columns:[{header:F(),cell:e=>(0,Y.jsx)(U,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:j(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:_(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:T(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ue(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(H,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(G,{value:e,onValueChange:n,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(de,{})}),(0,Y.jsx)(q,{children:t.map(([e,t])=>(0,Y.jsx)(fe,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Ax as i,Bx as a,Cx as o,Dw as s,Dx as c,Ex as l,Fx as u,Gx as d,Hx as f,Ix as p,Jx as m,Kx as h,Lx as ee,Mx as te,Nx as ne,Ox as re,Px as g,Qx as _,Rx as v,Sw as y,Sx as ie,Tx as ae,Ux as oe,Vx as se,Wx as ce,Xx as le,Yx as ue,Zx as b,_w as x,bx as S,cw as C,dw as w,eT as T,fw as E,gw as D,hw as O,jx as k,kx as A,lw as j,mw as M,oT as N,pw as P,qx as F,sT as I,sm as L,sw as R,uw as z,vw as B,wx as V,xx as H,yw as de,zx as fe}from"./dist-DC2Oibm5.js";import{t as U}from"./button-68hHQyd5.js";import{A as pe,E as W,O as me,Z as G,_ as he,b as ge,ot as K,v as _e,x as ve,y as q}from"./index-DGI4ATru.js";var J=t(e(),1),Y=[{id:`messages`,label:()=>r()},{id:`composer`,label:()=>_()},{id:`sidebar`,label:()=>b()},{id:`other`,label:()=>le()}],X={showSource:{category:`messages`,label:()=>ue(),help:()=>m()},showReport:{category:`messages`,label:()=>F(),help:()=>h()},copyAssistant:{category:`messages`,label:()=>d()},copyUser:{category:`messages`,label:()=>ce()},showDelete:{category:`messages`,label:()=>oe()},showTools:{category:`messages`,label:()=>f(),help:()=>se()},voiceInput:{category:`composer`,label:()=>a(),help:()=>fe()},showChatAge:{category:`sidebar`,label:()=>v(),help:()=>ee()},showChatProvider:{category:`sidebar`,label:()=>p(),help:()=>u()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function ye(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var be=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],xe={voiceInput:`voiceInput`};function Se(e){return be.includes(e)}function Q(e){return e===`admin`}function Ce(e){return e===!0?`on`:e===!1?`off`:`inherit`}function we(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Se(e)?xe[e]:void 0}var $=n(),Ee={voiceInput:()=>V()};function De({prefKey:e,ui:t}){let n=N(T.admin.setUiPrefDefault),r=N(T.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:re()}),(0,$.jsxs)(he,{value:Ce(t.defaults[e]),onValueChange:t=>void n({key:e,value:we(t)}),children:[(0,$.jsx)(ge,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ve,{})}),(0,$.jsxs)(_e,{children:[(0,$.jsx)(q,{value:`on`,children:ie()}),(0,$.jsx)(q,{value:`off`,children:H()}),(0,$.jsx)(q,{value:`inherit`,children:S()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":c()}),c()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),a=I(T.me.getMe,{host:K}),c=a?.ui,u=Q(a?.role)&&n,d=N(T.me.setUiPref).withOptimisticUpdate(me),f=(0,J.useMemo)(()=>c?ye(Object.keys(c.effective),e):[],[c,e]);return c?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Q(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":A()}),A()]}):null,u?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:l()}),(0,$.jsx)(`p`,{children:ae()}),(0,$.jsx)(`p`,{children:o()})]}):null,(0,$.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),f.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:f.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),a=c.locked[e],o=c.effective[e],s=c.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${a?` is-locked`:``}${s&&!a?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,a?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:te()}):s?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:k()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!a&&s?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void d({key:e,value:null}),children:i()}):null,(0,$.jsx)(W,{checked:o,disabled:a,onCheckedChange:t=>void d({key:e,value:t===!0}),"aria-label":n})]}),u?(0,$.jsx)(De,{prefKey:e,ui:c}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:s()})}function ke(){let e=I(T.me.getMe,{host:K}),t=N(T.me.setLocale),n=N(T.me.setMyName),r=pe(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,J.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(O())}catch(e){r.error(M(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:de()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:B()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(G,{className:`max-w-xs`,value:c,maxLength:120,placeholder:x(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,$.jsx)(U,{size:`sm`,disabled:!l,onClick:()=>void u(),children:L()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:P()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(U,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?C():e===`en`?R():y()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:z()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Cc as i,Dc as a,Ec as o,Hc as s,Mc as c,Nc as l,Oc as u,Pc as d,Sc as f,Tc as p,Vc as m,_c as h,bc as g,eT as _,gc as v,hc as y,jc as b,kc as x,oT as S,sT as C,vc as w,wc as T,xc as E,yc as D}from"./dist-DC2Oibm5.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-qmnobZin.js";import{t as I}from"./button-68hHQyd5.js";import{A as L,E as R,_ as z,b as B,v as V,x as H,y as U}from"./index-DGI4ATru.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:x,help:u},documentary_fetch:{label:a,help:o},inbound_files:{label:p,help:T}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:h,references:v,files:y};function Y(){let e=C(_.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:f()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(M,{label:d(),help:l()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:i()}),(0,G.jsxs)(z,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(B,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(H,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(U,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=S(_.admin.upsertInstanceConfig),n=L(),r=e.config??{},[i,a]=(0,W.useState)(()=>A(r)),[o,c]=(0,W.useState)(!1),l=i.promptInjections,u=(e,t)=>a({...i,promptInjections:{...l,[e]:{...l[e],...t}}});async function d(){c(!0);try{await t({instanceId:e._id,config:N(i,r)})}catch(e){n.error(m(),e)}finally{c(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:l[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>u(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void d(),disabled:o,children:s()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:a}){let[o,s]=(0,W.useState)(!1),l=i.template.trim()!==t.defaultTemplate,u=t.togglable&&!i.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),f=O(e,i),p=f?k(f,d):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(R,{checked:i.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),l&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:b()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:r()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?g():E()}),l&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:c()})]})]}),o&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:D()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:w()})})]})}export{Y as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bd as ee,Cf as i,Hd as a,Id as te,Ld as ne,Qd as o,Rd as s,Sf as c,Tf as l,Ud as u,Vd as d,Wd as f,Xd as p,Zd as m,_f as h,af as g,bf as _,cf as v,df as y,eT as b,ef as x,ff as re,gf as S,hf as C,if as ie,lf as ae,mf as w,nf as T,oT as E,of as D,pf as O,rf as k,sT as A,sf as j,tf as M,uf as N,vf as P,wf as F,xf as I,yf as L,zd as R}from"./dist-DC2Oibm5.js";import{t as z}from"./button-68hHQyd5.js";import{A as B,E as V,X as H,Z as U,j as W,m as G,xt as K}from"./index-DGI4ATru.js";import{t as q}from"./roleDescriptions-CU2PycEu.js";var J=t(e(),1),Y=n(),X=[{group:()=>l(),keys:[{key:`traces.read`,label:()=>_()},{key:`traces.read.content`,label:()=>L(),phi:!0},{key:`traces.write`,label:()=>P()}]},{group:()=>F(),keys:[{key:`kpi.read`,label:()=>_()},{key:`kpi.write`,label:()=>P()}]},{group:()=>i(),keys:[{key:`openclaw.query`,label:()=>h()},{key:`anomalies.read`,label:()=>S()},{key:`anomalies.report`,label:()=>C()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>_()},{key:`selfheal`,label:()=>O()}]},{group:()=>I(),keys:[{key:`admin.manage`,label:()=>w()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=A(b.apiKeys.listRoles,{}),t=E(b.apiKeys.createRole),n=E(b.apiKeys.ensureRolesSeeded),i=E(b.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(b.apiKeys.listRoles,{});r&&e.setQuery(b.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=B(),[h,_]=(0,J.useState)(!1),[S,C]=(0,J.useState)(Q),[w,O]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{l.error(y(),e)})},[n,l]);let P=e??[];async function F(e,t){if(Z(e.permissions)||w.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:N({name:e.name}),description:ae(),confirmLabel:v()}))){O(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(j(),e)}finally{O(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C(Q),_(!1)}catch(e){l.error(D(),e)}}let L=e===void 0,$=!L&&P.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,ie(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,k()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:T()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{C(Q),_(!0)},children:M()})})]}),L?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:o()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?re({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:P.map(e=>{let t=Z(e.permissions),n=w.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,m()]}):(0,Y.jsx)(H,{variant:`secondary`,children:p()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?f():n?u():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:h,onOpenChange:_,title:a(),description:d(),canSubmit:!!(S.key&&S.name),onSubmit:I,submitLabel:ee(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:R()}),(0,Y.jsx)(U,{value:S.key,placeholder:s(),onChange:e=>C({...S,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,Y.jsx)(U,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Y.jsx)(U,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as ee,Bb as te,Cb as ne,Db as re,Eb as ie,Fb as ae,Gb as oe,Hb as se,Ib as ce,Jb as le,Kb as ue,Lb as de,Mb as fe,Nb as pe,Ob as me,Pb as he,Qb as ge,Rb as _e,Sb as a,Tb as ve,Ub as ye,Vb as be,Wb as xe,Xb as Se,Yb as Ce,Zb as we,_b as o,_x as Te,ab as s,ax as Ee,bb as c,cb as l,cx as De,db as u,dx as Oe,eT as d,eb as f,ex as ke,fb as Ae,fx as je,gb as Me,gx as Ne,hb as Pe,hx as Fe,iT as Ie,ib as p,ix as Le,jb as Re,kb as ze,lb as m,lx as Be,mb as h,mx as g,nb as _,nx as Ve,oT as v,ob as y,ox as He,pb as b,px as x,qb as Ue,rb as S,rx as We,sT as C,sb as w,sx as Ge,tb as T,tx as Ke,ub as E,ux as qe,vb as D,vx as Je,wb as Ye,xb as O,yb as k,yx as Xe,zb as Ze}from"./dist-DC2Oibm5.js";import{n as Qe}from"./dist-C6DxU1UR.js";import{i as $e}from"./dist-DZxb8Lg7.js";import{t as A}from"./button-68hHQyd5.js";import{$ as j,A as et,At as tt,Et as M,Ot as nt,Q as N,X as P,Z as F,_ as I,b as L,et as R,j as rt,kt as it,m as at,nt as z,rt as B,tt as V,v as H,x as U,y as W}from"./index-DGI4ATru.js";import{t as ot}from"./FilterBar-CoklwXid.js";import{t as st}from"./DataTableShell-B3BNv6WF.js";import{t as ct}from"./roleDescriptions-CU2PycEu.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>p(),days:30},{value:`90`,label:()=>S(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,G.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),l=C(d.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),u=C(d.apiKeys.listKeys,{}),f=C(d.apiKeys.listRoles,{}),Ae=v(d.apiKeys.createServiceAccount),Me=v(d.apiKeys.updateServiceAccount),Pe=v(d.apiKeys.deleteServiceAccount),p=Ie(d.apiKeys.mintApiKey),m=v(d.apiKeys.revokeApiKey),h=rt(),_=et(),y=n!==``||a!==J||i!==J;function b(){o(J),t({search:{},replace:!0})}let[S,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,Qe]=(0,G.useState)(new Set),[j,M]=(0,G.useState)(null),N=(0,G.useRef)(!1),[R,z]=(0,G.useState)(new Set),[B,V]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function Q(e){Qe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await Me({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),_.success(de())):await Ae({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),w(!1)}catch(e){_.error(D?_e():Ze(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function $(e){if(N.current)return;N.current=!0;let t=B[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;M(e._id);try{let t=await p({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(ce(),e)}finally{N.current=!1,M(null)}}async function mt(e){if(await h({title:ae(),description:(0,K.jsxs)(K.Fragment,{children:[he(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,pe(),` `,(0,K.jsx)(`strong`,{children:fe()}),` `,Re()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await Pe({serviceAccountId:e._id}),_.success(ze(),e.name)}catch(e){_.error(me(),e)}}async function ht(e){if(await h({title:re(),description:(0,K.jsxs)(K.Fragment,{children:[ie(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ve()]}),confirmLabel:Ye(),destructive:!0})&&!R.has(e._id)){z(t=>new Set(t).add(e._id));try{await m({keyId:e._id})}catch(e){_.error(ne(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}),(0,K.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:Je(),onReset:b,canReset:y,children:[(0,K.jsxs)(I,{value:a,onValueChange:o,children:[(0,K.jsx)(L,{size:`sm`,className:`w-40`,children:(0,K.jsx)(U,{placeholder:Te()})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{value:J,children:Ne()}),(f??[]).map(e=>(0,K.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(I,{value:i,onValueChange:c,children:[(0,K.jsx)(L,{size:`sm`,className:`w-36`,children:(0,K.jsx)(U,{})}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{value:J,children:Fe()}),(0,K.jsx)(W,{value:`active`,children:g()}),(0,K.jsx)(W,{value:`disabled`,children:x()})]})]})]}),(0,K.jsx)(st,{title:je(),rows:l,addLabel:Oe(),onAdd:()=>{E(Y),O(null),w(!0)},emptyHint:qe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:R}),rowActions:e=>[{label:He(),onSelect:()=>pt(e)},{label:Be(),onSelect:()=>void $(e)},{label:k.has(e._id)?De():Ge(),onSelect:()=>Q(e._id)},{label:Ee(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Le():We(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)($e,{}):(0,K.jsx)(nt,{})})},{header:Ve(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ke(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(P,{variant:`secondary`,children:e.roleKey})},{header:ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(P,{variant:`destructive`,children:x()}):(0,K.jsx)(P,{variant:`outline`,children:g()})},{header:r(),cell:e=>(0,K.jsxs)(I,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(L,{size:`sm`,className:`w-32`,children:(0,K.jsx)(U,{})}),(0,K.jsx)(H,{children:q.map(e=>(0,K.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:ge(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:j===e._id?we():Se({count:t})})}}]}),(0,K.jsx)(at,{open:S,onOpenChange:e=>{w(e),e||O(null)},title:D?Ce():ue(),description:D?le():oe(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Ue():xe(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,K.jsx)(F,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:se()}),(0,K.jsxs)(I,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(L,{className:`w-full`,children:(0,K.jsx)(U,{placeholder:be()})}),(0,K.jsx)(H,{children:(f??[]).map(e=>(0,K.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,K.jsx)(F,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:c()}),(0,K.jsx)(`th`,{children:k()}),(0,K.jsx)(`th`,{children:D()}),(0,K.jsx)(`th`,{children:o()}),(0,K.jsx)(`th`,{children:Me()}),(0,K.jsx)(`th`,{children:Pe()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(P,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?h():b()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(N,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(j,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(z,{children:[(0,K.jsx)(B,{children:Ae()}),(0,K.jsx)(R,{children:u({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:E()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":m(),children:[n?(0,K.jsx)(Qe,{}):(0,K.jsx)(M,{}),n?l():w()]})]}),(0,K.jsx)(V,{children:(0,K.jsx)(A,{onClick:()=>{r(!1),t()},children:y()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?_():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(P,{variant:`destructive`,children:T()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(P,{variant:`outline`,children:f()}):(0,K.jsx)(P,{variant:`outline`,children:i()})}export{X as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as a,CS as o,Cw as s,DS as c,ES as l,FS as u,GS as d,HS as f,IS as p,JS as m,KS as h,LS as ee,MS as g,NS as te,OS as ne,PS as re,QS as ie,RS as ae,SC as oe,SS as se,TS as ce,Tw as le,US as ue,VS as de,WS as fe,XS as pe,YS as me,ZS as he,_C as ge,_S as _e,aC as ve,aS as ye,bC as be,bS as _,cC as xe,cS as v,cw as Se,dC as Ce,dS as we,eC as Te,eS as Ee,eT as y,fC as b,fS as De,gC as Oe,gS as ke,hC as Ae,hS as je,iC as Me,iS as x,iT as Ne,jS as Pe,kS as Fe,lC as Ie,lS as Le,mC as Re,mS as ze,n as Be,nC as Ve,nS as He,oC as Ue,oS as We,oT as S,pC as Ge,pS as Ke,qS as qe,rC as Je,rS as Ye,sC as Xe,sS as Ze,sT as C,sw as Qe,tC as $e,tS as et,tT as tt,uC as nt,uS as rt,vC as it,vS as at,wS as ot,ww as st,xC as ct,xS as lt,yC as ut,yS as dt,zS as w}from"./dist-DC2Oibm5.js";import{n as T}from"./dist-C6DxU1UR.js";import{t as ft}from"./TimeRangePicker-WuBOXKuJ.js";import{t as E}from"./x-YTR7quzM.js";import{t as D}from"./button-68hHQyd5.js";import{E as O,G as pt,J as k,K as A,W as mt,X as j,Y as ht,Z as M,_ as N,at as gt,b as P,it as _t,ot as F,q as vt,v as I,wt as L,x as R,y as z}from"./index-DGI4ATru.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-D3vxkef_.js";import{a as Tt,i as B,n as Et,o as V,r as H,t as Dt}from"./table-Cpg7ktx0.js";import{t as Ot}from"./FilterBar-CoklwXid.js";import{t as kt}from"./AdvancedFilter-D2FHLsw8.js";var U=tt(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),W=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function G(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(o());if(e.size>Lt)throw Error(se());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(_());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(_());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);G(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=G(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await q(f,`image/webp`,Bt)??await q(f,`image/png`);if(!h)throw Error(dt());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return K(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return K(e)}async function K(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(lt())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function q(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var J=n(),Y=`__all__`,X={kind:`relative`,from:`now-24h`,to:`now`},Ut=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,J.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?le():e===`dark`?st():s()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,J.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,J.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,J.jsxs)(`button`,{type:`button`,className:Be(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,J.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,J.jsx)(T,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,J.jsx)(Kt,{tokens:r,mode:i}):(0,J.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,J.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,J.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=C(y.charts.listMyCharts),r=S(y.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,J.jsx)(Q,{selected:e===null,title:b(),subtitle:Ce(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?nt():n.via===`owner`?Ie():xe({group:n.via.group});return(0,J.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):null]})}function Jt(){let e=S(y.charts.importChart),[t,n]=(0,W.useState)(``),[r,i]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,p]=(0,W.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(w())}}}async function g(){if(s(null),l(!1),t.trim()===``){s(ee());return}let a;try{a=JSON.parse(r)}catch{s(w());return}p(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{p(!1)}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:qe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:d()}),(0,J.jsx)(M,{value:t,onChange:e=>n(e.target.value),placeholder:fe(),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:ue()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:f(),rows:8,spellCheck:!1})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),de(),(0,J.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,J.jsx)(D,{size:`sm`,disabled:u,onClick:()=>void g(),children:a()})]}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,J.jsx)(`p`,{className:`oc-chart-import__ok`,children:ae()}):null]})]})}function Yt({chart:e}){let t=Ne(y.charts.setChartLogo),n=S(y.charts.removeChartLogo),[r,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(null),u=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Vt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await d(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=u(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await d(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=u(e),n=u(e===`light`?`dark`:`light`);return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?i():Fe()}),(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,J.jsx)(`img`,{src:t,alt:``}):null}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),t?c():ne(),(0,J.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:ce()}):null,t?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:l()}):null]})}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,J.jsx)(h,{mode:`light`}),(0,J.jsx)(h,{mode:`dark`})]}),r?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:ot()}):null,o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function $({chart:e}){let t=C(y.me.getMe,{host:F}),n=S(y.charts.addChartDomain),r=S(y.charts.removeChartDomain),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:ze()}):u.map(e=>(0,J.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ke({domain:e}),onClick:()=>void f(e),children:(0,J.jsx)(E,{className:`size-3`})})]},e))}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(M,{value:i,onChange:e=>a(e.target.value),placeholder:ke(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:je()})]}),(0,J.jsx)(`span`,{className:`oc-show__desc`,children:_e()}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=S(y.charts.updateChart),n=S(y.charts.deleteChart),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(e.name),[s,c]=(0,W.useState)(()=>JSON.stringify(e.tokens,null,2)),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);function p(){o(e.name),c(JSON.stringify(e.tokens,null,2)),u(null),i(!0)}async function m(){if(e.chartId===void 0)return;u(null);let n;try{n=JSON.parse(s)}catch{u(w());return}f(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}async function h(){if(e.chartId!==void 0&&window.confirm(v()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:p,children:te()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void h(),children:g()})]})})]}),r?(0,J.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:rt()}),(0,J.jsx)(M,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:Le()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),l?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:l}):null,(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,disabled:d,onClick:()=>void m(),children:De()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:we()})]})]}):null,(0,J.jsx)(Yt,{chart:e}),(0,J.jsx)($,{chart:e})]})}function Zt(){let e=C(y.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:p()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),e!==void 0&&t.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:re()}):(0,J.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,J.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=S(y.charts.addChartToGroupPool),i=S(y.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(j,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?r():e.kind===`custom`&&e.scope===`personal`?x():Te()}),e.isGlobalDefault?(0,J.jsx)(j,{variant:`default`,children:ie()}):null]}),(0,J.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:pe()}),(o??[]).map(e=>(0,J.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":m({group:e.name}),onClick:()=>void u(e.groupId),children:(0,J.jsx)(E,{className:`size-3`})})]},e.groupId)),c.length>0?(0,J.jsxs)(N,{value:``,onValueChange:e=>void l(e),children:[(0,J.jsx)(P,{size:`sm`,className:`w-56`,children:(0,J.jsx)(R,{placeholder:me()})}),(0,J.jsx)(I,{children:c.map(e=>(0,J.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:he()}):null]})]})}function $t({chart:e}){let t=S(y.charts.promoteChartToCommon),n=S(y.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(v()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ye():x()}),e.ownerLabel?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:ye({owner:e.ownerLabel})}):null]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:He()}):null,(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:et()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(y.admin.setDefaultThemeMode),i=S(y.admin.setDefaultLocale),a=S(y.charts.setDefaultChart),o=C(y.charts.listChartsAdmin),s=C(y.groups.listGroups,{}),c=e??`system`,l=t??`fr`;return(0,J.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:b()}),gt.map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,J.jsx)(Qt,{chart:e,groups:s??[]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:$e()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,J.jsx)($,{chart:e})]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()}):(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,J.jsx)($t,{chart:e},e.key))})})()]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:oe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,J.jsx)(D,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,J.jsx)(D,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?Se():Qe()},e))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:it()})]})]})}function tn(){let e=C(y.me.getMe,{host:F}),t=_t(e?.resolvedThemeMode);return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,J.jsx)(Jt,{}),(0,J.jsx)(Zt,{}),e?.role===`admin`?(0,J.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,W.useState)(!0),[n,r]=(0,W.useState)(`per-user`),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(Y),[c,l]=(0,W.useState)(Y),[u,d]=(0,W.useState)(X),f=i!==``||o!==Y||c!==Y;function p(){a(``),s(Y),l(Y),d(X)}return(0,J.jsxs)(`div`,{className:`oc-show`,children:[(0,J.jsx)(tn,{}),(0,J.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,J.jsx)(`summary`,{className:`oc-show__title`,children:ge()}),(0,J.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(D,{variant:`outline`,children:`Outline`}),(0,J.jsx)(D,{variant:`ghost`,children:`Ghost`}),(0,J.jsx)(D,{variant:`destructive`,children:`Destructive`}),(0,J.jsx)(D,{variant:`link`,children:`Link`})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,children:`Small`}),(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{size:`lg`,children:`Large`}),(0,J.jsx)(D,{size:`icon`,"aria-label":`more`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(D,{disabled:!0,children:`Disabled`})]})]}),(0,J.jsx)(Z,{title:`Badges`,children:(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(j,{children:`Default`}),(0,J.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(j,{variant:`outline`,children:`Outline`}),(0,J.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,J.jsx)(Z,{title:`Inputs & selection`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(M,{placeholder:`Text input…`}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsxs)(N,{value:n,onValueChange:r,children:[(0,J.jsx)(P,{className:`w-56`,children:(0,J.jsx)(R,{placeholder:`Select…`})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,J.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,J.jsxs)(`label`,{className:`oc-show__check`,children:[(0,J.jsx)(O,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,J.jsx)(Z,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,J.jsxs)(N,{value:o,onValueChange:s,children:[(0,J.jsx)(P,{size:`sm`,children:(0,J.jsx)(R,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:Y,children:`Toutes directions`}),(0,J.jsx)(z,{value:`inbound`,children:`inbound`}),(0,J.jsx)(z,{value:`outbound`,children:`outbound`}),(0,J.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,J.jsxs)(N,{value:c,onValueChange:l,children:[(0,J.jsx)(P,{size:`sm`,children:(0,J.jsx)(R,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{value:Y,children:`Toutes sévérités`}),(0,J.jsx)(z,{value:`info`,children:`info`}),(0,J.jsx)(z,{value:`warn`,children:`warn`}),(0,J.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,J.jsx)(kt,{fields:Ut,onChange:()=>{}}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,J.jsx)(ft,{value:u,onChange:d})]})]})}),(0,J.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,J.jsxs)(mt,{children:[(0,J.jsx)(ht,{asChild:!0,children:(0,J.jsx)(D,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,J.jsx)(L,{})})}),(0,J.jsxs)(pt,{align:`start`,children:[(0,J.jsx)(vt,{children:`Actions`}),(0,J.jsx)(k,{}),(0,J.jsx)(A,{children:`Edit`}),(0,J.jsx)(A,{children:`Duplicate`}),(0,J.jsx)(k,{}),(0,J.jsx)(A,{variant:`destructive`,children:`Delete`})]})]})}),(0,J.jsx)(Z,{title:`Card`,children:(0,J.jsxs)(wt,{className:`w-80`,children:[(0,J.jsxs)(yt,{children:[(0,J.jsx)(St,{children:`Instance`}),(0,J.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,J.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,J.jsxs)(bt,{className:`gap-2`,children:[(0,J.jsx)(D,{size:`sm`,children:`Save`}),(0,J.jsx)(D,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,J.jsx)(Z,{title:`Table`,children:(0,J.jsxs)(Dt,{children:[(0,J.jsx)(Tt,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(B,{className:`w-8`,children:(0,J.jsx)(O,{"aria-label":`select all`})}),(0,J.jsx)(B,{children:`Name`}),(0,J.jsx)(B,{children:`Mode`}),(0,J.jsx)(B,{className:`text-right`,children:`Status`}),(0,J.jsx)(B,{className:`w-8`})]})}),(0,J.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{children:(0,J.jsx)(O,{"aria-label":`select ${e.n}`})}),(0,J.jsx)(H,{className:`font-medium`,children:e.n}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{variant:`secondary`,children:e.m})}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-3.5`}),` `,e.s]})}),(0,J.jsx)(H,{children:(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,J.jsx)(L,{})})})]},e.n))})]})}),(0,J.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,J.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,J.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,J.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,J.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,J.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,J.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,J.jsx)(`span`,{className:`oc-run-status__dot`}),(0,J.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$l as i,B_ as a,Bl as o,C_ as s,E_ as c,F_ as l,Fl as u,G_ as d,Gl as f,H_ as p,Hl as m,I_ as h,Il as g,J_ as _,Jl as ee,K_ as v,Kl as y,L_ as b,Ll as x,M_ as S,N_ as te,P_ as ne,Q_ as C,Ql as re,R_ as w,Rl as ie,S_ as T,T_ as ae,U_ as E,Ul as oe,V_ as D,Vl as se,W_ as ce,Wl as le,X_ as O,Xl as ue,Y_ as k,Yl as de,Z_ as A,Zl as fe,__ as j,_u as pe,au as me,b_ as M,cu as he,du as ge,eT as N,eu as _e,ev as ve,f_ as ye,fu as be,g_ as xe,gu as Se,h_ as Ce,hu as we,iu as Te,j_ as Ee,lu as De,m_ as Oe,mu as ke,nu as Ae,oT as P,ou as je,p_ as Me,pu as Ne,q_ as Pe,ql as Fe,ru as Ie,sT as F,su as Le,tT as I,tu as Re,tv as ze,uu as Be,v_ as Ve,vu as He,w_ as Ue,x_ as We,y_ as Ge,yu as Ke,z_ as qe,zl as Je}from"./dist-DC2Oibm5.js";import{n as Ye}from"./dist-C6DxU1UR.js";import{n as L}from"./TimeRangePicker-WuBOXKuJ.js";import{t as Xe}from"./x-YTR7quzM.js";import{i as R,n as z,r as Ze,t as Qe}from"./tabs-CtLuGbAQ.js";import{t as B}from"./button-68hHQyd5.js";import{$ as $e,At as et,Ct as tt,Et as nt,Q as rt,X as V,_ as H,a as it,b as U,et as at,i as ot,k as st,kt as ct,nt as lt,o as ut,ot as dt,r as ft,rt as pt,v as W,x as G,y as K}from"./index-DGI4ATru.js";import{t as mt}from"./FilterBar-CoklwXid.js";import{t as ht}from"./AdvancedFilter-D2FHLsw8.js";import{t as q}from"./DataTableShell-B3BNv6WF.js";var gt=I(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_t=I(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),vt=I(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function yt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?h():n===`agent`?`${l()} - ${r}`:e}function bt(){let e=F(N.me.getMe,{host:dt})?.role===`admin`,t=F(N.deliveryTiming.getDeliveryStatus,{}),n=P(N.deliveryTiming.startDeliveryRecord),i=P(N.deliveryTiming.stopDeliveryRecord),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:ze()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ve()})]}),e?(0,Y.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?C():r()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(V,{variant:`secondary`,children:A()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:O({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?Pe():_()})}),a?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=F(N.deliveryTiming.listDeliverySessions,{}),n=P(N.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,f]=(0,J.useState)(null),{from:m,to:h}=L(c),g=c.to===`now`?1/0:h,_=r.trim()!==``||o!==`all`||c!==X,ee=()=>{i(``),s(`all`),l(X)},y=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,m,g]),x=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(mt,{q:r,onQChange:i,searchPlaceholder:d(),timeRange:c,onTimeRangeChange:l,onReset:ee,canReset:_,children:(0,Y.jsxs)(H,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:`all`,children:ce()}),(0,Y.jsx)(K,{value:`active`,children:E()}),(0,Y.jsx)(K,{value:`stopped`,children:p()})]})]})}),(0,Y.jsx)(q,{title:v(),rows:y,emptyHint:Me(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?te():ne(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(gt,{size:15,"aria-hidden":!0}):(0,Y.jsx)(tt,{size:15,"aria-hidden":!0})})},{header:D(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:a(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:qe(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:w(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:b(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(V,{variant:`secondary`,children:E()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:p()})}],rowActions:e?e=>[{label:S(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:S(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=F(N.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ct,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(st(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ct({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,ye()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ye,{size:13,"aria-hidden":!0}):(0,Y.jsx)(nt,{size:13,"aria-hidden":!0}),t?Oe():Ce()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:Ue()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:s()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:T()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(We(),r.bridge),i(M(),r.A),i(Ge(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:j()})]})}var wt=[50,100,200,500],Tt=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=et({from:`/settings/traces`}),t=ct({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,d=e.q??``,p=ft(e.from,e.to),h=(0,J.useMemo)(()=>ut(e.adv),[e.adv]),{from:g,to:_}=L(p),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),te=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),C=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),w=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,...it(e)})}),O=e=>void t({search:t=>({...t,adv:ot(e)}),replace:!0}),k=F(N.observability.listEvents,{limit:n}),A=F(N.observability.listEvents,{limit:n,kind:r===Tt?void 0:r,filter:{q:d||void 0,from:g,to:_,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:h.length>0?h:void 0}}),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),M=(0,J.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),ve=d!==``||a!==Q||s!==Q||l!==Q||u!==Q||h.length>0||p.kind!==`relative`||p.from!==kt.from;function ye(){t({search:{limit:100,kind:`all`},replace:!0})}let xe=v?k?.filter(e=>e.correlationId===v):A,[Ce,Ee]=(0,J.useState)(`events`);return(0,Y.jsxs)(Qe,{value:Ce,onValueChange:e=>Ee(e),children:[(0,Y.jsxs)(Ze,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(_t,{size:13,"aria-hidden":!0}),c()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),ae()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(bt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke(),(0,Y.jsx)(`strong`,{children:He()}),pe(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:Se()})]}),(0,Y.jsxs)(mt,{q:d,onQChange:C,searchPlaceholder:we(),timeRange:p,onTimeRangeChange:ce,onReset:ye,canReset:ve,children:[(0,Y.jsxs)(H,{value:a,onValueChange:w,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:ke()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Q,children:Ne()}),Et.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(H,{value:s,onValueChange:T,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:be()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Q,children:ge()}),Dt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(H,{value:l,onValueChange:E,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:Be()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Q,children:De()}),Ot.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(H,{value:u,onValueChange:D,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{placeholder:he()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Q,children:Le()}),M.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(H,{value:r,onValueChange:ne,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(G,{placeholder:je()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Tt,children:me()}),j.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(H,{value:String(n),onValueChange:e=>te(Number(e)),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(W,{children:wt.map(e=>(0,Y.jsx)(K,{value:String(e),children:Te({count:e})},e))})]})]}),(0,Y.jsx)(ht,{fields:At,seed:h,onChange:O}),v?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Ie(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ae(),(0,Y.jsx)(`code`,{children:$(v)})]}),(0,Y.jsx)(Xe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:Re()})]})}):null,(0,Y.jsx)(q,{title:_e(),rows:xe,emptyHint:v?i():re(),columns:[{header:fe(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:ue(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(V,{variant:`secondary`,children:e.kind})},{header:de(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ee(),children:`✓`})}},{header:Fe(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(V,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:y(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:f(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:m(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:o(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:ie()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:x,onClose:()=>S(null)})]})]})}function Mt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Nt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Pt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(rt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)($e,{className:`max-w-lg`,children:[(0,Y.jsxs)(lt,{children:[(0,Y.jsxs)(pt,{className:`oc-traces__meta-title`,children:[x(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(V,{variant:`outline`,children:g()})]}),(0,Y.jsx)(at,{children:u()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$m as i,Am as a,Bm as o,Dm as s,Em as c,Fm as l,Gm as u,Hm as d,Im as f,Jm as ee,Km as te,Lm as ne,Mm as re,Nm as p,Om as ie,Pm as ae,Qc as m,Qm as h,Rm as g,Um as oe,Vm as se,Wm as ce,Xc as _,Xm as le,Ym as ue,Zc as v,Zm as de,al as y,cl as b,eT as x,eh as S,el as C,il as w,jm as fe,km as pe,nl as T,oT as E,ol as D,qm as me,rl as O,sT as k,sl as A,sm as he,tl as j,zm as ge}from"./dist-DC2Oibm5.js";import{t as M}from"./button-68hHQyd5.js";import{$ as N,A as P,At as F,E as I,G as L,K as R,M as z,Q as B,W as _e,X as V,Y as ve,_ as H,_t as U,b as W,d as G,et as ye,f as be,gt as K,j as xe,kt as Se,nt as Ce,ot as we,p as q,q as Te,rt as Ee,v as J,x as Y,y as X}from"./index-DGI4ATru.js";import{t as De}from"./FilterBar-CoklwXid.js";import{t as Oe}from"./DataTableShell-B3BNv6WF.js";import{t as ke}from"./DetailChips-D3pYF8yO.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=k(x.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=k(x.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Q.jsx)(B,{open:n,onOpenChange:r,children:(0,Q.jsxs)(N,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:b({user:t})}),(0,Q.jsx)(ye,{children:A()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?D():y()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:j()}):[...d.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:i,assigned:a,defaultKey:o}){let s=E(x.agents.assignAgent),c=E(x.agents.removeAgent),l=E(x.agents.setDefaultAgent),u=P();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(O(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(T(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__kind`,children:n})]}),i.map(e=>{let n=`${t}/${e.agentId}`,i=a.has(n),s=o===n,c=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(I,{checked:i,disabled:c&&!i,onCheckedChange:()=>void d(e.agentId,i),"aria-label":C({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:r()}):null,e.outOfPool?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:m()}):null,i?s?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":v(),title:v(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":_(),title:_(),onClick:()=>void f(e.agentId),children:(0,Q.jsx)(K,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(q[e])).length;return(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?S():i({count:r})})}),(0,Q.jsxs)(L,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:h()}),G.map(e=>{let r=q[e];return(0,Q.jsxs)(R,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(I,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:be[e]??e})]},e)})]})]})}function Ne(){let e=F({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,r=e.role??$,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),m=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),h=k(x.admin.listUsers,{filter:{q:n||void 0,role:r===$?void 0:r},withAgents:!0}),_=k(x.me.getMe,{host:we}),v=E(x.admin.setRole),y=E(x.admin.setUserPermissions),b=E(x.admin.startImpersonation),S=E(x.admin.deleteUser),C=E(x.admin.setUserName),w=xe(),T=z(),D=P(),[O,A]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of h??[])e.add(t.role);return[...e]},[h]),M=n!==``||r!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await v(e)}catch(e){D.error(de(),e)}}async function L(e){try{await y(e)}catch(e){D.error(le(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:oe(),description:d({user:t}),confirmWord:se(),confirmLabel:o(),destructive:!0}))try{await S({profileId:e._id}),D.success(g({user:t}))}catch(e){D.error(ge(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:f(),label:l({user:t}),placeholder:ae(),defaultValue:e.name??``,confirmLabel:he()});if(n!==null)try{await C({profileId:e._id,name:n}),D.success(p())}catch(e){D.error(re(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:i,searchPlaceholder:ue(),onReset:N,canReset:M,children:(0,Q.jsxs)(H,{value:r,onValueChange:m,children:[(0,Q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(X,{value:$,children:ee()}),j.map(e=>(0,Q.jsx)(X,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:me(),rows:h,emptyHint:te(),rowActions:e=>{let t=[{label:c(),onSelect:()=>A({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ne(),onSelect:()=>void B(e)}];return e.userId!==_?.userId&&t.push({label:u(),onSelect:()=>void b({profileId:e._id})},{label:ce(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:fe(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:a(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(H,{value:e.role,onValueChange:t=>void I({profileId:e._id,role:t}),children:[(0,Q.jsx)(W,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(X,{value:`pending`,children:`pending`}),(0,Q.jsx)(X,{value:`user`,children:`user`}),(0,Q.jsx)(X,{value:`admin`,children:`admin`})]})]})},{header:pe(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ie()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),L({profileId:e._id,permissions:[...n]})}})},{header:s(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||A(null)}})]})}export{Ne as UsersTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{tT as e}from"./dist-DC2Oibm5.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,O as t,R as n,T as r,k as i,w as a}from"./dist-DC2Oibm5.js";var o=e=>typeof e==`string`?e:null;function s(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function c(e,t){let n=s(e),r=s(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n[e]-r[e];if(t!==0)return t}return 0}function l(e,t){if(e===null||t===null)return!1;let n=c(t,e.min);return n!==null&&n>=0}function u(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,s=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=o(e.min),n=o(e.maxValidated);t!==null&&n!==null&&(s={min:t,maxValidated:n})}let c=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:s,validatedVersions:c}}function d(e,t,n){if(e===null)return`unknown`;let{range:r}=u(n,t);return l(r,e)?r!==null&&(c(e,r.maxValidated)??0)>0?`beyond`:`supported`:`unknown`}function f(n){return n===`supported`?i():n===`beyond`?t():e()}function p(e){return e??n()}function m(e){return e===null?a():r({version:e})}function h(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}export{p as a,m as i,h as n,c as o,f as r,u as s,d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,Bi as t,Gi as n,Hi as r,Ii as i,Ji as a,Ki as o,Li as s,Qi as c,Ri as l,Ui as u,Vi as d,Wi as f,Xi as p,Yi as m,Zi as h,aa as g,ca as _,ea as v,ia as y,la as b,na as x,oa as S,qi as C,ra as w,sa as T,ta as E,ua as D,zi as O}from"./dist-DC2Oibm5.js";var k={AGENT_NOT_FOUND:()=>({label:D(),hint:b()}),AUTH_TOKEN_MISMATCH:()=>({label:_(),hint:T()}),DEVICE_SIGNING_FAILED:()=>({label:S(),hint:g()}),SESSION_SCOPE_DENIED:()=>({label:y(),hint:w()}),GATEWAY_TIMEOUT:()=>({label:x(),hint:E()}),GATEWAY_DISCONNECTED:()=>({label:v(),hint:e()}),ATTACHMENT_TOO_LARGE:()=>({label:p(),hint:m()}),ATTACHMENT_REJECTED:()=>({label:a(),hint:C()}),BRIDGE_UNREACHABLE:()=>({label:c(),hint:h()}),INVALID_REQUEST:()=>({label:o(),hint:n()}),NOT_CONFIGURED:()=>({label:f(),hint:u()}),UNROUTED:()=>({label:r(),hint:d()}),UPSTREAM_ERROR:()=>({label:t(),hint:O()}),UNKNOWN:()=>({label:l(),hint:s()})};function A(e){return e?k[e]?.()??{label:e,hint:i()}:k.UNKNOWN()}export{A as t};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Bw as i,Fw as a,Hw as o,Iw as s,Kw as c,Lw as l,Mw as u,Nw as d,Pw as f,Rw as p,Uw as m,Xw as h,qw as g,zw as _}from"./dist-DC2Oibm5.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,ee]=m(b),[S,C]=x(b),w=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[u,d]=i({prop:r,defaultProp:a??!1,onChange:o,caller:b});return(0,y.jsx)(S,{scope:t,triggerRef:c,contentRef:l,contentId:p(),titleId:p(),descriptionId:p(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};w.displayName=b;var T=`DialogTrigger`,E=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=C(T,n),o=r(t,a.triggerRef);return(0,y.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":K(a.open),...i,ref:o,onClick:c(e.onClick,a.onOpenToggle)})});E.displayName=T;var D=`DialogPortal`,[O,k]=x(D,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=C(D,t);return(0,y.jsx)(O,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||o.open,children:(0,y.jsx)(a,{asChild:!0,container:i,children:e})}))})};A.displayName=D;var j=`DialogOverlay`,M=v.forwardRef((e,t)=>{let n=k(j,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(j,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(P,{...i,ref:t})}):null});M.displayName=j;var N=h(`DialogOverlay.RemoveScroll`),P=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(j,n);return(0,y.jsx)(d,{as:N,allowPinchZoom:!0,shards:[i.contentRef],children:(0,y.jsx)(g.div,{"data-state":K(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),F=`DialogContent`,I=v.forwardRef((e,t)=>{let n=k(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(F,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(L,{...i,ref:t}):(0,y.jsx)(R,{...i,ref:t})})});I.displayName=F;var L=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return u(e)},[]),(0,y.jsx)(z,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),R=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(z,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),z=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,...c}=e,u=C(F,n),d=v.useRef(null),p=r(t,d);return f(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,y.jsx)(l,{role:`dialog`,id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":K(u.open),...c,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(X,{titleId:u.titleId}),(0,y.jsx)(Q,{contentRef:d,descriptionId:u.descriptionId})]})]})}),B=`DialogTitle`,V=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(B,n);return(0,y.jsx)(g.h2,{id:i.titleId,...r,ref:t})});V.displayName=B;var H=`DialogDescription`,U=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(H,n);return(0,y.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});U.displayName=H;var W=`DialogClose`,G=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(W,n);return(0,y.jsx)(g.button,{type:`button`,...r,ref:t,onClick:c(e.onClick,()=>i.onOpenChange(!1))})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=`DialogTitleWarning`,[J,Y]=o(q,{contentName:F,titleName:B,docsSlug:`dialog`}),X=({titleId:e})=>{let t=Y(q),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
-
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Z=`DialogDescriptionWarning`,Q=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Y(Z).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},$=w,te=E,ne=A,re=M,ie=I,ae=V,oe=U,se=G;export{ne as a,te as c,re as i,J as l,ie as n,$ as o,oe as r,ae as s,se as t,ee as u};
|