dorkos 0.124.0 → 0.125.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 (344) hide show
  1. package/dist/bin/cli.js +2319 -1483
  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-BH8Ndn3e.js → AboutPage-GdrU2Z3k.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-D1T74VJE.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-7GXGUwd1.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-C-8dACWp.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-CRRs6yil.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
  10. package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-CF5XZmBx.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-BXes2ymU.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-BuXVpWfb.js} +4 -4
  13. package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-DoqoCU4j.js} +1 -1
  14. package/dist/client/assets/ApplyToOverridesDialog-By8jgPX3.js +1 -0
  15. package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
  17. package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BXfjFGvP.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-C-dobEns.js} +4 -4
  19. package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
  22. package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
  23. package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DlCWmwEz.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
  25. package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-S2O_hvwR.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-COOCQFpL.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-PA9T4FZP.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-CnYUWQBS.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-BBpWiN4-.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-sa0Yn2uq.js} +3 -3
  33. package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
  35. package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-BkyUpdZt.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-DAMr1NNY.js} +1 -1
  38. package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Cnzrh08A.js} +2 -2
  39. package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-EAbQtygH.js} +1 -1
  40. package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-BfADALGd.js} +2 -2
  41. package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-CkOBUhOz.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-CvLaSO7V.js} +1 -1
  45. package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-GCk9gfsW.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
  49. package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
  50. package/dist/client/assets/PermissionHistory-DgmFpdJK.js +1 -0
  51. package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DHFt_34a.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-CobRy95S.js} +1 -1
  53. package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
  55. package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
  56. package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
  60. package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
  61. package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-BHUDRYzJ.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
  63. package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
  64. package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
  65. package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
  66. package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-1uOPUCP9.js} +1 -1
  67. package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
  68. package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BEobBuAr.js} +1 -1
  69. package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
  70. package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-BFw2ODM-.js} +2 -2
  71. package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-C0CMgSFx.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
  73. package/dist/client/assets/ToolsPage-dx-rQ2F1.js +2 -0
  74. package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
  75. package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost--UYZoKlJ.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BN2odbqD.js} +1 -1
  77. package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
  78. package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-CAUx4KUI.js} +7 -7
  79. package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
  80. package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
  81. package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-uuqgFA3M.js} +1 -1
  82. package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-CiMsy7bF.js} +1 -1
  83. package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
  84. package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks-BClPai4g.js} +1 -1
  85. package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
  86. package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-BGXkXPhY.js} +4 -4
  87. package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-BwjXkgi1.js} +1 -1
  88. package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
  89. package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
  90. package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
  91. package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
  92. package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-BgJu1gDa.js} +5 -5
  93. package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
  94. package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
  95. package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
  96. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
  97. package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-BZNjpw9v.js} +1 -1
  98. package/dist/client/assets/{arc-CuT6QA_y.js → arc-BbGU9Ctb.js} +1 -1
  99. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
  100. package/dist/client/assets/{banner-DRumuw3F.js → banner-C7kHJJGz.js} +2 -2
  101. package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
  102. package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
  103. package/dist/client/assets/{card-B3CtfC3R.js → card-D4ek-VvX.js} +1 -1
  104. package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
  105. package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
  106. package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
  107. package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
  108. package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
  109. package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
  110. package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
  111. package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
  112. package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
  113. package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
  114. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
  115. package/dist/client/assets/{command-CDKbyppr.js → command-srO4Wv-5.js} +1 -1
  116. package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
  117. package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-CFIu4JtK.js} +1 -1
  118. package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
  119. package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
  120. package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
  121. package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
  122. package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
  123. package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
  124. package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
  125. package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
  126. package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
  127. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
  128. package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
  129. package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-Bxfi7_ss.js} +1 -1
  130. package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
  131. package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-afKaYukD.js} +1 -1
  132. package/dist/client/assets/{file-D40js1Zx.js → file-C-ooqbRY.js} +1 -1
  133. package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-BWWgLsMF.js} +1 -1
  134. package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-BJt8biPY.js} +1 -1
  135. package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
  136. package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
  137. package/dist/client/assets/{form-DlPwEgQH.js → form-LJ2Rf9ny.js} +1 -1
  138. package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-DrUISrHj.js} +1 -1
  139. package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
  140. package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-D5xr7U5P.js} +1 -1
  141. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
  142. package/dist/client/assets/{graph-DROgI3M3.js → graph-DNjxkUSL.js} +1 -1
  143. package/dist/client/assets/{heart-c7u4Ezxt.js → heart-DnR_GX4I.js} +1 -1
  144. package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
  145. package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
  146. package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DdvvVxmq.js} +2 -2
  147. package/dist/client/assets/index-5eNHb7up.js +1 -0
  148. package/dist/client/assets/{index-BVqSmajJ.js → index-5hCWBj-r.js} +1 -1
  149. package/dist/client/assets/{index-Be0OJLWK.js → index-9GoQjBFo.js} +1 -1
  150. package/dist/client/assets/{index-DswGXheF.js → index-ANmu61E0.js} +1 -1
  151. package/dist/client/assets/{index-dyAahqKe.js → index-B0jt7Nng.js} +1 -1
  152. package/dist/client/assets/index-B1gC3xYN.js +1 -0
  153. package/dist/client/assets/{index-DDgOoXP1.js → index-B2wx4J9U.js} +1 -1
  154. package/dist/client/assets/{index-DksjixUS.js → index-BAIKz_P0.js} +1 -1
  155. package/dist/client/assets/{index-CT_pFeX_.js → index-BFecX5dC.js} +1 -1
  156. package/dist/client/assets/{index-CqPRAM_6.js → index-BWQfqbbe.js} +1 -1
  157. package/dist/client/assets/{index-BlyoyIck.js → index-BYeyKNKj.js} +1 -1
  158. package/dist/client/assets/{index-CD8aw6Jb.js → index-Ba9q2CoQ.js} +1 -1
  159. package/dist/client/assets/{index-DeRDq7bD.js → index-Blhsfk7u.js} +1 -1
  160. package/dist/client/assets/{index-mwf7ZNk2.js → index-Bpwvxz0c.js} +1 -1
  161. package/dist/client/assets/{index-CYy1cjtq.js → index-BqKjnd_r.js} +1 -1
  162. package/dist/client/assets/{index-2wezsLA_.js → index-Bri5bZfv.js} +1 -1
  163. package/dist/client/assets/{index-CZmqtJWZ.js → index-BsHyymmC.js} +1 -1
  164. package/dist/client/assets/index-BsmR2hi4.js +23 -0
  165. package/dist/client/assets/index-By-VWzSF.js +43 -0
  166. package/dist/client/assets/{index-D150FXCC.js → index-By8pKNSM.js} +1 -1
  167. package/dist/client/assets/{index-B3eeEDWj.js → index-BzKkoaB1.js} +3 -3
  168. package/dist/client/assets/{index-DaZ1I8s-.js → index-CDGWl8qL.js} +1 -1
  169. package/dist/client/assets/{index-J3Hh1MnL.js → index-CDo6TA8n.js} +1 -1
  170. package/dist/client/assets/{index-DINk1YfD.js → index-CLQIvYHP.js} +1 -1
  171. package/dist/client/assets/{index-D3YeRrne.js → index-CLbs0fcq.js} +1 -1
  172. package/dist/client/assets/{index-DxiRRZRo.js → index-CQ2atcs_.js} +1 -1
  173. package/dist/client/assets/index-CSqz4B0v.js +1 -0
  174. package/dist/client/assets/{index-BizvylBV.js → index-CXWlrRzK.js} +1 -1
  175. package/dist/client/assets/{index-CbHCZsbE.js → index-D-Q7CW4p.js} +1 -1
  176. package/dist/client/assets/index-D0ujPZdD.js +1 -0
  177. package/dist/client/assets/index-D1kQ19Gb.css +1 -0
  178. package/dist/client/assets/index-DHi8-3w0.js +1 -0
  179. package/dist/client/assets/index-DKTd8X7n.js +1053 -0
  180. package/dist/client/assets/{index-D0eJtRlK.js → index-DTuNXPGU.js} +1 -1
  181. package/dist/client/assets/{index-Ccf1XBTs.js → index-DXWsH2Ep.js} +1 -1
  182. package/dist/client/assets/index-DjFFFMc-.js +2 -0
  183. package/dist/client/assets/{index-C7B3eSOP.js → index-DqCxUalt.js} +1 -1
  184. package/dist/client/assets/{index-C5or4L_3.js → index-Ixk2o7yl.js} +1 -1
  185. package/dist/client/assets/{index-AzyLwYS_.js → index-ZYbeRA5f.js} +3 -3
  186. package/dist/client/assets/index-a6ojvFqI.js +1 -0
  187. package/dist/client/assets/{index-DT7pv2iW.js → index-adYd35CJ.js} +1 -1
  188. package/dist/client/assets/{index-DhHobJd3.js → index-ld6lMfGU.js} +1 -1
  189. package/dist/client/assets/{index-DNGNMW3c.js → index-r0stHl-2.js} +1 -1
  190. package/dist/client/assets/index-uIonuakd.js +1 -0
  191. package/dist/client/assets/{index-BEkYBuOq.js → index-xfRcAp50.js} +1 -1
  192. package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-j5KQ_b6S.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
  194. package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-DlVYFFW7.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
  198. package/dist/client/assets/{layers-Cm7coqdo.js → layers-CzyhuVSM.js} +1 -1
  199. package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-DwGE7s99.js} +1 -1
  200. package/dist/client/assets/{link-2-CDJapTSa.js → link-2-CljREnN9.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-D5ZO30FL.js} +1 -1
  202. package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-CN_dGlgE.js} +1 -1
  203. package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-C6OT4gx4.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-DNuzxE7q.js} +4 -4
  205. package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-DlkAPJdd.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
  207. package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-DRPervoL.js} +1 -1
  208. package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-C-Q9ySA7.js} +1 -1
  209. package/dist/client/assets/{package-CUuTl39E.js → package-BVNiaGrb.js} +1 -1
  210. package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-D03bhclt.js} +1 -1
  211. package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
  212. package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DQQVX5tJ.js} +1 -1
  213. package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-CQ16nhYd.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
  216. package/dist/client/assets/{plug-DHQcxt7N.js → plug-CadJyjTp.js} +1 -1
  217. package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
  218. package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
  219. package/dist/client/assets/{progress-4FQQfnS6.js → progress-BB97hlmb.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
  221. package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-B456s96E.js} +1 -1
  222. package/dist/client/assets/{radio-ta5Bw763.js → radio-DrpN3x3S.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
  224. package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
  225. package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
  226. package/dist/client/assets/repeat-DPzic7-j.js +11 -0
  227. package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
  228. package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-aN4p_kDV.js} +2 -2
  229. package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
  230. package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-mHsqEte-.js} +1 -1
  231. package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
  232. package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-DVd6ctli.js} +1 -1
  233. package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CzgTzL0z.js} +2 -2
  234. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
  235. package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-Btfd3Xnx.js} +1 -1
  236. package/dist/client/assets/{signed-in-DctJ2IWe.js → signed-in-gS3tMpTW.js} +1 -1
  237. package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
  238. package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-C7zd1yXt.js} +1 -1
  239. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
  240. package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
  241. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
  242. package/dist/client/assets/{table-BSAvOYPp.js → table-BIdFvzBs.js} +1 -1
  243. package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
  244. package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-DszobEjt.js} +1 -1
  245. package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-xlfZ61jC.js} +1 -1
  246. package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
  247. package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-CytBTafV.js} +1 -1
  248. package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-BPNK3sUh.js} +1 -1
  249. package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-DMQT0qiv.js} +1 -1
  250. package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-PDVdWccW.js} +1 -1
  251. package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
  252. package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-CgTwS83G.js} +1 -1
  253. package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-BoZCIc4h.js} +1 -1
  254. package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
  255. package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
  256. package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-C2seN-V1.js} +1 -1
  257. package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
  258. package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
  259. package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CF0uGQ6e.js} +1 -1
  260. package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CnCeK4gS.js} +1 -1
  261. package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-BtAb14HI.js} +1 -1
  262. package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-B8LHpZTt.js} +1 -1
  263. package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
  264. package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
  265. package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-YV9FVC-a.js} +1 -1
  266. package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-CjtGhz_3.js} +3 -3
  267. package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
  268. package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-CGqANpVO.js} +1 -1
  269. package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-CvU_70WJ.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
  271. package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
  272. package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
  273. package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
  274. package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
  275. package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
  276. package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
  277. package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-BAU_J-u3.js} +1 -1
  278. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
  279. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
  280. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
  281. package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
  282. package/dist/client/index.html +2 -2
  283. package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
  284. package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
  285. package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
  286. package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
  287. package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
  288. package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
  289. package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
  290. package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
  291. package/dist/drizzle/meta/_journal.json +28 -0
  292. package/dist/server/extension-child.cjs +45 -3
  293. package/dist/server/index.js +61358 -29913
  294. package/dist/server/index.js.map +2 -2
  295. package/package.json +9 -9
  296. package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
  297. package/dist/client/assets/AttentionSignalRow-CjjZobp7.js +0 -1
  298. package/dist/client/assets/CanvasFileContent-estXyAbr.js +0 -2
  299. package/dist/client/assets/CanvasModel3dContent-CkOo930M.js +0 -2
  300. package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
  301. package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
  302. package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
  303. package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
  304. package/dist/client/assets/ProfileFields-BebX5oiv.js +0 -1
  305. package/dist/client/assets/RoomSurface-Bg5WV4Ep.js +0 -44
  306. package/dist/client/assets/RuntimeConnectFlow-DjReuQ-T.js +0 -1
  307. package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
  308. package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
  309. package/dist/client/assets/TaskDialogWrapper-qYJPEoSR.js +0 -1
  310. package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
  311. package/dist/client/assets/TopologyGraph-I4_mkMHM.js +0 -30
  312. package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
  313. package/dist/client/assets/_shell._home.index-C8t8cw72.js +0 -3
  314. package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
  315. package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
  316. package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
  317. package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
  318. package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
  319. package/dist/client/assets/channel-DjBlTcCV.js +0 -1
  320. package/dist/client/assets/image-lightbox-DE_fHkw-.js +0 -1
  321. package/dist/client/assets/index-7jby-RRg.js +0 -1
  322. package/dist/client/assets/index-BGqvci3k.js +0 -1
  323. package/dist/client/assets/index-BkoMsjtM.js +0 -2
  324. package/dist/client/assets/index-BqIHtiaE.js +0 -1
  325. package/dist/client/assets/index-Cga0qx1T.js +0 -1033
  326. package/dist/client/assets/index-Ct4At33X.js +0 -1
  327. package/dist/client/assets/index-DCJQGDZk.js +0 -1
  328. package/dist/client/assets/index-DITPwUa9.js +0 -38
  329. package/dist/client/assets/index-DUZrTFYD.css +0 -1
  330. package/dist/client/assets/index-F-vqXYqa.js +0 -1
  331. package/dist/client/assets/index-InEBtYxw.js +0 -23
  332. package/dist/client/assets/primer-trigger-BmV5wjek.js +0 -3
  333. package/dist/client/assets/profile-errors-BSCuj3rT.js +0 -1
  334. package/dist/client/assets/registry-Dc102rws.js +0 -1
  335. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
  336. package/dist/client/assets/terminal-6CdY-T1V.js +0 -6
  337. package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
  338. package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
  339. package/dist/client/assets/use-jump-back-in-Bibj5tVk.js +0 -11
  340. package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
  341. package/dist/client/assets/use-session-canvas-i30oMO_Q.js +0 -25
  342. package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
  343. package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
  344. /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
