@p4code/cli 0.9.9 → 0.9.10

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 (184) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-CQsXscQ2.mjs → binCli-CYcCQdSE.mjs} +25 -3
  3. package/dist/client/.vite/manifest.json +1125 -1125
  4. package/dist/client/assets/{2NI2N5EU-aTesTRUs.js → 2NI2N5EU-CTGx9SqE.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-fOcXoLqw.js → 4UO7MD6I-BjVL6foo.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-CVlBycCk.js → 5B3SVYGG-Cs9CtCwM.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-UdJh1ROk.js → 5GK6JWQ2-uCqJ5b6P.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-LpXLPis9.js → 5N7A7DKN-D8xYxzg8.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-pX1yQcrA.js → 5OC2THR4-B4_z8HL_.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-CTBX-e9M.js → 5S6HY5KT-BQM1ruT_.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-DL11cDPG.js → 6IMQ5BUJ-CkYA1m9F.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-TXqcGdqI.js → 6OLKWJ4F-B7EL2QRF.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-DNrMi93b.js → 74OO7NKP-3i4AYzMo.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-CwCbVMzG.js → 75O6YZUN-CFk80U2S.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-BuuKvNS0.js → 77XECAW3-DUjtpBc8.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BxNthVYO.js → ABYRPUBD-BobiH6Ib.js} +2 -2
  17. package/dist/client/assets/{AuthSurfaceShell-DCBmguf9.js → AuthSurfaceShell-PCmsqp7T.js} +2 -2
  18. package/dist/client/assets/{BB2UYUI2-Bg3EJQg5.js → BB2UYUI2-DnxMKjgT.js} +2 -2
  19. package/dist/client/assets/{BUM34MOA-CgVaLfn6.js → BUM34MOA-DNTynUxx.js} +2 -2
  20. package/dist/client/assets/{CEQABKGZ-BpDmef7u.js → CEQABKGZ-veHxvA1u.js} +2 -2
  21. package/dist/client/assets/{CXAC5362-uHOdbo6J.js → CXAC5362-BynYY6uD.js} +2 -2
  22. package/dist/client/assets/{ChatGptUsageButton-CcLiWo0d.js → ChatGptUsageButton-D-N8-zk6.js} +2 -2
  23. package/dist/client/assets/{ChatMarkdown-DQk9NI7y.js → ChatMarkdown-fdsQ0rQe.js} +5 -5
  24. package/dist/client/assets/{CodexSetupSection.logic-fnotucae.js → CodexSetupSection.logic-lS_hYW7M.js} +2 -2
  25. package/dist/client/assets/{CommandBlock-ConSzQ7T.js → CommandBlock-BFdf6yDf.js} +2 -2
  26. package/dist/client/assets/{ComposerPromptEditor-Dh9Y0crA.js → ComposerPromptEditor--x6yGPiW.js} +4 -4
  27. package/dist/client/assets/{ConnectionDiagnosisDetails-DIM-B35q.js → ConnectionDiagnosisDetails-BiLziJiH.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-9tvJLXhF.js → DRLTVNUE-BOhroau_.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-CXR9o7Qv.js → DYY6UVD2-Bpmvecid.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-Oy_RHjOo.js → DevicePanel-BgToYlYg.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-ct6xlJYm.js → DeviceSetup-CJ3rjcDw.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-C-L5yt6X.js → DiffCommentAnnotation-BkAROMry.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-C5oMLRG9.js → DiffFileTree-ERgpSLaE.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-CE2e4NYA.js → DiffPanel-DwPk2swZ.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-K9JsvPrH.js → DiffWorkerPoolProvider-BrhQktrm.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-xOusO8oo.js → EmbeddedDesign-DpSkJYii.js} +2 -2
  37. package/dist/client/assets/{FNOVOB4O-BmZ9pVZx.js → FNOVOB4O-Mdzaj7g-.js} +2 -2
  38. package/dist/client/assets/{FileDiff-BTNP8QcY.js → FileDiff-sbzjIw4Y.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-m6c5KXjS.js → FilePreviewPanel-BOnzRmKq.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-BTB3Pbv2.js → FoldedSettingsSection-DN1s3P5h.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-JiOhjq7U.js → HDGCDEEZ-Ylftf3gZ.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-Bd0iumEG.js → HSJLKHB7-BQqIHFzA.js} +2 -2
  43. package/dist/client/assets/JZOYTAAL-5fSSCfug.js +1 -0
  44. package/dist/client/assets/{K3MD6TGW-B2s2l_Ok.js → K3MD6TGW-C-WMFQa2.js} +2 -2
  45. package/dist/client/assets/{K7RP3OMA-DEvHDTPu.js → K7RP3OMA-Bv01V4PC.js} +2 -2
  46. package/dist/client/assets/{LHDIQX7Q-D06sm2YF.js → LHDIQX7Q-NSQFT8t0.js} +2 -2
  47. package/dist/client/assets/{LUXOKEGN-A74rm75g.js → LUXOKEGN-URYU7c_t.js} +2 -2
  48. package/dist/client/assets/{MathTypeset-Vm1FBYDj.js → MathTypeset-vloBebae.js} +2 -2
  49. package/dist/client/assets/{N3JZAHOW-BCbSRiUS.js → N3JZAHOW-B9_qgeJe.js} +2 -2
  50. package/dist/client/assets/{NUIALGQ3-DmGUeCU6.js → NUIALGQ3-CgK-ZGa2.js} +2 -2
  51. package/dist/client/assets/{NoProjectsHero-BBiWXq8t.js → NoProjectsHero-Bkfsk4qc.js} +2 -2
  52. package/dist/client/assets/{O65XPQGZ-859wHUVg.js → O65XPQGZ-DcczmOOs.js} +2 -2
  53. package/dist/client/assets/{O7XIQ6OM-BSsC7pLO.js → O7XIQ6OM-DBN8Ta1r.js} +2 -2
  54. package/dist/client/assets/{OFQON5FD-BjECyhxL.js → OFQON5FD-BAqD2M9W.js} +2 -2
  55. package/dist/client/assets/{P4ConnectAccountPages-Cqk-Frva.js → P4ConnectAccountPages-kTztZndM.js} +2 -2
  56. package/dist/client/assets/{P4ConnectSidebarSignIn-wL7BP9rR.js → P4ConnectSidebarSignIn-BLFNWeXr.js} +2 -2
  57. package/dist/client/assets/{PJQHF43J-CuSzd3x-.js → PJQHF43J-D1TwOPBO.js} +2 -2
  58. package/dist/client/assets/{PanelLayoutControls-DXgwWyzK.js → PanelLayoutControls-BL3qZRW6.js} +4 -4
  59. package/dist/client/assets/{PierreEntryIcon-CDSrlZTw.js → PierreEntryIcon-CcaKUQ_5.js} +2 -2
  60. package/dist/client/assets/{PreviewPanel-B7EzPl1x.js → PreviewPanel-CF9KdCOZ.js} +2 -2
  61. package/dist/client/assets/{ProjectDefaultsSettings-BRi9-O_X.js → ProjectDefaultsSettings-DC9sqe1A.js} +2 -2
  62. package/dist/client/assets/{ProjectFavicon-Cf1XjP8U.js → ProjectFavicon-6uv-3a7b.js} +3 -3
  63. package/dist/client/assets/{ProjectIconPickerDialog-DSRXK7Zv.js → ProjectIconPickerDialog-DrNrdWag.js} +2 -2
  64. package/dist/client/assets/{ProviderAuthTerminal-8VrYkUNI.js → ProviderAuthTerminal-BdestvKT.js} +2 -2
  65. package/dist/client/assets/{ProviderModelPicker-mxdF5wUN.js → ProviderModelPicker-Dx26TqdI.js} +2 -2
  66. package/dist/client/assets/{ProviderSettingsForm-ByFYLn1K.js → ProviderSettingsForm-B1ZiIcrJ.js} +2 -2
  67. package/dist/client/assets/{PullRequestCodeTab-DCUJxgcQ.js → PullRequestCodeTab-5JEE8HsL.js} +2 -2
  68. package/dist/client/assets/{RHNBAITX-Z04dR_uf.js → RHNBAITX-AZ9q_QDP.js} +2 -2
  69. package/dist/client/assets/{ReadOnlySourcePreview-CiVudVcz.js → ReadOnlySourcePreview-CSK6ee05.js} +2 -2
  70. package/dist/client/assets/{RenderErrorBoundary-C8jlNO8Q.js → RenderErrorBoundary-ImTUJEbS.js} +2 -2
  71. package/dist/client/assets/{SLD4V6NK-CTh_lt_F.js → SLD4V6NK-uXoZZAB2.js} +2 -2
  72. package/dist/client/assets/{ScheduledTasksSettings-DfwR9Auj.js → ScheduledTasksSettings-BDkh7pCI.js} +2 -2
  73. package/dist/client/assets/{ScopedSwitch-6K10bTo0.js → ScopedSwitch-IyBzdLBa.js} +2 -2
  74. package/dist/client/assets/{SelfImproveSettingsSection-DwtwZ9He.js → SelfImproveSettingsSection-DGcoA36F.js} +2 -2
  75. package/dist/client/assets/{SettingsPanels-BnfeCIPg.js → SettingsPanels-BfzvtrNj.js} +2 -2
  76. package/dist/client/assets/{SettingsPanels.logic-BM52qF-a.js → SettingsPanels.logic-xcOt84aX.js} +2 -2
  77. package/dist/client/assets/{SettingsScopeNotice-CPP-_wXt.js → SettingsScopeNotice-BSIkX2D-.js} +2 -2
  78. package/dist/client/assets/{SidebarStageBackdrop-ClK_nT_C.js → SidebarStageBackdrop-D7me9VdP.js} +2 -2
  79. package/dist/client/assets/{T3PCR2KE-O2OwSAZh.js → T3PCR2KE-B4buGw24.js} +2 -2
  80. package/dist/client/assets/{TKWO2OVW-BxZ4r_GJ.js → TKWO2OVW-B2GIBRnj.js} +2 -2
  81. package/dist/client/assets/{TSHNXIZL-6843lSfx.js → TSHNXIZL-CwVvoBmu.js} +2 -2
  82. package/dist/client/assets/{ThemeEditorPanel-B_Mpp-fO.js → ThemeEditorPanel-Z1t7Xzva.js} +2 -2
  83. package/dist/client/assets/{ThreadTerminalDrawer-3sb2Ksna.js → ThreadTerminalDrawer-CnO3UVOq.js} +2 -2
  84. package/dist/client/assets/{UQJE5E4I-DIek-a8V.js → UQJE5E4I-Bzqu0vVG.js} +2 -2
  85. package/dist/client/assets/{USNYFO5S-l_vgf0I4.js → USNYFO5S-C4Z9b1ks.js} +2 -2
  86. package/dist/client/assets/{Virtualizer-CttujTBW.js → Virtualizer-saguDIDi.js} +2 -2
  87. package/dist/client/assets/{WEVWDWVA-DASU9Cts.js → WEVWDWVA-C5c2236d.js} +2 -2
  88. package/dist/client/assets/{X5RFHQXM-B52DJ-qb.js → X5RFHQXM-NygNPjev.js} +2 -2
  89. package/dist/client/assets/{X62E3GBT-Ccgsn5Dj.js → X62E3GBT-qvvfx8FL.js} +2 -2
  90. package/dist/client/assets/{XBNEOJTC-BRptYPNn.js → XBNEOJTC-DAgGRRGR.js} +2 -2
  91. package/dist/client/assets/{YHV2MVVZ-D_wcLZ-W.js → YHV2MVVZ-PIsz4H0c.js} +2 -2
  92. package/dist/client/assets/{YURCZMG2-DP6lArrr.js → YURCZMG2-CAQz8Kb8.js} +2 -2
  93. package/dist/client/assets/{YVG2LODB-CgFYuKDa.js → YVG2LODB-Crh6Gk8v.js} +2 -2
  94. package/dist/client/assets/{_chat-Vh73A6rC.js → _chat-BO5aRu-j.js} +5 -5
  95. package/dist/client/assets/{_chat.design-_0R3HMjq.js → _chat.design-1RXhKj_3.js} +2 -2
  96. package/dist/client/assets/{_chat.index-DhmrbSHU.js → _chat.index-ij31rX59.js} +2 -2
  97. package/dist/client/assets/{_chat.new-Byb4mhMY.js → _chat.new-QYOVVQAv.js} +2 -2
  98. package/dist/client/assets/{_chat.pull-requests-BNzVcYEB.js → _chat.pull-requests-B8-W4w8K.js} +2 -2
  99. package/dist/client/assets/{assetUrls-d3y14MLX.js → assetUrls-5u2VAW_2.js} +2 -2
  100. package/dist/client/assets/{assets-FbkZMhUb.js → assets-dVntMNKj.js} +2 -2
  101. package/dist/client/assets/{browserHistoryStore-CjWZgU2Q.js → browserHistoryStore-AwPHr-9a.js} +2 -2
  102. package/dist/client/assets/{browserLinkTarget-IsSd9GTV.js → browserLinkTarget-CUvZuS7D.js} +2 -2
  103. package/dist/client/assets/{connect-agent-dJ-CRJsT.js → connect-agent-BJCTM1nf.js} +2 -2
  104. package/dist/client/assets/{connect-DyZ-pjcy.js → connect-wndN2LD9.js} +2 -2
  105. package/dist/client/assets/{design-CXl7HVrT.js → design-Cve-RO6N.js} +2 -2
  106. package/dist/client/assets/{device-MyE56wi2.js → device-ZhgWJyBN.js} +2 -2
  107. package/dist/client/assets/{diffRendering-COA7wG72.js → diffRendering-Dyda4rX5.js} +2 -2
  108. package/dist/client/assets/{dist-CYq41icZ.js → dist-DP18jjts.js} +2 -2
  109. package/dist/client/assets/{duoViewer-CjvM1rB0.js → duoViewer-BnfAzuzK.js} +2 -2
  110. package/dist/client/assets/{dynamic-BZ3kW5ih.js → dynamic-DXn8DtfU.js} +2 -2
  111. package/dist/client/assets/{embeddedScripts-BLmMNkyP.js → embeddedScripts-BMILAsdP.js} +2 -2
  112. package/dist/client/assets/{entities-D8ZKPC2e.js → entities-DCgQUDZp.js} +2 -2
  113. package/dist/client/assets/{fileLinks-CNAL-7G6.js → fileLinks-BlBUc4i_.js} +2 -2
  114. package/dist/client/assets/{fileTreeExpansion-B_6v-e30.js → fileTreeExpansion-B8yevc-B.js} +2 -2
  115. package/dist/client/assets/{getDiffFileInput-DovUC0XJ.js → getDiffFileInput-dJd1H35Q.js} +2 -2
  116. package/dist/client/assets/{guideRunStore-7uPQQ44U.js → guideRunStore-DksWd_Oc.js} +2 -2
  117. package/dist/client/assets/{index-DD6u-vDm.js → index-Bxk_RxGw.js} +3 -3
  118. package/dist/client/assets/{lazy-CXsQYM2D.js → lazy-DILJj7Gd.js} +4 -4
  119. package/dist/client/assets/{linkedPrompt-DgAytF6c.js → linkedPrompt-CE3amDef.js} +2 -2
  120. package/dist/client/assets/{main-CNcsYwUg.js → main-CVSzIqPv.js} +7 -7
  121. package/dist/client/assets/{mediaReference-DNNV5BY5.js → mediaReference-DMJ5Zay3.js} +2 -2
  122. package/dist/client/assets/{mediaSource-DI8dP4uu.js → mediaSource-UIArIbzY.js} +2 -2
  123. package/dist/client/assets/{onboarding-CyFz37eL.js → onboarding-pqbI8W1U.js} +2 -2
  124. package/dist/client/assets/{openFileInPreview-rYwhIeVk.js → openFileInPreview-x34grdQ6.js} +2 -2
  125. package/dist/client/assets/{p4ProjectFile-CT0gLoXX.js → p4ProjectFile-xLwkLebE.js} +2 -2
  126. package/dist/client/assets/{pair-BOq1UYDI.js → pair-C4lVdDUz.js} +2 -2
  127. package/dist/client/assets/{phoneViewer-BtDABBh2.js → phoneViewer-Cotavx5y.js} +2 -2
  128. package/dist/client/assets/{pierre-icons-LoH9zCdH.js → pierre-icons-CBskVugi.js} +2 -2
  129. package/dist/client/assets/{preview-D9IkIo7q.js → preview-Bw-Ffmn4.js} +2 -2
  130. package/dist/client/assets/{primary-DXTkE8Z6.js → primary-CIcP7bEP.js} +2 -2
  131. package/dist/client/assets/{primaryCloudLinkState-CZVS0Wwo.js → primaryCloudLinkState-Dwi-D0I7.js} +2 -2
  132. package/dist/client/assets/{projectFilesQueryState-Cl_MU7SH.js → projectFilesQueryState-02nlfyzQ.js} +2 -2
  133. package/dist/client/assets/{projectScriptEditor-CfiaAaXj.js → projectScriptEditor-CIDcf-KL.js} +2 -2
  134. package/dist/client/assets/{providerSkills-CCJGD2Js.js → providerSkills-DTVLY34_.js} +2 -2
  135. package/dist/client/assets/{pullRequestDetail.logic-4EhxvJSo.js → pullRequestDetail.logic-BLe7zsLi.js} +2 -2
  136. package/dist/client/assets/{pullRequests-DRm4lwgc.js → pullRequests-mcrrz3SF.js} +2 -2
  137. package/dist/client/assets/{queries-BGbR-fUx.js → queries-ByCVdESa.js} +2 -2
  138. package/dist/client/assets/{renderScheduler-3p9xZuHR.js → renderScheduler-CNepEPa2.js} +2 -2
  139. package/dist/client/assets/{runtime-CdX0UBlL.js → runtime-CZnPVuwS.js} +3 -3
  140. package/dist/client/assets/{runtime-S0tnrkvE.js → runtime-DEFP_0P0.js} +3 -3
  141. package/dist/client/assets/{scheduledTasksSettings.logic-CrhQwOvr.js → scheduledTasksSettings.logic-CTJ1Zr8Z.js} +2 -2
  142. package/dist/client/assets/{server-ELSEsqtb.js → server-BuS35bSu.js} +2 -2
  143. package/dist/client/assets/{session-DCntd6Nl.js → session-DIw-RcNy.js} +2 -2
  144. package/dist/client/assets/{session-logic-CbKDK1qZ.js → session-logic-B5D2SdWr.js} +2 -2
  145. package/dist/client/assets/{settings-CbkRsZQ6.js → settings-CTpjG14a.js} +2 -2
  146. package/dist/client/assets/{settings.appearance-BGbKeD2q.js → settings.appearance-Cq56uRT4.js} +2 -2
  147. package/dist/client/assets/settings.archived-D2NDpNIY.js +2 -0
  148. package/dist/client/assets/{settings.computer-use-Cl0y_o-b.js → settings.computer-use-J2r1Wt55.js} +2 -2
  149. package/dist/client/assets/{settings.connections-xy7hhFa0.js → settings.connections-DDjl99g3.js} +2 -2
  150. package/dist/client/assets/{settings.data-controls-Boy0foov.js → settings.data-controls-Kotba8vC.js} +2 -2
  151. package/dist/client/assets/{settings.decisions-DUCJDJZC.js → settings.decisions-DghPRQ02.js} +2 -2
  152. package/dist/client/assets/{settings.designs-DYuankA7.js → settings.designs-D-0dwYo4.js} +2 -2
  153. package/dist/client/assets/{settings.diagnostics-DgYvj0_x.js → settings.diagnostics-C1H_Oj2r.js} +2 -2
  154. package/dist/client/assets/{settings.general-CrvvO6VU.js → settings.general-c-32Nudd.js} +2 -2
  155. package/dist/client/assets/{settings.integrations-Do9x2dXf.js → settings.integrations-BBvK_SX4.js} +2 -2
  156. package/dist/client/assets/{settings.keybindings-Q_21VUQP.js → settings.keybindings-BIfUzprR.js} +2 -2
  157. package/dist/client/assets/{settings.open-source-licenses-Cnz72Gu0.js → settings.open-source-licenses-wmlqchzJ.js} +2 -2
  158. package/dist/client/assets/{settings.plugins-C9-DUFnM.js → settings.plugins-C1PnlzX1.js} +2 -2
  159. package/dist/client/assets/{settings.projects-BKMazKl9.js → settings.projects-BmJITbPY.js} +3 -3
  160. package/dist/client/assets/{settings.providers-ouat2Ci1.js → settings.providers-ELxTJwWk.js} +3 -3
  161. package/dist/client/assets/{settings.scheduled-tasks-DOmtQjNH.js → settings.scheduled-tasks-BGGcs-KK.js} +2 -2
  162. package/dist/client/assets/{settings.snap-shot-609BnJ2S.js → settings.snap-shot-CvbNcoJx.js} +2 -2
  163. package/dist/client/assets/{settings.source-control-D1LmFmrq.js → settings.source-control-k2lVK3Ho.js} +2 -2
  164. package/dist/client/assets/{settings.storage-CXdZfPhF.js → settings.storage-CxA7PNjV.js} +2 -2
  165. package/dist/client/assets/{settingsLayout-aLGl3ZXu.js → settingsLayout-BWJVQUbK.js} +2 -2
  166. package/dist/client/assets/{sidebarProjectGrouping-BAN1mSDk.js → sidebarProjectGrouping-CPb438r8.js} +2 -2
  167. package/dist/client/assets/{sourceControl-ChrSdv6h.js → sourceControl-DzD_N8hv.js} +2 -2
  168. package/dist/client/assets/{sourceControlClients-BDwX0klQ.js → sourceControlClients-BG_kFh61.js} +2 -2
  169. package/dist/client/assets/{terminalSessions-DdR_bXtX.js → terminalSessions-BxTpBnAL.js} +2 -2
  170. package/dist/client/assets/{toast-BNQWmVQ-.js → toast-rcFdQept.js} +2 -2
  171. package/dist/client/assets/{uiStateStore-Bo1Umjei.js → uiStateStore-DKTSAGd0.js} +2 -2
  172. package/dist/client/assets/{usage-BPmOvYDv.js → usage-C-EgFB5m.js} +2 -2
  173. package/dist/client/assets/{use-atom-command-REOTdDAa.js → use-atom-command-BETKz9Hv.js} +2 -2
  174. package/dist/client/assets/{useHandleNewThread-DYBNXS8y.js → useHandleNewThread-BoN4NqHy.js} +2 -2
  175. package/dist/client/assets/{useP4ConnectAuthPrompt-CGiX3TE7.js → useP4ConnectAuthPrompt-BXoWBt0U.js} +2 -2
  176. package/dist/client/assets/{usePullRequestActions-BOUPI3Y5.js → usePullRequestActions-D0-24Gox.js} +2 -2
  177. package/dist/client/assets/{useScopedModelAvailability-DD6NdaS0.js → useScopedModelAvailability-C44gQf2k.js} +2 -2
  178. package/dist/client/assets/{useSettings-BNjvPVd5.js → useSettings-4JwtKUFC.js} +2 -2
  179. package/dist/client/assets/{vcsRefInvalidation-BSyEzs8X.js → vcsRefInvalidation-aUafFWy3.js} +2 -2
  180. package/dist/client/assets/{welcome-CJLDvQwx.js → welcome-DORffgtg.js} +2 -2
  181. package/dist/client/index.html +1 -1
  182. package/package.json +1 -1
  183. package/dist/client/assets/JZOYTAAL-0AVwCd1G.js +0 -1
  184. package/dist/client/assets/settings.archived-DNDOvbYT.js +0 -2
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ad as i,I_ as a,L_ as o,Nd as s,Tb as c,_h as l,dr as u,ev as d,l as f,lE as p,sf as m,t as h,ts as g,yh as _}from"./utils-D19Exirm.js";import{R as v,W as y}from"./runtime-S0tnrkvE.js";import{D as b,K as x,S as ee,d as te,x as S}from"./useSettings-BNjvPVd5.js";import{f as C}from"./server-ELSEsqtb.js";import{i as w,n as ne}from"./session-DCntd6Nl.js";import{n as re}from"./query-D-IVadFI.js";import{t as T}from"./use-atom-command-REOTdDAa.js";import{n as E,t as D}from"./radio-group-DIOJb--u.js";import{t as ie}from"./input-yNgBXsRj.js";import{a as ae,c as O,i as oe,r as se,s as ce,t as le}from"./dialog-CKG1aUT3.js";import{x as k}from"./Icons-BP6jlahF.js";import{t as ue}from"./preview-oweHYD4S.js";import{S as A,t as de}from"./ChatGptUsageButton-CcLiWo0d.js";import{a as j}from"./settingsLayout-aLGl3ZXu.js";import{Er as M,ao as N,ba as fe,co as pe,io as me,no as he,ro as P,so as F,ya as ge}from"./main-CNcsYwUg.js";var I=e(t(),1),L=n(),R=e(r(),1);function z(e){let t=(0,L.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,R.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t[3]=i):i=t[3];let a=n??`Continue with ChatGPT`,o;return t[4]!==r||t[5]!==a?(o=(0,R.jsxs)(u,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function _e(e){let t=(0,L.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(ye),[s,c]=(0,I.useState)(null),l=s===`chatgpt-change-account`?s:o.find(e=>e.id===s)?.id??o[0]?.id??`chatgpt-change-account`,u=le,d;t[0]===i?d=t[1]:(d=e=>{e||i()},t[0]=i,t[1]=d);let f=ce,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsxs)(ae,{children:[(0,R.jsx)(O,{children:`Reconnect ChatGPT`}),(0,R.jsx)(se,{children:`On OpenAI, sign in with the account you choose here.`})]}),t[2]=p):p=t[2];let m=E,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>c(e),t[3]=h):h=t[3];let g=o.map(ve),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:`chatgpt-change-account`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`Use a different account`})]}),t[4]=_):_=t[4];let v;t[5]!==m||t[6]!==l||t[7]!==h||t[8]!==g?(v=(0,R.jsx)(`div`,{className:`px-6 pb-6`,children:(0,R.jsxs)(m,{"aria-label":`ChatGPT account to connect`,value:l,onValueChange:h,children:[g,_]})}),t[5]=m,t[6]=l,t[7]=h,t[8]=g,t[9]=v):v=t[9];let y;t[10]!==a||t[11]!==l?(y=(0,R.jsx)(oe,{children:(0,R.jsx)(z,{onClick:()=>a(l)})}),t[10]=a,t[11]=l,t[12]=y):y=t[12];let b;t[13]!==f||t[14]!==p||t[15]!==v||t[16]!==y?(b=(0,R.jsxs)(f,{children:[p,v,y]}),t[13]=f,t[14]=p,t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;return t[18]!==u||t[19]!==n||t[20]!==d||t[21]!==b?(x=(0,R.jsx)(u,{open:n,onOpenChange:d,children:b}),t[18]=u,t[19]=n,t[20]=d,t[21]=b,t[22]=x):x=t[22],x}function ve(e){return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:e.id}),(0,R.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function ye(e){return e.id.startsWith(`chatgpt-profile:`)}function be(e){let t=(0,L.c)(36),{environmentId:n,onClose:r,renderSetup:i,onAccountCreated:s}=e,c=w(n,d),l=te(n),p;t[0]===n?p=t[1]:(p=C.providersValueAtom(n),t[0]=n,t[1]=p);let m=g(p),h=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,I.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,ee]=(0,I.useState)(null),[S,re]=(0,I.useState)(!1),E=m?.find(e=>e.instanceId===x),D=A(E),ae=(0,I.useEffectEvent)(r);(0,I.useEffect)(()=>{D&&ae()},[D]);let O;t[4]!==b||t[5]!==n||t[6]!==_||t[7]!==s||t[8]!==r||t[9]!==S||t[10]!==l||t[11]!==h?(O=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=o.make(`codex_${f()}`);(await h({environmentId:n,input:{patch:{providerInstances:{...l.providerInstances,[e]:{driver:a.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(s?(s(e,b),r()):ee(e)),re(!1)},t[4]=b,t[5]=n,t[6]=_,t[7]=s,t[8]=r,t[9]=S,t[10]=l,t[11]=h,t[12]=O):O=t[12];let oe=O,se=le,ce=!D,k;t[13]===r?k=t[14]:(k=e=>{e||r()},t[13]=r,t[14]=k);let ue=N,de=x?b:`Add ChatGPT account`,M;t[15]===de?M=t[16]:(M=(0,R.jsx)(P,{title:de,description:`Each account has its own Codex instance and sign-in. Choose the other account on the sign-in page.`}),t[15]=de,t[16]=M);let fe=me,pe=x?E?.setup?i(x,E):(0,R.jsx)(j,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,R.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),oe()},children:(0,R.jsx)(j,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,R.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),F;t[17]!==fe||t[18]!==pe?(F=(0,R.jsx)(fe,{children:pe}),t[17]=fe,t[18]=pe,t[19]=F):F=t[19];let ge;t[20]!==c||t[21]!==x||t[22]!==_||t[23]!==r||t[24]!==S?(ge=(0,R.jsx)(he,{children:x?(0,R.jsx)(u,{variant:`outline`,onClick:r,children:`Finish later`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(u,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,R.jsx)(u,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!c,children:S?`Adding account…`:`Continue`})]})}),t[20]=c,t[21]=x,t[22]=_,t[23]=r,t[24]=S,t[25]=ge):ge=t[25];let z;t[26]!==ue||t[27]!==F||t[28]!==ge||t[29]!==M?(z=(0,R.jsxs)(ue,{size:`wide`,children:[M,F,ge]}),t[26]=ue,t[27]=F,t[28]=ge,t[29]=M,t[30]=z):z=t[30];let _e;return t[31]!==se||t[32]!==z||t[33]!==ce||t[34]!==k?(_e=(0,R.jsx)(se,{open:ce,onOpenChange:k,children:z}),t[31]=se,t[32]=z,t[33]=ce,t[34]=k,t[35]=_e):_e=t[35],_e}var xe=c(l),Se=c(_),Ce=/^[A-Za-z0-9_./:\\-]+$/;function we(e,t,n){return Ce.test(e)&&(n===`windows`||!e.includes(`\\`))?e:n===`windows`?`& '${e.replaceAll(`'`,`''`)}'`:n===`darwin`||n===`linux`?e.startsWith(`~/`)||e.startsWith(`~\\`)?`~/'${e.slice(2).replaceAll(`'`,`'"'"'`)}'`:`'${e.replaceAll(`'`,`'"'"'`)}'`:t}function Te(e){return e===void 0?`checking`:!e.enabled||e.status===`disabled`?`disabled`:!e.installed&&e.status===`warning`&&e.auth.status===`unknown`?`checking`:e.installed?e.auth.status===`unauthenticated`?`signIn`:e.status===`ready`?`ready`:`attention`:`install`}var B={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function V(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||B[Te(n)]>B[Te(e)])&&t.set(n.driver,n)}return t}var Ee={claudeAgent:{windows:`irm https://claude.ai/install.ps1 | iex`,posix:`curl -fsSL https://claude.ai/install.sh | bash`},codex:{windows:`irm https://chatgpt.com/codex/install.ps1 | iex`,posix:`curl -fsSL https://chatgpt.com/codex/install.sh | sh`}};function De(e,t){let n=Ee[e];return t===`windows`?n.windows:n.posix}function Oe(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=xe(r?.config??{});return`${we(p(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=Se(r?.config??{});return`${we(p(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var ke={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function H(e){if(!e)return{headline:`Checking provider status`,detail:`Waiting for the server to report installation and authentication details.`};if(!e.enabled||e.status===`disabled`)return{headline:`Disabled`,detail:e.message??`This provider is installed but disabled for new sessions in P4 Code.`};if(!e.installed)return{headline:`Not found`,detail:e.message??`CLI not detected on PATH.`};if(e.auth.status===`unauthenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Not authenticated · ${t}`:`Not authenticated`,detail:e.message??null}}if(e.status===`warning`)return{headline:`Needs attention`,detail:e.message??`The provider is installed, but the server could not fully verify it.`};if(e.status===`error`)return{headline:`Unavailable`,detail:e.message??`The provider failed its startup checks.`};if(e.auth.status===`authenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Authenticated · ${t}`:`Authenticated`,detail:e.message??null}}return{headline:`Available`,detail:e.message??null}}function U(e){if(!e)return null;let t=/^agy_acp_server_(\d{4})(\d{2})(\d{2})_\d+(?:_(\w+))?$/.exec(e);if(t){let[,e,n,r,i]=t;return`${e}-${n}-${r}${i?` ${i}`:``}`}return/^\d/.test(e)?`v${e}`:e}var Ae={graceful:`Limited support`,unsupported:`Unsupported version`,broken:`Known broken version`};function je(e,t,n=!0){let r=t?.latestVersionStatus===`broken`||t?.latestVersionStatus===`unsupported`;if(n&&t&&(t.status===`graceful`||t.status===`unsupported`||t.status===`broken`)){let n=t.recommendedVersion,i=U(n)??t.recommendedRange;return{title:Ae[t.status],detail:t.message??(i?`Use ${i} for full support.`:`Update for full support.`),updateCommand:n||r?null:e?.updateCommand??null,emphasis:t.status===`graceful`?`normal`:`strong`,targetVersion:n}}if(!e||e.status===`current`||e.status===`unknown`||r)return null;let i=`Update available`,a=e.latestVersion,o=U(a);return{title:i,detail:e.message??(o?`${i}: install ${o}.`:`${i}: install the latest provider version.`),updateCommand:e.updateCommand,emphasis:`normal`,targetVersion:null}}var Me=()=>void 0;function Ne(e){let t=(0,L.c)(11),[n,r]=(0,I.useState)(!1),a;t[0]===e.provider?a=t[1]:(a=Te(e.provider),t[0]=e.provider,t[1]=a);let o=a,s=e.enabled&&o===`ready`,c=e.provider?.auth.status===`authenticated`,l=o===`checking`,d;t[2]===e.provider?d=t[3]:(d=H(e.provider),t[2]=e.provider,t[3]=d);let f=d,p;return t[4]!==c||t[5]!==l||t[6]!==s||t[7]!==f||t[8]!==e||t[9]!==n?(p=e.mode===`existing`&&e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:s?e.provider?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:e.provider.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected with your Codex CLI.`:l?`Checking your Codex CLI...`:e.provider?.installed?f.headline:`Code with your ChatGPT subscription.`,control:s?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(i,{className:`size-3.5`}),`Ready`]}):l?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):c?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.headline}):(0,R.jsx)(z,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!c&&!s&&!l?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,onClick:()=>e.onModeChange(`existing`),children:`Use existing CLI`}):null}):e.mode===`existing`?null:e.provider?.setup===void 0?e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,R.jsx)(Ie,{}),control:(0,R.jsx)(u,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,R.jsx)(j,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,R.jsx)(Fe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=c,t[5]=l,t[6]=s,t[7]=f,t[8]=e,t[9]=n,t[10]=p):p=t[10],p}function Pe(e){let t=(0,L.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,d),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,R.jsx)(Fe,{environmentId:n,instanceId:e,provider:t,mode:`managed`,enabled:!0,readOnly:!a,autoStart:!0,onAutoStartConsumed:Me,onModeChange:Me,onSignInCancelled:r,allowExistingCli:!1},e),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(s=(0,R.jsx)(be,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=s):s=t[8],s}function Fe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:a,onModeChange:o,autoStart:s,onAutoStartConsumed:c,allowExistingCli:l=!0,presentation:d,displayName:f,onSignInCancelled:p}){let g={environmentId:e,input:{instanceId:t}},_=re(C.providerAuthState(g)),te=re(C.providerInstallState(g)),[w,ne]=(0,I.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:_.data,[ae,O]=(0,I.useState)(!1),[oe,se]=(0,I.useState)(`chatgpt`),ce=D?.methods?.find(e=>e.id===`chatgpt`)?.accountEmail,le=D?.methods?.find(e=>e.id===oe)?.accountEmail,k=D?.methods?.some(e=>e.id.startsWith(`chatgpt-profile:`)),A=D?.interaction?.type===`browser`?D.interaction.url:D?.authorizationUrl,N=te.data,me=ee(e),he=me!==null&&ue(new URL(me).hostname),P={reportFailure:!1,reportDefect:!1},L=T(C.startProviderAuth,P),ve=T(C.refreshProviders,P),ye=T(C.completeProviderAuth,P),be=T(C.cancelProviderAuth,P),xe=T(C.logoutProviderAuth,P),Se=T(C.startProviderInstall,P),Ce=T(C.cancelProviderInstall,P),we=T(C.chatGptReconnectProfile,P),Te=T(C.chatGptImportProfile,P),B=!w&&(!he||window.desktopBridge?.receiveProviderAuthCallback!==void 0),V=B&&!window.desktopBridge?.receiveProviderAuthCallback,Ee=b(),De=S(Ee),Oe=ee(Ee),ke=!he&&Ee&&De?.connection.phase===`connected`&&Oe&&ue(new URL(Oe).hostname)&&(window.desktopBridge!==void 0||ue(window.location.hostname))?Ee:null,H=new URL(window.location.href);H.pathname===`/welcome`&&(H.hash=`agents:${e}`),H.pathname===`/settings/providers`&&H.searchParams.set(`instanceId`,t);let U=V,Ae=(0,I.useId)(),[je,Me]=(0,I.useState)(!1),[Ne,Pe]=(0,I.useState)({flowId:``,value:``}),Fe=Ne.flowId===D?.flowId?Ne.value:``,[W,Re]=(0,I.useState)(!1),[ze,Be]=(0,I.useState)(null),Ve=(0,I.useRef)(!1),[He,Ue]=(0,I.useState)(null),G=(0,I.useRef)(null),K=(0,I.useRef)(!1),We=(0,I.useRef)(null),[Ge,Ke]=(0,I.useState)(!1),q=N?.installedVersion!=null,J=n?.auth.status===`authenticated`,qe=q&&N?.source!==`local`&&N?.version!=null&&N.version!==N.installedVersion,Je=ze!==null&&!J&&(D?.phase===`succeeded`||ze===`handoff`);(0,I.useEffect)(()=>{(J||D?.phase===`failed`||D?.phase===`cancelled`)&&Be(null)},[J,D?.phase]),(0,I.useEffect)(()=>{ze&&D?.phase===`succeeded`&&ve({environmentId:e,input:{instanceId:t}})},[ze,D?.phase,ve,e,t]);let Ye=s&&!Ge,Xe=ze===`sign-in`&&!J&&(D===null||D.phase===`idle`),Ze=Je||Xe||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,Y=N?.phase===`downloading`||N?.phase===`extracting`||N?.phase===`verifying`,X=Ye||Ze||W&&!Y,Z=a||!r||W||_.error!==null||te.error!==null,Q=W||Ze||Y,$=(0,I.useCallback)(async(e,t)=>{if(Ve.current)return!1;Ve.current=!0,Re(!0),Ue(null);let n=!1;try{let r=await e();if(r._tag===`Failure`){if(!v(r)){let e=y(r);Ue(e instanceof Error?e.message:`Codex setup failed. Try again.`)}}else n=!0,t?.(r.value)}catch{Ue(`Codex setup failed. Try again.`)}return Ve.current=!1,Re(!1),n},[]),Qe=(0,I.useId)(),$e=(0,I.useRef)(0),et=(0,I.useRef)(null),[tt,nt]=(0,I.useState)(!1),rt=(0,I.useCallback)(async n=>{let r=await $(()=>Te({environmentId:e,input:{instanceId:t,profile:n}}));r&&(Be(`handoff`),ne(null)),nt(!r)},[$,Te,e,t]);(0,I.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;et.current!==e&&(et.current=e,rt(E.data.profile))},[w,E.data,rt]),(0,I.useEffect)(()=>{w&&(E.error||E.data?.phase===`auth`&&[`failed`,`cancelled`].includes(E.data.state.phase))&&(Ue(E.data?.phase===`auth`?E.data.state.message??`ChatGPT sign-in could not finish. Try again.`:`ChatGPT sign-in on the primary environment was interrupted. Try again.`),ne(null))},[w,E.data,E.error]);let it=(0,I.useCallback)(()=>(Be(null),w?(ne(null),Promise.resolve()):$(()=>be({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,$,be,e,t,D]),at=(0,I.useCallback)(async(n=`chatgpt`)=>{if(Ve.current)return;K.current=!0,nt(!1),se(n);let r=new URL(window.location.href);if(r.pathname===`/welcome`&&(r.hash=`agents:${e}`),r.pathname===`/settings/providers`&&r.searchParams.set(`instanceId`,t),ke){let i=`${Qe}:${++$e.current}`;await $(()=>we({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:ke,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(K.current=!1)}else await $(()=>L({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:B?`client`:`server`}}),()=>Be(`sign-in`))||(K.current=!1)},[e,t,$,L,B,ke,we,Qe]),ot=(0,I.useCallback)(async(n=`chatgpt`)=>{Z||Q||(q&&!qe?await at(n):(G.current=n,await $(()=>Se({environmentId:e,input:{instanceId:t}}))||(G.current=null)))},[Z,Q,q,qe,at,$,Se,e,t]);(0,I.useEffect)(()=>{!s||Ge||Z||Q||N===null||!n?.setup?.canInstall||(Ke(!0),c(),ot())},[s,Ge,Z,Q,N,n?.setup?.canInstall,c,ot]),(0,I.useEffect)(()=>{if(!(!G.current||W||Y)){if(N?.phase===`failed`||N?.phase===`cancelled`)G.current=null;else if(q){let e=G.current;G.current=null,at(e)}}},[W,Y,N?.phase,q,at]);let st=(0,I.useRef)(null),ct=D?.flowId,lt=(0,I.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&B&&ct){if(st.current===n){await x().shell.openExternal(n);return}st.current=n;let i=await r(n);if(st.current!==n)return;st.current=null,await $(()=>ye({environmentId:e,input:{instanceId:t,flowId:ct,callbackUrl:i}}))}else await x().shell.openExternal(n)}catch{Ue(`Could not finish sign-in on this computer. Try again or paste the redirect URL below.`)}},[B,ct,$,ye,e,t]);(0,I.useEffect)(()=>{if(B&&A&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===A&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(A).catch(()=>void 0)}},[B,A]),(0,I.useEffect)(()=>{K.current&&D?.phase===`waiting`&&D.flowId&&A&&We.current!==D.flowId&&(We.current=D.flowId,K.current=!1,V||lt(A))},[D?.phase,D?.flowId,A,lt,V]);let ut=N?.phase===`downloading`?`Downloading ${(N.downloadedBytes/1e6).toFixed(1)}${N.totalBytes===null?``:` of ${(N.totalBytes/1e6).toFixed(1)}`} MB.`:N?.phase===`extracting`?`Installing Codex.`:N?.phase===`verifying`?`Checking Codex.`:q?`${N?.source===`local`?`Using your installed Codex`:`Managed by P4 Code`}${N?.installedVersion?` · v${N.installedVersion}`:``}.`:N?.message??`P4 Code downloads and manages Codex for you.`,dt=Je?`Finishing sign-in...`:Y?ut:X||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&le?`Continue as ${le} on OpenAI.`:D?.message??`Finish signing in in your browser.`:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`}),`.`]}):`Signed in with ChatGPT.`:ce??`Use your ChatGPT subscription.`,ft=U&&A&&D?.flowId&&fe(H.toString())?ge({authorizationUrl:A,returnUrl:H.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,R.jsx)(u,{size:`sm`,variant:V?`default`:`outline`,className:d===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?W||!tt:!A||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?rt(E.data.profile):A&&lt(A)},children:Je?`Finishing sign-in...`:E.data?.phase===`finished`?tt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?V?`Open ChatGPT sign-in`:`Open sign-in page`:d===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&A?(0,R.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,R.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,onSubmit:n=>{if(n.preventDefault(),!D.flowId||!Fe.trim())return;let r=Fe.trim(),i=D.flowId;$(()=>ye({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Pe({flowId:i,value:``})})},children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(ie,{"aria-label":`ChatGPT sign-in redirect URL`,type:`password`,autoComplete:`off`,placeholder:`Paste the URL from the sign-in tab`,value:Fe,maxLength:16384,disabled:W||a,onChange:e=>Pe({flowId:D.flowId??``,value:e.target.value})})}),(0,R.jsx)(u,{variant:`outline`,type:`submit`,disabled:W||a||!Fe.trim(),children:`Connect`})]}),V?null:(0,R.jsx)(`div`,{children:(0,R.jsxs)(u,{size:`xs`,variant:`ghost-muted`,onClick:()=>void x().shell.openExternal(A),children:[`Try sign-in in your browser`,(0,R.jsx)(m,{className:`size-3.5`})]})}),ft?(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,R.jsx)(u,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,R.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,R.jsx)(F,{open:je,children:(0,R.jsx)(pe,{children:(0,R.jsx)(`div`,{id:Ae,className:h(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=U?mt:mt?(0,R.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(Ie,{label:`Having trouble signing in?`,expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,R.jsx)(_e,{open:ae,methods:D?.methods??[],onClose:()=>O(!1),onSelect:e=>{O(!1),ot(D?.methods?.some(t=>t.id===e)?e:`chatgpt-change-account`)}}),vt=D?.phase===`idle`&&D.message?.startsWith(`Signed out locally.`)?D.message:null;if(d===`onboarding`){let r=vt??He??(_.error||te.error?`Could not read setup status. Reconnect and try again.`:N?.phase===`failed`?N.message:null);return(0,R.jsxs)(R.Fragment,{children:[_t,(0,R.jsxs)(Le,{title:f||n?.displayName||`Codex`,description:Y?ut:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected to ChatGPT.`:mt&&!U?(0,R.jsx)(Ie,{expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}):Ye||Xe||D?.phase===`starting`||D?.phase===`waiting`||W&&!Y?(0,R.jsx)(Ie,{}):X||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:J&&!Q?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(i,{className:`size-3.5`}),`Ready`]}):X?pt:(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:Y||W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:X&&!Je||Y?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:W||a,onClick:()=>{K.current=!1,G.current=null,w||X&&D?.flowId?it():N?.operationId&&$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:N.operationId}}))},children:`Cancel`}):!X&&!J&&k?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):!X&&!J&&l?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:a||Q,onClick:()=>o(`existing`),children:`Use existing CLI`}):null,children:[U?gt:ht(),r?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,R.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,R.jsx)(j,{title:`ChatGPT account`,description:dt,control:(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:X?(0,R.jsxs)(R.Fragment,{children:[pt,!Je&&(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:W||a,onClick:()=>{(w||D?.flowId)&&(K.current=!1,it(),p?.())},children:`Cancel`})]}):Y?(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:W||a,onClick:()=>{N?.operationId&&(G.current=null,$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:N.operationId}})))},children:`Cancel`}):J?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(u,{size:`sm`,variant:`outline`,disabled:Z||Q,onClick:()=>O(!0),children:`Change account`}),(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void $(()=>xe(g)),children:`Disconnect`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),k?(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):null]})})}),J?(0,R.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,R.jsx)(de,{})}):null,vt?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,R.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,He||_.error||te.error||N?.phase===`failed`?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive sm:px-4`,children:He??(N?.phase===`failed`?N.message:`Could not read Codex setup status. Reconnect and try again.`)}):null]})}function W(e){let t=(0,L.c)(20),{environmentId:n,instanceId:r,provider:i}=e,a;t[0]!==n||t[1]!==r?(a=C.providerInstallState({environmentId:n,input:{instanceId:r}}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=re(a),s=o.data?.executablePath??``,c=o.error?`Could not read runtime path`:`Not installed`,l;t[3]!==s||t[4]!==c?(l=(0,R.jsx)(j,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex binary path`,value:s,title:s,placeholder:c,disabled:!0})})}),t[3]=s,t[4]=c,t[5]=l):l=t[5];let u=i?.runtimePaths?.homePath??``,d=i?.runtimePaths?.homePath,f;t[6]!==u||t[7]!==d?(f=(0,R.jsx)(j,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex home path`,value:u,title:d,placeholder:`Unavailable`,disabled:!0})})}),t[6]=u,t[7]=d,t[8]=f):f=t[8];let p=i?.runtimePaths?.shadowHomePath?`Account-specific home sharing the Codex state above.`:`This instance uses the shared Codex home directly.`,m=i?.runtimePaths?.shadowHomePath??``,h=i?.runtimePaths?.shadowHomePath??void 0,g=i?.runtimePaths?`Not used`:`Unavailable`,_;t[9]!==g||t[10]!==m||t[11]!==h?(_=(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex shadow home path`,value:m,title:h,placeholder:g,disabled:!0})}),t[9]=g,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v;t[13]!==_||t[14]!==p?(v=(0,R.jsx)(j,{title:`Shadow home path`,description:p,control:_}),t[13]=_,t[14]=p,t[15]=v):v=t[15];let y;return t[16]!==v||t[17]!==l||t[18]!==f?(y=(0,R.jsxs)(R.Fragment,{children:[l,f,v]}),t[16]=v,t[17]=l,t[18]=f,t[19]=y):y=t[19],y}function Ie(e){let t=(0,L.c)(10),{label:n,expanded:r,controls:i,onToggle:a}=e,o=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!a){let e;return t[0]===o?e=t[1]:(e=(0,R.jsx)(`div`,{className:`leading-relaxed`,children:o}),t[0]=o,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,R.jsx)(s,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==a||t[8]!==u?(d=(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-sm text-left leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":`Having trouble signing in?`,"aria-expanded":c,"aria-controls":i,onClick:a,children:[o,u]}),t[4]=i,t[5]=c,t[6]=o,t[7]=a,t[8]=u,t[9]=d):d=t[9],d}function Le(e){let t=(0,L.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=I.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,R.jsx)(k,{className:`size-5 shrink-0 fill-foreground`}),t[2]=l):l=t[2];let u;t[3]===n?u=t[4]:(u=(0,R.jsx)(`h3`,{className:`text-sm font-medium`,children:n}),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=(0,R.jsx)(`div`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:r}),t[5]=r,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==a?(p=i||a?(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 has-[button]:w-full has-[button]:flex-col-reverse has-[button]:items-end sm:has-[button]:w-auto sm:has-[button]:flex-row sm:has-[button]:items-center`,children:[a,i]}):null,t[10]=i,t[11]=a,t[12]=p):p=t[12];let m;t[13]!==f||t[14]!==p?(m=(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l,f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c?h=t[17]:(h=c.length>0?(0,R.jsx)(`div`,{className:`ml-8 mt-2 flex flex-wrap items-center gap-2`,children:c}):null,t[16]=c,t[17]=h);let g;return t[18]!==m||t[19]!==h?(g=(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background px-4 py-4`,children:[m,h]}),t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Re(e){return typeof e==`object`&&e&&`setupMode`in e&&e.setupMode===`managed`?`managed`:`existing`}export{ke as a,U as c,Oe as d,V as f,Ne as i,Te as l,Pe as n,H as o,z as p,W as r,je as s,Re as t,De as u};
2
- //# sourceMappingURL=CodexSetupSection.logic-fnotucae.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ad as i,I_ as a,L_ as o,Nd as s,Tb as c,_h as l,dr as u,ev as d,l as f,lE as p,sf as m,t as h,ts as g,yh as _}from"./utils-D19Exirm.js";import{R as v,W as y}from"./runtime-DEFP_0P0.js";import{D as b,K as x,S as ee,d as te,x as S}from"./useSettings-4JwtKUFC.js";import{f as C}from"./server-BuS35bSu.js";import{i as w,n as ne}from"./session-DIw-RcNy.js";import{n as re}from"./query-D-IVadFI.js";import{t as T}from"./use-atom-command-BETKz9Hv.js";import{n as E,t as D}from"./radio-group-DIOJb--u.js";import{t as ie}from"./input-yNgBXsRj.js";import{a as ae,c as O,i as oe,r as se,s as ce,t as le}from"./dialog-CKG1aUT3.js";import{x as k}from"./Icons-BP6jlahF.js";import{t as ue}from"./preview-oweHYD4S.js";import{S as A,t as de}from"./ChatGptUsageButton-D-N8-zk6.js";import{a as j}from"./settingsLayout-BWJVQUbK.js";import{Er as M,ao as N,ba as fe,co as pe,io as me,no as he,ro as P,so as F,ya as ge}from"./main-CVSzIqPv.js";var I=e(t(),1),L=n(),R=e(r(),1);function z(e){let t=(0,L.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,R.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t[3]=i):i=t[3];let a=n??`Continue with ChatGPT`,o;return t[4]!==r||t[5]!==a?(o=(0,R.jsxs)(u,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function _e(e){let t=(0,L.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(ye),[s,c]=(0,I.useState)(null),l=s===`chatgpt-change-account`?s:o.find(e=>e.id===s)?.id??o[0]?.id??`chatgpt-change-account`,u=le,d;t[0]===i?d=t[1]:(d=e=>{e||i()},t[0]=i,t[1]=d);let f=ce,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsxs)(ae,{children:[(0,R.jsx)(O,{children:`Reconnect ChatGPT`}),(0,R.jsx)(se,{children:`On OpenAI, sign in with the account you choose here.`})]}),t[2]=p):p=t[2];let m=E,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>c(e),t[3]=h):h=t[3];let g=o.map(ve),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:`chatgpt-change-account`}),(0,R.jsx)(`span`,{className:`font-medium`,children:`Use a different account`})]}),t[4]=_):_=t[4];let v;t[5]!==m||t[6]!==l||t[7]!==h||t[8]!==g?(v=(0,R.jsx)(`div`,{className:`px-6 pb-6`,children:(0,R.jsxs)(m,{"aria-label":`ChatGPT account to connect`,value:l,onValueChange:h,children:[g,_]})}),t[5]=m,t[6]=l,t[7]=h,t[8]=g,t[9]=v):v=t[9];let y;t[10]!==a||t[11]!==l?(y=(0,R.jsx)(oe,{children:(0,R.jsx)(z,{onClick:()=>a(l)})}),t[10]=a,t[11]=l,t[12]=y):y=t[12];let b;t[13]!==f||t[14]!==p||t[15]!==v||t[16]!==y?(b=(0,R.jsxs)(f,{children:[p,v,y]}),t[13]=f,t[14]=p,t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;return t[18]!==u||t[19]!==n||t[20]!==d||t[21]!==b?(x=(0,R.jsx)(u,{open:n,onOpenChange:d,children:b}),t[18]=u,t[19]=n,t[20]=d,t[21]=b,t[22]=x):x=t[22],x}function ve(e){return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,R.jsx)(D,{value:e.id}),(0,R.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function ye(e){return e.id.startsWith(`chatgpt-profile:`)}function be(e){let t=(0,L.c)(36),{environmentId:n,onClose:r,renderSetup:i,onAccountCreated:s}=e,c=w(n,d),l=te(n),p;t[0]===n?p=t[1]:(p=C.providersValueAtom(n),t[0]=n,t[1]=p);let m=g(p),h=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,I.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,ee]=(0,I.useState)(null),[S,re]=(0,I.useState)(!1),E=m?.find(e=>e.instanceId===x),D=A(E),ae=(0,I.useEffectEvent)(r);(0,I.useEffect)(()=>{D&&ae()},[D]);let O;t[4]!==b||t[5]!==n||t[6]!==_||t[7]!==s||t[8]!==r||t[9]!==S||t[10]!==l||t[11]!==h?(O=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=o.make(`codex_${f()}`);(await h({environmentId:n,input:{patch:{providerInstances:{...l.providerInstances,[e]:{driver:a.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(s?(s(e,b),r()):ee(e)),re(!1)},t[4]=b,t[5]=n,t[6]=_,t[7]=s,t[8]=r,t[9]=S,t[10]=l,t[11]=h,t[12]=O):O=t[12];let oe=O,se=le,ce=!D,k;t[13]===r?k=t[14]:(k=e=>{e||r()},t[13]=r,t[14]=k);let ue=N,de=x?b:`Add ChatGPT account`,M;t[15]===de?M=t[16]:(M=(0,R.jsx)(P,{title:de,description:`Each account has its own Codex instance and sign-in. Choose the other account on the sign-in page.`}),t[15]=de,t[16]=M);let fe=me,pe=x?E?.setup?i(x,E):(0,R.jsx)(j,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,R.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),oe()},children:(0,R.jsx)(j,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,R.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),F;t[17]!==fe||t[18]!==pe?(F=(0,R.jsx)(fe,{children:pe}),t[17]=fe,t[18]=pe,t[19]=F):F=t[19];let ge;t[20]!==c||t[21]!==x||t[22]!==_||t[23]!==r||t[24]!==S?(ge=(0,R.jsx)(he,{children:x?(0,R.jsx)(u,{variant:`outline`,onClick:r,children:`Finish later`}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(u,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,R.jsx)(u,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!c,children:S?`Adding account…`:`Continue`})]})}),t[20]=c,t[21]=x,t[22]=_,t[23]=r,t[24]=S,t[25]=ge):ge=t[25];let z;t[26]!==ue||t[27]!==F||t[28]!==ge||t[29]!==M?(z=(0,R.jsxs)(ue,{size:`wide`,children:[M,F,ge]}),t[26]=ue,t[27]=F,t[28]=ge,t[29]=M,t[30]=z):z=t[30];let _e;return t[31]!==se||t[32]!==z||t[33]!==ce||t[34]!==k?(_e=(0,R.jsx)(se,{open:ce,onOpenChange:k,children:z}),t[31]=se,t[32]=z,t[33]=ce,t[34]=k,t[35]=_e):_e=t[35],_e}var xe=c(l),Se=c(_),Ce=/^[A-Za-z0-9_./:\\-]+$/;function we(e,t,n){return Ce.test(e)&&(n===`windows`||!e.includes(`\\`))?e:n===`windows`?`& '${e.replaceAll(`'`,`''`)}'`:n===`darwin`||n===`linux`?e.startsWith(`~/`)||e.startsWith(`~\\`)?`~/'${e.slice(2).replaceAll(`'`,`'"'"'`)}'`:`'${e.replaceAll(`'`,`'"'"'`)}'`:t}function Te(e){return e===void 0?`checking`:!e.enabled||e.status===`disabled`?`disabled`:!e.installed&&e.status===`warning`&&e.auth.status===`unknown`?`checking`:e.installed?e.auth.status===`unauthenticated`?`signIn`:e.status===`ready`?`ready`:`attention`:`install`}var B={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function V(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||B[Te(n)]>B[Te(e)])&&t.set(n.driver,n)}return t}var Ee={claudeAgent:{windows:`irm https://claude.ai/install.ps1 | iex`,posix:`curl -fsSL https://claude.ai/install.sh | bash`},codex:{windows:`irm https://chatgpt.com/codex/install.ps1 | iex`,posix:`curl -fsSL https://chatgpt.com/codex/install.sh | sh`}};function De(e,t){let n=Ee[e];return t===`windows`?n.windows:n.posix}function Oe(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=xe(r?.config??{});return`${we(p(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=Se(r?.config??{});return`${we(p(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var ke={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function H(e){if(!e)return{headline:`Checking provider status`,detail:`Waiting for the server to report installation and authentication details.`};if(!e.enabled||e.status===`disabled`)return{headline:`Disabled`,detail:e.message??`This provider is installed but disabled for new sessions in P4 Code.`};if(!e.installed)return{headline:`Not found`,detail:e.message??`CLI not detected on PATH.`};if(e.auth.status===`unauthenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Not authenticated · ${t}`:`Not authenticated`,detail:e.message??null}}if(e.status===`warning`)return{headline:`Needs attention`,detail:e.message??`The provider is installed, but the server could not fully verify it.`};if(e.status===`error`)return{headline:`Unavailable`,detail:e.message??`The provider failed its startup checks.`};if(e.auth.status===`authenticated`){let t=e.auth.label??e.auth.type;return{headline:t?`Authenticated · ${t}`:`Authenticated`,detail:e.message??null}}return{headline:`Available`,detail:e.message??null}}function U(e){if(!e)return null;let t=/^agy_acp_server_(\d{4})(\d{2})(\d{2})_\d+(?:_(\w+))?$/.exec(e);if(t){let[,e,n,r,i]=t;return`${e}-${n}-${r}${i?` ${i}`:``}`}return/^\d/.test(e)?`v${e}`:e}var Ae={graceful:`Limited support`,unsupported:`Unsupported version`,broken:`Known broken version`};function je(e,t,n=!0){let r=t?.latestVersionStatus===`broken`||t?.latestVersionStatus===`unsupported`;if(n&&t&&(t.status===`graceful`||t.status===`unsupported`||t.status===`broken`)){let n=t.recommendedVersion,i=U(n)??t.recommendedRange;return{title:Ae[t.status],detail:t.message??(i?`Use ${i} for full support.`:`Update for full support.`),updateCommand:n||r?null:e?.updateCommand??null,emphasis:t.status===`graceful`?`normal`:`strong`,targetVersion:n}}if(!e||e.status===`current`||e.status===`unknown`||r)return null;let i=`Update available`,a=e.latestVersion,o=U(a);return{title:i,detail:e.message??(o?`${i}: install ${o}.`:`${i}: install the latest provider version.`),updateCommand:e.updateCommand,emphasis:`normal`,targetVersion:null}}var Me=()=>void 0;function Ne(e){let t=(0,L.c)(11),[n,r]=(0,I.useState)(!1),a;t[0]===e.provider?a=t[1]:(a=Te(e.provider),t[0]=e.provider,t[1]=a);let o=a,s=e.enabled&&o===`ready`,c=e.provider?.auth.status===`authenticated`,l=o===`checking`,d;t[2]===e.provider?d=t[3]:(d=H(e.provider),t[2]=e.provider,t[3]=d);let f=d,p;return t[4]!==c||t[5]!==l||t[6]!==s||t[7]!==f||t[8]!==e||t[9]!==n?(p=e.mode===`existing`&&e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:s?e.provider?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:e.provider.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected with your Codex CLI.`:l?`Checking your Codex CLI...`:e.provider?.installed?f.headline:`Code with your ChatGPT subscription.`,control:s?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(i,{className:`size-3.5`}),`Ready`]}):l?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):c?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.headline}):(0,R.jsx)(z,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!c&&!s&&!l?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,onClick:()=>e.onModeChange(`existing`),children:`Use existing CLI`}):null}):e.mode===`existing`?null:e.provider?.setup===void 0?e.presentation===`onboarding`?(0,R.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,R.jsx)(Ie,{}),control:(0,R.jsx)(u,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,R.jsx)(j,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,R.jsx)(Fe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=c,t[5]=l,t[6]=s,t[7]=f,t[8]=e,t[9]=n,t[10]=p):p=t[10],p}function Pe(e){let t=(0,L.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,d),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,R.jsx)(Fe,{environmentId:n,instanceId:e,provider:t,mode:`managed`,enabled:!0,readOnly:!a,autoStart:!0,onAutoStartConsumed:Me,onModeChange:Me,onSignInCancelled:r,allowExistingCli:!1},e),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(s=(0,R.jsx)(be,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=s):s=t[8],s}function Fe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:a,onModeChange:o,autoStart:s,onAutoStartConsumed:c,allowExistingCli:l=!0,presentation:d,displayName:f,onSignInCancelled:p}){let g={environmentId:e,input:{instanceId:t}},_=re(C.providerAuthState(g)),te=re(C.providerInstallState(g)),[w,ne]=(0,I.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:_.data,[ae,O]=(0,I.useState)(!1),[oe,se]=(0,I.useState)(`chatgpt`),ce=D?.methods?.find(e=>e.id===`chatgpt`)?.accountEmail,le=D?.methods?.find(e=>e.id===oe)?.accountEmail,k=D?.methods?.some(e=>e.id.startsWith(`chatgpt-profile:`)),A=D?.interaction?.type===`browser`?D.interaction.url:D?.authorizationUrl,N=te.data,me=ee(e),he=me!==null&&ue(new URL(me).hostname),P={reportFailure:!1,reportDefect:!1},L=T(C.startProviderAuth,P),ve=T(C.refreshProviders,P),ye=T(C.completeProviderAuth,P),be=T(C.cancelProviderAuth,P),xe=T(C.logoutProviderAuth,P),Se=T(C.startProviderInstall,P),Ce=T(C.cancelProviderInstall,P),we=T(C.chatGptReconnectProfile,P),Te=T(C.chatGptImportProfile,P),B=!w&&(!he||window.desktopBridge?.receiveProviderAuthCallback!==void 0),V=B&&!window.desktopBridge?.receiveProviderAuthCallback,Ee=b(),De=S(Ee),Oe=ee(Ee),ke=!he&&Ee&&De?.connection.phase===`connected`&&Oe&&ue(new URL(Oe).hostname)&&(window.desktopBridge!==void 0||ue(window.location.hostname))?Ee:null,H=new URL(window.location.href);H.pathname===`/welcome`&&(H.hash=`agents:${e}`),H.pathname===`/settings/providers`&&H.searchParams.set(`instanceId`,t);let U=V,Ae=(0,I.useId)(),[je,Me]=(0,I.useState)(!1),[Ne,Pe]=(0,I.useState)({flowId:``,value:``}),Fe=Ne.flowId===D?.flowId?Ne.value:``,[W,Re]=(0,I.useState)(!1),[ze,Be]=(0,I.useState)(null),Ve=(0,I.useRef)(!1),[He,Ue]=(0,I.useState)(null),G=(0,I.useRef)(null),K=(0,I.useRef)(!1),We=(0,I.useRef)(null),[Ge,Ke]=(0,I.useState)(!1),q=N?.installedVersion!=null,J=n?.auth.status===`authenticated`,qe=q&&N?.source!==`local`&&N?.version!=null&&N.version!==N.installedVersion,Je=ze!==null&&!J&&(D?.phase===`succeeded`||ze===`handoff`);(0,I.useEffect)(()=>{(J||D?.phase===`failed`||D?.phase===`cancelled`)&&Be(null)},[J,D?.phase]),(0,I.useEffect)(()=>{ze&&D?.phase===`succeeded`&&ve({environmentId:e,input:{instanceId:t}})},[ze,D?.phase,ve,e,t]);let Ye=s&&!Ge,Xe=ze===`sign-in`&&!J&&(D===null||D.phase===`idle`),Ze=Je||Xe||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,Y=N?.phase===`downloading`||N?.phase===`extracting`||N?.phase===`verifying`,X=Ye||Ze||W&&!Y,Z=a||!r||W||_.error!==null||te.error!==null,Q=W||Ze||Y,$=(0,I.useCallback)(async(e,t)=>{if(Ve.current)return!1;Ve.current=!0,Re(!0),Ue(null);let n=!1;try{let r=await e();if(r._tag===`Failure`){if(!v(r)){let e=y(r);Ue(e instanceof Error?e.message:`Codex setup failed. Try again.`)}}else n=!0,t?.(r.value)}catch{Ue(`Codex setup failed. Try again.`)}return Ve.current=!1,Re(!1),n},[]),Qe=(0,I.useId)(),$e=(0,I.useRef)(0),et=(0,I.useRef)(null),[tt,nt]=(0,I.useState)(!1),rt=(0,I.useCallback)(async n=>{let r=await $(()=>Te({environmentId:e,input:{instanceId:t,profile:n}}));r&&(Be(`handoff`),ne(null)),nt(!r)},[$,Te,e,t]);(0,I.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;et.current!==e&&(et.current=e,rt(E.data.profile))},[w,E.data,rt]),(0,I.useEffect)(()=>{w&&(E.error||E.data?.phase===`auth`&&[`failed`,`cancelled`].includes(E.data.state.phase))&&(Ue(E.data?.phase===`auth`?E.data.state.message??`ChatGPT sign-in could not finish. Try again.`:`ChatGPT sign-in on the primary environment was interrupted. Try again.`),ne(null))},[w,E.data,E.error]);let it=(0,I.useCallback)(()=>(Be(null),w?(ne(null),Promise.resolve()):$(()=>be({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,$,be,e,t,D]),at=(0,I.useCallback)(async(n=`chatgpt`)=>{if(Ve.current)return;K.current=!0,nt(!1),se(n);let r=new URL(window.location.href);if(r.pathname===`/welcome`&&(r.hash=`agents:${e}`),r.pathname===`/settings/providers`&&r.searchParams.set(`instanceId`,t),ke){let i=`${Qe}:${++$e.current}`;await $(()=>we({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:ke,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(K.current=!1)}else await $(()=>L({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:B?`client`:`server`}}),()=>Be(`sign-in`))||(K.current=!1)},[e,t,$,L,B,ke,we,Qe]),ot=(0,I.useCallback)(async(n=`chatgpt`)=>{Z||Q||(q&&!qe?await at(n):(G.current=n,await $(()=>Se({environmentId:e,input:{instanceId:t}}))||(G.current=null)))},[Z,Q,q,qe,at,$,Se,e,t]);(0,I.useEffect)(()=>{!s||Ge||Z||Q||N===null||!n?.setup?.canInstall||(Ke(!0),c(),ot())},[s,Ge,Z,Q,N,n?.setup?.canInstall,c,ot]),(0,I.useEffect)(()=>{if(!(!G.current||W||Y)){if(N?.phase===`failed`||N?.phase===`cancelled`)G.current=null;else if(q){let e=G.current;G.current=null,at(e)}}},[W,Y,N?.phase,q,at]);let st=(0,I.useRef)(null),ct=D?.flowId,lt=(0,I.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&B&&ct){if(st.current===n){await x().shell.openExternal(n);return}st.current=n;let i=await r(n);if(st.current!==n)return;st.current=null,await $(()=>ye({environmentId:e,input:{instanceId:t,flowId:ct,callbackUrl:i}}))}else await x().shell.openExternal(n)}catch{Ue(`Could not finish sign-in on this computer. Try again or paste the redirect URL below.`)}},[B,ct,$,ye,e,t]);(0,I.useEffect)(()=>{if(B&&A&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===A&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(A).catch(()=>void 0)}},[B,A]),(0,I.useEffect)(()=>{K.current&&D?.phase===`waiting`&&D.flowId&&A&&We.current!==D.flowId&&(We.current=D.flowId,K.current=!1,V||lt(A))},[D?.phase,D?.flowId,A,lt,V]);let ut=N?.phase===`downloading`?`Downloading ${(N.downloadedBytes/1e6).toFixed(1)}${N.totalBytes===null?``:` of ${(N.totalBytes/1e6).toFixed(1)}`} MB.`:N?.phase===`extracting`?`Installing Codex.`:N?.phase===`verifying`?`Checking Codex.`:q?`${N?.source===`local`?`Using your installed Codex`:`Managed by P4 Code`}${N?.installedVersion?` · v${N.installedVersion}`:``}.`:N?.message??`P4 Code downloads and manages Codex for you.`,dt=Je?`Finishing sign-in...`:Y?ut:X||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&le?`Continue as ${le} on OpenAI.`:D?.message??`Finish signing in in your browser.`:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`}),`.`]}):`Signed in with ChatGPT.`:ce??`Use your ChatGPT subscription.`,ft=U&&A&&D?.flowId&&fe(H.toString())?ge({authorizationUrl:A,returnUrl:H.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,R.jsx)(u,{size:`sm`,variant:V?`default`:`outline`,className:d===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?W||!tt:!A||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?rt(E.data.profile):A&&lt(A)},children:Je?`Finishing sign-in...`:E.data?.phase===`finished`?tt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?V?`Open ChatGPT sign-in`:`Open sign-in page`:d===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&A?(0,R.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,R.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,onSubmit:n=>{if(n.preventDefault(),!D.flowId||!Fe.trim())return;let r=Fe.trim(),i=D.flowId;$(()=>ye({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Pe({flowId:i,value:``})})},children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(ie,{"aria-label":`ChatGPT sign-in redirect URL`,type:`password`,autoComplete:`off`,placeholder:`Paste the URL from the sign-in tab`,value:Fe,maxLength:16384,disabled:W||a,onChange:e=>Pe({flowId:D.flowId??``,value:e.target.value})})}),(0,R.jsx)(u,{variant:`outline`,type:`submit`,disabled:W||a||!Fe.trim(),children:`Connect`})]}),V?null:(0,R.jsx)(`div`,{children:(0,R.jsxs)(u,{size:`xs`,variant:`ghost-muted`,onClick:()=>void x().shell.openExternal(A),children:[`Try sign-in in your browser`,(0,R.jsx)(m,{className:`size-3.5`})]})}),ft?(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,R.jsx)(u,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,R.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,R.jsx)(F,{open:je,children:(0,R.jsx)(pe,{children:(0,R.jsx)(`div`,{id:Ae,className:h(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=U?mt:mt?(0,R.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,R.jsx)(Ie,{label:`Having trouble signing in?`,expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,R.jsx)(_e,{open:ae,methods:D?.methods??[],onClose:()=>O(!1),onSelect:e=>{O(!1),ot(D?.methods?.some(t=>t.id===e)?e:`chatgpt-change-account`)}}),vt=D?.phase===`idle`&&D.message?.startsWith(`Signed out locally.`)?D.message:null;if(d===`onboarding`){let r=vt??He??(_.error||te.error?`Could not read setup status. Reconnect and try again.`:N?.phase===`failed`?N.message:null);return(0,R.jsxs)(R.Fragment,{children:[_t,(0,R.jsxs)(Le,{title:f||n?.displayName||`Codex`,description:Y?ut:J?n?.auth.email?.trim()?(0,R.jsxs)(R.Fragment,{children:[`Signed in as`,` `,(0,R.jsx)(M,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected to ChatGPT.`:mt&&!U?(0,R.jsx)(Ie,{expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}):Ye||Xe||D?.phase===`starting`||D?.phase===`waiting`||W&&!Y?(0,R.jsx)(Ie,{}):X||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:J&&!Q?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,R.jsx)(i,{className:`size-3.5`}),`Ready`]}):X?pt:(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:Y||W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:X&&!Je||Y?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:W||a,onClick:()=>{K.current=!1,G.current=null,w||X&&D?.flowId?it():N?.operationId&&$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:N.operationId}}))},children:`Cancel`}):!X&&!J&&k?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):!X&&!J&&l?(0,R.jsx)(u,{size:`sm`,variant:`ghost-muted`,disabled:a||Q,onClick:()=>o(`existing`),children:`Use existing CLI`}):null,children:[U?gt:ht(),r?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,R.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,R.jsx)(j,{title:`ChatGPT account`,description:dt,control:(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:X?(0,R.jsxs)(R.Fragment,{children:[pt,!Je&&(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:W||a,onClick:()=>{(w||D?.flowId)&&(K.current=!1,it(),p?.())},children:`Cancel`})]}):Y?(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:W||a,onClick:()=>{N?.operationId&&(G.current=null,$(()=>Ce({environmentId:e,input:{instanceId:t,operationId:N.operationId}})))},children:`Cancel`}):J?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(u,{size:`sm`,variant:`outline`,disabled:Z||Q,onClick:()=>O(!0),children:`Change account`}),(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void $(()=>xe(g)),children:`Disconnect`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(z,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):ot()},children:W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),k?(0,R.jsx)(u,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):null]})})}),J?(0,R.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,R.jsx)(de,{})}):null,vt?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,R.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,He||_.error||te.error||N?.phase===`failed`?(0,R.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive sm:px-4`,children:He??(N?.phase===`failed`?N.message:`Could not read Codex setup status. Reconnect and try again.`)}):null]})}function W(e){let t=(0,L.c)(20),{environmentId:n,instanceId:r,provider:i}=e,a;t[0]!==n||t[1]!==r?(a=C.providerInstallState({environmentId:n,input:{instanceId:r}}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=re(a),s=o.data?.executablePath??``,c=o.error?`Could not read runtime path`:`Not installed`,l;t[3]!==s||t[4]!==c?(l=(0,R.jsx)(j,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex binary path`,value:s,title:s,placeholder:c,disabled:!0})})}),t[3]=s,t[4]=c,t[5]=l):l=t[5];let u=i?.runtimePaths?.homePath??``,d=i?.runtimePaths?.homePath,f;t[6]!==u||t[7]!==d?(f=(0,R.jsx)(j,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex home path`,value:u,title:d,placeholder:`Unavailable`,disabled:!0})})}),t[6]=u,t[7]=d,t[8]=f):f=t[8];let p=i?.runtimePaths?.shadowHomePath?`Account-specific home sharing the Codex state above.`:`This instance uses the shared Codex home directly.`,m=i?.runtimePaths?.shadowHomePath??``,h=i?.runtimePaths?.shadowHomePath??void 0,g=i?.runtimePaths?`Not used`:`Unavailable`,_;t[9]!==g||t[10]!==m||t[11]!==h?(_=(0,R.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,R.jsx)(ie,{"aria-label":`Codex shadow home path`,value:m,title:h,placeholder:g,disabled:!0})}),t[9]=g,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v;t[13]!==_||t[14]!==p?(v=(0,R.jsx)(j,{title:`Shadow home path`,description:p,control:_}),t[13]=_,t[14]=p,t[15]=v):v=t[15];let y;return t[16]!==v||t[17]!==l||t[18]!==f?(y=(0,R.jsxs)(R.Fragment,{children:[l,f,v]}),t[16]=v,t[17]=l,t[18]=f,t[19]=y):y=t[19],y}function Ie(e){let t=(0,L.c)(10),{label:n,expanded:r,controls:i,onToggle:a}=e,o=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!a){let e;return t[0]===o?e=t[1]:(e=(0,R.jsx)(`div`,{className:`leading-relaxed`,children:o}),t[0]=o,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,R.jsx)(s,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==a||t[8]!==u?(d=(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-sm text-left leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":`Having trouble signing in?`,"aria-expanded":c,"aria-controls":i,onClick:a,children:[o,u]}),t[4]=i,t[5]=c,t[6]=o,t[7]=a,t[8]=u,t[9]=d):d=t[9],d}function Le(e){let t=(0,L.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=I.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,R.jsx)(k,{className:`size-5 shrink-0 fill-foreground`}),t[2]=l):l=t[2];let u;t[3]===n?u=t[4]:(u=(0,R.jsx)(`h3`,{className:`text-sm font-medium`,children:n}),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=(0,R.jsx)(`div`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:r}),t[5]=r,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==a?(p=i||a?(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 has-[button]:w-full has-[button]:flex-col-reverse has-[button]:items-end sm:has-[button]:w-auto sm:has-[button]:flex-row sm:has-[button]:items-center`,children:[a,i]}):null,t[10]=i,t[11]=a,t[12]=p):p=t[12];let m;t[13]!==f||t[14]!==p?(m=(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l,f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===c?h=t[17]:(h=c.length>0?(0,R.jsx)(`div`,{className:`ml-8 mt-2 flex flex-wrap items-center gap-2`,children:c}):null,t[16]=c,t[17]=h);let g;return t[18]!==m||t[19]!==h?(g=(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-background px-4 py-4`,children:[m,h]}),t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Re(e){return typeof e==`object`&&e&&`setupMode`in e&&e.setupMode===`managed`?`managed`:`existing`}export{ke as a,U as c,Oe as d,V as f,Ne as i,Te as l,Pe as n,H as o,z as p,W as r,je as s,Re as t,De as u};
2
+ //# sourceMappingURL=CodexSetupSection.logic-lS_hYW7M.js.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./react-BUfh6y28.js";import{n as t,t as n}from"./jsx-runtime-DJeoFXNw.js";import{dr as r,t as i}from"./utils-D19Exirm.js";import{S as a,d as o,l as s}from"./TooltipViewport-CEOeTVyb.js";import{p as c}from"./toast-BNQWmVQ-.js";var l=t(),u=e(n(),1);function d(e){let t=(0,l.c)(19),{command:n,className:d,prominent:f}=e,p=f!==void 0&&f,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={timeout:1500,target:`command`},t[0]=m):m=t[0];let{copyToClipboard:h,isCopied:g}=c(m),_=p?`px-4 py-3.5 text-base`:`px-3 py-2.5 text-sm`,v;t[1]!==d||t[2]!==_?(v=i(`flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/50 font-mono`,_,d),t[1]=d,t[2]=_,t[3]=v):v=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsx)(`span`,{className:`mr-2 text-muted-foreground`,children:`$`}),t[4]=y):y=t[4];let b;t[5]===n?b=t[6]:(b=(0,u.jsxs)(`span`,{className:`min-w-0 truncate`,children:[y,n]}),t[5]=n,t[6]=b);let x;t[7]!==n||t[8]!==h?(x=()=>h(n,void 0),t[7]=n,t[8]=h,t[9]=x):x=t[9];let S=g?o:a,C;t[10]===S?C=t[11]:(C=(0,u.jsx)(s,{className:`size-3.5`,icon:S}),t[10]=S,t[11]=C);let w;t[12]!==x||t[13]!==C?(w=(0,u.jsx)(r,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy command`,onClick:x,children:C}),t[12]=x,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==w||t[16]!==v||t[17]!==b?(T=(0,u.jsxs)(`div`,{className:v,children:[b,w]}),t[15]=w,t[16]=v,t[17]=b,t[18]=T):T=t[18],T}export{d as t};
2
- //# sourceMappingURL=CommandBlock-ConSzQ7T.js.map
1
+ import{a as e}from"./react-BUfh6y28.js";import{n as t,t as n}from"./jsx-runtime-DJeoFXNw.js";import{dr as r,t as i}from"./utils-D19Exirm.js";import{S as a,d as o,l as s}from"./TooltipViewport-CEOeTVyb.js";import{p as c}from"./toast-rcFdQept.js";var l=t(),u=e(n(),1);function d(e){let t=(0,l.c)(19),{command:n,className:d,prominent:f}=e,p=f!==void 0&&f,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={timeout:1500,target:`command`},t[0]=m):m=t[0];let{copyToClipboard:h,isCopied:g}=c(m),_=p?`px-4 py-3.5 text-base`:`px-3 py-2.5 text-sm`,v;t[1]!==d||t[2]!==_?(v=i(`flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/50 font-mono`,_,d),t[1]=d,t[2]=_,t[3]=v):v=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsx)(`span`,{className:`mr-2 text-muted-foreground`,children:`$`}),t[4]=y):y=t[4];let b;t[5]===n?b=t[6]:(b=(0,u.jsxs)(`span`,{className:`min-w-0 truncate`,children:[y,n]}),t[5]=n,t[6]=b);let x;t[7]!==n||t[8]!==h?(x=()=>h(n,void 0),t[7]=n,t[8]=h,t[9]=x):x=t[9];let S=g?o:a,C;t[10]===S?C=t[11]:(C=(0,u.jsx)(s,{className:`size-3.5`,icon:S}),t[10]=S,t[11]=C);let w;t[12]!==x||t[13]!==C?(w=(0,u.jsx)(r,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy command`,onClick:x,children:C}),t[12]=x,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==w||t[16]!==v||t[17]!==b?(T=(0,u.jsxs)(`div`,{className:v,children:[b,w]}),t[15]=w,t[16]=v,t[17]=b,t[18]=T):T=t[18],T}export{d as t};
2
+ //# sourceMappingURL=CommandBlock-BFdf6yDf.js.map
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReadOnlySourcePreview-CiVudVcz.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/useSettings-BNjvPVd5.js","assets/utils-D19Exirm.js","assets/activity-CbqMUSRC.js","assets/createLucideIcon-DDevWfFk.js","assets/Icon-DYn8279B.js","assets/alarm-clock-D3-pktbt.js","assets/app-window-DT4yrrS-.js","assets/archive-Cr7-RIjC.js","assets/arrow-down-up-CQvYrirj.js","assets/arrow-down-BKghgxKI.js","assets/arrow-left-BWI0-vRp.js","assets/arrow-right-left-DXmmhGuH.js","assets/arrow-right-BJPYbHTL.js","assets/arrow-up-down-BEa_lFuV.js","assets/arrow-up-left-DLNjxPfK.js","assets/arrow-up-right-B8xNcEXp.js","assets/arrow-up-DMEbfkKl.js","assets/battery-BNMPLne0.js","assets/bell-vGxw63Gg.js","assets/blocks-CpHzQlR2.js","assets/book-open-DKRWS47i.js","assets/bookmark-DfPbwgkW.js","assets/bot-Cp92syL6.js","assets/box-D-FyjNxy.js","assets/bug-DH2pu6U9.js","assets/calendar-arrow-down-WH0xj289.js","assets/calendar-arrow-up-Lk-Us3ba.js","assets/calendar-clock-BARV5L0a.js","assets/calendar-DHdDnhKF.js","assets/camera-8ozLiwCj.js","assets/chart-no-axes-column-CQLqBsxb.js","assets/check-CdrGo1Oa.js","assets/chevron-down-D0M7_175.js","assets/chevron-left-CEWOKn-e.js","assets/chevron-right-DPl-L-yL.js","assets/chevron-up-gyDnPot_.js","assets/chevrons-left-right-ellipsis-DEfsDjXt.js","assets/chevrons-up-down-DakHVkrx.js","assets/chromium-x91nZeen.js","assets/circle-alert-DsKXULDS.js","assets/circle-arrow-up-DCmGv6Tl.js","assets/circle-check-CZ31KO9m.js","assets/circle-dashed-DMw11mBM.js","assets/circle-dot-CWCBN-HY.js","assets/circle-slash-eIt5hG5T.js","assets/circle-x-DMkHWcTz.js","assets/circle-Doq0I3MA.js","assets/clock-3-C5l2rPxd.js","assets/clock-aK6BX5Ve.js","assets/cloud-download-Ddj2y2Q1.js","assets/cloud-upload-BzCXws1i.js","assets/cloud-BhcSs4Ie.js","assets/code-xml-DsmxIkJL.js","assets/code-Dfd-vS1O.js","assets/columns-2-CgvyvCTB.js","assets/copy-CO2RgESU.js","assets/corner-left-up-DUJ8nnVp.js","assets/corner-up-right-xmYx6v5O.js","assets/cpu-DBknwmfd.js","assets/database-D2y6m7fG.js","assets/download-S2u-tXaE.js","assets/earth-CDbKfFEl.js","assets/ellipsis-vertical-CY0vJAc8.js","assets/ellipsis-Zza4fevQ.js","assets/external-link-D1GSnnDW.js","assets/eye-off-CH68-9dO.js","assets/eye-C3U51ndb.js","assets/file-braces-BzATadbM.js","assets/file-code-corner-eTofF8xM.js","assets/file-diff-CNp_vbEN.js","assets/file-search-ymCSYDZx.js","assets/file-spreadsheet-GRfTgOTy.js","assets/file-text-Bfv40hwh.js","assets/file-Ksu7amJn.js","assets/files-DlNPWYbd.js","assets/film-BUU7xHiL.js","assets/flask-conical-Dsv3DUqc.js","assets/folder-closed-urrrH8hq.js","assets/folder-cog-Dph_MIqG.js","assets/folder-git-2-BNs-MyeS.js","assets/folder-git-CZrtjtbc.js","assets/folder-open-glqXjO8U.js","assets/folder-plus-hbrm_0zI.js","assets/folder-tree-DRc_6QzW.js","assets/folder-7OwzWKex.js","assets/gauge-Bn8T6vfX.js","assets/git-branch-plus-DHrV8m4V.js","assets/git-branch-fKUdZyoj.js","assets/git-commit-horizontal-BKUdfVpN.js","assets/git-fork-q7k7fP_a.js","assets/git-merge-B6FlDJ0L.js","assets/git-pull-request-arrow-C03R6MRd.js","assets/git-pull-request-closed-BmuvrrUt.js","assets/git-pull-request-draft-BiETgjOy.js","assets/globe-rqPSVFGf.js","assets/grip-vertical-CDZpgHdL.js","assets/hammer-D3FVtCT2.js","assets/hard-drive-BYq2E_is.js","assets/hat-glasses-Dr2HzrbT.js","assets/history-CdIQPf9A.js","assets/house-ClTLFcnB.js","assets/image-Dp6bFTt-.js","assets/inbox-CcvYrvdu.js","assets/info-D9JLmnlB.js","assets/keyboard-Cwz72Cn4.js","assets/laptop-BRe6y-6m.js","assets/layers-DnKM4R7R.js","assets/lightbulb-D4c0exHI.js","assets/link-2-LC4CLD9N.js","assets/link-BG0xfm4f.js","assets/list-checks-D4Mjxs0W.js","assets/list-filter-CT2YuCdg.js","assets/list-ordered-CmlribqV.js","assets/list-todo-C9Q41q8t.js","assets/list-DFOg7UCj.js","assets/loader-circle-C9YTWe0R.js","assets/lock-open-ZMNlBvF_.js","assets/lock-CUPWkQFd.js","assets/log-in-CmJt2PGl.js","assets/mail-DH8sy4L4.js","assets/maximize-2-Ci1M4n4b.js","assets/maximize--OpXUP-L.js","assets/memory-stick-BfRByDz7.js","assets/message-circle-question-mark-B1TZAw6J.js","assets/message-circle-CHd5kZQY.js","assets/message-square-dashed-Cdozx3vh.js","assets/message-square-off-CWEe8iPZ.js","assets/message-square-text-DqZTWyZK.js","assets/message-square-warning-BNloiEzN.js","assets/message-square-HrqKYo9g.js","assets/messages-square-CNMItvyI.js","assets/minimize-2-C4_6Xjo0.js","assets/minus-BIm_k5Zx.js","assets/monitor-Dsi2qeBw.js","assets/moon-CQPzCH_B.js","assets/mouse-pointer-2-4CaeeJnC.js","assets/mouse-pointer-click-BPbYQy6n.js","assets/octagon-alert-EzAYxsw5.js","assets/package-plus-B0kbli0A.js","assets/package-DgK3Panc.js","assets/paintbrush-CRnk3l4s.js","assets/palette-oisfBZwg.js","assets/panel-bottom-_VbUQKRM.js","assets/panel-left-7a6N5kup.js","assets/panel-right-BeNqPQu9.js","assets/paperclip-D4ApErSa.js","assets/panels-top-left-DWNysJ-h.js","assets/pen-line-dPqyqyP8.js","assets/pencil-ruler-DmVfcvOi.js","assets/pencil-CkBDbGEU.js","assets/picture-in-picture-2-CM4GLcBZ.js","assets/pilcrow-D4Yvx6IY.js","assets/pin-DXnYmcqx.js","assets/play-3I2EkmKd.js","assets/plug-2-s7zj7Hxq.js","assets/plus-B2sOrZDk.js","assets/plug-YkUyuPha.js","assets/power-Bvdrcoxh.js","assets/presentation-Dzj9KqNW.js","assets/puzzle-A0RiinH5.js","assets/qr-code-DliRXqLn.js","assets/quote-BVm0cRnP.js","assets/radio-tower-DUk4f2-O.js","assets/redo-2-BJ7l6vPt.js","assets/refresh-cw-D5OcXJqv.js","assets/rotate-ccw-DpwKQVbi.js","assets/rotate-cw--ORF2bp-.js","assets/route-VA8ojaMC.js","assets/rows-3-BtaOoWPd.js","assets/scale-CFZenX_z.js","assets/search-BXnNiPfE.js","assets/send-rvnCC0tk.js","assets/server-D1-mXw9_.js","assets/settings-2-Bv4a7vuX.js","assets/settings-DSIgI7hn.js","assets/shield-check-Dp6nEC76.js","assets/shield-question-mark-Ct8sQE8L.js","assets/shield-BffxaUbT.js","assets/sliders-horizontal-Cjgfn3-e.js","assets/smartphone-D_YX6TMp.js","assets/smile-plus-CCWLDL7I.js","assets/sparkles-cGzc0RFW.js","assets/square-arrow-out-up-right-BhjBGexN.js","assets/square-pen-D43PK7SU.js","assets/square-split-horizontal-1peTt3kF.js","assets/square-split-vertical-BiyS0VO4.js","assets/square-terminal-jbiJud2S.js","assets/square-ekoTCPwL.js","assets/star-DNOgk1Yn.js","assets/sun-Doo18Rp9.js","assets/tag-COKMM2Nu.js","assets/target-DINbFNKH.js","assets/terminal-B0APSOls.js","assets/text-align-start-CwrzoVmt.js","assets/text-search-CmRPmwd0.js","assets/text-wrap-CQL7aZBn.js","assets/ticket-DOLQqHse.js","assets/trash-2-PlYko97C.js","assets/trending-down-DVeDgUDE.js","assets/trending-up-DbEIgYu9.js","assets/triangle-alert-BoPMRm-g.js","assets/type-CjUvBO4t.js","assets/undo-2-BD9xLk2R.js","assets/unlink-2-D70rwDdQ.js","assets/unplug-BYib3V6l.js","assets/upload-Cra7ct3V.js","assets/user-check-CcyAu7dq.js","assets/user-lock--_mHRTC7.js","assets/user-plus-zMaVgV4o.js","assets/user-round-x-pYk-6fRI.js","assets/user-round-4JeqoQGO.js","assets/users-BZYEVbyz.js","assets/wifi-off-ODm5nCE4.js","assets/workflow-BefWgmas.js","assets/wrench-pR-6hpnb.js","assets/x-C35beONT.js","assets/zap-BIb9m3mg.js","assets/runtime-S0tnrkvE.js","assets/runtime-CdX0UBlL.js","assets/toast-BNQWmVQ-.js","assets/TooltipViewport-CEOeTVyb.js","assets/spinner-H4tz4lLc.js","assets/useParams-D_0yPfYl.js","assets/server-ELSEsqtb.js","assets/session-DCntd6Nl.js","assets/use-atom-command-REOTdDAa.js","assets/themePalette-pZ7Ys_kT.js","assets/diffRendering-COA7wG72.js","assets/index-DD6u-vDm.js","assets/Virtualizer-CttujTBW.js","assets/getDiffFileInput-DovUC0XJ.js","assets/main-CNcsYwUg.js","assets/vcsRefInvalidation-BSyEzs8X.js","assets/entities-D8ZKPC2e.js","assets/query-D-IVadFI.js","assets/number-field-DcRWl9B0.js","assets/useRegisterFieldControl-DnspXZl4.js","assets/FormContext-B_ZMFN7l.js","assets/CSPContext-jKZ42W4p.js","assets/select-CML8G0wN.js","assets/SelectScrollUpArrow-BAwxXUi-.js","assets/link-CmpZDWcG.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-tnhWsSYX.js","assets/useNavigate-DAhzXpNZ.js","assets/useLocation--dLSTvwv.js","assets/rightPanelStore-CRQRe1Cp.js","assets/toastHelpers-DxXYm50b.js","assets/queries-BGbR-fUx.js","assets/session-logic-CbKDK1qZ.js","assets/htmlRender-hlYiIm7u.js","assets/mediaSource-DI8dP4uu.js","assets/fileLinks-CNAL-7G6.js","assets/mediaReference-DNNV5BY5.js","assets/usageFormat-xrTYBhxI.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-DsRaXpYk.js","assets/skeleton-eiJFH0l9.js","assets/useAriaLabelledBy-DVTboZ71.js","assets/toggle-BDixfqRe.js","assets/toggle-group-DV__8G6T.js","assets/CompositeRoot-XnJ7Nzli.js","assets/input-yNgBXsRj.js","assets/Input-B9nob0l2.js","assets/FieldControl-DfaF5AW8.js","assets/scroll-area-DTOm0CbX.js","assets/ScrollAreaCorner-Bstf_gNQ.js","assets/dist-CYq41icZ.js","assets/DialogTitle-DdTujj5B.js","assets/dialog-CKG1aUT3.js","assets/sidebar-DMJE0zUg.js","assets/useResizeDrag-CWrW8GV3.js","assets/observeResize-DjqKtKLK.js","assets/AnimatedHeight-Baj5Pa60.js","assets/assets-FbkZMhUb.js","assets/sourceControl-ChrSdv6h.js","assets/assetUrls-d3y14MLX.js","assets/browserHistoryStore-CjWZgU2Q.js","assets/preview-oweHYD4S.js","assets/openFileInPreview-rYwhIeVk.js","assets/keybindings-hzk4_Sgu.js","assets/Icons-BP6jlahF.js","assets/preview-D9IkIo7q.js","assets/PierreEntryIcon-CDSrlZTw.js","assets/pierre-icons-LoH9zCdH.js","assets/RenderErrorBoundary-C8jlNO8Q.js","assets/sourceControlClients-BDwX0klQ.js","assets/browserLinkTarget-IsSd9GTV.js","assets/pullRequestIcons-DyEIFm1n.js","assets/pullRequests-DRm4lwgc.js","assets/threadSort-Bd2rijEy.js","assets/popover-DVeZET9D.js","assets/PopoverHandle-Bf0PlJ6j.js","assets/ProjectFavicon-Cf1XjP8U.js","assets/ProjectMonogram-BJooqIM-.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-Cl_MU7SH.js","assets/checkbox-BPr09F_k.js","assets/CheckboxIndicator-CvUY7aCo.js","assets/FieldItemContext-sr3mCd2v.js","assets/terminalSessions-DdR_bXtX.js","assets/AlertDialogRoot-BDlDnUeW.js","assets/useHandleNewThread-DYBNXS8y.js","assets/p4ProjectFile-CT0gLoXX.js","assets/uiStateStore-Bo1Umjei.js","assets/guideRunStore-7uPQQ44U.js","assets/pullRequestDetail.logic-4EhxvJSo.js","assets/pullRequestReviewStore-B55CEHY9.js","assets/sidebarProjectGrouping-BAN1mSDk.js","assets/EnvironmentMachineIcon-BrGxJPP_.js","assets/alert-CqueYfb9.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-CcLiWo0d.js","assets/kbd-Cr4XEhSh.js","assets/settingsLayout-aLGl3ZXu.js","assets/WorkspacePageContainer-E5ZuTsSl.js","assets/KeybindingsSettings.logic-CkmobJKX.js","assets/usageShortcuts-CQcKqXkw.js","assets/primaryCloudLinkState-CZVS0Wwo.js","assets/command-i_eKJj3B.js","assets/ComboboxClear-BWxvz8Y9.js","assets/ComboboxGroupLabel-B9uepPCe.js","assets/ConnectionStatusDot-CpPwqzkK.js","assets/standalone-page-DrNBm39d.js","assets/primary-DXTkE8Z6.js","assets/onboarding-CyFz37eL.js","assets/scheduledTasksSettings.logic-CrhQwOvr.js","assets/main-B-tAk2zT.css","assets/DiffWorkerPoolProvider-K9JsvPrH.js"])))=>i.map(i=>d[i]);
2
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-DD6u-vDm.js";import{n as r,t as i}from"./jsx-runtime-DJeoFXNw.js";import{$ as a,Ad as o,Ai as s,Ct as c,Ec as l,Fc as u,Gu as d,J as f,Ku as p,Mm as m,Nd as h,Pc as g,Q as _,Rc as v,Rm as y,Tc as b,X as x,Y as S,_t as C,af as w,bt as T,dr as E,gc as D,ih as ee,it as te,jd as ne,jt as re,kc as O,ki as k,kp as ie,mp as ae,mt as oe,ot as se,qu as ce,rt as le,st as ue,t as de,th as fe,ts as pe,v_ as me,vt as he,wa as ge,wt as _e,x_ as A,xp as ve,y as ye,yt as be}from"./utils-D19Exirm.js";import{D as xe}from"./entities-D8ZKPC2e.js";import{l as Se,o as Ce,s as we}from"./runtime-CdX0UBlL.js";import{S as Te,U as Ee,b as De,d as Oe,l as ke,w as j}from"./TooltipViewport-CEOeTVyb.js";import{A as Ae,C as je,D as Me,E as Ne,O as Pe,S as Fe,T as Ie,a as Le,b as Re,j as ze,k as Be,l as Ve,n as He,r as Ue,s as We,v as Ge,w as Ke,y as qe}from"./ChatMarkdown-DQk9NI7y.js";import{t as Je}from"./spinner-H4tz4lLc.js";import{t as Ye}from"./link-CmpZDWcG.js";import{i as Xe,p as Ze}from"./toast-BNQWmVQ-.js";import{G as Qe,_ as $e,q as et,s as tt}from"./useSettings-BNjvPVd5.js";import{f as nt,s as rt}from"./server-ELSEsqtb.js";import{P as it,R as at,_ as ot,g as st,p as ct,z as lt}from"./themePalette-pZ7Ys_kT.js";import{l as ut,t as dt}from"./diffRendering-COA7wG72.js";import{c as ft,d as pt,f as mt,l as ht,m as gt,o as _t,p as vt,s as yt,t as bt,u as xt}from"./htmlRender-hlYiIm7u.js";import{a as St,n as Ct,t as wt}from"./tooltip-DsRaXpYk.js";import{n as Tt,o as Et}from"./pierre-icons-LoH9zCdH.js";import{t as Dt}from"./toggle-BDixfqRe.js";import{i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./combobox-CEzOq8mg.js";import{t as Ft}from"./scroll-area-DTOm0CbX.js";import{t as It}from"./assetUrls-d3y14MLX.js";import{v as Lt}from"./keybindings-hzk4_Sgu.js";import{o as Rt,t as zt}from"./PierreEntryIcon-CDSrlZTw.js";import{M as Bt,N as Vt,lt as Ht,ot as Ut}from"./RenderErrorBoundary-C8jlNO8Q.js";import{n as Wt}from"./pullRequestIcons-DyEIFm1n.js";import{Gt,Kt,Lt as qt,Mt as Jt,Nt as Yt,Ut as Xt,Vt as Zt,Wt as Qt,Ya as $t,fo as en,zt as tn}from"./main-CNcsYwUg.js";var M=e(t(),1),N=r(),P=e(i(),1),nn=e(ge(),1),rn=s(),an=k();function on(e){let t=e.mimeType?.split(`;`,1)[0]?.trim().toLowerCase();return t===`text/csv`?`,`:t===`text/tab-separated-values`?` `:t&&t!==`text/plain`&&t!==`application/octet-stream`?null:/\.csv$/i.test(e.name)?`,`:/\.tsv$/i.test(e.name)?` `:null}function sn(e,t){let n=[],r=[],i=``,a=!1,o=!1,s=+(e.charCodeAt(0)===65279),c=()=>{r.length<30?r.push(i):o=!0,i=``};for(let l=s;l<e.length;l++){let u=e[l];if(u===`"`){if(a&&e[l+1]===`"`){i.length<2e3?i+=`"`:o=!0,l++;continue}if(a||i===``){a=!a;continue}}if(!a&&(u===t||u===`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReadOnlySourcePreview-CSK6ee05.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/useSettings-4JwtKUFC.js","assets/utils-D19Exirm.js","assets/activity-CbqMUSRC.js","assets/createLucideIcon-DDevWfFk.js","assets/Icon-DYn8279B.js","assets/alarm-clock-D3-pktbt.js","assets/app-window-DT4yrrS-.js","assets/archive-Cr7-RIjC.js","assets/arrow-down-up-CQvYrirj.js","assets/arrow-down-BKghgxKI.js","assets/arrow-left-BWI0-vRp.js","assets/arrow-right-left-DXmmhGuH.js","assets/arrow-right-BJPYbHTL.js","assets/arrow-up-down-BEa_lFuV.js","assets/arrow-up-left-DLNjxPfK.js","assets/arrow-up-right-B8xNcEXp.js","assets/arrow-up-DMEbfkKl.js","assets/battery-BNMPLne0.js","assets/bell-vGxw63Gg.js","assets/blocks-CpHzQlR2.js","assets/book-open-DKRWS47i.js","assets/bookmark-DfPbwgkW.js","assets/bot-Cp92syL6.js","assets/box-D-FyjNxy.js","assets/bug-DH2pu6U9.js","assets/calendar-arrow-down-WH0xj289.js","assets/calendar-arrow-up-Lk-Us3ba.js","assets/calendar-clock-BARV5L0a.js","assets/calendar-DHdDnhKF.js","assets/camera-8ozLiwCj.js","assets/chart-no-axes-column-CQLqBsxb.js","assets/check-CdrGo1Oa.js","assets/chevron-down-D0M7_175.js","assets/chevron-left-CEWOKn-e.js","assets/chevron-right-DPl-L-yL.js","assets/chevron-up-gyDnPot_.js","assets/chevrons-left-right-ellipsis-DEfsDjXt.js","assets/chevrons-up-down-DakHVkrx.js","assets/chromium-x91nZeen.js","assets/circle-alert-DsKXULDS.js","assets/circle-arrow-up-DCmGv6Tl.js","assets/circle-check-CZ31KO9m.js","assets/circle-dashed-DMw11mBM.js","assets/circle-dot-CWCBN-HY.js","assets/circle-slash-eIt5hG5T.js","assets/circle-x-DMkHWcTz.js","assets/circle-Doq0I3MA.js","assets/clock-3-C5l2rPxd.js","assets/clock-aK6BX5Ve.js","assets/cloud-download-Ddj2y2Q1.js","assets/cloud-upload-BzCXws1i.js","assets/cloud-BhcSs4Ie.js","assets/code-xml-DsmxIkJL.js","assets/code-Dfd-vS1O.js","assets/columns-2-CgvyvCTB.js","assets/copy-CO2RgESU.js","assets/corner-left-up-DUJ8nnVp.js","assets/corner-up-right-xmYx6v5O.js","assets/cpu-DBknwmfd.js","assets/database-D2y6m7fG.js","assets/download-S2u-tXaE.js","assets/earth-CDbKfFEl.js","assets/ellipsis-vertical-CY0vJAc8.js","assets/ellipsis-Zza4fevQ.js","assets/external-link-D1GSnnDW.js","assets/eye-off-CH68-9dO.js","assets/eye-C3U51ndb.js","assets/file-braces-BzATadbM.js","assets/file-code-corner-eTofF8xM.js","assets/file-diff-CNp_vbEN.js","assets/file-search-ymCSYDZx.js","assets/file-spreadsheet-GRfTgOTy.js","assets/file-text-Bfv40hwh.js","assets/file-Ksu7amJn.js","assets/files-DlNPWYbd.js","assets/film-BUU7xHiL.js","assets/flask-conical-Dsv3DUqc.js","assets/folder-closed-urrrH8hq.js","assets/folder-cog-Dph_MIqG.js","assets/folder-git-2-BNs-MyeS.js","assets/folder-git-CZrtjtbc.js","assets/folder-open-glqXjO8U.js","assets/folder-plus-hbrm_0zI.js","assets/folder-tree-DRc_6QzW.js","assets/folder-7OwzWKex.js","assets/gauge-Bn8T6vfX.js","assets/git-branch-plus-DHrV8m4V.js","assets/git-branch-fKUdZyoj.js","assets/git-commit-horizontal-BKUdfVpN.js","assets/git-fork-q7k7fP_a.js","assets/git-merge-B6FlDJ0L.js","assets/git-pull-request-arrow-C03R6MRd.js","assets/git-pull-request-closed-BmuvrrUt.js","assets/git-pull-request-draft-BiETgjOy.js","assets/globe-rqPSVFGf.js","assets/grip-vertical-CDZpgHdL.js","assets/hammer-D3FVtCT2.js","assets/hard-drive-BYq2E_is.js","assets/hat-glasses-Dr2HzrbT.js","assets/history-CdIQPf9A.js","assets/house-ClTLFcnB.js","assets/image-Dp6bFTt-.js","assets/inbox-CcvYrvdu.js","assets/info-D9JLmnlB.js","assets/keyboard-Cwz72Cn4.js","assets/laptop-BRe6y-6m.js","assets/layers-DnKM4R7R.js","assets/lightbulb-D4c0exHI.js","assets/link-2-LC4CLD9N.js","assets/link-BG0xfm4f.js","assets/list-checks-D4Mjxs0W.js","assets/list-filter-CT2YuCdg.js","assets/list-ordered-CmlribqV.js","assets/list-todo-C9Q41q8t.js","assets/list-DFOg7UCj.js","assets/loader-circle-C9YTWe0R.js","assets/lock-open-ZMNlBvF_.js","assets/lock-CUPWkQFd.js","assets/log-in-CmJt2PGl.js","assets/mail-DH8sy4L4.js","assets/maximize-2-Ci1M4n4b.js","assets/maximize--OpXUP-L.js","assets/memory-stick-BfRByDz7.js","assets/message-circle-question-mark-B1TZAw6J.js","assets/message-circle-CHd5kZQY.js","assets/message-square-dashed-Cdozx3vh.js","assets/message-square-off-CWEe8iPZ.js","assets/message-square-text-DqZTWyZK.js","assets/message-square-warning-BNloiEzN.js","assets/message-square-HrqKYo9g.js","assets/messages-square-CNMItvyI.js","assets/minimize-2-C4_6Xjo0.js","assets/minus-BIm_k5Zx.js","assets/monitor-Dsi2qeBw.js","assets/moon-CQPzCH_B.js","assets/mouse-pointer-2-4CaeeJnC.js","assets/mouse-pointer-click-BPbYQy6n.js","assets/octagon-alert-EzAYxsw5.js","assets/package-plus-B0kbli0A.js","assets/package-DgK3Panc.js","assets/paintbrush-CRnk3l4s.js","assets/palette-oisfBZwg.js","assets/panel-bottom-_VbUQKRM.js","assets/panel-left-7a6N5kup.js","assets/panel-right-BeNqPQu9.js","assets/paperclip-D4ApErSa.js","assets/panels-top-left-DWNysJ-h.js","assets/pen-line-dPqyqyP8.js","assets/pencil-ruler-DmVfcvOi.js","assets/pencil-CkBDbGEU.js","assets/picture-in-picture-2-CM4GLcBZ.js","assets/pilcrow-D4Yvx6IY.js","assets/pin-DXnYmcqx.js","assets/play-3I2EkmKd.js","assets/plug-2-s7zj7Hxq.js","assets/plus-B2sOrZDk.js","assets/plug-YkUyuPha.js","assets/power-Bvdrcoxh.js","assets/presentation-Dzj9KqNW.js","assets/puzzle-A0RiinH5.js","assets/qr-code-DliRXqLn.js","assets/quote-BVm0cRnP.js","assets/radio-tower-DUk4f2-O.js","assets/redo-2-BJ7l6vPt.js","assets/refresh-cw-D5OcXJqv.js","assets/rotate-ccw-DpwKQVbi.js","assets/rotate-cw--ORF2bp-.js","assets/route-VA8ojaMC.js","assets/rows-3-BtaOoWPd.js","assets/scale-CFZenX_z.js","assets/search-BXnNiPfE.js","assets/send-rvnCC0tk.js","assets/server-D1-mXw9_.js","assets/settings-2-Bv4a7vuX.js","assets/settings-DSIgI7hn.js","assets/shield-check-Dp6nEC76.js","assets/shield-question-mark-Ct8sQE8L.js","assets/shield-BffxaUbT.js","assets/sliders-horizontal-Cjgfn3-e.js","assets/smartphone-D_YX6TMp.js","assets/smile-plus-CCWLDL7I.js","assets/sparkles-cGzc0RFW.js","assets/square-arrow-out-up-right-BhjBGexN.js","assets/square-pen-D43PK7SU.js","assets/square-split-horizontal-1peTt3kF.js","assets/square-split-vertical-BiyS0VO4.js","assets/square-terminal-jbiJud2S.js","assets/square-ekoTCPwL.js","assets/star-DNOgk1Yn.js","assets/sun-Doo18Rp9.js","assets/tag-COKMM2Nu.js","assets/target-DINbFNKH.js","assets/terminal-B0APSOls.js","assets/text-align-start-CwrzoVmt.js","assets/text-search-CmRPmwd0.js","assets/text-wrap-CQL7aZBn.js","assets/ticket-DOLQqHse.js","assets/trash-2-PlYko97C.js","assets/trending-down-DVeDgUDE.js","assets/trending-up-DbEIgYu9.js","assets/triangle-alert-BoPMRm-g.js","assets/type-CjUvBO4t.js","assets/undo-2-BD9xLk2R.js","assets/unlink-2-D70rwDdQ.js","assets/unplug-BYib3V6l.js","assets/upload-Cra7ct3V.js","assets/user-check-CcyAu7dq.js","assets/user-lock--_mHRTC7.js","assets/user-plus-zMaVgV4o.js","assets/user-round-x-pYk-6fRI.js","assets/user-round-4JeqoQGO.js","assets/users-BZYEVbyz.js","assets/wifi-off-ODm5nCE4.js","assets/workflow-BefWgmas.js","assets/wrench-pR-6hpnb.js","assets/x-C35beONT.js","assets/zap-BIb9m3mg.js","assets/runtime-DEFP_0P0.js","assets/runtime-CZnPVuwS.js","assets/toast-rcFdQept.js","assets/TooltipViewport-CEOeTVyb.js","assets/spinner-H4tz4lLc.js","assets/useParams-D_0yPfYl.js","assets/server-BuS35bSu.js","assets/session-DIw-RcNy.js","assets/use-atom-command-BETKz9Hv.js","assets/themePalette-pZ7Ys_kT.js","assets/diffRendering-Dyda4rX5.js","assets/index-Bxk_RxGw.js","assets/Virtualizer-saguDIDi.js","assets/getDiffFileInput-dJd1H35Q.js","assets/main-CVSzIqPv.js","assets/vcsRefInvalidation-aUafFWy3.js","assets/entities-DCgQUDZp.js","assets/query-D-IVadFI.js","assets/number-field-DcRWl9B0.js","assets/useRegisterFieldControl-DnspXZl4.js","assets/FormContext-B_ZMFN7l.js","assets/CSPContext-jKZ42W4p.js","assets/select-CML8G0wN.js","assets/SelectScrollUpArrow-BAwxXUi-.js","assets/link-CmpZDWcG.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-tnhWsSYX.js","assets/useNavigate-DAhzXpNZ.js","assets/useLocation--dLSTvwv.js","assets/rightPanelStore-CRQRe1Cp.js","assets/toastHelpers-DxXYm50b.js","assets/queries-ByCVdESa.js","assets/session-logic-B5D2SdWr.js","assets/htmlRender-hlYiIm7u.js","assets/mediaSource-UIArIbzY.js","assets/fileLinks-BlBUc4i_.js","assets/mediaReference-DMJ5Zay3.js","assets/usageFormat-xrTYBhxI.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-DsRaXpYk.js","assets/skeleton-eiJFH0l9.js","assets/useAriaLabelledBy-DVTboZ71.js","assets/toggle-BDixfqRe.js","assets/toggle-group-DV__8G6T.js","assets/CompositeRoot-XnJ7Nzli.js","assets/input-yNgBXsRj.js","assets/Input-B9nob0l2.js","assets/FieldControl-DfaF5AW8.js","assets/scroll-area-DTOm0CbX.js","assets/ScrollAreaCorner-Bstf_gNQ.js","assets/dist-DP18jjts.js","assets/DialogTitle-DdTujj5B.js","assets/dialog-CKG1aUT3.js","assets/sidebar-DMJE0zUg.js","assets/useResizeDrag-CWrW8GV3.js","assets/observeResize-DjqKtKLK.js","assets/AnimatedHeight-Baj5Pa60.js","assets/assets-dVntMNKj.js","assets/sourceControl-DzD_N8hv.js","assets/assetUrls-5u2VAW_2.js","assets/browserHistoryStore-AwPHr-9a.js","assets/preview-oweHYD4S.js","assets/openFileInPreview-x34grdQ6.js","assets/keybindings-hzk4_Sgu.js","assets/Icons-BP6jlahF.js","assets/preview-Bw-Ffmn4.js","assets/PierreEntryIcon-CcaKUQ_5.js","assets/pierre-icons-CBskVugi.js","assets/RenderErrorBoundary-ImTUJEbS.js","assets/sourceControlClients-BG_kFh61.js","assets/browserLinkTarget-CUvZuS7D.js","assets/pullRequestIcons-DyEIFm1n.js","assets/pullRequests-mcrrz3SF.js","assets/threadSort-Bd2rijEy.js","assets/popover-DVeZET9D.js","assets/PopoverHandle-Bf0PlJ6j.js","assets/ProjectFavicon-6uv-3a7b.js","assets/ProjectMonogram-BJooqIM-.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-02nlfyzQ.js","assets/checkbox-BPr09F_k.js","assets/CheckboxIndicator-CvUY7aCo.js","assets/FieldItemContext-sr3mCd2v.js","assets/terminalSessions-BxTpBnAL.js","assets/AlertDialogRoot-BDlDnUeW.js","assets/useHandleNewThread-BoN4NqHy.js","assets/p4ProjectFile-xLwkLebE.js","assets/uiStateStore-DKTSAGd0.js","assets/guideRunStore-DksWd_Oc.js","assets/pullRequestDetail.logic-BLe7zsLi.js","assets/pullRequestReviewStore-B55CEHY9.js","assets/sidebarProjectGrouping-CPb438r8.js","assets/EnvironmentMachineIcon-BrGxJPP_.js","assets/alert-CqueYfb9.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-D-N8-zk6.js","assets/kbd-Cr4XEhSh.js","assets/settingsLayout-BWJVQUbK.js","assets/WorkspacePageContainer-E5ZuTsSl.js","assets/KeybindingsSettings.logic-CkmobJKX.js","assets/usageShortcuts-CQcKqXkw.js","assets/primaryCloudLinkState-Dwi-D0I7.js","assets/command-i_eKJj3B.js","assets/ComboboxClear-BWxvz8Y9.js","assets/ComboboxGroupLabel-B9uepPCe.js","assets/ConnectionStatusDot-CpPwqzkK.js","assets/standalone-page-DrNBm39d.js","assets/primary-CIcP7bEP.js","assets/onboarding-pqbI8W1U.js","assets/scheduledTasksSettings.logic-CTJ1Zr8Z.js","assets/main-B-tAk2zT.css","assets/DiffWorkerPoolProvider-BrhQktrm.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-Bxk_RxGw.js";import{n as r,t as i}from"./jsx-runtime-DJeoFXNw.js";import{$ as a,Ad as o,Ai as s,Ct as c,Ec as l,Fc as u,Gu as d,J as f,Ku as p,Mm as m,Nd as h,Pc as g,Q as _,Rc as v,Rm as y,Tc as b,X as x,Y as S,_t as C,af as w,bt as T,dr as E,gc as D,ih as ee,it as te,jd as ne,jt as re,kc as O,ki as k,kp as ie,mp as ae,mt as oe,ot as se,qu as ce,rt as le,st as ue,t as de,th as fe,ts as pe,v_ as me,vt as he,wa as ge,wt as _e,x_ as A,xp as ve,y as ye,yt as be}from"./utils-D19Exirm.js";import{D as xe}from"./entities-DCgQUDZp.js";import{l as Se,o as Ce,s as we}from"./runtime-CZnPVuwS.js";import{S as Te,U as Ee,b as De,d as Oe,l as ke,w as j}from"./TooltipViewport-CEOeTVyb.js";import{A as Ae,C as je,D as Me,E as Ne,O as Pe,S as Fe,T as Ie,a as Le,b as Re,j as ze,k as Be,l as Ve,n as He,r as Ue,s as We,v as Ge,w as Ke,y as qe}from"./ChatMarkdown-fdsQ0rQe.js";import{t as Je}from"./spinner-H4tz4lLc.js";import{t as Ye}from"./link-CmpZDWcG.js";import{i as Xe,p as Ze}from"./toast-rcFdQept.js";import{G as Qe,_ as $e,q as et,s as tt}from"./useSettings-4JwtKUFC.js";import{f as nt,s as rt}from"./server-BuS35bSu.js";import{P as it,R as at,_ as ot,g as st,p as ct,z as lt}from"./themePalette-pZ7Ys_kT.js";import{l as ut,t as dt}from"./diffRendering-Dyda4rX5.js";import{c as ft,d as pt,f as mt,l as ht,m as gt,o as _t,p as vt,s as yt,t as bt,u as xt}from"./htmlRender-hlYiIm7u.js";import{a as St,n as Ct,t as wt}from"./tooltip-DsRaXpYk.js";import{n as Tt,o as Et}from"./pierre-icons-CBskVugi.js";import{t as Dt}from"./toggle-BDixfqRe.js";import{i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./combobox-CEzOq8mg.js";import{t as Ft}from"./scroll-area-DTOm0CbX.js";import{t as It}from"./assetUrls-5u2VAW_2.js";import{v as Lt}from"./keybindings-hzk4_Sgu.js";import{o as Rt,t as zt}from"./PierreEntryIcon-CcaKUQ_5.js";import{M as Bt,N as Vt,lt as Ht,ot as Ut}from"./RenderErrorBoundary-ImTUJEbS.js";import{n as Wt}from"./pullRequestIcons-DyEIFm1n.js";import{Gt,Kt,Lt as qt,Mt as Jt,Nt as Yt,Ut as Xt,Vt as Zt,Wt as Qt,Ya as $t,fo as en,zt as tn}from"./main-CVSzIqPv.js";var M=e(t(),1),N=r(),P=e(i(),1),nn=e(ge(),1),rn=s(),an=k();function on(e){let t=e.mimeType?.split(`;`,1)[0]?.trim().toLowerCase();return t===`text/csv`?`,`:t===`text/tab-separated-values`?` `:t&&t!==`text/plain`&&t!==`application/octet-stream`?null:/\.csv$/i.test(e.name)?`,`:/\.tsv$/i.test(e.name)?` `:null}function sn(e,t){let n=[],r=[],i=``,a=!1,o=!1,s=+(e.charCodeAt(0)===65279),c=()=>{r.length<30?r.push(i):o=!0,i=``};for(let l=s;l<e.length;l++){let u=e[l];if(u===`"`){if(a&&e[l+1]===`"`){i.length<2e3?i+=`"`:o=!0,l++;continue}if(a||i===``){a=!a;continue}}if(!a&&(u===t||u===`
3
3
  `||u===`\r`)){if(c(),u!==t&&(n.push(r),r=[],u===`\r`&&e[l+1]===`
4
4
  `&&l++,s=l+1,n.length===100))return{rows:n,truncated:o||l<e.length-1}}else i.length<2e3?i+=u:o=!0}return s<e.length&&(c(),n.push(r)),{rows:n,truncated:o||a}}async function cn(e,t){if(!e.ok)throw e.body?.cancel().catch(()=>void 0),Error(`The file could not be loaded. Reconnect and try again.`);if(t.aborted)throw Error(`Preview cancelled.`);let n=Ce+1,r=e.body?.getReader();if(!r)throw Error(`Streaming file previews are unavailable in this runtime.`);let i=()=>{r.cancel().catch(()=>void 0)};t.addEventListener(`abort`,i,{once:!0});let a=[],o=0;try{for(;o<n;){if(t.aborted)throw Error(`Preview cancelled.`);let e=await r.read();if(e.done)break;let i=e.value.subarray(0,n-o);a.push(i),o+=i.length}}finally{t.removeEventListener(`abort`,i),await r.cancel()}if(t.aborted)throw Error(`Preview cancelled.`);let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return we(s)}function ln(e){let t=(0,N.c)(4),n;return t[0]!==e.name||t[1]!==e.onError||t[2]!==e.src?(n=(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,P.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.src,"aria-label":e.name,className:`w-full max-w-xl`,onError:e.onError})}),t[0]=e.name,t[1]=e.onError,t[2]=e.src,t[3]=n):n=t[3],n}function un(e,t,n){let r=ot(it(e,t,n));return r===null?ct(n):st(r,n)??r.colors}function dn(){let e=(0,N.c)(11),{theme:t,resolvedTheme:n,themeHalves:r}=Qe(),i;e[0]!==n||e[1]!==t||e[2]!==r?(i=()=>un(t,r,n),e[0]=n,e[1]=t,e[2]=r,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=()=>ct(n),e[4]=n,e[5]=a);let o=(0,M.useSyncExternalStore)(at,i,a),s=tt(mn),c=tt(pn),l;return e[6]!==o||e[7]!==c||e[8]!==n||e[9]!==s?(l=ft(Object.fromEntries(Object.entries(o).map(fn)),n,{sans:$t(s,bt.sans),mono:$t(c,bt.mono)}),e[6]=o,e[7]=c,e[8]=n,e[9]=s,e[10]=l):l=e[10],l}function fn(e){let[t,n]=e;return[t,lt(n)??n]}function pn(e){return e.fontFamilyCode}function mn(e){return e.fontFamilySans}var hn=`#toolbar=0&view=FitH`,gn=new Set([`commandPalette.toggle`,`filePicker.toggle`,`projectSearch.toggle`,`chat.find`,`sidebar.toggle`,`rightPanel.toggle`,`rightPanel.toggleMaximized`,`threadPanel.toggle`,`terminal.toggle`,`preview.toggle`,`navigation.back`,`navigation.forward`,`thread.previous`,`thread.next`,...A,...me]),_n=e=>/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``);function vn(e){let t=(0,N.c)(7),n=e.documentKey??e.src,r;return t[0]!==n||t[1]!==e.htmlRender||t[2]!==e.pdf||t[3]!==e.src||t[4]!==e.threadRef||t[5]!==e.title?(r=e.pdf?(0,P.jsx)(`iframe`,{src:`${e.src}${hn}`,title:e.title,className:`min-h-0 flex-1 border-0 bg-white`},e.src):e.htmlRender?(0,P.jsx)(bn,{src:e.src,title:e.title,threadRef:e.threadRef,className:`min-h-0 flex-1`},n):(0,P.jsx)(yn,{src:e.src,title:e.title},n),t[0]=n,t[1]=e.htmlRender,t[2]=e.pdf,t[3]=e.src,t[4]=e.threadRef,t[5]=e.title,t[6]=r):r=t[6],r}function yn(e){let t=(0,N.c)(3),[n]=(0,M.useState)(e.src),r;return t[0]!==e.title||t[1]!==n?(r=(0,P.jsx)(`iframe`,{src:n,title:e.title,className:`min-h-0 flex-1 border-0 bg-white`,sandbox:`allow-scripts allow-forms allow-popups allow-downloads`}),t[0]=e.title,t[1]=n,t[2]=r):r=t[2],r}function bn(e){let t=(0,N.c)(57),n=dn(),r=(0,M.useRef)(null),i;t[0]!==e.src||t[1]!==n?(i=()=>`${e.src.split(`#`,1)[0]}${ht(n)}`,t[0]=e.src,t[1]=n,t[2]=i):i=t[2];let[a]=(0,M.useState)(i),[o,s]=(0,M.useState)(!1),[c,l]=(0,M.useState)(null),d;t[3]===n?d=t[4]:(d=()=>{r.current?.contentWindow?.postMessage(xt(n),`*`)},t[3]=n,t[4]=d);let f=d,p;t[5]===n?p=t[6]:(p=[n],t[5]=n,t[6]=p),(0,M.useEffect)(f,p);let m=pe(rt),h=pe(nt.configValueAtom(e.threadRef?.environmentId??null))?.keybindings,_;if(t[7]!==h||t[8]!==m){let e=g(navigator.platform),n=t=>({key:t.key,metaKey:t.metaKey||t.modKey&&e,ctrlKey:t.ctrlKey||t.modKey&&!e,shiftKey:t.shiftKey,altKey:t.altKey}),r=[...m,...h??[]].filter(Tn).map(e=>n(e.shortcut)),i=new Map;for(let{command:e,shortcut:t}of m)gn.has(e)&&(t.metaKey||t.ctrlKey||t.modKey)&&i.set(Lt(t),n(t));_={shortcuts:[...i.values()],blocked:r},t[7]=h,t[8]=m,t[9]=_}else _=t[9];let{shortcuts:y,blocked:b}=_,x;t[10]!==b||t[11]!==y?(x=()=>{r.current?.contentWindow?.postMessage(yt(y,b),`*`)},t[10]=b,t[11]=y,t[12]=x):x=t[12];let S=x,C;t[13]!==b||t[14]!==y?(C=[b,y],t[13]=b,t[14]=y,t[15]=C):C=t[15],(0,M.useEffect)(S,C);let w;t[16]!==b||t[17]!==y?(w=e=>{let t=t=>u(e,{...t,modKey:!1},navigator.platform),n=y.filter(t);return n.length>0&&!b.some(t)&&(e.key.length===1||e.key===`Dead`||n.some(t=>t.key===v(e.key)))},t[16]=b,t[17]=y,t[18]=w):w=t[18];let T=(0,M.useEffectEvent)(w),E=Ut(e.threadRef),D=Ht(e.threadRef),ee;t[19]!==E||t[20]!==D||t[21]!==e.threadRef?(ee=(t,n)=>{n.metaKey||n.ctrlKey?et()?.shell.openExternal(t).catch(wn):e.threadRef!==void 0&&E({...n,preventDefault:Cn,stopPropagation:Sn},t,void 0,e.threadRef.environmentId)||D(t,{event:n}).catch(xn)},t[19]=E,t[20]=D,t[21]=e.threadRef,t[22]=ee):ee=t[22];let te=(0,M.useEffectEvent)(ee),ne;t[23]===te?ne=t[24]:(ne=()=>{let e=e=>{let t=r.current,n=gt(e.data);n!==void 0&&t!==null&&e.source===t.contentWindow&&document.activeElement===t&&navigator.userActivation?.isActive!==!1&&(te(n.url,n),t.contentWindow?.postMessage(_t(n.id),`*`))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},t[23]=te,t[24]=ne);let re;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(re=[],t[25]=re):re=t[25],(0,M.useEffect)(ne,re);let O;t[26]===T?O=t[27]:(O=()=>{let e=e=>{let t=r.current,n=vt(e.data);n!==void 0&&t!==null&&e.source===t.contentWindow&&document.activeElement===t&&navigator.userActivation?.isActive!==!1&&T(n)&&t.dispatchEvent(new KeyboardEvent(`keydown`,{...n,bubbles:!0,cancelable:!0}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},t[26]=T,t[27]=O);let k;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],t[28]=k):k=t[28],(0,M.useEffect)(O,k);let ie,ae;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>{let e=e=>{let t=r.current,n=mt(e.data);n!==void 0&&t!==null&&e.source===t.contentWindow&&document.activeElement===t&&navigator.userActivation?.isActive!==!1&&l({images:[{src:n.src,name:n.name}],index:0})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},ae=[],t[29]=ie,t[30]=ae):(ie=t[29],ae=t[30]),(0,M.useEffect)(ie,ae);let{onFullscreenChange:oe}=e,se,ce;t[31]!==c||t[32]!==oe?(se=()=>{if(c!==null)return oe?.(!0),()=>oe?.(!1)},ce=[c,oe],t[31]=c,t[32]=oe,t[33]=se,t[34]=ce):(se=t[33],ce=t[34]),(0,M.useEffect)(se,ce);let{onContentHeight:le}=e,ue,fe;t[35]===le?(ue=t[36],fe=t[37]):(ue=()=>{if(le===void 0)return;let e=e=>{let t=pt(e.data);t!==void 0&&e.source===r.current?.contentWindow&&le(t)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},fe=[le],t[35]=le,t[36]=ue,t[37]=fe),(0,M.useLayoutEffect)(ue,fe);let me=e.title,he;t[38]!==S||t[39]!==f?(he=()=>{s(!0),f(),S()},t[38]=S,t[39]=f,t[40]=he):he=t[40];let ge;t[41]===e.className?ge=t[42]:(ge=de(`border-0 scheme-light`,e.className),t[41]=e.className,t[42]=ge);let _e;t[43]!==o||t[44]!==n?(_e=o?{colorScheme:n.appearance}:void 0,t[43]=o,t[44]=n,t[45]=_e):_e=t[45];let A;t[46]!==e.title||t[47]!==a||t[48]!==he||t[49]!==ge||t[50]!==_e?(A=(0,P.jsx)(`iframe`,{ref:r,src:a,title:me,sandbox:`allow-scripts allow-forms`,loading:`lazy`,onLoad:he,className:ge,style:_e}),t[46]=e.title,t[47]=a,t[48]=he,t[49]=ge,t[50]=_e,t[51]=A):A=t[51];let ve;t[52]===c?ve=t[53]:(ve=c===null?null:(0,P.jsx)(Ve,{preview:c,onClose:()=>l(null)}),t[52]=c,t[53]=ve);let ye;return t[54]!==A||t[55]!==ve?(ye=(0,P.jsxs)(P.Fragment,{children:[A,ve]}),t[54]=A,t[55]=ve,t[56]=ye):ye=t[56],ye}function xn(e){return console.error(e)}function Sn(){}function Cn(){}function wn(e){return console.error(e)}function Tn(e){return!gn.has(e.command)}var En=`flex h-10 min-h-10 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-3 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,Dn=`data-file-link-reveal`,On=`
5
5
  ${dt}
@@ -45,7 +45,7 @@ import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-DD6u-vDm.js
45
45
  ) !important;
46
46
  color: var(--diffs-selection-number-fg) !important;
47
47
  }
48
- `;function kn(e){let t=(0,N.c)(11),n=e.pressed,r;t[0]!==n||t[1]!==e.children||t[2]!==e.disabled||t[3]!==e.label||t[4]!==e.onPress?(r=(0,P.jsx)(St,{render:n===void 0?(0,P.jsx)(E,{type:`button`,className:`shrink-0`,disabled:e.disabled??!1,onClick:e.onPress,"aria-label":e.label,variant:`ghost`,size:`icon-sm`,children:e.children}):(0,P.jsx)(Dt,{className:`shrink-0`,pressed:n,disabled:e.disabled??!1,onPressedChange:e.onPress,"aria-label":e.label,variant:`ghost`,size:`sm`,children:e.children})}),t[0]=n,t[1]=e.children,t[2]=e.disabled,t[3]=e.label,t[4]=e.onPress,t[5]=r):r=t[5];let i;t[6]===e.label?i=t[7]:(i=(0,P.jsx)(Ct,{children:e.label}),t[6]=e.label,t[7]=i);let a;return t[8]!==r||t[9]!==i?(a=(0,P.jsxs)(wt,{children:[r,i]}),t[8]=r,t[9]=i,t[10]=a):a=t[10],a}function An(e){let t=(0,N.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,P.jsx)(`div`,{role:`status`,className:`shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-2xs text-warning-foreground`,children:e.children}),t[0]=e.children,t[1]=n),n}function jn(e){let t=(0,N.c)(5),n;t[0]===e.className?n=t[1]:(n=de(`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,e.className),t[0]=e.className,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(Je,{size:`lg`}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,P.jsx)(`div`,{role:`status`,"aria-label":`Loading file`,className:n,children:r}),t[3]=n,t[4]=i),i}function Mn(e){let t=(0,N.c)(7),n;t[0]===e.message?n=t[1]:(n=(0,P.jsx)(`p`,{className:`text-destructive`,children:e.message}),t[0]=e.message,t[1]=n);let r;t[2]===e.onRetry?r=t[3]:(r=e.onRetry?(0,P.jsx)(`button`,{type:`button`,onClick:e.onRetry,className:`rounded-md border border-input px-2.5 py-1 text-xs text-foreground hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:`Try again`}):null,t[2]=e.onRetry,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,P.jsxs)(`div`,{role:`alert`,className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center text-xs leading-relaxed`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Nn(e){let t=(0,N.c)(29),n;t[0]!==e.delimiter||t[1]!==e.text?(n=sn(e.text,e.delimiter),t[0]=e.delimiter,t[1]=e.text,t[2]=n):n=t[2];let r=n,i,a,o,s,c,l,u;if(t[3]!==e.name||t[4]!==r.rows||t[5]!==r.truncated){let[n,...d]=r.rows;c=`flex min-h-0 flex-1 flex-col`,t[13]===r.truncated?l=t[14]:(l=r.truncated?(0,P.jsx)(An,{children:`Table limited to the first 100 rows and 30 columns. Switch to source for the rest.`}):null,t[13]=r.truncated,t[14]=l),s=`min-h-0 flex-1 overflow-auto`,i=`min-w-full border-separate border-spacing-0 text-xs`,a=e.name,t[15]===n?o=t[16]:(o=n?(0,P.jsx)(`thead`,{className:`sticky top-0 z-10`,children:(0,P.jsx)(`tr`,{children:n.map(In)})}):null,t[15]=n,t[16]=o),u=(0,P.jsx)(`tbody`,{children:d.map(Pn)}),t[3]=e.name,t[4]=r.rows,t[5]=r.truncated,t[6]=i,t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=u}else i=t[6],a=t[7],o=t[8],s=t[9],c=t[10],l=t[11],u=t[12];let d;t[17]!==i||t[18]!==a||t[19]!==o||t[20]!==u?(d=(0,P.jsxs)(`table`,{className:i,"aria-label":a,children:[o,u]}),t[17]=i,t[18]=a,t[19]=o,t[20]=u,t[21]=d):d=t[21];let f;t[22]!==s||t[23]!==d?(f=(0,P.jsx)(`div`,{className:s,children:d}),t[22]=s,t[23]=d,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==f?(p=(0,P.jsxs)(`div`,{className:c,children:[l,f]}),t[25]=c,t[26]=l,t[27]=f,t[28]=p):p=t[28],p}function Pn(e,t){return(0,P.jsx)(`tr`,{className:`even:bg-muted/30`,children:e.map(Fn)},t)}function Fn(e,t){return(0,P.jsx)(`td`,{className:`max-w-80 border-b border-border/60 px-3 py-1.5 align-top whitespace-pre-wrap break-words tabular-nums`,children:e},t)}function In(e,t){return(0,P.jsx)(`th`,{scope:`col`,className:`max-w-80 border-b border-border bg-muted/60 px-3 py-1.5 text-left align-bottom font-medium whitespace-pre-wrap break-words backdrop-blur`,children:e},t)}var Ln=(0,M.lazy)(()=>n(()=>import(`./ReadOnlySourcePreview-CiVudVcz.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332]))),Rn=3e5;function zn(e){let t=(0,N.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,P.jsx)(jn,{className:`p-4`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,P.jsx)(M.Suspense,{fallback:n,children:(0,P.jsx)(Ln,{...e})}),t[1]=e,t[2]=r),r}function Bn(e,t){return e===`markdown`?t?`Show markdown source`:`Show rendered markdown`:e===`table`?t?`Show source`:`Show table`:t?`Show HTML source`:`Show rendered page`}function Vn(e){let t=Se(e),n=on(e),r=t===`markdown`?`markdown`:t===`html`?`html`:n?`table`:null,i=e.asset?.attachmentId,{copyToClipboard:a,isCopied:o}=Ze({target:e.name}),s=(0,M.useMemo)(()=>i?{_tag:`attachment`,attachmentId:i,fileName:e.name,mimeType:e.mimeType,disposition:`inline`}:null,[i,e.name,e.mimeType]),c=It(e.file?null:e.asset?.environmentId??null,e.file?null:s),l=(0,M.useMemo)(()=>s?{...s,disposition:`attachment`}:null,[s]),u=It(e.asset?.environmentId??null,l),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(null),[g,_]=(0,M.useState)(null),[v,b]=(0,M.useState)(!0),[x,S]=(0,M.useState)(0),[C,T]=(0,M.useState)(null),[E,D]=(0,M.useState)(null),[te,ne]=(0,M.useState)(null),re=(0,M.useRef)(0);(0,M.useEffect)(()=>{if(!e.file)return;let t=URL.createObjectURL(e.file);return m(t),()=>URL.revokeObjectURL(t)},[e.file]),(0,M.useEffect)(()=>{if(e.file)return;let t=!1;return _(null),D(null),c().then(e=>{if(!t){if(!e)throw Error(`Reconnect to the environment and try again.`);re.current=Date.now(),_(e)}}).catch(e=>{t||D(e instanceof Error?e.message:`The attachment is unavailable.`)}),()=>{t=!0}},[e.file,c,x]);let O=e.file?p:g,k=t===`text`||t===`markdown`||t===`html`&&!v;(0,M.useEffect)(()=>{if(!k||!O)return;let t=new AbortController;T(null),ne(null);let n=e.file;return(async()=>{if(!n&&Date.now()-re.current>Rn){let e=await c();if(t.signal.aborted)return;if(!e)throw Error(`Reconnect to the environment and try again.`);if(re.current=Date.now(),e!==O){_(e);return}}let r=await cn(n?{ok:!0,body:n.stream()}:await fetch(O,{signal:t.signal,...e.sizeBytes>0?{headers:{Range:`bytes=0-${Ce}`}}:{},cache:x===0?`default`:`reload`}),t.signal);t.signal.aborted||T(r)})().catch(e=>{t.signal.aborted||ne(e instanceof Error?e.message:`Could not load this file.`)}),()=>t.abort()},[O,k,x,e.sizeBytes,e.file,c]);let ie=E??(k?te:null),ae=tt(e=>e.wordWrap),oe=$e(),se=ie===null&&k&&C!==null&&!(n&&v)&&!(t===`markdown`&&v),ce=()=>{f(!0),(async()=>{try{let t=e.file;if(!t){let e=await u();if(!e)throw Error(`Reconnect to the environment and try again.`);let n=await fetch(e);if(!n.ok)throw Error(`The file could not be loaded. Try again.`);t=await n.blob()}let n=URL.createObjectURL(t);try{let t=document.createElement(`a`);t.href=n,t.download=e.name,t.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}catch(e){Xe.add({type:`error`,title:`Could not save file`,description:e instanceof Error?e.message:`Please try again.`})}finally{f(!1)}})()},le=ie?(0,P.jsx)(Mn,{message:ie,onRetry:()=>{D(null),S(e=>e+1)}}):!O||k&&!C?(0,P.jsx)(jn,{}):k&&C?n&&v?(0,P.jsx)(Nn,{name:e.name,text:C.text,delimiter:n}):t===`markdown`&&v?(0,P.jsx)(Ft,{className:`min-h-0 flex-1`,children:(0,P.jsx)(He,{text:C.text,cwd:void 0,className:`mx-auto max-w-4xl px-6 py-5`})}):(0,P.jsx)(zn,{name:e.name,text:C.text}):t===`pdf`||t===`html`?(0,P.jsx)(vn,{src:O,title:e.name,pdf:t===`pdf`,htmlRender:e.htmlRender===!0,threadRef:e.threadRef}):t===`audio`?(0,P.jsx)(ln,{src:O,name:e.name,onError:()=>D(`Unable to load audio.`)}):t===`video`?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black`,children:(0,P.jsx)(`video`,{controls:!0,playsInline:!0,src:O,"aria-label":e.name,className:`max-h-full max-w-full`,onError:()=>D(`Unable to load video.`)})}):t===`image`?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,P.jsx)(`img`,{src:O,alt:e.name,className:`max-h-full max-w-full object-contain`,onError:()=>D(`Unable to load image.`)})}):(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-1 px-6 text-center`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`No preview for this file`}),(0,P.jsxs)(`p`,{className:`max-w-sm text-xs leading-relaxed text-muted-foreground`,children:[`Save it to open in an app that supports `,e.name.split(`.`).at(-1)||`this format`,` `,`files.`]})]});return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,P.jsxs)(`div`,{className:de(En),"data-surface-subheader":!0,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center text-xs`,children:[(0,P.jsx)(`span`,{className:`shrink-0 px-0.5 text-muted-foreground`,children:e.origin??`Attachment`}),(0,P.jsx)(h,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}),(0,P.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate px-0.5 font-medium text-foreground`,children:e.name}),e.sizeBytes>0?(0,P.jsx)(`span`,{className:`ml-2 shrink-0 text-muted-foreground`,children:Rt(e.sizeBytes)}):null]}),r?(0,P.jsx)(kn,{label:Bn(r,v),pressed:v,onPress:()=>b(e=>!e),children:(0,P.jsx)(ke,{className:`size-3.5`,icon:v?De:r===`table`?Ee:j})}):null,se?(0,P.jsx)(kn,{label:ae?`Disable word wrap`:`Enable word wrap`,pressed:ae,onPress:()=>oe({wordWrap:!ae}),children:(0,P.jsx)(fe,{className:`size-3.5`})}):null,C?(0,P.jsx)(kn,{label:o?`Copied`:C.truncated?`Copy preview`:`Copy contents`,onPress:()=>a(C.text,void 0),children:(0,P.jsx)(ke,{className:`size-3.5`,icon:o?Oe:Te})}):null,O?(0,P.jsx)(kn,{label:d?`Preparing file…`:`Save file`,disabled:d,onPress:ce,children:(0,P.jsx)(w,{className:`size-3.5`})}):null,e.onRemove?(0,P.jsx)(kn,{label:`Remove from draft`,onPress:e.onRemove,children:(0,P.jsx)(y,{className:`size-3.5`})}):null,e.onClose?(0,P.jsx)(kn,{label:`Close`,onPress:e.onClose,children:(0,P.jsx)(ee,{className:`size-3.5`})}):null]}),C?.truncated?(0,P.jsxs)(An,{children:[`Preview limited to the first 1 MB`,e.sizeBytes>0?` of a ${e.sizeBytes.toLocaleString()} byte file`:``,`. Save the file to read it in full.`]}):null,le]})}function Hn(e){let t=e.getData(`text/plain`),n=be(e.getData(`web application/x-p4-context-fragment+json`))??he(e.getData(`text/html`));if(n===null)return null;let r=new Set(b(t).map(e=>e.contextId));for(let e of n.records)e.kind===`preview-annotation`&&!(`payload`in e)&&r.has(e.contextId)&&e.screenshotContextId&&r.add(e.screenshotContextId);return{...n,records:n.records.filter(e=>r.has(e.contextId))}}function Un(e,t){let n=e.getData(`text/plain`),r=t?Hn(e):null,i=r&&r.records.length>0?t(r):null;return i&&i.size>0?O(n,e=>{let t=i.get(e.contextId);return t?l({...e,contextId:ce.make(t),kind:e.kind===`element`?`preview-annotation`:e.kind}):e.source}):n}var Wn=`Ask for changes, send follow-ups, or attach images`;function Gn(e){let t=e.match(/^[ \t]*/)?.[0]??``,n=e.slice(t.length),r=n.match(/^(\d+)([.)])((?:[ \t]+)|\s*$)/);if(r&&r[1]!==void 0&&r[2]!==void 0)return{marker:{kind:`ordered`,indent:t,numberText:r[1],delimiter:r[2]===`)`?`)`:`.`,space:r[3]??``},markerEnd:t.length+r[0].length};let i=n.match(/^-\s\[[ xX]\]((?:[ \t]+)|\s*$)/);if(i)return{marker:{kind:`task`,indent:t,space:i[1]??``},markerEnd:t.length+i[0].length};let a=n.match(/^([-*+])((?:[ \t]+)|\s*$)/);return a&&a[1]!==void 0?{marker:{kind:`bullet`,indent:t,bullet:a[1],space:a[2]??``},markerEnd:t.length+a[0].length}:null}function Kn(e){let t=e.slice(0,-1),n=e.slice(-1),r=Number.parseInt(t,10);return`${Number.isSafeInteger(r)?String(r+1).padStart(t.length,`0`):t}${n}`}function qn(e){return e.kind===`ordered`?`${e.indent}${Kn(`${e.numberText}${e.delimiter}`)} `:e.kind===`task`?`${e.indent}- [ ] `:`${e.indent}${e.bullet} `}function Jn(e){return e.type===`text`?e.text:e.source}function Yn(e,t){let n=0;for(let r of Gt(e)){let e=n+Jn(r).length;if(r.type!==`text`&&t>n&&t<e)return!0;n=e}return!1}function Xn(e,t){let n=e.lastIndexOf(`
48
+ `;function kn(e){let t=(0,N.c)(11),n=e.pressed,r;t[0]!==n||t[1]!==e.children||t[2]!==e.disabled||t[3]!==e.label||t[4]!==e.onPress?(r=(0,P.jsx)(St,{render:n===void 0?(0,P.jsx)(E,{type:`button`,className:`shrink-0`,disabled:e.disabled??!1,onClick:e.onPress,"aria-label":e.label,variant:`ghost`,size:`icon-sm`,children:e.children}):(0,P.jsx)(Dt,{className:`shrink-0`,pressed:n,disabled:e.disabled??!1,onPressedChange:e.onPress,"aria-label":e.label,variant:`ghost`,size:`sm`,children:e.children})}),t[0]=n,t[1]=e.children,t[2]=e.disabled,t[3]=e.label,t[4]=e.onPress,t[5]=r):r=t[5];let i;t[6]===e.label?i=t[7]:(i=(0,P.jsx)(Ct,{children:e.label}),t[6]=e.label,t[7]=i);let a;return t[8]!==r||t[9]!==i?(a=(0,P.jsxs)(wt,{children:[r,i]}),t[8]=r,t[9]=i,t[10]=a):a=t[10],a}function An(e){let t=(0,N.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,P.jsx)(`div`,{role:`status`,className:`shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-2xs text-warning-foreground`,children:e.children}),t[0]=e.children,t[1]=n),n}function jn(e){let t=(0,N.c)(5),n;t[0]===e.className?n=t[1]:(n=de(`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,e.className),t[0]=e.className,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(Je,{size:`lg`}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,P.jsx)(`div`,{role:`status`,"aria-label":`Loading file`,className:n,children:r}),t[3]=n,t[4]=i),i}function Mn(e){let t=(0,N.c)(7),n;t[0]===e.message?n=t[1]:(n=(0,P.jsx)(`p`,{className:`text-destructive`,children:e.message}),t[0]=e.message,t[1]=n);let r;t[2]===e.onRetry?r=t[3]:(r=e.onRetry?(0,P.jsx)(`button`,{type:`button`,onClick:e.onRetry,className:`rounded-md border border-input px-2.5 py-1 text-xs text-foreground hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:`Try again`}):null,t[2]=e.onRetry,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,P.jsxs)(`div`,{role:`alert`,className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center text-xs leading-relaxed`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Nn(e){let t=(0,N.c)(29),n;t[0]!==e.delimiter||t[1]!==e.text?(n=sn(e.text,e.delimiter),t[0]=e.delimiter,t[1]=e.text,t[2]=n):n=t[2];let r=n,i,a,o,s,c,l,u;if(t[3]!==e.name||t[4]!==r.rows||t[5]!==r.truncated){let[n,...d]=r.rows;c=`flex min-h-0 flex-1 flex-col`,t[13]===r.truncated?l=t[14]:(l=r.truncated?(0,P.jsx)(An,{children:`Table limited to the first 100 rows and 30 columns. Switch to source for the rest.`}):null,t[13]=r.truncated,t[14]=l),s=`min-h-0 flex-1 overflow-auto`,i=`min-w-full border-separate border-spacing-0 text-xs`,a=e.name,t[15]===n?o=t[16]:(o=n?(0,P.jsx)(`thead`,{className:`sticky top-0 z-10`,children:(0,P.jsx)(`tr`,{children:n.map(In)})}):null,t[15]=n,t[16]=o),u=(0,P.jsx)(`tbody`,{children:d.map(Pn)}),t[3]=e.name,t[4]=r.rows,t[5]=r.truncated,t[6]=i,t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=u}else i=t[6],a=t[7],o=t[8],s=t[9],c=t[10],l=t[11],u=t[12];let d;t[17]!==i||t[18]!==a||t[19]!==o||t[20]!==u?(d=(0,P.jsxs)(`table`,{className:i,"aria-label":a,children:[o,u]}),t[17]=i,t[18]=a,t[19]=o,t[20]=u,t[21]=d):d=t[21];let f;t[22]!==s||t[23]!==d?(f=(0,P.jsx)(`div`,{className:s,children:d}),t[22]=s,t[23]=d,t[24]=f):f=t[24];let p;return t[25]!==c||t[26]!==l||t[27]!==f?(p=(0,P.jsxs)(`div`,{className:c,children:[l,f]}),t[25]=c,t[26]=l,t[27]=f,t[28]=p):p=t[28],p}function Pn(e,t){return(0,P.jsx)(`tr`,{className:`even:bg-muted/30`,children:e.map(Fn)},t)}function Fn(e,t){return(0,P.jsx)(`td`,{className:`max-w-80 border-b border-border/60 px-3 py-1.5 align-top whitespace-pre-wrap break-words tabular-nums`,children:e},t)}function In(e,t){return(0,P.jsx)(`th`,{scope:`col`,className:`max-w-80 border-b border-border bg-muted/60 px-3 py-1.5 text-left align-bottom font-medium whitespace-pre-wrap break-words backdrop-blur`,children:e},t)}var Ln=(0,M.lazy)(()=>n(()=>import(`./ReadOnlySourcePreview-CSK6ee05.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332]))),Rn=3e5;function zn(e){let t=(0,N.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,P.jsx)(jn,{className:`p-4`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,P.jsx)(M.Suspense,{fallback:n,children:(0,P.jsx)(Ln,{...e})}),t[1]=e,t[2]=r),r}function Bn(e,t){return e===`markdown`?t?`Show markdown source`:`Show rendered markdown`:e===`table`?t?`Show source`:`Show table`:t?`Show HTML source`:`Show rendered page`}function Vn(e){let t=Se(e),n=on(e),r=t===`markdown`?`markdown`:t===`html`?`html`:n?`table`:null,i=e.asset?.attachmentId,{copyToClipboard:a,isCopied:o}=Ze({target:e.name}),s=(0,M.useMemo)(()=>i?{_tag:`attachment`,attachmentId:i,fileName:e.name,mimeType:e.mimeType,disposition:`inline`}:null,[i,e.name,e.mimeType]),c=It(e.file?null:e.asset?.environmentId??null,e.file?null:s),l=(0,M.useMemo)(()=>s?{...s,disposition:`attachment`}:null,[s]),u=It(e.asset?.environmentId??null,l),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(null),[g,_]=(0,M.useState)(null),[v,b]=(0,M.useState)(!0),[x,S]=(0,M.useState)(0),[C,T]=(0,M.useState)(null),[E,D]=(0,M.useState)(null),[te,ne]=(0,M.useState)(null),re=(0,M.useRef)(0);(0,M.useEffect)(()=>{if(!e.file)return;let t=URL.createObjectURL(e.file);return m(t),()=>URL.revokeObjectURL(t)},[e.file]),(0,M.useEffect)(()=>{if(e.file)return;let t=!1;return _(null),D(null),c().then(e=>{if(!t){if(!e)throw Error(`Reconnect to the environment and try again.`);re.current=Date.now(),_(e)}}).catch(e=>{t||D(e instanceof Error?e.message:`The attachment is unavailable.`)}),()=>{t=!0}},[e.file,c,x]);let O=e.file?p:g,k=t===`text`||t===`markdown`||t===`html`&&!v;(0,M.useEffect)(()=>{if(!k||!O)return;let t=new AbortController;T(null),ne(null);let n=e.file;return(async()=>{if(!n&&Date.now()-re.current>Rn){let e=await c();if(t.signal.aborted)return;if(!e)throw Error(`Reconnect to the environment and try again.`);if(re.current=Date.now(),e!==O){_(e);return}}let r=await cn(n?{ok:!0,body:n.stream()}:await fetch(O,{signal:t.signal,...e.sizeBytes>0?{headers:{Range:`bytes=0-${Ce}`}}:{},cache:x===0?`default`:`reload`}),t.signal);t.signal.aborted||T(r)})().catch(e=>{t.signal.aborted||ne(e instanceof Error?e.message:`Could not load this file.`)}),()=>t.abort()},[O,k,x,e.sizeBytes,e.file,c]);let ie=E??(k?te:null),ae=tt(e=>e.wordWrap),oe=$e(),se=ie===null&&k&&C!==null&&!(n&&v)&&!(t===`markdown`&&v),ce=()=>{f(!0),(async()=>{try{let t=e.file;if(!t){let e=await u();if(!e)throw Error(`Reconnect to the environment and try again.`);let n=await fetch(e);if(!n.ok)throw Error(`The file could not be loaded. Try again.`);t=await n.blob()}let n=URL.createObjectURL(t);try{let t=document.createElement(`a`);t.href=n,t.download=e.name,t.click()}finally{setTimeout(()=>URL.revokeObjectURL(n),3e4)}}catch(e){Xe.add({type:`error`,title:`Could not save file`,description:e instanceof Error?e.message:`Please try again.`})}finally{f(!1)}})()},le=ie?(0,P.jsx)(Mn,{message:ie,onRetry:()=>{D(null),S(e=>e+1)}}):!O||k&&!C?(0,P.jsx)(jn,{}):k&&C?n&&v?(0,P.jsx)(Nn,{name:e.name,text:C.text,delimiter:n}):t===`markdown`&&v?(0,P.jsx)(Ft,{className:`min-h-0 flex-1`,children:(0,P.jsx)(He,{text:C.text,cwd:void 0,className:`mx-auto max-w-4xl px-6 py-5`})}):(0,P.jsx)(zn,{name:e.name,text:C.text}):t===`pdf`||t===`html`?(0,P.jsx)(vn,{src:O,title:e.name,pdf:t===`pdf`,htmlRender:e.htmlRender===!0,threadRef:e.threadRef}):t===`audio`?(0,P.jsx)(ln,{src:O,name:e.name,onError:()=>D(`Unable to load audio.`)}):t===`video`?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black`,children:(0,P.jsx)(`video`,{controls:!0,playsInline:!0,src:O,"aria-label":e.name,className:`max-h-full max-w-full`,onError:()=>D(`Unable to load video.`)})}):t===`image`?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,P.jsx)(`img`,{src:O,alt:e.name,className:`max-h-full max-w-full object-contain`,onError:()=>D(`Unable to load image.`)})}):(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-1 px-6 text-center`,children:[(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`No preview for this file`}),(0,P.jsxs)(`p`,{className:`max-w-sm text-xs leading-relaxed text-muted-foreground`,children:[`Save it to open in an app that supports `,e.name.split(`.`).at(-1)||`this format`,` `,`files.`]})]});return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,P.jsxs)(`div`,{className:de(En),"data-surface-subheader":!0,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center text-xs`,children:[(0,P.jsx)(`span`,{className:`shrink-0 px-0.5 text-muted-foreground`,children:e.origin??`Attachment`}),(0,P.jsx)(h,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}),(0,P.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate px-0.5 font-medium text-foreground`,children:e.name}),e.sizeBytes>0?(0,P.jsx)(`span`,{className:`ml-2 shrink-0 text-muted-foreground`,children:Rt(e.sizeBytes)}):null]}),r?(0,P.jsx)(kn,{label:Bn(r,v),pressed:v,onPress:()=>b(e=>!e),children:(0,P.jsx)(ke,{className:`size-3.5`,icon:v?De:r===`table`?Ee:j})}):null,se?(0,P.jsx)(kn,{label:ae?`Disable word wrap`:`Enable word wrap`,pressed:ae,onPress:()=>oe({wordWrap:!ae}),children:(0,P.jsx)(fe,{className:`size-3.5`})}):null,C?(0,P.jsx)(kn,{label:o?`Copied`:C.truncated?`Copy preview`:`Copy contents`,onPress:()=>a(C.text,void 0),children:(0,P.jsx)(ke,{className:`size-3.5`,icon:o?Oe:Te})}):null,O?(0,P.jsx)(kn,{label:d?`Preparing file…`:`Save file`,disabled:d,onPress:ce,children:(0,P.jsx)(w,{className:`size-3.5`})}):null,e.onRemove?(0,P.jsx)(kn,{label:`Remove from draft`,onPress:e.onRemove,children:(0,P.jsx)(y,{className:`size-3.5`})}):null,e.onClose?(0,P.jsx)(kn,{label:`Close`,onPress:e.onClose,children:(0,P.jsx)(ee,{className:`size-3.5`})}):null]}),C?.truncated?(0,P.jsxs)(An,{children:[`Preview limited to the first 1 MB`,e.sizeBytes>0?` of a ${e.sizeBytes.toLocaleString()} byte file`:``,`. Save the file to read it in full.`]}):null,le]})}function Hn(e){let t=e.getData(`text/plain`),n=be(e.getData(`web application/x-p4-context-fragment+json`))??he(e.getData(`text/html`));if(n===null)return null;let r=new Set(b(t).map(e=>e.contextId));for(let e of n.records)e.kind===`preview-annotation`&&!(`payload`in e)&&r.has(e.contextId)&&e.screenshotContextId&&r.add(e.screenshotContextId);return{...n,records:n.records.filter(e=>r.has(e.contextId))}}function Un(e,t){let n=e.getData(`text/plain`),r=t?Hn(e):null,i=r&&r.records.length>0?t(r):null;return i&&i.size>0?O(n,e=>{let t=i.get(e.contextId);return t?l({...e,contextId:ce.make(t),kind:e.kind===`element`?`preview-annotation`:e.kind}):e.source}):n}var Wn=`Ask for changes, send follow-ups, or attach images`;function Gn(e){let t=e.match(/^[ \t]*/)?.[0]??``,n=e.slice(t.length),r=n.match(/^(\d+)([.)])((?:[ \t]+)|\s*$)/);if(r&&r[1]!==void 0&&r[2]!==void 0)return{marker:{kind:`ordered`,indent:t,numberText:r[1],delimiter:r[2]===`)`?`)`:`.`,space:r[3]??``},markerEnd:t.length+r[0].length};let i=n.match(/^-\s\[[ xX]\]((?:[ \t]+)|\s*$)/);if(i)return{marker:{kind:`task`,indent:t,space:i[1]??``},markerEnd:t.length+i[0].length};let a=n.match(/^([-*+])((?:[ \t]+)|\s*$)/);return a&&a[1]!==void 0?{marker:{kind:`bullet`,indent:t,bullet:a[1],space:a[2]??``},markerEnd:t.length+a[0].length}:null}function Kn(e){let t=e.slice(0,-1),n=e.slice(-1),r=Number.parseInt(t,10);return`${Number.isSafeInteger(r)?String(r+1).padStart(t.length,`0`):t}${n}`}function qn(e){return e.kind===`ordered`?`${e.indent}${Kn(`${e.numberText}${e.delimiter}`)} `:e.kind===`task`?`${e.indent}- [ ] `:`${e.indent}${e.bullet} `}function Jn(e){return e.type===`text`?e.text:e.source}function Yn(e,t){let n=0;for(let r of Gt(e)){let e=n+Jn(r).length;if(r.type!==`text`&&t>n&&t<e)return!0;n=e}return!1}function Xn(e,t){let n=e.lastIndexOf(`
49
49
  `,t-1)+1,r=e.indexOf(`
50
50
  `,t),i=r===-1?e.length:r;return{start:n,end:i,text:e.slice(n,i)}}function Zn(e,t){if(!Number.isInteger(t)||t<0||t>e.length)return null;let n=Xn(e,t),r=Gn(n.text);if(!r||r.marker.space===``)return null;let i=n.start+r.markerEnd;return t<i||Yn(e,t)?null:e.slice(i,n.end).trim()===``?{start:n.start,end:Math.max(t,i),replacement:``}:{start:t,end:t,replacement:`\n${qn(r.marker)}`}}function Qn(e,t,n){if(!Number.isInteger(t)||t!==n||t<0||t>e.length)return null;let r=Xn(e,t);return!Gn(r.text)||Yn(e,t)?null:{start:r.start,end:r.start,replacement:` `}}function $n(e){let t=0,n=0;for(let r of e.imageIds){let i=e.uploadsByImageId[r];i?.status===`failed`&&i.environmentId===e.environmentId?n+=1:(i?.status!==`ready`||i.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?`Retry or remove the failed attachment`:`Retry or remove the failed attachments`:t>0?t===1?`Attachment still uploading`:`Attachments still uploading`:null}function er(e){return`${Math.floor(Math.max(0,Math.min(1,Number.isFinite(e)?e:0))*100)}%`}var tr=Object.defineProperty,nr=(e,t)=>{let n={};for(var r in e)tr(n,r,{get:e[r],enumerable:!0});return t||tr(n,Symbol.toStringTag,{value:`Module`}),n};function rr(e){this.content=e}rr.prototype={constructor:rr,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new rr(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new rr(n)},addToStart:function(e,t){return new rr([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new rr(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new rr(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=rr.from(e),e.size?new rr(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=rr.from(e),e.size?new rr(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=rr.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},rr.from=function(e){if(e instanceof rr)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new rr(t)};function ir(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a)n+=i.nodeSize;else{if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&sr(e.charCodeAt(r-1))&&or(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ir(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function ar(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s)n-=c,r-=c;else{if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&sr(e.charCodeAt(i-1))&&or(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ar(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}}function or(e){return e>=56320&&e<57344}function sr(e){return e>=55296&&e<56320}var F=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ir(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ar(this,e,t,n)}findIndex(e){if(e==0)return lr(0,e);if(e==this.size)return lr(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?lr(t+1,i):lr(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};F.empty=new F([],0);var cr={index:0,offset:0};function lr(e,t){return cr.index=e,cr.offset=t,cr}function ur(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!ur(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ur(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var I=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ur(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};I.none=[];var dr=class extends Error{},L=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=pr(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(fr(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(F.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};L.empty=new L(F.empty,0,0);function fr(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(fr(a.content,t-i-1,n-i-1)))}function pr(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=pr(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function mr(e,t,n){if(n.openStart>e.depth)throw new dr(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new dr(`Inconsistent open depths`);return hr(e,t,n,0)}function hr(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=hr(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return br(a,Sr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return br(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Cr(n,e);return br(a,xr(e,i,o,t,r))}}function gr(e,t){if(!t.type.compatibleContent(e.type))throw new dr(`Cannot join `+t.type.name+` onto `+e.type.name)}function _r(e,t,n){let r=e.node(n);return gr(r,t.node(n)),r}function vr(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function yr(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(vr(e.nodeAfter,r),a++));for(let e=a;e<o;e++)vr(i.child(e),r);t&&t.depth==n&&t.textOffset&&vr(t.nodeBefore,r)}function br(e,t){if(!e.type.validContent(t))throw new dr(`Invalid content for node `+e.type.name);return e.copy(t)}function xr(e,t,n,r,i){let a=e.depth>i&&_r(e,t,i+1),o=r.depth>i&&_r(n,r,i+1),s=[];return yr(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(gr(a,o),vr(br(a,xr(e,t,n,r,i+1)),s)):(a&&vr(br(a,Sr(e,t,i+1)),s),yr(t,n,i,s),o&&vr(br(o,Sr(n,r,i+1)),s)),yr(r,null,i,s),new F(s)}function Sr(e,t,n){let r=[];return yr(null,e,n,r),e.depth>n&&vr(br(_r(e,t,n+1),Sr(e,t,n+1)),r),yr(t,null,n,r),new F(r)}function Cr(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(F.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var wr=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive!==!1||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive!==!1||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Or(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Dr.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Dr.set(t,r=new Tr);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Er,i}},Tr=class{constructor(){this.elts=[],this.i=0}},Er=12,Dr=new WeakMap,Or=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},kr=Object.create(null),Ar=class e{constructor(e,t,n,r=I.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&ur(this.attrs,t||e.defaultAttrs||kr)&&I.sameSet(this.marks,n||I.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return L.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new L(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return mr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return wr.resolveCached(this,e)}resolveNoCache(e){return wr.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Mr(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=F.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=I.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!I.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=F.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Ar.prototype.text=void 0;var jr=class e extends Ar{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Mr(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Mr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Nr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Pr(t,n);if(r.next==null)return e.empty;let i=Fr(r);r.next&&r.err(`Unexpected trailing text`);let a=Gr(Hr(i));return Kr(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return F.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];a.isLeaf||a.hasRequiredAttrs()||a.name in t||r.type&&!o.validEnd||(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
51
51
  `)}};Nr.empty=new Nr(!0);var Pr=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Fr(e){let t=[];do t.push(Ir(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ir(e){let t=[];do t.push(Lr(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Lr(e){let t=Vr(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=zr(e,t);else break;return t}function Rr(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function zr(e,t){let n=Rr(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Rr(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Br(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Vr(e){if(e.eat(`(`)){let t=Fr(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Br(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Hr(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Ur(e,t){return t-e}function Wr(e,t){let n=[];return r(t),n.sort(Ur);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Gr(e){let t=Object.create(null);return n(Wr(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Wr(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Nr(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Ur);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Kr(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function qr(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Jr(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Yr(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Xr(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new $r(e,r,t[r]);return n}var Zr=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Xr(e,n.attrs),this.defaultAttrs=qr(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Nr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Jr(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Ar(this,this.computeAttrs(e),F.from(t),I.setFrom(n))}createChecked(e=null,t,n){return t=F.from(t),this.checkContent(t),new Ar(this,this.computeAttrs(e),t,I.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=F.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(F.empty,!0);return i?new Ar(this,e,t.append(i),I.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Yr(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:I.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Qr(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var $r=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Qr(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ei=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Xr(e,r.attrs),this.excluded=null;let i=qr(this.attrs);this.instance=i?new I(this,i):null}create(e=null){return!e&&this.instance?this.instance:new I(this,Jr(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Yr(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ti=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=rr.from(e.nodes),t.marks=rr.from(e.marks||{}),this.nodes=Zr.compile(this.spec.nodes,this),this.marks=ei.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Nr.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?ni(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:ni(this,n.split(` `))}this.nodeFromJSON=e=>Ar.fromJSON(this,e),this.markFromJSON=e=>I.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Zr))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new jr(n,n.defaultAttrs,e,I.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function ni(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ri(e){return e.tag!=null}function ii(e){return e.style!=null}var ai=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ri(e))this.tags.push(e);else if(ii(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new mi(this,t,!1);return n.addAll(e,I.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new mi(this,t,!0);return n.addAll(e,I.none,t.from,t.to),L.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(gi(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_i(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=_i(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},oi={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},si={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ci={ol:!0,ul:!0},li=1,ui=2,di=4;function fi(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?li:0)|(t===`full`?ui:0)}var pi=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=I.none,this.match=i||(a&di?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&li)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!oi.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},mi=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=fi(null,t.preserveWhitespace,0)|(n?di:0);i=r?new pi(r.type,r.attrs,I.none,!0,t.topMatch||r.type.contentMatch,a):n?new pi(null,null,I.none,!0,null,a):new pi(e.schema.topNodeType,null,I.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&ui?`full`:this.localPreserveWS||(r.options&li)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
@@ -201,4 +201,4 @@ img.ProseMirror-separator {
201
201
  `,o)?2:1);for(let e of n){let t=e.content.length;e.color&&e.content.trim()&&a.push({from:o,to:o+t,color:e.color}),o+=t}}return a}function pT(e,t,n){let r=[];for(let{node:i,pos:a}of uT(e)){if(!cT(i.textContent))continue;let e=t.get(lT(i,n));if(!e||i.content.size!==i.textContent.length)continue;let o=a+1;for(let t of e.decorations)r.push(Pu.inline(o+t.from,o+t.to,{style:`color:${t.color}`}))}return U.create(e.doc,r)}function mT(e,t){return t!==null&&t.start!==t.end&&(t.start!==e.start||t.end!==e.end)}var hT=(0,M.createContext)({openComment:null,onOpenChange:()=>{},onDraftChange:()=>{},onSubmitAndSend:()=>{}}),gT=(0,M.createContext)([]),_T={"(":`)`,"[":`]`,"{":`}`,"'":`'`,'"':`"`,"“":`”`,"`":"`","<":`>`,"«":`»`,"*":`*`,_:`_`};function vT(){return document.documentElement.classList.contains(`dark`)?`dark`:`light`}var yT=`relative inline-flex select-none items-center align-middle leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-sm data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']`,bT=zh.create({name:`composer-mention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},source:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-composer-mention":``,...e}]},addNodeView(){return y_(xT)}});function xT(e){let t=(0,N.c)(25),{node:n}=e,r=(0,M.use)(Mw),i=n.attrs.path??``,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(`button`,{type:`button`}),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==i?(o=()=>r.openMention(i),t[1]=r,t[2]=i,t[3]=o):o=t[3];let s=`Preview ${i}`,c=r.environmentId,l=r.cwd,u;t[4]===i?u=t[5]:(u=Tt(i),t[4]=i,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=vT(),t[6]=d):d=t[6];let f;t[7]!==r.cwd||t[8]!==r.environmentId||t[9]!==i||t[10]!==u?(f=(0,P.jsx)(Le,{path:i,environmentId:c,cwd:l,label:u,theme:d}),t[7]=r.cwd,t[8]=r.environmentId,t[9]=i,t[10]=u,t[11]=f):f=t[11];let p;t[12]!==o||t[13]!==s||t[14]!==f?(p=(0,P.jsx)(Ae,{kind:`mention`,render:a,onClick:o,"aria-label":s,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":`true`,children:f}),t[12]=o,t[13]=s,t[14]=f,t[15]=p):p=t[15];let m=p,h;t[16]===m?h=t[17]:(h=(0,P.jsx)(St,{render:m}),t[16]=m,t[17]=h);let g;t[18]!==r.cwd||t[19]!==r.environmentId||t[20]!==i?(g=(0,P.jsx)(Ct,{side:`top`,children:(0,P.jsx)(We,{path:i,environmentId:r.environmentId,cwd:r.cwd})}),t[18]=r.cwd,t[19]=r.environmentId,t[20]=i,t[21]=g):g=t[21];let _;return t[22]!==h||t[23]!==g?(_=(0,P.jsx)(a_,{as:`span`,className:yT,children:(0,P.jsxs)(wt,{children:[h,g]})}),t[22]=h,t[23]=g,t[24]=_):_=t[24],_}var ST=zh.create({name:`composer-skill`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{skillName:{default:``},skillLabel:{default:``},skillDescription:{default:null}}},parseHTML(){return[{tag:`span[data-composer-skill]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-composer-skill":``,...e}]},addNodeView(){return y_(CT)}});function CT(e){let t=(0,N.c)(21),{node:n}=e,r=(0,M.use)(Mw),i=(0,M.use)(gT),a=n.attrs.skillName??``,o=n.attrs.skillLabel||a,s=n.attrs.skillDescription??null,c;if(t[0]!==a||t[1]!==i){let e;t[3]===a?e=t[4]:(e=e=>e.name===a,t[3]=a,t[4]=e),c=i.find(e),t[0]=a,t[1]=i,t[2]=c}else c=t[2];let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,P.jsx)(Ge,{}),t[5]=u):u=t[5];let d=`Skill ${o}`,f;t[6]===o?f=t[7]:(f=(0,P.jsx)(`p`,{className:`font-medium`,children:o}),t[6]=o,t[7]=f);let p=l?.description??s??`No description is available for this skill.`,m;t[8]===p?m=t[9]:(m=(0,P.jsx)(`p`,{children:p}),t[8]=p,t[9]=m);let h;t[10]!==r||t[11]!==l?(h=l?.path?(0,P.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>r.openMention(l.path),children:`View instructions`}):null,t[10]=r,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==f||t[14]!==m||t[15]!==h?(g=(0,P.jsxs)(`div`,{className:`space-y-3 p-2 text-sm`,children:[f,m,h]}),t[13]=f,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==d||t[19]!==g?(_=(0,P.jsx)(a_,{as:`span`,className:yT,children:(0,P.jsx)(je,{kind:`skill`,icon:u,label:o,accessibleLabel:d,children:g})}),t[17]=o,t[18]=d,t[19]=g,t[20]=_):_=t[20],_}var wT=zh.create({name:`composer-citation`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{citation:{default:null},source:{default:``},citeKey:{default:``}}},parseHTML(){return[{tag:`span[data-composer-citation]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-composer-citation":``,...e}]},addNodeView(){return y_(TT)}});function TT(e){let t=(0,N.c)(47),{node:n,editor:r,getPos:i}=e,a=(0,M.use)(hT),o=n.attrs.citation,s=n.attrs.citeKey,c=a.openComment?.key===s?a.openComment:null,l;t[0]===i?l=t[1]:(l=()=>{let e=typeof i==`function`?i():null;return typeof e==`number`?e:null},t[0]=i,t[1]=l);let u=l,d;t[2]!==r.isEditable||t[3]!==r.state||t[4]!==r.view||t[5]!==u?(d=e=>{if(!r.isEditable)return!1;let t=u();if(t===null)return!1;let n=r.state.doc.nodeAt(t);if(!n||n.type.name!==`composer-citation`)return!1;let i=n.attrs.citation,a=Vt(i,e),o=r.state.tr.setNodeMarkup(t,void 0,{...n.attrs,citation:a,source:Bt(a)});return r.view.dispatch(o),!0},t[2]=r.isEditable,t[3]=r.state,t[4]=r.view,t[5]=u,t[6]=d):d=t[6];let f=d,p=c?.removeOnCancel,m;t[7]!==r||t[8]!==u||t[9]!==p?(m=()=>{if(!r.isEditable||!p)return;let e=u();if(e===null)return;let{doc:t}=r.state,n=t.nodeAt(e);if(!n)return;let i=e+n.nodeSize,a=p.before&&t.textBetween(e-1,e)===` `?e-1:e,o=p.after&&t.textBetween(i,i+1)===` `?i+1:i;r.chain().focus().deleteRange({from:a,to:o}).run()},t[7]=r,t[8]=u,t[9]=p,t[10]=m):m=t[10];let h=m,g;t[11]!==r.commands||t[12]!==r.isEditable||t[13]!==r.state||t[14]!==u?(g=()=>{if(!r.isEditable)return;let e=u();if(e===null)return;let t=r.state.doc.nodeAt(e);t&&t.type.name===`composer-citation`&&r.commands.focus(e+t.nodeSize)},t[11]=r.commands,t[12]=r.isEditable,t[13]=r.state,t[14]=u,t[15]=g):g=t[15];let _=g,v;t[16]!==r.isEditable||t[17]!==_?(v=e=>{!r.isEditable||e.key!==`Tab`||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey||!(e.target instanceof HTMLElement)||e.target.dataset.citationCommentTrigger===void 0||(e.preventDefault(),_())},t[16]=r.isEditable,t[17]=_,t[18]=v):v=t[18];let y=c!==null,b=c?.sourceAnchor,x;t[19]!==s||t[20]!==a||t[21]!==r.isEditable?(x=e=>{(!e||r.isEditable)&&a.onOpenChange(s,e)},t[19]=s,t[20]=a,t[21]=r.isEditable,t[22]=x):x=t[22];let S;t[23]!==h||t[24]!==p?(S=p?{onCancel:h}:{},t[23]=h,t[24]=p,t[25]=S):S=t[25];let C;t[26]!==s||t[27]!==a?(C=e=>a.onDraftChange(s,e),t[26]=s,t[27]=a,t[28]=C):C=t[28];let w;t[29]!==a||t[30]!==f?(w=e=>f(e)?(a.onSubmitAndSend(),!0):!1,t[29]=a,t[30]=f,t[31]=w):w=t[31];let T;t[32]!==_||t[33]!==f||t[34]!==C||t[35]!==w||t[36]!==y||t[37]!==b||t[38]!==x||t[39]!==S?(T={open:y,sourceAnchor:b,onOpenChange:x,...S,onSave:f,onDraftChange:C,onSaveAndSend:w,onRestoreFocus:_},t[32]=_,t[33]=f,t[34]=C,t[35]=w,t[36]=y,t[37]=b,t[38]=x,t[39]=S,t[40]=T):T=t[40];let E;t[41]!==o||t[42]!==T?(E=(0,P.jsx)(Re,{citation:o,composer:!0,commentEditor:T}),t[41]=o,t[42]=T,t[43]=E):E=t[43];let D;return t[44]!==E||t[45]!==v?(D=(0,P.jsx)(a_,{as:`span`,className:`inline-flex min-w-0 max-w-full select-none`,contentEditable:!1,spellCheck:!1,"data-composer-citation-chip":`true`,onKeyDown:v,children:E}),t[44]=E,t[45]=v,t[46]=D):D=t[46],D}var ET=zh.create({name:`composer-context-reference`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{kind:{default:``},contextId:{default:``},label:{default:``},source:{default:``}}},parseHTML(){return[{tag:`span[data-composer-context-reference]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-composer-context-reference":``,...e}]},addNodeView(){return y_(DT)}});function DT(e){let t=(0,N.c)(4),{node:n}=e,r=n.attrs.kind??``,i=n.attrs.contextId??``,a=n.attrs.label??``,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,P.jsx)(a_,{as:`span`,className:yT,children:(0,P.jsx)(Jw,{kind:r,contextId:i,label:a})}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function OT(e){let t=[],n=VC(e),r=null,i=0;for(let e of n.runs)if(e.nodeName!==`codeBlock`&&(e.openLen>0&&(r??={from:e.pmPos,to:e.pmPos,markers:[]},r.markers.push({at:e.pmPos,side:-1,text:n.value.slice(e.mdStart,e.mdStart+e.openLen)})),r!==null)){if(r.to=e.pmPos+e.docLen,e.closeLen>0){let t=e.mdStart+e.mdLen;r.markers.push({at:r.to,side:-2,text:n.value.slice(t-e.closeLen,t)})}i+=e.openLen-e.closeLen,i===0&&(t.push(r),r=null)}return t}function kT(e,t){return new oh({find:e,handler:({state:e,range:n,match:r,chain:i})=>{let a=r.groups?.marker??`-`,o=r.groups?.space??` `,s=r.groups?.carried??``,c=e.doc.resolve(n.from);if(c.parent.type.name!==`paragraph`||c.depth!==1)return null;let l=i().deleteRange(n).wrapInList(t,t===`orderedList`?{start:Number.parseInt(a,10)||1}:{}).updateAttributes(`listItem`,{marker:a,space:o});(s?l.insertContent(s):l).run()}})}var AT=new oh({find:/^\[([ xX])\] $/,handler:({state:e,range:t,match:n,chain:r})=>{let i=e.doc.resolve(t.from),a=i.node(-1);if(i.parent.type.name!==`paragraph`||a?.type.name!==`listItem`||![`-`,`*`,`+`].includes(a.attrs.marker??``))return null;let o=(n[1]??` `).toLowerCase()===`x`;r().command(({tr:e})=>(MC(e,t.from,t.to,o),!0)).run()}});function jT(e){let t=Rh({find:/^- \[([ xX])\] $/,type:e,getAttributes:e=>({checked:e[1]?.toLowerCase()===`x`})});return new oh({find:t.find,handler:e=>e.state.doc.resolve(e.range.from).depth===1?t.handler(e):null})}function MT(e,t){for(let n=e.depth;n>0;--n)if(e.node(n).type.name===t)return!0;return!1}var NT=new oh({find:/^>(\s)$/,handler:({state:e,range:t,match:n,chain:r})=>{let i=e.doc.resolve(t.from);if(i.parent.type.name!==`paragraph`||i.depth!==1)return null;r().deleteRange(t).wrapIn(`blockquote`,{prefix:`>${n[1]??` `}`}).run()}}),PT=new oh({find:/^(---|\*\*\*|___)\s?$/,handler:({state:e,range:t,match:n,chain:r})=>{let i=n[0]??`---`;if(!i.startsWith(`---`)&&!/\s$/.test(i))return null;let a=e.doc.resolve(t.from);if(a.parent.type.name!==`paragraph`||a.depth!==1)return null;r().deleteRange(t).setHorizontalRule().command(({tr:e})=>{let t=e.selection.$from,n=t.index(0)-1;if(n<0)return!0;let r=t.posAtIndex(n,0),a=e.doc.nodeAt(r);return a?.type.name===`horizontalRule`&&e.setNodeMarkup(r,void 0,{...a.attrs,source:i}),!0}).run()}}),FT=new oh({find:/^(#{1,6})(\s)$/,handler:({state:e,range:t,match:n,chain:r})=>{let i=e.doc.resolve(t.from);if(i.parent.type.name!==`paragraph`||i.depth!==1)return null;r().deleteRange(t).setNode(`heading`,{level:n[1]?.length??1,space:n[2]??` `}).run()}});function IT(e){return e.state.selection.$from.parent.type.spec.code===!0}var LT=new H(`composer-rich-markers`),RT=new V({key:LT,state:{init:(e,t)=>zT(t),apply:(e,t,n,r)=>e.docChanged||e.selectionSet||e.storedMarksSet?zT(r):t},props:{decorations(e){return LT.getState(e)}}});function zT(e){let{doc:t,selection:n}=e,r=XC(e)?3:0,i=[];n.empty||t.nodesBetween(n.from,n.to,(e,t)=>!e.type.name.startsWith(`composer-`)||(i.push(Pu.node(t,t+e.nodeSize,{class:`composer-chip-range-selected`})),!1));for(let e of OT(t))if(n.empty?n.from>=e.from&&n.from<=e.to:n.from<e.to&&n.to>e.from)for(let{at:t,side:a,text:o}of e.markers){let e=n.empty&&t===n.from?a+r:a,s=document.createElement(`span`);s.className=`composer-rich-marker`,s.textContent=o,s.setAttribute(`aria-hidden`,`true`),i.push(Pu.widget(t,s,{side:e,key:`marker-${t}-${e}-${s.textContent}`}))}return U.create(t,i)}var BT=J.create({name:`composer-rich-markers`,addProseMirrorPlugins(){return[RT]}});function VT(e){let t=(0,N.c)(3),n=e.literalText?`literal`:e.richTextEnabled?`rich`:`plain`,r;return t[0]!==e||t[1]!==n?(r=(0,P.jsx)(UT,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var HT=J.create({name:`composer-undo-grouping`,addStorage(){return{previous:null}},dispatchTransaction({transaction:e,next:t}){this.storage.previous=dw(e,this.storage.previous),t(e)}});function UT(e){let{value:t,cursor:n,richTextEnabled:r,literalText:i=!1,contextRecords:a,buildContextClipboardFragment:o,importContextFragment:s,skills:c,disabled:l,placeholder:u,ariaLabel:f,suggestionListId:p,activeSuggestionId:m,isPathQueryActive:h,containerClassName:_,className:v,placeholderClassName:y,onChange:b,onVisibleSelectionChange:x,onCommandKeyDown:S,onPageScrollKeyDown:C,onPageScrollKeyUp:w,onPageScrollRelease:E,onCitationSubmitAndSend:ee,onCitationDraftSave:te,onPaste:ne,editorRef:re}=e,O=!i&&(r??!1),k=(0,M.useCallback)((e,t)=>i?Math.max(0,Math.min(e.length,Number.isFinite(t)?Math.floor(t):e.length)):Jt(e,t),[i]),ie=(0,M.useCallback)((e,t)=>i?t:qt(e,t),[i]),ae=(0,M.useRef)(b),oe=(0,M.useRef)(x),se=(0,M.useRef)(S),ce=(0,M.useRef)(h),le=(0,M.useRef)(o),ue=(0,M.useRef)(s),fe=(0,M.useRef)(c),pe=(0,M.useRef)(t),me=(0,M.useRef)(null);(0,M.useEffect)(()=>{ae.current=b},[b]),(0,M.useEffect)(()=>{oe.current=x},[x]),(0,M.useEffect)(()=>{se.current=S},[S]),(0,M.useEffect)(()=>{ce.current=h},[h]),(0,M.useEffect)(()=>{le.current=o},[o]),(0,M.useEffect)(()=>{ue.current=s},[s]),(0,M.useEffect)(()=>{fe.current=c},[c]),(0,M.useLayoutEffect)(()=>{pe.current=t},[t]);let he=(0,M.useCallback)(e=>{let t=e.startsWith(`$`)?e.slice(1):e,n=fe.current.find(e=>e.name===t);if(!n)return{label:qe({name:t}),description:null};let r=n.shortDescription?.trim();return{label:qe(n),description:r||n.description?.trim()||null}},[]),ge=k(t,n),_e=ie(t,ge),A=(0,M.useRef)({value:t,cursor:ge,expandedCursor:_e,contextIds:i?[]:D(t)}),ve=(0,M.useRef)({start:_e,end:_e}),ye=(0,M.useRef)(!1),be=(0,M.useRef)(!1),xe=(0,M.useRef)(null),[Se,Ce]=(0,M.useState)(null),we=(0,M.useRef)(null),[Te,Ee]=(0,M.useState)(t.length===0),De=(0,M.useMemo)(()=>({openComment:Se,onOpenChange:(e,t)=>{!t&&we.current?.key===e&&(we.current=null),Ce(n=>t?n?.key===e?n:{key:e}:n?.key===e?null:n)},onDraftChange:(e,t)=>{we.current={key:e,comment:t}},onSubmitAndSend:ee??(()=>{})}),[ee,Se]),Oe=(0,M.useCallback)(e=>{let t=VC(e.state.doc),n=i?[]:t.contextIds,{from:r,to:a}=e.state.selection,o=JC(t,r),s=JC(t,a),c=t.value,l=k(t.value,WC(t,o)),u=Math.max(0,Math.min(t.value.length,GC(t,o))),d={start:Math.min(u,GC(t,s)),end:Math.max(u,GC(t,s))},f=ve.current;ve.current=d,Ee(c.length===0);let p=A.current,m=!(p.value===c&&p.cursor===l&&p.expandedCursor===u&&p.contextIds.length===n.length&&p.contextIds.every((e,t)=>e===n[t]));if(ye.current)return;if(!m){mT(f,d)&&oe.current?.();return}if(p.value===c&&c!==pe.current)return;A.current={value:c,cursor:l,expandedCursor:u,contextIds:n};let h=e.state.selection.$from.parent.type.spec.code===!0,g=i||h||tn(c,l,`left`)||tn(c,l,`right`);ae.current(c,l,u,g,n)},[k,i]),ke=(0,M.useMemo)(()=>({class:de(`composer-tiptap -m-1 block max-h-52 min-h-19.5 overflow-y-auto p-1 whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none`,v),"data-testid":`composer-editor`,"data-composer-rich-text":O?`true`:`false`,role:`textbox`,"aria-multiline":`true`,...f?{"aria-label":f}:{},...l?{"aria-readonly":`true`}:{},...!l&&p?{"aria-autocomplete":`list`,"aria-haspopup":`listbox`,...m?{"aria-controls":p,"aria-activedescendant":m}:{}}:{},"aria-placeholder":u}),[m,f,v,l,u,O,p]),j=e_({extensions:[GS.configure({blockquote:!1,bulletList:!1,codeBlock:!1,heading:!1,horizontalRule:!1,listItem:!1,link:!1,orderedList:!1,underline:!1,dropcursor:!1,gapcursor:!1,trailingNode:!1,code:!1,listKeymap:!1,undoRedo:{newGroupDelay:cw},...O?{}:{bold:!1,italic:!1,strike:!1}}),HT,bT,ST,wT,ET,BT,...O?[QS,iC.extend({addNodeView(){return y_(aT,{stopEvent:({event:e})=>e.target instanceof Element&&e.target.closest(`.chat-markdown-codeblock-header`)!==null})},addInputRules(){return[]}}),dT({resolveTheme:()=>ut(document.documentElement.classList.contains(`dark`)?`dark`:`light`)}),...fC.map(e=>e.name===`blockquote`?e.extend({addInputRules(){return[NT]}}):e.name===`horizontalRule`?e.extend({addInputRules(){return[PT]}}):e.name===`heading`?e.extend({addInputRules(){return[FT]}}):e),...cC.map(e=>e.name===`listItem`?e:e.extend({addInputRules(){return this.name===`bulletList`?[kT(/^(?<marker>[*+])(?<space>\s)$/,`bulletList`),kT(/^(?<marker>-)(?<space>[ \t]+)(?<carried>[^\s[])$/,`bulletList`)]:[kT(/^(?<marker>\d+[.)])(?<space>\s)$/,`orderedList`)]}})),tC,rC.extend({addInputRules(){return[jT(this.type),AT]}})]:[]],content:CC(t,e=>{let t=e.startsWith(`$`)?e.slice(1):e,n=c.find(e=>e.name===t);if(!n)return{label:qe({name:t}),description:null};let r=n.shortDescription?.trim();return{label:qe(n),description:r||n.description?.trim()||null}},{styling:O,literalText:i}),editable:!l,editorProps:{attributes:ke,handleKeyDown:(e,t)=>{if(g(navigator.platform)&&(t.key===`Home`||t.key===`End`)&&!t.altKey&&!t.metaKey&&!t.ctrlKey&&!t.isComposing){let n=window.getSelection();if(n?.anchorNode&&e.dom.contains(n.anchorNode)&&typeof n.modify==`function`)return t.preventDefault(),t.stopPropagation(),n.modify(t.shiftKey?`extend`:`move`,t.key===`Home`?`backward`:`forward`,`lineboundary`),n.anchorNode&&n.focusNode&&e.dispatch(e.state.tr.setSelection(z.create(e.state.doc,e.posAtDOM(n.anchorNode,n.anchorOffset),e.posAtDOM(n.focusNode,n.focusOffset))).scrollIntoView()),!0}if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(t.key)&&!t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey&&!t.isComposing&&e.state.selection.empty){let{$from:n}=e.state.selection,r=t.key===`ArrowLeft`||t.key===`ArrowUp`?-1:1,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,a=n.pos===(r===-1?z.atStart(e.state.doc).from:z.atEnd(e.state.doc).to),o=i||a?ZC(e.state,r):null;if(o)return t.preventDefault(),t.stopPropagation(),e.dispatch(o),!0;let s=r===-1?n.nodeBefore:n.nodeAfter;if(i&&s?.type.name.startsWith(`composer-`))return t.preventDefault(),t.stopPropagation(),e.dispatch(e.state.tr.setSelection(z.create(e.state.doc,n.pos+r*s.nodeSize)).scrollIntoView()),!0}if(t.key===`Tab`&&t.shiftKey&&!t.altKey&&!t.metaKey&&!t.ctrlKey&&e.state.selection.empty){let{$from:n}=e.state.selection,r=n.nodeBefore;if(r?.type.name===`composer-citation`){let i=e.nodeDOM(n.pos-r.nodeSize),a=i instanceof HTMLElement?i.querySelector(`[data-citation-comment-trigger]`):null;if(a)return t.preventDefault(),t.stopPropagation(),a.focus(),!0}}if(t.key===`Enter`&&(t.isComposing||t.keyCode===229))return t.stopPropagation(),!0;if(t.key===`Enter`&&t.target instanceof HTMLInputElement)return t.preventDefault(),!0;if(t.key===`Tab`&&!t.metaKey&&!t.ctrlKey&&tw(e.state))return t.preventDefault(),t.stopPropagation(),ow(e.state,t.shiftKey?`out`:`in`,t=>e.dispatch(t));if(t.key===`Enter`&&O&&!t.metaKey&&!t.ctrlKey&&!t.isComposing){if(tw(e.state)){t.preventDefault(),t.stopPropagation();let n=t=>e.dispatch(t.scrollIntoView());return aw(e.state,n)||iw(e)||rw(e.state,n)||To(e.state,n)}if(sw(e.state,t=>e.dispatch(t)))return t.preventDefault(),t.stopPropagation(),!0}let n=se.current;if(t.key===`Enter`){let r=me.current,i=O&&(r?.isActive(`taskItem`)??!1),a=O&&(r?.isActive(`listItem`)??!1);return n?.(`Enter`,t,i||a)??!1?(t.preventDefault(),t.stopPropagation(),!0):(t.preventDefault(),(i||a)&&r&&jC(r)||O&&r&&MT(e.state.selection.$from,`blockquote`)&&e.state.selection.$from.parent.content.size===0&&r.commands.lift(`blockquote`)?!0:Mo(e.state,t=>{e.dispatch(t.scrollIntoView())}))}if(!n)return!1;let r=n(t.key,t);return r&&(t.preventDefault(),t.stopPropagation()),r},handleTextInput:(e,t,n,r)=>{if(i||r.length!==1)return!1;let a=_T[r];if(!a||t===n)return!1;let o=!1;if(e.state.doc.nodesBetween(t,n,e=>e.isAtom&&e.isInline&&!e.isText||e.isText&&e.marks.length>0?(o=!0,!1):!0),o)return!1;let s=VC(e.state.doc),c=GC(s,JC(s,t)),l=GC(s,JC(s,n));if(Qt(s.value,c,l))return!1;let u=e.state.tr.insertText(a,n).insertText(r,t);return u.setSelection(z.create(u.doc,t+r.length,n+r.length)),e.dispatch(u),!0},handlePaste:(e,t)=>{let n=t.clipboardData;if(!n||n.files.length>0)return!1;let r=n.getData(`text/plain`);if(!r)return!1;if(t.preventDefault(),IT(e)){let{from:t,to:n}=e.state.selection;return e.dispatch(lw(e.state.tr.insertText(r,t,n),`paste`).scrollIntoView()),!0}let a=ue.current,o=!i&&a?Un(n,a):r,s=i?[]:Xt(`${o}\n`),c=s.at(-1);if((c?.type===`mention`||c?.type===`skill`)&&c.end===o.length&&(o+=` `),(s[0]?.type===`mention`||s[0]?.type===`skill`)&&s[0].start===0){let t=VC(e.state.doc),n=GC(t,JC(t,e.state.selection.from));n>0&&!/\s/.test(t.value[n-1])&&(o=` ${o}`)}let{$from:l}=e.state.selection,u=l.parent.textBetween(0,l.parentOffset,void 0,``),d=i?0:Zt(u,o,ce.current?.()),f=me.current;if(f){let t=e.state.selection.$from,n=[`listItem`,`taskItem`,`blockquote`].some(e=>MT(t,e));WT(o,he,{styling:O,blocks:!n,literalText:i,literalLength:d},e=>{f.chain().command(({tr:e})=>(lw(e,`paste`),!0)).insertContent(e).command(({tr:e})=>{let{selection:t}=e;return!(t instanceof B)||!t.node.isBlock||(e.doc.resolve(t.to).nodeAfter?.isTextblock||e.insert(t.to,e.doc.type.schema.nodes.paragraph.create()),e.setSelection(z.create(e.doc,t.to+1))),!0}).run()}),GT(f)}return!0}},onUpdate:({editor:e})=>{Oe(e)},onSelectionUpdate:({editor:e})=>{Oe(e)}},[]);(0,M.useEffect)(()=>{j?.setEditable(!l)},[l,j]),(0,M.useEffect)(()=>{me.current=j},[j]),(0,M.useLayoutEffect)(()=>{j?.isInitialized&&j.view.setProps({attributes:ke})},[j,ke]);let Ae=(0,M.useCallback)(()=>{let e=A.current;if(!j)return e;let t=VC(j.state.doc),{from:n,to:r}=j.state.selection,a=JC(t,n),o={value:t.value,cursor:k(t.value,WC(t,a)),expandedCursor:Math.max(0,Math.min(t.value.length,GC(t,a))),contextIds:i?[]:t.contextIds},s=JC(t,r);return ve.current={start:Math.min(o.expandedCursor,GC(t,s)),end:Math.max(o.expandedCursor,GC(t,s))},A.current=o,o},[k,j,i]),je=(0,M.useEffectEvent)((e,t)=>{let n=we.current;if(we.current=null,!n||!te)return;let[r]=rp(e.state.doc,e=>e.type.name===`composer-citation`&&e.attrs.citeKey===n.key);if(!r)return;let{node:i,pos:a}=r,o=i.attrs.citation,s=Fe({reason:`none`,draft:n.comment,savedComment:o.comment});if(s.kind!==`commit`)return;let c=Vt(o,s.comment);e.view.dispatch(e.state.tr.setNodeMarkup(a,void 0,{...i.attrs,citation:c,source:Bt(c)}).setMeta(`addToHistory`,!1)),te(t,VC(e.state.doc).value)});(0,M.useLayoutEffect)(()=>{if(!j)return;let e=!be.current;be.current=!0;let r=k(t,n),a=A.current;if(!e&&a.value===t&&a.cursor===r)return;let o=ie(t,r);A.current={value:t,cursor:r,expandedCursor:o,contextIds:D(t)},ve.current={start:o,end:o},Ee(t.length===0);let s=j.view.dom,c=!!(s&&document.activeElement===s);if(!e&&a.value===t&&!c)return;ye.current=!0;let l=xe.current?.value===t?xe.current:null;a.value!==t&&(je(j,a.value),j.commands.setContent(CC(t,he,{styling:O,literalText:i}),{emitUpdate:!1}));let u=VC(j.state.doc),d=KC(u,r);if(j.commands.setTextSelection(qC(u,d)),c&&GT(j),l){xe.current=null;let e=u.runs.find(e=>e.kind===`token`&&e.nodeName===`composer-citation`&&e.mdStart===l.citationStart);if(e){let t=j.state.doc.nodeAt(e.pmPos)?.attrs?.citeKey;t&&Ce({key:t,sourceAnchor:l.sourceAnchor,removeOnCancel:l.insertedSpaces})}}queueMicrotask(()=>{ye.current=!1})},[k,n,j,ie,i,O,he,t]);let Me=(0,M.useCallback)(e=>{if(!j||(j.view.focus(),A.current.value!==pe.current))return;let t=k(A.current.value,e),n=VC(j.state.doc),r=KC(n,t);j.commands.setTextSelection(qC(n,r)),GT(j),t!==A.current.cursor&&(A.current={value:A.current.value,cursor:t,expandedCursor:ie(A.current.value,t),contextIds:A.current.contextIds},ve.current={start:A.current.expandedCursor,end:A.current.expandedCursor},ae.current(A.current.value,t,A.current.expandedCursor,i,A.current.contextIds))},[k,j,ie,i]);(0,M.useImperativeHandle)(re,()=>({focus:()=>{Me(A.current.cursor)},focusAt:Me,focusAtEnd:()=>{Me(i?A.current.value.length:Yt(A.current.value,A.current.value.length))},readSelectionRange:()=>(Ae(),ve.current),requestCitationComment:e=>{if(xe.current=e,!j)return;let t=VC(j.state.doc);if(t.value!==e.value)return;let n=t.runs.find(t=>t.kind===`token`&&t.nodeName===`composer-citation`&&t.mdStart===e.citationStart);if(!n)return;let r=j.state.doc.nodeAt(n.pmPos)?.attrs?.citeKey;r&&(xe.current=null,Ce({key:r,sourceAnchor:e.sourceAnchor,removeOnCancel:e.insertedSpaces}))},readSnapshot:Ae,isCaretOnVisualEdge:e=>{let t=Ae();if(t.value.length===0)return!0;let n=t.value.slice(0,t.expandedCursor),r=t.value.slice(t.expandedCursor);if(e===`start`?n.includes(`
202
202
  `):r.includes(`
203
203
  `))return!1;let i=j?.view.dom,a=window.getSelection();if(!i||!a||!a.isCollapsed||a.rangeCount===0||!a.anchorNode||!i.contains(a.anchorNode))return!1;let o=KT(a.getRangeAt(0),e);if(!o)return!1;let s=((e===`start`?i.firstElementChild:i.lastElementChild)??i).getBoundingClientRect(),c=o.height/2;return e===`start`?o.top-s.top<c:s.bottom-o.bottom<c}}),[j,Me,i,Ae]);let Ne=(0,M.useCallback)((e,t)=>{let n=le.current;if(!j||t&&!j.isEditable)return;let r=e.clipboardData,{from:a,to:o}=j.state.selection;if(a===o)return;let s=BC(j.state.doc,a,o),c=i?[]:Array.from(new Set(D(s))),l=c.length>0?n?.(c):null;e.preventDefault(),r.setData(`text/plain`,s),l&&(r.setData(d,l),r.setData(`text/html`,T(s,l))),t&&j.chain().focus().command(({tr:e})=>(lw(e,`cut`),!0)).deleteSelection().run()},[j,i]);return(0,P.jsx)(gT,{value:c,children:(0,P.jsx)(Fw,{value:a,children:(0,P.jsx)(hT,{value:De,children:(0,P.jsxs)(`div`,{className:de(`relative flow-root font-(family-name:--font-composer,var(--font-sans)) text-(length:--font-size-prompt,var(--text-sm)) max-sm:pointer-coarse:text-(length:--font-size-prompt-touch)`,_),children:[(0,P.jsx)(qg,{editor:j,onKeyDown:e=>{if((e.key===`Control`||e.key===`Meta`||e.key===`Alt`||e.key===`Shift`)&&E?.(),e.key!==`PageUp`&&e.key!==`PageDown`)return;let t=e.currentTarget.querySelector(`[data-testid="composer-editor"]`);if(!t)return;let n=gw({altKey:e.altKey,clientHeight:t.clientHeight,ctrlKey:e.ctrlKey,defaultPrevented:e.defaultPrevented,isComposing:e.nativeEvent.isComposing,key:e.key,keyCode:e.keyCode,metaKey:e.metaKey,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,shiftKey:e.shiftKey});n?C&&(e.preventDefault(),C(n)):E?.()},onKeyUp:e=>w?.(e.key),onBlur:E,onPasteCapture:ne,onCopyCapture:e=>Ne(e,!1),onCutCapture:e=>Ne(e,!0)}),Te&&a.size===0&&u?(0,P.jsx)(`div`,{className:de(`pointer-events-none absolute inset-0 leading-relaxed text-placeholder/75`,y),children:u}):null]})})})})}function WT(e,t,n,r){let i=SC(e,t,n);if(i.length===1&&i[0]?.type===`paragraph`){let e=i[0]?.content??[];if(e.length===0)return;r(e)}else r(i)}function GT(e){e.view.dispatch(e.state.tr.scrollIntoView())}function KT(e,t){let n=Array.from(e.getClientRects()).filter(e=>e.height>0),r=t===`start`?n.at(-1):n[0];if(r)return r;let i=e.startContainer;if(i.nodeType===3){let n=i;if(n.data.length===0)return null;let r=Math.max(0,Math.min(t===`start`?e.startOffset:e.startOffset-1,n.data.length-1)),a=document.createRange();a.setStart(n,r),a.setEnd(n,r+1);let o=Array.from(a.getClientRects()).find(e=>e.height>0);if(o)return o;let s=a.getBoundingClientRect();return s.height>0?s:null}if(!(i instanceof HTMLElement))return null;let a=i.childNodes[Math.max(0,e.startOffset-1)]??i.childNodes[e.startOffset];if(a instanceof HTMLElement){let e=a.getBoundingClientRect();if(e.height>0)return e}else if(a instanceof Text&&a.data.length>0){let t=a===i.childNodes[e.startOffset-1]?a.data.length-1:0,n=document.createRange();n.setStart(a,t),n.setEnd(a,t+1);let r=Array.from(n.getClientRects()).find(e=>e.height>0);if(r)return r}let o=i.getBoundingClientRect();return o.height>0?o:null}function qT(e){let t=(0,N.c)(2),n;return t[0]===e?n=t[1]:(n=(0,P.jsx)(VT,{...e}),t[0]=e,t[1]=n),n}export{ln as A,kn as C,bn as D,vn as E,_n as O,En as S,jn as T,Vn as _,Pw as a,Dn as b,ww as c,er as d,Zn as f,Hn as g,Un as h,Iw as i,on as j,dn as k,Cw as l,Wn as m,Mw as n,jw as o,Qn as p,Nw as r,Ew as s,qT as t,$n as u,zn as v,Mn as w,On as x,Nn as y};
204
- //# sourceMappingURL=ComposerPromptEditor-Dh9Y0crA.js.map
204
+ //# sourceMappingURL=ComposerPromptEditor--x6yGPiW.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Nd as i,Os as a,aE as o,dr as s,fE as c,iE as l,t as u,ts as d}from"./utils-D19Exirm.js";import{At as f,Sn as p,kt as m}from"./runtime-S0tnrkvE.js";import{F as h,It as g,Lt as _}from"./runtime-CdX0UBlL.js";import{i as v,p as y}from"./toast-BNQWmVQ-.js";import{k as b}from"./useSettings-BNjvPVd5.js";import{h as x}from"./server-ELSEsqtb.js";import{t as S}from"./toastHelpers-DxXYm50b.js";var C=n(),w=e(t(),1),T=e(r(),1);function E(e){let t=(0,C.c)(11),n=e.environmentId,r;t[0]===n?r=t[1]:(r=x.stateAtom(n),t[0]=n,t[1]=r);let i=l(a(d(r)),D),s=b().environments.get(n)?.status,u;t[2]===e.entry?u=t[3]:(u=m(e.entry),t[2]=e.entry,t[3]=u);let p=u,g;t[4]!==e.entry||t[5]!==p.length?(g=p.length===1&&f(e.entry),t[4]=e.entry,t[5]=p.length,t[6]=g):g=t[6];let v=g,y=e.connection.phase,S=e.entry.enabled&&y!==`connected`&&y!==`unsupported`?_({hostLabel:e.label,state:i,via:v?`relay`:`direct`,relayStatus:v?o(s??c()):null,clientVersion:h,serverVersion:e.serverConfig?.environment.serverVersion}):null,w;return t[7]!==S||t[8]!==v||t[9]!==i?(w={diagnosis:S,state:i,relayOnly:v},t[7]=S,t[8]=v,t[9]=i,t[10]=w):w=t[10],w}function D(){return p}function O(e){let{environment:t}=e;return E(t).diagnosis?.headline??null}var k={ok:`✓`,failed:`✕`,unchecked:`–`},A={ok:``,failed:`Failed`,unchecked:`Not checked`};function j(e){let t=(0,C.c)(5),{retryAt:n}=e,[r,i]=(0,w.useState)(Date.now),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{if(n<=Date.now())return;let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,w.useEffect)(a,o);let s=Math.ceil((n-r)/1e3),c=s>0?`retrying in ${s}s`:`retrying`,l;return t[3]===c?l=t[4]:(l=(0,T.jsx)(T.Fragment,{children:c}),t[3]=c,t[4]=l),l}function M(e){let t=(0,C.c)(29),{diagnosis:n,retryAt:r,attempt:a,expanded:o,onToggle:s}=e,c;t[0]===n.headline?c=t[1]:(c=(0,T.jsx)(`p`,{className:`text-destructive`,children:n.headline}),t[0]=n.headline,t[1]=c);let l;t[2]===r?l=t[3]:(l=r===null?null:(0,T.jsx)(j,{retryAt:r}),t[2]=r,t[3]=l);let d;t[4]!==a||t[5]!==r?(d=r!==null&&a>0?(0,T.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,t[4]=a,t[5]=r,t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=a>0?(0,T.jsxs)(`span`,{children:[`attempt `,a]}):null,t[7]=a,t[8]=f);let p;t[9]!==a||t[10]!==r?(p=r!==null||a>0?(0,T.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,t[9]=a,t[10]=r,t[11]=p):p=t[11];let m=o&&`rotate-90`,h;t[12]===m?h=t[13]:(h=u(`size-3 transition-transform duration-150 motion-reduce:transition-none`,m),t[12]=m,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,T.jsx)(i,{"aria-hidden":!0,className:h}),t[14]=h,t[15]=g);let _;t[16]!==o||t[17]!==s||t[18]!==g?(_=(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:s,className:`inline-flex items-center gap-0.5 rounded-sm outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Details`,g]}),t[16]=o,t[17]=s,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==l||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==_?(v=(0,T.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1 text-muted-foreground`,children:[l,d,f,p,_]}),t[20]=l,t[21]=d,t[22]=f,t[23]=p,t[24]=_,t[25]=v):v=t[25];let y;return t[26]!==c||t[27]!==v?(y=(0,T.jsxs)(`div`,{className:`text-xs`,children:[c,v]}),t[26]=c,t[27]=v,t[28]=y):y=t[28],y}function N(e){let t=(0,C.c)(36),{hostLabel:n,diagnosis:r,onRetry:i,onAddRoute:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={target:`connection diagnostics`,onCopy:R,onError:L},t[0]=o):o=t[0];let{copyToClipboard:c}=y(o),l;t[1]===r.hops?l=t[2]:(l=r.hops.map(I),t[1]=r.hops,t[2]=l);let u;t[3]===l?u=t[4]:(u=(0,T.jsx)(`ol`,{className:`grid gap-0.5`,children:l}),t[3]=l,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,T.jsx)(`p`,{className:`font-medium text-foreground`,children:`What to try`}),t[5]=d):d=t[5];let f;t[6]===r.steps?f=t[7]:(f=r.steps.map(F),t[6]=r.steps,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,T.jsx)(`ol`,{className:`list-decimal pl-4 text-muted-foreground`,children:f}),t[8]=f,t[9]=p);let m;t[10]===r.moreInfoUrl?m=t[11]:(m=r.moreInfoUrl?(0,T.jsx)(`a`,{href:r.moreInfoUrl,target:`_blank`,rel:`noreferrer`,className:`text-muted-foreground underline underline-offset-2 hover:text-foreground`,children:`More info`}):null,t[10]=r.moreInfoUrl,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,T.jsxs)(`div`,{children:[d,p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let _;t[15]===r.facts?_=t[16]:(_=r.facts.map(P),t[15]=r.facts,t[16]=_);let v;t[17]===_?v=t[18]:(v=(0,T.jsx)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 font-mono text-muted-foreground`,children:_}),t[17]=_,t[18]=v);let b;t[19]===i?b=t[20]:(b=(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:i,children:`Retry now`}),t[19]=i,t[20]=b);let x;t[21]!==c||t[22]!==r||t[23]!==n?(x=(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>{let e=g(n,r);c(e,void 0)},children:`Copy diagnostics`}),t[21]=c,t[22]=r,t[23]=n,t[24]=x):x=t[24];let S;t[25]===a?S=t[26]:(S=a?(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:a,children:`Add direct route`}):null,t[25]=a,t[26]=S);let w;t[27]!==b||t[28]!==x||t[29]!==S?(w=(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,x,S]}),t[27]=b,t[28]=x,t[29]=S,t[30]=w):w=t[30];let E;return t[31]!==v||t[32]!==w||t[33]!==u||t[34]!==h?(E=(0,T.jsxs)(`div`,{className:`mt-2 grid gap-3 border-t border-border/50 pt-2 text-xs`,children:[u,h,v,w]}),t[31]=v,t[32]=w,t[33]=u,t[34]=h,t[35]=E):E=t[35],E}function P(e){let[t,n]=e;return(0,T.jsxs)(`div`,{className:`contents`,children:[(0,T.jsx)(`dt`,{children:t}),(0,T.jsx)(`dd`,{className:`break-all text-foreground`,children:n})]},t)}function F(e){return(0,T.jsx)(`li`,{children:e},e)}function I(e){return(0,T.jsxs)(`li`,{className:u(`flex gap-2`,e.result===`failed`?`text-destructive`:`text-muted-foreground`),children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`w-3 text-center`,children:k[e.result]}),(0,T.jsx)(`span`,{className:u(e.result===`ok`&&`text-foreground`),children:e.label}),(0,T.jsx)(`span`,{children:A[e.result]})]},e.hop)}function L(e){return v.add(S({type:`error`,title:`Could not copy diagnostics`,description:e.message}))}function R(){return v.add({type:`success`,title:`Diagnostics copied`})}export{E as i,N as n,M as r,O as t};
2
- //# sourceMappingURL=ConnectionDiagnosisDetails-DIM-B35q.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Nd as i,Os as a,aE as o,dr as s,fE as c,iE as l,t as u,ts as d}from"./utils-D19Exirm.js";import{At as f,Sn as p,kt as m}from"./runtime-DEFP_0P0.js";import{F as h,It as g,Lt as _}from"./runtime-CZnPVuwS.js";import{i as v,p as y}from"./toast-rcFdQept.js";import{k as b}from"./useSettings-4JwtKUFC.js";import{h as x}from"./server-BuS35bSu.js";import{t as S}from"./toastHelpers-DxXYm50b.js";var C=n(),w=e(t(),1),T=e(r(),1);function E(e){let t=(0,C.c)(11),n=e.environmentId,r;t[0]===n?r=t[1]:(r=x.stateAtom(n),t[0]=n,t[1]=r);let i=l(a(d(r)),D),s=b().environments.get(n)?.status,u;t[2]===e.entry?u=t[3]:(u=m(e.entry),t[2]=e.entry,t[3]=u);let p=u,g;t[4]!==e.entry||t[5]!==p.length?(g=p.length===1&&f(e.entry),t[4]=e.entry,t[5]=p.length,t[6]=g):g=t[6];let v=g,y=e.connection.phase,S=e.entry.enabled&&y!==`connected`&&y!==`unsupported`?_({hostLabel:e.label,state:i,via:v?`relay`:`direct`,relayStatus:v?o(s??c()):null,clientVersion:h,serverVersion:e.serverConfig?.environment.serverVersion}):null,w;return t[7]!==S||t[8]!==v||t[9]!==i?(w={diagnosis:S,state:i,relayOnly:v},t[7]=S,t[8]=v,t[9]=i,t[10]=w):w=t[10],w}function D(){return p}function O(e){let{environment:t}=e;return E(t).diagnosis?.headline??null}var k={ok:`✓`,failed:`✕`,unchecked:`–`},A={ok:``,failed:`Failed`,unchecked:`Not checked`};function j(e){let t=(0,C.c)(5),{retryAt:n}=e,[r,i]=(0,w.useState)(Date.now),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{if(n<=Date.now())return;let e=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,w.useEffect)(a,o);let s=Math.ceil((n-r)/1e3),c=s>0?`retrying in ${s}s`:`retrying`,l;return t[3]===c?l=t[4]:(l=(0,T.jsx)(T.Fragment,{children:c}),t[3]=c,t[4]=l),l}function M(e){let t=(0,C.c)(29),{diagnosis:n,retryAt:r,attempt:a,expanded:o,onToggle:s}=e,c;t[0]===n.headline?c=t[1]:(c=(0,T.jsx)(`p`,{className:`text-destructive`,children:n.headline}),t[0]=n.headline,t[1]=c);let l;t[2]===r?l=t[3]:(l=r===null?null:(0,T.jsx)(j,{retryAt:r}),t[2]=r,t[3]=l);let d;t[4]!==a||t[5]!==r?(d=r!==null&&a>0?(0,T.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,t[4]=a,t[5]=r,t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=a>0?(0,T.jsxs)(`span`,{children:[`attempt `,a]}):null,t[7]=a,t[8]=f);let p;t[9]!==a||t[10]!==r?(p=r!==null||a>0?(0,T.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,t[9]=a,t[10]=r,t[11]=p):p=t[11];let m=o&&`rotate-90`,h;t[12]===m?h=t[13]:(h=u(`size-3 transition-transform duration-150 motion-reduce:transition-none`,m),t[12]=m,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,T.jsx)(i,{"aria-hidden":!0,className:h}),t[14]=h,t[15]=g);let _;t[16]!==o||t[17]!==s||t[18]!==g?(_=(0,T.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:s,className:`inline-flex items-center gap-0.5 rounded-sm outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Details`,g]}),t[16]=o,t[17]=s,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==l||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==_?(v=(0,T.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1 text-muted-foreground`,children:[l,d,f,p,_]}),t[20]=l,t[21]=d,t[22]=f,t[23]=p,t[24]=_,t[25]=v):v=t[25];let y;return t[26]!==c||t[27]!==v?(y=(0,T.jsxs)(`div`,{className:`text-xs`,children:[c,v]}),t[26]=c,t[27]=v,t[28]=y):y=t[28],y}function N(e){let t=(0,C.c)(36),{hostLabel:n,diagnosis:r,onRetry:i,onAddRoute:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={target:`connection diagnostics`,onCopy:R,onError:L},t[0]=o):o=t[0];let{copyToClipboard:c}=y(o),l;t[1]===r.hops?l=t[2]:(l=r.hops.map(I),t[1]=r.hops,t[2]=l);let u;t[3]===l?u=t[4]:(u=(0,T.jsx)(`ol`,{className:`grid gap-0.5`,children:l}),t[3]=l,t[4]=u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,T.jsx)(`p`,{className:`font-medium text-foreground`,children:`What to try`}),t[5]=d):d=t[5];let f;t[6]===r.steps?f=t[7]:(f=r.steps.map(F),t[6]=r.steps,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,T.jsx)(`ol`,{className:`list-decimal pl-4 text-muted-foreground`,children:f}),t[8]=f,t[9]=p);let m;t[10]===r.moreInfoUrl?m=t[11]:(m=r.moreInfoUrl?(0,T.jsx)(`a`,{href:r.moreInfoUrl,target:`_blank`,rel:`noreferrer`,className:`text-muted-foreground underline underline-offset-2 hover:text-foreground`,children:`More info`}):null,t[10]=r.moreInfoUrl,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,T.jsxs)(`div`,{children:[d,p,m]}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let _;t[15]===r.facts?_=t[16]:(_=r.facts.map(P),t[15]=r.facts,t[16]=_);let v;t[17]===_?v=t[18]:(v=(0,T.jsx)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 font-mono text-muted-foreground`,children:_}),t[17]=_,t[18]=v);let b;t[19]===i?b=t[20]:(b=(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:i,children:`Retry now`}),t[19]=i,t[20]=b);let x;t[21]!==c||t[22]!==r||t[23]!==n?(x=(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>{let e=g(n,r);c(e,void 0)},children:`Copy diagnostics`}),t[21]=c,t[22]=r,t[23]=n,t[24]=x):x=t[24];let S;t[25]===a?S=t[26]:(S=a?(0,T.jsx)(s,{type:`button`,size:`xs`,variant:`outline`,onClick:a,children:`Add direct route`}):null,t[25]=a,t[26]=S);let w;t[27]!==b||t[28]!==x||t[29]!==S?(w=(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,x,S]}),t[27]=b,t[28]=x,t[29]=S,t[30]=w):w=t[30];let E;return t[31]!==v||t[32]!==w||t[33]!==u||t[34]!==h?(E=(0,T.jsxs)(`div`,{className:`mt-2 grid gap-3 border-t border-border/50 pt-2 text-xs`,children:[u,h,v,w]}),t[31]=v,t[32]=w,t[33]=u,t[34]=h,t[35]=E):E=t[35],E}function P(e){let[t,n]=e;return(0,T.jsxs)(`div`,{className:`contents`,children:[(0,T.jsx)(`dt`,{children:t}),(0,T.jsx)(`dd`,{className:`break-all text-foreground`,children:n})]},t)}function F(e){return(0,T.jsx)(`li`,{children:e},e)}function I(e){return(0,T.jsxs)(`li`,{className:u(`flex gap-2`,e.result===`failed`?`text-destructive`:`text-muted-foreground`),children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`w-3 text-center`,children:k[e.result]}),(0,T.jsx)(`span`,{className:u(e.result===`ok`&&`text-foreground`),children:e.label}),(0,T.jsx)(`span`,{children:A[e.result]})]},e.hop)}function L(e){return v.add(S({type:`error`,title:`Could not copy diagnostics`,description:e.message}))}function R(){return v.add({type:`success`,title:`Diagnostics copied`})}export{E as i,N as n,M as r,O as t};
2
+ //# sourceMappingURL=ConnectionDiagnosisDetails-BiLziJiH.js.map