agent-relay-server 0.127.3 → 0.127.4

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 (147) hide show
  1. package/docs/openapi.json +1 -1
  2. package/package.json +3 -3
  3. package/public/assets/{MessageBubble-DnXnkt4a.js → MessageBubble-D2Wzxied.js} +2 -2
  4. package/public/assets/{MessageBubble-DnXnkt4a.js.map → MessageBubble-D2Wzxied.js.map} +1 -1
  5. package/public/assets/{PlanGraphPanel-D6CPEpQD.js → PlanGraphPanel-DH_xoWZi.js} +2 -2
  6. package/public/assets/{PlanGraphPanel-D6CPEpQD.js.map → PlanGraphPanel-DH_xoWZi.js.map} +1 -1
  7. package/public/assets/{activity-ZPwHcPLK.js → activity-B-ozOwNq.js} +2 -2
  8. package/public/assets/{activity-ZPwHcPLK.js.map → activity-B-ozOwNq.js.map} +1 -1
  9. package/public/assets/{agent-profiles-CT0E9LV1.js → agent-profiles-DZgjO25A.js} +2 -2
  10. package/public/assets/{agent-profiles-CT0E9LV1.js.map → agent-profiles-DZgjO25A.js.map} +1 -1
  11. package/public/assets/{agent-type-icon-BmBR-9CH.js → agent-type-icon-B9cLaOoz.js} +2 -2
  12. package/public/assets/{agent-type-icon-BmBR-9CH.js.map → agent-type-icon-B9cLaOoz.js.map} +1 -1
  13. package/public/assets/agents-mXBLSY6O.js +2 -0
  14. package/public/assets/{agents-Dt5TncjC.js.map → agents-mXBLSY6O.js.map} +1 -1
  15. package/public/assets/{analytics-BZtRycyL.js → analytics-5Ize_UL5.js} +3 -3
  16. package/public/assets/{analytics-BZtRycyL.js.map → analytics-5Ize_UL5.js.map} +1 -1
  17. package/public/assets/{automation-yzUJbvT2.js → automation-CidMvW2e.js} +2 -2
  18. package/public/assets/{automation-yzUJbvT2.js.map → automation-CidMvW2e.js.map} +1 -1
  19. package/public/assets/{badge-BCvp7LK3.js → badge-BkNNvFNa.js} +2 -2
  20. package/public/assets/{badge-BCvp7LK3.js.map → badge-BkNNvFNa.js.map} +1 -1
  21. package/public/assets/{branch-state-badge-Cscjqf-E.js → branch-state-badge-DnS40KCb.js} +2 -2
  22. package/public/assets/{branch-state-badge-Cscjqf-E.js.map → branch-state-badge-DnS40KCb.js.map} +1 -1
  23. package/public/assets/{button-DyHjsHY3.js → button-DUaC2wSQ.js} +2 -2
  24. package/public/assets/{button-DyHjsHY3.js.map → button-DUaC2wSQ.js.map} +1 -1
  25. package/public/assets/{card-BoqYxpVW.js → card-r-yAV4cH.js} +2 -2
  26. package/public/assets/{card-BoqYxpVW.js.map → card-r-yAV4cH.js.map} +1 -1
  27. package/public/assets/{channels-DAtOnA6o.js → channels-MPO2FOBv.js} +2 -2
  28. package/public/assets/{channels-DAtOnA6o.js.map → channels-MPO2FOBv.js.map} +1 -1
  29. package/public/assets/chat-Ca4ERso5.js +2 -0
  30. package/public/assets/chat-Ca4ERso5.js.map +1 -0
  31. package/public/assets/{connectors-B2grC-hl.js → connectors-BbYdtRkW.js} +2 -2
  32. package/public/assets/{connectors-B2grC-hl.js.map → connectors-BbYdtRkW.js.map} +1 -1
  33. package/public/assets/copy-button-u463GPZR.js +2 -0
  34. package/public/assets/{copy-button-C67FUG3E.js.map → copy-button-u463GPZR.js.map} +1 -1
  35. package/public/assets/{display-aTnwsqQh.js → display-BNI-7rdq.js} +2 -2
  36. package/public/assets/{display-aTnwsqQh.js.map → display-BNI-7rdq.js.map} +1 -1
  37. package/public/assets/{dist-D5w04z0l.js → dist-5e_is3Xr.js} +2 -2
  38. package/public/assets/{dist-D5w04z0l.js.map → dist-5e_is3Xr.js.map} +1 -1
  39. package/public/assets/{dist-BD4Xc13v.js → dist-ActI2qb5.js} +2 -2
  40. package/public/assets/{dist-BD4Xc13v.js.map → dist-ActI2qb5.js.map} +1 -1
  41. package/public/assets/dist-B-FQ0-X3.js +2 -0
  42. package/public/assets/{dist-G8YBD-wp.js.map → dist-B-FQ0-X3.js.map} +1 -1
  43. package/public/assets/{dist-f6MW74eX.js → dist-BduURKro.js} +2 -2
  44. package/public/assets/{dist-f6MW74eX.js.map → dist-BduURKro.js.map} +1 -1
  45. package/public/assets/{dist-BFDfbfNC.js → dist-Bp0-OBcd.js} +2 -2
  46. package/public/assets/{dist-BFDfbfNC.js.map → dist-Bp0-OBcd.js.map} +1 -1
  47. package/public/assets/{dist-C_VOBSaK.js → dist-CJ7e7uqU.js} +2 -2
  48. package/public/assets/{dist-C_VOBSaK.js.map → dist-CJ7e7uqU.js.map} +1 -1
  49. package/public/assets/{dist-BNB3fTO-.js → dist-CYzOsD_n.js} +2 -2
  50. package/public/assets/{dist-BNB3fTO-.js.map → dist-CYzOsD_n.js.map} +1 -1
  51. package/public/assets/{dist-CQMQ5iku.js → dist-CpcQJrKV.js} +2 -2
  52. package/public/assets/{dist-CQMQ5iku.js.map → dist-CpcQJrKV.js.map} +1 -1
  53. package/public/assets/dist-DFgmDjLv.js +2 -0
  54. package/public/assets/{dist-CHKra2JV.js.map → dist-DFgmDjLv.js.map} +1 -1
  55. package/public/assets/{dist-DG75bvPp.js → dist-DrpSpMKL.js} +2 -2
  56. package/public/assets/{dist-DG75bvPp.js.map → dist-DrpSpMKL.js.map} +1 -1
  57. package/public/assets/dist-DzWoiN2z.js +2 -0
  58. package/public/assets/{dist-BJKxqIQd.js.map → dist-DzWoiN2z.js.map} +1 -1
  59. package/public/assets/{es2015-a6fysEVz.js → es2015-DNuudVtQ.js} +2 -2
  60. package/public/assets/{es2015-a6fysEVz.js.map → es2015-DNuudVtQ.js.map} +1 -1
  61. package/public/assets/formatted-body-BEI1zP7i.js +3 -0
  62. package/public/assets/{formatted-body-D5-1aiyB.js.map → formatted-body-BEI1zP7i.js.map} +1 -1
  63. package/public/assets/{formatted-body-impl-Do5NbJUA.js → formatted-body-impl-CNQ5sqwK.js} +2 -2
  64. package/public/assets/{formatted-body-impl-Do5NbJUA.js.map → formatted-body-impl-CNQ5sqwK.js.map} +1 -1
  65. package/public/assets/index-D2Mpzpft.js +26 -0
  66. package/public/assets/{index-BdNafiPz.js.map → index-D2Mpzpft.js.map} +1 -1
  67. package/public/assets/{input-Rc4oWv4q.js → input-BvNUEkDd.js} +2 -2
  68. package/public/assets/{input-Rc4oWv4q.js.map → input-BvNUEkDd.js.map} +1 -1
  69. package/public/assets/{insights-i6AEZT_a.js → insights-5rkMFRgf.js} +2 -2
  70. package/public/assets/{insights-i6AEZT_a.js.map → insights-5rkMFRgf.js.map} +1 -1
  71. package/public/assets/{integrations-9c6IdRU4.js → integrations-BEaqjfP4.js} +2 -2
  72. package/public/assets/{integrations-9c6IdRU4.js.map → integrations-BEaqjfP4.js.map} +1 -1
  73. package/public/assets/{lib-BZ6WPg2t.js → lib-BvrbNA2I.js} +2 -2
  74. package/public/assets/{lib-BZ6WPg2t.js.map → lib-BvrbNA2I.js.map} +1 -1
  75. package/public/assets/{lucide-react-NXHPIMsX.js → lucide-react-DD_zIava.js} +2 -2
  76. package/public/assets/{lucide-react-NXHPIMsX.js.map → lucide-react-DD_zIava.js.map} +1 -1
  77. package/public/assets/maintenance-CEiURaYZ.js +2 -0
  78. package/public/assets/{maintenance-CJ6wikpg.js.map → maintenance-CEiURaYZ.js.map} +1 -1
  79. package/public/assets/{managed-agents-JZn0xNJR.js → managed-agents-CetHyuQW.js} +4 -4
  80. package/public/assets/{managed-agents-JZn0xNJR.js.map → managed-agents-CetHyuQW.js.map} +1 -1
  81. package/public/assets/{markdown-preview-impl-BsvAkpR4.js → markdown-preview-impl-ZwGYvObh.js} +2 -2
  82. package/public/assets/{markdown-preview-impl-BsvAkpR4.js.map → markdown-preview-impl-ZwGYvObh.js.map} +1 -1
  83. package/public/assets/memory-BTm8XzCg.js +2 -0
  84. package/public/assets/{memory-BE9IwCdC.js.map → memory-BTm8XzCg.js.map} +1 -1
  85. package/public/assets/{messages-vXgdc3H4.js → messages-fJd17pzv.js} +2 -2
  86. package/public/assets/{messages-vXgdc3H4.js.map → messages-fJd17pzv.js.map} +1 -1
  87. package/public/assets/{orchestrators-CribhLg-.js → orchestrators-C5XQ2UYy.js} +2 -2
  88. package/public/assets/{orchestrators-CribhLg-.js.map → orchestrators-C5XQ2UYy.js.map} +1 -1
  89. package/public/assets/overview-Bhk-tqKc.js +2 -0
  90. package/public/assets/{overview-q3O9K9VK.js.map → overview-Bhk-tqKc.js.map} +1 -1
  91. package/public/assets/{pairs-BNOnd0IE.js → pairs-CBrszSZh.js} +2 -2
  92. package/public/assets/{pairs-BNOnd0IE.js.map → pairs-CBrszSZh.js.map} +1 -1
  93. package/public/assets/{projects-iDkxAGBW.js → projects-DXy9JviE.js} +2 -2
  94. package/public/assets/{projects-iDkxAGBW.js.map → projects-DXy9JviE.js.map} +1 -1
  95. package/public/assets/prompt-settings-DEQhAt2X.js +2 -0
  96. package/public/assets/{prompt-settings-Bdz_xCgD.js.map → prompt-settings-DEQhAt2X.js.map} +1 -1
  97. package/public/assets/{react-dom-8yaD9iJG.js → react-dom-CADlISeR.js} +2 -2
  98. package/public/assets/{react-dom-8yaD9iJG.js.map → react-dom-CADlISeR.js.map} +1 -1
  99. package/public/assets/{registry-DPcyGypi.js → registry-DsZILce1.js} +4 -4
  100. package/public/assets/{registry-DPcyGypi.js.map → registry-DsZILce1.js.map} +1 -1
  101. package/public/assets/{security-Z3l3u-Pl.js → security-C-wVZm5k.js} +2 -2
  102. package/public/assets/{security-Z3l3u-Pl.js.map → security-C-wVZm5k.js.map} +1 -1
  103. package/public/assets/{select-BX_lW49D.js → select-DsEGBLJk.js} +2 -2
  104. package/public/assets/{select-BX_lW49D.js.map → select-DsEGBLJk.js.map} +1 -1
  105. package/public/assets/settings-D3_r5IGA.js +6 -0
  106. package/public/assets/{settings-Y381jZt7.js.map → settings-D3_r5IGA.js.map} +1 -1
  107. package/public/assets/{store-D-Frk_EC.js → store-DKTb9O0v.js} +5 -5
  108. package/public/assets/{store-D-Frk_EC.js.map → store-DKTb9O0v.js.map} +1 -1
  109. package/public/assets/{task-chip-CeujtXYT.js → task-chip-DwdauC08.js} +2 -2
  110. package/public/assets/{task-chip-CeujtXYT.js.map → task-chip-DwdauC08.js.map} +1 -1
  111. package/public/assets/{tasks-Di6d0_Ch.js → tasks-DnEzBku4.js} +2 -2
  112. package/public/assets/{tasks-Di6d0_Ch.js.map → tasks-DnEzBku4.js.map} +1 -1
  113. package/public/assets/{teams-DJv4l-_l.js → teams-DpAbZ3ye.js} +2 -2
  114. package/public/assets/{teams-DJv4l-_l.js.map → teams-DpAbZ3ye.js.map} +1 -1
  115. package/public/assets/{terminal-viewer-impl-3zBLpRel.js → terminal-viewer-impl-_IU5o8ya.js} +3 -3
  116. package/public/assets/{terminal-viewer-impl-3zBLpRel.js.map → terminal-viewer-impl-_IU5o8ya.js.map} +1 -1
  117. package/public/assets/types-BqeSkWrv.js.map +1 -1
  118. package/public/assets/{use-keyboard-viewport-cGEmrGE7.js → use-keyboard-viewport-wTh5CR4-.js} +2 -2
  119. package/public/assets/{use-keyboard-viewport-cGEmrGE7.js.map → use-keyboard-viewport-wTh5CR4-.js.map} +1 -1
  120. package/public/assets/user-avatar-CZ3XO8ml.js +2 -0
  121. package/public/assets/{user-avatar-qbo-B3dQ.js.map → user-avatar-CZ3XO8ml.js.map} +1 -1
  122. package/public/assets/{work-queue-D73-hP0c.js → work-queue-DKcLZWRl.js} +2 -2
  123. package/public/assets/{work-queue-D73-hP0c.js.map → work-queue-DKcLZWRl.js.map} +1 -1
  124. package/public/assets/workspaces-Cs2IZZOI.js +3 -0
  125. package/public/assets/{workspaces-CoDz-iZd.js.map → workspaces-Cs2IZZOI.js.map} +1 -1
  126. package/public/index.html +24 -24
  127. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  128. package/runner/src/adapters/claude-transcript.ts +52 -3
  129. package/runner/src/control-server.ts +34 -17
  130. package/runner/src/runner-core.ts +64 -30
  131. package/src/db/messages.ts +20 -8
  132. package/public/assets/agents-Dt5TncjC.js +0 -2
  133. package/public/assets/chat-DhYX9BDG.js +0 -2
  134. package/public/assets/chat-DhYX9BDG.js.map +0 -1
  135. package/public/assets/copy-button-C67FUG3E.js +0 -2
  136. package/public/assets/dist-BJKxqIQd.js +0 -2
  137. package/public/assets/dist-CHKra2JV.js +0 -2
  138. package/public/assets/dist-G8YBD-wp.js +0 -2
  139. package/public/assets/formatted-body-D5-1aiyB.js +0 -3
  140. package/public/assets/index-BdNafiPz.js +0 -26
  141. package/public/assets/maintenance-CJ6wikpg.js +0 -2
  142. package/public/assets/memory-BE9IwCdC.js +0 -2
  143. package/public/assets/overview-q3O9K9VK.js +0 -2
  144. package/public/assets/prompt-settings-Bdz_xCgD.js +0 -2
  145. package/public/assets/settings-Y381jZt7.js +0 -6
  146. package/public/assets/user-avatar-qbo-B3dQ.js +0 -2
  147. package/public/assets/workspaces-CoDz-iZd.js +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"card-BoqYxpVW.js","names":[],"sources":["../../dashboard/src/components/ui/card.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Card({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & { size?: \"default\" | \"sm\" }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n \"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n"],"mappings":"0GAIA,SAAS,EAAK,CACZ,YACA,OAAO,UACP,GAAG,GACyD,CAC5D,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,OACV,YAAW,EACX,UAAW,EACT,uVACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,qSACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAU,CAAE,YAAW,GAAG,GAAsC,CACvE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,aACV,UAAW,EACT,oFACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAsC,CAC7E,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,mBACV,UAAW,EAAG,gCAAiC,EAAU,CACzD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,iEACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAAW,GAAG,GAAsC,CACzE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,eACV,UAAW,EAAG,sCAAuC,EAAU,CAC/D,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,wFACA,EACD,CACD,GAAI,EACJ,CAAA"}
