dorkos 0.121.0 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/bin/cli.js +392 -347
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-CtI8gbER.js → AboutPage-ClN3P9B8.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-CHTXfBS7.js → ActivityErrorState-B2lq1pyE.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-B8p4yYJL.js → ActivityPage-htTkSy18.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-CSuSz-92.js → ActivityRow-BqV0B1T0.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Qnxn0cE5.js → AdapterIcon-DlkN0YJo.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-BG8H-Lld.js → AdapterSetupWizard-RyNPjSmU.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-BWFQFynn.js → AgentOptionRow-DSievGfL.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CL93SET3.js → AgentPicker-BCtWrhsA.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CamX7Tvr.js → AgentRequestCard-BHIHWNRz.js} +1 -1
  13. package/dist/client/assets/{AppearancePage-rN70_7ih.js → AppearancePage-B2eduuT0.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-DeWaXbgm.js → ApplyToOverridesDialog-C7G2t3X2.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-CKcSWExi.js → AttentionSignalRow-_8thTHYX.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BwYaLf2P.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-WpZU5xiO.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DqPDLYbF.js → BindingDialog-BAwbHFq3.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-DoAZs5bz.js → BlintzCanvas-BEtRmEbL.js} +3 -3
  19. package/dist/client/assets/{BlintzCanvas-xZ3u3nk7.css → BlintzCanvas-DCXOV_yN.css} +1 -1
  20. package/dist/client/assets/{CanvasCsvContent-ViqRJuhW.js → CanvasCsvContent--6i2ETyZ.js} +2 -2
  21. package/dist/client/assets/CanvasFileContent-C86nyLbI.js +2 -0
  22. package/dist/client/assets/CanvasModel3dContent-wYHHAovt.js +2 -0
  23. package/dist/client/assets/{ChatAppsOff-D0PbHYqF.js → ChatAppsOff-2Wvch1rr.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-DFNSXeuV.js → CodeMirrorDiff-s1TWguZ8.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-AgkgsSqN.js → CodeMirrorEditor-1ndoTbcZ.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-0V6QivXH.js → CommitmentList-BK97ndab.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-i3XoHwBj.js → CommitmentsPage-_nd37gVX.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-RPoBc-km.js → ComputerResourceView-C2Broer4.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-2ugaCd0H.js → ComputerViewer-DgG7t2KZ.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-DaPP4U96.js → ConnectionAccessLists-Pbo2lft8.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-BVqYvfk5.js → ConnectionsPage-Dm2d9owX.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-BoqncrFd.js → ConventionPage-BUltejHJ.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-BrOEeNX3.js → ExtensionPageRoute-DAomCiMw.js} +1 -1
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DLwix3K7.js → FloatingTanStackRouterDevtools-CqogiFob-5fT29ZEV.js} +1 -1
  35. package/dist/client/assets/HandlePage-BoBFGnUB.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-DgXhbaBJ.js → HeartbeatPage-BW0X4YAL.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-CRr32Ae5.js → KeyEntry-ClqAj0dS.js} +1 -1
  38. package/dist/client/assets/{LexicalField-DeAoA6yr.js → LexicalField-CbswpPQ7.js} +1 -1
  39. package/dist/client/assets/{ManagesPage-ZBWYLTZx.js → ManagesPage-Daqs8hys.js} +1 -1
  40. package/dist/client/assets/{Marketplace-iL5p8Omt.js → Marketplace-BNMIm8g_.js} +4 -4
  41. package/dist/client/assets/{MarketplaceSourcesView-CsNLVOdP.js → MarketplaceSourcesView-B4WpzVpr.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-B1WPswgk.js → McpAppFrame-Dbg_Ni39.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-CJ28yu0o.js → McpSigninBody-ZmmY1BZ4.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BIZWdK8g.js → Model3dViewer-DT8x0h7T.js} +1 -1
  45. package/dist/client/assets/NamePage-bC_9FOtD.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-DRx9e9kM.js → NewDirectMessageMenu-BbehZd6I.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-cfqgSuVy.js → NotificationsPage-B9zEN26O.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-BIIuKDku.js → OpenMeshSwitch-D-AYDXjH.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-BKUSGrs6.js → OperatorIdentityForm-BdAqzVEG.js} +1 -1
  50. package/dist/client/assets/{PermissionHistory-Ctdqhib6.js → PermissionHistory-IOgLQ7qN.js} +1 -1
  51. package/dist/client/assets/{PermissionsPage-CYA_zdrV.js → PermissionsPage-CKfDf5Pj.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BR4Cpr2C.js → PersonalityPopover-CHPTuHIH.js} +1 -1
  53. package/dist/client/assets/PhotoPage-BOe3xwyN.js +1 -0
  54. package/dist/client/assets/{PresetPicker-zGvDOqTf.js → PresetPicker-BcKF2ds8.js} +1 -1
  55. package/dist/client/assets/{PreviewRefusedNotice-D1Tl265t.js → PreviewRefusedNotice-BuVUhjq3.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-T3vVbHRC.js → ProfileFields-DimHNpR4.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CParzTPA.js → ProfilePanelContainer-FRZ5Px2L.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-BU4eiMKn.js → ProfileRolePicker-UWhM5yuR.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-CGNQc2Tf.js → PromptSuggestionChips-DQaDSd7Y.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-Dj5U_Ppi.js → ReportsToPopover-BOuCM8il.js} +1 -1
  61. package/dist/client/assets/RoomSurface-Dhv-LkWz.js +44 -0
  62. package/dist/client/assets/{RoomsPage-Cvs3h6f0.js → RoomsPage-glKYJBpq.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-BUlYwRW4.js → RunsOnPopover-BvxoHUeo.js} +1 -1
  64. package/dist/client/assets/{RuntimeConnectFlow-ChrvjC84.js → RuntimeConnectFlow-CgB_X5wo.js} +1 -1
  65. package/dist/client/assets/{RuntimeSetupDialog-BK9yo7YF.js → RuntimeSetupDialog-r1Ss_YQW.js} +1 -1
  66. package/dist/client/assets/{SessionsPage-CWUwU3US.js → SessionsPage-CFLDx-aF.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-BApzy0J8.js → SettingsDialog-BT5rYJUm.js} +1 -1
  68. package/dist/client/assets/{SkillsPage-z3XnApNX.js → SkillsPage-CUQZ4I_r.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-BEWUpAlk.js → TaskDialogWrapper-DWpxyxBb.js} +1 -1
  70. package/dist/client/assets/{TasksEmptyState-CLwpLnIO.js → TasksEmptyState-B4TjUm8G.js} +1 -1
  71. package/dist/client/assets/{TasksPage-CyHjr9OZ.js → TasksPage-D_vFBDA1.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-BHHIofx3.js → TeamComputerEntry-EQ1fjMRb.js} +1 -1
  73. package/dist/client/assets/{ToolsPage-CckCco8x.js → ToolsPage-CyNXCe2l.js} +1 -1
  74. package/dist/client/assets/{TopologyGraph-Dox7aWP3.js → TopologyGraph-DsPEpDjt.js} +1 -1
  75. package/dist/client/assets/{TourHost-CTBewD-a.js → TourHost-D1z2mH5S.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-CFRgExId.js → UnlinkDialog-q-6B4Ftt.js} +1 -1
  77. package/dist/client/assets/{WidgetErrorCard-Dx5oPMlF.js → WidgetErrorCard-BYMiUiAf.js} +1 -1
  78. package/dist/client/assets/_shell-scIpUrVY.js +80 -0
  79. package/dist/client/assets/{_shell._home-DnBkgWs4.js → _shell._home-D-8JcUYq.js} +1 -1
  80. package/dist/client/assets/{_shell._home.activity-CVCC-EEI.js → _shell._home.activity-xJKxWbtL.js} +1 -1
  81. package/dist/client/assets/{_shell._home.index-Ck6jxwIx.js → _shell._home.index-C74gh1aE.js} +1 -1
  82. package/dist/client/assets/{_shell._home.tasks-B7QQAZnA.js → _shell._home.tasks-Bh8jwRYJ.js} +1 -1
  83. package/dist/client/assets/{_shell._home.workspaces-DlrRd9tv.js → _shell._home.workspaces-BKkUl6wW.js} +1 -1
  84. package/dist/client/assets/{_shell.channels-CiWehoyl.js → _shell.channels-B2A1G9n8.js} +4 -4
  85. package/dist/client/assets/{_shell.connections-CGP5hZHq.js → _shell.connections-eDlPXmuG.js} +1 -1
  86. package/dist/client/assets/{_shell.feedback-requests-BxxNvw6j.js → _shell.feedback-requests-Cdbl3oKj.js} +1 -1
  87. package/dist/client/assets/_shell.marketplace-FHQpZxgB.js +1 -0
  88. package/dist/client/assets/_shell.marketplace_.sources-DXv90Z-v.js +1 -0
  89. package/dist/client/assets/_shell.session-BNeYm91q.js +63 -0
  90. package/dist/client/assets/{_shell.team-CsXH3NkS.js → _shell.team-Consxq97.js} +3 -3
  91. package/dist/client/assets/_shell.x._extensionId-DirEl_qN.js +1 -0
  92. package/dist/client/assets/_shell.x._extensionId_._-DirEl_qN.js +1 -0
  93. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CMdkyiQ3.js → abnfDiagram-WEYOIA3C-DXTlLd8s.js} +1 -1
  94. package/dist/client/assets/{access-copy-CW-z1oMH.js → access-copy-B1SlOYEi.js} +1 -1
  95. package/dist/client/assets/{arc-Bw7tftQk.js → arc-B3IW5TXq.js} +1 -1
  96. package/dist/client/assets/{architectureDiagram-ZHVYKT53-BhpXALtX.js → architectureDiagram-ZHVYKT53-Bx-4szWe.js} +1 -1
  97. package/dist/client/assets/{banner-EomQNDOH.js → banner-RKoWGrEp.js} +1 -1
  98. package/dist/client/assets/{blockDiagram-RJAE7QA3-Bxk_BuZv.js → blockDiagram-RJAE7QA3-D_B3EDQ1.js} +1 -1
  99. package/dist/client/assets/{c4Diagram-XDPPPE54-CYN0FwR8.js → c4Diagram-XDPPPE54-CSBl4ROD.js} +1 -1
  100. package/dist/client/assets/{card-ww4ebz8h.js → card-DTMhLU7B.js} +1 -1
  101. package/dist/client/assets/channel-BlEJg4XA.js +1 -0
  102. package/dist/client/assets/{chunk-2E7WHVMD-IPDvYcPa.js → chunk-2E7WHVMD-QSgLcVHQ.js} +1 -1
  103. package/dist/client/assets/{chunk-2Q5K7J3B-DZ5bU5Ax.js → chunk-2Q5K7J3B-CAEYyBSj.js} +1 -1
  104. package/dist/client/assets/{chunk-4EMNKR2T-DrsWxa6Y.js → chunk-4EMNKR2T-CQ_90aiz.js} +1 -1
  105. package/dist/client/assets/{chunk-55XCU76K-CiBbKG0b.js → chunk-55XCU76K-jsUyUA3N.js} +1 -1
  106. package/dist/client/assets/{chunk-5VM5RSS4-B3K3MUav.js → chunk-5VM5RSS4-JHkf15PA.js} +1 -1
  107. package/dist/client/assets/{chunk-JWPE2WC7-CjV5RcIh.js → chunk-JWPE2WC7-BT-3krv8.js} +1 -1
  108. package/dist/client/assets/{chunk-VQ5W62QI-CWoRr0H2.js → chunk-VQ5W62QI-CJP11I5o.js} +1 -1
  109. package/dist/client/assets/{chunk-XXDRQBXY-E0nvzXiG.js → chunk-XXDRQBXY-BpqBecnj.js} +1 -1
  110. package/dist/client/assets/{chunk-ZCHMQSOR-DFop6Lvt.js → chunk-ZCHMQSOR-BLb4KcT4.js} +2 -2
  111. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-B7JJfc9z.js → classDiagram-v2-4MYWR3UA-DwLyYGkw.js} +1 -1
  112. package/dist/client/assets/{command-D4fLpJxA.js → command-DDSiiJlP.js} +1 -1
  113. package/dist/client/assets/{cose-bilkent-JH36ORCC-BjNppl29.js → cose-bilkent-JH36ORCC-CxYTET88.js} +1 -1
  114. package/dist/client/assets/{cpu-DCe0Yyml.js → cpu--56q_Ey0.js} +1 -1
  115. package/dist/client/assets/{cynefin-EF2NZ3EQ-PmRntJwW.js → cynefin-EF2NZ3EQ-9fHLZRHz.js} +1 -1
  116. package/dist/client/assets/{cynefinDiagram-WF24UDRP-Ctdbp_Vg.js → cynefinDiagram-WF24UDRP-DpfQecff.js} +1 -1
  117. package/dist/client/assets/{dagre-NK4GIZVX-5tvLY2ZW.js → dagre-NK4GIZVX-DuV6buEQ.js} +1 -1
  118. package/dist/client/assets/{diagram-CBK3MWTC-DZO-XBOO.js → diagram-CBK3MWTC-B-A9Sx5n.js} +1 -1
  119. package/dist/client/assets/{diagram-I5XIIV2D-CWBbA1Pv.js → diagram-I5XIIV2D-Ds5Hq9aV.js} +1 -1
  120. package/dist/client/assets/{diagram-ODIL2UCW-hP5A1tGl.js → diagram-ODIL2UCW-UUfSjM-R.js} +1 -1
  121. package/dist/client/assets/{diagram-PFBEJUXE-EI_-RoN7.js → diagram-PFBEJUXE-CUzSSYf9.js} +1 -1
  122. package/dist/client/assets/{diagram-RJA3I4VV-TrYq9A4Z.js → diagram-RJA3I4VV-Cgp6U3q1.js} +1 -1
  123. package/dist/client/assets/{diagram-TYUNFSNR-BAQq2OM5.js → diagram-TYUNFSNR-BxVgzMNE.js} +1 -1
  124. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-cKbeW9dQ.js → ebnfDiagram-V4P3TTPT-BgDiHzoi.js} +1 -1
  125. package/dist/client/assets/{elk-QONTBCTQ-wpfNPp0q.js → elk-QONTBCTQ-BCCN6mFs.js} +1 -1
  126. package/dist/client/assets/{empty-state-DXWQsHMf.js → empty-state-BsA3jcrO.js} +1 -1
  127. package/dist/client/assets/{erDiagram-KYQIGQAA-Dk0OrvjE.js → erDiagram-KYQIGQAA-5RkmUbLz.js} +1 -1
  128. package/dist/client/assets/{execution-config-CAyT2Qoo.js → execution-config-CRkSeCj7.js} +1 -1
  129. package/dist/client/assets/{file-Bf7D_47y.js → file-Bg_qGvWR.js} +1 -1
  130. package/dist/client/assets/{file-exclamation-point-DZXE9_8o.js → file-exclamation-point-BWsLZQVN.js} +1 -1
  131. package/dist/client/assets/{file-text-C1ougnBY.js → file-text-DQThCdY3.js} +1 -1
  132. package/dist/client/assets/{find-latest-widget-fence-B1_-pC-Z.js → find-latest-widget-fence-DFpYPIlS.js} +1 -1
  133. package/dist/client/assets/{flowDiagram-IUGLLWBU-CdlOoRZV.js → flowDiagram-IUGLLWBU-C2FFT_4u.js} +1 -1
  134. package/dist/client/assets/{form-D7kF-U0d.js → form-DjMe15QR.js} +1 -1
  135. package/dist/client/assets/{format-cron-ZtliseYi.js → format-cron-Bo3D4N9C.js} +1 -1
  136. package/dist/client/assets/{ganttDiagram-R7GPNTJY-x0MJLv5d.js → ganttDiagram-R7GPNTJY-BHG-HNDj.js} +1 -1
  137. package/dist/client/assets/{git-branch-B2k77X3Q.js → git-branch-CJ1NlVLY.js} +1 -1
  138. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-CruCvk7w.js → gitGraphDiagram-PDYL7XHY-D4bvs6_J.js} +1 -1
  139. package/dist/client/assets/{graph-5PBe05F8.js → graph-D8MBmHRU.js} +1 -1
  140. package/dist/client/assets/{heart-CmqGJPDc.js → heart-Beze5rli.js} +1 -1
  141. package/dist/client/assets/{highlighted-body-KPVGNVTW-Bqu2cQDj.js → highlighted-body-KPVGNVTW-B-za1R0D.js} +1 -1
  142. package/dist/client/assets/{image-lightbox-BBbz-ThL.js → image-lightbox-a4gqhNXS.js} +1 -1
  143. package/dist/client/assets/{image-off-BCtWIY4q.js → image-off-dQCXn9D_.js} +1 -1
  144. package/dist/client/assets/{index-8IAr9b71.js → index--vwACals.js} +1 -1
  145. package/dist/client/assets/{index-rWZWP3Wh.js → index-B3VKw60l.js} +1 -1
  146. package/dist/client/assets/index-B3ybVnXe.js +23 -0
  147. package/dist/client/assets/{index-DIxzqCwG.js → index-BJv8b9cZ.js} +1 -1
  148. package/dist/client/assets/{index-Cv0GsC4n.js → index-BMhblg3s.js} +1 -1
  149. package/dist/client/assets/{index-yI1r4pSP.js → index-BMktWriw.js} +1 -1
  150. package/dist/client/assets/{index-BIIH5CXj.js → index-BPa0ZczY.js} +1 -1
  151. package/dist/client/assets/{index-ClBIPuLA.js → index-BTVsyrd0.js} +1 -1
  152. package/dist/client/assets/{index-EdJm7ZN-.js → index-BTfwunle.js} +1 -1
  153. package/dist/client/assets/{index-DrA03bMq.js → index-BaocSCDH.js} +1 -1
  154. package/dist/client/assets/{index-BpmmNapD.js → index-Bk6YahnN.js} +1 -1
  155. package/dist/client/assets/{index-B5rRtvWx.js → index-BqwfU5a7.js} +1 -1
  156. package/dist/client/assets/index-BydIKjk5.js +1 -0
  157. package/dist/client/assets/{index-BfRW2WTx.js → index-C38pc-JE.js} +1 -1
  158. package/dist/client/assets/{index-BuGQxHrf.js → index-C9qjJR0B.js} +1 -1
  159. package/dist/client/assets/{index-C11Ssk2u.js → index-CAGOE4EU.js} +2 -2
  160. package/dist/client/assets/{index-DsJWzmWw.js → index-CDm1XkU1.js} +1 -1
  161. package/dist/client/assets/{index-JxeBJIuE.js → index-CGVRWEpN.js} +1 -1
  162. package/dist/client/assets/{index-BXMxoWrk.js → index-CMlVfxJv.js} +1 -1
  163. package/dist/client/assets/{index-Do6eeFps.js → index-CPxcbKL6.js} +2 -2
  164. package/dist/client/assets/{index-CMNc_OrC.js → index-CU-gekzq.js} +1 -1
  165. package/dist/client/assets/{index-CJ5v2_Cz.js → index-Ckv0K82u.js} +1 -1
  166. package/dist/client/assets/{index-mFOJXyAE.js → index-CocSe_I3.js} +3 -3
  167. package/dist/client/assets/{index-B6dEbNhI.js → index-CodC2rG4.js} +1 -1
  168. package/dist/client/assets/{index-DbDI5BAA.js → index-CxWJDJW7.js} +1 -1
  169. package/dist/client/assets/index-D18FqQKB.js +1 -0
  170. package/dist/client/assets/{index-ChwNEkM8.js → index-D4mYlxG0.js} +1 -1
  171. package/dist/client/assets/{index-DcZPWi_I.js → index-DBdO-_iL.js} +247 -247
  172. package/dist/client/assets/{index-BrQGZ6iF.js → index-DFN-GU8r.js} +1 -1
  173. package/dist/client/assets/{index-t4Ud6YTX.js → index-DLdpa3d4.js} +1 -1
  174. package/dist/client/assets/{index-8TfzCkKR.js → index-DNlhbCX_.js} +1 -1
  175. package/dist/client/assets/{index-DAdo_yIq.js → index-D_KBdkA4.js} +1 -1
  176. package/dist/client/assets/{index-BCk4wW-T.js → index-Dbt6ttQb.js} +1 -1
  177. package/dist/client/assets/{index-BXZlDqvy.js → index-DfSOcv9s.js} +1 -1
  178. package/dist/client/assets/{index-Dmn03xST.js → index-DnfhvN3q.js} +1 -1
  179. package/dist/client/assets/{index-CQ0VLZf-.js → index-DpX_xwGs.js} +1 -1
  180. package/dist/client/assets/{index-xmk9Ohv9.js → index-DqD-Sg0W.js} +1 -1
  181. package/dist/client/assets/{index-xaMF1mrN.js → index-Ds-LCBb6.js} +1 -1
  182. package/dist/client/assets/index-dnaC3n0i.js +17 -0
  183. package/dist/client/assets/{index-CtycM8wY.js → index-hKY0860x.js} +1 -1
  184. package/dist/client/assets/{index-BzPgsdPn.js → index-vNaWkS8Y.js} +1 -1
  185. package/dist/client/assets/{index-1ShgR_xt.js → index-vieeLeZH.js} +1 -1
  186. package/dist/client/assets/{index-Cml5572f.js → index-yDf4EVDy.js} +1 -1
  187. package/dist/client/assets/{index.esm-CZZtbPRj.js → index.esm-Ruqz-OsH.js} +1 -1
  188. package/dist/client/assets/{infoDiagram-MVDRKAX5-Bj9DD77n.js → infoDiagram-MVDRKAX5-CmDlX3lx.js} +1 -1
  189. package/dist/client/assets/{inline-code-g9PVHZI2.js → inline-code-plzdKGm9.js} +1 -1
  190. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DckI6dhS.js → ishikawaDiagram-HPEHV2GE-DZFRAvrx.js} +1 -1
  191. package/dist/client/assets/{journeyDiagram-BOSHW7O7-Ce1GAVa0.js → journeyDiagram-BOSHW7O7-B140KXYu.js} +1 -1
  192. package/dist/client/assets/{kanban-definition-FNSA4HC5-Kq5O9rZa.js → kanban-definition-FNSA4HC5-QCZgRJic.js} +1 -1
  193. package/dist/client/assets/{layers-D3lEdRF0.js → layers-Br3LALac.js} +1 -1
  194. package/dist/client/assets/{lightbulb-BFE-KkFU.js → lightbulb-CeJgUDoT.js} +1 -1
  195. package/dist/client/assets/{link-2-Dvb6g-2Q.js → link-2-BXcZwTAC.js} +1 -1
  196. package/dist/client/assets/{list-runtime-types-8YGEK3Al.js → list-runtime-types-CqKIrt9D.js} +1 -1
  197. package/dist/client/assets/{markdown-content-Cqq_QMXA.js → markdown-content-BKbjOTI2.js} +1 -1
  198. package/dist/client/assets/{mention-pill-Bnzt4u2l.js → mention-pill-B-FgNE6o.js} +1 -1
  199. package/dist/client/assets/{mermaid.core-dpp59v7L.js → mermaid.core-Br9hJ7FR.js} +4 -4
  200. package/dist/client/assets/{message-square-off-BX2XnEDx.js → message-square-off-Co0W--np.js} +1 -1
  201. package/dist/client/assets/{mindmap-definition-6OY57UG3-CFdfJO6g.js → mindmap-definition-6OY57UG3-BxjSZAec.js} +1 -1
  202. package/dist/client/assets/{more-details-B4lBMpKi.js → more-details-BsdCkGTg.js} +1 -1
  203. package/dist/client/assets/{owner-notice-ByjrIRmX.js → owner-notice-BxltHzJH.js} +1 -1
  204. package/dist/client/assets/{package-6Rbxg35g.js → package-DPgmy9lP.js} +1 -1
  205. package/dist/client/assets/{page-container-DoZzad36.js → page-container-HokGbFg_.js} +1 -1
  206. package/dist/client/assets/{paperclip-B-jDXtxw.js → paperclip-BDnApT-_.js} +1 -1
  207. package/dist/client/assets/{path-input-DpqUD8hN.js → path-input-C22n3ghr.js} +1 -1
  208. package/dist/client/assets/{pegDiagram-ECIUJNBX-eVnSw2Ma.js → pegDiagram-ECIUJNBX-utA2pUiu.js} +1 -1
  209. package/dist/client/assets/{pieDiagram-GNMPY74T-BYG7LY5Q.js → pieDiagram-GNMPY74T-DjEry_VP.js} +1 -1
  210. package/dist/client/assets/{plug-DnaAhcy4.js → plug-tLTAmXis.js} +1 -1
  211. package/dist/client/assets/{primer-trigger-Da5ECjY8.js → primer-trigger-CfVHNFbe.js} +1 -1
  212. package/dist/client/assets/{profile-errors-GbTNc2-M.js → profile-errors-Dvm4O6MR.js} +1 -1
  213. package/dist/client/assets/{progress-DlIRjXIA.js → progress-BduTwXMX.js} +1 -1
  214. package/dist/client/assets/{quadrantDiagram-D57K4MC3-CRgNKuHR.js → quadrantDiagram-D57K4MC3-DO9NgnEq.js} +1 -1
  215. package/dist/client/assets/{query-error-state-DB-Jby7_.js → query-error-state-puwJHnzi.js} +1 -1
  216. package/dist/client/assets/query-keys-DeYqUDia.js +1 -0
  217. package/dist/client/assets/{radio-CaaE60ws.js → radio-DR4E05zZ.js} +1 -1
  218. package/dist/client/assets/{railroadDiagram-Y72NRBL7-DGL-Hqz9.js → railroadDiagram-Y72NRBL7-BTilAS9p.js} +1 -1
  219. package/dist/client/assets/registry-B3Ss4ItQ.js +1 -0
  220. package/dist/client/assets/{relay-trace-schemas-CcCqyOrA.js → relay-trace-schemas-DwqIIDB9.js} +1 -1
  221. package/dist/client/assets/{requirementDiagram-EQYSW5RA-DKsFpU3l.js → requirementDiagram-EQYSW5RA-C6rzY7GK.js} +1 -1
  222. package/dist/client/assets/{room-files-source-CbbVpvSW.js → room-files-source-Duo4oiqX.js} +1 -1
  223. package/dist/client/assets/{rotate-ccw-clock-CeY00nlZ.js → rotate-ccw-clock-RJuoRE3k.js} +1 -1
  224. package/dist/client/assets/{rotate-cw-Djl5J_x9.js → rotate-cw-C0EpbK5k.js} +1 -1
  225. package/dist/client/assets/{sankeyDiagram-SY24JHO5-BFRkDxic.js → sankeyDiagram-SY24JHO5-BqpJRY1t.js} +1 -1
  226. package/dist/client/assets/{scroll-area-BOqrziJf.js → scroll-area-07T90PR6.js} +1 -1
  227. package/dist/client/assets/{search-x-B_mHjnlo.js → search-x-DQabogEL.js} +1 -1
  228. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-fHea3KOI.js → sequenceDiagram-BLEHNHQU-BHfzZpFt.js} +1 -1
  229. package/dist/client/assets/{shield-check-Csnr5rFy.js → shield-check-DbbCy17l.js} +1 -1
  230. package/dist/client/assets/{shield-x-Dhl4YvvW.js → shield-x-Cuo1GTv4.js} +1 -1
  231. package/dist/client/assets/{signed-in-BMqAss8c.js → signed-in-CFtA8gTK.js} +1 -1
  232. package/dist/client/assets/{sizeCapture-INFHLROL-CztsD3qF.js → sizeCapture-INFHLROL-U0MO-4ua.js} +1 -1
  233. package/dist/client/assets/{soul-file-DOfamgB5.js → soul-file-wKTqbR0Y.js} +1 -1
  234. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-CWyOqZ9S.js → stateDiagram-v2-A6IESKWZ-fzo1sDsX.js} +1 -1
  235. package/dist/client/assets/{swimlanes-B3ENRKFQ-0EfOxSAX.js → swimlanes-B3ENRKFQ-B7QcCUBU.js} +1 -1
  236. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CgZZnzbW.js +8 -0
  237. package/dist/client/assets/{table-L7FvN6Or.js → table-BjHA85BX.js} +1 -1
  238. package/dist/client/assets/{terminal-C9M5a_PS.js → terminal-qfxxVZaa.js} +1 -1
  239. package/dist/client/assets/{timeline-definition-JXYKGLGB-sFyYvZ20.js → timeline-definition-JXYKGLGB-okVlmef4.js} +1 -1
  240. package/dist/client/assets/{trust-posture-dl6qwDtI.js → trust-posture-BmW0KVP6.js} +1 -1
  241. package/dist/client/assets/{unplug-CFUEVRbc.js → unplug-BYKBdSMl.js} +1 -1
  242. package/dist/client/assets/{unverified-catalog-notice-CdYU3WEJ.js → unverified-catalog-notice-CQHA4Cst.js} +1 -1
  243. package/dist/client/assets/{use-adapter-catalog-YTofdqDJ.js → use-adapter-catalog-rB4qQQ5D.js} +1 -1
  244. package/dist/client/assets/{use-bindings-CpyT6kNu.js → use-bindings-DiFC7kWg.js} +1 -1
  245. package/dist/client/assets/{use-composer-prefs-CK_EK_QJ.js → use-composer-prefs-DHY5vJ0l.js} +1 -1
  246. package/dist/client/assets/{use-connector-management-DwoK8kon.js → use-connector-management-CoinXIID.js} +1 -1
  247. package/dist/client/assets/{use-deep-link-scroll-CgRjt48R.js → use-deep-link-scroll-Cm8BRFAE.js} +1 -1
  248. package/dist/client/assets/{use-delete-binding-CfsnMXrL.js → use-delete-binding-FtM6qPfF.js} +1 -1
  249. package/dist/client/assets/{use-dev-links-B3I-ZK34.js → use-dev-links-TQFCV3vk.js} +1 -1
  250. package/dist/client/assets/{use-external-adapter-catalog-aGlZNRrp.js → use-external-adapter-catalog-Lx8LZDAa.js} +1 -1
  251. package/dist/client/assets/{use-full-activity-feed-B61Olhdw.js → use-full-activity-feed-CmcBAvUM.js} +1 -1
  252. package/dist/client/assets/use-is-below-desktop-BB9kHnYm.js +1 -0
  253. package/dist/client/assets/use-is-hub-ab4UGRdN.js +1 -0
  254. package/dist/client/assets/{use-jump-back-in-C39GOTHa.js → use-jump-back-in-V8G_6fYj.js} +1 -1
  255. package/dist/client/assets/{use-local-browser-DCwzB4D8.js → use-local-browser-CbS4typW.js} +1 -1
  256. package/dist/client/assets/{use-mesh-topology-LRYxFuZp.js → use-mesh-topology-DZ1qMT3J.js} +1 -1
  257. package/dist/client/assets/{use-mounted-ref-CZaegwTr.js → use-mounted-ref-DUbNzP-m.js} +1 -1
  258. package/dist/client/assets/{use-notification-prefs-FtOiUS5H.js → use-notification-prefs-BAsICJ96.js} +1 -1
  259. package/dist/client/assets/{use-panel-tab-placements-Dv2OPvKh.js → use-panel-tab-placements-ymrpuL_s.js} +1 -1
  260. package/dist/client/assets/use-pending-read-BkCvAuX4.js +1 -0
  261. package/dist/client/assets/{use-personality-commit-BB5aeh6p.js → use-personality-commit-rJOmDgC2.js} +1 -1
  262. package/dist/client/assets/{use-promo-activation-BW0u7n7m.js → use-promo-activation-BKeBloMI.js} +1 -1
  263. package/dist/client/assets/{use-promo-dismissals-BOXzW4kD.js → use-promo-dismissals-Cio8QMjL.js} +1 -1
  264. package/dist/client/assets/{use-pulse-freshness-ClW-MLMo.js → use-pulse-freshness-DZkMVbSM.js} +1 -1
  265. package/dist/client/assets/{use-relay-config-hItHtkSr.js → use-relay-config-CbZQKFhZ.js} +1 -1
  266. package/dist/client/assets/{use-room-follow-claim-wotzxUWc.js → use-room-follow-claim-DbJIsuWz.js} +1 -1
  267. package/dist/client/assets/{use-roving-tab-list-DkbO6xSs.js → use-roving-tab-list-B4nZ7trj.js} +1 -1
  268. package/dist/client/assets/use-session-canvas-sAwc2L1A.js +25 -0
  269. package/dist/client/assets/{use-session-diagnostics-DmxvD-wy.js → use-session-diagnostics-0gcI762B.js} +2 -2
  270. package/dist/client/assets/{use-unclaimed-chats-DKpexDm3.js → use-unclaimed-chats-BWIqOrvs.js} +1 -1
  271. package/dist/client/assets/use-update-config-DTL7WyZV.js +1 -0
  272. package/dist/client/assets/{useMutationState-Btf2Hp1a.js → useMutationState-C9Q5lRej.js} +1 -1
  273. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DRngjDUq.js → usecaseDiagram-WPOLBNNX-CMjVaeX9.js} +1 -1
  274. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-iK-dlS1-.js → vennDiagram-Q3Y3IDCW-BajZBf0H.js} +1 -1
  275. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-sOS67Cks.js → wardleyDiagram-IVAIDKWA-BN4xF6JT.js} +1 -1
  276. package/dist/client/assets/{xychartDiagram-4URNHDU4-EgnLiIao.js → xychartDiagram-4URNHDU4-Cy0Z9a28.js} +1 -1
  277. package/dist/client/index.html +1 -1
  278. package/dist/server/index.js +30173 -28514
  279. package/dist/server/index.js.map +2 -2
  280. package/package.json +6 -6
  281. package/dist/client/assets/CanvasFileContent-ClcHZ_l-.js +0 -2
  282. package/dist/client/assets/CanvasModel3dContent-Cm3msNdQ.js +0 -2
  283. package/dist/client/assets/HandlePage-B_5GLHsp.js +0 -1
  284. package/dist/client/assets/NamePage-0nr288eM.js +0 -1
  285. package/dist/client/assets/PhotoPage-C3Ir3wlA.js +0 -1
  286. package/dist/client/assets/RoomSurface-BIyjtxKD.js +0 -44
  287. package/dist/client/assets/_shell-BHUZq_8C.js +0 -80
  288. package/dist/client/assets/_shell.marketplace-BoAmyvPt.js +0 -1
  289. package/dist/client/assets/_shell.marketplace_.sources-BpqWjkGL.js +0 -1
  290. package/dist/client/assets/_shell.session-KyPj3OxK.js +0 -61
  291. package/dist/client/assets/_shell.x._extensionId-CfiAgtoq.js +0 -1
  292. package/dist/client/assets/_shell.x._extensionId_._-CfiAgtoq.js +0 -1
  293. package/dist/client/assets/channel-DZpRF3QJ.js +0 -1
  294. package/dist/client/assets/index-Cl8trmnL.js +0 -1
  295. package/dist/client/assets/index-Cp3yShS8.js +0 -23
  296. package/dist/client/assets/index-DKDK-3KH.js +0 -17
  297. package/dist/client/assets/index-DPNBHwcQ.js +0 -1
  298. package/dist/client/assets/registry-DS1Ghdft.js +0 -1
  299. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C7fkUKrq.js +0 -8
  300. package/dist/client/assets/use-is-below-desktop-Qwyg-mFb.js +0 -1
  301. package/dist/client/assets/use-is-hub-CSz6NDaP.js +0 -1
  302. package/dist/client/assets/use-pending-read-DBOl1ee_.js +0 -1
  303. package/dist/client/assets/use-session-canvas-C_fuAgW_.js +0 -24
  304. package/dist/client/assets/use-update-config-CSYwg557.js +0 -1
