@lacneu/atrium 0.96.0 → 0.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/assets/{AccessTab-CX08Ry4n.js → AccessTab-CRwVD6bj.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-NdO-ABAb.js → AdvancedFilter-Dnyuc-Bv.js} +1 -1
  3. package/dist/assets/AgentFilesTab-CPNOuN7W.js +3 -0
  4. package/dist/assets/AnomaliesTab-LNX-bDmU.js +1 -0
  5. package/dist/assets/AuditTab-Bo5FFLse.js +1 -0
  6. package/dist/assets/BridgeTab-5DckBVxB.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-CI7bnli7.js +1 -0
  8. package/dist/assets/{DataTableShell-DwQKTbat.js → DataTableShell-Dekyfrzb.js} +1 -1
  9. package/dist/assets/DeletedChatsTab-CBrccWUL.js +1 -0
  10. package/dist/assets/{DetailChips-B79dXme3.js → DetailChips-Kz4cbymu.js} +1 -1
  11. package/dist/assets/FeedbacksTab-nr2NGnOq.js +1 -0
  12. package/dist/assets/{FieldLabel-pGuDJHof.js → FieldLabel-Dug2NEx7.js} +1 -1
  13. package/dist/assets/FilesTab-DQI3Qs6I.js +1 -0
  14. package/dist/assets/{FilterBar-DDDj8Wi2.js → FilterBar-Ct8JGeev.js} +1 -1
  15. package/dist/assets/{GroupsTab-DB601qwu.js → GroupsTab-FMHdOf15.js} +1 -1
  16. package/dist/assets/InstancesTab-1l_YlKBp.js +1 -0
  17. package/dist/assets/IntegrationsTab-qHBzXhyJ.js +1 -0
  18. package/dist/assets/{KpiTab-BGxs3igy.js → KpiTab-Pi-1zup5.js} +1 -1
  19. package/dist/assets/PreferencesTab-DHQv8afQ.js +1 -0
  20. package/dist/assets/ProjectPage-B9VswV7G.js +1 -0
  21. package/dist/assets/PromptInjectionsTab-Bm9tmvcD.js +4 -0
  22. package/dist/assets/RolesTab-D0xnbubk.js +1 -0
  23. package/dist/assets/ScheduledTab-D0CdWK0x.js +1 -0
  24. package/dist/assets/ServiceAccountsTab-BLbO_-PK.js +1 -0
  25. package/dist/assets/{SubAgentReportsTab-D6UhTJ2Q.js → SubAgentReportsTab-CeMPpWp2.js} +1 -1
  26. package/dist/assets/ThemeShowroom-BJf2qNsA.js +1 -0
  27. package/dist/assets/{TimeRangePicker-D-l1jL_i.js → TimeRangePicker-1vrUmBZJ.js} +1 -1
  28. package/dist/assets/{TimezoneCombobox-7YfscLD7.js → TimezoneCombobox-Bs8PmRcr.js} +1 -1
  29. package/dist/assets/TracesTab-CQNXeU8n.js +1 -0
  30. package/dist/assets/TrashTab-CanoobNv.js +1 -0
  31. package/dist/assets/UsersTab-SU4FWI5C.js +1 -0
  32. package/dist/assets/VoiceTab-C2JssfrM.js +1 -0
  33. package/dist/assets/api-BEXV-QDx.js +44 -0
  34. package/dist/assets/{button-kCamrfzR.js → button-BI4NYd7l.js} +1 -1
  35. package/dist/assets/{card-CC1ag_mw.js → card-CUy80Snk.js} +1 -1
  36. package/dist/assets/chevrons-up-down-BBnIDUVh.js +1 -0
  37. package/dist/assets/{compatView-BC1dh2j7.js → compatView-C6vyLpqy.js} +1 -1
  38. package/dist/assets/{dispatchErrorInfo-DBBnWn64.js → dispatchErrorInfo-U1f-h1hb.js} +1 -1
  39. package/dist/assets/{dist-Bz_kht3B.js → dist-BgUgjwlI.js} +1 -1
  40. package/dist/assets/{dist-DZI3tM10.js → dist-Yi0k4JhM.js} +1 -1
  41. package/dist/assets/{dist-CzXQ0eKG.js → dist-ibS6mHJS.js} +1 -1
  42. package/dist/assets/{dist-Rn9r4nGi.js → dist-xED7lptS.js} +1 -1
  43. package/dist/assets/{highlighted-body-OFNGDK62-CPvMZWDL.js → highlighted-body-OFNGDK62-DKzMKZqC.js} +1 -1
  44. package/dist/assets/index-04n15OUt.css +1 -0
  45. package/dist/assets/index-CND0zLpO.js +448 -0
  46. package/dist/assets/{list-DcO3n-3W.js → list-CMpIlPcq.js} +1 -1
  47. package/dist/assets/mermaid-GHXKKRXX-U8_Ynrg_.js +1 -0
  48. package/dist/assets/{pdf-iLQ-6sXC.js → pdf-B2fugRCF.js} +1 -1
  49. package/dist/assets/roleDescriptions-BUL4ira1.js +1 -0
  50. package/dist/assets/{table-BpXBaCrR.js → table-CvUcBPgp.js} +1 -1
  51. package/dist/assets/trashPage-CtRjTgEJ.js +1 -0
  52. package/dist/assets/{use_paginated_query-B_mVv9z5.js → use_paginated_query-CWrNoLih.js} +1 -1
  53. package/dist/assets/x-ijoBrBAS.js +1 -0
  54. package/dist/index.html +9 -9
  55. package/package.json +1 -1
  56. package/dist/assets/AgentFilesTab-Bf1HY6m-.js +0 -3
  57. package/dist/assets/AnomaliesTab-BVOmAPJz.js +0 -1
  58. package/dist/assets/AuditTab-C8Vdj6sE.js +0 -1
  59. package/dist/assets/BridgeTab-6it0lVRs.js +0 -1
  60. package/dist/assets/ChatDefaultsTab--eOikDSv.js +0 -1
  61. package/dist/assets/DeletedChatsTab-BgiGkq5o.js +0 -1
  62. package/dist/assets/FeedbacksTab-C1yc9DOZ.js +0 -1
  63. package/dist/assets/FilesTab-DM3-5ePt.js +0 -1
  64. package/dist/assets/InstancesTab-B9JtAxFO.js +0 -1
  65. package/dist/assets/IntegrationsTab-DfNFl2UZ.js +0 -1
  66. package/dist/assets/PreferencesTab-Da7rOXq0.js +0 -1
  67. package/dist/assets/ProjectPage-DsvdJ4jl.js +0 -1
  68. package/dist/assets/PromptInjectionsTab-C-JZd1GM.js +0 -4
  69. package/dist/assets/RolesTab-u4Jz95GA.js +0 -1
  70. package/dist/assets/ScheduledTab-CuQiOFvx.js +0 -1
  71. package/dist/assets/ServiceAccountsTab-BCBBrG-g.js +0 -1
  72. package/dist/assets/ThemeShowroom-CMA0A8Lc.js +0 -1
  73. package/dist/assets/TracesTab-BdSq-X2g.js +0 -1
  74. package/dist/assets/TrashTab-CQfKOCIH.js +0 -1
  75. package/dist/assets/UsersTab-Cy6C6yVf.js +0 -1
  76. package/dist/assets/VoiceTab-hkKsq7lK.js +0 -1
  77. package/dist/assets/api-ZghOy9gS.js +0 -44
  78. package/dist/assets/chevrons-up-down-Btm4pQFN.js +0 -1
  79. package/dist/assets/index-C_ywXTWT.js +0 -446
  80. package/dist/assets/index-DshenjZG.css +0 -1
  81. package/dist/assets/mermaid-GHXKKRXX-BZBeDf7b.js +0 -1
  82. package/dist/assets/roleDescriptions-D9G4WSSN.js +0 -1
  83. package/dist/assets/trashPage-K2ys0z1F.js +0 -1
  84. package/dist/assets/x-SeWtpTcs.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AE as i,BE as a,CD as o,E as s,EE as c,FE as l,FT as u,GE as d,HE as f,IE as p,JE as m,KE as ee,LE as h,ME as te,NE as g,RE as _,SD as ne,SE as v,To as re,UE as ie,VE as ae,WE as oe,XE as se,YE as ce,ZE as le,_D as ue,_E as de,aD as fe,bE as y,cD as pe,dC as me,dD as he,eD as ge,fX as b,gE as _e,hD as ve,hE as x,jE as S,lD as ye,mD as be,nD as C,pX as w,qE as xe,rD as T,rX as E,t as D,tD as Se,vD as O,vE as Ce,wD as we,wE as k,wo as Te,xE as A,yE as Ee,zE as De}from"./api-BEXV-QDx.js";import{r as Oe}from"./dist-ibS6mHJS.js";import{t as ke}from"./list-CMpIlPcq.js";import{t as j}from"./button-BI4NYd7l.js";import{$n as Ae,$t as M,A as N,An as je,Bn as P,C as F,D as Me,E as Ne,Gn as Pe,I as Fe,Kn as Ie,M as Le,N as Re,O as ze,P as I,Qn as Be,S as Ve,T as He,Un as L,Vn as Ue,Xn as R,Yt as We,Zn as Ge,_ as Ke,_t as qe,an as Je,b as Ye,ct as Xe,d as Ze,dr as z,en as Qe,er as $e,f as et,fr as tt,g as nt,gt as B,h as rt,ht as V,in as it,j as H,k as at,lt as ot,mt as st,nn as U,p as ct,pr as W,pt as lt,rn as ut,sr as dt,tn as ft,tr as pt,v as G,w as K,x as q,y as mt,zn as ht}from"./index-CND0zLpO.js";var gt=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),_t=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),vt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),J=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function yt({className:e}){return(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":v(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(pt,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:s}){let c=b(D.projects.renameProject),l=b(D.projects.setProjectColor),u=b(D.projects.moveProject),d=b(D.projects.deleteProject),f=b(D.projects.createProject),p=Xe(),m=rt(),ee=ot(),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(t),[re,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(!1),ce=w(D.projects.projectTreeCount,ae?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{onOpenChange:e=>e&&oe(!0),children:[(0,X.jsx)(yt,{className:a}),(0,X.jsxs)(ft,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>s(),children:[(0,X.jsx)(Be,{}),` `,fe()]}),(0,X.jsxs)(U,{onSelect:()=>{v(t),g(!0)},children:[(0,X.jsx)(Ue,{}),` `,A()]}),(0,X.jsxs)(U,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ee({title:se(),label:we(),placeholder:o(),confirmLabel:ne()});t&&await f({name:t,parentId:e})})},children:[(0,X.jsx)(Ge,{}),` `,se()]}),(0,X.jsxs)(U,{onSelect:()=>ie(!0),children:[(0,X.jsx)(_t,{}),` `,te()]}),(0,X.jsx)(ut,{children:Ce()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":de(),children:`✕`}),Ke.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ce?.folders??0,r=ce?.chats??0;await p({title:pe({name:t}),description:ct({folders:n,chats:r,days:m}),confirmWord:k(),confirmLabel:ye(),destructive:!0})&&await d({projectId:e})})},children:[(0,X.jsx)(je,{}),` `,k()]})]})]}),(0,X.jsx)(Ye,{open:h,onOpenChange:g,title:be(),canSubmit:_.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:_.trim()}),g(!1)},submitLabel:A(),children:(0,X.jsx)(M,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),re?(0,X.jsx)(nt,{open:re,onOpenChange:ie,title:i(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=b(D.chats.pinChat),i=b(D.chats.deleteChat),a=b(D.chats.renameChat),o=b(D.chats.setChatSidebar),s=b(D.chats.moveChatToProject),c=Xe(),l=rt(),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(e.title??``),[ee,h]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Qe,{children:[(0,X.jsx)(yt,{className:n}),(0,X.jsxs)(ft,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(U,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,X.jsx)(Ue,{}),` `,A()]}),(0,X.jsxs)(U,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(ht,{}):(0,X.jsx)(P,{}),e.pinned?y():Ee()]}),(0,X.jsxs)(U,{onSelect:()=>h(!0),children:[(0,X.jsx)(_t,{}),` `,g()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(U,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(L,{}):(0,X.jsx)(J,{}),e.inSidebar?C():T()]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:_e(),description:x({days:l}),confirmLabel:k(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(je,{}),` `,k()]})]})]}),(0,X.jsx)(Ye,{open:d,onOpenChange:f,title:u(),canSubmit:p.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:A(),children:(0,X.jsx)(M,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),ee?(0,X.jsx)(nt,{open:ee,onOpenChange:h,title:S(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function bt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function xt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function St(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var Ct=`oc.projpage.view`;function wt(){let e=localStorage.getItem(Ct);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,Tt=e=>`col:${e??`null`}`,Et=e=>`crumb:${e}`;function Dt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Ot(){let{projectId:e}=W({from:`/project/$projectId`}),t=z(),n=w(D.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:_()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:h()}),(0,X.jsx)(j,{variant:`outline`,onClick:()=>void t({to:`/`}),children:p()})]}):(0,X.jsx)(kt,{page:n})})}function kt({page:e}){let t=z(),n=Xe(),s=rt(),u=ot(),p=We(),m=b(D.projects.renameProject),h=b(D.projects.setProjectColor),g=b(D.projects.deleteProject),_=b(D.projects.createProject),v=b(D.projects.moveProject),ie=b(D.projects.setProjectSidebar),oe=b(D.chats.moveChatToProject),ce=b(D.chats.reorderChat),ue=b(D.projects.reorderProject),fe=w(D.projects.projectTreeCount,{projectId:e.project._id}),[y,he]=(0,Y.useState)(wt),_e=e=>{localStorage.setItem(Ct,e),he(e)},x=w(D.projects.folderColumns,y===`columns`?{projectId:e.project._id}:`skip`),S=w(D.projects.projectTreeList,y===`list`?{projectId:e.project._id}:`skip`),{c:C}=tt({from:`/project/$projectId`}),T=w(D.projects.listProjects,{}),E=w(D.chatReads.myBusyChats,{}),Ee=(0,Y.useMemo)(()=>new Set(E??[]),[E]),{byChat:Oe}=qe(E??null),P=w(D.chatReads.myChatReads,{}),F=(0,Y.useMemo)(()=>St(e.chats,P??[]),[e.chats,P]),{startNewChat:I,picker:Be}=Ze(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[L,et]=(0,Y.useState)(``),[B,H]=(0,Y.useState)(!1),[W,dt]=(0,Y.useState)(e.project.name),[G,ht]=(0,Y.useState)(!1),[J,yt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>yt(L.trim()),180);return()=>clearTimeout(e)},[L]);let Z=w(D.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),Q=Re(Le(Me,{activationConstraint:{distance:4}}),Le(ze,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),Tt=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Et,Ot]=(0,Y.useState)(null),kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=x?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||O()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(T??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=N(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=N(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=N(n(`crumb:`));if(a.length>0)return a;let o=N(n(`col:`));return o.length>0?o:at(n(t?`folder:`:`chat:`))},[]),It=t=>{if(y===`columns`){for(let e of x?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(y===`list`){let e=S?.chats.find(e=>e._id===t);return e?{list:S.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Lt=t=>{if(y===`columns`){for(let e of x?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(y===`list`){let e=S?.folders.find(e=>e._id===t);if(!e||!S)return null;let n=e.parentId??S.rootId;return{list:st(S.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{Ot(null),Tt();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=Dt(r);if(e!==void 0){if(a)await oe({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!lt(T??[],t,e)){p.error(le());return}await v({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await oe({chatId:e,projectId:n.folderId});let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ce({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!lt(T??[],e,n.parentId)){p.error(le());return}await v({projectId:e,parentId:n.parentId})}let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ue({projectId:e,...a});return}}catch{p.error(le())}},[,Bt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=mt(e.project),Ut=bt(e.chats,L),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{$.current||e()};return(0,X.jsx)(V.Provider,{value:Oe,children:(0,X.jsxs)(He,{sensors:Q,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":l(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(At,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(j,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:re(),onClick:()=>{ie({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)($e,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Te()}),(0,X.jsx)(Ae,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":Se(),children:[(0,X.jsx)(j,{variant:y===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Se(),title:Se(),"aria-pressed":y===`cards`,onClick:()=>_e(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(j,{variant:y===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ge(),title:ge(),"aria-pressed":y===`columns`,onClick:()=>_e(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(j,{variant:y===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":r(),title:r(),"aria-pressed":y===`list`,onClick:()=>_e(`list`),children:(0,X.jsx)(ke,{})})]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Ie,{}),d()]}),(0,X.jsxs)(j,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await u({title:se(),label:we(),placeholder:o(),confirmLabel:ne()});t&&await _({name:t,parentId:e.project._id})},children:[(0,X.jsx)(Ge,{}),se()]}),(0,X.jsxs)(Qe,{children:[(0,X.jsx)(Je,{asChild:!0,children:(0,X.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":ve(),children:(0,X.jsx)(pt,{})})}),(0,X.jsxs)(ft,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(U,{onSelect:()=>{dt(e.project.name),H(!0)},children:[(0,X.jsx)(Ue,{}),` `,A()]}),(0,X.jsxs)(U,{onSelect:()=>ht(!0),children:[(0,X.jsx)(_t,{}),` `,te()]}),(0,X.jsx)(ut,{children:Ce()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({projectId:e.project._id,color:null}),"aria-label":de(),children:`✕`}),Ke.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(it,{}),(0,X.jsxs)(U,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=fe?.folders??0,a=fe?.chats??0;await n({title:pe({name:e.project.name}),description:ct({folders:i,chats:a,days:s}),confirmWord:k(),confirmLabel:ye(),destructive:!0})&&(await g({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(je,{}),` `,k()]})]})]})]})]}),y===`columns`?(0,X.jsx)(Rt,{data:x,currentId:e.project._id,busyIds:Ee,suppressClick:$,locateChatId:C??null}):y===`list`?(0,X.jsx)(Ft,{data:S,busyIds:Ee,suppressClick:$,locateChatId:C??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:xe()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:Ve,children:e.children.map(t=>(0,X.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),e.chats.length>0?(0,X.jsx)(M,{value:L,onChange:e=>et(e.target.value),placeholder:f(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?a():De()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ae({term:L.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(q,{items:Ut.map(e=>`chat:${e._id}`),strategy:K,children:Ut.map(t=>(0,X.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:Ee.has(t._id),unread:F.has(t._id),locate:t._id===C,suppressClick:$},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:c()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ae({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Fe(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Pe,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||me()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(Ye,{open:B,onOpenChange:H,title:be(),canSubmit:W.trim().length>0,onSubmit:async()=>{await m({projectId:e.project._id,name:W.trim()}),H(!1)},submitLabel:A(),children:(0,X.jsx)(M,{value:W,onChange:e=>dt(e.target.value),autoFocus:!0})}),G?(0,X.jsx)(nt,{open:G,onOpenChange:ht,title:i(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void v({projectId:e.project._id,parentId:t})}):null,Be]}),(0,X.jsx)(Ne,{children:Et?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Et.kind===`folder`?(0,X.jsx)(R,{size:13,"aria-hidden":!0}):(0,X.jsx)(Pe,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Et.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=H({id:Et(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function jt({child:e,parentId:t,now:n,suppressClick:r}){let i=z(),a=F({id:`folder:${e._id}`}),o=H({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:I.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(R,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?oe({count:e.folderCount})+` · `:``,ie({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:et(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=b(D.chats.setChatSidebar),n=e.inSidebar?C():T();return(0,X.jsx)(j,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(L,{}):(0,X.jsx)(J,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,Y.useContext)(V).get(e._id),c=z(),l=G(e.color),u=F({id:`chat:${e._id}`}),d=Pt(a);return(0,X.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:I.Transform.toString(u.transform),transition:u.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||O()}),e.pinned?(0,X.jsx)(P,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:et(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:B(s,ue()).className,title:B(s,ue()).label,"aria-label":B(s,ue()).label}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:he(),"aria-label":he()}):null]}),(0,X.jsx)(Mt,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,o]=(0,Y.useState)(new Set),s=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:E()});if(e===null)return null;let c=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(a,o)=>{let u=s.get(a??e.rootId)??[],d=st(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Lt,{chat:e,depth:o,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(It,{folder:t,parentId:a??e.rootId,depth:o,folded:i.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:i.has(t._id)?null:l(t._id,o+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(s.get(e.rootId)??[]).length===0&&st(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:a()}):l(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=z(),c=F({id:`folder:${e._id}`}),l=H({id:$(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":mt(e),transform:I.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?ce():m(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(dt,{size:13}):(0,X.jsx)(Oe,{size:13})}),(0,X.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,Y.useContext)(V).get(e._id),o=z(),s=F({id:`chat:${e._id}`}),c=Pt(r),l=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:I.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||O()}),n?(0,X.jsx)(`span`,{className:B(a,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Mt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=z(),s=H({id:Tt(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Vt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:De()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=F({id:`folder:${e._id}`}),o=H({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":mt(e),transform:I.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(R,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,Y.useContext)(V).get(e._id),s=F({id:`chat:${e._id}`}),c=Pt(r),l=G(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:I.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||O()}),n?(0,X.jsx)(`span`,{className:B(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Mt,{chat:e})]})}export{Ot as ProjectPage};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ak as r,Bd as i,Bp as a,Ck as o,Dk as s,Ek as c,Hk as l,Hp as u,Id as d,Jd as f,Ld as p,Mk as m,Nk as h,Ok as g,Pk as _,Rd as ee,Rp as te,Sk as ne,Tk as v,Vk as y,Vp as b,Xd as x,Yd as S,_k as C,au as w,bk as T,fX as re,gk as ie,hk as ae,jk as oe,kk as E,ou as D,pX as O,qd as k,su as A,t as j,vk as M,wk as N,xk as P,xo as F,yk as I,zd as L,zp as R}from"./api-BEXV-QDx.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-Dug2NEx7.js";import{t as U}from"./button-BI4NYd7l.js";import{Mt as W,St as G,Yt as se,bt as K,ft as ce,gn as le,hn as ue,mn as de,pn as q,vt as J,xt as Y,yt as X}from"./index-CND0zLpO.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:E,help:g},documentary_fetch:{label:s,help:c},inbound_files:{label:v,help:N},history_summary:{label:u,help:b},file_curation:{label:x,help:i},quote_reply:{label:S,help:f}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:C,references:ie,files:ae,previous_summary:a,new_messages:R,max_chars:te,file_name:L,budget_chars:ee,feedback:p,content:d,excerpt:k};function _e(){let e=O(j.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:_(),help:h()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:o()}),(0,$.jsxs)(J,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=re(j.admin.upsertInstanceConfig),n=se(),r=O(j.me.getMe,{host:ce}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{s(z(i,a))},[a,e._id]);let[c,u]=(0,Q.useState)(!1),d=o.promptInjections,f=(e,t)=>s({...o,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(y(),e)}finally{u(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(y(),e)}}let h=e.config?.contentLocale??`default`,g=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:A()}),(0,$.jsxs)(J,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:w({locale:g})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),de.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:d[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:c,children:l()})})]})}function ye({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=ue(e,i,a),p=f?le(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(W,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:oe()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?T():P()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:m()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:F()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:M()})})]})}export{_e as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AN as i,CN as a,DN as o,EN as s,FN as c,IN as l,JM as u,LN as d,MN as f,NN as p,ON as m,PN as h,QM as g,RN as _,SN as ee,TN as v,XM as te,YM as y,ZM as b,_N as x,bN as S,bf as C,cN as ne,dN as re,eN as ie,fN as ae,fX as w,gN as T,hN as E,jN as D,kN as O,lN as k,mN as A,nN as j,pN as M,pX as N,t as P,tN as F,uN as I,vN as L,wN as R,xN as oe,yN as z}from"./api-BEXV-QDx.js";import{t as B}from"./button-BI4NYd7l.js";import{$t as V,Jt as H,Mt as U,Yt as W,b as G,ct as K,qn as q}from"./index-CND0zLpO.js";import{t as J}from"./roleDescriptions-BUL4ira1.js";var Y=t(e(),1),X=n(),Z=[{group:()=>_(),keys:[{key:`traces.read`,label:()=>p()},{key:`traces.read.content`,label:()=>f(),phi:!0},{key:`traces.write`,label:()=>D()}]},{group:()=>d(),keys:[{key:`kpi.read`,label:()=>p()},{key:`kpi.write`,label:()=>D()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>i()},{key:`anomalies.read`,label:()=>O()},{key:`anomalies.report`,label:()=>m()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>p()},{key:`selfheal`,label:()=>s()},{key:`media.repair`,label:()=>v()},{key:`feedback.respond`,label:()=>C()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>o()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=N(P.apiKeys.listRoles,{}),t=w(P.apiKeys.createRole),n=w(P.apiKeys.ensureRolesSeeded),i=w(P.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(P.apiKeys.listRoles,{});r&&e.setQuery(P.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=K(),s=W(),[c,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[p,m]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(a(),e)})},[n,s]);let h=e??[];async function _(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:ee({name:e.name}),description:oe(),confirmLabel:S()});return}if(p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(z(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function v(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),l(!1)}catch(e){s.error(L(),e)}}let C=e===void 0,D=!C&&h.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,T(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,E()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:A()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),l(!0)},children:M()})})]}),C?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):D?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:I()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?R({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:h.map(e=>{let t=Q(e.permissions),n=p.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,k()]}):(0,X.jsx)(H,{variant:`secondary`,children:ne()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?j():n?F():r,onCheckedChange:()=>void _(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:c,onOpenChange:l,title:ie(),description:r(),canSubmit:!!(d.key&&d.name),onSubmit:v,submitLabel:g(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,X.jsx)(V,{value:d.key,placeholder:te(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,X.jsx)(V,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(V,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$q as i,AJ as a,BJ as o,BK as s,Bq as c,Cq as l,DJ as u,Dq as ee,E as d,EJ as f,Eq as p,FJ as m,Fq as h,GK as g,HK as te,IJ as ne,Iq as re,JK as ie,Jq as ae,KK as oe,Kq as se,LJ as ce,Lq as le,MJ as ue,Mq as de,NJ as fe,NK as pe,Nq as me,OJ as he,PJ as ge,Pq as _e,QK as ve,Qq as ye,RJ as be,Rq as xe,Sq as Se,Tq as _,UK as Ce,Uq as we,VJ as Te,VK as Ee,Vq as De,WK as Oe,XK as ke,Xq as Ae,YK as je,Yq as Me,ZK as Ne,Zq as Pe,_q as Fe,aJ as Ie,aX as v,bq as Le,eJ as y,eq as Re,fq as ze,gq as Be,hq as Ve,iJ as He,jJ as Ue,kJ as We,mq as b,nJ as Ge,nq as Ke,oJ as qe,pX as Je,pq as Ye,qK as Xe,qq as Ze,rJ as Qe,rX as $e,sJ as et,t as x,tq as tt,uX as S,vq as C,wq as nt,xq as rt,yq as it,zJ as at,zK as ot,zq as st}from"./api-BEXV-QDx.js";import{t as ct}from"./list-CMpIlPcq.js";import{t as w}from"./button-BI4NYd7l.js";import{$t as lt,An as ut,Bt as dt,Ct as ft,Dt as pt,Et as mt,Gt as ht,Hn as gt,Ht as _t,In as vt,Jn as yt,Jt as T,Kt as bt,Ot as xt,Rn as St,Rt as Ct,St as E,Tt as wt,Ut as Tt,Vn as Et,Vt as Dt,Wt as Ot,Yt as kt,bt as D,cn as O,cr as k,ft as At,on as A,qt as jt,sn as j,sr as M,vt as N,wn as Mt,wt as Nt,xt as P,yt as F,zt as Pt}from"./index-CND0zLpO.js";import{a as Ft,i as I,n as It,o as Lt,r as L,t as Rt}from"./table-CvUcBPgp.js";import{t as zt}from"./FilterBar-Ct8JGeev.js";/* empty css */import{a as Bt,c as R,i as z,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-Bs8PmRcr.js";var qt=d(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=d(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Vt(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(v()),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{month:`long`,year:`numeric`}),[]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),f=R(i.year,i.month),m=n?.hour??9,h=n?.minute??0,g=(e,n,r,i,a)=>t(B(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),g(e,t,n,m,h)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?p():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(A,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ee(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,H.jsxs)(j,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":_(),onClick:()=>ne(-1),children:(0,H.jsx)(k,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":nt(),onClick:()=>ne(1),children:(0,H.jsx)(M,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),f.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(N,{value:String(m),onValueChange:e=>g(i.year,i.month,n?.day??r.getDate(),Number(e),h),children:[(0,H.jsx)(P,{size:`sm`,"aria-label":l(),children:(0,H.jsx)(E,{})}),(0,H.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(N,{value:String(h),onValueChange:e=>g(i.year,i.month,n?.day??r.getDate(),m,Number(e)),children:[(0,H.jsx)(P,{size:`sm`,"aria-label":Se(),children:(0,H.jsx)(E,{})}),(0,H.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=v(),c=(0,V.useMemo)(()=>Zt(e),[e]),l=(0,V.useMemo)(()=>$t(s),[s]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},m=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":Ve(),onClick:()=>p(-1),children:(0,H.jsx)(k,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":b(),onClick:()=>p(1),children:(0,H.jsx)(M,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:Be()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:m}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(w,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:C()}),(0,H.jsx)(w,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:Fe()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:Ye({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=R(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=Ut(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(T,{variant:`secondary`,children:c()});case`error`:return(0,H.jsx)(T,{variant:`destructive`,children:xe()});case`running`:return(0,H.jsx)(T,{variant:`outline`,children:le()});case`other`:return(0,H.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=S(x.scheduled.listMyCrons),t=S(x.scheduled.getCronDetail),n=S(x.scheduled.listCronRuns),l=S(x.scheduled.updateCron),ee=S(x.scheduled.removeCron),d=S(x.scheduled.runCronNow),p=kt(),Se=Je(x.me.getMe,{host:At})?.timezone,[_,Fe]=(0,V.useState)(null),[Be,Ve]=(0,V.useState)(!1),[b,Ye]=(0,V.useState)(!1),[C,nt]=(0,V.useState)(null),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[M,R]=(0,V.useState)(null),[Vt,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ht),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of _??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Bt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[_,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,V.useCallback)(async()=>{Ve(!0),Ye(!1);try{Fe(await e({}))}catch{Ye(!0)}finally{Ve(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{_!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[_]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{nt(e);try{await t(),p.success(n),await q()}catch(e){p.toast({variant:`error`,title:y({code:dn(e)})})}finally{nt(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;j({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;j({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;j(null),p.toast({variant:`error`,title:y({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;R({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;R(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;R(null),p.toast({variant:`error`,title:y({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){p.toast({variant:`error`,title:ot()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){p.toast({variant:`error`,title:s()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){R(null);return}let t=Q.current;Gt(!0);try{await l({instanceName:M.instanceName,jobId:M.jobId,patch:e}),p.success(r()),t===Q.current&&R(null),await q()}catch(e){p.toast({variant:`error`,title:y({code:dn(e)})})}finally{Gt(!1)}},hn=_?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Te()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":rt(),children:[(0,H.jsx)(w,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Le(),title:Le(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(ct,{})}),(0,H.jsx)(w,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":it(),title:it(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Be,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(vt,{size:14,"aria-hidden":!0}),o()]})]}),_!==null&&hn>0?(0,H.jsxs)(zt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:h(),onReset:()=>U(Ht),canReset:Wt(B),children:[(0,H.jsxs)(N,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(P,{size:`sm`,className:`w-40`,children:(0,H.jsx)(E,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(D,{value:`all`,children:_e()}),(0,H.jsx)(D,{value:`active`,children:u()}),(0,H.jsx)(D,{value:`paused`,children:he()}),(0,H.jsx)(D,{value:`auto-disabled`,children:f()})]})]}),(0,H.jsxs)(N,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(P,{size:`sm`,className:`w-40`,children:(0,H.jsx)(E,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(D,{value:`all`,children:me()}),(0,H.jsx)(D,{value:`ok`,children:c()}),(0,H.jsx)(D,{value:`error`,children:xe()}),(0,H.jsx)(D,{value:`running`,children:le()}),(0,H.jsx)(D,{value:`none`,children:re()})]})]})]}):null,_===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Be,children:b?at():$e()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[b?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):null,_.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:ze()})]}):(0,H.jsxs)(H.Fragment,{children:[b?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):null,_.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,_.map(e=>{let t=e.jobs.filter(e=>Bt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[_.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ne({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):(0,H.jsxs)(Rt,{children:[(0,H.jsx)(Ft,{children:(0,H.jsxs)(Lt,{children:[(0,H.jsx)(I,{children:ge()}),(0,H.jsx)(I,{children:fe()}),(0,H.jsx)(I,{children:ue()}),(0,H.jsx)(I,{children:Ue()}),(0,H.jsx)(I,{children:a()}),(0,H.jsx)(I,{children:De()}),(0,H.jsx)(I,{children:Ke()})]})}),(0,H.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=C===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,H.jsxs)(Lt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(L,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??We()}),(0,H.jsx)(L,{children:(0,H.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(L,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:Pt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(L,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(L,{children:Ut(t)===`auto-disabled`?(0,H.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:f()}):Ut(t)===`active`?(0,H.jsx)(T,{variant:`secondary`,children:u()}):Ut(t)===`paused`?(0,H.jsx)(T,{variant:`outline`,children:he()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(L,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??et(),children:st()}):null]}),(0,H.jsx)(L,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,H.jsx)(yt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:C!==null,onClick:()=>void X(r,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},i()),children:(0,H.jsx)(Mt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:z(t)===`pause`?He():Qe(),"aria-label":z(t)===`pause`?He():Qe(),disabled:C!==null,onClick:()=>void X(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:z(t)===`resume`}}),z(t)===`pause`?ye():Pe()),children:z(t)===`pause`?(0,H.jsx)(gt,{size:14,"aria-hidden":!0}):(0,H.jsx)(St,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:tt(),"aria-label":tt(),disabled:C!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(Et,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:C!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Ge(),"aria-label":Ge(),disabled:C!==null,onClick:()=>k({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(ut,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ce()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:pe()}):null]}),(0,H.jsx)(dt,{open:O!==null,onOpenChange:e=>{e||k(null)},children:(0,H.jsxs)(Tt,{children:[(0,H.jsxs)(bt,{children:[(0,H.jsx)(jt,{children:Me()}),(0,H.jsx)(Ot,{children:ae({name:O?.name??``})})]}),(0,H.jsxs)(ht,{children:[(0,H.jsx)(_t,{children:Ze()}),(0,H.jsx)(Dt,{onClick:()=>{let e=O;k(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>ee({instanceName:e.instanceName,jobId:e.jobId}),Ae())},children:se()})]})]})}),(0,H.jsx)(ft,{open:A!==null,onOpenChange:e=>{e||(Z.current++,j(null))},children:(0,H.jsxs)(Nt,{style:{maxWidth:640},children:[(0,H.jsx)(pt,{children:(0,H.jsx)(xt,{children:ve({name:A?.name??``})})}),A?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):A!==null&&A.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):A===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:A.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[we({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(ft,{open:M!==null,onOpenChange:e=>{e||(Q.current++,R(null))},children:(0,H.jsxs)(Nt,{className:`oc-cronedit`,children:[(0,H.jsxs)(pt,{children:[(0,H.jsx)(xt,{children:ke()}),(0,H.jsx)(wt,{children:je()})]}),M===null?null:M.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ge()}),(0,H.jsx)(lt,{value:M.name,maxLength:200,onChange:e=>R({...M,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ie()}),(0,H.jsxs)(N,{value:M.scheduleKind,onValueChange:e=>R({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(P,{children:(0,H.jsx)(E,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(D,{value:`cron`,children:Xe()}),(0,H.jsx)(D,{value:`every`,children:oe()}),(0,H.jsx)(D,{value:`at`,children:g()})]})]}),M.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(lt,{value:M.cronExpr,onChange:e=>R({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:M.tz,onChange:e=>R({...M,tz:e,scheduleDirty:!0}),fallbackTz:Se??void 0})]}):M.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(lt,{type:`number`,min:1,value:M.everyValue,onChange:e=>R({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(N,{value:M.everyUnit,onValueChange:e=>R({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(P,{style:{maxWidth:160},children:(0,H.jsx)(E,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(D,{value:`minutes`,children:Oe()}),(0,H.jsx)(D,{value:`hours`,children:Ce()}),(0,H.jsx)(D,{value:`days`,children:te()})]})]})]}):(0,H.jsx)(Yt,{value:M.at,onChange:e=>R({...M,at:e,scheduleDirty:!0})})]}),M.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:qe()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>R({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(mt,{children:[(0,H.jsx)(w,{variant:`ghost`,onClick:()=>R(null),children:Ze()}),(0,H.jsxs)(w,{onClick:()=>void mn(),disabled:M===null||M.loading||Vt,children:[Vt?(0,H.jsx)(yt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ee()]})]})]})})]})}export{pn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,AU as i,BU as ee,CU as a,DU as te,EU as ne,FU as re,GU as ie,HU as ae,IU as oe,JU as se,KU as ce,LU as le,MU as ue,NU as de,OU as fe,PU as pe,QU as me,RU as he,SU as o,TU as ge,UU as _e,VU as ve,WU as ye,XU as be,YU as xe,ZU as Se,_U as s,_W as Ce,aU as we,aW as Te,bU as Ee,bW as De,cU as Oe,cW as ke,dU as c,dW as Ae,eU as l,eW as je,fU as u,fW as Me,fX as d,gU as f,gW as Ne,hU as p,hW as m,iU as h,iW as Pe,jU as Fe,kU as Ie,lU as g,lW as Le,mU as _,mW as v,nU as y,nW as Re,oU as b,oW as ze,pU as x,pW as Be,pX as S,qU as Ve,rU as C,rW as He,sU as w,sW as Ue,t as T,tU as E,tW as We,uU as D,uW as Ge,uX as Ke,vU as O,vW as qe,wU as Je,xU as k,yU as A,yW as Ye,zU as Xe}from"./api-BEXV-QDx.js";import{r as Ze}from"./dist-ibS6mHJS.js";import{t as j}from"./button-BI4NYd7l.js";import{$t as M,At as N,Ct as P,Dt as F,Et as I,Jt as L,Ot as R,St as z,Tt as B,Yt as Qe,b as $e,bt as V,ct as et,dr as tt,fr as nt,kt as H,lr as U,rr as rt,sr as it,vt as W,wt as G,xt as K,yt as q}from"./index-CND0zLpO.js";import{t as at}from"./FilterBar-Ct8JGeev.js";import{t as ot}from"./DataTableShell-Dekyfrzb.js";import{t as st}from"./roleDescriptions-BUL4ira1.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>b(),days:null},{value:`30`,label:()=>we(),days:30},{value:`90`,label:()=>h(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=nt({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,s]=(0,J.useState)(Z),we=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ee=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),Oe=S(T.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),c=S(T.apiKeys.listKeys,{}),l=S(T.apiKeys.listRoles,{}),u=d(T.apiKeys.createServiceAccount),f=d(T.apiKeys.updateServiceAccount),p=d(T.apiKeys.deleteServiceAccount),h=Ke(T.apiKeys.mintApiKey),g=d(T.apiKeys.revokeApiKey),_=et(),y=Qe(),b=n!==``||o!==Z||a!==Z;function x(){s(Z),t({search:{},replace:!0})}let[C,w]=(0,J.useState)(!1),[E,D]=(0,J.useState)(Q),[O,k]=(0,J.useState)(null),[A,N]=(0,J.useState)(new Set),[P,F]=(0,J.useState)(null),I=(0,J.useRef)(!1),[R,B]=(0,J.useState)(new Set),[H,U]=(0,J.useState)({}),[rt,G]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function $(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await f({serviceAccountId:O,name:E.name,roleKey:E.roleKey,description:E.description}),y.success(he())):await u({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),D(Q),k(null),w(!1)}catch(e){y.error(O?Xe():ee(),e)}}function ft(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=H[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});G({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(le(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await _({title:oe(),description:(0,Y.jsxs)(Y.Fragment,{children:[re(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,pe(),` `,(0,Y.jsx)(`strong`,{children:de()}),` `,ue()]}),confirmWord:e.name,confirmLabel:Fe(),destructive:!0}))try{await p({serviceAccountId:e._id}),y.success(i(),e.name)}catch(e){y.error(Ie(),e)}}async function ht(e){if(await _({title:fe(),description:(0,Y.jsxs)(Y.Fragment,{children:[te(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ne()]}),confirmLabel:ge(),destructive:!0})&&!R.has(e._id)){B(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(Je(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Y.jsxs)(at,{q:n,onQChange:we,searchPlaceholder:Ye(),onReset:x,canReset:b,children:[(0,Y.jsxs)(W,{value:o,onValueChange:s,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(z,{placeholder:qe()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(V,{value:Z,children:Ce()}),(l??[]).map(e=>(0,Y.jsx)(V,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(W,{value:a,onValueChange:Ee,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(z,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(V,{value:Z,children:Ne()}),(0,Y.jsx)(V,{value:`active`,children:m()}),(0,Y.jsx)(V,{value:`disabled`,children:v()})]})]})]}),(0,Y.jsx)(ot,{title:Be(),rows:Oe,addLabel:Me(),onAdd:()=>{D(Q),k(null),w(!0)},emptyHint:Ae(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:R}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Ue(),onSelect:()=>ft(e)},{label:Ge(),onSelect:()=>void pt(e)}]:[],{label:A.has(e._id)?Le():ke(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:ze(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Te():Pe(),onClick:()=>$(e._id),children:A.has(e._id)?(0,Y.jsx)(Ze,{}):(0,Y.jsx)(it,{})})},{header:He(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Re(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:We(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(L,{variant:`destructive`,children:v()}):(0,Y.jsx)(L,{variant:`outline`,children:m()})},{header:je(),cell:e=>(0,Y.jsxs)(W,{value:H[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(z,{})}),(0,Y.jsx)(q,{children:ct.map(e=>(0,Y.jsx)(V,{value:e.value,children:e.label()},e.value))})]})},{header:r(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?me():Se({count:t})})}}]}),(0,Y.jsx)($e,{open:C,onOpenChange:e=>{w(e),e||k(null)},title:O?be():Ve(),description:O?xe():ce(),canSubmit:!!(E.name&&E.roleKey),onSubmit:dt,submitLabel:O?se():ie(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,Y.jsx)(M,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,Y.jsxs)(W,{value:E.roleKey||void 0,onValueChange:e=>D({...E,roleKey:e}),children:[(0,Y.jsx)(K,{className:`w-full`,children:(0,Y.jsx)(z,{placeholder:ae()})}),(0,Y.jsx)(q,{children:(l??[]).map(e=>(0,Y.jsxs)(V,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(l??[]).find(e=>e.key===E.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ve()}),(0,Y.jsx)(M,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:rt,onClose:()=>G(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:k()}),(0,Y.jsx)(`th`,{children:Ee()}),(0,Y.jsx)(`th`,{children:A()}),(0,Y.jsx)(`th`,{children:O()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:f()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:N(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,Y.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?p():_()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(G,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(F,{children:[(0,Y.jsx)(R,{children:x()}),(0,Y.jsx)(B,{children:u({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:c()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":D(),children:[n?(0,Y.jsx)(U,{}):(0,Y.jsx)(rt,{}),n?g():Oe()]})]}),(0,Y.jsx)(I,{children:(0,Y.jsx)(j,{onClick:()=>{r(!1),t()},children:w()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?C():N(e)}function pt(e){return e===null?`—`:H(e)}function mt(e){return e.disabled?(0,Y.jsx)(L,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(L,{variant:`outline`,children:E()}):(0,Y.jsx)(L,{variant:`outline`,children:l()})}export{$ as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as a,Dm as o,Em as s,Jp as c,Om as l,Qp as u,Sm as d,Tm as f,Xp as p,Yp as m,Zp as h,_m as g,am as _,bm as v,cm as y,dm as b,em as x,fm as S,gm as C,hm as w,im as T,jm as E,km as D,lm as O,mm as k,nm as A,oX as j,om as M,pm as N,qp as P,rm as F,sX as I,sm as L,t as R,tm as ee,um as z,vm as B,wm as V,xm as H,ym as U}from"./api-ZghOy9gS.js";import{t as W}from"./button-kCamrfzR.js";import{At as G,ct as K}from"./index-C_ywXTWT.js";import{t as q}from"./DataTableShell-DwQKTbat.js";var J=t(e(),1),Y=n(),X={hung:()=>k(),wrong_result:()=>N(),error:()=>S(),other:()=>b()},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=j(R.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!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),` · `,z({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:O()}),(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:y()}),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`?L():M()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:_()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:T(),value:o,maxLength:2e3,rows:3,onChange:e=>s(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 d(),disabled:!o.trim()||c,children:c?A():F()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${x()}`:``,t.textTruncated?` ${r()}`:``]}),(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?` · ${u()}`:``]}),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:h()}),(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:p()}),(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=I(R.subAgentReports.listForAdmin,{}),t=j(R.subAgentReports.readReport),n=j(R.subAgentReports.deleteReport),r=K(),[u,p]=(0,J.useState)(null),[h,_]=(0,J.useState)({});async function y(e){if(u===e._id){p(null);return}if(!h[e._id]){let n=await t({reportId:e._id});_(t=>({...t,[e._id]:n}))}p(e._id)}async function b(e){await r({title:m(),description:c(),confirmLabel:P(),destructive:!0})&&(await n({reportId:e._id}),u===e._id&&p(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,Y.jsx)(`strong`,{children:l()}),` `,o()]}),(0,Y.jsx)(q,{title:E(),rows:e,emptyHint:i(),isExpanded:e=>u===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,Y.jsx)($,{data:h[e._id]}):null,columns:[{header:s(),cell:e=>G(e.at),sort:e=>e.at},{header:f(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:V(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${v({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:U()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:B()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:u===e._id?C():g(),onSelect:()=>void y(e)},{label:w(),onSelect:()=>void b(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as a,Dm as o,Em as s,Jp as c,Om as l,Qp as u,Sm as d,Tm as f,Xp as p,Yp as m,Zp as h,_m as g,am as _,bm as v,cm as y,dm as b,em as x,fX as S,fm as C,gm as w,hm as T,im as E,jm as D,km as O,lm as k,mm as A,nm as j,om as M,pX as N,pm as P,qp as F,rm as I,sm as L,t as R,tm as ee,um as z,vm as B,wm as V,xm as H,ym as U}from"./api-BEXV-QDx.js";import{t as W}from"./button-BI4NYd7l.js";import{At as G,ct as K}from"./index-CND0zLpO.js";import{t as q}from"./DataTableShell-Dekyfrzb.js";var J=t(e(),1),Y=n(),X={hung:()=>A(),wrong_result:()=>P(),error:()=>C(),other:()=>b()},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=S(R.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!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),` · `,z({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:k()}),(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:y()}),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`?L():M()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:_()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:E(),value:o,maxLength:2e3,rows:3,onChange:e=>s(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 d(),disabled:!o.trim()||c,children:c?j():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${x()}`:``,t.textTruncated?` ${r()}`:``]}),(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?` · ${u()}`:``]}),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:h()}),(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:p()}),(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=N(R.subAgentReports.listForAdmin,{}),t=S(R.subAgentReports.readReport),n=S(R.subAgentReports.deleteReport),r=K(),[u,p]=(0,J.useState)(null),[h,_]=(0,J.useState)({});async function y(e){if(u===e._id){p(null);return}if(!h[e._id]){let n=await t({reportId:e._id});_(t=>({...t,[e._id]:n}))}p(e._id)}async function b(e){await r({title:m(),description:c(),confirmLabel:F(),destructive:!0})&&(await n({reportId:e._id}),u===e._id&&p(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[O(),` `,(0,Y.jsx)(`strong`,{children:l()}),` `,o()]}),(0,Y.jsx)(q,{title:D(),rows:e,emptyHint:i(),isExpanded:e=>u===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,Y.jsx)($,{data:h[e._id]}):null,columns:[{header:s(),cell:e=>G(e.at),sort:e=>e.at},{header:f(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:V(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${v({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:U()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:B()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:u===e._id?w():g(),onSelect:()=>void y(e)},{label:T(),onSelect:()=>void b(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,$Y as i,AG as a,BG as o,CG as s,CK as c,DG as l,DK as u,EG as d,EK as f,FG as p,GG as m,Gp as h,HG as g,IG as _,JG as v,KG as y,Kp as b,LG as ee,MG as te,NG as ne,OG as re,OK as ie,PG as ae,QG as oe,RG as se,SG as ce,SK as le,TG as ue,TK as de,UG as fe,Up as pe,VG as me,WG as he,Wp as ge,XG as _e,YG as ve,ZG as ye,_G as be,_K as xe,aK as Se,bG as Ce,bK as we,cG as Te,cK as Ee,dG as x,dK as De,eK as Oe,eX as ke,fG as Ae,fK as je,fX as S,gG as Me,gK as Ne,hG as C,hK as Pe,iK as Fe,jG as Ie,kG as Le,kK as Re,lG as ze,lK as Be,mG as Ve,mK as He,nK as Ue,oK as We,pG as Ge,pK as Ke,pX as w,qG as qe,r as Je,rK as Ye,sG as Xe,sK as Ze,t as T,tK as Qe,tX as $e,uG as et,uK as tt,uX as nt,vG as rt,vK as it,wG as at,wK as ot,xG as st,xK as ct,yG as lt,yK as E,zG as ut}from"./api-BEXV-QDx.js";import{t as D}from"./x-ijoBrBAS.js";import{t as O}from"./button-BI4NYd7l.js";import{$t as k,Jt as A,Mt as j,On as M,St as N,an as dt,bt as P,dt as ft,en as pt,ft as F,in as I,lr as L,nn as R,nr as mt,rn as ht,tn as gt,tr as z,ut as _t,vt as B,xt as V,yt as H}from"./index-CND0zLpO.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-CUy80Snk.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CvUcBPgp.js";import{t as Ot}from"./TimeRangePicker-1vrUmBZJ.js";import{t as kt}from"./FilterBar-Ct8JGeev.js";import{t as At}from"./AdvancedFilter-Dnyuc-Bv.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(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 q(e,t,n){return Ft(e,t,n)>=jt}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(a());if(e.size>Rt)throw Error(Le());let{source:n,width:r,height:i,cleanup:o}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=s,u.height=c;let f=u.getContext(`2d`);if(!f)throw Error(l());f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(n,0,0,s,c);let p=Pt(f.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},m=document.createElement(`canvas`);m.width=p.width,m.height=p.height;let h=m.getContext(`2d`);if(!h)throw Error(l());if(h.drawImage(u,p.x,p.y,p.width,p.height,0,0,p.width,p.height),t.variantFor){let e=h.getImageData(0,0,p.width,p.height);q(e.data,p.width,p.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),h.putImageData(e,0,0)}let g=q(h.getImageData(0,0,p.width,p.height).data,p.width,p.height),_=await Y(m,`image/webp`,Vt)??await Y(m,`image/png`);if(!_)throw Error(d());return{blob:_,hasAlpha:g}}finally{o()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(re())),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`?$e():e===`dark`?ke():i()}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:o}){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)(L,{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})})]}),o?(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":b(),title:b(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(T.charts.listMyCharts),r=S(T.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:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:E(),subtitle:it(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?xe():n.via===`owner`?Ne():Pe({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:He()}):null]})}function Qt(){let e=S(T.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(y())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(he());return}let r;try{r=JSON.parse(i)}catch{s(y());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}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:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(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:oe()}),(0,X.jsx)(k,{value:t,onChange:e=>n(e.target.value),placeholder:ye(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:_e()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ve(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),v(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(O,{size:`sm`,disabled:u,onClick:()=>void p(),children:qe()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:m()}):null]})]})}function $t({chart:e}){let t=nt(T.charts.setChartLogo),n=S(T.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(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`?ee():_()}),(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)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),t?ae():p(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:te()}):null,t?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:ne()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:se()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ie()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=w(T.me.getMe,{host:F}),n=S(T.charts.addChartDomain),r=S(T.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(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:ue()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:st()}):d.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ce({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(D,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{value:i,onChange:e=>a(e.target.value),placeholder:s(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ce()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:at()}),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=S(T.charts.updateChart),n=S(T.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>$(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(y());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(C()))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)(O,{variant:`outline`,size:`sm`,onClick:_,children:o()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ut()})]})})]}),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:be()}),(0,X.jsx)(k,{value:a,onChange:e=>s(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:h()}),(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:u,onChange:e=>d(Number(e.target.value)),"aria-label":h()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?ge():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:pe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Me()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(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)(O,{size:`sm`,disabled:m,onClick:()=>void v(),children:lt()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:rt()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=w(T.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:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()}):(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=S(T.charts.addChartToGroupPool),r=S(T.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({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)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?We():e.kind===`custom`&&e.scope===`personal`?x():Ze()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:Se()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ye()}),(a??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Qe({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(V,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:Ue()})}),(0,X.jsx)(H,{children:s.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Fe()}):null]})]})}function an({chart:e}){let t=S(T.charts.promoteChartToCommon),n=S(T.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(C()))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)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?et():x()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ae({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ze()}):null,(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Te()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(T.admin.setDefaultThemeMode),i=S(T.admin.setDefaultLocale),a=S(T.charts.setDefaultChart),o=w(T.charts.listChartsAdmin),s=w(T.groups.listGroups,{}),l=e??`system`,d=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:c()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(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:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:E()}),ft.map(e=>(0,X.jsx)(O,{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)(O,{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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:tt()})]}),(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:Be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(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:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):(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:Re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(O,{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:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(O,{variant:d===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:de()})]})]})}function sn(){let e=w(T.me.getMe,{host:F}),t=_t(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.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:ot()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(O,{variant:`outline`,children:`Outline`}),(0,X.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(O,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,children:`Small`}),(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{size:`lg`,children:`Large`}),(0,X.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(z,{})}),(0,X.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{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)(k,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(B,{value:n,onValueChange:r,children:[(0,X.jsx)(V,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(j,{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)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(B,{value:o,onValueChange:s,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(B,{value:c,onValueChange:l,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{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)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(pt,{children:[(0,X.jsx)(dt,{asChild:!0,children:(0,X.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(z,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(O,{size:`sm`,children:`Save`}),(0,X.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(j,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(L,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(z,{})})})]},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{$D as r,Cd as i,Dd as a,Ed as o,Od as s,Sd as c,Td as l,aO as u,cO as d,dO as f,eO as p,iO as m,lO as h,nO as g,oO as _,rO as v,sO as y,tO as b,uO as x,wd as S}from"./api-ZghOy9gS.js";import{t as C}from"./button-kCamrfzR.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-C_ywXTWT.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:f(),from:`now-5m`},{label:x(),from:`now-15m`},{label:h(),from:`now-30m`},{label:d(),from:`now-1h`},{label:y(),from:`now-3h`},{label:_(),from:`now-6h`},{label:u(),from:`now-12h`},{label:m(),from:`now-24h`},{label:v(),from:`now-2d`},{label:g(),from:`now-7d`},{label:b(),from:`now-30d`},{label:p(),from:`now-90d`},{label:r(),from:`now-520w`}];function L(e){return T(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),[u,d]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),d(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=u.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[u]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:_,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{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:s()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(w,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:u,onChange:e=>d(e.target.value),placeholder:S(),"aria-label":i()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:c()}):b.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:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cd as r,Dd as i,Ed as a,Od as o,Sd as s,Td as c,aO as l,cO as u,dO as d,fO as f,iO as p,lO as m,mO as h,nO as g,oO as _,pO as v,rO as y,sO as b,uO as x,wd as S}from"./api-BEXV-QDx.js";import{t as C}from"./button-BI4NYd7l.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-CND0zLpO.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:h(),from:`now-5m`},{label:v(),from:`now-15m`},{label:f(),from:`now-30m`},{label:d(),from:`now-1h`},{label:x(),from:`now-3h`},{label:m(),from:`now-6h`},{label:u(),from:`now-12h`},{label:b(),from:`now-24h`},{label:_(),from:`now-2d`},{label:l(),from:`now-7d`},{label:p(),from:`now-30d`},{label:y(),from:`now-90d`},{label:g(),from:`now-520w`}];function L(e){return T(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,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),d(``)}l(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),l(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),l(!1))}let b=(0,M.useMemo)(()=>{let e=u.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[u]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:_,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{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:o()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(w,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:u,onChange:e=>d(e.target.value),placeholder:S(),"aria-label":r()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):b.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:()=>v(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{Cq as r,Sq as i,Tq as a,wq as o}from"./api-ZghOy9gS.js";import{t as s}from"./chevrons-up-down-Btm4pQFN.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-C_ywXTWT.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)(c,{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()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),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)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:o(),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:r()}):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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aq as r,Oq as i,jq as a,kq as o}from"./api-BEXV-QDx.js";import{t as s}from"./chevrons-up-down-BBnIDUVh.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-CND0zLpO.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)(c,{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()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),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)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:r(),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:o()}):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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$R as i,AR as a,Cj as o,Cu as s,DR as c,E as l,ER as u,FR as d,GA as f,GR as p,HA as m,IR as h,JA as g,JR as _,KA as v,KR as y,LR as b,MR as x,NR as S,OR as C,PR as w,QA as ee,QR as T,RR as te,Sj as ne,TR as E,Tu as re,UA as ie,VA as ae,WA as oe,WR as se,XA as ce,XR as le,YA as ue,YR as D,ZA as de,ZR as fe,_j as pe,aj as me,az as O,bj as he,cj as ge,cz as k,dj as _e,dz as A,ej as ve,ez as j,fX as M,fj as ye,fz as N,gj as be,hj as xe,ij as Se,iz as Ce,jR as we,kR as Te,lj as Ee,lz as De,mj as Oe,mz as ke,nj as Ae,nz as je,oj as Me,oz as Ne,pX as P,pj as Pe,pz as Fe,qA as Ie,qR as Le,rj as Re,rz as ze,sj as Be,sz as Ve,t as F,tj as He,tz as I,uj as Ue,uz as We,vj as Ge,wj as Ke,wu as qe,xj as Je,yj as Ye,zR as Xe}from"./api-BEXV-QDx.js";import{t as Ze}from"./x-ijoBrBAS.js";import{t as L}from"./button-BI4NYd7l.js";import{$n as Qe,At as R,Ct as $e,Dt as et,Jt as z,Ot as tt,St as B,Tt as nt,U as rt,Yn as it,a as at,at as V,bt as H,dr as ot,er as st,fr as ct,ft as lt,i as ut,it as dt,jt as ft,lr as pt,o as mt,ot as ht,rr as gt,s as _t,st as U,vt as W,wt as vt,xt as G,yt as K}from"./index-CND0zLpO.js";import{n as yt}from"./TimeRangePicker-1vrUmBZJ.js";import{t as bt}from"./FilterBar-Ct8JGeev.js";import{t as xt}from"./AdvancedFilter-Dnyuc-Bv.js";import{t as St}from"./DataTableShell-Dekyfrzb.js";var Ct=l(`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`?D():n===`agent`?`${_()} - ${r}`:e}function Tt(){let e=P(F.me.getMe,{host:lt})?.role===`admin`,t=P(F.deliveryTiming.getDeliveryStatus,{}),n=M(F.deliveryTiming.startDeliveryRecord),r=M(F.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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:ke()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()})]}),e?(0,J.jsx)(L,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?A():N()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{variant:`secondary`,children:We()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:De({time:ft(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ne():Ve()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=P(F.deliveryTiming.listDeliverySessions,{}),n=M(F.deliveryTiming.deleteDeliverySessions),[r,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:m,to:h}=yt(c),g=c.to===`now`?1/0:h,_=r.trim()!==``||o!==`all`||c!==Y,v=()=>{a(``),s(`all`),l(Y)},b=(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>=m&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,m,g]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:a,searchPlaceholder:Ce(),timeRange:c,onTimeRangeChange:l,onReset:v,canReset:_,children:(0,J.jsxs)(W,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:`all`,children:ze()}),(0,J.jsx)(H,{value:`active`,children:je()}),(0,J.jsx)(H,{value:`stopped`,children:I()})]})]})}),(0,J.jsx)(St,{title:O(),rows:b,emptyHint:u(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?y():Le(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(st,{size:15,"aria-hidden":!0}):(0,J.jsx)(Qe,{size:15,"aria-hidden":!0})})},{header:j(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.startedAt)})},{header:i(),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:R(e.stoppedAt)})},{header:T(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:fe(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:le(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(z,{variant:`secondary`,children:je()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:p(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:p(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=P(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(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:se()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()});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,` `,E()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(pt,{size:13,"aria-hidden":!0}):(0,J.jsx)(gt,{size:13,"aria-hidden":!0}),t?c():C()]})]}),(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:b()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:h()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:d()})]})}),(0,J.jsxs)(`tbody`,{children:[i(w(),r.bridge),i(S(),r.A),i(x(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]})}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:re()},{value:`principalType`,label:qe()},{value:`direction`,label:`direction`},{value:`roleKey`,label:s()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=ct({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,d=e.correlationId,p=ut(e.from,e.to),m=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:h,to:_}=yt(p),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),re=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ie=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ae=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),se=e=>void t({search:t=>({...t,...mt(e)})}),le=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),D=P(F.observability.listEvents,{limit:n}),fe=P(F.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:h,to:_,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:m.length>0?m:void 0}}),O=(0,q.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),A=u!==``||a!==Q||s!==Q||c!==Q||l!==Q||m.length>0||p.kind!==`relative`||p.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=y?D?.filter(e=>e.correlationId===y):fe,N=e.section,Ce=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(dt,{value:N,onValueChange:e=>Ce(e),children:[(0,J.jsxs)(ht,{className:`w-full`,children:[(0,J.jsxs)(U,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),Xe()]}),(0,J.jsxs)(U,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),te()]})]}),(0,J.jsx)(V,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(V,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke(),(0,J.jsx)(`strong`,{children:o()}),ne(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Je()})]}),(0,J.jsxs)(bt,{q:u,onQChange:T,searchPlaceholder:he(),timeRange:p,onTimeRangeChange:se,onReset:j,canReset:A,children:[(0,J.jsxs)(W,{value:a,onValueChange:E,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Ye()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:Ge()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:s,onValueChange:re,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:pe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:be()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:c,onValueChange:ie,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:xe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:Oe()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:l,onValueChange:ae,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{placeholder:Pe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:ye()}),k.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:i===Z?``:i,placeholder:_e(),"aria-label":_e(),onChange:e=>{let t=e.target.value.trim();w(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:O.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(W,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(K,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Ue({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:m,onChange:le}),y?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Ee(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ge(),(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:Be()})]})}):null,(0,J.jsx)(St,{title:Me(),rows:M,emptyHint:y?me():Se(),columns:[{header:Re(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)})},{header:Ae(),sort:e=>e.kind,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.kind})},{header:He(),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":ve(),children:`✓`})}},{header:r(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(z,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:de(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ce(),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:ue(),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:g(),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:Ie(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:v(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:oe()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:x,onClose:()=>S(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)($e,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(vt,{className:`max-w-lg`,children:[(0,J.jsxs)(et,{children:[(0,J.jsxs)(tt,{className:`oc-traces__meta-title`,children:[ie(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(z,{variant:`outline`,children:m()})]}),(0,J.jsx)(nt,{children:ae()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BA as r,BT as i,E as a,GT as o,HT as s,IT as c,JT as l,KT as u,LT as d,QT as f,RT as p,UT as m,VT as h,WT as g,XT as _,YT as v,ZT as y,aX as b,fX as x,nE as S,pX as C,qT as w,t as T,tE as E,zT as D}from"./api-BEXV-QDx.js";import{t as O}from"./use_paginated_query-CWrNoLih.js";import{t as k}from"./button-BI4NYd7l.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-CND0zLpO.js";import{n as I,t as L}from"./trashPage-CtRjTgEJ.js";var R=a(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=C(T.blobSweep.listBlobSweeps,{}),t=C(T.blobQuarantine.quarantineSettings,{}),n=x(T.blobSweep.startBlobSweep),a=P(),{toast:S}=N(),[E,O]=(0,z.useState)(!1),F=b(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){S({title:c(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await a({title:i({count:H.orphans.count}),description:D({size:I(H.orphans.bytes)}),confirmLabel:h(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:f()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:E||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,_()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:E||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,h()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:y({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:v({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:l()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:w({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:u({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:o({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:g({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:m({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:s()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?d({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):p({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(T.trash.adminListTrash,{},{initialNumItems:50}),i=F(),a=x(T.trash.adminRestoreChat),o=x(T.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:S({days:i})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:E()}):(0,V.jsx)(L,{items:e,onRestore:e=>a({chatId:e}),onPurge:e=>o({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$k as i,JF as a,QF as o,Qk as s,SI as c,XF as l,Xk as u,YF as d,ZF as f,Zk as p,_I as m,_b as h,aA as g,aI as ee,bI as _,cA as v,cI as te,dI as ne,eA as y,eI as re,fI as ie,fX as b,gI as ae,gb as x,hI as oe,hb as S,iA as C,iI as se,kF as ce,lI as le,mI as ue,nA as w,nI as de,oA as T,oI as E,pI as fe,pX as D,rA as O,rI as pe,sA as k,sI as me,t as A,tA as j,tI as he,uI as ge,vI as _e,xI as M,yI as ve}from"./api-BEXV-QDx.js";import{t as N}from"./button-BI4NYd7l.js";import{Ct as P,Dt as F,J as I,Jt as L,Mt as R,Ot as ye,Pn as z,St as B,Tt as be,Yt as V,an as xe,bt as H,c as U,ct as Se,dr as W,en as Ce,fr as we,ft as Te,jn as G,l as Ee,lt as De,nn as Oe,rn as ke,tn as Ae,u as K,vt as q,wt as je,xt as J,yt as Y}from"./index-CND0zLpO.js";import{t as Me}from"./FilterBar-Ct8JGeev.js";import{t as Ne}from"./DataTableShell-Dekyfrzb.js";import{t as Pe}from"./DetailChips-Kz4cbymu.js";var X=t(e(),1),Z=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=D(A.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=D(A.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Z.jsx)(P,{open:n,onOpenChange:r,children:(0,Z.jsxs)(je,{className:`oc-access`,children:[(0,Z.jsxs)(F,{children:[(0,Z.jsx)(ye,{children:v({user:t})}),(0,Z.jsx)(be,{children:k()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?T():g()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:C()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:j()}):[...d.entries()].map(([t,n])=>(0,Z.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let c=b(A.agents.assignAgent),l=b(A.agents.removeAgent),d=b(A.agents.setDefaultAgent),f=V();if(!e)return null;async function m(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await c({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(O(),I(e))}}async function h(n){try{await d({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(w(),I(e))}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),c=o===n,l=e.state===`deleted`,d=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${d?` is-disabled`:``}`,children:[(0,Z.jsx)(R,{checked:r,disabled:(l||d)&&!r,onCheckedChange:()=>void m(e.agentId,r),"aria-label":y({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,l?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:i()}):null,e.outOfPool?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:s()}):null,r?c?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":p(),title:p(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":u(),title:u(),disabled:d,onClick:()=>void h(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return S();case`user`:return x();case`admin`:return h();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(K[e])).length;return(0,Z.jsxs)(Ce,{children:[(0,Z.jsx)(xe,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?c():M({count:r})})}),(0,Z.jsxs)(Ae,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(ke,{children:_()}),U.map(e=>{let r=K[e];return(0,Z.jsxs)(Oe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(R,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Re(){let e=we({from:`/settings/users`}),t=W({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=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})}),u=D(A.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),p=D(A.me.getMe,{host:Te}),h=b(A.admin.setRole),g=b(A.admin.setUserPermissions),_=b(A.admin.startImpersonation),v=b(A.admin.deleteUser),y=b(A.admin.setUserName),x=Se(),S=De(),C=V(),[w,T]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of u??[])e.add(t.role);return[...e]},[u]),k=n!==``||i!==Q;function j(){t({search:{},replace:!0})}async function M(e){try{await h(e)}catch(e){C.error(ve(),e)}}async function N(e){try{await g(e)}catch(e){C.error(_e(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await x({title:ne(),description:ge({user:t}),confirmWord:le(),confirmLabel:te(),destructive:!0}))try{await v({profileId:e._id}),C.success(E({user:t}))}catch(e){C.error(me(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await S({title:se(),label:pe({user:t}),placeholder:de(),defaultValue:e.name??``,confirmLabel:ce()});if(n!==null)try{await y({profileId:e._id,name:n}),C.success(he())}catch(e){C.error(re(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{q:n,onQChange:s,searchPlaceholder:m(),onReset:j,canReset:k,children:(0,Z.jsxs)(q,{value:i,onValueChange:c,children:[(0,Z.jsx)(J,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:Q,children:ae()}),O.map(e=>(0,Z.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Ne,{title:oe(),rows:u,emptyHint:ue(),rowActions:e=>{let t=[{label:a(),onSelect:()=>T({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ee(),onSelect:()=>void F(e)}];return e.userId!==p?.userId&&t.push({label:fe(),onSelect:()=>void _({profileId:e._id})},{label:ie(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:r(),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:o(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(q,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,Z.jsx)(J,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(H,{value:`user`,children:$(`user`)}),(0,Z.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:f(),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:l()}):(0,Z.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:d(),cell:e=>(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(z,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Fe,{profileId:w?.profileId??null,userLabel:w?.label??``,open:w!==null,onOpenChange:e=>{e||T(null)}})]})}export{Re as UsersTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Ac as i,Al as a,Bl as o,Cc as s,Cl as c,Dl as ee,EL as l,El as u,Fl as d,Hl as f,Il as p,Ll as m,Ml as h,Nl as g,Ol as te,Pl as _,Rl as v,Sc as y,Sl as b,Sv as x,Tl as S,Ul as ne,Vl as re,Xs as ie,Zg as ae,aX as oe,bc as se,bl as ce,cc as le,dc as C,fX as w,gc as T,hc as ue,jl as de,kl as fe,lc as E,mc as D,pX as O,pc as pe,rX as k,t as A,uX as me,uc as he,wl as j,xc as M,xl as N,yc as P,yl as F,zl as I}from"./api-BEXV-QDx.js";import{t as L}from"./button-BI4NYd7l.js";import{Cn as R,Jt as z,Mt as B,Sn as V,St as H,Tn as ge,Wn as _e,_n as ve,at as U,bn as ye,bt as W,dr as be,fr as xe,ft as Se,it as Ce,ot as we,st as G,ur as Te,vn as Ee,vt as K,xn as q,xt as J,yn as De,yt as Y}from"./index-CND0zLpO.js";/* empty css */var X=t(e(),1),Z=n(),Q=[[`auto`,()=>p()],[`fr-FR`,()=>s()],[`en-US`,()=>y()],[`en-GB`,()=>M()],[`de-DE`,()=>se()],[`es-ES`,()=>P()]],Oe=[[`0.75`,()=>_()],[`1`,()=>g()],[`1.25`,()=>h()],[`1.5`,()=>de()]],$=0;function ke({instance:e}){let t=w(A.admin.upsertInstanceConfig),n=e.config??{},i={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},[o,s]=(0,X.useState)(i),[c,l]=(0,X.useState)(`idle`),[f,p]=(0,X.useState)(!1),[h,g]=(0,X.useState)(!1),_=me(A.voice.gatewayTtsPreview);(0,X.useEffect)(()=>{s({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}),l(`idle`)},[e._id]);let y=o.enabled!==i.enabled||o.engine!==i.engine||o.lang!==i.lang||o.rate!==i.rate||o.autoRead!==i.autoRead;async function b(){l(`saving`);try{let n={...e.config??{}};n.voiceEnabled=o.enabled,o.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,o.lang===`auto`?delete n.voiceLang:n.voiceLang=o.lang;let r=Number.parseFloat(o.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,o.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),l(`idle`)}catch{l(`error`)}}return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(z,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(B,{checked:o.enabled,onCheckedChange:e=>s({...o,enabled:e===!0}),"aria-label":v()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,Z.jsxs)(K,{value:o.engine,onValueChange:e=>s({...o,engine:e}),disabled:!o.enabled,children:[(0,Z.jsx)(J,{size:`sm`,"aria-label":C(),children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(W,{value:`browser`,children:he()}),e.kind===`hermes`?null:(0,Z.jsx)(W,{value:`gateway`,children:E()})]})]})]}),o.engine===`gateway`?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()}):null,o.engine===`gateway`?null:(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,Z.jsxs)(K,{value:o.lang,onValueChange:e=>s({...o,lang:e}),disabled:!o.enabled,children:[(0,Z.jsx)(J,{size:`sm`,"aria-label":m(),children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(Y,{children:Q.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,Z.jsxs)(K,{value:o.rate,onValueChange:e=>s({...o,rate:e}),disabled:!o.enabled,children:[(0,Z.jsx)(J,{size:`sm`,"aria-label":d(),children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(Y,{children:Oe.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),o.engine===`gateway`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(B,{checked:o.autoRead,onCheckedChange:e=>s({...o,autoRead:e===!0}),disabled:!o.enabled,"aria-label":a()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:fe()})]}),(0,Z.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Z.jsx)(L,{size:`sm`,disabled:!y||c===`saving`,onClick:()=>void b(),children:c===`saving`?x():r()}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,disabled:!o.enabled||f,onClick:()=>{let t=Number.parseFloat(o.rate)||1,n=++$;if(g(!1),V(),q(),o.engine!==`gateway`){ye(u(),{lang:De(o.lang,oe()),rate:t});return}p(!0),_({instanceName:e.name,text:u()}).then(({mime:e,audioBase64:r})=>{n===$&&Ee(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>p(!1))},children:f?x():te()}),(0,Z.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),V(),q()},children:ee()})]}),c===`error`||h?(0,Z.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h?ie():ae()}):null]})}function Ae({stt:e}){let t=O(A.me.getMe,{host:Se}),n=w(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:j()}),(0,Z.jsx)(z,{variant:e?`secondary`:`outline`,children:e?ce():F()}),(0,Z.jsx)(z,{variant:r?`secondary`:`destructive`,children:r?ue():D()})]}),i?(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(B,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":T()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]}):null,(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]})}function je(){let e=O(A.admin.listInstances,{}),t=(0,X.useMemo)(()=>R(),[]),n=(0,X.useMemo)(()=>ve(),[]),{section:r}=xe({from:`/settings/voice`}),i=be({from:`/settings/voice`});return(0,Z.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Z.jsx)(z,{variant:t?`secondary`:`destructive`,children:t?f():re()}),(0,Z.jsx)(z,{variant:n?`secondary`:`destructive`,children:n?o():I()})]}),(0,Z.jsxs)(Ce,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Z.jsxs)(we,{className:`w-full`,children:[(0,Z.jsxs)(G,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(ge,{size:13,"aria-hidden":!0}),pe()]}),(0,Z.jsxs)(G,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(_e,{size:13,"aria-hidden":!0}),j()]}),(0,Z.jsxs)(G,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Te,{size:13,"aria-hidden":!0}),b()]})]}),(0,Z.jsx)(U,{value:`readaloud`,children:e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.map(e=>(0,Z.jsx)(ke,{instance:e},e._id))}),(0,Z.jsx)(U,{value:`dictation`,children:(0,Z.jsx)(Ae,{stt:n})}),(0,Z.jsxs)(U,{value:`talk`,children:[(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:b()})}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]}),e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.map(e=>(0,Z.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=w(A.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,a=e.kind===`hermes`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(z,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()}):(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(B,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":l()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()})]})]})}export{je as VoiceTab};