local-operator-ui 0.57.3 → 0.57.5

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 (100) hide show
  1. package/out/main/index.js +1044 -63
  2. package/out/preload/index.js +102 -21
  3. package/out/renderer/assets/{_basePickBy-BeAzmqgq.js → _basePickBy-D2upKftS.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-Clx9gdFs.js → _baseUniq-BGD19KIN.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-BMztNR89.js → agent-details-page-OPyFw_dI.js} +1 -1
  6. package/out/renderer/assets/{agent-hub-page-quUNNwcr.js → agent-hub-page-B3V1y16n.js} +1 -1
  7. package/out/renderer/assets/{agents-page-BTYHgMAf.js → agents-page-CowgZsSO.js} +3 -3
  8. package/out/renderer/assets/appearance-DO4VPBSi.js +65 -0
  9. package/out/renderer/assets/{approvalsOverlay-BxwEca1y.js → approvalsOverlay-CBPXn0ct.js} +1 -1
  10. package/out/renderer/assets/{arc-BOZHzyJm.js → arc-Cv6N9gTJ.js} +1 -1
  11. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-CpE8Siol.js → architectureDiagram-IEHRJDOE-DHtB5fE0.js} +1 -1
  12. package/out/renderer/assets/{avatar-cropper-BWJE7j7A.js → avatar-cropper-Bjo9zUPg.js} +1 -1
  13. package/out/renderer/assets/{blockDiagram-JOT3LUYC-D4LTtQ_H.js → blockDiagram-JOT3LUYC-4WEK73Je.js} +1 -1
  14. package/out/renderer/assets/{book-open-fa_DaJBq.js → book-open-CmfjhXrg.js} +1 -1
  15. package/out/renderer/assets/browser-page-2S7sbehs.js +1 -0
  16. package/out/renderer/assets/{browser-webauthn-prompt-VC7pNm9O.js → browser-webauthn-prompt-D8Tgtg83.js} +1 -1
  17. package/out/renderer/assets/{c4Diagram-VJAJSXHY-DRtUDXOF.js → c4Diagram-VJAJSXHY-kaGHtOK6.js} +1 -1
  18. package/out/renderer/assets/channel-DRHru1K8.js +1 -0
  19. package/out/renderer/assets/{chunk-4BMEZGHF-Cw4VudrA.js → chunk-4BMEZGHF-CpC8J2AT.js} +1 -1
  20. package/out/renderer/assets/{chunk-A2AXSNBT-0JOiKMb-.js → chunk-A2AXSNBT-DKmX4atq.js} +1 -1
  21. package/out/renderer/assets/{chunk-AEK57VVT-CAKCg9DA.js → chunk-AEK57VVT-Dtej3BD4.js} +1 -1
  22. package/out/renderer/assets/{chunk-D6G4REZN-CFZ2DTGX.js → chunk-D6G4REZN-DUXxF-pw.js} +1 -1
  23. package/out/renderer/assets/{chunk-RZ5BOZE2-CupwUHva.js → chunk-RZ5BOZE2-DeeJjU3w.js} +1 -1
  24. package/out/renderer/assets/{chunk-XZIHB7SX-B1vcbFku.js → chunk-XZIHB7SX-D4R6kzHb.js} +1 -1
  25. package/out/renderer/assets/classDiagram-GIVACNV2-Cs0VSRpc.js +1 -0
  26. package/out/renderer/assets/classDiagram-v2-COTLJTTW-Cs0VSRpc.js +1 -0
  27. package/out/renderer/assets/clone-_NlCUljT.js +1 -0
  28. package/out/renderer/assets/{console-mirror-IB35kNI8.js → console-mirror-Bp3thuUi.js} +1 -1
  29. package/out/renderer/assets/{consoleCapture-D4G96kDb.js → consoleCapture-BJR8BDEY.js} +1 -1
  30. package/out/renderer/assets/{conversation-input-sync-DlorrZ6B.js → conversation-input-sync-FnnZiNnd.js} +4 -4
  31. package/out/renderer/assets/{dagre-OKDRZEBW-CunvCCGM.js → dagre-OKDRZEBW-DDY_IkmM.js} +1 -1
  32. package/out/renderer/assets/{diagram-SSKATNLV-DlpXMePq.js → diagram-SSKATNLV-D7AGoSSj.js} +1 -1
  33. package/out/renderer/assets/{diagram-VNBRO52H-CtgMK6MT.js → diagram-VNBRO52H-CcgAGaBN.js} +1 -1
  34. package/out/renderer/assets/{erDiagram-Q7BY3M3F-C-QNezLB.js → erDiagram-Q7BY3M3F-LEYxek3-.js} +1 -1
  35. package/out/renderer/assets/{error-boundary-C1x5W-AX.js → error-boundary-BsWceBKP.js} +1 -1
  36. package/out/renderer/assets/{flowDiagram-4HSFHLVR-DjwRYw0E.js → flowDiagram-4HSFHLVR-CQLUaH8T.js} +1 -1
  37. package/out/renderer/assets/{ganttDiagram-APWFNJXF-Tb5F1KXD.js → ganttDiagram-APWFNJXF-Ole27PT-.js} +1 -1
  38. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BokP9Y1T.js → gitGraphDiagram-7IBYFJ6S-BNYa___9.js} +1 -1
  39. package/out/renderer/assets/{graph-DEHYXN6b.js → graph-Bibb0aeq.js} +1 -1
  40. package/out/renderer/assets/{heart-DqMMtrJ1.js → heart-Cix0tXFr.js} +1 -1
  41. package/out/renderer/assets/index-BKLUTBo0.css +1 -0
  42. package/out/renderer/assets/index-BKh47kLl.js +857 -0
  43. package/out/renderer/assets/{index-D7fnBkIK.js → index-C9UzsV82.js} +1 -1
  44. package/out/renderer/assets/{index-CJ8BPUHQ.js → index-CMJfInon.js} +1 -1
  45. package/out/renderer/assets/{index-BWQzFq0n.js → index-D0qlrLIs.js} +10 -10
  46. package/out/renderer/assets/infoDiagram-PH2N3AL5-BXhry1Gr.js +2 -0
  47. package/out/renderer/assets/{inline-error-boundary-ChbTvdIh.js → inline-error-boundary-Ba_FWBMT.js} +1 -1
  48. package/out/renderer/assets/{installer-Bplg-bpo.js → installer-bmE_RNOZ.js} +1 -1
  49. package/out/renderer/assets/{journeyDiagram-U35MCT3I-BfXoBW-2.js → journeyDiagram-U35MCT3I-DI32aDKT.js} +1 -1
  50. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BeT3LOJG.js → kanban-definition-NDS4AKOZ-CZ-ELIdr.js} +1 -1
  51. package/out/renderer/assets/{layout-B71SsWep.js → layout-Dza9PMRJ.js} +1 -1
  52. package/out/renderer/assets/{legacy-agents-page-BaSX_kru.js → legacy-agents-page-CPFGYWOZ.js} +1 -1
  53. package/out/renderer/assets/{library-page-BwmVBhNJ.js → library-page-DiaLon0b.js} +3 -3
  54. package/out/renderer/assets/{log-in-C4tjIXzF.js → log-in-Bd6fDqyJ.js} +1 -1
  55. package/out/renderer/assets/{mermaid.core-D7wfsRjY.js → mermaid.core-BcJdc-X6.js} +5 -5
  56. package/out/renderer/assets/{mesh-page-DbC0RmVo.js → mesh-page-7T5BtRTh.js} +1 -1
  57. package/out/renderer/assets/{messages-B7aIuFuF.js → messages-BYDbMAVA.js} +10 -10
  58. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BPTOzHuL.js → mindmap-definition-ALO5MXBD-D2CXGzTD.js} +1 -1
  59. package/out/renderer/assets/{mini-DXMqE-0u.js → mini-CJlFVLUZ.js} +1 -1
  60. package/out/renderer/assets/{notebook-pen-CQdB2BC5.js → notebook-pen-D05OGtSm.js} +1 -1
  61. package/out/renderer/assets/{notifications-page-C9PU2typ.js → notifications-page-BjrfZb8l.js} +1 -1
  62. package/out/renderer/assets/{org-access-Fw38H9fZ.js → org-access-B9_h9w7n.js} +1 -1
  63. package/out/renderer/assets/{org-surface-gate-CKBjFWJL.js → org-surface-gate-sm4xQvjq.js} +1 -1
  64. package/out/renderer/assets/{page-header-CAW9G_fb.js → page-header-DXwYxMB-.js} +1 -1
  65. package/out/renderer/assets/{pieDiagram-IB7DONF6-C0JN0KMq.js → pieDiagram-IB7DONF6-DUG4cv-v.js} +1 -1
  66. package/out/renderer/assets/{projects-page-D9F4QotN.js → projects-page-DlCYJUiP.js} +1 -1
  67. package/out/renderer/assets/{publication-validation-DygSOQkj.js → publication-validation-Bn7rmCS6.js} +1 -1
  68. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BRgjFQlM.js → quadrantDiagram-7GDLP6J5-DaYms9_B.js} +1 -1
  69. package/out/renderer/assets/{radar-MK3ICKWK-VE0niGVF.js → radar-MK3ICKWK-B97TgRmB.js} +1 -1
  70. package/out/renderer/assets/{radient-auth-buttons-CXMLVkUO.js → radient-auth-buttons-CEfTJcvg.js} +1 -1
  71. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DkwJBmMi.js → requirementDiagram-KVF5MWMF-DgyICZXf.js} +1 -1
  72. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-DFv3zh8B.js → sankeyDiagram-QLVOVGJD-DHgZL_Zc.js} +1 -1
  73. package/out/renderer/assets/{schedules-page-aTbxrD_M.js → schedules-page-CNdkudlY.js} +1 -1
  74. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BXcr3er8.js → sequenceDiagram-X6HHIX6F-pU2H-s2W.js} +1 -1
  75. package/out/renderer/assets/settings-page-B9GORgXK.js +319 -0
  76. package/out/renderer/assets/{smartart-CWBh1X_F.js → smartart-gFtvTNRW.js} +1 -1
  77. package/out/renderer/assets/{stateDiagram-DGXRK772-Cw08neDd.js → stateDiagram-DGXRK772-HwW2OpHh.js} +1 -1
  78. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BwCPC1S5.js +1 -0
  79. package/out/renderer/assets/{team-bridge-page-BHAdGSZS.js → team-bridge-page-ChcIcnje.js} +17 -17
  80. package/out/renderer/assets/{timeline-definition-BDJGKUSR-B-ZFBehC.js → timeline-definition-BDJGKUSR-CPNzpTN8.js} +1 -1
  81. package/out/renderer/assets/{use-default-on-banner-C8DUslhy.js → use-default-on-banner-CuXTqN3l.js} +1 -1
  82. package/out/renderer/assets/{use-download-agent-mutation-DMGaSxDK.js → use-download-agent-mutation-BCbr9wLe.js} +1 -1
  83. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BGB8PPzY.js → xychartDiagram-VJFVF3MP-TZFrKw4j.js} +1 -1
  84. package/out/renderer/browser-approvals-overlay.html +2 -2
  85. package/out/renderer/console-capture.html +6 -6
  86. package/out/renderer/index.html +8 -8
  87. package/out/renderer/installer.html +5 -5
  88. package/out/renderer/mini.html +7 -7
  89. package/package.json +1 -1
  90. package/out/renderer/assets/appearance-DCqlsN7S.js +0 -65
  91. package/out/renderer/assets/browser-page-AgwdXhLM.js +0 -1
  92. package/out/renderer/assets/channel-DMQl-cpj.js +0 -1
  93. package/out/renderer/assets/classDiagram-GIVACNV2-DJsxDWD8.js +0 -1
  94. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DJsxDWD8.js +0 -1
  95. package/out/renderer/assets/clone-B9GxWhWi.js +0 -1
  96. package/out/renderer/assets/index-BnqyWEPM.css +0 -1
  97. package/out/renderer/assets/index-Buuz619t.js +0 -852
  98. package/out/renderer/assets/infoDiagram-PH2N3AL5-bdAhVGkO.js +0 -2
  99. package/out/renderer/assets/settings-page-DWZ3Mguh.js +0 -319
  100. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BtazAv7-.js +0 -1