@@ -1,4 +1,4 @@
1
- import{W as de,as as ne,a1 as q,a3 as me,a4 as Cs,at as ws,au as B,r as h,kZ as Es,k_ as Ve,k$ as Ye,l0 as Ms,aW as Z,hK as Je,du as pe,y as fe,a2 as he,gZ as Rs,l1 as _s,iy as Ze,l2 as As,dQ as es,l3 as Os,l4 as Me,l5 as Ps,l6 as Ds,a7 as Is,j as s,bx as xe,ar as ge,G as k,dZ as Us,aR as Re,l7 as oe,l8 as Ls,l9 as zs,ig as ss,la as Bs,kP as $s,bL as Ne,gk as Fs,cs as H,gU as Gs,lb as Hs,lc as Ws,gS as qs,ld as W,cM as D,cN as I,cO as U,by as je,bz as ye,bA as be,bC as ve,gW as Qs,aN as ts,gT as Ks,le as Xs,lf as $,lg as Vs,b8 as Ys,B as F,lh as Js,li as Zs,a9 as et,lj as ns,dt as st,dR as tt,lk as _e,ll as nt,ij as rt,ik as it,je as Ae,im as at,io as ot,lm as lt,ln as ct,ip as Oe,lo as ut,f as dt,dx as Pe,hb as rs,lp as mt,lq as pt,lr as is,ls as as,lt as ft,g9 as ht,ga as xt,gb as gt,gc as Nt,_ as ee,gd as jt,ge as yt,gf as bt,gg as vt,e as K,dz as os,ju as De,dj as St,I as Tt,jv as kt,jd as Ct,aS as ls,aO as Se,c7 as wt,dO as se,c9 as ae,lu as le,lv as cs,ca as us,lw as Et,lx as Mt,ly as Rt,eQ as _t,lz as At,eS as Ot,cb as Pt,lA as Dt,bD as X,cc as ds,lB as It,jM as Ut,aq as Lt,eW as zt,lC as Bt,gX as $t,lD as Ft,hE as Gt,iR as Ht,J as Wt,X as qt,ad as Qt,kL as Kt,g2 as Xt,hI as Vt,ea as Yt,hu as Jt,ie as Zt,$ as en,eG as sn,lE as tn,cp as nn,lF as rn,lG as an,lH as on,lI as ln,lJ as cn,lK as un,lL as dn}from"./index-DcZPWi_I.js";import{G as V}from"./git-branch-B2k77X3Q.js";import{u as mn}from"./use-update-config-CSYwg557.js";import{s as pn}from"./settings-for-runtime-BoOa-ZFG.js";import{C as fn}from"./card-ww4ebz8h.js";import{R as hn,H as xn,a as gn,b as Nn}from"./RuntimeSetupDialog-BK9yo7YF.js";import{r as jn}from"./RuntimeConnectFlow-ChrvjC84.js";import{U as Ie}from"./unverified-catalog-notice-CdYU3WEJ.js";import{L as yn}from"./layers-D3lEdRF0.js";import{C as bn,a as vn}from"./cpu-DCe0Yyml.js";/**
1
+ import{W as de,as as ne,a1 as q,a3 as me,a4 as Cs,at as ws,au as B,r as h,k$ as Es,l0 as Ve,l1 as Ye,l2 as Ms,aW as Z,hK as Je,du as pe,y as fe,a2 as he,gZ as Rs,l3 as _s,iy as Ze,l4 as As,dQ as es,l5 as Os,l6 as Me,l7 as Ds,l8 as Ps,a7 as Is,j as s,bx as xe,ar as ge,G as k,dZ as Us,aR as Re,l9 as oe,la as Ls,lb as zs,ig as ss,lc as Bs,kR as $s,bL as Ne,gk as Fs,cs as H,gU as Gs,ld as Hs,le as Ws,gS as qs,lf as W,cM as P,cN as I,cO as U,by as je,bz as ye,bA as be,bC as ve,gW as Qs,aN as ts,gT as Ks,lg as Xs,lh as $,li as Vs,b8 as Ys,B as F,lj as Js,lk as Zs,a9 as et,ll as ns,dt as st,dR as tt,lm as _e,ln as nt,ij as rt,ik as it,je as Ae,im as at,io as ot,lo as lt,lp as ct,ip as Oe,lq as ut,f as dt,dx as De,hb as rs,lr as mt,ls as pt,lt as is,lu as as,lv as ft,g9 as ht,ga as xt,gb as gt,gc as Nt,_ as ee,gd as jt,ge as yt,gf as bt,gg as vt,e as K,dz as os,jw as Pe,dj as St,I as Tt,jx as kt,jd as Ct,aS as ls,aO as Se,c7 as wt,dO as se,c9 as ae,lw as le,lx as cs,ca as us,ly as Et,lz as Mt,lA as Rt,eQ as _t,lB as At,eS as Ot,cb as Dt,lC as Pt,bD as X,cc as ds,lD as It,jO as Ut,aq as Lt,eW as zt,lE as Bt,gX as $t,lF as Ft,hE as Gt,iR as Ht,J as Wt,X as qt,ad as Qt,kN as Kt,g2 as Xt,hI as Vt,ea as Yt,hu as Jt,ie as Zt,$ as en,eG as sn,lG as tn,cp as nn,lH as rn,lI as an,lJ as on,lK as ln,lL as cn,lM as un,lN as dn}from"./index-DBdO-_iL.js";import{G as V}from"./git-branch-CJ1NlVLY.js";import{u as mn}from"./use-update-config-DTL7WyZV.js";import{s as pn}from"./settings-for-runtime-BoOa-ZFG.js";import{C as fn}from"./card-DTMhLU7B.js";import{R as hn,H as xn,a as gn,b as Nn}from"./RuntimeSetupDialog-r1Ss_YQW.js";import{r as jn}from"./RuntimeConnectFlow-CgB_X5wo.js";import{U as Ie}from"./unverified-catalog-notice-CQHA4Cst.js";import{L as yn}from"./layers-Br3LALac.js";import{C as bn,a as vn}from"./cpu--56q_Ey0.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,4 +13,4 @@ import{W as de,as as ne,a1 as q,a3 as me,a4 as Cs,at as ws,au as B,r as h,kZ as
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const fs={name:"wifi",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]};fs.node;const Y=de(fs);function kn(e){return e.ambient===!0&&e.status!=="error"}function yi(e){const t=[],n=[];for(const r of e)(r.ambient?n:t).push(r);return{shown:t,ambient:n}}function Cn(e){var t;return((t=e==null?void 0:e.ui)==null?void 0:t.statusBar)??Es}function wn(){const{data:e}=ne();return Cn(e)}function En(){const e=q(),t=me(),n=Cs({mutationKey:ws,mutationFn:i=>e.updateConfig({ui:{statusBar:{pins:[...i]}}}),onMutate:async i=>{await t.cancelQueries({queryKey:B.current()});const o=t.getQueryData(B.current());return t.setQueryData(B.current(),a=>a!=null&&a.ui?{...a,ui:{...a.ui,statusBar:{pins:[...i]}}}:a),{previous:o}},onError:(i,o,a)=>{a&&a.previous!==void 0&&t.setQueryData(B.current(),a.previous)},onSettled:()=>{t.invalidateQueries({queryKey:B.current()})}});return{setPins:h.useCallback(i=>n.mutate(i),[n]),isPending:n.isPending}}const Mn=80,Rn=95,_n=70,hs=85;function An(e){return e>=Rn?"critical":e>=Mn?"warning":"ok"}function xs(e,t){return e==null||e<=0||t==null||t<=0?null:Math.min(100,Math.round(e/t*100))}function gs(e,t){return t?Math.round(t.percentage):e}function On(e){var n;const t=e.cacheStats;return!t||t.cacheReadTokens===0&&t.cacheCreationTokens===0?null:{cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,contextTokens:(n=e.contextUsage)==null?void 0:n.totalTokens}}function Pn(e){var t,n;return e?{contextPercent:xs((t=e.contextUsage)==null?void 0:t.totalTokens,(n=e.contextUsage)==null?void 0:n.maxTokens),costUsd:e.cost,model:e.model,cacheStatus:On(e),usage:e.usage}:{contextPercent:null,costUsd:null,model:null,cacheStatus:null,usage:null}}function Ns(e,t,n){if(t)return"streaming";if(e===void 0)return n;switch(e){case"streaming":return"streaming";case"error":return"error";default:return"idle"}}function bi(e,t){var n;return Ns((n=e.status)==null?void 0:n.lifecycle,e.triggerPending,t)}function Dn(e){const t=Ve(e),n=Ye(e),r=Ms(e);return Ns(t,n,r)}function In(e,t){return e??t??"default"}function J(e){return!e.isPending||e.fetchStatus==="idle"||e.fetchStatus==="paused"}const Un=5e3;function Ln(e,t){const n=q(),r=Z(N=>N.selectedCwd),{sessions:i,isAnswered:o,isLoading:a}=Je(),u=ne(),f=pe(),{data:m}=u,{data:p}=f,c=t??(p==null?void 0:p.defaultRuntime)??null,d=fe(c),y=e!==null&&o&&!i.some(N=>N.id===e),v=he({queryKey:Ze.storedSettings(e),queryFn:()=>n.getStoredSessionSettings(e),staleTime:Un,enabled:y,networkMode:"always"}),{data:l}=v;if(r===null)return{mode:void 0,settled:!1};if(a)return{mode:void 0,settled:!1};if(!y)return{mode:void 0,settled:!0};if(!J(v)||!J(u)||!J(f))return{mode:void 0,settled:!1};if((l==null?void 0:l.permissionMode)!==void 0)return{mode:l.permissionMode,settled:!0};if(!c||!(d!=null&&d.permissionModes.supported))return{mode:void 0,settled:!0};const x=Rs(m==null?void 0:m.executionDefaults,c);return{mode:_s(x,d.permissionModes),settled:!0}}function zn(e,t,n,r){var Te,ke;const i=q(),o=me(),a=Z(j=>j.selectedCwd),u=As(e),f=(u==null?void 0:u.cwd)??a,m=Z(j=>j.pendingAccount),{data:p}=es({sessionId:e??void 0,runtime:r??void 0}),c=Os(e??""),d=Me(j=>j.apply),y=Me(j=>j.clear),v=Ps(e),{data:l}=v,{sessions:x}=Je(),N=e===null?void 0:x.find(j=>j.id===e),w=Ln(e,r),g=((Te=p==null?void 0:p.find(j=>j.isDefault))==null?void 0:Te.value)??((ke=p==null?void 0:p[0])==null?void 0:ke.value)??"",T=Ds(e??""),_=!r||!(l!=null&&l.runtime)||l.runtime===r?l==null?void 0:l.model:void 0,E=T&&_===T.from?T.to:_,O=c.model??(n?t==null?void 0:t.model:null)??E??g,P=p==null?void 0:p.find(j=>j.value===O),M=(t==null?void 0:t.contextTokens)??(l==null?void 0:l.contextTokens)??null,C=(t==null?void 0:t.contextMaxTokens)??(P==null?void 0:P.contextWindow)??null,b=c.effort??(l==null?void 0:l.effort)??null,Q=c.fastMode??(l==null?void 0:l.fastMode)??!1,G=c.permissionMode??(l==null?void 0:l.permissionMode)??(N==null?void 0:N.permissionMode)??w.mode,R=e===null||G!==void 0||J(v)&&w.settled,L={permissionMode:In(c.permissionMode,G),permissionModeKnown:R,model:O,effort:b,fastMode:Q,costUsd:(t==null?void 0:t.costUsd)??null,contextPercent:xs(M,C),isStreaming:n,cwd:(l==null?void 0:l.cwd)??null},re=h.useCallback(async j=>{if(!e)return;const Ce={...j.model?{model:j.model}:{},...j.permissionMode?{permissionMode:j.permissionMode}:{},...j.effort?{effort:j.effort}:{},...j.fastMode!==void 0?{fastMode:j.fastMode}:{}};d(e,Ce);const we=(m==null?void 0:m.sessionId)===e?m.id:void 0,Ts={...r?{runtime:r}:{},...we?{account:we}:{},...j};try{const{permissionModePendingUntilNextTurn:ie,runtimeUnbound:ks,...Ee}=await i.updateSession(e,Ts,f??void 0);return ie&&Is.warning("Saved · starts on your next message",{description:"The current reply keeps its old setting."}),o.setQueriesData({queryKey:Ze.bySession(e)},z=>({...z,...Ee,...j.model===void 0?{model:z==null?void 0:z.model}:{},...ks?{runtime:z==null?void 0:z.runtime}:{}})),Ee}catch(ie){console.error("[useSessionStatus] updateSession failed for session",e,ie),y(e,Ce)}},[i,e,r,f,m,o,d,y]);return h.useEffect(()=>{if(!e)return;const j={};c.model!==void 0&&(l==null?void 0:l.model)===c.model&&(j.model=c.model),c.permissionMode!==void 0&&(l==null?void 0:l.permissionMode)===c.permissionMode&&(j.permissionMode=c.permissionMode),c.effort!==void 0&&(l==null?void 0:l.effort)===c.effort&&(j.effort=c.effort),c.fastMode!==void 0&&(l==null?void 0:l.fastMode)===c.fastMode&&(j.fastMode=c.fastMode),Object.keys(j).length>0&&y(e,j)},[e,l==null?void 0:l.model,l==null?void 0:l.permissionMode,l==null?void 0:l.effort,l==null?void 0:l.fastMode,c,y]),{...L,updateSession:re}}function Bn(e){const t=q();return he({queryKey:["subagents",e??null],queryFn:()=>t.getSubagents({sessionId:e}),staleTime:1800*1e3})}const $n={duration:.2,ease:[.4,0,.2,1]},Fn="pointer-coarse:[&_button]:py-3";function vi({items:e,trailing:t}){const n=e.filter(i=>i.cluster==="left"),r=e.filter(i=>i.cluster==="right");return s.jsxs("div",{role:"toolbar","aria-label":"Chat status","aria-live":"polite","data-testid":"status-line",className:"text-muted-foreground flex items-center gap-2 overflow-hidden px-1 text-xs whitespace-nowrap pointer-coarse:min-h-11",children:[s.jsx(Ue,{items:n,className:"min-w-0 flex-auto"}),s.jsx(Ue,{items:r,className:"min-w-0 shrink"}),t!==void 0&&s.jsx("span",{className:"flex shrink-0 items-center",children:t})]})}const Gn=8;function Hn(e,t){return Gn**Math.max(0,t.indexOf(e.key))}function Ue({items:e,className:t}){const n=[...e].sort((r,i)=>i.severity-r.severity).map(r=>r.key);return s.jsx("div",{className:k("flex items-center gap-2",t),children:s.jsx(xe,{initial:!1,mode:"popLayout",children:e.map((r,i)=>s.jsxs(ge.div,{"data-testid":`status-item-${r.key}`,"data-rigid":r.rigid?"true":void 0,layout:"position",initial:{opacity:0,scale:.8,filter:"blur(4px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},exit:{opacity:0,scale:.8,filter:"blur(4px)"},transition:$n,style:r.rigid?void 0:{flexShrink:Hn(r,n)},className:k("inline-flex items-center gap-2",r.rigid?"shrink-0":"min-w-10",Fn),children:[i>0&&s.jsx(Wn,{}),r.node]},r.key))})})}function Wn(){return s.jsx("span",{className:"text-muted-foreground/30 shrink-0","aria-hidden":"true",children:"·"})}function Si({cwd:e}){const t=e.split("/").filter(Boolean).pop()??e;return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:e,children:[s.jsx(Us,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:t})]})}const qn=Object.freeze({state:"unknown"}),Qn=Object.freeze({state:"no-repo"});function Kn(e){const t=q();return he({queryKey:["git-status",e],queryFn:()=>t.getGitStatus(e??void 0),enabled:!!e,refetchInterval:Re.GIT_STATUS_REFETCH_MS,refetchIntervalInBackground:!1,staleTime:Re.GIT_STATUS_STALE_TIME_MS})}function Xn(e){return!!e&&!("error"in e)}function Vn(e){return e===void 0?qn:"error"in e?Qn:{state:"repo",branch:e.branch,dirty:!e.clean}}function te(e){const t=e.trim(),n=Array.from(t);return n.length<=oe?t:`${n.slice(0,oe-1).join("").trimEnd()}…`}function Yn(e){return e.replace(/\s*\([^()]*\)\s*$/,"").split("·")[0].trim()}function Jn(e,t){return te(Zn(e,t))}function Zn(e,t){const n=t.find(i=>i.value===e);if(n)return Yn(n.displayName);const r=/claude-(\w+)-/.exec(e);return r?`${r[1].charAt(0).toUpperCase()}${r[1].slice(1)}`:e==="default"?"Default":Ls(e)??e}function Ti({data:e,workspace:t,compact:n}){if(!e)return null;if(!Xn(e))return s.jsxs("span",{className:"text-muted-foreground/50 inline-flex min-w-0 items-center gap-1",title:"Not a git repository",children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:"No repo"})]});const r=e.modified+e.staged+e.untracked,i=r===1?"1 change":`${r} changes`,o=[];if(e.modified>0&&o.push(`${e.modified} modified`),e.staged>0&&o.push(`${e.staged} staged`),e.untracked>0&&o.push(`${e.untracked} untracked`),e.conflicted>0&&o.push(`${e.conflicted} conflicted`),t){const u=zs(t.portBase),f=[`${t.key} · ${t.projectKey}`,`${t.branch??e.branch} · ${t.provider}`,e.ahead>0?`↑${e.ahead}`:"",e.behind>0?`↓${e.behind}`:"",o.length>0?o.join(", "):"clean",`ports ${u.DORKOS_PORT} / ${u.VITE_PORT} / ${u.SITE_PORT}`,t.pinned?"pinned":""].filter(Boolean);return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:f.join(" · "),children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"max-w-[20ch] truncate font-medium",children:n?te(t.key):t.key}),!n&&s.jsxs("span",{className:"text-muted-foreground truncate",children:["· ",t.projectKey]}),t.pinned&&s.jsx(ss,{className:"text-muted-foreground size-(--size-icon-xs) shrink-0"}),r>0&&(n?s.jsx(Le,{label:i}):s.jsxs("span",{className:"text-muted-foreground shrink-0",children:["· ",i]}))]})}const a=o.length>0?`${e.branch} · ${o.join(", ")}`:`${e.branch} · clean`;return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:a,children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"max-w-[25ch] truncate",children:n?te(e.branch):e.branch}),e.ahead>0&&s.jsxs("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-0.5",children:[s.jsx(Bs,{className:"size-(--size-icon-xs)"}),e.ahead]}),e.behind>0&&s.jsxs("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-0.5",children:[s.jsx($s,{className:"size-(--size-icon-xs)"}),e.behind]}),r>0&&(n?s.jsx(Le,{label:i}):s.jsxs("span",{className:"text-muted-foreground shrink-0",children:["· ",i]}))]})}function Le({label:e}){return s.jsx("span",{role:"img","aria-label":e,title:e,className:"bg-muted-foreground/70 size-1 shrink-0 rounded-full"})}function er({stop:e,onMakeDefault:t,onDismiss:n,pending:r,error:i,placement:o="inline"}){const a=o==="overlay";return a&&!e?null:s.jsx("div",{className:k("flex items-center px-1",a?"bg-background/95 pointer-events-auto absolute right-0 bottom-full left-0 z-20 mb-1 rounded-md py-0.5 backdrop-blur-sm":"min-h-5"),"data-testid":a?"make-default-slot-overlay":"make-default-slot",children:e&&s.jsxs("p",{role:"status","data-testid":"make-default-offer",className:k("animate-in fade-in-0 flex min-w-0 items-center gap-1.5 text-xs duration-200 motion-reduce:animate-none",i?"text-destructive":"text-muted-foreground"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i?s.jsxs(s.Fragment,{children:[s.jsx(Ne,{className:"mr-1 inline size-3 shrink-0 align-[-2px]","aria-hidden":!0}),i]}):s.jsxs(s.Fragment,{children:["Start every new chat in ",Fs(e),"?"]})})," ",s.jsxs("span",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[i?s.jsx("button",{type:"button",disabled:r,onClick:t,"data-testid":"make-default-retry",className:"focus-ring text-foreground rounded-sm underline underline-offset-2 disabled:opacity-50",children:"Try again"}):s.jsx("button",{type:"button",disabled:r,onClick:t,"data-testid":"make-default-confirm",className:"focus-ring text-foreground rounded-sm underline underline-offset-2 disabled:opacity-50",children:"Make default"}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("button",{type:"button",onClick:n,"data-testid":"make-default-dismiss",className:"focus-ring hover:text-foreground rounded-sm underline underline-offset-2",children:"Dismiss"})]})]})})}const sr="Auto mode needs Opus 4.6+ or Sonnet 4.6";function ki({mode:e,onChangeMode:t,disabled:n,pending:r,runtime:i,modelSupportsAutoMode:o,planActive:a,compact:u,makeDefault:f,onOpenChange:m}){var C;const p=fe(i),c=Z(b=>b.setControlCenterOpen),d=H(b=>b.open),y=H(b=>b.setOpen),v=H(b=>b.setAvailable),l=!(p&&!p.permissionModes.supported)&&n!==!0&&r!==!0;h.useEffect(()=>(v(l),()=>v(!1)),[l,v]);const x=h.useRef(m);if(h.useEffect(()=>{x.current=m},[m]),h.useEffect(()=>()=>{var b;y(!1),(b=x.current)==null||b.call(x,!1)},[y]),p&&!p.permissionModes.supported)return null;const N=(p==null?void 0:p.permissionModes.values)??[],w=!o&&N.some(b=>b.id==="auto"),g=w?N.filter(b=>b.id!=="auto"):N,T=g.find(b=>b.id===e),A=(T==null?void 0:T.label)??Gs(e),_=u?te(A):A,E=Hs(T),O=(C=Ws(g).find(b=>b.mode.id===e))==null?void 0:C.stop,P=w&&(O==="act"||e==="auto"),M=s.jsxs("button",{disabled:n,"data-testid":"permission-mode-trigger","aria-label":`Permissions: ${A}`,className:k(W,"items-center gap-1 disabled:cursor-not-allowed disabled:opacity-40",E),children:[s.jsx(qs,{descriptor:T,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:_})]});return n?s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:s.jsx("span",{className:"inline-flex",children:M})}),s.jsx(U,{side:"top",children:"Send a message first"})]}):r?s.jsxs("span",{"data-testid":"permission-mode-pending","aria-busy":"true","aria-label":"Permissions: still loading",className:k(W,"items-center gap-1 opacity-40"),children:[s.jsx("span",{className:"bg-muted-foreground/30 size-(--size-icon-xs) shrink-0 animate-pulse rounded-full"}),s.jsx("span",{className:"bg-muted-foreground/30 h-2 w-10 animate-pulse rounded"})]}):s.jsxs(je,{open:d,onOpenChange:b=>{y(b),m==null||m(b)},children:[s.jsx(ye,{asChild:!0,children:M}),s.jsxs(be,{side:"top",align:"start",className:"w-80 p-3","aria-label":"Permissions",children:[s.jsx(ve,{children:"Permissions"}),s.jsx(Qs,{mode:e,descriptors:g,onChangeMode:t,planActive:a,onUnlock:()=>c(!0)}),f&&s.jsx(er,{...f}),P&&s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("p",{"data-testid":"auto-unsupported-hint",className:"text-muted-foreground text-3xs mt-2 flex items-center gap-1.5 px-1",children:[s.jsx(ts,{className:"size-(--size-icon-xs) shrink-0"}),"Auto unavailable on this model"]})}),s.jsx(U,{side:"top",children:sr})]}),s.jsx(Ks,{mode:e,descriptor:T,className:"mt-2 px-1"})]})]})}const tr=6e3;function nr(e){return e instanceof Error&&e.message||"Couldn’t save that. Try again."}function Ci(e){var b,Q,G;const{sessionId:t,runtime:n,declaredModes:r,runtimeDefaultMode:i}=e,{data:o}=ne(),{data:a}=pe(),u=mn(),f=me(),m=Xs(t),p=$(R=>R.dismissDefaultStopOffer),[c,d]=h.useState(null),[y,v]=h.useState(null),[l,x]=h.useState(t);l!==t&&(x(t),d(null),v(null));const N=o==null?void 0:o.executionDefaults,w=n??(N==null?void 0:N.runtime),g=(b=N==null?void 0:N.perRuntime.find(R=>R.runtime===w))==null?void 0:b.trustStop,T=g??(N==null?void 0:N.trustStop)??null,A=(Q=r.find(R=>R.id===i))==null?void 0:Q.stop,_=T??A,E=g!=null?(G=pn(a,w))==null?void 0:G.configSection:void 0,O=o!==void 0;h.useEffect(()=>{if(!c)return;const R=setTimeout(()=>d(null),tr);return()=>clearTimeout(R)},[c]);const P=h.useCallback(R=>{const L=r.find(re=>re.id===R);!L||Vs(L)||!O||m||L.stop!==_&&(v(null),d(L.stop))},[r,O,m,_,d,v]),M=h.useCallback(()=>{if(!c)return;const R=c;v(null),u.mutate({runtimes:E?{[E]:{defaultTrustStop:R}}:{defaultTrustStop:R}},{onSuccess:()=>{f.invalidateQueries({queryKey:B.all}),d(null)},onError:L=>v(nr(L))})},[c,u,f,E,d,v]),C=h.useCallback(()=>{p(t),d(null)},[p,t,d]);return{line:O?{stop:c,onMakeDefault:M,onDismiss:C,pending:u.isPending,error:y}:null,offerFor:P}}function wi({runtimeLabel:e,onShown:t,onDismiss:n}){const r=H(o=>o.available),i=H(o=>o.setOpen);return h.useEffect(()=>{t==null||t()},[t]),s.jsxs(fn,{"data-slot":"read-only-mode-notice","data-testid":"read-only-mode-notice",gap:"none",className:"flex-row flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2",children:[s.jsx(Ys,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),s.jsxs("p",{className:"text-muted-foreground min-w-0 flex-1 text-xs",children:["In this mode, ",e," reads files but won’t change them. Asking won’t help."]}),s.jsxs("div",{className:"flex w-full shrink-0 flex-wrap items-center justify-end gap-1.5 sm:w-auto",children:[s.jsx(F,{variant:"ghost",size:"sm",responsive:!1,className:"h-7 px-2 text-xs",onClick:n,children:"Dismiss"}),r&&s.jsx(F,{variant:"outline",size:"sm",responsive:!1,className:"h-7 px-2 text-xs",onClick:()=>i(!0),children:"Change permissions"})]})]})}function Ei(e,t,n){const r=fe(t??void 0),i=$(c=>c.recordReadOnlyHintShown),o=$(c=>c.spendReadOnlyHint),a=Js(e??""),u=r==null?void 0:r.permissionModes.values.find(c=>c.id===n),f=u!==void 0&&Zs(u);h.useEffect(()=>{f||!e||a!=="shown"||o(e)},[f,e,a,o]);const m=h.useCallback(()=>{e&&i(e)},[e,i]),p=h.useCallback(()=>{e&&o(e)},[e,o]);return h.useMemo(()=>({eligible:!!e&&f&&a!=="spent",runtimeLabel:t?et(t):"This agent",markShown:m,dismiss:p}),[e,f,a,t,m,p])}function Mi({descriptor:e,active:t,onToggle:n,disabled:r}){return s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("button",{type:"button","aria-pressed":t,disabled:r,onClick:()=>n(!t),className:k(W,"items-center gap-1","disabled:cursor-not-allowed disabled:opacity-40",t&&"text-foreground"),children:[s.jsx(ns,{className:"size-(--size-icon-xs) shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:e.label})]})}),s.jsx(U,{side:"top",children:r?"Send a message first":e.promise})]})}function Ri({runtime:e,model:t,onChangeRuntime:n,canSelect:r,compact:i,account:o}){const{data:a}=pe(),{data:u}=st(),{nameFor:f}=tt(),[m,p]=h.useState({open:!1}),c=Object.keys((a==null?void 0:a.capabilities)??{}),d=c.filter(g=>_e(u,g)),y=c.filter(g=>!_e(u,g)),v=a!==void 0&&Object.values(nt).some(g=>g.setup&&!c.includes(g.type)),l=!!n&&(c.length>1||y.length>0||v),x=i?null:t,N=s.jsx(Ae,{runtime:e,model:x,iconClassName:"size-(--size-icon-xs)"}),w=o?`Account: ${f(o)}`:null;return r?l?s.jsxs(s.Fragment,{children:[s.jsxs(rt,{children:[s.jsx(it,{asChild:!0,children:s.jsx("button",{className:W,children:s.jsx(Ae,{runtime:e,model:x,iconClassName:"size-(--size-icon-xs)"})})}),s.jsxs(at,{side:"top",align:"start",className:"w-56",children:[s.jsx(ot,{children:"Runs on"}),s.jsx(lt,{value:e,onValueChange:g=>n==null?void 0:n(g),children:d.map(g=>{const T=Pe(g);return s.jsx(ct,{value:g,icon:T.icon,children:T.label},g)})}),y.map(g=>{const T=Pe(g);return s.jsx(Oe,{icon:T.icon,description:"Connect",onSelect:()=>p({open:!0,runtime:g}),children:T.label},g)}),v&&s.jsxs(s.Fragment,{children:[s.jsx(ut,{}),s.jsx(Oe,{icon:dt,onSelect:()=>p({open:!0}),children:"Add a runtime"})]})]})]}),s.jsx(hn,{runtime:m.runtime,open:m.open,onOpenChange:g=>p(T=>({...T,open:g})),renderConnect:jn,showConnectSuccess:!0,onRuntimeReady:g=>{n==null||n(g)}})]}):w?s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:N}),s.jsx(U,{side:"top",children:w})]}):N:s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:N}),s.jsxs(U,{side:"top",children:[s.jsx("span",{className:"block",children:"Set when the chat starts. It can’t change after."}),w&&s.jsx("span",{className:"block",children:w})]})]})}function _i(e,t,n){const r=rs(),i=mt(e),o=new Date(r),a=t.pending?null:t.usage;return{...pt({liveTurnUsage:n,liveTurnAt:i,accountStatus:ft(a,o),accountObservedAt:is(as(a))}),accountUsage:a}}function Ai({open:e,onOpenChange:t,onConfirm:n}){return s.jsx(ht,{open:e,onOpenChange:t,children:s.jsxs(xt,{children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(ts,{className:"text-muted-foreground size-4"}),"Turn on Auto mode?",s.jsx(ee,{size:"xs",variant:"secondary",className:"tracking-wide uppercase",children:"Preview"})]}),s.jsx(jt,{children:"Asks only before risky steps, like deleting files. Switch back anytime."})]}),s.jsxs(yt,{children:[s.jsx(bt,{children:"Cancel"}),s.jsx(vt,{onClick:n,children:"Turn on Auto mode"})]})]})})}const ze=[{slug:"frontier",label:"Frontier"},{slug:"solid-coders",label:"Solid coders"},{slug:"quick-helpers",label:"Quick helpers"},{slug:"more-models",label:"More models"},{slug:"no-tools",label:"Can’t do agent work"}],rr=10,ir="Can’t use tools, so it can’t read files or run commands.",ar="Makes images DorkOS can’t show yet.",or=["openrouter/openrouter/auto","openrouter/auto"];function lr(e){return or.some(t=>e.value===t||e.value.startsWith(`${t}-`))}function js(e){return e.supportsToolUse!==!1}function cr(e){return e.supportsImageOutput===!0&&!lr(e)?ar:js(e)?null:ir}function ur(e){if(!js(e))return"no-tools";switch(e.tier){case"frontier":return"frontier";case"solid-coder":return"solid-coders";case"quick-helper":return"quick-helpers";default:return"more-models"}}function dr(e){return e.some(t=>t.tier!=null)||e.length>rr}function mr(e,t){const n=t.trim().toLowerCase();return n?e.value.toLowerCase().includes(n)||e.displayName.toLowerCase().includes(n):!0}function pr(e){const t=new Map(ze.map(n=>[n.slug,[]]));for(const n of e)t.get(ur(n)).push(n);return ze.map(n=>({...n,models:t.get(n.slug)})).filter(n=>n.models.length>0)}function fr(e){return e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function hr(){return s.jsx("div",{className:"space-y-2","data-testid":"model-cards-skeleton",children:Array.from({length:3}).map((e,t)=>s.jsxs("div",{className:"flex items-center gap-3 rounded-xl p-3",children:[s.jsx(K,{className:"size-4 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(K,{className:"h-3.5 w-24"}),s.jsx(K,{className:"h-2.5 w-32"})]}),s.jsx(K,{className:"h-5 w-10 rounded-md"})]},t))})}function xr({onRetry:e,message:t}){return s.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-center","data-testid":"model-load-error",children:[s.jsx(Ne,{className:"text-muted-foreground size-5"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:t??"Couldn’t load the model list."}),s.jsxs("button",{onClick:e,className:"text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",children:[s.jsx(os,{className:"size-3"}),"Retry"]})]})}function gr(e){const t=e.slice(e.lastIndexOf(" ")+1);return t.includes("/")||t.includes(":")}function ys({text:e,className:t}){return gr(e)?s.jsx("div",{dir:"rtl",className:k("truncate text-left",t),title:e,children:s.jsx("bdi",{dir:"ltr",children:e})}):s.jsx("div",{className:k("truncate",t),title:e,children:e})}function Be({model:e,isSelected:t}){const n=cr(e);return s.jsxs("label",{className:k("flex w-full cursor-pointer items-center gap-3 rounded-xl border p-3 transition-colors duration-150",t?"bg-secondary border-foreground/15":"border-border hover:border-muted-foreground/30 hover:bg-muted/50 opacity-70"),children:[s.jsx(kt,{value:e.value,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"text-foreground line-clamp-2 text-sm font-medium break-words",children:[e.displayName,e.local&&s.jsxs("span",{className:"text-muted-foreground text-3xs ml-1.5 font-normal",children:[Ct()," · private"]})]}),s.jsx(ys,{text:e.description,className:"text-muted-foreground text-2xs leading-tight"}),n&&s.jsx("div",{className:"text-2xs text-status-warning-fg mt-0.5 leading-tight","data-testid":`model-limitation-${e.value}`,children:n})]}),e.contextWindow&&s.jsx(ee,{size:"xs",variant:"secondary",className:"shrink-0",children:fr(e.contextWindow)})]})}function Nr({value:e}){return s.jsxs("div",{className:"space-y-1.5","data-testid":"model-unavailable-saved",children:[s.jsxs("div",{className:"border-border flex w-full items-center gap-3 rounded-xl border border-dashed p-3 opacity-80",children:[s.jsx(Ne,{className:"text-status-warning-fg size-4 shrink-0"}),s.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[s.jsx(ys,{text:e,className:"text-foreground min-w-0 text-sm font-medium"}),s.jsx("span",{className:"text-muted-foreground text-2xs shrink-0 font-normal",children:"(not available)"})]})]}),s.jsx("p",{className:"text-muted-foreground text-2xs leading-snug",children:"This model isn’t available anymore. Pick another."})]})}function jr({slug:e,label:t}){return s.jsx("div",{className:"text-muted-foreground text-2xs mt-2 mb-1 font-medium tracking-wide uppercase first:mt-0","data-testid":`model-group-${e}`,children:t})}function yr({models:e,selectedModel:t,onChangeModel:n,emptyMessage:r}){const[i,o]=h.useState(""),a=dr(e),f=e.length>0&&t.length>0&&!e.some(d=>d.value===t)?s.jsx(Nr,{value:t}):null,m=e.some(d=>d.unverified),p=h.useMemo(()=>a?e.filter(d=>mr(d,i)):e,[e,i,a]),c=h.useMemo(()=>a?pr(p):[],[p,a]);return e.length===0?s.jsx("div",{className:"border-border text-muted-foreground text-2xs rounded-xl border border-dashed p-3 leading-snug","data-testid":"model-catalog-unavailable",children:r??"Couldn’t load models. Check Settings, then try again."}):a?s.jsxs("div",{className:"space-y-2",children:[f,m&&s.jsx(Ie,{}),s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),s.jsx(Tt,{type:"text",value:i,onChange:d=>o(d.target.value),placeholder:"Search models…","aria-label":"Search models","data-testid":"model-search",className:"h-8 pl-8 text-xs"})]}),c.length===0?s.jsx("p",{className:"text-muted-foreground py-4 text-center text-xs","data-testid":"model-search-empty",children:m?"No match in this short list. Connect a provider to see more.":"No models match"}):s.jsx(De,{value:t,onValueChange:n,className:"grid-cols-1 gap-1.5","aria-label":"Model selection","data-testid":"model-card-list",children:c.map(d=>s.jsxs(h.Fragment,{children:[s.jsx(jr,{slug:d.slug,label:d.label}),d.models.map(y=>s.jsx(Be,{model:y,isSelected:y.value===t},y.value))]},d.slug))})]}):s.jsxs("div",{className:"space-y-2",children:[f,m&&s.jsx(Ie,{}),s.jsx(De,{value:t,onValueChange:n,className:"grid-cols-1 gap-1.5","aria-label":"Model selection","data-testid":"model-card-list",children:e.map(d=>s.jsx(Be,{model:d,isSelected:d.value===t},d.value))})]})}const ce={none:{label:"None",description:"No reasoning"},minimal:{label:"Minimal",description:"Near-zero thinking"},low:{label:"Low",description:"Fastest responses"},medium:{label:"Medium",description:"Moderate thinking"},high:{label:"High",description:"Deep reasoning"},max:{label:"Max",description:"Maximum thinking"},xhigh:{label:"XHigh",description:"Beyond maximum"}},br={duration:.15,ease:"easeOut"};function vr({effortLevels:e,effort:t,onChangeEffort:n}){return s.jsxs("div",{children:[s.jsx("div",{className:"text-muted-foreground text-2xs mb-2 font-medium tracking-wide uppercase",children:"Effort"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":"Effort level",children:[s.jsx(ue,{role:"radio",label:"Default",isSelected:t===null,onClick:()=>n(null)}),e.map(r=>s.jsx(ue,{role:"radio",label:ce[r].label,description:ce[r].description,isSelected:t===r,onClick:()=>n(r)},r))]})]})}function Sr({supportsFastMode:e,fastMode:t,onChangeFastMode:n}){return e?s.jsxs("div",{children:[s.jsx("div",{className:"text-muted-foreground text-2xs mb-2 font-medium tracking-wide uppercase",children:"Mode"}),s.jsx("div",{className:"flex gap-1.5",children:s.jsx(ue,{role:"switch",label:"Fast",icon:s.jsx(Se,{className:"size-3"}),isSelected:t,onClick:()=>n(!t)})})]}):null}function ue({role:e,label:t,description:n,icon:r,isSelected:i,onClick:o}){const a=s.jsxs("button",{role:e,"aria-checked":i,onClick:o,className:k("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors duration-150",i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),children:[r,t]});return n?s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:a}),s.jsx(U,{side:"top",className:"text-xs",children:n})]}):a}function Oi({model:e,onChangeModel:t,effort:n,onChangeEffort:r,fastMode:i,onChangeFastMode:o,disabled:a,sessionId:u,runtime:f,onCredits:m,compact:p}){var _;const{data:c,isLoading:d,isError:y,refetch:v}=es({sessionId:u,runtime:f??void 0}),l=c??[],x=l.find(E=>E.value===e),N=!!(x!=null&&x.supportsEffort&&(((_=x.supportedEffortLevels)==null?void 0:_.length)??0)>0),w=(x==null?void 0:x.supportsFastMode)??!1,g=!p&&N&&n?ce[n].label:null,T=!p&&i,A=s.jsxs("button",{disabled:a,className:k(W,"items-center gap-1 disabled:cursor-not-allowed disabled:opacity-40"),"data-testid":"model-config-trigger",children:[s.jsx(ls,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:Jn(e,l)}),g&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground text-2xs",children:"·"}),s.jsx(ee,{size:"xs",variant:"secondary",children:g})]}),T&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground text-2xs",children:"·"}),s.jsxs(ee,{size:"xs",variant:"secondary",children:[s.jsx(Se,{className:"mr-0.5 inline size-2.5"}),"Fast"]})]})]});return a?s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:s.jsx("span",{className:"inline-flex",children:A})}),s.jsx(U,{side:"top",children:"Send a message first"})]}):s.jsxs(je,{children:[s.jsx(ye,{asChild:!0,children:A}),s.jsxs(be,{side:"top",align:"start",className:"w-120 max-w-[calc(100vw-1.5rem)] p-3","data-testid":"model-config-popover",children:[s.jsx(ve,{children:"Model"}),l.some(E=>E.paidFromCredits)&&s.jsx("p",{className:"text-muted-foreground text-2xs mb-2","data-testid":"model-credits-note",children:l.some(E=>E.creditsListOutOfDate)?"Models your DorkOS credits cover. This list may be out of date.":"Models your DorkOS credits cover"}),d&&s.jsx(hr,{}),y&&s.jsx(xr,{onRetry:()=>v(),message:m?"Couldn’t load the models DorkOS credits cover. Your model stays as it is.":void 0}),!d&&!y&&s.jsx(yr,{models:l,selectedModel:e,onChangeModel:t,emptyMessage:m?"DorkOS credits don’t cover a model for this runtime yet.":void 0}),s.jsx(xe,{children:!d&&!y&&(N||w)&&s.jsxs(ge.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:br,children:[s.jsx(wt,{className:"my-3"}),s.jsx("div",{className:"text-muted-foreground text-2xs mb-3 font-medium tracking-wide uppercase",children:"Configuration"}),s.jsxs("div",{className:"space-y-3",children:[N&&s.jsx(vr,{effortLevels:x.supportedEffortLevels,effort:n,onChangeEffort:r}),w&&s.jsx(Sr,{supportsFastMode:(x==null?void 0:x.supportsFastMode)??!1,fastMode:i,onChangeFastMode:o})]})]},"config")})]})]})}function Pi({percent:e,contextUsage:t,compact:n,reading:r,now:i}){const o=gs(e,t)??e,a=An(o),u=a==="critical"?se.error:a==="warning"?se.warning:"",f=n!=null&&o>=hs,m=t?{total:t.totalTokens,max:t.maxTokens}:r&&r.maxTokens>0?{total:r.totalTokens,max:r.maxTokens}:null,p=(r==null?void 0:r.observedAt)??null,c=m!==null,d=s.jsxs("span",{"aria-label":c?"Context window usage":void 0,className:k("inline-flex shrink-0 items-center gap-1",c&&"cursor-default",u),children:[s.jsx(yn,{className:"size-(--size-icon-xs) shrink-0"}),s.jsxs("span",{children:[o,"%"]})]});return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[m?s.jsx(Tr,{totals:m,categories:(t==null?void 0:t.categories)??[],observedAt:p,now:i,children:d}):d,s.jsx(xe,{initial:!1,children:f&&s.jsxs(ge.button,{type:"button",onClick:n.onCompact,disabled:n.pending,"aria-label":n.pending?"Compacting chat…":`Context ${o}% full. Compact now`,"aria-busy":n.pending,"data-testid":"compaction-chip",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:"bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted inline-flex min-w-0 shrink items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(os,{"aria-hidden":"true",className:k("size-(--size-icon-xs) shrink-0",n.pending&&"animate-spin")}),s.jsx("span",{className:"truncate",children:"Compact"})]},"compact")})]})}function Tr({totals:e,categories:t,observedAt:n,now:r,children:i}){const o=t.filter(a=>a.tokens>0).sort((a,u)=>u.tokens-a.tokens);return s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:i}),s.jsx(U,{side:"top",className:"max-w-64",children:s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"text-xs font-medium",children:[ae(e.total)," / ",ae(e.max)," tokens"]}),o.length>0&&s.jsx("div",{className:"space-y-0.5",children:o.map(a=>s.jsxs("div",{className:"text-3xs flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1 truncate",children:[s.jsx("span",{className:"inline-block size-1.5 shrink-0 rounded-full",style:{backgroundColor:a.color}}),a.name]}),s.jsx("span",{className:k(le,"shrink-0"),children:ae(a.tokens)})]},a.name))}),n!==null&&s.jsx(cs,{observedAt:n,now:r,surface:"tooltip"})]})})]})}function Di({usage:e,accountUsage:t=null,observedAt:n=null,open:r,onOpenChange:i,now:o}){const a=rs(),u=o??new Date(a),f=as(t),m=f.length>0?is(f):n,p=e!=null&&us(e);let c;return f.length>0?c=s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs font-medium",children:"Subscription usage"}),s.jsx("div",{className:"flex flex-col gap-2.5",children:f.map(d=>s.jsx(Et,{window:d,label:Mt(d.key,d.label),now:u},d.key))}),e&&s.jsx("div",{className:"text-3xs space-y-0.5",children:s.jsx(Rt,{usage:e})})]}):p?c=s.jsx(Pt,{usage:e}):c=s.jsx("p",{className:"text-muted-foreground text-xs",children:"No usage yet."}),s.jsxs(_t,{open:r,onOpenChange:i,children:[s.jsx(At,{asChild:!0,children:s.jsx("span",{"aria-hidden":!0,className:"inline-block h-0 w-0"})}),s.jsx(Ot,{side:"top",align:"end",className:"w-72 max-w-[calc(100vw-1.5rem)]","aria-label":"Usage and cost",children:s.jsxs("div",{className:"space-y-2",children:[c,m!==null&&(f.length>0||p)&&s.jsx(cs,{observedAt:m,now:u})]})})]})}const kr={connecting:{color:X.warning,label:"Connecting",shortLabel:"Connecting",icon:Y,tasks:!0},connected:{color:X.success,label:"Connected",shortLabel:"Connected",icon:Y,tasks:!1},reconnecting:{color:X.warning,label:"Reconnecting",shortLabel:"Reconnecting",icon:Y,tasks:!0},disconnected:{color:X.error,label:"Live updates lost",shortLabel:"Offline",icon:Dt,tasks:!1}};function Ii({connectionState:e,compact:t}){const n=kr[e],r=n.icon;return s.jsxs(xn,{openDelay:200,children:[s.jsx(gn,{asChild:!0,children:s.jsxs("span",{className:"flex min-w-0 cursor-default items-center gap-1.5 text-xs",children:[s.jsx("span",{className:k("size-1.5 shrink-0 rounded-full",n.color,n.tasks&&"animate-breath")}),s.jsx("span",{className:"text-muted-foreground truncate",children:t?n.shortLabel:n.label})]})}),s.jsx(Nn,{side:"top",align:"center",className:"w-72 p-3",children:s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx(r,{className:k("mt-0.5 size-4 shrink-0",e==="disconnected"?se.error:se.warning)}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx("p",{className:"text-sm font-medium",children:n.label}),s.jsx(Cr,{connectionState:e})]})]})})]})}function Cr({connectionState:e}){const t="text-muted-foreground text-xs leading-relaxed";return e==="connecting"?s.jsx("p",{className:t,children:"Connecting to live updates. New messages appear once connected."}):e==="reconnecting"?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:t,children:"Live updates dropped and are reconnecting. Nothing is lost."}),s.jsx("p",{className:k(t,"text-muted-foreground/70"),children:"No action needed."})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:t,children:"Couldn’t reconnect live updates. New messages won’t appear until they’re back."}),s.jsx("p",{className:k(t,"text-muted-foreground/70"),children:"Refresh the page. If that doesn’t help, check that DorkOS is running."})]})}function Ui({count:e,running:t,waiting:n}){const r=e===1?"":"s",i=e-t.length,o=`${e} subagent${r} running`;return s.jsxs(D,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1","aria-label":o,children:[s.jsx(ds,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"shrink-0 tabular-nums",children:e})]})}),s.jsxs(U,{side:"top",className:"max-w-64",children:[n&&s.jsx("p",{className:"mb-1 font-medium",children:"Still working. The agent continues when they finish."}),s.jsx("ul",{className:"space-y-1",children:t.map(a=>s.jsxs("li",{children:[s.jsx("span",{className:"font-medium",children:a.description??"Working…"}),s.jsxs("p",{className:k(le,"text-3xs leading-tight"),children:[a.toolUses??0," tool",a.toolUses===1?"":"s",a.lastToolName?` · last ${a.lastToolName}`:""]})]},a.taskId))}),i>0&&s.jsx("p",{className:k(le,"text-3xs leading-tight"),children:t.length>0?`and ${i} more`:`${i} task${r} from earlier`})]})]})}const wr=new Set(["main","master"]);function Li(e,t,n){return{dirty:!t,onDefaultBranch:!n&&wr.has(e)}}const S={AGENT_ANCHOR:1e3,CONNECTION_LOST:100,CONTEXT_CRITICAL:90,ACCOUNT_ATTENTION:85,USAGE_EXHAUSTED:80,PERMISSION_BYPASS:70,CONTEXT_WARNING:50,USAGE_WARNING:50,PERMISSION_ELEVATED:40,PLAN_ACTIVE:40,SUBAGENTS_RUNNING:35,EXTENSION_ITEM:35,RUNTIME_NON_DEFAULT:30,GIT_DIRTY:20,MODEL:10,CWD:5,QUIET:0},Er={session:"Session",diagnostics:"Diagnostics"};function $e(e){return e.runtime&&!e.runtime.isDefault?S.RUNTIME_NON_DEFAULT:S.QUIET}function Mr(e){return e.account!==null}const Rr=new Set(["near","model-out","out"]);function Fe(e){return e.permissionDescriptor?e.permissionDescriptor.stop!=="ask":e.permissionMode!=="default"}const bs=[{key:"agent",label:"Agent",description:"Who you are talking to",cluster:"left",group:null,icon:Ut,promote:()=>!0,severity:()=>S.AGENT_ANCHOR},{key:"cwd",label:"Directory",description:"The folder this chat can touch",cluster:"left",group:"session",icon:Lt,promote:e=>e.cwd!==null,severity:()=>S.CWD},{key:"git",label:"Git",description:"Branch and uncommitted changes",cluster:"left",group:"session",icon:V,promote:e=>e.git!==null&&(e.git.dirty||!e.git.onDefaultBranch),severity:e=>{var t;return(t=e.git)!=null&&t.dirty?S.GIT_DIRTY:S.QUIET}},{key:"runtime",label:"Runs on",description:"What runs this chat",cluster:"right",group:"session",icon:bn,promote:e=>e.runtime!==null&&e.runtime.type!=="doe"&&(!e.runtime.isDefault||e.runtime.canSelect),severity:$e},{key:"account",label:"Account",description:"Which Claude account this uses, and what’s left",cluster:"right",group:null,icon:vn,promote:e=>e.account!==null,severity:e=>e.account&&Rr.has(e.account.chipState)?S.ACCOUNT_ATTENTION:$e(e)},{key:"extensions",label:"Add-ons",description:"What your extensions show here",cluster:"right",group:null,icon:zt,promote:e=>e.extensionItems.some(t=>t.visible),severity:e=>e.extensionItems.some(t=>t.visible&&t.urgent)?S.ACCOUNT_ATTENTION:S.EXTENSION_ITEM},{key:"model",label:"Model",description:"The model answering you",cluster:"right",group:"session",icon:ls,promote:()=>!1,severity:()=>S.MODEL},{key:"cache",label:"Cache",description:"How much came from cache",cluster:"right",group:"session",icon:Se,promote:()=>!1,severity:()=>S.QUIET,neverInLine:!0},{key:"context",label:"Context",description:"How full the context window is",cluster:"right",group:"session",icon:Sn,rigid:!0,promote:e=>e.contextPercent!==null,severity:e=>e.contextPercent===null?S.QUIET:e.contextPercent>=hs?S.CONTEXT_CRITICAL:e.contextPercent>=_n?S.CONTEXT_WARNING:S.QUIET},{key:"usage",label:"Usage & cost",description:"Plan limits or chat cost",cluster:"right",group:"session",icon:Bt,rigid:!0,promote:e=>e.usage!==null&&us(e.usage)&&!Mr(e),wide:e=>e.usageStale,severity:e=>{var t,n;return((t=e.usage)==null?void 0:t.state)==="exhausted"?S.USAGE_EXHAUSTED:((n=e.usage)==null?void 0:n.state)==="warning"?S.USAGE_WARNING:S.QUIET}},{key:"permission",label:"Permissions",description:"How freely the agent acts",cluster:"right",group:"session",icon:$t,promote:e=>Fe(e)||e.permissionPickerOpen===!0,severity:e=>(e.permissionDescriptor?Ft(e.permissionDescriptor):Gt(e.permissionMode))?S.PERMISSION_BYPASS:Fe(e)||e.permissionPickerOpen===!0?S.PERMISSION_ELEVATED:S.QUIET},{key:"plan",label:"Plan",description:"Plan first, change nothing until approved",cluster:"right",group:"session",icon:ns,promote:e=>e.plan!==null,severity:e=>{var t;return(t=e.plan)!=null&&t.active?S.PLAN_ACTIVE:S.QUIET}},{key:"subagents",label:"Subagents",description:"Subagents working on this turn",cluster:"right",group:"diagnostics",icon:ds,rigid:!0,promote:e=>e.subagentsInFlight>0,severity:e=>e.subagentsInFlight>0?S.SUBAGENTS_RUNNING:S.QUIET},{key:"connection",label:"Live updates",description:"The live link that delivers messages",cluster:"right",group:"diagnostics",icon:Y,promote:e=>e.connectionState!=="connected",severity:e=>e.connectionState==="connected"?S.QUIET:S.CONNECTION_LOST}];function vs(e){return e.group==="session"&&e.neverInLine!==!0}function _r(){const{pins:e}=wn(),{setPins:t}=En(),n=h.useCallback(i=>{const o=It.find(a=>a===i);o&&t(e.includes(o)?e.filter(a=>a!==o):[...e,o])},[e,t]),r=h.useCallback(()=>t([]),[t]);return{pins:e,toggle:n,reset:r}}function Ar(){return["session","diagnostics"].map(t=>({group:t,label:Er[t],items:bs.filter(n=>n.group===t)})).filter(t=>t.items.length>0)}function Ss(e){const t=e.contextTokens??e.readTokens+e.creationTokens;return t<=0?0:Math.round(e.readTokens/t*100)}function Or(e){return e?e.kind==="subscription"&&e.utilization!=null?`${Math.round(e.utilization*100)}% of ${e.windowLabel??"your plan"}`:e.costUsd!=null?`$${e.costUsd.toFixed(2)}`:null:null}function Pr(e){return e.split("/").filter(Boolean).pop()??e}function Dr(e,t){switch(e){case"cwd":return t.cwd?Pr(t.cwd):null;case"git":return t.git.state==="unknown"?null:t.git.state==="no-repo"?"No repo":t.git.dirty?`${t.git.branch} · changed`:t.git.branch;case"runtime":return t.runtime;case"model":return t.model;case"context":return t.contextPercent===null?null:`${t.contextPercent}% full`;case"cache":return t.cache===null?null:`${Ss(t.cache)}% from cache`;case"usage":return Or(t.usage);case"permission":return t.permissionMode;case"connection":return`${t.connectionState} · event ${t.lastEventSeq}`;default:return null}}function Ir(e){return JSON.stringify({sessionId:e.sessionId,cwd:e.cwd,git:e.git,runtime:e.runtime,model:e.model,selectedModel:e.selectedModel,effort:e.effort,fastMode:e.fastMode,permissionMode:e.permissionMode,contextPercent:e.contextPercent,contextUsage:e.contextUsage,cache:e.cache===null?null:{readTokens:e.cache.readTokens,creationTokens:e.cache.creationTokens,contextTokens:e.cache.contextTokens??null,hitPercent:Ss(e.cache)},usage:e.usage,connectionState:e.connectionState,streaming:e.streaming,lifecycle:e.lifecycle,triggerPending:e.triggerPending,lastEventSeq:e.lastEventSeq,snapshotCursor:e.snapshotCursor,lastEventAt:e.lastEventAt===null?null:new Date(e.lastEventAt).toISOString(),queueDepth:e.queueDepth,subagents:e.subagents.map(t=>t.name),activeSubagents:e.activeSubagents,runningSubagentCount:e.runningSubagentCount,clientVersion:e.clientVersion,capturedAt:new Date().toISOString()},null,2)}function Ur({copied:e,failed:t}){return e?s.jsx(Wt,{className:"text-status-success size-3.5","aria-hidden":!0}):t?s.jsx(qt,{className:"text-destructive size-3.5","aria-hidden":!0}):s.jsx(Tn,{className:"size-3.5","aria-hidden":!0})}function Lr(e,t){return e?"Copied":t?"Couldn’t copy":"Copy diagnostics"}function zr({diagnostics:e,className:t}){const{copied:n,failed:r,copy:i}=Ht(),o=()=>void i(Ir(e));return s.jsxs(F,{variant:"ghost",size:"sm",className:k("gap-1.5 text-xs",t),onClick:o,children:[s.jsx(Ur,{copied:n,failed:r}),Lr(n,r)]})}function zi({open:e,onOpenChange:t,diagnostics:n,controls:r,promotionContext:i,urgentAction:o,overflowCount:a=0,addOns:u}){const f=Qt(),{pins:m,toggle:p,reset:c}=_r(),d=Ar(),y=new Set(m),v=a>0;return s.jsxs(je,{open:e,onOpenChange:t,children:[s.jsx(Kt,{children:s.jsxs(D,{children:[s.jsx(ye,{asChild:!0,children:s.jsx(I,{asChild:!0,children:s.jsxs("button",{type:"button","data-testid":"status-reveal","aria-label":v?`Chat details, ${a} more`:"Chat details",className:"text-muted-foreground/50 hover:text-muted-foreground inline-flex shrink-0 items-center justify-center gap-0.5 transition-colors duration-150 pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:[s.jsx(Xt,{className:"size-4"}),v&&s.jsxs("span",{className:"tabular-nums",children:["+",a]})]})})}),s.jsx(U,{side:"top",children:v?`Chat details, ${a} more`:"Chat details"})]})}),s.jsxs(be,{side:"top",align:"end",className:"w-80 p-3","aria-label":"Chat",children:[s.jsx(ve,{children:"Chat"}),o&&s.jsx(F,{variant:"secondary",className:"mb-3 w-full",disabled:o.pending,onClick:()=>{o.onAction(),t(!1)},children:o.label}),s.jsxs("div",{className:"flex flex-col gap-4",children:[u&&s.jsxs("section",{className:"space-y-1","data-testid":"session-add-ons",children:[s.jsx("h3",{className:"text-muted-foreground px-1 text-xs font-medium tracking-wide uppercase",children:"Add-ons"}),u]}),d.map(l=>s.jsxs("section",{className:"space-y-1",children:[s.jsx("h3",{className:"text-muted-foreground px-1 text-xs font-medium tracking-wide uppercase",children:l.label}),Br($r(l.items,r),f?i:null).map(x=>s.jsx(Gr,{item:x,value:Dr(x.key,n),pinned:y.has(x.key),onTogglePin:vs(x)?()=>p(x.key):null,control:Fr(x.key,r)},x.key)),l.group==="diagnostics"&&s.jsxs(s.Fragment,{children:[s.jsx(Ge,{label:"Queued messages",value:String(n.queueDepth)}),s.jsx(Ge,{label:"Chat ID",value:n.sessionId||"—"})]})]},l.group))]}),n.sessionId!==""&&s.jsxs(F,{variant:"ghost",size:"sm",className:"text-muted-foreground mt-3 h-7 w-full justify-start gap-1.5 text-xs",onClick:()=>{t(!1),Yt({sessionId:n.sessionId})},children:[s.jsx(Vt,{className:"size-3.5","aria-hidden":!0}),"View notifications"]}),s.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2",children:[s.jsx(zr,{diagnostics:n}),s.jsxs(F,{variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 text-xs",disabled:m.length===0,onClick:c,children:[s.jsx(Jt,{className:"size-3.5","aria-hidden":!0}),"Reset pins"]})]})]})]})}function Br(e,t){return t?[...e].sort((n,r)=>r.severity(t)-n.severity(t)):e}function $r(e,t){return e.filter(n=>n.key!=="plan"||t.plan!==null)}function Fr(e,t){return e==="plan"&&t.plan?s.jsx(en,{checked:t.plan.active,onCheckedChange:t.plan.onToggle,"aria-label":"Plan first, change nothing until approved"}):null}function Gr({item:e,value:t,pinned:n,onTogglePin:r,control:i}){const o=e.icon;return s.jsxs("div",{"data-testid":`session-row-${e.key}`,className:"flex items-center gap-2 px-1 py-1 text-sm",children:[s.jsx(o,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"shrink-0",children:e.label}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("span",{className:"text-muted-foreground truncate text-xs",title:t??void 0,children:t??"—"}),i,r&&s.jsx("button",{type:"button",onClick:r,"aria-pressed":n,"aria-label":n?`Stop keeping ${e.label} in the status bar`:`Keep ${e.label} in the status bar`,className:k("hover:text-foreground inline-flex size-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150",n?"text-foreground":"text-muted-foreground/50"),children:n?s.jsx(ss,{className:"size-3.5"}):s.jsx(Zt,{className:"size-3.5"})})]})}function Ge({label:e,value:t}){return s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-sm",children:[s.jsx("span",{className:"w-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"shrink-0",children:e}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("span",{className:"text-muted-foreground truncate text-xs",title:t,children:t})]})}function Bi(e){const t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]),h.useEffect(()=>{const n=r=>{const i=r.key==="."||r.key===">";(r.metaKey||r.ctrlKey)&&r.shiftKey&&i&&(r.preventDefault(),t.current())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[])}function Hr(e){const t=new Map;for(const r of e){if(r.type!=="subagent_update")continue;const i=t.get(r.taskId);t.set(r.taskId,{taskId:r.taskId,status:r.status,description:r.description??(i==null?void 0:i.description),toolUses:r.toolUses??(i==null?void 0:i.toolUses),lastToolName:r.lastToolName??(i==null?void 0:i.lastToolName),summary:r.summary??(i==null?void 0:i.summary),ambient:r.ambient??(i==null?void 0:i.ambient)})}const n=[];for(const{ambient:r,...i}of t.values())kn({ambient:r,status:i.status})||n.push(i);return n}function $i(e){const t=[],n=[];for(const r of e)r.status==="running"?t.push(r):n.push(r);return{running:t,finished:n}}const He=new WeakMap;function We(e,t,n){let r=He.get(e);r||(r=new Set,He.set(e,r)),!r.has(t)&&(r.add(t),n())}function qe(e,t,n){let r;try{r=n()}catch(i){return We(e,`${t}:throw`,()=>console.warn(`[extensions] ${e.extensionId}'s status-bar item "${e.id}" threw in ${t}(); it is hidden until it stops throwing.`,i)),!1}return typeof r!="boolean"?(We(e,`${t}:type`,()=>console.warn(`[extensions] ${e.extensionId}'s status-bar item "${e.id}": ${t}() must return true or false, synchronously, reading only its ctx; it returned ${Wr(r)}, read as false.`)),!1):r}function Wr(e){return e instanceof Promise?"a Promise":e===null?"null":typeof e=="object"?"an object":`a ${typeof e}`}function qr(e,t){const n=[],r=[];for(const i of e){const o=i.when?qe(i,"when",()=>i.when(t)):!0,a=o&&i.urgent?qe(i,"urgent",()=>i.urgent(t)):!1;n.push({id:i.id,visible:o,urgent:a}),o&&r.push(i)}return r.sort((i,o)=>(i.priority??0)-(o.priority??0)),{promotion:n,visible:r}}function Fi(e){const t=sn("status-bar");return h.useMemo(()=>qr(t,e),[t,e])}function Qr(e){return e!=null&&e!==!1}function Gi({ctx:e,pins:t,nodes:n}){var o;const r=new Set(t),i=[];for(const a of bs){if(a.neverInLine)continue;const u=n[a.key];if(!Qr(u))continue;const f=r.has(a.key)&&vs(a);!f&&!a.promote(e)||i.push({key:a.key,cluster:a.cluster,severity:a.severity(e),pinned:f,rigid:a.rigid===!0,wide:((o=a.wide)==null?void 0:o.call(a,e))===!0,node:u})}return i}const Qe=648,Kr=440,Xr=340,Vr=3,Yr=3,Jr=2,Zr=4,ei=8,si=20,ti=oe*ei+si,ni=Number.POSITIVE_INFINITY,Ke=[],ri=["cwd"],Xe=["cwd","git"];function ii(e){if(e===null||e<=0)return{density:"full",rightBudget:ni,dropped:Ke};if(e>=Qe){const t=Math.floor((e-Qe)/ti);return{density:"full",rightBudget:Zr+t,dropped:Ke}}return e>=Kr?{density:"compact",rightBudget:Vr,dropped:ri}:e>=Xr?{density:"identity",rightBudget:Yr,dropped:Xe}:{density:"avatar",rightBudget:Jr,dropped:Xe}}function ai(e,t){return t.severity!==e.severity?t.severity-e.severity:Number(t.pinned)-Number(e.pinned)}const oi=2,li=2;function Hi(e,t){const n=new Set(t.dropped),r=e.filter(u=>u.cluster==="right"),i=new Set;let o=0,a=0;for(const u of[...r].sort(ai)){if(a>=t.rightBudget)break;u.rigid&&o>=oi||(u.rigid&&(o+=1),i.add(u.key),a+=u.wide?Math.min(li,t.rightBudget-a):1)}return{items:e.filter(u=>u.cluster==="right"?i.has(u.key):!n.has(u.key)),overflow:r.length-i.size}}function Wi(){const e=h.useRef(null),[t,n]=h.useState(null);h.useLayoutEffect(()=>{const i=e.current;if(!i)return;n(i.getBoundingClientRect().width);const o=new ResizeObserver(a=>{var m,p;const u=a.at(0);if(!u)return;const f=((p=(m=u.contentBoxSize)==null?void 0:m.at(0))==null?void 0:p.inlineSize)??u.contentRect.width;n(f)});return o.observe(i),()=>o.disconnect()},[]);const r=h.useMemo(()=>ii(t),[t]);return{ref:e,budget:r}}const ci=[];function qi(e){const t=tn(e),n=h.useMemo(()=>Pn(t),[t]),r=Dn(e)==="streaming",i=$(h.useCallback(M=>{var C;return((C=M.sessions[e])==null?void 0:C.sessionStatus)??null},[e])),o=nn(e),a=zn(e||null,i,r,o.runtime),u=$(h.useCallback(M=>{var C;return((C=M.sessions[e])==null?void 0:C.contextUsage)??null},[e])),f=$(rn(M=>{var b;const C=(b=M.sessions[e])==null?void 0:b.sessionStatus;return!(C!=null&&C.cacheReadTokens)&&!(C!=null&&C.cacheCreationTokens)?null:{cacheReadTokens:C.cacheReadTokens??0,cacheCreationTokens:C.cacheCreationTokens??0,contextTokens:C.contextTokens}})),m=n.cacheStatus??f,{data:p}=Kn(a.cwd),{data:c}=Bn(e),{data:d}=ne(),y=an(e),v=Ve(e),l=on(e),x=ln(e),N=cn(e),w=Ye(e),g=un(e).length,T=dn(e),A=h.useMemo(()=>{let M=null;return()=>M??(M=Hr(T))},[T]),_=(t==null?void 0:t.runningSubagentCount)??null,E=h.useMemo(()=>Vn(p),[p]),O=gs(n.contextPercent??a.contextPercent,u),P=(o.model??n.model??a.model)||null;return h.useMemo(()=>({sessionId:e,cwd:a.cwd,git:E,runtime:o.runtime,model:P,selectedModel:a.model||null,effort:a.effort??null,fastMode:a.fastMode,permissionMode:a.permissionMode,contextPercent:O,contextUsage:u,cache:m?{readTokens:m.cacheReadTokens,creationTokens:m.cacheCreationTokens,contextTokens:m.contextTokens}:null,usage:n.usage,connectionState:y,streaming:r,lifecycle:v??null,triggerPending:w,lastEventSeq:l,snapshotCursor:N,lastEventAt:x,queueDepth:g,subagents:c??ci,get activeSubagents(){return A()},runningSubagentCount:_,clientVersion:(d==null?void 0:d.version)??null}),[e,a.cwd,a.model,a.effort,a.fastMode,a.permissionMode,E,o.runtime,P,O,u,m,n,y,v,r,w,l,N,x,g,c,A,_,d==null?void 0:d.version])}export{Ai as A,Wi as B,zr as C,_i as D,yi as E,hs as F,Ti as G,zn as H,Ln as I,bi as J,kn as K,er as M,ki as P,wi as R,zi as S,Di as U,kr as a,Ii as b,Ss as c,Pi as d,Si as e,Oi as f,Mi as g,Ri as h,vi as i,Ui as j,Hi as k,qr as l,Ir as m,Li as n,Xn as o,$i as p,Mr as q,ii as r,Gi as s,Fi as t,qi as u,Kn as v,Ci as w,Ei as x,Bi as y,_r as z};
16
+ */const fs={name:"wifi",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]};fs.node;const Y=de(fs);function kn(e){return e.ambient===!0&&e.status!=="error"}function yi(e){const t=[],n=[];for(const r of e)(r.ambient?n:t).push(r);return{shown:t,ambient:n}}function Cn(e){var t;return((t=e==null?void 0:e.ui)==null?void 0:t.statusBar)??Es}function wn(){const{data:e}=ne();return Cn(e)}function En(){const e=q(),t=me(),n=Cs({mutationKey:ws,mutationFn:i=>e.updateConfig({ui:{statusBar:{pins:[...i]}}}),onMutate:async i=>{await t.cancelQueries({queryKey:B.current()});const o=t.getQueryData(B.current());return t.setQueryData(B.current(),a=>a!=null&&a.ui?{...a,ui:{...a.ui,statusBar:{pins:[...i]}}}:a),{previous:o}},onError:(i,o,a)=>{a&&a.previous!==void 0&&t.setQueryData(B.current(),a.previous)},onSettled:()=>{t.invalidateQueries({queryKey:B.current()})}});return{setPins:h.useCallback(i=>n.mutate(i),[n]),isPending:n.isPending}}const Mn=80,Rn=95,_n=70,hs=85;function An(e){return e>=Rn?"critical":e>=Mn?"warning":"ok"}function xs(e,t){return e==null||e<=0||t==null||t<=0?null:Math.min(100,Math.round(e/t*100))}function gs(e,t){return t?Math.round(t.percentage):e}function On(e){var n;const t=e.cacheStats;return!t||t.cacheReadTokens===0&&t.cacheCreationTokens===0?null:{cacheReadTokens:t.cacheReadTokens,cacheCreationTokens:t.cacheCreationTokens,contextTokens:(n=e.contextUsage)==null?void 0:n.totalTokens}}function Dn(e){var t,n;return e?{contextPercent:xs((t=e.contextUsage)==null?void 0:t.totalTokens,(n=e.contextUsage)==null?void 0:n.maxTokens),costUsd:e.cost,model:e.model,cacheStatus:On(e),usage:e.usage}:{contextPercent:null,costUsd:null,model:null,cacheStatus:null,usage:null}}function Ns(e,t,n){if(t)return"streaming";if(e===void 0)return n;switch(e){case"streaming":return"streaming";case"error":return"error";default:return"idle"}}function bi(e,t){var n;return Ns((n=e.status)==null?void 0:n.lifecycle,e.triggerPending,t)}function Pn(e){const t=Ve(e),n=Ye(e),r=Ms(e);return Ns(t,n,r)}function In(e,t){return e??t??"default"}function J(e){return!e.isPending||e.fetchStatus==="idle"||e.fetchStatus==="paused"}const Un=5e3;function Ln(e,t){const n=q(),r=Z(N=>N.selectedCwd),{sessions:i,isAnswered:o,isLoading:a}=Je(),u=ne(),f=pe(),{data:m}=u,{data:p}=f,c=t??(p==null?void 0:p.defaultRuntime)??null,d=fe(c),y=e!==null&&o&&!i.some(N=>N.id===e),v=he({queryKey:Ze.storedSettings(e),queryFn:()=>n.getStoredSessionSettings(e),staleTime:Un,enabled:y,networkMode:"always"}),{data:l}=v;if(r===null)return{mode:void 0,settled:!1};if(a)return{mode:void 0,settled:!1};if(!y)return{mode:void 0,settled:!0};if(!J(v)||!J(u)||!J(f))return{mode:void 0,settled:!1};if((l==null?void 0:l.permissionMode)!==void 0)return{mode:l.permissionMode,settled:!0};if(!c||!(d!=null&&d.permissionModes.supported))return{mode:void 0,settled:!0};const x=Rs(m==null?void 0:m.executionDefaults,c);return{mode:_s(x,d.permissionModes),settled:!0}}function zn(e,t,n,r){var Te,ke;const i=q(),o=me(),a=Z(j=>j.selectedCwd),u=As(e),f=(u==null?void 0:u.cwd)??a,m=Z(j=>j.pendingAccount),{data:p}=es({sessionId:e??void 0,runtime:r??void 0}),c=Os(e??""),d=Me(j=>j.apply),y=Me(j=>j.clear),v=Ds(e),{data:l}=v,{sessions:x}=Je(),N=e===null?void 0:x.find(j=>j.id===e),w=Ln(e,r),g=((Te=p==null?void 0:p.find(j=>j.isDefault))==null?void 0:Te.value)??((ke=p==null?void 0:p[0])==null?void 0:ke.value)??"",T=Ps(e??""),_=!r||!(l!=null&&l.runtime)||l.runtime===r?l==null?void 0:l.model:void 0,E=T&&_===T.from?T.to:_,O=c.model??(n?t==null?void 0:t.model:null)??E??g,D=p==null?void 0:p.find(j=>j.value===O),M=(t==null?void 0:t.contextTokens)??(l==null?void 0:l.contextTokens)??null,C=(t==null?void 0:t.contextMaxTokens)??(D==null?void 0:D.contextWindow)??null,b=c.effort??(l==null?void 0:l.effort)??null,Q=c.fastMode??(l==null?void 0:l.fastMode)??!1,G=c.permissionMode??(l==null?void 0:l.permissionMode)??(N==null?void 0:N.permissionMode)??w.mode,R=e===null||G!==void 0||J(v)&&w.settled,L={permissionMode:In(c.permissionMode,G),permissionModeKnown:R,model:O,effort:b,fastMode:Q,costUsd:(t==null?void 0:t.costUsd)??null,contextPercent:xs(M,C),isStreaming:n,cwd:(l==null?void 0:l.cwd)??null},re=h.useCallback(async j=>{if(!e)return;const Ce={...j.model?{model:j.model}:{},...j.permissionMode?{permissionMode:j.permissionMode}:{},...j.effort?{effort:j.effort}:{},...j.fastMode!==void 0?{fastMode:j.fastMode}:{}};d(e,Ce);const we=(m==null?void 0:m.sessionId)===e?m.id:void 0,Ts={...r?{runtime:r}:{},...we?{account:we}:{},...j};try{const{permissionModePendingUntilNextTurn:ie,runtimeUnbound:ks,...Ee}=await i.updateSession(e,Ts,f??void 0);return ie&&Is.warning("Saved · starts on your next message",{description:"The current reply keeps its old setting."}),o.setQueriesData({queryKey:Ze.bySession(e)},z=>({...z,...Ee,...j.model===void 0?{model:z==null?void 0:z.model}:{},...ks?{runtime:z==null?void 0:z.runtime}:{}})),Ee}catch(ie){console.error("[useSessionStatus] updateSession failed for session",e,ie),y(e,Ce)}},[i,e,r,f,m,o,d,y]);return h.useEffect(()=>{if(!e)return;const j={};c.model!==void 0&&(l==null?void 0:l.model)===c.model&&(j.model=c.model),c.permissionMode!==void 0&&(l==null?void 0:l.permissionMode)===c.permissionMode&&(j.permissionMode=c.permissionMode),c.effort!==void 0&&(l==null?void 0:l.effort)===c.effort&&(j.effort=c.effort),c.fastMode!==void 0&&(l==null?void 0:l.fastMode)===c.fastMode&&(j.fastMode=c.fastMode),Object.keys(j).length>0&&y(e,j)},[e,l==null?void 0:l.model,l==null?void 0:l.permissionMode,l==null?void 0:l.effort,l==null?void 0:l.fastMode,c,y]),{...L,updateSession:re}}function Bn(e){const t=q();return he({queryKey:["subagents",e??null],queryFn:()=>t.getSubagents({sessionId:e}),staleTime:1800*1e3})}const $n={duration:.2,ease:[.4,0,.2,1]},Fn="pointer-coarse:[&_button]:py-3";function vi({items:e,trailing:t}){const n=e.filter(i=>i.cluster==="left"),r=e.filter(i=>i.cluster==="right");return s.jsxs("div",{role:"toolbar","aria-label":"Chat status","aria-live":"polite","data-testid":"status-line",className:"text-muted-foreground flex items-center gap-2 overflow-hidden px-1 text-xs whitespace-nowrap pointer-coarse:min-h-11",children:[s.jsx(Ue,{items:n,className:"min-w-0 flex-auto"}),s.jsx(Ue,{items:r,className:"min-w-0 shrink"}),t!==void 0&&s.jsx("span",{className:"flex shrink-0 items-center",children:t})]})}const Gn=8;function Hn(e,t){return Gn**Math.max(0,t.indexOf(e.key))}function Ue({items:e,className:t}){const n=[...e].sort((r,i)=>i.severity-r.severity).map(r=>r.key);return s.jsx("div",{className:k("flex items-center gap-2",t),children:s.jsx(xe,{initial:!1,mode:"popLayout",children:e.map((r,i)=>s.jsxs(ge.div,{"data-testid":`status-item-${r.key}`,"data-rigid":r.rigid?"true":void 0,layout:"position",initial:{opacity:0,scale:.8,filter:"blur(4px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},exit:{opacity:0,scale:.8,filter:"blur(4px)"},transition:$n,style:r.rigid?void 0:{flexShrink:Hn(r,n)},className:k("inline-flex items-center gap-2",r.rigid?"shrink-0":"min-w-10",Fn),children:[i>0&&s.jsx(Wn,{}),r.node]},r.key))})})}function Wn(){return s.jsx("span",{className:"text-muted-foreground/30 shrink-0","aria-hidden":"true",children:"·"})}function Si({cwd:e}){const t=e.split("/").filter(Boolean).pop()??e;return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:e,children:[s.jsx(Us,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:t})]})}const qn=Object.freeze({state:"unknown"}),Qn=Object.freeze({state:"no-repo"});function Kn(e){const t=q();return he({queryKey:["git-status",e],queryFn:()=>t.getGitStatus(e??void 0),enabled:!!e,refetchInterval:Re.GIT_STATUS_REFETCH_MS,refetchIntervalInBackground:!1,staleTime:Re.GIT_STATUS_STALE_TIME_MS})}function Xn(e){return!!e&&!("error"in e)}function Vn(e){return e===void 0?qn:"error"in e?Qn:{state:"repo",branch:e.branch,dirty:!e.clean}}function te(e){const t=e.trim(),n=Array.from(t);return n.length<=oe?t:`${n.slice(0,oe-1).join("").trimEnd()}…`}function Yn(e){return e.replace(/\s*\([^()]*\)\s*$/,"").split("·")[0].trim()}function Jn(e,t){return te(Zn(e,t))}function Zn(e,t){const n=t.find(i=>i.value===e);if(n)return Yn(n.displayName);const r=/claude-(\w+)-/.exec(e);return r?`${r[1].charAt(0).toUpperCase()}${r[1].slice(1)}`:e==="default"?"Default":Ls(e)??e}function Ti({data:e,workspace:t,compact:n}){if(!e)return null;if(!Xn(e))return s.jsxs("span",{className:"text-muted-foreground/50 inline-flex min-w-0 items-center gap-1",title:"Not a git repository",children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:"No repo"})]});const r=e.modified+e.staged+e.untracked,i=r===1?"1 change":`${r} changes`,o=[];if(e.modified>0&&o.push(`${e.modified} modified`),e.staged>0&&o.push(`${e.staged} staged`),e.untracked>0&&o.push(`${e.untracked} untracked`),e.conflicted>0&&o.push(`${e.conflicted} conflicted`),t){const u=zs(t.portBase),f=[`${t.key} · ${t.projectKey}`,`${t.branch??e.branch} · ${t.provider}`,e.ahead>0?`↑${e.ahead}`:"",e.behind>0?`↓${e.behind}`:"",o.length>0?o.join(", "):"clean",`ports ${u.DORKOS_PORT} / ${u.VITE_PORT} / ${u.SITE_PORT}`,t.pinned?"pinned":""].filter(Boolean);return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:f.join(" · "),children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"max-w-[20ch] truncate font-medium",children:n?te(t.key):t.key}),!n&&s.jsxs("span",{className:"text-muted-foreground truncate",children:["· ",t.projectKey]}),t.pinned&&s.jsx(ss,{className:"text-muted-foreground size-(--size-icon-xs) shrink-0"}),r>0&&(n?s.jsx(Le,{label:i}):s.jsxs("span",{className:"text-muted-foreground shrink-0",children:["· ",i]}))]})}const a=o.length>0?`${e.branch} · ${o.join(", ")}`:`${e.branch} · clean`;return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:a,children:[s.jsx(V,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"max-w-[25ch] truncate",children:n?te(e.branch):e.branch}),e.ahead>0&&s.jsxs("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-0.5",children:[s.jsx(Bs,{className:"size-(--size-icon-xs)"}),e.ahead]}),e.behind>0&&s.jsxs("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-0.5",children:[s.jsx($s,{className:"size-(--size-icon-xs)"}),e.behind]}),r>0&&(n?s.jsx(Le,{label:i}):s.jsxs("span",{className:"text-muted-foreground shrink-0",children:["· ",i]}))]})}function Le({label:e}){return s.jsx("span",{role:"img","aria-label":e,title:e,className:"bg-muted-foreground/70 size-1 shrink-0 rounded-full"})}function er({stop:e,onMakeDefault:t,onDismiss:n,pending:r,error:i,placement:o="inline"}){const a=o==="overlay";return a&&!e?null:s.jsx("div",{className:k("flex items-center px-1",a?"bg-background/95 pointer-events-auto absolute right-0 bottom-full left-0 z-20 mb-1 rounded-md py-0.5 backdrop-blur-sm":"min-h-5"),"data-testid":a?"make-default-slot-overlay":"make-default-slot",children:e&&s.jsxs("p",{role:"status","data-testid":"make-default-offer",className:k("animate-in fade-in-0 flex min-w-0 items-center gap-1.5 text-xs duration-200 motion-reduce:animate-none",i?"text-destructive":"text-muted-foreground"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i?s.jsxs(s.Fragment,{children:[s.jsx(Ne,{className:"mr-1 inline size-3 shrink-0 align-[-2px]","aria-hidden":!0}),i]}):s.jsxs(s.Fragment,{children:["Start every new chat in ",Fs(e),"?"]})})," ",s.jsxs("span",{className:"flex shrink-0 items-center gap-1 whitespace-nowrap",children:[i?s.jsx("button",{type:"button",disabled:r,onClick:t,"data-testid":"make-default-retry",className:"focus-ring text-foreground rounded-sm underline underline-offset-2 disabled:opacity-50",children:"Try again"}):s.jsx("button",{type:"button",disabled:r,onClick:t,"data-testid":"make-default-confirm",className:"focus-ring text-foreground rounded-sm underline underline-offset-2 disabled:opacity-50",children:"Make default"}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("button",{type:"button",onClick:n,"data-testid":"make-default-dismiss",className:"focus-ring hover:text-foreground rounded-sm underline underline-offset-2",children:"Dismiss"})]})]})})}const sr="Auto mode needs Opus 4.6+ or Sonnet 4.6";function ki({mode:e,onChangeMode:t,disabled:n,pending:r,runtime:i,modelSupportsAutoMode:o,planActive:a,compact:u,makeDefault:f,onOpenChange:m}){var C;const p=fe(i),c=Z(b=>b.setControlCenterOpen),d=H(b=>b.open),y=H(b=>b.setOpen),v=H(b=>b.setAvailable),l=!(p&&!p.permissionModes.supported)&&n!==!0&&r!==!0;h.useEffect(()=>(v(l),()=>v(!1)),[l,v]);const x=h.useRef(m);if(h.useEffect(()=>{x.current=m},[m]),h.useEffect(()=>()=>{var b;y(!1),(b=x.current)==null||b.call(x,!1)},[y]),p&&!p.permissionModes.supported)return null;const N=(p==null?void 0:p.permissionModes.values)??[],w=!o&&N.some(b=>b.id==="auto"),g=w?N.filter(b=>b.id!=="auto"):N,T=g.find(b=>b.id===e),A=(T==null?void 0:T.label)??Gs(e),_=u?te(A):A,E=Hs(T),O=(C=Ws(g).find(b=>b.mode.id===e))==null?void 0:C.stop,D=w&&(O==="act"||e==="auto"),M=s.jsxs("button",{disabled:n,"data-testid":"permission-mode-trigger","aria-label":`Permissions: ${A}`,className:k(W,"items-center gap-1 disabled:cursor-not-allowed disabled:opacity-40",E),children:[s.jsx(qs,{descriptor:T,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:_})]});return n?s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:s.jsx("span",{className:"inline-flex",children:M})}),s.jsx(U,{side:"top",children:"Send a message first"})]}):r?s.jsxs("span",{"data-testid":"permission-mode-pending","aria-busy":"true","aria-label":"Permissions: still loading",className:k(W,"items-center gap-1 opacity-40"),children:[s.jsx("span",{className:"bg-muted-foreground/30 size-(--size-icon-xs) shrink-0 animate-pulse rounded-full"}),s.jsx("span",{className:"bg-muted-foreground/30 h-2 w-10 animate-pulse rounded"})]}):s.jsxs(je,{open:d,onOpenChange:b=>{y(b),m==null||m(b)},children:[s.jsx(ye,{asChild:!0,children:M}),s.jsxs(be,{side:"top",align:"start",className:"w-80 p-3","aria-label":"Permissions",children:[s.jsx(ve,{children:"Permissions"}),s.jsx(Qs,{mode:e,descriptors:g,onChangeMode:t,planActive:a,onUnlock:()=>c(!0)}),f&&s.jsx(er,{...f}),D&&s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("p",{"data-testid":"auto-unsupported-hint",className:"text-muted-foreground text-3xs mt-2 flex items-center gap-1.5 px-1",children:[s.jsx(ts,{className:"size-(--size-icon-xs) shrink-0"}),"Auto unavailable on this model"]})}),s.jsx(U,{side:"top",children:sr})]}),s.jsx(Ks,{mode:e,descriptor:T,className:"mt-2 px-1"})]})]})}const tr=6e3;function nr(e){return e instanceof Error&&e.message||"Couldn’t save that. Try again."}function Ci(e){var b,Q,G;const{sessionId:t,runtime:n,declaredModes:r,runtimeDefaultMode:i}=e,{data:o}=ne(),{data:a}=pe(),u=mn(),f=me(),m=Xs(t),p=$(R=>R.dismissDefaultStopOffer),[c,d]=h.useState(null),[y,v]=h.useState(null),[l,x]=h.useState(t);l!==t&&(x(t),d(null),v(null));const N=o==null?void 0:o.executionDefaults,w=n??(N==null?void 0:N.runtime),g=(b=N==null?void 0:N.perRuntime.find(R=>R.runtime===w))==null?void 0:b.trustStop,T=g??(N==null?void 0:N.trustStop)??null,A=(Q=r.find(R=>R.id===i))==null?void 0:Q.stop,_=T??A,E=g!=null?(G=pn(a,w))==null?void 0:G.configSection:void 0,O=o!==void 0;h.useEffect(()=>{if(!c)return;const R=setTimeout(()=>d(null),tr);return()=>clearTimeout(R)},[c]);const D=h.useCallback(R=>{const L=r.find(re=>re.id===R);!L||Vs(L)||!O||m||L.stop!==_&&(v(null),d(L.stop))},[r,O,m,_,d,v]),M=h.useCallback(()=>{if(!c)return;const R=c;v(null),u.mutate({runtimes:E?{[E]:{defaultTrustStop:R}}:{defaultTrustStop:R}},{onSuccess:()=>{f.invalidateQueries({queryKey:B.all}),d(null)},onError:L=>v(nr(L))})},[c,u,f,E,d,v]),C=h.useCallback(()=>{p(t),d(null)},[p,t,d]);return{line:O?{stop:c,onMakeDefault:M,onDismiss:C,pending:u.isPending,error:y}:null,offerFor:D}}function wi({runtimeLabel:e,onShown:t,onDismiss:n}){const r=H(o=>o.available),i=H(o=>o.setOpen);return h.useEffect(()=>{t==null||t()},[t]),s.jsxs(fn,{"data-slot":"read-only-mode-notice","data-testid":"read-only-mode-notice",gap:"none",className:"flex-row flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2",children:[s.jsx(Ys,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),s.jsxs("p",{className:"text-muted-foreground min-w-0 flex-1 text-xs",children:["In this mode, ",e," reads files but won’t change them. Asking won’t help."]}),s.jsxs("div",{className:"flex w-full shrink-0 flex-wrap items-center justify-end gap-1.5 sm:w-auto",children:[s.jsx(F,{variant:"ghost",size:"sm",responsive:!1,className:"h-7 px-2 text-xs",onClick:n,children:"Dismiss"}),r&&s.jsx(F,{variant:"outline",size:"sm",responsive:!1,className:"h-7 px-2 text-xs",onClick:()=>i(!0),children:"Change permissions"})]})]})}function Ei(e,t,n){const r=fe(t??void 0),i=$(c=>c.recordReadOnlyHintShown),o=$(c=>c.spendReadOnlyHint),a=Js(e??""),u=r==null?void 0:r.permissionModes.values.find(c=>c.id===n),f=u!==void 0&&Zs(u);h.useEffect(()=>{f||!e||a!=="shown"||o(e)},[f,e,a,o]);const m=h.useCallback(()=>{e&&i(e)},[e,i]),p=h.useCallback(()=>{e&&o(e)},[e,o]);return h.useMemo(()=>({eligible:!!e&&f&&a!=="spent",runtimeLabel:t?et(t):"This agent",markShown:m,dismiss:p}),[e,f,a,t,m,p])}function Mi({descriptor:e,active:t,onToggle:n,disabled:r}){return s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("button",{type:"button","aria-pressed":t,disabled:r,onClick:()=>n(!t),className:k(W,"items-center gap-1","disabled:cursor-not-allowed disabled:opacity-40",t&&"text-foreground"),children:[s.jsx(ns,{className:"size-(--size-icon-xs) shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:e.label})]})}),s.jsx(U,{side:"top",children:r?"Send a message first":e.promise})]})}function Ri({runtime:e,model:t,onChangeRuntime:n,canSelect:r,compact:i,account:o}){const{data:a}=pe(),{data:u}=st(),{nameFor:f}=tt(),[m,p]=h.useState({open:!1}),c=Object.keys((a==null?void 0:a.capabilities)??{}),d=c.filter(g=>_e(u,g)),y=c.filter(g=>!_e(u,g)),v=a!==void 0&&Object.values(nt).some(g=>g.setup&&!c.includes(g.type)),l=!!n&&(c.length>1||y.length>0||v),x=i?null:t,N=s.jsx(Ae,{runtime:e,model:x,iconClassName:"size-(--size-icon-xs)"}),w=o?`Account: ${f(o)}`:null;return r?l?s.jsxs(s.Fragment,{children:[s.jsxs(rt,{children:[s.jsx(it,{asChild:!0,children:s.jsx("button",{className:W,children:s.jsx(Ae,{runtime:e,model:x,iconClassName:"size-(--size-icon-xs)"})})}),s.jsxs(at,{side:"top",align:"start",className:"w-56",children:[s.jsx(ot,{children:"Runs on"}),s.jsx(lt,{value:e,onValueChange:g=>n==null?void 0:n(g),children:d.map(g=>{const T=De(g);return s.jsx(ct,{value:g,icon:T.icon,children:T.label},g)})}),y.map(g=>{const T=De(g);return s.jsx(Oe,{icon:T.icon,description:"Connect",onSelect:()=>p({open:!0,runtime:g}),children:T.label},g)}),v&&s.jsxs(s.Fragment,{children:[s.jsx(ut,{}),s.jsx(Oe,{icon:dt,onSelect:()=>p({open:!0}),children:"Add a runtime"})]})]})]}),s.jsx(hn,{runtime:m.runtime,open:m.open,onOpenChange:g=>p(T=>({...T,open:g})),renderConnect:jn,showConnectSuccess:!0,onRuntimeReady:g=>{n==null||n(g)}})]}):w?s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:N}),s.jsx(U,{side:"top",children:w})]}):N:s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:N}),s.jsxs(U,{side:"top",children:[s.jsx("span",{className:"block",children:"Set when the chat starts. It can’t change after."}),w&&s.jsx("span",{className:"block",children:w})]})]})}function _i(e,t,n){const r=rs(),i=mt(e),o=new Date(r),a=t.pending?null:t.usage;return{...pt({liveTurnUsage:n,liveTurnAt:i,accountStatus:ft(a,o),accountObservedAt:is(as(a))}),accountUsage:a}}function Ai({open:e,onOpenChange:t,onConfirm:n}){return s.jsx(ht,{open:e,onOpenChange:t,children:s.jsxs(xt,{children:[s.jsxs(gt,{children:[s.jsxs(Nt,{className:"flex items-center gap-2",children:[s.jsx(ts,{className:"text-muted-foreground size-4"}),"Turn on Auto mode?",s.jsx(ee,{size:"xs",variant:"secondary",className:"tracking-wide uppercase",children:"Preview"})]}),s.jsx(jt,{children:"Asks only before risky steps, like deleting files. Switch back anytime."})]}),s.jsxs(yt,{children:[s.jsx(bt,{children:"Cancel"}),s.jsx(vt,{onClick:n,children:"Turn on Auto mode"})]})]})})}const ze=[{slug:"frontier",label:"Frontier"},{slug:"solid-coders",label:"Solid coders"},{slug:"quick-helpers",label:"Quick helpers"},{slug:"more-models",label:"More models"},{slug:"no-tools",label:"Can’t do agent work"}],rr=10,ir="Can’t use tools, so it can’t read files or run commands.",ar="Makes images DorkOS can’t show yet.",or=["openrouter/openrouter/auto","openrouter/auto"];function lr(e){return or.some(t=>e.value===t||e.value.startsWith(`${t}-`))}function js(e){return e.supportsToolUse!==!1}function cr(e){return e.supportsImageOutput===!0&&!lr(e)?ar:js(e)?null:ir}function ur(e){if(!js(e))return"no-tools";switch(e.tier){case"frontier":return"frontier";case"solid-coder":return"solid-coders";case"quick-helper":return"quick-helpers";default:return"more-models"}}function dr(e){return e.some(t=>t.tier!=null)||e.length>rr}function mr(e,t){const n=t.trim().toLowerCase();return n?e.value.toLowerCase().includes(n)||e.displayName.toLowerCase().includes(n):!0}function pr(e){const t=new Map(ze.map(n=>[n.slug,[]]));for(const n of e)t.get(ur(n)).push(n);return ze.map(n=>({...n,models:t.get(n.slug)})).filter(n=>n.models.length>0)}function fr(e){return e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function hr(){return s.jsx("div",{className:"space-y-2","data-testid":"model-cards-skeleton",children:Array.from({length:3}).map((e,t)=>s.jsxs("div",{className:"flex items-center gap-3 rounded-xl p-3",children:[s.jsx(K,{className:"size-4 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(K,{className:"h-3.5 w-24"}),s.jsx(K,{className:"h-2.5 w-32"})]}),s.jsx(K,{className:"h-5 w-10 rounded-md"})]},t))})}function xr({onRetry:e,message:t}){return s.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-center","data-testid":"model-load-error",children:[s.jsx(Ne,{className:"text-muted-foreground size-5"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:t??"Couldn’t load the model list."}),s.jsxs("button",{onClick:e,className:"text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",children:[s.jsx(os,{className:"size-3"}),"Retry"]})]})}function gr(e){const t=e.slice(e.lastIndexOf(" ")+1);return t.includes("/")||t.includes(":")}function ys({text:e,className:t}){return gr(e)?s.jsx("div",{dir:"rtl",className:k("truncate text-left",t),title:e,children:s.jsx("bdi",{dir:"ltr",children:e})}):s.jsx("div",{className:k("truncate",t),title:e,children:e})}function Be({model:e,isSelected:t}){const n=cr(e);return s.jsxs("label",{className:k("flex w-full cursor-pointer items-center gap-3 rounded-xl border p-3 transition-colors duration-150",t?"bg-secondary border-foreground/15":"border-border hover:border-muted-foreground/30 hover:bg-muted/50 opacity-70"),children:[s.jsx(kt,{value:e.value,className:"shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"text-foreground line-clamp-2 text-sm font-medium break-words",children:[e.displayName,e.local&&s.jsxs("span",{className:"text-muted-foreground text-3xs ml-1.5 font-normal",children:[Ct()," · private"]})]}),s.jsx(ys,{text:e.description,className:"text-muted-foreground text-2xs leading-tight"}),n&&s.jsx("div",{className:"text-2xs text-status-warning-fg mt-0.5 leading-tight","data-testid":`model-limitation-${e.value}`,children:n})]}),e.contextWindow&&s.jsx(ee,{size:"xs",variant:"secondary",className:"shrink-0",children:fr(e.contextWindow)})]})}function Nr({value:e}){return s.jsxs("div",{className:"space-y-1.5","data-testid":"model-unavailable-saved",children:[s.jsxs("div",{className:"border-border flex w-full items-center gap-3 rounded-xl border border-dashed p-3 opacity-80",children:[s.jsx(Ne,{className:"text-status-warning-fg size-4 shrink-0"}),s.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[s.jsx(ys,{text:e,className:"text-foreground min-w-0 text-sm font-medium"}),s.jsx("span",{className:"text-muted-foreground text-2xs shrink-0 font-normal",children:"(not available)"})]})]}),s.jsx("p",{className:"text-muted-foreground text-2xs leading-snug",children:"This model isn’t available anymore. Pick another."})]})}function jr({slug:e,label:t}){return s.jsx("div",{className:"text-muted-foreground text-2xs mt-2 mb-1 font-medium tracking-wide uppercase first:mt-0","data-testid":`model-group-${e}`,children:t})}function yr({models:e,selectedModel:t,onChangeModel:n,emptyMessage:r}){const[i,o]=h.useState(""),a=dr(e),f=e.length>0&&t.length>0&&!e.some(d=>d.value===t)?s.jsx(Nr,{value:t}):null,m=e.some(d=>d.unverified),p=h.useMemo(()=>a?e.filter(d=>mr(d,i)):e,[e,i,a]),c=h.useMemo(()=>a?pr(p):[],[p,a]);return e.length===0?s.jsx("div",{className:"border-border text-muted-foreground text-2xs rounded-xl border border-dashed p-3 leading-snug","data-testid":"model-catalog-unavailable",children:r??"Couldn’t load models. Check Settings, then try again."}):a?s.jsxs("div",{className:"space-y-2",children:[f,m&&s.jsx(Ie,{}),s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),s.jsx(Tt,{type:"text",value:i,onChange:d=>o(d.target.value),placeholder:"Search models…","aria-label":"Search models","data-testid":"model-search",className:"h-8 pl-8 text-xs"})]}),c.length===0?s.jsx("p",{className:"text-muted-foreground py-4 text-center text-xs","data-testid":"model-search-empty",children:m?"No match in this short list. Connect a provider to see more.":"No models match"}):s.jsx(Pe,{value:t,onValueChange:n,className:"grid-cols-1 gap-1.5","aria-label":"Model selection","data-testid":"model-card-list",children:c.map(d=>s.jsxs(h.Fragment,{children:[s.jsx(jr,{slug:d.slug,label:d.label}),d.models.map(y=>s.jsx(Be,{model:y,isSelected:y.value===t},y.value))]},d.slug))})]}):s.jsxs("div",{className:"space-y-2",children:[f,m&&s.jsx(Ie,{}),s.jsx(Pe,{value:t,onValueChange:n,className:"grid-cols-1 gap-1.5","aria-label":"Model selection","data-testid":"model-card-list",children:e.map(d=>s.jsx(Be,{model:d,isSelected:d.value===t},d.value))})]})}const ce={none:{label:"None",description:"No reasoning"},minimal:{label:"Minimal",description:"Near-zero thinking"},low:{label:"Low",description:"Fastest responses"},medium:{label:"Medium",description:"Moderate thinking"},high:{label:"High",description:"Deep reasoning"},max:{label:"Max",description:"Maximum thinking"},xhigh:{label:"XHigh",description:"Beyond maximum"}},br={duration:.15,ease:"easeOut"};function vr({effortLevels:e,effort:t,onChangeEffort:n}){return s.jsxs("div",{children:[s.jsx("div",{className:"text-muted-foreground text-2xs mb-2 font-medium tracking-wide uppercase",children:"Effort"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":"Effort level",children:[s.jsx(ue,{role:"radio",label:"Default",isSelected:t===null,onClick:()=>n(null)}),e.map(r=>s.jsx(ue,{role:"radio",label:ce[r].label,description:ce[r].description,isSelected:t===r,onClick:()=>n(r)},r))]})]})}function Sr({supportsFastMode:e,fastMode:t,onChangeFastMode:n}){return e?s.jsxs("div",{children:[s.jsx("div",{className:"text-muted-foreground text-2xs mb-2 font-medium tracking-wide uppercase",children:"Mode"}),s.jsx("div",{className:"flex gap-1.5",children:s.jsx(ue,{role:"switch",label:"Fast",icon:s.jsx(Se,{className:"size-3"}),isSelected:t,onClick:()=>n(!t)})})]}):null}function ue({role:e,label:t,description:n,icon:r,isSelected:i,onClick:o}){const a=s.jsxs("button",{role:e,"aria-checked":i,onClick:o,className:k("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors duration-150",i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80 hover:text-foreground"),children:[r,t]});return n?s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:a}),s.jsx(U,{side:"top",className:"text-xs",children:n})]}):a}function Oi({model:e,onChangeModel:t,effort:n,onChangeEffort:r,fastMode:i,onChangeFastMode:o,disabled:a,sessionId:u,runtime:f,onCredits:m,compact:p}){var _;const{data:c,isLoading:d,isError:y,refetch:v}=es({sessionId:u,runtime:f??void 0}),l=c??[],x=l.find(E=>E.value===e),N=!!(x!=null&&x.supportsEffort&&(((_=x.supportedEffortLevels)==null?void 0:_.length)??0)>0),w=(x==null?void 0:x.supportsFastMode)??!1,g=!p&&N&&n?ce[n].label:null,T=!p&&i,A=s.jsxs("button",{disabled:a,className:k(W,"items-center gap-1 disabled:cursor-not-allowed disabled:opacity-40"),"data-testid":"model-config-trigger",children:[s.jsx(ls,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:Jn(e,l)}),g&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground text-2xs",children:"·"}),s.jsx(ee,{size:"xs",variant:"secondary",children:g})]}),T&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground text-2xs",children:"·"}),s.jsxs(ee,{size:"xs",variant:"secondary",children:[s.jsx(Se,{className:"mr-0.5 inline size-2.5"}),"Fast"]})]})]});return a?s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:s.jsx("span",{className:"inline-flex",children:A})}),s.jsx(U,{side:"top",children:"Send a message first"})]}):s.jsxs(je,{children:[s.jsx(ye,{asChild:!0,children:A}),s.jsxs(be,{side:"top",align:"start",className:"w-120 max-w-[calc(100vw-1.5rem)] p-3","data-testid":"model-config-popover",children:[s.jsx(ve,{children:"Model"}),l.some(E=>E.paidFromCredits)&&s.jsx("p",{className:"text-muted-foreground text-2xs mb-2","data-testid":"model-credits-note",children:l.some(E=>E.creditsListOutOfDate)?"Models your DorkOS credits cover. This list may be out of date.":"Models your DorkOS credits cover"}),d&&s.jsx(hr,{}),y&&s.jsx(xr,{onRetry:()=>v(),message:m?"Couldn’t load the models DorkOS credits cover. Your model stays as it is.":void 0}),!d&&!y&&s.jsx(yr,{models:l,selectedModel:e,onChangeModel:t,emptyMessage:m?"DorkOS credits don’t cover a model for this runtime yet.":void 0}),s.jsx(xe,{children:!d&&!y&&(N||w)&&s.jsxs(ge.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:br,children:[s.jsx(wt,{className:"my-3"}),s.jsx("div",{className:"text-muted-foreground text-2xs mb-3 font-medium tracking-wide uppercase",children:"Configuration"}),s.jsxs("div",{className:"space-y-3",children:[N&&s.jsx(vr,{effortLevels:x.supportedEffortLevels,effort:n,onChangeEffort:r}),w&&s.jsx(Sr,{supportsFastMode:(x==null?void 0:x.supportsFastMode)??!1,fastMode:i,onChangeFastMode:o})]})]},"config")})]})]})}function Di({percent:e,contextUsage:t,compact:n,reading:r,now:i}){const o=gs(e,t)??e,a=An(o),u=a==="critical"?se.error:a==="warning"?se.warning:"",f=n!=null&&o>=hs,m=t?{total:t.totalTokens,max:t.maxTokens}:r&&r.maxTokens>0?{total:r.totalTokens,max:r.maxTokens}:null,p=(r==null?void 0:r.observedAt)??null,c=m!==null,d=s.jsxs("span",{"aria-label":c?"Context window usage":void 0,className:k("inline-flex shrink-0 items-center gap-1",c&&"cursor-default",u),children:[s.jsx(yn,{className:"size-(--size-icon-xs) shrink-0"}),s.jsxs("span",{children:[o,"%"]})]});return s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[m?s.jsx(Tr,{totals:m,categories:(t==null?void 0:t.categories)??[],observedAt:p,now:i,children:d}):d,s.jsx(xe,{initial:!1,children:f&&s.jsxs(ge.button,{type:"button",onClick:n.onCompact,disabled:n.pending,"aria-label":n.pending?"Compacting chat…":`Context ${o}% full. Compact now`,"aria-busy":n.pending,"data-testid":"compaction-chip",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},className:"bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted inline-flex min-w-0 shrink items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(os,{"aria-hidden":"true",className:k("size-(--size-icon-xs) shrink-0",n.pending&&"animate-spin")}),s.jsx("span",{className:"truncate",children:"Compact"})]},"compact")})]})}function Tr({totals:e,categories:t,observedAt:n,now:r,children:i}){const o=t.filter(a=>a.tokens>0).sort((a,u)=>u.tokens-a.tokens);return s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:i}),s.jsx(U,{side:"top",className:"max-w-64",children:s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"text-xs font-medium",children:[ae(e.total)," / ",ae(e.max)," tokens"]}),o.length>0&&s.jsx("div",{className:"space-y-0.5",children:o.map(a=>s.jsxs("div",{className:"text-3xs flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1 truncate",children:[s.jsx("span",{className:"inline-block size-1.5 shrink-0 rounded-full",style:{backgroundColor:a.color}}),a.name]}),s.jsx("span",{className:k(le,"shrink-0"),children:ae(a.tokens)})]},a.name))}),n!==null&&s.jsx(cs,{observedAt:n,now:r,surface:"tooltip"})]})})]})}function Pi({usage:e,accountUsage:t=null,observedAt:n=null,open:r,onOpenChange:i,now:o}){const a=rs(),u=o??new Date(a),f=as(t),m=f.length>0?is(f):n,p=e!=null&&us(e);let c;return f.length>0?c=s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs font-medium",children:"Subscription usage"}),s.jsx("div",{className:"flex flex-col gap-2.5",children:f.map(d=>s.jsx(Et,{window:d,label:Mt(d.key,d.label),now:u},d.key))}),e&&s.jsx("div",{className:"text-3xs space-y-0.5",children:s.jsx(Rt,{usage:e})})]}):p?c=s.jsx(Dt,{usage:e}):c=s.jsx("p",{className:"text-muted-foreground text-xs",children:"No usage yet."}),s.jsxs(_t,{open:r,onOpenChange:i,children:[s.jsx(At,{asChild:!0,children:s.jsx("span",{"aria-hidden":!0,className:"inline-block h-0 w-0"})}),s.jsx(Ot,{side:"top",align:"end",className:"w-72 max-w-[calc(100vw-1.5rem)]","aria-label":"Usage and cost",children:s.jsxs("div",{className:"space-y-2",children:[c,m!==null&&(f.length>0||p)&&s.jsx(cs,{observedAt:m,now:u})]})})]})}const kr={connecting:{color:X.warning,label:"Connecting",shortLabel:"Connecting",icon:Y,tasks:!0},connected:{color:X.success,label:"Connected",shortLabel:"Connected",icon:Y,tasks:!1},reconnecting:{color:X.warning,label:"Reconnecting",shortLabel:"Reconnecting",icon:Y,tasks:!0},disconnected:{color:X.error,label:"Live updates lost",shortLabel:"Offline",icon:Pt,tasks:!1}};function Ii({connectionState:e,compact:t}){const n=kr[e],r=n.icon;return s.jsxs(xn,{openDelay:200,children:[s.jsx(gn,{asChild:!0,children:s.jsxs("span",{className:"flex min-w-0 cursor-default items-center gap-1.5 text-xs",children:[s.jsx("span",{className:k("size-1.5 shrink-0 rounded-full",n.color,n.tasks&&"animate-breath")}),s.jsx("span",{className:"text-muted-foreground truncate",children:t?n.shortLabel:n.label})]})}),s.jsx(Nn,{side:"top",align:"center",className:"w-72 p-3",children:s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx(r,{className:k("mt-0.5 size-4 shrink-0",e==="disconnected"?se.error:se.warning)}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx("p",{className:"text-sm font-medium",children:n.label}),s.jsx(Cr,{connectionState:e})]})]})})]})}function Cr({connectionState:e}){const t="text-muted-foreground text-xs leading-relaxed";return e==="connecting"?s.jsx("p",{className:t,children:"Connecting to live updates. New messages appear once connected."}):e==="reconnecting"?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:t,children:"Live updates dropped and are reconnecting. Nothing is lost."}),s.jsx("p",{className:k(t,"text-muted-foreground/70"),children:"No action needed."})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:t,children:"Couldn’t reconnect live updates. New messages won’t appear until they’re back."}),s.jsx("p",{className:k(t,"text-muted-foreground/70"),children:"Refresh the page. If that doesn’t help, check that DorkOS is running."})]})}function Ui({count:e,running:t,waiting:n}){const r=e===1?"":"s",i=e-t.length,o=`${e} subagent${r} running`;return s.jsxs(P,{children:[s.jsx(I,{asChild:!0,children:s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1","aria-label":o,children:[s.jsx(ds,{className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"shrink-0 tabular-nums",children:e})]})}),s.jsxs(U,{side:"top",className:"max-w-64",children:[n&&s.jsx("p",{className:"mb-1 font-medium",children:"Still working. The agent continues when they finish."}),s.jsx("ul",{className:"space-y-1",children:t.map(a=>s.jsxs("li",{children:[s.jsx("span",{className:"font-medium",children:a.description??"Working…"}),s.jsxs("p",{className:k(le,"text-3xs leading-tight"),children:[a.toolUses??0," tool",a.toolUses===1?"":"s",a.lastToolName?` · last ${a.lastToolName}`:""]})]},a.taskId))}),i>0&&s.jsx("p",{className:k(le,"text-3xs leading-tight"),children:t.length>0?`and ${i} more`:`${i} task${r} from earlier`})]})]})}const wr=new Set(["main","master"]);function Li(e,t,n){return{dirty:!t,onDefaultBranch:!n&&wr.has(e)}}const S={AGENT_ANCHOR:1e3,CONNECTION_LOST:100,CONTEXT_CRITICAL:90,ACCOUNT_ATTENTION:85,USAGE_EXHAUSTED:80,PERMISSION_BYPASS:70,CONTEXT_WARNING:50,USAGE_WARNING:50,PERMISSION_ELEVATED:40,PLAN_ACTIVE:40,SUBAGENTS_RUNNING:35,EXTENSION_ITEM:35,RUNTIME_NON_DEFAULT:30,GIT_DIRTY:20,MODEL:10,CWD:5,QUIET:0},Er={session:"Session",diagnostics:"Diagnostics"};function $e(e){return e.runtime&&!e.runtime.isDefault?S.RUNTIME_NON_DEFAULT:S.QUIET}function Mr(e){return e.account!==null}const Rr=new Set(["near","model-out","out"]);function Fe(e){return e.permissionDescriptor?e.permissionDescriptor.stop!=="ask":e.permissionMode!=="default"}const bs=[{key:"agent",label:"Agent",description:"Who you are talking to",cluster:"left",group:null,icon:Ut,promote:()=>!0,severity:()=>S.AGENT_ANCHOR},{key:"cwd",label:"Directory",description:"The folder this chat can touch",cluster:"left",group:"session",icon:Lt,promote:e=>e.cwd!==null,severity:()=>S.CWD},{key:"git",label:"Git",description:"Branch and uncommitted changes",cluster:"left",group:"session",icon:V,promote:e=>e.git!==null&&(e.git.dirty||!e.git.onDefaultBranch),severity:e=>{var t;return(t=e.git)!=null&&t.dirty?S.GIT_DIRTY:S.QUIET}},{key:"runtime",label:"Runs on",description:"What runs this chat",cluster:"right",group:"session",icon:bn,promote:e=>e.runtime!==null&&e.runtime.type!=="doe"&&(!e.runtime.isDefault||e.runtime.canSelect),severity:$e},{key:"account",label:"Account",description:"Which Claude account this uses, and what’s left",cluster:"right",group:null,icon:vn,promote:e=>e.account!==null,severity:e=>e.account&&Rr.has(e.account.chipState)?S.ACCOUNT_ATTENTION:$e(e)},{key:"extensions",label:"Add-ons",description:"What your extensions show here",cluster:"right",group:null,icon:zt,promote:e=>e.extensionItems.some(t=>t.visible),severity:e=>e.extensionItems.some(t=>t.visible&&t.urgent)?S.ACCOUNT_ATTENTION:S.EXTENSION_ITEM},{key:"model",label:"Model",description:"The model answering you",cluster:"right",group:"session",icon:ls,promote:()=>!1,severity:()=>S.MODEL},{key:"cache",label:"Cache",description:"How much came from cache",cluster:"right",group:"session",icon:Se,promote:()=>!1,severity:()=>S.QUIET,neverInLine:!0},{key:"context",label:"Context",description:"How full the context window is",cluster:"right",group:"session",icon:Sn,rigid:!0,promote:e=>e.contextPercent!==null,severity:e=>e.contextPercent===null?S.QUIET:e.contextPercent>=hs?S.CONTEXT_CRITICAL:e.contextPercent>=_n?S.CONTEXT_WARNING:S.QUIET},{key:"usage",label:"Usage & cost",description:"Plan limits or chat cost",cluster:"right",group:"session",icon:Bt,rigid:!0,promote:e=>e.usage!==null&&us(e.usage)&&!Mr(e),wide:e=>e.usageStale,severity:e=>{var t,n;return((t=e.usage)==null?void 0:t.state)==="exhausted"?S.USAGE_EXHAUSTED:((n=e.usage)==null?void 0:n.state)==="warning"?S.USAGE_WARNING:S.QUIET}},{key:"permission",label:"Permissions",description:"How freely the agent acts",cluster:"right",group:"session",icon:$t,promote:e=>Fe(e)||e.permissionPickerOpen===!0,severity:e=>(e.permissionDescriptor?Ft(e.permissionDescriptor):Gt(e.permissionMode))?S.PERMISSION_BYPASS:Fe(e)||e.permissionPickerOpen===!0?S.PERMISSION_ELEVATED:S.QUIET},{key:"plan",label:"Plan",description:"Plan first, change nothing until approved",cluster:"right",group:"session",icon:ns,promote:e=>e.plan!==null,severity:e=>{var t;return(t=e.plan)!=null&&t.active?S.PLAN_ACTIVE:S.QUIET}},{key:"subagents",label:"Subagents",description:"Subagents working on this turn",cluster:"right",group:"diagnostics",icon:ds,rigid:!0,promote:e=>e.subagentsInFlight>0,severity:e=>e.subagentsInFlight>0?S.SUBAGENTS_RUNNING:S.QUIET},{key:"connection",label:"Live updates",description:"The live link that delivers messages",cluster:"right",group:"diagnostics",icon:Y,promote:e=>e.connectionState!=="connected",severity:e=>e.connectionState==="connected"?S.QUIET:S.CONNECTION_LOST}];function vs(e){return e.group==="session"&&e.neverInLine!==!0}function _r(){const{pins:e}=wn(),{setPins:t}=En(),n=h.useCallback(i=>{const o=It.find(a=>a===i);o&&t(e.includes(o)?e.filter(a=>a!==o):[...e,o])},[e,t]),r=h.useCallback(()=>t([]),[t]);return{pins:e,toggle:n,reset:r}}function Ar(){return["session","diagnostics"].map(t=>({group:t,label:Er[t],items:bs.filter(n=>n.group===t)})).filter(t=>t.items.length>0)}function Ss(e){const t=e.contextTokens??e.readTokens+e.creationTokens;return t<=0?0:Math.round(e.readTokens/t*100)}function Or(e){return e?e.kind==="subscription"&&e.utilization!=null?`${Math.round(e.utilization*100)}% of ${e.windowLabel??"your plan"}`:e.costUsd!=null?`$${e.costUsd.toFixed(2)}`:null:null}function Dr(e){return e.split("/").filter(Boolean).pop()??e}function Pr(e,t){switch(e){case"cwd":return t.cwd?Dr(t.cwd):null;case"git":return t.git.state==="unknown"?null:t.git.state==="no-repo"?"No repo":t.git.dirty?`${t.git.branch} · changed`:t.git.branch;case"runtime":return t.runtime;case"model":return t.model;case"context":return t.contextPercent===null?null:`${t.contextPercent}% full`;case"cache":return t.cache===null?null:`${Ss(t.cache)}% from cache`;case"usage":return Or(t.usage);case"permission":return t.permissionMode;case"connection":return`${t.connectionState} · event ${t.lastEventSeq}`;default:return null}}function Ir(e){return JSON.stringify({sessionId:e.sessionId,cwd:e.cwd,git:e.git,runtime:e.runtime,model:e.model,selectedModel:e.selectedModel,effort:e.effort,fastMode:e.fastMode,permissionMode:e.permissionMode,contextPercent:e.contextPercent,contextUsage:e.contextUsage,cache:e.cache===null?null:{readTokens:e.cache.readTokens,creationTokens:e.cache.creationTokens,contextTokens:e.cache.contextTokens??null,hitPercent:Ss(e.cache)},usage:e.usage,connectionState:e.connectionState,streaming:e.streaming,lifecycle:e.lifecycle,triggerPending:e.triggerPending,lastEventSeq:e.lastEventSeq,snapshotCursor:e.snapshotCursor,lastEventAt:e.lastEventAt===null?null:new Date(e.lastEventAt).toISOString(),queueDepth:e.queueDepth,subagents:e.subagents.map(t=>t.name),activeSubagents:e.activeSubagents,runningSubagentCount:e.runningSubagentCount,clientVersion:e.clientVersion,capturedAt:new Date().toISOString()},null,2)}function Ur({copied:e,failed:t}){return e?s.jsx(Wt,{className:"text-status-success size-3.5","aria-hidden":!0}):t?s.jsx(qt,{className:"text-destructive size-3.5","aria-hidden":!0}):s.jsx(Tn,{className:"size-3.5","aria-hidden":!0})}function Lr(e,t){return e?"Copied":t?"Couldn’t copy":"Copy diagnostics"}function zr({diagnostics:e,className:t}){const{copied:n,failed:r,copy:i}=Ht(),o=()=>void i(Ir(e));return s.jsxs(F,{variant:"ghost",size:"sm",className:k("gap-1.5 text-xs",t),onClick:o,children:[s.jsx(Ur,{copied:n,failed:r}),Lr(n,r)]})}function zi({open:e,onOpenChange:t,diagnostics:n,controls:r,promotionContext:i,urgentAction:o,overflowCount:a=0,addOns:u}){const f=Qt(),{pins:m,toggle:p,reset:c}=_r(),d=Ar(),y=new Set(m),v=a>0;return s.jsxs(je,{open:e,onOpenChange:t,children:[s.jsx(Kt,{children:s.jsxs(P,{children:[s.jsx(ye,{asChild:!0,children:s.jsx(I,{asChild:!0,children:s.jsxs("button",{type:"button","data-testid":"status-reveal","aria-label":v?`Chat details, ${a} more`:"Chat details",className:"text-muted-foreground/50 hover:text-muted-foreground inline-flex shrink-0 items-center justify-center gap-0.5 transition-colors duration-150 pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:[s.jsx(Xt,{className:"size-4"}),v&&s.jsxs("span",{className:"tabular-nums",children:["+",a]})]})})}),s.jsx(U,{side:"top",children:v?`Chat details, ${a} more`:"Chat details"})]})}),s.jsxs(be,{side:"top",align:"end",className:"w-80 p-3","aria-label":"Chat",children:[s.jsx(ve,{children:"Chat"}),o&&s.jsx(F,{variant:"secondary",className:"mb-3 w-full",disabled:o.pending,onClick:()=>{o.onAction(),t(!1)},children:o.label}),s.jsxs("div",{className:"flex flex-col gap-4",children:[u&&s.jsxs("section",{className:"space-y-1","data-testid":"session-add-ons",children:[s.jsx("h3",{className:"text-muted-foreground px-1 text-xs font-medium tracking-wide uppercase",children:"Add-ons"}),u]}),d.map(l=>s.jsxs("section",{className:"space-y-1",children:[s.jsx("h3",{className:"text-muted-foreground px-1 text-xs font-medium tracking-wide uppercase",children:l.label}),Br($r(l.items,r),f?i:null).map(x=>s.jsx(Gr,{item:x,value:Pr(x.key,n),pinned:y.has(x.key),onTogglePin:vs(x)?()=>p(x.key):null,control:Fr(x.key,r)},x.key)),l.group==="diagnostics"&&s.jsxs(s.Fragment,{children:[s.jsx(Ge,{label:"Queued messages",value:String(n.queueDepth)}),s.jsx(Ge,{label:"Chat ID",value:n.sessionId||"—"})]})]},l.group))]}),n.sessionId!==""&&s.jsxs(F,{variant:"ghost",size:"sm",className:"text-muted-foreground mt-3 h-7 w-full justify-start gap-1.5 text-xs",onClick:()=>{t(!1),Yt({sessionId:n.sessionId})},children:[s.jsx(Vt,{className:"size-3.5","aria-hidden":!0}),"View notifications"]}),s.jsxs("div",{className:"mt-4 flex items-center justify-between gap-2",children:[s.jsx(zr,{diagnostics:n}),s.jsxs(F,{variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 text-xs",disabled:m.length===0,onClick:c,children:[s.jsx(Jt,{className:"size-3.5","aria-hidden":!0}),"Reset pins"]})]})]})]})}function Br(e,t){return t?[...e].sort((n,r)=>r.severity(t)-n.severity(t)):e}function $r(e,t){return e.filter(n=>n.key!=="plan"||t.plan!==null)}function Fr(e,t){return e==="plan"&&t.plan?s.jsx(en,{checked:t.plan.active,onCheckedChange:t.plan.onToggle,"aria-label":"Plan first, change nothing until approved"}):null}function Gr({item:e,value:t,pinned:n,onTogglePin:r,control:i}){const o=e.icon;return s.jsxs("div",{"data-testid":`session-row-${e.key}`,className:"flex items-center gap-2 px-1 py-1 text-sm",children:[s.jsx(o,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"shrink-0",children:e.label}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("span",{className:"text-muted-foreground truncate text-xs",title:t??void 0,children:t??"—"}),i,r&&s.jsx("button",{type:"button",onClick:r,"aria-pressed":n,"aria-label":n?`Stop keeping ${e.label} in the status bar`:`Keep ${e.label} in the status bar`,className:k("hover:text-foreground inline-flex size-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150",n?"text-foreground":"text-muted-foreground/50"),children:n?s.jsx(ss,{className:"size-3.5"}):s.jsx(Zt,{className:"size-3.5"})})]})}function Ge({label:e,value:t}){return s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-sm",children:[s.jsx("span",{className:"w-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"shrink-0",children:e}),s.jsx("span",{className:"min-w-0 flex-1"}),s.jsx("span",{className:"text-muted-foreground truncate text-xs",title:t,children:t})]})}function Bi(e){const t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]),h.useEffect(()=>{const n=r=>{const i=r.key==="."||r.key===">";(r.metaKey||r.ctrlKey)&&r.shiftKey&&i&&(r.preventDefault(),t.current())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[])}function Hr(e){const t=new Map;for(const r of e){if(r.type!=="subagent_update")continue;const i=t.get(r.taskId);t.set(r.taskId,{taskId:r.taskId,status:r.status,description:r.description??(i==null?void 0:i.description),toolUses:r.toolUses??(i==null?void 0:i.toolUses),lastToolName:r.lastToolName??(i==null?void 0:i.lastToolName),summary:r.summary??(i==null?void 0:i.summary),ambient:r.ambient??(i==null?void 0:i.ambient)})}const n=[];for(const{ambient:r,...i}of t.values())kn({ambient:r,status:i.status})||n.push(i);return n}function $i(e){const t=[],n=[];for(const r of e)r.status==="running"?t.push(r):n.push(r);return{running:t,finished:n}}const He=new WeakMap;function We(e,t,n){let r=He.get(e);r||(r=new Set,He.set(e,r)),!r.has(t)&&(r.add(t),n())}function qe(e,t,n){let r;try{r=n()}catch(i){return We(e,`${t}:throw`,()=>console.warn(`[extensions] ${e.extensionId}'s status-bar item "${e.id}" threw in ${t}(); it is hidden until it stops throwing.`,i)),!1}return typeof r!="boolean"?(We(e,`${t}:type`,()=>console.warn(`[extensions] ${e.extensionId}'s status-bar item "${e.id}": ${t}() must return true or false, synchronously, reading only its ctx; it returned ${Wr(r)}, read as false.`)),!1):r}function Wr(e){return e instanceof Promise?"a Promise":e===null?"null":typeof e=="object"?"an object":`a ${typeof e}`}function qr(e,t){const n=[],r=[];for(const i of e){const o=i.when?qe(i,"when",()=>i.when(t)):!0,a=o&&i.urgent?qe(i,"urgent",()=>i.urgent(t)):!1;n.push({id:i.id,visible:o,urgent:a}),o&&r.push(i)}return r.sort((i,o)=>(i.priority??0)-(o.priority??0)),{promotion:n,visible:r}}function Fi(e){const t=sn("status-bar");return h.useMemo(()=>qr(t,e),[t,e])}function Qr(e){return e!=null&&e!==!1}function Gi({ctx:e,pins:t,nodes:n}){var o;const r=new Set(t),i=[];for(const a of bs){if(a.neverInLine)continue;const u=n[a.key];if(!Qr(u))continue;const f=r.has(a.key)&&vs(a);!f&&!a.promote(e)||i.push({key:a.key,cluster:a.cluster,severity:a.severity(e),pinned:f,rigid:a.rigid===!0,wide:((o=a.wide)==null?void 0:o.call(a,e))===!0,node:u})}return i}const Qe=648,Kr=440,Xr=340,Vr=3,Yr=3,Jr=2,Zr=4,ei=8,si=20,ti=oe*ei+si,ni=Number.POSITIVE_INFINITY,Ke=[],ri=["cwd"],Xe=["cwd","git"];function ii(e){if(e===null||e<=0)return{density:"full",rightBudget:ni,dropped:Ke};if(e>=Qe){const t=Math.floor((e-Qe)/ti);return{density:"full",rightBudget:Zr+t,dropped:Ke}}return e>=Kr?{density:"compact",rightBudget:Vr,dropped:ri}:e>=Xr?{density:"identity",rightBudget:Yr,dropped:Xe}:{density:"avatar",rightBudget:Jr,dropped:Xe}}function ai(e,t){return t.severity!==e.severity?t.severity-e.severity:Number(t.pinned)-Number(e.pinned)}const oi=2,li=2;function Hi(e,t){const n=new Set(t.dropped),r=e.filter(u=>u.cluster==="right"),i=new Set;let o=0,a=0;for(const u of[...r].sort(ai)){if(a>=t.rightBudget)break;u.rigid&&o>=oi||(u.rigid&&(o+=1),i.add(u.key),a+=u.wide?Math.min(li,t.rightBudget-a):1)}return{items:e.filter(u=>u.cluster==="right"?i.has(u.key):!n.has(u.key)),overflow:r.length-i.size}}function Wi(){const e=h.useRef(null),[t,n]=h.useState(null);h.useLayoutEffect(()=>{const i=e.current;if(!i)return;n(i.getBoundingClientRect().width);const o=new ResizeObserver(a=>{var m,p;const u=a.at(0);if(!u)return;const f=((p=(m=u.contentBoxSize)==null?void 0:m.at(0))==null?void 0:p.inlineSize)??u.contentRect.width;n(f)});return o.observe(i),()=>o.disconnect()},[]);const r=h.useMemo(()=>ii(t),[t]);return{ref:e,budget:r}}const ci=[];function qi(e){const t=tn(e),n=h.useMemo(()=>Dn(t),[t]),r=Pn(e)==="streaming",i=$(h.useCallback(M=>{var C;return((C=M.sessions[e])==null?void 0:C.sessionStatus)??null},[e])),o=nn(e),a=zn(e||null,i,r,o.runtime),u=$(h.useCallback(M=>{var C;return((C=M.sessions[e])==null?void 0:C.contextUsage)??null},[e])),f=$(rn(M=>{var b;const C=(b=M.sessions[e])==null?void 0:b.sessionStatus;return!(C!=null&&C.cacheReadTokens)&&!(C!=null&&C.cacheCreationTokens)?null:{cacheReadTokens:C.cacheReadTokens??0,cacheCreationTokens:C.cacheCreationTokens??0,contextTokens:C.contextTokens}})),m=n.cacheStatus??f,{data:p}=Kn(a.cwd),{data:c}=Bn(e),{data:d}=ne(),y=an(e),v=Ve(e),l=on(e),x=ln(e),N=cn(e),w=Ye(e),g=un(e).length,T=dn(e),A=h.useMemo(()=>{let M=null;return()=>M??(M=Hr(T))},[T]),_=(t==null?void 0:t.runningSubagentCount)??null,E=h.useMemo(()=>Vn(p),[p]),O=gs(n.contextPercent??a.contextPercent,u),D=(o.model??n.model??a.model)||null;return h.useMemo(()=>({sessionId:e,cwd:a.cwd,git:E,runtime:o.runtime,model:D,selectedModel:a.model||null,effort:a.effort??null,fastMode:a.fastMode,permissionMode:a.permissionMode,contextPercent:O,contextUsage:u,cache:m?{readTokens:m.cacheReadTokens,creationTokens:m.cacheCreationTokens,contextTokens:m.contextTokens}:null,usage:n.usage,connectionState:y,streaming:r,lifecycle:v??null,triggerPending:w,lastEventSeq:l,snapshotCursor:N,lastEventAt:x,queueDepth:g,subagents:c??ci,get activeSubagents(){return A()},runningSubagentCount:_,clientVersion:(d==null?void 0:d.version)??null}),[e,a.cwd,a.model,a.effort,a.fastMode,a.permissionMode,E,o.runtime,D,O,u,m,n,y,v,r,w,l,N,x,g,c,A,_,d==null?void 0:d.version])}export{Ai as A,Wi as B,zr as C,_i as D,yi as E,hs as F,Ti as G,zn as H,Ln as I,bi as J,kn as K,er as M,ki as P,wi as R,zi as S,Pi as U,kr as a,Ii as b,Ss as c,Di as d,Si as e,Oi as f,Mi as g,Ri as h,vi as i,Ui as j,Hi as k,qr as l,Ir as m,Li as n,Xn as o,$i as p,Mr as q,ii as r,Gi as s,Fi as t,qi as u,Kn as v,Ci as w,Ei as x,Bi as y,_r as z};
@@ -1 +1 @@
1
- import{a1 as a,a2 as l,a3 as r,ap as o,a4 as s}from"./index-DcZPWi_I.js";import{B as d}from"./use-bindings-CpyT6kNu.js";const u=["relay","unclaimed-chats"];function m(e){return[...u,e]}function y(e="pending",t=!0){const n=a();return l({queryKey:m(e),queryFn:()=>n.listUnclaimedChats(e),enabled:t})}function U(){const e=r(),t=()=>{e.invalidateQueries({queryKey:[...u]})};o("relay_chat_unclaimed",t),o("relay_chat_unclaimed_burst",t)}function i(e){e.invalidateQueries({queryKey:[...u]})}function p(){const e=a(),t=r();return s({mutationFn:({id:n,input:c})=>e.claimUnclaimedChat(n,c),meta:{suppressErrorToast:!0},onSuccess:()=>{i(t),t.invalidateQueries({queryKey:[...d]})}})}function v(){const e=a(),t=r();return s({mutationFn:n=>e.ignoreUnclaimedChat(n),meta:{errorLabel:"Couldn’t ignore this chat"},onSuccess:()=>i(t)})}function f(){const e=a(),t=r();return s({mutationFn:n=>e.blockUnclaimedChat(n),meta:{errorLabel:"Couldn’t block this chat"},onSuccess:()=>i(t)})}function q(){const e=a(),t=r();return s({mutationFn:n=>e.leaveUnclaimedChat(n),meta:{errorLabel:"Couldn’t leave this chat"},onSuccess:()=>i(t)})}export{u as U,U as a,p as b,v as c,f as d,q as e,y as u};
1
+ import{a1 as a,a2 as l,a3 as r,ap as o,a4 as s}from"./index-DBdO-_iL.js";import{B as d}from"./use-bindings-DiFC7kWg.js";const u=["relay","unclaimed-chats"];function m(e){return[...u,e]}function y(e="pending",t=!0){const n=a();return l({queryKey:m(e),queryFn:()=>n.listUnclaimedChats(e),enabled:t})}function U(){const e=r(),t=()=>{e.invalidateQueries({queryKey:[...u]})};o("relay_chat_unclaimed",t),o("relay_chat_unclaimed_burst",t)}function i(e){e.invalidateQueries({queryKey:[...u]})}function p(){const e=a(),t=r();return s({mutationFn:({id:n,input:c})=>e.claimUnclaimedChat(n,c),meta:{suppressErrorToast:!0},onSuccess:()=>{i(t),t.invalidateQueries({queryKey:[...d]})}})}function v(){const e=a(),t=r();return s({mutationFn:n=>e.ignoreUnclaimedChat(n),meta:{errorLabel:"Couldn’t ignore this chat"},onSuccess:()=>i(t)})}function f(){const e=a(),t=r();return s({mutationFn:n=>e.blockUnclaimedChat(n),meta:{errorLabel:"Couldn’t block this chat"},onSuccess:()=>i(t)})}function q(){const e=a(),t=r();return s({mutationFn:n=>e.leaveUnclaimedChat(n),meta:{errorLabel:"Couldn’t leave this chat"},onSuccess:()=>i(t)})}export{u as U,U as a,p as b,v as c,f as d,q as e,y as u};
@@ -0,0 +1 @@
1
+ import{a1 as n,a3 as s,a4 as u,at as o,au as r}from"./index-DBdO-_iL.js";function c(){const t=n(),e=s();return u({mutationKey:o,mutationFn:a=>t.updateConfig(a),onSuccess:()=>{e.invalidateQueries({queryKey:r.current()})}})}export{c as u};
@@ -1 +1 @@
1
- import{a3 as f,r as n,an as i,ao as o}from"./index-DcZPWi_I.js";function a(r,u){return r.findAll(u.filters).map(e=>u.select?u.select(e):e.state)}function x(r={},u){const e=f(u).getMutationCache(),c=n.useRef(r),t=n.useRef(null);return t.current===null&&(t.current=a(e,r)),n.useEffect(()=>{c.current=r}),n.useSyncExternalStore(n.useCallback(l=>e.subscribe(()=>{const s=i(t.current,a(e,c.current));t.current!==s&&(t.current=s,o.schedule(l))}),[e]),()=>t.current,()=>t.current)}export{x as u};
1
+ import{a3 as f,r as n,an as i,ao as o}from"./index-DBdO-_iL.js";function a(r,u){return r.findAll(u.filters).map(e=>u.select?u.select(e):e.state)}function x(r={},u){const e=f(u).getMutationCache(),c=n.useRef(r),t=n.useRef(null);return t.current===null&&(t.current=a(e,r)),n.useEffect(()=>{c.current=r}),n.useSyncExternalStore(n.useCallback(l=>e.subscribe(()=>{const s=i(t.current,a(e,c.current));t.current!==s&&(t.current=s,o.schedule(l))}),[e]),()=>t.current,()=>t.current)}export{x as u};
@@ -1,4 +1,4 @@
1
- import{g as Ni}from"./chunk-XXDRQBXY-E0nvzXiG.js";import{s as Ci}from"./chunk-VQ5W62QI-CWoRr0H2.js";import{g as Zs,s as jt,a as Qs,b as Gt,v as bi,t as vi,_ as u,E as je,l as _i,c as en,q as Mi,r as xi,u as wi,j as Ui,A as Pi,P as Di,D as Fi,M as Bi,F as $i,K as ji,bj as Gi}from"./mermaid.core-dpp59v7L.js";import{s as Wi}from"./transform-BqqRT-Iy.js";import"./index-DcZPWi_I.js";import"./BlintzCanvas-DoAZs5bz.js";import"./index-B6dEbNhI.js";import"./index-mFOJXyAE.js";function Wt(s){console&&console.error&&console.error(`Error: ${s}`)}function tn(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function sn(s){const e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function nn(s){function e(){}e.prototype=s;const t=new e;function n(){return typeof t.bar}return n(),n(),s}function Ki(s){return Vi(s)?s.LABEL:s.name}function Vi(s){return typeof s.LABEL=="string"&&s.LABEL!==""}class te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class K extends te{constructor(e){super([]),this.idx=1,Object.assign(this,ie(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _e extends te{constructor(e){super(e.definition),this.orgText="",Object.assign(this,ie(e))}}class W extends te{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,ie(e))}}class G extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class se extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class ne extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class x extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class J extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class Z extends te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,ie(e))}}class k{constructor(e){this.idx=1,Object.assign(this,ie(e))}accept(e){e.visit(this)}}function zi(s){return s.map(at)}function at(s){function e(t){return t.map(at)}if(s instanceof K){const t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof W)return{type:"Alternative",definition:e(s.definition)};if(s instanceof G)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof se)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof J)return{type:"RepetitionWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof x)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof Z)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof k){const t={type:"Terminal",name:s.terminalType.name,label:Ki(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);const n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof _e)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function ie(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}class Me{visit(e){const t=e;switch(t.constructor){case K:return this.visitNonTerminal(t);case W:return this.visitAlternative(t);case G:return this.visitOption(t);case se:return this.visitRepetitionMandatory(t);case ne:return this.visitRepetitionMandatoryWithSeparator(t);case J:return this.visitRepetitionWithSeparator(t);case x:return this.visitRepetition(t);case Z:return this.visitAlternation(t);case k:return this.visitTerminal(t);case _e:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Hi(s){return s instanceof W||s instanceof G||s instanceof x||s instanceof se||s instanceof ne||s instanceof J||s instanceof k||s instanceof _e}function Tt(s,e=[]){return s instanceof G||s instanceof x||s instanceof J?!0:s instanceof Z?s.definition.some(n=>Tt(n,e)):s instanceof K&&e.includes(s)?!1:s instanceof te?(s instanceof K&&e.push(s),s.definition.every(n=>Tt(n,e))):!1}function Xi(s){return s instanceof Z}function ee(s){if(s instanceof K)return"SUBRULE";if(s instanceof G)return"OPTION";if(s instanceof Z)return"OR";if(s instanceof se)return"AT_LEAST_ONE";if(s instanceof ne)return"AT_LEAST_ONE_SEP";if(s instanceof J)return"MANY_SEP";if(s instanceof x)return"MANY";if(s instanceof k)return"CONSUME";throw Error("non exhaustive match")}class kt{walk(e,t=[]){e.definition.forEach((n,i)=>{const a=e.definition.slice(i+1);if(n instanceof K)this.walkProdRef(n,a,t);else if(n instanceof k)this.walkTerminal(n,a,t);else if(n instanceof W)this.walkFlat(n,a,t);else if(n instanceof G)this.walkOption(n,a,t);else if(n instanceof se)this.walkAtLeastOne(n,a,t);else if(n instanceof ne)this.walkAtLeastOneSep(n,a,t);else if(n instanceof J)this.walkManySep(n,a,t);else if(n instanceof x)this.walkMany(n,a,t);else if(n instanceof Z)this.walkOr(n,a,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);e.definition.forEach(a=>{const r=new W({definition:[a]});this.walk(r,i)})}}function ys(s,e,t){return[new G({definition:[new k({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function qe(s){if(s instanceof K)return qe(s.referencedRule);if(s instanceof k)return Ji(s);if(Hi(s))return Yi(s);if(Xi(s))return qi(s);throw Error("non exhaustive match")}function Yi(s){let e=[];const t=s.definition;let n=0,i=t.length>n,a,r=!0;for(;i&&r;)a=t[n],r=Tt(a),e=e.concat(qe(a)),n=n+1,i=t.length>n;return[...new Set(e)]}function qi(s){const e=s.definition.map(t=>qe(t));return[...new Set(e.flat())]}function Ji(s){return[s.terminalType]}const an="_~IN~_";class Zi extends kt{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ea(e.referencedRule,e.idx)+this.topProd.name,a=t.concat(n),r=new W({definition:a}),o=qe(r);this.follows[i]=o}}function Qi(s){const e={};return s.forEach(t=>{const n=new Zi(t).startWalking();Object.assign(e,n)}),e}function ea(s,e){return s.name+e+an}function y(s){return s.charCodeAt(0)}function Pt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;s[e],s[e]=!0}function Se(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ta(){throw Error("Internal Error - Should never get here!")}function Rs(s){return s.type==="Character"}const gt=[];for(let s=y("0");s<=y("9");s++)gt.push(s);const At=[y("_")].concat(gt);for(let s=y("a");s<=y("z");s++)At.push(s);for(let s=y("A");s<=y("Z");s++)At.push(s);const Os=[y(" "),y("\f"),y(`
1
+ import{g as Ni}from"./chunk-XXDRQBXY-BpqBecnj.js";import{s as Ci}from"./chunk-VQ5W62QI-CJP11I5o.js";import{g as Zs,s as jt,a as Qs,b as Gt,v as bi,t as vi,_ as u,E as je,l as _i,c as en,q as Mi,r as xi,u as wi,j as Ui,A as Pi,P as Di,D as Fi,M as Bi,F as $i,K as ji,bj as Gi}from"./mermaid.core-Br9hJ7FR.js";import{s as Wi}from"./transform-BqqRT-Iy.js";import"./index-DBdO-_iL.js";import"./BlintzCanvas-BEtRmEbL.js";import"./index-CodC2rG4.js";import"./index-CocSe_I3.js";function Wt(s){console&&console.error&&console.error(`Error: ${s}`)}function tn(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function sn(s){const e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function nn(s){function e(){}e.prototype=s;const t=new e;function n(){return typeof t.bar}return n(),n(),s}function Ki(s){return Vi(s)?s.LABEL:s.name}function Vi(s){return typeof s.LABEL=="string"&&s.LABEL!==""}class te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class K extends te{constructor(e){super([]),this.idx=1,Object.assign(this,ie(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _e extends te{constructor(e){super(e.definition),this.orgText="",Object.assign(this,ie(e))}}class W extends te{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,ie(e))}}class G extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class se extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class ne extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class x extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class J extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class Z extends te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,ie(e))}}class k{constructor(e){this.idx=1,Object.assign(this,ie(e))}accept(e){e.visit(this)}}function zi(s){return s.map(at)}function at(s){function e(t){return t.map(at)}if(s instanceof K){const t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof W)return{type:"Alternative",definition:e(s.definition)};if(s instanceof G)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof se)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof J)return{type:"RepetitionWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof x)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof Z)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof k){const t={type:"Terminal",name:s.terminalType.name,label:Ki(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);const n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof _e)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function ie(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}class Me{visit(e){const t=e;switch(t.constructor){case K:return this.visitNonTerminal(t);case W:return this.visitAlternative(t);case G:return this.visitOption(t);case se:return this.visitRepetitionMandatory(t);case ne:return this.visitRepetitionMandatoryWithSeparator(t);case J:return this.visitRepetitionWithSeparator(t);case x:return this.visitRepetition(t);case Z:return this.visitAlternation(t);case k:return this.visitTerminal(t);case _e:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Hi(s){return s instanceof W||s instanceof G||s instanceof x||s instanceof se||s instanceof ne||s instanceof J||s instanceof k||s instanceof _e}function Tt(s,e=[]){return s instanceof G||s instanceof x||s instanceof J?!0:s instanceof Z?s.definition.some(n=>Tt(n,e)):s instanceof K&&e.includes(s)?!1:s instanceof te?(s instanceof K&&e.push(s),s.definition.every(n=>Tt(n,e))):!1}function Xi(s){return s instanceof Z}function ee(s){if(s instanceof K)return"SUBRULE";if(s instanceof G)return"OPTION";if(s instanceof Z)return"OR";if(s instanceof se)return"AT_LEAST_ONE";if(s instanceof ne)return"AT_LEAST_ONE_SEP";if(s instanceof J)return"MANY_SEP";if(s instanceof x)return"MANY";if(s instanceof k)return"CONSUME";throw Error("non exhaustive match")}class kt{walk(e,t=[]){e.definition.forEach((n,i)=>{const a=e.definition.slice(i+1);if(n instanceof K)this.walkProdRef(n,a,t);else if(n instanceof k)this.walkTerminal(n,a,t);else if(n instanceof W)this.walkFlat(n,a,t);else if(n instanceof G)this.walkOption(n,a,t);else if(n instanceof se)this.walkAtLeastOne(n,a,t);else if(n instanceof ne)this.walkAtLeastOneSep(n,a,t);else if(n instanceof J)this.walkManySep(n,a,t);else if(n instanceof x)this.walkMany(n,a,t);else if(n instanceof Z)this.walkOr(n,a,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);e.definition.forEach(a=>{const r=new W({definition:[a]});this.walk(r,i)})}}function ys(s,e,t){return[new G({definition:[new k({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function qe(s){if(s instanceof K)return qe(s.referencedRule);if(s instanceof k)return Ji(s);if(Hi(s))return Yi(s);if(Xi(s))return qi(s);throw Error("non exhaustive match")}function Yi(s){let e=[];const t=s.definition;let n=0,i=t.length>n,a,r=!0;for(;i&&r;)a=t[n],r=Tt(a),e=e.concat(qe(a)),n=n+1,i=t.length>n;return[...new Set(e)]}function qi(s){const e=s.definition.map(t=>qe(t));return[...new Set(e.flat())]}function Ji(s){return[s.terminalType]}const an="_~IN~_";class Zi extends kt{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ea(e.referencedRule,e.idx)+this.topProd.name,a=t.concat(n),r=new W({definition:a}),o=qe(r);this.follows[i]=o}}function Qi(s){const e={};return s.forEach(t=>{const n=new Zi(t).startWalking();Object.assign(e,n)}),e}function ea(s,e){return s.name+e+an}function y(s){return s.charCodeAt(0)}function Pt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;s[e],s[e]=!0}function Se(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ta(){throw Error("Internal Error - Should never get here!")}function Rs(s){return s.type==="Character"}const gt=[];for(let s=y("0");s<=y("9");s++)gt.push(s);const At=[y("_")].concat(gt);for(let s=y("a");s<=y("z");s++)At.push(s);for(let s=y("A");s<=y("Z");s++)At.push(s);const Os=[y(" "),y("\f"),y(`
2
2
  `),y("\r"),y(" "),y("\v"),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y("\u2028"),y("\u2029"),y(" "),y(" "),y(" "),y("\uFEFF")],sa=/[0-9a-fA-F]/,tt=/[0-9]/,na=/[1-9]/;class ia{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Fe(n,"global");break;case"i":Fe(n,"ignoreCase");break;case"m":Fe(n,"multiLine");break;case"u":Fe(n,"unicode");break;case"y":Fe(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Se(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return ta()}quantifier(e=!1){let t;const n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),t={atLeast:i,atMost:a}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Se(t);break}if(!(e===!0&&t===void 0)&&Se(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Se(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[y(`
3
3
  `),y("\r"),y("\u2028"),y("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=gt;break;case"D":e=gt,t=!0;break;case"s":e=Os;break;case"S":e=Os,t=!0;break;case"w":e=At;break;case"W":e=At,t=!0;break}if(Se(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=y("\f");break;case"n":e=y(`
4
4
  `);break;case"r":e=y("\r");break;case"t":e=y(" ");break;case"v":e=y("\v");break}if(Se(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:y("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:y(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
@@ -1,4 +1,4 @@
1
- import{b8 as Wt,s as Kt,g as Ht,v as Yt,t as Xt,a as Zt,b as Jt,_ as S,M as St,R as Qt,ar as $t,ag as te,ah as ee,ai as ne,d as se,A as ie,O as re,P as oe}from"./mermaid.core-dpp59v7L.js";import{s as rt}from"./transform-BqqRT-Iy.js";import"./index-DcZPWi_I.js";import"./BlintzCanvas-DoAZs5bz.js";import"./index-B6dEbNhI.js";import"./index-mFOJXyAE.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(J(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)J(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(J(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)J(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{J(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);J(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Nt(e)}function Ot(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Nt(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Nt(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},D={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Ot(I,s,e,i,h),D=Lt(k,f,M)}const X={};f.forEach(I=>{I.label&&(X[I.sets]=I.label)});function G(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const H=I.sets.map(Q=>{let W=V[Q],Y=k[Q];return W||(W={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+Y.x*C,y:W.y*(1-C)+Y.y*C,radius:W.radius*(1-C)+Y.radius*C}});return wt(H,y)}}const R=B.selectAll(".venn-area").data(f,I=>I.sets),N=R.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=N.append("path"),L=N.append("text").attr("class","label").text(I=>G(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const F=_.selectAll("text").filter(I=>I.sets in D).text(I=>G(I)).attr("x",I=>Math.floor(D[I.sets].x)).attr("y",I=>Math.floor(D[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,G)):F.each("end",ot(k,G)):F.each(ot(k,G)));const A=P(R.exit()).remove();typeof R.transition=="function"&&A.selectAll("path").attrTween("d",q);const Z=A.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),F.style("font-size",p),Z.style("font-size","0px")),{circles:k,textCentres:D,nodes:R,enter:N,update:_,exit:A}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
1
+ import{b8 as Wt,s as Kt,g as Ht,v as Yt,t as Xt,a as Zt,b as Jt,_ as S,M as St,R as Qt,ar as $t,ag as te,ah as ee,ai as ne,d as se,A as ie,O as re,P as oe}from"./mermaid.core-Br9hJ7FR.js";import{s as rt}from"./transform-BqqRT-Iy.js";import"./index-DBdO-_iL.js";import"./BlintzCanvas-BEtRmEbL.js";import"./index-CodC2rG4.js";import"./index-CocSe_I3.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(J(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)J(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(J(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)J(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{J(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);J(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Nt(e)}function Ot(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Nt(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Nt(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},D={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Ot(I,s,e,i,h),D=Lt(k,f,M)}const X={};f.forEach(I=>{I.label&&(X[I.sets]=I.label)});function G(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const H=I.sets.map(Q=>{let W=V[Q],Y=k[Q];return W||(W={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+Y.x*C,y:W.y*(1-C)+Y.y*C,radius:W.radius*(1-C)+Y.radius*C}});return wt(H,y)}}const R=B.selectAll(".venn-area").data(f,I=>I.sets),N=R.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=N.append("path"),L=N.append("text").attr("class","label").text(I=>G(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const F=_.selectAll("text").filter(I=>I.sets in D).text(I=>G(I)).attr("x",I=>Math.floor(D[I.sets].x)).attr("y",I=>Math.floor(D[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,G)):F.each("end",ot(k,G)):F.each(ot(k,G)));const A=P(R.exit()).remove();typeof R.transition=="function"&&A.selectAll("path").attrTween("d",q);const Z=A.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),F.style("font-size",p),Z.style("font-size","0px")),{circles:k,textCentres:D,nodes:R,enter:N,update:_,exit:A}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
2
2
  M`,t,n),e.push(`
3
3
  m`,-s,0),e.push(`
4
4
  a`,s,s,0,1,0,s*2,0),e.push(`