1
+ {"version":3,"file":"card-r-yAV4cH.js","names":[],"sources":["../../dashboard/src/components/ui/card.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Card({\n className,\n size = \"default\",\n ...props\n}: React.ComponentProps<\"div\"> & { size?: \"default\" | \"sm\" }) {\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(\n \"group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\n \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-title\"\n className={cn(\n \"font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-action\"\n className={cn(\n \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"px-4 group-data-[size=sm]/card:px-3\", className)}\n {...props}\n />\n )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n}\n"],"mappings":"0GAIA,SAAS,EAAK,CACZ,YACA,OAAO,UACP,GAAG,GACyD,CAC5D,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,OACV,YAAW,EACX,UAAW,EACT,uVACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,qSACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAU,CAAE,YAAW,GAAG,GAAsC,CACvE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,aACV,UAAW,EACT,oFACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAsC,CAC7E,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,mBACV,UAAW,EAAG,gCAAiC,EAAU,CACzD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,iEACA,EACD,CACD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAAW,GAAG,GAAsC,CACzE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,eACV,UAAW,EAAG,sCAAuC,EAAU,CAC/D,GAAI,EACJ,CAAA,CAIN,SAAS,EAAW,CAAE,YAAW,GAAG,GAAsC,CACxE,OACE,EAAA,EAAA,KAAC,MAAD,CACE,YAAU,cACV,UAAW,EACT,wFACA,EACD,CACD,GAAI,EACJ,CAAA"}
@@ -1,2 +1,2 @@
1
- import{Bn as e,Jn as t,Kn as n,U as r,Yt as i,Zt as a,at as o,er as s,nt as c,qn as l,rr as u,xn as d,yn as f,z as p}from"./lucide-react-NXHPIMsX.js";import{p as m,t as h}from"./store-D-Frk_EC.js";import{J as g,K as _,Y as v,c as y,s as b}from"./display-aTnwsqQh.js";import{t as x}from"./badge-BCvp7LK3.js";import{t as S}from"./button-DyHjsHY3.js";import{o as C,r as w,s as T,t as E}from"./card-BoqYxpVW.js";var D=u(),O={MessagesSquare:c,PlugZap:r,AlertCircle:d,Activity:s,Eye:i,CircleCheck:f,Radio:p,MessageCircle:o,Bell:e};function k({direction:e}){return e===`inbound`?(0,D.jsx)(l,{className:`w-3 h-3`}):e===`outbound`?(0,D.jsx)(n,{className:`w-3 h-3`}):(0,D.jsx)(t,{className:`w-3 h-3`})}function A({channel:e,integration:t}){let n=m(),r=h(e=>e.openChannelDetail),i=y(e),o=e.status!==`offline`,s=e.direction===`outbound`,l=t?.displayName||e.name||e.id,u=(t?.icon?O[t.icon]:null)??c;return(0,D.jsxs)(E,{className:`${o?``:`opacity-60`} hover:border-zinc-600 transition-colors${t?.accentColor?` border-l-2`:``}`,style:t?.accentColor?{borderLeftColor:t.accentColor}:void 0,children:[(0,D.jsx)(C,{className:`pb-2 pt-4 px-4`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded-md ${o?`bg-blue-500/10`:`bg-zinc-800`}`,children:(0,D.jsx)(u,{className:`w-4 h-4 ${o?`text-blue-400`:`text-zinc-500`}`})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(T,{className:`text-sm font-medium truncate`,children:l}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.type,` · `,e.transport]})]}),(0,D.jsx)(x,{className:`text-[10px] shrink-0 ${g(i.tone)}`,children:i.label})]})}),(0,D.jsxs)(w,{className:`px-4 pb-4 space-y-2.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,D.jsx)(k,{direction:e.direction}),(0,D.jsx)(`span`,{className:`capitalize`,children:e.direction}),!s&&e.target&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{children:`·`}),(0,D.jsx)(`span`,{className:`truncate text-foreground`,children:e.target})]})]}),!s&&e.targetHealth&&e.targetHealth.status!==`ok`&&(0,D.jsx)(`div`,{className:`text-xs px-2 py-1 rounded ${e.targetHealth.status===`error`?`bg-red-500/10 text-red-400`:`bg-yellow-500/10 text-yellow-400`}`,children:e.targetHealth.detail}),v(e.capabilities).length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:v(e.capabilities).map(e=>(0,D.jsx)(x,{variant:`secondary`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))}),e.tags.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.map(e=>(0,D.jsx)(x,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between pt-0.5`,children:[(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_(n,e.lastSeen)}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t?.docsUrl&&(0,D.jsxs)(`a`,{href:t.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors h-7 px-2 rounded border border-input hover:bg-accent`,children:[(0,D.jsx)(a,{className:`w-3 h-3`}),`Docs`]}),(0,D.jsxs)(S,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>r(e),children:[(0,D.jsx)(a,{className:`w-3 h-3`}),`Details`]})]})]})]})]})}function j(){let e=h(e=>e.channels),t=h(e=>e.integrations),n=h(e=>e.switchView),i=new Map(t.map(e=>[e.name,e])),a=e.filter(b).length,o=e.filter(e=>e.direction!==`outbound`&&e.targetHealth?.status===`error`).length,s=e.filter(e=>e.direction!==`outbound`&&e.targetHealth?.status===`warning`).length;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-semibold`,children:`Channels`}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Inbound / outbound message integrations`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[a>0&&(0,D.jsxs)(x,{className:`text-xs bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:[a,` ready`]}),s>0&&(0,D.jsxs)(x,{className:`text-xs bg-yellow-500/15 text-yellow-400 border-yellow-500/30`,children:[s,` warning`]}),o>0&&(0,D.jsxs)(x,{className:`text-xs bg-red-500/15 text-red-400 border-red-500/30`,children:[o,` error`]}),(0,D.jsxs)(S,{variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1.5 text-muted-foreground`,onClick:()=>void n(`integrations`),children:[(0,D.jsx)(r,{className:`w-3 h-3`}),`API Integrations`]})]})]}),e.length===0?(0,D.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No channels registered.`}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,D.jsx)(A,{channel:e,integration:i.get(e.type)},e.id))})]})}export{j as ChannelsView};
2
- //# sourceMappingURL=channels-DAtOnA6o.js.map
1
+ import{Jn as e,Qt as t,Sn as n,U as r,Vn as i,Xt as a,Yn as o,at as s,bn as c,ir as l,nt as u,qn as d,tr as f,z as p}from"./lucide-react-DD_zIava.js";import{p as m,t as h}from"./store-DKTb9O0v.js";import{J as g,K as _,Y as v,c as y,s as b}from"./display-BNI-7rdq.js";import{t as x}from"./badge-BkNNvFNa.js";import{t as S}from"./button-DUaC2wSQ.js";import{o as C,r as w,s as T,t as E}from"./card-r-yAV4cH.js";var D=l(),O={MessagesSquare:u,PlugZap:r,AlertCircle:n,Activity:f,Eye:a,CircleCheck:c,Radio:p,MessageCircle:s,Bell:i};function k({direction:t}){return t===`inbound`?(0,D.jsx)(e,{className:`w-3 h-3`}):t===`outbound`?(0,D.jsx)(d,{className:`w-3 h-3`}):(0,D.jsx)(o,{className:`w-3 h-3`})}function A({channel:e,integration:n}){let r=m(),i=h(e=>e.openChannelDetail),a=y(e),o=e.status!==`offline`,s=e.direction===`outbound`,c=n?.displayName||e.name||e.id,l=(n?.icon?O[n.icon]:null)??u;return(0,D.jsxs)(E,{className:`${o?``:`opacity-60`} hover:border-zinc-600 transition-colors${n?.accentColor?` border-l-2`:``}`,style:n?.accentColor?{borderLeftColor:n.accentColor}:void 0,children:[(0,D.jsx)(C,{className:`pb-2 pt-4 px-4`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded-md ${o?`bg-blue-500/10`:`bg-zinc-800`}`,children:(0,D.jsx)(l,{className:`w-4 h-4 ${o?`text-blue-400`:`text-zinc-500`}`})}),(0,D.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,D.jsx)(T,{className:`text-sm font-medium truncate`,children:c}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.type,` · `,e.transport]})]}),(0,D.jsx)(x,{className:`text-[10px] shrink-0 ${g(a.tone)}`,children:a.label})]})}),(0,D.jsxs)(w,{className:`px-4 pb-4 space-y-2.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,D.jsx)(k,{direction:e.direction}),(0,D.jsx)(`span`,{className:`capitalize`,children:e.direction}),!s&&e.target&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{children:`·`}),(0,D.jsx)(`span`,{className:`truncate text-foreground`,children:e.target})]})]}),!s&&e.targetHealth&&e.targetHealth.status!==`ok`&&(0,D.jsx)(`div`,{className:`text-xs px-2 py-1 rounded ${e.targetHealth.status===`error`?`bg-red-500/10 text-red-400`:`bg-yellow-500/10 text-yellow-400`}`,children:e.targetHealth.detail}),v(e.capabilities).length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:v(e.capabilities).map(e=>(0,D.jsx)(x,{variant:`secondary`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))}),e.tags.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.map(e=>(0,D.jsx)(x,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between pt-0.5`,children:[(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_(r,e.lastSeen)}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n?.docsUrl&&(0,D.jsxs)(`a`,{href:n.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors h-7 px-2 rounded border border-input hover:bg-accent`,children:[(0,D.jsx)(t,{className:`w-3 h-3`}),`Docs`]}),(0,D.jsxs)(S,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>i(e),children:[(0,D.jsx)(t,{className:`w-3 h-3`}),`Details`]})]})]})]})]})}function j(){let e=h(e=>e.channels),t=h(e=>e.integrations),n=h(e=>e.switchView),i=new Map(t.map(e=>[e.name,e])),a=e.filter(b).length,o=e.filter(e=>e.direction!==`outbound`&&e.targetHealth?.status===`error`).length,s=e.filter(e=>e.direction!==`outbound`&&e.targetHealth?.status===`warning`).length;return(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-semibold`,children:`Channels`}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Inbound / outbound message integrations`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[a>0&&(0,D.jsxs)(x,{className:`text-xs bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:[a,` ready`]}),s>0&&(0,D.jsxs)(x,{className:`text-xs bg-yellow-500/15 text-yellow-400 border-yellow-500/30`,children:[s,` warning`]}),o>0&&(0,D.jsxs)(x,{className:`text-xs bg-red-500/15 text-red-400 border-red-500/30`,children:[o,` error`]}),(0,D.jsxs)(S,{variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1.5 text-muted-foreground`,onClick:()=>void n(`integrations`),children:[(0,D.jsx)(r,{className:`w-3 h-3`}),`API Integrations`]})]})]}),e.length===0?(0,D.jsx)(`div`,{className:`text-center py-16 text-muted-foreground text-sm`,children:`No channels registered.`}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4`,children:e.map(e=>(0,D.jsx)(A,{channel:e,integration:i.get(e.type)},e.id))})]})}export{j as ChannelsView};
2
+ //# sourceMappingURL=channels-MPO2FOBv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"channels-DAtOnA6o.js","names":[],"sources":["../../dashboard/src/components/views/channels.tsx"],"sourcesContent":["import { useRelayStore, useNow } from '@/store'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { channelIsReady, channelPresence, timeAgo, toneToColor, userFacingCapabilities } from '@/lib/display'\nimport {\n MessagesSquare, ArrowRight, ArrowLeft, ArrowLeftRight, ExternalLink,\n PlugZap, AlertCircle, Activity, Eye, CircleCheck, Radio, MessageCircle, Bell,\n} from 'lucide-react'\nimport type { ChannelSummary, ChannelDirection, IntegrationSummary } from '@/types'\n\nconst INTEGRATION_ICONS: Record<string, typeof MessagesSquare> = {\n MessagesSquare, PlugZap, AlertCircle, Activity, Eye, CircleCheck, Radio, MessageCircle, Bell,\n}\n\nfunction DirectionIcon({ direction }: { direction: ChannelDirection }) {\n if (direction === 'inbound') return <ArrowLeft className=\"w-3 h-3\" />\n if (direction === 'outbound') return <ArrowRight className=\"w-3 h-3\" />\n return <ArrowLeftRight className=\"w-3 h-3\" />\n}\n\nfunction ChannelCard({ channel, integration }: { channel: ChannelSummary; integration?: IntegrationSummary }) {\n const now = useNow()\n const openChannelDetail = useRelayStore((s) => s.openChannelDetail)\n\n const presence = channelPresence(channel)\n const online = channel.status !== 'offline'\n const isOutbound = channel.direction === 'outbound'\n\n const displayName = integration?.displayName || channel.name || channel.id\n const ChannelIcon = (integration?.icon ? INTEGRATION_ICONS[integration.icon] : null) ?? MessagesSquare\n\n return (\n <Card\n className={`${!online ? 'opacity-60' : ''} hover:border-zinc-600 transition-colors${integration?.accentColor ? ' border-l-2' : ''}`}\n style={integration?.accentColor ? { borderLeftColor: integration.accentColor } : undefined}\n >\n <CardHeader className=\"pb-2 pt-4 px-4\">\n <div className=\"flex items-start gap-2\">\n <div className={`p-1.5 rounded-md ${online ? 'bg-blue-500/10' : 'bg-zinc-800'}`}>\n <ChannelIcon className={`w-4 h-4 ${online ? 'text-blue-400' : 'text-zinc-500'}`} />\n </div>\n <div className=\"flex-1 min-w-0\">\n <CardTitle className=\"text-sm font-medium truncate\">{displayName}</CardTitle>\n <div className=\"text-xs text-muted-foreground mt-0.5\">{channel.type} · {channel.transport}</div>\n </div>\n <Badge className={`text-[10px] shrink-0 ${toneToColor(presence.tone)}`}>\n {presence.label}\n </Badge>\n </div>\n </CardHeader>\n\n <CardContent className=\"px-4 pb-4 space-y-2.5\">\n {/* Direction + routing target (outbound channels have no binding target) */}\n <div className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n <DirectionIcon direction={channel.direction} />\n <span className=\"capitalize\">{channel.direction}</span>\n {!isOutbound && channel.target && (\n <>\n <span>·</span>\n <span className=\"truncate text-foreground\">{channel.target}</span>\n </>\n )}\n </div>\n\n {/* Target health: inbound/bidirectional only — outbound channels have no routing target */}\n {!isOutbound && channel.targetHealth && channel.targetHealth.status !== 'ok' && (\n <div className={`text-xs px-2 py-1 rounded ${channel.targetHealth.status === 'error' ? 'bg-red-500/10 text-red-400' : 'bg-yellow-500/10 text-yellow-400'}`}>\n {channel.targetHealth.detail}\n </div>\n )}\n\n {/* Capabilities */}\n {userFacingCapabilities(channel.capabilities).length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {userFacingCapabilities(channel.capabilities).map((c) => (\n <Badge key={c} variant=\"secondary\" className=\"text-[9px] px-1 py-0 h-4\">{c}</Badge>\n ))}\n </div>\n )}\n\n {/* Tags */}\n {channel.tags.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {channel.tags.map((t) => (\n <Badge key={t} variant=\"outline\" className=\"text-[9px] px-1 py-0 h-4\">{t}</Badge>\n ))}\n </div>\n )}\n\n {/* Last seen + optional docs link + details */}\n <div className=\"flex items-center justify-between pt-0.5\">\n <span className=\"text-xs text-muted-foreground\">{timeAgo(now, channel.lastSeen)}</span>\n <div className=\"flex items-center gap-1.5\">\n {integration?.docsUrl && (\n <a\n href={integration.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors h-7 px-2 rounded border border-input hover:bg-accent\"\n >\n <ExternalLink className=\"w-3 h-3\" />\n Docs\n </a>\n )}\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"h-7 text-xs gap-1\"\n onClick={() => openChannelDetail(channel)}\n >\n <ExternalLink className=\"w-3 h-3\" />\n Details\n </Button>\n </div>\n </div>\n </CardContent>\n </Card>\n )\n}\n\nexport function ChannelsView() {\n const channels = useRelayStore((s) => s.channels)\n const integrations = useRelayStore((s) => s.integrations)\n const switchView = useRelayStore((s) => s.switchView)\n\n const integrationByName = new Map(integrations.map((i) => [i.name, i]))\n\n const readyCount = channels.filter(channelIsReady).length\n // Outbound channels have no routing target, so target health errors/warnings don't apply to them.\n const errorCount = channels.filter((c) => c.direction !== 'outbound' && c.targetHealth?.status === 'error').length\n const warningCount = channels.filter((c) => c.direction !== 'outbound' && c.targetHealth?.status === 'warning').length\n\n return (\n <div className=\"space-y-4\">\n {/* Header */}\n <div className=\"flex items-center gap-3\">\n <div>\n <h2 className=\"text-base font-semibold\">Channels</h2>\n <p className=\"text-xs text-muted-foreground\">Inbound / outbound message integrations</p>\n </div>\n <div className=\"flex items-center gap-2 ml-auto\">\n {readyCount > 0 && (\n <Badge className=\"text-xs bg-emerald-500/15 text-emerald-400 border-emerald-500/30\">\n {readyCount} ready\n </Badge>\n )}\n {warningCount > 0 && (\n <Badge className=\"text-xs bg-yellow-500/15 text-yellow-400 border-yellow-500/30\">\n {warningCount} warning\n </Badge>\n )}\n {errorCount > 0 && (\n <Badge className=\"text-xs bg-red-500/15 text-red-400 border-red-500/30\">\n {errorCount} error\n </Badge>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 text-xs gap-1.5 text-muted-foreground\"\n onClick={() => void switchView('integrations')}\n >\n <PlugZap className=\"w-3 h-3\" />\n API Integrations\n </Button>\n </div>\n </div>\n\n {/* Cards */}\n {channels.length === 0 ? (\n <div className=\"text-center py-16 text-muted-foreground text-sm\">\n No channels registered.\n </div>\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4\">\n {channels.map((channel) => (\n <ChannelCard key={channel.id} channel={channel} integration={integrationByName.get(channel.type)} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"kaAWM,EAA2D,CAC/D,iBAAgB,UAAS,YAAA,EAAa,WAAU,MAAK,cAAa,QAAO,gBAAe,OACzF,CAED,SAAS,EAAc,CAAE,aAA8C,CAGrE,OAFI,IAAc,WAAkB,EAAA,EAAA,KAAC,EAAD,CAAW,UAAU,UAAY,CAAA,CACjE,IAAc,YAAmB,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,UAAY,CAAA,EAChE,EAAA,EAAA,KAAC,EAAD,CAAgB,UAAU,UAAY,CAAA,CAG/C,SAAS,EAAY,CAAE,UAAS,eAA8E,CAC5G,IAAM,EAAM,GAAQ,CACd,EAAoB,EAAe,GAAM,EAAE,kBAAkB,CAE7D,EAAW,EAAgB,EAAQ,CACnC,EAAS,EAAQ,SAAW,UAC5B,EAAa,EAAQ,YAAc,WAEnC,EAAc,GAAa,aAAe,EAAQ,MAAQ,EAAQ,GAClE,GAAe,GAAa,KAAO,EAAkB,EAAY,MAAQ,OAAS,EAExF,OACE,EAAA,EAAA,MAAC,EAAD,CACE,UAAW,GAAI,EAAwB,GAAf,aAAkB,0CAA0C,GAAa,YAAc,cAAgB,KAC/H,MAAO,GAAa,YAAc,CAAE,gBAAiB,EAAY,YAAa,CAAG,IAAA,YAFnF,EAIE,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,2BACpB,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,kCAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,oBAAoB,EAAS,iBAAmB,0BAC9D,EAAA,EAAA,KAAC,EAAD,CAAa,UAAW,WAAW,EAAS,gBAAkB,kBAAqB,CAAA,CAC/E,CAAA,EACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,0BAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAW,UAAU,wCAAgC,EAAwB,CAAA,EAC7E,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,gDAAf,CAAuD,EAAQ,KAAK,MAAI,EAAQ,UAAgB,GAC5F,IACN,EAAA,EAAA,KAAC,EAAD,CAAO,UAAW,wBAAwB,EAAY,EAAS,KAAK,YACjE,EAAS,MACJ,CAAA,CACJ,GACK,CAAA,EAEb,EAAA,EAAA,MAAC,EAAD,CAAa,UAAU,iCAAvB,EAEE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mEAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAe,UAAW,EAAQ,UAAa,CAAA,EAC/C,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,sBAAc,EAAQ,UAAiB,CAAA,CACtD,CAAC,GAAc,EAAQ,SACtB,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,OAAD,CAAA,SAAM,IAAQ,CAAA,EACd,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,oCAA4B,EAAQ,OAAc,CAAA,CACjE,CAAA,CAAA,CAED,GAGL,CAAC,GAAc,EAAQ,cAAgB,EAAQ,aAAa,SAAW,OACtE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,6BAA6B,EAAQ,aAAa,SAAW,QAAU,6BAA+B,8CACnH,EAAQ,aAAa,OAClB,CAAA,CAIP,EAAuB,EAAQ,aAAa,CAAC,OAAS,IACrD,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAuB,EAAQ,aAAa,CAAC,IAAK,IACjD,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,YAAY,UAAU,oCAA4B,EAAU,CAAvE,EAAuE,CACnF,CACE,CAAA,CAIP,EAAQ,KAAK,OAAS,IACrB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAQ,KAAK,IAAK,IACjB,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,UAAU,UAAU,oCAA4B,EAAU,CAArE,EAAqE,CACjF,CACE,CAAA,EAIR,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,oDAAf,EACE,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,yCAAiC,EAAQ,EAAK,EAAQ,SAAS,CAAQ,CAAA,EACvF,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qCAAf,CACG,GAAa,UACZ,EAAA,EAAA,MAAC,IAAD,CACE,KAAM,EAAY,QAClB,OAAO,SACP,IAAI,sBACJ,UAAU,qKAJZ,EAME,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,UAAY,CAAA,CAAA,OAElC,IAEN,EAAA,EAAA,MAAC,EAAD,CACE,KAAK,KACL,QAAQ,UACR,UAAU,oBACV,YAAe,EAAkB,EAAQ,UAJ3C,EAME,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,UAAY,CAAA,CAAA,UAE7B,GACL,GACF,GACM,GACT,GAIX,SAAgB,GAAe,CAC7B,IAAM,EAAW,EAAe,GAAM,EAAE,SAAS,CAC3C,EAAe,EAAe,GAAM,EAAE,aAAa,CACnD,EAAa,EAAe,GAAM,EAAE,WAAW,CAE/C,EAAoB,IAAI,IAAI,EAAa,IAAK,GAAM,CAAC,EAAE,KAAM,EAAE,CAAC,CAAC,CAEjE,EAAa,EAAS,OAAO,EAAe,CAAC,OAE7C,EAAa,EAAS,OAAQ,GAAM,EAAE,YAAc,YAAc,EAAE,cAAc,SAAW,QAAQ,CAAC,OACtG,EAAe,EAAS,OAAQ,GAAM,EAAE,YAAc,YAAc,EAAE,cAAc,SAAW,UAAU,CAAC,OAEhH,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EAEE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mCAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,KAAD,CAAI,UAAU,mCAA0B,WAAa,CAAA,EACrD,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,yCAAgC,0CAA2C,CAAA,CACpF,CAAA,CAAA,EACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,2CAAf,CACG,EAAa,IACZ,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,4EAAjB,CACG,EAAW,SACN,GAET,EAAe,IACd,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,yEAAjB,CACG,EAAa,WACR,GAET,EAAa,IACZ,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,gEAAjB,CACG,EAAW,SACN,IAEV,EAAA,EAAA,MAAC,EAAD,CACE,QAAQ,QACR,KAAK,KACL,UAAU,4CACV,YAAe,KAAK,EAAW,eAAe,UAJhD,EAME,EAAA,EAAA,KAAC,EAAD,CAAS,UAAU,UAAY,CAAA,CAAA,mBAExB,GACL,GACF,GAGL,EAAS,SAAW,GACnB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,2DAAkD,0BAE3D,CAAA,EAEN,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gEACZ,EAAS,IAAK,IACb,EAAA,EAAA,KAAC,EAAD,CAAuC,UAAS,YAAa,EAAkB,IAAI,EAAQ,KAAK,CAAI,CAAlF,EAAQ,GAA0E,CACpG,CACE,CAAA,CAEJ"}
1
+ {"version":3,"file":"channels-MPO2FOBv.js","names":[],"sources":["../../dashboard/src/components/views/channels.tsx"],"sourcesContent":["import { useRelayStore, useNow } from '@/store'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { channelIsReady, channelPresence, timeAgo, toneToColor, userFacingCapabilities } from '@/lib/display'\nimport {\n MessagesSquare, ArrowRight, ArrowLeft, ArrowLeftRight, ExternalLink,\n PlugZap, AlertCircle, Activity, Eye, CircleCheck, Radio, MessageCircle, Bell,\n} from 'lucide-react'\nimport type { ChannelSummary, ChannelDirection, IntegrationSummary } from '@/types'\n\nconst INTEGRATION_ICONS: Record<string, typeof MessagesSquare> = {\n MessagesSquare, PlugZap, AlertCircle, Activity, Eye, CircleCheck, Radio, MessageCircle, Bell,\n}\n\nfunction DirectionIcon({ direction }: { direction: ChannelDirection }) {\n if (direction === 'inbound') return <ArrowLeft className=\"w-3 h-3\" />\n if (direction === 'outbound') return <ArrowRight className=\"w-3 h-3\" />\n return <ArrowLeftRight className=\"w-3 h-3\" />\n}\n\nfunction ChannelCard({ channel, integration }: { channel: ChannelSummary; integration?: IntegrationSummary }) {\n const now = useNow()\n const openChannelDetail = useRelayStore((s) => s.openChannelDetail)\n\n const presence = channelPresence(channel)\n const online = channel.status !== 'offline'\n const isOutbound = channel.direction === 'outbound'\n\n const displayName = integration?.displayName || channel.name || channel.id\n const ChannelIcon = (integration?.icon ? INTEGRATION_ICONS[integration.icon] : null) ?? MessagesSquare\n\n return (\n <Card\n className={`${!online ? 'opacity-60' : ''} hover:border-zinc-600 transition-colors${integration?.accentColor ? ' border-l-2' : ''}`}\n style={integration?.accentColor ? { borderLeftColor: integration.accentColor } : undefined}\n >\n <CardHeader className=\"pb-2 pt-4 px-4\">\n <div className=\"flex items-start gap-2\">\n <div className={`p-1.5 rounded-md ${online ? 'bg-blue-500/10' : 'bg-zinc-800'}`}>\n <ChannelIcon className={`w-4 h-4 ${online ? 'text-blue-400' : 'text-zinc-500'}`} />\n </div>\n <div className=\"flex-1 min-w-0\">\n <CardTitle className=\"text-sm font-medium truncate\">{displayName}</CardTitle>\n <div className=\"text-xs text-muted-foreground mt-0.5\">{channel.type} · {channel.transport}</div>\n </div>\n <Badge className={`text-[10px] shrink-0 ${toneToColor(presence.tone)}`}>\n {presence.label}\n </Badge>\n </div>\n </CardHeader>\n\n <CardContent className=\"px-4 pb-4 space-y-2.5\">\n {/* Direction + routing target (outbound channels have no binding target) */}\n <div className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n <DirectionIcon direction={channel.direction} />\n <span className=\"capitalize\">{channel.direction}</span>\n {!isOutbound && channel.target && (\n <>\n <span>·</span>\n <span className=\"truncate text-foreground\">{channel.target}</span>\n </>\n )}\n </div>\n\n {/* Target health: inbound/bidirectional only — outbound channels have no routing target */}\n {!isOutbound && channel.targetHealth && channel.targetHealth.status !== 'ok' && (\n <div className={`text-xs px-2 py-1 rounded ${channel.targetHealth.status === 'error' ? 'bg-red-500/10 text-red-400' : 'bg-yellow-500/10 text-yellow-400'}`}>\n {channel.targetHealth.detail}\n </div>\n )}\n\n {/* Capabilities */}\n {userFacingCapabilities(channel.capabilities).length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {userFacingCapabilities(channel.capabilities).map((c) => (\n <Badge key={c} variant=\"secondary\" className=\"text-[9px] px-1 py-0 h-4\">{c}</Badge>\n ))}\n </div>\n )}\n\n {/* Tags */}\n {channel.tags.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {channel.tags.map((t) => (\n <Badge key={t} variant=\"outline\" className=\"text-[9px] px-1 py-0 h-4\">{t}</Badge>\n ))}\n </div>\n )}\n\n {/* Last seen + optional docs link + details */}\n <div className=\"flex items-center justify-between pt-0.5\">\n <span className=\"text-xs text-muted-foreground\">{timeAgo(now, channel.lastSeen)}</span>\n <div className=\"flex items-center gap-1.5\">\n {integration?.docsUrl && (\n <a\n href={integration.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors h-7 px-2 rounded border border-input hover:bg-accent\"\n >\n <ExternalLink className=\"w-3 h-3\" />\n Docs\n </a>\n )}\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"h-7 text-xs gap-1\"\n onClick={() => openChannelDetail(channel)}\n >\n <ExternalLink className=\"w-3 h-3\" />\n Details\n </Button>\n </div>\n </div>\n </CardContent>\n </Card>\n )\n}\n\nexport function ChannelsView() {\n const channels = useRelayStore((s) => s.channels)\n const integrations = useRelayStore((s) => s.integrations)\n const switchView = useRelayStore((s) => s.switchView)\n\n const integrationByName = new Map(integrations.map((i) => [i.name, i]))\n\n const readyCount = channels.filter(channelIsReady).length\n // Outbound channels have no routing target, so target health errors/warnings don't apply to them.\n const errorCount = channels.filter((c) => c.direction !== 'outbound' && c.targetHealth?.status === 'error').length\n const warningCount = channels.filter((c) => c.direction !== 'outbound' && c.targetHealth?.status === 'warning').length\n\n return (\n <div className=\"space-y-4\">\n {/* Header */}\n <div className=\"flex items-center gap-3\">\n <div>\n <h2 className=\"text-base font-semibold\">Channels</h2>\n <p className=\"text-xs text-muted-foreground\">Inbound / outbound message integrations</p>\n </div>\n <div className=\"flex items-center gap-2 ml-auto\">\n {readyCount > 0 && (\n <Badge className=\"text-xs bg-emerald-500/15 text-emerald-400 border-emerald-500/30\">\n {readyCount} ready\n </Badge>\n )}\n {warningCount > 0 && (\n <Badge className=\"text-xs bg-yellow-500/15 text-yellow-400 border-yellow-500/30\">\n {warningCount} warning\n </Badge>\n )}\n {errorCount > 0 && (\n <Badge className=\"text-xs bg-red-500/15 text-red-400 border-red-500/30\">\n {errorCount} error\n </Badge>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 text-xs gap-1.5 text-muted-foreground\"\n onClick={() => void switchView('integrations')}\n >\n <PlugZap className=\"w-3 h-3\" />\n API Integrations\n </Button>\n </div>\n </div>\n\n {/* Cards */}\n {channels.length === 0 ? (\n <div className=\"text-center py-16 text-muted-foreground text-sm\">\n No channels registered.\n </div>\n ) : (\n <div className=\"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4\">\n {channels.map((channel) => (\n <ChannelCard key={channel.id} channel={channel} integration={integrationByName.get(channel.type)} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"kaAWM,EAA2D,CAC/D,iBAAgB,UAAS,YAAA,EAAa,WAAU,MAAK,cAAa,QAAO,gBAAe,OACzF,CAED,SAAS,EAAc,CAAE,aAA8C,CAGrE,OAFI,IAAc,WAAkB,EAAA,EAAA,KAAC,EAAD,CAAW,UAAU,UAAY,CAAA,CACjE,IAAc,YAAmB,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,UAAY,CAAA,EAChE,EAAA,EAAA,KAAC,EAAD,CAAgB,UAAU,UAAY,CAAA,CAG/C,SAAS,EAAY,CAAE,UAAS,eAA8E,CAC5G,IAAM,EAAM,GAAQ,CACd,EAAoB,EAAe,GAAM,EAAE,kBAAkB,CAE7D,EAAW,EAAgB,EAAQ,CACnC,EAAS,EAAQ,SAAW,UAC5B,EAAa,EAAQ,YAAc,WAEnC,EAAc,GAAa,aAAe,EAAQ,MAAQ,EAAQ,GAClE,GAAe,GAAa,KAAO,EAAkB,EAAY,MAAQ,OAAS,EAExF,OACE,EAAA,EAAA,MAAC,EAAD,CACE,UAAW,GAAI,EAAwB,GAAf,aAAkB,0CAA0C,GAAa,YAAc,cAAgB,KAC/H,MAAO,GAAa,YAAc,CAAE,gBAAiB,EAAY,YAAa,CAAG,IAAA,YAFnF,EAIE,EAAA,EAAA,KAAC,EAAD,CAAY,UAAU,2BACpB,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,kCAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,oBAAoB,EAAS,iBAAmB,0BAC9D,EAAA,EAAA,KAAC,EAAD,CAAa,UAAW,WAAW,EAAS,gBAAkB,kBAAqB,CAAA,CAC/E,CAAA,EACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,0BAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAW,UAAU,wCAAgC,EAAwB,CAAA,EAC7E,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,gDAAf,CAAuD,EAAQ,KAAK,MAAI,EAAQ,UAAgB,GAC5F,IACN,EAAA,EAAA,KAAC,EAAD,CAAO,UAAW,wBAAwB,EAAY,EAAS,KAAK,YACjE,EAAS,MACJ,CAAA,CACJ,GACK,CAAA,EAEb,EAAA,EAAA,MAAC,EAAD,CAAa,UAAU,iCAAvB,EAEE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mEAAf,EACE,EAAA,EAAA,KAAC,EAAD,CAAe,UAAW,EAAQ,UAAa,CAAA,EAC/C,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,sBAAc,EAAQ,UAAiB,CAAA,CACtD,CAAC,GAAc,EAAQ,SACtB,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,OAAD,CAAA,SAAM,IAAQ,CAAA,EACd,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,oCAA4B,EAAQ,OAAc,CAAA,CACjE,CAAA,CAAA,CAED,GAGL,CAAC,GAAc,EAAQ,cAAgB,EAAQ,aAAa,SAAW,OACtE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,6BAA6B,EAAQ,aAAa,SAAW,QAAU,6BAA+B,8CACnH,EAAQ,aAAa,OAClB,CAAA,CAIP,EAAuB,EAAQ,aAAa,CAAC,OAAS,IACrD,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAuB,EAAQ,aAAa,CAAC,IAAK,IACjD,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,YAAY,UAAU,oCAA4B,EAAU,CAAvE,EAAuE,CACnF,CACE,CAAA,CAIP,EAAQ,KAAK,OAAS,IACrB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gCACZ,EAAQ,KAAK,IAAK,IACjB,EAAA,EAAA,KAAC,EAAD,CAAe,QAAQ,UAAU,UAAU,oCAA4B,EAAU,CAArE,EAAqE,CACjF,CACE,CAAA,EAIR,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,oDAAf,EACE,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,yCAAiC,EAAQ,EAAK,EAAQ,SAAS,CAAQ,CAAA,EACvF,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qCAAf,CACG,GAAa,UACZ,EAAA,EAAA,MAAC,IAAD,CACE,KAAM,EAAY,QAClB,OAAO,SACP,IAAI,sBACJ,UAAU,qKAJZ,EAME,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,UAAY,CAAA,CAAA,OAElC,IAEN,EAAA,EAAA,MAAC,EAAD,CACE,KAAK,KACL,QAAQ,UACR,UAAU,oBACV,YAAe,EAAkB,EAAQ,UAJ3C,EAME,EAAA,EAAA,KAAC,EAAD,CAAc,UAAU,UAAY,CAAA,CAAA,UAE7B,GACL,GACF,GACM,GACT,GAIX,SAAgB,GAAe,CAC7B,IAAM,EAAW,EAAe,GAAM,EAAE,SAAS,CAC3C,EAAe,EAAe,GAAM,EAAE,aAAa,CACnD,EAAa,EAAe,GAAM,EAAE,WAAW,CAE/C,EAAoB,IAAI,IAAI,EAAa,IAAK,GAAM,CAAC,EAAE,KAAM,EAAE,CAAC,CAAC,CAEjE,EAAa,EAAS,OAAO,EAAe,CAAC,OAE7C,EAAa,EAAS,OAAQ,GAAM,EAAE,YAAc,YAAc,EAAE,cAAc,SAAW,QAAQ,CAAC,OACtG,EAAe,EAAS,OAAQ,GAAM,EAAE,YAAc,YAAc,EAAE,cAAc,SAAW,UAAU,CAAC,OAEhH,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EAEE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,mCAAf,EACE,EAAA,EAAA,MAAC,MAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,KAAD,CAAI,UAAU,mCAA0B,WAAa,CAAA,EACrD,EAAA,EAAA,KAAC,IAAD,CAAG,UAAU,yCAAgC,0CAA2C,CAAA,CACpF,CAAA,CAAA,EACN,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,2CAAf,CACG,EAAa,IACZ,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,4EAAjB,CACG,EAAW,SACN,GAET,EAAe,IACd,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,yEAAjB,CACG,EAAa,WACR,GAET,EAAa,IACZ,EAAA,EAAA,MAAC,EAAD,CAAO,UAAU,gEAAjB,CACG,EAAW,SACN,IAEV,EAAA,EAAA,MAAC,EAAD,CACE,QAAQ,QACR,KAAK,KACL,UAAU,4CACV,YAAe,KAAK,EAAW,eAAe,UAJhD,EAME,EAAA,EAAA,KAAC,EAAD,CAAS,UAAU,UAAY,CAAA,CAAA,mBAExB,GACL,GACF,GAGL,EAAS,SAAW,GACnB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,2DAAkD,0BAE3D,CAAA,EAEN,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,gEACZ,EAAS,IAAK,IACb,EAAA,EAAA,KAAC,EAAD,CAAuC,UAAS,YAAa,EAAkB,IAAI,EAAQ,KAAK,CAAI,CAAlF,EAAQ,GAA0E,CACpG,CACE,CAAA,CAEJ"}
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,A as n,B as r,Bt as i,C as a,Cn as o,Dn as s,En as c,Gt as l,H as u,It as d,Jn as f,K as p,Kn as m,Mt as h,Ot as g,Qn as _,Sn as v,Tn as y,Un as b,Ut as x,Xt as S,Y as C,Zn as w,_ as T,_r as E,a as D,ar as ee,bn as te,c as ne,en as re,et as ie,gt as ae,h as oe,hn as se,hr as ce,ir as O,j as le,l as ue,lr as de,lt as fe,mt as pe,nn as me,nr as k,on as he,ot as ge,r as _e,rt as ve,tt as A,ut as ye,v as be,wn as xe,zn as Se}from"./lucide-react-DD_zIava.js";import{t as Ce}from"./react-dom-CADlISeR.js";import{a as we,b as Te,g as Ee,o as De,p as Oe,s as ke,t as j,v as Ae,y as je}from"./store-DKTb9O0v.js";import{_ as Me,c as Ne,h as Pe,v as Fe}from"./types-BqeSkWrv.js";import{A as Ie,E as Le,K as Re,M as ze,W as Be,X as Ve,Y as He,Z as Ue,a as We,d as Ge,h as Ke,k as qe,o as Je,q as Ye,r as Xe,v as Ze,z as Qe}from"./display-BNI-7rdq.js";import{t as $e}from"./badge-BkNNvFNa.js";import{t as M}from"./button-DUaC2wSQ.js";import{t as et}from"./input-BvNUEkDd.js";import{t as tt}from"./copy-button-u463GPZR.js";import{t as nt}from"./agent-type-icon-B9cLaOoz.js";import{t as rt}from"./formatted-body-BEI1zP7i.js";import{B as it,C as at,D as ot,F as st,H as ct,K as lt,L as ut,N as dt,O as ft,Ot as pt,R as mt,S as ht,T as gt,V as _t,W as vt,_ as yt,_t as bt,at as xt,b as St,c as Ct,ct as wt,d as Tt,et as Et,f as Dt,g as Ot,gt as kt,h as At,ht as jt,it as Mt,j as Nt,k as Pt,lt as Ft,m as It,mt as Lt,n as Rt,nt as zt,o as Bt,ot as Vt,p as Ht,pt as Ut,s as Wt,st as Gt,t as Kt,u as qt,ut as Jt,v as Yt,w as Xt,x as Zt,xt as Qt,y as $t}from"./index-D2Mpzpft.js";import{t as en}from"./use-keyboard-viewport-wTh5CR4-.js";import{t as tn}from"./MessageBubble-D2Wzxied.js";import{i as nn,n as rn,r as an,t as on}from"./branch-state-badge-DnS40KCb.js";import{n as sn,r as cn,t as ln}from"./PlanGraphPanel-DH_xoWZi.js";var N=e(E(),1);function un(e,t,n,r,i){if(i.includes(e))return!1;if(r.includes(e)||n)return!0;let a=t[e];return!!(a&&Ne(a.spawnedBy??``))}function dn(){let e=j(e=>e.agents),t=j(e=>e.agentsById),n=j(e=>e.showBuiltIns),r=j(e=>e.showOffline),i=j(e=>e.chatAgentSearch),a=j(e=>e.chatAgentProviderFilter),o=j(e=>e.chatAgentStatusFilter),s=j(e=>e.chatAgentTagFilter),c=j(e=>e.chatAgentCapFilter),l=j(e=>e.chatAgentHostFilter),u=j(e=>e.chatAgentSort),d=j(e=>e.chatAgentSortDir),f=j(e=>e.managedPolicies),p=j(e=>e.feedObserveAll),m=j(e=>e.coordinatorFollows),h=j(e=>e.coordinatorMutes),g=Qt();return(0,N.useMemo)(()=>{let _=new Set(g.map(e=>e.peer)),v=Ve(e,n,f);if(r||(v=v.filter(e=>e.status!==`offline`)),v=p?v.filter(e=>!h.includes(e.id)):v.filter(e=>un(e.id,t,_.has(e.id),m,h)),i){let e=i.toLowerCase();v=v.filter(t=>t.id.toLowerCase().includes(e)||(t.name||``).toLowerCase().includes(e)||(t.label||``).toLowerCase().includes(e)||(t.tags||[]).some(t=>t.toLowerCase().includes(e))||(t.capabilities||[]).some(t=>t.toLowerCase().includes(e)))}a&&(v=v.filter(e=>Je(e)===a)),o&&(v=v.filter(e=>e.status===o)),s&&(v=v.filter(e=>(e.tags||[]).includes(s))),c&&(v=v.filter(e=>(e.capabilities||[]).includes(c))),l&&(v=v.filter(e=>(e.machine||``)===l));let y=d===`desc`?-1:1;return[...v].sort((e,t)=>u===`name`?Ge(e).localeCompare(Ge(t))*y:u===`lastSeen`?ft(Ye(e.lastSeen),Ye(t.lastSeen),y)||Ge(e).localeCompare(Ge(t)):((Ue[e.status]??9)-(Ue[t.status]??9))*y||Ge(e).localeCompare(Ge(t)))},[e,t,n,r,f,i,a,o,s,c,l,u,d,p,m,h,g])}var P=O(),fn=[{re:/`([^`]+)`/,recurse:!1,wrap:(e,t)=>(0,P.jsx)(`code`,{className:`rounded bg-muted px-1 font-mono text-[0.9em]`,children:e},t)},{re:/\*\*([^*]+)\*\*/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`strong`,{className:`font-semibold text-foreground/90`,children:e},t)},{re:/__([^_]+)__/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`strong`,{className:`font-semibold text-foreground/90`,children:e},t)},{re:/~~([^~]+)~~/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`s`,{children:e},t)},{re:/\*([^*]+)\*/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`em`,{children:e},t)},{re:/_([^_]+)_/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`em`,{children:e},t)},{re:/\[([^\]]+)\]\([^)]+\)/,recurse:!0,wrap:(e,t)=>(0,P.jsx)(`span`,{className:`underline decoration-dotted underline-offset-2`,children:e},t)}];function pn(e,t=`i`){let n=null;for(let t of fn){let r=t.re.exec(e);r&&r[1]&&(n===null||r.index<n.index)&&(n={index:r.index,length:r[0].length,inner:r[1],pattern:t})}if(!n)return[e];let r=[];n.index>0&&r.push(e.slice(0,n.index));let i=n.pattern.recurse?pn(n.inner,`${t}x`):n.inner;r.push(n.pattern.wrap(i,`${t}m`));let a=e.slice(n.index+n.length);return a&&r.push(...pn(a,`${t}r`)),r}function mn({threads:e,onSelectAgent:t}){let n=j(e=>e.set),r=j(e=>e.openInboxThread),i=j(e=>e.openAgentSpawn),s=j(e=>e.selectedInboxThread),l=j(e=>e.chatAgentSearch),f=j(e=>e.chatAgentSort),p=j(e=>e.chatAgentSortDir),h=j(e=>e.chatAgentProviderFilter),g=j(e=>e.chatAgentStatusFilter),_=j(e=>e.chatAgentTagFilter),y=j(e=>e.chatAgentCapFilter),x=j(e=>e.chatAgentHostFilter),C=j(e=>e.chatAgentGroupBy),T=j(e=>e.chatAgentFiltersCollapsed),E=j(e=>e.agentsById),D=j(e=>e.chatCollapsedChildren),ee=j(e=>e.toggleChatChildrenCollapsed),te=j(e=>e.feedObserveAll),ne=j(e=>e.setFeedObserveAll),re=j(e=>e.coordinatorFollows),ie=j(e=>e.coordinatorMutes),ae=j(e=>e.toggleCoordinatorFollow),oe=j(e=>e.toggleCoordinatorMute),se=Oe(),ce=dn(),O=(0,N.useMemo)(()=>new Set(D),[D]),ue=(0,N.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.peer,n);return t},[e]),de=(0,N.useMemo)(()=>{if(f!==`lastMessage`)return ce;let e=p===`desc`?-1:1;return[...ce].sort((t,n)=>ft(ct(ue.get(t.id)),ct(ue.get(n.id)),e)||Ge(t).localeCompare(Ge(n)))},[ce,f,p,ue]),fe=(0,N.useMemo)(()=>[...new Set(ce.flatMap(e=>e.tags||[]))],[ce]),pe=(0,N.useMemo)(()=>[...new Set(ce.flatMap(e=>He(e.capabilities||[])))],[ce]),me=pt(),ge=(0,N.useMemo)(()=>{if(C!==`project`)return null;let e=new Map;for(let t of de){let n=Vt(t)||`No project`,r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[de,C]),_e=[h,g,_,y,x].filter(Boolean).length,ve=(0,N.useMemo)(()=>lt(de,E,se),[de,E,se]);function A(e){r(e,ue.get(e)?.messages),t?.(e)}function ye(e){let{agent:t}=e;if(e.depth===1&&e.parent&&O.has(e.parent.id))return null;let n=ue.get(t.id),r=n?.attention.unread||0,i=Xe(t),a=n?.previewMessage,o=dt(n)||ct(n),l=s===t.id,u=Gt(t),d=Vt(t),f=u.Icon,p=e.parent?Ge(e.parent):t.spawnedBy,m=e.children.length,h=e.depth===0&&m>0,g=O.has(t.id),_=ie.includes(t.id),y=re.includes(t.id);return(0,P.jsxs)(`li`,{className:k(`relative group`,e.depth===1&&`pl-4`),children:[e.depth===1&&(0,P.jsx)(`div`,{className:`absolute left-2 top-3.5 text-muted-foreground/55`,children:(0,P.jsx)(he,{className:`h-3.5 w-3.5`})}),(0,P.jsxs)(`div`,{className:`absolute right-1.5 top-1.5 z-10 hidden items-center gap-0.5 rounded-md border border-border/60 bg-popover/95 px-0.5 py-0.5 shadow-sm backdrop-blur-sm group-hover:flex`,children:[(0,P.jsx)(`button`,{type:`button`,title:y?`Unfollow (stop pinning into scoped view)`:`Follow (keep visible even in scoped view)`,onClick:e=>{e.stopPropagation(),ae(t.id)},className:k(`rounded p-1 transition-colors`,y?`text-primary bg-primary/15 hover:bg-primary/25`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:(0,P.jsx)(be,{className:`h-3 w-3`})}),(0,P.jsx)(`button`,{type:`button`,title:_?`Unmute`:`Mute (hide from all views)`,onClick:e=>{e.stopPropagation(),oe(t.id)},className:k(`rounded p-1 transition-colors`,_?`text-orange-400 bg-orange-500/15 hover:bg-orange-500/25`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:(0,P.jsx)(b,{className:`h-3 w-3`})})]}),(0,P.jsxs)(`button`,{className:k(`w-full text-left px-3 py-2.5 flex items-start gap-2.5 hover:bg-muted/50 transition-colors border-b border-border/50`,e.depth===1&&`bg-muted/15`,l&&`bg-muted/60`,_&&`opacity-50`),onClick:()=>A(t.id),children:[(0,P.jsxs)(`div`,{className:`relative shrink-0 mt-0.5`,children:[(0,P.jsx)(nt,{agent:t}),(0,P.jsx)(wt,{agent:t,now:se,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-1 mb-0.5`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0`,children:[(0,P.jsx)(rn,{profile:an(t),className:`text-xs shrink-0`}),(0,P.jsx)(`span`,{className:`text-xs font-medium truncate`,children:Ge(t)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 transition-opacity group-hover:opacity-0`,children:[y&&(0,P.jsx)(be,{className:`h-3 w-3 text-primary`,"aria-label":`Followed`}),o>0&&(0,P.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,title:Ke(o),children:Re(se,o)}),r>0&&(0,P.jsx)($e,{className:`bg-red-500 text-white text-[11px] font-semibold leading-none tabular-nums min-w-[18px] h-[18px] flex items-center justify-center shrink-0 px-1 rounded-full`,children:r}),!r&&i&&(0,P.jsx)($e,{className:`bg-amber-500 text-black min-w-[18px] h-[18px] flex items-center justify-center shrink-0 px-1 rounded-full`,title:`Needs response`,children:(0,P.jsx)(v,{className:`h-3 w-3`})})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-0.5 text-[10px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{title:u.title,className:`inline-flex shrink-0`,children:(0,P.jsx)(f,{className:k(`h-3 w-3`,u.iconColor)})}),(0,P.jsx)(`span`,{className:`truncate`,children:d||u.label}),xt(t)&&(0,P.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,P.jsx)(Mt,{context:t.context,expected:!0,size:18})})]}),e.depth===0&&t.spawnedBy&&p&&(0,P.jsx)(`div`,{className:`mb-0.5`,children:(0,P.jsx)($e,{variant:`outline`,className:`max-w-full text-[9px] h-4 px-1.5 text-muted-foreground`,children:(0,P.jsxs)(`span`,{className:`truncate`,children:[`spawned by `,p]})})}),a&&(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate leading-tight`,children:[a.from===`user`?`You: `:``,pn(ze(a).replace(/\s+/g,` `))]})]})]}),h&&(0,P.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ee(t.id)},className:`flex w-full items-center gap-1.5 border-b border-border/50 bg-muted/20 py-1 pl-8 pr-3 text-[10px] text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground`,"aria-expanded":!g,title:g?`Show ${m} child ${m===1?`agent`:`agents`}`:`Hide children`,children:[g?(0,P.jsx)(xe,{className:`h-3.5 w-3.5 shrink-0`}):(0,P.jsx)(c,{className:`h-3.5 w-3.5 shrink-0`}),(0,P.jsxs)(`span`,{className:`font-medium`,children:[m,` child `,m===1?`agent`:`agents`]})]})]},t.id)}return(0,P.jsxs)(`div`,{className:`flex flex-col h-full border-r border-border min-w-0`,children:[(0,P.jsxs)(`div`,{className:`p-3 border-b border-border space-y-2`,children:[(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(le,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground pointer-events-none`}),(0,P.jsx)(et,{placeholder:`Search agents...`,value:l,onChange:e=>n({chatAgentSearch:e.target.value}),className:`pl-8 h-7 text-xs`})]}),(0,P.jsxs)(`div`,{className:`flex h-7 items-center rounded-md border border-border bg-background p-0.5 text-xs`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ne(!1),title:`Show only conversations where you're in the audience (agents you spawned or messaged)`,"aria-pressed":!te,className:k(`flex h-full flex-1 items-center justify-center gap-1.5 rounded-[5px] transition-colors`,te?`text-muted-foreground hover:text-foreground`:`bg-primary/15 text-primary font-medium`),children:[(0,P.jsx)(d,{className:`h-3.5 w-3.5`}),`Scoped`]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ne(!0),title:`Show every agent conversation, including agent-to-agent chatter`,"aria-pressed":te,className:k(`flex h-full flex-1 items-center justify-center gap-1.5 rounded-[5px] transition-colors`,te?`bg-primary/15 text-primary font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(S,{className:`h-3.5 w-3.5`}),`All`]})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n({chatAgentFiltersCollapsed:!T}),className:`sm:hidden flex w-full items-center justify-between h-6 px-1.5 text-xs rounded-md border border-border bg-background text-muted-foreground`,children:[(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,P.jsx)(a,{className:`w-3.5 h-3.5`}),`Filters & sort`,_e>0&&(0,P.jsx)($e,{className:`bg-primary/20 text-primary text-[10px] h-4 min-w-4 px-1 flex items-center justify-center`,children:_e})]}),T?(0,P.jsx)(c,{className:`w-3.5 h-3.5`}):(0,P.jsx)(o,{className:`w-3.5 h-3.5`})]}),(0,P.jsxs)(`div`,{className:k(`space-y-2`,T?`hidden`:`block`,`sm:block`),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,P.jsxs)(`select`,{value:f,onChange:e=>n({chatAgentSort:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:`status`,children:`By status`}),(0,P.jsx)(`option`,{value:`name`,children:`By name`}),(0,P.jsx)(`option`,{value:`lastSeen`,children:`By last seen`}),(0,P.jsx)(`option`,{value:`lastMessage`,children:`By last activity`})]}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-xs`,onClick:()=>n({chatAgentSortDir:p===`asc`?`desc`:`asc`}),children:p===`asc`?(0,P.jsx)(m,{className:`w-3.5 h-3.5`}):(0,P.jsx)(w,{className:`w-3.5 h-3.5`})})]}),(0,P.jsxs)(`select`,{value:C,onChange:e=>n({chatAgentGroupBy:e.target.value}),className:`w-full h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`No grouping`}),(0,P.jsx)(`option`,{value:`project`,children:`Group by project`})]}),(0,P.jsxs)(`div`,{className:`flex gap-1`,children:[(0,P.jsxs)(`select`,{value:h,onChange:e=>n({chatAgentProviderFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All types`}),Pe().map(e=>(0,P.jsx)(`option`,{value:e,children:Me(e)},e)),(0,P.jsx)(`option`,{value:`agent`,children:`Agent`}),(0,P.jsx)(`option`,{value:`user`,children:`User`})]}),(0,P.jsxs)(`select`,{value:g,onChange:e=>n({chatAgentStatusFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All status`}),(0,P.jsx)(`option`,{value:`online`,children:`Online`}),(0,P.jsx)(`option`,{value:`idle`,children:`Idle`}),(0,P.jsx)(`option`,{value:`busy`,children:`Busy`}),(0,P.jsx)(`option`,{value:`offline`,children:`Offline`})]}),me.length>1&&(0,P.jsxs)(`select`,{value:x,onChange:e=>n({chatAgentHostFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All hosts`}),me.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]}),(fe.length>0||pe.length>0)&&(0,P.jsxs)(`div`,{className:`flex gap-1`,children:[fe.length>0&&(0,P.jsxs)(`select`,{value:_,onChange:e=>n({chatAgentTagFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All tags`}),fe.map(e=>(0,P.jsxs)(`option`,{value:e,children:[`#`,e]},e))]}),pe.length>0&&(0,P.jsxs)(`select`,{value:y,onChange:e=>n({chatAgentCapFilter:e.target.value}),className:`flex-1 h-6 text-xs rounded-md border border-border bg-background px-1.5 text-foreground`,children:[(0,P.jsx)(`option`,{value:``,children:`All caps`}),pe.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full shrink-0 items-center gap-2.5 border-b border-border px-3 py-2 text-left transition-colors hover:bg-muted/50`,onClick:i,children:[(0,P.jsx)(`div`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-dashed border-primary/50 bg-primary/10 text-primary`,children:(0,P.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`text-xs font-medium`,children:`New Agent`}),(0,P.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:`Spawn a fresh chat agent`})]})]}),(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:de.length===0?!te&&!l&&_e===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center px-6`,children:[(0,P.jsx)(be,{className:`w-8 h-8 text-muted-foreground/40 mb-3`}),(0,P.jsx)(`p`,{className:`text-xs font-medium text-foreground/80`,children:`No conversations in your audience`}),(0,P.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:`Agents you spawn or message show up here.`}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>ne(!0),className:`mt-3 inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground`,children:[(0,P.jsx)(S,{className:`h-3.5 w-3.5`}),` Show all agents`]})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-10 text-center px-4`,children:[(0,P.jsx)(Se,{className:`w-8 h-8 text-muted-foreground/40 mb-2`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No agents match filters`})]}):ge?ge.map(([e,t])=>(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-1.5 border-b border-border/50 bg-background/95 px-3 py-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground backdrop-blur`,children:[(0,P.jsx)(`span`,{className:`truncate`,children:e}),(0,P.jsx)(`span`,{className:`text-muted-foreground/50`,children:t.length})]}),(0,P.jsx)(`ul`,{children:lt(t,E,se).map(ye)})]},e)):(0,P.jsx)(`ul`,{children:ve.map(ye)})})]})}var hn=[{name:`/reply`,source:`skill`,description:`Reply to a relay message by id`,argumentHint:`<messageId> <body>`},{name:`/message`,source:`skill`,description:`Send a relay message to an agent, label, tag, or broadcast`,argumentHint:`<target> <body>`},{name:`/pair`,source:`skill`,description:`Start or manage a two-agent pair session`},{name:`/react`,source:`skill`,description:`Add a reaction to a relay message`,argumentHint:`<messageId> <emoji>`},{name:`/read-message`,source:`skill`,description:`Fetch a full relay message by id`,argumentHint:`<messageId>`},{name:`/send-claimable`,source:`skill`,description:`Enqueue a claimable work item for one agent to claim`},{name:`/status`,source:`skill`,description:`Show this agent's relay status`},{name:`/tags`,source:`skill`,description:`List or update this agent's relay tags`},{name:`/label`,source:`skill`,description:`Read, set, or clear this agent's relay label`},{name:`/disconnect`,source:`skill`,description:`End the current relay pair session`}],gn={"/clear":{description:`Clear conversation history and free up context`},"/compact":{description:`Compact the conversation to reclaim context`,argumentHint:`[instructions]`},"/model":{description:`Switch the active model`,argumentHint:`[model]`},"/help":{description:`Show help`},"/new":{description:`Start a new thread`}};function _n(e){return[...((e?Fe(e):void 0)?.slashCommands??[]).map(e=>({name:e,source:`builtin`,...gn[e]})),...hn]}function vn({agentId:e,className:t}){let n=j(t=>t.presenceByAgent[e]),r=j(e=>e.usersById),i=ce(),a=(n??[]).filter(e=>e.clientId!==i);if(a.length===0)return null;let o=Array.from(new Set(a.map(e=>Ze(e.userId,r)))),s=a.some(e=>e.typing),c=o.length===1?o[0]:`${o.length} viewers`,l=s?p:S;return(0,P.jsxs)(`span`,{title:`${o.join(`, `)}${s?` · typing`:` · viewing`}`,className:k(`inline-flex items-center gap-1 rounded-full bg-muted/40 px-2 py-0.5 text-[11px] text-muted-foreground`,t),children:[(0,P.jsx)(l,{className:k(`h-3 w-3 shrink-0`,s&&`text-emerald-400`)}),(0,P.jsxs)(`span`,{className:`truncate max-w-[12ch]`,children:[c,s&&o.length===1?` is typing…`:``]})]})}function yn({selectedInboxThread:e,agent:n,now:a,blockedState:o,thread:s,exportableThread:c,importedHistory:l,showBackButton:u,onBack:d,openAgentDetail:p,openWorkspaceFocus:m,voiceTtsEnabled:g,setVoiceTtsEnabled:_,canOpenTerminal:v,terminalOpening:y,handleOpenTerminal:b,canInterrupt:S,interruptAgent:C,canCompact:w,canClearContext:E,canShutdown:D,openConfirm:ee,workspaceAction:te,doAgentAction:ae,openFilesForAgent:oe,forkFromAgent:ce,markInboxThreadUnread:O,markInboxThreadRead:de,exportThread:pe,onOpenSearch:k}){return(0,P.jsxs)(`div`,{className:`flex items-center justify-between px-3 md:px-4 py-2.5 md:py-3 border-b border-border shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 md:gap-2.5 min-w-0`,children:[u&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,onClick:d,className:`shrink-0 -ml-1`,children:(0,P.jsx)(f,{className:`w-4 h-4`})}),(0,P.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 md:gap-2.5 min-w-0 hover:opacity-80 transition-opacity`,onClick:()=>n&&p(n),disabled:!n,children:[(0,P.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,P.jsx)(nt,{agent:n}),(0,P.jsx)(wt,{agent:n,now:a,className:`absolute -bottom-0.5 -right-0.5 w-2 h-2`})]}),(0,P.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,P.jsxs)(`p`,{className:`flex items-center gap-1 text-sm font-medium truncate`,children:[n&&(0,P.jsx)(rn,{profile:an(n),className:`shrink-0`}),(0,P.jsx)(`span`,{className:`truncate`,children:n?Ge(n):e})]}),n&&(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[o?`blocked: ${o.label}`:n.status,n.machine&&` · ${n.machine}`,typeof n.meta?.cwd==`string`&&n.meta.cwd&&` · ${Be(n.meta.cwd,1)}`]})]})]}),n&&(0,P.jsx)(zt,{agent:n,compact:!0,className:`hidden @4xl/chat:flex shrink-0`}),n&&xt(n)&&(0,P.jsx)(Mt,{context:n.context,expected:!0}),n?.branchState&&n.branchWorkspaceId&&(0,P.jsx)(on,{state:n.branchState,className:`shrink-0`,onClick:()=>void m(n.branchWorkspaceId)}),s?.attention.unread?(0,P.jsxs)($e,{className:`bg-red-500/20 text-red-400 text-xs shrink-0 hidden @2xl/chat:flex`,children:[s.attention.unread,` unread`]}):null,n&&(0,P.jsx)(vn,{agentId:n.id,className:`shrink-0 hidden @3xl/chat:inline-flex`})]}),(0,P.jsx)(`div`,{className:`flex items-center gap-0.5 md:gap-1 shrink-0`,children:n&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(tt,{value:n.id,label:`Copy agent ID`,size:`icon-sm`}),k&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Search this chat`,onClick:k,children:(0,P.jsx)(le,{className:`w-3.5 h-3.5`})}),Te.available&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:g?`Speaking agent responses aloud — click to mute (engine & voice in Settings)`:`Speak agent responses aloud (active chat) — engine & voice in Settings`,className:g?`text-primary`:``,onClick:()=>_(!g),children:g?(0,P.jsx)(ue,{className:`w-3.5 h-3.5`}):(0,P.jsx)(ne,{className:`w-3.5 h-3.5`})}),v&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,disabled:y,title:`Terminal`,onClick:()=>void b(),children:(0,P.jsx)(T,{className:`w-3.5 h-3.5`})}),S&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-red-400 hover:text-red-300`,title:`Interrupt`,onClick:C,children:(0,P.jsx)(se,{className:`w-3.5 h-3.5`})}),(n.branchState===`changes`||n.branchState===`idle`)&&n.branchWorkspaceId&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex text-amber-400 hover:text-amber-300`,title:`Mark workspace ready — hand off to the auto-merge`,onClick:()=>ee(`Mark Workspace Ready`,`Mark ${Ge(n)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>te(n.branchWorkspaceId,`ready`)),children:(0,P.jsx)(x,{className:`w-3.5 h-3.5`})}),w&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Compact`,onClick:()=>ee(`Compact Agent`,`Compact context for ${Ge(n)}?`,()=>ae(n,`compact`)),children:(0,P.jsx)(ie,{className:`w-3.5 h-3.5`})}),E&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Clear context`,onClick:()=>ee(`Clear Context`,`Clear context for ${Ge(n)}?`,()=>ae(n,`clearContext`)),children:(0,P.jsx)(t,{className:`w-3.5 h-3.5`})}),D&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Shutdown`,onClick:()=>ee(`Shutdown Agent`,`Shutdown ${Ge(n)}?`,()=>ae(n,`shutdown`)),children:(0,P.jsx)(r,{className:`w-3.5 h-3.5`})}),n&&typeof n.meta?.cwd==`string`&&n.meta.cwd&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Open ${n.meta.cwd} in Files`,onClick:()=>void oe(n),children:(0,P.jsx)(i,{className:`w-3.5 h-3.5`})}),n&&s&&s.messages.length>0&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Fork — spawn new agent with this chat history`,onClick:()=>ce(n.id,s.messages),children:(0,P.jsx)(h,{className:`w-3.5 h-3.5`})}),s&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark unread`,onClick:()=>O(e),children:(0,P.jsx)(fe,{className:`w-3.5 h-3.5`})}),s&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Mark read`,onClick:()=>de(s.peer,s.messages),children:(0,P.jsx)(ye,{className:`w-3.5 h-3.5`})}),c&&(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`hidden @4xl/chat:inline-flex`,title:`Export thread`,onClick:()=>pe({...c,importedHistory:l},`json`),children:(0,P.jsx)(me,{className:`w-3.5 h-3.5`})}),(0,P.jsxs)(Ut,{children:[(0,P.jsx)(bt,{asChild:!0,children:(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`@4xl/chat:hidden`,children:(0,P.jsx)(re,{className:`w-3.5 h-3.5`})})}),(0,P.jsxs)(Lt,{align:`end`,children:[v&&(0,P.jsxs)(jt,{disabled:y,onClick:()=>void b(),children:[(0,P.jsx)(T,{className:`w-3.5 h-3.5`}),`Terminal`]}),S&&(0,P.jsxs)(jt,{onClick:C,children:[(0,P.jsx)(se,{className:`w-3.5 h-3.5`}),`Interrupt`]}),(n.branchState===`changes`||n.branchState===`idle`)&&n.branchWorkspaceId&&(0,P.jsxs)(jt,{onClick:()=>ee(`Mark Workspace Ready`,`Mark ${Ge(n)}'s branch ready to land? The relay auto-merge will rebase and land it.`,()=>te(n.branchWorkspaceId,`ready`)),children:[(0,P.jsx)(x,{className:`w-3.5 h-3.5`}),`Mark Ready`]}),w&&(0,P.jsxs)(jt,{onClick:()=>ee(`Compact Agent`,`Compact context for ${Ge(n)}?`,()=>ae(n,`compact`)),children:[(0,P.jsx)(ie,{className:`w-3.5 h-3.5`}),`Compact`]}),E&&(0,P.jsxs)(jt,{onClick:()=>ee(`Clear Context`,`Clear context for ${Ge(n)}?`,()=>ae(n,`clearContext`)),children:[(0,P.jsx)(t,{className:`w-3.5 h-3.5`}),`Clear Context`]}),D&&(0,P.jsxs)(jt,{onClick:()=>ee(`Shutdown Agent`,`Shutdown ${Ge(n)}?`,()=>ae(n,`shutdown`)),children:[(0,P.jsx)(r,{className:`w-3.5 h-3.5`}),`Shutdown`]}),n&&typeof n.meta?.cwd==`string`&&n.meta.cwd&&(0,P.jsxs)(jt,{onClick:()=>void oe(n),children:[(0,P.jsx)(i,{className:`w-3.5 h-3.5`}),`Open Files`]}),n&&s&&s.messages.length>0&&(0,P.jsxs)(jt,{onClick:()=>ce(n.id,s.messages),children:[(0,P.jsx)(h,{className:`w-3.5 h-3.5`}),`Fork`]}),(v||w||E||D)&&(0,P.jsx)(kt,{}),s&&(0,P.jsxs)(jt,{onClick:()=>O(e),children:[(0,P.jsx)(fe,{className:`w-3.5 h-3.5`}),`Mark Unread`]}),s&&(0,P.jsxs)(jt,{onClick:()=>de(s.peer,s.messages),children:[(0,P.jsx)(ye,{className:`w-3.5 h-3.5`}),`Mark Read`]}),c&&(0,P.jsxs)(jt,{onClick:()=>pe({...c,importedHistory:l},`json`),children:[(0,P.jsx)(me,{className:`w-3.5 h-3.5`}),`Download`]})]})]})]})})]})}function bn({query:e,position:t,total:n,onQueryChange:r,onNext:i,onPrev:a,onClose:s}){let l=(0,N.useRef)(null),u=e.trim().length>0,d=u&&n===0;function f(e){if(e.key===`Escape`){e.preventDefault(),s();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?a():i())}return(0,P.jsxs)(`section`,{className:`flex shrink-0 items-center gap-2 border-b border-border bg-card/45 px-3 py-2`,children:[(0,P.jsx)(le,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,P.jsx)(et,{ref:l,autoFocus:!0,value:e,onChange:e=>r(e.target.value),onKeyDown:f,placeholder:`Search this chat…`,"aria-label":`Search this chat`,className:`h-7 flex-1 text-sm`}),(0,P.jsx)(`span`,{className:`shrink-0 tabular-nums text-xs `+(d?`text-red-400`:`text-muted-foreground`),children:u?d?`No results`:`${t}/${n}`:``}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Previous match (Shift+Enter)`,disabled:n===0,onClick:a,children:(0,P.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Next match (Enter)`,disabled:n===0,onClick:i,children:(0,P.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,P.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,title:`Close search (Esc)`,onClick:s,children:(0,P.jsx)(D,{className:`h-3.5 w-3.5`})})]})]})}function xn({matches:e,activeIndex:t,onAccept:n,onHover:r}){return e.length===0?null:(0,P.jsx)(`div`,{className:`absolute bottom-full left-3 right-3 md:left-4 md:right-4 mb-2 z-20 max-h-64 overflow-auto rounded-xl border border-border bg-popover shadow-lg`,children:e.map((e,i)=>(0,P.jsxs)(`button`,{onMouseDown:t=>{t.preventDefault(),n(e)},onMouseEnter:()=>r(i),className:k(`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm`,i===t?`bg-accent`:`hover:bg-accent/50`),children:[(0,P.jsx)(`span`,{className:`font-medium shrink-0`,children:e.name}),e.argumentHint&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e.argumentHint}),e.description&&(0,P.jsx)(`span`,{className:`ml-auto truncate text-xs text-muted-foreground/70`,children:e.description})]},e.name))})}function Sn({value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:i,className:a}){let o=(0,N.useRef)(null);return(0,N.useEffect)(()=>{let e=o.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,200)+`px`)},[e]),(0,N.useEffect)(()=>{let e=window.visualViewport;if(!e)return;function t(){let e=o.current;!e||document.activeElement!==e||requestAnimationFrame(()=>{e.scrollIntoView({block:`nearest`,behavior:`smooth`})})}return e.addEventListener(`resize`,t),()=>e.removeEventListener(`resize`,t)},[]),(0,P.jsx)(`textarea`,{ref:o,value:e,onChange:t,onKeyDown:n,onPaste:r,placeholder:i,rows:1,className:k(`w-full resize-none rounded-xl border border-border bg-background px-3.5 py-2.5 text-sm`,`placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,`min-h-[42px] max-h-[200px] overflow-y-auto`,a)})}function Cn({item:e,onRemove:t}){let[n,r]=(0,N.useState)(!1),i=!!(e.previewUrl&&!e.error);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,disabled:!i,onClick:()=>r(!0),className:`group/pending relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded bg-muted disabled:cursor-default`,title:i?`Preview image`:e.fileName,children:e.previewUrl?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`h-full w-full object-cover`}),(0,P.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/0 group-hover/pending:bg-black/30 transition-colors`,children:(0,P.jsx)(_e,{className:`h-3.5 w-3.5 text-white opacity-0 group-hover/pending:opacity-100 transition-opacity drop-shadow-md`})})]}):e.error?(0,P.jsx)(v,{className:`h-4 w-4 text-red-400`}):e.uploading?(0,P.jsx)(pe,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,P.jsx)(l,{className:`h-4 w-4 text-muted-foreground`})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`p`,{className:`truncate font-medium`,children:e.fileName}),(0,P.jsx)(`p`,{className:k(`truncate text-muted-foreground`,e.error&&`text-red-400`),children:e.error||(e.uploading?`Uploading`:Pt(e.size))})]}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Remove attachment`,onClick:t,children:(0,P.jsx)(D,{className:`h-3.5 w-3.5`})})]}),e.previewUrl&&(0,P.jsx)(Kt,{open:n,onOpenChange:r,children:(0,P.jsxs)(Rt,{className:`max-w-[95vw] max-h-[95vh] w-auto p-0 bg-black/95 border-zinc-800 gap-0 overflow-hidden`,showCloseButton:!1,children:[(0,P.jsx)(Bt,{className:`sr-only`,children:e.fileName}),(0,P.jsxs)(`div`,{className:`relative flex items-center justify-center min-h-[200px]`,children:[(0,P.jsx)(`img`,{src:e.previewUrl,alt:e.fileName,className:`max-w-[93vw] max-h-[90vh] object-contain`}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>r(!1),className:`absolute top-2 right-2 rounded-md bg-black/60 hover:bg-black/80 p-2 text-white transition-colors`,title:`Close`,children:(0,P.jsx)(D,{className:`w-4 h-4`})})]})]})})]})}function wn({draft:e,placeholder:t,chatSending:r,disabled:i,hasPendingUploads:a,readyAttachmentCount:o,pendingAttachments:s,micAvailable:c,micState:l,slashMatches:u,slashActiveIndex:d,onDraftChange:f,onKeyDown:p,onPaste:m,onUploadFiles:h,onRemovePendingAttachment:g,onSend:_,onAcceptSlash:v,onSlashHover:y,onStartPtt:b,onStopPtt:x,footerText:S}){let w=(0,N.useRef)(null),[T,E]=(0,N.useState)(!1),D=!e.trim()&&o===0||a||r||i;return(0,P.jsxs)(`div`,{className:k(`relative shrink-0 border-t border-border px-3 md:px-4 py-2.5 md:py-3 safe-area-bottom`,T&&`bg-primary/5 ring-1 ring-primary/40`),onDragOver:e=>{e.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:e=>{e.preventDefault(),E(!1),h(e.dataTransfer.files)},children:[s.length>0&&(0,P.jsx)(`div`,{className:`mb-2 grid gap-2 sm:grid-cols-2`,children:s.map(e=>(0,P.jsx)(Cn,{item:e,onRemove:()=>g(e.id)},e.id))}),(0,P.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&h(e.target.files),e.currentTarget.value=``}}),(0,P.jsx)(xn,{matches:u,activeIndex:d,onAccept:v,onHover:y}),(0,P.jsxs)(`div`,{className:`hidden md:flex items-end gap-2`,children:[(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:r,onClick:()=>w.current?.click(),className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,P.jsx)(C,{className:`w-4 h-4`})}),(0,P.jsx)(Sn,{value:e,onChange:e=>f(e.target.value),onKeyDown:p,onPaste:m,placeholder:t,className:`flex-1`}),c&&(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:l===`recording`?`Release to transcribe`:`Hold to talk`,disabled:r||l===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}x()},className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px] ${l===`recording`?`text-red-400 animate-pulse`:``}`,children:l===`transcribing`?(0,P.jsx)(pe,{className:`w-4 h-4 animate-spin`}):(0,P.jsx)(A,{className:`w-4 h-4`})}),(0,P.jsx)(M,{size:`icon`,disabled:D,onClick:_,className:`shrink-0 mb-0.5 rounded-xl h-[42px] w-[42px]`,children:(0,P.jsx)(n,{className:`w-4 h-4`})})]}),(0,P.jsxs)(`div`,{className:`md:hidden space-y-2`,children:[(0,P.jsx)(Sn,{value:e,onChange:e=>f(e.target.value),onKeyDown:p,onPaste:m,placeholder:t,className:`w-full`}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:`Attach files`,disabled:r,onClick:()=>w.current?.click(),className:`rounded-xl h-9 w-9`,children:(0,P.jsx)(C,{className:`w-4 h-4`})}),c&&(0,P.jsx)(M,{variant:`ghost`,size:`icon`,title:l===`recording`?`Release to transcribe`:`Hold to talk`,disabled:r||l===`transcribing`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b()},onPointerUp:e=>{e.preventDefault();try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}x()},className:`rounded-xl h-9 w-9 ${l===`recording`?`text-red-400 animate-pulse`:``}`,children:l===`transcribing`?(0,P.jsx)(pe,{className:`w-4 h-4 animate-spin`}):(0,P.jsx)(A,{className:`w-4 h-4`})})]}),(0,P.jsx)(M,{size:`icon`,disabled:D,onClick:_,className:`rounded-xl h-9 w-9`,children:(0,P.jsx)(n,{className:`w-4 h-4`})})]})]}),S&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1.5 hidden md:block`,children:S})]})}var Tn=e(Ce(),1);function En({preview:e,error:t,onReadError:n,onMouseEnter:r,onMouseLeave:i}){let{anchor:a}=e,o=Math.min(560,window.innerWidth-24),s=Math.min(380,window.innerHeight-24),c=Math.max(12,Math.min(a.left,window.innerWidth-o-12));return(0,Tn.createPortal)((0,P.jsxs)(`div`,{className:`fixed z-50 flex flex-col overflow-hidden rounded-lg border border-border bg-background shadow-xl`,style:{top:window.innerHeight-a.bottom>=s+8?a.bottom+8:a.top-8-s>=12?a.top-8-s:Math.max(12,window.innerHeight-s-12),left:c,width:o,height:s},onMouseEnter:r,onMouseLeave:i,children:[(0,P.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-border px-2.5`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium text-muted-foreground`,children:e.path}),t&&(0,P.jsx)(`span`,{className:`max-w-[12rem] truncate text-[11px] text-red-400`,children:t}),(0,P.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:`click to pin`})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:e.type===`directory`?(0,P.jsx)(Ft,{orchestratorId:e.orchestratorId,selectedPath:e.path,onReadError:n}):(0,P.jsx)(Jt,{orchestratorId:e.orchestratorId,selectedPath:e.path,line:e.line,onReadError:n})})]}),document.body)}var Dn=[];function On(e){return j(t=>t.chatStatusEvents[e]??Dn)}function kn(e,t){let n=(0,N.useRef)(!1);(0,N.useEffect)(()=>{if(!e)return;n.current||=(window.history.pushState({chatGuard:!0},``),!0);function r(e){(e.state?.chatGuard!==void 0||!n.current)&&(window.history.pushState({chatGuard:!0},``),t())}function i(e){e.preventDefault()}return window.addEventListener(`popstate`,r),window.addEventListener(`beforeunload`,i),()=>{window.removeEventListener(`popstate`,r),window.removeEventListener(`beforeunload`,i)}},[e,t]),(0,N.useEffect)(()=>{!e&&n.current&&(n.current=!1)},[e])}function An(e,t){let n=e.toLowerCase(),r=t.trim().toLowerCase();return r?n.includes(r)?!0:/\s/.test(r)||r.length<4?!1:jn(n,r):!1}function jn(e,t,n=4){let r=0,i=-1;for(let a=0;a<e.length&&r<t.length;a+=1)if(e[a]===t[r]){if(i!==-1&&a-i-1>n)return!1;i=a,r+=1}return r===t.length}function Mn(e,t){let n=t.trim();if(!n)return[];let r=[];for(let t of e){let e=gt(t);e&&An(e,n)&&r.push(Xt(t))}return r}function Nn(e){let[t,n]=(0,N.useState)(!1),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(0),s=(0,N.useMemo)(()=>t?Mn(e,r):[],[t,r,e]),c=(0,N.useMemo)(()=>new Set(s),[s]),l=s.length,u=l?Math.min(a,l-1):0,d=l?s[u]??null:null,f=(0,N.useCallback)(()=>n(!0),[]),p=(0,N.useCallback)(()=>{n(!1),i(``),o(0)},[]),m=(0,N.useCallback)(e=>{i(e),o(0)},[]),h=(0,N.useCallback)(()=>{o(e=>l?(e+1)%l:0)},[l]),g=(0,N.useCallback)(()=>{o(e=>l?(e-1+l)%l:0)},[l]);return{open:t,query:r,matchKeys:s,matchKeySet:c,total:l,position:l?u+1:0,currentKey:d,openSearch:f,close:p,setQuery:m,next:h,prev:g}}var Pn=1e4;function Fn(e,t){let n=j(e=>e.announcePresence),r=(0,N.useRef)(t);r.current=t,(0,N.useEffect)(()=>{if(!e)return;n(e,r.current);let t=setInterval(()=>{n(e,r.current)},Pn);return()=>{clearInterval(t),n(e,!1,!0)}},[e,n]),(0,N.useEffect)(()=>{e&&n(e,t)},[e,t,n])}var In=0,Ln=1,Rn=2,zn=4;function Bn(e){return()=>e}function Vn(e){e()}function Hn(e,t){return n=>e(t(n))}function Un(e,t){return()=>e(t)}function Wn(e,t){return n=>e(t,n)}function Gn(e){return e!==void 0}function Kn(...e){return()=>{e.map(Vn)}}function qn(){}function Jn(e,t){return t(e),e}function Yn(e,t){return t(e)}function F(...e){return e}function I(e,t){return e(Ln,t)}function L(e,t){e(In,t)}function Xn(e){e(Rn)}function R(e){return e(zn)}function z(e,t){return I(e,Wn(t,In))}function Zn(e,t){let n=e(Ln,e=>{n(),t(e)});return n}function Qn(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function $n(e,t){return e===t}function B(e=$n){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function V(e){return t=>n=>{e(n)&&t(n)}}function H(e){return t=>Hn(t,e)}function er(e){return t=>()=>{t(e)}}function U(e,...t){let n=ir(...t);return((t,r)=>{switch(t){case Rn:Xn(e);return;case Ln:return I(e,n(r))}})}function tr(e,t){return n=>r=>{n(t=e(t,r))}}function nr(e){return t=>n=>{e>0?e--:t(n)}}function rr(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function W(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;I(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function ir(...e){return t=>e.reduceRight(Yn,t)}function ar(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case Ln:return a?n===a?void 0:(r(),n=a,t=I(e,a),t):(r(),qn);case Rn:r(),n=null;return}}}function G(e){let t=e,n=K();return((e,r)=>{switch(e){case In:t=r;break;case Ln:r(t);break;case zn:return t}return n(e,r)})}function or(e,t){return Jn(G(t),t=>z(e,t))}function K(){let e=[];return((t,n)=>{switch(t){case In:e.slice().forEach(e=>{e(n)});return;case Rn:e.splice(0,e.length);return;case Ln:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function sr(e){return Jn(K(),t=>z(e,t))}function q(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:cr(),singleton:n}}var cr=()=>Symbol();function lr(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function ur(...e){let t=K(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;I(e,e=>{n[a]=e,r|=o,r===i&&L(t,n)})}),function(e,a){switch(e){case Rn:Xn(t);return;case Ln:return r===i&&a(n),I(t,a)}}}function J(e,t=$n){return U(e,B(t))}function dr(...e){return function(t,n){switch(t){case Rn:return;case Ln:return Kn(...e.map(e=>I(e,n)))}}}var fr={DEBUG:0,INFO:1,WARN:2,ERROR:3},pr={[fr.DEBUG]:`debug`,[fr.ERROR]:`error`,[fr.INFO]:`log`,[fr.WARN]:`warn`},mr=()=>typeof globalThis>`u`?window:globalThis,hr=q(()=>{let e=G(fr.ERROR);return{log:G((t,n,r=fr.INFO)=>{r>=(mr().VIRTUOSO_LOG_LEVEL??R(e))&&console[pr[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0}),gr=new WeakMap;function _r(e){return`self`in e?e.document.documentElement:e}function vr(e){let t=_r(e),n=gr.get(t);if(n!==void 0)return n;let r=t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`;return gr.set(t,r),r}function yr(e){gr.delete(_r(e))}function br(e,t){return vr(e)?-t:t}var xr=br;function Sr(e,t){return br(e,t)}function Cr(e,t,n){return wr(e,t,n).callbackRef}function wr(e,t,n){let r=N.useRef(null),i=e=>{},a=N.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function Tr(e,t,n,r,i,a,o,s,c){return wr(N.useCallback(n=>{let c=Er(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?xr(o,o.scrollLeft):o.scrollTop:u?s?xr(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?xr(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?Dr(`column-gap`,getComputedStyle(n).columnGap,i):Dr(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function Er(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},fr.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function Dr(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,fr.WARN),t===`normal`?0:parseInt(t??`0`,10)}function Or(e,t,n){let r=N.useRef(null),i=N.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=wr(i,!0,n),s=N.useCallback(()=>{i(o.current)},[i,o]);return N.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var kr=q(()=>{let e=K(),t=K(),n=G(0),r=K(),i=G(0),a=K(),o=K(),s=G(0),c=G(0),l=G(0),u=G(0),d=K(),f=K(),p=G(!1),m=G(!1),h=G(!1);return z(U(e,H(({scrollTop:e})=>e)),t),z(U(e,H(({scrollHeight:e})=>e)),o),z(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),Ar={lvl:0};function jr(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function Y(e){return e===Ar}function Mr(e,t){if(!Y(e))return t===e.k?e.v:t<e.k?Mr(e.l,t):Mr(e.r,t)}function Nr(e,t,n=`k`){if(Y(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=Nr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Nr(e.l,t,n)}function Pr(e,t,n){return Y(e)?Gr(t,n,1):t===e.k?Vr(e,{k:t,v:n}):t<e.k?Kr(Vr(e,{l:Pr(e.l,t,n)})):Kr(Vr(e,{r:Pr(e.r,t,n)}))}function Fr(){return Ar}function Ir(e,t,n){if(Y(e))return[];let r=Nr(e,t)[0];return Yr(zr(e,r,n))}function Lr(e,t){if(Y(e))return Ar;let{k:n,l:r,r:i}=e;if(t===n){if(Y(r))return i;if(Y(i))return r;let[t,n]=Wr(r);return Br(Vr(e,{k:t,l:Hr(r),v:n}))}return Br(t<n?Vr(e,{l:Lr(r,t)}):Vr(e,{r:Lr(i,t)}))}function Rr(e){return Y(e)?[]:[...Rr(e.l),{k:e.k,v:e.v},...Rr(e.r)]}function zr(e,t,n){if(Y(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(zr(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(zr(a,t,n))),s}function Br(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Ur(t))return qr(Vr(e,{lvl:n-1}));if(!Y(t)&&!Y(t.r))return Vr(t.r,{l:Vr(t,{r:t.r.l}),lvl:n,r:Vr(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(Ur(e))return Jr(Vr(e,{lvl:n-1}));if(!Y(r)&&!Y(r.l)){let t=r.l,i=Ur(t)?r.lvl-1:r.lvl;return Vr(t,{l:Vr(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:Jr(Vr(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function Vr(e,t){return Gr(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function Hr(e){return Y(e.r)?e.l:Br(Vr(e,{r:Hr(e.r)}))}function Ur(e){return Y(e)||e.lvl>e.r.lvl}function Wr(e){return Y(e.r)?[e.k,e.v]:Wr(e.r)}function Gr(e,t,n,r=Ar,i=Ar){return{k:e,l:r,lvl:n,r:i,v:t}}function Kr(e){return Jr(qr(e))}function qr(e){let{l:t}=e;return!Y(t)&&t.lvl===e.lvl?Vr(t,{r:Vr(e,{l:t.r})}):e}function Jr(e){let{lvl:t,r:n}=e;return!Y(n)&&!Y(n.r)&&n.lvl===t&&n.r.lvl===t?Vr(n,{l:Vr(e,{r:n.l}),lvl:t+1}):e}function Yr(e){return jr(e,({k:e,v:t})=>({index:e,value:t}))}function Xr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Zr(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var Qr=q(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function $r(e,t,n){return e[ei(e,t,n)]}function ei(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function ti(e,t,n,r){let i=ei(e,t,r),a=ei(e,n,r,i);return e.slice(i,a+1)}function ni(e,t){return Math.round(e.getBoundingClientRect()[t])}function ri(e){return!Y(e.groupOffsetTree)}function ii({index:e},t){return t===e?0:t<e?-1:1}function ai(){return{groupIndices:[],groupOffsetTree:Fr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Fr()}}function oi(e,t){let n=Y(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),Y(e)){e=Pr(e,0,i);continue}let o=Ir(e,a-1,t+1);if(o.some(vi(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=Lr(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=Pr(e,t+1,a));c&&(e=Pr(e,a,i))}return[e,n]}function si(e){return typeof e.groupIndex<`u`}function ci({offset:e},t){return t===e?0:t<e?-1:1}function li(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=$r(t,e,ii),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function ui(e,t){if(!ri(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function di(e,t,n){if(si(e))return t.groupIndices[e.groupIndex]+1;let r=ui(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function fi(e,t,n,r=0){return r>0&&(t=Math.max(t,$r(e,r,ii).offset)),jr(ti(e,t,n,ci),_i)}function pi(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,fr.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Y(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>Pr(Pr(t,n,e),n+1,r),o)}else [o,s]=oi(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=gi(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>Pr(e,t,li(t,d,i)),Fr()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function mi(e){return Rr(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function hi(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function gi(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=ei(i,t-1,ii),s=i[c].offset;let e=Nr(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===Nr(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of Ir(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function _i(e){return{index:e.index,value:e}}function vi(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var yi={offsetHeight:`height`,offsetWidth:`width`},bi=q(([{log:e},{recalcInProgress:t}])=>{let n=K(),r=K(),i=or(r,0),a=K(),o=K(),s=G(0),c=G([]),l=G(void 0),u=G(void 0),d=G(void 0),f=G(void 0),p=G((e,t)=>ni(e,yi[t])),m=G(void 0),h=G(0),g=ai(),_=or(U(n,W(c,e,h),tr(pi,g),B()),g),v=or(U(c,B(),tr((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),H(({prev:e})=>e)),[]);z(U(c,V(e=>e.length>0),W(_,h),H(([e,t,n])=>{let r=e.reduce((e,r,i)=>Pr(e,r,li(r,t.offsetTree,n)||i),Fr());return{...t,groupIndices:e,groupOffsetTree:r}})),_),z(U(r,W(_),V(([e,{lastIndex:t}])=>e<t),H(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),z(l,u);let y=or(U(l,H(e=>e===void 0)),!0);z(U(u,V(e=>e!==void 0&&Y(R(_).sizeTree)),H(e=>{let t=R(d),n=R(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),z(U(f,V(e=>e!==void 0&&e.length>0&&Y(R(_).sizeTree)),H(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),z(U(c,W(d,u),V(([,e,t])=>e!==void 0&&t!==void 0),H(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=sr(U(n,W(_),tr(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),H(e=>e.changed)));I(U(s,tr((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),H(e=>e.diff)),e=>{let{groupIndices:n}=R(_);if(e>0)L(t,!0),L(a,e+hi(e,n));else if(e<0){let t=R(v);t.length>0&&(e-=hi(-e,t)),L(o,e)}}),I(U(s,W(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},fr.ERROR)});let x=sr(a);z(U(a,W(_),H(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Mr(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=Rr(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Rr(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=sr(U(o,W(_,h),H(([e,{offsetTree:t},n])=>li(-e,t,n))));return z(U(o,W(_,h),H(([e,t,n])=>{if(t.groupIndices.length>0){if(Y(t.sizeTree))return t;let r=Fr(),i=R(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=Rr(t.sizeTree).reduce((t,{k:n,v:r})=>Pr(t,Math.max(0,n+e),r),r),a!==-e){let n=Mr(t.sizeTree,s);r=Pr(r,0,n);let i=Nr(t.sizeTree,-e+1)[1];r=Pr(r,1,i)}return{...t,sizeTree:r,...gi(t.offsetTree,0,r,n)}}let r=Rr(t.sizeTree).reduce((t,{k:n,v:r})=>Pr(t,Math.max(0,n+e),r),Fr());return{...t,sizeTree:r,...gi(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},F(hr,Qr),{singleton:!0});function xi(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var Si=q(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=K(),o=K(),s=sr(U(a,H(xi)));return z(U(s,H(e=>e.totalCount)),n),z(U(s,H(e=>e.groupIndices)),e),z(U(ur(i,t,r),V(([e,t])=>ri(t)),H(([e,t,n])=>Nr(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),B(),H(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},F(bi,kr)),Ci=q(([{log:e}])=>{let t=G(!1),n=sr(U(t,V(e=>e),B()));return I(t,t=>{t&&R(e)(`props updated`,{},fr.DEBUG)}),{didMount:n,propsReady:t}},F(hr),{singleton:!0}),wi=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function Ti(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!wi)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var Ei=q(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=K(),m=K(),h=G(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),L(c,!1)}return z(U(p,W(n,d,r,h,s,o,f),W(e,a,i),H(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=Ti(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=di(b,n,w),E=li(T,n.offsetTree,d)+o;x===`end`?(E+=f+Nr(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+Nr(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},fr.DEBUG),L(p,e)):(L(m,!0),l(`list did not change, scroll successful`,{},fr.DEBUG))};if(y(),S===`smooth`){let e=!1;v=I(t,t=>{e||=t}),g=Zn(u,()=>{D(e)})}else g=Zn(U(t,Di(150)),D);return _=setTimeout(()=>{y()},1200),L(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},fr.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},F(bi,kr,hr),{singleton:!0});function Di(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Oi(e,t){e===0?t():requestAnimationFrame(()=>{Oi(e-1,t)})}function ki(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Ai=q(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=G(!0),c=G(0),l=G(!0);return z(U(o,W(c),V(([e,t])=>t!==0),er(!1)),s),z(U(o,W(c),V(([e,t])=>t!==0),er(!1)),l),I(U(ur(t,o),W(s,n,e,l),V(([[,e],t,{sizeTree:n},r,i])=>e&&(!Y(n)||Gn(r))&&!t&&!i),W(c)),([,e])=>{Zn(i,()=>{L(l,!0)}),Oi(4,()=>{Zn(r,()=>{L(s,!0)}),L(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},F(bi,kr,Ei,Ci),{singleton:!0});function ji(e,t){return Math.abs(e-t)<1.01}var Mi=`up`,Ni=`down`,Pi=`none`,Fi={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ii=0,Li=q(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=G(!1),s=G(!0),c=K(),l=K(),u=G(4),d=G(Ii),f=or(U(dr(U(J(i),nr(1),er(!0)),U(J(i),nr(1),er(!1),Qn(100))),B()),!1),p=or(U(dr(U(n,er(!0)),U(n,er(!1),Qn(200))),B()),!1);z(U(ur(J(i),J(d)),H(([e,t])=>e<=t),B()),s),z(U(s,rr(50)),l);let m=sr(U(ur(r,J(a),J(t),J(e),J(u)),tr((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},Fi),B((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=or(U(r,tr((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!ji(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),V(e=>e.changed),H(e=>e.jump)),0);z(U(m,H(e=>e.atBottom)),o),z(U(o,rr(50)),c);let g=G(Ni);z(U(r,H(({scrollTop:e})=>e),B(),tr((e,t)=>R(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Mi:Ni,prevScrollTop:t},{direction:Ni,prevScrollTop:0}),H(e=>e.direction)),g),z(U(r,rr(50),er(Pi)),g);let _=G(0);return z(U(f,V(e=>!e),er(0)),_),z(U(i,rr(100),W(f),V(([e,t])=>t),tr(([e,t],[n])=>[t,n],[0,0]),H(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},F(kr)),Ri=`top`,zi=`bottom`,Bi=`none`;function Vi(e,t,n){return typeof e==`number`?n===Mi&&t===Ri||n===Ni&&t===zi?e:0:n===Mi?t===Ri?e.main:e.reverse:t===zi?e.main:e.reverse}function Hi(e,t){return typeof e==`number`?e:e[t]??0}var Ui=q(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=K(),o=G(0),s=G(0),c=G(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:or(U(ur(J(r),J(i),J(n),J(a,Zr),J(c),J(o),J(t),J(e),J(s)),H(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=Bi,m=Hi(l,Ri),h=Hi(l,zi);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=Mi),i<e-f+t+h&&(p=Ni),p===Bi?null:[Math.max(u-n-Vi(a,Ri,p)-m,0),u-f-s+t+Vi(a,zi,p)+h]}),V(e=>e!==null),B(Zr)),[0,0])}},F(kr),{singleton:!0});function Wi(e,t,n){if(ri(t)){let r=ui(e,t);return[{index:Nr(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var Gi={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ki(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:Ji(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:Ji(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function qi(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=ki(t,s);return Ki(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function Ji(e,t,n){if(e.length===0)return[];if(!ri(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=Ir(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function Yi(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var Xi=q(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=G([]),g=G(0),_=K(),v=G(0);z(a.topItemsIndexes,h);let y=or(U(ur(p,m,J(c,Zr),J(i),J(r),J(l),u,J(h),J(t),J(n),J(v),e),V(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),H(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=R(g);if(n===0)return{...Gi,totalCount:n};if(e===0&&t===0)return m===0?{...Gi,totalCount:n}:qi(m,i,r,s,c,u||[]);if(Y(p))return m>0?null:Ki(Wi(ki(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of Ir(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return Ki([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=fi(f,e,t,_);if(v.length===0)return null;let y=n-1,b=Jn([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=Yi(l,Ri),S=Yi(l,zi);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=Ir(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=Ir(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return Ki(b,h,n,c,d,s)}),V(e=>e!==null),B()),Gi);z(U(e,V(Gn),H(e=>e?.length)),i),z(U(y,H(e=>e.topListHeight)),d),z(d,s),z(U(y,H(e=>[e.top,e.bottom])),o),z(U(y,H(e=>e.items)),_);let b=sr(U(y,V(({items:e})=>e.length>0),W(i,e),V(([{items:e},t])=>e[e.length-1].originalIndex===t-1),H(([,e,t])=>[e-1,t]),B(Zr),H(([e])=>e))),x=sr(U(y,rr(200),V(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),H(({items:e})=>e[0].index),B()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:sr(U(y,V(({items:e})=>e.length>0),H(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),B(Xr))),startReached:x,topItemsIndexes:h,...f}},F(bi,Si,Ui,Ai,Ei,Li,Ci,Qr),{singleton:!0}),Zi=q(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=K(),o=or(U(ur(n,e,r,t,i),H(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return z(J(o),a),{totalListHeight:o,totalListHeightChanged:a}},F(kr,Xi),{singleton:!0}),Qi=q(([{viewportHeight:e},{totalListHeight:t}])=>{let n=G(!1);return{alignToBottom:n,paddingTopAddition:or(U(ur(n,e,t),V(([e])=>e),H(([,e,t])=>Math.max(0,e-t)),rr(0),B()),0)}},F(kr,Zi),{singleton:!0}),$i=q(()=>({context:G(null)})),ea=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,ta=q(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=K();return z(U(u,W(t,c,n,a,i,r,s),W(e),H(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=ea,done:d,...f}=e,p=di(e,t,r-1),m=li(p,t.offsetTree,l)+i+a,h=m+Nr(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&Zn(U(o,V(e=>!e),nr(R(o)?1:2)),d),_}),V(e=>e!==null)),l),{scrollIntoView:u}},F(bi,kr,Ei,Xi,hr),{singleton:!0});function na(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var ra=(e,t)=>typeof e==`function`?na(e(t)):t&&na(e),ia=q(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=G(!1),h=K(),g=null;function _(e){L(o,{align:`end`,behavior:e,index:`LAST`})}I(U(ur(U(J(t),nr(1)),c),W(J(m),a,s,d),H(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=ra(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),V(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),R(n)===void 0?g=Zn(e,()=>{R(u)(`following output to `,{totalCount:r},fr.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{R(u)(`following output to `,{totalCount:r},fr.DEBUG),_(t)})});function v(e){let t=Zn(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(R(u)(`scrolling to bottom due to increased size`,{},fr.DEBUG),_(`auto`))});setTimeout(t,100)}I(U(ur(J(m),t,l),V(([e,,t])=>e!==!1&&t),tr(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),V(({refreshed:e})=>e),W(m,t)),([,e])=>{R(s)&&v(e!==!1)}),I(h,()=>{v(R(m)!==!1)}),I(ur(J(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=G(null),b=K();return z(dr(U(J(r),H(e=>e?.length??0)),U(J(t))),b),I(U(ur(U(b,nr(1)),c),W(J(y),s,d,f),H(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),V(e=>!!e),rr(0)),t=>{g!==null&&(g(),g=null),R(n)===void 0?g=Zn(e,()=>{R(u)(`scrolling into view`,{}),L(p,t),g=null}):requestAnimationFrame(()=>{R(u)(`scrolling into view`,{}),L(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},F(bi,Li,Ei,Ai,Ci,hr,kr,$i,ta)),aa=q(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(z(U(s,W(a),V(([,e])=>e!==0),W(i,r,t,n,e),H(([[,e],t,n,r,i,a=[]])=>qi(e,t,n,r,i,a))),o),{}),F(bi,Ai,Xi,Ci),{singleton:!0}),oa=q(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=G(0);return I(U(e,W(r),V(([,e])=>e!==0),H(([,e])=>({top:e}))),e=>{Zn(U(n,nr(1),V(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{L(t,e)})})}),{initialScrollTop:r}},F(Ci,kr,Xi),{singleton:!0}),sa=q(([{scrollVelocity:e}])=>{let t=G(!1),n=K(),r=G(!1);return z(U(e,W(r,t,n),V(([e,t])=>t!==!1&&t!==void 0),H(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),B()),t),I(U(ur(t,e,n),W(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},F(Li),{singleton:!0}),ca=q(([{scrollContainerState:e,scrollTo:t}])=>{let n=K(),r=K(),i=K(),a=G(!1),o=G(void 0);return z(U(ur(n,r),H(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),z(U(t,W(r),H(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},F(kr)),la=q(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=K(),u=G(void 0),d=G(null),f=G(null);return z(s,d),z(c,f),I(U(l,W(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=mi(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),z(U(u,V(Gn),H(ua)),i),z(U(a,W(u),V(([,e])=>e!==void 0),B(),H(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},F(bi,kr,Ai,Ci,ca));function ua(e){return{align:`start`,index:0,offset:e.scrollTop}}var da=q(([{topItemsIndexes:e}])=>{let t=G(0);return z(U(t,V(e=>e>=0),H(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},F(Xi));function fa(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var pa=fa(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),ma=q(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:ee,rangeChanged:te,...ne}=b;return z(te,T.scrollSeekRangeChanged),z(U(T.windowViewportRect,H(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:ee,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:te,...ne,...T,..._,sizes:u,...v}},F(bi,Ai,kr,la,ia,Xi,Ei,q(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=sr(U(c,W(o),tr(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),V(([e])=>e!==0),W(r,s,n,i,p,m),V(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===Mi),H(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},fr.DEBUG),e))));function g(n){n>0?(L(t,{behavior:`auto`,top:-n}),L(e,0)):(L(e,0),L(t,{behavior:`auto`,top:-n}))}return I(U(h,W(e,a)),([t,n,r])=>{r&&pa()?L(e,n-t):g(-t)}),I(U(ur(or(a,!1),e,m),V(([e,t,n])=>!e&&!n&&t!==0),H(([e,t])=>t),rr(1)),g),z(U(d,H(e=>({top:-e}))),t),I(U(l,W(f,u),H(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=Mr(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{L(e,n),requestAnimationFrame(()=>{L(t,{top:n}),requestAnimationFrame(()=>{L(e,0),L(m,!1)})})}),{deviation:e}},F(kr,Li,Xi,bi,hr,Qr)),da,Si,q(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),F(Ui,aa,Ci,sa,Zi,oa,Qi,ca,ta,hr,$i))));function ha(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var ga=typeof document<`u`?N.useLayoutEffect:N.useEffect;function _a(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=N.createContext({});function c(e,n){e.propsReady!==void 0&&L(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];L(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];L(i,n[r])}e.propsReady!==void 0&&L(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];L(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=ar(e[t.events[r]]),n),{})}return{Component:N.forwardRef(function(t,a){let{children:d,...f}=t,[p]=N.useState(()=>Jn(lr(e),e=>{c(e,f)})),[m]=N.useState(Un(u,p));ga(()=>{for(let e of o)e in f&&I(m[e],f[e]);return()=>{Object.values(m).map(Xn)}},[f,m,p]),ga(()=>{c(p,f)}),N.useImperativeHandle(a,Bn(l(p)));let h=n;return(0,P.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,P.jsx)(h,{...ha([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=N.useContext(s)[e];ga(()=>I(n,t),[t,n])},useEmitterValue:e=>{let t=N.useContext(s)[e],n=N.useCallback(e=>I(t,e),[t]);return N.useSyncExternalStore(n,()=>R(t),()=>R(t))},usePublisher:e=>{let t=N.useContext(s);return N.useCallback(n=>{L(t[e],n)},[t,e])}}}var va=N.createContext(void 0),ya=N.createContext(void 0),ba=`-webkit-sticky`,xa=`sticky`,Sa=fa(()=>{if(typeof document>`u`)return xa;let e=document.createElement(`div`);return e.style.position=ba,e.style.position===ba?ba:xa}),Ca=typeof document<`u`?N.useLayoutEffect:N.useEffect;function wa(e){return`self`in e}function Ta(e){return`body`in e}function Ea(e,t,n,r=qn,i,a){let o=N.useRef(null),s=N.useRef(null),c=N.useRef(null),l=N.useCallback(n=>{let r,i,o,l=n.target;if(Ta(l)||wa(l)){let e=wa(l)?l:l.defaultView;o=a===!0?xr(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?xr(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Tn.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);N.useEffect(()=>{let e=i||o.current;return yr(e),r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{yr(e),r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;wa(r)?(u=Math.max(ni(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?xr(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=ni(r,a===!0?`width`:`height`),d=a===!0?xr(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,ji(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:Sr(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:Sr(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Da(e){return e}var Oa=q(([e,t])=>({...e,...t}),F(ma,q(()=>{let e=G(e=>`Item ${e}`),t=G(e=>`Group ${e}`),n=G({}),r=G(Da),i=G(`div`),a=G(qn),o=(e,t=null)=>or(U(n,H(t=>t[e]),B()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),ka=({height:e})=>(0,P.jsx)(`div`,{style:{height:e}}),Aa={overflowAnchor:`none`,position:Sa(),zIndex:1},ja={overflowAnchor:`none`},Ma={...ja,display:`inline-block`,height:`100%`},Na=N.memo(function({showTopList:e=!1}){let t=Z(`listState`),n=Ya(`sizeRanges`),r=Z(`useWindowScroll`),i=Z(`customScrollParent`),a=Ya(`windowScrollContainerState`),o=Ya(`scrollContainerState`),s=i||r?a:o,c=Z(`itemContent`),l=Z(`context`),u=Z(`groupContent`),d=Z(`trackItemSizes`),f=Z(`itemSize`),p=Z(`log`),m=Ya(`gap`),h=Z(`horizontalDirection`),{callbackRef:g}=Tr(n,f,d,e?qn:s,p,m,i,h,Z(`skipAnimationFrameInResizeObserver`)),[_,v]=N.useState(0);Ja(`deviation`,e=>{_!==e&&v(e)});let y=Z(`EmptyPlaceholder`),b=Z(`ScrollSeekPlaceholder`)??ka,x=Z(`ListComponent`),S=Z(`ItemComponent`),C=Z(`GroupComponent`),w=Z(`computeItemKey`),T=Z(`isSeeking`),E=Z(`groupIndices`).length>0,D=Z(`alignToBottom`),ee=Z(`initialItemFinalLocationReached`),te=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?D?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...ee?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,P.jsx)(y,{...X(y,l)}):(0,P.jsx)(x,{...X(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:te,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,N.createElement)(b,{...X(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,N.createElement)(C,{...X(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Aa},u(e.index,l)):(0,N.createElement)(S,{...X(S,l),...za(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?Ma:ja},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),Pa={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Fa={outline:`none`,overflowX:`auto`,position:`relative`},Ia=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),La=(e,t,n=0)=>({...Ia(e),position:t?`relative`:`absolute`,top:t?-n:0}),Ra={position:Sa(),top:0,width:`100%`,zIndex:1};function X(e,t){if(typeof e!=`string`)return{context:t}}function za(e,t){return{item:typeof e==`string`?void 0:t}}var Ba=N.memo(function(){let e=Z(`HeaderComponent`),t=Ya(`headerHeight`),n=Z(`HeaderFooterTag`),r=Cr(N.useMemo(()=>e=>{t(ni(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),Va=N.memo(function(){let e=Z(`FooterComponent`),t=Ya(`footerHeight`),n=Z(`HeaderFooterTag`),r=Cr(N.useMemo(()=>e=>{t(ni(e,`height`))},[t]),!0,Z(`skipAnimationFrameInResizeObserver`)),i=Z(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})});function Ha({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=Ea(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,P.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Fa:Pa,...i},tabIndex:0,...o,...X(c,a),children:r})})}function Ua({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=N.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=Ea(s,l,c,t(`scrollerRef`),f);return Ca(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,P.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...X(c,a),children:r})})}var Wa=({children:e})=>{let t=N.useContext(va),n=Ya(`viewportHeight`),r=Ya(`fixedItemHeight`),i=Z(`alignToBottom`),a=Z(`horizontalDirection`),o=Cr(N.useMemo(()=>Hn(n,e=>ni(e,a?`width`:`height`)),[n,a]),!0,Z(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:Ia(i),children:e})},Ga=({children:e})=>{let t=N.useContext(va),n=Ya(`windowViewportRect`),r=Ya(`fixedItemHeight`),i=Z(`customScrollParent`),a=Z(`useWindowScroll`),o=Z(`topListHeight`),s=Or(n,i,Z(`skipAnimationFrameInResizeObserver`)),c=Z(`alignToBottom`);return N.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:La(c,a,o),children:e})},Ka=({children:e})=>{let t=Z(`TopItemListComponent`)??`div`,n=Z(`headerHeight`);return(0,P.jsx)(t,{style:{...Ra,marginTop:`${n}px`},...X(t,Z(`context`)),children:e})},{Component:qa,useEmitter:Ja,useEmitterValue:Z,usePublisher:Ya}=_a(Oa,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},N.memo(function(e){let t=Z(`useWindowScroll`),n=Z(`topItemsIndexes`).length>0,r=Z(`customScrollParent`),i=Z(`context`);return(0,P.jsxs)(r||t?Za:Xa,{...e,context:i,children:[n&&(0,P.jsx)(Ka,{children:(0,P.jsx)(Na,{showTopList:!0})}),(0,P.jsxs)(r||t?Ga:Wa,{children:[(0,P.jsx)(Ba,{}),(0,P.jsx)(Na,{}),(0,P.jsx)(Va,{})]})]})})),Xa=Ha({useEmitter:Ja,useEmitterValue:Z,usePublisher:Ya}),Za=Ua({useEmitter:Ja,useEmitterValue:Z,usePublisher:Ya}),Qa=qa,$a=q(([e,t])=>({...e,...t}),F(ma,q(()=>{let e=G(e=>(0,P.jsxs)(`td`,{children:[`Item $`,e]})),t=G(null),n=G(e=>(0,P.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=G(null),i=G(null),a=G({}),o=G(Da),s=G(qn),c=(e,t=null)=>or(U(a,H(t=>t[e]),B()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),eo=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{height:e}})}),to=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),no={overflowAnchor:`none`},ro={position:Sa(),zIndex:2,overflowAnchor:`none`},io=N.memo(function({showTopList:e=!1}){let t=Q(`listState`),n=Q(`computeItemKey`),r=Q(`firstItemIndex`),i=Q(`context`),a=Q(`isSeeking`),o=Q(`fixedHeaderHeight`),s=Q(`groupIndices`).length>0,c=Q(`itemContent`),l=Q(`groupContent`),u=Q(`ScrollSeekPlaceholder`)??eo,d=Q(`GroupComponent`),f=Q(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,N.createElement)(u,{...X(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,N.createElement)(d,{...X(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...ro,top:o}},l(t.index,i)):(0,N.createElement)(f,{...X(f,i),...za(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...ro,top:o+g}:no},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),ao=N.memo(function(){let e=Q(`listState`),t=Q(`topItemsIndexes`).length>0,n=uo(`sizeRanges`),r=Q(`useWindowScroll`),i=Q(`customScrollParent`),a=uo(`windowScrollContainerState`),o=uo(`scrollContainerState`),s=i||r?a:o,c=Q(`trackItemSizes`),{callbackRef:l,ref:u}=Tr(n,Q(`itemSize`),c,s,Q(`log`),void 0,i,!1,Q(`skipAnimationFrameInResizeObserver`)),[d,f]=N.useState(0);lo(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=Q(`EmptyPlaceholder`),m=Q(`FillerRow`)??to,h=Q(`TableBodyComponent`),g=Q(`paddingTopAddition`),_=Q(`statefulTotalCount`),v=Q(`context`);if(_===0&&p!=null)return(0,P.jsx)(p,{...X(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,P.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,P.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,P.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...X(h,v),children:[S,t&&(0,P.jsx)(io,{showTopList:!0}),(0,P.jsx)(io,{}),C]})}),oo=({children:e})=>{let t=N.useContext(va),n=uo(`viewportHeight`),r=uo(`fixedItemHeight`),i=Cr(N.useMemo(()=>Hn(n,e=>ni(e,`height`)),[n]),!0,Q(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:Ia(!1),children:e})},so=({children:e})=>{let t=N.useContext(va),n=uo(`windowViewportRect`),r=uo(`fixedItemHeight`),i=Q(`customScrollParent`),a=Q(`useWindowScroll`),o=Or(n,i,Q(`skipAnimationFrameInResizeObserver`));return N.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:La(!1,a),children:e})},{Component:co,useEmitter:lo,useEmitterValue:Q,usePublisher:uo}=_a($a,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},N.memo(function(e){let t=Q(`useWindowScroll`),n=Q(`customScrollParent`),r=uo(`fixedHeaderHeight`),i=uo(`fixedFooterHeight`),a=Q(`fixedHeaderContent`),o=Q(`fixedFooterContent`),s=Q(`context`),c=Cr(N.useMemo(()=>Hn(r,e=>ni(e,`height`)),[r]),!0,Q(`skipAnimationFrameInResizeObserver`)),l=Cr(N.useMemo(()=>Hn(i,e=>ni(e,`height`)),[i]),!0,Q(`skipAnimationFrameInResizeObserver`)),u=n||t?po:fo,d=n||t?so:oo,f=Q(`TableComponent`),p=Q(`TableHeadComponent`),m=Q(`TableFooterComponent`),h=a?(0,P.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...X(p,s),children:a()},`TableHead`):null,g=o?(0,P.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...X(m,s),children:o()},`TableFoot`):null;return(0,P.jsx)(u,{...e,...X(u,s),children:(0,P.jsx)(d,{children:(0,P.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...X(f,s),children:[h,(0,P.jsx)(ao,{},`TableBody`),g]})})})})),fo=Ha({useEmitter:lo,useEmitterValue:Q,usePublisher:uo}),po=Ua({useEmitter:lo,useEmitterValue:Q,usePublisher:uo}),mo={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ho={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:go,floor:_o,max:vo,min:yo,round:bo}=Math;function xo(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function So(e){return{...ho,items:e}}function Co(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function wo(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var To=q(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=G(0),C=G(0),w=G(mo),T=G({height:0,width:0}),E=G({height:0,width:0}),D=K(),ee=K(),te=G(0),ne=G(null),re=G({column:0,row:0}),ie=K(),ae=K(),oe=G(!1),se=G(0),ce=G(!0),O=G(!1),le=G(!1);I(U(m,W(se),V(([e,t])=>t!==0)),()=>{L(ce,!1)}),I(U(ur(m,ce,E,T,se,O),V(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{L(O,!0),Oi(1,()=>{L(D,e)}),Zn(U(l),()=>{L(t,[0,0]),L(ce,!0)})}),z(U(ae,V(e=>e!=null&&e.scrollTop>0),er(0)),C),I(U(m,W(ae),V(([,e])=>e!=null)),([,e])=>{e&&(L(T,e.viewport),L(E,e.item),L(re,e.gap),e.scrollTop>0&&(L(oe,!0),Zn(U(l,nr(1)),e=>{L(oe,!1)}),L(c,{top:e.scrollTop})))}),z(U(T,H(({height:e})=>e)),d),z(U(ur(J(T,Co),J(E,Co),J(re,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),J(l)),H(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),ie),z(U(ur(J(S),r,J(re,wo),J(E,Co),J(T,Co),J(ne),J(C),J(oe),J(ce),J(se)),V(([,,,,,,,e])=>!e),H(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return mo;if(p===0){let t=ki(l,e);return So(xo(t,t+Math.max(s-1,0),o))}let h=Eo(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*_o((t+d)/(f+d)),_=h*go((n+d)/(f+d))-1,_=yo(e-1,vo(_,h-1)),g=yo(_,vo(0,g))):(g=0,_=-1);let v=xo(g,_,o),{bottom:y,top:b}=Do(a,r,i,v),x=go(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),z(U(ne,V(e=>e!==null),H(e=>e.length)),S),z(U(ur(T,E,w,re),V(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),H(([e,t,{items:n},r])=>{let{bottom:i,top:a}=Do(e,r,t,n);return[a,i]}),B(Zr)),t);let ue=G(!1);z(U(l,W(ue),H(([e,t])=>t||e!==0)),ue);let de=sr(U(ur(w,S),V(([{items:e}])=>e.length>0),W(ue),V(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),H(([[,e]])=>e-1),B())),fe=sr(U(J(w),V(({items:e})=>e.length>0&&e[0].index===0),er(0),B())),pe=sr(U(J(w),W(oe),V(([{items:e},t])=>e.length>0&&!t),H(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),B(Xr),rr(0)));z(pe,p.scrollSeekRangeChanged),z(U(D,W(T,E,S,re),H(([e,t,n,r,i])=>{let a=Ti(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=vo(0,l,yo(r-1,l));let u=Oo(t,i,n,l);return o===`end`?u=bo(u-t.height+n.height):o===`center`&&(u=bo(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let me=or(U(w,H(e=>e.offsetBottom+e.bottom)),0);return z(U(b,H(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:ne,deviation:te,footerHeight:i,gap:re,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:ae,scrollBy:o,scrollContainerState:s,scrollHeight:ee,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:le,initialTopMostItemIndex:se,totalListHeight:me,...f,endReached:de,propsReady:h,rangeChanged:pe,startReached:fe,stateChanged:ie,stateRestoreInProgress:oe,...x}},F(Ui,kr,Li,sa,Ci,ca,hr));function Eo(e,t,n){return vo(1,_o((e+n)/(_o(t)+n)))}function Do(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Oo(e,t,n,r[0].index);return{bottom:Oo(e,t,n,r[r.length-1].index)+i,top:a}}function Oo(e,t,n,r){let i=_o(r/Eo(e.width,n.width,t.column)),a=i*n.height+vo(0,i-1)*t.row;return a>0?a+t.row:a}var ko=q(([e,t])=>({...e,...t}),F(To,q(()=>{let e=G(e=>`Item ${e}`),t=G({}),n=G(null),r=G(`virtuoso-grid-item`),i=G(`virtuoso-grid-list`),a=G(Da),o=G(`div`),s=G(qn),c=(e,n=null)=>or(U(t,H(t=>t[e]),B()),n),l=G(!1),u=G(!1);return z(J(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),Ao=N.memo(function(){let e=$(`gridState`),t=$(`listClassName`),n=$(`itemClassName`),r=$(`itemContent`),i=$(`computeItemKey`),a=$(`isSeeking`),o=Lo(`scrollHeight`),s=$(`ItemComponent`),c=$(`ListComponent`),l=$(`ScrollSeekPlaceholder`),u=$(`context`),d=Lo(`itemDimensions`),f=Lo(`gap`),p=$(`log`),m=$(`stateRestoreInProgress`),h=Lo(`reportReadyState`),g=Cr(N.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:Bo(`column-gap`,getComputedStyle(e).columnGap,p),row:Bo(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return Ca(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,P.jsx)(c,{className:t,ref:g,...X(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,P.jsx)(l,{...X(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,N.createElement)(s,{...X(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),jo=N.memo(function(){let e=$(`HeaderComponent`),t=Lo(`headerHeight`),n=$(`headerFooterTag`),r=Cr(N.useMemo(()=>e=>{t(ni(e,`height`))},[t]),!0,!1),i=$(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),Mo=N.memo(function(){let e=$(`FooterComponent`),t=Lo(`footerHeight`),n=$(`headerFooterTag`),r=Cr(N.useMemo(()=>e=>{t(ni(e,`height`))},[t]),!0,!1),i=$(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...X(e,i)})})}),No=({children:e})=>{let t=N.useContext(ya),n=Lo(`itemDimensions`),r=Lo(`viewportDimensions`),i=Cr(N.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,P.jsx)(`div`,{ref:i,style:Ia(!1),children:e})},Po=({children:e})=>{let t=N.useContext(ya),n=Lo(`windowViewportRect`),r=Lo(`itemDimensions`),i=$(`customScrollParent`),a=$(`useWindowScroll`),o=Or(n,i,!1);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,P.jsx)(`div`,{ref:o,style:La(!1,a),children:e})},{Component:Fo,useEmitter:Io,useEmitterValue:$,usePublisher:Lo}=_a(ko,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},N.memo(function({...e}){let t=$(`useWindowScroll`),n=$(`customScrollParent`),r=n||t?zo:Ro,i=n||t?Po:No,a=$(`context`);return(0,P.jsx)(r,{...e,...X(r,a),children:(0,P.jsxs)(i,{children:[(0,P.jsx)(jo,{}),(0,P.jsx)(Ao,{}),(0,P.jsx)(Mo,{})]})})})),Ro=Ha({useEmitter:Io,useEmitterValue:$,usePublisher:Lo}),zo=Ua({useEmitter:Io,useEmitterValue:$,usePublisher:Lo});function Bo(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,fr.WARN),t===`normal`?0:parseInt(t??`0`,10)}var Vo={"workspace-ready":`workspace ready`,"task-deliver":`task deliver`,"task-done":`task done`,"explicit-reply":`explicit reply`,"report-final":`report final`,"edge-fallback":`inferred at exit`};function Ho({windowId:e,members:t,issueRepo:n}){let r=t[0];if(!r)return null;let i=ot(r.msg.occurredAt??r.msg.createdAt),a=r.source===`edge-fallback`,o=r.source?Vo[r.source]:void 0;return(0,P.jsx)(`div`,{"data-msg-id":r.msg.id,"data-window-id":e,className:`mb-3`,children:(0,P.jsxs)(`div`,{className:k(`rounded-xl border px-3.5 py-2.5 shadow-sm`,a?`border-amber-500/40 bg-amber-500/[0.06]`:`border-emerald-500/40 bg-emerald-500/[0.06]`),children:[(0,P.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-emerald-600 dark:text-emerald-400`,children:[(0,P.jsx)(te,{className:`h-3.5 w-3.5`}),(0,P.jsx)(`span`,{children:`Final report`}),a&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-medium normal-case text-amber-700 dark:text-amber-400`,title:`This work window was closed by a crash/idle-exit edge, not an explicit workspace-ready or task-done signal.`,children:[(0,P.jsx)(oe,{className:`h-3 w-3`}),`inferred at exit`]}),!a&&o&&(0,P.jsxs)(`span`,{className:`text-[10px] font-normal normal-case text-muted-foreground/50`,children:[`via `,o]}),(0,P.jsx)(`span`,{className:`ml-auto text-[10px] font-normal normal-case text-muted-foreground/60`,children:i})]}),(0,P.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,P.jsxs)(`div`,{"data-msg-id":e.msg.id,children:[(0,P.jsx)(rt,{text:qe(e.msg),rawBody:e.msg.body,issueRepo:n,className:`text-sm leading-relaxed text-foreground`}),e.confidence===`reconstructed`&&(0,P.jsx)(`p`,{className:`mt-0.5 text-[10px] italic text-muted-foreground/50`,title:`This report was reconstructed from persisted state (e.g. after a relay restart), not captured live.`,children:`reconstructed`})]},e.msg.id))})]})})}function Uo(){return(0,P.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,P.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,P.jsx)(`span`,{children:`Thinking may still be arriving…`})]})}function Wo({agentId:e,approval:t}){let n=j(e=>e.sendPermissionDecision),[r,i]=(0,N.useState)(null);if(!t)return null;if(t.questions&&t.questions.length)return(0,P.jsx)(qo,{agentId:e,approval:t,questions:t.questions});let a=t,o=t.choices.length?t.choices:[{id:`approve`,label:`Approve`},{id:`deny`,label:`Deny`}];async function s(t){if(!r){i(t.id);try{await n(e,a.id,t.id)}finally{i(null)}}}let c=t.kind===`plan`;return(0,P.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,P.jsx)(`div`,{className:`max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c?(0,P.jsx)(ae,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}):(0,P.jsx)(v,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-100`,children:t.title}),t.reasoningSettled===!1&&(0,P.jsx)(Uo,{}),t.body&&(c?(0,P.jsx)(`div`,{className:`mt-2 max-h-72 overflow-auto rounded-md bg-background/60 p-2.5 text-xs leading-relaxed`,children:(0,P.jsx)(rt,{text:t.body,rawBody:t.body,className:`leading-relaxed`})}):(0,P.jsx)(`pre`,{className:`mt-2 max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-md bg-background/80 p-2 font-mono text-xs leading-relaxed text-muted-foreground`,children:t.body})),(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.map(e=>(0,P.jsxs)(M,{size:`sm`,variant:e.id===`deny`||e.id===`abort`?`outline`:`default`,disabled:!!r,onClick:()=>void s(e),className:`h-7 px-2 text-xs`,children:[r===e.id&&(0,P.jsx)(pe,{className:`mr-1.5 h-3 w-3 animate-spin`}),e.label]},e.id))})]})]})})})}function Go(e){return e?e.otherActive&&e.other.trim()?!0:e.labels.length>0:!1}function Ko(e){let t=[...e.labels];return e.otherActive&&e.other.trim()&&t.push(e.other.trim()),t.join(`, `)}function qo({agentId:e,approval:t,questions:n}){let r=j(e=>e.sendPermissionDecision),[i,a]=(0,N.useState)(0),[o,c]=(0,N.useState)({}),[l,u]=(0,N.useState)(null),d=n[Math.min(i,n.length-1)],f=o[i];if(!d)return null;let p=!!d.multiSelect,m=n.length,h=i===m-1,g=Go(f),_=n.every((e,t)=>Go(o[t])),v=!!l;function b(e){c(t=>{let n=t[i]??{labels:[],other:``,otherActive:!1};return{...t,[i]:{...n,...e}}})}function x(e){if(p){let t=f?.labels.includes(e);b({labels:t?(f?.labels??[]).filter(t=>t!==e):[...f?.labels??[],e]})}else b({labels:[e],otherActive:!1})}function S(){b(p?{otherActive:!f?.otherActive}:{labels:[],otherActive:!0})}async function C(){if(!(!_||v)){u(`answer`);try{let i={};n.forEach((e,t)=>{let n=o[t];n&&(i[e.question]=Ko(n))}),await r(e,t.id,`answer`,i)}finally{u(null)}}}async function w(){if(!v){u(`dismiss`);try{await r(e,t.id,`deny`)}finally{u(null)}}}let T=!!f?.otherActive;return(0,P.jsx)(`div`,{className:`flex justify-start mb-3`,children:(0,P.jsxs)(`div`,{className:`w-full max-w-[92%] md:max-w-[78%] rounded-2xl rounded-bl-sm bg-card ring-1 ring-amber-500/35 px-3.5 py-3 text-sm`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ge,{className:`h-4 w-4 shrink-0 text-amber-400`}),(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900 dark:text-amber-100`,children:t.title}),m>1&&(0,P.jsxs)($e,{variant:`outline`,className:`ml-auto h-5 px-1.5 text-[10px] text-muted-foreground`,children:[i+1,` / `,m]})]}),t.reasoningSettled===!1&&(0,P.jsx)(Uo,{}),(0,P.jsxs)(`div`,{className:`mt-3`,children:[d.header&&(0,P.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-amber-700 dark:text-amber-300/80`,children:d.header}),(0,P.jsx)(`div`,{className:`mt-0.5 text-sm text-foreground whitespace-pre-wrap break-words`,children:d.question}),p&&(0,P.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Select all that apply`}),(0,P.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:[d.options.map(e=>{let t=!!f?.labels.includes(e.label);return(0,P.jsxs)(`button`,{type:`button`,disabled:v,onClick:()=>x(e.label),className:k(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,t?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,v&&`opacity-60`),children:[(0,P.jsx)(`span`,{className:k(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,p?`rounded`:`rounded-full`,t?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:t&&(0,P.jsx)(s,{className:`h-3 w-3`})}),(0,P.jsxs)(`span`,{className:`min-w-0`,children:[(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),e.description&&(0,P.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.label)}),(0,P.jsxs)(`button`,{type:`button`,disabled:v,onClick:S,className:k(`flex items-start gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors`,T?`border-amber-500/60 bg-amber-500/10`:`border-border bg-background/60 hover:bg-background`,v&&`opacity-60`),children:[(0,P.jsx)(`span`,{className:k(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border text-amber-300`,p?`rounded`:`rounded-full`,T?`border-amber-400 bg-amber-400/20`:`border-muted-foreground/40`),children:T&&(0,P.jsx)(s,{className:`h-3 w-3`})}),(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:`Other…`})]}),T&&(0,P.jsx)(vt,{autoFocus:!0,rows:2,disabled:v,value:f?.other??``,onChange:e=>b({other:e.target.value,otherActive:!0}),placeholder:`Type your answer`,className:`mt-1 text-sm`})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[i>0&&(0,P.jsxs)(M,{size:`sm`,variant:`outline`,disabled:v,onClick:()=>a(e=>e-1),className:`h-7 px-2 text-xs`,children:[(0,P.jsx)(y,{className:`mr-1 h-3 w-3`}),`Back`]}),h?(0,P.jsxs)(M,{size:`sm`,disabled:v||!_,onClick:()=>void C(),className:`h-7 px-2 text-xs`,children:[l===`answer`&&(0,P.jsx)(pe,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Send answer`,m>1?`s`:``]}):(0,P.jsxs)(M,{size:`sm`,disabled:v||!g,onClick:()=>a(e=>e+1),className:`h-7 px-2 text-xs`,children:[`Next`,(0,P.jsx)(xe,{className:`ml-1 h-3 w-3`})]}),(0,P.jsxs)(M,{size:`sm`,variant:`ghost`,disabled:v,onClick:()=>void w(),className:`ml-auto h-7 px-2 text-xs text-muted-foreground`,children:[l===`dismiss`&&(0,P.jsx)(pe,{className:`mr-1.5 h-3 w-3 animate-spin`}),`Dismiss`]})]})]})})}var Jo={"mount-stick-default":`settling`,"mount-restore-start":`restoring`,"mount-free-scroll":`free-scroll`,"append-tail":`settling`,"own-prompt-sent":`settling`,"settle-reached-bottom":`at-bottom-stuck`,"settle-bailed":`free-scroll`,"latest-click":`latest-pinning`,"latest-pin-reached-bottom":`at-bottom-stuck`,"latest-pin-bailed":`free-scroll`,"gesture-scroll-up":`free-scroll`,"gesture-scroll-bottom":`at-bottom-stuck`,"restore-settled":`free-scroll`,"restore-gesture-interrupt":`free-scroll`,"restore-unresolvable":`free-scroll`,"search-jump":`free-scroll`},Yo=new Set([`at-bottom-stuck`,`settling`,`latest-pinning`]);function Xo(e,t){return Jo[t]??e}function Zo(){if(typeof window>`u`)return!1;try{return new URLSearchParams(window.location.search).has(`debugScroll`)?!0:window.localStorage?.getItem(`debugScroll`)===`1`}catch{return!1}}var Qo=Zo(),$o=500,es=[],ts=new Map,ns=null,rs=null,is=new Set;function as(){for(let e of is)e()}function os(e){return is.add(e),()=>is.delete(e)}function ss(e){return ts.get(e)??`free-scroll`}function cs(e){es.push(e),es.length>$o&&es.shift(),ns=e.agentId,rs=e.ts,fs=null,as()}function ls(e,t,n){if(!Qo)return;let r=ss(e),i=Xo(r,t);ts.set(e,i),cs({ts:Date.now(),agentId:e,kind:`transition`,cause:t,from:r,to:i,stick:Yo.has(i),...n?{detail:n}:{}})}function us(e,t,n,r){Qo&&cs({ts:Date.now(),agentId:e,kind:t,cause:n,...r?{detail:r}:{}})}var ds=20,fs=null;function ps(){return fs||={agentId:ns,state:ns?ss(ns):null,updatedAt:rs,transitions:es.filter(e=>e.kind===`transition`).slice(-ds)},fs}Qo&&typeof window<`u`&&(Object.defineProperty(window,`__scrollDebug`,{configurable:!0,get:()=>ps()}),window.__scrollTrace=()=>{let e=es.slice();return console.log(JSON.stringify(e,null,2)),e});function ms({agentId:e,state:t}){let n=(0,N.useSyncExternalStore)(os,ps);return n.agentId===e?(0,P.jsxs)(`div`,{className:`pointer-events-none absolute left-2 top-2 z-30 max-w-[240px] select-none rounded-md border border-border/60 bg-background/90 px-2 py-1.5 font-mono text-[10px] leading-tight text-muted-foreground shadow-md backdrop-blur`,children:[(0,P.jsx)(`div`,{className:`font-semibold text-foreground`,children:t}),n.transitions.slice(-5).map((e,t)=>(0,P.jsxs)(`div`,{className:`truncate`,children:[e.cause,` → `,e.to]},`${e.ts}-${t}`))]}):null}var hs=1e6,gs=`px-3 md:px-4`;function _s({context:e}){if(!e)return null;let{agentId:t,busy:n,pendingApproval:r,blockedLabel:i,canInterrupt:a,onInterrupt:o}=e,s=n&&(!r||r.reasoningSettled===!1);return!r&&!s?null:(0,P.jsxs)(`div`,{className:`${gs} pb-3 md:pb-4`,children:[r&&(0,P.jsx)(Wo,{agentId:t,approval:r},r.id),s&&(0,P.jsx)(qt,{blockedLabel:i,onInterrupt:a?o:void 0})]})}function vs(e){let t=e.findIndex(e=>e.type!==`date`&&e.type!==`created`),n=t>=0?t:0,r=e[n];return{key:r?Xt(r):null,index:n}}function ys(e,t){let[n,r]=(0,N.useState)(()=>hs-t.length),i=(0,N.useRef)({agentId:e,anchor:vs(t)});return(0,N.useLayoutEffect)(()=>{let n=vs(t),a=i.current;r(n=>{if(a.agentId!==e)return hs-t.length;if(!a.anchor.key)return n;let r=t.findIndex(e=>Xt(e)===a.anchor.key)-a.anchor.index;return Qo&&r>0&&us(e,`window-mutation`,`prepend`,{prependedRows:r,firstItemIndexBefore:n,firstItemIndexAfter:n-r}),r>0?n-r:n}),i.current={agentId:e,anchor:n}},[e,t]),n}function bs({agentId:e,agentStatus:t,timeline:n,hasMore:r,loading:i,loadedInitial:a,showReasoning:o,pendingApproval:s,blockedLabel:c,canInterrupt:l,searchActive:u,searchCurrentKey:d,searchMatchKeys:f,onAtBottomChange:p,onScrollerRef:m,onLoadOlder:h,onInterrupt:g,onOpenReferencedPath:v,onPreviewReferencedPath:y,onPreviewReferencedPathEnd:b}){let x=(0,N.useRef)(null),S=(0,N.useRef)(null),C=(0,N.useSyncExternalStore)(os,()=>ss(e));(0,N.useLayoutEffect)(()=>{Qo&&S.current?.setAttribute(`data-scroll-state`,C)},[C]);let[w,T]=(0,N.useState)(!0),E=t===`busy`,[D,ee]=(0,N.useState)(E);(0,N.useLayoutEffect)(()=>{if(E){ee(!0);return}let e=setTimeout(()=>ee(!1),600);return()=>clearTimeout(e)},[E]);let te=ys(e,n),ne=n.length>0?n[n.length-1]:null,re=ne?Xt(ne):null,ie=(ne?.type===`message`||ne?.type===`initial-prompt`)&&ne.msg.from===`user`,ae=(0,N.useRef)(n);ae.current=n;let oe=(0,N.useRef)(i);oe.current=i;let se=(0,N.useRef)(a);se.current=a;let ce=(0,N.useRef)(te);ce.current=te;let O=(0,N.useRef)(e);O.current=e;let le=(0,N.useRef)(!1),ue=(0,N.useCallback)(()=>{le.current||(le.current=!0,requestAnimationFrame(()=>{le.current=!1;let e=S.current;if(!e)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-item-index]`));for(let e of n){let n=e.getBoundingClientRect();if(n.bottom>t+1){let r=Number(e.getAttribute(`data-item-index`))-ce.current,i=ae.current[r],a=i?at(i):null,o={stick:!1,topKey:i?Xt(i):null,...a?{anchorMessageId:a.messageId,anchorEndMessageId:a.endMessageId}:{},offset:Math.max(0,Math.round(t-n.top))};Qo&&us(O.current,`persist`,`capture-reading-position`,{...o,debounced:!0}),ke(O.current,o);return}}}))},[]),de=(0,N.useRef)(null);if(de.current===null){let t=we(e),r=-1;t&&!t.stick&&(t.topKey||t.anchorMessageId!==void 0)&&(r=ht(n,{topKey:t.topKey,messageId:t.anchorMessageId,endMessageId:t.anchorEndMessageId})),de.current=r>=0?r:Math.max(0,n.length-1)}let fe=(0,N.useRef)(re),me=(0,N.useRef)(e);me.current!==e&&(me.current=e,fe.current=re);let he=fe.current?n.findIndex(e=>Xt(e)===fe.current):-1,ge=!w&&he>=0?n.slice(he+1).filter(e=>e.type===`message`&&e.msg.from!==`user`||e.type===`work-final`&&e.members.some(e=>e.msg.from!==`user`)).length:0;(0,N.useLayoutEffect)(()=>{w&&(fe.current=re)},[w,re]);let _e=(0,N.useRef)(w);_e.current=w;let A=(0,N.useRef)(we(e)?.stick??!0),ye=(0,N.useRef)(!1),be=(0,N.useRef)(!1),xe=(0,N.useRef)(null);(0,N.useLayoutEffect)(()=>{if(!Qo)return;let t=we(e),n=!!(t&&(t.topKey!==null||t.anchorMessageId!==void 0));ls(e,A.current?`mount-stick-default`:n?`mount-restore-start`:`mount-free-scroll`,{savedStick:t?.stick})},[e]);let Se=(0,N.useCallback)((e=`settle`)=>{Nt()||x.current?.scrollToIndex({index:`LAST`,align:`end`});let t=performance.now(),n=0,r=!1,i=!1,a=0,o=(t,n)=>{if(Qo){let r=e===`latest`?t?`latest-pin-reached-bottom`:`latest-pin-bailed`:t?`settle-reached-bottom`:`settle-bailed`;ls(O.current,r,{reason:n})}},s=()=>{if(r)return;if(!A.current){o(i,`gesture-release`);return}if(Nt()){n=requestAnimationFrame(s);return}let e=S.current;if(e){let t=e.scrollHeight-e.clientHeight-e.scrollTop;e.scrollHeight-e.clientHeight>64?(t<=64&&(i=!0,ye.current=!0),e.scrollTo({top:e.scrollHeight,behavior:`auto`}),a=i&&t<=1?a+1:0):(i=!0,ye.current=!0,a++)}else a=0;if(i&&a>=3){o(!0,`converged`);return}if(performance.now()-t>1e4){o(i,`safety-cap`);return}n=requestAnimationFrame(s)};return n=requestAnimationFrame(s),()=>{r=!0,cancelAnimationFrame(n)}},[]);(0,N.useLayoutEffect)(()=>{if(ie?(A.current=!0,ke(O.current,{stick:!0,topKey:null,offset:0}),Qo&&(us(O.current,`persist`,`own-prompt-sent`,{stick:!0,topKey:null,offset:0}),ls(O.current,`own-prompt-sent`))):Qo&&A.current&&ls(O.current,`append-tail`,{latestKey:re}),A.current)return Se(`settle`)},[re,ie,Se]),(0,N.useLayoutEffect)(()=>{let e=0,t=()=>{let r=S.current;if(Nt()){n=requestAnimationFrame(t);return}e=A.current&&r&&r.scrollHeight-r.clientHeight-r.scrollTop>64?e+1:0,e>=5&&x.current?.scrollToIndex({index:`LAST`,align:`end`}),n=requestAnimationFrame(t)},n=requestAnimationFrame(t);return()=>cancelAnimationFrame(n)},[]),(0,N.useLayoutEffect)(()=>{let e=null,t=!1;return De().then(()=>{if(t)return;let n=we(O.current);if(Qo&&us(O.current,`hydrate`,`hydrate-resolved`,{hasSaved:!!n,stick:n?.stick,topKey:n?.topKey}),!n||n.stick||!n.topKey&&n.anchorMessageId===void 0)return;A.current=!1;let r={topKey:n.topKey,messageId:n.anchorMessageId,endMessageId:n.anchorEndMessageId},i=n.offset,a=0,o=!1,s=0,c=-1,l=0,u=performance.now();be.current=!0;let d=(e=`restore-gesture-interrupt`)=>{o=!0,cancelAnimationFrame(a),be.current=!1,xe.current===d&&(xe.current=null),Qo&&ls(O.current,e)};e=d,xe.current=d;let f=()=>{if(o)return;let e=ht(ae.current,r),t=performance.now();if(e>=0&&(s===0&&(s=t),x.current?.scrollToIndex({index:e,align:`start`,offset:i})),s===0){let e=S.current,n=e?e.scrollHeight:ae.current.length,r=oe.current||!se.current||ae.current.length===0;(r||n!==c)&&(c=n,l=r?0:t);let i=l>0&&t-l>=1200,o=t-u>=3e4;!i&&!o?a=requestAnimationFrame(f):d(`restore-unresolvable`);return}t-s<800?a=requestAnimationFrame(f):d(`restore-settled`)};a=requestAnimationFrame(f)}),()=>{t=!0,e?.()}},[]);let Ce=s?.id;(0,N.useLayoutEffect)(()=>{if(!D&&!Ce||!A.current)return;let e=0,t=performance.now(),n=()=>{let r=S.current;r&&A.current&&r.scrollHeight-r.clientHeight-r.scrollTop>2&&r.scrollTo({top:r.scrollHeight,behavior:`auto`}),performance.now()-t<300&&(e=requestAnimationFrame(n))};return e=requestAnimationFrame(n),()=>cancelAnimationFrame(e)},[D,Ce]),(0,N.useLayoutEffect)(()=>{if(!u||!d)return;let e=ae.current.findIndex(e=>Xt(e)===d);e<0||(A.current=!1,Qo&&ls(O.current,`search-jump`,{searchCurrentKey:d}),x.current?.scrollToIndex({index:e,align:`center`}))},[u,d]);let Te=(0,N.useRef)(null),Ee=(0,N.useCallback)(e=>{let t=e instanceof HTMLElement?e:null;if(S.current=t,m?.(t),Te.current?.(),Te.current=null,!t)return;Qo&&t.setAttribute(`data-scroll-state`,ss(O.current));let n=e=>{A.current=!1,Qo&&ls(O.current,`gesture-scroll-up`,{gestureKind:e}),xe.current?.()},r=()=>{let e=t.scrollTop;t.scrollHeight-t.clientHeight-e<=64&&!be.current&&(A.current||(ke(O.current,{stick:!0,topKey:null,offset:0}),Qo&&(us(O.current,`persist`,`reached-bottom`,{stick:!0,topKey:null,offset:0}),ls(O.current,`gesture-scroll-bottom`))),A.current=!0,xe.current?.()),!A.current&&!be.current&&ue()},i=e=>{xe.current?.(),e.deltaY<0&&n(`wheel`)},a=0,o=e=>{a=e.touches[0]?.clientY??0},s=e=>{let t=(e.touches[0]?.clientY??0)-a;Math.abs(t)>6&&xe.current?.(),t>6&&n(`touch`)},c=e=>{(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`||e.key===` `&&e.shiftKey)&&(xe.current?.(),n(`keyboard`))};t.addEventListener(`scroll`,r,{passive:!0}),t.addEventListener(`wheel`,i,{passive:!0}),t.addEventListener(`touchstart`,o,{passive:!0}),t.addEventListener(`touchmove`,s,{passive:!0}),t.addEventListener(`keydown`,c),Te.current=()=>{t.removeEventListener(`scroll`,r),t.removeEventListener(`wheel`,i),t.removeEventListener(`touchstart`,o),t.removeEventListener(`touchmove`,s),t.removeEventListener(`keydown`,c)}},[m,ue]),Oe=(0,N.useCallback)(e=>{T(e),e&&!be.current&&(A.current=!0),p?.(e)},[p]),j=(0,N.useCallback)(()=>{!r||i||h()},[r,i,h]),Ae=(0,N.useCallback)(()=>{fe.current=re,A.current=!0,ke(e,{stick:!0,topKey:null,offset:0}),Qo&&(us(e,`persist`,`latest-click`,{stick:!0,topKey:null,offset:0}),ls(e,`latest-click`)),Se(`latest`)},[e,re,Se]),je=(0,N.useMemo)(()=>function(){return(0,P.jsx)(`div`,{className:gs,children:(0,P.jsx)(xs,{hasMore:r,loading:i,loadedInitial:a,hasItems:n.length>0})})},[r,a,i,n]),Me=(0,N.useMemo)(()=>({agentId:e,busy:D,pendingApproval:s,blockedLabel:c,canInterrupt:l,onInterrupt:g}),[e,D,c,l,g,s]),Ne=(0,N.useMemo)(()=>function(){return(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center text-center`,children:[i?(0,P.jsx)(pe,{className:`mb-2 h-5 w-5 animate-spin text-muted-foreground`}):(0,P.jsx)(ve,{className:`mb-2 h-8 w-8 text-zinc-600`}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i?`Loading messages`:`No messages yet`})]})},[i]),Pe=(0,N.useMemo)(()=>({Header:je,Footer:_s,EmptyPlaceholder:Ne}),[Ne,je]);return(0,P.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,P.jsx)(Qa,{ref:x,scrollerRef:Ee,className:`h-full py-3 md:py-4`,style:{height:`100%`,overflowX:`hidden`,overscrollBehavior:`contain`},context:Me,data:n,firstItemIndex:te,initialTopMostItemIndex:de.current??Math.max(0,n.length-1),computeItemKey:(e,t)=>Xt(t),itemContent:(t,r)=>{let i=u?Xt(r):``,a=u&&f?.has(i),s=a&&i===d,c=t-te,l=r.type===`message`||r.type===`initial-prompt`?r.msg.from:null,p=n[c+1],m=p?.type===`message`||p?.type===`initial-prompt`?p.msg.from:null,h=l!==null&&l!==m;return(0,P.jsx)(`div`,{className:gs,children:(0,P.jsx)(`div`,{className:k(a&&`rounded-xl ring-1 ring-amber-400/40 transition-shadow`,s&&`ring-2 ring-amber-400 bg-amber-400/5`),children:(0,P.jsx)(Ss,{entry:r,agentId:e,showReasoning:o,showAvatar:h,onOpenReferencedPath:v,onPreviewReferencedPath:y,onPreviewReferencedPathEnd:b})})})},components:Pe,startReached:j,atBottomStateChange:Oe,atBottomThreshold:64,followOutput:()=>A.current&&!Nt()?`auto`:!1,increaseViewportBy:{top:600,bottom:600}},e),!w&&n.length>0&&(0,P.jsxs)(M,{type:`button`,size:`sm`,variant:`secondary`,className:`absolute bottom-3 right-4 z-20 h-8 gap-1.5 rounded-full border border-border/70 bg-background/95 px-3 text-xs shadow-lg backdrop-blur`,onClick:Ae,children:[(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),`Latest`,ge>0&&(0,P.jsx)(`span`,{className:`ml-0.5 min-w-4 rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-medium leading-none text-primary-foreground`,children:ge>99?`99+`:ge})]}),Qo&&(0,P.jsx)(ms,{agentId:e,state:C})]})}function xs({hasMore:e,loading:t,loadedInitial:n,hasItems:r}){return t?(0,P.jsxs)(`div`,{className:`flex items-center justify-center gap-2 pb-3 text-xs text-muted-foreground`,children:[(0,P.jsx)(pe,{className:`h-3.5 w-3.5 animate-spin`}),(0,P.jsx)(`span`,{children:`Loading earlier messages`})]}):!e&&n&&r?(0,P.jsxs)(`div`,{className:`flex items-center justify-center gap-2 pb-3 text-xs text-muted-foreground/70`,children:[(0,P.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,P.jsx)(`span`,{children:`Beginning of conversation`}),(0,P.jsx)(`div`,{className:`h-px flex-1 bg-border`})]}):null}function Ss({entry:e,agentId:t,showReasoning:n,showAvatar:r,onOpenReferencedPath:i,onPreviewReferencedPath:a,onPreviewReferencedPathEnd:o}){let s=j(e=>e.agentsById[t]?.issueRepo);return e.type===`message`?(0,P.jsx)(tn,{msg:e.msg,peer:t,showAvatar:r,onOpenReferencedPath:i,onPreviewReferencedPath:a,onPreviewReferencedPathEnd:o}):e.type===`initial-prompt`?(0,P.jsx)(At,{msg:e.msg,issueRepo:s}):e.type===`notice`?(0,P.jsx)(Ot,{msg:e.msg}):e.type===`relay-injection`?(0,P.jsx)(Yt,{entry:e}):e.type===`prompt-resolution`?(0,P.jsx)(yt,{entry:e}):e.type===`agent-action`?(0,P.jsx)(Ct,{entry:e}):e.type===`activity`?(0,P.jsx)(Wt,{steps:e.steps,showReasoning:n,issueRepo:s}):e.type===`import-boundary`?(0,P.jsx)(Ht,{history:e.history}):e.type===`imported-message`?(0,P.jsx)(It,{entry:e.entry,sourceLabel:e.history.sourceAgentLabel||e.history.sourcePeerId,issueRepo:s}):e.type===`status`?(0,P.jsx)($t,{event:e.event}):e.type===`date`?(0,P.jsx)(Dt,{date:e.date}):e.type===`work-final`?(0,P.jsx)(Ho,{windowId:e.windowId,members:e.members,issueRepo:s}):(0,P.jsx)(Tt,{timestamp:e.timestamp})}var Cs=[],ws=15e3;function Ts(e){return e.kind===`session`&&e.payload?.session?.type===`prompt`}function Es(e){let t=e.filter(e=>e.kind===`chat`&&e.from===`user`);return t.length?e.filter(e=>{if(!Ts(e)||e.from!==`user`)return!0;let n=qe(e).trim();if(!n)return!0;let r=Ye(e.createdAt);return!t.some(e=>qe(e).trim()===n&&Math.abs(Ye(e.createdAt)-r)<=ws)}):e}function Ds({threads:e,onBack:t,showBackButton:n}){let r=j(e=>e.selectedInboxThread),i=j(e=>e.selectedInboxThread?e.agentsById[e.selectedInboxThread]:void 0)||null,a=j(e=>e.inboxDrafts),o=Oe(),s=j(e=>e.sendChatMessage),c=j(e=>e.openFilesAt),l=j(e=>e.openFilesForAgent),u=j(e=>e.openAgentDetail),d=j(e=>e.chatSending),f=j(e=>e.markInboxThreadRead),p=j(e=>e.markInboxThreadUnread),m=j(e=>e.setReplyDraft),h=j(e=>e.exportThread),g=j(e=>e.doAgentAction),_=j(e=>e.workspaceAction),v=j(e=>e.openWorkspaceFocus),y=j(e=>e.forkFromAgent),b=j(e=>e.chatHistoryImports),x=j(e=>e.agentChatByAgent[e.selectedInboxThread]),S=x?.messages??Cs,C=j(e=>e.loadOlder),w=j(e=>e.openConfirm),T=j(e=>e.showError),E=j(e=>e.orchestrators),te=j(e=>e.fetchOrchestrators),ne=j(e=>e.showReasoning),re=j(e=>e.voiceTtsEnabled),ie=j(e=>e.setVoiceTtsEnabled),ae=j(e=>e.voiceInputMode),oe=j(e=>e.plansByThread);(0,N.useRef)(null);let se=(0,N.useRef)(null),[ce,O]=(0,N.useState)(`idle`),le=(0,N.useRef)([]),[ue,fe]=(0,N.useState)([]),[pe,me]=(0,N.useState)(!1),[k,he]=(0,N.useState)(null),[ge,_e]=(0,N.useState)(null),[A,ye]=(0,N.useState)(``),be=(0,N.useRef)(null),xe=(0,N.useRef)(0),[Se,Ce]=(0,N.useState)(null),we=On(r),De=(0,N.useMemo)(()=>e.find(e=>e.peer===r)||null,[e,r]),ke=(0,N.useMemo)(()=>Es(S.filter(e=>Ie(r,e)&&!Le(e)).sort((e,t)=>e.id-t.id)),[S,r]),Me=typeof i?.meta?.lifecycleAction==`string`&&i.meta.lifecycleAction.startsWith(`finalizing-`),{terminalOpen:Ne,terminalTarget:Pe,terminalOpening:Fe,openTerminal:Re,closeTerminal:ze}=nn(i?.id),Be=typeof i?.meta?.spawnRequestId==`string`?i.meta.spawnRequestId:``,Ve=(0,N.useMemo)(()=>b.filter(e=>e.targetAgentId===r||!!(Be&&e.targetSpawnRequestId===Be)),[Be,b,r]),He=Qe(i),Ue=He?.pendingApproval,Ke=(0,N.useMemo)(()=>{if(!r||!De&&ke.length===0)return null;let e=ke[ke.length-1]??De?.lastMessage??null,t=De?.previewMessage&&ke.some(e=>e.id===De.previewMessage?.id)?De.previewMessage:e;return{id:De?.id??r,peer:r,messages:ke,lastMessage:e,previewMessage:t,attention:De?.attention??{unread:0,needsHumanResponse:!1,score:0},archived:De?.archived??!1,draft:De?.draft??``}},[r,De,ke]),qe=Ke||(Ve.length>0?{peer:r,messages:[],importedHistory:Ve}:null),Je=a[r]||``,Ye=typeof i?.meta?.tmuxSession==`string`&&i.meta.tmuxSession.trim()?i.meta.tmuxSession:null,Xe=Ye?E.find(e=>e.managedAgents?.some(e=>e.agentId===i.id||e.tmuxSession===Ye))??null:null,Ze=!!(Ye&&Xe?.status===`online`&&i?.providerCapabilities?.terminal?.live?.read),$e=!!(Ze&&i?.providerCapabilities?.terminal?.live?.write),et=i?.providerCapabilities?.terminal?.attach?.create===!0,tt=Ze||et,nt=We(i,`compact`),rt=We(i,`clearContext`),at=We(i,`shutdown`),ot=We(i,`interrupt`),ct=()=>{i&&g(i,`interrupt`)},[lt,dt]=(0,N.useState)(0),[ft,pt]=(0,N.useState)(!1),ht=i?.providerCapabilities?.liveSession?.slashCommands===!0,gt=i?.providerCapabilities?.model?.provider??(typeof i?.meta?.provider==`string`?i.meta.provider:void 0),vt=ht&&!ft&&/^\/\S*$/.test(Je)?_n(gt).filter(e=>e.name.toLowerCase().startsWith(Je.toLowerCase())):[],yt=vt.length?Math.min(lt,vt.length-1):0;function bt(e){m(r,`${e.name} `),dt(0)}function xt(e){m(r,e),ft&&pt(!1),dt(0)}let Ct=ue.some(e=>e.uploading),wt=ue.filter(e=>e.artifact),Tt=Je.trim().length>0||ue.length>0;Fn(i?.id??``,Je.trim().length>0),kn(Tt,(0,N.useCallback)(()=>{},[])),le.current=ue,(0,N.useEffect)(()=>()=>{it(le.current)},[]),(0,N.useEffect)(()=>{i?.meta?.tmuxSession&&E.length===0&&te()},[i?.id,i?.meta?.tmuxSession,E.length]),(0,N.useEffect)(()=>()=>{be.current!==null&&window.clearTimeout(be.current)},[]);let Dt=typeof i?.spawnedBy==`string`?i.spawnedBy:void 0,Ot=j(e=>Dt?e.agentsById[Dt]?.meta?.provider:void 0),kt=!!(x?.loadedInitial&&!x.hasMore),At=(0,N.useMemo)(()=>Zt(ke,we,i?.createdAt,Ve,{...Dt?{spawnedBy:{agentId:Dt,provider:Ot}}:{},initialPromptComplete:kt}),[ke,we,i?.createdAt,Ve,Dt,Ot,kt]),jt=(0,N.useMemo)(()=>mt(i,ke,Ke?.lastMessage,oe),[i,Ke?.lastMessage,oe,ke]),Mt=Nn(At),Nt=(0,N.useCallback)(()=>{!r||!x?.hasMore||x.loading||C(r)},[x?.hasMore,x?.loading,C,r]),Pt=(0,N.useCallback)(()=>{be.current!==null&&(window.clearTimeout(be.current),be.current=null)},[]),It=(0,N.useCallback)(async e=>{let t=st(E,e);if(!t)return null;try{let n=await ee(`GET`,`/orchestrators/${encodeURIComponent(t.id)}/files/stat?path=${encodeURIComponent(e)}`);return{orchestratorId:t.id,path:n.path,type:n.type}}catch{return null}},[E]),Lt=(0,N.useCallback)((e,t,n)=>{if(!_t()||!n)return;let r=++xe.current;It(e).then(e=>{xe.current===r&&e&&(Pt(),_e({...e,line:t||0,anchor:n}),ye(``))})},[Pt,It]),Rt=(0,N.useCallback)(()=>{xe.current+=1,Pt(),be.current=window.setTimeout(()=>{_e(null)},250)},[Pt]),zt=(0,N.useCallback)((e,t)=>{It(e).then(n=>{if(!n){T(`File Not Found`,e);return}if(_t()){xe.current+=1,Pt(),_e(null),he({...n,line:t||0}),ye(``);return}n.type===`directory`?c({orchestratorId:n.orchestratorId,path:n.path,overlay:!0}):c({orchestratorId:n.orchestratorId,path:ut(n.path),selectedPath:n.path,line:t,overlay:!0})})},[Pt,c,It,T]);function Bt(){he(null),ye(``)}async function Vt(e){let t=Array.from(e).filter(e=>e.size>0);if(!t.length)return;let n=t.map(e=>({id:`${Date.now()}-${e.name}-${Math.random().toString(16).slice(2)}`,fileName:e.name,size:e.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,uploading:!0}));fe(e=>[...e,...n]);for(let e=0;e<t.length;e+=1){let r=t[e],i=n[e];try{let e=await de(`/artifacts`,r,{filename:r.name,sensitivity:`normal`});fe(t=>t.map(t=>t.id===i.id?{...t,artifact:e,uploading:!1}:t))}catch(e){fe(t=>t.map(t=>t.id===i.id?{...t,error:e.message,uploading:!1}:t))}}}function Ht(e){fe(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})}function Ut(){it(ue),fe([])}function Wt(){if(!Je.trim()&&wt.length===0||!r||d||Ct||Me)return;let e=wt.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));s(Je,{peer:r,lastMessage:Ke?.lastMessage||null},e),Ut()}function Gt(e){if(vt.length){if(e.key===`ArrowDown`){e.preventDefault(),dt(e=>Math.min(e+1,vt.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),dt(e=>Math.max(e-1,0));return}if(e.key===`Escape`){e.preventDefault(),pt(!0);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=vt[yt];t&&bt(t);return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Wt())}function Kt(e){let t=Array.from(e.clipboardData.files).filter(e=>e.type.startsWith(`image/`));t.length&&(e.preventDefault(),Vt(t))}async function qt(){if(!Ae||ce!==`idle`||!r)return;Te.bargeIn();let e=new Ee;try{await e.start(),se.current=e,O(`recording`)}catch(e){se.current=null,O(`idle`),T(`Microphone unavailable`,e?.message||`Could not access the microphone.`)}}async function Yt(){let e=se.current;if(!(!e||ce!==`recording`)){se.current=null,O(`transcribing`);try{let t=await e.stop();if(!t)return;let n=await je(t);if(!n)return;let i=Je?`${Je} ${n}`:n;if(ae===`autosend`&&!d&&!Ct){let e=wt.map(e=>({artifactId:e.artifact.id,kind:e.artifact.kind,role:`media`,title:e.artifact.filename||e.fileName}));s(i,{peer:r,lastMessage:Ke?.lastMessage||null},e),Ut()}else m(r,i)}catch(e){T(`Transcription failed`,e?.message||`Could not transcribe audio.`)}finally{O(`idle`)}}}return r?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex h-full min-w-0`,children:[(0,P.jsxs)(`div`,{className:`@container/chat flex h-full min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(yn,{selectedInboxThread:r,agent:i,now:o,blockedState:He,thread:Ke,exportableThread:qe,importedHistory:Ve,showBackButton:n,onBack:t,openAgentDetail:u,openWorkspaceFocus:v,voiceTtsEnabled:re,setVoiceTtsEnabled:ie,canOpenTerminal:tt,terminalOpening:Fe,handleOpenTerminal:Re,canInterrupt:ot,interruptAgent:ct,canCompact:nt,canClearContext:rt,canShutdown:at,openConfirm:w,workspaceAction:_,doAgentAction:g,openFilesForAgent:l,forkFromAgent:y,markInboxThreadUnread:p,markInboxThreadRead:f,exportThread:h,onOpenSearch:Mt.openSearch}),(0,P.jsx)(ln,{threadId:jt&&`threadId`in jt?jt.threadId:null,teamId:jt&&`teamId`in jt?jt.teamId:void 0,channel:jt?.channel}),r&&(0,P.jsx)(sn,{agentId:r}),Mt.open&&(0,P.jsx)(bn,{query:Mt.query,position:Mt.position,total:Mt.total,onQueryChange:Mt.setQuery,onNext:Mt.next,onPrev:Mt.prev,onClose:Mt.close}),(0,P.jsx)(St,{scrollEl:Se,timeline:At}),(0,P.jsx)(bs,{agentId:r,agentStatus:i?.status,timeline:At,hasMore:x?.hasMore??!1,loading:x?.loading??!1,loadedInitial:x?.loadedInitial??!1,showReasoning:ne,pendingApproval:Ue,blockedLabel:He?.label,canInterrupt:ot,searchActive:Mt.open,searchCurrentKey:Mt.currentKey,searchMatchKeys:Mt.matchKeySet,onScrollerRef:Ce,onLoadOlder:Nt,onInterrupt:ct,onOpenReferencedPath:zt,onPreviewReferencedPath:Lt,onPreviewReferencedPathEnd:Rt}),(0,P.jsx)(wn,{draft:Je,placeholder:`Message ${i?Ge(i):r}…`,chatSending:d,disabled:Me,hasPendingUploads:Ct,readyAttachmentCount:wt.length,pendingAttachments:ue,micAvailable:Ae,micState:ce,slashMatches:vt,slashActiveIndex:yt,onDraftChange:xt,onKeyDown:Gt,onPaste:Kt,onUploadFiles:e=>{Vt(e)},onRemovePendingAttachment:Ht,onSend:Wt,onAcceptSlash:bt,onSlashHover:dt,onStartPtt:()=>{qt()},onStopPtt:()=>{Yt()},footerText:Me?`${i?Ge(i):`Agent`} is wrapping up (${(i?.meta?.lifecycleAction).slice(11)}) — messaging paused`:`Enter to send · Shift+Enter for newline`})]}),k&&(0,P.jsxs)(`aside`,{className:`hidden h-full w-[min(44vw,720px)] min-w-[360px] shrink-0 flex-col border-l border-border bg-background xl:flex`,children:[(0,P.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 text-xs font-medium text-muted-foreground`,children:`File preview`}),A&&(0,P.jsx)(`span`,{className:`max-w-[18rem] truncate text-xs text-red-400`,children:A}),(0,P.jsx)(M,{variant:`ghost`,size:`icon-sm`,title:`Close preview`,onClick:Bt,children:(0,P.jsx)(D,{className:`h-3.5 w-3.5`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1`,children:k.type===`directory`?(0,P.jsx)(Ft,{orchestratorId:k.orchestratorId,selectedPath:k.path,onReadError:ye}):(0,P.jsx)(Jt,{orchestratorId:k.orchestratorId,selectedPath:k.path,line:k.line,onReadError:ye})})]})]}),ge&&(0,P.jsx)(En,{preview:ge,error:A,onReadError:ye,onMouseEnter:Pt,onMouseLeave:Rt}),Pe&&(0,P.jsx)(Et,{open:Ne,onOpenChange:ze,orchestratorId:Pe.orchestratorId,session:Pe.session,interactive:Pe.interactive||$e,canWrite:$e})]}):(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4`,children:[(0,P.jsx)(ve,{className:`w-12 h-12 text-zinc-600 mb-3`}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Select an agent to start chatting`})]})}function Os(){let e=j(e=>e.inboxDrafts),t=j(e=>e.agentsById),n=j(e=>e.set);(0,N.useEffect)(()=>{let r=Object.keys(e);if(r.length===0)return;let i=r.filter(e=>!t[e]&&e!==`user`);if(i.length===0)return;let a=setTimeout(()=>{let e=j.getState().agentsById,t={...j.getState().inboxDrafts},r=!1;for(let n of i)e[n]||(delete t[n],r=!0);r&&n({inboxDrafts:t})},3e4);return()=>clearTimeout(a)},[])}function ks(e,t){(0,N.useEffect)(()=>{if(typeof window>`u`||!e||!window.matchMedia(`(max-width: 767px)`).matches)return;window.history.pushState({chatOpen:!0},``);function n(e){e.state?.chatOpen||t()}return window.addEventListener(`popstate`,n),()=>{window.removeEventListener(`popstate`,n),window.history.state?.chatOpen&&window.history.back()}},[e,t])}function As(){let e=Qt(),t=j(e=>e.selectedInboxThread),n=j(e=>e.set),r=j(e=>e.loadAgentChat),i=j(e=>e.agentsById),a=!!t,o=cn();Os(),(0,N.useEffect)(()=>{t&&r(t)},[t,r]),(0,N.useEffect)(()=>{t&&(i[t]||n({selectedInboxThread:``}))},[t,i,n]);let s=(0,N.useCallback)(()=>{n({selectedInboxThread:``})},[n]);return ks(a,s),(0,P.jsx)(`div`,{className:`flex h-full min-h-0`,children:o?(0,P.jsx)(`div`,{className:`flex w-full overflow-hidden`,children:a?(0,P.jsx)(js,{children:(0,P.jsx)(Ds,{threads:e,onBack:s,showBackButton:!0},t||`empty`)}):(0,P.jsx)(`div`,{className:`w-full flex flex-col overflow-hidden`,children:(0,P.jsx)(mn,{threads:e})})}):(0,P.jsxs)(`div`,{className:`flex w-full`,children:[(0,P.jsx)(`div`,{className:`w-1/3 min-w-[240px] max-w-xs flex flex-col overflow-hidden`,children:(0,P.jsx)(mn,{threads:e})}),(0,P.jsx)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:(0,P.jsx)(Ds,{threads:e},t||`empty`)})]})})}function js({children:e}){let t=en();return(0,P.jsx)(`div`,{className:`fixed inset-x-0 top-0 z-40 flex flex-col bg-background pt-[var(--sat)]`,style:{height:t?`${t}px`:`100dvh`},children:e})}export{As as ChatView};
2
+ //# sourceMappingURL=chat-Ca4ERso5.js.map