@@ -1 +1 @@
1
- import{r as a,j as t,c as le}from"./index-BWQzFq0n.js";import{e as Ai,f as Mi,a as qi,g as pt,h as Ii,i as z,j as Wt,o as Fi,k as mt,l as zi,m as Bi,r as Li}from"./appearance-DCqlsN7S.js";import{P as $t}from"./page-header-CAW9G_fb.js";import{u as li,S as Ht,A as Kt,B as w,C as di,a as Pi,b as Oi,d as Ui,X as Gt,e as Vi,f as Wi,D as ht,g as gt,h as He,i as xt,j as kt,k as Te,l as $e,m as ui,n as fi,o as pi}from"./error-boundary-C1x5W-AX.js";import{P as mi,Q as $i,R as Nt,S as Hi,T as Ki,U as Gi,V as Qi,W as Xi,X as Yi,Y as Zi,Z as Ji,_ as en,$ as Qt,a0 as tn,a1 as nn,a2 as Ke,a3 as sn,a4 as an,a5 as on,a6 as Xt,a7 as rn,a8 as yt,a9 as Yt,aa as Zt,ab as cn,ac as Jt,ad as Y,ae as ei,af as ln,ag as ti,ah as ke,ai as ii,aj as Ae,ak as dn,al as un,am as vt,an as Me,ao as X,ap as qe,aq as fn,ar as pn,as as mn,at as hn,au as gn,av as ni,aw as xn,ax as kn,ay as yn}from"./conversation-input-sync-DlorrZ6B.js";import{t as n}from"./messages-B7aIuFuF.js";import{a as si,R as vn,C as hi}from"./index-Buuz619t.js";import"./roles-D1pcbxAx.js";import"./console-mirror-IB35kNI8.js";const wt=120,bt=180,wn=({exiting:r,children:c,onExited:g})=>{const d=mi("(prefers-reduced-motion: reduce)"),[u,b]=a.useState("idle"),[D,S]=a.useState(null),U=a.useRef(null),v=a.useRef(!1);a.useLayoutEffect(()=>{if(r&&!v.current){if(v.current=!0,d){g();return}S(U.current?.getBoundingClientRect().height??56),b("leaving")}else!r&&v.current&&(v.current=!1,b("idle"),S(null))},[r,d,g]),a.useEffect(()=>{if(!r||d||u==="idle")return;if(u==="leaving"){const se=setTimeout(()=>b("collapsing"),wt);return()=>clearTimeout(se)}const C=setTimeout(g,bt);return()=>clearTimeout(C)},[r,u,d,g]);const M={height:u==="collapsing"?0:D??void 0,overflow:u==="idle"?void 0:"hidden",transition:u==="idle"||d?void 0:u==="leaving"?`opacity ${wt}ms var(--ease-out-quart), transform ${wt}ms var(--ease-out-quart)`:`height ${bt}ms var(--ease-out-quart), opacity ${bt}ms var(--ease-out-quart)`,opacity:u==="idle"?void 0:0,transform:u==="leaving"?"translateY(-8px)":void 0,pointerEvents:u==="idle"?void 0:"none"};return t.jsx("div",{ref:U,style:M,className:le("shrink-0",u!=="idle"&&"motion-reduce:hidden"),"aria-hidden":u!=="idle"||void 0,...u!=="idle"?{inert:""}:{},"data-notification-exit":u==="idle"?void 0:u,children:c})},bn=({progress:r})=>(li(),t.jsx("output",{className:"shrink-0 px-6 py-1 text-meta text-ink-muted","data-notification-operation":"",children:n("ui.notifications.operation.progress",r)})),ai=(r,c)=>{r&&(r.pending.length>0||r.error!==void 0)||c(null)},jn=(r,c,g)=>{const d=a.useRef(r);d.current=r;const u=Bi({queryKey:["desktop","notifications","session-scope-counts",g],enabled:c&&r!==void 0,queryFn:()=>kn(yn(d.current)),retry:Li,staleTime:5e3,refetchOnWindowFocus:!1});return{counts:u.data,pending:r===void 0||u.data===void 0}},Sn=75,oi=r=>{Rt.current=r,performance.mark("lop:notifications:read:requested")},jt=(...r)=>{for(const c of r)performance.clearMarks(`lop:notifications:${c}`)},Rt={current:null},St=r=>n("ui.notifications.operation.progress",r),_t="notifications-read-state",gi="notifications-grouping",ri=(r,c,g)=>{try{const d=localStorage.getItem(r);return c.includes(d)?d:g}catch{return g}},Dt=(r,c)=>{try{localStorage.setItem(r,c)}catch{}},On=({nowMs:r})=>{li();const{notificationId:c}=Ai(),g=Mi(),d=qi(),b=pt(d.data,"notifications",1)==="enabled",D=pt(d.data,"notification_bulk_selection",1)==="enabled",S=pt(d.data,"notification_bulk_ask_read",1)==="enabled",U=r??Date.now(),v=!mi("(min-width: 1100px)"),{client:M}=Ii(),[C,se]=a.useState(()=>ri(_t,["unread","all"],"unread")),[de,ae]=a.useState(()=>ri(gi,["time","conversation"],"time")),[ue]=$i(),[E,fe]=a.useState(()=>({...Nt,from:ue.get("from")||null})),[ye,oe]=a.useState(()=>new Set),[p,ve]=a.useState(null),[F,K]=a.useState(null),we=a.useRef(0),B=a.useRef(null),[L,be]=a.useState(null),[x,N]=a.useState(null),[G,je]=a.useState(null),[Se,re]=a.useState(null),[Z,q]=a.useState(!1),j=a.useRef(!1),[_e,Et]=a.useState(()=>new Map),[Ge,J]=a.useState(()=>new Map),Qe=a.useRef(new Map),[xi,Tt]=a.useState(0),[At,ki]=a.useState(null),[yi,Xe]=a.useState(!0),V=a.useRef(null),Ie=a.useRef(null),Ye=a.useCallback(()=>{const e=V.current;if(!e)return;const i=e.getBoundingClientRect();Ie.current={port:e,scrollTop:e.scrollTop,rows:[...e.querySelectorAll("[data-notification-row]")].flatMap(o=>{const s=o.getBoundingClientRect();return s.bottom>i.top&&s.top<i.bottom?[{id:o.dataset.notificationRow,offset:s.top-i.top}]:[]})}},[]),Ze=a.useCallback(()=>{const e=V.current;if(!e)return[];const i=e.getBoundingClientRect();return[...e.querySelectorAll("[data-notification-row]")].filter(o=>{const s=o.getBoundingClientRect();return i.height===0||s.bottom>=i.top&&s.top<=i.bottom}).map(o=>o.dataset.notificationRow).slice(0,500)},[]),Je=a.useRef(!1);a.useEffect(()=>{!Z&&Je.current&&(Je.current=!1,document.querySelector("[data-notifications-select-all]")?.focus())},[Z]);const m=Hi(C,b,{atTop:yi}),ce=Ki(()=>{m.resetToTop()}),vi=Gi(),Ce=Qi(),Fe=a.useCallback((e,i)=>"items"in i?(e==="read"?Ce.markRead:e==="unread"?Ce.markUnread:e==="dismiss"?Ce.dismiss:Ce.restore)(i.items):Xi(e,i),[Ce]),{query:I,behindLoading:Mt}=Yi(c??null,b,c?m.data?.items.find(e=>e.id===c)?.revision:void 0),et=Zi(m.data),wi=Ji(I.data?.item.session.id??null,b&&!!I.data?.item.session.id&&et===void 0);a.useEffect(()=>{m.isSuccess&&!m.isFetching&&ki(m.dataUpdatedAt)},[m.isSuccess,m.isFetching,m.dataUpdatedAt]);const qt=a.useRef(0);a.useEffect(()=>{!m.windowResetAt||m.windowResetAt===qt.current||(qt.current=m.windowResetAt,Ie.current=null,V.current&&(V.current.scrollTop=0),Xe(!0))},[m.windowResetAt]);const k=m.data,pe=a.useMemo(()=>{const e=en(k?.items??[],Qe.current),i=[..._e.values()],o=[...e.filter(l=>!_e.has(l.id)),...i];if(C!=="unread"||Ge.size===0)return o;const s=new Set(o.map(l=>l.id));return[...o,...[...Ge.values()].filter(l=>!s.has(l.id))]},[k,C,Ge,xi,_e]),me=a.useMemo(()=>(k?.reelWaiting??k?.waiting??[]).filter(e=>!_e.has(e.id)),[k,_e]),tt=a.useMemo(()=>Qt(pe,E),[pe,E]),Ne=a.useMemo(()=>Qt(me,E),[me,E]),bi=tt.filter(e=>!e.read).length+Ne.filter(e=>!e.read).length,ze=a.useMemo(()=>tn(tt,Ne,de,U),[tt,Ne,de,U]),h=a.useMemo(()=>nn(ze),[ze]);a.useLayoutEffect(()=>{const e=V.current,i=Ie.current;if(e&&i?.port===e&&i.scrollTop>0)for(const o of i.rows){const s=e.querySelector(`[data-notification-row="${CSS.escape(o.id)}"]`);if(s){e.scrollTop+=s.getBoundingClientRect().top-e.getBoundingClientRect().top-o.offset;break}}Ye()},[ze,Ye]);const ji=Ke(E)&&h.length===0&&!!m.hasNextPage;a.useEffect(()=>{if(!Ke(E)||!m.hasNextPage||m.isFetchingNextPage||m.isError)return;const e=V.current;(h.length===0||e&&e.clientHeight>0&&e.scrollHeight<=e.clientHeight+160)&&m.fetchNextPage()},[E,h.length,m.hasNextPage,m.isFetchingNextPage,m.isError,m.fetchNextPage]);const ee=a.useMemo(()=>{const e=new Map;for(const i of[...me,...pe])e.set(i.id,i);return e},[pe,me]),it=a.useMemo(()=>{const e=new Map;for(const i of[...me,...pe]){const o=e.get(i.session.id)??[i.session.id,i.session.title||n("ui.notifications.group.untitled"),0];o[2]+=1,e.set(i.session.id,o)}return[...e.values()].sort((i,o)=>o[2]-i[2])},[pe,me]),he=m.isRefreshError&&!!k,Si=jn(k?.high_water,!!k&&et===void 0&&on(de,!!c),[sn(k?.items??[],I.data?.item.session.id??""),an(I.data?.item.session.id?wi.data:void 0)].join("|")),It=et??Si.counts,P=he||Z,[_i,nt]=a.useState(()=>new Set),Be=a.useCallback(e=>{nt(i=>new Set([...i,...e]))},[]),Ft=a.useCallback(e=>{nt(i=>{const o=new Set(i);for(const s of e)o.delete(s);return o})},[]),Ci=a.useCallback(e=>{nt(i=>{const o=new Set(i);return o.delete(e),o})},[]),W=c?ee.get(c)??I.data?.item??null:null,ge=a.useRef(null),Ni=a.useCallback(e=>{!M||!b||(ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{ge.current=null,Xt(M,e.id)},Sn))},[M,b]);a.useEffect(()=>()=>{ge.current&&clearTimeout(ge.current)},[]);const Le=I.data?.item.id===c;a.useEffect(()=>{if(!M||!b||!c||!Le)return;const e=h.findIndex(i=>i.id===c);if(!(e<0))for(const i of[h[e-1],h[e+1]])i&&Xt(M,i.id)},[M,b,c,Le,h]);const zt=a.useRef(!1);a.useLayoutEffect(()=>{performance.mark("lop:notifications:open")},[]),a.useLayoutEffect(()=>{zt.current||!k||(zt.current=!0,performance.mark("lop:notifications:list-paint"),performance.measure("lop:notifications:open-to-list",{start:"lop:notifications:open",end:"lop:notifications:list-paint",detail:{rows:k.items.length,fromCache:!m.isFetching}}),jt("open","list-paint"))},[k,m.isFetching]);const Pe=a.useRef(null);a.useLayoutEffect(()=>{if(!c){Pe.current=null;return}Pe.current={id:c,cached:I.data?.item.id===c},performance.mark("lop:notifications:detail:requested")},[c]),a.useLayoutEffect(()=>{const e=Pe.current;!e||!Le||e.id!==c||(Pe.current=null,performance.mark("lop:notifications:detail:painted"),performance.measure("lop:notifications:detail",{start:"lop:notifications:detail:requested",end:"lop:notifications:detail:painted",detail:e}),jt("detail:requested","detail:painted"))},[Le,c]);const st=a.useRef(null),at=a.useRef(null);a.useEffect(()=>{const e=I.data?.item;if(!c){st.current=null;return}e?.id!==c||st.current===e.id||C!=="unread"||!e.read||e.dismissed||ee.has(e.id)||(st.current=e.id,at.current=e.id,J(i=>new Map(i).set(e.id,e)))},[c,I.data,C,ee]),a.useEffect(()=>{const e=at.current;if(!e)return;const i=V.current?.querySelector(`[data-notification-row="${CSS.escape(e)}"]`);i&&(at.current=null,i.scrollIntoView?.({block:"nearest"}))},[h]),rn(c??null,W??void 0,P,e=>{oi(e.id),vi.mutate({verb:"read",target:{items:yt([e])}})}),a.useLayoutEffect(()=>{const e=Rt.current;!e||!ee.get(e)?.read||(Rt.current=null,performance.mark("lop:notifications:read:painted"),performance.measure("lop:notifications:read",{start:"lop:notifications:read:requested",end:"lop:notifications:read:painted",detail:{id:e}}),jt("read:requested","read:painted"))},[ee]);const $=a.useCallback(()=>{we.current+=1,ve(null),oe(new Set),be(null)},[]);a.useEffect(()=>{$(),K(null)},[E.kind,E.priority,E.from,C,$]);const te=a.useRef(null),ot=a.useCallback(async(e,i)=>{if(j.current)return;j.current=!0,q(!0),te.current=null;let o=null;try{const s=await Yt(Fe,e,i,void 0,re),l=Zt(s);e==="unread"&&J(f=>{const T=new Map(f);for(const y of s.changed)T.delete(y.id);return T}),cn(s,i.length)?Jt(n("ui.notifications.toast.undone")):Y(St(l)),o=s,ei(M,e,s.changed.map(f=>f.id))}finally{j.current=!1,q(!1),ai(o,re)}},[M,Fe]),ie=a.useCallback(async(e,i,o,s,l=!1)=>{if(j.current&&!l)return;j.current=!0,q(!0);let f=null;te.current=null;try{const T="items"in i?void 0:{scope:"sessionId"in i?{sessionId:i.sessionId}:{all:!0},throughSeq:i.throughSeq,tokens:o},y=await Yt(Fe,e,o,T,re),_=Zt(y);e==="read"?(J(H=>{const Ee=new Map(H);for(const xe of y.changed){const ft=ee.get(xe.id);ft?Ee.set(ft.id,{...ft,read:!0,read_via:"explicit"}):Qe.current.set(xe.id,xe.revision)}return Ee}),Tt(H=>H+1)):e==="unread"&&(J(H=>{const Ee=new Map(H);for(const xe of y.changed)Ee.delete(xe.id),Qe.current.delete(xe.id);return Ee}),Tt(H=>H+1));const A=y.changed.length?{verb:ln(e),items:y.changed,at:Date.now()}:null;te.current=A;const R=s({changed:y.changed.map(H=>H.id),skipped:y.skipped}),O=_.pending>0||_.skipped>0,Vt=ti(O);Y([R,O?St(_):null].filter(Boolean).join(". "),{duration:Vt,action:A?{label:n("ui.notifications.toast.undo"),onClick:()=>{te.current===A&&Date.now()-A.at<=Vt&&ot(A.verb,A.items)}}:void 0}),f=y,ei(M,e,y.changed.map(H=>H.id))}finally{j.current=!1,q(!1),f?.error&&Ft(new Set(o.map(T=>T.id))),ai(f,re)}},[M,ee,Ft,ot,Fe]),Oe=a.useCallback(e=>{if(e.length===0||P)return;const i=e.some(f=>!f.read),o=i?"read":"unread",s=e.filter(f=>i?!f.read:f.read),l=yt(s);o==="read"&&s[0]&&oi(s[0].id),ie(o,{items:l},l,f=>o==="read"?n("ui.notifications.toast.marked_read",{count:z(f.changed.length)}):n("ui.notifications.toast.marked_unread",{count:z(f.changed.length)}))},[ie,P]),Re=a.useCallback(e=>{if(P)return;const{dismissable:i,asksStaying:o}=ke(e);if(i.length===0){o>0&&Y(n("ui.notifications.ask.stays"));return}const s=yt(i),l=new Set(i.map(y=>y.id));Be(l);const f=h.findIndex(y=>l.has(y.id)),T=h.slice(f+1).find(y=>!l.has(y.id))??[...h.slice(0,f)].reverse().find(y=>!l.has(y.id));N(T?.id??null),c&&l.has(c)&&g("/notifications"),$(),ie("dismiss",{items:s},s,y=>{const _=y.skipped.filter(O=>O.reason==="live_ask").length,A=n("ui.notifications.toast.dismissed",{count:y.changed.length}),R=o+_;return R>0?`${A}. ${n("ui.notifications.select.asks_stay",{count:R})}`:A})},[Be,$,g,c,h,ie,P]),rt=a.useCallback(async(e,i)=>{if(!(!k||P||j.current)){j.current=!0,q(!0);try{const o=await ii(s=>Wt({op:"notifications.list",...s}),{scope:{sessionId:e},throughSeq:k.high_water,waiting:[],verb:"dismiss"});o.tokens.length&&je({sessionId:e,title:i,count:o.tokens.length,snapshot:o})}catch{Ae(n("ui.notifications.error.load.title"))}finally{j.current=!1,q(!1)}}},[k,P]),Ri=a.useCallback(()=>{if(!G)return;const{snapshot:e}=G;je(null),c&&e.tokens.some(i=>i.id===c)&&g("/notifications"),ie("dismiss",{...e.scope,throughSeq:e.throughSeq,observed:[...e.tokens]},[...e.tokens],i=>{const o=new Set(h.map(l=>l.id)),s=dn(o,i.changed);return s.size>0&&(Be(s),J(l=>{const f=new Map(l);for(const T of s)f.delete(T);return f})),n("ui.notifications.toast.dismissed",{count:i.changed.length})})},[G,g,c,ie,h,Be]),Di=a.useCallback(async()=>{if(!(!k||P||j.current)){j.current=!0,q(!0);try{const e=new Set((k.waiting??[]).filter(o=>!o.read).map(o=>o.id)),i=await ii(o=>Wt({op:"notifications.list",...o}),{scope:{all:!0},throughSeq:k.high_water,waiting:k.observed.filter(o=>e.has(o.id)),verb:"read"});await ie("read",{all:!0,throughSeq:i.throughSeq,observed:[...i.tokens]},[...i.tokens],o=>n("ui.notifications.toast.marked_read",{count:z(o.changed.length)}),!0)}catch{Ae(n("ui.notifications.error.load.title"))}finally{j.current=!1,q(!1)}}},[k,ie,P]),De=a.useCallback(e=>{N(e.id),g(un(e.id))},[g]),Bt=a.useCallback(()=>{const e=c;g("/notifications"),e&&N(e)},[g,c]),Lt=a.useCallback(e=>{Fi(g,e)},[g]),Pt=a.useCallback((e,i)=>{if(p){const o=new Map(p.excluded);if(i)for(const s of vt(h,L,e.id,new Set))o.delete(s);else if(o.has(e.id))o.delete(e.id);else if(Me(e,p)){if(o.size>=500){Y(n("ui.notifications.bulk.exclusion_limit"));return}o.set(e.id,e)}else{Y(n("ui.notifications.bulk.frozen_hint"));return}ve({...p,excluded:o})}else oe(o=>{if(i)return vt(h,L,e.id,o);const s=new Set(o);return s.has(e.id)?s.delete(e.id):s.add(e.id),s});be(e.id)},[L,h,p]),ct=a.useCallback(async e=>{if(!j.current){j.current=!0,q(!0),B.current=null;try{const i=[];for(const s of e)i.push(await ce.undo(s));const o={changed_count:i.reduce((s,l)=>s+l.changed_count,0),skipped_count:i.reduce((s,l)=>s+l.skipped_count,0)};o.skipped_count===0?Jt(n("ui.notifications.toast.undone")):Y(n("ui.notifications.bulk.partial",{changed:z(o.changed_count),skipped:z(o.skipped_count)}))}catch(i){Ae(mt(i,n("ui.notifications.error.load.title")))}finally{j.current=!1,q(!1)}}},[ce]),ne=a.useCallback(async(e,i)=>{if(j.current||he)return;if(!("items"in i)){const s=X(i);if((e==="dismiss"?s.eligible:s.readable)===0)return}j.current=!0,q(!0),te.current=null,B.current=null,Je.current=!!document.activeElement?.closest("[data-notifications-page]");const o=s=>"items"in i?i.items.some(l=>l.id===s.id):Me(s,i);try{const s="items"in i?await ce.applyItems(e,i.items,i.throughSeq,S,Ze()):{receipts:[await ce.apply(e,i,Ze())],pending:0,skippedAsks:0},l={changed_count:s.receipts.reduce((R,O)=>R+O.changed_count,0),skipped_count:s.receipts.reduce((R,O)=>R+O.skipped_count,0)};e==="dismiss"&&(J(R=>new Map([...R].filter(([,O])=>!o(O)))),W&&o(W)&&g("/notifications")),$();const f=l.changed_count>0?{tokens:s.receipts.filter(R=>R.changed_count>0).map(R=>R.operation_token),at:Date.now()}:null;B.current=f;const T=e==="dismiss"?n("ui.notifications.toast.dismissed",{count:l.changed_count}):e==="read"?n("ui.notifications.toast.marked_read",{count:z(l.changed_count)}):n("ui.notifications.toast.marked_unread",{count:z(l.changed_count)}),_=[s.pending>0?St({changed:l.changed_count,skipped:l.skipped_count,pending:s.pending}):l.skipped_count>0?n("ui.notifications.bulk.partial",{changed:z(l.changed_count),skipped:z(l.skipped_count)}):T,s.skippedAsks>0?n("ui.notifications.select.asks_stay",{count:s.skippedAsks}):null].filter(Boolean).join(". "),A=ti(s.pending>0||l.skipped_count>0||s.skippedAsks>0);Y(_,{duration:A,action:f?{label:n("ui.notifications.toast.undo"),onClick:()=>{B.current===f&&Date.now()-f.at<=A&&ct(f.tokens)}}:void 0})}catch(s){Ae(mt(s,n("ui.notifications.error.load.title")))}finally{j.current=!1,q(!1)}},[ce,S,Ze,$,he,W,g,ct]),Ue=a.useCallback(e=>{const i=X(e),o=h.filter(s=>!qe(s)&&Me(s,e)).length;i.eligible>o||i.asks>0?K({snapshot:e}):ne("dismiss",e)},[h,ne]),lt=a.useCallback(async(e=!1)=>{if(!D){Y(n("ui.notifications.bulk.update_required"));return}if(j.current||he||!k)return;j.current=!0,q(!0);const i=++we.current;let o=null;try{const s=await fn(E,C,[...new Set([...ce.activeSessionIds(),...h.map(f=>f.session.id),...it.map(([f])=>f)])].slice(0,50),S);if(i!==we.current)return;const l={preview:s,includeAskReads:S,filters:{...E},state:C,excluded:new Map,asks:[...Ne]};if(X(l).count===0)return;o=l,oe(new Set),ve(l)}catch(s){Ae(mt(s,n("ui.notifications.bulk.select_error")))}finally{j.current=!1,q(!1)}e&&o&&Ue(o)},[D,S,ce.activeSessionIds,E,C,Ne,k,he,Ue,h,it]),Ve=a.useMemo(()=>p?new Set(h.filter(e=>Me(e,p)).map(e=>e.id)):ye,[p,h,ye]),Ot=a.useCallback(e=>{De(e),Y(n("ui.notifications.ask.stays"))},[De]),Ut=x&&h.some(e=>e.id===x)?x:h[0]?.id??null,dt=a.useRef(null);a.useEffect(()=>{if(!x)return;const e=V.current?.querySelector(`[data-notification-row="${CSS.escape(x)}"]`);e&&V.current?.contains(document.activeElement)&&e.focus({preventScroll:dt.current!==x}),dt.current=null},[x]);const Ei=e=>{if(e.target.closest("input, textarea, [contenteditable='true']"))return;const o=h.findIndex(_=>_.id===Ut),s=o>=0?h[o]:void 0,l=_=>{const A=Math.max(0,Math.min(h.length-1,_)),R=h[A];R&&(e.shiftKey&&s&&!p&&oe(O=>vt(h,s.id,R.id,O)),dt.current=R.id,N(R.id))},f=e.metaKey||e.ctrlKey,T=h.filter(_=>Ve.has(_.id)),y=T.length>0?T:s?[s]:[];switch(e.key){case"ArrowDown":case"j":case"J":if(f)return;e.preventDefault(),l(o+1);return;case"ArrowUp":case"k":case"K":if(f)return;e.preventDefault(),l(o-1);return;case"Home":e.preventDefault(),l(0);return;case"End":e.preventDefault(),l(h.length-1);return;case"Enter":s&&(e.preventDefault(),De(s));return;case"o":case"O":s&&!f&&(e.preventDefault(),Lt(s.session.id));return;case"x":case"X":s&&!f&&(e.preventDefault(),Pt(s,!1));return;case"a":case"A":if(f){e.preventDefault(),lt();return}if(s){e.preventDefault();const _=h.find(A=>A.session.id===s.session.id&&qe(A));De(_??s)}return;case"e":case"E":if(f||!s)return;if(e.preventDefault(),e.shiftKey){rt(s.session.id,s.session.title||n("ui.notifications.group.untitled"));return}if(T.length===0&&qe(s)){Ot(s);return}p?Ue(p):ke(y).asksStaying>0?K({items:y,throughSeq:k?.high_water??0}):D&&T.length>0?ne("dismiss",{items:y,throughSeq:k?.high_water??0}):Re(y);return;case"u":case"U":if(f)return;e.preventDefault(),p?ne(X(p).unread>0?"read":"unread",p):Oe(y);return;case"z":case"Z":if(f&&B.current&&Date.now()-B.current.at<=ni){e.preventDefault(),ct(B.current.tokens);return}if(f&&te.current){e.preventDefault();const _=te.current;te.current=null,Date.now()-_.at<=ni&&_.items.length>0&&ot(_.verb,_.items)}return;case"Escape":if(Ve.size>0||p){e.preventDefault(),$();return}c&&(e.preventDefault(),Bt());return}};if(!b)return t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx($t,{title:n("ui.notifications.page.title"),icon:si}),d.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Ht,{label:n("ui.notifications.page.checking")})}):t.jsx(Kt,{variant:"warning",children:n("ui.notifications.page.unavailable")})]});const Q=h.filter(e=>Ve.has(e.id)),We=!!(c&&W),Ti=v&&We,ut=k&&h.length===0?Ke(E)?"filtered":C==="unread"?"caught_up":"none":null;return t.jsxs("div",{className:"flex h-full min-h-0 flex-col","data-notifications-page":"","data-glass-region":"canvas",children:[t.jsxs("div",{className:"flex shrink-0 flex-col gap-4 px-6 pt-6",children:[t.jsx($t,{title:n("ui.notifications.page.title"),icon:si,subtitle:n("ui.notifications.page.subtitle"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.newerCount>0&&t.jsxs(w,{size:"sm",variant:"secondary","data-notifications-back-to-top":"",onClick:()=>{Ie.current=null,V.current?.scrollTo({top:0}),Xe(!0),m.resetToTop()},children:[t.jsx(di,{"aria-hidden":"true"}),n("ui.notifications.new_pill",{count:z(m.newerCount)})]}),t.jsx(w,{variant:"ghost",size:"icon","aria-label":n("ui.notifications.page.refresh"),title:n("ui.notifications.page.refresh"),"aria-busy":m.isFetching||void 0,disabled:m.isFetching,onClick:()=>{J(new Map),Et(new Map),m.refresh()},children:t.jsx(vn,{})})]})}),t.jsx(Rn,{loaded:k,bulkEnabled:D,readState:C,onReadState:e=>{se(e),J(new Map),Dt(_t,e)},filters:E,setFilters:fe,grouping:de,setGrouping:ae,sources:it,writesPaused:P,markAllRead:Di,selectionCount:p?X(p).count:Q.length,asksCount:p?X(p).asks:ke(Q).asksStaying,allChecked:p?p.excluded.size===0?!0:"indeterminate":Q.length>0?"indeterminate":!1,frozen:!!p,newItemsOutsideSelection:!!(p&&h.some(e=>qe(e)?!p.asks.some(i=>i.id===e.id):e.seq>p.preview.through_seq)),readIncludesAsks:!!(p&&pn(p)),onDismissAll:()=>void lt(!0),nothingToDismiss:ut!==null,visibleUnread:bi,onSelectAll:()=>p&&p.excluded.size===0?$():void lt(),onReviewAsks:()=>{$(),fe(e=>({...e,kind:"asks"}))},onClearSelection:$,onBulkRead:e=>p?void ne(e,p):Oe(e==="read"?Q.filter(i=>!i.read):Q.filter(i=>i.read)),onBulkDismiss:()=>{p?Ue(p):ke(Q).asksStaying>0?K({items:Q,throughSeq:k?.high_water??0}):D&&Q.length>0?ne("dismiss",{items:Q,throughSeq:k?.high_water??0}):Re(Q)}})]}),he&&t.jsx("div",{className:"px-6 pt-3",children:t.jsxs(Kt,{variant:"danger",role:"alert","data-notifications-refresh-error":"",children:[t.jsx("span",{className:"font-medium",children:n("ui.notifications.error.refresh.title")})," ",n("ui.notifications.error.refresh.body",{time:At?zi(At,{hour:"2-digit",minute:"2-digit"}):""})]})}),t.jsxs("div",{className:"mt-3 flex min-h-0 flex-1",children:[!Ti&&t.jsx("div",{className:le("flex min-h-0 flex-col",We||!v?"w-[min(560px,46%)] shrink-0":"flex-1",v&&"w-full"),children:m.isError&&!k?t.jsxs("div",{className:"flex flex-col items-start gap-3 px-6 py-6",role:"alert",children:[t.jsx("p",{className:"text-body text-ink",children:n("ui.notifications.error.load.title")}),t.jsx(w,{variant:"secondary",onClick:()=>void m.refetch(),children:n("ui.notifications.error.retry")})]}):!k||ji?t.jsx(En,{}):ut?t.jsx(Cn,{kind:ut,onShowAll:()=>{se("all"),Dt(_t,"all")},onClearFilters:()=>fe(Nt)}):t.jsx("div",{ref:V,role:"grid","aria-multiselectable":"true","aria-label":n("ui.notifications.page.list_label"),onKeyDown:Ei,onScroll:e=>{const i=e.currentTarget;Ye(),Xe(i.scrollTop<=24),m.hasNextPage&&!m.isFetchingNextPage&&i.scrollHeight-i.scrollTop-i.clientHeight<160&&m.fetchNextPage()},className:"flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 [overflow-anchor:none] [scrollbar-gutter:stable]","data-notifications-list":"",children:ze.map(e=>t.jsx(_n,{group:e,nowMs:U,openId:c??null,selected:Ve,selecting:p?X(p).count>0:ye.size>0,focusedId:Ut,writesPaused:P,exitingIds:_i,onExitFinished:Ci,onOpen:De,onToggleSelect:Pt,onToggleRead:i=>Oe([i]),onDismiss:i=>Re([i]),onAnswer:Ot,onFocusRow:i=>N(i.id),onPrefetch:Ni,onDismissSession:rt,sessionCount:i=>It?.[i]??null},e.key))})}),!v||We?t.jsx("div",{"data-glass-region":"panel",className:le("flex min-h-0 min-w-0 flex-1 flex-col rounded-md bg-surface",v?"mx-6 mb-6 w-auto":"me-6 mb-6"),children:We&&W?t.jsx(mn,{item:W,detail:Mt?void 0:I.data,loading:I.isLoading||Mt,error:I.isError,nowMs:U,narrow:v,writesPaused:P,sessionDismissCount:It?.[W.session.id]??null,onClose:Bt,onOpenConversation:Lt,onToggleRead:e=>Oe([e]),onDismiss:e=>Re([e]),onDismissSession:rt,onCopyLink:hn,onOpenProject:e=>g(`/projects/${encodeURIComponent(e)}`),onAsksSettled:(e,i)=>{const o=`ask:${W.session.id}:${e}`,s=ee.get(o)??(I.data?.item.id===o?I.data.item:void 0);s?.source==="ask"&&s.ask&&Et(l=>new Map(l).set(o,{...s,read:!0,ask:{...s.ask,status:i}})),gn(M,W.id)}},W.id):t.jsx(Dn,{})}):null]}),Z&&!Se&&t.jsx(Ht,{label:n("ui.notifications.page.loading")}),Se&&t.jsx(bn,{progress:Se}),F&&t.jsx(Tn,{count:"snapshot"in F?X(F.snapshot).eligible:ke(F.items).dismissable.length,asks:"snapshot"in F?X(F.snapshot).asks:ke(F.items).asksStaying,beyondPage:"snapshot"in F&&X(F.snapshot).eligible>h.filter(e=>!qe(e)&&Me(e,F.snapshot)).length,onCancel:()=>K(null),onConfirm:()=>{const e=F;K(null),"snapshot"in e?ne("dismiss",e.snapshot):D?ne("dismiss",e):Re(e.items)},onReviewAsks:()=>{K(null),$(),fe(e=>({...e,kind:"asks"}))}}),G&&t.jsx(Nn,{title:G.title,count:G.count,onConfirm:Ri,onCancel:()=>je(null)})]})},ci=r=>{switch(r.kind){case"waiting":return n("ui.notifications.group.waiting");case"conversation":return r.title||n("ui.notifications.group.untitled");case"time":return r.key==="today"?n("ui.notifications.group.today"):r.key==="yesterday"?n("ui.notifications.group.yesterday"):r.key==="week"?n("ui.notifications.group.week"):n("ui.notifications.group.older")}},_n=({group:r,onDismissSession:c,sessionCount:g,...d})=>{const[u,b]=a.useState(r.kind==="time"&&r.key==="older"),D=r.kind==="conversation"?g(r.sessionId):0;return t.jsxs("div",{role:"rowgroup","data-notification-group":r.key,children:[t.jsxs("div",{role:"row",tabIndex:-1,"data-glass-plane":"band-backdrop",className:"sticky top-0 z-[1] flex h-8 items-center gap-2 bg-canvas px-3 text-ink-muted text-meta",children:[t.jsx("span",{role:"rowheader",className:"flex min-w-0 items-center gap-1.5",children:r.kind==="time"&&r.key==="older"?t.jsxs("button",{type:"button",className:"inline-flex min-h-6 items-center gap-1 hover:text-ink","aria-expanded":!u,onClick:()=>b(S=>!S),children:[ci(r),t.jsx("span",{className:"text-ink-dim tabular-nums",children:r.items.length}),u?t.jsx(He,{size:12}):t.jsx(di,{size:12})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate",children:ci(r)}),t.jsx("span",{className:"text-ink-dim tabular-nums",children:r.items.length})]})}),r.kind==="conversation"&&D!==null&&D>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:"h-px flex-1 bg-hairline"}),t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>c(r.sessionId,r.title),children:n("ui.notifications.group.dismiss_session",{count:z(D)})})]})]}),!u&&r.items.map(S=>t.jsx(wn,{exiting:d.exitingIds.has(S.id),onExited:()=>d.onExitFinished(S.id),children:t.jsx(xn,{item:S,nowMs:d.nowMs,open:d.openId===S.id,picked:d.selected.has(S.id),selecting:d.selecting,focused:d.focusedId===S.id,writesPaused:d.writesPaused,onOpen:d.onOpen,onToggleSelect:d.onToggleSelect,onToggleRead:d.onToggleRead,onDismiss:d.onDismiss,onAnswer:d.onAnswer,onFocusRow:d.onFocusRow,onPrefetch:d.onPrefetch})},S.id))]})},Cn=({kind:r,onShowAll:c,onClearFilters:g})=>t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 py-16 text-center","data-notifications-empty":r,children:[r==="caught_up"&&t.jsx(hi,{size:24,"aria-hidden":"true",className:"text-ink-muted"}),t.jsx("p",{className:"text-heading text-ink",children:r==="caught_up"?n("ui.notifications.empty.caught_up.title"):r==="none"?n("ui.notifications.empty.none.title"):n("ui.notifications.empty.filtered.title")}),r!=="filtered"&&t.jsx("p",{className:"max-w-96 text-body-sm text-ink-muted",children:r==="caught_up"?n("ui.notifications.empty.caught_up.body"):n("ui.notifications.empty.none.body")}),r==="caught_up"&&t.jsx(w,{variant:"secondary",onClick:c,children:n("ui.notifications.empty.caught_up.show_all")}),r==="filtered"&&t.jsx(w,{variant:"secondary",onClick:g,children:n("ui.notifications.filter.clear")})]}),Nn=({title:r,count:c,onConfirm:g,onCancel:d})=>t.jsx(ui,{open:!0,onOpenChange:u=>!u&&d(),children:t.jsxs(fi,{className:"max-w-sm",children:[t.jsx(pi,{children:n("ui.notifications.confirm.dismiss_session",{count:c,source:r})}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx(w,{variant:"tonal",onClick:d,children:n("ui.notifications.confirm.cancel")}),t.jsx(w,{variant:"danger",autoFocus:!0,onClick:g,"data-notifications-confirm":"",children:n("ui.notifications.confirm.dismiss_session_ok")})]})]})}),Rn=({loaded:r,bulkEnabled:c,readState:g,onReadState:d,filters:u,setFilters:b,grouping:D,setGrouping:S,sources:U,writesPaused:v,markAllRead:M,selectionCount:C,asksCount:se,allChecked:de,frozen:ae,readIncludesAsks:ue,newItemsOutsideSelection:E,onDismissAll:fe,nothingToDismiss:ye,visibleUnread:oe,onSelectAll:p,onClearSelection:ve,onReviewAsks:F,onBulkRead:K,onBulkDismiss:we})=>{const B=se,L=C-se,be=C>0;return t.jsxs("div",{className:"flex min-h-11 shrink-0 flex-wrap items-center gap-2 border-hairline border-b py-2","data-notifications-toolbar":be?"selection":"filters",children:[t.jsx("span",{className:"inline-flex size-6 shrink-0 items-center justify-center pointer-coarse:size-11",children:t.jsx(Pi,{hitArea:"comfortable",checked:de,"aria-label":n("ui.notifications.select.all"),disabled:!c||!r||v,title:c?void 0:n("ui.notifications.bulk.update_required"),onCheckedChange:p,"data-notifications-select-all":""})}),be?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium text-body-sm text-ink",title:ae?n("ui.notifications.bulk.frozen_hint"):void 0,children:n("ui.notifications.select.count",{count:z(C)})}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:ae&&(ue?C:L)===0,"aria-disabled":v||void 0,title:n("ui.notifications.bulk.read_hint"),"data-notifications-bulk-read":"read",onClick:()=>!v&&K("read"),children:[t.jsx(Oi,{}),ae&&!ue?n("ui.notifications.bulk_updates.read",{count:L}):n("ui.notifications.select.mark_read")]}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:ae&&(ue?C:L)===0,"aria-disabled":v||void 0,"data-notifications-bulk-read":"unread",onClick:()=>!v&&K("unread"),children:[t.jsx(Ui,{}),ae&&!ue?n("ui.notifications.bulk_updates.unread",{count:L}):n("ui.notifications.select.mark_unread")]}),t.jsxs(w,{variant:"secondary",size:"sm","aria-disabled":v||L===0||void 0,onClick:()=>!v&&L>0&&we(),title:n("ui.notifications.bulk.dismiss_hint"),"data-notifications-bulk-dismiss":L,children:[t.jsx(Gt,{}),n("ui.notifications.select.dismiss",{count:z(L)})]}),B>0&&t.jsx("span",{className:"text-ink-dim text-meta",role:"status","data-notifications-asks-stay":B,children:n("ui.notifications.select.asks_stay",{count:B})}),B>0&&t.jsx(w,{variant:"ghost",size:"sm",onClick:F,children:n("ui.notifications.bulk.review_asks")}),t.jsx("span",{className:"flex-1"}),t.jsxs(w,{variant:"ghost",size:"sm",onClick:ve,children:[n("ui.notifications.select.clear"),t.jsx("kbd",{className:"ms-1 text-ink-dim text-meta",children:"Esc"})]}),E&&t.jsxs("p",{className:"basis-full text-meta text-ink-muted","data-notifications-new-outside-selection":"",children:[n("ui.notifications.bulk_updates.new_items")," ",n("ui.notifications.ask.stays")]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{role:"radiogroup","aria-label":n("ui.notifications.filter.read_state"),"data-glass-well":"",className:"flex items-center gap-0.5 rounded-sm bg-sunken p-0.5",children:["unread","all"].map(x=>t.jsxs("button",{type:"button",role:"radio","aria-checked":g===x,onClick:()=>d(x),className:le("flex h-7 items-center gap-1.5 rounded-xs px-2.5 text-body-sm",g===x?"bg-elevated text-ink":"text-ink-muted hover:text-ink"),children:[x==="unread"?n("ui.notifications.filter.unread"):n("ui.notifications.filter.all"),x==="unread"&&oe>0&&t.jsx(Vi,{variant:"neutral",size:"count",children:Wi(oe,99)})]},x))}),[{label:n("ui.notifications.filter.kind"),value:u.kind,options:["all","asks","updates"],isDefault:u.kind==="all",set:x=>b(N=>({...N,kind:x})),optionLabel:x=>x==="asks"?n("ui.notifications.filter.kind_asks"):x==="updates"?n("ui.notifications.filter.kind_updates"):n("ui.notifications.filter.kind_all")},{label:n("ui.notifications.filter.priority"),value:u.priority,options:["any","high","normal_up"],isDefault:u.priority==="any",set:x=>b(N=>({...N,priority:x})),optionLabel:x=>x==="high"?n("ui.notifications.filter.priority_high"):x==="normal_up"?n("ui.notifications.filter.priority_normal_up"):n("ui.notifications.filter.priority_any")}].map(({label:x,value:N,options:G,isDefault:je,set:Se,optionLabel:re})=>t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r,children:[t.jsx(Ct,{label:x,value:re(N),emphasised:!je}),t.jsx(He,{})]})}),t.jsx(xt,{align:"start",children:t.jsx(kt,{value:N,onValueChange:Se,children:G.map(Z=>t.jsx(Te,{value:Z,children:re(Z)},Z))})})]},x)),U.length>0&&t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r,children:[t.jsx(Ct,{label:n("ui.notifications.filter.from"),value:u.from===null?n("ui.notifications.filter.from_all"):U.find(([x])=>x===u.from)?.[1]??n("ui.notifications.group.untitled"),emphasised:u.from!==null}),t.jsx(He,{})]})}),t.jsx(xt,{align:"start",children:t.jsxs(kt,{value:u.from??"",onValueChange:x=>b(N=>({...N,from:x||null})),children:[t.jsx(Te,{value:"",children:n("ui.notifications.filter.from_all")}),U.map(([x,N,G])=>t.jsxs(Te,{value:x,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:N}),t.jsx("span",{className:"ms-3 text-ink-dim text-meta tabular-nums",children:G})]},x))]})})]}),Ke(u)&&t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>b(()=>Nt),children:n("ui.notifications.filter.clear")}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:!c||!r||v||ye,onClick:fe,title:n(c?"ui.notifications.bulk.dismiss_hint":"ui.notifications.bulk.update_required"),"data-notifications-dismiss-all":"",children:[t.jsx(Gt,{}),n("ui.notifications.bulk.dismiss_all")]}),t.jsx("span",{className:"flex-1"}),t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",children:[t.jsx(Ct,{label:n("ui.notifications.filter.group"),value:D==="time"?n("ui.notifications.filter.group_time"):n("ui.notifications.filter.group_conversation"),emphasised:D!=="time"}),t.jsx(He,{})]})}),t.jsx(xt,{align:"end",children:t.jsxs(kt,{value:D,onValueChange:x=>{const N=x==="conversation"?"conversation":"time";S(N),Dt(gi,N)},children:[t.jsx(Te,{value:"time",children:n("ui.notifications.filter.group_time")}),t.jsx(Te,{value:"conversation",children:n("ui.notifications.filter.group_conversation")})]})})]}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r||(r?.unread_count??0)+(r?.waiting_unread_count??0)===0,"aria-disabled":v||void 0,title:v?n("ui.notifications.writes_paused_tip"):void 0,onClick:()=>{!r||v||r.unread_count+r.waiting_unread_count===0||M()},"data-notifications-mark-all":"",children:[t.jsx(hi,{}),n("ui.notifications.action.mark_all_read")]})]})]})},Ct=({label:r,value:c,emphasised:g})=>{const d=n("ui.notifications.filter.chip",{label:r,value:c}),u=d.lastIndexOf(c);return u<0?t.jsx("span",{children:d}):t.jsxs("span",{children:[d.slice(0,u),t.jsx("span",{className:le(g&&"font-semibold"),children:c}),d.slice(u+c.length)]})},Dn=()=>t.jsx("div",{className:"flex h-full items-center justify-center p-6 text-center text-ink-dim text-body-sm",children:n("ui.notifications.detail.empty")}),En=()=>t.jsx("div",{role:"status","aria-label":n("ui.notifications.page.loading"),className:"flex flex-col",children:Array.from({length:7},(r,c)=>t.jsxs("div",{className:"flex h-14 items-center gap-3 px-3","data-notification-skeleton":"",children:[t.jsx($e,{className:"size-1.5 rounded-full bg-elevated"}),t.jsx($e,{className:"size-4 bg-elevated"}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[t.jsx($e,{className:le("h-3 bg-elevated",c%2?"w-2/3":"w-1/2")}),t.jsx($e,{className:le("h-2.5 bg-elevated",c%3?"w-1/3":"w-2/5")})]})]},c))}),Tn=({count:r,asks:c,beyondPage:g,onConfirm:d,onCancel:u,onReviewAsks:b})=>t.jsx(ui,{open:!0,onOpenChange:D=>!D&&u(),children:t.jsxs(fi,{className:"max-w-md",children:[t.jsx(pi,{children:n("ui.notifications.bulk.confirm_title",{count:r})}),g&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.notifications.bulk.beyond_page")}),c>0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.notifications.bulk.asks_hint")}),t.jsxs("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[c>0&&t.jsx(w,{variant:"ghost",onClick:b,children:n("ui.notifications.bulk.review_asks")}),t.jsx(w,{variant:"tonal",onClick:u,children:n("ui.notifications.confirm.cancel")}),t.jsx(w,{variant:"danger",disabled:r===0,onClick:d,"data-notifications-confirm-view":"",children:n("ui.notifications.confirm.dismiss_session_ok")})]})]})});export{On as NotificationsPage,ni as UNDO_WINDOW_MS,ti as receiptDuration};
1
+ import{r as a,j as t,c as le}from"./index-D0qlrLIs.js";import{e as Ai,f as Mi,a as qi,g as pt,h as Ii,i as z,j as Wt,o as Fi,k as mt,l as zi,m as Bi,r as Li}from"./appearance-DO4VPBSi.js";import{P as $t}from"./page-header-DXwYxMB-.js";import{u as li,S as Ht,A as Kt,B as w,C as di,a as Pi,b as Oi,d as Ui,X as Gt,e as Vi,f as Wi,D as ht,g as gt,h as He,i as xt,j as kt,k as Te,l as $e,m as ui,n as fi,o as pi}from"./error-boundary-BsWceBKP.js";import{P as mi,Q as $i,R as Nt,S as Hi,T as Ki,U as Gi,V as Qi,W as Xi,X as Yi,Y as Zi,Z as Ji,_ as en,$ as Qt,a0 as tn,a1 as nn,a2 as Ke,a3 as sn,a4 as an,a5 as on,a6 as Xt,a7 as rn,a8 as yt,a9 as Yt,aa as Zt,ab as cn,ac as Jt,ad as Y,ae as ei,af as ln,ag as ti,ah as ke,ai as ii,aj as Ae,ak as dn,al as un,am as vt,an as Me,ao as X,ap as qe,aq as fn,ar as pn,as as mn,at as hn,au as gn,av as ni,aw as xn,ax as kn,ay as yn}from"./conversation-input-sync-FnnZiNnd.js";import{t as n}from"./messages-BYDbMAVA.js";import{a as si,R as vn,C as hi}from"./index-BKh47kLl.js";import"./roles-D1pcbxAx.js";import"./console-mirror-Bp3thuUi.js";const wt=120,bt=180,wn=({exiting:r,children:c,onExited:g})=>{const d=mi("(prefers-reduced-motion: reduce)"),[u,b]=a.useState("idle"),[D,S]=a.useState(null),U=a.useRef(null),v=a.useRef(!1);a.useLayoutEffect(()=>{if(r&&!v.current){if(v.current=!0,d){g();return}S(U.current?.getBoundingClientRect().height??56),b("leaving")}else!r&&v.current&&(v.current=!1,b("idle"),S(null))},[r,d,g]),a.useEffect(()=>{if(!r||d||u==="idle")return;if(u==="leaving"){const se=setTimeout(()=>b("collapsing"),wt);return()=>clearTimeout(se)}const C=setTimeout(g,bt);return()=>clearTimeout(C)},[r,u,d,g]);const M={height:u==="collapsing"?0:D??void 0,overflow:u==="idle"?void 0:"hidden",transition:u==="idle"||d?void 0:u==="leaving"?`opacity ${wt}ms var(--ease-out-quart), transform ${wt}ms var(--ease-out-quart)`:`height ${bt}ms var(--ease-out-quart), opacity ${bt}ms var(--ease-out-quart)`,opacity:u==="idle"?void 0:0,transform:u==="leaving"?"translateY(-8px)":void 0,pointerEvents:u==="idle"?void 0:"none"};return t.jsx("div",{ref:U,style:M,className:le("shrink-0",u!=="idle"&&"motion-reduce:hidden"),"aria-hidden":u!=="idle"||void 0,...u!=="idle"?{inert:""}:{},"data-notification-exit":u==="idle"?void 0:u,children:c})},bn=({progress:r})=>(li(),t.jsx("output",{className:"shrink-0 px-6 py-1 text-meta text-ink-muted","data-notification-operation":"",children:n("ui.notifications.operation.progress",r)})),ai=(r,c)=>{r&&(r.pending.length>0||r.error!==void 0)||c(null)},jn=(r,c,g)=>{const d=a.useRef(r);d.current=r;const u=Bi({queryKey:["desktop","notifications","session-scope-counts",g],enabled:c&&r!==void 0,queryFn:()=>kn(yn(d.current)),retry:Li,staleTime:5e3,refetchOnWindowFocus:!1});return{counts:u.data,pending:r===void 0||u.data===void 0}},Sn=75,oi=r=>{Rt.current=r,performance.mark("lop:notifications:read:requested")},jt=(...r)=>{for(const c of r)performance.clearMarks(`lop:notifications:${c}`)},Rt={current:null},St=r=>n("ui.notifications.operation.progress",r),_t="notifications-read-state",gi="notifications-grouping",ri=(r,c,g)=>{try{const d=localStorage.getItem(r);return c.includes(d)?d:g}catch{return g}},Dt=(r,c)=>{try{localStorage.setItem(r,c)}catch{}},On=({nowMs:r})=>{li();const{notificationId:c}=Ai(),g=Mi(),d=qi(),b=pt(d.data,"notifications",1)==="enabled",D=pt(d.data,"notification_bulk_selection",1)==="enabled",S=pt(d.data,"notification_bulk_ask_read",1)==="enabled",U=r??Date.now(),v=!mi("(min-width: 1100px)"),{client:M}=Ii(),[C,se]=a.useState(()=>ri(_t,["unread","all"],"unread")),[de,ae]=a.useState(()=>ri(gi,["time","conversation"],"time")),[ue]=$i(),[E,fe]=a.useState(()=>({...Nt,from:ue.get("from")||null})),[ye,oe]=a.useState(()=>new Set),[p,ve]=a.useState(null),[F,K]=a.useState(null),we=a.useRef(0),B=a.useRef(null),[L,be]=a.useState(null),[x,N]=a.useState(null),[G,je]=a.useState(null),[Se,re]=a.useState(null),[Z,q]=a.useState(!1),j=a.useRef(!1),[_e,Et]=a.useState(()=>new Map),[Ge,J]=a.useState(()=>new Map),Qe=a.useRef(new Map),[xi,Tt]=a.useState(0),[At,ki]=a.useState(null),[yi,Xe]=a.useState(!0),V=a.useRef(null),Ie=a.useRef(null),Ye=a.useCallback(()=>{const e=V.current;if(!e)return;const i=e.getBoundingClientRect();Ie.current={port:e,scrollTop:e.scrollTop,rows:[...e.querySelectorAll("[data-notification-row]")].flatMap(o=>{const s=o.getBoundingClientRect();return s.bottom>i.top&&s.top<i.bottom?[{id:o.dataset.notificationRow,offset:s.top-i.top}]:[]})}},[]),Ze=a.useCallback(()=>{const e=V.current;if(!e)return[];const i=e.getBoundingClientRect();return[...e.querySelectorAll("[data-notification-row]")].filter(o=>{const s=o.getBoundingClientRect();return i.height===0||s.bottom>=i.top&&s.top<=i.bottom}).map(o=>o.dataset.notificationRow).slice(0,500)},[]),Je=a.useRef(!1);a.useEffect(()=>{!Z&&Je.current&&(Je.current=!1,document.querySelector("[data-notifications-select-all]")?.focus())},[Z]);const m=Hi(C,b,{atTop:yi}),ce=Ki(()=>{m.resetToTop()}),vi=Gi(),Ce=Qi(),Fe=a.useCallback((e,i)=>"items"in i?(e==="read"?Ce.markRead:e==="unread"?Ce.markUnread:e==="dismiss"?Ce.dismiss:Ce.restore)(i.items):Xi(e,i),[Ce]),{query:I,behindLoading:Mt}=Yi(c??null,b,c?m.data?.items.find(e=>e.id===c)?.revision:void 0),et=Zi(m.data),wi=Ji(I.data?.item.session.id??null,b&&!!I.data?.item.session.id&&et===void 0);a.useEffect(()=>{m.isSuccess&&!m.isFetching&&ki(m.dataUpdatedAt)},[m.isSuccess,m.isFetching,m.dataUpdatedAt]);const qt=a.useRef(0);a.useEffect(()=>{!m.windowResetAt||m.windowResetAt===qt.current||(qt.current=m.windowResetAt,Ie.current=null,V.current&&(V.current.scrollTop=0),Xe(!0))},[m.windowResetAt]);const k=m.data,pe=a.useMemo(()=>{const e=en(k?.items??[],Qe.current),i=[..._e.values()],o=[...e.filter(l=>!_e.has(l.id)),...i];if(C!=="unread"||Ge.size===0)return o;const s=new Set(o.map(l=>l.id));return[...o,...[...Ge.values()].filter(l=>!s.has(l.id))]},[k,C,Ge,xi,_e]),me=a.useMemo(()=>(k?.reelWaiting??k?.waiting??[]).filter(e=>!_e.has(e.id)),[k,_e]),tt=a.useMemo(()=>Qt(pe,E),[pe,E]),Ne=a.useMemo(()=>Qt(me,E),[me,E]),bi=tt.filter(e=>!e.read).length+Ne.filter(e=>!e.read).length,ze=a.useMemo(()=>tn(tt,Ne,de,U),[tt,Ne,de,U]),h=a.useMemo(()=>nn(ze),[ze]);a.useLayoutEffect(()=>{const e=V.current,i=Ie.current;if(e&&i?.port===e&&i.scrollTop>0)for(const o of i.rows){const s=e.querySelector(`[data-notification-row="${CSS.escape(o.id)}"]`);if(s){e.scrollTop+=s.getBoundingClientRect().top-e.getBoundingClientRect().top-o.offset;break}}Ye()},[ze,Ye]);const ji=Ke(E)&&h.length===0&&!!m.hasNextPage;a.useEffect(()=>{if(!Ke(E)||!m.hasNextPage||m.isFetchingNextPage||m.isError)return;const e=V.current;(h.length===0||e&&e.clientHeight>0&&e.scrollHeight<=e.clientHeight+160)&&m.fetchNextPage()},[E,h.length,m.hasNextPage,m.isFetchingNextPage,m.isError,m.fetchNextPage]);const ee=a.useMemo(()=>{const e=new Map;for(const i of[...me,...pe])e.set(i.id,i);return e},[pe,me]),it=a.useMemo(()=>{const e=new Map;for(const i of[...me,...pe]){const o=e.get(i.session.id)??[i.session.id,i.session.title||n("ui.notifications.group.untitled"),0];o[2]+=1,e.set(i.session.id,o)}return[...e.values()].sort((i,o)=>o[2]-i[2])},[pe,me]),he=m.isRefreshError&&!!k,Si=jn(k?.high_water,!!k&&et===void 0&&on(de,!!c),[sn(k?.items??[],I.data?.item.session.id??""),an(I.data?.item.session.id?wi.data:void 0)].join("|")),It=et??Si.counts,P=he||Z,[_i,nt]=a.useState(()=>new Set),Be=a.useCallback(e=>{nt(i=>new Set([...i,...e]))},[]),Ft=a.useCallback(e=>{nt(i=>{const o=new Set(i);for(const s of e)o.delete(s);return o})},[]),Ci=a.useCallback(e=>{nt(i=>{const o=new Set(i);return o.delete(e),o})},[]),W=c?ee.get(c)??I.data?.item??null:null,ge=a.useRef(null),Ni=a.useCallback(e=>{!M||!b||(ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{ge.current=null,Xt(M,e.id)},Sn))},[M,b]);a.useEffect(()=>()=>{ge.current&&clearTimeout(ge.current)},[]);const Le=I.data?.item.id===c;a.useEffect(()=>{if(!M||!b||!c||!Le)return;const e=h.findIndex(i=>i.id===c);if(!(e<0))for(const i of[h[e-1],h[e+1]])i&&Xt(M,i.id)},[M,b,c,Le,h]);const zt=a.useRef(!1);a.useLayoutEffect(()=>{performance.mark("lop:notifications:open")},[]),a.useLayoutEffect(()=>{zt.current||!k||(zt.current=!0,performance.mark("lop:notifications:list-paint"),performance.measure("lop:notifications:open-to-list",{start:"lop:notifications:open",end:"lop:notifications:list-paint",detail:{rows:k.items.length,fromCache:!m.isFetching}}),jt("open","list-paint"))},[k,m.isFetching]);const Pe=a.useRef(null);a.useLayoutEffect(()=>{if(!c){Pe.current=null;return}Pe.current={id:c,cached:I.data?.item.id===c},performance.mark("lop:notifications:detail:requested")},[c]),a.useLayoutEffect(()=>{const e=Pe.current;!e||!Le||e.id!==c||(Pe.current=null,performance.mark("lop:notifications:detail:painted"),performance.measure("lop:notifications:detail",{start:"lop:notifications:detail:requested",end:"lop:notifications:detail:painted",detail:e}),jt("detail:requested","detail:painted"))},[Le,c]);const st=a.useRef(null),at=a.useRef(null);a.useEffect(()=>{const e=I.data?.item;if(!c){st.current=null;return}e?.id!==c||st.current===e.id||C!=="unread"||!e.read||e.dismissed||ee.has(e.id)||(st.current=e.id,at.current=e.id,J(i=>new Map(i).set(e.id,e)))},[c,I.data,C,ee]),a.useEffect(()=>{const e=at.current;if(!e)return;const i=V.current?.querySelector(`[data-notification-row="${CSS.escape(e)}"]`);i&&(at.current=null,i.scrollIntoView?.({block:"nearest"}))},[h]),rn(c??null,W??void 0,P,e=>{oi(e.id),vi.mutate({verb:"read",target:{items:yt([e])}})}),a.useLayoutEffect(()=>{const e=Rt.current;!e||!ee.get(e)?.read||(Rt.current=null,performance.mark("lop:notifications:read:painted"),performance.measure("lop:notifications:read",{start:"lop:notifications:read:requested",end:"lop:notifications:read:painted",detail:{id:e}}),jt("read:requested","read:painted"))},[ee]);const $=a.useCallback(()=>{we.current+=1,ve(null),oe(new Set),be(null)},[]);a.useEffect(()=>{$(),K(null)},[E.kind,E.priority,E.from,C,$]);const te=a.useRef(null),ot=a.useCallback(async(e,i)=>{if(j.current)return;j.current=!0,q(!0),te.current=null;let o=null;try{const s=await Yt(Fe,e,i,void 0,re),l=Zt(s);e==="unread"&&J(f=>{const T=new Map(f);for(const y of s.changed)T.delete(y.id);return T}),cn(s,i.length)?Jt(n("ui.notifications.toast.undone")):Y(St(l)),o=s,ei(M,e,s.changed.map(f=>f.id))}finally{j.current=!1,q(!1),ai(o,re)}},[M,Fe]),ie=a.useCallback(async(e,i,o,s,l=!1)=>{if(j.current&&!l)return;j.current=!0,q(!0);let f=null;te.current=null;try{const T="items"in i?void 0:{scope:"sessionId"in i?{sessionId:i.sessionId}:{all:!0},throughSeq:i.throughSeq,tokens:o},y=await Yt(Fe,e,o,T,re),_=Zt(y);e==="read"?(J(H=>{const Ee=new Map(H);for(const xe of y.changed){const ft=ee.get(xe.id);ft?Ee.set(ft.id,{...ft,read:!0,read_via:"explicit"}):Qe.current.set(xe.id,xe.revision)}return Ee}),Tt(H=>H+1)):e==="unread"&&(J(H=>{const Ee=new Map(H);for(const xe of y.changed)Ee.delete(xe.id),Qe.current.delete(xe.id);return Ee}),Tt(H=>H+1));const A=y.changed.length?{verb:ln(e),items:y.changed,at:Date.now()}:null;te.current=A;const R=s({changed:y.changed.map(H=>H.id),skipped:y.skipped}),O=_.pending>0||_.skipped>0,Vt=ti(O);Y([R,O?St(_):null].filter(Boolean).join(". "),{duration:Vt,action:A?{label:n("ui.notifications.toast.undo"),onClick:()=>{te.current===A&&Date.now()-A.at<=Vt&&ot(A.verb,A.items)}}:void 0}),f=y,ei(M,e,y.changed.map(H=>H.id))}finally{j.current=!1,q(!1),f?.error&&Ft(new Set(o.map(T=>T.id))),ai(f,re)}},[M,ee,Ft,ot,Fe]),Oe=a.useCallback(e=>{if(e.length===0||P)return;const i=e.some(f=>!f.read),o=i?"read":"unread",s=e.filter(f=>i?!f.read:f.read),l=yt(s);o==="read"&&s[0]&&oi(s[0].id),ie(o,{items:l},l,f=>o==="read"?n("ui.notifications.toast.marked_read",{count:z(f.changed.length)}):n("ui.notifications.toast.marked_unread",{count:z(f.changed.length)}))},[ie,P]),Re=a.useCallback(e=>{if(P)return;const{dismissable:i,asksStaying:o}=ke(e);if(i.length===0){o>0&&Y(n("ui.notifications.ask.stays"));return}const s=yt(i),l=new Set(i.map(y=>y.id));Be(l);const f=h.findIndex(y=>l.has(y.id)),T=h.slice(f+1).find(y=>!l.has(y.id))??[...h.slice(0,f)].reverse().find(y=>!l.has(y.id));N(T?.id??null),c&&l.has(c)&&g("/notifications"),$(),ie("dismiss",{items:s},s,y=>{const _=y.skipped.filter(O=>O.reason==="live_ask").length,A=n("ui.notifications.toast.dismissed",{count:y.changed.length}),R=o+_;return R>0?`${A}. ${n("ui.notifications.select.asks_stay",{count:R})}`:A})},[Be,$,g,c,h,ie,P]),rt=a.useCallback(async(e,i)=>{if(!(!k||P||j.current)){j.current=!0,q(!0);try{const o=await ii(s=>Wt({op:"notifications.list",...s}),{scope:{sessionId:e},throughSeq:k.high_water,waiting:[],verb:"dismiss"});o.tokens.length&&je({sessionId:e,title:i,count:o.tokens.length,snapshot:o})}catch{Ae(n("ui.notifications.error.load.title"))}finally{j.current=!1,q(!1)}}},[k,P]),Ri=a.useCallback(()=>{if(!G)return;const{snapshot:e}=G;je(null),c&&e.tokens.some(i=>i.id===c)&&g("/notifications"),ie("dismiss",{...e.scope,throughSeq:e.throughSeq,observed:[...e.tokens]},[...e.tokens],i=>{const o=new Set(h.map(l=>l.id)),s=dn(o,i.changed);return s.size>0&&(Be(s),J(l=>{const f=new Map(l);for(const T of s)f.delete(T);return f})),n("ui.notifications.toast.dismissed",{count:i.changed.length})})},[G,g,c,ie,h,Be]),Di=a.useCallback(async()=>{if(!(!k||P||j.current)){j.current=!0,q(!0);try{const e=new Set((k.waiting??[]).filter(o=>!o.read).map(o=>o.id)),i=await ii(o=>Wt({op:"notifications.list",...o}),{scope:{all:!0},throughSeq:k.high_water,waiting:k.observed.filter(o=>e.has(o.id)),verb:"read"});await ie("read",{all:!0,throughSeq:i.throughSeq,observed:[...i.tokens]},[...i.tokens],o=>n("ui.notifications.toast.marked_read",{count:z(o.changed.length)}),!0)}catch{Ae(n("ui.notifications.error.load.title"))}finally{j.current=!1,q(!1)}}},[k,ie,P]),De=a.useCallback(e=>{N(e.id),g(un(e.id))},[g]),Bt=a.useCallback(()=>{const e=c;g("/notifications"),e&&N(e)},[g,c]),Lt=a.useCallback(e=>{Fi(g,e)},[g]),Pt=a.useCallback((e,i)=>{if(p){const o=new Map(p.excluded);if(i)for(const s of vt(h,L,e.id,new Set))o.delete(s);else if(o.has(e.id))o.delete(e.id);else if(Me(e,p)){if(o.size>=500){Y(n("ui.notifications.bulk.exclusion_limit"));return}o.set(e.id,e)}else{Y(n("ui.notifications.bulk.frozen_hint"));return}ve({...p,excluded:o})}else oe(o=>{if(i)return vt(h,L,e.id,o);const s=new Set(o);return s.has(e.id)?s.delete(e.id):s.add(e.id),s});be(e.id)},[L,h,p]),ct=a.useCallback(async e=>{if(!j.current){j.current=!0,q(!0),B.current=null;try{const i=[];for(const s of e)i.push(await ce.undo(s));const o={changed_count:i.reduce((s,l)=>s+l.changed_count,0),skipped_count:i.reduce((s,l)=>s+l.skipped_count,0)};o.skipped_count===0?Jt(n("ui.notifications.toast.undone")):Y(n("ui.notifications.bulk.partial",{changed:z(o.changed_count),skipped:z(o.skipped_count)}))}catch(i){Ae(mt(i,n("ui.notifications.error.load.title")))}finally{j.current=!1,q(!1)}}},[ce]),ne=a.useCallback(async(e,i)=>{if(j.current||he)return;if(!("items"in i)){const s=X(i);if((e==="dismiss"?s.eligible:s.readable)===0)return}j.current=!0,q(!0),te.current=null,B.current=null,Je.current=!!document.activeElement?.closest("[data-notifications-page]");const o=s=>"items"in i?i.items.some(l=>l.id===s.id):Me(s,i);try{const s="items"in i?await ce.applyItems(e,i.items,i.throughSeq,S,Ze()):{receipts:[await ce.apply(e,i,Ze())],pending:0,skippedAsks:0},l={changed_count:s.receipts.reduce((R,O)=>R+O.changed_count,0),skipped_count:s.receipts.reduce((R,O)=>R+O.skipped_count,0)};e==="dismiss"&&(J(R=>new Map([...R].filter(([,O])=>!o(O)))),W&&o(W)&&g("/notifications")),$();const f=l.changed_count>0?{tokens:s.receipts.filter(R=>R.changed_count>0).map(R=>R.operation_token),at:Date.now()}:null;B.current=f;const T=e==="dismiss"?n("ui.notifications.toast.dismissed",{count:l.changed_count}):e==="read"?n("ui.notifications.toast.marked_read",{count:z(l.changed_count)}):n("ui.notifications.toast.marked_unread",{count:z(l.changed_count)}),_=[s.pending>0?St({changed:l.changed_count,skipped:l.skipped_count,pending:s.pending}):l.skipped_count>0?n("ui.notifications.bulk.partial",{changed:z(l.changed_count),skipped:z(l.skipped_count)}):T,s.skippedAsks>0?n("ui.notifications.select.asks_stay",{count:s.skippedAsks}):null].filter(Boolean).join(". "),A=ti(s.pending>0||l.skipped_count>0||s.skippedAsks>0);Y(_,{duration:A,action:f?{label:n("ui.notifications.toast.undo"),onClick:()=>{B.current===f&&Date.now()-f.at<=A&&ct(f.tokens)}}:void 0})}catch(s){Ae(mt(s,n("ui.notifications.error.load.title")))}finally{j.current=!1,q(!1)}},[ce,S,Ze,$,he,W,g,ct]),Ue=a.useCallback(e=>{const i=X(e),o=h.filter(s=>!qe(s)&&Me(s,e)).length;i.eligible>o||i.asks>0?K({snapshot:e}):ne("dismiss",e)},[h,ne]),lt=a.useCallback(async(e=!1)=>{if(!D){Y(n("ui.notifications.bulk.update_required"));return}if(j.current||he||!k)return;j.current=!0,q(!0);const i=++we.current;let o=null;try{const s=await fn(E,C,[...new Set([...ce.activeSessionIds(),...h.map(f=>f.session.id),...it.map(([f])=>f)])].slice(0,50),S);if(i!==we.current)return;const l={preview:s,includeAskReads:S,filters:{...E},state:C,excluded:new Map,asks:[...Ne]};if(X(l).count===0)return;o=l,oe(new Set),ve(l)}catch(s){Ae(mt(s,n("ui.notifications.bulk.select_error")))}finally{j.current=!1,q(!1)}e&&o&&Ue(o)},[D,S,ce.activeSessionIds,E,C,Ne,k,he,Ue,h,it]),Ve=a.useMemo(()=>p?new Set(h.filter(e=>Me(e,p)).map(e=>e.id)):ye,[p,h,ye]),Ot=a.useCallback(e=>{De(e),Y(n("ui.notifications.ask.stays"))},[De]),Ut=x&&h.some(e=>e.id===x)?x:h[0]?.id??null,dt=a.useRef(null);a.useEffect(()=>{if(!x)return;const e=V.current?.querySelector(`[data-notification-row="${CSS.escape(x)}"]`);e&&V.current?.contains(document.activeElement)&&e.focus({preventScroll:dt.current!==x}),dt.current=null},[x]);const Ei=e=>{if(e.target.closest("input, textarea, [contenteditable='true']"))return;const o=h.findIndex(_=>_.id===Ut),s=o>=0?h[o]:void 0,l=_=>{const A=Math.max(0,Math.min(h.length-1,_)),R=h[A];R&&(e.shiftKey&&s&&!p&&oe(O=>vt(h,s.id,R.id,O)),dt.current=R.id,N(R.id))},f=e.metaKey||e.ctrlKey,T=h.filter(_=>Ve.has(_.id)),y=T.length>0?T:s?[s]:[];switch(e.key){case"ArrowDown":case"j":case"J":if(f)return;e.preventDefault(),l(o+1);return;case"ArrowUp":case"k":case"K":if(f)return;e.preventDefault(),l(o-1);return;case"Home":e.preventDefault(),l(0);return;case"End":e.preventDefault(),l(h.length-1);return;case"Enter":s&&(e.preventDefault(),De(s));return;case"o":case"O":s&&!f&&(e.preventDefault(),Lt(s.session.id));return;case"x":case"X":s&&!f&&(e.preventDefault(),Pt(s,!1));return;case"a":case"A":if(f){e.preventDefault(),lt();return}if(s){e.preventDefault();const _=h.find(A=>A.session.id===s.session.id&&qe(A));De(_??s)}return;case"e":case"E":if(f||!s)return;if(e.preventDefault(),e.shiftKey){rt(s.session.id,s.session.title||n("ui.notifications.group.untitled"));return}if(T.length===0&&qe(s)){Ot(s);return}p?Ue(p):ke(y).asksStaying>0?K({items:y,throughSeq:k?.high_water??0}):D&&T.length>0?ne("dismiss",{items:y,throughSeq:k?.high_water??0}):Re(y);return;case"u":case"U":if(f)return;e.preventDefault(),p?ne(X(p).unread>0?"read":"unread",p):Oe(y);return;case"z":case"Z":if(f&&B.current&&Date.now()-B.current.at<=ni){e.preventDefault(),ct(B.current.tokens);return}if(f&&te.current){e.preventDefault();const _=te.current;te.current=null,Date.now()-_.at<=ni&&_.items.length>0&&ot(_.verb,_.items)}return;case"Escape":if(Ve.size>0||p){e.preventDefault(),$();return}c&&(e.preventDefault(),Bt());return}};if(!b)return t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx($t,{title:n("ui.notifications.page.title"),icon:si}),d.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Ht,{label:n("ui.notifications.page.checking")})}):t.jsx(Kt,{variant:"warning",children:n("ui.notifications.page.unavailable")})]});const Q=h.filter(e=>Ve.has(e.id)),We=!!(c&&W),Ti=v&&We,ut=k&&h.length===0?Ke(E)?"filtered":C==="unread"?"caught_up":"none":null;return t.jsxs("div",{className:"flex h-full min-h-0 flex-col","data-notifications-page":"","data-glass-region":"canvas",children:[t.jsxs("div",{className:"flex shrink-0 flex-col gap-4 px-6 pt-6",children:[t.jsx($t,{title:n("ui.notifications.page.title"),icon:si,subtitle:n("ui.notifications.page.subtitle"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.newerCount>0&&t.jsxs(w,{size:"sm",variant:"secondary","data-notifications-back-to-top":"",onClick:()=>{Ie.current=null,V.current?.scrollTo({top:0}),Xe(!0),m.resetToTop()},children:[t.jsx(di,{"aria-hidden":"true"}),n("ui.notifications.new_pill",{count:z(m.newerCount)})]}),t.jsx(w,{variant:"ghost",size:"icon","aria-label":n("ui.notifications.page.refresh"),title:n("ui.notifications.page.refresh"),"aria-busy":m.isFetching||void 0,disabled:m.isFetching,onClick:()=>{J(new Map),Et(new Map),m.refresh()},children:t.jsx(vn,{})})]})}),t.jsx(Rn,{loaded:k,bulkEnabled:D,readState:C,onReadState:e=>{se(e),J(new Map),Dt(_t,e)},filters:E,setFilters:fe,grouping:de,setGrouping:ae,sources:it,writesPaused:P,markAllRead:Di,selectionCount:p?X(p).count:Q.length,asksCount:p?X(p).asks:ke(Q).asksStaying,allChecked:p?p.excluded.size===0?!0:"indeterminate":Q.length>0?"indeterminate":!1,frozen:!!p,newItemsOutsideSelection:!!(p&&h.some(e=>qe(e)?!p.asks.some(i=>i.id===e.id):e.seq>p.preview.through_seq)),readIncludesAsks:!!(p&&pn(p)),onDismissAll:()=>void lt(!0),nothingToDismiss:ut!==null,visibleUnread:bi,onSelectAll:()=>p&&p.excluded.size===0?$():void lt(),onReviewAsks:()=>{$(),fe(e=>({...e,kind:"asks"}))},onClearSelection:$,onBulkRead:e=>p?void ne(e,p):Oe(e==="read"?Q.filter(i=>!i.read):Q.filter(i=>i.read)),onBulkDismiss:()=>{p?Ue(p):ke(Q).asksStaying>0?K({items:Q,throughSeq:k?.high_water??0}):D&&Q.length>0?ne("dismiss",{items:Q,throughSeq:k?.high_water??0}):Re(Q)}})]}),he&&t.jsx("div",{className:"px-6 pt-3",children:t.jsxs(Kt,{variant:"danger",role:"alert","data-notifications-refresh-error":"",children:[t.jsx("span",{className:"font-medium",children:n("ui.notifications.error.refresh.title")})," ",n("ui.notifications.error.refresh.body",{time:At?zi(At,{hour:"2-digit",minute:"2-digit"}):""})]})}),t.jsxs("div",{className:"mt-3 flex min-h-0 flex-1",children:[!Ti&&t.jsx("div",{className:le("flex min-h-0 flex-col",We||!v?"w-[min(560px,46%)] shrink-0":"flex-1",v&&"w-full"),children:m.isError&&!k?t.jsxs("div",{className:"flex flex-col items-start gap-3 px-6 py-6",role:"alert",children:[t.jsx("p",{className:"text-body text-ink",children:n("ui.notifications.error.load.title")}),t.jsx(w,{variant:"secondary",onClick:()=>void m.refetch(),children:n("ui.notifications.error.retry")})]}):!k||ji?t.jsx(En,{}):ut?t.jsx(Cn,{kind:ut,onShowAll:()=>{se("all"),Dt(_t,"all")},onClearFilters:()=>fe(Nt)}):t.jsx("div",{ref:V,role:"grid","aria-multiselectable":"true","aria-label":n("ui.notifications.page.list_label"),onKeyDown:Ei,onScroll:e=>{const i=e.currentTarget;Ye(),Xe(i.scrollTop<=24),m.hasNextPage&&!m.isFetchingNextPage&&i.scrollHeight-i.scrollTop-i.clientHeight<160&&m.fetchNextPage()},className:"flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 [overflow-anchor:none] [scrollbar-gutter:stable]","data-notifications-list":"",children:ze.map(e=>t.jsx(_n,{group:e,nowMs:U,openId:c??null,selected:Ve,selecting:p?X(p).count>0:ye.size>0,focusedId:Ut,writesPaused:P,exitingIds:_i,onExitFinished:Ci,onOpen:De,onToggleSelect:Pt,onToggleRead:i=>Oe([i]),onDismiss:i=>Re([i]),onAnswer:Ot,onFocusRow:i=>N(i.id),onPrefetch:Ni,onDismissSession:rt,sessionCount:i=>It?.[i]??null},e.key))})}),!v||We?t.jsx("div",{"data-glass-region":"panel",className:le("flex min-h-0 min-w-0 flex-1 flex-col rounded-md bg-surface",v?"mx-6 mb-6 w-auto":"me-6 mb-6"),children:We&&W?t.jsx(mn,{item:W,detail:Mt?void 0:I.data,loading:I.isLoading||Mt,error:I.isError,nowMs:U,narrow:v,writesPaused:P,sessionDismissCount:It?.[W.session.id]??null,onClose:Bt,onOpenConversation:Lt,onToggleRead:e=>Oe([e]),onDismiss:e=>Re([e]),onDismissSession:rt,onCopyLink:hn,onOpenProject:e=>g(`/projects/${encodeURIComponent(e)}`),onAsksSettled:(e,i)=>{const o=`ask:${W.session.id}:${e}`,s=ee.get(o)??(I.data?.item.id===o?I.data.item:void 0);s?.source==="ask"&&s.ask&&Et(l=>new Map(l).set(o,{...s,read:!0,ask:{...s.ask,status:i}})),gn(M,W.id)}},W.id):t.jsx(Dn,{})}):null]}),Z&&!Se&&t.jsx(Ht,{label:n("ui.notifications.page.loading")}),Se&&t.jsx(bn,{progress:Se}),F&&t.jsx(Tn,{count:"snapshot"in F?X(F.snapshot).eligible:ke(F.items).dismissable.length,asks:"snapshot"in F?X(F.snapshot).asks:ke(F.items).asksStaying,beyondPage:"snapshot"in F&&X(F.snapshot).eligible>h.filter(e=>!qe(e)&&Me(e,F.snapshot)).length,onCancel:()=>K(null),onConfirm:()=>{const e=F;K(null),"snapshot"in e?ne("dismiss",e.snapshot):D?ne("dismiss",e):Re(e.items)},onReviewAsks:()=>{K(null),$(),fe(e=>({...e,kind:"asks"}))}}),G&&t.jsx(Nn,{title:G.title,count:G.count,onConfirm:Ri,onCancel:()=>je(null)})]})},ci=r=>{switch(r.kind){case"waiting":return n("ui.notifications.group.waiting");case"conversation":return r.title||n("ui.notifications.group.untitled");case"time":return r.key==="today"?n("ui.notifications.group.today"):r.key==="yesterday"?n("ui.notifications.group.yesterday"):r.key==="week"?n("ui.notifications.group.week"):n("ui.notifications.group.older")}},_n=({group:r,onDismissSession:c,sessionCount:g,...d})=>{const[u,b]=a.useState(r.kind==="time"&&r.key==="older"),D=r.kind==="conversation"?g(r.sessionId):0;return t.jsxs("div",{role:"rowgroup","data-notification-group":r.key,children:[t.jsxs("div",{role:"row",tabIndex:-1,"data-glass-plane":"band-backdrop",className:"sticky top-0 z-[1] flex h-8 items-center gap-2 bg-canvas px-3 text-ink-muted text-meta",children:[t.jsx("span",{role:"rowheader",className:"flex min-w-0 items-center gap-1.5",children:r.kind==="time"&&r.key==="older"?t.jsxs("button",{type:"button",className:"inline-flex min-h-6 items-center gap-1 hover:text-ink","aria-expanded":!u,onClick:()=>b(S=>!S),children:[ci(r),t.jsx("span",{className:"text-ink-dim tabular-nums",children:r.items.length}),u?t.jsx(He,{size:12}):t.jsx(di,{size:12})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate",children:ci(r)}),t.jsx("span",{className:"text-ink-dim tabular-nums",children:r.items.length})]})}),r.kind==="conversation"&&D!==null&&D>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:"h-px flex-1 bg-hairline"}),t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>c(r.sessionId,r.title),children:n("ui.notifications.group.dismiss_session",{count:z(D)})})]})]}),!u&&r.items.map(S=>t.jsx(wn,{exiting:d.exitingIds.has(S.id),onExited:()=>d.onExitFinished(S.id),children:t.jsx(xn,{item:S,nowMs:d.nowMs,open:d.openId===S.id,picked:d.selected.has(S.id),selecting:d.selecting,focused:d.focusedId===S.id,writesPaused:d.writesPaused,onOpen:d.onOpen,onToggleSelect:d.onToggleSelect,onToggleRead:d.onToggleRead,onDismiss:d.onDismiss,onAnswer:d.onAnswer,onFocusRow:d.onFocusRow,onPrefetch:d.onPrefetch})},S.id))]})},Cn=({kind:r,onShowAll:c,onClearFilters:g})=>t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 py-16 text-center","data-notifications-empty":r,children:[r==="caught_up"&&t.jsx(hi,{size:24,"aria-hidden":"true",className:"text-ink-muted"}),t.jsx("p",{className:"text-heading text-ink",children:r==="caught_up"?n("ui.notifications.empty.caught_up.title"):r==="none"?n("ui.notifications.empty.none.title"):n("ui.notifications.empty.filtered.title")}),r!=="filtered"&&t.jsx("p",{className:"max-w-96 text-body-sm text-ink-muted",children:r==="caught_up"?n("ui.notifications.empty.caught_up.body"):n("ui.notifications.empty.none.body")}),r==="caught_up"&&t.jsx(w,{variant:"secondary",onClick:c,children:n("ui.notifications.empty.caught_up.show_all")}),r==="filtered"&&t.jsx(w,{variant:"secondary",onClick:g,children:n("ui.notifications.filter.clear")})]}),Nn=({title:r,count:c,onConfirm:g,onCancel:d})=>t.jsx(ui,{open:!0,onOpenChange:u=>!u&&d(),children:t.jsxs(fi,{className:"max-w-sm",children:[t.jsx(pi,{children:n("ui.notifications.confirm.dismiss_session",{count:c,source:r})}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx(w,{variant:"tonal",onClick:d,children:n("ui.notifications.confirm.cancel")}),t.jsx(w,{variant:"danger",autoFocus:!0,onClick:g,"data-notifications-confirm":"",children:n("ui.notifications.confirm.dismiss_session_ok")})]})]})}),Rn=({loaded:r,bulkEnabled:c,readState:g,onReadState:d,filters:u,setFilters:b,grouping:D,setGrouping:S,sources:U,writesPaused:v,markAllRead:M,selectionCount:C,asksCount:se,allChecked:de,frozen:ae,readIncludesAsks:ue,newItemsOutsideSelection:E,onDismissAll:fe,nothingToDismiss:ye,visibleUnread:oe,onSelectAll:p,onClearSelection:ve,onReviewAsks:F,onBulkRead:K,onBulkDismiss:we})=>{const B=se,L=C-se,be=C>0;return t.jsxs("div",{className:"flex min-h-11 shrink-0 flex-wrap items-center gap-2 border-hairline border-b py-2","data-notifications-toolbar":be?"selection":"filters",children:[t.jsx("span",{className:"inline-flex size-6 shrink-0 items-center justify-center pointer-coarse:size-11",children:t.jsx(Pi,{hitArea:"comfortable",checked:de,"aria-label":n("ui.notifications.select.all"),disabled:!c||!r||v,title:c?void 0:n("ui.notifications.bulk.update_required"),onCheckedChange:p,"data-notifications-select-all":""})}),be?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium text-body-sm text-ink",title:ae?n("ui.notifications.bulk.frozen_hint"):void 0,children:n("ui.notifications.select.count",{count:z(C)})}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:ae&&(ue?C:L)===0,"aria-disabled":v||void 0,title:n("ui.notifications.bulk.read_hint"),"data-notifications-bulk-read":"read",onClick:()=>!v&&K("read"),children:[t.jsx(Oi,{}),ae&&!ue?n("ui.notifications.bulk_updates.read",{count:L}):n("ui.notifications.select.mark_read")]}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:ae&&(ue?C:L)===0,"aria-disabled":v||void 0,"data-notifications-bulk-read":"unread",onClick:()=>!v&&K("unread"),children:[t.jsx(Ui,{}),ae&&!ue?n("ui.notifications.bulk_updates.unread",{count:L}):n("ui.notifications.select.mark_unread")]}),t.jsxs(w,{variant:"secondary",size:"sm","aria-disabled":v||L===0||void 0,onClick:()=>!v&&L>0&&we(),title:n("ui.notifications.bulk.dismiss_hint"),"data-notifications-bulk-dismiss":L,children:[t.jsx(Gt,{}),n("ui.notifications.select.dismiss",{count:z(L)})]}),B>0&&t.jsx("span",{className:"text-ink-dim text-meta",role:"status","data-notifications-asks-stay":B,children:n("ui.notifications.select.asks_stay",{count:B})}),B>0&&t.jsx(w,{variant:"ghost",size:"sm",onClick:F,children:n("ui.notifications.bulk.review_asks")}),t.jsx("span",{className:"flex-1"}),t.jsxs(w,{variant:"ghost",size:"sm",onClick:ve,children:[n("ui.notifications.select.clear"),t.jsx("kbd",{className:"ms-1 text-ink-dim text-meta",children:"Esc"})]}),E&&t.jsxs("p",{className:"basis-full text-meta text-ink-muted","data-notifications-new-outside-selection":"",children:[n("ui.notifications.bulk_updates.new_items")," ",n("ui.notifications.ask.stays")]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{role:"radiogroup","aria-label":n("ui.notifications.filter.read_state"),"data-glass-well":"",className:"flex items-center gap-0.5 rounded-sm bg-sunken p-0.5",children:["unread","all"].map(x=>t.jsxs("button",{type:"button",role:"radio","aria-checked":g===x,onClick:()=>d(x),className:le("flex h-7 items-center gap-1.5 rounded-xs px-2.5 text-body-sm",g===x?"bg-elevated text-ink":"text-ink-muted hover:text-ink"),children:[x==="unread"?n("ui.notifications.filter.unread"):n("ui.notifications.filter.all"),x==="unread"&&oe>0&&t.jsx(Vi,{variant:"neutral",size:"count",children:Wi(oe,99)})]},x))}),[{label:n("ui.notifications.filter.kind"),value:u.kind,options:["all","asks","updates"],isDefault:u.kind==="all",set:x=>b(N=>({...N,kind:x})),optionLabel:x=>x==="asks"?n("ui.notifications.filter.kind_asks"):x==="updates"?n("ui.notifications.filter.kind_updates"):n("ui.notifications.filter.kind_all")},{label:n("ui.notifications.filter.priority"),value:u.priority,options:["any","high","normal_up"],isDefault:u.priority==="any",set:x=>b(N=>({...N,priority:x})),optionLabel:x=>x==="high"?n("ui.notifications.filter.priority_high"):x==="normal_up"?n("ui.notifications.filter.priority_normal_up"):n("ui.notifications.filter.priority_any")}].map(({label:x,value:N,options:G,isDefault:je,set:Se,optionLabel:re})=>t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r,children:[t.jsx(Ct,{label:x,value:re(N),emphasised:!je}),t.jsx(He,{})]})}),t.jsx(xt,{align:"start",children:t.jsx(kt,{value:N,onValueChange:Se,children:G.map(Z=>t.jsx(Te,{value:Z,children:re(Z)},Z))})})]},x)),U.length>0&&t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r,children:[t.jsx(Ct,{label:n("ui.notifications.filter.from"),value:u.from===null?n("ui.notifications.filter.from_all"):U.find(([x])=>x===u.from)?.[1]??n("ui.notifications.group.untitled"),emphasised:u.from!==null}),t.jsx(He,{})]})}),t.jsx(xt,{align:"start",children:t.jsxs(kt,{value:u.from??"",onValueChange:x=>b(N=>({...N,from:x||null})),children:[t.jsx(Te,{value:"",children:n("ui.notifications.filter.from_all")}),U.map(([x,N,G])=>t.jsxs(Te,{value:x,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:N}),t.jsx("span",{className:"ms-3 text-ink-dim text-meta tabular-nums",children:G})]},x))]})})]}),Ke(u)&&t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>b(()=>Nt),children:n("ui.notifications.filter.clear")}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:!c||!r||v||ye,onClick:fe,title:n(c?"ui.notifications.bulk.dismiss_hint":"ui.notifications.bulk.update_required"),"data-notifications-dismiss-all":"",children:[t.jsx(Gt,{}),n("ui.notifications.bulk.dismiss_all")]}),t.jsx("span",{className:"flex-1"}),t.jsxs(ht,{children:[t.jsx(gt,{asChild:!0,children:t.jsxs(w,{variant:"secondary",size:"sm",children:[t.jsx(Ct,{label:n("ui.notifications.filter.group"),value:D==="time"?n("ui.notifications.filter.group_time"):n("ui.notifications.filter.group_conversation"),emphasised:D!=="time"}),t.jsx(He,{})]})}),t.jsx(xt,{align:"end",children:t.jsxs(kt,{value:D,onValueChange:x=>{const N=x==="conversation"?"conversation":"time";S(N),Dt(gi,N)},children:[t.jsx(Te,{value:"time",children:n("ui.notifications.filter.group_time")}),t.jsx(Te,{value:"conversation",children:n("ui.notifications.filter.group_conversation")})]})})]}),t.jsxs(w,{variant:"secondary",size:"sm",disabled:!r||(r?.unread_count??0)+(r?.waiting_unread_count??0)===0,"aria-disabled":v||void 0,title:v?n("ui.notifications.writes_paused_tip"):void 0,onClick:()=>{!r||v||r.unread_count+r.waiting_unread_count===0||M()},"data-notifications-mark-all":"",children:[t.jsx(hi,{}),n("ui.notifications.action.mark_all_read")]})]})]})},Ct=({label:r,value:c,emphasised:g})=>{const d=n("ui.notifications.filter.chip",{label:r,value:c}),u=d.lastIndexOf(c);return u<0?t.jsx("span",{children:d}):t.jsxs("span",{children:[d.slice(0,u),t.jsx("span",{className:le(g&&"font-semibold"),children:c}),d.slice(u+c.length)]})},Dn=()=>t.jsx("div",{className:"flex h-full items-center justify-center p-6 text-center text-ink-dim text-body-sm",children:n("ui.notifications.detail.empty")}),En=()=>t.jsx("div",{role:"status","aria-label":n("ui.notifications.page.loading"),className:"flex flex-col",children:Array.from({length:7},(r,c)=>t.jsxs("div",{className:"flex h-14 items-center gap-3 px-3","data-notification-skeleton":"",children:[t.jsx($e,{className:"size-1.5 rounded-full bg-elevated"}),t.jsx($e,{className:"size-4 bg-elevated"}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[t.jsx($e,{className:le("h-3 bg-elevated",c%2?"w-2/3":"w-1/2")}),t.jsx($e,{className:le("h-2.5 bg-elevated",c%3?"w-1/3":"w-2/5")})]})]},c))}),Tn=({count:r,asks:c,beyondPage:g,onConfirm:d,onCancel:u,onReviewAsks:b})=>t.jsx(ui,{open:!0,onOpenChange:D=>!D&&u(),children:t.jsxs(fi,{className:"max-w-md",children:[t.jsx(pi,{children:n("ui.notifications.bulk.confirm_title",{count:r})}),g&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.notifications.bulk.beyond_page")}),c>0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.notifications.bulk.asks_hint")}),t.jsxs("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[c>0&&t.jsx(w,{variant:"ghost",onClick:b,children:n("ui.notifications.bulk.review_asks")}),t.jsx(w,{variant:"tonal",onClick:u,children:n("ui.notifications.confirm.cancel")}),t.jsx(w,{variant:"danger",disabled:r===0,onClick:d,"data-notifications-confirm-view":"",children:n("ui.notifications.confirm.dismiss_session_ok")})]})]})});export{On as NotificationsPage,ni as UNDO_WINDOW_MS,ti as receiptDuration};
@@ -1,2 +1,2 @@
1
- import{r as S,j as a,c as I}from"./index-BWQzFq0n.js";import{y as ue,z as de,A as he,D as fe,E as Z,H as ee,F as pe,G as te,I as ne,J as be,K as ge,L as me,M as U,O as xe}from"./index-Buuz619t.js";import{u as q,C as ke,h as ye,B as A,a as _e,m as ve,n as we,y as je,o as Ne,z as Se,F as Ie}from"./error-boundary-C1x5W-AX.js";import{t as d}from"./messages-B7aIuFuF.js";import{N as p,m as C,u as E,a as ie,d as L,r as se,j as O,O as Q,Q as Re}from"./appearance-DCqlsN7S.js";import{bm as ae,aR as P,bf as F}from"./conversation-input-sync-DlorrZ6B.js";const Pe=1e3,z=400,Ae=.35;function G(e){return e===""?[]:e.split(`
1
+ import{r as S,j as a,c as I}from"./index-D0qlrLIs.js";import{y as ue,z as de,A as he,D as fe,E as Z,H as ee,F as pe,G as te,I as ne,J as be,K as ge,L as me,M as U,O as xe}from"./index-BKh47kLl.js";import{u as q,C as ke,h as ye,B as A,a as _e,m as ve,n as we,y as je,o as Ne,z as Se,F as Ie}from"./error-boundary-BsWceBKP.js";import{t as d}from"./messages-BYDbMAVA.js";import{N as p,m as C,u as E,a as ie,d as L,r as se,j as O,O as Q,Q as Re}from"./appearance-DO4VPBSi.js";import{bm as ae,aR as P,bf as F}from"./conversation-input-sync-FnnZiNnd.js";const Pe=1e3,z=400,Ae=.35;function G(e){return e===""?[]:e.split(`
2
2
  `)}function re(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let s=e.length,i=t.length;for(;s>n&&i>n&&e[s-1]===t[i-1];)s--,i--;const c=[];for(let o=0;o<n;o++)c.push({kind:"context",a:o,b:o});c.push(...Ee(e,t,n,s,n,i));for(let o=0;s+o<e.length;o++)c.push({kind:"context",a:s+o,b:i+o});return c}function Ee(e,t,n,s,i,c){const o=s-n,m=c-i,v=()=>[...Array.from({length:o},(k,j)=>({kind:"del",a:n+j,b:i})),...Array.from({length:m},(k,j)=>({kind:"add",a:s,b:i+j}))];if(o===0||m===0)return v();const g=Math.min(o+m,Pe),r=g;let f=new Int32Array(2*g+2);const u=[];let l=-1;for(let k=0;k<=g;k++){u.push(f.slice());const j=f.slice();for(let w=-k;w<=k;w+=2){let N;w===-k||w!==k&&f[r+w-1]<f[r+w+1]?N=f[r+w+1]:N=f[r+w-1]+1;let h=N-w;for(;N<o&&h<m&&e[n+N]===t[i+h];)N++,h++;if(j[r+w]=N,N>=o&&h>=m){l=k;break}}if(f=j,l>=0)break}if(l<0)return v();const y=[];let x=o,_=m;for(let k=l;k>0;k--){const j=u[k],w=x-_,N=w===-k||w!==k&&j[r+w-1]<j[r+w+1],h=N?w+1:w-1,b=j[r+h],R=b-h;for(;x>b&&_>R;)x--,_--,y.push({kind:"context",a:n+x,b:i+_});N?(_--,y.push({kind:"add",a:n+x,b:i+_})):(x--,y.push({kind:"del",a:n+x,b:i+_}))}for(;x>0&&_>0;)x--,_--,y.push({kind:"context",a:n+x,b:i+_});return y.reverse()}function Y(e){return e.match(/[\p{L}\p{N}_]+|\s+|[^\p{L}\p{N}_\s]/gu)??[]}function De(e,t){const n=Y(e),s=Y(t);let i=0;for(;i<n.length&&i<s.length&&n[i]===s[i];)i++;let c=0;for(;c<n.length-i&&c<s.length-i&&n[n.length-1-c]===s[s.length-1-c];)c++;if(n.length-i-c>z||s.length-i-c>z)return null;const o=re(n,s);let m=0;for(const u of o)u.kind==="context"&&(m+=n[u.a].length);const v=Math.max(e.length,t.length);if(v===0||m/v<Ae)return null;const g=(u,l,y)=>{const x=u[u.length-1];x&&x.changed===y?x.text+=l:u.push({text:l,changed:y})},r=[],f=[];for(const u of o)u.kind==="context"?(g(r,n[u.a],!1),g(f,s[u.b],!1)):u.kind==="del"?g(r,n[u.a],!0):g(f,s[u.b],!0);return{before:r,after:f}}function qe(e){let t=0;for(;t<e.length;){if(e[t].kind==="context"){t++;continue}const n=t;for(;t<e.length&&e[t].kind!=="context";)t++;const s=e.slice(n,t),i=[...s.filter(c=>c.kind==="del"),...s.filter(c=>c.kind==="add")];e.splice(n,i.length,...i)}}function Me(e){let t=0;for(;t<e.length;){if(e[t].kind!=="del"){t++;continue}const n=[];for(;t<e.length&&e[t].kind==="del";)n.push(e[t++]);const s=[];for(;t<e.length&&e[t].kind==="add";)s.push(e[t++]);for(let i=0;i<Math.min(n.length,s.length);i++){const c=De(n[i].text,s[i].text);c&&(n[i].segments=c.before,s[i].segments=c.after)}}}function Te(e,t,{context:n=3,wordLevel:s=!0}={}){const i=G(e),c=G(t),o=re(i,c).map(l=>l.kind==="context"?{kind:"context",text:i[l.a],oldNo:l.a+1,newNo:l.b+1}:l.kind==="del"?{kind:"del",text:i[l.a],oldNo:l.a+1,newNo:null}:{kind:"add",text:c[l.b],oldNo:null,newNo:l.b+1});qe(o),s&&Me(o);let m=0,v=0;for(const l of o)l.kind==="add"?m++:l.kind==="del"&&v++;const g=new Array(o.length).fill(!1);o.forEach((l,y)=>{if(l.kind==="context")return;const x=Math.max(0,y-n),_=Math.min(o.length-1,y+n);for(let k=x;k<=_;k++)g[k]=!0});const r=[];let f=0,u=0;for(;u<o.length;){const l=o[u],y=u;if(l.kind!=="context"){const j=[];for(;u<o.length&&o[u].kind!=="context";)j.push(o[u++]);r.push({kind:"change",id:`change-${f}`,index:f,lines:j}),f++;continue}const x=g[u],_=[];for(;u<o.length&&o[u].kind==="context"&&g[u]===x;)_.push(o[u++]);const k=`${x?"context":"gap"}-${y}`;r.push(x||_.length<2?{kind:"context",id:k,lines:_}:{kind:"gap",id:k,lines:_})}return{blocks:r,added:m,removed:v,changes:f,identical:m===0&&v===0}}const Ce={add:"+",del:"-",context:" "},Oe={add:"text-success",del:"text-danger",context:"text-ink-dim"},Fe={add:"bg-success-wash/40",del:"bg-danger-wash/40",context:""},J="rounded-sm p-1 text-ink-muted hover:bg-row-hover hover:text-ink disabled:text-ink-disabled focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",X="my-0.5 block w-full bg-surface py-0.5 text-center font-sans text-ink-muted text-meta hover:bg-row-hover hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:-outline-offset-2",Ke={add:"rounded-[2px] bg-success-wash underline decoration-success decoration-2 underline-offset-2",del:"rounded-[2px] bg-danger-wash underline decoration-danger decoration-2 underline-offset-2"};function $({line:e}){const t=e.kind!=="context",n=e.kind==="context"?"":Ke[e.kind];return a.jsxs("div",{className:I("flex min-w-0",Fe[e.kind]),"data-diff-line":e.kind,children:[a.jsx("span",{"aria-hidden":"true",className:"w-9 shrink-0 select-none pr-1 text-right text-ink-dim tabular-nums",children:e.oldNo??""}),a.jsx("span",{"aria-hidden":"true",className:"w-9 shrink-0 select-none pr-1 text-right text-ink-dim tabular-nums",children:e.newNo??""}),a.jsx("span",{"aria-hidden":"true",className:I("w-4 shrink-0 select-none text-center",Oe[e.kind]),children:Ce[e.kind]}),a.jsxs("span",{className:I("min-w-0 flex-1 whitespace-pre-wrap break-words",t?"text-ink":"text-ink-muted"),children:[e.kind!=="context"&&a.jsxs("span",{className:"sr-only",children:[e.kind==="add"?d("ui.shared.unified_diff.line_added"):d("ui.shared.unified_diff.line_removed")," "]}),e.segments&&e.kind!=="context"?e.segments.map((s,i)=>s.changed?a.jsx("mark",{"data-diff-word":e.kind,className:I("text-inherit",n),children:s.text},i):a.jsx("span",{children:s.text},i)):e.text||" "]})]})}function $e({before:e,after:t,context:n=3,wordLevel:s=!0,labels:i,resetKey:c,maxHeight:o,onStats:m,className:v,"data-testid":g="unified-diff"}){q();const r=S.useMemo(()=>Te(e,t,{context:n,wordLevel:s}),[e,t,n,s]),[f,u]=S.useState(new Set),[l,y]=S.useState(-1),x=S.useRef([]),_=c??`${e}\0${t}`;S.useEffect(()=>{u(new Set),y(-1)},[_]),S.useEffect(()=>{y(h=>Math.min(h,r.changes-1))},[r.changes]),S.useEffect(()=>{m?.({added:r.added,removed:r.removed,hunks:r.changes})},[r,m]);const k=S.useCallback(h=>{if(r.changes===0)return;const b=Math.max(0,Math.min(r.changes-1,h));y(b);const R=x.current[b];R&&(R.focus({preventScroll:!0}),R.scrollIntoView?.({block:"nearest"}))},[r.changes]),j=()=>k(l<0?0:l+1),w=()=>k(l<0?r.changes-1:l-1),N=h=>{if(h.metaKey||h.ctrlKey||h.altKey)return;const b=h.key.toLowerCase();b==="n"||b==="j"?(h.preventDefault(),j()):(b==="p"||b==="k")&&(h.preventDefault(),w())};return r.identical?a.jsx("p",{"data-testid":g,"data-diff-identical":"true",className:I("rounded-md border border-hairline bg-sunken p-3 text-meta text-ink-muted",v),children:d("ui.shared.unified_diff.no_changes")}):a.jsxs("div",{"data-testid":g,className:I("overflow-hidden rounded-md border border-hairline bg-sunken",v),children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-hairline border-b px-3 py-1.5 text-meta",children:[a.jsxs("span",{"data-diff-stats":!0,"aria-hidden":"true",className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-success",children:["+",r.added]})," ",a.jsxs("span",{className:"text-danger",children:["−",r.removed]}),a.jsxs("span",{className:"text-ink-muted",children:[" · ",d("ui.shared.unified_diff.changes",{count:r.changes})]})]}),a.jsx("span",{className:"sr-only",children:d("ui.shared.unified_diff.stats_accessible",{added:String(r.added),removed:String(r.removed)})}),i&&a.jsxs("span",{className:"min-w-0 truncate text-ink-muted",children:[a.jsx("span",{className:"text-danger",children:"-"})," ",i.before," ",a.jsx("span",{className:"text-success",children:"+"})," ",i.after]}),a.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[l>=0&&a.jsx("span",{className:"text-ink-muted tabular-nums","aria-live":"polite",children:d("ui.shared.unified_diff.position",{index:String(l+1),total:String(r.changes)})}),a.jsx("button",{type:"button",onClick:w,disabled:r.changes===0,"aria-label":d("ui.shared.unified_diff.previous"),title:d("ui.shared.unified_diff.previous_hint"),className:J,children:a.jsx(ke,{"aria-hidden":"true",className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:j,disabled:r.changes===0,"aria-label":d("ui.shared.unified_diff.next"),title:d("ui.shared.unified_diff.next_hint"),className:J,children:a.jsx(ye,{"aria-hidden":"true",className:"h-4 w-4"})})]})]}),a.jsx("section",{tabIndex:0,"aria-label":d("ui.shared.unified_diff.accessible"),"aria-keyshortcuts":"n p",onKeyDown:N,className:"overflow-y-auto py-1 font-mono text-mono-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:-outline-offset-2",style:o!==void 0?{maxHeight:o}:void 0,children:r.blocks.map(h=>h.kind==="change"?a.jsx("fieldset",{ref:b=>{x.current[h.index]=b},tabIndex:-1,"data-diff-change":h.index,"data-current":l===h.index||void 0,"aria-label":d("ui.shared.unified_diff.position",{index:String(h.index+1),total:String(r.changes)}),className:I("scroll-my-6 border-l-2 border-transparent outline-none",l===h.index&&"border-l-accent"),children:h.lines.map(b=>a.jsx($,{line:b},`${b.kind}:${b.oldNo}:${b.newNo}`))},h.id):h.kind==="gap"?a.jsx("div",{tabIndex:-1,className:"outline-none",children:f.has(h.id)?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","data-diff-gap-hide":h.lines.length,onClick:b=>{b.currentTarget.parentElement?.focus({preventScroll:!0}),u(R=>{const B=new Set(R);return B.delete(h.id),B})},className:X,children:d("ui.shared.unified_diff.hide_unchanged",{count:h.lines.length})},"hide"),h.lines.map(b=>a.jsx($,{line:b},`c:${b.oldNo}:${b.newNo}`))]}):a.jsx("button",{type:"button","data-diff-gap":h.lines.length,onClick:b=>{b.currentTarget.parentElement?.focus({preventScroll:!0}),u(R=>new Set(R).add(h.id))},className:X,children:d("ui.shared.unified_diff.show_unchanged",{count:h.lines.length})},"show")},h.id):a.jsx("div",{className:"border-l-2 border-transparent",children:h.lines.map(b=>a.jsx($,{line:b},`c:${b.oldNo}:${b.newNo}`))},h.id))})]})}const M=e=>e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2),Ue={available:"border-hairline",updating:"border-hairline",applied:"border-hairline",review:"border-warning-border",failed:"border-danger-border"};function Le(e){const t=[];for(const n of e??[])for(const s of n.fields??[])for(const i of s.regions??[])(i.provenance==="unresolved"||M(i.local)!==M(i.remote))&&t.push({field:s.field,region:i});return t}function We({regions:e}){return q(),e.length?a.jsx("ul",{className:"space-y-3","data-testid":"hub-update-preview",children:e.map(({field:t,region:n},s)=>a.jsxs("li",{className:"space-y-1 text-meta",children:[a.jsx("p",{className:"font-medium text-ink",children:n.heading||n.name||t}),a.jsx($e,{before:M(n.local),after:M(n.remote),labels:{before:d("ui.agents.navigation.updates.preview.local"),after:d("ui.agents.navigation.updates.preview.remote")},maxHeight:360})]},`${t}:${n.id??s}`))}):a.jsx("p",{className:"text-meta text-ink-muted",children:d("ui.agents.navigation.updates.preview.empty")})}function dt({kind:e,name:t,enabled:n}){q();const s=ue(n),i=de(),[c,o]=S.useState(null),m=fe(e,t),v=he(s.data).get(m),g=Z(v),r=i.notes[m],f=i.pending.has(m);if(!v||!g)return r?a.jsx("section",{"data-testid":"hub-update-panel","aria-label":d("ui.agents.navigation.updates.accessible"),className:"mb-8 rounded-md border border-hairline p-3 text-body-sm",children:a.jsx("p",{role:r.tone==="error"?"alert":"status",className:r.tone==="error"?"text-danger":"text-ink",children:r.message})}):null;const u=g.kind==="review",l=v.classification==="baseline-unknown",y=_=>({prefer:_,acknowledgeUnknownBaseline:l}),x=async()=>{const _=await i.applyItem(e,t,{...y(),dryRun:!0});o(_??[])};return a.jsxs("section",{"data-testid":"hub-update-panel","aria-label":d("ui.agents.navigation.updates.accessible"),className:I("mb-8 space-y-2 rounded-md border p-3 text-body-sm",Ue[g.kind]),children:[a.jsxs("p",{className:"flex items-start gap-2 text-ink",children:[a.jsx(ee,{mark:g,className:"mt-0.5"}),a.jsx("span",{className:I(g.kind==="failed"&&"text-danger"),children:pe(v,g)})]}),i.upgradeMessage&&a.jsx("output",{className:"block text-meta text-warning","data-hub-core-upgrade":!0,children:i.upgradeMessage}),u&&l&&a.jsx("p",{className:"text-meta text-ink-muted",children:d("ui.agents.navigation.updates.baseline_unknown")}),u&&!l&&a.jsx("p",{className:"text-meta text-ink-muted",children:d("ui.agents.navigation.updates.merge_guidance")}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.kind==="available"&&a.jsx(A,{size:"sm",variant:"outline","aria-disabled":f||!i.canWrite||void 0,onClick:()=>!f&&i.canWrite&&void i.applyItem(e,t),children:f?d("ui.agents.navigation.updates.action.updating"):d("ui.agents.navigation.updates.action.update")}),g.kind==="failed"&&g.retryable&&a.jsx(A,{size:"sm",variant:"outline","aria-disabled":f||!i.canWrite||void 0,onClick:()=>!f&&i.canWrite&&void i.retryItem(e,t),children:f?d("ui.agents.navigation.updates.action.retrying"):d("ui.agents.navigation.updates.action.retry")}),u&&a.jsxs(a.Fragment,{children:[a.jsx(A,{size:"sm",variant:"outline","aria-disabled":f||!i.canWrite||void 0,onClick:()=>!f&&i.canWrite&&void x(),children:f&&!c?d("ui.agents.navigation.updates.action.loading"):d("ui.agents.navigation.updates.action.preview")}),a.jsx(A,{size:"sm",variant:"ghost","aria-disabled":f||!i.canWrite||void 0,onClick:()=>!f&&i.canWrite&&void i.applyItem(e,t,y("local")),children:d("ui.agents.navigation.updates.action.keep_local")}),a.jsx(A,{size:"sm",variant:"ghost","aria-disabled":f||!i.canWrite||void 0,onClick:()=>!f&&i.canWrite&&void i.applyItem(e,t,y("remote")),children:d("ui.agents.navigation.updates.action.use_remote")})]})]}),c&&u&&a.jsx(We,{regions:Le(c)}),r&&a.jsx("p",{role:r.tone==="error"?"alert":"status",className:r.tone==="error"?"text-meta text-danger":"text-meta text-ink-muted",children:r.message})]})}const He=/\/+$/;function le(e){const t=e.replace(He,"");try{const{pathname:n}=new URL(t);return n===""||n==="/"?`${t}/v1`:t}catch{return`${t}/v1`}}function Be(e){const t=Array.isArray(e.files)?e.files.flatMap(i=>{const c=i;return c&&typeof c=="object"&&typeof c.path=="string"?[{path:c.path,content:typeof c.content=="string"?c.content:""}]:[]}):[],n=e.bundle&&typeof e.bundle=="object"?e.bundle:null,s=n?.file_count;return{...e,files:t,bundle:n,file_count:typeof s=="number"&&Number.isFinite(s)&&s>=0?s:t.length}}const oe=e=>({...e,result:e.result?Be(e.result):e.result}),ht=e=>e?.skills===1&&e.revision_cas===1;function Qe(e,t=1,n=20){const s=new URL(te(e,"skills"));return s.searchParams.set("page",String(t)),s.searchParams.set("per_page",String(n)),ne(s.toString())}function ze(e,t){return ne(te(e,"skills",t)).then(oe)}function Ge(e){return ae({operation:"org_skills.list",tenantId:e})}function Ye(e,t){return ae({operation:"org_skill.get",tenantId:e,skillId:t}).then(oe)}const Je=p.enum(["merge","keep-local","take-hub"]),ft=p.object({adoption:p.object({state:p.enum(["equal","ready","needs-choice"]),strategy:p.union([Je,p.literal("equal")]).nullable().optional(),files:p.array(p.object({path:p.string(),local_path:p.string().nullable().optional(),action:p.string(),proposed:p.string().nullable(),diff_vs_local:p.string(),diff_vs_hub:p.string(),kept:p.record(p.array(p.string())).optional(),engine:p.object({model:p.string().nullable().optional()}).passthrough().optional(),reason:p.string().nullable().optional()}).passthrough()),model:p.string().nullable().optional(),warnings:p.array(p.string()).optional()}).passthrough(),adoption_receipt:p.string().min(16).max(128),snapshot:p.object({path:p.string().min(1),tree_hash:p.string(),manifest:p.array(p.unknown())}).passthrough(),confirmation_required:p.literal(!0)}).passthrough();function Xe(e,t){return!t&&!e.dry_run&&!e.confirmation_required&&e.reports.some(n=>n.applied||n.outcome==="unchanged")}const Ve=12,T={all:["public-teams"],list:(e,t)=>[...T.all,"list",{page:e,perPage:t}],detail:e=>[...T.all,"detail",e]},K=(e,t)=>t instanceof be?t.status===null?!1:t.status>=500&&e<1:e<1,pt=({page:e=1,perPage:t=Ve,enabled:n=!0}={})=>{const s=C({queryKey:T.list(e,t),queryFn:()=>ge(P.radientBaseUrl,e,t),select:i=>i.result,enabled:n,retry:K,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:i=>i});return{...s,teams:s.data?.records??[],isRefreshing:s.isFetching&&s.data!==void 0,pagination:s.data?{page:s.data.page,perPage:s.data.per_page,totalPages:s.data.total_pages,totalRecords:s.data.total_records}:void 0}},bt=({teamId:e,enabled:t=!0})=>{const n=C({queryKey:T.detail(e??""),queryFn:()=>me(P.radientBaseUrl,e),select:s=>s.result,enabled:t&&!!e,retry:K,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...n,team:n.data}};function D(e){if(e.getQueryState(Q.capabilities)?.status!=="success"||!L(e.getQueryData(Q.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function gt(e,t,n){const s=E(),i=ie();return C({queryKey:["hub-skills",P.radientBaseUrl,e.visibility,e.tenantId,t],enabled:n&&!i.isError&&L(i.data,"hub_skills"),queryFn:async()=>{if(D(s),e.visibility==="org"){const o=(await Ge(e.tenantId)).result;return{rows:o.skills,pages:1,total:o.skills.length,contract:o.sync_contract}}const c=(await Qe(P.radientBaseUrl,t,20)).result;return{rows:c.records,pages:c.total_pages,total:c.total_records,contract:c.sync_contract}},staleTime:3e4,retry:e.visibility==="org"?se:K,retryOnMount:!1,refetchOnWindowFocus:!1})}function mt(e,t,n){const s=E(),i=ie();return C({queryKey:["hub-skill",P.radientBaseUrl,e.visibility,e.tenantId,t],enabled:n&&t!==null&&!i.isError&&L(i.data,"hub_skills"),queryFn:async()=>(D(s),(e.visibility==="org"?await Ye(e.tenantId,t):await ze(P.radientBaseUrl,t)).result),staleTime:3e4,retry:e.visibility==="org"?se:K,retryOnMount:!1})}function W(e,t){e.setQueryData(U,t.links)}function H(e){e.invalidateQueries({queryKey:U}),e.invalidateQueries({queryKey:["desktop","skills"]})}function xt(e={}){const t=E();return F({...e.retry===void 0?{}:{retry:e.retry},mutationFn:n=>(D(t),O({op:"hub.skillPull",requestId:n.requestId,hubId:n.remoteId,hubSource:le(P.radientBaseUrl),visibility:n.scope.visibility,tenantId:n.scope.tenantId,localAlias:n.alias,subscribe:n.subscribe,autoPush:n.autoPush,confirmPublicEgress:n.consent,...n.dryRun!==void 0?{dryRun:n.dryRun}:{},...n.adoptionStrategy!==void 0?{adoptionStrategy:n.adoptionStrategy}:{},...n.allowLlm!==void 0?{allowLlm:n.allowLlm}:{},...n.confirm!==void 0?{confirm:n.confirm}:{},...n.adoptionReceipt!==void 0?{adoptionReceipt:n.adoptionReceipt}:{}})),onSuccess:(n,s)=>{Xe(n,s.dryRun)&&W(t,n)},onSettled:(n,s,i)=>{!i.dryRun&&!n?.dry_run&&!n?.confirmation_required&&H(t)}})}function kt(){const e=E();return F({mutationFn:t=>(D(e),O({op:"hub.skillSubscribe",requestId:t.requestId,hubId:t.remoteId,hubSource:le(P.radientBaseUrl),visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias})),onSuccess:t=>{W(e,t)},onSettled:()=>{H(e)}})}function yt(){const e=E();return F({mutationFn:t=>(D(e),O({op:"hub.skillUnpull",requestId:t.requestId,linkId:t.linkId})),onSuccess:t=>{W(e,t)},onSettled:()=>{H(e)}})}function _t(){const e=E();return F({mutationFn:t=>(D(e),O({op:"hub.skillPublish",requestId:t.requestId,...t.draft,dryRun:t.previewReceipt===void 0,...t.previewReceipt?{previewReceipt:t.previewReceipt,confirmPublish:!0}:{}})),onSuccess:t=>{t.local_link_receipt?.state==="complete"&&(e.invalidateQueries({queryKey:U}),e.invalidateQueries({queryKey:["desktop","skills"]}),e.invalidateQueries({queryKey:["hub-skills"]}))}})}const Ze=/\/+$/;function V(e){return e.replace(Ze,"")}function vt(e,t){return t.visibility==="public"?e.visibility==="public"&&!e.tenant_id:e.visibility==="org"&&e.tenant_id===t.tenantId}function et(e){const t=e.id??e.hub_id??"",n=e.tenantId??e.tenant_id??"";return`${t}\0${e.visibility}\0${n}`}function wt(e,t){const n=V(t),s=new Map;for(const i of e??[])i.kind==="skill"&&V(i.hub_source)===n&&s.set(et({hub_id:i.hub_id,visibility:i.visibility,tenantId:i.tenant_id}),i);return s}function jt(e,t,n=!0){if(!n)return{kind:"unknown"};if(!e)return{kind:"not-present"};const s=xe(e);return s==="present"&&(e.pull.state==="available"||t?.state==="available"&&!t.error_class)?{kind:"update",link:e,automatic:t?.auto_will_apply===!0||e.auto_will_apply}:s==="absent"?e.policy.subscribe?{kind:"subscribed",link:e}:{kind:"detached",link:e}:e.policy.subscribe?{kind:"pulled",link:e}:{kind:"manual",link:e}}function Nt(e){return e?"policy":"create"}function St(e){return JSON.stringify({op:"pull",selected:e.selected,scope:e.scope,localAlias:e.localAlias,subscribe:e.subscribe,autoPush:e.autoPush,consent:e.consent})}const tt={available:"text-accent",applied:"text-success",failed:"text-danger",review:"text-warning",updating:"text-ink-muted"},nt={available:"ui.hub.skills.update_available",applied:"ui.hub.skills.update_applied",failed:"ui.hub.skills.update_failed",review:"ui.hub.links.mark_review",updating:"ui.hub.links.mark_busy"},it={"not-present":"ui.hub.skills.not_downloaded",subscribed:"ui.hub.skills.subscribed_absent",pulled:"ui.hub.skills.pulled",manual:"ui.hub.skills.manual",detached:"ui.hub.skills.detached"};function It(e,t,n){const s=t?Z(t):null;return s&&(e.kind==="update"||n&&(t?.state==="applied"||t?.state==="failed"||t?.error_class))?s:e.kind==="update"?{kind:"available",auto:e.automatic}:null}function Rt(e,t){return e.kind==="unknown"?t:e.kind!=="update"?d(it[e.kind]):d(e.link.policy.subscribe?"ui.hub.skills.pulled":"ui.hub.skills.manual")}function Pt({mark:e,className:t,labels:n}){return q(),e?a.jsxs("span",{"data-hub-mark-state":e.kind,className:I("flex shrink-0 items-center gap-1 text-meta",tt[e.kind],t),children:[a.jsx(ee,{mark:e}),a.jsx("span",{children:d(n?.[e.kind]??nt[e.kind])})]}):null}const At=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function Et({value:e,onChange:t,source:n,item:s,visibility:i,organization:c,destinationKey:o,canEnableAutoPush:m,disabled:v=!1}){q();const g=S.useId(),r=S.useRef(null),[f,u]=S.useState(null);return S.useEffect(()=>{f!==null&&f!==o&&u(null)},[f,o]),a.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[a.jsx("p",{className:"text-meta text-ink-muted",children:d("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(l=>a.jsxs("label",{htmlFor:`${g}-${l}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[a.jsx(_e,{id:`${g}-${l}`,checked:e[l],disabled:v||l==="autoPush"&&!m&&!e.autoPush,onCheckedChange:y=>{l==="subscribe"?t({...e,subscribe:y===!0}):y!==!0?t({...e,autoPush:!1,confirmPublicEgress:!1}):m&&u(o)}}),a.jsxs("span",{children:[a.jsx("span",{className:"block",children:d(l==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),a.jsx("span",{className:"block text-meta text-ink-muted",children:d(l==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:n})})]})]},l)),!m&&a.jsx("p",{className:"text-meta text-ink-muted",children:d("ui.hub.subscriptions.unsupported")}),a.jsx(ve,{open:f!==null,onOpenChange:l=>{l||u(null)},children:a.jsxs(we,{onOpenAutoFocus:l=>{l.preventDefault(),r.current?.focus()},children:[a.jsxs(je,{children:[a.jsx(Ne,{children:d("ui.hub.subscriptions.enable_title",{source:n})}),a.jsx(Se,{children:i==="public"?d("ui.hub.subscriptions.enable_public",{item:s}):d("ui.hub.subscriptions.enable_private",{item:s,organization:c??n})})]}),a.jsx("p",{className:"text-body-sm text-ink-muted",children:d("ui.hub.subscriptions.enable_safety")}),a.jsxs(Ie,{children:[a.jsx(A,{ref:r,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>u(null),children:d("ui.hub.subscriptions.cancel")}),a.jsx(A,{"data-testid":"hub-policy-enable",disabled:v||!m||f!==o,onClick:()=>{t({...e,autoPush:!0,confirmPublicEgress:i==="public"}),u(null)},children:d("ui.hub.subscriptions.enable")})]})]})})]})}function Dt(e,t,n=Date.now()){return e.can_confirm===!0&&e.kind==="skill"&&e.direction==="push"&&e.publication==="create"&&e.proposal?.kind==="skill"&&e.proposal.fields?.document_version===1&&e.preview_receipt.length>0&&e.local_fingerprint.length>0&&e.draft_fingerprint.length>0&&e.proposal_fingerprint.length>0&&e.source_skill===t.sourceSkill&&e.local_alias===t.localAlias&&e.visibility===t.visibility&&e.tenant_id===t.tenantId&&e.policy?.subscribe===t.subscribe&&e.policy?.auto_push===t.autoPush&&e.policy?.confirm_public_egress===t.confirmPublicEgress&&Number.isFinite(Date.parse(e.expires_at))&&Date.parse(e.expires_at)>n}function qt(e){return e.local_link_receipt?.state==="complete"&&!!e.link&&e.local_link_receipt.link_id===e.link.link_id&&typeof e.link.policy?.subscribe=="boolean"&&typeof e.link.policy.auto_push=="boolean"&&typeof e.link.policy.revision=="string"&&e.link.policy.revision.length>0}const st=e=>e==="active"||e==="past_due",ce=e=>e.status!=="active"?"no_access":st(e.plan.status)?"available":"plan_inactive",Mt=e=>e.filter(t=>ce(t)==="available"),Tt=e=>e.filter(t=>ce(t)==="plan_inactive"),Ct=e=>{if(!(e instanceof Re))return null;switch(e.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{Tt as A,Et as H,Ve as P,Pt as S,$e as U,ft as a,_t as b,gt as c,mt as d,kt as e,yt as f,wt as g,ht as h,Dt as i,le as j,vt as k,et as l,jt as m,At as n,It as o,qt as p,Rt as q,dt as r,Xe as s,St as t,xt as u,Nt as v,Ct as w,pt as x,bt as y,Mt as z};
@@ -1 +1 @@
1
- import{b as e}from"./appearance-DCqlsN7S.js";import{t as n}from"./messages-B7aIuFuF.js";import"./index-BWQzFq0n.js";const a=()=>n("ui.hub.pages.orgs_below_version"),u=o=>o==="enabled",s=(o,r)=>o==="enabled"||o==="unknown"?null:e(o,r)??a();export{u as a,s as o};
1
+ import{b as e}from"./appearance-DO4VPBSi.js";import{t as n}from"./messages-BYDbMAVA.js";import"./index-D0qlrLIs.js";const a=()=>n("ui.hub.pages.orgs_below_version"),u=o=>o==="enabled",s=(o,r)=>o==="enabled"||o==="unknown"?null:e(o,r)??a();export{u as a,s as o};
@@ -1 +1 @@
1
- import{j as e}from"./index-BWQzFq0n.js";const l=({title:a,icon:t,subtitle:s,children:i})=>e.jsxs("div",{className:"@container flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[e.jsx(t,{size:24,"aria-hidden":"true",className:"mt-1 shrink-0 text-ink-muted"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h1",{className:"text-display text-ink",children:a}),s&&e.jsx("p",{className:"max-w-200 text-body text-ink-muted",children:s})]})]}),i]});export{l as P};
1
+ import{j as e}from"./index-D0qlrLIs.js";const l=({title:a,icon:t,subtitle:s,children:i})=>e.jsxs("div",{className:"@container flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[e.jsx(t,{size:24,"aria-hidden":"true",className:"mt-1 shrink-0 text-ink-muted"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h1",{className:"text-display text-ink",children:a}),s&&e.jsx("p",{className:"max-w-200 text-body text-ink-muted",children:s})]})]}),i]});export{l as P};
@@ -1,4 +1,4 @@
1
- import{p as V}from"./chunk-4BMEZGHF-Cw4VudrA.js";import{_ as p,g as U,s as j,a as q,b as H,t as K,q as Q,l as F,c as Z,F as J,K as X,Q as Y,e as tt,z as et,H as at}from"./mermaid.core-D7wfsRjY.js";import{p as rt}from"./radar-MK3ICKWK-VE0niGVF.js";import{d as P}from"./arc-BOZHzyJm.js";import{a as y,t as z,aE as nt,aF as it}from"./conversation-input-sync-DlorrZ6B.js";import"./index-BWQzFq0n.js";import"./messages-B7aIuFuF.js";import"./_baseUniq-Clx9gdFs.js";import"./_basePickBy-BeAzmqgq.js";import"./clone-B9GxWhWi.js";import"./appearance-DCqlsN7S.js";import"./roles-D1pcbxAx.js";import"./error-boundary-C1x5W-AX.js";function st(t,a){return a<t?-1:a>t?1:a>=t?0:NaN}function ot(t){return t}function lt(){var t=ot,a=st,m=null,s=y(0),u=y(z),x=y(0);function i(e){var r,l=(e=nt(e)).length,d,A,h=0,c=new Array(l),n=new Array(l),v=+s.apply(this,arguments),w=Math.min(z,Math.max(-z,u.apply(this,arguments)-v)),f,T=Math.min(Math.abs(w)/l,x.apply(this,arguments)),$=T*(w<0?-1:1),g;for(r=0;r<l;++r)(g=n[c[r]=r]=+t(e[r],r,e))>0&&(h+=g);for(a!=null?c.sort(function(S,C){return a(n[S],n[C])}):m!=null&&c.sort(function(S,C){return m(e[S],e[C])}),r=0,A=h?(w-l*$)/h:0;r<l;++r,v=f)d=c[r],g=n[d],f=v+(g>0?g*A:0)+$,n[d]={data:e[d],index:r,value:g,startAngle:v,endAngle:f,padAngle:T};return n}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:y(+e),i):t},i.sortValues=function(e){return arguments.length?(a=e,m=null,i):a},i.sort=function(e){return arguments.length?(m=e,a=null,i):m},i.startAngle=function(e){return arguments.length?(s=typeof e=="function"?e:y(+e),i):s},i.endAngle=function(e){return arguments.length?(u=typeof e=="function"?e:y(+e),i):u},i.padAngle=function(e){return arguments.length?(x=typeof e=="function"?e:y(+e),i):x},i}var ct=at.pie,G={sections:new Map,showData:!1},b=G.sections,W=G.showData,pt=structuredClone(ct),ut=p(()=>structuredClone(pt),"getConfig"),dt=p(()=>{b=new Map,W=G.showData,et()},"clear"),gt=p(({label:t,value:a})=>{b.has(t)||(b.set(t,a),F.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),ft=p(()=>b,"getSections"),mt=p(t=>{W=t},"setShowData"),ht=p(()=>W,"getShowData"),R={getConfig:ut,clear:dt,setDiagramTitle:Q,getDiagramTitle:K,setAccTitle:H,getAccTitle:q,setAccDescription:j,getAccDescription:U,addSection:gt,getSections:ft,setShowData:mt,getShowData:ht},vt=p((t,a)=>{V(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),St={parse:p(async t=>{const a=await rt("pie",t);F.debug(a),vt(a,R)},"parse")},yt=p(t=>`
1
+ import{p as V}from"./chunk-4BMEZGHF-CpC8J2AT.js";import{_ as p,g as U,s as j,a as q,b as H,t as K,q as Q,l as F,c as Z,F as J,K as X,Q as Y,e as tt,z as et,H as at}from"./mermaid.core-BcJdc-X6.js";import{p as rt}from"./radar-MK3ICKWK-B97TgRmB.js";import{d as P}from"./arc-Cv6N9gTJ.js";import{a as y,t as z,aE as nt,aF as it}from"./conversation-input-sync-FnnZiNnd.js";import"./index-D0qlrLIs.js";import"./messages-BYDbMAVA.js";import"./_baseUniq-BGD19KIN.js";import"./_basePickBy-D2upKftS.js";import"./clone-_NlCUljT.js";import"./appearance-DO4VPBSi.js";import"./roles-D1pcbxAx.js";import"./error-boundary-BsWceBKP.js";function st(t,a){return a<t?-1:a>t?1:a>=t?0:NaN}function ot(t){return t}function lt(){var t=ot,a=st,m=null,s=y(0),u=y(z),x=y(0);function i(e){var r,l=(e=nt(e)).length,d,A,h=0,c=new Array(l),n=new Array(l),v=+s.apply(this,arguments),w=Math.min(z,Math.max(-z,u.apply(this,arguments)-v)),f,T=Math.min(Math.abs(w)/l,x.apply(this,arguments)),$=T*(w<0?-1:1),g;for(r=0;r<l;++r)(g=n[c[r]=r]=+t(e[r],r,e))>0&&(h+=g);for(a!=null?c.sort(function(S,C){return a(n[S],n[C])}):m!=null&&c.sort(function(S,C){return m(e[S],e[C])}),r=0,A=h?(w-l*$)/h:0;r<l;++r,v=f)d=c[r],g=n[d],f=v+(g>0?g*A:0)+$,n[d]={data:e[d],index:r,value:g,startAngle:v,endAngle:f,padAngle:T};return n}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:y(+e),i):t},i.sortValues=function(e){return arguments.length?(a=e,m=null,i):a},i.sort=function(e){return arguments.length?(m=e,a=null,i):m},i.startAngle=function(e){return arguments.length?(s=typeof e=="function"?e:y(+e),i):s},i.endAngle=function(e){return arguments.length?(u=typeof e=="function"?e:y(+e),i):u},i.padAngle=function(e){return arguments.length?(x=typeof e=="function"?e:y(+e),i):x},i}var ct=at.pie,G={sections:new Map,showData:!1},b=G.sections,W=G.showData,pt=structuredClone(ct),ut=p(()=>structuredClone(pt),"getConfig"),dt=p(()=>{b=new Map,W=G.showData,et()},"clear"),gt=p(({label:t,value:a})=>{b.has(t)||(b.set(t,a),F.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),ft=p(()=>b,"getSections"),mt=p(t=>{W=t},"setShowData"),ht=p(()=>W,"getShowData"),R={getConfig:ut,clear:dt,setDiagramTitle:Q,getDiagramTitle:K,setAccTitle:H,getAccTitle:q,setAccDescription:j,getAccDescription:U,addSection:gt,getSections:ft,setShowData:mt,getShowData:ht},vt=p((t,a)=>{V(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),St={parse:p(async t=>{const a=await rt("pie",t);F.debug(a),vt(a,R)},"parse")},yt=p(t=>`
2
2
  .pieCircle{
3
3
  stroke: ${t.pieStrokeColor};
4
4
  stroke-width : ${t.pieStrokeWidth};
@@ -1,4 +1,4 @@
1
- import{j as e,c as L,r as m}from"./index-BWQzFq0n.js";import{t as n}from"./messages-B7aIuFuF.js";import{ak as ms,m as fs,j as js,al as _s,ai as Pt,i as se,a as Ot,d as Pe,f as It,o as hs,am as ft,an as xs,e as gs,g as bs}from"./appearance-DCqlsN7S.js";import{c as Ft,u as G,U as Ke,w as Ut,V as Ve,W as Ge,Y as Ye,Z as Oe,B as W,D as vs,g as ys,S as Ze,i as ws,I as Le,_ as ks,$ as Ns,a0 as Ss,j as Cs,k as Es,H as Ds,e as Fe,a1 as et,a2 as tt,a3 as st,L as ee,K as ue,r as Ts,a as Rs,M as As,X as Bt,N as Ls,O as Ms,P as Ps,A as jt,l as ye}from"./error-boundary-C1x5W-AX.js";import{bt as Os,aD as Is,b$ as Fs,bk as Us,bl as Bs,c0 as zs,c1 as zt,bn as $s,bU as Hs,c2 as qs,b1 as Ws,c3 as Ks,c4 as _t,ac as Me,aj as ht}from"./conversation-input-sync-DlorrZ6B.js";import{P as xt}from"./page-header-CAW9G_fb.js";import{b0 as Z,b1 as $t,b2 as Q,b3 as de,b4 as Ht,b5 as De,b6 as we,b7 as ke,b8 as Vs,b9 as Gs,ba as Ys,bb as Xs,bc as Js,bd as Qs,be as rt,bf as Zs,bg as qt,bh as er,bi as Wt,bj as tr,bk as sr,bl as rr,bm as nr,bn as ar,bo as or,bp as ir,bq as gt,br as cr,bs as lr,bt as ur,bu as dr,bv as Kt,bw as pr,bx as mr,by as bt,bz as fr,bA as jr,bB as _r,bC as vt,bD as hr,bE as xr,bF as gr,bG as br,bH as Vt,bI as vr,b as Xe,bJ as He,bK as yr,bL as wr,bM as kr,bN as Nr,bO as Sr,bP as yt,bQ as Cr,bR as Er,bS as Dr,R as Tr,bT as wt,bU as Rr,bV as Ar,bW as Lr}from"./index-Buuz619t.js";import"./roles-D1pcbxAx.js";import"./console-mirror-IB35kNI8.js";/**
1
+ import{j as e,c as L,r as m}from"./index-D0qlrLIs.js";import{t as n}from"./messages-BYDbMAVA.js";import{ak as ms,m as fs,j as js,al as _s,ai as Pt,i as se,a as Ot,d as Pe,f as It,o as hs,am as ft,an as xs,e as gs,g as bs}from"./appearance-DO4VPBSi.js";import{c as Ft,u as G,U as Ke,w as Ut,V as Ve,W as Ge,Y as Ye,Z as Oe,B as W,D as vs,g as ys,S as Ze,i as ws,I as Le,_ as ks,$ as Ns,a0 as Ss,j as Cs,k as Es,H as Ds,e as Fe,a1 as et,a2 as tt,a3 as st,L as ee,K as ue,r as Ts,a as Rs,M as As,X as Bt,N as Ls,O as Ms,P as Ps,A as jt,l as ye}from"./error-boundary-BsWceBKP.js";import{bt as Os,aD as Is,b$ as Fs,bk as Us,bl as Bs,c0 as zs,c1 as zt,bn as $s,bU as Hs,c2 as qs,b1 as Ws,c3 as Ks,c4 as _t,ac as Me,aj as ht}from"./conversation-input-sync-FnnZiNnd.js";import{P as xt}from"./page-header-DXwYxMB-.js";import{b0 as Z,b1 as $t,b2 as Q,b3 as de,b4 as Ht,b5 as De,b6 as we,b7 as ke,b8 as Vs,b9 as Gs,ba as Ys,bb as Xs,bc as Js,bd as Qs,be as rt,bf as Zs,bg as qt,bh as er,bi as Wt,bj as tr,bk as sr,bl as rr,bm as nr,bn as ar,bo as or,bp as ir,bq as gt,br as cr,bs as lr,bt as ur,bu as dr,bv as Kt,bw as pr,bx as mr,by as bt,bz as fr,bA as jr,bB as _r,bC as vt,bD as hr,bE as xr,bF as gr,bG as br,bH as Vt,bI as vr,b as Xe,bJ as He,bK as yr,bL as wr,bM as kr,bN as Nr,bO as Sr,bP as yt,bQ as Cr,bR as Er,bS as Dr,R as Tr,bT as wt,bU as Rr,bV as Ar,bW as Lr}from"./index-BKh47kLl.js";import"./roles-D1pcbxAx.js";import"./console-mirror-Bp3thuUi.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{n as f,k as v,p as c,P as w,m as A,r as L,q as T,s as P,t as R,v as N}from"./appearance-DCqlsN7S.js";import{aA as S,aB as E,aC as O}from"./conversation-input-sync-DlorrZ6B.js";import{t as e}from"./messages-B7aIuFuF.js";import"./index-BWQzFq0n.js";import{l as q,c as C}from"./index-Buuz619t.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},U=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function j(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Z(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:j(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:U(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry","open-console"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],F=/^(\d{3})\b/,B=new Set([404,410]),I=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],D=n=>{const t=n.toLowerCase();return I.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return B.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),J=(n,t,i)=>n==="download"?K(t,i):f(M(),t),V={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")},get"open-console"(){return e("ui.chat.radient_session.action.open_console")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await q(d,n,t,s):await C(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{V as P,J as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Z as p,oe as t,ie as u};
1
+ import{n as f,k as v,p as c,P as w,m as A,r as L,q as T,s as P,t as R,v as N}from"./appearance-DO4VPBSi.js";import{aA as S,aB as E,aC as O}from"./conversation-input-sync-FnnZiNnd.js";import{t as e}from"./messages-BYDbMAVA.js";import"./index-D0qlrLIs.js";import{l as q,c as C}from"./index-BKh47kLl.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},U=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function j(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Z(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:j(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:U(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry","open-console"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],F=/^(\d{3})\b/,B=new Set([404,410]),I=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],D=n=>{const t=n.toLowerCase();return I.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return B.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),J=(n,t,i)=>n==="download"?K(t,i):f(M(),t),V={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")},get"open-console"(){return e("ui.chat.radient_session.action.open_console")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await q(d,n,t,s):await C(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{V as P,J as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Z as p,oe as t,ie as u};
@@ -1,4 +1,4 @@
1
- import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as mt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-D7wfsRjY.js";import{l as $t}from"./conversation-input-sync-DlorrZ6B.js";import"./index-BWQzFq0n.js";import"./messages-B7aIuFuF.js";import"./appearance-DCqlsN7S.js";import"./roles-D1pcbxAx.js";import"./error-boundary-C1x5W-AX.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],q=[1,37],b=[1,36],y=[1,38],T=[1,35],m=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:q,5:b,10:y,12:T,13:m,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var me=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(qe,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
1
+ import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as mt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-BcJdc-X6.js";import{l as $t}from"./conversation-input-sync-FnnZiNnd.js";import"./index-D0qlrLIs.js";import"./messages-BYDbMAVA.js";import"./appearance-DO4VPBSi.js";import"./roles-D1pcbxAx.js";import"./error-boundary-BsWceBKP.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],q=[1,37],b=[1,36],y=[1,38],T=[1,35],m=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:q,5:b,10:y,12:T,13:m,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var me=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(qe,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
2
2
  `+E.showPosition()+`
3
3
  Expecting `+yt.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(w==Kt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Pt,{text:E.match,token:this.terminals_[w]||w,line:E.yylineno,loc:kt,expected:yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+w);switch(N[0]){case 1:u.push(w),A.push(E.yytext),e.push(E.yylloc),u.push(N[1]),w=null,Gt=E.yyleng,n=E.yytext,gt=E.yylineno,kt=E.yylloc;break;case 2:if(X=this.productions_[N[1]][1],st.$=A[A.length-X],st._$={first_line:e[e.length-(X||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(X||1)].first_column,last_column:e[e.length-1].last_column},me&&(st._$.range=[e[e.length-(X||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(st,[n,Gt,gt,Y.yy,N[1],A,e].concat(Te)),typeof Ft<"u")return Ft;X&&(u=u.slice(0,-1*X*2),A=A.slice(0,-1*X),e=e.slice(0,-1*X)),u.push(this.productions_[N[1]][0]),A.push(st.$),e.push(st._$),Jt=ht[u[u.length-2]][u[u.length-1]],u.push(Jt);break;case 3:return!0}}return!0},"parse")},pe=function(){var M={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+`