@@ -1,25 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-CYHsXAcY.js","assets/index-Cga0qx1T.js","assets/index-DUZrTFYD.css","assets/index-DksjixUS.js","assets/index-AzyLwYS_.js","assets/BlintzCanvas-DCXOV_yN.css","assets/CanvasFileContent-estXyAbr.js","assets/rotate-cw-B3rB_YSw.js","assets/query-keys-DeYqUDia.js","assets/index.esm-BFJ9SG0n.js","assets/WidgetErrorCard-cS8yMCxU.js","assets/index-F-vqXYqa.js","assets/card-B3CtfC3R.js","assets/progress-4FQQfnS6.js","assets/markdown-content-m_qereFc.js","assets/table-BSAvOYPp.js","assets/terminal-6CdY-T1V.js","assets/package-CUuTl39E.js","assets/heart-c7u4Ezxt.js","assets/git-branch-BpxhecMq.js","assets/file-text-DgdvRfMk.js","assets/file-D40js1Zx.js","assets/McpAppFrame-C7eYYdI9.js","assets/more-details-ReA2ZFBn.js","assets/CanvasModel3dContent-CkOo930M.js","assets/CanvasCsvContent--Gr7Fe_U.js","assets/index-dyAahqKe.js"])))=>i.map(i=>d[i]);
2
- var en=Object.defineProperty;var Qt=e=>{throw TypeError(e)};var tn=(e,t,r)=>t in e?en(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var te=(e,t,r)=>tn(e,typeof t!="symbol"?t+"":t,r),gt=(e,t,r)=>t.has(e)||Qt("Cannot "+r);var Me=(e,t,r)=>(gt(e,t,"read from private field"),r?r.call(e):t.get(e)),qe=(e,t,r)=>t.has(e)?Qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ve=(e,t,r,n)=>(gt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),be=(e,t,r)=>(gt(e,t,"access private method"),r);import{W as ft,a1 as ae,a2 as rn,a3 as nn,r as p,jp as ht,fH as Z,fS as Q,fL as jt,fO as Be,fI as ce,mp as sn,mq as on,mr as an,aX as Re,c8 as Mt,ms as cn,aW as V,ix as un,j as h,ht as ln,hu as dn,e5 as fn,G as qt,I as hn,fs as pn,fJ as it,c5 as mn,mt as gn,iO as vn,iS as bn,a7 as wn,mu as xn,mv as yr,mw as Ct,mx as ot,my as kr,fG as Kt,mz as yn,mA as kn,mB as jn,gG as J,mC as Cn,mD as On,B as rt,J as jr,gs as Cr,C as Rn,as as En,mE as _n,mF as Sn,mG as er}from"./index-Cga0qx1T.js";import{R as Dn}from"./rotate-cw-B3rB_YSw.js";import{d as Ot}from"./query-keys-DeYqUDia.js";import{T as In,a as Nn,u as Tn}from"./index.esm-BFJ9SG0n.js";import{v as An,a as zn,W as Fn}from"./WidgetErrorCard-cS8yMCxU.js";import{M as Mn}from"./McpAppFrame-C7eYYdI9.js";/**
3
- * @license lucide-react v1.48.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const Or={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};Or.node;const Eo=ft(Or);/**
8
- * @license lucide-react v1.48.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const Rr={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};Rr.node;const qn=ft(Rr);/**
13
- * @license lucide-react v1.48.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const Er={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};Er.node;const Ln=ft(Er);/**
18
- * @license lucide-react v1.48.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const _r={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};_r.node;const Pn=ft(_r);function Bn(e,t){const r=ae();return rn({queryKey:Ot.index(e??""),queryFn:()=>r.getDocIndex(e),enabled:t&&e!==null,refetchOnWindowFocus:!0})}function Wn(){const e=nn();return p.useCallback(t=>{e.invalidateQueries({queryKey:t?Ot.index(t):Ot.all})},[e])}const _e={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},at=ce().min(1).max(128),Te={bridgeGeneration:at},Un=Z({...Te,__dorkosDevtools:Q("capture-result"),requestId:at,dataUrl:ce().max(9e5).optional(),error:ce().max(2048).optional()}),$n=sn.omit({hostOutcome:!0}).extend({...Te,__dorkosDevtools:Q("act-result"),dataUrl:ce().max(9e5).optional()}),Gn=on.extend({status:Be().int().min(0).max(599),durationMs:Be().min(0),responseSize:Be().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:Be().min(0)}),Hn=an.refine(e=>e.timestamp>=0),Vn=ht("__dorkosDevtools",[Z({__dorkosDevtools:Q("hello"),pageInstanceId:at,bridgeVersion:Q(2)}),Z({...Te,__dorkosDevtools:Q("ready"),pageInstanceId:at}),Z({...Te,__dorkosDevtools:Q("navigated")}),Z({...Te,__dorkosDevtools:Q("resource-error")}),Z({...Te,__dorkosDevtools:Q("batch"),seq:Be().int().min(0).max(Number.MAX_SAFE_INTEGER),console:jt(Hn).max(500),network:jt(Gn).max(200)}),Un,$n]);function Jn(e){const t=new Set;let r=0,n=0;const s=a=>(n+=a)<=16384;function o(a){if(!s(2))return!1;for(let i=0;i<a.length;i++){const d=a.charCodeAt(i);if(d>=55296&&d<=56319&&i+1<a.length&&a.charCodeAt(i+1)>=56320&&a.charCodeAt(i+1)<=57343){if(!s(2))return!1;i++;continue}const u=d===34||d===92||[8,9,10,12,13].includes(d)?2:d<32||d>=55296&&d<=57343?6:1;if(!s(u))return!1}return!0}function c(a,i){if(++r>2048||i>8)return!1;if(a===null)return s(4);if(typeof a=="boolean")return s(a?4:5);if(typeof a=="string")return o(a);if(typeof a=="number")return Number.isFinite(a)&&s(String(a).length);if(typeof a!="object"||t.has(a))return!1;const d=Object.getPrototypeOf(a);if(d!==Object.prototype&&d!==null&&d!==Array.prototype)return!1;const u=Array.isArray(a);if(u&&a.length>2048||Object.getOwnPropertySymbols(a).length||!s(2))return!1;t.add(a);let f=0;for(const l in a){if(!Object.prototype.hasOwnProperty.call(a,l))continue;if(++f>2048||u&&(!/^\d+$/.test(l)||Number(l)>=a.length))return!1;const m=Object.getOwnPropertyDescriptor(a,l);if(["__proto__","constructor","prototype"].includes(l)||!("value"in m)||!m.enumerable||f>1&&!s(1)||!u&&(!o(l)||!s(1))||!c(m.value,i+1))return!1}return t.delete(a),!u||f===a.length}try{return c(e,0)}catch{return!1}}function Xn(e){try{if(!e||typeof e!="object")return null;const t=e;if(t.__dorkosDevtools==="capture-result"&&t.dataUrl===void 0&&t.error===void 0)return null;if(t.__dorkosDevtools==="batch"){if(!Array.isArray(t.console)||t.console.length>500||!Array.isArray(t.network)||t.network.length>200)return null;for(const s of t.console){if(!s||typeof s!="object")return null;const o=s.args;if(o!==void 0&&(!Array.isArray(o)||o.length>50||!Jn(o)))return null}}const r=Vn.safeParse(e);if(!r.success)return null;const n=r.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!Sr(n.dataUrl)?null:n}catch{return null}}function Sr(e){if(e.length>9e5||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(e))return null;try{const t=atob(e.slice(e.indexOf(",")+1));if(t.length<24||t.slice(0,8)!==`‰PNG\r
23
- 
24
- `||t.slice(12,16)!=="IHDR")return null;const r=o=>t.charCodeAt(o)*2**24+(t.charCodeAt(o+1)<<16)+(t.charCodeAt(o+2)<<8)+t.charCodeAt(o+3),n=r(16),s=r(20);return n>0&&s>0&&n<=1568&&s<=1568?{width:n,height:s}:null}catch{return null}}let vt=null;async function tr(){return vt===null&&(vt=(await Re(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),vt}let bt=null;async function Zn(){if(bt===null){const e=await Re(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);bt={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return bt}async function rr(e,t,r=()=>{}){if(e.length===0)return{ok:!1,error:"The recording has no frames in it."};r();const{GIFEncoder:n,quantize:s,applyPalette:o}=await Zn();r();const c=e[0],a=e[e.length-1],i=new Uint8ClampedArray(c.data.length+a.data.length);i.set(c.data,0),i.set(a.data,c.data.length);const d=s(i,256),u=n();for(let l=0;l<e.length;l++){r();const m=e[l];if(u.writeFrame(o(m.data,d),m.width,m.height,{...l===0?{palette:d,repeat:0}:{},delay:t.frameMs}),u.bytesView().byteLength>t.maxBytes)return{ok:!1,error:`The recording came out bigger than ${Math.round(t.maxBytes/1024/1024)} MB, so it was not saved.`}}u.finish();const f=u.bytes();return f.byteLength>t.maxBytes?{ok:!1,error:`The recording came out bigger than ${Math.round(t.maxBytes/1024/1024)} MB, so it was not saved.`}:{ok:!0,bytes:f}}async function Yn(e,t,r=()=>{}){const n=[],s=document.createElement("canvas");let o=0,c=0;try{for(let a=0;a<Math.min(e.length,62);a++){r();const i=e[a];if(!Sr(i)){e[a]="";continue}const d=await Kn(i);e[a]="";try{if(r(),!d)continue;if(!o){const l=Math.min(1,Math.min(800,t)/Math.max(d.width,d.height,1));o=Math.max(1,Math.round(d.width*l)),c=Math.max(1,Math.round(d.height*l)),s.width=o,s.height=c}const u=s.getContext("2d",{willReadFrequently:!0});if(!u)return[];u.fillStyle="#ffffff",u.fillRect(0,0,o,c);const f=Math.min(o/d.width,c/d.height);u.drawImage(d,0,0,Math.round(d.width*f),Math.round(d.height*f)),r(),n.push({data:u.getImageData(0,0,o,c).data,width:o,height:c})}finally{d&&(d.src="")}}return n}catch(a){throw n.length=0,a}finally{e.length=0,s.width=0,s.height=0}}function Qn(e,t=()=>{}){const r=document.createElement("canvas"),n=document.createElement("canvas");try{for(let s=0;s<e.length;s++){t();const o=e[s];n.width=o.width,n.height=o.height,r.width=Math.max(1,Math.round(o.width/2)),r.height=Math.max(1,Math.round(o.height/2));const c=n.getContext("2d"),a=r.getContext("2d",{willReadFrequently:!0});if(!c||!a)throw new Error("Canvas pixels are unavailable");c.putImageData(new ImageData(new Uint8ClampedArray(o.data),o.width,o.height),0,0),a.drawImage(n,0,0,r.width,r.height),e[s]={data:a.getImageData(0,0,r.width,r.height).data,width:r.width,height:r.height}}}finally{n.width=n.height=r.width=r.height=0}}function Kn(e){return new Promise(t=>{const r=new Image;r.onload=()=>{r.onload=r.onerror=null,t(r)},r.onerror=()=>{r.onload=r.onerror=null,r.src="",t(null)},r.src=e})}function nr(e,t,r){const n=r.slice().buffer;return{name:e,type:t,size:r.byteLength,arrayBuffer:async()=>n}}function es(e){const t=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(t,r=>r.charCodeAt(0))}const ts=8e3;function rs(e){const t=ae(),r=p.useRef(t);p.useLayoutEffect(()=>{r.current=t});const[n]=Mt(),[s,o]=p.useState(0),c=p.useRef(null),a=p.useRef(new Map),i=p.useRef(null),d=p.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),u=p.useRef(null),f=p.useRef(-1),l=p.useRef(null),m=p.useRef(null),w=p.useRef(!1),g=p.useRef(-1/0),v=p.useRef(!1),N=p.useRef(null),S=p.useRef(0),I=p.useRef(null),z=p.useRef(null),M=p.useRef(!1),L=p.useRef(null),P=p.useRef({...e,sessionId:n}),q=p.useRef(Promise.resolve()),G=p.useRef(()=>{}),re=p.useRef({initialize:x,retire:D,consume:ue,register:B,eligiblePending:ee,refuseRequest:k,live:R,captureFrame:mt,valid:Ke,reportRecordingStart:Ae,cancelReservation:Ut,finish:$t});p.useLayoutEffect(()=>{re.current={initialize:x,retire:D,consume:ue,register:B,eligiblePending:ee,refuseRequest:k,live:R,captureFrame:mt,valid:Ke,reportRecordingStart:Ae,cancelReservation:Ut,finish:$t}});const ge=O=>L.current===O||V.getState().openDocuments.some(b=>b.id===O&&b.openedHere);function y(O,{active:b,activation:E=!1,keepalive:j=!1,reset:T=!1}){if(!O.sessionId)return;const Y={documentId:O.documentId,logicalUrl:O.logicalUrl,bridgeGeneration:O.generation,seq:Math.max(0,f.current),console:[],network:[],active:b,activation:E,instrumented:O.ready&&!O.retired,...T?{reset:!0}:{}};q.current=q.current.then(()=>r.current.ingestDevtoolsCapture(O.sessionId,Y,j?{keepalive:!0}:void 0)).catch(()=>{})}function D(){var E;const O=c.current;O&&(O.retired=!0),c.current=null,u.current!==null&&clearTimeout(u.current),u.current=null,i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0},f.current=-1,g.current=-1/0,v.current=!1;for(const[j,T]of a.current)T.life.sessionId&&T.deadline>Date.now()&&T.kind!=="frame"&&k(j,T.kind,T.life,"The frame changed while this request was pending."),clearTimeout(T.timer),(E=T.resolve)==null||E.call(T,null);a.current.clear(),O&&y(O,{active:!1});const b=N.current;b&&(clearTimeout(b.reservationTimer),b.cancelled=!0,b.abort.abort(),b.frames.length=0,b.finishing||(b.drawn.length=0,N.current=null)),I.current!==null&&cancelAnimationFrame(I.current),I.current=null,S.current=0,o(0)}function x({loadActivation:O,reset:b=!1}={}){var $,se;const E=P.current,j=($=E.iframeRef.current)==null?void 0:$.contentWindow;if(w.current||!j||!E.bridgeEligibility||!E.resolvedSource)return;const T={generation:crypto.randomUUID(),frame:j,sessionId:E.sessionId,documentId:E.documentId,logicalUrl:E.logicalUrl,source:E.resolvedSource,origin:E.bridgeEligibility==="served-document"?"null":E.previewOrigin,ready:!1,activation:!1,retired:!1};c.current=T;const Y=O??(M.current||z.current!==T.documentId&&ge(T.documentId));T.activation=Y,M.current=!1,z.current=T.documentId,y(T,{active:!0,activation:Y,reset:b}),((se=l.current)==null?void 0:se.frame)===j&&l.current.source===E.resolvedSource&&l.current.reload===E.reloadNonce&&l.current.documentId===E.documentId&&l.current.logicalUrl===E.logicalUrl&&j.postMessage({__dorkosDevtools:"init",bridgeGeneration:T.generation},"*")}p.useLayoutEffect(()=>{var j;P.current={...e,sessionId:n};const O={frame:(j=e.iframeRef.current)==null?void 0:j.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},b=m.current;if(!b||Object.keys(O).some(T=>O[T]!==b[T])){const T=!b||b.frame!==O.frame||b.documentId!==O.documentId||b.logicalUrl!==O.logicalUrl||b.source!==O.source||b.reload!==O.reload;m.current=O,w.current=!1,D(),x({reset:T})}});const C=p.useCallback(()=>{var Y,$,se;const{initialize:O,retire:b}=re.current,E=P.current,j=(Y=E.iframeRef.current)==null?void 0:Y.contentWindow,T=($=c.current)!=null&&$.ready?!1:(se=c.current)==null?void 0:se.activation;j&&E.resolvedSource&&(l.current={frame:j,source:E.resolvedSource,reload:E.reloadNonce,documentId:E.documentId,logicalUrl:E.logicalUrl}),w.current=!1,b(),O({loadActivation:T,reset:!0})},[]),A=p.useCallback(()=>{const O=c.current;M.current=!0,L.current=P.current.documentId,O&&G.current({active:!0,activation:!0})},[]);p.useLayoutEffect(()=>{G.current=O=>{c.current&&y(c.current,O)}});function R(O){return c.current===O&&!O.retired}function k(O,b,E,j){if(!E.sessionId)return;const T={requestId:O,bridgeGeneration:E.generation,documentId:E.documentId,hostOutcome:"host",error:j};b==="action"?r.current.postDevtoolsAction(E.sessionId,{...T,ok:!1}).catch(()=>{}):r.current.ingestDevtoolsCapture(E.sessionId,{...T,logicalUrl:E.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],screenshot:{requestId:O,error:j}}).catch(()=>{})}function B(O,b,E,{capture:j=!1,resolve:T,timeoutMs:Y=8e3}={}){if(a.current.size>=_e.pending||a.current.has(O))return null;const $=setTimeout(()=>U(O,se),Y),se={kind:b,life:E,capture:j,deadline:Date.now()+Y,timer:$,resolve:T};return a.current.set(O,se),se}function U(O,b){var E;a.current.get(O)===b&&(a.current.delete(O),clearTimeout(b.timer),(E=b.resolve)==null||E.call(b,null))}function ee(O,b,E){return a.current.get(O)!==b||b.life!==E||!R(E)?!1:Date.now()>=b.deadline?(U(O,b),!1):!0}function ue(O,b,E){const j=a.current.get(O);return!j||j.life!==E||j.kind!==b&&!(b==="capture"&&j.kind==="frame")||!ee(O,j,E)?null:(a.current.delete(O),clearTimeout(j.timer),j)}p.useEffect(()=>{const{initialize:O,retire:b,consume:E}=re.current;function j(){u.current=null;const de=i.current;i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0};const _=c.current;de&&_&&!_.retired&&_.sessionId&&de.bridgeGeneration===_.generation&&r.current.ingestDevtoolsCapture(_.sessionId,de)}function T(de){var Ht,Vt,Jt,Xt;const _=c.current;if(!_||_.retired||de.source!==_.frame||de.origin!==_.origin||((Ht=l.current)==null?void 0:Ht.frame)!==_.frame||l.current.source!==_.source||l.current.reload!==P.current.reloadNonce||l.current.documentId!==_.documentId||l.current.logicalUrl!==_.logicalUrl)return;const F=de.data;if(!F||typeof F!="object"||typeof F.__dorkosDevtools!="string"||!["hello","ready","navigated","resource-error","batch","capture-result","act-result"].includes(F.__dorkosDevtools)||F.__dorkosDevtools!=="hello"&&F.bridgeGeneration!==_.generation)return;const ie=F.__dorkosDevtools==="batch";if(ie){if(!_.ready||!_.sessionId||F.bridgeGeneration!==_.generation||!Number.isSafeInteger(F.seq)||F.seq<0||F.seq<=f.current)return;const H=Date.now();if(H-g.current<_e.batchMs){i.current?i.current.dropped=!0:v.current=!0;return}g.current=H}const W=Xn(F);if(!W){ie&&(v.current=!0);return}if(W.__dorkosDevtools==="hello"){_.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:_.generation},"*");return}if(W.bridgeGeneration!==_.generation)return;if(W.__dorkosDevtools==="ready"){_.ready||(_.ready=!0,_.activation=!1,y(_,{active:!0}));return}if(!_.ready)return;if(W.__dorkosDevtools==="navigated"){w.current=!0,b();return}if(W.__dorkosDevtools==="resource-error"){S.current=Math.min(_e.resourceErrors,S.current+1),I.current===null&&(I.current=requestAnimationFrame(()=>{I.current=null,R(_)&&o(S.current)}));return}if(!_.sessionId)return;if(W.__dorkosDevtools==="batch"){if(W.seq<=f.current)return;f.current=W.seq;const H=i.current??{documentId:_.documentId,logicalUrl:_.logicalUrl,bridgeGeneration:_.generation,seq:W.seq,console:[],network:[]};H.seq=W.seq,v.current&&(H.dropped=!0),v.current=!1;const je=d.current,Zt=new TextEncoder;if(i.current||(je.overheadBytes=Zt.encode(JSON.stringify({...H,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),je.overheadBytes>_e.queueBytes){i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0},v.current=!0;return}for(const[Fe,Qr]of[["console",W.console],["network",W.network]])for(const Kr of Qr){const Yt=Zt.encode(JSON.stringify(Kr)).length;je[Fe].push(Yt),je.entryBytes+=Yt}H.console.push(...W.console),H.network.push(...W.network);const Yr=()=>je.overheadBytes+je.entryBytes+Math.max(0,H.console.length-1)+Math.max(0,H.network.length-1);for(;H.console.length>500||H.network.length>200||Yr()>_e.queueBytes;){H.dropped=!0;const Fe=(((Vt=H.console[0])==null?void 0:Vt.timestamp)??1/0)<=(((Jt=H.network[0])==null?void 0:Jt.timestamp)??1/0)?"console":"network";if(!H[Fe].length)break;H[Fe].shift(),je.entryBytes-=je[Fe].shift()}i.current=H,u.current===null&&(u.current=setTimeout(j,_e.batchMs));return}if(W.__dorkosDevtools==="capture-result"){const H=E(W.requestId,"capture",_);if(!H)return;if(H.kind==="frame"){(Xt=H.resolve)==null||Xt.call(H,W.dataUrl??null);return}r.current.ingestDevtoolsCapture(_.sessionId,{bridgeGeneration:_.generation,documentId:_.documentId,logicalUrl:_.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:W.requestId,dataUrl:W.dataUrl,error:W.error}});return}const ze=E(W.requestId,"action",_);if(!ze)return;const Ee=N.current,Gt=ze.capture&&W.dataUrl!==void 0&&Ee!==null&&Ee.life===_&&Ee.activated&&!Ee.finishing&&!Ee.cancelled&&Ee.frames.length<61;Gt&&Ee.frames.push(W.dataUrl);const{__dorkosDevtools:bo,dataUrl:wo,...Zr}=W;r.current.postDevtoolsAction(_.sessionId,{...Zr,hostOutcome:"page-reported",documentId:_.documentId,captured:Gt||void 0})}window.addEventListener("message",T);const Y=setInterval(()=>G.current({active:!0}),15e3),$=()=>{c.current||O(),G.current({active:!0,activation:!0})},se=()=>{G.current({active:!1,keepalive:!0}),b()},oe=()=>{document.visibilityState==="visible"&&$()};return window.addEventListener("focus",$),window.addEventListener("pagehide",se),window.addEventListener("pageshow",$),document.addEventListener("visibilitychange",oe),()=>{window.removeEventListener("message",T),clearInterval(Y),window.removeEventListener("focus",$),window.removeEventListener("pagehide",se),window.removeEventListener("pageshow",$),document.removeEventListener("visibilitychange",oe),b()}},[]),p.useEffect(()=>cn.subscribeSessionEvent((O,b)=>{if(b.type!=="devtools_capture_request"&&b.type!=="devtools_action_request"&&b.type!=="devtools_recording_request")return;const{register:E,eligiblePending:j,refuseRequest:T,captureFrame:Y,valid:$,finish:se,reportRecordingStart:oe,cancelReservation:de}=re.current,_=c.current;if(!(!(_!=null&&_.ready)||!_.sessionId||_.retired||b.targetClientId!==r.current.clientId||b.documentId!==_.documentId||b.bridgeGeneration!==_.generation)){if(b.type==="devtools_capture_request"||b.type==="devtools_action_request"){const F=b.type==="devtools_action_request",ie=E(b.requestId,F?"action":"capture",_,{capture:F&&!!b.capture,timeoutMs:F&&b.command.action==="wait_for"?Math.min(1e4,b.command.timeoutMs)+2e3:8e3});if(!ie){a.current.has(b.requestId)||T(b.requestId,F?"action":"capture",_,"Too many browser requests are waiting. Try again when one finishes.");return}const W=ze=>{j(b.requestId,ie,_)&&_.frame.postMessage(F?{__dorkosDevtools:"act-request",bridgeGeneration:_.generation,requestId:b.requestId,documentId:_.documentId,command:b.command,...b.capture?{capture:!0,lib:ze}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:_.generation,requestId:b.requestId,lib:ze},"*")};!F||b.capture?tr().then(W,()=>W()):W()}if(b.type==="devtools_recording_request"){if(b.action==="cancel-start"){de(b.recordingId,b.requestId,_);return}if(b.action==="confirm-start"){const F=N.current;if(!F||F.id!==b.recordingId||F.startRequestId!==b.requestId||F.life!==_||F.finishing||!$(F))return;if(!F.activated){if(performance.now()>=F.reservationDeadline){de(F.id,F.startRequestId,_),oe(b,_,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(F.reservationTimer),F.activated=!0,F.startedAt=Date.now(),Y(_).then(ie=>{ie&&$(F)&&F.frames.push(ie)})}oe(b,_,{phase:"started",ok:!0});return}if(b.action==="start"){const F=b.reservationTimeoutMs;if(!Number.isSafeInteger(F)||!F||F<1||F>ts){oe(b,_,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(N.current){oe(b,_,{phase:"reserved",ok:!1,error:"Another recording in this window is still running or being saved. Wait for it to finish, then start again."});return}const ie={id:b.recordingId,startRequestId:b.requestId,activated:!1,reservationDeadline:performance.now()+F,life:_,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};N.current=ie,ie.reservationTimer=setTimeout(()=>{N.current===ie&&!ie.activated&&de(ie.id,ie.startRequestId,_)},F),oe(b,_,{phase:"reserved",ok:!0})}else se(b.requestId,b.recordingId,_)}}}),[]);function Ae(O,b,E){!R(b)||!b.sessionId||r.current.ingestDevtoolsCapture(b.sessionId,{hostOutcome:"host",documentId:b.documentId,bridgeGeneration:b.generation,seq:0,console:[],network:[],recordingStart:{...E,requestId:O.requestId,recordingId:O.recordingId}}).catch(()=>{})}function Ut(O,b,E){var T;const j=N.current;if(!(!j||j.id!==O||j.startRequestId!==b||j.life!==E||j.finishing)){clearTimeout(j.reservationTimer),j.cancelled=!0,j.abort.abort(),j.frames.length=0,j.drawn.length=0;for(const[Y,$]of a.current)$.life===E&&$.kind==="frame"&&(clearTimeout($.timer),(T=$.resolve)==null||T.call($,null),a.current.delete(Y));N.current=null}}function Ke(O){return N.current===O&&!O.cancelled&&R(O.life)}function mt(O){const b=`frame-${crypto.randomUUID()}`;return new Promise(E=>{const j=B(b,"frame",O,{resolve:E});if(!j){E(null);return}tr().then(T=>{ee(b,j,O)&&O.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:O.generation,requestId:b,lib:T},"*")},()=>{U(b,j)})})}async function $t(O,b,E){const j=N.current;if(!j||!j.activated||j.id!==b||j.life!==E){R(E)&&await r.current.uploadDevtoolsRecording(E.sessionId,{requestId:O,bridgeGeneration:E.generation,documentId:E.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(j.finishing)return;j.finishing=!0;const T=()=>{if(!Ke(j))throw new Error("retired")},Y={requestId:O,bridgeGeneration:E.generation,documentId:E.documentId};try{const $=await mt(E);T(),$&&j.frames.length<_e.frames&&j.frames.push($);const se=j.frames.length?es(j.frames[j.frames.length-1]):new Uint8Array;j.drawn=await Yn(j.frames,800,T),T();let oe=await rr(j.drawn,{frameMs:500,maxBytes:8*1024*1024},T);if(T(),!oe.ok&&j.drawn.length&&(Qn(j.drawn,T),oe=await rr(j.drawn,{frameMs:500,maxBytes:8*1024*1024},T),T()),!oe.ok){await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,hostOutcome:"host",error:oe.error},{signal:j.abort.signal}),T();return}T(),await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,frames:j.drawn.length,durationMs:Date.now()-j.startedAt,recording:nr(`${b}.gif`,"image/gif",oe.bytes),keyframe:nr(`${b}.png`,"image/png",se)},{signal:j.abort.signal}),T()}catch{Ke(j)&&await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:j.abort.signal}).catch(()=>{})}finally{j.frames.length=0,j.drawn.length=0,N.current===j&&(N.current=null)}}return{resourceErrorCount:s,notePersonNavigated:A,noteFrameLoaded:C}}const ns=15e3;function ss(e){const t=e instanceof Error?e.message.trim():"";return t.length>0?t:"Couldn’t reach DorkOS. Check your network and try again."}function is(e){const t=ae();return{open:p.useCallback(async r=>{await t.openRoomCanvasDocument(e,r)},[t,e]),update:p.useCallback(async(r,n)=>{await t.updateRoomCanvasDocument(e,r,{content:n})},[t,e]),pin:p.useCallback(async(r,n)=>{await t.updateRoomCanvasDocument(e,r,{pinned:n})},[t,e]),close:p.useCallback(async r=>{await t.closeRoomCanvasDocument(e,r)},[t,e])}}function os(e,t){const r=ae(),n=V(s=>s.setRoomCanvasEditing);p.useEffect(()=>{if(n(e,t),t===null)return;const s=c=>{r.setRoomCanvasEditing(e,t,c).catch(a=>{console.warn("[room-canvas] edit lock failed",{roomId:e,documentId:t,err:a})})};s(!0);const o=setInterval(()=>s(!0),ns);return()=>{clearInterval(o),s(!1),n(e,null)}},[r,e,t,n])}const as=400;function _o(e,t){const r=ae(),n=V(s=>s.roomCanvasPresenceEpoch[e]??0);p.useEffect(()=>{const s=a=>{r.setRoomCanvasViewing(e,a).catch(i=>{console.warn("[room-canvas] could not say where we are looking",{roomId:e,err:i})})};let o=!1;const c=setTimeout(()=>{o=!0,s(t)},as);return()=>{clearTimeout(c),o&&s(null)}},[r,e,t,n])}const cs="allow-scripts allow-forms allow-popups allow-modals",wt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",us=new Set(["javascript:","data:","blob:"]),ls=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function Lt(e){return ls.has(e)||e.endsWith(".localhost")}function ds(e){return Lt(e)?"direct":"server"}function fs(e,t){let r;try{r=new URL(e)}catch{return null}const n=r.searchParams.get(sr),s=new URL(r.origin),o=t.indexOf("?");return s.pathname=(o===-1?t:t.slice(0,o))||"/",s.search=o===-1?"":t.slice(o),n!==null&&s.searchParams.set(sr,n),s.toString()}const sr="__dorkos_preview",hs="/__dorkos_preview/health";function ps(e){return e==="https:"?443:80}function Dr(e){let t;try{t=new URL(e)}catch{return{mode:"serve",path:e}}if(us.has(t.protocol))return{mode:"blocked"};if(t.protocol==="file:")return{mode:"serve",path:decodeURIComponent(t.pathname)};if(t.protocol==="http:"||t.protocol==="https:"){if(Lt(t.hostname)){const r=t.port?Number(t.port):ps(t.protocol);return{mode:"proxy",hostname:t.hostname,port:r,path:`${t.pathname}${t.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function ms(e){const t=e.trim();if(t===""||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))return t;const r=t.split("/")[0];if(t.includes("/")&&!r.includes(".")&&!r.includes(":"))return t;const s=r.split(":")[0];return`${Lt(s)?"http":"https"}://${t}`}function gs(e){const t=Dr(e);if(t.mode==="serve")return{kind:"local",path:t.path};if(t.mode==="blocked")return{kind:"raw",text:e};try{const r=new URL(e),n=r.host.replace(/^www\./,""),s=r.pathname==="/"&&r.search===""&&r.hash===""?"":`${r.pathname}${r.search}${r.hash}`;return{kind:"url",host:n,rest:s}}catch{return{kind:"raw",text:e}}}const vs=2e3;async function ir(e,t=globalThis.fetch,r=vs){const n=new AbortController,s=setTimeout(()=>n.abort(),r);try{return await t(e,{mode:"no-cors",cache:"no-store",signal:n.signal}),!0}catch{return n.signal.aborted}finally{clearTimeout(s)}}function bs({target:e,currentUrl:t,strategy:r,cwd:n,reloadNonce:s}){const o=JSON.stringify([t,r,n,s]),[c,a]=p.useState(null),[i,d]=p.useState(null),[u,f]=p.useState(null),l=ae(),m=p.useRef(l);return p.useEffect(()=>{m.current=l}),p.useEffect(()=>{const w=m.current;let g=!1;const v=z=>{a(o),d(z)};async function N(z){if(n===null){f({kind:"no-session"});return}try{const M=await w.createServeUrl(n,z);if(g)return;M===null?f({kind:"unsupported"}):v({src:M,sandbox:cs,previewOrigin:null,bridgeEligibility:"served-document"})}catch{g||f({kind:"failed"})}}async function S(z,M){let L;try{const q=await w.probeLoopbackPort(z);L=q===null?"unknown":q.listening}catch{L="unknown"}if(g)return;let P=null;if(L!==!1){let q=null;try{q=await w.createProxyUrl(z)}catch{if(g)return;P={kind:"failed"}}if(g)return;if((q==null?void 0:q.unavailable)==="tunnel"){f({kind:"tunnel"});return}if((q==null?void 0:q.unavailable)==="no-port"&&(P={kind:"no-port"}),q!=null&&q.url){const G=new URL(q.url);if(await ir(`${G.origin}${hs}`)){if(g)return;const re=fs(q.url,M);if(re!==null){v({src:re,sandbox:wt,previewOrigin:G.origin,bridgeEligibility:"preview-listener"});return}}if(g)return;P={kind:"origin-unreachable",host:G.hostname,listenPort:G.port}}}if(r==="direct"&&await ir(t)){if(g)return;v({src:t,sandbox:wt,previewOrigin:null,bridgeEligibility:null});return}g||f(P??{kind:"no-upstream"})}async function I(){if(f(null),d(null),e.mode!=="blocked"){if(e.mode==="external"){v({src:e.url,sandbox:wt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?N(e.path):S(e.port,e.path)}}return I(),()=>{g=!0}},[e,t,r,n,s,o]),{resolved:c===o?i:null,resolveError:u}}const ws=1e4;function xs(e,t){if(e&&e.contentUrl===t&&e.stack.length>0){const r=Math.min(Math.max(e.cursor,0),e.stack.length-1);return{stack:e.stack,cursor:r}}return{stack:[t],cursor:0}}function ys({documentId:e,content:t}){const r=V(C=>C.selectedCwd),n=V(C=>C.writeBrowserHistory),[s]=p.useState(()=>xs(V.getState().browserHistories[e],t.url)),[o,c]=p.useState(s.stack),[a,i]=p.useState(s.cursor),[d,u]=p.useState(0);p.useEffect(()=>{n(e,{contentUrl:t.url,stack:o,cursor:a})},[e,t.url,o,a,n]);const f=o[a],l=p.useMemo(()=>Dr(f),[f]),m=p.useMemo(()=>l.mode==="proxy"?ds(window.location.hostname):null,[l]),w=p.useRef(null),{resolved:g,resolveError:v}=bs({target:l,currentUrl:f,strategy:m,cwd:r,reloadNonce:d}),{resourceErrorCount:N,notePersonNavigated:S,noteFrameLoaded:I}=rs({iframeRef:w,documentId:e,logicalUrl:f,reloadNonce:d,previewOrigin:(g==null?void 0:g.previewOrigin)??null,bridgeEligibility:(g==null?void 0:g.bridgeEligibility)??null,resolvedSource:(g==null?void 0:g.src)??null}),z=V(C=>C.roomCanvasLiveRoomId),{open:M}=is(z??""),[L,P]=p.useState(null),q=p.useCallback(C=>{c(A=>[...A.slice(0,a+1),C]),i(A=>A+1)},[a]),G=un(z),re=V(C=>z?C.roomCanvasEditing[z]??null:null);p.useEffect(()=>{if(G===null||re!==null||G.documentId!==e)return;const C=G.url;C===void 0||C===f||q(C)},[G,re,e,f,q]);const ge=a>0,y=a<o.length-1,D=p.useCallback(C=>{const A=ms(C);if(!A||A===f){S(),u(R=>R+1);return}if(z){P(null),M({type:"browser",url:A}).catch(R=>{P({url:A,message:ss(R)})});return}S(),q(A)},[f,q,z,M,S]),x=()=>pn(f);return h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsxs("div",{className:"border-border/60 flex shrink-0 flex-wrap items-center gap-1 border-b px-2 py-1 lg:h-9 lg:flex-nowrap lg:py-0",children:[h.jsx(et,{label:"Back",disabled:!ge,onClick:()=>i(C=>C-1),children:h.jsx(ln,{className:"size-4"})}),h.jsx(et,{label:"Forward",disabled:!y,onClick:()=>i(C=>C+1),children:h.jsx(dn,{className:"size-4"})}),h.jsx(et,{label:"Reload",onClick:()=>u(C=>C+1),children:h.jsx(Dn,{className:"size-4"})}),h.jsx("div",{className:"order-first flex w-full min-w-0 lg:order-none lg:w-auto lg:flex-1",children:h.jsx(ks,{url:(L==null?void 0:L.url)??f,startEditing:L!==null,onSubmit:D},L===null?"address":`retry:${L.url}`)}),h.jsx(et,{label:"Open in system browser",onClick:x,children:h.jsx(fn,{className:"size-4"})})]}),L!==null&&h.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:L.message}),h.jsx(Rs,{target:l,resolved:g,resolveError:v,reloadNonce:d,resourceErrorCount:N,title:t.title??"Embedded browser",onOpenExternally:x,onReload:()=>{S(),u(C=>C+1)},iframeRef:w,onFrameLoad:I})]})}function ks({url:e,startEditing:t=!1,onSubmit:r}){const[n,s]=p.useState(t),[o,c]=p.useState(e);if(!n)return h.jsx(Cs,{url:e,onActivate:()=>{c(e),s(!0)}});const a=i=>{i.preventDefault(),s(!1),r(o)};return h.jsx("form",{onSubmit:a,className:"min-w-0 flex-1",children:h.jsx(hn,{"aria-label":"Address",autoFocus:!0,value:o,onChange:i=>c(i.target.value),onFocus:i=>i.currentTarget.select(),onBlur:()=>s(!1),onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),s(!1))},spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:"h-11 w-full text-base lg:h-7 lg:text-sm"})})}function js(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function Cs({url:e,onActivate:t}){const r=p.useMemo(()=>gs(e),[e]);return h.jsxs("button",{type:"button","aria-label":`Address: ${js(r)}`,onClick:t,className:"text-muted-foreground hover:bg-muted focus-ring flex h-11 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left text-sm transition-colors lg:h-7",children:[r.kind==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"bg-muted-foreground/15 text-3xs rounded px-1 py-0.5 font-medium tracking-wide uppercase",children:"local"}),h.jsx("span",{className:"text-foreground truncate",children:r.path})]}),r.kind==="url"&&h.jsxs("span",{className:"truncate",children:[h.jsx("span",{className:"text-foreground",children:r.host}),h.jsx("span",{className:"text-muted-foreground",children:r.rest})]}),r.kind==="raw"&&h.jsx("span",{className:"truncate",children:r.text})]})}function Os(e,t){switch(e.kind){case"no-session":return"Open a chat to preview local files.";case"unsupported":return"Local previews aren’t available in this environment.";case"failed":return"Couldn’t load this preview. Reload, or open the app in your browser.";case"tunnel":return"Dev server previews don’t work remotely. Open DorkOS on the computer running it.";case"no-port":return"All preview ports are in use. Close a preview, then reload.";case"origin-unreachable":return`This view can’t reach port ${e.listenPort} on ${e.host}. Open DorkOS on the computer running it.`;case"no-upstream":return`Nothing is listening on ${t.mode==="proxy"?`${t.hostname}:${t.port}`:"that address"}. Start the dev server, then reload.`}}function Rs({target:e,resolved:t,resolveError:r,reloadNonce:n,resourceErrorCount:s,title:o,onOpenExternally:c,onReload:a,iframeRef:i,onFrameLoad:d}){if(e.mode==="blocked")return h.jsx(xt,{children:"This address is blocked for safety."});if(r!==null)return h.jsxs(xt,{children:[h.jsx("p",{children:Os(r,e)}),r.kind!=="no-session"&&r.kind!=="unsupported"&&h.jsx("button",{type:"button",onClick:a,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(t===null)return h.jsx(xt,{children:"Loading…"});const u=e.mode==="external";return h.jsx(Es,{src:t.src,sandbox:t.sandbox,title:o,iframeRef:i,onFrameLoad:d,watchLoadDeadline:!u,resourceErrorCount:s,showEmbedFallback:u,onOpenExternally:c,onReload:a},`${t.src}:${n}`)}function Es({src:e,sandbox:t,title:r,iframeRef:n,onFrameLoad:s,watchLoadDeadline:o,resourceErrorCount:c,showEmbedFallback:a,onOpenExternally:i,onReload:d}){const[u,f]=p.useState(!1),[l,m]=p.useState(!1);return p.useEffect(()=>{if(!o)return;const w=setTimeout(()=>m(!0),ws);return()=>clearTimeout(w)},[o]),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[l&&!u&&h.jsx(or,{onOpenExternally:i,onReload:d,children:"This preview is slow to load."}),c>0&&h.jsxs(or,{onOpenExternally:i,children:["This page hit ",c===1e4?"at least 10,000":c," ",c===1?"error":"errors"," while loading."]}),h.jsx("iframe",{ref:n,src:e,sandbox:t,onLoad:()=>{f(!0),s()},className:"min-h-0 w-full flex-1 border-0",title:r}),a&&h.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-t px-3 py-1.5 text-xs",children:[h.jsx("span",{children:"This site can’t always be embedded here."}),h.jsx("button",{type:"button",onClick:i,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function or({children:e,onOpenExternally:t,onReload:r}){return h.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5 text-xs",children:[h.jsx("span",{children:e}),h.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[r&&h.jsx("button",{type:"button",onClick:r,className:"text-foreground hover:underline",children:"Reload"}),h.jsx("button",{type:"button",onClick:t,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function et({label:e,disabled:t,onClick:r,children:n}){return h.jsx("button",{type:"button","aria-label":e,disabled:t,onClick:r,className:qt("text-muted-foreground hover:text-foreground hover:bg-muted focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors lg:size-7",t&&"pointer-events-none opacity-40"),children:n})}function xt({children:e}){return h.jsx("div",{className:"text-muted-foreground flex min-h-0 flex-1 flex-col items-center justify-center p-8 text-center",children:e})}const _s=4096;function Ss(e){return e.toLowerCase().endsWith(".md")?e.slice(0,-3):e}function Ds(e){const t=e.trim(),r=/^(["'])(.*)\1$/.exec(t);return r?r[2].trim():/^[|>][+-]?\d*$/.test(t)?"":t.replace(/\s+#.*$/,"").trim()}function Is(e,t){var o;const r=e.replace(/^\uFEFF/,"").split(/\r?\n/);let n=0;if(r[0]==="---"){for(n=1;n<r.length;n+=1){const c=r[n];if(c==="---"||c==="...")break;const a=/^title:(.*)$/.exec(c);if(a){const i=Ds(a[1]);if(i!=="")return i}}n+=1}let s=null;for(;n<r.length;n+=1){const c=r[n],a=(o=/^ {0,3}(`{3,}|~{3,})/.exec(c))==null?void 0:o[1];if(a){s===null?s=a[0]:a[0]===s&&(s=null);continue}if(s!==null)continue;const i=/^ {0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(c);if(i&&i[1].trim()!=="")return i[1].trim()}return Ss(t)}function Ns(e,t,r=_s){let n=new TextDecoder().decode(e.subarray(0,r));return e.length>=r&&(n=n.slice(0,Math.max(0,n.lastIndexOf(`
25
- `)))),Is(n,t)}function Ts(e,t){return Ns(new TextEncoder().encode(e),t)}const Ir=Z({path:ce().min(1),title:ce(),slug:ce()});Z({root:ce(),docs:jt(Ir),truncated:it()});Z({cwd:ce().min(1)});Z({cwd:ce().min(1),target:ce().min(1).max(1e3),from:ce().min(1).optional()});Z({doc:Ir.nullable(),complete:it()});const Rt=".md";function we(e){return e.normalize("NFC").trim().toLowerCase()}function Nr(e){return we(e).replace(/\s+/g,"-")}function Le(e){return e.toLowerCase().endsWith(Rt)?e.slice(0,-Rt.length):e}function ar(e){return e.slice(e.lastIndexOf("/")+1)}function nt(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function ct(e){return e===""?[]:e.split("/")}function As(e,t){const r=ct(e);for(const n of t.split("/"))if(!(n===""||n==="."))if(n===".."){if(r.length===0)return null;r.pop()}else r.push(n);return r.length===0?null:r.join("/")}function cr(e,t){const r=ct(e),n=ct(t);let s=0;for(;s<r.length&&s<n.length&&r[s]===n[s];)s+=1;return r.length-s+(n.length-s)}function zs(e){return Nr(e).replace(/[^\p{L}\p{N}_-]/gu,"")}function Fs(e,t,r=null){const n=r&&r.trim()!==""?`#${zs(r)}`:"",s=e===null?null:e.normalize("NFC"),o=t.normalize("NFC");if(s===o&&n)return n;const c=ct(s===null?"":nt(s)),a=o.split("/");let i=0;for(;i<c.length&&i<a.length-1&&c[i]===a[i];)i+=1;return[...Array.from({length:c.length-i},()=>".."),...a.slice(i)].map(encodeURIComponent).join("/")+n}const Ms=/[[\]|#\n\r]/,qs=20;function Ls(e){const t=e.map(a=>({doc:a,folder:nt(a.path),path:we(a.path),title:we(a.title),base:we(Le(ar(a.path)))})),r=new Map(t.map(a=>[a.path,a])),n=a=>(i,d)=>cr(a,i.folder)-cr(a,d.folder)||i.doc.path.length-d.doc.path.length||(i.doc.path<d.doc.path?-1:i.doc.path>d.doc.path?1:0);function s(a,i){const d=Le(a),u=a.startsWith("/")?[""]:[i,""];for(const f of u){const l=As(f,d);if(l===null)continue;const m=r.get(we(l+Rt));if(m)return m}}function o(a,i){const d=a.normalize("NFC").trim();if(d==="")return null;const u=i===null?"":nt(i);if(d.includes("/")){const g=s(d,u);if(g)return g}const f=we(d),l=we(Le(d)),m=Nr(l),w=t.filter(g=>g.title===f||g.base===l||g.doc.slug===m);return w.length===0?null:w.sort(n(u))[0]??null}function c(a,i){const d=[a.doc.title.trim(),Le(ar(a.doc.path)),`/${Le(a.doc.path)}`];for(const u of d)if(!(u===""||Ms.test(u))&&o(u,i)===a)return u;return null}return{docs:e,resolve:(a,i)=>{var d;return((d=o(a,i))==null?void 0:d.doc)??null},search(a,i,d=qs){const u=we(a),f=i===null?"":nt(i),l=i===null?null:we(i),m=[];for(const v of t){if(v.path===l)continue;const N=u===""||v.title.startsWith(u)?0:v.title.split(/[\s\-_/]+/).some(S=>S.startsWith(u))?1:v.title.includes(u)?2:v.path.includes(u)?3:-1;N>=0&&m.push({entry:v,score:N})}const w=n(f);m.sort((v,N)=>v.score-N.score||w(v.entry,N.entry));const g=[];for(const{entry:v}of m){if(g.length>=d)break;const N=c(v,i);N!==null&&g.push({target:N,title:v.doc.title,description:v.doc.path})}return g}}}function ur(e,t){const r=t.normalize("NFC").replaceAll("\\","/"),n=r.startsWith("/")||/^[A-Za-z]:\//.test(r);let s=r;if(n){const c=e.normalize("NFC").replaceAll("\\","/").replace(/\/+$/,"");if(!r.startsWith(`${c}/`))return null;s=r.slice(c.length+1)}const o=[];for(const c of s.split("/"))if(!(c===""||c==="."))if(c===".."){if(o.length===0)return null;o.pop()}else o.push(c);return o.length===0?null:o.join("/")}const lr="Links within this doc don’t open.",dr="This folder is too big to check this link.",fr="Couldn’t check this link.";function hr(e,t,r){return{exists:!0,href:Fs(e,t.path,r),title:t.title}}function Ps(e){const{index:t,truncated:r,docPath:n,lookup:s,open:o,refuse:c}=e,a=new Map,i=f=>{const l=f.normalize("NFC").trim().toLowerCase();let m=a.get(l);return m||(m=s(f.trim()).catch(()=>null),a.set(l,m)),m};return{resolve:f=>{if(f.target.trim()==="")return{exists:!1,title:lr};const l=t.resolve(f.target,n);return l?hr(n,l,f.heading):r?i(f.target).then(m=>m===null?{exists:!0,title:fr}:m.doc?hr(n,m.doc,f.heading):m.complete?{exists:!1}:{exists:!0,title:dr}):{exists:!1}},search:f=>t.search(f,n),onOpen:f=>{const l=f.target.trim();if(l===""){c(lr);return}const m=`No doc called “${l}” yet.`,w=t.resolve(l,n);if(w){o(w.path);return}if(!r){c(m);return}i(l).then(g=>{g!=null&&g.doc?o(g.doc.path):c(g===null?fr:g.complete?m:dr)})}}}function Bs({cwd:e,sourcePath:t,content:r="",saved:n=!1}){const{enabled:s}=mn(gn),o=s&&!!e&&!!t,{data:c}=Bn(e,o),a=Wn(),i=ae(),{setTheme:d}=vn(),u=o&&c&&e&&t?ur(e,t)??ur(c.root,t):null,f=p.useMemo(()=>c?Ls(c.docs):null,[c]),l=p.useRef({index:f,docPath:u,content:r,cwd:e});p.useEffect(()=>{l.current={index:f,docPath:u,content:r,cwd:e}}),p.useEffect(()=>{const{index:w,docPath:g,content:v,cwd:N}=l.current;if(!n||!w||g===null)return;const S=w.docs.find(z=>z.path.normalize("NFC").toLowerCase()===g.toLowerCase()),I=g.slice(g.lastIndexOf("/")+1);(!S||S.title!==Ts(v,I))&&a(N)},[n,a]);const m=p.useCallback(w=>{bn({getStore:V.getState,setTheme:d,supportsTerminal:i.supportsTerminal},{action:"open_file",sourcePath:w},"user")},[d,i]);return p.useMemo(()=>{if(!(!f||!c||u===null||!e))return Ps({index:f,truncated:c.truncated,docPath:u,lookup:w=>i.resolveDocLink(e,w,u),open:m,refuse:w=>wn.info(w)})},[f,c,u,e,i,m])}const Je=ce().min(1).max(128),he={protocol:Q("dorkos-doc"),v:Q(1),nonce:Je,requestToken:Je,loadToken:Ct,generation:yr.shape.generation};ht("kind",[Z({...he,kind:Q("challenge")}).strict(),Z({...he,kind:Q("ack")}).strict(),Z({...he,kind:Q("connect")}).strict()]);ht("kind",[Z({...he,kind:Q("emit"),requestId:Je,event:ot}).strict(),Z({...he,kind:Q("retire")}).strict()]);ht("kind",[Z({...he,kind:Q("receipt"),requestId:Je,receipt:kr}).strict(),Z({...he,kind:Q("refused"),requestId:Je,outcome:Kt(["cancelled","unconfirmed","refused"])}).strict(),Z({...he,kind:Q("state"),state:yn,stateRev:Ct,docSeq:Ct,reset:it()}).strict(),Z({...he,kind:Q("event"),frame:kn}).strict(),Z({...he,kind:Q("status"),status:Kt(["connecting","ready","offline","revoked"]),unconfirmed:it()}).strict()]);function Ws(e,t){try{if(xn(t,1048576)!==void 0)return null;const r=e.safeParse(t);return r.success?r.data:null}catch{return null}}function Us({owner:e,getOwner:t,readTail:r,writeTail:n,transport:s,cwd:o,sourcePath:c,documentId:a,pending:i}){const d=()=>{var g,v;return((g=t())==null?void 0:g.recoveryGate)==="unsupported"||((v=t())==null?void 0:v.recoveryGate)==="observed_clear"},u=g=>{var S;const v=jn.parse(g),N=(S=t())==null?void 0:S.recoveryBinding;if(!N||v.documentId!==a||!J(v.incarnation,N.incarnation))throw new Error("Original save scope changed");return v},f=s.originalFileSaveRecovery,l=()=>{var g;try{const v=t();return(v==null?void 0:v.identity)===e&&v.active&&!!((g=v.recoveryBinding)!=null&&g.current())}catch{return!1}},m=(g,v,N=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const S=t(),I={},z=()=>t()===S&&l()&&(!v||S.recoveryBinding===v)&&(!N||S.recoveryWork===I),M=S.discovery;let L=!1;S.recoveryWork=I,S.recoveryGate="pending",S.recoveryBusy=!0;const P=r().catch(()=>{}).then(async()=>{try{if(!z())return{status:"idle"};const q=await g();return z()?(N&&(S.recoveryGate="observed_clear"),L=!0,{status:"observed",value:q}):{status:"idle"}}catch{return z()?(S.recoveryGate="unavailable",{status:"unavailable"}):{status:"idle"}}finally{!L&&S.discovery===M&&(S.discovery=void 0),S.recoveryWork===I&&(S.recoveryBusy=!1,S.recoveryWork=void 0)}});return N||n(P.then(()=>{})),P};return{identity:e,supported:!!f,current:l,discover:(g=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const v=t(),N=v.recoveryBinding;if(v.discoveryBinding===N&&v.discovery&&(v.pendingDiscovery===v.discovery||!g&&v.recoveryGate==="observed_clear"))return v.discovery;const S=m(async()=>{const I=u(await f.discover(a));return t()===v&&v.recoveryBinding===N&&l()&&(v.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),I},N);return v.discoveryBinding=N,v.discovery=S,v.pendingDiscovery=S,S.then(I=>{v.pendingDiscovery===S&&(v.pendingDiscovery=void 0),I.status==="idle"&&v.discovery===S&&(v.discovery=void 0)}),S},recover(g){if(i())return Promise.resolve({status:"local_uncertain"});const v=t();return m(async()=>{if(!v||i())throw new Error("Mounted original still uncertain");const N=v.recoveryBinding,S=Cn.parse(await f.recover(a,g,N.incarnation));if(t()!==v||!l()||S.documentId!==a||S.entry.eventId!==g||!J(S.incarnation,N.incarnation))throw new Error("Original recovery scope changed");const I=u(await f.discover(a));return t()===v&&l()&&(v.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),{result:S,discovery:I}})},inspectCurrent(){const g=t();return!g||!l()||i()||!d()?Promise.resolve({status:"local_uncertain"}):m(async()=>{const v=await s.readFileContent(o,c);if(!v||typeof v.content!="string"||typeof v.hash!="string"||!/^[a-f0-9]{64}$/u.test(v.hash))throw new Error("Current file evidence missing");return{content:v.content,hash:v.hash}},g.recoveryBinding,!0)}}}class Se extends Error{constructor(){super("The original save is not confirmed. Retry it before saving another draft.")}}class Ge extends Error{}function $s(){const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=[...e].map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Gs(e){const t=e;return(t==null?void 0:t.status)===412&&t.code==="DOC_SAVE_FAILED"}var fe,Ie,Ye,Et;class Hs{constructor(){qe(this,Ye);qe(this,fe);qe(this,Ie)}get pending(){return Me(this,fe)!==void 0}get receipt(){return Me(this,Ie)}async write(t,r,n,s,o,c,a=!1){if(Me(this,fe))throw new Se;if(ve(this,Ie,void 0),!c)return t.writeFile(r,n,s,o);if(!a&&!c.current())throw new Ge;const i=Object.freeze({cwd:r,path:n,content:s,options:Object.freeze({...o,documentSave:Object.freeze({documentId:c.incarnation.documentId,eventId:$s(),incarnation:Object.freeze({...c.incarnation})})})});return ve(this,fe,i),be(this,Ye,Et).call(this,t,i)}async retry(t,r){const n=Me(this,fe);if(!(n!=null&&n.options.documentSave)||!r.current()||!J(n.options.documentSave.incarnation,r.incarnation))throw new Ge;return{result:await be(this,Ye,Et).call(this,t,n),content:n.content}}}fe=new WeakMap,Ie=new WeakMap,Ye=new WeakSet,Et=async function(t,r){try{const n=await t.writeFile(r.cwd,r.path,r.content,r.options);if(!n||typeof n!="object"||typeof n.ok!="boolean")throw new Se;if(!n.ok){if(!n.conflict||typeof n.conflict.currentHash!="string"||!n.conflict.currentHash||typeof n.conflict.currentContent!="string")throw new Se;return ve(this,fe,void 0),n}if(typeof n.hash!="string"||!n.hash||n.effect!=="changed"&&n.effect!=="no_op")throw new Se;const s="documentReceipt"in n?On.parse(n.documentReceipt):void 0,o=r.options.documentSave;if(!s&&n.effect!=="no_op")throw new Se;if(s&&(s.documentId!==o.documentId||s.eventId!==o.eventId||!J(s.incarnation,o.incarnation)||s.fileHash!==n.hash||(s.status==="accepted"?n.effect!=="changed":n.effect!=="no_op")))throw new Se;if((s==null?void 0:s.status)==="duplicate"){const c=await t.readFileContent(r.cwd,r.path);if(!c||typeof c!="object"||Array.isArray(c)||typeof c.hash!="string"||!c.hash||typeof c.content!="string")throw new Se;if(c.hash!==s.fileHash||c.content!==r.content)return ve(this,Ie,s),ve(this,fe,void 0),{ok:!1,conflict:{currentHash:c.hash,currentContent:c.content}}}return ve(this,Ie,s),ve(this,fe,void 0),n}catch(n){throw Gs(n)&&ve(this,fe,void 0),n}};function Vs({sourcePath:e,cwd:t,loadedContent:r,documentId:n,documentSaveBinding:s,documentRecoveryBinding:o}){const c=ae(),a=(s==null?void 0:s.incarnation)??(o==null?void 0:o.incarnation),i=a?JSON.stringify([a.documentId,a.physicalOpenedAt,a.channelCreatedAt,a.generation]):void 0,d=p.useRef(new Hs),u=p.useMemo(()=>({sourcePath:e,cwd:t,documentId:n,transport:c,birthKey:i}),[e,t,n,c,i]),f=p.useRef(null),l=p.useRef(null),m=p.useRef(Promise.resolve()),w=p.useCallback(()=>{var R;return((R=l.current)==null?void 0:R.identity)===u&&l.current.active},[u]);p.useLayoutEffect(()=>{var R;return((R=l.current)==null?void 0:R.identity)!==u?l.current={identity:u,baseHash:null,baseContent:r,active:!0,recoveryBinding:o,recoveryGate:o&&c.originalFileSaveRecovery?"pending":"unsupported"}:(l.current.active=!0,l.current.recoveryBinding=o),()=>{var k;((k=l.current)==null?void 0:k.identity)===u&&(l.current.active=!1)}},[u,r,o,c]);const[g,v]=p.useState({owner:u,status:"idle",conflict:null}),N=g.owner===u?g.status:"idle",S=g.owner===u?g.conflict:null,I=p.useCallback((R,k,B)=>{w()&&v(U=>({owner:u,status:R,documentReceipt:k,confirmedContent:B,conflict:U.owner===u?U.conflict:null}))},[u,w]),z=p.useCallback(R=>{w()&&v(k=>({owner:u,conflict:R,status:k.owner===u?k.status:"idle"}))},[u,w]),M=p.useCallback(()=>{var R,k;return((R=l.current)==null?void 0:R.recoveryGate)==="unsupported"||((k=l.current)==null?void 0:k.recoveryGate)==="observed_clear"},[]),L=p.useMemo(()=>{const R=()=>Us({owner:u,getOwner:()=>l.current,readTail:()=>m.current,writeTail:k=>{m.current=k},transport:c,cwd:t,sourcePath:e,documentId:n,pending:()=>d.current.pending});return{identity:u,supported:!!c.originalFileSaveRecovery,current:()=>R().current(),discover:k=>R().discover(k),recover:k=>R().recover(k),inspectCurrent:()=>R().inspectCurrent()}},[u,c,t,e,n]),P=!!(e&&t),q=p.useCallback((R,k,B,U=!1)=>{const ee=()=>w()&&l.current===R&&(!s||s.current());if(k.ok){if(typeof k.hash!="string"||!k.hash||k.effect!=="changed"&&k.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return R.baseHash=k.hash,R.baseContent=B,!U&&!ee()?{status:"idle"}:(U||(z(null),I("saved",d.current.receipt,B)),{status:k.effect,confirmed:{hash:k.hash,content:B}})}return!U&&!ee()?{status:"idle"}:(U||(z(k.conflict),I("conflict")),{status:"conflict"})},[w,s,z,I]),G=p.useCallback(async(R,k)=>{if(!w())return{status:"idle"};const B=l.current;s&&!d.current.pending&&(f.current=u);const U=await d.current.write(c,t,e,R,k,s);return q(B,U,R)},[w,c,t,e,s,q,u]),re=p.useCallback(R=>{var U;if(!P||!w())return Promise.resolve({status:"idle"});const k=((U=l.current.finalToken)==null?void 0:U.content)===R?l.current.finalToken:void 0,B=m.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(d.current.pending)return I("uncertain"),{status:"uncertain"};if(!M())return I("error"),{status:"error"};l.current.finalToken===k&&(l.current.finalToken=void 0),I("saving");try{const ee=l.current.baseHash!==null?{expectedHash:l.current.baseHash}:{expectedContent:l.current.baseContent};return await G(R,ee)}catch(ee){if(ee instanceof Ge)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const ue=d.current.pending?"uncertain":"error";return I(ue),{status:ue}}});return m.current=B.then(()=>{}),B},[P,G,w,I,s,M]),ge=p.useCallback(R=>{if(!P||!w()||s&&!s.current())return null;const k=l.current,B={content:R,id:Symbol("buffered canvas draft")};return k.finalToken=B,{cancel(){k.finalToken===B&&(k.finalToken=void 0)},flush(){if(k.finalToken!==B||l.current!==k||k.active)return Promise.resolve({status:"idle"});k.finalToken=void 0;const U=m.current.catch(()=>{}).then(async()=>{if(l.current!==k||k.active)return{status:"idle"};try{if(k.recoveryGate!=="unsupported"&&k.recoveryGate!=="observed_clear")return{status:"error"};const ee=k.baseHash!==null?{expectedHash:k.baseHash}:{expectedContent:k.baseContent};s&&!d.current.pending&&(f.current=u);const ue=await d.current.write(c,t,e,R,ee,s,!0);return q(k,ue,R,!0)}catch{return{status:"error"}}});return m.current=U.then(()=>{}),U}}},[P,w,c,t,e,s,q,u]),y=p.useCallback(async R=>{const k=l.current;return!k||k.identity!==u?!1:(await m.current.catch(()=>{}),l.current===k&&!d.current.pending&&k.baseContent===R)},[u]),D=p.useCallback(()=>{if(!w()||!s||f.current!==u)return Promise.resolve({status:"idle"});const R=l.current,k=m.current.catch(()=>{}).then(async()=>{if(!w()||l.current!==R||f.current!==u)return{status:"idle"};try{I("saving");const B=await d.current.retry(c,s);return q(R,B.result,B.content)}catch(B){if(B instanceof Ge||!w()||l.current!==R)return{status:"idle"};const U=d.current.pending?"uncertain":"error";return I(U),{status:U}}});return m.current=k.then(()=>{}),k},[w,s,c,q,I,u]),x=p.useCallback(R=>{var ee;if(!P||!S||!w())return Promise.resolve({status:"idle"});const k=S.currentHash,B=((ee=l.current.finalToken)==null?void 0:ee.content)===R?l.current.finalToken:void 0,U=m.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(d.current.pending)return I("uncertain"),{status:"uncertain"};if(!M())return I("error"),{status:"error"};l.current.finalToken===B&&(l.current.finalToken=void 0),I("saving");try{return await G(R,{expectedHash:k})}catch(ue){if(ue instanceof Ge)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const Ae=d.current.pending?"uncertain":"error";return I(Ae),{status:Ae}}});return m.current=U.then(()=>{}),U},[P,S,G,w,I,s,M]),C=p.useCallback(()=>{var R;return((R=l.current)==null?void 0:R.identity)===u?{hash:l.current.baseHash,content:l.current.baseContent}:{hash:null,content:r}},[u,r]),A=p.useCallback(()=>{if(!S||!w()||s&&!s.current())return null;l.current.finalToken=void 0;const R=S.currentContent;return l.current.baseHash=S.currentHash,l.current.baseContent=R,z(null),I("idle"),R},[S,w,z,I,s]);return{recovery:L,status:N,conflict:S,canSave:P,save:re,overwrite:x,adoptDisk:A,getConfirmedBase:C,prepareFinalSave:ge,retryUnconfirmed:D,waitForCloseDrain:y,documentReceipt:g.owner===u?g.documentReceipt:void 0,confirmedContent:g.owner===u?g.confirmedContent:void 0}}const Js=p.lazy(()=>Re(()=>import("./BlintzCanvas-CYHsXAcY.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas}))),Xs=500;function Zs(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function Ys({content:e,documentId:t,onContentChange:r}){const[n,s]=p.useState(!1),[o,c]=p.useState(e.content),a=V(x=>x.canvasSessionId),i=V(x=>x.setDocumentEditing),d=V(x=>{var C;return((C=x.openDocuments.find(A=>A.id===t))==null?void 0:C.editing)??!1}),u=V(x=>x.selectedCwd),f=n&&d,l=Vs({documentId:t,sourcePath:e.sourcePath,cwd:u,loadedContent:e.content}),m=l.canSave,w=Bs({cwd:u,sourcePath:m?e.sourcePath:null,content:o,saved:l.status==="saved"}),g=p.useRef(null),v=p.useRef(null),N=p.useRef(o),S=p.useRef(e),I=p.useRef(r),z=p.useRef(l.save),M=p.useRef(l.prepareFinalSave),L=p.useRef(null);p.useEffect(()=>{N.current=o,S.current=e,I.current=r,z.current=l.save,M.current=l.prepareFinalSave});const P=p.useCallback(x=>{V.getState().canvasSessionId===g.current&&(I.current({...S.current,content:x}),z.current(x))},[]),q=p.useCallback(x=>{var C;c(x),N.current=x,(C=L.current)==null||C.cancel(),L.current=M.current(x),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,P(x)},Xs)},[P]),G=()=>{g.current=V.getState().canvasSessionId,c(e.content),s(!0),i(t,!0)},re=()=>{v.current&&(clearTimeout(v.current),v.current=null,P(N.current)),s(!1),i(t,!1)};p.useEffect(()=>{var x;f&&a!==g.current&&(v.current&&(clearTimeout(v.current),v.current=null),(x=L.current)==null||x.cancel(),L.current=null,s(!1),i(t,!1))},[a,f,t,i]),p.useEffect(()=>{var x;!n||f||(v.current&&clearTimeout(v.current),v.current=null,(x=L.current)==null||x.cancel(),L.current=null)},[f,n]),p.useEffect(()=>()=>{var x,C;v.current&&(clearTimeout(v.current),v.current=null,V.getState().canvasSessionId===g.current&&I.current({...S.current,content:N.current})),V.getState().canvasSessionId===g.current?(x=L.current)==null||x.flush():(C=L.current)==null||C.cancel(),L.current=null,i(t,!1)},[P,t,i]);const ge=()=>{const x=l.adoptDisk();x!=null&&(r({...e,content:x}),c(x))},y=()=>{l.overwrite(N.current)},D=Zs(l.status);return h.jsxs("div",{className:"relative flex h-full flex-col",children:[h.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[m&&D&&h.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:D}),m&&h.jsx(rt,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:f?re:G,"aria-label":f?"Finish editing":"Edit document",children:f?h.jsx(jr,{className:"size-4"}):h.jsx(Cr,{className:"size-4"})})]}),l.status==="conflict"&&h.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[h.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),h.jsx(rt,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ge,children:"Reload"}),h.jsx(rt,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:y,children:"Overwrite"})]}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(p.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:h.jsx(Js,{value:f?o:e.content,editable:f,onChange:f?q:void 0,wikiLinks:w})})})]})}function Qs({content:e}){return h.jsx("div",{className:"p-4 font-mono text-sm",children:h.jsx(Tr,{value:e.data,depth:0})})}const Ks=20;function Tr({value:e,depth:t,keyName:r}){const[n,s]=p.useState(t>2),o=p.useCallback(()=>s(u=>!u),[]);if(t>=Ks)return h.jsx(Pe,{keyName:r,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return h.jsx(Pe,{keyName:r,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return h.jsx(Pe,{keyName:r,value:String(e),className:"text-blue-500"});if(typeof e=="number")return h.jsx(Pe,{keyName:r,value:String(e),className:"text-green-500"});if(typeof e=="string")return h.jsx(Pe,{keyName:r,value:`"${e}"`,className:"text-amber-500"});const c=Array.isArray(e),a=c?e.map((u,f)=>[String(f),u]):Object.entries(e),i=c?"[":"{",d=c?"]":"}";return h.jsxs("div",{style:{paddingLeft:t>0?16:0},children:[h.jsxs("button",{type:"button",className:"hover:bg-muted -ml-0.5 inline-flex items-center gap-0.5 rounded px-0.5 transition-colors duration-150",onClick:o,children:[h.jsx(Rn,{className:qt("size-3 transition-transform",!n&&"rotate-90")}),r!=null&&h.jsxs("span",{className:"text-foreground",children:[r,": "]}),h.jsxs("span",{className:"text-muted-foreground",children:[i,n&&` … ${a.length} items `,n&&d]})]}),!n&&h.jsxs(h.Fragment,{children:[a.map(([u,f])=>h.jsx(Tr,{keyName:c?void 0:u,value:f,depth:t+1},u)),h.jsx("div",{className:"text-muted-foreground",children:d})]})]})}function Pe({keyName:e,value:t,className:r}){return h.jsxs("div",{style:{paddingLeft:16},children:[e!=null&&h.jsxs("span",{className:"text-foreground",children:[e,": "]}),h.jsx("span",{className:r,children:t})]})}const ei=new Set(["http:","https:"]);function ti(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const ri={image:"data:image/",pdf:"data:application/pdf"};function Ar(e,t,r){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(ri[t])?{url:n,error:null}:{url:null,error:"unsupported-data"};const s=ti(n);if(s!==null)return ei.has(s)?{url:n,error:null}:{url:null,error:"blocked"};const o=r(n);return o?{url:o,error:null}:{url:null,error:"local-unavailable"}}function zr(e,t){switch(e){case"blocked":return`This ${t} source is blocked for safety.`;case"unsupported-data":return`This data URI isn’t a valid ${t} source.`;case"local-unavailable":return`Local ${t} files can’t be displayed here.`}}function ni({content:e}){const t=ae(),r=V(u=>u.selectedCwd),n=p.useMemo(()=>Ar(e.src,"image",u=>t.mediaUrl(r??"",u)),[e.src,t,r]),[s,o]=p.useState("loading"),[c,a]=p.useState(e.src);c!==e.src&&(a(e.src),o("loading"));const i=e.alt??e.title??"Canvas image";if(n.url===null){const u=n.error?zr(n.error,"image"):"";return h.jsx(pr,{children:u})}const d=n.url;return h.jsxs("div",{className:"bg-muted/40 relative flex h-full items-center justify-center",children:[s==="loading"&&h.jsx("p",{className:"text-muted-foreground absolute text-sm","aria-live":"polite",children:"Loading image…"}),s==="error"?h.jsx(pr,{children:"This image couldn’t be loaded."}):h.jsxs(In,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[h.jsx(si,{}),h.jsx(Nn,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:h.jsx("img",{src:d,alt:i,onLoad:()=>o("loaded"),onError:()=>o("error"),className:qt("max-h-full max-w-full object-contain transition-opacity",s==="loaded"?"opacity-100":"opacity-0")})})]})]})}function si(){const{zoomIn:e,zoomOut:t,resetTransform:r}=Tn();return h.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[h.jsx(yt,{label:"Zoom in",onClick:()=>e(),children:h.jsx(Ln,{className:"size-4"})}),h.jsx(yt,{label:"Zoom out",onClick:()=>t(),children:h.jsx(Pn,{className:"size-4"})}),h.jsx(yt,{label:"Reset zoom",onClick:()=>r(),children:h.jsx(qn,{className:"size-4"})})]})}function yt({label:e,onClick:t,children:r}){return h.jsx("button",{type:"button",onClick:t,"aria-label":e,className:"bg-background/80 text-muted-foreground hover:text-foreground focus-ring rounded-md border p-1.5 backdrop-blur transition-colors",children:r})}function pr({children:e}){return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:e})})}function ii({content:e}){const t=ae(),r=En().data,n=V(i=>i.selectedCwd),s=p.useMemo(()=>Ar(e.src,"pdf",i=>t.mediaUrl(n??"",i)),[e.src,t,n]);if(s.url===null){const i=s.error?zr(s.error,"pdf"):"";return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:i})})}const o=s.url,c=e.title??"PDF document",a=new URL(o,window.location.href).origin===window.location.origin;return a&&!r?null:a&&(r==null?void 0:r.serverRole)==="hub"?h.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[h.jsx("p",{children:"PDFs download here instead of opening."}),h.jsxs("a",{href:o,download:!0,className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Download ",c]})]}):h.jsx("object",{data:o,type:"application/pdf",title:c,className:"h-full w-full",children:h.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[h.jsx("p",{children:"This PDF can’t be shown here."}),h.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Open ",c," in a new tab"]})]})})}function oi(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const ai=new Set(["http:","https:","data:"]);function Fr(e,t,r){const n=e.trim(),s=oi(n);return s!==null?ai.has(s)?s==="data:"&&r!==void 0?n.toLowerCase().startsWith(r)?{url:n}:{url:null}:{url:n}:{url:null}:{url:t(n)}}function ci({content:e}){const t=ae(),r=V(o=>o.selectedCwd),n=p.useMemo(()=>Fr(e.src,o=>t.mediaUrl(r??"",o),"data:audio/"),[e.src,t,r]),s=e.title??"Canvas audio";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This audio can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center p-8",children:h.jsx("audio",{controls:!0,src:n.url,"aria-label":s,className:"w-full max-w-2xl",children:h.jsxs("p",{className:"text-muted-foreground text-sm",children:["Your browser can’t play this audio."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function ui({content:e}){const t=ae(),r=V(o=>o.selectedCwd),n=p.useMemo(()=>Fr(e.src,o=>t.mediaUrl(r??"",o),"data:video/"),[e.src,t,r]),s=e.title??"Canvas video";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This video can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center",children:h.jsx("video",{controls:!0,src:n.url,"aria-label":s,className:"max-h-full w-full max-w-full object-contain",children:h.jsxs("p",{className:"text-muted-foreground p-8 text-sm",children:["Your browser can’t play this video."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function Mr({content:e,documentId:t,channel:r}){const[n]=Mt(),s=An(e.definition),o=p.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return h.jsx("div",{className:"p-4",children:s.ok?h.jsx(zn,{channel:r,document:s.document,sessionId:n??void 0},r?t??r.documentId:o):h.jsx(Fn,{error:s.error,raw:s.raw})})}class li{constructor(){te(this,"contiguous",0);te(this,"through",0);te(this,"pending",new Map)}get highest(){return this.contiguous}get catchUpThrough(){return this.through}get pendingCount(){return this.pending.size}reset(){this.contiguous=0,this.through=0,this.pending.clear()}resetHighest(){this.contiguous=0}advance(t){this.contiguous=Math.max(this.contiguous,t)}markThrough(t){this.through=Math.max(this.through,t)}recordGap(t){return this.markThrough(t.docSeq),this.pending.set(t.docSeq,t),this.pending.size<=200?!1:(this.pending.clear(),!0)}takeNextContiguous(){for(const n of this.pending.keys())n<=this.contiguous&&this.pending.delete(n);const t=this.contiguous+1,r=this.pending.get(t);return r&&this.pending.delete(t),r}clearReachedTarget(){return this.contiguous<this.through?!1:(this.through=0,!0)}}const _t=new WeakMap,Qe=new WeakMap,ye=new WeakMap,He=new WeakMap;function Oe(e){Ne(e);const t=_t.get(e);if(!t)throw new Error("Replay owner lifetime is absent.");return t}function di(e,t){const r=Qe.get(t);if(!r||r.owner!==e)throw new Error("Replay run is foreign.");return r}function qr(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const t of Object.values(e))qr(t);Object.freeze(e)}return e}function fi(e){if(Ne(e),_t.has(e))throw new Error("Replay owner lifetime is already initialized.");_t.set(e,new li)}function Pt(e){const t=Oe(e);return Object.freeze({highest:t.highest,through:t.catchUpThrough,pending:t.pendingCount})}function mr(e){Oe(e).reset()}function gr(e,t){const r=Qe.get(t);if(!(!r||r.owner!==e))return Object.freeze({subject:r.subject,epoch:r.epoch,revision:r.revision,observation:r.observation,ended:r.ended})}function hi(e,t,r){const n=ye.get(r),s=Qe.get(t);if(!(!s||s.owner!==e||!n||n.owner!==e||n.run!==t||n.phase!=="consuming"||n.admissionRead||!ne(e,t)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:s.targetBirth})}function pi(e,t,r){const n=di(e,t),s=ye.get(r),o=Ur(e,t,r);if(!o||!s||s.owner!==e||s.run!==t||s.phase!=="consuming"||!s.admissionRead||n.ended||n.epoch!==o.epoch||n.subject!==o.previous)throw new Error("Replay own issuance is foreign or stale.");n.subject=o.subject}function Lr(e,t,r,n){if(!ne(e,t))return;if(n){const o=He.get(r);return o&&o.owner===e&&o.run===t&&o.phase==="dispatching"&&!o.advanced?o.frame:void 0}const s=ye.get(r);return s&&s.owner===e&&s.run===t&&s.phase==="frames"&&s.dispatching!==void 0&&!s.advanced?s.frames[s.dispatching]:void 0}function mi(e,t,r,n){const s=Wi(e,t,r,n);if(!s||!ne(e,t))throw new Error("Replay cursor advance has no genuine core witness.");const o=n?He.get(r):ye.get(r);if(!o||o.advanced)throw new Error("Replay frame advance was consumed.");o.advanced=!0,Oe(e).advance(s.docSeq)}function gi(e,t){const r=Qe.get(t),n=(r==null?void 0:r.lastPage)&&ye.get(r.lastPage);if(!r||r.owner!==e||!ne(e,t)||r.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&Oe(e).highest<r.target)return;const s=Oe(e);return Object.freeze({highest:s.highest,through:s.catchUpThrough,target:r.target})}function vi(e,t){const r=Ze(e,t);if(!r)throw new Error("Replay notice is foreign or stale.");const n=Oe(e),s=r.notification;if(r.mode==="quarantine")n.markThrough(s.type==="canvas_channel_snapshot"?s.snapshot.highWatermark:s.docSeq),s.type!=="canvas_channel_snapshot"&&n.recordGap(s);else{if(r.mode==="gap"&&s.type!=="canvas_channel_snapshot")return n.recordGap(s);r.mode==="event"&&to(e,t)}return!1}function bi(e,t){const r=Ze(e,t);if(!r||r.mode!=="event"||r.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");Oe(e).advance(r.notification.docSeq)}function wi(e){const t=le(e),r=Oe(e),n=Object.freeze({}),s={owner:e,subject:t.subject,epoch:t.epoch,revision:t.revision,observation:t.observation,ended:!1,starting:r.highest,succeeded:!1};Qe.set(n,s),Hi(e,n);const o=()=>ne(e,n),c=()=>le(e).live?o()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!o())return null;const a=le(e),i=r.highest,d=pt(e),u=d.getCanvasChannel;if(!o())return null;const f=await u.call(d,t.documentId,{since:i,limit:200});if(!o())return null;const l=qr(_n.parse(f));if(!o())return null;const m=Object.freeze({});return ye.set(m,{owner:e,run:n,response:l,since:i,revision:a.revision,observation:a.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),m},consumePage(a){const i=ye.get(a);return!o()||!i||i.owner!==e||i.run!==n||i.phase!=="read"?{kind:"done"}:(i.phase="consuming",Vi(e,n,a)!=="accepted"||!o()?(i.phase="finished",{kind:"done"}):(s.target??(s.target=i.response.highWatermark),s.targetBirth=i.response.incarnation,i.frames=Object.freeze(i.response.events.filter(u=>u.docSeq<=s.target)),i.phase="frames",s.lastPage=a,i.response.resetRequired&&r.advance(i.response.retentionFloor-1),{kind:"frames",count:i.frames.length}))},advancePageFrame(a,i){const d=ye.get(a);if(!o()||!d||d.owner!==e||d.run!==n||d.phase!=="frames"||i!==d.next||!d.frames[i])return!1;d.next=i+1,d.dispatching=i,d.advanced=!1;try{return br(e,n,a,!1)&&o()}finally{d.dispatching=void 0}},finishPage(a){const i=ye.get(a);if(!o()||!i||i.owner!==e||i.run!==n||i.phase!=="frames"||i.next!==i.frames.length||s.target===void 0)return"done";if(i.phase="finished",i.response.events.length<200||r.highest>=s.target)return r.advance(s.target),!o()||(wr(e,n),!o())||(s.succeeded=!0),"done";if(r.highest<=i.since)throw new Error("Document replay made no progress.");return"again"},failed(){o()&&Ji(e,n)},beginFinalization(){return c()??(s.succeeded?"drain":"stop")},takePending(){if(!o())return null;const a=r.takeNextContiguous();if(!a||!o())return null;const i=Object.freeze({});return He.set(i,{owner:e,run:n,frame:a,phase:"taken",advanced:!1}),i},advancePending(a){const i=He.get(a);if(!o()||!i||i.owner!==e||i.run!==n||i.phase!=="taken")return!1;i.phase="dispatching";try{return br(e,n,a,!0)&&o()}finally{i.phase="finished",He.delete(a)}},finishFinalization(){const a=c();if(a)return a;if(r.clearReachedTarget()){const i=c();if(i)return i;wr(e,n);const d=c();if(d)return d}if(r.pendingCount||r.catchUpThrough>r.highest){const i=le(e);if(r.highest>s.starting||i.revision>s.revision||i.observation>s.observation)return"restart";Xi(e,n)}return c()??"stop"},current:o,end:()=>{s.ended=!0}})}var me,Dt,We;class St{constructor(){qe(this,me);te(this,"current",null);te(this,"token",0);te(this,"retiring",!1);te(this,"subscribers",new Set);te(this,"resources",new Map);te(this,"doc",null);te(this,"docClaims",new WeakMap);te(this,"retiringDoc",!1);te(this,"docResources",new Map);te(this,"bindings",new WeakSet)}getCurrent(){return this.current}observeHostContext(t){if(this.retiring)return null;if(!t.transportOwner||typeof t.transportOwner!="object"||!Number.isSafeInteger(t.publisherEpoch)||t.publisherEpoch<0)throw new Error("Explicit transport owner and epoch required.");const r=["frame","documentId","resolvedSource","logicalUrl","reloadKey","sessionId","eligibility","exactOrigin","transportOwner","publisherEpoch"];if(r.some(s=>!Object.hasOwn(t,s))||typeof t.documentId!="string"||!t.documentId||typeof t.logicalUrl!="string"||typeof t.reloadKey!="string")throw new Error("Complete host context required.");const n=this.current;return n&&r.every(s=>Object.is(n[s],t[s]))?n:(this.retire(),this.current=Object.freeze({...t,token:this.token,loaded:!1}),this.current)}observeLoaded(t){return this.retiring||this.current!==t||!t.frame?null:(this.retire(),this.current=Object.freeze({...t,token:this.token,loaded:!0}),this.current)}retire(){if(this.retiring)return;const t=this.current;this.current=null;const r=this.doc;this.doc=null,this.token++,this.retiring=!0;const n=[...t?this.resources.get(t)??[]:[],...r?this.docResources.get(r)??[]:[],...this.subscribers];r&&this.docResources.delete(r),t&&this.resources.delete(t);try{for(const s of n)try{const o=s();o&&typeof o.then=="function"&&Promise.resolve(o).catch(()=>{})}catch{}}finally{this.retiring=!1}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}own(t,r){if(this.retiring||this.current!==t)throw new Error("Frame observation retired.");const n=this.resources.get(t)??new Set;return n.add(r),this.resources.set(t,n),()=>{n.delete(r)}}bindDoc(t,r,n){return be(this,me,Dt).call(this,t,r,n)}acquireDoc(t,r,n){const s=be(this,me,Dt).call(this,t,r,n),o=Object.freeze({});this.docClaims.set(s,o);let c=!1;return Object.freeze({binding:s,release:()=>{c||(c=!0,this.docClaims.get(s)===o&&(this.docClaims.delete(s),this.doc===s&&this.bindings.has(s)&&be(this,me,We).call(this)))}})}disableDoc(){be(this,me,We).call(this)}retireDoc(t){this.doc===t&&this.bindings.has(t)&&be(this,me,We).call(this)}ownDoc(t,r){if(!this.isCurrent(t))throw new Error("Doc binding retired.");const n=this.docResources.get(t)??new Set;return n.add(r),this.docResources.set(t,n),()=>{n.delete(r)}}isCurrent(t){return!this.retiring&&!this.retiringDoc&&this.doc===t&&this.bindings.has(t)&&this.current===t.observation}}me=new WeakSet,Dt=function(t,r,n){const s=this.doc,o=this.token,c=Ws(yr,r);if(!c)throw this.disableDoc(),new Error("Established server Doc birth required.");const a=c,i=t.exactOrigin,d=t.eligibility==="served-document"?i==="null":t.eligibility==="preview-listener"&&i!==null&&new URL(i).origin===i;if(!t.loaded||!t.frame||typeof t.frame.postMessage!="function"||!t.resolvedSource||!d||t.documentId!==a.documentId||!n||n.length>200)throw new Error("Loaded eligible frame and established Doc birth required.");if(this.retiring||this.retiringDoc||this.current!==t||this.doc!==s||this.token!==o)throw new Error("Frame observation retired during Doc admission.");if(this.doc){if(this.doc.observation!==t)throw new Error("Doc binding belongs to another host load.");if(J(this.doc.incarnation,a)&&this.doc.scope===n)return this.doc;throw this.retire(),new Error("Doc birth changed; a fresh host load is required.")}const u=Object.freeze({observation:t,incarnation:Object.freeze(a),scope:n});try{return this.doc=u,this.bindings.add(u),u}catch(f){throw this.doc===u&&be(this,me,We).call(this),f}},We=function(){if(this.retiringDoc)return;const t=this.doc;this.doc=null,this.retiringDoc=!0;const r=[...t?this.docResources.get(t)??[]:[]];t&&this.docResources.delete(t);try{for(const n of r)try{const s=n();s&&typeof s.then=="function"&&Promise.resolve(s).catch(()=>{})}catch{}}finally{this.retiringDoc=!1}};function xi(e,t,r){if(!r||typeof r.captureOriginal!="function"||typeof r.submit!="function"||typeof r.inspect!="function"||typeof r.isCurrentOwner!="function"||r.owner!==t.observation.transportOwner||r.publisherEpoch!==t.observation.publisherEpoch)throw new Error("Explicit current transport submit and inspect ports required.");const{owner:n,publisherEpoch:s,isCurrentOwner:o,submit:c,inspect:a,captureOriginal:i}=r,d=Object.freeze({expectedGeneration:t.incarnation.generation}),u=()=>{try{return e.isCurrent(t)?o(n,s)===!0&&e.isCurrent(t):!1}catch{return!1}};if(!u())throw new Error("Doc binding unavailable.");const f=()=>{if(!u())throw new Error("Doc binding retired.")};return Object.freeze({binding:t,current:u,captureOriginal:l=>{f();const m=l.id;f();const w=l.bytes;f();const g=Reflect.apply(i,r,[Object.freeze({id:m,bytes:w})]);if(f(),!g)return null;const v=g.id;f();const N=g.bytes;f();const S=g.submit;f();const I=g.inspect;return f(),v!==m||N!==w||typeof S!="function"||typeof I!="function"?null:Object.freeze({id:m,bytes:w,submit:async z=>{f(),z.throwIfAborted();const M=await Reflect.apply(S,g,[z]);return f(),z.throwIfAborted(),M},inspect:async z=>{f(),z.throwIfAborted();const M=await Reflect.apply(I,g,[z]);return f(),z.throwIfAborted(),M}})},retireObservation:()=>{u()&&e.retire()},onRetire:l=>e.ownDoc(t,l),submit:(l,m)=>(f(),m.throwIfAborted(),c(l,d,m)),inspect:(l,m)=>(f(),m.throwIfAborted(),a(l,d,m))})}class yi{constructor(){te(this,"revision",0);te(this,"draining",!1);te(this,"cleanup");te(this,"subscribers",new Set);te(this,"retirements",new WeakMap)}captureRetirement(){const t=Object.freeze({}),r=++this.revision,n=this.cleanup;return this.cleanup=void 0,this.retirements.set(t,{revision:r,cleanup:n,callbacks:this.draining?[]:[...this.subscribers]}),t}drainRetirement(t){const r=this.retirements.get(t);if(!r)throw new Error("Frame resource retirement is foreign or consumed.");this.retirements.delete(t);const n=this.draining;this.draining=!0;try{this.drain(r.cleanup);for(const s of r.callbacks)this.drain(s)}finally{this.draining=n}}begin(){const t=this.captureRetirement(),r=this.revision;return this.drainRetirement(t),r}once(t,r,n){let s=!1;return()=>{if(s||(s=!0,!this.current(t)||!r()||!this.current(t)))return null;const o=n();return!this.current(t)||!r()||!this.current(t)?null:o}}drain(t){try{Promise.resolve(t==null?void 0:t()).catch(()=>{})}catch{}}current(t){return this.revision===t}install(t,r){return this.current(t)?(this.cleanup=r,!0):!1}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}}function ki(e,t,r){const n=()=>e.current(t)&&r.current()===!0&&e.current(t),s=e.once(t,n,r.complete);return Object.freeze({completeLoad:()=>{const o=s();return!o||!n()||r.accept(o)!==!0||!n()?null:o}})}function ji(e,t,r){const n=()=>e.current(t)&&r.current()===!0&&e.current(t);if(!n())return null;const s=r.acquire();if(!s)return null;let o=!1,c=null,a;try{const i=s.binding;if(n()&&r.bindingCurrent(i)===!0&&n()){const d=r.createPort(i);n()&&r.portCurrent(d)===!0&&n()&&e.install(t,s.release)&&(o=!0,c=d)}}catch(i){a={cause:i}}if(!o)try{s.release()}catch(i){a??(a={cause:i})}if(a)throw a.cause;return c}function Ci(e){const t=()=>Object.assign(new Error("Document actions are unavailable."),{status:409}),r=(s,o)=>{if(o.aborted||!e.current(s)||o.aborted)throw t()},n=(s,o)=>{const c=kr.parse(o);if(c.receipt.id!==s)throw new Error("Document receipt does not match this action.");return c};return Object.freeze({current:e.current,submit:async(s,o)=>{const c=ot.parse(JSON.parse(JSON.stringify(s))),a=c.id;r("submit",o);const i=await e.submit(c,o);r("read",o);const d=n(a,i);return r("read",o),d},inspect:async(s,o)=>{r("read",o);const c=await e.inspect(s,o);r("read",o);const a=n(s,c);return r("read",o),a},captureOriginal:s=>{const o=ot.parse(JSON.parse(JSON.stringify(s))),c=o.id,a=JSON.stringify(o);if(!e.current("submit"))return null;const i=e.capture(o,a);if(!i||!e.current("submit")||!i.current("submit"))return null;let d=!1;const u=f=>i.current(f)===!0;return Object.freeze({id:c,bytes:a,current:u,submit:async f=>{if(d||f.aborted||!u("submit"))throw t();d=!0;const l=await i.submit(JSON.parse(a),f);if(f.aborted||!u("read"))throw t();const m=n(c,l);if(f.aborted||!u("read"))throw t();return m},inspect:async f=>{if(f.aborted||!u("read"))throw t();const l=await i.inspect(c,f);if(f.aborted||!u("read"))throw t();const m=n(c,l);if(f.aborted||!u("read"))throw t();return m}})}})}function Oi(e){return Object.freeze({id:e.id,bytes:e.bytes,submit:async t=>{try{return{kind:"accepted",receipt:await e.submit(t)}}catch{return{kind:"uncertain"}}},inspect:async t=>{try{return{kind:"accepted",receipt:await e.inspect(t)}}catch{return{kind:"unknown"}}}})}function Ri(e,t,r){const n=ot.parse(JSON.parse(e.bytes));if(n.id!==e.id||JSON.stringify(n)!==e.bytes||!r())return null;const s=t(n);return!r()||!s?null:Oi(s)}const Ei=St.prototype.acquireDoc,ut=new WeakMap,It=new WeakMap;function _i(e,t){const r=pt(e),n=new WeakMap,s=(c,a)=>t.current(a)&&Ce(e,c,!0);return Object.freeze({prepareFrameLoad:(c,a)=>{var l;if(!(c instanceof St)||a.loaded)return null;const i=vr(e),d=i?(l=De(e,i))==null?void 0:l.httpBaseline:void 0,u=t.begin();if(!i||!d||!t.current(u)||!Ce(e,i,!0)||c.getCurrent()!==a||a.transportOwner!==r||!s(i,u))return null;let f=null;return ki(t,u,{current:()=>{var m;return Ce(e,i,!0)&&((m=De(e,i))==null?void 0:m.httpBaseline)===d&&c.getCurrent()===(f??a)&&t.current(u)&&Ce(e,i,!0)},complete:()=>(f=c.observeLoaded(a),f),accept:m=>{var w,g;return!t.current(u)||!Ce(e,i,!0)||((w=De(e,i))==null?void 0:w.httpBaseline)!==d||c.getCurrent()!==m||!t.current(u)||!Ce(e,i,!0)||((g=De(e,i))==null?void 0:g.httpBaseline)!==d?!1:(n.set(m,{record:i,birth:d.birth}),!0)}})},subscribeInvalidation:c=>t.subscribe(c),attachFrame:(c,a)=>{if(!(c instanceof St))return null;const i=vr(e),d=t.begin();if(!i||!t.current(d)||!Ce(e,i,!0)||c.getCurrent()!==a||a.transportOwner!==r||!s(i,d))return null;const u=n.get(a);return!u||u.record!==i||!J(u.birth,De(e,i).birth)?null:ji(t,d,{current:()=>s(i,d),acquire:()=>{const f=Ei.call(c,a,De(e,i).birth,De(e,i).birth.documentId);let l=!1,m=null,w;try{s(i,d)&&c.getCurrent()===a&&s(i,d)&&(m=Object.freeze({binding:f.binding,release:f.release}),l=!0)}catch(g){w={cause:g}}if(!l)try{f.release()}catch(g){w??(w={cause:g})}if(w)throw w.cause;return m},bindingCurrent:f=>c.isCurrent(f)&&s(i,d),createPort:f=>xi(c,f,{owner:r,publisherEpoch:a.publisherEpoch,isCurrentOwner:(l,m)=>l===r&&m===a.publisherEpoch&&t.current(d)&&Ce(e,i),captureOriginal:l=>Ri(l,m=>{var w;return((w=Gi(e,i))==null?void 0:w.captureOriginal(m))??null},()=>s(i,d)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:f=>f.current()&&s(i,d)})}})}function Si(e){if(Ne(e),ut.has(e))throw new Error("Frame owner is already initialized.");const t=new yi,r=_i(e,t);return ut.set(e,{frames:t,facade:r}),r}function Di(e){var t;return Ne(e),(t=ut.get(e))==null?void 0:t.facade}function Ue(e){Ne(e);const t=ut.get(e);if(!t)return;const r=Object.freeze({});return It.set(r,{owner:e,frames:t.frames,ticket:t.frames.captureRetirement()}),r}function $e(e,t){if(!t)return;const r=It.get(t);if(!r||r.owner!==e)throw new Error("Frame retirement is foreign or consumed.");It.delete(t),r.frames.drainRetirement(r.ticket)}function Pr(e,t){const r=xe(e,t),n=Bi(e,t);if(!(!r||!n))return{owner:t,verified:r.verified,...Ci(n)}}function pe(e,t){return{documentId:e,transport:t,events:[],available:!1}}function Ii(e,t,r,n,s,o){var i,d;const c=e.documentId===r&&e.transport===n?e:pe(r,n);if(c.snapshot&&(t.highWatermark<c.snapshot.highWatermark||t.stateRev<c.snapshot.stateRev))return c;const a=new Map((((i=c.snapshot)==null?void 0:i.receipts)??[]).filter(u=>u.receipt.docSeq>=t.receiptRetentionFloor).map(u=>[u.receipt.id,u]));for(const u of t.receipts)a.set(u.receipt.id,u);return{...c,available:o,snapshot:{...t,...s?{}:{routing:(d=c.snapshot)==null?void 0:d.routing},receipts:[...a.values()].sort((u,f)=>f.receipt.docSeq-u.receipt.docSeq).slice(0,400)},events:t.resetRequired?c.events.filter(u=>u.docSeq>=t.retentionFloor):c.events}}function Ni(e){var r,n,s,o,c,a,i,d,u,f,l,m;const t=async()=>{throw Object.assign(new Error("Document actions are unavailable."),{status:409})};return{documentId:e.documentId,enabled:e.available&&((r=e.binding)==null?void 0:r.verified)===!0&&((s=(n=e.snapshot)==null?void 0:n.routing)==null?void 0:s.enabled)===!0,submissionOwner:(o=e.binding)==null?void 0:o.owner,current:((c=e.binding)==null?void 0:c.current)??(()=>!1),approvedEventTypes:e.available?((i=(a=e.snapshot)==null?void 0:a.routing)==null?void 0:i.approvedEventTypes)??[]:[],destinationLabel:e.available?((u=(d=e.snapshot)==null?void 0:d.routing)==null?void 0:u.destinationLabel)??"Actions unavailable":"Actions unavailable",...e.snapshot?{snapshot:e.snapshot}:{},submit:((f=e.binding)==null?void 0:f.submit)??t,inspect:((l=e.binding)==null?void 0:l.inspect)??t,captureOriginal:(m=e.binding)==null?void 0:m.captureOriginal}}function Ti(e,t,r){return!!(e&&t&&r.incarnation&&J(t,r.incarnation)&&(r.highWatermark<e.highWatermark||r.stateRev<e.stateRev))}function Br(e,t,r,n){const s=e.documentId===r&&e.transport===n?e:pe(r,n);return{...s,events:[...s.events,t].slice(-200)}}function Ai(e,t){if(e.incarnation&&(e.incarnation.documentId!==t||e.events.some(r=>r.documentId!==t||!r.incarnation||!J(e.incarnation,r.incarnation))))throw new Error("Document replay identity changed.")}const Nt=new WeakMap;function zi(e,t,r){const n=hi(e,t,r);if(n)return Nt.set(r,{owner:e,run:t,witness:n}),n}const Wr=new WeakMap,Xe=new WeakMap,Tt=new WeakMap,At=new WeakMap;function ke(e,t){Ne(e);const r=t??Xe.get(e),n=r&&Wr.get(r);return n&&n.owner===e&&Xe.get(e)===r&&n.active?n:void 0}function X(e){return Ne(e),Xe.get(e)}function xe(e,t){const r=ke(e,t);return r?Object.freeze({birth:r.birth,httpBaseline:r.httpBaseline,snapshot:r.snapshot,verified:r.verified}):void 0}function Ve(e,t,r=!1){var o,c;const n=ke(e,t),s=le(e);return!!n&&s.live&&n.verified&&n.transport===pt(e)&&(!r||((c=(o=n.snapshot)==null?void 0:o.routing)==null?void 0:c.enabled)===!0)}function Fi(e){const t=ke(e);Xe.delete(e),t&&(t.active=!1,t.verified=!1)}function kt(e,t){const r=ke(e,t);r&&(r.verified=!1)}function Mi(e,t,r){const n=ke(e,r);return!n||!ne(e,t)?!1:(n.verified=!0,ne(e,t))}function qi(e,t,r){const n=Nt.get(r);Nt.delete(r);const s=(n==null?void 0:n.owner)===e&&n.run===t?n.witness:void 0;if(!s||!ne(e,t))return!1;const o=s.response.incarnation;let c=ke(e);if(!c&&!o)return ne(e,t);if(!c&&o){const a=le(e),i=()=>{const w=le(e);return ne(e,t)&&w.epoch===a.epoch&&w.observation===a.observation&&X(e)===a.subject},d=pt(e),u=d.ingestCanvasEvent;if(!i())return!1;const f=Function.prototype.bind.call(u,d),l=d.getCanvasEventReceipt;if(!i())return!1;const m=Function.prototype.bind.call(l,d);if(!i())return!1;c={owner:e,token:Object.freeze({}),birth:Object.freeze({...o}),active:!0,verified:!1,submit:f,inspect:m,transport:d},Wr.set(c.token,c),Xe.set(e,c.token),c.httpBaseline=Object.freeze({birth:c.birth,floor:s.response.receiptRetentionFloor}),Tt.set(r,Object.freeze({owner:e,run:t,epoch:a.epoch,previous:a.subject,subject:c.token}));try{pi(e,t,r)}catch(w){throw ke(e)===c&&Qi(e,t,r),w}finally{Tt.delete(r)}if(!ne(e,t))return!1}else if(c){if(!o||!J(c.birth,o))return!1;c.httpBaseline=Object.freeze({birth:c.birth,floor:s.response.receiptRetentionFloor})}return ne(e,t)?(c&&(c.verified=Ki(e)||c.verified),!0):!1}function Bt(e,t,r){const n=Wt(e),s=n.subject,o=()=>Hr(e,n,r);if(!s||!Ve(e,s)){const i=Ue(e);$e(e,i)}if(!o())return;const c=s&&Pr(e,s),a=Di(e);n.dispatch(i=>{var f;if(!o())return i;const d=((f=i.binding)==null?void 0:f.owner)===s?i:pe(n.documentId,n.transport),u=typeof t=="function"?t(d):t;return o()?{...u,...u.snapshot?{snapshot:Object.freeze({...u.snapshot})}:{},binding:c,frameAdmission:a}:i})}function Li(e,t,r,n,s){const o=Wt(e),c=ke(e);Hr(e,o,s)&&(c&&(c.snapshot=t),Bt(e,a=>Ii(a,t,o.documentId,o.transport,r,n),s))}function Pi(e,t,r,n){const s=Lr(e,t,r,n);if(!ne(e,t)||!s)return!1;if(s.docSeq<=Pt(e).highest)return ne(e,t);At.set(r,{owner:e,run:t,pending:n,frame:s});try{mi(e,t,r,n)}finally{At.delete(r)}if(!ne(e,t))return!1;const o=Wt(e);return Bt(e,c=>Br(c,s,o.documentId,o.transport),t),ne(e,t)}function Bi(e,t){const r=ke(e,t);if(!r)return;const n=le(e).documentId;return{current:s=>Ve(e,t,s==="submit"),submit:(s,o)=>r.submit(n,s,{expectedGeneration:r.birth.generation},o),inspect:(s,o)=>r.inspect(n,s,{expectedGeneration:r.birth.generation},o),capture:()=>{const s=r.httpBaseline;return!s||!Ve(e,t,!0)||!J(s.birth,r.birth)?null:Object.freeze({current:o=>Ve(e,t,o==="submit")&&(o==="read"||r.httpBaseline===s),submit:(o,c)=>r.submit(n,o,{expectedGeneration:s.birth.generation},c),inspect:(o,c)=>r.inspect(n,o,{expectedGeneration:s.birth.generation},c)})}}}function Ur(e,t,r){const n=Tt.get(r),s=le(e);return n&&n.owner===e&&n.run===t&&s.epoch===n.epoch&&s.subject===n.subject&&s.live?n:void 0}function Wi(e,t,r,n){const s=At.get(r);return s&&s.owner===e&&s.run===t&&s.pending===n&&ne(e,t)?s.frame:void 0}const $r=new WeakMap,lt=new WeakMap;function Ui(e){const t=lt.get(e);if(!t)throw new Error("Document construction ticket is foreign or consumed.");return lt.delete(e),t}function $i(e,t,r){const n=Object.freeze({});lt.set(n,Object.freeze({documentId:e,transport:t,dispatch:r}));try{const s=eo(n);return $r.set(n,s),n}finally{lt.delete(n)}}function K(e){const t=$r.get(e);if(!t)throw new Error("Document owner is foreign.");return t}function Ne(e){K(e)}function le(e){return K(e).facts()}function pt(e){return K(e).transport()}function vr(e){return K(e).subject()}function De(e,t){return K(e).subjectFacts(t)}function Ce(e,t,r=!1){return K(e).subjectCurrent(t,r)}function Gi(e,t){return K(e).binding(t)}function Hi(e,t){K(e).reserve(t)}function ne(e,t){return K(e).current(t)}function Vi(e,t,r){return K(e).admit(t,r)}function br(e,t,r,n){return K(e).frame(t,r,n)}function wr(e,t){return K(e).qualify(t)}function Ji(e,t){K(e).failed(t)}function Xi(e,t){K(e).unavailable(t)}function Zi(e,t){K(e).start(t)}function Yi(e){K(e).dispose()}const Gr=new WeakMap;function Wt(e){const t=Object.freeze(K(e).projection());return Gr.set(t,Object.freeze({custodyKey:e,capture:t})),t}function Hr(e,t,r){const n=Gr.get(t);return(n==null?void 0:n.custodyKey)===e&&n.capture===t&&K(e).projectionCurrent(t.epoch,t.subject,r)}function Qi(e,t,r){K(e).abortAdmission(t,r)}function Ki(e){return K(e).qualified()}const zt=new WeakMap;function eo(e){const{documentId:t,transport:r,dispatch:n}=Ui(e);let s,o=!1,c;const a={live:!0};let i=0,d,u,f=!1,l,m,w=0;const g=()=>a.live,v=()=>Fi(e);let N=0;const S=()=>Pt(e),I=y=>{const D=gr(e,y);return!!D&&!D.ended&&g()&&s===y&&D.epoch===i&&D.subject===X(e)},z=(y=!1)=>{const D=Ue(e);v(),i++,s=void 0,y&&mr(e),$e(e,D)},M=(y,D)=>Bt(e,y,D),L=y=>{const D=gi(e,y),x=X(e),C=x&&xe(e,x);return!I(y)||!D||D.through>D.highest||!l||!C||!J(l,C.birth)||!Mi(e,y,x)?!1:(l=void 0,M(A=>({...A,available:!0}),y),I(y))},P=(y,D,x)=>{const C=X(e),A=C&&xe(e,C),R=i,k=()=>g()&&R===i&&X(e)===C&&(!x||I(x));if(!k()||Ti(A==null?void 0:A.snapshot,A==null?void 0:A.birth,y))return;const B=D?y.routing:u;y={...y,routing:B&&Object.freeze({enabled:B.enabled,destinationLabel:B.destinationLabel,approvedEventTypes:Object.freeze([...B.approvedEventTypes])})},D&&(u=y.routing),!C&&!y.incarnation&&(f=!0),k()&&Li(e,y,D,l===void 0,x)},q=(y,D)=>{var ue;const x=zi(e,y,D);if(!I(y)||!x)return"discard";const C=x.response;Ai(C,t);const A=C.incarnation;if((X(e)||l||m)&&!A)throw new Error("Document replay identity is unavailable.");if(m&&A&&!J(m,A))return z(!0),M(pe(t,r)),"restart";const R=X(e),k=(R&&((ue=xe(e,R))==null?void 0:ue.birth))??l;if(A&&(k&&!J(k,A)||!k&&f||x.targetBirth&&!J(x.targetBirth,A)))return l=A,f=!1,u=void 0,d=void 0,z(!0),M(pe(t,r)),"restart";const{events:B,...U}=C,ee=X(e);return!ee&&A&&(l=m??A),!qi(e,y,D)||!I(y)?"discard":(!ee&&A&&(m=void 0),P(U,x.revision===N,y),I(y)?"accepted":"discard")},G=(y,D,x)=>{var k;const C=Lr(e,y,D,x),A=X(e),R=(A&&((k=xe(e,A))==null?void 0:k.birth))??l;return!I(y)||!C||C.documentId!==t||R&&(!C.incarnation||!J(R,C.incarnation))?!1:Pi(e,y,D,x)},re=(y,D)=>{const x=Object.freeze({});zt.set(x,Object.freeze({owner:e,revision:N,observation:w,epoch:i,notification:y,mode:D}));try{return vi(e,x)}finally{zt.delete(x)}},ge=y=>{if(o||!g()||(o=!0,M(pe(t,r)),!g()))return;const D=Sn(void 0,x=>{if(!g()||x.documentId!==t)return;const C=x.type==="canvas_channel_snapshot"?x.snapshot.incarnation:x.incarnation,A=X(e);if(!A){if(l&&!m&&(!C||!J(l,C))||!C||C.documentId!==t)return;if(!m||!J(m,C)){const R=!!m||!!l;if(m=Object.freeze({...C}),w++,u=void 0,d=void 0,f=!1,R&&(z(!0),M(pe(t,r))),!g()||!m||!J(m,C))return}re(x,"quarantine"),g()&&y();return}if(l&&(!C||!J(l,C))){C&&y();return}if(C&&!J(xe(e,A).birth,C)){l=C,f=!1,u=void 0,d=void 0,z(!0),M(pe(t,r)),g()&&y();return}if(C){if(d!==void 0&&d!==x.scope){const R=Ue(e);if(d=x.scope,kt(e,A),i++,s=void 0,N++,$e(e,R),X(e)!==A||!g())return;M(k=>({...k,available:!1})),X(e)===A&&g()&&y();return}d=x.scope,N++,x.type==="canvas_channel_snapshot"?P(x.snapshot,!0):x.docSeq>S().highest+1?(re(x,"gap")&&g()&&M(k=>({...k,available:!1})),g()&&y()):re(x,"event")}},r,()=>{if(!g())return;const x=Ue(e),C=X(e);C&&kt(e,C),i++,s=void 0,N++,$e(e,x),M(A=>({...A,available:!1})),g()&&y()});g()?c=D:D(),g()&&y()};return Vr.set(e,y=>{const D=Ze(e,y);if(!D||D.notification.type==="canvas_channel_snapshot")return;const x=X(e),C=i;!x||!D.notification.incarnation||!J(xe(e,x).birth,D.notification.incarnation)||(M(A=>Br(A,D.notification,t,r)),!g()||C!==i||X(e))}),{facts:()=>Object.freeze({documentId:t,live:g(),epoch:i,revision:N,observation:w,subject:X(e)}),transport:()=>r,subject:()=>X(e),subjectFacts:y=>xe(e,y),subjectCurrent:(y,D)=>Ve(e,y,D),binding:y=>Pr(e,y),qualified:()=>l===void 0,projection:()=>({documentId:t,transport:r,dispatch:n,epoch:i,run:s,subject:X(e)}),projectionCurrent:(y,D,x)=>g()&&y===i&&D===X(e)&&(!x||s===x),abortAdmission:(y,D)=>{Ur(e,y,D)&&z(!0)},reserve:y=>{const D=gr(e,y);if(!D||D.ended||!g()||D.epoch!==i||D.subject!==X(e))throw new Error("Replay run is foreign or stale.");s=y},current:I,admit:q,frame:G,qualify:L,failed:y=>{if(!I(y))return;const D=X(e);D&&kt(e,D),M(x=>({...x,available:!1}),y)},unavailable:y=>{I(y)&&M(D=>({...D,available:!1}),y)},start:ge,dispose:()=>{if(!g())return;const y=Ue(e);a.live=!1,s=void 0;const D=c;c=void 0,v(),i++,mr(e);try{$e(e,y)}finally{D==null||D()}}}}function Ze(e,t){const r=zt.get(t),n=le(e);if(!(!r||r.owner!==e||!n.live||n.epoch!==r.epoch||n.revision!==r.revision||n.observation!==r.observation))return r}function to(e,t){var a;const r=Ze(e,t);if(!r||r.notification.type==="canvas_channel_snapshot")return;const n=r.notification,o=le(e).subject,c=o&&xe(e,o);!c||!n.incarnation||!J(c.birth,n.incarnation)||n.docSeq<=Pt(e).highest||(bi(e,t),!(!Ze(e,t)||le(e).subject!==o)&&((a=Vr.get(e))==null||a(t)))}const Vr=new WeakMap;function ro(e,t,r){const n=$i(e,t,r);fi(n);const s=Si(n);return Object.freeze({beginRun:()=>wi(n),frameAdmission:s,start:o=>Zi(n,o),dispose:()=>Yi(n)})}function no(e,t){let r,n=0;const s=f=>{try{t==null||t(f)}catch{}},o=f=>{r===f&&(r=void 0)},c=(f,l)=>{f.settled||(f.settled=!0,r||s(!1),l?f.reject(l.cause):f.resolve())},a=()=>{u().catch(()=>{})},i=(f,l)=>{const m=()=>n===f.revision;if(!m())return;const w=l.beginFinalization();if(m()){if(w==="restart"){a();return}if(w==="drain")for(;m();){const g=l.drainOne();if(!m())return;if(g!=="again"){if(g==="restart")a();else if(g==="tail"){const v=l.finishFinalization();m()&&v==="restart"&&a()}return}}}},d=async f=>{let l,m;try{l=e();try{for(;await l.page()==="again";);}catch(w){l.failed(w)}}catch(w){m={cause:w}}finally{o(f);try{l&&i(f,l)}catch(w){m={cause:w}}finally{c(f,m)}}},u=()=>{if(r)return r.promise;let f,l;const m=new Promise((g,v)=>{f=g,l=v}),w={revision:++n,promise:m,resolve:f,reject:l,settled:!1};return r=w,s(!0),d(w),m};return Object.freeze({request:u})}function so(e,t,r,n){const s=ro(e,t,r);let o=!1;const c=no(()=>{const a=s.beginRun();return{async page(){const i=await a.readPage();if(!i)return"done";const d=a.consumePage(i);if(d.kind!=="frames")return d.kind;for(let u=0;u<d.count;u++)if(!a.advancePageFrame(i,u))return"done";return a.finishPage(i)},failed:()=>a.failed(),beginFinalization:()=>{const i=a.beginFinalization();return i!=="drain"&&a.end(),i},drainOne(){if(!a.current())return a.end(),"stop";const i=a.takePending();return i?a.advancePending(i)?"again":(a.end(),"stop"):"tail"},finishFinalization:()=>{try{return a.finishFinalization()}finally{a.end()}}}},a=>{o||n==null||n(a)});return s.start(()=>{c.request().catch(()=>{})}),Object.freeze({dispose(){o=!0,s.dispose()}})}function io(e){var d,u,f;const t=ae(),[r,n]=p.useState(()=>pe(e,t)),[s,o]=p.useState({documentId:e,transport:t,pending:!0});p.useLayoutEffect(()=>{const l=so(e,t,n,m=>{o({documentId:e,transport:t,pending:m})});return()=>l.dispose()},[e,t]);const c=r.documentId===e&&r.transport===t?r:pe(e,t),a=p.useMemo(()=>Ni(c),[c]),i=p.useMemo(()=>{var w;const l=(w=c.snapshot)==null?void 0:w.incarnation,m=c.binding;return l&&m?Object.freeze({incarnation:Object.freeze({...l}),current:()=>m.current("read")}):void 0},[(d=c.snapshot)==null?void 0:d.incarnation,c.binding]);return{channel:a,events:c.events,frameAdmission:c.frameAdmission,fileSaveBinding:i,fileSaveObservation:s.documentId!==e||s.transport!==t||s.pending?"pending":c.available&&((u=c.binding)!=null&&u.verified)&&((f=c.snapshot)!=null&&f.incarnation)?"ready":"unavailable"}}function oo({content:e}){const[t]=Mt();return t?h.jsx("div",{className:"h-full w-full",children:h.jsx(Mn,{sessionId:t,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const ao=p.lazy(()=>Re(()=>import("./CanvasFileContent-estXyAbr.js"),__vite__mapDeps([6,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasFileContent}))),co=p.lazy(()=>Re(()=>import("./CanvasModel3dContent-CkOo930M.js"),__vite__mapDeps([24,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasModel3dContent}))),uo=p.lazy(()=>Re(()=>import("./CanvasCsvContent--Gr7Fe_U.js"),__vite__mapDeps([25,1,2,26,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasCsvContent}))),lo=p.lazy(()=>Re(()=>import("./index-Cga0qx1T.js").then(e=>e.uU),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function So({documentId:e,widgetChannel:t,content:r,onContentChange:n}){switch(r.type){case"url":case"browser":return h.jsx(ys,{documentId:e,content:r},`${e}:${r.url}`);case"markdown":return h.jsx(Ys,{documentId:e,content:r,onContentChange:n},r.sourcePath??"generated");case"json":return h.jsx(Qs,{content:r});case"image":return h.jsx(ni,{content:r});case"pdf":return h.jsx(ii,{content:r});case"audio":return h.jsx(ci,{content:r});case"video":return h.jsx(ui,{content:r});case"widget":return t?h.jsx(Mr,{content:r,documentId:e,channel:t}):h.jsx(fo,{documentId:e,content:r});case"mcp_app":return h.jsx(oo,{content:r});case"file":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(ao,{documentId:e,content:r})});case"model3d":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(co,{content:r})});case"csv":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(uo,{content:r})});case"diff":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(lo,{documentId:e,content:r},r.sourcePath)})}}function tt(){return h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function fo({documentId:e,content:t}){const{channel:r}=io(e);return h.jsx(Mr,{documentId:e,content:t,channel:r})}const ho=p.lazy(()=>Re(()=>import("./BlintzCanvas-CYHsXAcY.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas})));function Do({roomId:e,document:t,content:r,onSave:n}){const[s,o]=p.useState(null),[c,a]=p.useState(!1),[i,d]=p.useState(null),u=s!==null,f=r.sourcePath===void 0;os(e,u?t.id:null);const l=async()=>{if(s===null)return;if(s===r.content){o(null),d(null);return}a(!0),d(null);const m=await n(t.id,{...r,content:s});a(!1),m?o(null):d("Couldn’t save. Your words are still here. Try again.")};return h.jsxs("div",{className:"flex h-full flex-col",children:[f&&h.jsxs("div",{className:"flex items-center justify-end gap-2 border-b px-2 py-1",children:[u&&h.jsx("span",{className:"text-muted-foreground text-xs",children:c?"Saving…":"Everyone sees your save."}),h.jsx(rt,{type:"button",size:"xs",variant:"ghost",disabled:c,"aria-label":u?"Save for the room":"Edit this document",onClick:()=>u?void l():o(r.content),children:u?h.jsx(jr,{className:"size-3.5"}):h.jsx(Cr,{className:"size-3.5"})})]}),i!==null&&h.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:i}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(p.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"}),children:h.jsx(ho,{value:s??r.content,editable:u,onChange:o},u?"editing":`rev-${t.rev}`)})})]})}const Ft="dorkos-canvas-sessions",po=1440*60*60*1e3;function Jr(){try{const e=localStorage.getItem(Ft);if(!e)return null;const t=JSON.parse(e);return t===null||typeof t!="object"?null:t}catch{return null}}function Xr(e){try{Object.keys(e).length===0?localStorage.removeItem(Ft):localStorage.setItem(Ft,JSON.stringify(e))}catch{}}function mo(e){return Array.isArray(e.documents)?[...e.documents].sort((t,r)=>(t.openedAt??0)-(r.openedAt??0)).map(t=>t.content).filter(t=>!!t):e.content?[e.content]:[]}function dt(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(dt).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${dt(n)}`).join(",")}}`}function go(e,t){const r=new Set,n=new Map;for(const o of e){const c=er(o.content);if(c!==null){r.add(c);continue}const a=dt(o.content);n.set(a,(n.get(a)??0)+1)}const s=[];for(const o of t){const c=er(o);if(c!==null){r.has(c)||s.push(o);continue}const a=dt(o),i=n.get(a)??0;i>0?n.set(a,i-1):s.push(o)}return s}const st=new Set;function Io(){st.clear()}function No(e,t={}){const r=ae(),n=t.canonical??!0;p.useEffect(()=>{e&&V.getState().loadCanvasForSession(e)},[e]),p.useEffect(()=>{if(!e||!n||st.has(e))return;const s=Jr();if(!s)return;const o=s[e];if(!o){vo(s);return}st.add(e),(async()=>{try{const c=mo(o),a=go(await r.listSessionCanvas(e),c);if(a.length===0){xr(e);return}for(const i of a)await r.openSessionCanvasDocument(e,i);xr(e),V.getState().hydrateCanvasFromSnapshot(e,await r.listSessionCanvas(e))}catch{st.delete(e)}})()},[e,n,r])}function xr(e){const t=Jr();if(!t)return;const{[e]:r,...n}=t;Xr(n)}function vo(e){const t=Date.now()-po,r=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=t);r.length!==Object.keys(e).length&&Xr(Object.fromEntries(r))}export{So as C,Eo as F,Do as R,Bs as a,io as b,is as c,ss as d,_o as e,Mr as f,Io as g,rs as h,No as i,Fr as r,Vs as u};
@@ -1,16 +0,0 @@
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,le as Es,lf as Ve,lg as Ye,lh as Ms,aW as Z,hP as Je,dw as pe,y as fe,a2 as he,h0 as Rs,li as _s,iD as Ze,lj as As,dS as es,lk as Os,ll as Me,lm as Ps,ln as Ds,a7 as Is,j as s,bx as xe,ar as ge,G as k,d$ as Us,aR as Re,lo as oe,lp as Ls,lq as zs,il as ss,lr as Bs,l4 as $s,bL as Ne,gn as Fs,cu as H,gX as Gs,ls as Hs,lt as Ws,gV as qs,lu as W,cO as D,cP as I,cQ as U,by as je,bz as ye,bA as be,bC as ve,gZ as Qs,aN as ts,gW as Ks,lv as Xs,lw as $,lx as Vs,b8 as Ys,B as F,ly as Js,lz as Zs,a9 as et,lA as ns,dv as st,dT as tt,lB as _e,lC as nt,ip as rt,iq as it,jb as Ae,is as at,it as ot,lD as lt,lE as ct,iu as Oe,lF as ut,f as dt,dz as Pe,hf as rs,lG as mt,lH as pt,lI as is,lJ as as,lK as ft,gc as ht,gd as xt,ge as gt,gf as Nt,_ as ee,gg as jt,gh as yt,gi as bt,gj as vt,e as K,dB as os,k7 as De,dl as St,I as Tt,k8 as kt,ja as Ct,aS as ls,aO as Se,c9 as wt,dQ as se,cb as ae,lL as le,lM as cs,cc as us,lN as Et,lO as Mt,lP as Rt,eT as _t,lQ as At,eV as Ot,cd as Pt,lR as Dt,bD as X,ce as ds,lS as It,ju as Ut,aq as Lt,eZ as zt,lT as Bt,g_ as $t,lU as Ft,hJ as Gt,iN as Ht,J as Wt,X as qt,ad as Qt,l0 as Kt,g5 as Xt,hN as Vt,ed as Yt,hy as Jt,ik as Zt,$ as en,eJ as sn,lV as tn,cr as nn,lW as rn,lX as an,lY as on,lZ as ln,l_ as cn,l$ as un,m0 as dn}from"./index-Cga0qx1T.js";import{G as V}from"./git-branch-BpxhecMq.js";import{u as mn}from"./use-update-config-Tbn3SodN.js";import{s as pn}from"./settings-for-runtime-BoOa-ZFG.js";import{C as fn}from"./card-B3CtfC3R.js";import{R as hn,H as xn,a as gn,b as Nn}from"./RuntimeSetupDialog-Cr4GRi8c.js";import{r as jn}from"./RuntimeConnectFlow-DjReuQ-T.js";import{U as Ie}from"./unverified-catalog-notice-CEzu54YH.js";import{L as yn}from"./layers-Cm7coqdo.js";import{C as bn,a as vn}from"./cpu-B7xLO7jn.js";/**
2
- * @license lucide-react v1.48.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ms={name:"chart-column",size:24,node:[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],aliases:["bar-chart-3"]};ms.node;const Sn=de(ms);/**
7
- * @license lucide-react v1.48.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const ps={name:"clipboard-copy",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]};ps.node;const Tn=de(ps);/**
12
- * @license lucide-react v1.48.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
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};
@@ -1 +0,0 @@
1
- import{a1 as n,a3 as s,a4 as u,at as o,au as r}from"./index-Cga0qx1T.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};