@lacneu/atrium 0.84.20 → 0.84.21
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-CoFRPa-e.js → AccessTab-7DgwkLkg.js} +1 -1
- package/dist/assets/{AdvancedFilter-CZnbykZe.js → AdvancedFilter-D-mIQhPG.js} +1 -1
- package/dist/assets/{AgentFilesTab-Bcz9V6fH.js → AgentFilesTab-DI6SkJi3.js} +1 -1
- package/dist/assets/{AnomaliesTab-YUjA4XnE.js → AnomaliesTab-CcdmV3_N.js} +1 -1
- package/dist/assets/{AuditTab-Jes9HRNk.js → AuditTab-De1aUlfc.js} +1 -1
- package/dist/assets/{BridgeTab-CWbabhHl.js → BridgeTab-BvlinzLy.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-DT3gBozQ.js → ChatDefaultsTab-LBCm6cXz.js} +1 -1
- package/dist/assets/{DataTableShell-CDmo0isC.js → DataTableShell-BK8Kucos.js} +1 -1
- package/dist/assets/{DetailChips-Csi8ao-5.js → DetailChips-DSrMAbLD.js} +1 -1
- package/dist/assets/{FeedbacksTab-9go4R--0.js → FeedbacksTab-Dn5lwj2V.js} +1 -1
- package/dist/assets/{FieldLabel-4AzJbj-7.js → FieldLabel-CgbnOAaa.js} +1 -1
- package/dist/assets/{FilesTab-CRGP9jbn.js → FilesTab-BR9OC5V_.js} +1 -1
- package/dist/assets/{FilterBar-CK5Wsnof.js → FilterBar-DHbB2cbQ.js} +1 -1
- package/dist/assets/{GroupsTab-HBoCEQWy.js → GroupsTab-CRUou4Sn.js} +1 -1
- package/dist/assets/{InstancesTab-CMEb9hT6.js → InstancesTab-DzK5DgDi.js} +1 -1
- package/dist/assets/{IntegrationsTab-hlpMleFu.js → IntegrationsTab-6rOgYMOt.js} +1 -1
- package/dist/assets/{KpiTab-Dqb9g4zO.js → KpiTab-BMKdEuEd.js} +1 -1
- package/dist/assets/{PreferencesTab-Bdlwezal.js → PreferencesTab-BNBLxTGr.js} +1 -1
- package/dist/assets/{ProjectPage-DWMUaSn7.js → ProjectPage-Dr7E7Gdc.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-DAajt_Z1.js → PromptInjectionsTab-B-hui4r1.js} +1 -1
- package/dist/assets/{RolesTab-DHifxhw3.js → RolesTab-DYYmUvDN.js} +1 -1
- package/dist/assets/{ScheduledTab-CeVs9uJe.js → ScheduledTab-B6mlE1sC.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-Bl7nm8Ph.js → ServiceAccountsTab-DcDezuba.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-O1q9pZe2.js → SubAgentReportsTab-D6R_3oe8.js} +1 -1
- package/dist/assets/{ThemeShowroom-BSjPrQxB.js → ThemeShowroom-BUXpwJRo.js} +1 -1
- package/dist/assets/{TimeRangePicker-DOkbYJPt.js → TimeRangePicker-B8MRcEsu.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DeJ3e50i.js → TimezoneCombobox-BYDYUkxC.js} +1 -1
- package/dist/assets/{TracesTab-M7MbrfPE.js → TracesTab-CGGE2Afj.js} +1 -1
- package/dist/assets/{UsersTab-DW6GasiH.js → UsersTab-LjXyy7nc.js} +1 -1
- package/dist/assets/{VoiceTab-CLMSu_Kx.js → VoiceTab-BGkLEvDq.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CYEBDkYv.js → highlighted-body-OFNGDK62-qznyJ1AG.js} +1 -1
- package/dist/assets/{index-DMM3fags.js → index-Bkfx3eIe.js} +6 -6
- package/dist/assets/mermaid-GHXKKRXX-D1_QmKBf.js +1 -0
- package/dist/assets/{pdf-CNbyQJnG.js → pdf-RQlFQI9k.js} +1 -1
- package/dist/assets/{tabs-vdU2pkw5.js → tabs-BBnOOIhM.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DDdByclK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as a,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as o,XP as Ce,YP as we,ZN as Te,ZP as Ee,_P as De,aF as Oe,aP as ke,aV as Ae,bP as je,cF as Me,cP as s,cV as c,dF as l,dP as u,eF as Ne,eP as d,fF as Pe,fP as f,gF as Fe,gP as p,hF as Ie,hP as m,iF as Le,iP as h,jP as Re,kP as ze,lF as Be,lP as g,mF as Ve,mP as _,nF as He,nP as v,oF as Ue,oP as y,pF as We,pP as b,qP as Ge,rF as Ke,rP as x,sF as qe,sP as S,sV as C,t as w,tF as Je,tP as T,uF as E,uP as D,vP as O,wP as Ye,xP as Xe,yP as k,zP as Ze}from"./api-B1lq0pb-.js";import{t as A}from"./button-Ds98Pj53.js";import{$ as j,Bn as Qe,Dt as $e,Et as M,Gn as et,Hn as tt,In as N,Kn as nt,Q as P,U as rt,Un as F,X as I,Z as L,_ as it,at as R,ct as z,et as B,it as V,jt as H,nt as U,ot as W,rt as G,st as at,tt as K}from"./index-DMM3fags.js";import{t as ot}from"./FilterBar-CK5Wsnof.js";import{t as st}from"./DataTableShell-CDmo0isC.js";import{t as ct}from"./roleDescriptions-BV5RwGCx.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>T(),days:30},{value:`90`,label:()=>d(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=nt({from:`/settings/serviceAccounts`}),t=et({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),Te=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),De=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),ke=c(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),s=c(w.apiKeys.listKeys,{}),u=c(w.apiKeys.listRoles,{}),d=C(w.apiKeys.createServiceAccount),f=C(w.apiKeys.updateServiceAccount),p=C(w.apiKeys.deleteServiceAccount),m=Ae(w.apiKeys.mintApiKey),h=C(w.apiKeys.revokeApiKey),g=rt(),_=$e(),v=n!==``||a!==X||r!==X;function y(){o(X),t({search:{},replace:!0})}let[b,x]=(0,q.useState)(!1),[S,T]=(0,q.useState)(Z),[D,O]=(0,q.useState)(null),[k,N]=(0,q.useState)(new Set),[F,R]=(0,q.useState)(null),z=(0,q.useRef)(!1),[V,U]=(0,q.useState)(new Set),[W,G]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of s??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[s]);function Q(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await f({serviceAccountId:D,name:S.name,roleKey:S.roleKey,description:S.description}),_.success(he())):await d({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),T(Z),O(null),x(!1)}catch(e){_.error(D?ae():ce(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),x(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=W[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;R(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(pe(),e)}finally{z.current=!1,R(null)}}async function $(e){if(await g({title:fe(),description:(0,J.jsxs)(J.Fragment,{children:[Re(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,J.jsx)(`strong`,{children:ze()}),` `,me()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(ie(),e.name)}catch(e){_.error(ye(),e)}}async function ht(e){if(await g({title:Ye(),description:(0,J.jsxs)(J.Fragment,{children:[ne(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ve()]}),confirmLabel:Xe(),destructive:!0})&&!V.has(e._id)){U(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(je(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,J.jsxs)(ot,{q:n,onQChange:Te,searchPlaceholder:Ie(),onReset:y,canReset:v,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(j,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:Ve()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:We()}),(u??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:r,onValueChange:De,children:[(0,J.jsx)(j,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:Pe()}),(0,J.jsx)(P,{value:`active`,children:l()}),(0,J.jsx)(P,{value:`disabled`,children:E()})]})]})]}),(0,J.jsx)(st,{title:Be(),rows:ke,addLabel:Me(),onAdd:()=>{T(Z),O(null),x(!0)},emptyHint:qe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Ke(),onSelect:()=>pt(e)},{label:Ue(),onSelect:()=>void mt(e)}]:[],{label:k.has(e._id)?Oe():Le(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:He(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Je():Ne(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(tt,{}):(0,J.jsx)(Qe,{})})},{header:i(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ge(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:E()}):(0,J.jsx)(M,{variant:`outline`,children:l()})},{header:Ce(),cell:e=>(0,J.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(j,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(L,{children:lt.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:we(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:F===e._id?le():Ge({count:t})})}}]}),(0,J.jsx)(it,{open:b,onOpenChange:e=>{x(e),e||O(null)},title:D?ue():be(),description:D?oe():se(),canSubmit:!!(S.name&&S.roleKey),onSubmit:ft,submitLabel:D?Se():xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,J.jsx)(H,{value:S.name,onChange:e=>T({...S,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,J.jsxs)(I,{value:S.roleKey||void 0,onValueChange:e=>T({...S,roleKey:e}),children:[(0,J.jsx)(j,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:_e()})}),(0,J.jsx)(L,{children:(u??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,J.jsx)(H,{value:S.description,onChange:e=>T({...S,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[k(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:De()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?u():D()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(R,{children:[(0,J.jsx)(W,{children:g()}),(0,J.jsx)(G,{children:s({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:S()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":y(),children:[n?(0,J.jsx)(F,{}):(0,J.jsx)(N,{}),n?ke():h()]})]}),(0,J.jsx)(V,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:x()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?r():z(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:a()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(M,{variant:`outline`,children:Te()}):(0,J.jsx)(M,{variant:`outline`,children:o()})}export{Q as ServiceAccountsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as a,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as o,XP as Ce,YP as we,ZN as Te,ZP as Ee,_P as De,aF as Oe,aP as ke,aV as Ae,bP as je,cF as Me,cP as s,cV as c,dF as l,dP as u,eF as Ne,eP as d,fF as Pe,fP as f,gF as Fe,gP as p,hF as Ie,hP as m,iF as Le,iP as h,jP as Re,kP as ze,lF as Be,lP as g,mF as Ve,mP as _,nF as He,nP as v,oF as Ue,oP as y,pF as We,pP as b,qP as Ge,rF as Ke,rP as x,sF as qe,sP as S,sV as C,t as w,tF as Je,tP as T,uF as E,uP as D,vP as O,wP as Ye,xP as Xe,yP as k,zP as Ze}from"./api-B1lq0pb-.js";import{t as A}from"./button-Ds98Pj53.js";import{$ as j,Bn as Qe,Dt as $e,Et as M,Gn as et,Hn as tt,In as N,Kn as nt,Q as P,U as rt,Un as F,X as I,Z as L,_ as it,at as R,ct as z,et as B,it as V,jt as H,nt as U,ot as W,rt as G,st as at,tt as K}from"./index-Bkfx3eIe.js";import{t as ot}from"./FilterBar-DHbB2cbQ.js";import{t as st}from"./DataTableShell-BK8Kucos.js";import{t as ct}from"./roleDescriptions-BV5RwGCx.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>T(),days:30},{value:`90`,label:()=>d(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=nt({from:`/settings/serviceAccounts`}),t=et({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),Te=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),De=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),ke=c(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),s=c(w.apiKeys.listKeys,{}),u=c(w.apiKeys.listRoles,{}),d=C(w.apiKeys.createServiceAccount),f=C(w.apiKeys.updateServiceAccount),p=C(w.apiKeys.deleteServiceAccount),m=Ae(w.apiKeys.mintApiKey),h=C(w.apiKeys.revokeApiKey),g=rt(),_=$e(),v=n!==``||a!==X||r!==X;function y(){o(X),t({search:{},replace:!0})}let[b,x]=(0,q.useState)(!1),[S,T]=(0,q.useState)(Z),[D,O]=(0,q.useState)(null),[k,N]=(0,q.useState)(new Set),[F,R]=(0,q.useState)(null),z=(0,q.useRef)(!1),[V,U]=(0,q.useState)(new Set),[W,G]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of s??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[s]);function Q(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await f({serviceAccountId:D,name:S.name,roleKey:S.roleKey,description:S.description}),_.success(he())):await d({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),T(Z),O(null),x(!1)}catch(e){_.error(D?ae():ce(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),x(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=W[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;R(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(pe(),e)}finally{z.current=!1,R(null)}}async function $(e){if(await g({title:fe(),description:(0,J.jsxs)(J.Fragment,{children:[Re(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,J.jsx)(`strong`,{children:ze()}),` `,me()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(ie(),e.name)}catch(e){_.error(ye(),e)}}async function ht(e){if(await g({title:Ye(),description:(0,J.jsxs)(J.Fragment,{children:[ne(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ve()]}),confirmLabel:Xe(),destructive:!0})&&!V.has(e._id)){U(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(je(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,J.jsxs)(ot,{q:n,onQChange:Te,searchPlaceholder:Ie(),onReset:y,canReset:v,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(j,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:Ve()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:We()}),(u??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:r,onValueChange:De,children:[(0,J.jsx)(j,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:Pe()}),(0,J.jsx)(P,{value:`active`,children:l()}),(0,J.jsx)(P,{value:`disabled`,children:E()})]})]})]}),(0,J.jsx)(st,{title:Be(),rows:ke,addLabel:Me(),onAdd:()=>{T(Z),O(null),x(!0)},emptyHint:qe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Ke(),onSelect:()=>pt(e)},{label:Ue(),onSelect:()=>void mt(e)}]:[],{label:k.has(e._id)?Oe():Le(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:He(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Je():Ne(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(tt,{}):(0,J.jsx)(Qe,{})})},{header:i(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ge(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:E()}):(0,J.jsx)(M,{variant:`outline`,children:l()})},{header:Ce(),cell:e=>(0,J.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(j,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(L,{children:lt.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:we(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:F===e._id?le():Ge({count:t})})}}]}),(0,J.jsx)(it,{open:b,onOpenChange:e=>{x(e),e||O(null)},title:D?ue():be(),description:D?oe():se(),canSubmit:!!(S.name&&S.roleKey),onSubmit:ft,submitLabel:D?Se():xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,J.jsx)(H,{value:S.name,onChange:e=>T({...S,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,J.jsxs)(I,{value:S.roleKey||void 0,onValueChange:e=>T({...S,roleKey:e}),children:[(0,J.jsx)(j,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:_e()})}),(0,J.jsx)(L,{children:(u??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,J.jsx)(H,{value:S.description,onChange:e=>T({...S,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[k(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:De()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?u():D()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(R,{children:[(0,J.jsx)(W,{children:g()}),(0,J.jsx)(G,{children:s({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:S()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":y(),children:[n?(0,J.jsx)(F,{}):(0,J.jsx)(N,{}),n?ke():h()]})]}),(0,J.jsx)(V,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:x()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?r():z(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:a()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(M,{variant:`outline`,children:Te()}):(0,J.jsx)(M,{variant:`outline`,children:o()})}export{Q as ServiceAccountsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Cl as i,Gc as a,Hc as o,Jc as s,Kc as c,Qc as l,Sl as u,Tl as d,Uc as f,Vc as p,Wc as m,Xc as h,Yc as g,Zc as _,_l as v,al as y,bl as b,cV as x,cl as S,dl as C,el as w,fl as T,gl as E,hl as D,il as O,ll as k,ml as A,nl as j,ol as M,pl as N,qc as P,rl as F,sV as I,sl as L,t as R,tl as ee,ul as z,vl as B,wl as V,xl as H,yl as U}from"./api-B1lq0pb-.js";import{t as W}from"./button-Ds98Pj53.js";import{U as G,ct as K}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Cl as i,Gc as a,Hc as o,Jc as s,Kc as c,Qc as l,Sl as u,Tl as d,Uc as f,Vc as p,Wc as m,Xc as h,Yc as g,Zc as _,_l as v,al as y,bl as b,cV as x,cl as S,dl as C,el as w,fl as T,gl as E,hl as D,il as O,ll as k,ml as A,nl as j,ol as M,pl as N,qc as P,rl as F,sV as I,sl as L,t as R,tl as ee,ul as z,vl as B,wl as V,xl as H,yl as U}from"./api-B1lq0pb-.js";import{t as W}from"./button-Ds98Pj53.js";import{U as G,ct as K}from"./index-Bkfx3eIe.js";import{t as q}from"./DataTableShell-BK8Kucos.js";var J=t(e(),1),Y=n(),X={hung:()=>S(),wrong_result:()=>L(),error:()=>M(),other:()=>y()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=I(R.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function v(){let t=u.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,O({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ee():w()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:r()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void v(),disabled:!u.trim()||f,children:f?h():_()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[g({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${P()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${c()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=x(R.subAgentReports.listForAdmin,{}),t=I(R.subAgentReports.readReport),n=I(R.subAgentReports.deleteReport),r=G(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function m(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function h(e){await r({title:f(),description:o(),confirmLabel:p(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,H()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:V(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:b(),cell:e=>K(e.at),sort:e=>e.at},{header:U(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:B(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${A({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:N()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?z():C(),onSelect:()=>void m(e)},{label:k(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,Bc as o,CI as s,CL as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JI as h,KI as g,LI as _,Lc as ee,MI as v,NI as y,OI as b,PI as te,QI as ne,RI as re,Rc as ie,SI as ae,SL as oe,TI as se,TL as ce,UI as le,VI as ue,WI as de,XB as fe,XI as pe,YB as me,YI as he,ZB as ge,ZI as _e,_I as ve,_L as ye,aI as be,aL as xe,aV as Se,bI as Ce,bL as we,cI as Te,cL as Ee,cV as x,dI as S,dL as De,eL as Oe,fI as ke,fL as Ae,gI as je,gL as Me,hI as Ne,hL as C,iI as Pe,iL as Fe,jI as Ie,kI as Le,lI as Re,lL as ze,mI as Be,mL as Ve,nL as He,oI as Ue,oL as We,pI as Ge,pL as Ke,qI as qe,r as Je,rI as Ye,rL as Xe,sI as w,sL as Ze,sV as T,t as E,tL as Qe,uI as $e,uL as et,vI as tt,vL as nt,wI as rt,wL as it,xI as at,xL as ot,yI as st,yL as ct,zI as lt,zc as D}from"./api-B1lq0pb-.js";import{t as O}from"./x-CHx4ismM.js";import{t as k}from"./button-Ds98Pj53.js";import{$ as A,Et as j,Fn as ut,Ft as dt,G as ft,It as M,K as pt,Lt as mt,Mt as ht,Nt as gt,Pn as N,Pt as P,Q as F,Un as I,X as L,Z as R,et as z,jt as B,ln as V,q as H,ut as U}from"./index-DMM3fags.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-C2GdBOIp.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-B15ESmxP.js";import{t as Dt}from"./TimeRangePicker-DOkbYJPt.js";import{t as Ot}from"./FilterBar-CK5Wsnof.js";import{t as kt}from"./AdvancedFilter-CZnbykZe.js";var q=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 J(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(u());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),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(s());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Nt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(s());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);J(e.data,f.width,f.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Bt)??await Y(p,`image/png`);if(!g)throw Error(ae());return{blob:g,hasAlpha:h}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(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 Ut(e)}async function Ut(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(rt())),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 Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?ge():e===`dark`?fe():me()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(I,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(E.charts.listMyCharts),r=T(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:Ve(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ke():n.via===`owner`?Ae():De({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()}):null]})}function Qt(){let e=T(E.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.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(p())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(a());return}let o;try{o=JSON.parse(r)}catch{s(p());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:h()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:qe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:f(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),de(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void _(),children:le()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ue()}):null]})]})}function $t({chart:e}){let t=Se(E.charts.setChartLogo),n=T(E.charts.removeChartLogo),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function u(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 d(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await u(e,n)}async function f(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 p(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await u(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?y():v()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),t?i():Ie(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void d(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:b()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Le()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:te()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=x(E.me.getMe,{host:H}),n=T(E.charts.addChartDomain),r=T(E.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.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,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ve()}):u.map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:st(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:tt()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ce()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=T(E.charts.updateChart),n=T(E.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>$(e.tokens)),[l,u]=(0,q.useState)(e.tokens.bpm??0),[f,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);function v(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),h(null),i(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(s)}catch{h(p());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:m()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:d()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ge()}),(0,X.jsx)(B,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?ie():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ke()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:g,onClick:()=>void y(),children:Ne()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Be()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=x(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=T(E.charts.addChartToGroupPool),i=T(E.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,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?He():e.kind===`custom`&&e.scope===`personal`?w():Xe()}),e.isGlobalDefault?(0,X.jsx)(j,{variant:`default`,children:Qe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:r()}),(o??[]).map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":_e({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:ne()})}),(0,X.jsx)(R,{children:c.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}):null]})]})}function an({chart:e}){let t=T(E.charts.promoteChartToCommon),n=T(E.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(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ue():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:be()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Pe()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=T(E.admin.setDefaultThemeMode),i=T(E.admin.setDefaultLocale),a=T(E.charts.setDefaultChart),o=x(E.charts.listChartsAdmin),s=x(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),pt.map(e=>(0,X.jsx)(k,{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,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:c()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]})]})}function sn(){let e=x(E.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:we()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{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,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(I,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,Bc as o,CI as s,CL as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JI as h,KI as g,LI as _,Lc as ee,MI as v,NI as y,OI as b,PI as te,QI as ne,RI as re,Rc as ie,SI as ae,SL as oe,TI as se,TL as ce,UI as le,VI as ue,WI as de,XB as fe,XI as pe,YB as me,YI as he,ZB as ge,ZI as _e,_I as ve,_L as ye,aI as be,aL as xe,aV as Se,bI as Ce,bL as we,cI as Te,cL as Ee,cV as x,dI as S,dL as De,eL as Oe,fI as ke,fL as Ae,gI as je,gL as Me,hI as Ne,hL as C,iI as Pe,iL as Fe,jI as Ie,kI as Le,lI as Re,lL as ze,mI as Be,mL as Ve,nL as He,oI as Ue,oL as We,pI as Ge,pL as Ke,qI as qe,r as Je,rI as Ye,rL as Xe,sI as w,sL as Ze,sV as T,t as E,tL as Qe,uI as $e,uL as et,vI as tt,vL as nt,wI as rt,wL as it,xI as at,xL as ot,yI as st,yL as ct,zI as lt,zc as D}from"./api-B1lq0pb-.js";import{t as O}from"./x-CHx4ismM.js";import{t as k}from"./button-Ds98Pj53.js";import{$ as A,Et as j,Fn as ut,Ft as dt,G as ft,It as M,K as pt,Lt as mt,Mt as ht,Nt as gt,Pn as N,Pt as P,Q as F,Un as I,X as L,Z as R,et as z,jt as B,ln as V,q as H,ut as U}from"./index-Bkfx3eIe.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-C2GdBOIp.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-B15ESmxP.js";import{t as Dt}from"./TimeRangePicker-B8MRcEsu.js";import{t as Ot}from"./FilterBar-DHbB2cbQ.js";import{t as kt}from"./AdvancedFilter-D-mIQhPG.js";var q=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 J(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(u());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),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(s());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Nt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(s());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);J(e.data,f.width,f.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Bt)??await Y(p,`image/png`);if(!g)throw Error(ae());return{blob:g,hasAlpha:h}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(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 Ut(e)}async function Ut(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(rt())),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 Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?ge():e===`dark`?fe():me()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(I,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(E.charts.listMyCharts),r=T(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:Ve(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ke():n.via===`owner`?Ae():De({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()}):null]})}function Qt(){let e=T(E.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.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(p())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(a());return}let o;try{o=JSON.parse(r)}catch{s(p());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:h()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:qe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:f(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),de(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void _(),children:le()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ue()}):null]})]})}function $t({chart:e}){let t=Se(E.charts.setChartLogo),n=T(E.charts.removeChartLogo),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function u(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 d(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await u(e,n)}async function f(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 p(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await u(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?y():v()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),t?i():Ie(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void d(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:b()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Le()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:te()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=x(E.me.getMe,{host:H}),n=T(E.charts.addChartDomain),r=T(E.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.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,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ve()}):u.map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:st(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:tt()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ce()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=T(E.charts.updateChart),n=T(E.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>$(e.tokens)),[l,u]=(0,q.useState)(e.tokens.bpm??0),[f,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);function v(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),h(null),i(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(s)}catch{h(p());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:m()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:d()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ge()}),(0,X.jsx)(B,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?ie():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ke()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:g,onClick:()=>void y(),children:Ne()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Be()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=x(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=T(E.charts.addChartToGroupPool),i=T(E.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,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?He():e.kind===`custom`&&e.scope===`personal`?w():Xe()}),e.isGlobalDefault?(0,X.jsx)(j,{variant:`default`,children:Qe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:r()}),(o??[]).map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":_e({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:ne()})}),(0,X.jsx)(R,{children:c.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}):null]})]})}function an({chart:e}){let t=T(E.charts.promoteChartToCommon),n=T(E.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(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ue():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:be()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Pe()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=T(E.admin.setDefaultThemeMode),i=T(E.admin.setDefaultLocale),a=T(E.charts.setDefaultChart),o=x(E.charts.listChartsAdmin),s=x(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),pt.map(e=>(0,X.jsx)(k,{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,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:c()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]})]})}function sn(){let e=x(E.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:we()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{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,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(I,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Cb as i,Co as a,Db as o,Eb as s,Mb as c,Ob as l,Sb as u,So as d,Tb as f,bb as p,bo as m,jb as h,kb as g,vo as _,wb as v,wo as y,xb as b,xo as x,yo as S}from"./api-B1lq0pb-.js";import{t as C}from"./button-Ds98Pj53.js";import{Ht as w,Ln as T,Ut as E,Vt as D,Wt as O,ct as k,jt as A,mn as j}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ab as r,Cb as i,Co as a,Db as o,Eb as s,Mb as c,Ob as l,Sb as u,So as d,Tb as f,bb as p,bo as m,jb as h,kb as g,vo as _,wb as v,wo as y,xb as b,xo as x,yo as S}from"./api-B1lq0pb-.js";import{t as C}from"./button-Ds98Pj53.js";import{Ht as w,Ln as T,Ut as E,Vt as D,Wt as O,ct as k,jt as A,mn as j}from"./index-Bkfx3eIe.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:c(),from:`now-5m`},{label:h(),from:`now-15m`},{label:r(),from:`now-30m`},{label:g(),from:`now-1h`},{label:l(),from:`now-3h`},{label:o(),from:`now-6h`},{label:s(),from:`now-12h`},{label:f(),from:`now-24h`},{label:v(),from:`now-2d`},{label:i(),from:`now-7d`},{label:u(),from:`now-30d`},{label:b(),from:`now-90d`},{label:p(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,o]=(0,M.useState)(``),s=F(e),[c,l]=(0,M.useState)(()=>z(s.from)),[u,f]=(0,M.useState)(()=>z(s.to));function p(t){if(t){let t=F(e);l(z(t.from)),f(z(t.to)),o(``)}r(t)}function h(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function g(){let e=B(c),n=B(u);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let v=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),b=B(c)!==null&&B(u)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:p,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:y()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>l(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,H.jsx)(A,{type:`datetime-local`,value:u,onChange:e=>f(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:g,children:x()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>o(e.target.value),placeholder:m(),"aria-label":S()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:v.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:_()}):v.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>h(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{DR as r,ER as i,TR as a,wR as o}from"./api-B1lq0pb-.js";import{t as s}from"./chevrons-up-down-Du-SfIms.js";import{Bt as c,Rt as l,Un as u,jt as d,zt as f}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{DR as r,ER as i,TR as a,wR as o}from"./api-B1lq0pb-.js";import{t as s}from"./chevrons-up-down-Du-SfIms.js";import{Bt as c,Rt as l,Un as u,jt as d,zt as f}from"./index-Bkfx3eIe.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||o():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(c,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":r(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(d,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:a()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AC as i,BA as a,CA as o,CC as s,D as c,DA as l,DC as u,EA as d,EC as f,FA as p,FC as m,GA as h,HA as g,IA as ee,IC as _,JA as v,KA as y,LA as b,LC as x,MC as te,NC as S,OA as C,OC as ne,PA as re,PC as ie,QA as w,RA as T,RC as ae,SA as E,SC as oe,TA as D,TC as se,UA as O,VA as ce,WA as le,XA as ue,YA as de,ZA as fe,_A as k,_C as pe,aC as me,bA as he,bC as ge,ba as _e,cC as ve,cV as A,dC as ye,ej as be,fC as xe,gA as Se,gC as Ce,hA as j,hC as we,iC as M,ij as N,jC as Te,kA as Ee,kC as De,lC as Oe,mC as ke,nC as P,nj as Ae,oC as je,pC as Me,qA as Ne,rC as Pe,rj as Fe,sC as Ie,sV as F,t as I,tj as Le,uC as Re,vA as ze,vC as Be,wA as Ve,wC as He,xA as Ue,xC as We,xa as Ge,yA as Ke,yC as qe,ya as Je,zA as Ye,zC as Xe}from"./api-B1lq0pb-.js";import{t as Ze}from"./x-CHx4ismM.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-vdU2pkw5.js";import{t as z}from"./button-Ds98Pj53.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-DMM3fags.js";import{n as yt}from"./TimeRangePicker-DOkbYJPt.js";import{t as bt}from"./FilterBar-CK5Wsnof.js";import{t as xt}from"./AdvancedFilter-CZnbykZe.js";import{t as St}from"./DataTableShell-CDmo0isC.js";var Ct=c(`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`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ye():n===`agent`?`${T()} - ${r}`:e}function Tt(){let e=A(I.me.getMe,{host:ht})?.role===`admin`,t=A(I.deliveryTiming.getDeliveryStatus,{}),n=F(I.deliveryTiming.startDeliveryRecord),i=F(I.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:N()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?Le():Ae()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:be()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:r({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?ue():fe()})}),a?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=A(I.deliveryTiming.listDeliverySessions,{}),n=F(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:m}=yt(c),_=c.to===`now`?1/0:m,x=r.trim()!==``||o!==`all`||c!==Y,te=()=>{i(``),s(`all`),l(Y)},S=(0,q.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>=f&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,_]),C=e=>{let t=new Set((S??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:v(),timeRange:c,onTimeRangeChange:l,onReset:te,canReset:x,children:(0,J.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:Ne()}),(0,J.jsx)(H,{value:`active`,children:y()}),(0,J.jsx)(H,{value:`stopped`,children:h()})]})]})}),(0,J.jsx)(St,{title:de(),rows:S,emptyHint:Se(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?ee():b(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:le(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:O(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:g(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:ce(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:a(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:y()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:h()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>C([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>C(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=A(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:re()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:w()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,j()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?k():ze()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:l()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:d()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:D()})]})}),(0,J.jsxs)(`tbody`,{children:[i(Ve(),r.bridge),i(o(),r.A),i(E(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ge()},{value:`principalType`,label:_e()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Je()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,o=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,d=e.q??``,p=e.correlationId,h=ut(e.from,e.to),g=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:ee,to:v}=yt(h),[y,b]=(0,q.useState)(null),[re,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,...pt(e)})}),fe=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),k=A(I.observability.listEvents,{limit:n}),he=A(I.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:d||void 0,from:ee,to:v,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:g.length>0?g:void 0}}),_e=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),be=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),Se=d!==``||a!==Q||o!==Q||c!==Q||l!==Q||g.length>0||h.kind!==`relative`||h.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=y?k?.filter(e=>e.correlationId===y):he,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),Ee()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),C()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Xe(),(0,J.jsx)(`strong`,{children:ae()}),x(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,J.jsxs)(bt,{q:d,onQChange:D,searchPlaceholder:m(),timeRange:h,onTimeRangeChange:de,onReset:j,canReset:Se,children:[(0,J.jsxs)(U,{value:a,onValueChange:O,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ie()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:S()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:o,onValueChange:ce,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:te()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:le,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:i()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:De()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:ue,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:u()}),be.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:f(),"aria-label":f(),onChange:e=>{let t=e.target.value.trim();E(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:_e.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:se({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:g,onChange:fe}),y?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:He(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[s(),(0,J.jsx)(`code`,{children:$(y)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:oe()})]})}):null,(0,J.jsx)(St,{title:We(),rows:M,emptyHint:y?ge():qe(),columns:[{header:Be(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:pe(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:Ce(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":we(),children:`✓`})}},{header:ke(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Me(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:xe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ye(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Re(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Oe(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:ve(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ie(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:me()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:re,onClose:()=>w(null)})]})]})}function It(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 Lt(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 Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[M(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:Pe()})]}),(0,J.jsx)(gt,{children:P()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AC as i,BA as a,CA as o,CC as s,D as c,DA as l,DC as u,EA as d,EC as f,FA as p,FC as m,GA as h,HA as g,IA as ee,IC as _,JA as v,KA as y,LA as b,LC as x,MC as te,NC as S,OA as C,OC as ne,PA as re,PC as ie,QA as w,RA as T,RC as ae,SA as E,SC as oe,TA as D,TC as se,UA as O,VA as ce,WA as le,XA as ue,YA as de,ZA as fe,_A as k,_C as pe,aC as me,bA as he,bC as ge,ba as _e,cC as ve,cV as A,dC as ye,ej as be,fC as xe,gA as Se,gC as Ce,hA as j,hC as we,iC as M,ij as N,jC as Te,kA as Ee,kC as De,lC as Oe,mC as ke,nC as P,nj as Ae,oC as je,pC as Me,qA as Ne,rC as Pe,rj as Fe,sC as Ie,sV as F,t as I,tj as Le,uC as Re,vA as ze,vC as Be,wA as Ve,wC as He,xA as Ue,xC as We,xa as Ge,yA as Ke,yC as qe,ya as Je,zA as Ye,zC as Xe}from"./api-B1lq0pb-.js";import{t as Ze}from"./x-CHx4ismM.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-BBnOOIhM.js";import{t as z}from"./button-Ds98Pj53.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-Bkfx3eIe.js";import{n as yt}from"./TimeRangePicker-B8MRcEsu.js";import{t as bt}from"./FilterBar-DHbB2cbQ.js";import{t as xt}from"./AdvancedFilter-D-mIQhPG.js";import{t as St}from"./DataTableShell-BK8Kucos.js";var Ct=c(`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`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ye():n===`agent`?`${T()} - ${r}`:e}function Tt(){let e=A(I.me.getMe,{host:ht})?.role===`admin`,t=A(I.deliveryTiming.getDeliveryStatus,{}),n=F(I.deliveryTiming.startDeliveryRecord),i=F(I.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:N()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?Le():Ae()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:be()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:r({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?ue():fe()})}),a?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=A(I.deliveryTiming.listDeliverySessions,{}),n=F(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:m}=yt(c),_=c.to===`now`?1/0:m,x=r.trim()!==``||o!==`all`||c!==Y,te=()=>{i(``),s(`all`),l(Y)},S=(0,q.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>=f&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,_]),C=e=>{let t=new Set((S??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:v(),timeRange:c,onTimeRangeChange:l,onReset:te,canReset:x,children:(0,J.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:Ne()}),(0,J.jsx)(H,{value:`active`,children:y()}),(0,J.jsx)(H,{value:`stopped`,children:h()})]})]})}),(0,J.jsx)(St,{title:de(),rows:S,emptyHint:Se(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?ee():b(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:le(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:O(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:g(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:ce(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:a(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:y()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:h()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>C([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>C(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=A(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:re()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:w()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,j()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?k():ze()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:l()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:d()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:D()})]})}),(0,J.jsxs)(`tbody`,{children:[i(Ve(),r.bridge),i(o(),r.A),i(E(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ge()},{value:`principalType`,label:_e()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Je()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,o=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,d=e.q??``,p=e.correlationId,h=ut(e.from,e.to),g=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:ee,to:v}=yt(h),[y,b]=(0,q.useState)(null),[re,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,...pt(e)})}),fe=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),k=A(I.observability.listEvents,{limit:n}),he=A(I.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:d||void 0,from:ee,to:v,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:g.length>0?g:void 0}}),_e=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),be=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),Se=d!==``||a!==Q||o!==Q||c!==Q||l!==Q||g.length>0||h.kind!==`relative`||h.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=y?k?.filter(e=>e.correlationId===y):he,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),Ee()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),C()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Xe(),(0,J.jsx)(`strong`,{children:ae()}),x(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,J.jsxs)(bt,{q:d,onQChange:D,searchPlaceholder:m(),timeRange:h,onTimeRangeChange:de,onReset:j,canReset:Se,children:[(0,J.jsxs)(U,{value:a,onValueChange:O,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ie()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:S()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:o,onValueChange:ce,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:te()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:le,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:i()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:De()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:ue,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:u()}),be.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:f(),"aria-label":f(),onChange:e=>{let t=e.target.value.trim();E(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:_e.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:se({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:g,onChange:fe}),y?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:He(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[s(),(0,J.jsx)(`code`,{children:$(y)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:oe()})]})}):null,(0,J.jsx)(St,{title:We(),rows:M,emptyHint:y?ge():qe(),columns:[{header:Be(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:pe(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:Ce(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":we(),children:`✓`})}},{header:ke(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Me(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:xe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ye(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Re(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Oe(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:ve(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ie(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:me()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:re,onClose:()=>w(null)})]})]})}function It(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 Lt(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 Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[M(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:Pe()})]}),(0,J.jsx)(gt,{children:P()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,CS as a,DO as o,EO as s,ES as c,Jp as l,OO as u,RD as d,SO as f,SS as p,TO as m,TS as h,Xp as g,Yp as _,_O as ee,_S as v,aO as y,bO as te,bS as b,cO as x,cV as S,dO as ne,fO as re,gO as ie,gS as C,hO as ae,hS as w,iO as oe,jO as T,kO as E,lO as D,mO as se,mS as O,oO as ce,pO as le,rO as ue,sO as de,sV as k,t as A,uO as fe,vO as pe,vS as j,wO as me,wS as M,xO as he,xS as N,yO as ge,yS as P}from"./api-B1lq0pb-.js";import{t as F}from"./button-Ds98Pj53.js";import{$ as I,Dt as L,Et as R,Ft as z,Gn as _e,Kn as ve,Lt as ye,Mt as be,Nt as xe,Pt as Se,Q as B,U as Ce,W as we,X as V,Z as H,at as Te,c as U,et as W,fn as G,l as Ee,nt as De,ot as Oe,pn as K,q as ke,rt as Ae,tt as je,u as q,ut as J}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,CS as a,DO as o,EO as s,ES as c,Jp as l,OO as u,RD as d,SO as f,SS as p,TO as m,TS as h,Xp as g,Yp as _,_O as ee,_S as v,aO as y,bO as te,bS as b,cO as x,cV as S,dO as ne,fO as re,gO as ie,gS as C,hO as ae,hS as w,iO as oe,jO as T,kO as E,lO as D,mO as se,mS as O,oO as ce,pO as le,rO as ue,sO as de,sV as k,t as A,uO as fe,vO as pe,vS as j,wO as me,wS as M,xO as he,xS as N,yO as ge,yS as P}from"./api-B1lq0pb-.js";import{t as F}from"./button-Ds98Pj53.js";import{$ as I,Dt as L,Et as R,Ft as z,Gn as _e,Kn as ve,Lt as ye,Mt as be,Nt as xe,Pt as Se,Q as B,U as Ce,W as we,X as V,Z as H,at as Te,c as U,et as W,fn as G,l as Ee,nt as De,ot as Oe,pn as K,q as ke,rt as Ae,tt as je,u as q,ut as J}from"./index-Bkfx3eIe.js";import{t as Y}from"./FilterBar-DHbB2cbQ.js";import{t as Me}from"./DataTableShell-BK8Kucos.js";import{t as Ne}from"./DetailChips-DSrMAbLD.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=S(A.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=S(A.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),l=(o??[]).find(e=>e.isDefault)??null,u=l?`${l.instanceName}/${l.agentId}`:null,d=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!d.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,enabled:e.enabled,state:e.state,outOfPool:!0}))],m=new Map;for(let e of f){let t=m.get(e.instanceName)??[];t.push(e),m.set(e.instanceName,t)}return(0,Z.jsx)(je,{open:n,onOpenChange:r,children:(0,Z.jsxs)(De,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(Oe,{children:c({user:t})}),(0,Z.jsx)(Ae,{children:h()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?M():a()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):f.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:P()}):[...m.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:u},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=k(A.agents.assignAgent),s=k(A.agents.removeAgent),c=k(A.agents.setDefaultAgent),l=L();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(N(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(b(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(K,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":j({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:v()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:C()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":w(),title:w(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":O(),title:O(),disabled:c,onClick:()=>void d(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return l();case`user`:return _();case`admin`:return g();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),i=U.filter(e=>n.has(q[e])).length;return(0,Z.jsxs)(be,{children:[(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:i===0?T():r({count:i})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:E()}),U.map(e=>{let r=q[e];return(0,Z.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,r=e.role??Q,a=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),l=S(A.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),p=S(A.me.getMe,{host:ke}),h=k(A.admin.setRole),g=k(A.admin.setUserPermissions),_=k(A.admin.startImpersonation),v=k(A.admin.deleteUser),b=k(A.admin.setUserName),C=Ce(),w=we(),T=L(),[E,O]=(0,X.useState)(null),j=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of l??[])e.add(t.role);return[...e]},[l]),M=n!==``||r!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await h(e)}catch(e){T.error(u(),e)}}async function F(e){try{await g(e)}catch(e){T.error(o(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:te(),description:ge({user:t}),confirmWord:pe(),confirmLabel:ee(),destructive:!0}))try{await v({profileId:e._id}),T.success(ae({user:t}))}catch(e){T.error(ie(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:le(),label:re({user:t}),placeholder:ne(),defaultValue:e.name??``,confirmLabel:d()});if(n!==null)try{await b({profileId:e._id,name:n}),T.success(fe())}catch(e){T.error(D(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:a,searchPlaceholder:s(),onReset:N,canReset:M,children:(0,Z.jsxs)(V,{value:r,onValueChange:c,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:Q,children:m()}),j.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:me(),rows:l,emptyHint:i(),rowActions:e=>{let t=[{label:ue(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:se(),onSelect:()=>void z(e)}];return e.userId!==p?.userId&&t.push({label:f(),onSelect:()=>void _({profileId:e._id})},{label:he(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:x(),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,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:de(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(B,{value:`user`,children:$(`user`)}),(0,Z.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:ce(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:y()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:oe(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||O(null)}})]})}export{Le as UsersTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Ai as i,Bi as a,Ci as o,Di as s,Dr as c,Ei as ee,Fi as l,Fk as u,Ii as d,Ld as f,Li as p,Mi as m,Ni as h,Oi as g,Pi as _,Ri as v,Si as y,Ti as b,_i as x,_r as S,aV as C,ar as te,bi as ne,br as w,cV as T,cp as E,cr as D,dr as re,fr as ie,gi as ae,gr as oe,ji as se,ki as ce,or as le,pr as O,qn as ue,sV as k,sr as de,t as A,tV as fe,ur as pe,vi as j,vr as M,wi as N,xi as P,yi as F,yr as I,zd as L,zi as R}from"./api-B1lq0pb-.js";import{i as z,n as B,r as me,t as he}from"./tabs-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Ai as i,Bi as a,Ci as o,Di as s,Dr as c,Ei as ee,Fi as l,Fk as u,Ii as d,Ld as f,Li as p,Mi as m,Ni as h,Oi as g,Pi as _,Ri as v,Si as y,Ti as b,_i as x,_r as S,aV as C,ar as te,bi as ne,br as w,cV as T,cp as E,cr as D,dr as re,fr as ie,gi as ae,gr as oe,ji as se,ki as ce,or as le,pr as O,qn as ue,sV as k,sr as de,t as A,tV as fe,ur as pe,vi as j,vr as M,wi as N,xi as P,yi as F,yr as I,zd as L,zi as R}from"./api-B1lq0pb-.js";import{i as z,n as B,r as me,t as he}from"./tabs-BBnOOIhM.js";import{t as V}from"./button-Ds98Pj53.js";import{$ as H,$t as ge,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-Bkfx3eIe.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>h()],[`fr-FR`,()=>w()],[`en-US`,()=>I()],[`en-GB`,()=>M()],[`de-DE`,()=>S()],[`es-ES`,()=>oe()]],Oe=[[`0.75`,()=>se()],[`1`,()=>i()],[`1.25`,()=>ce()],[`1.5`,()=>g()]],$=0;function ke({instance:e}){let t=k(A.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,a]=(0,Z.useState)(r),[c,u]=(0,Z.useState)(`idle`),[d,p]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),v=C(A.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{a({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),u(`idle`)},[e._id]);let y=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function x(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":l()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:de()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:le()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":_(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":m(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":s()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!y||c===`saving`,onClick:()=>void x(),children:c===`saving`?E():L()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||d,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(g(!1),J(),Y(),i.engine!==`gateway`){Ce(o(),{lang:Ee(i.lang,fe()),rate:t});return}p(!0),v({instanceName:e.name,text:o()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>p(!1))},children:d?E():b()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),J(),Y()},children:N()})]}),c===`error`||h?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h?ue():f()}):null]})}function Ae({stt:e}){let t=T(A.me.getMe,{host:we}),n=k(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:P()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?x():ae()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?ie():re()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]})}function je(){let e=T(A.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ge(),[]),{section:i}=ye({from:`/settings/voice`}),o=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?R():v()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?p():d()})]}),(0,Q.jsxs)(he,{value:i,onValueChange:e=>void o({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(me,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),pe()]}),(0,Q.jsxs)(z,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),P()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),F()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(B,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(B,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:F()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:j()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=k(A.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":u()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()})]})]})}export{je as VoiceTab};
|
package/dist/assets/{highlighted-body-OFNGDK62-CYEBDkYv.js → highlighted-body-OFNGDK62-qznyJ1AG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dt as r,ft as i,pt as a}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dt as r,ft as i,pt as a}from"./index-Bkfx3eIe.js";var o=t(e(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(a),p=i(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(r,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};
|