yepanywhere 0.9.1 → 0.9.2

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 (361) hide show
  1. package/bundled/@yep-anywhere/shared/dist/__tests__/model-prices.test.js +12 -0
  2. package/bundled/@yep-anywhere/shared/dist/__tests__/model-prices.test.js.map +1 -1
  3. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts +2 -2
  4. package/bundled/@yep-anywhere/shared/dist/app-types.d.ts.map +1 -1
  5. package/bundled/@yep-anywhere/shared/dist/app-types.js +5 -5
  6. package/bundled/@yep-anywhere/shared/dist/app-types.js.map +1 -1
  7. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.d.ts +21 -0
  8. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.d.ts.map +1 -1
  9. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.js +22 -1
  10. package/bundled/@yep-anywhere/shared/dist/artifact-viewer.js.map +1 -1
  11. package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts +2 -2
  12. package/bundled/@yep-anywhere/shared/dist/find/documentFind.d.ts +41 -0
  13. package/bundled/@yep-anywhere/shared/dist/find/documentFind.d.ts.map +1 -0
  14. package/bundled/@yep-anywhere/shared/dist/find/documentFind.js +280 -0
  15. package/bundled/@yep-anywhere/shared/dist/find/documentFind.js.map +1 -0
  16. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.d.ts +2 -0
  17. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.d.ts.map +1 -0
  18. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.d.ts +2 -0
  19. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.d.ts.map +1 -0
  20. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.js +5 -0
  21. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.generated.js.map +1 -0
  22. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.js +59 -0
  23. package/bundled/@yep-anywhere/shared/dist/find/frameFindAgent.js.map +1 -0
  24. package/bundled/@yep-anywhere/shared/dist/find/protocol.d.ts +46 -0
  25. package/bundled/@yep-anywhere/shared/dist/find/protocol.d.ts.map +1 -0
  26. package/bundled/@yep-anywhere/shared/dist/find/protocol.js +45 -0
  27. package/bundled/@yep-anywhere/shared/dist/find/protocol.js.map +1 -0
  28. package/bundled/@yep-anywhere/shared/dist/index.d.ts +4 -2
  29. package/bundled/@yep-anywhere/shared/dist/index.d.ts.map +1 -1
  30. package/bundled/@yep-anywhere/shared/dist/index.js +3 -1
  31. package/bundled/@yep-anywhere/shared/dist/index.js.map +1 -1
  32. package/bundled/@yep-anywhere/shared/dist/model-prices.d.ts.map +1 -1
  33. package/bundled/@yep-anywhere/shared/dist/model-prices.js +9 -2
  34. package/bundled/@yep-anywhere/shared/dist/model-prices.js.map +1 -1
  35. package/bundled/@yep-anywhere/shared/dist/pdfjs.d.ts +7 -0
  36. package/bundled/@yep-anywhere/shared/dist/pdfjs.d.ts.map +1 -0
  37. package/bundled/@yep-anywhere/shared/dist/pdfjs.js +7 -0
  38. package/bundled/@yep-anywhere/shared/dist/pdfjs.js.map +1 -0
  39. package/bundled/@yep-anywhere/shared/dist/skill-invocations.d.ts.map +1 -1
  40. package/bundled/@yep-anywhere/shared/dist/skill-invocations.js +7 -10
  41. package/bundled/@yep-anywhere/shared/dist/skill-invocations.js.map +1 -1
  42. package/bundled/@yep-anywhere/shared/package.json +1 -1
  43. package/client-dist/assets/{AboutSettings-CHsaLshd.js → AboutSettings-CCzudbSj.js} +1 -1
  44. package/client-dist/assets/{ActivityPage-CBVcBckm.js → ActivityPage-Bn0LbMgE.js} +1 -1
  45. package/client-dist/assets/{AgentContextSettings-DLLaiwUX.js → AgentContextSettings-DI8jQVIx.js} +1 -1
  46. package/client-dist/assets/{AgentsPage-C3_U9MGs.js → AgentsPage-Ci_iJt8T.js} +1 -1
  47. package/client-dist/assets/App-rFnK5pnF.js +2 -0
  48. package/client-dist/assets/AppearanceSettings-DTYVt0W5.js +2 -0
  49. package/client-dist/assets/{AppsSettings-B1BIWKaz.js → AppsSettings-hbh_sguk.js} +1 -1
  50. package/client-dist/assets/{AttachmentChip-CQTl9l1O.js → AttachmentChip-BFve3lTD.js} +1 -1
  51. package/client-dist/assets/{AuthContext-BQK10GgC.js → AuthContext-DmXjW0be.js} +1 -1
  52. package/client-dist/assets/{BangCommandDisplayObject-BDGW0BZN.js → BangCommandDisplayObject-BH2KRGnc.js} +1 -1
  53. package/client-dist/assets/{BangCommandsPage-C1-n2iHi.js → BangCommandsPage-MfkuL8yS.js} +1 -1
  54. package/client-dist/assets/{BrowserDebugToolbarButton-CRE47FFy.js → BrowserDebugToolbarButton-BPghQu17.js} +1 -1
  55. package/client-dist/assets/{CacheMissBillingSettings-BspB12sl.js → CacheMissBillingSettings-rUgC-_DD.js} +1 -1
  56. package/client-dist/assets/{CodexUpdatePrompt-BXTqvclk.js → CodexUpdatePrompt-mT9K-f1e.js} +1 -1
  57. package/client-dist/assets/{CommittedRangeInput-bK7EXtAc.js → CommittedRangeInput-BwuV6Q6c.js} +1 -1
  58. package/client-dist/assets/{CommittedRangeNumberInput-bGOjN2Xv.js → CommittedRangeNumberInput-C5YSVltB.js} +1 -1
  59. package/client-dist/assets/{ComputerControlSettings-BLA4wsEA.js → ComputerControlSettings-MWIdP7SS.js} +1 -1
  60. package/client-dist/assets/{ConversationPreviewPage-rxHQQOck.js → ConversationPreviewPage-B47r7mUF.js} +2 -2
  61. package/client-dist/assets/{DevelopmentSettings-CFo3ctnP.js → DevelopmentSettings-BEAy_xq-.js} +1 -1
  62. package/client-dist/assets/{DevicesSettings-DPdJOmEQ.js → DevicesSettings-DKQOZkRN.js} +1 -1
  63. package/client-dist/assets/{EmulatorPage-RPHDvihL.js → EmulatorPage-DlsPq3nR.js} +1 -1
  64. package/client-dist/assets/{EmulatorSettings-8dHy0xqk.js → EmulatorSettings-C6Ye1k_Y.js} +1 -1
  65. package/client-dist/assets/{EnvironmentSettings-DaFyodJV.js → EnvironmentSettings-ou8UNqTa.js} +1 -1
  66. package/client-dist/assets/{FilePage-BwbKyIGF.js → FilePage-Cw2PaO5H.js} +1 -1
  67. package/client-dist/assets/{FilterDropdown-BiB5gAUh.js → FilterDropdown-CACc6ysA.js} +1 -1
  68. package/client-dist/assets/{FloatingActionButton-DEiaqWhv.js → FloatingActionButton-Bl1Eumxh.js} +1 -1
  69. package/client-dist/assets/{GitStatusPage-CSXr__tv.js → GitStatusPage-CLTkgnDI.js} +1 -1
  70. package/client-dist/assets/{GlobalSessionsPage-C-CbcZjC.js → GlobalSessionsPage-Bvzs4zmW.js} +1 -1
  71. package/client-dist/assets/{HeartbeatTextArea-DWZZh0eE.js → HeartbeatTextArea-CtP5kx9R.js} +1 -1
  72. package/client-dist/assets/{HostIdentityContext-DbEx7dor.js → HostIdentityContext-DA7dMF-y.js} +1 -1
  73. package/client-dist/assets/{HostsPage-BRlkrB-8.js → HostsPage-CBOYGC2-.js} +1 -1
  74. package/client-dist/assets/{InboxContext-DtjKccKZ.js → InboxContext-8PXoTbK1.js} +1 -1
  75. package/client-dist/assets/{InboxPage-DFaLlFm5.js → InboxPage-DWl7uzdw.js} +1 -1
  76. package/client-dist/assets/{IssueSettings-CHjLBTZK.js → IssueSettings-BVljRpuD.js} +1 -1
  77. package/client-dist/assets/{IssuesPage-CfYD-jwK.js → IssuesPage-BFxgsMkf.js} +1 -1
  78. package/client-dist/assets/{LifecycleWebhooksSettings-Ir3_1MvY.js → LifecycleWebhooksSettings-Qw_dN3F3.js} +1 -1
  79. package/client-dist/assets/{LocalAccessSettings-BVh3wBDY.js → LocalAccessSettings-SWirs75o.js} +1 -1
  80. package/client-dist/assets/LocalMediaModal-B3KXtyEB.css +1 -0
  81. package/client-dist/assets/LocalMediaModal-B9eHVx6y.js +14 -0
  82. package/client-dist/assets/{LoginPage-irZxKYu1.js → LoginPage-CYWqVJ95.js} +1 -1
  83. package/client-dist/assets/{MessageAge-CKdiBg7K.js → MessageAge-CaPpa1nH.js} +1 -1
  84. package/client-dist/assets/{MessageDeliverySettings-BJ6Hgu1F.js → MessageDeliverySettings-BUSuGKlc.js} +1 -1
  85. package/client-dist/assets/MessageInput-a13ZPAHv.js +3 -0
  86. package/client-dist/assets/{MessageInputToolbar-CvUMMGJv.js → MessageInputToolbar-CQGTnVea.js} +3 -3
  87. package/client-dist/assets/MessageList-C7kAuWKg.js +4 -0
  88. package/client-dist/assets/{Modal-DOzUIhWU.js → Modal-ClSjJagX.js} +2 -2
  89. package/client-dist/assets/{ModelSettings-SWaaTKgm.js → ModelSettings-Dnd4yzmI.js} +1 -1
  90. package/client-dist/assets/{NavigationLayout-D8BMwd7T.js → NavigationLayout-BTFsWVtE.js} +2 -2
  91. package/client-dist/assets/{NewSessionPage-BBFzYBNs.js → NewSessionPage-BfiAS-Mo.js} +1 -1
  92. package/client-dist/assets/{NotificationsSettings-0iotA0wy.js → NotificationsSettings-B1ugQIp-.js} +1 -1
  93. package/client-dist/assets/{PageHeader-Ca3PbaMb.js → PageHeader-BjwH2pWD.js} +1 -1
  94. package/client-dist/assets/{PerformanceSettings-BgDJMjlN.js → PerformanceSettings-jJYF9SPY.js} +1 -1
  95. package/client-dist/assets/{ProjectSessionDefaultsModal-LEaPwpSM.js → ProjectSessionDefaultsModal-G_0uxJEv.js} +1 -1
  96. package/client-dist/assets/{ProjectTemplatesSettings-fPlh8ZpJ.js → ProjectTemplatesSettings-BQTCV3-3.js} +1 -1
  97. package/client-dist/assets/{ProjectsPage-CiQ3rBB_.js → ProjectsPage-suTd8s9l.js} +1 -1
  98. package/client-dist/assets/ProviderBadge-P0VTI71n.js +1 -0
  99. package/client-dist/assets/{ProviderChildSessionDetail-CSAbaZtr.js → ProviderChildSessionDetail-D0472EW8.js} +13 -13
  100. package/client-dist/assets/ProviderChildSessionPage-9__sgY14.js +1 -0
  101. package/client-dist/assets/{ProvidersSettings-B327MdUT.js → ProvidersSettings-Bwzy73Rk.js} +1 -1
  102. package/client-dist/assets/{RecapAfterSecondsControl-DWG9fB4u.js → RecapAfterSecondsControl-CxuXyFSr.js} +1 -1
  103. package/client-dist/assets/{RelayProtocol-DOWXVB0k.js → RelayProtocol-BpdH0COG.js} +1 -1
  104. package/client-dist/assets/{RemoteAccessSettings-CBSIP-qP.js → RemoteAccessSettings-Dn7KB5nK.js} +1 -1
  105. package/client-dist/assets/{RemoteExecutorsSettings-DDAqEB42.js → RemoteExecutorsSettings-Cjl4Y2rB.js} +1 -1
  106. package/client-dist/assets/{SchemaValidationContext-DLNGXai_.js → SchemaValidationContext-57RCj4c4.js} +1 -1
  107. package/client-dist/assets/{SearchPreview-BCP67hKg.js → SearchPreview-OzVFWPJZ.js} +1 -1
  108. package/client-dist/assets/{SessionHeader.module-CHO2T3eQ.js → SessionHeader.module-BpaFAQ-S.js} +1 -1
  109. package/client-dist/assets/SessionPage-BYthaEfZ.js +50 -0
  110. package/client-dist/assets/SessionPage-CXXEAwu2.css +1 -0
  111. package/client-dist/assets/{SettingsItem-BWF_CyTI.js → SettingsItem-C9Vh5p7F.js} +1 -1
  112. package/client-dist/assets/{SettingsSection-DbOwfvBD.js → SettingsSection-BaPzETK6.js} +1 -1
  113. package/client-dist/assets/{SourceControlSettings-BopLkzc6.js → SourceControlSettings-DnqLg0db.js} +1 -1
  114. package/client-dist/assets/{SourceFileHeaderActions-HoUciheJ.js → SourceFileHeaderActions-PjhUGnn6.js} +1 -1
  115. package/client-dist/assets/SpeechControlMenu-BYVdEa3C.js +2 -0
  116. package/client-dist/assets/{SpeechSettings-B4mB2LIj.js → SpeechSettings-B6LkqfSK.js} +1 -1
  117. package/client-dist/assets/{SpeechSmartTurnControls-tb5zP_85.js → SpeechSmartTurnControls-LPq9wBaM.js} +1 -1
  118. package/client-dist/assets/{StorageSettings-B5A0CtTo.js → StorageSettings-DtsJnYaz.js} +1 -1
  119. package/client-dist/assets/{ThinkingControls-BEweLRqu.js → ThinkingControls-DXbxdJRi.js} +1 -1
  120. package/client-dist/assets/{ToolbarSettings-CJbxOope.js → ToolbarSettings-Nb2BKpnk.js} +1 -1
  121. package/client-dist/assets/{UsersSettings-NWqRSGov.js → UsersSettings-BdvqmyqK.js} +1 -1
  122. package/client-dist/assets/ViewerModePage-DzRIpuYF.js +1 -0
  123. package/client-dist/assets/{VoiceInputButton-0BzvkjjK.js → VoiceInputButton-CCgovfyf.js} +1 -1
  124. package/client-dist/assets/{WorkstreamsPage-oM6jTLsK.js → WorkstreamsPage-dlEUllSL.js} +1 -1
  125. package/client-dist/assets/{YaServerProvider-BNTM9_P9.js → YaServerProvider-CN3tC5UL.js} +1 -1
  126. package/client-dist/assets/{YepAnywhereLogo-C4H1sg3q.js → YepAnywhereLogo-5zFKWjQq.js} +1 -1
  127. package/client-dist/assets/{abnfDiagram-VCTEODGH-DIBSwOuB.js → abnfDiagram-VCTEODGH-BWHUBcV3.js} +1 -1
  128. package/client-dist/assets/{arc-Blz12Cef.js → arc-DKsIJWGD.js} +1 -1
  129. package/client-dist/assets/{architectureDiagram-5GKGNRK7-CtTnQhBI.js → architectureDiagram-5GKGNRK7-BuLImqW3.js} +1 -1
  130. package/client-dist/assets/{attachmentFileNames-DwaA5IPB.js → attachmentFileNames-CBV_5g65.js} +1 -1
  131. package/client-dist/assets/{blockDiagram-I7D4REHJ-BanTkGM6.js → blockDiagram-I7D4REHJ-CJ4Gh6sL.js} +1 -1
  132. package/client-dist/assets/{c4Diagram-7LVT6UL2-C4p1KgTp.js → c4Diagram-7LVT6UL2-WR43XvCI.js} +1 -1
  133. package/client-dist/assets/channel-PV8AAsuo.js +1 -0
  134. package/client-dist/assets/{chunk-2Q5K7J3B-CJSvy8go.js → chunk-2Q5K7J3B-CiP4m_EA.js} +1 -1
  135. package/client-dist/assets/{chunk-5VM5RSS4-BVg02Giz.js → chunk-5VM5RSS4-BUAhj1h9.js} +1 -1
  136. package/client-dist/assets/{chunk-F27PBJKO-f_VOUJ8l.js → chunk-F27PBJKO-BUZNwiGx.js} +1 -1
  137. package/client-dist/assets/{chunk-IMKFNOWR-P5H0uE4d.js → chunk-IMKFNOWR-CX1a0BCE.js} +1 -1
  138. package/client-dist/assets/{chunk-JWPE2WC7-BpEGNu2X.js → chunk-JWPE2WC7-C6tL-mLF.js} +1 -1
  139. package/client-dist/assets/{chunk-POPQ4Y6H-oZudgMt7.js → chunk-POPQ4Y6H-BzijGGWv.js} +1 -1
  140. package/client-dist/assets/{chunk-SVP7TREG-dMWNgoWs.js → chunk-SVP7TREG-CsZImJKI.js} +1 -1
  141. package/client-dist/assets/{chunk-TICWLB2K-D8VqJUFw.js → chunk-TICWLB2K-TwCtuDc1.js} +1 -1
  142. package/client-dist/assets/{chunk-XXDRQBXY-ZwkKkcDz.js → chunk-XXDRQBXY-C-2EoNns.js} +1 -1
  143. package/client-dist/assets/classDiagram-ZZMXUADV-DvtSxfma.js +1 -0
  144. package/client-dist/assets/classDiagram-v2-VYDZK3BY-DvtSxfma.js +1 -0
  145. package/client-dist/assets/{client-D_ikArFV.js → client-Ci_HPGfl.js} +1 -1
  146. package/client-dist/assets/{compactSettingsControls-CzgNQCH3.js → compactSettingsControls-C9mLZh5H.js} +1 -1
  147. package/client-dist/assets/{cose-bilkent-JH36ORCC-DrtmDj3A.js → cose-bilkent-JH36ORCC-CmbEx2jT.js} +1 -1
  148. package/client-dist/assets/{cynefin-OW5HDTMX-CYhxgFq5.js → cynefin-OW5HDTMX-BSQHHXFU.js} +1 -1
  149. package/client-dist/assets/{cynefinDiagram-5FMLGOSQ-BXvBp5eq.js → cynefinDiagram-5FMLGOSQ-C-62JZJD.js} +1 -1
  150. package/client-dist/assets/{dagre-GXQ25YYZ-CdvzhCPS.js → dagre-GXQ25YYZ-BBERQe_A.js} +1 -1
  151. package/client-dist/assets/{diagram-S7CK7UJ4-DSGzzHN1.js → diagram-S7CK7UJ4-muw11lmG.js} +1 -1
  152. package/client-dist/assets/{diagram-UQ7AKVKN-Bk4fbl1S.js → diagram-UQ7AKVKN-DpePWzAe.js} +1 -1
  153. package/client-dist/assets/{diagram-VSXAHHWV-BAOCj4oX.js → diagram-VSXAHHWV-DHX6AHUY.js} +1 -1
  154. package/client-dist/assets/{diagram-VX7I27RA-KHmeuEjq.js → diagram-VX7I27RA-DYmR6NH_.js} +1 -1
  155. package/client-dist/assets/{diagram-Z3DM3KII-D6GpIAdx.js → diagram-Z3DM3KII-BC1SenHB.js} +1 -1
  156. package/client-dist/assets/{ebnfDiagram-PWID7BFC-Bm_JuhNL.js → ebnfDiagram-PWID7BFC-EVpri6Ma.js} +1 -1
  157. package/client-dist/assets/{erDiagram-RLTQ6QDP-u5Ryj9Z_.js → erDiagram-RLTQ6QDP-DthztUaa.js} +1 -1
  158. package/client-dist/assets/{flowDiagram-HODETNUW-C9A7e1yC.js → flowDiagram-HODETNUW-DEpC5nMx.js} +1 -1
  159. package/client-dist/assets/{frontendReload-DN8qVYjF.js → frontendReload-CBdyvvdy.js} +1 -1
  160. package/client-dist/assets/{ganttDiagram-EL5Y4UJY-BEIN_FhZ.js → ganttDiagram-EL5Y4UJY-Csqji8t1.js} +1 -1
  161. package/client-dist/assets/{gitGraphDiagram-WWUBYQGX-Cu5ow6Ls.js → gitGraphDiagram-WWUBYQGX-DVX1SDIE.js} +1 -1
  162. package/client-dist/assets/{hostStorage-C37tOOJa.js → hostStorage-D1KAm3U1.js} +1 -1
  163. package/client-dist/assets/{index-_2WVhpKj.js → index-BESqiBDI.js} +1 -1
  164. package/client-dist/assets/index-BkOdUxq4.js +2 -0
  165. package/client-dist/assets/index-CPb-36gi.css +1 -0
  166. package/client-dist/assets/{index-YAR5D3xY.js → index-CoR-vzsb.js} +1 -1
  167. package/client-dist/assets/index-Cv3tQXyE.js +1 -0
  168. package/client-dist/assets/{index-LT-lzpNS.js → index-DSFMItgO.js} +1 -1
  169. package/client-dist/assets/index-umZg0LZ6.js +81 -0
  170. package/client-dist/assets/{infoDiagram-27XIBGKW-ILfv0Qu_.js → infoDiagram-27XIBGKW-CHm3qsd2.js} +1 -1
  171. package/client-dist/assets/{ishikawaDiagram-5VMMS53U-D1P8nenz.js → ishikawaDiagram-5VMMS53U-tBRZwz-_.js} +1 -1
  172. package/client-dist/assets/{journeyDiagram-3NMN7TZE-CXP61NqX.js → journeyDiagram-3NMN7TZE-EJic7nqD.js} +1 -1
  173. package/client-dist/assets/{kanban-definition-UXKFOSKX-2x79Nimu.js → kanban-definition-UXKFOSKX-DtzL6eeO.js} +1 -1
  174. package/client-dist/assets/{layout-D7AfOq-G.js → layout-gb-Axsoq.js} +1 -1
  175. package/client-dist/assets/{linear-B_4Bripc.js → linear-CAe4xGbR.js} +1 -1
  176. package/client-dist/assets/{mermaid.core-y_avJe8E.js → mermaid.core-BCu1nv8H.js} +5 -5
  177. package/client-dist/assets/{mindmap-definition-YA3MSWOX-DwMJuV6d.js → mindmap-definition-YA3MSWOX-C7-KSPtJ.js} +1 -1
  178. package/client-dist/assets/{pegDiagram-XKGWAZYB-43LaxzRF.js → pegDiagram-XKGWAZYB-iWVH9rbY.js} +1 -1
  179. package/client-dist/assets/{pieDiagram-E7YTZNPT-DAOi_afd.js → pieDiagram-E7YTZNPT-VKD6PLHa.js} +1 -1
  180. package/client-dist/assets/{providerChildSessions-BpJF5D9s.css → providerChildSessions-Cd7oK6KQ.css} +1 -1
  181. package/client-dist/assets/providerChildSessions-DbLFSybt.js +77 -0
  182. package/client-dist/assets/{quadrantDiagram-AXDQQJYC-BRPBWWpv.js → quadrantDiagram-AXDQQJYC-AXFugcFl.js} +1 -1
  183. package/client-dist/assets/{railroadDiagram-O6MQD6OU-xAuDG62P.js → railroadDiagram-O6MQD6OU-D6oZy6Al.js} +1 -1
  184. package/client-dist/assets/{recentProjectPathLinks-B6pQxzWg.js → recentProjectPathLinks-D0Dx6YXT.js} +1 -1
  185. package/client-dist/assets/{registerServiceWorker-fKJh5dWO.js → registerServiceWorker-B8K2KVOY.js} +1 -1
  186. package/client-dist/assets/{relayEndpoints-DRyKx83V.js → relayEndpoints-BTq9xppf.js} +1 -1
  187. package/client-dist/assets/{remoteRoutePaths-BxKY1U2z.js → remoteRoutePaths-D8htA0xa.js} +1 -1
  188. package/client-dist/assets/{requirementDiagram-BXWQKSXE-BJvybhuU.js → requirementDiagram-BXWQKSXE-Eqtb74It.js} +1 -1
  189. package/client-dist/assets/{sankeyDiagram-P5KCCOFB-aAAflmwo.js → sankeyDiagram-P5KCCOFB-CxvDiZ1R.js} +1 -1
  190. package/client-dist/assets/{sequenceDiagram-WJ2MYXX4-CP3BPtU-.js → sequenceDiagram-WJ2MYXX4-BbpkgW2L.js} +1 -1
  191. package/client-dist/assets/{sessionNavigationState-MSOOrZi4.js → sessionNavigationState-BXejf2ZW.js} +1 -1
  192. package/client-dist/assets/sessionRouteLayer-D9T2QT8G.js +1 -0
  193. package/client-dist/assets/{sizeCapture-INFHLROL-BwAQ5zb3.js → sizeCapture-INFHLROL-DcuwWD5r.js} +1 -1
  194. package/client-dist/assets/{sourceControlNavigationState-t_nQLZvO.js → sourceControlNavigationState-BJbTzWTE.js} +1 -1
  195. package/client-dist/assets/{speechDraftTransaction-8sgF4uer.js → speechDraftTransaction-WhqFE1h9.js} +1 -1
  196. package/client-dist/assets/{stateDiagram-D77RDMKH-B8llvNN3.js → stateDiagram-D77RDMKH-Cidpq73w.js} +1 -1
  197. package/client-dist/assets/stateDiagram-v2-MP3YSRHH-DFqKXxjz.js +1 -0
  198. package/client-dist/assets/{swimlanes-42K2YHIH-qqdgDD32.js → swimlanes-42K2YHIH-Ba8C7MwG.js} +1 -1
  199. package/client-dist/assets/swimlanesDiagram-VR7AAH4N-3pW2TcAt.js +8 -0
  200. package/client-dist/assets/{timeline-definition-24CTP7MA-EBxDGVBl.js → timeline-definition-24CTP7MA-CKefGvUK.js} +1 -1
  201. package/client-dist/assets/{useAcliCommentarySetting-JMx-BSAu.js → useAcliCommentarySetting-CBKAl7qr.js} +2 -2
  202. package/client-dist/assets/{useActivityBusState-CnG-LXsr.js → useActivityBusState-C0dor9p7.js} +1 -1
  203. package/client-dist/assets/{useBackgroundRevalidation-7vLWDD_M.js → useBackgroundRevalidation-C79HAUP3.js} +1 -1
  204. package/client-dist/assets/{useCodexUpdateStatus-CAR1HkyO.js → useCodexUpdateStatus-CEZO_f2Y.js} +1 -1
  205. package/client-dist/assets/{useConnectedDevices-DxgKt21O.js → useConnectedDevices-Ds-DuUDc.js} +1 -1
  206. package/client-dist/assets/{useDocumentTitle-bldu9XOq.js → useDocumentTitle-Xz5t-nlB.js} +1 -1
  207. package/client-dist/assets/{useEmulators-BPiSdRjQ.js → useEmulators-qS_cCZ3I.js} +1 -1
  208. package/client-dist/assets/{useFileActivity-D0JXhEz7.js → useFileActivity-BoW4X3DY.js} +1 -1
  209. package/client-dist/assets/{useFloatingActionButtonEnabled-Dp_hZuYb.js → useFloatingActionButtonEnabled-2_hw7nSa.js} +1 -1
  210. package/client-dist/assets/{useForkSummaryAutoOpen-Cty_gTm1.js → useForkSummaryAutoOpen-CS33Irpf.js} +1 -1
  211. package/client-dist/assets/{useGeneratedTitleLength-BpbPYGRf.js → useGeneratedTitleLength-D856ktVg.js} +1 -1
  212. package/client-dist/assets/{useKeepMobileKeyboardOpenAfterDelivery-BWCiVVkU.js → useKeepMobileKeyboardOpenAfterDelivery-Ba77SbWF.js} +1 -1
  213. package/client-dist/assets/{useModelSettings-CeABGid0.js → useModelSettings-BdlYk1DT.js} +1 -1
  214. package/client-dist/assets/{useNotifyInApp-CuUBcZeR.js → useNotifyInApp-DcWe3dh4.js} +1 -1
  215. package/client-dist/assets/{useOnboarding-BDCBf2Fp.js → useOnboarding-CoE3WF8a.js} +1 -1
  216. package/client-dist/assets/{useProviders-45TZLkhy.js → useProviders-CeN1PclA.js} +1 -1
  217. package/client-dist/assets/{useQuestionAsideSetting-B0bjoe-z.js → useQuestionAsideSetting-CPFw1u0y.js} +1 -1
  218. package/client-dist/assets/{useRecentSessions-COrEGQJH.js → useRecentSessions-ieTzzJu4.js} +1 -1
  219. package/client-dist/assets/{useRelativeNow-XM1dKxcx.js → useRelativeNow-Ca6QGcPa.js} +1 -1
  220. package/client-dist/assets/{useReloadNotifications-JBj22syT.js → useReloadNotifications-Dm1jmdIb.js} +1 -1
  221. package/client-dist/assets/{useRemoteExecutors-Bzvi8gRe.js → useRemoteExecutors-zBAQnQXH.js} +1 -1
  222. package/client-dist/assets/{useSidebarWidth-CITe0sSV.js → useSidebarWidth-CBCcbSLg.js} +1 -1
  223. package/client-dist/assets/{useSourceControlCleanLanding-B-8NTKPa.js → useSourceControlCleanLanding-VDlft5tr.js} +1 -1
  224. package/client-dist/assets/{useStableToolPreviewRendering-CeH1PY9S.js → useStableToolPreviewRendering-hbVp38Jd.js} +1 -1
  225. package/client-dist/assets/{useStreamingEnabled-C535nHwb.js → useStreamingEnabled-hU1g8i7_.js} +1 -1
  226. package/client-dist/assets/{useTabTitleActivityPreference-NekVdSEZ.js → useTabTitleActivityPreference-DhREY7m2.js} +1 -1
  227. package/client-dist/assets/{useVhostAccess-CHT40zJ3.js → useVhostAccess-DUtn_sH1.js} +1 -1
  228. package/client-dist/assets/{useWorkflowTags-Bl7Czynw.js → useWorkflowTags-DxbEBqtf.js} +1 -1
  229. package/client-dist/assets/{vennDiagram-4TSXK5OY-BRLuM0pk.js → vennDiagram-4TSXK5OY-CSGBq-Ur.js} +1 -1
  230. package/client-dist/assets/{wardleyDiagram-VM6X3IG4-D5cPV-h-.js → wardleyDiagram-VM6X3IG4-DIMvcaMb.js} +1 -1
  231. package/client-dist/assets/{xychartDiagram-S5SC5T6Z-M2QslymW.js → xychartDiagram-S5SC5T6Z-TYXSqT3w.js} +1 -1
  232. package/client-dist/index.html +3 -3
  233. package/dist/app.d.ts.map +1 -1
  234. package/dist/app.js +19 -10
  235. package/dist/app.js.map +1 -1
  236. package/dist/artifacts/ArtifactServer.d.ts +0 -1
  237. package/dist/artifacts/ArtifactServer.d.ts.map +1 -1
  238. package/dist/artifacts/ArtifactServer.js +41 -9
  239. package/dist/artifacts/ArtifactServer.js.map +1 -1
  240. package/dist/auth/limitedUserPolicy.d.ts +9 -5
  241. package/dist/auth/limitedUserPolicy.d.ts.map +1 -1
  242. package/dist/auth/limitedUserPolicy.js +64 -35
  243. package/dist/auth/limitedUserPolicy.js.map +1 -1
  244. package/dist/auth/principal.d.ts +6 -0
  245. package/dist/auth/principal.d.ts.map +1 -1
  246. package/dist/auth/principal.js +6 -0
  247. package/dist/auth/principal.js.map +1 -1
  248. package/dist/frontend/static.d.ts.map +1 -1
  249. package/dist/frontend/static.js +2 -1
  250. package/dist/frontend/static.js.map +1 -1
  251. package/dist/middleware/authenticated-transport.d.ts +13 -0
  252. package/dist/middleware/authenticated-transport.d.ts.map +1 -1
  253. package/dist/middleware/authenticated-transport.js +12 -0
  254. package/dist/middleware/authenticated-transport.js.map +1 -1
  255. package/dist/middleware/limited-users.d.ts +9 -5
  256. package/dist/middleware/limited-users.d.ts.map +1 -1
  257. package/dist/middleware/limited-users.js +37 -23
  258. package/dist/middleware/limited-users.js.map +1 -1
  259. package/dist/routes/file-edit.d.ts +4 -1
  260. package/dist/routes/file-edit.d.ts.map +1 -1
  261. package/dist/routes/file-edit.js +22 -6
  262. package/dist/routes/file-edit.js.map +1 -1
  263. package/dist/routes/files.d.ts.map +1 -1
  264. package/dist/routes/files.js +19 -5
  265. package/dist/routes/files.js.map +1 -1
  266. package/dist/routes/pdfjs.d.ts +9 -0
  267. package/dist/routes/pdfjs.d.ts.map +1 -0
  268. package/dist/routes/pdfjs.js +34 -0
  269. package/dist/routes/pdfjs.js.map +1 -0
  270. package/dist/routes/recents.d.ts +4 -1
  271. package/dist/routes/recents.d.ts.map +1 -1
  272. package/dist/routes/recents.js +7 -0
  273. package/dist/routes/recents.js.map +1 -1
  274. package/dist/routes/settings.d.ts +7 -2
  275. package/dist/routes/settings.d.ts.map +1 -1
  276. package/dist/routes/settings.js +43 -1
  277. package/dist/routes/settings.js.map +1 -1
  278. package/dist/routes/ws-relay-handlers.d.ts +12 -0
  279. package/dist/routes/ws-relay-handlers.d.ts.map +1 -1
  280. package/dist/routes/ws-relay-handlers.js +25 -4
  281. package/dist/routes/ws-relay-handlers.js.map +1 -1
  282. package/dist/routes/ws-relay.d.ts.map +1 -1
  283. package/dist/routes/ws-relay.js +8 -0
  284. package/dist/routes/ws-relay.js.map +1 -1
  285. package/dist/sdk/providers/codex-model-catalog.d.ts.map +1 -1
  286. package/dist/sdk/providers/codex-model-catalog.js +5 -3
  287. package/dist/sdk/providers/codex-model-catalog.js.map +1 -1
  288. package/dist/sdk/providers/codex-protocol/generated/ContentItem.d.ts +4 -1
  289. package/dist/sdk/providers/codex-protocol/generated/ContentItem.d.ts.map +1 -1
  290. package/dist/sdk/providers/codex-protocol/generated/FunctionCallOutputContentItem.d.ts +4 -1
  291. package/dist/sdk/providers/codex-protocol/generated/FunctionCallOutputContentItem.d.ts.map +1 -1
  292. package/dist/sdk/providers/codex-protocol/generated/Personality.d.ts +3 -0
  293. package/dist/sdk/providers/codex-protocol/generated/Personality.d.ts.map +1 -1
  294. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.d.ts +2 -0
  295. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.d.ts.map +1 -0
  296. package/dist/sdk/providers/codex-protocol/generated/v2/{ThreadRollbackParams.js → McpAppDisplayMode.js} +1 -1
  297. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppDisplayMode.js.map +1 -0
  298. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.d.ts +9 -0
  299. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.d.ts.map +1 -0
  300. package/dist/sdk/providers/codex-protocol/generated/v2/{ThreadRollbackResponse.js → McpAppUi.js} +1 -1
  301. package/dist/sdk/providers/codex-protocol/generated/v2/McpAppUi.js.map +1 -0
  302. package/dist/sdk/providers/codex-protocol/generated/v2/Thread.d.ts +1 -1
  303. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts +4 -0
  304. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadForkResponse.d.ts.map +1 -1
  305. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts +6 -1
  306. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadItem.d.ts.map +1 -1
  307. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts +4 -0
  308. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeParams.d.ts.map +1 -1
  309. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts +9 -0
  310. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadResumeResponse.d.ts.map +1 -1
  311. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts +9 -0
  312. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartParams.d.ts.map +1 -1
  313. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts +4 -0
  314. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadStartResponse.d.ts.map +1 -1
  315. package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts +7 -1
  316. package/dist/sdk/providers/codex-protocol/generated/v2/TurnStartParams.d.ts.map +1 -1
  317. package/dist/sdk/providers/codex-protocol/generated/v2/UserInput.d.ts +3 -0
  318. package/dist/sdk/providers/codex-protocol/generated/v2/UserInput.d.ts.map +1 -1
  319. package/dist/sdk/providers/codex-protocol/index.d.ts +0 -2
  320. package/dist/sdk/providers/codex-protocol/index.d.ts.map +1 -1
  321. package/dist/sdk/providers/codex.d.ts +7 -2
  322. package/dist/sdk/providers/codex.d.ts.map +1 -1
  323. package/dist/sdk/providers/codex.js +21 -20
  324. package/dist/sdk/providers/codex.js.map +1 -1
  325. package/dist/services/ArtifactRebuildService.d.ts +11 -14
  326. package/dist/services/ArtifactRebuildService.d.ts.map +1 -1
  327. package/dist/services/ArtifactRebuildService.js +15 -7
  328. package/dist/services/ArtifactRebuildService.js.map +1 -1
  329. package/dist/services/PdfjsAssetCache.d.ts +20 -0
  330. package/dist/services/PdfjsAssetCache.d.ts.map +1 -0
  331. package/dist/services/PdfjsAssetCache.js +131 -0
  332. package/dist/services/PdfjsAssetCache.js.map +1 -0
  333. package/package.json +3 -3
  334. package/client-dist/assets/App-DYWU2-wq.js +0 -2
  335. package/client-dist/assets/AppearanceSettings-Ci0wlAx3.js +0 -2
  336. package/client-dist/assets/LocalMediaModal-DOcizK52.css +0 -1
  337. package/client-dist/assets/LocalMediaModal-DyDpC0dk.js +0 -12
  338. package/client-dist/assets/MessageInput-leX__dbU.js +0 -3
  339. package/client-dist/assets/MessageList-DDA4Q_Gj.js +0 -4
  340. package/client-dist/assets/ProviderBadge-BKZVllDn.js +0 -1
  341. package/client-dist/assets/ProviderChildSessionPage-vpu5u3YA.js +0 -1
  342. package/client-dist/assets/SessionPage-BJ5qaa-G.js +0 -50
  343. package/client-dist/assets/SessionPage-BiV0X3n1.css +0 -1
  344. package/client-dist/assets/SpeechControlMenu-DEDIWl9h.js +0 -2
  345. package/client-dist/assets/ViewerModePage-Dyq_I7ws.js +0 -1
  346. package/client-dist/assets/channel-DwT-nHaK.js +0 -1
  347. package/client-dist/assets/classDiagram-ZZMXUADV-DdlhZ-2W.js +0 -1
  348. package/client-dist/assets/classDiagram-v2-VYDZK3BY-DdlhZ-2W.js +0 -1
  349. package/client-dist/assets/index-BY-TgOY-.js +0 -81
  350. package/client-dist/assets/index-BgkZrNQv.js +0 -1
  351. package/client-dist/assets/index-BrCZcBcO.js +0 -2
  352. package/client-dist/assets/index-wA2zlxt-.css +0 -1
  353. package/client-dist/assets/providerChildSessions-DVWCZpC4.js +0 -78
  354. package/client-dist/assets/stateDiagram-v2-MP3YSRHH-CD7vRqY6.js +0 -1
  355. package/client-dist/assets/swimlanesDiagram-VR7AAH4N-NBdWyLIY.js +0 -8
  356. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts +0 -14
  357. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.d.ts.map +0 -1
  358. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackParams.js.map +0 -1
  359. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts +0 -12
  360. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.d.ts.map +0 -1
  361. package/dist/sdk/providers/codex-protocol/generated/v2/ThreadRollbackResponse.js.map +0 -1
@@ -0,0 +1,77 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BCu1nv8H.js","assets/index-umZg0LZ6.js","assets/react-runtime-D-UPQ57m.js","assets/index-CPb-36gi.css"])))=>i.map(i=>d[i]);
2
+ var na=Object.defineProperty;var sa=(e,t,n)=>t in e?na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t,n)=>sa(e,typeof t!="symbol"?t+"":t,n);import{r as a,h as Bs,U as Ee,cm as ra,cn as oa,co as Jn,cp as Hr,aG as ia,j as c,g as pt,by as ca,bz as aa,s as Wt,G as la,cq as Xo,bb as Yo,aC as Vr,f as Ur,bE as ua,cr as da,bv as fa,ax as st,u as je,aK as _e,cs as Jo,bs as zt,ct as ha,cb as ma,d as pa,p as ga,cu as Zo,F as ei,cv as wa,cw as ya,cx as va,cy as xa,cz as ba,cA as Sa,cB as Ca,cC as Ea,c9 as _a,cD as ka,ca as La,bp as Ma,bt as Ra}from"./index-umZg0LZ6.js";import{H as ja,b as Ds,a as oe,ab as Aa}from"./client-Ci_HPGfl.js";import{q as Ta,b as Os,e as ti,d as Na,r as Ia,j as Pa,a as $a,g as ni,c as Fa,s as Dt,t as Fn,v as Ba,w as qr,x as si,S as Da,y as Oa,u as Nt,Q as ws,M as ri,z as Ha,A as Wr,n as Va,o as Ua,m as qa}from"./Modal-ClSjJagX.js";import{R as Kt,T as Hs,U as Qt,W as oi,D as Rt,X as ys,Y as Wa,e as Vs,f as Bn,Z as za,_ as vs,$ as Us,N as Ka,a0 as Qa,a1 as Ga,a2 as Xa,r as qs,a3 as ii,a4 as Dn,g as Ht,a5 as ci,a6 as Ln,a7 as Ya,B as Ja,V as Za,a8 as el,a9 as tl,E as nl,aa as sl,ab as ai,ac as xs,p as rl,L as ol,ad as li,ae as zr,c as il,af as cl,h as al,ag as ll,ah as ul,v as ui,ai as dl,aj as fl,ak as hl,G as Kr,al as ml,I as di,am as pl,an as gl}from"./LocalMediaModal-B9eHVx6y.js";import{k as wl}from"./katex-Dv2p4YRM.js";import{a as mt}from"./appHref-ByaEnJGJ.js";import{g as fi}from"./remoteRoutePaths-D8htA0xa.js";import{c as yl,e as vl,C as xl}from"./index-CoR-vzsb.js";import{P as bl}from"./ProviderBadge-P0VTI71n.js";const ev=32,tv=64*1024;function nv(e){const t=e.trim().replace(/^#\s*/,""),n=/^acli: 1(?:\s+(.*))?$/.exec(t),s=/^acli-capabilities:\s+(.+)$/.exec(t),r=((n==null?void 0:n[1])??(s==null?void 0:s[1])??"").split(/\s+/);return r.includes(n?"+commentary-lines":"commentary-lines/1")?"lines":r.includes(n?"+commentary":"commentary/1")?"json":null}function Sl(e){JSON.parse(e);const t=/\s*("(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+)/y;let n=0;const s=()=>{t.lastIndex=n;const o=t.exec(e);if(!o)throw new Error("Missing JSON token");return n=t.lastIndex,{text:o[1],start:n-o[1].length}},r=o=>{if(o>128)throw new Error("JSON nesting exceeds commentary limit");const i=s(),l={start:i.start,end:n};if(i.text==="{"){l.members=[];const u=new Set;for(;;){const d=s();if(d.text==="}")break;const m=JSON.parse(d.text);if(u.has(m))throw new Error("Ambiguous duplicate JSON member");if(u.add(m),s(),l.members.push({key:m,start:d.start,value:r(o+1)}),s().text==="}")break}l.end=n}else if(i.text==="["){l.items=[];const u=n;if(s().text!=="]"){n=u;do l.items.push(r(o+1));while(s().text!=="]")}l.end=n}return l};return r(0)}function Qr(e,t){const n=JSON.parse(e.slice(t.start,t.end));if(!n||Array.isArray(n)||typeof n!="object"||Object.keys(n).length!==1||!Array.isArray(n.commentary)||n.commentary.length===0)return null;const s=[];for(const r of n.commentary){if(!r||typeof r!="object"||Array.isArray(r)||Object.keys(r).length!==1||typeof r.text!="string"||!r.text.trim())return null;s.push(r.text)}return s}function hi(e,t){const n=[];let s=t.start;for(const r of e.removed)r.start<t.start||r.end>t.end||(n.push(e.source.slice(s,r.start)),s=r.end);return n.push(e.source.slice(s,t.end)),n.join("")}function sv(e,t){return t.context?hi(e,t.context):null}function rv(e){const t={source:e,data:e,commentary:[],removed:[],metadataOnly:!1};if(e.length>1024*1024)return t;if(!e.includes("_acli")&&!e.includes("\\")){try{JSON.parse(e),t.json=!0}catch{}return t}let n;try{n=Sl(e)}catch{return t}t.json=!0;const s=o=>{var i;return((i=o.members)==null?void 0:i.length)===1&&o.members[0].key==="_acli"&&Qr(e,o.members[0].value)!==null},r=(o,i,l)=>{var u;if(o.items){let d=null;o.items.forEach((m,h)=>{r(m,`${i}/${h}`,d),s(m)||(d=m)})}(u=o.members)==null||u.forEach((d,m,h)=>{if(d.key!=="_acli"){r(d.value,`${i}/${d.key.replace(/~/g,"~0").replace(/\//g,"~1")}`,null);return}const w=Qr(e,d.value);if(!w)return;const g=s(o)?l:o===n?null:o;w.forEach((b,x)=>{t.commentary.push({id:`${i}/_acli/commentary/${x}`,text:b,context:g})});const f=h[m+1],y=h[m-1];t.removed.push({start:!f&&y?y.value.end:d.start,end:f?f.start:d.value.end})})};return r(n,"",null),t.removed.sort((o,i)=>o.start-i.start),t.metadataOnly=s(n),t.data=hi(t,{start:0,end:e.length}),t}function ov(e){const t="# _acli.commentary: ",n=e.startsWith(t)?e.slice(t.length).replace(/\r?\n$/,""):"",s=e.length<=1024*1024&&!!n.trim();return{source:e,data:s?"":e,commentary:s?[{id:"line",text:n,context:null}]:[],removed:s?[{start:0,end:e.length}]:[],metadataOnly:s}}class Cl{constructor(t="json"){te(this,"fragments",[]);te(this,"depth",0);te(this,"quoted",!1);te(this,"escaped",!1);te(this,"json",!1);te(this,"started",!1);this.format=t}append(t){const n=[];let s=0;for(let r=0;r<t.length;r++){const o=t[r];!this.started&&!/\s/.test(o)&&(this.started=!0,this.json=this.format==="json"&&(o==="{"||o==="[")),this.json&&(this.quoted?this.escaped?this.escaped=!1:o==="\\"?this.escaped=!0:o==='"'&&(this.quoted=!1):o==='"'?this.quoted=!0:o==="{"||o==="["?this.depth++:(o==="}"||o==="]")&&this.depth--),o===`
3
+ `&&(!this.json||!this.quoted&&this.depth<=0)&&(this.fragments.push(t.slice(s,r+1)),n.push(...this.finish()),s=r+1)}return s<t.length&&this.fragments.push(t.slice(s)),n}finish(){const t=this.fragments.join("");return this.fragments=[],this.depth=0,this.quoted=!1,this.escaped=!1,this.json=!1,this.started=!1,t?[t]:[]}}const El=8e3,_l=120,kl=3;function iv(e){return(e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean)??"Source review").slice(0,_l)}function Ll(e,t,n=kl,s="new"){if(!Number.isInteger(t)||t<0)return null;let r=0;for(const o of e){if(t<r+o.lines.length)return Ml(o,t-r,n,s);r+=o.lines.length}return null}function Ml(e,t,n,s){var h,w;let r=e.oldStart,o=e.newStart;for(let g=0;g<t;g++){const f=(h=e.lines[g])==null?void 0:h[0];f==="-"?r++:(f==="+"||r++,o++)}const i=(w=e.lines[t])==null?void 0:w[0];let l,u,d;i==="-"?(l="old",u=r,d=null):i==="+"?(l="new",u=null,d=o):(l=s,u=r,d=o);const m=Math.max(0,t-n);return{side:l,oldLine:u,newLine:d,snippet:Rl(e.lines,t,n),snippetAnchorOffset:t-m}}function Rl(e,t,n){const s=Math.max(0,t-n),r=Math.min(e.length,t+n+1),o=[];for(let i=s;i<r;i++)o.push((e[i]??"").slice(1));return o.join(`
4
+ `).slice(0,El)}const jl=/^([\w.-]+)\[(\d+)\]\{([^}]*)\}:\s*$/;function Al(e){const t=[];let n="",s=!1,r=!1;for(let o=0;o<e.length;o+=1){const i=e[o];if(s)i==='"'?e[o+1]==='"'?(n+='"',o+=1):(s=!1,r=!0):n+=i;else if(r){if(i!==",")return null;t.push(n),n="",r=!1}else if(i==='"'&&n==="")s=!0;else{if(i==='"')return null;i===","?(t.push(n),n=""):n+=i}}return s?null:(t.push(n),t)}function Tl(e){var r,o;const t=e.trim().split(`
5
+ `),n=[];let s=0;for(;s<t.length;){if(!((r=t[s])!=null&&r.trim())){s+=1;continue}const i=(o=t[s])==null?void 0:o.trim().match(jl);if(!i)return null;const l=Number(i[2]),u=(i[3]??"").split(",").map(m=>m.trim());if(u.length===0||u.some(m=>!m))return null;s+=1;const d=[];for(let m=0;m<l;m+=1,s+=1){const h=t[s];if(h===void 0||!h.trim())return null;const w=Al(h.trim());if(!w||w.length!==u.length)return null;d.push(w)}n.push({name:i[1]??"",columns:u,rows:d})}return n.length>0?n:null}const Zn=/[^\s"'`<>&,:;()[\]{}=|]+/g,es=/(?:^|\s)((?:\/(?!\/)|[A-Za-z]:[\\/])\S+)/g,Nl=/[.!?]+$/;function Il(e){const t=[];es.lastIndex=0;let n=es.exec(e);for(;n!==null;){const i=n[1];if(i){const l=n.index+n[0].length-i.length;t.push({end:l+i.length,kind:"absolute",start:l,text:i})}n=es.exec(e)}const s=[...t];let r=0;Zn.lastIndex=0;let o=Zn.exec(e);for(;o!==null;){const l=o[0].replace(Nl,""),u=o.index,d=u+l.length;for(;t[r]&&t[r].end<=u;)r+=1;const m=t[r],h=!!m&&u<m.end&&d>m.start;l&&!l.startsWith("/")&&!h&&s.push({end:d,kind:"relative",start:u,text:l}),o=Zn.exec(e)}return s.sort((i,l)=>i.start-l.start)}const ts=typeof Intl.Segmenter=="function"?new Intl.Segmenter("und",{granularity:"grapheme"}):null,Gr=String.fromCodePoint(8205);function Pl(e){for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>127)return!1;return!0}function $l(e,t){const n=[],s=[],r=[];let o=null;for(let i=0;i<e.length;i+=1){const l=e.charCodeAt(i);if(l===32||l>=9&&l<=13){o??(o=i);continue}o!==null&&(n.push(" "),s.push(o),r.push(i),o=null),n.push(t&&l>=65&&l<=90?String.fromCharCode(l+32):e[i]),s.push(i),r.push(i+1)}return o!==null&&(n.push(" "),s.push(o),r.push(e.length)),{chars:n,ends:r,starts:s}}function Xr(e){return e>=4352&&e<=4447||e>=43360&&e<=43388?"L":e>=4448&&e<=4519||e>=55216&&e<=55238?"V":e>=4520&&e<=4607||e>=55243&&e<=55291?"T":e>=44032&&e<=55203?(e-44032)%28===0?"LV":"LVT":null}function Fl(e){const t=[];let n="",s=0,r;for(const o of e){const i=s+n.length,l=r?Xr(r.codePointAt(0)):null,u=Xr(o.codePointAt(0)),d=l==="L"&&(u==="L"||u==="V"||u==="LV"||u==="LVT")||(l==="LV"||l==="V")&&(u==="V"||u==="T")||(l==="LVT"||l==="T")&&u==="T";!(n.length>0&&(new RegExp("\\p{Mark}","u").test(o)||o===Gr||r===Gr||d))&&n&&(t.push({index:s,segment:n}),s+=n.length,n="",r=void 0),n||(s=i),n+=o,r=o}return n&&t.push({index:s,segment:n}),t}function Bl(e){return(ts==null?void 0:ts.segment(e))??Fl(e)}function Dl(e,t){const n=e.normalize("NFKC");return t?n.toLowerCase().replaceAll("ς","σ"):n}function mi(e,t){if(Pl(e))return $l(e,t);const n=[],s=[],r=[];let o=null,i=0;const l=()=>{o!==null&&(n.push(" "),s.push(o),r.push(i),o=null)};for(const u of Bl(e)){const d=u.index,m=d+u.segment.length;if(/^\s+$/u.test(u.segment)){o??(o=d),i=m;continue}l();for(const h of Dl(u.segment,t))n.push(h),s.push(d),r.push(m)}return l(),{chars:n,ends:r,starts:s}}function Ol(e){return mi(e,!0)}function Hl(e){return mi(e,!1).chars.join("").trim()}function Yr(e){return e===void 0||!/[-\u2010\u2011]/u.test(e)&&/[\p{White_Space}\p{P}]/u.test(e)}class Vl{constructor(t){te(this,"boundaryIndexes");te(this,"occupiedSegments");const n=Array.from(new Set(t.flatMap(s=>[s.start,s.end]))).sort((s,r)=>s-r);this.boundaryIndexes=new Map(n.map((s,r)=>[s,r])),this.occupiedSegments=new Uint32Array(n.length+1)}overlaps(t,n){const s=this.boundaryIndexes.get(t),r=this.boundaryIndexes.get(n);return this.prefixSum(r)>this.prefixSum(s)}add(t,n){const s=this.boundaryIndexes.get(t),r=this.boundaryIndexes.get(n);for(let o=s;o<r;o+=1)this.addSegment(o)}addSegment(t){for(let n=t+1;n<this.occupiedSegments.length;n+=n&-n)this.occupiedSegments[n]+=1}prefixSum(t){let n=0;for(let s=t;s>0;s-=s&-s)n+=this.occupiedSegments[s]??0;return n}}function Ul(e,t){return t.visibleCodePoints-e.visibleCodePoints||t.requiredBoldCodePoints-e.requiredBoldCodePoints||e.glossaryOrder-t.glossaryOrder||e.rowOrder-t.rowOrder||e.alternativeOrder-t.alternativeOrder||e.start-t.start||e.end-t.end}function ql(e,t){var u,d,m,h,w,g;if(!e||t.nodes.length===0||t.terminals.length===0)return[];const n=Ol(e),s=[],r=new Map;let o=0;for(let f=0;f<n.chars.length;f+=1){const y=n.chars[f];if(y!==void 0){for(;o!==0&&((u=t.nodes[o])==null?void 0:u.transitions[y])===void 0;)o=((d=t.nodes[o])==null?void 0:d.failure)??0;o=((m=t.nodes[o])==null?void 0:m.transitions[y])??((h=t.nodes[0])==null?void 0:h.transitions[y])??0;for(const b of((w=t.nodes[o])==null?void 0:w.outputs)??[]){const x=t.terminals[b];if(!x)continue;const _=f-x.codePointLength+1;if(_<0||!Yr(n.chars[_-1])||!Yr(n.chars[f+1]))continue;const M=n.starts[_],C=n.ends[f];if(M===void 0||C===void 0)continue;const S=e.slice(M,C);if((g=x.caseSensitiveForms)!=null&&g.length){let v=r.get(b);if(v||(v=new Set(x.caseSensitiveForms),r.set(b,v)),!v.has(Hl(S)))continue}s.push({alternativeOrder:x.alternativeOrder,definitionText:x.definitionText,end:C,glossaryOrder:x.glossaryOrder,requiredBoldCodePoints:x.requiredBoldCodePoints,rowOrder:x.rowOrder,start:M,terminalIndex:b,visibleCodePoints:Array.from(S).length})}}}s.sort(Ul);const i=[],l=new Vl(s);for(const f of s)l.overlaps(f.start,f.end)||(l.add(f.start,f.end),i.push(f));return i.sort((f,y)=>f.start-y.start||f.end-y.end),i.map(({definitionText:f,end:y,start:b,terminalIndex:x})=>({definitionText:f,end:y,start:b,terminalIndex:x}))}const Wl="6.3.289",Cn=Bs(Ee.questionReminderTurns,3,e=>{const t=Number(e);return Number.isInteger(t)&&t>=0&&t<=12?t:void 0});function cv(e){if(!Number.isInteger(e)||e<0||e>12)throw new RangeError("Question reminder turns must be an integer from 0 to 12");Cn.set(e)}function zl(){return a.useSyncExternalStore(Cn.subscribe,Cn.read,Cn.read)}const Kl=ra({draft:Hr(),dismissed:Jn(),seen:Jn(),answer:Hr().nullable(),quoted:Jn().optional(),edits:oa().nonnegative()}),bs={draft:"",dismissed:!1,seen:!1,answer:null,edits:0};function Ws(e){return(e==null?void 0:e.answer)!=null||(e==null?void 0:e.quoted)===!0}const Ss=new Map,pi=new Set;let gi=0,Jr=0;function av(e,t){return`yep-async-questions:${e}:${t}`}function zs(e){if(e)try{const t=Kl.safeParse(JSON.parse(e));return t.success?t.data:void 0}catch{return}}function Ql(e){const t={};try{for(let n=0;n<localStorage.length;n++){const s=localStorage.key(n);if(!(s!=null&&s.startsWith(`${e}:`)))continue;const r=zs(localStorage.getItem(s));r&&(t[s.slice(e.length+1)]=r)}}catch{}return t}function Tt(e){let t=Ss.get(e);return t||(t={records:Ql(e),listeners:new Set},Ss.set(e,t)),t}function Cs(e,t,n=!0){const s=Tt(e);s.records=t;for(const r of s.listeners)r();if(n){gi++;for(const r of pi)r()}}function Zr(e){var t;if(!(e.key!==null&&!e.key.startsWith("yep-async-questions:"))){for(const n of Ss.keys())if(e.key===null)Cs(n,{});else if(e.key.startsWith(`${n}:`)){const s=e.key.slice(n.length+1),r={...Tt(n).records},o=zs(e.newValue);o?r[s]={...o,edits:Math.max(o.edits,((t=r[s])==null?void 0:t.edits)??0)}:delete r[s],Cs(n,r)}}}function wi(e,t){return Jr++===0&&window.addEventListener("storage",Zr),e.add(t),()=>{e.delete(t),--Jr===0&&window.removeEventListener("storage",Zr)}}function lv(e){return Tt(e).records}function Gl(e,t,n){const s=Tt(e),r=s.records[t]??bs;let o=r;try{o=zs(localStorage.getItem(`${e}:${t}`))??o}catch{}const i={...o,...n,edits:Math.max(r.edits,o.edits,n.edits??0)};try{localStorage.setItem(`${e}:${t}`,JSON.stringify(i))}catch{}const l={...s.records,[t]:i},u=r.answer!==i.answer||r.quoted!==i.quoted||r.dismissed!==i.dismissed||r.seen!==i.seen||r.edits!==i.edits;return Cs(e,l,u),l}function Xl(e){return a.useSyncExternalStore(t=>wi(Tt(e).listeners,t),()=>Tt(e).records)}const Yl=e=>wi(pi,e),Jl=()=>gi;function uv(){return a.useSyncExternalStore(Yl,Jl)}function Zl(e){return{countTurns:e,countEdits:Math.round(e*160/3),overflowTurns:Math.ceil(e*8/3),overflowEdits:e*200}}function Mn(e,t,n=3){const s=Zl(n);return e>=s.overflowTurns||t>=s.overflowEdits?"retired":e>=s.countTurns||t>=s.countEdits?"quiet":"recent"}function eu(e){const t=[],n=new Set,s=new Set;for(let r=e.length-1;r>=0;r--){const o=e[r];if(o.type==="user_prompt"&&s.add(o.id),o.type==="text")for(const i of o.sourceMessages){const l=ja(i);if(!l||i.codexAgentMessageDelivery!=="async")continue;const u=i.codexAsyncQuestions;if(u)for(let d=u.length-1;d>=0;d--){const m=u[d],h=JSON.stringify([l,d]);n.has(h)||(n.add(h),t.push({id:h,messageId:l,renderId:o.id,index:d,title:m.title,options:m.options??[],age:s.size}))}}}return t.reverse()}function Es(e){return e.split(`
6
+ `).map(t=>`> ${t}`).join(`
7
+ `)}function Rn(e){const t=e.sourceElement.closest("[data-render-id]"),n=t==null?void 0:t.dataset.renderId,r=(t?Array.from(t.querySelectorAll('[data-markdown-copy-source="true"]')):[]).indexOf(e.sourceElement);return{id:ia(),sourceElement:e.sourceElement,...n?{renderId:n}:{},...r>=0?{sourceIndex:r}:{},range:e.range,selectedText:e.selectedText,quotedText:Es(e.markdown),lineSignatures:ou(e.markdown),sourceStart:e.sourceStart,sourceEnd:e.sourceEnd,sourceLocation:e.sourceLocation}}function tu(e,t){if(e.sourceElement.isConnected)return!0;if(!t||!e.renderId||e.sourceIndex===void 0)return!1;const n=Array.from(t.querySelectorAll("[data-render-id]")).find(r=>r.dataset.renderId===e.renderId),s=n==null?void 0:n.querySelectorAll('[data-markdown-copy-source="true"]')[e.sourceIndex];return s?(e.sourceElement=s,!0):!1}function nu(e){if(e.sourceStart!==void 0&&e.sourceEnd!==void 0){const t=Ta(e.sourceElement,{start:e.sourceStart,end:e.sourceEnd});if(t)return t}return au(e.range)?e.range:uu(e.sourceElement,e.selectedText)}function su(e){return new Set(e.split(`
8
+ `).filter(iu).map(yi).filter(Boolean))}function ru(e,t){return t.lineSignatures.length===0?!1:t.lineSignatures.some(n=>e.has(n))}function dv(e,t,n){var i;if(e===t)return{mayAffectQuoteAnchors:!1};if(!n||(i=n.inputType)!=null&&i.startsWith("history"))return{mayAffectQuoteAnchors:!0};const s=Gt(n.start,e.length),r=Math.max(s,Gt(n.end,e.length)),o=n.insertedText;return{mayAffectQuoteAnchors:eo(e,s,r)||eo(t,s,s+o.length)}}function ou(e){return e.split(`
9
+ `).map(yi).filter(Boolean)}function iu(e){return/^[\t ]*>/.test(e)}function yi(e){return e.replace(/^[\t ]*>\s?/,"").replace(/\s+/g," ").trim()}function Gt(e,t){return Number.isFinite(e)?Math.max(0,Math.min(t,Math.trunc(e))):0}function eo(e,t,n){if(!e)return!1;const s=Gt(t,e.length),r=Math.max(s,Gt(n,e.length));if(un(e,s)||r>s&&un(e,r-1)||r<e.length&&un(e,r))return!0;for(let o=s;o<r;o+=1)if(e[o]===`
10
+ `&&un(e,o+1))return!0;return!1}function un(e,t){if(!e)return!1;const n=Gt(t,e.length),s=Math.max(0,n-1),r=e.lastIndexOf(`
11
+ `,s)+1;return cu(e,r)}function cu(e,t){for(let n=t;n<e.length;n+=1){const s=e[n];if(!(s===" "||s===" "))return s===">"}return!1}function au(e){return e.collapsed||!e.startContainer.isConnected||!e.endContainer.isConnected?!1:typeof e.getClientRects!="function"?!0:e.getClientRects().length>0}function lu(e){const n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>o.textContent&&o.textContent.length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});let s="";const r=[];for(let o=n.nextNode();o;o=n.nextNode()){const i=o,l=i.textContent??"";for(let u=0;u<=l.length;u+=1)r[s.length+u]={node:i,offset:u};s+=l}return s?{text:s,positions:r}:null}function uu(e,t){if(!e.isConnected)return null;const n=lu(e);if(!n)return null;const s=n.text.indexOf(t);if(s>=0)return to(e,n.positions,s,s+t.length);const r=no(n.text),o=no(t);if(!o.text)return null;const i=r.text.indexOf(o.text);if(i<0)return null;const l=i+o.text.length-1,u=r.map[i],d=r.map[l];return u===void 0||d===void 0?null:to(e,n.positions,u,d+1)}function to(e,t,n,s){const r=t[n],o=t[s];if(!r||!o)return null;const i=e.ownerDocument.createRange();return i.setStart(r.node,r.offset),i.setEnd(o.node,o.offset),i}function no(e){let t="";const n=[];let s=null;for(let r=0;r<e.length;r+=1){const o=e[r]??"";if(/\s/.test(o)){t.length>0&&s===null&&(s=r);continue}s!==null&&(t+=" ",n.push(s),s=null),t+=o,n.push(r)}return{text:t,map:n}}const vi=a.createContext(null),Ks=()=>a.useContext(vi);function fv({storageKey:e,draftSignal:t,send:n,quote:s,focusComposer:r,target:o,children:i}){const l=zl(),[u,d]=a.useState([]),m=Xl(e),h=a.useRef(m);a.useEffect(()=>{var W,Y;const O={...m};for(const G of S.current)O[G]={...O[G]??bs,edits:Math.max(((W=O[G])==null?void 0:W.edits)??0,((Y=h.current[G])==null?void 0:Y.edits)??0)};h.current=O},[m]);const w=a.useRef(u),[g,f]=a.useState(null),[y,b]=a.useState(null),[x,_]=a.useState(null),M=a.useRef(!1),C=a.useRef(0),S=a.useRef(new Set),[v,L]=a.useState(!1),p=a.useRef(null),E=a.useRef(null),[T,I]=a.useState(null),j=a.useRef({send:n,quote:s,focusComposer:r});j.current={send:n,quote:s,focusComposer:r};const k=a.useCallback((O,W)=>{var G;const Y=Gl(e,O,{...W,edits:Math.max(((G=h.current[O])==null?void 0:G.edits)??0,W.edits??0)});h.current={...h.current,[O]:Y[O]},S.current.delete(O)},[e]),A=a.useCallback(()=>{for(const O of S.current)k(O,{edits:h.current[O].edits})},[k]),$=a.useCallback((O,W)=>{k(O,W)},[k]),P=a.useCallback(O=>{const W=eu(O);JSON.stringify(W)!==JSON.stringify(w.current)&&(w.current=W,d(W))},[]);a.useEffect(()=>{let O=t.getDraft();return t.subscribeDraftChanges(({text:W})=>{const Y=W!==O;if(O=W,!Y||!W)return;let G=!1;const R={...h.current};for(const he of w.current){const re=R[he.id]??bs;if(re.dismissed||Ws(re))continue;const ae=Math.min(2400,re.edits+1);ae!==re.edits&&(S.current.add(he.id),G||(G=Mn(he.age,ae,l)!==Mn(he.age,re.edits,l)),R[he.id]={...re,edits:ae})}h.current=R,G&&A()})},[t,A,l]),a.useEffect(()=>{A()},[l,A]),a.useEffect(()=>{const O=()=>{document.hidden&&A()};return document.addEventListener("visibilitychange",O),window.addEventListener("pagehide",A),()=>{A(),document.removeEventListener("visibilitychange",O),window.removeEventListener("pagehide",A)}},[A]);const B=a.useCallback(O=>{var W,Y,G;C.current++,E.current??(E.current=((W=p.current)==null?void 0:W.capture())??null),I(((G=(Y=E.current)==null?void 0:Y.anchor)==null?void 0:G.id)??null),L(!1),f(O.id),b({renderId:O.renderId,questionId:O.id,token:C.current})},[]),q=a.useRef(null);a.useEffect(()=>{if(!o||q.current===o.token)return;const O=u.find(W=>W.messageId===o.messageId&&W.index===o.index);O&&(q.current=o.token,E.current={atBottom:!0,following:!0,scrollTop:0,scrollHeight:0,clientHeight:0,updatedAtMs:Date.now()},B(O))},[o,u,B]);const D=a.useCallback(()=>{var W;C.current++,f(null),b(null);const O=E.current;E.current=null,I(null),O&&((W=p.current)==null||W.restore(O)),j.current.focusComposer()},[]),U=a.useCallback(async(O,W)=>{var he;if(!W.trim()||M.current)return!1;const Y=C.current;E.current??(E.current=((he=p.current)==null?void 0:he.capture())??null),M.current=!0,_(O.id);let G=!1;const R=re=>{var ke;const ae=re.target;ae instanceof Element&&re.type!=="wheel"&&((ke=ae.closest("[data-async-question-reply]"))==null?void 0:ke.dataset.asyncQuestionReply)===O.id||(G=!0)};document.addEventListener("pointerdown",R,!0),document.addEventListener("focusin",R,!0),document.addEventListener("wheel",R,{capture:!0,passive:!0});try{const re=await j.current.send(`${Es(O.title)}
12
+
13
+ ${W}`);return re&&($(O.id,{answer:W,draft:"",seen:!0}),!G&&Y===C.current?D():Y===C.current&&(f(null),b(null),I(null),E.current=null)),re}finally{M.current=!1,_(null),document.removeEventListener("pointerdown",R,!0),document.removeEventListener("focusin",R,!0),document.removeEventListener("wheel",R,!0)}},[D,$]),Q=a.useCallback(O=>{B(O),f(null),I(null),E.current=null,j.current.quote(`${Es(O.title)}
14
+
15
+ `),$(O.id,{quoted:!0,seen:!0})},[B,$]),Z=a.useMemo(()=>{const O=u.find(W=>W.id===g);return[...O?[O.renderId]:[],...T?[T]:[]]},[u,g,T]),K=a.useMemo(()=>({reminderTurns:l,questions:u,records:m,activeId:g,navigationTarget:y,submittingId:x,menuOpen:v,retainedRenderIds:Z,setMenuOpen:L,observe:P,navigation:p,open:B,returnToPrevious:D,update:$,submit:U,quote:Q}),[l,u,m,g,y,x,v,Z,P,B,D,$,U,Q]);return c.jsx(vi.Provider,{value:K,children:i})}const du="_indicator_u9558_1",fu="_recent_u9558_17",hu="_overflowEntry_u9558_22",mu="_menu_u9558_28",pu="_menuHeading_u9558_42",gu="_groupHeading_u9558_48",wu="_questionList_u9558_53",yu="_menuRow_u9558_60",vu="_turnAge_u9558_67",xu="_previewBox_u9558_73",bu="_preview_u9558_73",Su="_previewText_u9558_95",Cu="_unseen_u9558_100",Eu="_dismiss_u9558_106",_u="_rowMenu_u9558_117",ku="_secondary_u9558_134",Lu="_inlineQuestion_u9558_144",Mu="_activeQuestion_u9558_151",Ru="_questionTitle_u9558_154",ju="_hint_u9558_158",Au="_options_u9558_163",Tu="_iconAction_u9558_190",Nu="_replyForm_u9558_201",Iu="_replyActions_u9558_216",Pu="_send_u9558_222",$u="_sent_u9558_230",Fu="_error_u9558_235",J={indicator:du,recent:fu,overflowEntry:hu,menu:mu,menuHeading:pu,groupHeading:gu,questionList:wu,menuRow:yu,turnAge:vu,previewBox:xu,preview:bu,previewText:Su,unseen:Cu,dismiss:Eu,rowMenu:_u,secondary:ku,inlineQuestion:Lu,activeQuestion:Mu,questionTitle:Ru,hint:ju,options:Au,iconAction:Tu,replyForm:Nu,replyActions:Iu,send:Pu,sent:$u,error:Fu},dn=pt(Ee.glossaryHints,!1);function Bu(){return{glossaryHintsEnabled:a.useSyncExternalStore(dn.subscribe,dn.read,dn.read),setGlossaryHintsEnabled:dn.set}}const Du="",Ou=32,Hu=32*1024*1024,fn={state:"idle"};function so(e,t){return e!==null&&t!==null&&e.epoch===t.epoch&&e.sequence===t.sequence}function ns(e){if(e===void 0)return Du;const t=e.replaceAll("\\","/").replace(/^\.\//,"");if(!t||t.startsWith("/")||t.includes("\0"))return null;const n=[];for(const s of t.split("/"))if(!(!s||s===".")){if(s==="..")return null;n.push(s)}return n.join("/")||null}function Vu(e){const t="/GLOSSARY.md";return e.endsWith(t)?e.slice(0,-t.length):""}function Uu(e,t){return t?e===t||(e==null?void 0:e.startsWith(`${t}/`))===!0:!0}function qu(e){if(!e||typeof e!="object"||!("type"in e))return!1;const t=e.type;return t==="glossary-paths-snapshot"||t==="glossary-path-changed"}function Wu(e){return e===void 0?0:new TextEncoder().encode(JSON.stringify(e)).byteLength}class zu{constructor(t={}){te(this,"active",null);te(this,"stream",null);te(this,"paths",new Set);te(this,"pathsReady",!1);te(this,"generation",null);te(this,"entries",new Map);te(this,"listeners",new Map);te(this,"activationSerial",0);te(this,"accessSerial",0);te(this,"maxInactiveArtifacts");te(this,"maxInactiveBytes");this.maxInactiveArtifacts=Math.max(0,Math.floor(t.maxInactiveArtifacts??Ou)),this.maxInactiveBytes=Math.max(0,Math.floor(t.maxInactiveBytes??Hu))}activate(t,n){var r;if(((r=this.active)==null?void 0:r.projectId)===t&&this.active.transport===n)return;this.active&&this.deactivate();const s=++this.activationSerial;this.active={projectId:t,transport:n,activationSerial:s},this.stream=ca(n,{subscribe:({transport:o,handlers:i})=>o.subscribeGlossary(t,i),onEvent:o=>{var i;((i=this.active)==null?void 0:i.activationSerial)===s&&qu(o.data)&&this.handleSubscriptionEvent(o.data)}},{inactivityTimeoutMs:aa})}deactivate(){var t;(t=this.stream)==null||t.close(),this.stream=null,this.active=null,this.paths.clear(),this.pathsReady=!1,this.generation=null;for(const n of this.entries.values())n.requestSerial+=1;this.entries.clear(),this.emitAll()}getSnapshot(t){const n=ns(t);if(n===null)return fn;const s=this.entries.get(n);return s?(this.touch(s),s.snapshot):fn}subscribe(t,n){const s=ns(t);if(s===null)return()=>{};let r=this.listeners.get(s);r||(r=new Set,this.listeners.set(s,r)),r.add(n);const o=this.entries.get(s);return o&&this.touch(o),()=>{const i=this.listeners.get(s);if(i&&(i.delete(n),i.size===0)){this.listeners.delete(s);const l=this.entries.get(s);l&&(l.requested=!1,this.touch(l)),this.pruneInactiveEntries()}}}ensure(t){const n=ns(t);if(n===null)return;const s=this.getOrCreateEntry(n);s.requested=!0,this.touch(s),this.ensureEntry(n,s)}diagnostics(){var s;let t=0,n=0;for(const[r,o]of this.entries)this.isPinned(r,o)||(t+=1,n+=o.estimatedBytes);return{activeProjectId:((s=this.active)==null?void 0:s.projectId)??null,artifacts:this.entries.size,glossaryPaths:this.paths.size,inactiveArtifacts:t,inactiveBytes:n,pathsReady:this.pathsReady}}handleSubscriptionEvent(t){t.type==="glossary-paths-snapshot"?this.handleSnapshot(t):this.handlePathChange(t)}handleSnapshot(t){const n=this.pathsReady,s=n&&!so(this.generation,t.generation);this.paths=new Set(t.paths),this.pathsReady=!0,this.generation=t.generation,n?s&&this.invalidateEntries(()=>!0):this.invalidateEntries(r=>r.snapshot.state==="loading"),this.ensureRequestedEntries(),this.pruneInactiveEntries()}handlePathChange(t){var r;const n=(((r=this.generation)==null?void 0:r.sequence)??-1)+1,s=!this.generation||this.generation.epoch!==t.generation.epoch||t.generation.sequence!==n;if(t.changeType==="delete"?this.paths.delete(t.path):this.paths.add(t.path),this.pathsReady=!0,this.generation=t.generation,s||t.changeType==="create")this.invalidateEntries(()=>!0);else{const o=Vu(t.path);this.invalidateEntries(i=>(i.snapshot.result&&"dependencies"in i.snapshot.result?i.snapshot.result.dependencies:[]).some(d=>d.path===t.path)||t.changeType==="delete"&&Uu(i.sourcePath,o))}this.ensureRequestedEntries(),this.pruneInactiveEntries()}invalidateEntries(t){for(const[n,s]of this.entries)t(s)&&(s.requestSerial+=1,s.snapshot=fn,s.estimatedBytes=0,this.emit(n))}ensureRequestedEntries(){for(const[t,n]of this.entries)n.requested&&this.ensureEntry(t,n)}ensureEntry(t,n){if(!this.active||n.snapshot.state==="loading"||n.snapshot.state==="ready"||n.snapshot.state==="none"||n.snapshot.state==="disabled")return;const s=this.findReusableRootEntry(n);if(s){n.snapshot=s.snapshot,n.estimatedBytes=s.estimatedBytes,this.touch(n),this.emit(t);return}const r=this.active,o=this.generation,i=++n.requestSerial;n.snapshot={state:"loading"},n.estimatedBytes=0,this.emit(t);const l=new URLSearchParams;n.sourcePath!==void 0&&l.set("sourcePath",n.sourcePath);const u=l.size>0?`?${l.toString()}`:"";r.transport.fetch(`/projects/${encodeURIComponent(r.projectId)}/glossary-artifact${u}`).then(d=>{this.active!==r||n.requestSerial!==i||o!==null&&!so(o,this.generation)||(n.snapshot={state:d.status,result:d},n.estimatedBytes=Wu(d),this.touch(n),this.emit(t),this.pruneInactiveEntries())}).catch(d=>{this.active!==r||n.requestSerial!==i||(n.snapshot={state:"error",error:d instanceof Error?d:new Error(String(d))},n.estimatedBytes=0,this.touch(n),this.emit(t),this.pruneInactiveEntries())})}findReusableRootEntry(t){if(t.sourcePath!==void 0||!this.pathsReady)return null;for(const n of this.entries.values()){if(n===t)continue;const s=n.snapshot.result;if((n.snapshot.state==="ready"||n.snapshot.state==="disabled")&&s&&"governingPath"in s&&s.governingPath==="GLOSSARY.md")return n}return null}getOrCreateEntry(t){const n=this.entries.get(t);if(n)return n;const s={sourcePath:t||void 0,snapshot:fn,requested:!1,requestSerial:0,lastUsedSerial:++this.accessSerial,estimatedBytes:0};return this.entries.set(t,s),s}touch(t){t.lastUsedSerial=++this.accessSerial}isPinned(t,n){return n.requested||n.snapshot.state==="loading"||this.listeners.has(t)}pruneInactiveEntries(){const t=Array.from(this.entries.entries()).filter(([r,o])=>!this.isPinned(r,o)).sort(([,r],[,o])=>r.lastUsedSerial-o.lastUsedSerial);let n=t.length,s=t.reduce((r,[,o])=>r+o.estimatedBytes,0);for(const[r,o]of t){if(n<=this.maxInactiveArtifacts&&s<=this.maxInactiveBytes)break;this.entries.delete(r),n-=1,s-=o.estimatedBytes}}emit(t){for(const n of this.listeners.get(t)??[])n()}emitAll(){for(const t of this.listeners.values())for(const n of t)n()}}const Ku={state:"idle"},_s=a.createContext(null);function Qu(e,t){if(!t||!Kt(e))return t;const n=t.replaceAll("\\","/"),s=Hs(e).replaceAll("\\","/");if(n.startsWith(`${s}/`))return n.slice(s.length+1);if(!(n.startsWith("/")||/^[A-Za-z]:\//.test(n)))return t}function Gu({children:e,enabled:t=!0,projectId:n}){const s=a.useContext(_s),r=Os(),{glossaryHintsEnabled:o}=Bu(),{version:i}=ti(),l=a.useMemo(()=>new zu,[]),u=(s==null?void 0:s.projectId)===n?s.store:null,m=u===null&&t&&o&&Kt(n)&&Wt(i,la);a.useLayoutEffect(()=>{if(!m||!Kt(n)){l.deactivate();return}return l.activate(n,r.transport),()=>l.deactivate()},[l,m,n,r.transport]);const h=a.useMemo(()=>u?{projectId:n,store:u}:m?{projectId:n,store:l}:null,[u,l,m,n]);return c.jsx(_s.Provider,{value:h,children:e})}function ro({children:e,projectId:t}){return c.jsx(Gu,{projectId:t,children:e})}function xi(e){const t=a.useContext(_s),n=Qu((t==null?void 0:t.projectId)??"",e),s=a.useCallback(i=>(t==null?void 0:t.store.subscribe(n,i))??(()=>{}),[t,n]),r=a.useCallback(()=>(t==null?void 0:t.store.getSnapshot(n))??Ku,[t,n]),o=a.useSyncExternalStore(s,r,r);return a.useEffect(()=>{t==null||t.store.ensure(n)},[t,n]),o}const Xu="_host_n1tgc_4",Yu={host:Xu},bi='<svg class="render-mode-glyph" width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"><text x="8" y="8.1" text-anchor="middle" dominant-baseline="central" font-family="KaTeX_Main, Times New Roman, serif" font-size="12.5" font-weight="500" fill="currentColor">Σ</text></svg>';function Ju(){return c.jsx("span",{className:Yu.host,dangerouslySetInnerHTML:{__html:bi}})}const Zu={dark:"dark",light:"neutral"};let ss=null,oo=null,ed=0;async function td(){return ss||(ss=Yo(()=>import("./mermaid.core-BCu1nv8H.js").then(e=>e.cb),__vite__mapDeps([0,1,2,3])).then(e=>e.default)),ss}function nd(e,t){oo!==t&&(e.initialize({startOnLoad:!1,securityLevel:"strict",theme:Zu[t]}),oo=t)}function sd(e){for(const t of document.querySelectorAll(`#${e}, #d${e}`))t.remove()}const rd={language:"mermaid",renderedNoun:"diagram",async render(e){const t=await td();nd(t,Xo());const n=`ya-mermaid-${++ed}`;try{const{svg:s}=await t.render(n,e);return s}catch{return null}finally{sd(n)}}},Si=new Map;function od(e){Si.set(e.language,e)}function id(e){return Si.get(e)}od(rd);const cd="_root_1l3gc_4",ad={root:cd},ld=ad.root,ud="pre > code[class*='language-']",dd=/(?:^|\s)language-(\S+)/,fd=2500,jn="data-ya-code-block",io="data-ya-code-rendered",Qs="data-ya-code-toggle",hd=50,Ot=new Map;function md(e,t){for(Ot.set(e,t);Ot.size>hd;){const n=Ot.keys().next();if(n.done)return;Ot.delete(n.value)}}function pd(e,t,n){return`${e.language}|${n}|${t.length}|${t}`}function gd(e,t){e.dataset.yaCodeLanguage!==t&&(e.dataset.yaCodeLanguage=t,e.setAttribute("aria-label",`${t} code block`))}function wd(e,t){const n=e.createElement("button");return n.type="button",n.setAttribute(Qs,""),n.innerHTML=bi,n.dataset.yaRenderedNoun=t.renderedNoun,n}function yd(e,t){const n=e.dataset.yaRenderedNoun??"rendered view",s=t?`Show ${n} source`:`Show ${n}`;e.setAttribute("aria-pressed",String(t)),e.setAttribute("aria-label",s),e.title=s}function Ci(e,t){e.dataset.yaCodeView=t;const n=e.querySelector(`[${Qs}]`);n&&yd(n,t==="rendered")}function vd(e,t,n,s){const r=e.ownerDocument,o=e.parentElement;let i=(o==null?void 0:o.hasAttribute(jn))===!0?o:void 0;i||(i=r.createElement("div"),i.setAttribute(jn,""),e.replaceWith(i),i.append(e),i.append(wd(r,s)));let l=i.querySelector(`[${io}]`);l||(l=r.createElement("div"),l.setAttribute(io,""),i.insertBefore(l,e)),l.innerHTML=t,i.dataset.yaRenderKey=n,Ci(i,i.dataset.yaCodeView==="source"?"source":"rendered")}async function xd(e,t,n){const s=t.textContent??"";if(s.trim()==="")return;const r=pd(n,s,Xo()),o=e.closest(`[${jn}]`);if(o instanceof HTMLElement&&o.dataset.yaRenderKey===r||e.dataset.yaRenderAttempt===r)return;e.dataset.yaRenderAttempt=r;let i=Ot.get(r);i===void 0&&(i=await n.render(s),md(r,i)),!(i===null||!e.isConnected)&&vd(e,i,r,n)}function bd(e){var t,n;for(const s of e.querySelectorAll(ud)){const r=s.parentElement;if(!r)continue;const o=(n=(t=dd.exec(s.className))==null?void 0:t[1])==null?void 0:n.toLowerCase();if(!o)continue;gd(r,o);const i=id(o);i&&xd(r,s,i)}}function Sd(e){a.useEffect(()=>{var m,h,w;const t=e.current;if(!t)return;let n=!1,s;const r=()=>{n=!1,bd(t)},o=()=>{n||(n=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(r):window.setTimeout(r,0))},i=g=>{const f=g.target;if(!(f instanceof Element))return;const y=f.closest(`[${Qs}]`),b=y==null?void 0:y.closest(`[${jn}]`);if(y&&b instanceof HTMLElement){g.stopPropagation(),g.preventDefault(),Ci(b,b.dataset.yaCodeView==="source"?"rendered":"source");return}const x=f.closest("pre[data-ya-code-language]");if(x){for(const _ of t.querySelectorAll("pre[data-ya-code-language-shown]"))delete _.dataset.yaCodeLanguageShown;x.dataset.yaCodeLanguageShown="1",window.clearTimeout(s),s=window.setTimeout(()=>{delete x.dataset.yaCodeLanguageShown},fd)}};r(),t.addEventListener("click",i);const l=new MutationObserver(o);l.observe(t,{childList:!0,subtree:!0});const u=new MutationObserver(o);u.observe(t.ownerDocument.documentElement,{attributeFilter:["data-theme"],attributes:!0});const d=(h=(m=t.ownerDocument.defaultView)==null?void 0:m.matchMedia)==null?void 0:h.call(m,"(prefers-color-scheme: dark)");return(w=d==null?void 0:d.addEventListener)==null||w.call(d,"change",o),()=>{var g;l.disconnect(),u.disconnect(),(g=d==null?void 0:d.removeEventListener)==null||g.call(d,"change",o),t.removeEventListener("click",i),window.clearTimeout(s)}},[e])}const Cd="_term_a5syx_1",Ed={term:Cd},_d=["a","button","code","input","kbd","pre","samp","script","select","style","textarea","[data-glossary-term]","[data-tooltip]","[title]",".katex"].join(","),kd=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DD","DIV","DL","DT","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"]);function Ld(e){const t=[];let n=[],s="";const r=()=>{s&&t.push({segments:n,text:s}),n=[],s=""},o=i=>{if(i instanceof Text){if(!i.data)return;const u=s.length;s+=i.data,n.push({start:u,end:s.length,node:i});return}if(!(i instanceof Element))return;if(i.matches(_d)){r();return}const l=kd.has(i.tagName)||i.tagName==="BR";l&&r();for(const u of i.childNodes)o(u);l&&r()};for(const i of e.childNodes)o(i);return r(),t}function Md(e,t,n,s,r,o){const i=Math.max(t,e.start)-e.start,l=Math.min(n,e.end)-e.start;if(i>=l)return;e.node.splitText(l);const u=e.node.splitText(i),d=document.createElement("span");d.className=Ed.term,d.dataset.glossaryTerm="true",d.dataset.glossaryMatch=o,d.title=s,r&&(d.setAttribute("role","button"),d.tabIndex=0),u.replaceWith(d),d.append(u)}function Ei(e,t){if(!t||typeof document>"u"||!e)return{changed:!1,html:e};const n=document.createElement("template");n.innerHTML=e;const s=Ld(n.content);let r=0,o=!1;for(const i of s){const l=ql(i.text,t);for(let u=l.length-1;u>=0;u-=1){const d=l[u];if(!d)continue;const m=i.segments.filter(w=>w.start<d.end&&d.start<w.end);if(m.length===0)continue;const h=`g${r++}`;for(let w=m.length-1;w>=0;w-=1){const g=m[w];g&&Md(g,d.start,d.end,d.definitionText,w===0,h)}o=!0}}return{changed:o,html:o?n.innerHTML:e}}const ks="yep-anywhere-file-viewer-density-zoom",_i=-4,ki=6,Rd=.5,jd=1,Ad={fontSizeOffsetPx:-1,verticalSpacingOffsetPx:-2},Td={fontSizeOffsetPx:0,verticalSpacingOffsetPx:0};function Li(e){return Math.min(ki,Math.max(_i,e))}function Nd(){if(typeof sessionStorage>"u")return 0;try{const e=Number(sessionStorage.getItem(ks));return Number.isFinite(e)?Li(e):0}catch{return 0}}function Id(e){if(!(typeof sessionStorage>"u"))try{e===0?sessionStorage.removeItem(ks):sessionStorage.setItem(ks,String(e))}catch{}}function co(e,t){return{fontSizeOffsetPx:(e.fontSizeOffsetPx??0)+(t.fontSizeOffsetPx??0),verticalSpacingOffsetPx:(e.verticalSpacingOffsetPx??0)+(t.verticalSpacingOffsetPx??0)}}function Pd({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--markdown-preview-font-size-offset":`${e}px`,"--markdown-preview-vspace-offset":`${t}px`}}function $d({fontSizeOffsetPx:e=0,verticalSpacingOffsetPx:t=0}={}){return{"--source-font-size-offset":`${e}px`,"--source-vspace-offset":`${t}px`}}function Fd(){const[e,t]=a.useState(Nd),n=a.useMemo(()=>({fontSizeOffsetPx:e*Rd,verticalSpacingOffsetPx:e*jd}),[e]),s=a.useCallback(r=>{const o=Li(r);t(o),Id(o)},[]);return{canZoomIn:e<ki,canZoomOut:e>_i,density:n,zoom:e,zoomIn:()=>s(e+1),zoomOut:()=>s(e-1)}}const Gs=a.memo(a.forwardRef(function({ariaLabel:t,className:n,density:s,html:r,onClick:o,onContextMenu:i,onKeyDown:l,sourcePath:u},d){const m=["markdown-preview",n].filter(Boolean).join(" "),h=xi(u),w=a.useMemo(()=>{var y;return h.state!=="ready"||((y=h.result)==null?void 0:y.status)!=="ready"?r:Ei(r,h.result.artifact).html},[h,r]),g=a.useMemo(()=>({__html:w}),[w]),f=a.useRef(null);return Sd(f),c.jsx("div",{className:m,role:"region","aria-label":t??"Markdown preview",onClick:o,onContextMenu:i,onKeyDown:l,ref:d,style:Pd(s),children:c.jsx("div",{className:`markdown-rendered ${ld}`,ref:f,dangerouslySetInnerHTML:g})})}));function Bd({canZoomIn:e,canZoomOut:t,onZoomIn:n,onZoomOut:s,zoom:r}){return c.jsxs("div",{className:"file-viewer-density-controls",role:"group","aria-label":"Source zoom",children:[c.jsx("button",{type:"button",className:"file-viewer-action",onClick:s,disabled:!t,title:"Zoom source and preview out","aria-label":"Zoom source and preview out",children:c.jsx(Dd,{})}),c.jsx("span",{className:"file-viewer-density-value","aria-hidden":"true",children:r>0?`+${r}`:r}),c.jsx("button",{type:"button",className:"file-viewer-action",onClick:n,disabled:!e,title:"Zoom source and preview in","aria-label":"Zoom source and preview in",children:c.jsx(Od,{})})]})}function Dd(){return c.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:c.jsx("path",{d:"M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function Od(){return c.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",children:c.jsx("path",{d:"M8 3v10M3 8h10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}const Mi=a.createContext(null),Hd=[];function hv({children:e}){const[t,n]=a.useState("rendered"),[s,r]=a.useState(()=>new Set),[o,i]=a.useState(0),l=a.useCallback((m,h)=>{r(w=>{const g=w.has(m);if(h===g)return w;const f=new Set(w);return h?f.add(m):f.delete(m),f})},[]),u=a.useCallback(()=>{n(m=>m==="rendered"?"source":"rendered"),r(()=>new Set),i(m=>m+1)},[]);a.useEffect(()=>{const m=h=>{h.defaultPrevented||h.isComposing||(h.ctrlKey||h.metaKey)&&h.shiftKey&&!h.altKey&&h.key.toLowerCase()==="m"&&(h.preventDefault(),u())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[u]);const d=a.useMemo(()=>({globalMode:t,state:s.size>0?"mixed":t,resetVersion:o,toggleGlobalMode:u,setOverrideActive:l}),[t,s.size,o,l,u]);return c.jsx(Mi.Provider,{value:d,children:e})}function Vd(){return a.useContext(Mi)}function Ud(e,t={}){const n=Vd(),s=t.participateInGlobalMode??!0,r=s&&n?n.globalMode:"rendered",o=s&&n?n.resetVersion:0,i=t.renderWhenDisabled??!0,l=t.resetDependencies??Hd,u=a.useRef(l);u.current=l;const d=a.useId(),[m,h]=a.useState(()=>t.initialMode&&t.initialMode!==r?t.initialMode:null),w=a.useRef([e,o,...l]);a.useEffect(()=>{const y=[e,o,...u.current],b=w.current;w.current=y,(y.length!==b.length||y.some((x,_)=>!Object.is(x,b[_])))&&h(null)},[e,o,...l]),a.useEffect(()=>{if(!n||!s)return;const y=e&&m!==null;return n.setOverrideActive(d,y),()=>{n.setOverrideActive(d,!1)}},[e,n,m,s,d]);const g=e?(m??r)==="rendered":i,f=a.useCallback(()=>{e&&h(y=>{const x=(y??r)==="rendered"?"source":"rendered";return x===r?null:x})},[e,r]);return{showRendered:g,toggleLocalMode:f}}const qd=1e3,ao="[SessionUITrace]";let Ye=null;function Wd(e){try{return JSON.stringify(e)}catch{return JSON.stringify({unserializable:!0})}}function zd(e,t){if(e==="session-stream-event"){const n=t.eventType,s=t.sdkType;if(n==="message"&&s==="stream_event")return"stream:message:stream_event";if(n==="pending"||n==="markdown-augment")return`stream:${String(n)}`}if(e==="session-stream-dispatch"){const n=t.eventType,s=t.sdkType;if(n==="message"&&s==="stream_event")return"dispatch:message:stream_event";if(n==="pending"||n==="markdown-augment")return`dispatch:${String(n)}`}return null}function Ri(e){vl.record("log",ao,`${ao} ${Wd(e)}`)}function Kd(){const e=Ye;e&&(Ye=null,e.timer&&clearTimeout(e.timer),Ri({event:"session-ui-trace-batch",sessionId:e.sessionId,total:e.total,counts:e.counts,windowMs:Date.now()-e.startedAt,firstEventId:e.firstEventId??null,lastEventId:e.lastEventId??null}))}function Qd(e,t){Ye||(Ye={timer:null,startedAt:Date.now(),total:0,counts:{},sessionId:t.sessionId,firstEventId:t.eventId},Ye.timer=setTimeout(Kd,qd)),Ye.total+=1,Ye.counts[e]=(Ye.counts[e]??0)+1,Ye.lastEventId=t.eventId}function Gd(e,t={}){if(!yl())return;const n=zd(e,t);if(n){Qd(n,t);return}Ri({event:e,...t})}const lo=8;function uo(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Xd(){if(typeof window>"u")return lo;const e=window.__RENDER_PROFILE__;if(e&&typeof e=="object"){const t=e.thresholdMs;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t)}return lo}function Yd(){return fi()||typeof window<"u"&&window.__RENDER_PROFILE__!==void 0}function ji(e,t,n){if(!Yd())return n();const s=uo();try{return n()}finally{const r=uo()-s;if(r>=Xd()){const o=typeof t=="function"?t():t,i={name:e,durationMs:Math.round(r*10)/10,...o};Gd("render-profile",i),typeof window<"u"&&window.__RENDER_PROFILE__!==void 0&&!fi()&&console.log("[RenderProfile]",i)}}}function Ls(e,t){return!e||!t?null:{scrollRoot:e,initialOffset:t.getBoundingClientRect().top-e.getBoundingClientRect().top}}function Ai(e,t){if(!e||!t)return;const s=t.getBoundingClientRect().top-e.scrollRoot.getBoundingClientRect().top-e.initialOffset;Math.abs(s)>1&&(e.scrollRoot.scrollTop+=s)}function Jd(e,t){const n=a.useRef(null),s=a.useRef(null),r=a.useCallback(()=>{const o=n.current;if(o){let i=o.parentElement;for(;i;){const{overflowY:l}=window.getComputedStyle(i);if(l==="auto"||l==="scroll")break;i=i.parentElement}s.current=Ls(i,o)}t()},[t]);return a.useLayoutEffect(()=>{const o=s.current;o&&(s.current=null,Ai(o,n.current))},[e]),{btnRef:n,handleClick:r}}function Zd(e){const t=e.trim().replace(/^#\s*/,"");return/^acli: 1(?:\s+\+?[a-z][a-z0-9-]*)*$/.test(t)||/^acli-capabilities: (?:[a-z][a-z0-9-]*\/1)(?:\s+[a-z][a-z0-9-]*\/1)*$/.test(t)}function ef(e){JSON.parse(e);const t=e.match(/"(?:\\.|[^"\\])*"|[{}[\],:]|[^\s{}[\],:]+/g)??[];let n=0,s="";const r=()=>`
16
+ ${" ".repeat(n)}`;return t.forEach((o,i)=>{o==="{"||o==="["?(s+=o,n++,t[i+1]!==(o==="{"?"}":"]")&&(s+=r())):o==="}"||o==="]"?(n--,t[i-1]!==(o==="}"?"{":"[")&&(s+=r()),s+=o):o===","?s+=o+r():o===":"?s+=": ":s+=o}),s+(e.endsWith(`
17
+ `)?`
18
+ `:"")}function tf(e){const t=new Cl,n=[...t.append(e),...t.finish()];let s;return n.map(r=>{var i;const o=(i=/^\s*(`{3,}|~{3,})/.exec(r))==null?void 0:i[1];if(o)return s?o[0]===s[0]&&o.length>=s.length&&(s=void 0):s=o,{kind:"text",source:r,text:r};if(!s&&Zd(r))return{kind:"metadata",source:r,text:r};if(!s&&/^[\s]*[[{]/.test(r))try{return{kind:"json",source:r,text:ef(r)}}catch{}return{kind:"text",source:r,text:r}})}const Ti=a.createContext(null);function nf({children:e,onQuoteTextBlock:t}){return c.jsx(Ti.Provider,{value:t,children:e})}function Xs(){return a.useContext(Ti)}function sf(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M13.5 8h-11M6.5 4l-4 4 4 4"})})}const rf=300*1e3,of=32,cf=1024*1024,af=100,Te=new Map,Ms=new Set,En=[];function Ys(e){return(e==null?void 0:e.nowMs)??Date.now()}function Ni(e){return Array.isArray(e)?e.map(t=>Ni(t)):e??null}function fo(e){if(!e)return{};if(e instanceof URLSearchParams){const n={};for(const s of Array.from(new Set(e.keys())).sort()){const r=e.getAll(s);n[s]=r.length>1?r:r[0]??""}return n}const t={};for(const n of Object.keys(e).sort())t[n]=Ni(e[n]);return t}function Rs(e){if(e===void 0)return"undefined";if(e===null||typeof e!="object")return JSON.stringify(e)??String(e);if(Array.isArray(e))return`[${e.map(n=>Rs(n)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${Rs(t[n])}`).join(",")}}`}function On(e){const t=e.projectId??null;return{key:Rs({sourceKey:e.sourceKey,routeId:e.routeId,projectId:t,routeParams:fo(e.routeParams),queryParams:fo(e.queryParams)}),sourceKey:e.sourceKey,routeId:e.routeId,projectId:t}}function Ii(e){var t;try{return((t=JSON.stringify(e))==null?void 0:t.length)??0}catch{return 0}}function Pi(){for(const e of Array.from(Ms))e()}function lf(e){return{key:e.key,sourceKey:e.sourceKey,routeId:e.routeId,projectId:e.projectId,createdAt:e.createdAt,updatedAt:e.updatedAt,lastAccessedAt:e.lastAccessedAt,expiresAt:e.expiresAt,approxBytes:e.approxBytes}}function Js(){typeof window>"u"||(window.__YA_ROUTE_RETENTION__={entries:()=>rs().entries,events:()=>rs().events,diagnostics:rs,clear:pf,invalidate:mf})}function jt(e,t={}){for(En.push(e);En.length>af;)En.shift();Js(),t.emit&&Pi()}function Yt(e,t,n,s=!0){const r=Te.get(e);r&&(Te.delete(e),jt({type:t==="invalidate"?"invalidate":"evict",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,reason:t,approxBytes:r.approxBytes},{emit:s}))}function uf(e){for(const t of Array.from(Te.values()))t.expiresAt<=e&&Yt(t.key,"expired",e,!1)}function df(){let e=0;for(const t of Te.values())e+=t.approxBytes;return e}function ff(e,t){const n=e.maxEntries??of,s=e.maxBytes??cf;for(;Te.size>n||df()>s;){const r=Array.from(Te.values()).sort((o,i)=>o.lastAccessedAt!==i.lastAccessedAt?o.lastAccessedAt-i.lastAccessedAt:o.updatedAt-i.updatedAt)[0];if(!r)break;Yt(r.key,"lru",t,!1)}}function $i(e){return Ms.add(e),Js(),()=>{Ms.delete(e)}}function hf(e,t={}){const n=Ys(t),s=On(e),r=Te.get(s.key),o=t.recordDiagnostics??!0;return r?r.expiresAt<=n?t.touch===!1&&!o?{value:null,missReason:"expired"}:(Yt(r.key,"expired",n),o&&jt({type:"miss",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,reason:"expired"}),{value:null,missReason:"expired"}):(t.touch!==!1&&(r.lastAccessedAt=n),o&&jt({type:"hit",key:r.key,sourceKey:r.sourceKey,routeId:r.routeId,projectId:r.projectId,at:n,approxBytes:r.approxBytes}),{value:r.value}):(o&&jt({type:"miss",key:s.key,sourceKey:s.sourceKey,routeId:s.routeId,projectId:s.projectId,at:n,reason:"missing"}),{value:null,missReason:"missing"})}function Zs(e,t){return hf(e,t).value}function er(e,t,n={}){const s=Ys(n);uf(s);const r=On(e),o=Te.get(r.key),i=n.ttlMs??rf,l={...r,value:t,createdAt:(o==null?void 0:o.createdAt)??s,updatedAt:s,lastAccessedAt:s,expiresAt:s+i,approxBytes:n.approxBytes??Ii(t)};Te.set(r.key,l),ff(n,s),jt({type:"write",key:l.key,sourceKey:l.sourceKey,routeId:l.routeId,projectId:l.projectId,at:s,approxBytes:l.approxBytes},{emit:!0})}function mv(e,t,n={}){const s=Zs(e,{...n,touch:!1,recordDiagnostics:!1}),r=typeof t=="function"?t(s):Object.assign({},s,t);er(e,r,n);const o=On(e);jt({type:"patch",key:o.key,sourceKey:o.sourceKey,routeId:o.routeId,projectId:o.projectId,at:Ys(n),approxBytes:n.approxBytes??Ii(r)})}function mf(e){const t=Date.now();Yt(On(e).key,"invalidate",t)}function pf(){const e=Date.now();for(const t of Array.from(Te.values()))Yt(t.key,"invalidate",e,!1);Pi()}function rs(){const e=Array.from(Te.values(),lf);return{entries:e,events:[...En],totalBytes:e.reduce((t,n)=>t+n.approxBytes,0)}}Js();const gf=3e4,wf=750,yf=60*1e3;function vf(){return $a(),!0}function Fi(e,t,n,s){return{sourceKey:e,routeId:n?"git-status:data:cached-untracked":s?"git-status:data:no-untracked":"git-status:data",projectId:t}}function xf(e,t,n,s){const r=a.useMemo(()=>t?Fi(e,t,n,s):null,[e,t,n,s]);return a.useSyncExternalStore($i,()=>r?Zs(r,{touch:!1,recordDiagnostics:!1}):null,()=>null)}function bf(e,t={}){const n=Ds(),s=vf(),r=t.useUntrackedCache===!0,o=t.omitUntracked===!0,i=a.useMemo(()=>Na({endpoint:r?"git-status:cached-untracked":o?"git-status:no-untracked":"git-status",projectId:e??null}),[o,e,r]),l=xf(n,e,r,o),u=`${n}\0${i}`,d=a.useRef({identity:u,value:l});d.current.identity!==u?d.current={identity:u,value:l}:l!==null&&(d.current.value=l);const m=l??d.current.value,[h,w]=a.useState(null),[g,f]=a.useState(!1),y=a.useMemo(()=>Sf(m,h,r),[m,h,r]),[b,x]=a.useState(()=>!!e&&y===null),[_,M]=a.useState(null),[C,S]=a.useState(null),v=a.useRef(!0),L=a.useRef(0),p=a.useRef(0),E=a.useRef(null),T=a.useRef(y),I=a.useRef(h),j=a.useRef(l),k=a.useRef({queryKey:"",present:!1});T.current=y,I.current=h,j.current=l,a.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),a.useEffect(()=>{p.current+=1,E.current=null,w(null),f(!1),S(null)},[o,e,n,r]),a.useEffect(()=>{M(null),x(!!e&&T.current===null)},[e,i,n]),a.useEffect(()=>{if(e)return Ia({sourceKey:n,key:i})},[e,i,n]);const A=a.useCallback(async({background:q=!1}={})=>{if(!e||!s||!r||(l==null?void 0:l.isGitRepo)!==!0)return;const D=++p.current;(!q||I.current===null)&&S(null),I.current===null&&f(!0);const U=E.current,Q=U??oe.listGitUntrackedFiles(e);U||(E.current=Q);try{const Z=await Q;v.current&&D===p.current&&(w(Z),f(!1),S(null))}catch(Z){v.current&&D===p.current&&!Vr(Z)&&(!q||I.current===null)&&S(Z instanceof Error?Z:new Error(String(Z)))}finally{v.current&&D===p.current&&f(!1),E.current===Q&&(E.current=null)}},[e,s,l==null?void 0:l.isGitRepo,r]),$=a.useCallback(async({force:q=!1,background:D=!1}={})=>{if(!e||!s)return;const U=++L.current,Q=j.current!==null,Z=T.current!==null;!D&&!Z&&x(!0),D||M(null);const K={projectId:e},O=(Y,G)=>{const R=G.meta.projectId;R&&er(Fi(G.sourceKey,R,r,o),Y,{ttlMs:yf})},W=Y=>{const G=Y.meta.projectId;if(!G)throw new Error("Project id is required");return oe.getGitStatus(G,{...o?{omitUntracked:!0}:{},...r?{useUntrackedCache:!0}:{}})};try{const Y=await Pa({sourceKey:n,key:i,force:q||!Q,meta:K,fetcher:W,applySnapshot:O});if(!v.current||U!==L.current)return;Y.status!=="obsolete"&&M(null)}catch(Y){if(!v.current||U!==L.current)return;T.current===null&&!Vr(Y)&&M(Y instanceof Error?Y:new Error(String(Y)))}finally{v.current&&U===L.current&&x(!1)}},[o,e,i,s,n,r]);a.useEffect(()=>{!e||!s||$({background:T.current!==null})},[$,e,s]),a.useEffect(()=>{const q=k.current,D=l!==null;k.current={queryKey:i,present:D},q.queryKey===i&&q.present&&!D&&e&&s&&document.visibilityState==="visible"&&document.hasFocus()&&$()},[$,e,i,s,l]),a.useEffect(()=>{(l==null?void 0:l.isGitRepo)===!0&&A({background:I.current!==null})},[A,l==null?void 0:l.isGitRepo]);const P=t.poll!==!1;a.useEffect(()=>{if(!e||!s)return;let q=document.visibilityState==="visible"&&document.hasFocus();const D=()=>{const U=document.visibilityState==="visible"&&document.hasFocus();if(U!==q&&(q=U,!!U)){if(j.current===null){$();return}P&&($({force:!0,background:!0}),A({background:!0}))}};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",D),window.addEventListener("blur",D),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",D),window.removeEventListener("blur",D)}},[$,A,P,e,s]),a.useEffect(()=>{if(!e||!s||t.poll===!1)return;let q=!1,D=!1,U=null,Q=null;const Z=()=>{$({force:!0,background:!0}),A({background:!0})},K=()=>{U&&(clearInterval(U),U=null)},O=()=>{U||(U=setInterval(Z,gf))},W=()=>{Q&&(clearTimeout(Q),Q=null)},Y=()=>{K(),q&&O()},G=()=>{q&&(W(),Q=setTimeout(()=>{Q=null,Z(),Y()},wf))},R=()=>{const ae=document.visibilityState==="visible"&&document.hasFocus();D&&ae===q||(D=!0,q=ae,q?O():(K(),W()))},he=Ur.onSource(n,"process-state-changed",ae=>{ae.projectId===e&&ae.activity!=="in-turn"&&G()}),re=Ur.onSource(n,"reconnect",G);return R(),document.addEventListener("visibilitychange",R),window.addEventListener("focus",R),window.addEventListener("blur",R),()=>{q=!1,K(),W(),he(),re(),document.removeEventListener("visibilitychange",R),window.removeEventListener("focus",R),window.removeEventListener("blur",R)}},[$,A,t.poll,e,s,n]);const B=a.useCallback(async()=>{await Promise.all([$({force:!0,background:T.current!==null}),A({background:I.current!==null})])},[$,A]);return{gitStatus:y,untrackedFiles:h,untrackedLoading:g,untrackedError:C,loading:b,error:_,refetch:B}}function Sf(e,t,n){if(!n||(e==null?void 0:e.isGitRepo)===!1||!e||!t)return e;const s=[...t.files.map(i=>{var l;return{path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null,...(l=t.lastEditors)!=null&&l[i]?{lastEditor:t.lastEditors[i]}:{}}}),...t.folders.map(({path:i})=>({path:i,status:"?",staged:!1,linesAdded:null,linesDeleted:null}))],o=[...e.files.filter(i=>i.status!=="?"),...s];return{...e,files:o,isClean:o.length===0}}const Cf=5e3,Ef=6e4;function ho(e,t){return{sourceKey:e,routeId:"git-status:file-projections",projectId:t}}function _f(e,t,n){const s=a.useMemo(()=>t?ho(e,t):null,[t,e]),r=a.useSyncExternalStore($i,()=>s?Zs(s,{touch:!1,recordDiagnostics:!1}):null,()=>null),o=(r==null?void 0:r.statusKey)===n?r.value:null,i=a.useRef(n);i.current=n;const l=Fa({sourceKey:e,key:{endpoint:"git-status:file-projections",projectId:t??null,statusKey:n},enabled:!!(t&&n),hasData:o!==null,staleTimeMs:Cf,meta:{projectId:t,statusKey:n},fetcher:async d=>{const m=d.meta;if(!m.projectId)throw new Error("Project is required for file projections");return oe.getGitFileProjections(m.projectId)},applySnapshot:(d,m)=>{const h=m.meta;!h.projectId||!h.statusKey||h.statusKey!==i.current||er(ho(m.sourceKey,h.projectId),{statusKey:h.statusKey,value:d},{ttlMs:Ef})}});return{manifest:o??(n&&!l.error?(r==null?void 0:r.value)??null:null),loading:!!(n&&!o&&!l.error)}}function kf(e){const t=Qt(e).replace(/^\.\/+/,""),n=t.startsWith("/")||t.startsWith("//")||/^[a-zA-Z]:\//.test(t),s=t===".."||t.startsWith("../");return t&&!n&&!s?t:null}function mo(e,t){return e?t.find(n=>n.path===e||n.origPath===e)??null:null}function Lf(e){var t,n;return JSON.stringify([((n=(t=e.recentCommits)==null?void 0:t[0])==null?void 0:n.hash)??null,e.files.map(s=>[s.path,s.origPath??null,s.status,s.staged,s.linesAdded,s.linesDeleted])])}function Bi(e,t){var g,f;const n=Ds(),s=ni(n),r=Wt(s,ua),o=Wt(s,da),i=a.useMemo(()=>kf(t),[t]),l=r&&o&&i?e:void 0,{gitStatus:u,loading:d,error:m}=bf(l,{poll:!1,omitUntracked:!1}),h=u!=null&&u.isGitRepo&&i?Lf(u):null,w=_f(n,l,h);return{cumulativeFile:mo(i,((g=w.manifest)==null?void 0:g.cumulativeFiles)??[]),loading:!!(e&&i&&(s===null||o&&l&&(d||!u&&!m||u!=null&&u.isGitRepo&&w.loading))),relativePath:i,supported:o,worktreeFile:mo(i,((f=w.manifest)==null?void 0:f.worktreeFiles)??[])}}const Mf=["block","paragraph-hover","paragraph-always"],Di="paragraph-hover";function Rf(e){return Mf.includes(e)?e:void 0}const Vt=Bs(Ee.quoteReplyButtonMode,Di,Rf);Vt.set;function Oi(){return{quoteReplyButtonMode:a.useSyncExternalStore(Vt.subscribe,Vt.read,()=>Di),setQuoteReplyButtonMode:Vt.set}}Vt.read;const jf="_rowSurface_1pv0o_1",Af="_trigger_1pv0o_5",Tf="_overlay_1pv0o_38",Nf="_menu_1pv0o_48",If="_separatorBefore_1pv0o_74",Ut={rowSurface:jf,trigger:Af,overlay:Tf,menu:Nf,separatorBefore:If},pv=Ut.rowSurface,Pf=500,$f=8;function Hi(e,t){const[n,s]=a.useState(null),r=a.useRef(null),o=a.useRef(!1),i=a.useRef(null),l=a.useCallback(()=>s(null),[]),u=a.useCallback((S,v,L,p,E)=>{var T;s({actions:p,x:S,y:v,returnFocus:L,...E!=null&&E.contextKey?{contextKey:E.contextKey}:{}}),(T=E==null?void 0:E.onOpen)==null||T.call(E)},[]),d=a.useCallback((S,v,L)=>{S.preventDefault(),S.stopPropagation();const p=S.currentTarget.getBoundingClientRect();u(p.right,p.bottom+4,S.currentTarget,v,L)},[u]),m=a.useCallback((S,v)=>{s(L=>(L==null?void 0:L.contextKey)===S?{...L,actions:v}:L)},[]),h=a.useCallback((S,v,L)=>{S.preventDefault(),S.stopPropagation(),u(S.clientX,S.clientY,S.currentTarget,v,L)},[u]),w=a.useCallback((S,v,L)=>{if(S.key!=="ContextMenu"&&!(S.shiftKey&&S.key==="F10"))return!1;S.preventDefault(),S.stopPropagation();const p=S.currentTarget.getBoundingClientRect();return u(p.left+Math.min(32,p.width/2),p.top+Math.min(32,p.height),S.currentTarget,v,L),!0},[u]),g=a.useCallback(()=>{r.current&&(clearTimeout(r.current.timer),r.current=null)},[]),f=a.useCallback((S,v,L,p)=>{if(g(),i.current&&(clearTimeout(i.current),i.current=null),o.current=!1,!S.isPrimary||S.button!==0||S.pointerType!=="touch"&&S.pointerType!=="pen")return;const E=S.clientX,T=S.clientY,I=setTimeout(()=>{o.current=!0,r.current=null,u(E,T,v,L,p)},Pf);r.current={timer:I,x:E,y:T}},[g,u]),y=a.useCallback((S,v,L)=>{f(S.nativeEvent,S.currentTarget,v,L)},[f]),b=a.useCallback(S=>{const v=r.current;!v||Math.hypot(S.clientX-v.x,S.clientY-v.y)<=$f||g()},[g]),x=a.useCallback(S=>{b(S.nativeEvent)},[b]),_=a.useCallback(()=>o.current?(o.current=!1,!0):!1,[]),M=a.useCallback(()=>{g(),o.current&&(i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o.current=!1,i.current=null},0))},[g]),C=a.useCallback((S,v,L)=>({onContextMenu:p=>h(p,S,L),onKeyDown:p=>{w(p,S,L)},onPointerDown:p=>y(p,S,L),onPointerMove:x,onPointerUp:g,onPointerCancel:g,onClick:()=>{_()||v()}}),[y,_,g,x,h,w]);return a.useEffect(()=>(window.addEventListener("pointerup",M),window.addEventListener("pointercancel",M),()=>{window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",M),g(),i.current&&(clearTimeout(i.current),i.current=null)}),[g,M]),{menu:n?c.jsx(Ff,{...n,labels:t,onClose:l,t:e}):null,targetProps:C,openAt:u,openFromButton:d,refreshOpenActions:m,beginLongPressAt:f,moveLongPressAt:b,endLongPress:g,consumeLongPressClick:_}}function gv({actions:e,label:t,onOpen:n,openOptions:s}){return c.jsx("button",{type:"button",className:Ut.trigger,"aria-label":t,title:t,onClick:r=>n(r,e,s),children:"⋯"})}function Ff({actions:e,x:t,y:n,returnFocus:s,onClose:r,t:o,labels:i}){const l=a.useRef(null);a.useEffect(()=>fa(),[]),a.useLayoutEffect(()=>{var m,h;(h=(m=l.current)==null?void 0:m.querySelector('button[role="menuitem"]:not(:disabled)'))==null||h.focus()},[]),a.useEffect(()=>{const m=h=>{var y,b;if(h.key==="Escape"){h.preventDefault(),r(),s==null||s.focus();return}if(h.key!=="ArrowDown"&&h.key!=="ArrowUp"&&h.key!=="Home"&&h.key!=="End")return;const w=Array.from(((y=l.current)==null?void 0:y.querySelectorAll('button[role="menuitem"]:not(:disabled)'))??[]);if(w.length===0)return;h.preventDefault();const g=w.indexOf(document.activeElement),f=h.key==="Home"?0:h.key==="End"?w.length-1:h.key==="ArrowDown"?(g+1+w.length)%w.length:(g-1+w.length)%w.length;(b=w[f])==null||b.focus()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r,s]);const u=m=>{m.disabled||(m.onSelect(),r(),s==null||s.focus())},d=e.length*34+16;return st.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:Ut.overlay,"aria-label":(i==null?void 0:i.dismiss)??o("sourceDismissActions"),onClick:()=>{r(),s==null||s.focus()},onContextMenu:m=>{m.preventDefault(),r(),s==null||s.focus()}}),c.jsx("div",{ref:l,className:Ut.menu,role:"menu","aria-label":(i==null?void 0:i.menu)??o("sourceActionMenu"),style:{left:Math.max(8,Math.min(t,window.innerWidth-232)),top:Math.max(8,Math.min(n,window.innerHeight-d))},children:e.map((m,h)=>c.jsx("button",{type:"button",role:"menuitem",className:m.separatorBefore?Ut.separatorBefore:void 0,disabled:m.disabled,onClick:()=>u(m),children:m.label},h))})]}),document.body)}const Bf="_cluster_13b9h_1",Df="_button_13b9h_9",Of="_text_13b9h_37",Hf="_quote_13b9h_56",Vf="_source_13b9h_75",Uf="_rich_13b9h_94",qf="_newSession_13b9h_112",Wf="_specimen_13b9h_132",zf="_mobile_13b9h_137",Kf="_docked_13b9h_146",Ue={cluster:Bf,button:Df,text:Of,quote:Hf,source:Vf,rich:Uf,newSession:qf,specimen:Wf,mobile:zf,docked:Kf},Qf=30,Gf=44,Bt=6;function Xf(){return c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),c.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const po={text:c.jsx(Xf,{}),quote:">",source:"</>",rich:"Aa",newSession:"+"},Yf={text:Ue.text,quote:Ue.quote,source:Ue.source,rich:Ue.rich,newSession:Ue.newSession};function Jf({kind:e,label:t,onClick:n,onPointerDown:s,onPointerUp:r,specimen:o=!1}){const i=`${Ue.button} ${Yf[e]} ${o?Ue.specimen:""}`;return o?c.jsx("span",{className:i,"aria-hidden":"true","data-selection-action-specimen":e,children:po[e]}):c.jsx("button",{type:"button",className:i,onMouseDown:l=>l.preventDefault(),onPointerDown:l=>{l.preventDefault(),s==null||s(l)},onPointerUp:r,onClick:n,"aria-label":t,title:t,children:po[e]})}function Zf({children:e,docked:t=!1,mobile:n=!1,placement:s,style:r}){return c.jsx("div",{className:[Ue.cluster,t?Ue.docked:"",n?Ue.mobile:""].filter(Boolean).join(" "),style:r,"data-selection-action-cluster":"true","data-selection-action-placement":s,children:e})}const eh="session-file-comments",Vi="data-session-file-comment-mode",Ui=100,th=2e4,go=8e3;function nh({sourceKey:e,sessionId:t,projectId:n,filePath:s}){return[eh,e,t,n,s].map(encodeURIComponent).join(":")}function sh(e){try{const t=JSON.parse(localStorage.getItem(e)??"null");if(!Array.isArray(t))return[];const n=[];for(const s of t.slice(0,Ui)){if(!oh(s))continue;const{id:r,location:o,quote:i,text:l,afterLine:u,afterBlock:d}=s;typeof r!="string"||!r||typeof o!="string"||!o||typeof i!="string"||!i.trim()||typeof l!="string"||!l.trim()||o.length>go||i.length>go||l.length>th||u!==void 0&&(!Number.isInteger(u)||Number(u)<1)||d!==void 0&&(!Number.isInteger(d)||Number(d)<0)||n.push({id:r,location:o,quote:i,text:l,...u===void 0?{}:{afterLine:Number(u)},...d===void 0?{}:{afterBlock:Number(d)}})}return n}catch{return[]}}function os(e,t){const n=t.filter(s=>s.text.trim()).slice(0,Ui);if(n.length===0){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify(n))}function qi(e){const t=e.quote.replace(/\r\n?/g,`
19
+ `).replace(/^\n+|\n+$/g,"").split(`
20
+ `).map(n=>`> ${n}`).join(`
21
+ `);return`${e.location}
22
+
23
+ ${t}
24
+
25
+ ${e.text.trim()}`}function rh(e){return e.map(qi).join(`
26
+
27
+ ---
28
+
29
+ `)}function oh(e){return typeof e=="object"&&e!==null}const bt="session-transcript-selection-active",ih=50;function wo(e,t,n){return Math.max(t,Math.min(n,e))}function yo(e,t,n){const s=e.sourceElement.ownerDocument.createRange();return s.selectNodeContents(e.sourceElement),t==="after"?s.setStart(e.range.endContainer,e.range.endOffset):s.setEnd(e.range.startContainer,e.range.startOffset),!s.toString().trim()||typeof s.getClientRects!="function"?!0:!Array.from(s.getClientRects()).some(r=>r.width>0&&r.height>0&&r.bottom>n.top+1&&r.top<n.bottom-1)}function ch(e){const t=new Set(e.map(s=>s.sourceElement)),n=[];for(const s of t){const r=s.ownerDocument.createRange();r.selectNodeContents(s),typeof r.getClientRects=="function"&&n.push(...Array.from(r.getClientRects()).filter(o=>o.width>0&&o.height>0))}return n}function ah(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function tr(e){var t;return((t=e.matchMedia)==null?void 0:t.call(e,"(pointer: coarse)").matches)===!0}function lh(e,t){if(tr(t))return!0;const n=e.pointerType;return n==="touch"||n==="pen"}function uh(e,t,n){return t===0&&n===0?!0:e.ranges.some(s=>typeof s.getClientRects!="function"?!0:Array.from(s.getClientRects()).some(r=>t>=r.left-1&&t<=r.right+1&&n>=r.top-1&&n<=r.bottom+1))}function dh(e,t,n,s,r){const{snippets:o}=n,i=n.root,l=e.ownerDocument.defaultView??window,u=tr(l),d=u?Gf:Qf,m=t.getRangeAt(t.rangeCount-1),h=typeof m.getBoundingClientRect=="function"?m.getBoundingClientRect():null,w=typeof m.getClientRects=="function"?Array.from(m.getClientRects()).filter(D=>D.width!==0||D.height!==0):[],g=h&&(h.width!==0||h.height!==0);if(!g&&!r)return null;const f=i.getBoundingClientRect(),y=g?h:{top:(r==null?void 0:r.clientY)??f.top,right:(r==null?void 0:r.clientX)??f.left,bottom:(r==null?void 0:r.clientY)??f.top,left:(r==null?void 0:r.clientX)??f.left,width:0,height:0},b=w[0]??y,x=w.at(-1)??y,_=s*d+(s-1)*Bt,M=o[0],C=o.at(-1),S=C?yo(C,"after",x):!1,v=M?yo(M,"before",b):!1,L=f.right-x.right,p=b.left-f.left,E=f.bottom-y.bottom,T=y.top-f.top,I=Math.max(0,i.clientHeight-d),j=Math.max(0,i.clientWidth-_),k=y.left-f.left+(y.width-_)/2,A={after:{top:x.top-f.top+(x.height-d)/2,left:x.right-f.left+Bt},before:{top:b.top-f.top+(b.height-d)/2,left:b.left-f.left-_-Bt},below:{top:y.bottom-f.top+Bt,left:k},above:{top:y.top-f.top-d-Bt,left:k}},$=ch(o),P=D=>{if(D==="after"&&!S||D==="before"&&!v)return!1;const U=A[D];if(U.left<0||U.top<0||U.left+_>i.clientWidth||U.top+d>i.clientHeight)return!1;const Q={top:f.top+U.top,right:f.left+U.left+_,bottom:f.top+U.top+d,left:f.left+U.left};return Q.left<0||Q.top<0||Q.right>l.innerWidth||Q.bottom>l.innerHeight?!1:!$.some(Z=>ah(Q,Z))},B=["after","before","below","above"].find(P)??[["after",L-_],["before",p-_],["below",E-d],["above",T-d]].reduce((D,U)=>U[1]>D[1]?U:D)[0],q=A[B];return{side:B,docked:u&&i===e,mobile:u,snapshot:n,top:wo(q.top,0,I),left:wo(q.left,0,j)}}function fh({actionCount:e,getActionCount:t,containerRef:n,inert:s,isInteractiveTarget:r}){const o=a.useRef(!1),[i,l]=a.useState(null),u=a.useCallback(()=>l(null),[]),d=a.useCallback(()=>{const m=n.current,h=m==null?void 0:m.ownerDocument.getSelection();if(!m||!h||h.isCollapsed||h.rangeCount===0)return null;const w=Dt(m,h);if(!w)return null;const g=Fn(w);return g.length===0?null:{anchors:g.map(Rn),snippets:g,ranges:g.map(f=>f.range.cloneRange()),root:w}},[n]);return a.useEffect(()=>{if(s)return;const m=h=>{const w=n.current;if(!w)return;const g=Dt(w);g&&Ba(h,g)};return document.addEventListener("copy",m),()=>document.removeEventListener("copy",m)},[n,s]),a.useEffect(()=>{if(s)return;const m=n.current,h=(m==null?void 0:m.ownerDocument)??document,w=g=>{const f=n.current;if(g.button!==0||!f||r(g.target))return;const y=h.getSelection(),b=Dt(f,y),x=qr(f,g.target);b&&b===x&&(y==null||y.removeAllRanges())};return h.addEventListener("mousedown",w,!0),()=>h.removeEventListener("mousedown",w,!0)},[n,s,r]),a.useEffect(()=>{if(s)return;const m=n.current,h=(m==null?void 0:m.ownerDocument)??document,w=h.defaultView??window;if(!tr(w))return;let g=null,f=null;const y=x=>{const _=n.current,M=(_==null?void 0:_.closest(".session-page"))??null,C=(_==null?void 0:_.ownerDocument.body)??null;g&&g!==M&&g.classList.remove(bt),f&&f!==C&&f.classList.remove(bt),g=M,f=C,M==null||M.classList.toggle(bt,x),C==null||C.classList.toggle(bt,x&&M!==null)},b=()=>{const x=n.current;y(x?Dt(x,x.ownerDocument.getSelection())!==null:!1)};return h.addEventListener("selectionchange",b),h.addEventListener("pointerup",b,!0),h.addEventListener("keyup",b,!0),w.addEventListener("blur",b),()=>{h.removeEventListener("selectionchange",b),h.removeEventListener("pointerup",b,!0),h.removeEventListener("keyup",b,!0),w.removeEventListener("blur",b),g==null||g.classList.remove(bt),f==null||f.classList.remove(bt)}},[n,s]),a.useEffect(()=>{var L;if(s||e===0){l(null);return}const m=((L=n.current)==null?void 0:L.ownerDocument)??document,h=m.defaultView??window;let w,g=!1;const f=()=>{g=!1,w!==void 0&&(h.clearTimeout(w),w=void 0)},y=p=>{if(o.current&&!p){l(null);return}const E=n.current,T=E==null?void 0:E.ownerDocument.getSelection(),I=d();if(!E||!T||!I){l(null);return}const j=(t==null?void 0:t(I))??e;if(j===0){l(null);return}l(dh(E,T,I,j,p))},b=()=>{w=h.setTimeout(()=>{w=void 0,g&&(g=!1,y(),b())},ih)},x=()=>{if(w!==void 0){g=!0;return}y(),b()},_=()=>{const p=m.getSelection();if(!p||p.isCollapsed||p.rangeCount===0){f();return}x()},M=p=>{const E=n.current;if(p.target instanceof Element&&p.target.closest('[data-selection-action-cluster="true"]')){o.current=!1,f();return}if(f(),!E||!qr(E,p.target)){o.current=!1;return}o.current=!0,l(null)},C=p=>{const E=o.current;o.current=!1,E&&(f(),h.setTimeout(()=>{f(),y({clientX:p.clientX,clientY:p.clientY})},0))},S=()=>{o.current=!1,f()},v=()=>{if(o.current){f();return}const p=m.getSelection();if(!p||p.isCollapsed||p.rangeCount===0){f(),l(null);return}x()};return m.addEventListener("selectionchange",v),m.addEventListener("pointerdown",M,!0),m.addEventListener("pointercancel",S,!0),m.addEventListener("pointerup",C,!0),h.addEventListener("resize",_),h.addEventListener("scroll",_,!0),()=>{f(),m.removeEventListener("selectionchange",v),m.removeEventListener("pointerdown",M,!0),m.removeEventListener("pointercancel",S,!0),m.removeEventListener("pointerup",C,!0),h.removeEventListener("resize",_),h.removeEventListener("scroll",_,!0)}},[e,d,n,t,s]),{captureSnapshot:d,dismiss:u,state:i}}const hn=pt(Ee.selectionQuoteActionEnabled,!0),mn=pt(Ee.selectionTextCopyActionEnabled,!1),pn=pt(Ee.selectionSourceCopyActionEnabled,!1),gn=pt(Ee.selectionRichCopyActionEnabled,!1),wn=pt(Ee.selectionNewSessionActionEnabled,!1);function hh(){const e=a.useSyncExternalStore(hn.subscribe,hn.read,hn.read),t=a.useSyncExternalStore(mn.subscribe,mn.read,mn.read),n=a.useSyncExternalStore(pn.subscribe,pn.read,pn.read),s=a.useSyncExternalStore(gn.subscribe,gn.read,gn.read),r=a.useSyncExternalStore(wn.subscribe,wn.read,wn.read);return{selectionQuoteActionEnabled:e,setSelectionQuoteActionEnabled:hn.set,selectionTextCopyActionEnabled:t,setSelectionTextCopyActionEnabled:mn.set,selectionSourceCopyActionEnabled:n,setSelectionSourceCopyActionEnabled:pn.set,selectionRichCopyActionEnabled:s,setSelectionRichCopyActionEnabled:gn.set,selectionNewSessionActionEnabled:r,setSelectionNewSessionActionEnabled:wn.set}}function is(e){return e.snippets.some(t=>t.sourceElement.closest(`[${Vi}="true"]`)!==null)}function mh(e){return e.snippets.map((t,n)=>{var r;if(t.sourceStart!==void 0)return t.selectedText;const s=e.ranges[n];return s?((r=oi(e.root,[s]))==null?void 0:r.text)??t.selectedText:t.selectedText}).join(`
30
+
31
+ `)}function ph(e){return e.snippets.map(t=>t.markdown).join(`
32
+
33
+ `)}function gh(e){return e.anchors.map(t=>t.quotedText).join(`
34
+
35
+ `)}function wh(e){const t=e.snippets.map(o=>o.sourceLocation);if(t.some(o=>o===void 0))return null;const n=t[0];if(!n||t.some(o=>(o==null?void 0:o.projectId)!==n.projectId||o.filePath!==n.filePath))return null;const s=Math.min(...t.map(o=>(o==null?void 0:o.lineStart)??n.lineStart)),r=Math.max(...t.map(o=>(o==null?void 0:o.lineEnd)??n.lineEnd));return`${n.filePath}:${s}${r>s?`-${r}`:""}`}function yh(e){const t=gh(e),n=wh(e);return n?`${n}
36
+
37
+ ${t}`:t}function vh({applyQuoteAnchors:e,applyQuoteFromSelection:t,containerRef:n,inert:s,isInteractiveTarget:r,onQuoteSelection:o,onStartNewSessionFromSelection:i}){const l=a.useRef(null),{selectionQuoteActionEnabled:u,selectionTextCopyActionEnabled:d,selectionSourceCopyActionEnabled:m,selectionRichCopyActionEnabled:h,selectionNewSessionActionEnabled:w}=hh(),{t:g}=je(),{menu:f,openAt:y}=Hi(g,{dismiss:g("sessionDismissSelectionActions"),menu:g("sessionSelectionActionMenu")}),b=a.useMemo(()=>{const k=[];return d&&k.push({kind:"text",label:g("sessionCopySelectionText")}),m&&k.push({kind:"source",label:g("sessionCopySelectionSource")}),h&&k.push({kind:"rich",label:g("sessionCopySelectionRich")}),u&&o&&k.push({kind:"quote",label:g("sessionQuoteSelection")}),w&&i&&k.push({kind:"newSession",label:g("sessionNewSessionFromSelection")}),k},[o,i,w,u,h,m,d,g]),x=a.useCallback(k=>is(k)?b.filter(A=>A.kind!=="quote"):b,[b]),_=a.useCallback(k=>x(k).length,[x]),M=fh({actionCount:b.length,getActionCount:_,containerRef:n,inert:s,isInteractiveTarget:r});a.useEffect(()=>{if(s||!o||!u)return;const k=A=>{if(A.defaultPrevented||A.isComposing||A.ctrlKey||A.metaKey||A.altKey||A.key.length!==1||r(A.target))return;const $=M.captureSnapshot();$&&is($)||t(A.key)&&(M.dismiss(),A.preventDefault(),A.stopPropagation())};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,M.captureSnapshot,M.dismiss,s,r,o,u]);const C=a.useCallback((k,A)=>{if(k==="text"){const P=mh(A);return P?(_e(P),!0):!1}if(k==="quote"){const P=e(A.anchors);return P&&M.dismiss(),P}if(k==="source"){const P=ph(A);return P?(_e(P),!0):!1}if(k==="newSession")return i?(i(yh(A)),!0):!1;const $=oi(A.root,A.ranges);return $?(Jo($.html,$.text),!0):!1},[e,M.dismiss,i]),S=a.useCallback(k=>{const A=[{label:g("sessionCopySelectionText"),onSelect:()=>{C("text",k)}},{label:g("sessionCopySelectionSource"),onSelect:()=>{C("source",k)}}];return o&&!is(k)&&A.push({label:g("sessionQuoteSelection"),onSelect:()=>{C("quote",k)}}),i&&A.push({label:g("sessionNewSessionFromSelection"),onSelect:()=>{C("newSession",k)}}),A},[C,o,i,g]);a.useEffect(()=>{if(s)return;const k=n.current,A=k==null?void 0:k.ownerDocument;if(!k||!A)return;const $=A.defaultView??window,P=B=>{if(B.defaultPrevented||r(B.target)||lh(B,$))return;const q=M.captureSnapshot();!q||!uh(q,B.clientX,B.clientY)||(B.preventDefault(),B.stopPropagation(),y(B.clientX,B.clientY,A.activeElement instanceof HTMLElement?A.activeElement:null,S(q)))};return A.addEventListener("contextmenu",P),()=>A.removeEventListener("contextmenu",P)},[M.captureSnapshot,n,s,r,y,S]);const v=M.state,L=v!==null&&v.snapshot.root!==n.current,p=v!=null&&v.docked&&typeof document<"u"?document.querySelector("[data-selection-actions-mobile-slot]"):null,E=(v==null?void 0:v.docked)===!0&&p!==null,T=v?c.jsx(Zf,{docked:E,mobile:v.mobile,placement:v.side,style:E?void 0:{top:`${v.top}px`,left:`${v.left}px`},children:x(v.snapshot).map(({kind:k,label:A})=>c.jsx(Jf,{kind:k,label:A,onPointerDown:()=>{l.current=null},onPointerUp:$=>{v.mobile&&($.preventDefault(),C(k,v.snapshot)&&(l.current=k))},onClick:()=>{if(l.current===k){l.current=null;return}C(k,v.snapshot)}},k))}):null,I=E&&T?st.createPortal(T,p):null,j=v&&!E?L?v.snapshot.root.isConnected?st.createPortal(T,v.snapshot.root):null:T:null;return{dismiss:M.dismiss,floatingSelectionActions:j,mobileSelectionActions:I,selectionContextMenu:f}}function xh({containerRef:e,composerDraftSignal:t,onQuoteSelection:n,quoteClearSignal:s}){const r=a.useRef(null),o=a.useRef([]),[i,l]=a.useState([]),u=a.useRef(null),d=a.useRef(null),m=a.useRef(t),h=a.useRef(()=>{}),w=a.useCallback(C=>{if(typeof CSS>"u"||!("highlights"in CSS)||typeof Highlight>"u")return;if(C.length===0){CSS.highlights.delete("comment-tint");return}const S=C.filter(v=>tu(v,e.current)).map(nu).filter(v=>v!==null);if(S.length===0){CSS.highlights.delete("comment-tint");return}CSS.highlights.set("comment-tint",new Highlight(...S))},[e]),g=a.useCallback(()=>{var C;(C=d.current)==null||C.call(d),d.current=null},[]),f=a.useCallback(()=>{var C;(C=u.current)==null||C.disconnect(),u.current=null},[]),y=a.useCallback(C=>{var E;f();const S=Array.from(new Set(C.map(T=>T.sourceElement).filter(T=>T.isConnected))),v=S[0],L=(E=v==null?void 0:v.ownerDocument.defaultView)==null?void 0:E.MutationObserver;if(!v||!L)return;const p=new L(()=>{w(o.current)});for(const T of S)p.observe(T,{childList:!0,characterData:!0,subtree:!0});u.current=p},[w,f]),b=a.useCallback(()=>{g();const C=m.current;!C||o.current.length===0||(d.current=C.subscribeDraftChanges(S=>{h.current(S)}))},[g]),x=a.useCallback(C=>{const S=o.current;C!==S&&(o.current=C,l(Array.from(new Set(C.map(v=>v.renderId).filter(v=>v!==void 0)))),w(C),y(C),S.length===0&&C.length>0?b():S.length>0&&C.length===0&&g())},[w,y,b,g]);h.current=C=>{const S=o.current;if(S.length===0)return;const v=r.current;if(v===null&&C.metadata.mayAffectQuoteAnchors===!1)return;r.current=null;const L=su(v??C.text),p=S.filter(E=>ru(L,E));p.length!==S.length&&x(p)},a.useEffect(()=>(m.current=t,b(),g),[t,b,g]),a.useEffect(()=>()=>{g(),f(),w([])},[w,f,g]);const _=a.useCallback((C,S="")=>{var p,E;if(!n||C.length===0)return!1;const v=C.map(T=>{const I=T.sourceLocation;return I?`re: ${I.filePath}:${I.lineStart}
38
+ ${T.quotedText}`:T.quotedText}).join(`
39
+
40
+ `),L=n(S?`${v}
41
+ ${S}`:`${v}
42
+ `);return L===null?!1:(r.current=L,x([...o.current,...C]),(E=(p=e.current)==null?void 0:p.ownerDocument.getSelection())==null||E.removeAllRanges(),!0)},[e,n,x]),M=a.useCallback((C="")=>{const S=e.current;if(!S)return!1;const v=Dt(S);if(!v)return!1;const L=Fn(v).map(Rn);return _(L,C)},[_,e]);return a.useEffect(()=>{s>0&&x([])},[s,x]),{anchoredRenderIds:i,applyQuoteAnchors:_,applyQuoteFromSelection:M}}function Wi({containerRef:e,inert:t,onQuoteSelection:n,onStartNewSessionFromSelection:s,composerDraftSignal:r,quoteClearSignal:o,isInteractiveTarget:i}){const{quoteReplyButtonMode:l}=Oi(),u=xh({containerRef:e,composerDraftSignal:r,onQuoteSelection:n,quoteClearSignal:o}),d=vh({...u,containerRef:e,inert:t,isInteractiveTarget:i,onQuoteSelection:n,onStartNewSessionFromSelection:s}),m=a.useCallback(h=>{u.applyQuoteAnchors([h])&&d.dismiss()},[u.applyQuoteAnchors,d.dismiss]);return{anchoredRenderIds:u.anchoredRenderIds,alwaysShowQuoteCircles:l==="paragraph-always",paragraphQuoteCirclesEnabled:l!=="block",handleQuoteTextBlock:m,mobileSelectionActions:d.mobileSelectionActions,floatingSelectionActions:d.floatingSelectionActions,selectionContextMenu:d.selectionContextMenu}}const wv=Wi;function zi(e,t,n){a.useEffect(()=>{const s=e.current;if(!(!s||!(t!=null&&t.trim())))return si(s,t,n)},[n,e,t])}function vo(e,t){const n=a.useRef(null);return zi(n,e,t),n}function xo(e,t){const n=new Map(t.map(s=>[s.id,s.text]));return e.filter(s=>n.get(s.id)!==s.text)}function bh({active:e,storageKey:t,sendComment:n}){const[s,r]=a.useState([]),[o,i]=a.useState(null),[l,u]=a.useState(new Set),[d,m]=a.useState(!1),h=a.useRef(s),w=a.useRef(o),g=a.useRef(l),f=a.useRef(n),y=a.useRef(t);w.current=o,g.current=l,f.current=n,y.current=t,a.useEffect(()=>{var T;const p=t?sh(t):[];h.current=p,w.current=((T=p.at(-1))==null?void 0:T.id)??null,r(p),i(w.current);const E=new Set;g.current=E,u(E),m(!1)},[t]);const b=a.useCallback(()=>{const p=y.current;p&&os(p,h.current),r(h.current)},[]),x=a.useCallback(p=>{h.current=p,r(p)},[]),_=a.useCallback(p=>{w.current=p,i(p)},[]),M=a.useCallback(p=>{m(!1);const E=h.current.find(k=>k.id===w.current);if((E==null?void 0:E.location)===p.location&&E.quote===p.quote)return;const T=h.current.filter(k=>k.id!==w.current||k.text.trim()),I=T.find(k=>k.location===p.location&&k.quote===p.quote);if(I){x(T),_(I.id);return}const j={...p,id:crypto.randomUUID(),text:""};x([...T,j]),_(j.id)},[x,_]),C=a.useCallback((p,E)=>{m(!1),h.current=h.current.map(T=>T.id===p?{...T,text:E}:T)},[]),S=a.useCallback(p=>{m(!1),x(h.current.filter(E=>E.id!==p)),w.current===p&&_(null)},[x,_]),v=a.useCallback(async p=>{const E=h.current.find(P=>P.id===p),T=f.current;if(!(E!=null&&E.text.trim())||!T||g.current.has(p))return!1;const I=new Set(g.current).add(p);g.current=I,u(I),b();const j=await T(qi(E)),k=new Set(g.current);if(k.delete(p),g.current=k,u(k),!j)return m(!0),!1;const A=xo(h.current,[E]);x(A),w.current===p&&!A.some(P=>P.id===p)&&_(null);const $=y.current;return $&&os($,A),m(!1),!0},[b,x,_]),L=a.useCallback(async()=>{const p=f.current,E=h.current.filter(P=>P.text.trim()&&!g.current.has(P.id));if(E.length===0)return b(),!0;if(!p)return b(),!1;const T=new Set(E.map(P=>P.id)),I=new Set([...g.current,...T]);g.current=I,u(I),b();const j=await p(rh(E)),k=new Set(g.current);for(const P of T)k.delete(P);if(g.current=k,u(k),!j)return m(!0),!1;const A=xo(h.current,E);x(A),w.current&&T.has(w.current)&&!A.some(P=>P.id===w.current)&&_(null);const $=y.current;return $&&os($,A),m(!1),!0},[b,x,_]);return a.useEffect(()=>{if(e)return()=>{L()}},[e,L]),{activeDraft:s.find(p=>p.id===o)??null,cancel:S,error:d,flush:L,open:M,persist:b,sendOne:v,sendingIds:l,update:C}}function js(e,t){var i,l;const n=t.replaceAll("\\","/"),s=((i=e.embeddedMedia)==null?void 0:i[t])??((l=e.embeddedMedia)==null?void 0:l[n]);if(!s)return null;const r=atob(s.data),o=new Uint8Array(r.length);for(let u=0;u<r.length;u+=1)o[u]=r.charCodeAt(u);return new Blob([o],{type:s.mimeType})}function Ki(e){return e&&e.replace(/<\/span>\r?\n(?=<span class="line(?:\s|"))/g,"</span>")}function Sh(e){const t=[];let n=0;const s=/\r\n|\r|\n/g;for(let r=s.exec(e);r;r=s.exec(e)){const o=r.index;t.push({start:n,end:o,text:e.slice(n,o)}),n=r.index+r[0].length}return t.push({start:n,end:e.length,text:e.slice(n)}),t}function Qi(e,t,n){e.setAttribute(Da,String(t)),e.setAttribute(Oa,String(n))}function Ch(e,t){const n=new Map,s=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=0;for(let o=s.nextNode();o;o=s.nextNode()){const i=o,l=i.data;if(t.text.slice(r,r+l.length)!==l)return;const u=t.start+r,d=u+l.length;for(let m=i.parentElement;m&&m!==e;m=m.parentElement){const h=n.get(m);n.set(m,{start:h?Math.min(h.start,u):u,end:h?Math.max(h.end,d):d})}r+=l.length}if(r===t.text.length)for(const[o,i]of n)Qi(o,i.start,i.end)}function Eh(e,t){if(!e||t===void 0||typeof document>"u")return e;const n=document.createElement("template");n.innerHTML=Ki(e)??"";const s=Array.from(n.content.querySelectorAll("code .line")),r=Sh(t);for(let o=0;o<s.length;o+=1){const i=s[o],l=r[o];!i||!l||i.textContent!==l.text||(Qi(i,l.start,l.end),Ch(i,l))}return n.innerHTML}function _h(e,t){if(typeof document>"u")return null;const n=document.createElement("template");if(n.innerHTML=e,!Array.from(n.content.querySelectorAll("code .line[data-line]")).some(o=>Number(o.dataset.line)===t))return null;const r=o=>{const i=n.content.cloneNode(!0);for(const u of i.querySelectorAll("code .line[data-line]")){const d=Number(u.dataset.line);(!Number.isInteger(d)||!o(d))&&u.remove()}const l=document.createElement("div");return l.append(i),l.innerHTML};return{before:r(o=>o<=t),after:r(o=>o>t)}}function kh({value:e,title:t,className:n,disabled:s=!1,icon:r="copy"}){const[o,i]=a.useState(!1),[l,u]=a.useState(!1);return a.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(!1),1200);return()=>clearTimeout(d)},[o]),c.jsx("button",{type:"button",className:`copy-button ${o?"copied":""} ${n??""}`,title:t,"aria-label":t,disabled:s||l,onClick:async d=>{d.stopPropagation(),u(!0);const m=typeof e=="function"?await zt(e()):await _e(e);u(!1),m&&i(!0)},children:o?c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("polyline",{points:"20 6 9 17 4 12"})}):c.jsx(Lh,{icon:r})})}function Lh({icon:e}){const t={width:13,height:13,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="path"?c.jsxs("svg",{...t,"aria-hidden":"true",children:[c.jsx("path",{d:"M3 7h6l2 2h10v9H3z"}),c.jsx("path",{d:"M8 14h8"}),c.jsx("path",{d:"m13 11 3 3-3 3"})]}):e==="content"?c.jsxs("svg",{...t,"aria-hidden":"true",children:[c.jsx("path",{d:"M6 2h8l4 4v16H6z"}),c.jsx("path",{d:"M14 2v5h5"}),c.jsx("path",{d:"M9 12h6M9 16h6"})]}):c.jsxs("svg",{...t,"aria-hidden":"true",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}const Mh="_root_eaud3_1",Rh="_commit_eaud3_14",jh="_age_eaud3_23",Ah="_dirty_eaud3_27",Th="_uncommitted_eaud3_33",St={root:Mh,commit:Rh,age:jh,dirty:Ah,uncommitted:Th};function nr({projectId:e,path:t,rev:n,origPath:s,dirtyLabel:r,uncommittedLabel:o,className:i}){const l=Ds(),u=ni(l),d=Nt(),m=Wt(u,ha),h=`${l}\0${e}\0${t}\0${n??""}\0${s??""}`,[w,g]=a.useState({identity:h,value:null}),f=w.identity===h?w.value:null;if(a.useEffect(()=>{if(!m||!e||!t)return;let _=!1;return oe.getGitFileRevision(e,{path:t,rev:n,origPath:s}).then(M=>{_||g({identity:h,value:M})}).catch(()=>{_||g({identity:h,value:null})}),()=>{_=!0}},[h,s,t,e,n,m]),!m||!(f!=null&&f.isGitRepo))return null;if(!f.commit)return c.jsx("span",{className:`${St.root} ${St.uncommitted} ${i??""}`,children:o});const y=new URLSearchParams({projectId:e,rev:f.commit.hash,commitFile:n?t:s??t}),b=mt(`${d}/git-status?${y.toString()}`),x=Ih(f.commit);return c.jsxs("span",{className:`${St.root} ${i??""}`,children:[c.jsx("a",{className:St.commit,href:b,title:x,children:f.commit.shortHash}),c.jsxs("span",{className:St.age,children:["(",Nh(f.commit.authorDate),")"]}),f.dirty&&c.jsx("span",{className:St.dirty,children:r})]})}function Nh(e,t=Date.now()){const n=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3));if(n<60)return"now";const s=Math.floor(n/60);if(s<60)return`${s}m ago`;const r=Math.floor(s/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<30?`${o}d ago`:o<365?`${Math.floor(o/30)}mo ago`:`${Math.floor(o/365)}y ago`}function Ih(e){const t=new Date(e.authorDate).toLocaleString(),n=`${e.message}${e.messageTruncated?`
43
+ ...`:""}`;return`${e.authorName}
44
+ ${t}
45
+
46
+ ${n}`}function Ph(e){return e==="auto"||e==="unified"||e==="side-by-side"}function $h(){try{const e=localStorage.getItem(Ee.diffViewMode);if(Ph(e))return e}catch{}return"auto"}function Fh(){const[e,t]=a.useState($h),n=a.useCallback(s=>{t(s);try{localStorage.setItem(Ee.diffViewMode,s)}catch{}},[]);return[e,n]}const Bh="[data-source-list-item]:not(:disabled)",Dh="[data-source-file-item]:not(:disabled)",Oh=100;function cs(){ma(Oh)}function yv(e,{filesOnly:t=!1,onPage:n}={}){var m,h;const s=e.key==="PageDown"?1:e.key==="PageUp"?-1:null;if(s===null&&e.key!=="ArrowDown"&&e.key!=="ArrowUp"&&e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;if(s!==null){if(!n)return;e.preventDefault(),cs(),n(s);return}const r=Array.from(e.currentTarget.querySelectorAll(t?Dh:Bh));if(r.length===0)return;const o=document.activeElement,i=r.indexOf(o);if(i<0)return;if(e.key==="ArrowLeft"||e.key==="ArrowRight"){const w=r[i],g=w.getAttribute("aria-expanded");if(e.preventDefault(),cs(),e.key==="ArrowRight"){if(g==="false"){w.click();return}if(g==="true"){const b=r[i+1];if(!b||!((m=w.parentElement)!=null&&m.contains(b)))return;b.focus()}return}if(g==="true"){w.click();return}const f=w.closest("ul");if(!f||f===e.currentTarget)return;const y=(h=f.parentElement)==null?void 0:h.querySelector(":scope > [data-source-list-item]:not(:disabled)");if(!y)return;y.focus();return}const l=e.key==="ArrowDown"?1:-1,u=Math.min(r.length-1,Math.max(0,i+l)),d=r[u];d&&(e.preventDefault(),cs(),d!==o&&d.focus())}function vv(e,t=!0){a.useEffect(()=>{if(!t)return;const n=s=>{if(s.defaultPrevented||s.key!=="/"||s.altKey||s.ctrlKey||s.metaKey||Gi(s.target))return;const r=e.current;r&&(s.preventDefault(),r.focus(),r.select())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}function Gi(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT":!1}const Hh=1e3;function Vh(e,t){return e==="unified"||e==="side-by-side"?e:t>=Hh?"side-by-side":"unified"}function Uh(e){const t=[];let n=0;for(const s of e){t.push({type:"header",text:`@@ -${s.oldStart},${s.oldLines} +${s.newStart},${s.newLines} @@`});let r=[],o=[];const i=()=>{const l=Math.max(r.length,o.length);for(let u=0;u<l;u++)t.push({type:"line",left:r[u]??null,right:o[u]??null});r=[],o=[]};for(const l of s.lines){const u=n++,d=l[0];d==="-"?r.push(u):d==="+"?o.push(u):(i(),t.push({type:"line",left:u,right:u}))}i()}return t}function Xi(e,t=!1){var r;const n=new Map;if(typeof DOMParser>"u")return n;const s=new DOMParser().parseFromString(e,"text/html");for(const o of s.querySelectorAll("[data-diff-line]")){const i=Number(o.getAttribute("data-diff-line"));Number.isInteger(i)&&(t&&((r=o.querySelector(".diff-prefix"))==null||r.remove()),n.set(i,o.outerHTML))}return n}const qh=a.createContext(null);function Wh(){return a.useContext(qh)}const _n=new Map;function zh(e,t){let n=_n.get(e);return n||(n=new Set,_n.set(e,n)),n.add(t),()=>{n==null||n.delete(t),n&&n.size===0&&_n.delete(e)}}function bo(e){for(const t of _n.get(e)??[])t()}function Kh(e,t,n=!1){const s=pa(),r=Nt(),o=Wh(),[i,l]=a.useState([]),[u,d]=a.useState(!1),[m,h]=a.useState(null),w=a.useRef(null),g=a.useCallback(async()=>{try{const b=await oe.listReviewComments(e);l(b.comments.filter(x=>x.status==="pending"&&x.anchor.path===t))}catch{}},[e,t]);a.useEffect(()=>(g(),zh(e,()=>{g()})),[e,g]);const f=a.useCallback(async(b,x)=>{d(!0),h(null);try{const{comment:_}=await oe.addReviewComment(e,b,x);return l(M=>[...M,_]),bo(e),!0}catch(_){return h(_ instanceof Error?_.message:"Failed to add comment"),!1}finally{d(!1)}},[e]),y=a.useCallback(async(b,x,_,M,C)=>{var S;d(!0),h(null);try{const v=JSON.stringify({anchor:b,text:x,target:_}),L=n&&((S=w.current)==null?void 0:S.key)===v?w.current:null,p=L?L.commentId:(await oe.addReviewComment(e,b,x)).comment.id,E=(L==null?void 0:L.submissionId)??crypto.randomUUID();n&&!L&&(w.current={key:v,commentId:p,submissionId:E});const T=n?{id:E}:void 0,I=T?await oe.submitReview(e,[p],_,_==="new"?C:void 0,T):_==="new"&&C?await oe.submitReview(e,[p],_,C):await oe.submitReview(e,[p],_);return bo(e),I.sessionId?(w.current=null,s(`${r}/projects/${e}/sessions/${I.sessionId}`),"navigated"):(n&&(w.current=null),h(M),g(),"queued")}catch(v){return h(v instanceof Error?v.message:"Failed to submit"),"error"}finally{d(!1)}},[e,s,r,g,n]);return{pending:i,defaultSession:o,busy:u,error:m,setError:h,refreshPending:g,addToReview:f,submitNow:y}}const Yi=ei*Zo,Qh=80,Gh=600,Xh=10,sr=150,An="yep-hovercard-appearance-change",Yh=Bs(Ee.sessionHoverCardShowDelayMs,Yi,e=>{const t=Number(e);return Number.isFinite(t)?Math.max(0,t):void 0});function Jh(e,t,n){return Math.min(n,Math.max(t,e))}function Zh(e,t){return Math.round(e/t)*t}function Ji(e){return Number.isFinite(e)?Jh(Zh(e,Xh),Qh,Gh):sr}function em(e,t){const n=localStorage.getItem(e);return n===null?t:Number(n)}function So(){return{showDelayMs:Yi,warmShowDelayMs:ei,maxHeightPx:Ji(em(Ee.sessionHoverCardMaxHeightPx,sr))}}function Zi(){const{tooltipMode:e,tooltipDelayMs:t}=ga(),[n,s]=a.useState(So);a.useEffect(()=>{const o=()=>s(So());return window.addEventListener(An,o),()=>window.removeEventListener(An,o)},[]);const r=Yh.read();return{...n,showDelayMs:e==="native"?r:t*Zo,warmShowDelayMs:t}}function xv(){const{maxHeightPx:e}=Zi(),t=a.useCallback(s=>{localStorage.setItem(Ee.sessionHoverCardMaxHeightPx,String(Ji(s))),window.dispatchEvent(new Event(An))},[]),n=a.useCallback(()=>{localStorage.removeItem(Ee.sessionHoverCardMaxHeightPx),window.dispatchEvent(new Event(An))},[]);return{hoverCardMaxHeightPx:e,setHoverCardMaxHeightPx:t,resetHoverCardAppearance:n}}const As="active-session-hovercard",Ts=new EventTarget;let Co=0;function tm(){return Co+=1,`session-hovercard-${Co}`}function nm(e){Ts.dispatchEvent(new CustomEvent(As,{detail:e}))}function sm(e){const t=n=>{e(n.detail)};return Ts.addEventListener(As,t),()=>{Ts.removeEventListener(As,t)}}function rm({targetRef:e,showDelayMs:t,warmShowDelayMs:n,enabled:s=!0,refreshPreview:r}){const o=r==null?void 0:r.projectId,i=r==null?void 0:r.sessionId,l=r==null?void 0:r.lastAgentText,u=r==null?void 0:r.owner,d=r!==void 0&&r.available!==!1,m=a.useRef(Symbol("session-hovercard-intent")),h=a.useRef(null),w=a.useRef(null),g=a.useRef(!1),f=a.useRef(null);f.current||(f.current=tm());const y=f.current,[b,x]=a.useState(null),_=a.useRef(null),M=a.useCallback(()=>{wa(m.current)},[]),C=a.useCallback(()=>{const I=h.current;I&&(h.current=null,ya(I))},[]),S=a.useCallback(()=>{M(),C(),_.current=null,x(null)},[M,C]),v=a.useCallback(()=>{!d||!o||!i||l||u==="self"||u==="external"||g.current||(g.current=!0,oe.refreshSessionPreview(o,i).finally(()=>{g.current=!1}))},[d,l,u,o,i]),L=a.useCallback(()=>{if(!s||va()){S();return}M();const I=xa()?n:t,j=e.current;j&&ba(m.current,I,()=>{if(!j.isConnected||!Ca(j))return;const k=j.getBoundingClientRect();v(),nm(y),h.current??(h.current=Ea(S));const A={rowLeft:k.left,rowTop:k.top,rowRight:k.right,rowBottom:k.bottom,cursorX:w.current??k.right};_.current=A,x(A)})},[S,M,s,y,v,t,e,n]);a.useEffect(()=>sm(I=>{I!==y&&S()}),[S,y]),a.useEffect(()=>Sa(S),[S]),a.useEffect(()=>{s||S()},[S,s]),a.useEffect(()=>()=>{M(),C()},[M,C]);const p=a.useCallback(I=>{I.pointerType!=="touch"&&(w.current=I.clientX,L())},[L]),E=a.useCallback(I=>{I.pointerType!=="touch"&&(w.current=I.clientX,_.current||L())},[L]),T=a.useCallback(I=>{const j=I.relatedTarget;j instanceof Element&&j.closest(`[data-session-hovercard-id="${y}"]`)!==null||S()},[S,y]);return{anchor:b,hoverCardId:y,clear:S,onPointerEnter:p,onPointerMove:E,onPointerLeave:T}}const om=Date.UTC(2001,0,1);function im(e){if(!e)return!1;const t=new Date(e).getTime();return Number.isFinite(t)&&t>=om}function Eo(e){if(!im(e))return null;const t=Date.now()-new Date(e).getTime();if(t<0)return"0m";const n=Math.floor(t/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function cm(e,t){const n=Eo(e),s=Eo(t);return n?`${n} ago${s?` (est. ${s})`:""}`:s?`est. ${s}`:null}const am=/<command-name>([\s\S]*?)<\/command-name>/,lm=/<command-message>[\s\S]*?<\/command-message>/g,um=/<command-args>([\s\S]*?)<\/command-args>/,dm=/<command-name>[\s\S]*?<\/command-name>/g,fm=/<command-args>[\s\S]*?<\/command-args>/g,hm=/<local-command-caveat>[\s\S]*?<\/local-command-caveat>/g,mm=/^(?:\s*<local-command-caveat>[\s\S]*?<\/local-command-caveat>\s*)+$/,pm=/^\s*<local-command-stdout>([\s\S]*?)<\/local-command-stdout>\s*$/,gm=new RegExp("\x1B\\[[\\d;:? ]*[ -/]*[@-~]","g");function wm(e){var r,o,i,l;const t=(o=(r=e.match(am))==null?void 0:r[1])==null?void 0:o.trim();if(!t||e.replace(hm,"").replace(dm,"").replace(lm,"").replace(fm,"").trim())return null;const s=((l=(i=e.match(um))==null?void 0:i[1])==null?void 0:l.trim())??"";return{command:t,args:s}}function bv(e){return e.args?`${e.command} ${e.args}`:e.command}function Sv(e){return mm.test(e)}function Cv(e){var n;const t=e.match(pm);return((n=t==null?void 0:t[1])==null?void 0:n.replace(gm,"").trim())??null}function Ev(e){const t=e.replace(/\s+/g," ").trim().toLowerCase();return t==="compacted"||t.startsWith("compacted (")}const ym=19,vm=34,xm=20,bm=38;function Sm(e,t){return Math.max(1,Math.floor((e-vm-xm-(t?bm:0))/ym))}const ec="--ya-activity-play",tt=new Map;let Je=null;function Cm(){return document.visibilityState==="visible"}function rr(e,t){const n=t.intersectsViewport&&Cm();if(e.style.setProperty(ec,n?"running":"paused"),t.active!==n){t.active=n;for(const s of t.subscriptions.values())s==null||s(n)}}function Em(e){for(const t of e){const n=t.target,s=tt.get(n);s&&(s.intersectsViewport=t.isIntersecting,rr(n,s))}}function _m(){return typeof window.IntersectionObserver!="function"?null:(Je??(Je=new window.IntersectionObserver(Em)),Je)}function _o(){for(const[e,t]of tt)rr(e,t)}function km(e,t){const n=Symbol("activity-animation");let s=tt.get(e);if(s)s.subscriptions.set(n,t),t==null||t(s.active??!1);else{const r=_m();s={active:null,intersectsViewport:r===null,subscriptions:new Map([[n,t]])};const o=tt.size===0;tt.set(e,s),o&&document.addEventListener("visibilitychange",_o),r==null||r.observe(e),rr(e,s)}return()=>{const r=tt.get(e);r&&(r.subscriptions.delete(n),!(r.subscriptions.size>0)&&(Je==null||Je.unobserve(e),tt.delete(e),e.style.removeProperty(ec),tt.size===0&&(Je==null||Je.disconnect(),Je=null,document.removeEventListener("visibilitychange",_o))))}}const Lm="_dot_m9hw9_1",Mm="_root_m9hw9_11",Rm="_pill_m9hw9_17",jm="_label_m9hw9_30",Am="_icon_m9hw9_34",Tm="_iconSvg_m9hw9_46",Ct={dot:Lm,root:Mm,pill:Rm,label:jm,icon:Am,iconSvg:Tm};function Nm({variant:e="dot",label:t="Thinking",className:n,animationVisibilityManaged:s=!1}){const r=a.useRef(null);a.useEffect(()=>{if(!(s||!r.current))return km(r.current)},[s]);const o=c.jsx("span",{className:Ct.dot});return e==="icon"?c.jsx("span",{ref:r,className:`${Ct.icon} ${n??""}`,title:t,"aria-label":t,role:"img",children:c.jsxs("svg",{className:Ct.iconSvg,width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M12 18V5"}),c.jsx("path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"}),c.jsx("path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"}),c.jsx("path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77"}),c.jsx("path",{d:"M18 18a4 4 0 0 0 2-7.464"}),c.jsx("path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"}),c.jsx("path",{d:"M6 18a4 4 0 0 1-2-7.464"}),c.jsx("path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77"})]})}):e==="pill"?c.jsxs("span",{ref:r,className:`${Ct.pill} ${n??""}`,children:[o,c.jsx("span",{className:Ct.label,children:t})]}):c.jsx("span",{ref:r,className:`${Ct.root} ${n??""}`,children:o})}function Im({variant:e,label:t}){const n=e==="needs-input"?"Input Needed":"New";return c.jsx("span",{className:`status-badge notification-${e}`,children:t??n})}function Pm({status:e,pendingInputType:t,activity:n}){if(e.owner==="external")return c.jsx("span",{className:"status-badge status-external",children:"External"});if(t){const s=t==="tool-approval"?"Approval Needed":"Question";return c.jsx(Im,{variant:"needs-input",label:s})}return n==="in-turn"?c.jsx(Nm,{variant:"pill"}):null}const $m="_root_79ggm_5",Fm="_wide_79ggm_15",Bm="_turn_79ggm_38",Dm="_command_79ggm_54",Om="_meta_79ggm_59",Hm="_project_79ggm_68",Vm="_age_79ggm_76",Um="_reply_79ggm_85",qm="_replyMarker_79ggm_95",Wm="_replyText_79ggm_100",He={root:$m,wide:Fm,turn:Bm,command:Dm,meta:Om,project:Hm,age:Vm,reply:Um,replyMarker:qm,replyText:Wm},yn=4,nt=8,zm=14,ko=8;function Km({rowLeft:e,rowRight:t,cursorX:n,cardWidth:s,viewportWidth:r}){const o=Math.max(nt,r-s-nt),i=t+ko;if(i+s<=r-nt)return i;const l=e-ko-s;return l>=nt?l:Math.min(Math.max(n+zm,nt),o)}function Qm({hoverCardId:e,anchor:t,prompt:n,lastAgentText:s,provider:r,model:o,projectName:i,ageLabel:l,onMouseLeave:u,status:d,pendingInputType:m,hasUnread:h,activity:w,maxHeightPx:g=sr}){const f=a.useRef(null),y=vo(n),b=vo(s),[x,_]=a.useState(null),M=[n,s??"",o??"",i??"",l,d].join("\0");a.useLayoutEffect(()=>{const v=f.current;if(!v)return;const{rowTop:L,rowBottom:p}=t,E=v.scrollHeight,T=v.offsetWidth,I=Math.max(0,window.innerHeight-p-yn-nt),j=Math.max(0,L-yn-nt),k=Math.min(E,g),A=Math.min(I,g),$=Math.min(j,g);let P,B,q=!1;k<=A?(P=!0,B=A):k<=$?(P=!1,B=$):(P=I>=j,B=Math.min(Math.max(I,j),g),q=!0);const D=Math.min(E,B),U=P?p+yn:L-yn-D,Q=Km({...t,cardWidth:T,viewportWidth:window.innerWidth});_({top:Math.max(nt,U),left:Q,maxHeight:B,loosened:q})},[t,M,g]);const C=x?Sm(x.maxHeight,!!s):void 0,S=n?wm(n):null;return st.createPortal(c.jsxs("div",{ref:f,"data-session-hovercard-id":e,...ws,className:`${He.root}${x!=null&&x.loosened?` ${He.wide}`:""}`,onMouseLeave:u,style:x?{top:x.top,left:x.left,maxHeight:x.maxHeight}:{top:0,left:0,visibility:"hidden"},role:"tooltip",children:[n&&c.jsx("div",{ref:y,className:He.turn,style:C?{WebkitLineClamp:C}:void 0,children:S?c.jsxs("span",{className:He.command,children:[S.command,S.args?` ${S.args}`:""]}):n}),c.jsxs("div",{className:He.meta,children:[c.jsx(bl,{provider:r,model:o}),i&&c.jsx("span",{className:He.project,children:i}),l&&c.jsx("span",{className:He.age,children:l}),d&&c.jsx(Pm,{status:d,pendingInputType:m,hasUnread:h,activity:w})]}),s&&c.jsxs("div",{ref:b,className:He.reply,children:[c.jsx("span",{className:He.replyMarker,"aria-hidden":"true",children:"↳"}),c.jsx("span",{className:He.replyText,children:s})]})]}),document.body)}function Lo({sessionId:e,fallback:t,children:n,className:s}){var _,M;const r=Aa(e),{showDelayMs:o,warmShowDelayMs:i,maxHeightPx:l}=Zi(),u=a.useRef(null),{anchor:d,hoverCardId:m,clear:h,onPointerEnter:w,onPointerMove:g,onPointerLeave:f}=rm({targetRef:u,showDelayMs:o,warmShowDelayMs:i,refreshPreview:{projectId:t.projectId,sessionId:e,lastAgentText:r==null?void 0:r.lastAgentText,owner:(_=r==null?void 0:r.ownership)==null?void 0:_.owner,available:!!r}});a.useEffect(()=>{if(!d)return;const C=()=>h();return window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[d,h]);const b=((M=!!(r!=null&&r.customTitle)?r==null?void 0:r.title:(r==null?void 0:r.initialPrompt)??(r==null?void 0:r.fullTitle)??(r==null?void 0:r.title))==null?void 0:M.trim())||t.title,x=(r==null?void 0:r.provider)??t.provider;return c.jsxs("span",{ref:u,className:s,onPointerEnter:w,onPointerMove:g,onPointerLeave:f,children:[n,d&&c.jsx(Qm,{hoverCardId:m,anchor:d,prompt:b,lastAgentText:r==null?void 0:r.lastAgentText,provider:x,model:(r==null?void 0:r.model)??t.model,projectName:r==null?void 0:r.projectName,ageLabel:cm(r==null?void 0:r.updatedAt,r==null?void 0:r.createdAt),status:r==null?void 0:r.ownership,pendingInputType:r==null?void 0:r.pendingInputType,hasUnread:r==null?void 0:r.hasUnread,activity:r==null?void 0:r.activity,maxHeightPx:l,onMouseLeave:h})]})}async function Gm(e){var s;const t=[];let n;for(;;){const r=await oe.getGlobalSessions({project:e,limit:500,after:n});if(t.push(...r.sessions),!r.hasMore)return t;const o=(s=r.sessions[r.sessions.length-1])==null?void 0:s.updatedAt;if(!o||o===n)throw new Error("Existing-session list did not advance");n=o}}function Xm(e,t){const n=e.customTitle||e.title||e.id.slice(0,8),s=e.model?`${e.provider}/${e.model}`:e.provider;return t?`${n} · ${s} · ${t}`:`${n} · ${s}`}const Ym="_window_1f36g_1",Jm="_anchor_1f36g_12",Zm="_snippet_1f36g_18",ep="_input_1f36g_30",tp="_error_1f36g_41",np="_actions_1f36g_46",sp="_submitActions_1f36g_53",rp="_destination_1f36g_62",op="_destinationError_1f36g_76",ip="_defaultSessionTarget_1f36g_82",cp="_submit_1f36g_53",Re={window:Ym,anchor:Jm,snippet:Zm,input:ep,error:tp,actions:np,submitActions:sp,destination:rp,destinationError:op,defaultSessionTarget:ip,submit:cp};function ap({projectId:e,anchorLabel:t,snippet:n,busy:s,error:r,onCancel:o,onAddToReview:i,defaultSession:l,onSubmit:u,t:d}){const[m,h]=a.useState(""),[w,g]=a.useState(null),[f,y]=a.useState(!1),[b,x]=a.useState((l==null?void 0:l.id)??"new"),_=a.useRef(!1),M=m.trim().length>0&&!s;a.useEffect(()=>{let v=!1;return Gm(e).then(L=>{var p;v||(g(L),!l&&!_.current&&x(((p=L[0])==null?void 0:p.id)??"new"))}).catch(()=>{v||y(!0)}),()=>{v=!0}},[l,e]);const C=(w==null?void 0:w.find(v=>v.id===b))??null,S=c.jsx("button",{type:"button",className:Re.submit,onClick:()=>u(m,b),disabled:!M,children:d("sourceReviewSubmitComment")});return c.jsx(tc,{anchorLabel:t,snippet:n,text:m,placeholder:d("sourceReviewCommentPlaceholder"),error:r,onChange:h,actions:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"review-comment-window-cancel",onClick:o,disabled:s,children:d("cancel")}),c.jsx("button",{type:"button",className:"review-comment-window-add",onClick:()=>i(m),disabled:!M,children:d("sourceReviewAddToReview")}),c.jsxs("div",{className:Re.submitActions,children:[c.jsxs("label",{className:Re.destination,children:[c.jsx("span",{children:d("sourceReviewTargetLegend")}),c.jsxs("select",{value:b,onChange:v=>{_.current=!0,x(v.target.value)},children:[c.jsx("option",{value:"new",children:d("sourceReviewTargetNew")}),l&&!(w!=null&&w.some(v=>v.id===l.id))&&c.jsxs("option",{value:l.id,children:[l.title," ·"," ",l.newSession.provider,l.newSession.model?`/${l.newSession.model}`:""," ","· ",d("sourceReviewCurrentSuffix")]}),w==null?void 0:w.map(v=>c.jsx("option",{value:v.id,children:Xm(v,v.id===(l==null?void 0:l.id)?d("sourceReviewCurrentSuffix"):void 0)},v.id))]})]}),f&&c.jsx("span",{className:Re.destinationError,children:d("sourceReviewSessionsUnavailable")}),l&&b===l.id?c.jsx(Lo,{sessionId:l.id,fallback:{projectId:l.projectId,title:l.title,provider:l.newSession.provider,model:l.newSession.model},className:Re.defaultSessionTarget,children:S}):C?c.jsx(Lo,{sessionId:C.id,fallback:{projectId:C.projectId,title:C.customTitle||C.title||C.id.slice(0,8),provider:C.provider,model:C.model},className:Re.defaultSessionTarget,children:S}):S]})]})})}function tc({anchorLabel:e,snippet:t,text:n,placeholder:s,autoFocus:r=!0,error:o,onChange:i,onBlur:l,onKeyDown:u,actions:d}){return c.jsxs("div",{className:Re.window,"data-markdown-copy-ignore":"true",children:[c.jsx("div",{className:Re.anchor,children:e}),c.jsx("pre",{className:Re.snippet,children:t}),c.jsx("textarea",{className:Re.input,autoFocus:r,rows:3,value:n,placeholder:s,onBlur:l,onChange:m=>i(m.target.value),onKeyDown:u}),o&&c.jsx("div",{className:Re.error,children:o}),c.jsx("div",{className:Re.actions,children:d})]})}const lp="_menuTrigger_qenm5_1",up={menuTrigger:lp};function dp({container:e,structuredPatch:t,pending:n,revisions:s,consumeLongPressClick:r,onOpenComment:o,onOpenMenu:i,onBeginLongPress:l,onMoveLongPress:u,onEndLongPress:d,t:m}){const[h,w]=a.useState(null),g=a.useCallback(b=>{if(!(b instanceof HTMLElement))return null;const x=b.closest("[data-diff-line]");return!x||!e.contains(x)?null:as(e,x,t)},[e,t]),f=a.useCallback(b=>{w(x=>(x==null?void 0:x.flatIndex)===b.flatIndex&&x.contextSide===b.contextSide&&x.top===b.top?x:b)},[]),y=a.useCallback(()=>{if(!h)return null;const b=e.querySelectorAll(`[data-diff-line="${h.flatIndex}"]`),x=Array.from(b).find(_=>nc(_)===h.contextSide)??b[0];return x?as(e,x,t):null},[h,e,t]);return a.useLayoutEffect(()=>{const b=p=>{var T;if(r()||!(((T=window.getSelection())==null?void 0:T.isCollapsed)??!0))return;const E=g(p.target);E&&o(E)},x=p=>{const E=g(p.target);E&&(p.preventDefault(),p.stopPropagation(),f(E.target),i(E,{x:p.clientX,y:p.clientY}))},_=p=>{const E=g(p.target);E&&(f(E.target),l(E,p))},M=p=>{u(p);const E=g(p.target);E&&f(E.target)},C=()=>d(),S=()=>{d(),w(null)},v=p=>{const E=g(p.target);E&&f(E.target)},L=p=>{const E=g(p.target);if(!E)return;if(p.key==="ContextMenu"||p.shiftKey&&p.key==="F10"){p.preventDefault(),p.stopPropagation();const k=E.node.getBoundingClientRect();i(E,{x:k.left+Math.min(32,k.width/2),y:k.bottom});return}if(p.key==="Enter"||p.key===" "){p.preventDefault(),o(E);return}if(p.key!=="ArrowDown"&&p.key!=="ArrowUp")return;const T=Array.from(e.querySelectorAll("[data-diff-line]")),I=T.indexOf(E.node),j=T[I+(p.key==="ArrowDown"?1:-1)];j&&(p.preventDefault(),j.focus())};return e.addEventListener("click",b),e.addEventListener("contextmenu",x),e.addEventListener("pointerdown",_),e.addEventListener("pointermove",M),e.addEventListener("pointerup",C),e.addEventListener("pointercancel",C),e.addEventListener("pointerleave",S),e.addEventListener("focusin",v),e.addEventListener("keydown",L),()=>{e.removeEventListener("click",b),e.removeEventListener("contextmenu",x),e.removeEventListener("pointerdown",_),e.removeEventListener("pointermove",M),e.removeEventListener("pointerup",C),e.removeEventListener("pointercancel",C),e.removeEventListener("pointerleave",S),e.removeEventListener("focusin",v),e.removeEventListener("keydown",L)}},[f,r,e,l,d,u,o,i,g]),a.useLayoutEffect(()=>{const b=new Set(n.map(M=>hp(M.anchor))),x=()=>{const M=e.querySelectorAll("[data-diff-line]");for(const C of M){const S=as(e,C,t),v=S?s==null?void 0:s[S.location.side]:void 0;C.classList.toggle("has-review-comment",!!S&&b.has(sc(S.location,v))),C.tabIndex=0,C.setAttribute("aria-label",m("sourceDiffLineActions"))}};x();const _=new MutationObserver(x);return _.observe(e,{childList:!0,subtree:!0}),()=>_.disconnect()},[e,n,s,t,m]),{activeLine:h,resolveActiveLine:y}}function as(e,t,n){const s=Number(t.getAttribute("data-diff-line")),r=nc(t),o=Ll(n,s,void 0,r);if(!o)return null;const i=t.getBoundingClientRect(),l=e.getBoundingClientRect();return{node:t,target:{flatIndex:s,contextSide:r,top:i.top-l.top+e.scrollTop},location:o}}function nc(e){var t;return((t=e.closest("[data-diff-col]"))==null?void 0:t.getAttribute("data-diff-col"))==="old"?"old":"new"}function fp(e){return(e==null?void 0:e.kind)==="sha"?`sha:${e.sha}`:"uncommitted"}function sc(e,t){return`${fp(t)}:${e.side}:${e.oldLine}:${e.newLine}`}function hp(e){return sc(e,e.revision)}function mp({projectId:e,filePath:t,structuredPatch:n,revisions:s,projections:r,container:o,onOpenChange:i,renderSource:l,t:u}){const[d,m]=a.useState(null),{pending:h,defaultSession:w,busy:g,error:f,setError:y,addToReview:b,submitNow:x}=Kh(e,t,r!==void 0);a.useLayoutEffect(()=>(i==null||i(d!==null),()=>{d&&(i==null||i(!1))}),[i,d]);const _=a.useCallback(v=>{y(null),m(v)},[y]),M=a.useCallback(async v=>{d&&await b(d.anchor,v)&&m(null)},[b,d]),C=a.useCallback(async(v,L,p)=>{if(!d)return;await x(d.anchor,v,L,u("sourceReviewSubmitQueued"),p)==="navigated"&&m(null)},[d,x,u]),S=d?c.jsx(ap,{projectId:e,anchorLabel:`${t}:${d.anchor.newLine??d.anchor.oldLine??"?"}`,snippet:d.anchor.snippet,busy:g,error:f,onCancel:()=>m(null),onAddToReview:M,defaultSession:w,onSubmit:(v,L)=>C(v,L,L==="new"?w==null?void 0:w.newSession:void 0),t:u},`${d.anchor.side}:${d.flatIndex}`):null;return c.jsxs(c.Fragment,{children:[l({openComment:d,editor:S}),c.jsx(pp,{filePath:t,structuredPatch:n,revisions:s,projections:r,container:o,pending:h,onOpenComment:_,t:u})]})}function pp({filePath:e,structuredPatch:t,revisions:n,projections:s,container:r,pending:o,onOpenComment:i,t:l}){const{menu:u,openAt:d,openFromButton:m,beginLongPressAt:h,moveLongPressAt:w,endLongPress:g,consumeLongPressClick:f}=Hi(l),y=a.useCallback(v=>({path:e,revision:(n==null?void 0:n[v.side])??{kind:"uncommitted",savedAt:new Date().toISOString()},side:v.side,oldLine:v.oldLine,newLine:v.newLine,snippet:v.snippet,snippetAnchorOffset:v.snippetAnchorOffset,...s!=null&&s[v.side]?{projection:s[v.side]}:{}}),[e,s,n]),b=a.useCallback(({location:v,target:L})=>{i({anchor:y(v),flatIndex:L.flatIndex})},[y,i]),x=a.useCallback((v,L,p)=>{const E=L.snippet.split(`
47
+ `)[L.snippetAnchorOffset]??"",T=L.newLine??L.oldLine;return[{label:l("sourceCommentOnLine"),onSelect:()=>b({target:v,location:L,node:p})},{label:l("sourceCopyLine"),separatorBefore:!0,onSelect:()=>{_e(E)}},{label:l("sourceCopyPathLine"),onSelect:()=>{_e(T?`${e}:${T}`:e)}}]},[e,b,l]),_=a.useCallback((v,L)=>{d(L.x,L.y,v.node,x(v.target,v.location,v.node))},[x,d]),M=a.useCallback((v,L)=>{h(L,v.node,x(v.target,v.location,v.node))},[h,x]),{activeLine:C,resolveActiveLine:S}=dp({container:r,structuredPatch:t,pending:o,revisions:n,consumeLongPressClick:f,onOpenComment:b,onOpenMenu:_,onBeginLongPress:M,onMoveLongPress:w,onEndLongPress:g,t:l});return c.jsxs(c.Fragment,{children:[C&&c.jsx("button",{type:"button",className:up.menuTrigger,style:{top:C.top},"aria-label":l("sourceMoreActions"),title:l("sourceMoreActions"),onClick:v=>{const L=S();L&&m(v,x(L.target,L.location,L.node))},children:"⋯"}),u]})}const gp="_root_nfjne_1",wp="_source_nfjne_7",yp="_editor_nfjne_11",_t={root:gp,source:wp,editor:yp};function qt({before:e,editor:t,after:n}){return t?c.jsxs("div",{className:_t.root,"data-review-comment-split":"",children:[c.jsx("div",{className:_t.source,"data-review-comment-before":"",children:e}),c.jsx("div",{className:_t.editor,children:t}),c.jsx("div",{className:_t.source,"data-review-comment-after":"",children:n})]}):c.jsx(c.Fragment,{children:e})}function vp({editor:e}){return e?c.jsx("div",{className:_t.root,"data-review-comment-inline":"",children:c.jsx("div",{className:_t.editor,children:e})}):null}const xp=a.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:s,editor:r=null}){const o=a.useMemo(()=>Xi(t),[t]),i=a.useMemo(()=>Uh(n),[n]),l=s===void 0?-1:i.findIndex(u=>u.type==="line"&&(u.left===s||u.right===s));return l<0||!r?c.jsx(ls,{rows:i,fragments:o}):c.jsx(qt,{before:c.jsx(ls,{rows:i.slice(0,l+1),fragments:o}),editor:r,after:c.jsx(ls,{rows:i.slice(l+1),fragments:o})})});function ls({rows:e,fragments:t}){return c.jsx("div",{className:"side-by-side-diff",children:e.map((n,s)=>n.type==="header"?c.jsx("div",{className:"sbs-header highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code><span class="line line-hunk">${bp(n.text)}</span></code></pre>`}},`h-${s}`):c.jsxs("div",{className:"sbs-row",children:[c.jsx(Ro,{col:"old",html:Mo(t,n.left)}),c.jsx(Ro,{col:"new",html:Mo(t,n.right)})]},`r-${s}`))})}function Mo(e,t){return t===null?null:e.get(t)??null}function Ro({col:e,html:t}){return t===null?c.jsx("div",{className:"sbs-cell sbs-empty"}):c.jsx("div",{className:"sbs-cell highlighted-diff","data-diff-col":e,dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${t}</code></pre>`}})}function bp(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Sp="_plain_v5smy_1",Cp="_hunkHeader_v5smy_22",jo={plain:Sp,hunkHeader:Cp},us=".line-deleted, .line-inserted, .diff-removed, .diff-added, .fixed-font-diff-removed, .fixed-font-diff-added",Ao=a.memo(function({diffHtml:t,structuredPatch:n,splitAfterLine:s,editor:r=null,plain:o=!1,hideRemovedLines:i=!1}){const l=a.useMemo(()=>o?new Map:Xi(t,i),[t,i,o]),u=a.useMemo(()=>o?[]:_p(n,i),[i,o,n]);if(o)return c.jsx(Ep,{hunks:n,hideRemovedLines:i});const d=s===void 0?-1:u.findIndex(m=>m.type==="line"&&m.flatIndex===s);return d<0||!r?c.jsx(ds,{rows:u,fragments:l,omitDiffPrefixes:i}):c.jsx(qt,{before:c.jsx(ds,{rows:u.slice(0,d+1),fragments:l,omitDiffPrefixes:i}),editor:r,after:c.jsx(ds,{rows:u.slice(d+1),fragments:l,omitDiffPrefixes:i})})});function Ep({hunks:e,hideRemovedLines:t}){return c.jsx("div",{className:jo.plain,"data-diff-rendering":"plain",children:c.jsx("pre",{children:c.jsx("code",{children:e.map((n,s)=>c.jsxs(a.Fragment,{children:[!t&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:`${jo.hunkHeader} line-hunk`,children:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`}),`
48
+ `]}),n.lines.filter(r=>!t||!r.startsWith("-")).map(r=>t?r.slice(1):r).join(`
49
+ `),s+1<e.length?`
50
+ `:""]},`${n.oldStart}:${n.newStart}:${s}`))})})})}function _p(e,t){const n=[];let s=0;for(const r of e){t||n.push({type:"header",text:`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`});for(const o of r.lines)(!t||!o.startsWith("-"))&&n.push({type:"line",flatIndex:s,text:o}),s+=1}return n}function ds({rows:e,fragments:t,omitDiffPrefixes:n}){const s=e.map(r=>r.type==="header"?`<span class="line line-hunk">${fs(r.text)}</span>`:t.get(r.flatIndex)??`<span class="${kp(r.text)}" data-diff-line="${r.flatIndex}">${n?"":`<span class="diff-prefix">${fs(r.text[0]??" ")}</span>`}${fs(r.text.slice(1))}</span>`).join("");return c.jsx("div",{className:"highlighted-diff",dangerouslySetInnerHTML:{__html:`<pre class="shiki"><code>${s}</code></pre>`}})}function kp(e){return e[0]==="-"?"line line-deleted":e[0]==="+"?"line line-inserted":"line line-context"}function fs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Lp="_plainNotice_ymdjf_1",Mp={plainNotice:Lp},Rp=1e6*20;function jp(e){return e.flatMap(t=>t.lines).join(`
51
+ `)}function To(e){return e.length===0?null:e.map(t=>t.lines.filter(n=>n.startsWith(" ")||n.startsWith("+")).map(n=>n.slice(1)).join(`
52
+ `)).join(`
53
+ `)}function vn(e){return e.closest(".git-diff-preview-body, .modal-content")??e}const Jt={kind:"worktree"},Ap={kind:"working-tree-history"};function Tn(e){if(e.kind==="commit")return e.sha;if(e.kind==="comparison"||e.kind==="inclusive-comparison")return e.headSha}function or(e){const t=Math.max(0,e.scrollHeight-e.clientHeight);return t===0?0:Math.min(1,Math.max(0,e.scrollTop/t))}function Tp(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=n*Math.min(1,Math.max(0,t))}function Ns(e,t,n,s){return e==="commit"?{kind:"commit",sha:t}:e==="comparison"||e==="inclusive-comparison"?{kind:e,baseSha:t,headSha:n}:e==="file-projection"?{kind:"file-projection",mode:s}:e==="working-tree-history"?Ap:Jt}function rc(e,t,n,s,r){return n.kind==="commit"?oe.getGitCommitDiff(e,{sha:n.sha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}}):n.kind==="comparison"||n.kind==="inclusive-comparison"?(n.kind==="inclusive-comparison"?oe.getGitInclusiveComparisonDiff:oe.getGitComparisonDiff)(e,{baseSha:n.baseSha,headSha:n.headSha,path:t.path,status:t.status,...t.origPath?{origPath:t.origPath}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}}):n.kind==="file-projection"?oe.getGitFileProjectionDiff(e,{path:t.path,mode:n.mode,...t.origPath?{origPath:t.origPath}:{},fullContext:s}):oe.getGitDiff(e,{path:t.path,staged:t.staged,status:t.status,...n.kind==="working-tree-history"?{againstHead:!0,...t.origPath?{origPath:t.origPath}:{}}:{},fullContext:s,...r?{ignoreWhitespace:!0}:{}})}function Np(e){if(e.kind==="commit"){const t={kind:"sha",sha:e.sha};return{old:t,new:t}}if(e.kind==="comparison"||e.kind==="inclusive-comparison")return{old:{kind:"sha",sha:e.baseSha},new:{kind:"sha",sha:e.headSha}}}const _v=a.forwardRef(function({file:t,fileKey:n,projectId:s,source:r=Jt,headerActions:o,retainedScrollRatio:i,retainedDiffView:l,onRetainScrollRatio:u,onRetainDiffView:d,onCommentEditorOpenChange:m,captureReviewProjections:h=!1,ignoreWhitespace:w=!1,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:f,t:y},b){const x=t?t.path.split("/").pop()||t.path:null,_=a.useRef(null),M=a.useRef(null),C=a.useCallback(S=>{M.current=S},[]);return a.useImperativeHandle(b,()=>({jumpToNextHunk:()=>{var S;return((S=M.current)==null?void 0:S.next())??!1},jumpToPreviousHunk:()=>{var S;return((S=M.current)==null?void 0:S.previous())??!1},scrollByPage:S=>{const v=_.current;if(!v)return;const L=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(L,Math.max(0,v.scrollTop+S*v.clientHeight))}}),[]),a.useLayoutEffect(()=>{const S=_.current;return()=>{!n||!S||u==null||u(n,or(S))}},[n,u]),c.jsx("section",{className:"git-diff-preview-pane",children:c.jsx("div",{className:"git-diff-preview-body",ref:_,children:t&&n?c.jsx(ir,{file:t,fileKey:n,projectId:s,source:r,retainedScrollRatio:i,scrollContainerRef:_,retainedDiffView:l,onRetainDiffView:d,paneHeader:{title:x??t.path,path:t.path,actions:o,revision:c.jsx(nr,{projectId:s,path:t.path,origPath:Tn(r)?void 0:t.origPath,rev:Tn(r),dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")})},onHunkNavigationChange:C,onCommentEditorOpenChange:m,captureReviewProjections:h,ignoreWhitespace:w,onToggleIgnoreWhitespace:g,onProjectionRequestFailure:f,t:y}):c.jsxs(c.Fragment,{children:[c.jsx(cr,{title:y("gitStatusDiffPreview"),path:"",actions:o}),c.jsx("div",{className:"git-diff-placeholder",children:y("gitStatusSelectFileForDiff")})]})})})});function kv({file:e,fileKey:t,projectId:n,source:s=Jt,headerActions:r,retainedScrollRatio:o,retainedDiffView:i,onRetainScrollRatio:l,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:m=!1,ignoreWhitespace:h=!1,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:f,onClose:y}){const b=a.useRef(null);return a.useLayoutEffect(()=>{const x=b.current;return()=>{x&&(l==null||l(t,or(x)))}},[t,l]),c.jsxs(ri,{title:e.path,onClose:y,closeOnBackGesture:!0,contentRef:b,children:[c.jsxs("div",{className:"git-diff-preview-header-actions",children:[c.jsx(nr,{projectId:n,path:e.path,origPath:Tn(s)?void 0:e.origPath,rev:Tn(s),dirtyLabel:f("fileRevisionDirty"),uncommittedLabel:f("fileRevisionUncommitted")}),r]}),c.jsx(ir,{file:e,fileKey:t,projectId:n,source:s,retainedScrollRatio:o,scrollContainerRef:b,retainedDiffView:i,onRetainDiffView:u,onCommentEditorOpenChange:d,captureReviewProjections:m,ignoreWhitespace:h,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:f})]})}function ir({file:e,fileKey:t,projectId:n,source:s=Jt,retainedDiffView:r,onRetainDiffView:o,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d=!1,ignoreWhitespace:m=!1,onToggleIgnoreWhitespace:h,onProjectionRequestFailure:w,retainedScrollRatio:g,scrollContainerRef:f,t:y}){const b=s.kind,x=s.kind==="commit"?s.sha:s.kind==="comparison"||s.kind==="inclusive-comparison"?s.baseSha:"",_=s.kind==="comparison"||s.kind==="inclusive-comparison"?s.headSha:"",M=s.kind==="file-projection"?s.mode:"worktree",C=JSON.stringify([t,b,x,_,M,m]),[S,v]=a.useState(()=>({requestKey:C,result:null,loading:!0,error:null})),L=S.requestKey===C?S:{result:null,loading:!0,error:null},{result:p,loading:E,error:T}=L,I=a.useRef({fileKey:t,view:r});I.current.fileKey!==t&&(I.current={fileKey:t,view:r});const j=a.useCallback((P,B)=>{I.current.fileKey===P&&(I.current.view={...I.current.view,...B}),o==null||o(P,B)},[o]),k=a.useRef(p),A=a.useRef(g===void 0?null:{fileKey:t,ratio:g});k.current=p,a.useLayoutEffect(()=>{A.current=g===void 0?null:{fileKey:t,ratio:g}},[t,g]),a.useLayoutEffect(()=>{const P=A.current;if(!p||(P==null?void 0:P.fileKey)!==t)return;const B=f==null?void 0:f.current;B&&(Tp(B,P.ratio),A.current=null)},[p,t,f]),a.useEffect(()=>{let P=!1;return v(B=>B.requestKey===C?{...B,loading:!0,error:null}:{requestKey:C,result:null,loading:!0,error:null}),rc(n,e,Ns(b,x,_,M),void 0,m).then(B=>{if(!P){const q=f==null?void 0:f.current;k.current&&q&&(A.current={fileKey:t,ratio:or(q)}),v({requestKey:C,result:B,loading:!1,error:null})}}).catch(B=>{if(!P){(m||b==="comparison"||b==="inclusive-comparison")&&(w==null||w(B));const q=B.message||y("gitStatusLoadDiffFailed");v(D=>D.requestKey===C?{...D,loading:!1,error:q}:{requestKey:C,result:null,loading:!1,error:q})}}),()=>{P=!0}},[n,e,t,C,b,x,_,M,m,w,f,y]);const $=E&&!p;return c.jsxs(c.Fragment,{children:[i&&($||!p&&T)&&c.jsx(cr,{title:i.title,path:i.path,actions:i.actions,revision:i.revision}),$&&c.jsx("div",{className:"git-diff-loading",children:y("gitStatusLoadingDiff")}),!p&&T&&c.jsx("div",{className:"git-diff-error",children:T}),p&&c.jsxs(c.Fragment,{children:[T&&c.jsx("div",{className:"git-diff-error",children:T}),c.jsx(Ip,{file:e,fileKey:t,projectId:n,source:s,diffResult:p,retainedDiffView:I.current.view,onRetainDiffView:j,paneHeader:i,onHunkNavigationChange:l,onCommentEditorOpenChange:u,captureReviewProjections:d,ignoreWhitespace:m,onToggleIgnoreWhitespace:h,onProjectionRequestFailure:w,t:y},C)]})]})}function Ip({file:e,fileKey:t,projectId:n,source:s=Jt,diffResult:r,retainedDiffView:o,onRetainDiffView:i,paneHeader:l,onHunkNavigationChange:u,onCommentEditorOpenChange:d,captureReviewProjections:m=!1,ignoreWhitespace:h=!1,onToggleIgnoreWhitespace:w,onProjectionRequestFailure:g,t:f}){const[y,b]=a.useState(()=>((o==null?void 0:o.showFullContext)??!1)||((o==null?void 0:o.hideRemovedLines)??!1)),[x,_]=a.useState(()=>(o==null?void 0:o.hideRemovedLines)??!1),M=a.useMemo(()=>JSON.stringify([r.structuredPatch,r.previewSkipped??null]),[r.previewSkipped,r.structuredPatch]),[C,S]=a.useState({revisionKey:null,result:null,loading:!1,error:null}),v=C.revisionKey===M?C:{result:null,loading:!1,error:null},{result:L,loading:p,error:E}=v,[T,I]=a.useState(()=>(o==null?void 0:o.showMarkdownPreview)??!1),j=a.useRef(null),k=a.useRef(null),[A,$]=a.useState(null),P=a.useCallback(V=>{j.current=V,$(V)},[]),[B,q]=Fh(),[D,U]=a.useState(0),Q=s.kind,Z=s.kind==="commit"?s.sha:s.kind==="comparison"||s.kind==="inclusive-comparison"?s.baseSha:"",K=s.kind==="comparison"||s.kind==="inclusive-comparison"?s.headSha:"",O=s.kind==="file-projection"?s.mode:"worktree",W=a.useMemo(()=>Np(Ns(Q,Z,K,O)),[Z,O,K,Q]);a.useEffect(()=>{const V=j.current;if(!V||typeof ResizeObserver>"u")return;const H=new ResizeObserver(ue=>{var xe;const ce=(xe=ue[0])==null?void 0:xe.contentRect.width;typeof ce=="number"&&U(ce)});return H.observe(V),()=>H.disconnect()},[]);const Y=a.useCallback(()=>{q(B==="auto"?"unified":B==="unified"?"side-by-side":"auto")},[B,q]),G=ys(e.path),R=a.useMemo(()=>G?$n(jp(r.structuredPatch),{diffAware:!0,baseFilePath:e.path,projectId:n}):null,[r.structuredPatch,e.path,G,n]),he=a.useMemo(()=>L?To(L.structuredPatch):null,[L]),re=a.useMemo(()=>!G||he===null||L!=null&&L.markdownHtml?null:$n(he,{baseFilePath:e.path,projectId:n}),[e.path,L==null?void 0:L.markdownHtml,he,G,n]),ae=(L==null?void 0:L.markdownHtml)||(re==null?void 0:re.html),ke=G&&(!!r.markdownHtml||(R==null?void 0:R.changed)===!0||(re==null?void 0:re.changed)===!0),de=T&&ke,ee=y?ae:R==null?void 0:R.html,ye=a.useCallback(V=>{i==null||i(t,V)},[t,i]),ie=a.useCallback(async()=>{if(L)return L;if(p)return null;const V=M;S(H=>H.revisionKey===V?{...H,loading:!0,error:null}:{revisionKey:V,result:null,loading:!0,error:null});try{const H=await rc(n,e,Ns(Q,Z,K,O),!0,h);return S(ue=>ue.revisionKey===V?{revisionKey:V,result:H,loading:!1,error:null}:ue),H}catch(H){(h||Q==="comparison"||Q==="inclusive-comparison")&&(g==null||g(H));const ue=H instanceof Error?H.message:f("gitStatusLoadContextFailed");return S(ce=>ce.revisionKey===V?{revisionKey:V,result:null,loading:!1,error:ue}:ce),null}},[L,p,M,n,e,Q,Z,K,O,h,g,f]),qe=a.useCallback(async()=>{const V=!y;if(V&&!await ie())return;const H=j.current,ue=H?vn(H):null;k.current=Ls(ue,(H==null?void 0:H.querySelector(us))??null),b(V),V||_(!1),ye({showFullContext:V,...V?{}:{hideRemovedLines:!1}})},[ie,ye,y]),Zt=a.useCallback(async()=>{const V=!x;if(V&&!await ie())return;const H=j.current,ue=H?vn(H):null;k.current=Ls(ue,(H==null?void 0:H.querySelector(us))??null),V&&b(!0),_(V),ye({hideRemovedLines:V,...V?{showFullContext:!0}:{}})},[x,ie,ye]),Hn=a.useCallback(()=>{const V=!T;I(V),ye({showMarkdownPreview:V})},[ye,T]),en=a.useCallback(async()=>{const V=y?L??await ie():r,H=V?To(V.structuredPatch):null;if(H===null)throw new Error("Diff content is unavailable");return H},[r,L,ie,y]);a.useEffect(()=>{y&&!L&&!p&&ie()},[p,L,ie,y]),a.useLayoutEffect(()=>{var H;const V=k.current;V&&(k.current=null,Ai(V,((H=j.current)==null?void 0:H.querySelector(us))??null))},[y,x,L]);const ve=y&&L?L:r,Ze=ve.renderMode==="plain"||ve.diffHtml.length>Rp,gt=Ze?"":ve.diffHtml,Vn=a.useMemo(()=>ve.previewSkipped?null:Op(ve.structuredPatch),[ve.previewSkipped,ve.structuredPatch]),We=ve.previewSkipped??Vn,[ze,rt]=a.useState({index:0,count:0}),pe=a.useRef(ze);a.useEffect(()=>{pe.current=ze},[ze]);const ot=a.useCallback(()=>de||We||!j.current?[]:Array.from(j.current.querySelectorAll(".line-hunk")),[We,de]),it=a.useCallback(()=>{const V=j.current,H=ot();if(!V||H.length===0){rt(ge=>ge.count===0?ge:{index:0,count:0});return}const ce=vn(V).getBoundingClientRect().top+52;let xe=0;for(let ge=0;ge<H.length;ge++){const nn=H[ge];if(nn&&nn.getBoundingClientRect().top<=ce)xe=ge;else break}rt(ge=>ge.index===xe&&ge.count===H.length?ge:{index:xe,count:H.length})},[ot]),ct=a.useCallback(V=>{const H=ot();if(H.length===0)return!1;const ce=((pe.current.count===H.length?pe.current.index:0)+V+H.length)%H.length,xe=H[ce];return!xe||typeof xe.scrollIntoView!="function"?!1:(xe.scrollIntoView({block:"start",behavior:"smooth"}),rt({index:ce,count:H.length}),!0)},[ot]),Ke=a.useCallback(()=>ct(1),[ct]),Ne=a.useCallback(()=>ct(-1),[ct]);a.useEffect(()=>{const V=j.current;if(!V)return;const H=vn(V);let ue=requestAnimationFrame(it),ce=!1;const xe=()=>{ce||(ce=!0,ue=requestAnimationFrame(()=>{ce=!1,it()}))};return H.addEventListener("scroll",xe,{passive:!0}),()=>{cancelAnimationFrame(ue),H.removeEventListener("scroll",xe)}},[it]),a.useEffect(()=>(u==null||u({next:Ke,previous:Ne}),()=>u==null?void 0:u(null)),[Ke,Ne,u]),a.useLayoutEffect(()=>{const V=H=>{const ue=H.key.toLowerCase();if(ue!=="n"&&ue!=="p"||H.altKey||H.ctrlKey||H.metaKey||Gi(H.target))return;(ue==="n"?Ke():Ne())&&H.preventDefault()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[Ke,Ne]);const tn=ze.count>0?c.jsxs("span",{className:"diff-hunk-navigation",children:[c.jsx("button",{type:"button",className:"diff-hunk-step",onClick:Ne,title:f("sourcePreviousHunkShortcut"),"aria-label":f("sourcePreviousHunkShortcut"),children:"‹"}),c.jsxs("span",{className:"diff-hunk-indicator",children:[ze.index+1,"/",ze.count]}),c.jsx("button",{type:"button",className:"diff-hunk-step",onClick:Ke,title:f("sourceNextHunkShortcut"),"aria-label":f("sourceNextHunkShortcut"),children:"›"})]}):null,wt=c.jsxs(c.Fragment,{children:[tn,w&&c.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${h?"active":""}`,onClick:w,title:f(h?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-label":f(h?"gitStatusIgnoreWhitespaceActive":"gitStatusIgnoreWhitespace"),"aria-pressed":h,children:c.jsx("span",{className:"diff-whitespace-glyph","aria-hidden":"true",children:"_+"})}),ke&&c.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${de?"active":""}`,onClick:Hn,title:f(de?"gitStatusDiff":"gitStatusPreview"),"aria-label":f(de?"gitStatusDiff":"gitStatusPreview"),"aria-pressed":de,children:c.jsx(Fp,{showDiff:de})}),c.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${y?"active":""}`,onClick:qe,disabled:p,title:f(p?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-label":f(p?"gitStatusLoading":y?"gitStatusDiffOnly":"gitStatusFullContext"),"aria-pressed":y,children:c.jsx(Pp,{expanded:y})}),c.jsx("button",{type:"button",className:`diff-context-toggle diff-toolbar-icon-button ${x?"active":""}`,onClick:Zt,disabled:p,title:f(x?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-label":f(x?"gitStatusShowRemovedLines":"gitStatusHideRemovedLines"),"aria-pressed":x,children:c.jsx($p,{hidden:x})}),c.jsx(kh,{value:en,title:f("fileViewerCopyContent"),className:"diff-context-toggle diff-toolbar-icon-button",disabled:p||!!We||ve.structuredPatch.length===0,icon:"content"}),!de&&!Ze&&!x&&c.jsx("button",{type:"button",className:"diff-context-toggle diff-toolbar-icon-button",onClick:Y,title:`${f("diffViewModeTitle")}: ${f(No(B))}`,"aria-label":`${f("diffViewModeTitle")}: ${f(No(B))}`,children:c.jsx(Bp,{mode:B})})]}),Ie=(V,H)=>ve.structuredPatch.length===0?c.jsx("div",{className:"git-diff-empty-projection",children:f(h?"gitStatusWhitespaceChangesHidden":"gitStatusNoContentChanges")}):gt&&!x&&Vh(B,D)==="side-by-side"?c.jsx(xp,{diffHtml:gt,structuredPatch:ve.structuredPatch,splitAfterLine:V,editor:H}):gt?c.jsx(Ao,{diffHtml:gt,structuredPatch:ve.structuredPatch,hideRemovedLines:x,plain:Ze,splitAfterLine:V,editor:H}):c.jsx(Ao,{diffHtml:"",structuredPatch:ve.structuredPatch,hideRemovedLines:x,plain:Ze,splitAfterLine:V,editor:H});return c.jsxs(c.Fragment,{children:[l?c.jsx(cr,{title:l.title,path:l.path,actions:l.actions,revision:l.revision,children:wt}):c.jsxs("div",{className:"diff-context-controls source-diff-context-controls",children:[c.jsx("span",{className:"diff-context-path",children:e.path}),c.jsx("div",{className:"diff-context-buttons",children:wt})]}),E&&c.jsx("div",{className:"diff-context-error",children:E}),c.jsxs("div",{className:"diff-modal-content source-diff-pane diff-gutter-aligned",ref:P,children:[Ze&&!We&&!de&&c.jsx("div",{className:Mp.plainNotice,children:f("gitStatusDiffPlainMode")}),de&&ee?c.jsx(Gs,{html:ee,sourcePath:e.path}):We?c.jsx(Dp,{file:e,previewSkipped:We,t:f}):A?c.jsx(mp,{projectId:n,filePath:e.path,structuredPatch:ve.structuredPatch,revisions:W,projections:m?ve.reviewProjections:void 0,container:A,onOpenChange:d,renderSource:({openComment:V,editor:H})=>Ie(V==null?void 0:V.flatIndex,H),t:f}):Ie(void 0,null)]})]})}function cr({title:e,path:t,actions:n,revision:s,children:r}){const o=t&&t!==e?t.endsWith(e)?t.slice(0,-e.length).replace(/\/$/,""):t:"";return c.jsxs("div",{className:`git-diff-pane-toolbar ${Rt.header}`,children:[c.jsxs("div",{className:Rt.identity,children:[c.jsxs("span",{className:"git-diff-file-identity",title:t||e,children:[o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"git-diff-toolbar-path",children:o}),c.jsx("span",{className:"git-diff-toolbar-separator","aria-hidden":"true",children:"/"})]}),c.jsx("h3",{className:"git-diff-preview-title",children:e})]}),s]}),c.jsxs("div",{className:Rt.actions,children:[r&&c.jsx("div",{className:"diff-context-buttons",children:r}),n&&c.jsx("div",{className:"git-diff-preview-header-actions",children:n})]})]})}function Pp({expanded:e}){return c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M5 12h14"}),e?c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"m8 7 4-4 4 4"}),c.jsx("path",{d:"m8 17 4 4 4-4"})]}):c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"m8 3 4 4 4-4"}),c.jsx("path",{d:"m8 21 4-4 4 4"})]})]})}function $p({hidden:e}){return c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M5 7h14M5 12h14M5 17h14"}),e&&c.jsx("path",{d:"M4 4l16 16"})]})}function Fp({showDiff:e}){return e?c.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"m8 9-4 3 4 3M16 9l4 3-4 3M14 5l-4 14"})}):c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12Z"}),c.jsx("circle",{cx:"12",cy:"12",r:"2.5"})]})}function Bp({mode:e}){return c.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:e==="side-by-side"?c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 7h7M14 7h7"}),c.jsx("path",{d:"M3 12h7M14 12h7"}),c.jsx("path",{d:"M3 17h7M14 17h7"})]}):c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),e==="auto"&&c.jsx("path",{d:"M5 4h4M5 4v3M19 20h-4M19 20v-3"})]})})}function No(e){switch(e){case"unified":return"diffViewModeUnified";case"side-by-side":return"diffViewModeSideBySide";default:return"diffViewModeAuto"}}function Dp({file:e,previewSkipped:t,t:n}){return c.jsxs("div",{className:"git-diff-preview-skipped",children:[c.jsx("div",{className:"git-diff-preview-skipped-title",children:n("gitStatusDiffPreviewSkipped")}),c.jsx("div",{className:"git-diff-preview-skipped-message",children:Hp(t,n)}),c.jsxs("dl",{className:"git-diff-preview-skipped-details",children:[c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedPath")}),c.jsx("dd",{children:e.path})]}),t.totalBytes!==void 0&&c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedSize")}),c.jsx("dd",{children:Vp(t.totalBytes)})]}),t.totalChars!==void 0&&c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedCharacters")}),c.jsx("dd",{children:t.totalChars.toLocaleString()})]}),t.totalLines!==void 0&&c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLines")}),c.jsx("dd",{children:t.totalLines.toLocaleString()})]}),t.maxLineChars!==void 0&&c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedLineLength")}),c.jsx("dd",{children:t.maxLineChars.toLocaleString()})]}),t.htmlChars!==void 0&&c.jsxs("div",{children:[c.jsx("dt",{children:n("gitStatusDiffPreviewSkippedHtmlSize")}),c.jsx("dd",{children:t.htmlChars.toLocaleString()})]})]})]})}function Op(e){let t=0,n=0;for(const s of e)for(const r of s.lines)for(const o of r){const i=o.codePointAt(0);if(i!==void 0){if(i===0||i===65533)return{reason:"binary"};t+=1,(i<32&&i!==8&&i!==9&&i!==10&&i!==12&&i!==13&&i!==27||i===127)&&(n+=1)}}return n/Math.max(t,1)>.01?{reason:"binary"}:null}function Hp(e,t){switch(e.reason){case"binary":return t("gitStatusDiffPreviewSkippedBinary");case"content-too-large":return t("gitStatusDiffPreviewSkippedContentTooLarge");case"line-too-long":return t("gitStatusDiffPreviewSkippedLineTooLong");case"html-too-large":return t("gitStatusDiffPreviewSkippedHtmlTooLarge")}}function Vp(e){return e<1024?`${e} B`:e<1024*1024?`${Io(e/1024)} KB`:`${Io(e/(1024*1024))} MB`}function Io(e){return e>=10?e.toFixed(0):e.toFixed(1)}const Up="_root_13ii2_1",qp="_link_13ii2_7",Wp="_inline_13ii2_17",zp="_inlineLink_13ii2_21",Kp="_header_13ii2_31",Qp="_headerLink_13ii2_38",Gp="_active_13ii2_45",dt={root:Up,link:qp,inline:Wp,inlineLink:zp,header:Kp,headerLink:Qp,active:Gp};function Nn({basePath:e="",diffMode:t,filePath:n,lineEnd:s,lineNumber:r,projectId:o,viewMode:i}){const l=new URLSearchParams({path:n});return t?l.set("diff",t):(r!==void 0&&l.set("line",String(r)),s!==void 0&&l.set("lineEnd",String(s)),i==="range"&&l.set("view","range")),`${e}/projects/${o}/file?${l.toString()}`}function Xp({className:e,filePath:t,projectId:n}){const s=Bi(n,t);return!s.supported||!s.relativePath||!s.worktreeFile&&!s.cumulativeFile?null:c.jsx(oc,{availability:s,className:e,projectId:n,variant:"inline"})}function oc({activeView:e="source",availability:t,className:n,onSelect:s,projectId:r,sourceHref:o,variant:i}){const{t:l}=je(),u=Nt(),d=t.relativePath;if(!t.supported||!d||!t.worktreeFile&&!t.cumulativeFile)return null;const m=g=>mt(Nn({basePath:u,diffMode:g,filePath:d,projectId:r})),h=g=>f=>{f.stopPropagation(),!(!s||f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey)&&(f.preventDefault(),s(g))},w=g=>[dt.link,i==="header"?dt.headerLink:dt.inlineLink,e===g?dt.active:null].filter(Boolean).join(" ");return c.jsxs("span",{className:[dt.root,i==="header"?dt.header:dt.inline,n].filter(Boolean).join(" "),"data-file-diff-links":i,role:"group","aria-label":l("fileDiffViews"),children:[i==="header"&&o&&c.jsx("a",{className:w("source"),href:o,"aria-current":e==="source"?"page":void 0,onClick:h("source"),children:l("fileViewerSource")}),t.worktreeFile&&c.jsx("a",{className:w("worktree"),href:m("worktree"),"aria-current":e==="worktree"?"page":void 0,"aria-label":l("fileDiffVsHeadTitle",{path:d}),title:l("fileDiffVsHeadTitle",{path:d}),onClick:h("worktree"),children:l("fileDiffVsHead")}),t.cumulativeFile&&c.jsx("a",{className:w("cumulative"),href:m("cumulative"),"aria-current":e==="cumulative"?"page":void 0,"aria-label":l("fileDiffVsParentTitle",{path:d}),title:l("fileDiffVsParentTitle",{path:d}),onClick:h("cumulative"),children:l("fileDiffVsParent")})]})}const Yp="_list_1omn2_1",Jp="_listCompact_1omn2_11",Zp="_row_1omn2_15",eg="_rowHighlighted_1omn2_27",tg="_rowMain_1omn2_32",ng="_rowMeta_1omn2_39",sg="_count_1omn2_46",rg="_warning_1omn2_51",og="_notice_1omn2_56",ig="_rowActions_1omn2_61",cg="_rowTypeIcon_1omn2_68",ag="_rowTypeIconLive_1omn2_85",lg="_iconButton_1omn2_89",ug="_iconButtonDanger_1omn2_107",dg="_iconButtonFreeze_1omn2_114",fg="_error_1omn2_144",hg="_empty_1omn2_148",we={list:Yp,listCompact:Jp,row:Zp,rowHighlighted:eg,rowMain:tg,rowMeta:ng,count:sg,warning:rg,notice:og,rowActions:ig,rowTypeIcon:cg,rowTypeIconLive:ag,iconButton:lg,iconButtonDanger:ug,iconButtonFreeze:dg,error:fg,empty:hg};function mg({children:e,compact:t=!1}){return c.jsx("div",{className:`${we.list} ${t?we.listCompact:""}`,role:"list",children:e})}function pg({children:e,copyAction:t,freezeAction:n,highlighted:s=!1,mode:r,modeLabel:o,revokeAction:i,title:l,warning:u}){return c.jsxs("div",{className:`${we.row} ${s?we.rowHighlighted:""}`,role:"listitem",children:[c.jsxs("div",{className:we.rowMain,children:[c.jsx("strong",{children:l}),e,u&&c.jsx("span",{className:we.warning,children:u})]}),c.jsxs("div",{className:we.rowActions,children:[c.jsx("span",{className:`${we.rowTypeIcon} ${r==="live"?we.rowTypeIconLive:""}`,title:o,"aria-label":o,role:"img",children:c.jsx(xg,{kind:r})}),c.jsx("button",{type:"button",className:we.iconButton,disabled:t.disabled,onClick:t.onClick,title:t.label,"aria-label":t.label,children:t.working?"…":c.jsx(bg,{})}),n&&c.jsx("button",{type:"button",className:`${we.iconButton} ${we.iconButtonFreeze}`,disabled:n.disabled,onClick:n.onClick,title:n.label,"aria-label":n.label,children:n.working?"…":c.jsx(vg,{})}),c.jsx("button",{type:"button",className:`${we.iconButton} ${we.iconButtonDanger}`,disabled:i.disabled,onClick:i.onClick,title:i.label,"aria-label":i.label,children:i.working?"…":c.jsx(yg,{})})]})]})}function gg({children:e}){return c.jsx("span",{className:we.rowMeta,children:e})}function Po({children:e,loading:t=!1}){return c.jsx("div",{className:we.empty,role:t?"status":void 0,children:e})}function wg({children:e}){return c.jsx("div",{className:we.count,children:e})}function $o({children:e,tone:t}){return c.jsx("div",{className:t==="error"?we.error:we.notice,role:t==="error"?"alert":"status",children:e})}function Lv(){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:c.jsx("path",{d:"M8 3v10M3 8h10"})})}function yg(){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round","aria-hidden":"true",children:c.jsx("path",{d:"m4 4 8 8M12 4l-8 8"})})}function vg(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1.5"}),c.jsx("path",{d:"M5.5 7V4.75a2.5 2.5 0 0 1 5 0V7M8 10v1.5"})]})}function Mv(){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"m3 8.5 3.2 3.2L13 4.8"})})}function xg({kind:e}){const t={all:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("path",{d:"M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"})]}),project:c.jsx("path",{d:"M3 6.5h7l2 2h9v10.5H3zM3 6.5V5h7l2 2"}),session:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"14",rx:"3"}),c.jsx("path",{d:"m8 21 4-3h5M7 9h10M7 13h7"})]}),frozen:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"5",y:"10",width:"14",height:"11",rx:"2"}),c.jsx("path",{d:"M8 10V7a4 4 0 0 1 8 0v3M12 14v3"})]}),live:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),c.jsx("path",{d:"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7M5.5 5.5a9 9 0 0 0 0 13M18.5 5.5a9 9 0 0 1 0 13"})]})};return c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[e]})}function bg(){return c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),c.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}const Sg="_modal_1132s_1",Cg="_fileIdentity_1132s_10",Eg="_liveBadge_1132s_39",_g="_description_1132s_52",kg="_warning_1132s_59",Lg="_createButton_1132s_82",Mg="_manualCopy_1132s_97",Rg="_inventory_1132s_118",jg="_inventoryHeading_1132s_123",Ve={modal:Sg,fileIdentity:Cg,liveBadge:Eg,description:_g,warning:kg,createButton:Lg,manualCopy:Mg,inventory:Rg,inventoryHeading:jg};function Ag({anchorRect:e,filePath:t,projectId:n,title:s,transformUrl:r=i=>i,onClose:o}){const{t:i}=je(),[l,u]=a.useState([]),[d,m]=a.useState(!0),[h,w]=a.useState(null),[g,f]=a.useState(null),[y,b]=a.useState(null),[x,_]=a.useState(null),M=a.useRef(null),C=a.useCallback(async()=>{m(!0),f(null);try{const p=await oe.getPublicFileShares(n,t);u(p.items)}catch(p){f(p instanceof Error?p.message:i("publicFileShareLoadFailed"))}finally{m(!1)}},[t,n,i]);a.useEffect(()=>{C()},[C]),a.useEffect(()=>{var p,E;x&&((p=M.current)==null||p.focus(),(E=M.current)==null||E.select())},[x]);const S=async()=>{w("create"),f(null),b(null),_(null);const p=oe.createPublicFileShare({projectId:n,path:t,...s?{title:s}:{}}),E=zt(p.then(T=>r(T.url)));try{const T=await p;await E?b(i("publicFileShareCopied")):(_(r(T.url)),b(i("publicFileShareManualCopy"))),await C()}catch(T){f(T instanceof Error?T.message:i("publicFileShareCreateFailed"))}finally{w(null)}},v=async p=>{f(null),b(null),_(null);const E=r(p.url);if(await zt(Promise.resolve(E))){b(i("publicFileShareCopied"));return}_(E),b(i("publicFileShareManualCopy"))},L=async p=>{if(window.confirm(i("publicShareManagementRevokeOneConfirm"))){w(`revoke:${p.shareId}`),f(null),b(null);try{await oe.revokePublicFileShare(p.shareId),u(E=>E.filter(T=>T.shareId!==p.shareId)),b(i("publicFileShareRevoked"))}catch(E){f(E instanceof Error?E.message:i("publicFileShareRevokeFailed"))}finally{w(null)}}};return c.jsx(ri,{anchorRect:e,title:i("publicFileShareTitle"),onClose:o,children:c.jsxs("div",{className:Ve.modal,children:[c.jsxs("div",{className:Ve.fileIdentity,title:t,children:[c.jsx(Tg,{}),c.jsx("span",{children:t}),c.jsx("span",{className:Ve.liveBadge,children:i("publicShareLiveBadge")})]}),c.jsx("p",{className:Ve.description,children:i("publicFileShareDescription")}),r("x")!=="x"&&c.jsx("p",{className:Ve.description,children:i("publicFileSharePlayLinks")}),c.jsxs("div",{className:Ve.warning,role:"note",children:[c.jsx(Ng,{}),c.jsx("span",{children:i("publicFileShareWarning")})]}),c.jsxs("button",{type:"button",className:`settings-button settings-button-primary ${Ve.createButton}`,disabled:h!==null,onClick:()=>void S(),children:[c.jsx(Ig,{}),i(h==="create"?"publicFileShareCreating":"publicFileShareCreate")]}),x&&c.jsxs("label",{className:Ve.manualCopy,children:[c.jsx("span",{children:i("publicFileShareUrlLabel")}),c.jsx("input",{ref:M,readOnly:!0,value:x})]}),g&&c.jsx($o,{tone:"error",children:g}),y&&c.jsx($o,{tone:"notice",children:y}),c.jsxs("div",{className:Ve.inventory,children:[c.jsx("div",{className:Ve.inventoryHeading,children:c.jsx("strong",{children:i("publicFileShareExisting")})}),d?c.jsx(Po,{loading:!0,children:i("publicFileShareLoading")}):l.length===0?c.jsx(Po,{children:i("publicFileShareEmpty")}):c.jsx(mg,{compact:!0,children:l.map(p=>{const E=h===`revoke:${p.shareId}`;return c.jsx(pg,{title:p.title||t.split("/").at(-1)||t,mode:"live",modeLabel:i("publicShareLiveBadge"),copyAction:{label:i("publicFileShareCopy"),disabled:h!==null,onClick:()=>void v(p)},revokeAction:{label:i("publicFileShareRevoke"),disabled:h!==null,working:E,onClick:()=>void L(p)},children:c.jsx(gg,{children:new Date(p.createdAt).toLocaleString()})},p.shareId)})}),!d&&c.jsx(wg,{children:i("publicFileShareCount",{count:l.length})})]})]})})}function Tg(){return c.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M5 2.5h6l4 4v11H5zM11 2.5v4h4"})})}function Ng(){return c.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M10 2.5 18 17H2zM10 7v4.5M10 14.5v.1"})})}function Ig(){return c.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}const Pg="_viewer_1m0zr_1",$g="_context_1m0zr_6",Fg="_body_1m0zr_10",Bg="_backButton_1m0zr_14",Dg="_htmlPreviewFrame_1m0zr_19",Og="_diffBody_1m0zr_27",Hg="_reloadStale_1m0zr_32",Vg="_rawToggle_1m0zr_36",Ug="_commentToggle_1m0zr_46",qg="_commentSend_1m0zr_56",Wg="_provenanceRow_1m0zr_69",zg="_quoteReplySurface_1m0zr_81",Kg="_header_1m0zr_88",Qg="_info_1m0zr_105",Gg="_actions_1m0zr_129",Xg="_windowActions_1m0zr_146",Yg="_fullscreenButton_1m0zr_147",Se={viewer:Pg,context:$g,body:Fg,backButton:Bg,htmlPreviewFrame:Dg,diffBody:Og,reloadStale:Hg,rawToggle:Vg,commentToggle:Ug,commentSend:qg,provenanceRow:Wg,quoteReplySurface:zg,header:Kg,info:Qg,actions:Gg,windowActions:Xg,fullscreenButton:Yg};function Jg(e){return e instanceof Element&&e.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])")!==null}function Zg(e){if(!e.isConnected||e.closest('[aria-hidden="true"]'))return!1;const t=e.closest('[role="dialog"]')??e.closest(".file-viewer")??e,n=e.ownerDocument.activeElement;return!n||n===e.ownerDocument.body||t.contains(n)}function ew(e){var u,d,m;const t=e==null?void 0:e.ownerDocument.getSelection();if(!e||!t)return!1;const n=e.ownerDocument.createRange(),s=((u=e.ownerDocument.defaultView)==null?void 0:u.NodeFilter)??NodeFilter,r=e.ownerDocument.createTreeWalker(e,s.SHOW_TEXT),o=r.nextNode();if(o){let h=o;for(let w=r.nextNode();w;w=r.nextNode())h=w;n.setStart(o,0),n.setEnd(h,((d=h.textContent)==null?void 0:d.length)??0)}else n.selectNodeContents(e);t.removeAllRanges(),t.addRange(n);const i=((m=e.ownerDocument.defaultView)==null?void 0:m.Event)??Event;return e.ownerDocument.dispatchEvent(new i("selectionchange")),!0}function tw({className:e,contentRef:t}){const{t:n}=je(),s=a.useCallback(()=>ew(t.current),[t]);a.useEffect(()=>{var u;const i=((u=t.current)==null?void 0:u.ownerDocument)??document,l=d=>{const m=t.current;!m||d.defaultPrevented||d.isComposing||d.altKey||d.shiftKey||!(d.ctrlKey||d.metaKey)||d.key.toLowerCase()!=="a"||Jg(d.target)||!Zg(m)||(d.preventDefault(),d.stopPropagation(),s())};return i.addEventListener("keydown",l,!0),()=>i.removeEventListener("keydown",l,!0)},[t,s]);const r=n("viewerSelectAll"),o=n("viewerSelectAllTitle");return c.jsx("button",{type:"button",className:e,onMouseDown:i=>i.preventDefault(),onPointerDown:i=>i.preventDefault(),onClick:s,title:o,"aria-label":r,children:c.jsx(nw,{})})}function nw(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M6 2H2v4M10 2h4v4M14 10v4h-4M6 14H2v-4"}),c.jsx("rect",{x:"5",y:"5",width:"6",height:"6",rx:"1"})]})}const Fo="p, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, table",sw=200,rw=120;function ow(e){return Array.from(e.querySelectorAll(Fo)).filter(n=>{var r;const s=(r=n.parentElement)==null?void 0:r.closest(Fo);return!s||!e.contains(s)})}function iw(e,t){return e.length===t.length&&e.every((n,s)=>{var r,o,i;return n.blockIndex===((r=t[s])==null?void 0:r.blockIndex)&&n.top===((o=t[s])==null?void 0:o.top)&&n.height===((i=t[s])==null?void 0:i.height)})}function ic(e,t){const n=e[t];if(!n)throw new Error(`Missing paragraph block ${t}`);return n}function cw(e,t,n){const s=n.getBoundingClientRect();return Array.from(t).sort((r,o)=>r-o).map(r=>{const o=ic(e,r).getBoundingClientRect();return{blockIndex:r,top:o.top-s.top+n.scrollTop,height:o.height}})}function aw({alwaysShowQuoteCircle:e,contentRef:t,layoutKey:n,onQuoteBlock:s,paragraphQuoteCirclesEnabled:r,sourceRef:o,surfaceRef:i}){const{t:l}=je(),u=a.useRef([]),[d,m]=a.useState([]);a.useEffect(()=>{const g=t.current,f=i.current;if(!r||!g||!f){u.current.length>0&&(u.current=[],m([]));return}let y=[],b=new WeakMap;const x=new Set;let _=0,M=0,C=!1;const S=()=>{_=0;const j=cw(y,x,f);u.current=j.map(k=>ic(y,k.blockIndex)),m(k=>iw(k,j)?k:j)},v=()=>{_===0&&(_=requestAnimationFrame(S))},L=()=>{window.clearTimeout(M),M=window.setTimeout(v,rw)},p=typeof IntersectionObserver>"u"?null:new IntersectionObserver(j=>{const k=j.find(A=>A.target===f);if(k&&!k.isIntersecting){if(!C)return;C=!1,x.clear(),p==null||p.disconnect(),p==null||p.observe(f),v();return}if(k!=null&&k.isIntersecting&&!C){C=!0;for(const A of y)p==null||p.observe(A)}for(const A of j){if(!(A.target instanceof HTMLElement))continue;const $=b.get(A.target);$!==void 0&&(A.isIntersecting?x.add($):x.delete($))}v()},{rootMargin:`${sw}px 0px`}),E=()=>{if(p)for(const j of y)p.unobserve(j);if(y=ow(g),b=new WeakMap,y.forEach((j,k)=>{b.set(j,k)}),x.clear(),p&&C)for(const j of y)p.observe(j);else if(!p)for(let j=0;j<y.length;j+=1)x.add(j);v()};E(),p&&p.observe(f);const T=typeof ResizeObserver>"u"?null:new ResizeObserver(L);T==null||T.observe(g);const I=new MutationObserver(E);return I.observe(g,{childList:!0,subtree:!0}),()=>{T==null||T.disconnect(),I.disconnect(),p==null||p.disconnect(),_!==0&&cancelAnimationFrame(_),window.clearTimeout(M)}},[t,n,r,i]);const h=a.useCallback(()=>{const g=o.current,f=t.current;if(!g)return;const y=Ha(g);if(!y)return;const b=f&&f!==g?Wr(g,f):null;s(Rn(b?{...y,range:b.range,selectedText:b.selectedText}:y))},[t,s,o]),w=a.useCallback(g=>{const f=o.current,y=u.current[g];if(!f||!y)return;const b=Wr(f,y);b&&s(Rn(b))},[s,o]);return c.jsx("div",{className:"text-block-quote-rail",children:r&&d.length>0?d.map((g,f)=>c.jsx("button",{type:"button",className:`text-block-quote text-block-quote-paragraph ${e?"always-visible":""}`,style:{top:`${g.top+g.height}px`},onClick:()=>w(f),title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"},g.blockIndex)):c.jsx("button",{type:"button",className:`text-block-quote text-block-quote-fallback ${e?"always-visible":""}`,onClick:h,title:l("sessionQuoteBlock"),"aria-label":l("sessionQuoteBlock"),children:">"})})}function Bo(e,t,n){if(e.length===0)return 0;if(t<=0)return Number.POSITIVE_INFINITY;let s=1,r=0;for(const o of e){const i=r===0?o:r+n+o;r>0&&i>t?(s+=1,r=o):r=i}return s}function lw({actionGap:e,actionWidths:t,availableWidth:n,contextWidth:s,headerGap:r,provenanceWidth:o}){if(t.length===0)return!1;const i=[s,o].filter(h=>h>0),l=i.reduce((h,w)=>h+w,0),u=n-l-r*Math.max(0,i.length),d=Bo(t,u,e),m=1+Bo(t,n,e);return d>=m}const kt=`/api/pdfjs/${Wl}`,xn=pt(Ee.pdfjsRenderer,!1);let hs=null;function uw(){return hs??(hs=Yo(()=>import(`${kt}/build/pdf.min.mjs`),[]).then(e=>(e.GlobalWorkerOptions.workerSrc=`${kt}/build/pdf.worker.min.mjs`,e),e=>{throw hs=null,e})),hs}function dw(e){let t=null,n=!1;return{promise:uw().then(r=>{if(n)throw new Error("PDF closed");return t=r.getDocument({url:e,withCredentials:!0,isEvalSupported:!1,verbosity:0,cMapUrl:`${kt}/cmaps/`,cMapPacked:!0,standardFontDataUrl:`${kt}/standard_fonts/`,wasmUrl:`${kt}/wasm/`,iccUrl:`${kt}/iccs/`}),t.promise}),destroy:()=>{n=!0,t==null||t.destroy()}}}function fw(){return{pdfjsRendererEnabled:a.useSyncExternalStore(xn.subscribe,xn.read,xn.read),setPdfjsRendererEnabled:xn.set}}const hw="_pdf_o9njr_1",mw="_openPdf_o9njr_13",pw="_media_o9njr_19",gw="_font_o9njr_36",ww="_glyphs_o9njr_47",Lt={pdf:hw,openPdf:mw,media:pw,font:gw,glyphs:ww},yw="_view_o4qm0_2",vw="_scroller_o4qm0_12",xw="_document_o4qm0_22",bw="_page_o4qm0_33",Sw="_zoomControls_o4qm0_40",Cw="_zoomLevel_o4qm0_73",Et={view:yw,scroller:vw,document:xw,page:bw,zoomControls:Sw,zoomLevel:Cw},cc=.5,ac=5,In=1.25,Ew=960,_w=12,kw=16777216,lc=e=>Math.min(ac,Math.max(cc,e));function Lw({url:e,fileName:t,loading:n,onError:s}){const{t:r}=je(),[o,i]=a.useState(null),l=a.useRef(null),u=a.useRef(null),[d,m]=a.useState(null),[h,w]=a.useState(1),g=a.useRef(h);g.current=h;const f=a.useRef(null);a.useEffect(()=>{let _=!1;i(null),w(1);const M=dw(e);return M.promise.then(async C=>{const S=[];for(let v=1;v<=C.numPages;v+=1)S.push((await C.getPage(v)).getViewport({scale:1}));_||i({document:C,sizes:S})}).catch(()=>{_||s()}),()=>{_=!0,M.destroy()}},[e,s]),a.useLayoutEffect(()=>{const _=l.current;if(!_)return;const M=()=>m(Math.max(1,Math.min(Ew,_.clientWidth-2*_w)));M();const C=new ResizeObserver(M);return C.observe(_),()=>C.disconnect()},[o]);const y=a.useCallback((_,M,C)=>{const S=l.current,v=g.current,L=lc(v*_);if(!S||L===v){Do(u.current);return}const p=S.getBoundingClientRect(),E=M-p.left,T=C-p.top,I=L/v;f.current={left:(S.scrollLeft+E)*I-E,top:(S.scrollTop+T)*I-T},w(L)},[]);a.useLayoutEffect(()=>{Do(u.current);const _=l.current,M=f.current;f.current=null,_&&M&&(_.scrollLeft=M.left,_.scrollTop=M.top)},[h]),Mw(l,u,g,y,o!==null);const b=_=>{var C;const M=(C=l.current)==null?void 0:C.getBoundingClientRect();M&&y(_,M.left+M.width/2,M.top+M.height/2)};if(!o)return c.jsx("div",{className:"file-viewer-loading",children:n});const x=d===null?null:d*h;return c.jsxs("div",{className:Et.view,children:[c.jsx("div",{ref:l,className:Et.scroller,children:c.jsx("div",{ref:u,className:Et.document,role:"document","aria-label":t,children:x!==null&&o.sizes.map((_,M)=>c.jsx(Rw,{document:o.document,pageNumber:M+1,size:_,width:x,root:l,onError:s},M))})}),c.jsxs("div",{className:Et.zoomControls,children:[c.jsx("button",{type:"button",onClick:()=>b(1/In),disabled:h<=cc,"aria-label":r("pdfjsZoomOut"),children:"−"}),c.jsxs("button",{type:"button",className:Et.zoomLevel,onClick:()=>b(1/h),"aria-label":r("pdfjsZoomFit"),children:[Math.round(h*100),"%"]}),c.jsx("button",{type:"button",onClick:()=>b(In),disabled:h>=ac,"aria-label":r("pdfjsZoomIn"),children:"+"})]})]})}function Do(e){e&&(e.style.transform="",e.style.transformOrigin="")}function Mw(e,t,n,s,r){a.useEffect(()=>{const o=e.current;if(!r||!o)return;let i=null,l;const u=(f,y,b)=>{const x=t.current;if(!x)return f;const _=lc(n.current*f)/n.current,M=x.getBoundingClientRect();return x.style.transformOrigin=`${y-M.left}px ${b-M.top}px`,x.style.transform=`scale(${_})`,_},d=f=>Math.hypot(f[0].clientX-f[1].clientX,f[0].clientY-f[1].clientY),m=f=>{if(f.touches.length!==2)return;const[y,b]=[f.touches[0],f.touches[1]];i={scale:1,clientX:(y.clientX+b.clientX)/2,clientY:(y.clientY+b.clientY)/2,startDistance:d(f.touches)}},h=f=>{!i||f.touches.length!==2||(f.preventDefault(),i.scale=u(d(f.touches)/i.startDistance,i.clientX,i.clientY))},w=f=>{if(!i||f.touches.length>=2)return;const y=i;i=null,s(y.scale,y.clientX,y.clientY)},g=f=>{if(!f.ctrlKey)return;f.preventDefault(),i??(i={scale:1,clientX:f.clientX,clientY:f.clientY,startDistance:0});const b=f.deltaMode!==WheelEvent.DOM_DELTA_PIXEL||Math.abs(f.deltaY)>=50?f.deltaY<0?In:1/In:Math.exp(-f.deltaY/100);i.scale=u(i.scale*b,i.clientX,i.clientY),clearTimeout(l),l=setTimeout(()=>{const x=i;i=null,x&&s(x.scale,x.clientX,x.clientY)},150)};return o.addEventListener("touchstart",m,{passive:!0}),o.addEventListener("touchmove",h,{passive:!1}),o.addEventListener("touchend",w),o.addEventListener("touchcancel",w),o.addEventListener("wheel",g,{passive:!1}),()=>{clearTimeout(l),o.removeEventListener("touchstart",m),o.removeEventListener("touchmove",h),o.removeEventListener("touchend",w),o.removeEventListener("touchcancel",w),o.removeEventListener("wheel",g)}},[e,t,n,s,r])}function Rw({document:e,pageNumber:t,size:n,width:s,root:r,onError:o}){const i=a.useRef(null);return a.useEffect(()=>{const l=i.current;if(!l)return;let u=null,d=!1,m=!1;const h=async()=>{d=!0;const f=await e.getPage(t),y=s*window.devicePixelRatio,b=y*n.height/n.width,x=Math.min(1,Math.sqrt(kw/(y*b))),_=f.getViewport({scale:y*x/n.width});if(m||!d)return;l.width=Math.round(_.width),l.height=Math.round(_.height);const M=f.render({canvas:l,viewport:_});u=M,await M.promise},w=()=>{d=!1,u==null||u.cancel(),u=null,l.width=0,l.height=0},g=new IntersectionObserver(f=>{const y=f.some(b=>b.isIntersecting);y&&!d?h().catch(b=>{!m&&d&&!jw(b)&&o()}):!y&&(d||l.width>0)&&w()},{root:r.current,rootMargin:"100% 50%"});return g.observe(l),()=>{m=!0,g.disconnect(),u==null||u.cancel()}},[e,t,n,s,r,o]),c.jsx("canvas",{ref:i,className:Et.page,style:{width:s,aspectRatio:`${n.width} / ${n.height}`}})}function jw(e){return e instanceof Error&&e.name==="RenderingCancelledException"}function ms(e){return e==="application/pdf"?"pdf":e.startsWith("audio/")?"audio":e.startsWith("video/")?"video":e.startsWith("font/")?"font":null}function Aw(e){var t;try{return((t=e.contentDocument)==null?void 0:t.contentType)==="application/pdf"}catch{return!1}}const Tw=["ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz","0123456789 !?&@#$%*()[]{}"],Nw=[14,20,32,48];function Iw({kind:e,url:t,fileName:n,sampleText:s,unsupported:r,pdfjsAvailable:o=!1}){const{t:i}=je(),{pdfjsRendererEnabled:l}=fw(),[u,d]=a.useState(null),[m,h]=a.useState(null),w=a.useCallback(()=>d(t),[t]),g=a.useCallback(()=>h(t),[t]);if(e==="pdf"&&o&&l&&m!==t)return c.jsx(Lw,{url:t,fileName:n,loading:i("fileViewerLoading",{name:n}),onError:g});if(u===t)return e!=="pdf"?c.jsx(c.Fragment,{children:r}):c.jsxs(c.Fragment,{children:[r,c.jsx("p",{className:Lt.openPdf,children:c.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:i("fileViewerOpenNewTab")})})]});switch(e){case"pdf":return c.jsx("iframe",{className:Lt.pdf,src:t,title:n,onLoad:f=>{Aw(f.currentTarget)||w()}});case"audio":return c.jsx("div",{className:Lt.media,children:c.jsx("audio",{controls:!0,preload:"metadata",src:t,onError:w})});case"video":return c.jsx("div",{className:Lt.media,children:c.jsx("video",{controls:!0,preload:"metadata",src:t,onError:w})});case"font":return c.jsx(Pw,{url:t,sampleText:s,onError:w,unsupported:r})}}let Oo=0;function Pw({url:e,sampleText:t,onError:n,unsupported:s}){const[r,o]=a.useState(null);return a.useEffect(()=>{if(typeof FontFace>"u")return;Oo+=1;const i=new FontFace(`ya-file-viewer-font-${Oo}`,`url("${e}")`);let l=!1;return o(null),i.load().then(u=>{l||(document.fonts.add(u),o(u.family))},()=>{l||n()}),()=>{l=!0,document.fonts.delete(i)}},[e,n]),typeof FontFace>"u"?c.jsx(c.Fragment,{children:s}):r?c.jsxs("div",{className:Lt.font,"data-font-specimen":!0,style:{fontFamily:`"${r}"`},children:[Nw.map(i=>c.jsx("p",{style:{fontSize:`${i}px`},children:t},i)),Tw.map(i=>c.jsx("p",{className:Lt.glyphs,children:i},i))]}):null}function Ho(e){return e<1024?`${e} b`:e<1024*1024?`${Math.round(e/1024)} kb`:`${Math.round(e/(1024*1024)*10)/10} mb`}function $w(e){var s;const t=((s=e.split(".").pop())==null?void 0:s.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",swift:"swift",php:"php",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",markdown:"markdown"}[t]||"plaintext"}function Vo(e){return e.startsWith("image/")}const Uo=1e4;function bn(e,t){return/\.(?:html?|xhtml)$/i.test(e)||t==="text/html"||t==="application/xhtml+xml"}function Fw(e){if(!Kt(e))return null;try{return li(Hs(e))}catch{return null}}function Bw(e,t){return e===void 0?null:{end:Math.max(e,t??e),start:e}}function ft(e){return(e==null?void 0:e.contentStartLine)??1}function uc(e){if(e.contentEndLine!==void 0)return e.contentEndLine;if(e.content!==void 0)return ft(e)+e.content.split(`
54
+ `).length-1}function qo(e){if(!e.contentTruncated)return null;const t=uc(e),n=e.contentTotalLines?` of ${e.contentTotalLines}`:"";return`Showing lines ${ft(e)}-${t}${n}`}function dc(e,t,n){return t===void 0?e:`${e}:${t}${n&&n>t?`-${n}`:""}`}function Dw(e,t,n,s){const r=e.split(`
55
+ `),o=s-t;if(o<0||o>=r.length)return null;const i=Math.max(0,o-3),l=Math.min(r.length,o+4);return{location:dc(n,s),quote:r.slice(i,l).join(`
56
+ `),afterLine:s}}function Ow(e,t){const n=Array.from(e.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])"));let s;for(let r=0;r<n.length;r+=1)try{t.intersectsNode(n[r])&&(s=r)}catch{}return s}function Hw({afterBlock:e,children:t,editor:n,previewRef:s}){const[r,o]=a.useState(null);return a.useLayoutEffect(()=>{if(e===void 0){o(null);return}const i=s.current;if(!i){o(null);return}const l=i.ownerDocument.createElement("div");l.dataset.reviewCommentInlineHost="";const u=()=>{const h=i.querySelectorAll(".markdown-rendered > :not([data-review-comment-inline-host])").item(e);h&&h.nextElementSibling!==l&&h.after(l)};if(u(),!l.isConnected){o(null);return}const d=new MutationObserver(u);return d.observe(i,{childList:!0,subtree:!0}),o(l),()=>{d.disconnect(),l.remove()}},[e,s]),c.jsxs("div",{ref:s,children:[t,r?st.createPortal(c.jsx(vp,{editor:n}),r,"session-file-comment-editor"):null]})}function Vw({busy:e,cancelLabel:t,draft:n,error:s,onCancel:r,onChange:o,onPersist:i,onSend:l,placeholder:u,sendLabel:d}){const[m,h]=a.useState(n.text);return c.jsx(tc,{anchorLabel:n.location,snippet:n.quote,text:m,placeholder:u,autoFocus:!n.preserveSelection,error:s,onBlur:i,onChange:w=>{h(w),o(n.id,w)},onKeyDown:w=>{w.key!=="Enter"||w.shiftKey||w.nativeEvent.isComposing||(w.preventDefault(),w.stopPropagation(),l(n.id))},actions:c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",onClick:()=>r(n.id),disabled:e,children:t}),c.jsx("button",{type:"button",className:Se.commentSend,onClick:()=>l(n.id),disabled:!m.trim()||e,children:d})]})})}function Uw(e,t,n,s){if(!e)return e;const r=Bw(n,s),o=(r==null?void 0:r.start)===(r==null?void 0:r.end);let i=0;return e.replace(/<span class="([^"]*)">/g,(l,u)=>{if(!u.split(/\s+/).includes("line"))return l;i+=1;const d=t+i-1,m=r!==null&&d>=r.start&&d<=r.end;return`<span class="${[u,o&&m?"highlighted-line":"",d===(r==null?void 0:r.start)?"highlighted-line-start":"",d===(r==null?void 0:r.end)?"highlighted-line-end":""].filter(Boolean).join(" ")}" data-line="${d}">`})}const ps={loadFile:(e,t,n,s,r,o)=>oe.getFile(e,t,n,s,r,o),getRawFileUrl:(e,t,n)=>oe.getFileRawUrl(e,t,n),statFile:(e,t)=>oe.getFileMetadata(e,t),fetchRawFileBlob:(e,t,n)=>{const{rawUrl:s}=e;if(!s)throw new Error("Raw file URL unavailable");const r=n?`${s}${s.includes("?")?"&":"?"}download=true`:s;return zr(r)},createMediaSource:e=>e?{fetchBlob:async(t,n)=>js(e,t)??zr(n)}:void 0};function qw(e,t){const n=e.getBoundingClientRect();return t.getBoundingClientRect().top-n.top+e.scrollTop}function Ww(e,t){if(e.scrollHeight<=e.clientHeight)return 0;const n=qw(e,t),s=e.clientHeight*.1,r=Math.max(0,e.scrollHeight-e.clientHeight);return Math.max(0,Math.min(r,n-s))}const zw=a.memo(function({projectId:t,filePath:n,source:s=ps,openInNewTabUrl:r,onClose:o,onMinimize:i,parentViewerId:l,standalone:u=!1,lineNumber:d,lineEnd:m,viewMode:h="full",initialPresentation:w,diffMode:g,headerLeading:f}){var Dr,Or;const{t:y}=je(),b=Xs(),x=Wa(),_=Vs(),{quoteReplyButtonMode:M}=Oi(),C=Os(),S=C.transport,v=Bn(),L=`${t}\0${n}\0${g??"source"}`,[p,E]=a.useState(!1),[T,I]=a.useState(null),[j,k]=a.useState(null),A=a.useRef(null),[$,P]=a.useState(()=>({identity:L,view:g??"source"})),B=$.identity===L?$.view:g??"source",q=a.useCallback(N=>{N==="source"&&(A.current=L,E(!1),k(null)),P({identity:L,view:N})},[L]),D=B!=="source",U=D?void 0:d,Q=D?void 0:m,Z=D?"full":h,K=Bi(v===null?t:void 0,n),O=B==="worktree"?K.worktreeFile:B==="cumulative"?K.cumulativeFile:null,W=S.capabilities.sameOriginUrls,Y=Nt(),G=v&&v.projectId!==null?za(Y,{relayUsername:v.relayUsername,relayUrl:v.relayUrl,secret:v.secret,projectId:v.projectId,path:n}):null,[R,he]=a.useState(null),[re,ae]=a.useState(!0),[ke,de]=a.useState(null),[ee,ye]=a.useState(!1),[ie,qe]=a.useState(!1),[Zt,Hn]=a.useState(null),en=a.useRef(null),ve=a.useRef(null),Ze=a.useRef(null),[gt,Vn]=a.useState(!1),[We,ze]=a.useState(null),rt=a.useRef(null),[pe,ot]=a.useState(!1),[it,ct]=a.useState(null),[Ke,Ne]=a.useState(null),[tn,wt]=a.useState(null),Ie=Fd(),V=co(Td,Ie.density),H=co(Ad,Ie.density),ue=$d(V),ce=a.useMemo(()=>Fw(t),[t]),xe=a.useMemo(()=>vs(n)?Us(n,ce):Qt(n).replace(/^\.\/+/,""),[n,ce]),ge=xe??n,nn=a.useMemo(()=>({projectId:t,filePath:ge,contentStartLine:R?ft(R):1}),[R,t,ge]),Ec=a.useMemo(()=>_&&x?nh({sourceKey:C.sourceKey,sessionId:_.sessionId,projectId:t,filePath:n}):null,[n,t,x,_,C.sourceKey]),le=bh({active:pe,storageKey:Ec,sendComment:x}),Pe=a.useRef(null);a.useLayoutEffect(()=>{const N=Zt,F=en.current,z=ve.current,X=Ze.current;if(!N||!F||!z||!X)return;const fe=()=>{const be=getComputedStyle(N),et=getComputedStyle(X),lt=Number.parseFloat(be.paddingLeft)+Number.parseFloat(be.paddingRight),Xe=Array.from(X.children,De=>De.getBoundingClientRect().width).filter(De=>De>0),ut=lw({actionGap:Number.parseFloat(et.columnGap)||0,actionWidths:Xe,availableWidth:N.clientWidth-lt,contextWidth:F.getBoundingClientRect().width,headerGap:Number.parseFloat(be.columnGap)||0,provenanceWidth:z.getBoundingClientRect().width});Vn(De=>De===ut?De:ut)},ne=typeof ResizeObserver>"u"?null:new ResizeObserver(fe),se=()=>{ne==null||ne.disconnect(),ne==null||ne.observe(N),ne==null||ne.observe(F),ne==null||ne.observe(z),ne==null||ne.observe(X);for(const be of X.children)ne==null||ne.observe(be)},Ge=new MutationObserver(()=>{se(),fe()});return Ge.observe(X,{childList:!0,subtree:!0}),se(),fe(),()=>{Ge.disconnect(),ne==null||ne.disconnect()}},[Zt]),zi(Pe,D||R==null?void 0:R.content,nn);const fr=Ka(),_c=a.useCallback(N=>{fr(t,N)},[t,fr]),sn=a.useRef(null),{modal:rn,localFileModal:Un,projectFileModal:yt,handleClick:qn,handleContextMenu:Wn,closeModal:kc,closeLocalFileModal:Lc,closeProjectFileModal:Mc,contextMenuElement:Rc}=Qa({projectContext:{projectId:t,projectPath:ce}}),hr=a.useRef(qn),mr=a.useRef(Wn);hr.current=qn,mr.current=Wn;const pr=a.useCallback(N=>hr.current(N),[]),gr=a.useCallback(N=>mr.current(N),[]),zn=a.useCallback(N=>{var z,X;if(N.key!==" ")return;const F=(X=(z=N.target).closest)==null?void 0:X.call(z,"a[href]");F&&(N.preventDefault(),F.click())},[]),jc=a.useCallback(N=>{N.button>0||N.target instanceof Element&&N.target.closest("button, input, textarea, select, a[href], [contenteditable='true']")||N.currentTarget.focus({preventScroll:!0})},[]),Ac=a.useCallback(N=>{if(N.button!==0||N.target instanceof Element&&N.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const F=N.currentTarget.ownerDocument.getSelection();if(!F||F.isCollapsed||F.rangeCount===0)return;(F.anchorNode!==null&&N.currentTarget.contains(F.anchorNode)||F.focusNode!==null&&N.currentTarget.contains(F.focusNode))&&F.removeAllRanges()},[]),Qe=!!(x&&_&&o&&!u&&v===null&&!D&&(R!=null&&R.metadata.isText)&&R.content!==void 0&&!(p&&bn(n,R.metadata.mimeType)));a.useEffect(()=>{!pe||Qe||(le.flush(),ot(!1))},[pe,Qe,le.flush]);const wr=a.useCallback(()=>{const N=Pe.current;if(!pe||!Qe||!N)return;const F=Fn(N);if(F.length===0)return;const z=F.map(se=>se.sourceLocation).filter(se=>(se==null?void 0:se.filePath)===ge),X=z.length===F.length?Math.min(...z.map(se=>(se==null?void 0:se.lineStart)??1)):void 0,fe=z.length===F.length?Math.max(...z.map(se=>(se==null?void 0:se.lineEnd)??1)):void 0,ne=p?Ow(sn.current??N,F.at(-1).range):void 0;le.open({location:dc(ge,X,fe),quote:F.map(se=>se.markdown).join(`
57
+
58
+ `),preserveSelection:!0,...!p&&fe!==void 0?{afterLine:fe}:{},...ne===void 0?{}:{afterBlock:ne}})},[pe,Qe,le.open,p,ge]);a.useEffect(()=>{if(!pe||!Qe)return;const N=Pe.current,F=N==null?void 0:N.ownerDocument;if(!N||!F)return;let z=!1,X=0;const fe=()=>{window.clearTimeout(X),X=window.setTimeout(wr,0)},ne=be=>{be.button===0&&be.target instanceof Node&&N.contains(be.target)&&!(be.target instanceof Element&&be.target.closest("button, input, textarea, select, a[href]"))&&(z=!0)},se=()=>{z&&(z=!1,fe())},Ge=()=>{const be=F.activeElement;be instanceof Element&&be.closest('[data-markdown-copy-ignore="true"]')||z||fe()};return F.addEventListener("pointerdown",ne,!0),F.addEventListener("pointerup",se,!0),F.addEventListener("pointercancel",se,!0),F.addEventListener("selectionchange",Ge),fe(),()=>{window.clearTimeout(X),F.removeEventListener("pointerdown",ne,!0),F.removeEventListener("pointerup",se,!0),F.removeEventListener("pointercancel",se,!0),F.removeEventListener("selectionchange",Ge)}},[pe,Qe,wr]);const Tc=a.useCallback(N=>{if(!pe||!Qe||!(R!=null&&R.content)||N.target instanceof Element&&N.target.closest("button, input, textarea, select, a[href], [contenteditable='true']"))return;const F=N.currentTarget.ownerDocument.getSelection();if(F&&!F.isCollapsed)return;const z=N.target instanceof Element?N.target.closest("[data-line]"):null,X=Number(z==null?void 0:z.dataset.line);if(!Number.isInteger(X))return;const fe=Dw(R.content,ft(R),ge,X);fe&&le.open(fe)},[pe,Qe,R,le.open,ge]),Nc=a.useCallback(()=>{ot(N=>(N&&le.flush(),!N))},[le.flush]),Ic=a.useCallback(N=>{if(!pe)return;const F=N.relatedTarget;if(!(F instanceof Node)){le.persist();return}(N.currentTarget.closest("dialog")??N.currentTarget).contains(F)||le.flush()},[pe,le.flush,le.persist]),yr=a.useCallback(()=>{le.flush(),o==null||o()},[o,le.flush]),Pc=a.useCallback(()=>{le.flush(),i==null||i()},[i,le.flush]),vr=a.useMemo(()=>{var N;return(N=s.createMediaSource)==null?void 0:N.call(s,R)},[R,s]),Ae=a.useMemo(()=>R!=null&&R.renderedMarkdownHtml?s.transformRenderedMarkdownHtml?s.transformRenderedMarkdownHtml(R.renderedMarkdownHtml,R):R.renderedMarkdownHtml:null,[R,s]),$c=a.useMemo(()=>Ae?c.jsx(Gs,{html:Ae,sourcePath:n,density:H,ariaLabel:y("fileViewerPreview"),onClick:pr,onContextMenu:gr,onKeyDown:zn}):null,[n,zn,pr,gr,H,Ae,y]),It=a.useMemo(()=>R?Ga(n,R,Ae??void 0):null,[R,n,Ae]),on=a.useMemo(()=>{const N=Uw(R==null?void 0:R.highlightedHtml,ft(R),U,Q);return Eh(Ki(N),R==null?void 0:R.content)},[Q,U,R]);Xa(sn,!D&&p?Ae:null,vr);const xr=!D&&p?Ae:D?null:on,Kn=`${t}\0${n}\0${d??""}\0${m??""}\0${h}`,[Fc,Bc]=a.useState(0),[$e,Qn]=a.useState(null),br=a.useCallback(()=>{const N=R==null?void 0:R.metadata.modifiedAt;!s.statFile||N===void 0||s.statFile(t,n).then(F=>{const z=F.metadata.modifiedAt;z!==void 0&&Qn(z!==N||F.metadata.size!==(R==null?void 0:R.metadata.size)?{state:"stale",at:z}:{state:"fresh",loadedAt:N})}).catch(()=>Qn(null))},[s,t,n,R]),Sr=a.useCallback(()=>{Qn(null),Bc(N=>N+1),s.loadFile(t,n,!0,U,Q,Z).then(he).catch(N=>de(String(N)))},[s,t,n,U,Q,Z]);a.useEffect(()=>{B==="source"||K.loading||(B==="worktree"&&!K.worktreeFile||B==="cumulative"&&!K.cumulativeFile)&&q("source")},[B,K,q]),a.useEffect(()=>{var F;let N=!1;if(D){ae(!1),de(null),wt(null);return}if(R&&((F=rt.current)==null?void 0:F.identity)===Kn&&rt.current.source===s){ae(!1),de(null);return}return ae(!0),de(null),wt(null),s.loadFile(t,n,!0,U,Q,Z).then(z=>{if(!N){rt.current={identity:Kn,source:s},he(z);const X=ys(n)&&!!z.renderedMarkdownHtml,fe=z.content!==void 0&&bn(n,z.metadata.mimeType);E(A.current===L?!1:w?w==="preview"&&(X||fe):X||fe),ae(!1)}}).catch(z=>{N||(de(z.message||y("fileViewerLoadFailed")),ae(!1))}),()=>{N=!0}},[t,D,Q,U,Z,n,w,s,Kn,y,L,R]),a.useEffect(()=>{const N=R==null?void 0:R.metadata.mimeType;if(!R||!N||!(Vo(N)||ms(N))){Ne(null);return}if(!s.fetchRawFileBlob||ms(N)==="pdf"&&W){Ne(null);return}let F=!1,z=null;return Ne(null),s.fetchRawFileBlob(R,n,!1).then(X=>{F||(z=URL.createObjectURL(X.type===N?X:new Blob([X],{type:N})),Ne(z))}).catch(X=>{F||de(X instanceof Error?X.message:String(X))}),()=>{F=!0,z&&URL.revokeObjectURL(z)}},[R,n,W,s]),a.useEffect(()=>{if(!ie)return;const N=F=>{F.key==="Escape"&&qe(!1)};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[ie]),a.useEffect(()=>{var z;if(U===void 0||!xr)return;const N=tn??((z=Pe.current)==null?void 0:z.querySelector(".highlighted-line-start, .markdown-preview-span-start")),F=Pe.current;N&&F&&requestAnimationFrame(()=>{F.scrollTop=Ww(F,N)})},[U,xr,tn]);const Dc=a.useCallback(async()=>{if((R==null?void 0:R.content)!==void 0)try{if(!await _e(R.content))throw new Error("Clipboard write failed");ye(!0),setTimeout(()=>ye(!1),3e3)}catch(N){console.error("Failed to copy:",N)}},[R==null?void 0:R.content]),Oc=a.useCallback(()=>{zt(s.loadFile(t,n,!1).then(N=>N.content??""))},[n,t,s]),Hc=a.useCallback(()=>{It&&Jo(It.html,It.text)},[It]),Vc=a.useMemo(()=>qs(n,ce),[n,ce]),Gn=a.useMemo(()=>ii(n,ce),[n,ce]),Pt=a.useMemo(()=>v?Dn(v,{filePath:n,lineEnd:m,lineNumber:d,viewMode:h}):null,[n,m,d,v,h]),Xn=a.useMemo(()=>r||Pt||mt(Nn({basePath:Y,filePath:n,lineEnd:m,lineNumber:d,projectId:t,viewMode:h})),[Y,n,m,d,r,t,Pt,h]),$t=a.useMemo(()=>B==="source"||Pt?Xn:mt(Nn({basePath:Y,diffMode:B,filePath:K.relativePath??n,projectId:t})),[B,Y,n,K.relativePath,t,Pt,Xn]),Le=Ht(n),Cr=$w(n),cn=R?Vo(R.metadata.mimeType):!1,vt=a.useMemo(()=>R!=null&&R.content?R.content.split(`
59
+ `):[],[R==null?void 0:R.content]),xt=R?((Dr=s.getRawFileUrl)==null?void 0:Dr.call(s,t,n,!1))??R.rawUrl:null,an=cn?W&&xt?xt:Ke??(s.fetchRawFileBlob?null:xt):null,Er=y("fileViewerOpenImageNewTab"),_r=ci(t,n),kr=a.useCallback(()=>{if(!R)return;if(s.fetchRawFileBlob){s.fetchRawFileBlob(R,n,!0).then(F=>Ln(F,Le)).catch(F=>{de(F instanceof Error?F.message:String(F))});return}const N=new URLSearchParams({path:n,download:"true"});S.fetchBlob(`/projects/${t}/files/raw?${N}`).then(F=>Ln(F,Le)).catch(F=>{de(F instanceof Error?F.message:"Failed to download file")})},[R,Le,n,t,s,S]),Lr=a.useMemo(()=>new URL($t,window.location.href).href,[$t]),Mr=a.useCallback(()=>{if(an){window.open(an,"_blank","noopener");return}window.open($t,"_blank","noopener")},[an,$t]),Uc=a.useCallback(()=>{if(!R)return Promise.reject(new Error("Image is not loaded"));if(s.fetchRawFileBlob)return s.fetchRawFileBlob(R,n,!1);const N=new URLSearchParams({path:n});return S.fetchBlob(`/projects/${encodeURIComponent(t)}/files/raw?${N}`)},[R,n,t,s,S]),Rr=Ya({fileName:Le,filePath:n,loadBlob:cn?Uc:void 0,onOpen:Mr,projectPath:ce,viewerLink:$t}),qc=a.useCallback(N=>{N.preventDefault(),N.stopPropagation(),ct({x:N.clientX,y:N.clientY})},[]),Wc=a.useCallback(()=>ct(null),[]),[Yn,zc]=a.useState(null),[jr,Kc]=a.useState(null),Qc=a.useCallback(N=>{Pe.current=N,zc(N)},[]),Ar=!D&&p&&(R==null?void 0:R.content)!==void 0&&R.metadata!==void 0&&bn(n,R.metadata.mimeType),Tr=D||(R==null?void 0:R.content)!==void 0,Gc=Ja(a.useMemo(()=>Ar?jr:Tr&&Yn?{kind:"element",element:Yn}:null,[Ar,jr,Tr,Yn]));if(re||!D&&!R&&!ke||D&&K.loading&&!O)return c.jsx("div",{className:"file-viewer",children:c.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Le})})});if(!D&&(ke||!R))return c.jsx("div",{className:"file-viewer",children:c.jsx("div",{className:"file-viewer-error",children:ke||y("fileViewerNotFound")})});const me=R==null?void 0:R.metadata,Fe=R==null?void 0:R.content,Nr=cn,Ir=!!(s.fetchRawFileBlob||xt),ln=Fe!==void 0&&ys(n)&&!!Ae,at=Fe!==void 0&&me!==void 0&&bn(n,me.mimeType),Pr=ln||at,Me=pe?le.activeDraft:null,Xc=Me?le.sendingIds.has(Me.id):!1,Be=Me?c.jsx(Vw,{draft:Me,placeholder:y("fileViewerCommentPlaceholder"),error:le.error?y("fileViewerCommentSendFailed"):null,busy:Xc,cancelLabel:y("cancel"),sendLabel:y("toolbarSend"),onCancel:le.cancel,onChange:le.update,onPersist:le.persist,onSend:N=>void le.sendOne(N)},Me.id):null,Ft=Be&&!p?Me==null?void 0:Me.afterLine:void 0,$r=Be&&p&&Ae&&(Me==null?void 0:Me.afterBlock)!==void 0?Me.afterBlock:void 0,Fr=()=>{if(D)return O?c.jsx("div",{className:Se.diffBody,children:c.jsx(ir,{file:O,fileKey:`file-viewer:${B}:${O.path}`,projectId:t,source:{kind:"file-projection",mode:B},captureReviewProjections:!0,t:y})}):c.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Le})});if(!R||!me)return c.jsx("div",{className:"file-viewer-error",children:ke||y("fileViewerNotFound")});if(Nr){const F=s.fetchRawFileBlob?Ke:xt,z=an??F;return c.jsx("div",{className:"file-viewer-image",children:F&&z?c.jsx("a",{className:"file-viewer-image-link",href:z,target:"_blank",rel:"noopener noreferrer",title:Er,"aria-label":Er,onContextMenu:Rr.handleContextMenu,children:c.jsx("img",{src:F,alt:Le})}):c.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Le})})})}const N=ms(me.mimeType);if(N){const F=!s.fetchRawFileBlob||N==="pdf"&&W?xt:Ke;return F?c.jsx(Iw,{kind:N,url:F,fileName:Le,sampleText:y("fileViewerFontSample"),unsupported:Br,pdfjsAvailable:W}):c.jsx("div",{className:"file-viewer-loading",children:y("fileViewerLoading",{name:Le})})}if(Fe!==void 0){if(p&&ln&&Ae)return c.jsx(Hw,{afterBlock:Be?$r:void 0,editor:Be,previewRef:sn,children:$c});if(p&&at)return c.jsx(cl,{html:Fe,path:n,projectId:t,className:Se.htmlPreviewFrame,title:Le,autoStart:j===L,toolbarHost:T,reloadKey:Fc,onFindSource:Kc},L);if(on){const et=qo(R),lt=Ft!==void 0?_h(on,Ft):null,Xe=ut=>c.jsx("div",{className:"shiki-container",onClick:qn,onContextMenu:Wn,onKeyDown:zn,dangerouslySetInnerHTML:{__html:ut}});return c.jsxs("div",{className:"file-viewer-code file-viewer-code-highlighted","data-language":R.highlightedLanguage??Cr,style:ue,children:[lt&&Be?c.jsx(qt,{before:Xe(lt.before),editor:Be,after:Xe(lt.after)}):Xe(on),R.highlightedTruncated&&c.jsx("div",{className:"file-viewer-truncated",children:y("fileViewerHighlightTruncated")}),et&&c.jsx("div",{className:"file-viewer-truncated",children:et})]})}const F=vt.length>Uo?vt.slice(0,Uo):vt,z=ft(R),X=U??0,fe=Math.max(X,Q??X),ne=X===fe,se=qo(R),Ge=(et,lt)=>{const Xe=F.slice(et,lt);return Xe.length>0?c.jsxs("div",{className:"code-highlighter-plain",children:[c.jsx("div",{className:"code-line-numbers",children:Xe.map((ut,De)=>{const Oe=z+et+De;return c.jsx("div",{children:Oe},`ln-${Oe}`)})}),c.jsx("pre",{className:"code-content",children:c.jsx("code",{children:Xe.map((ut,De)=>{const Oe=z+et+De,Zc=U!==void 0&&Oe>=X&&Oe<=fe,ea=[ne&&Zc?"highlighted-line":"",Oe===X?"highlighted-line-start":"",Oe===fe?"highlighted-line-end":""].filter(Boolean).join(" ");return c.jsx("div",{ref:U!==void 0&&Oe===X?ta=>wt(ta):void 0,className:ea||void 0,"data-line":Oe,children:ut||" "},`line-${Oe}`)})})})]}):null},be=Ft===void 0?null:Math.min(F.length,Math.max(0,Ft-z+1));return c.jsxs("div",{className:"file-viewer-code","data-language":Cr,style:ue,children:[be!==null&&Be?c.jsx(qt,{before:Ge(0,be),editor:Be,after:Ge(be,F.length)}):F.length>0?Ge(0,F.length):c.jsx("div",{className:"file-viewer-empty-content",children:"No content read"}),F.length<vt.length&&c.jsx("div",{className:"file-viewer-truncated",children:y("fileViewerPlainTruncated",{count:F.length,total:vt.length})}),se&&c.jsx("div",{className:"file-viewer-truncated",children:se})]})}return Br},Br=c.jsxs("div",{className:"file-viewer-binary",children:[c.jsx("p",{children:y("fileViewerBinary")}),c.jsxs("p",{children:[c.jsx("strong",{children:y("fileViewerType")})," ",me==null?void 0:me.mimeType]}),c.jsxs("p",{children:[c.jsx("strong",{children:y("fileViewerSize")})," ",me?Ho(me.size):""]}),Ir&&c.jsx("button",{type:"button",className:"file-viewer-download-btn",onClick:kr,children:y("fileViewerDownloadFile")})]}),Yc=c.jsxs("div",{ref:Hn,className:`file-viewer-header ${Rt.header} ${Se.header}`,"data-actions-below":gt||void 0,children:[c.jsxs("div",{ref:en,className:Se.context,children:[f,o&&c.jsx("button",{type:"button",className:`file-viewer-action ${Se.backButton}`,onClick:yr,title:y("actionBack"),"aria-label":y("actionBack"),children:c.jsx(sf,{})})]}),c.jsxs("div",{className:`file-viewer-info ${Rt.identity} ${Se.info}`,children:[c.jsx("span",{className:"file-viewer-path",title:n,onContextMenu:qc,children:Vc}),c.jsxs("div",{ref:ve,className:Se.provenanceRow,children:[v===null&&K.relativePath&&c.jsx(nr,{projectId:t,path:K.relativePath,origPath:(Or=K.worktreeFile)==null?void 0:Or.origPath,dirtyLabel:y("fileRevisionDirty"),uncommittedLabel:y("fileRevisionUncommitted")}),c.jsxs("span",{className:"file-viewer-meta",children:[me?Ho(me.size):"",!D&&(me==null?void 0:me.isText)&&Fe!==void 0&&c.jsxs(c.Fragment,{children:[" • ",R!=null&&R.contentTruncated?`lines ${ft(R)}-${uc(R)}${R!=null&&R.contentTotalLines?` of ${R.contentTotalLines}`:""}`:y("fileViewerLines",{count:vt.length})]})]})]})]}),c.jsx(Za,{find:Gc}),c.jsxs("div",{ref:Ze,className:`file-viewer-actions ${Rt.actions} ${Se.actions}`,children:[v===null&&c.jsx(oc,{activeView:B,availability:K,onSelect:q,projectId:t,sourceHref:Xn,variant:"header"}),!D&&Pr&&c.jsx("button",{type:"button",className:`file-viewer-action ${Se.rawToggle}`,"aria-label":y("fileViewerRawSource"),"aria-pressed":!p,title:y("fileViewerRawSource"),onClick:()=>{k(!p&&at?L:null),E(N=>!N)},children:c.jsx(Gw,{})}),Qe&&c.jsx("button",{type:"button",className:`file-viewer-action ${Se.commentToggle}`,"aria-label":y("fileViewerCommentMode"),"aria-pressed":pe,title:y("fileViewerCommentMode"),onClick:Nc,children:c.jsx(ty,{})}),v===null&&s===ps&&!D&&(me==null?void 0:me.isText)&&Fe!==void 0&&c.jsx(el,{source:{path:n,projectId:t},line:U,artifact:at,onSaved:at?void 0:Sr}),c.jsx("span",{ref:I}),!D&&R&&c.jsx("button",{type:"button",className:`file-viewer-action${($e==null?void 0:$e.state)==="stale"?` ${Se.reloadStale}`:""}`,"aria-label":y("fileViewerReload"),title:($e==null?void 0:$e.state)==="stale"?y("fileViewerReloadStale",{time:new Date($e.at).toLocaleTimeString()}):($e==null?void 0:$e.state)==="fresh"?y("fileViewerReloadFresh"):y("fileViewerReload"),onMouseEnter:br,onFocus:br,onClick:Sr,children:c.jsx(Qw,{})}),!D&&(me==null?void 0:me.isText)&&Fe!==void 0&&c.jsx(Bd,{zoom:Ie.zoom,canZoomIn:Ie.canZoomIn,canZoomOut:Ie.canZoomOut,onZoomIn:Ie.zoomIn,onZoomOut:Ie.zoomOut}),(D||!Nr&&Fe!==void 0&&!(p&&at))&&c.jsx(tw,{className:"file-viewer-action",contentRef:Pe}),!D&&Fe!==void 0&&c.jsx("button",{type:"button",className:`file-viewer-action ${ee?"copied":""}`,onClick:Dc,title:y(ee?"fileViewerCopied":"fileViewerCopyContent"),children:ee?c.jsx(Zw,{}):c.jsx(Xw,{})}),v===null&&s===ps&&!D&&c.jsx(Yw,{onOpen:ze}),v!==null&&v.projectId!==null&&!D&&at&&Fe!==void 0&&c.jsx(tl,{mode:"interactive",source:{},artifact:!0,href:G,active:!1,label:y("publicSharePlay"),onToggle:()=>window.open(G,"_blank","noopener")}),v===null&&c.jsx("button",{type:"button",className:"file-viewer-action file-viewer-new-session",onClick:_r,title:y("fileViewerNewSession"),children:c.jsx(ey,{})}),!D&&Ir&&c.jsx("button",{type:"button",className:"file-viewer-action",onClick:kr,title:y("fileViewerDownload"),children:c.jsx(ny,{})}),c.jsx("button",{type:"button",className:`file-viewer-action file-viewer-fullscreen-toggle ${Se.fullscreenButton}`,onClick:()=>qe(!ie),title:y(ie?"fileViewerExitFullscreen":"fileViewerFullscreen"),children:ie?c.jsx(ry,{}):c.jsx(sy,{})}),c.jsx(nl,{className:Se.windowActions,url:Lr,moveOut:!u,onMinimize:i?Pc:void 0,onClose:o?yr:void 0,minimizeLabel:y("fileViewerMinimize")})]})]}),Jc=["file-viewer",Se.viewer,u&&"file-viewer-standalone",ie&&"file-viewer-fullscreen",Z==="range"&&"file-viewer-compact"].filter(Boolean).join(" ");return c.jsxs("div",{className:Jc,onBlurCapture:Ic,children:[Yc,We&&c.jsx(Ag,{anchorRect:We,filePath:n,projectId:t,title:Le,transformUrl:j===L?N=>sl(N)??N:void 0,onClose:()=>ze(null)}),it&&c.jsx(ai,{x:it.x,y:it.y,canStartNewSession:v===null,onClose:Wc,onOpen:Mr,onOpenSource:xs(n)?()=>{k(null),E(!1)}:void 0,onOpenPreview:xs(n)&&Pr?()=>{k(L),E(!0)}:void 0,onStartNewSession:_r,onCopyProjectRelativePath:xe?()=>void _e(xe):void 0,onCopyAbsolutePath:v===null&&Gn?()=>void _e(Gn):void 0,onCopyFilePath:!xe&&!Gn?()=>void _e(n):void 0,onCopyViewerLink:()=>void _e(Lr),onCopyContents:Oc,onCopyRenderedContents:It?Hc:void 0}),Rc,cn?Rr.contextMenuElement:null,c.jsxs("div",{className:`file-viewer-body ${Se.body} ${b&&p&&ln?Se.quoteReplySurface:""}`,ref:Qc,tabIndex:-1,...pe?{[Vi]:"true"}:{},onClick:Tc,onMouseDownCapture:Ac,onPointerDown:jc,children:[Be&&Ft===void 0&&$r===void 0?c.jsx(qt,{before:Fr(),editor:Be}):Fr(),!pe&&b&&p&&ln?c.jsx(aw,{alwaysShowQuoteCircle:M==="paragraph-always",contentRef:sn,layoutKey:`${n}\0${Ae??""}`,onQuoteBlock:b,paragraphQuoteCirclesEnabled:M!=="block",sourceRef:Pe,surfaceRef:Pe}):null,u?c.jsx(Kw,{containerRef:Pe,onStartNewSessionFromSelection:v===null?_c:void 0}):null]}),rn?c.jsx(rl,{path:rn.path,mediaType:rn.mediaType,mediaSource:vr,dismissOnBack:!0,parentViewerId:rn.mediaType==="image"?l:void 0,onClose:kc}):null,Un?c.jsx(ol,{resource:Un.resource,initialPresentation:Un.initialPresentation,dismissOnBack:!0,onClose:Lc}):null,yt?c.jsx(Xt,{nestedViewer:!0,projectId:yt.projectId,filePath:yt.filePath,lineNumber:yt.lineNumber,lineEnd:yt.lineEnd,initialPresentation:yt.initialPresentation,onClose:Mc}):null]})});function Kw({containerRef:e,onStartNewSessionFromSelection:t}){const{floatingSelectionActions:n,selectionContextMenu:s}=Wi({containerRef:e,inert:!1,onStartNewSessionFromSelection:t,quoteClearSignal:0,isInteractiveTarget:r=>r instanceof Element&&r.closest("button, input, textarea, select, a[href], [contenteditable='true']")!==null});return c.jsxs(c.Fragment,{children:[n,s]})}function Qw(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 1-1.6-3.9"}),c.jsx("path",{d:"M13.5 2.5v3.2h-3.2"})]})}function Gw(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M5.5 4 2 8l3.5 4M10.5 4 14 8l-3.5 4M9.5 2.5l-3 11"})})}function Xw(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),c.jsx("path",{d:"M11 5V3.5A1.5 1.5 0 0 0 9.5 2H3.5A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5"})]})}function Yw({onOpen:e}){const{t}=je(),{version:n}=ti(),{status:s}=il();return(s==null?void 0:s.canCreate)!==!0||!Wt(n,_a)?null:c.jsx("button",{type:"button",className:"file-viewer-action",onClick:r=>e(r.currentTarget.getBoundingClientRect()),title:t("fileViewerSharePublicly"),"aria-label":t("fileViewerSharePublicly"),children:c.jsx(Jw,{})})}function Jw(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"m8 12 4-4M6.5 14.5l-1 1a2.8 2.8 0 0 1-4-4l3-3a2.8 2.8 0 0 1 4 0M13.5 5.5l1-1a2.8 2.8 0 1 1 4 4l-3 3a2.8 2.8 0 0 1-4 0"})})}function Zw(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M3 8.5L6.5 12L13 4"})})}function ey(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6"}),c.jsx("path",{d:"M8 5v6M5 8h6"})]})}function ty(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M3 3.5h10v7H7l-3.5 2.5v-2.5H3z"})})}function ny(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M8 2v9M4 8l4 4 4-4M2 14h12"})})}function sy(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M2 5V2h3M11 2h3v3M14 11v3h-3M5 14H2v-3"})})}function ry(){return c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M5 2v3H2M14 5h-3V2M11 14v-3h3M2 11h3v3"})})}const oy=128*1024,Wo=3e4,iy=64,fc=128,cy=4096;function ay(){var e;return(e=globalThis.crypto)!=null&&e.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function zo(){const e=new Error("Share request cancelled");return e.name="AbortError",e}function ly(e){return e instanceof Error?e:new Error("Share transfer failed")}function hc(e,t){return e.length>t||new TextEncoder().encode(e).byteLength>t}async function uy(e,t){if(typeof e=="string"){if(hc(e,t))throw new Error("Relay response is too large");return e}if(e instanceof Blob){if(e.size>t)throw new Error("Relay response is too large");return await e.text()}if(e instanceof ArrayBuffer){if(e.byteLength>t)throw new Error("Relay response is too large");return new TextDecoder().decode(e)}throw new Error("Relay returned an invalid response")}function dy(e){if(e===void 0)return!0;if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=Object.entries(e);return t.length<=iy&&t.every(([n,s])=>n.length<=fc&&typeof s=="string"&&s.length<=cy)}class fy{constructor(t,n,s){te(this,"ws");te(this,"ready");te(this,"readyResolve");te(this,"readyReject");te(this,"readySettled",!1);te(this,"connectTimeout");te(this,"pending");te(this,"closedIntentionally",!1);te(this,"terminalError");te(this,"signal");te(this,"abortListener",()=>{this.close(zo())});var r,o;this.signal=s,this.ready=new Promise((i,l)=>{this.readyResolve=i,this.readyReject=l}),this.ready.catch(()=>{}),this.ws=new WebSocket(t),this.connectTimeout=setTimeout(()=>{this.fail(new Error("Share request timed out")),this.close()},Wo),this.ws.onopen=()=>{this.ws.send(JSON.stringify({type:"client_connect",username:n}))},this.ws.onmessage=i=>{this.handleMessage(i)},this.ws.onerror=()=>{this.close(new Error("Relay connection failed"))},this.ws.onclose=()=>{this.closedIntentionally||this.failTerminal(new Error("Relay connection closed"))},(r=this.signal)==null||r.addEventListener("abort",this.abortListener,{once:!0}),(o=this.signal)!=null&&o.aborted&&this.abortListener()}async request(t,n=ka){var r;if(await this.ready,(r=this.signal)!=null&&r.aborted)throw zo();if(this.terminalError)throw this.terminalError;if(this.closedIntentionally||this.ws.readyState>=2)throw new Error("Relay connection closed");if(this.pending)throw new Error("Public share relay requests must be sequential");const s=ay();return await new Promise((o,i)=>{const l=setTimeout(()=>{this.pending=void 0;const u=new Error("Share request timed out");i(u),this.close(u)},Wo);this.pending={id:s,resolve:o,reject:i,timeout:l,maxResponseBytes:n};try{this.ws.send(JSON.stringify({type:"request",id:s,method:"GET",path:t,headers:{}}))}catch{clearTimeout(l),this.pending=void 0;const u=new Error("Relay connection closed");this.failTerminal(u),i(u)}})}isTerminal(){return this.terminalError!==void 0||this.closedIntentionally||this.ws.readyState>=2}close(t=new Error("Relay connection closed")){var n;this.closedIntentionally||(this.failTerminal(t),this.closedIntentionally=!0,(n=this.signal)==null||n.removeEventListener("abort",this.abortListener),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close())}async handleMessage(t){var s;let n;try{const r=((s=this.pending)==null?void 0:s.maxResponseBytes)??oy;let o;if(typeof t.data=="string"){if(hc(t.data,r))throw new Error("Relay response is too large");o=t.data}else o=await uy(t.data,r);n=JSON.parse(o)}catch(r){const o=ly(r);this.fail(o),this.close(o);return}if(n&&typeof n=="object"&&n.type==="client_connected"){this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyResolve());return}if(n&&typeof n=="object"&&n.type==="response"){const r=n;if(typeof r.id!="string"||r.id.length>fc||!Number.isInteger(r.status)||r.status<100||r.status>599||!dy(r.headers)){const i=new Error("Relay returned an invalid response");this.fail(i),this.close(i);return}if(!this.pending||r.id!==this.pending.id)return;const o=this.pending;this.pending=void 0,clearTimeout(o.timeout),o.resolve(r)}}fail(t){if(this.readySettled||(this.readySettled=!0,this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=null),this.readyReject(t)),this.pending){const n=this.pending;this.pending=void 0,clearTimeout(n.timeout),n.reject(t)}}failTerminal(t){this.terminalError??(this.terminalError=t),this.fail(this.terminalError)}}async function mc({path:e,relayUrl:t,relayUsername:n,signal:s,maxResponseBytes:r}){const o=new fy(t,n,s);try{return await o.request(e,r)}finally{o.close()}}class Ko extends Error{constructor(t,n,s){super(t),this.status=n,this.retryable=s,this.name="PublicShareRelayError"}}function hy(e){var t,n;if(e.status>=400){const s=e.body,r=s&&typeof s=="object"&&typeof s.error=="string"?s.error:"Share not found";throw new Ko(r,e.status,!!(s&&typeof s=="object"&&s.retryable===!0))}if(e.status!==200)throw new Ko("Share returned an unexpected response",e.status,!1);if(typeof e.body=="string"&&(((t=e.headers)==null?void 0:t["content-type"])??((n=e.headers)==null?void 0:n["Content-Type"])??"").includes("json"))try{return JSON.parse(e.body)}catch{throw new Error("Share response is invalid")}return e.body}async function my(e){return hy(await mc(e))}async function py(e){var r,o;const t=await mc(e);if(t.status>=400)throw new Error("Share not found");const n=((r=t.headers)==null?void 0:r["content-type"])||((o=t.headers)==null?void 0:o["Content-Type"])||"application/octet-stream",s=t.body;if(s&&typeof s=="object"&&s._binary===!0&&typeof s.data=="string"){const i=atob(s.data),l=new Uint8Array(i.length);for(let u=0;u<i.length;u+=1)l[u]=i.charCodeAt(u);return new Blob([l],{type:n})}return typeof s=="string"?new Blob([s],{type:n}):new Blob([JSON.stringify(s??null)],{type:n})}function gy(e,t){const n=document.createElement("template");return n.innerHTML=e,ul(n.content,t),n.innerHTML}function ar(e){const t=async(n,s)=>{const r=ll(s,e.projectId),o=(r?js(n,r.path):null)??js(n,s);if(o)return o;if(!r)throw new Error("File is outside this public share");const i=new URLSearchParams({path:r.path});return e.viewerId&&i.set("viewerId",e.viewerId),await py({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files/raw?${i}`})};return{loadFile:async(n,s,r,o,i,l)=>{const u=new URLSearchParams({path:s});return e.viewerId&&u.set("viewerId",e.viewerId),r&&u.set("highlight","true"),o!==void 0&&u.set("line",String(o)),i!==void 0&&u.set("lineEnd",String(i)),l==="range"&&u.set("view","range"),await my({relayUrl:e.relayUrl,relayUsername:e.relayUsername,path:`/public-api/shares/${encodeURIComponent(e.secret)}/files?${u}`})},getRawFileUrl:()=>null,fetchRawFileBlob:t,createMediaSource:n=>({buildApiPath:s=>al(e,s),fetchBlob:async s=>await t(n??{embeddedMedia:{}},s)}),transformRenderedMarkdownHtml:n=>gy(n,e)}}const wy="_linkCluster_1l5oo_1",yy="_paneViewer_1l5oo_7",vy="_nestedPaneViewer_1l5oo_15",xy="_fileViewerModal_1l5oo_21",by="_fileViewerModalCompact_1l5oo_35",Sy="_inlineDiffLinks_1l5oo_50",Mt={linkCluster:wy,paneViewer:yy,nestedPaneViewer:vy,fileViewerModal:xy,fileViewerModalCompact:by,inlineDiffLinks:Sy};function Cy({filePath:e}){return c.jsx(xl,{text:e,label:"Copy path",copiedLabel:"Copied path",className:"file-path-copy",onClick:t=>t.stopPropagation()})}function pc(e){if(!Kt(e))return null;try{const t=Hs(e);return li(t)}catch{return null}}function Ey(e,t){const n=pc(e),s=Us(t,n);if(s!==null)return s;const r=Qt(t);return!(r.startsWith("/")||/^[a-zA-Z]:\//.test(r))&&t.includes("\\")?Qt(t):t}function Is(e,t){return e===void 0?"":t!==void 0&&t>e?`:${e}-${t}`:`:${e}`}const Rv=a.memo(function({filePath:t,projectId:n,lineNumber:s,lineEnd:r,columnNumber:o,displayText:i,showLineSuffix:l=!0,showFullPath:u=!1,viewMode:d="full",showCopyButton:m=!0,showVersionControlLinks:h=!0}){const w=Bn(),g=ui(),f=Xs(),y=Nt(),b=Os().transport,x=a.useId(),[_,M]=a.useState(!1),[C,S]=a.useState(),[v,L]=a.useState(null),p=a.useMemo(()=>Ey(n,t),[n,t]),E=ci(n,p),T=a.useMemo(()=>pc(n),[n]),I=a.useMemo(()=>vs(p)?Us(p,T):Qt(p).replace(/^\.\/+/,""),[T,p]),j=a.useMemo(()=>ii(vs(t)?t:p,T),[t,T,p]),k=xs(p),A=w?Dn(w,{columnNumber:o,filePath:p,lineEnd:r,lineNumber:s,viewMode:d}):null,$=w!==null?A:mt(Nn({basePath:y,filePath:p,lineEnd:r,lineNumber:s,projectId:n,viewMode:d})),P=a.useMemo(()=>w?ar(w):void 0,[w]),B=a.useCallback(ee=>{if(g&&w===null){const ye=Is(s,r);di({id:x,kind:"file",sessionId:g,label:`${p}${ye}`,briefLabel:Ht(p),filePath:p,lineSuffix:ye,supportsRightPane:!0,renderContent:(ie,qe)=>c.jsx(Xt,{managedViewerId:x,inactive:ie,rightPane:qe,quoteReply:f,projectId:n,filePath:p,lineNumber:s,lineEnd:r,viewMode:d,initialPresentation:ee,source:P,openInNewTabUrl:$},x)});return}S(ee),M(!0)},[$,r,s,x,n,w,P,g,f,d,p]),q=a.useCallback(ee=>{if(ee.stopPropagation(),!(ee.button!==0||ee.metaKey||ee.ctrlKey||ee.shiftKey||ee.altKey)){if(w&&!A){ee.preventDefault();return}ee.preventDefault(),B()}},[B,w,A]),D=a.useCallback(()=>{M(!1)},[]),U=a.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),L({x:ee.clientX,y:ee.clientY})},[]),Q=a.useCallback(()=>L(null),[]),Z=a.useCallback(ee=>B(ee),[B]),K=a.useCallback(()=>{$&&_e(new URL($,window.location.href).href)},[$]),O=a.useCallback(()=>{const ee=P?P.loadFile(n,p,!1):oe.getFile(n,p);zt(ee.then(ye=>ye.content??""))},[n,P,p]),W=a.useCallback(()=>{const ee=P?P.loadFile(n,p,!0):oe.getFile(n,p,!0);La(ee.then(ye=>pl(p,ye)))},[n,P,p]),Y=a.useCallback(()=>{const ee=Ht(p);if(P!=null&&P.fetchRawFileBlob){P.loadFile(n,p,!1).then(ie=>{var qe;return(qe=P.fetchRawFileBlob)==null?void 0:qe.call(P,ie,p,!0)}).then(ie=>{ie&&Ln(ie,ee)}).catch(()=>{});return}const ye=new URLSearchParams({path:p,download:"true"});b.fetchBlob(`/projects/${n}/files/raw?${ye}`).then(ie=>Ln(ie,ee)).catch(()=>{})},[n,P,b,p]),G=u?t:Ht(t),R=i||G,he=Is(s,r),re=he&&o!==void 0&&r===void 0?`:${o}`:"",ae=`${he}${re}`,ke=l?ae:"",de=Ma(`${t}${ae}`);return c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:Mt.linkCluster,children:[c.jsxs("a",{href:$??"#",className:"file-path-link",onClick:q,onContextMenu:U,...de,children:[c.jsx("span",{className:"file-path-link-name",children:R}),ke&&c.jsx("span",{className:"file-path-link-line",children:ke})]}),m&&c.jsx(Cy,{filePath:p}),w===null&&h&&c.jsx(Xp,{className:Mt.inlineDiffLinks,projectId:n,filePath:p})]}),v&&c.jsx(ai,{x:v.x,y:v.y,canStartNewSession:w===null,onClose:Q,onOpen:()=>Z(),onDownload:Y,onOpenSource:k?()=>Z("source"):void 0,onOpenPreview:k?()=>Z("preview"):void 0,onStartNewSession:E,onCopyProjectRelativePath:I?()=>void _e(I):void 0,onCopyAbsolutePath:w===null&&j?()=>void _e(j):void 0,onCopyFilePath:!I&&!j?()=>void _e(p):void 0,onCopyViewerLink:$?K:void 0,onCopyContents:O,onCopyRenderedContents:k?W:void 0}),_&&c.jsx(Xt,{projectId:n,filePath:p,lineNumber:s,lineEnd:r,viewMode:d,initialPresentation:C,source:P,openInNewTabUrl:$,onClose:D})]})});function _y(e){return c.jsx(Xt,{...e})}function Xt({projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r="full",initialPresentation:o,source:i,openInNewTabUrl:l,managedViewerId:u,inactive:d=!1,rightPane:m=!1,nestedViewer:h=!1,quoteReply:w,onClose:g}){const f=Bn(),y=a.useMemo(()=>f?ar(f):void 0,[f]),b=i??y,x=Xs(),_=w??x,M=ui(),C=dl(),S=u===void 0&&(h||C!==null),v=m||S&&!!(C!=null&&C.target),L=u===void 0&&!S&&!!M&&f===null,p=Vs(),E=a.useId(),T=u??E,I=fl(),j=!!(d||S&&(C!=null&&C.inactive)||(I==null?void 0:I.id)===T&&I.minimized),k=a.useRef(g);k.current=g;const A=a.useCallback(()=>{var K;if(u!==void 0){hl(T);return}Kr(T),(K=k.current)==null||K.call(k)},[T,u]),$=a.useCallback(()=>ml(T),[T]);a.useLayoutEffect(()=>{if(u!==void 0||S||f!==null)return;const K=Is(n,s);di({id:T,kind:"file",sessionId:M??(p==null?void 0:p.sessionId)??"",label:`${t}${K}`,briefLabel:Ht(t),onClose:A,filePath:t,lineSuffix:K,...L?{supportsRightPane:!0,renderContent:(O,W)=>c.jsx(_y,{managedViewerId:T,inactive:O,rightPane:W,quoteReply:_,projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r,initialPresentation:o,source:b,openInNewTabUrl:l})}:{}})},[A,t,s,n,u,S,T,f,p==null?void 0:p.sessionId,M,L,e,r,o,b,l,_]),a.useEffect(()=>{if(!(u!==void 0||L||S))return()=>Kr(T)},[u,T,L,S]);const P=K=>{K.target===K.currentTarget&&A()},B=!L&&!j&&(!v||S||(I==null?void 0:I.id)===T);if(Va(A,B,"__fileViewerModal"),Ua(A,B),qa(A,B),L)return null;const q=c.jsx(zw,{projectId:e,filePath:t,lineNumber:n,lineEnd:s,viewMode:r,initialPresentation:o,source:b,openInNewTabUrl:l,onClose:A,onMinimize:f===null&&!S?$:void 0,parentViewerId:u}),D=_?c.jsx(nf,{onQuoteTextBlock:_,children:q}):q;if(v){const K=c.jsx(ro,{projectId:e,children:c.jsx("div",{className:`${Mt.paneViewer} ${S?Mt.nestedPaneViewer:""}`,...ws,children:D})});return S&&(C!=null&&C.target)?st.createPortal(K,C.target):K}const U=f===null?document.querySelector(".navigation-route-layer.is-active [data-session-viewer-layer]")??document.querySelector("[data-session-viewer-layer]"):null,Q=c.jsx("div",{className:"modal-overlay","aria-hidden":j||void 0,style:j?{display:"none"}:void 0,onClick:P,onMouseDown:K=>K.stopPropagation(),children:c.jsx("dialog",{className:`modal file-viewer-modal ${Mt.fileViewerModal} ${r==="range"?`file-viewer-modal-compact ${Mt.fileViewerModalCompact}`:""}`,...ws,open:!0,onClick:K=>K.stopPropagation(),children:D})}),Z=f===null?U??document.querySelector(".navigation-route-layer.is-active .session-page")??document.querySelector(".session-page"):null;return st.createPortal(f?Q:c.jsx(ro,{projectId:e,children:Q}),Z??document.body)}const ky=new RegExp(String.raw`\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\)|[@-Z\\-_])`,"g");function Ce(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function At(e){return Ce(e).replaceAll(`
60
+ `,"&#10;")}function lr(e){return e.replace(ky,"")}function Sn(e){return e.replace(/^[ab]\//,"")}function Ly(e){const t=e.replace(/\r\n/g,`
61
+ `).split(`
62
+ `);for(const n of t){const s=/^\+\+\+\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(s!=null&&s[1])return Sn(s[1].trim())}for(const n of t){const s=/^---\s+(?!\/dev\/null)(?:[ab]\/)?(.+?)\s*$/.exec(n);if(s!=null&&s[1])return Sn(s[1].trim())}for(const n of t){const s=/^diff --git\s+a\/(.+?)\s+b\/(.+?)\s*$/.exec(n);if(s!=null&&s[2])return Sn(s[2].trim());if(s!=null&&s[1])return Sn(s[1].trim())}}function Qo(e){const t=[];for(const n of e.replace(/\\/g,"/").split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function My(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||/^[a-z][a-z0-9+.-]*:/i.test(n))return null;const s=n.split(/[?#]/,1)[0]??"";if(!s)return null;if(s.startsWith("/"))return Qo(s.slice(1));const r=t!=null&&t.includes("/")?t.slice(0,t.lastIndexOf("/")):"";return Qo(r?`${r}/${s}`:s)}function Ry(e,t,n={}){const s=My(t,n.baseFilePath);if(!s)return null;const r=Ce(e||t);if(!n.projectId)return{html:r,changed:!0};const i=(n.publicShare&&Dn(n.publicShare,{filePath:s}))??mt(`${n.basePath??""}/projects/${encodeURIComponent(n.projectId)}/file?path=${encodeURIComponent(s)}`),l=`/${s}`,u=qs(l,n.projectPath);return{html:`<a class="fixed-font-file-link" href="${At(i)}" data-fixed-font-file-path="${At(s)}" data-tooltip="${At(u)}">${r}</a>`,changed:!0}}function Go(e,t){var i;if(!t.projectId||!((i=t.projectPathLinks)!=null&&i.length))return{html:Ce(e),changed:!1};const n=new Map(t.projectPathLinks.map(l=>[l.text,l.filePath])),s=Il(e).filter(l=>n.has(l.text));if(s.length===0)return{html:Ce(e),changed:!1};let r="",o=0;for(const l of s){const u=n.get(l.text),d=t.publicShare?Dn(t.publicShare,{filePath:u}):null;if(t.publicShare&&!d){r+=Ce(e.slice(o,l.end)),o=l.end;continue}r+=Ce(e.slice(o,l.start));const m=d??mt(`${t.basePath??""}/projects/${encodeURIComponent(t.projectId)}/file?path=${encodeURIComponent(u)}`),h=qs(u,t.projectPath);r+=`<a class="fixed-font-file-link" href="${At(m)}" data-fixed-font-file-path="${At(u)}" data-tooltip="${At(h)}">${Ce(l.text)}</a>`,o=l.end}return r+=Ce(e.slice(o)),{html:r,changed:!0}}function Pn(e,t){try{return wl.renderToString(e,{throwOnError:!1,displayMode:t,output:"htmlAndMathml",strict:"ignore",trust:!1})}catch{const n=t?`$$${e}$$`:`$${e}$`;return`<span class="fixed-font-math-error">${Ce(n)}</span>`}}function ur(e,t){let n=0;for(let s=t-1;s>=0&&e[s]==="\\";s-=1)n+=1;return n%2===1}function gc(e,t,n){let s=n;for(;s<e.length;){const r=e.indexOf(t,s);if(r<0||!ur(e,r))return r;s=r+t.length}return-1}function wc(e,t){const n=e.startsWith("$$",t)?{close:"$$",open:"$$"}:e.startsWith("\\[",t)&&!ur(e,t)?{close:"\\]",open:"\\["}:null;if(!n)return null;const s=gc(e,n.close,t+n.open.length);if(s<0)return null;const r=e.slice(t+n.open.length,s).trim();return r?{end:s+n.close.length,html:Pn(r,!0)}:null}function yc(e,t){if(e.startsWith("\\(",t)&&!ur(e,t)){const l=gc(e,"\\)",t+2);if(l<0)return null;const u=e.slice(t+2,l).trim();return!u||u.includes(`
63
+ `)?null:{end:l+2,html:Pn(u,!1)}}if(e[t]!=="$")return null;const n=e[t+1];if(!n||/\s/.test(n))return null;let s=t+1;for(;s<e.length;){const l=e[s];if(l===`
64
+ `)return null;if(l==="$")break;s+=1}if(s>=e.length||e[s]!=="$")return null;const r=e[s-1];if(!r||/\s/.test(r))return null;const o=e[s+1];if(o&&(/\d/.test(o)||o==="$"))return null;const i=e.slice(t+1,s);return!i||!/[\\^{}+]/.test(i)&&!/\d/.test(i)?null:{end:s+1,html:Pn(i,!1)}}function vc(e){return{chars:e.length,lines:e.length===0?0:e.split(`
65
+ `).length}}function xc(e){let t="",n=!1,s=0,r=0;for(;r<e.length;){const o=wc(e,r),i=o?null:yc(e,r),l=o??i;if(!l){r+=1;continue}t+=Ce(e.slice(s,r)),t+=l.html,n=!0,r=l.end,s=r}return t+=Ce(e.slice(s)),{html:t,changed:n}}function jy(e,t={}){return ji("fixed-font-math",()=>({...vc(e),diffAware:t.diffAware??!1}),()=>t.diffAware?$y(e):xc(e))}function Ay(e){const t=e.replace(/\r\n/g,`
66
+ `).split(`
67
+ `);if(t.some(r=>r.startsWith("@@ "))||t.some(r=>r.startsWith("diff --git "))||t.some(r=>r.startsWith("--- "))&&t.some(r=>r.startsWith("+++ ")))return!0;let n=0,s=0;for(const r of t)r.startsWith("+")&&!r.startsWith("+++")&&(n+=1),r.startsWith("-")&&!r.startsWith("---")&&(s+=1);return n>0&&s>0&&n+s>=2}function bc(e,t){return t&&e.length>0&&(e[0]===" "||e[0]==="+"&&!e.startsWith("+++")||e[0]==="-"&&!e.startsWith("---"))?{prefix:e[0],content:e.slice(1)}:{prefix:"",content:e}}function Ps(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.split("|").length>=4}function kn(e){return e.trim().slice(1,-1).split("|").map(n=>n.trim())}function gs(e){if(!Ps(e))return!1;const t=kn(e);return t.length>0&&t.every(n=>/^:?-{2,}:?$/.test(n.replace(/\s+/g,"")))}function Ty(e){const t=e.replace(/\s+/g,""),n=t.startsWith(":"),s=t.endsWith(":");return n&&s?"center":s?"right":n?"left":null}function ht(e,t={}){let n="",s=!1,r=0,o=0;const i=l=>{if(l>r){const u=Go(e.slice(r,l),t);n+=u.html,u.changed&&(s=!0)}};for(;o<e.length;){const l=e[o];if(l==="`"){const w=e.indexOf("`",o+1);if(w>o+1){i(o);const g=Go(e.slice(o+1,w),t);n+=`<code>${g.html}</code>`,s=!0,o=w+1,r=o;continue}}if(l==="["){const w=e.indexOf("]",o+1);if(w>o+1&&e[w+1]==="("){const g=e.indexOf(")",w+2);if(g>w+2){const f=e.slice(o+1,w),y=e.slice(w+2,g),b=Ry(f,y,t);if(b){i(o),n+=b.html,s=!0,o=g+1,r=o;continue}}}}const u=wc(e,o),d=u?null:yc(e,o),m=u??d;if(m){i(o),n+=m.html,s=!0,o=m.end,r=o;continue}const h=e.startsWith("**",o)?"**":e.startsWith("__",o)?"__":null;if(h){const w=e.indexOf(h,o+2);if(w>o+2){i(o);const g=ht(e.slice(o+2,w),t);n+=`<strong>${g.html}</strong>`,s=!0,o=w+2,r=o;continue}}o+=1}return i(e.length),{html:n,changed:s}}function $s(e){return e==="+"?"fixed-font-diff-added":e==="-"?"fixed-font-diff-removed":e===" "?"fixed-font-diff-context":""}function Fs(e){return`<span class="fixed-font-diff-gutter">${e===""||e===" "?"&nbsp;":Ce(e)}</span>`}function Ny(e,t,n={}){var g,f;const s=e[t],r=e[t+1];if(!s||!Ps(s.content))return null;const o=!!r&&gs(r.content);let i=o?t+2:t+1;for(;i<e.length&&Ps(((g=e[i])==null?void 0:g.content)??"")&&!(i+1<e.length&&gs(((f=e[i+1])==null?void 0:f.content)??""));)i+=1;if(!o&&i-t<2)return null;const l=o?kn(r.content).map(Ty):[],u=o?e.slice(t+2,i).filter(y=>!gs(y.content)):e.slice(t,i),d=e.slice(t,i).some(y=>y.prefix!==""),m=(y,b,x)=>{const _=l[x],M=_?` style="text-align: ${_}"`:"";return`<${y}${M}>${ht(b,n).html}</${y}>`},h=o?(()=>{const y=kn(s.content).map((x,_)=>m("th",x,_)).join(""),b=d?`<th class="fixed-font-diff-gutter-cell">${Fs(s.prefix)}</th>`:"";return`<thead><tr class="${$s(s.prefix)}">${b}${y}</tr></thead>`})():"",w=u.map(y=>{const b=kn(y.content).map((_,M)=>m("td",_,M)).join(""),x=d?`<td class="fixed-font-diff-gutter-cell">${Fs(y.prefix)}</td>`:"";return`<tr class="${$s(y.prefix)}">${x}${b}</tr>`}).join("");return{end:i,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${h}<tbody>${w}</tbody></table></div>`}}function Iy(e,t,n){var m;if(n)return null;const r=(((m=e[t])==null?void 0:m.content.trim())??"").match(/^[\w.-]+\[(\d+)\]\{[^}]*\}:$/);if(!r)return null;const o=t+1+Number(r[1]);if(o>e.length)return null;const i=Tl(e.slice(t,o).map(h=>h.content).join(`
68
+ `)),l=(i==null?void 0:i.length)===1?i[0]:void 0;if(!l)return null;const u=`<thead><tr>${l.columns.map(h=>`<th>${Ce(h)}</th>`).join("")}</tr></thead>`,d=l.rows.map(h=>`<tr>${h.map(w=>`<td>${Ce(w)}</td>`).join("")}</tr>`).join("");return{end:o,html:`<div class="fixed-font-markdown-block"><table class="fixed-font-markdown-table">${u}<tbody>${d}</tbody></table></div>`}}function Py(e,t={}){var l;const n=/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/.exec(e);if(n!=null&&n[1]&&n[2])return{html:ht(n[2],t).html,changed:!0,className:`fixed-font-markdown-heading fixed-font-markdown-heading-${n[1].length}`};if(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/.test(e))return{html:'<span class="fixed-font-markdown-rule" aria-hidden="true"></span>',changed:!0,className:"fixed-font-markdown-rule-line"};const s=/^\s{0,3}>\s?(.*)$/.exec(e);if(s)return{html:ht(s[1]??"",t).html,changed:!0,className:"fixed-font-markdown-blockquote"};const r=/^(\s*)([-*+]|\d+[.)])\s+(.+)$/.exec(e);if(r!=null&&r[2]&&r[3]){const u=((l=r[1])==null?void 0:l.length)??0,d=r[2].length+1;return{html:`<span class="fixed-font-markdown-list-marker">${/^\d/.test(r[2])?Ce(r[2]):"&bull;"}</span><span class="fixed-font-markdown-list-body">${ht(r[3],t).html}</span>`,changed:!0,className:"fixed-font-markdown-list-line",style:`--fixed-font-list-indent-ch:${u};--fixed-font-list-marker-ch:${d};`}}const o=/^(\s+)(\S[\s\S]*)$/.exec(e);if(o!=null&&o[1]&&o[2]){const u=ht(o[2],t);return{html:`<span class="fixed-font-leading-indent" style="--fixed-font-leading-ch:${o[1].length};"></span>${u.html}`,changed:u.changed}}return ht(e,t)}function Sc(e,t,n){var u,d,m;const s=(u=e[t])==null?void 0:u.content.trim(),r=s==="$$"?"$$":s==="\\["?"\\]":null;if(!r)return null;let o=t+1;for(;o<e.length&&((d=e[o])==null?void 0:d.content.trim())!==r;)o+=1;if(o>=e.length)return null;const i=e.slice(t+1,o).map(h=>h.content).join(`
69
+ `).trim();if(!i)return null;const l=Pn(i,!0);if(n){const h=e.slice(t,o+1),w=((m=h[0])==null?void 0:m.prefix)??"";return h.some(g=>g.prefix!==w)?null:{end:o+1,html:dr({prefix:w},{className:"fixed-font-markdown-display-math",html:l})}}return{end:o+1,html:l}}function dr(e,t){const n=["fixed-font-rendered-line",$s(e.prefix),t.className].filter(Boolean).join(" "),s=t.style?` style="${t.style}"`:"";return`<div class="${n}">${Fs(e.prefix)}<div class="fixed-font-rendered-line__content"${s}>${t.html}</div></div>`}function $y(e){const t=lr(e).replace(/\r\n/g,`
70
+ `).split(`
71
+ `).map(o=>bc(o,!0));let n="",s=!1,r=0;for(;r<t.length;){const o=Sc(t,r,!0);if(o){n+=o.html,s=!0,r=o.end;continue}const i=t[r];if(!i){r+=1;continue}const l=xc(i.content);n+=dr(i,l),l.changed&&(s=!0),r+=1}return{html:n,changed:s}}function Fy(e,t={}){const n=lr(e),s=t.baseFilePath??Ly(n),r=t.diffAware??Ay(n);if(!r&&tf(n).some(m=>m.kind!=="text"))return{html:Ce(n),changed:!1};const o={...t,baseFilePath:s},i=n.replace(/\r\n/g,`
72
+ `).split(`
73
+ `).map(m=>bc(m,r));let l="",u=!1,d=0;for(;d<i.length;){const m=Sc(i,d,r);if(m){l+=m.html,m.end<i.length&&(l+=`
74
+ `),u=!0,d=m.end;continue}const h=Iy(i,d,r);if(h){l+=h.html,u=!0,d=h.end;continue}const w=Ny(i,d,o);if(w){l+=w.html,u=!0,d=w.end;continue}const g=i[d];if(!g){d+=1;continue}const f=Py(g.content,o);f.changed&&(u=!0),r?l+=dr(g,f):(l+=f.html,d<i.length-1&&(l+=`
75
+ `)),d+=1}return{html:l,changed:u}}function $n(e,t={}){return ji("fixed-font-rich-content",()=>({...vc(e),diffAware:t.diffAware??null,hasProjectId:!!t.projectId,hasBaseFilePath:!!t.baseFilePath}),()=>Fy(e,t))}function By(e,t){return t==="themed"?e:e.replace(/ data-tooltip="([^"]*)"/g,(n,s)=>` title="${s}"`)}function jv({sourceText:e,sourceView:t,renderRenderedView:n,diffAware:s,baseFilePath:r,initialMode:o,precomputedRendered:i,renderMode:l="rich",projectPathLinks:u}){const d=Vs(),m=Bn(),h=Nt(),w=Ra(),g=xi(r),[f,y]=a.useState(null),b=a.useRef(null),x=a.useMemo(()=>lr(e),[e]),_=a.useMemo(()=>m?ar(m):void 0,[m]),M=a.useMemo(()=>i??(l==="math"?jy(e,{diffAware:s}):$n(e,{diffAware:s,projectId:d==null?void 0:d.projectId,projectPath:(d==null?void 0:d.projectPath)??void 0,baseFilePath:r,basePath:h,publicShare:m,projectPathLinks:u})),[i,e,l,s,d==null?void 0:d.projectId,d==null?void 0:d.projectPath,r,h,m,u]),{showRendered:C,toggleLocalMode:S}=Ud(M.changed,{initialMode:o,renderWhenDisabled:!1,resetDependencies:[e,l]}),{btnRef:v,handleClick:L}=Jd(C,S),p=a.useMemo(()=>{var k;const j=By(M.html,w);return Ei(j,g.state==="ready"&&((k=g.result)==null?void 0:k.status)==="ready"?g.result.artifact:void 0).html},[g,M.html,w]);a.useEffect(()=>{const j=b.current;if(!(!j||!x.trim()))return si(j,x)},[x]);const E=a.useCallback(j=>{var A,$;const k=($=(A=j.target)==null?void 0:A.closest)==null?void 0:$.call(A,"a[data-fixed-font-file-path]");k&&(j.button!==0||j.metaKey||j.ctrlKey||j.shiftKey||j.altKey||(j.preventDefault(),j.stopPropagation(),y({filePath:k.dataset.fixedFontFilePath??"",href:k.getAttribute("href")})))},[]),T=a.useCallback(j=>{const k=b.current,A=k?Fn(k).map(P=>P.markdown).join(`
76
+
77
+ `):"";gl(j.nativeEvent,j.currentTarget)&&A&&j.clipboardData.setData("text/plain",A)},[]),I=(d==null?void 0:d.projectId)??(m==null?void 0:m.projectId)??"";return c.jsxs("div",{ref:b,className:"fixed-font-render-toggle","data-render-mode":C&&M.changed?"rendered":"source",children:[C&&M.changed?c.jsx("div",{onClick:E,onCopy:T,children:n(p)}):t,M.changed&&c.jsx("button",{ref:v,type:"button",className:`fixed-font-render-toggle__button ${C?"is-rendered":""}`,onClick:L,"aria-label":C?"Show source":"Show rendered view",title:C?"Show source":"Show rendered view","aria-pressed":C,children:c.jsx(Ju,{})}),f&&I!==""&&c.jsx(Xt,{projectId:I,filePath:f.filePath,source:_,openInNewTabUrl:f.href,onClose:()=>y(null)})]})}function Dy(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:[c.jsx("path",{d:"M21 11a9 9 0 0 1-9 9 10 10 0 0 1-4-.9L3 21l1.8-5A9 9 0 1 1 21 11Z"}),c.jsx("path",{d:"M9.6 8a2.5 2.5 0 0 1 4.8 1c0 1.7-2.4 1.7-2.4 3.5M12 15h.01"})]})}function Oy({question:e,showDismissed:t,state:n}){var h,w;const{t:s}=je(),[r,o]=a.useState(!1),i=a.useRef(null),l=a.useRef(!1),u=()=>{i.current&&clearTimeout(i.current),i.current=null};a.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const d=((h=n.records[e.id])==null?void 0:h.dismissed)===!0,m=()=>{n.update(e.id,{dismissed:!d}),o(!1)};return c.jsxs("li",{className:J.menuRow,children:[c.jsx("span",{className:J.turnAge,role:"img","aria-label":s("asyncQuestionTurnsAgo",{count:e.age}),children:e.age}),c.jsxs("div",{className:J.previewBox,children:[c.jsxs("button",{type:"button",className:J.preview,title:e.title,"aria-label":e.title,onClick:()=>{if(l.current){l.current=!1;return}n.open(e)},onContextMenu:g=>{g.preventDefault(),u(),o(!0)},onTouchStart:()=>{l.current=!1,u(),i.current=setTimeout(()=>{l.current=!0,o(!0)},450)},onTouchMove:u,onTouchEnd:u,onTouchCancel:u,children:[c.jsx("span",{className:J.previewText,children:e.title}),!((w=n.records[e.id])!=null&&w.seen)&&c.jsx("span",{className:J.unseen,role:"img","aria-label":s("asyncQuestionUnseen")})]}),c.jsx("button",{type:"button",className:J.dismiss,onClick:m,"aria-label":s(d?"asyncQuestionRestore":"asyncQuestionDismiss",{question:e.title}),children:d&&t?"↶":"×"}),r&&c.jsx("div",{className:J.rowMenu,role:"menu",children:c.jsx("button",{type:"button",role:"menuitem",onClick:m,children:s(d?"asyncQuestionRestoreShort":"asyncQuestionDismissShort")})})]})]})}function Av({overflow:e=!1,compact:t="none",inventory:n,groupTitles:s,omitted:r=!1}){const o=Ks(),i=n??o,{t:l}=je(),u=a.useRef(null),d=a.useRef(null),m=a.useRef(null),[h,w]=a.useState(!1),[g,f]=a.useState(!1),[y,b]=a.useState(!1),[x,_]=a.useState({left:8,bottom:0,width:360,maxHeight:400}),M=(i==null?void 0:i.questions.filter(j=>!Ws(i.records[j.id])))??[],C=M.filter(j=>{var k;return y||!((k=i==null?void 0:i.records[j.id])!=null&&k.dismissed)}),S=M.filter(j=>{var k;return!((k=i==null?void 0:i.records[j.id])!=null&&k.dismissed)}),v=S.filter(j=>{var k;return Mn(j.age,((k=i==null?void 0:i.records[j.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="recent"}),L=S.every(j=>{var k;return Mn(j.age,((k=i==null?void 0:i.records[j.id])==null?void 0:k.edits)??0,i==null?void 0:i.reminderTurns)==="retired"}),p=v.reduce((j,k)=>!j||k.age<=j.age?k:j,void 0),E=i==null?void 0:i.setMenuOpen,T=()=>{w(!1),E==null||E(!1)};if(a.useLayoutEffect(()=>{if(!h)return;const j=()=>{var B;const k=(B=u.current)==null?void 0:B.getBoundingClientRect();if(!k)return;const A=Math.min(520,window.innerWidth-16),$=!!n&&window.innerHeight-k.bottom>Math.min(280,k.top),P=$?window.innerHeight-k.bottom-14:k.top-16;_({left:Math.max(8,Math.min(k.right-A,window.innerWidth-A-8)),...$?{top:k.bottom+6}:{bottom:window.innerHeight-k.top+6},width:A,maxHeight:Math.max(100,Math.min(400,P))})};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[h,n]),a.useLayoutEffect(()=>{var k,A;if(!h)return;m.current&&(m.current.scrollTop=m.current.scrollHeight);const j=(k=d.current)==null?void 0:k.querySelectorAll(`button.${J.preview}`);(A=j==null?void 0:j[j.length-1])==null||A.focus({preventScroll:!0})},[h]),a.useEffect(()=>{if(!h)return;const j=A=>{var $,P;!(A.target instanceof Node)||($=d.current)!=null&&$.contains(A.target)||(P=u.current)!=null&&P.contains(A.target)||(w(!1),E==null||E(!1))},k=A=>{var $;A.key==="Escape"&&(A.preventDefault(),w(!1),E==null||E(!1),($=u.current)==null||$.focus({preventScroll:!0}))};return document.addEventListener("pointerdown",j),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",k)}},[h,E]),a.useEffect(()=>{(i==null?void 0:i.menuOpen)===!1&&w(!1)},[i==null?void 0:i.menuOpen]),!i||i.reminderTurns===0||i.questions.length===0||!e&&L&&!h&&!g)return null;const I=p?`${l(v.length===1?"asyncQuestionSingle":"asyncQuestionCount",{count:v.length})} · ${l(p.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:p.age})}`:l("asyncQuestionsTitle");return c.jsxs(c.Fragment,{children:[c.jsxs("button",{ref:u,onFocus:()=>f(!0),onBlur:()=>f(!1),type:"button",className:`${J.indicator} ${v.length?J.recent:""} ${e?J.overflowEntry:""}`,"aria-label":I,title:I,"aria-expanded":h,"aria-haspopup":"dialog",role:e?"menuitem":void 0,onClick:()=>{w(!h),E==null||E(!h)},onContextMenu:j=>{j.preventDefault(),j.stopPropagation(),w(!0),E==null||E(!0)},children:[c.jsx(Dy,{}),p&&!e?c.jsxs(c.Fragment,{children:[c.jsx("span",{children:v.length}),t!=="late"&&c.jsx("span",{children:l(v.length===1?"asyncQuestionWord":"asyncQuestionsWord")}),t==="none"&&c.jsxs("span",{children:["·"," ",l(p.age===1?"asyncQuestionOneTurnAgo":"asyncQuestionTurnsAgo",{count:p.age})]})]}):t!=="late"&&c.jsx("span",{children:l("asyncQuestionsTitle")})]}),h&&st.createPortal(c.jsxs("div",{ref:d,className:J.menu,style:x,role:"dialog","aria-label":l("asyncQuestionsTitle"),onKeyDown:j=>{var $,P;if(j.key!=="ArrowDown"&&j.key!=="ArrowUp")return;const k=[...(($=d.current)==null?void 0:$.querySelectorAll(`button.${J.preview}`))??[]],A=k.indexOf(document.activeElement);k.length&&(j.preventDefault(),(P=k[(A+(j.key==="ArrowDown"?1:-1)+k.length)%k.length])==null||P.focus())},children:[c.jsxs("div",{className:J.menuHeading,children:[c.jsx("strong",{children:l("asyncQuestionsTitle")}),c.jsx("button",{type:"button",className:J.dismiss,"aria-label":l("asyncQuestionCloseMenu"),onClick:T,children:"×"})]}),c.jsx("ul",{ref:m,className:J.questionList,children:C.map((j,k)=>{var A,$,P;return c.jsxs(a.Fragment,{children:[(s==null?void 0:s.has(j.id))&&(k===0||((A=s.get(C[k-1].id))==null?void 0:A.id)!==(($=s.get(j.id))==null?void 0:$.id))&&c.jsx("li",{className:J.groupHeading,children:(P=s.get(j.id))==null?void 0:P.title}),c.jsx(Oy,{question:j,showDismissed:y,state:{...i,open:B=>{T(),i.open(B)}}})]},j.id)})}),C.length===0&&c.jsx("p",{children:l("asyncQuestionsNone")}),r&&c.jsx("p",{className:J.hint,children:l("asyncQuestionsEarlierOmitted")}),c.jsx("button",{type:"button",className:J.secondary,onClick:()=>b(!y),children:l(y?"asyncQuestionHideDismissed":"asyncQuestionShowDismissed")})]}),document.body)]})}function Hy({question:e}){const t=Ks(),{t:n}=je(),s=a.useRef(null),[r,o]=a.useState(!1),i=t.records[e.id],l=t.activeId===e.id,u=t.submittingId===e.id,d=Ws(i),m=t.update,h=a.useMemo(()=>$n(e.title,{diffAware:!1}).html,[e.title]);a.useEffect(()=>{if(i!=null&&i.seen||!s.current)return;let g=!1;const f=()=>{g&&!document.hidden&&m(e.id,{seen:!0})},y=new IntersectionObserver(([b])=>{g=((b==null?void 0:b.intersectionRatio)??0)>=.6,f()},{threshold:.6});return y.observe(s.current),document.addEventListener("visibilitychange",f),()=>{y.disconnect(),document.removeEventListener("visibilitychange",f)}},[e.id,i==null?void 0:i.seen,m]);const w=async g=>{o(!1);try{await t.submit(e,g)||o(!0)}catch{o(!0)}};return c.jsxs("div",{className:`${J.inlineQuestion} ${l?J.activeQuestion:""}`,"data-async-question-reply":e.id,children:[c.jsx("div",{ref:s,children:c.jsx(Gs,{className:J.questionTitle,html:h})}),e.options.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("p",{className:J.hint,children:n("asyncQuestionClickToSend")}),c.jsx("ul",{className:J.options,children:e.options.map((g,f)=>c.jsx("li",{children:c.jsxs("button",{type:"button",disabled:u||d,onClick:()=>void w(g),children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:g})]})},`${f}:${g}`))})]}),d?c.jsx("p",{className:J.sent,children:i!=null&&i.quoted?n("asyncQuestionReplyQuoted"):n("asyncQuestionReplySent",{answer:i.answer})}):c.jsxs(c.Fragment,{children:[!l&&c.jsx("button",{type:"button",className:J.secondary,onClick:()=>t.open(e),children:n("asyncQuestionReply")}),l&&c.jsxs("form",{className:J.replyForm,onSubmit:g=>{g.preventDefault(),!(u||!(i!=null&&i.draft.trim()))&&w((i==null?void 0:i.draft)??"")},children:[c.jsx("textarea",{rows:3,value:(i==null?void 0:i.draft)??"","aria-label":n("asyncQuestionReplyTo",{question:e.title}),placeholder:n("asyncQuestionReplyPlaceholder"),readOnly:u,onKeyDown:g=>{var f;g.key!=="Enter"||g.shiftKey||g.nativeEvent.isComposing||g.keyCode===229||(g.preventDefault(),g.repeat||(f=g.currentTarget.form)==null||f.requestSubmit())},onChange:g=>m(e.id,{draft:g.target.value})}),c.jsxs("div",{className:J.replyActions,children:[c.jsx("button",{type:"button",className:`${J.secondary} ${J.iconAction}`,onClick:t.returnToPrevious,"aria-label":n("asyncQuestionBack"),title:n("asyncQuestionBack"),children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"m10 5-7 7 7 7M3 12h18"})})}),c.jsx("button",{type:"submit",className:J.send,disabled:u||!(i!=null&&i.draft.trim()),children:n(u?"asyncQuestionSending":"asyncQuestionSend")})]})]}),c.jsx("button",{type:"button",className:`${J.secondary} ${J.iconAction}`,onClick:()=>t.quote(e),"aria-label":n("asyncQuestionQuoteMain"),title:n("asyncQuestionQuoteMain"),children:c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("path",{d:"m10 8 4 4-4 4"})]})})]}),r&&c.jsx("p",{role:"alert",className:J.error,children:n("asyncQuestionSendFailed")})]})}function Tv({renderId:e,fallback:t}){const n=Ks(),s=(n==null?void 0:n.questions.filter(r=>r.renderId===e))??[];return s.length?c.jsx(c.Fragment,{children:s.map(r=>c.jsx(Hy,{question:r},r.id))}):t}const Cc=1600,Nv=`${Cc}px 0px`;function Iv(e,t=Cc){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}const Vy=180*1e3;function Pv(e,t,n,s){return`${e.replace(/\/$/,"")}/projects/${t}/sessions/${n}/agents/${encodeURIComponent(s)}`}function $v(e,t){return e.title||e.agentType||t}function Fv(...e){for(const t of e)if(t)return t;return[]}const Uy=300*1e3;function Bv(e){const t=new Map;let n=Number.NEGATIVE_INFINITY;for(const s of e){const r=Date.parse(s.updatedAt);Number.isFinite(r)&&r>n&&(n=r)}for(const s of e){const r=Date.parse(s.updatedAt);if(!Number.isFinite(r)||n===Number.NEGATIVE_INFINITY){t.set(s.id,"older");continue}const o=n-r;t.set(s.id,o===0?"latest":o<Uy?"recent":"older")}return t}function Dv(e,t,n=Date.now()){return t!=="in-turn"?0:e.filter(s=>{const r=Date.parse(s.updatedAt);return!Number.isNaN(r)&&n-r<Vy}).length}export{bo as $,Av as A,sf as B,kh as C,sr as D,mf as E,zw as F,ro as G,Xh as H,zh as I,cs as J,Kh as K,ap as L,Gs as M,kl as N,nr as O,qt as P,Mf as Q,Ju as R,Jf as S,Nm as T,vv as U,yv as V,pv as W,gv as X,_v as Y,kv as Z,Gi as _,Bu as a,Ai as a$,iv as a0,Gm as a1,Xm as a2,bf as a3,qh as a4,$i as a5,mv as a6,Zs as a7,uv as a8,av as a9,nv as aA,Cl as aB,rv as aC,ov as aD,Sv as aE,wm as aF,bv as aG,Cv as aH,xi as aI,Ei as aJ,Sd as aK,Ud as aL,aw as aM,ld as aN,Xt as aO,Rv as aP,Cy as aQ,ji as aR,tf as aS,jv as aT,tw as aU,$n as aV,Zd as aW,Xp as aX,Ey as aY,Ls as aZ,us as a_,lv as aa,Gl as ab,xg as ac,Mv as ad,yg as ae,Lv as af,vg as ag,$o as ah,Po as ai,mg as aj,pg as ak,gg as al,wg as am,Zi as an,cm as ao,rm as ap,Bv as aq,Pm as ar,Qm as as,Iv as at,Gu as au,Fv as av,Dv as aw,Ev as ax,hv as ay,fv as az,fw as b,Ao as b0,Ki as b1,Jd as b2,Ad as b3,sv as b4,ev as b5,tv as b6,Nv as b7,Tv as b8,xv as c,Oi as d,hh as e,Gh as f,Qh as g,Sm as h,Il as i,Pv as j,zl as k,Zl as l,dv as m,Eo as n,py as o,$v as p,vo as q,jy as r,cv as s,Vd as t,Hi as u,Ks as v,km as w,wv as x,nf as y,Gd as z};