@p4code/cli 0.9.0 → 0.9.1

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 (183) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-k72_SR2Z.mjs → binCli-B8_9WRM7.mjs} +10 -3
  3. package/dist/client/.vite/manifest.json +1120 -1120
  4. package/dist/client/assets/{2NI2N5EU-DPAxyySd.js → 2NI2N5EU-Cc9Gs6p1.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-C0aflwpw.js → 4UO7MD6I--tXEX5R9.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-hhn6T1ru.js → 5B3SVYGG-CPRAqyzZ.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-BQ0OdoZ6.js → 5GK6JWQ2-OC2-LRPx.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-BR8rdHwZ.js → 5N7A7DKN-BUa1-OZ6.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-DVDBlcjJ.js → 5OC2THR4-DKcwc3u1.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-CjtOXys8.js → 5S6HY5KT-Dqth6iG8.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-Bpy1Geo9.js → 6IMQ5BUJ-DmEcg0r1.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-D2naWV4i.js → 6OLKWJ4F-W-G6qP3r.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-CceNos-7.js → 74OO7NKP-u02yiNi7.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-CnXm_L8w.js → 75O6YZUN-xx4y2KbP.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-ECBcD47O.js → 77XECAW3-SIARa2Fi.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-B4F4wZam.js → ABYRPUBD-B_0r9NT4.js} +2 -2
  17. package/dist/client/assets/{AuthSurfaceShell-DR9yRrzS.js → AuthSurfaceShell-DPlJfFlL.js} +2 -2
  18. package/dist/client/assets/{BB2UYUI2-Cae7rC8c.js → BB2UYUI2-CujjjZN9.js} +2 -2
  19. package/dist/client/assets/{BUM34MOA-DBDboDOb.js → BUM34MOA-NuuTH6rj.js} +2 -2
  20. package/dist/client/assets/{CEQABKGZ-C6UutqUy.js → CEQABKGZ-DDaGayTm.js} +2 -2
  21. package/dist/client/assets/{CXAC5362-BnZlf1Fg.js → CXAC5362-CB6ETtV8.js} +2 -2
  22. package/dist/client/assets/{ChatGptUsageButton-3K5PpaVk.js → ChatGptUsageButton-DqJ-vZMe.js} +2 -2
  23. package/dist/client/assets/{ChatMarkdown-EK5C8Dje.js → ChatMarkdown-C94Vrzqf.js} +5 -5
  24. package/dist/client/assets/{CodexSetupSection.logic-BepCZ25p.js → CodexSetupSection.logic-DOe05Yxb.js} +2 -2
  25. package/dist/client/assets/{CommandBlock-C967hvdK.js → CommandBlock-BUY_4yYG.js} +2 -2
  26. package/dist/client/assets/{ComposerPromptEditor-kPs79YCA.js → ComposerPromptEditor-BXlsIVOQ.js} +4 -4
  27. package/dist/client/assets/{ConnectionDiagnosisDetails-B5VXf5lv.js → ConnectionDiagnosisDetails-DoemNrMF.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-Du8kYl_L.js → DRLTVNUE-D0oW6kzx.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-DxjEuWNy.js → DYY6UVD2-DBOhEG0-.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-YEBH-Vqd.js → DevicePanel-B5VTFku5.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-CAlj40rJ.js → DeviceSetup-C7hesHao.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-BOk2MTlv.js → DiffCommentAnnotation-DDYXWdY5.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-Dg3cvfi5.js → DiffFileTree-SBs4YWHB.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-fTHMPAQJ.js → DiffPanel-Cd7uZSwI.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-CqmToECA.js → DiffWorkerPoolProvider-elvn0oLt.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-BXKBSCcw.js → EmbeddedDesign-BDMR5UJo.js} +2 -2
  37. package/dist/client/assets/{FNOVOB4O-BeMBYVRF.js → FNOVOB4O-C55ATzH6.js} +2 -2
  38. package/dist/client/assets/{FileDiff-DW1zPAn5.js → FileDiff-DpQM5r9o.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-CTTCKfik.js → FilePreviewPanel-DWeewVws.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-ClboCRR4.js → FoldedSettingsSection-KMTLX6MR.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-DtsLNbcM.js → HDGCDEEZ-BhXkP8CI.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-Cj1_K-Mg.js → HSJLKHB7-ad9jby8d.js} +2 -2
  43. package/dist/client/assets/JZOYTAAL-CifPXszn.js +1 -0
  44. package/dist/client/assets/{K3MD6TGW-SNOidZ8r.js → K3MD6TGW-CG-BXshu.js} +2 -2
  45. package/dist/client/assets/{K7RP3OMA-CpajkG5B.js → K7RP3OMA-Dvs72E71.js} +2 -2
  46. package/dist/client/assets/{LHDIQX7Q-CAyO0Nv9.js → LHDIQX7Q-DBbVLdBb.js} +2 -2
  47. package/dist/client/assets/{LUXOKEGN-Dp60gO-M.js → LUXOKEGN-B8HcSY56.js} +2 -2
  48. package/dist/client/assets/{MathTypeset-DG9QDH3a.js → MathTypeset-D0cDlCZy.js} +2 -2
  49. package/dist/client/assets/{N3JZAHOW-CPZZhC9o.js → N3JZAHOW-BXwh9_vP.js} +2 -2
  50. package/dist/client/assets/{NUIALGQ3-Bapg3pv1.js → NUIALGQ3-ClxnUm8B.js} +2 -2
  51. package/dist/client/assets/{NoProjectsHero-DunzHVd0.js → NoProjectsHero-Bn4v5ofT.js} +2 -2
  52. package/dist/client/assets/{O65XPQGZ-BmLVfB2-.js → O65XPQGZ-BEEpAP2l.js} +2 -2
  53. package/dist/client/assets/{O7XIQ6OM-BzZlSmaP.js → O7XIQ6OM-CkSDwviv.js} +2 -2
  54. package/dist/client/assets/{OFQON5FD-Ciy1Dfj8.js → OFQON5FD-4EbpxjZS.js} +2 -2
  55. package/dist/client/assets/{P4ConnectAccountPages-DO-fCpTN.js → P4ConnectAccountPages-DgxvyIGG.js} +2 -2
  56. package/dist/client/assets/{P4ConnectSidebarSignIn-7hkM7xr7.js → P4ConnectSidebarSignIn-Bn9hP_6_.js} +2 -2
  57. package/dist/client/assets/{PJQHF43J-CTTmTIhc.js → PJQHF43J-D_j27v4O.js} +2 -2
  58. package/dist/client/assets/{PanelLayoutControls-clP6N7xc.js → PanelLayoutControls-BHEJEPDp.js} +4 -4
  59. package/dist/client/assets/{PierreEntryIcon-wm-IkF2y.js → PierreEntryIcon-BCv2OXDn.js} +2 -2
  60. package/dist/client/assets/{PreviewPanel-fTwWXayK.js → PreviewPanel-D3CQGyTY.js} +2 -2
  61. package/dist/client/assets/{ProjectDefaultsSettings-DABlQCRQ.js → ProjectDefaultsSettings-CqigWqDQ.js} +2 -2
  62. package/dist/client/assets/{ProjectFavicon-zExdjKgc.js → ProjectFavicon-BzkwZEKX.js} +3 -3
  63. package/dist/client/assets/{ProjectIconPickerDialog-D4Br81iW.js → ProjectIconPickerDialog-Bl7a1F6c.js} +2 -2
  64. package/dist/client/assets/{ProviderAuthTerminal-Gf_5AaPE.js → ProviderAuthTerminal-BxyDTl04.js} +2 -2
  65. package/dist/client/assets/{ProviderModelPicker-DrfK42fH.js → ProviderModelPicker-BjWN45iR.js} +2 -2
  66. package/dist/client/assets/{ProviderSettingsForm-CXVYrIzw.js → ProviderSettingsForm-9qRf6JzH.js} +2 -2
  67. package/dist/client/assets/{PullRequestCodeTab-DaXxo4Bs.js → PullRequestCodeTab-2fq1MIQq.js} +2 -2
  68. package/dist/client/assets/{RHNBAITX-DKMeuR6R.js → RHNBAITX-DaSH9fj2.js} +2 -2
  69. package/dist/client/assets/{ReadOnlySourcePreview-DPJWK3HJ.js → ReadOnlySourcePreview-CUL87R5C.js} +2 -2
  70. package/dist/client/assets/{RenderErrorBoundary-BI5KBtsb.js → RenderErrorBoundary-CEX4aXRH.js} +2 -2
  71. package/dist/client/assets/{SLD4V6NK-CR4aIcpx.js → SLD4V6NK-BPOaMXu1.js} +2 -2
  72. package/dist/client/assets/{ScheduledTasksSettings-CTHyd4UX.js → ScheduledTasksSettings-BEw_vC1N.js} +2 -2
  73. package/dist/client/assets/{ScopedSwitch-De6GoQiO.js → ScopedSwitch-DPPAQKgb.js} +2 -2
  74. package/dist/client/assets/{SettingsPanels-D6e2byZQ.js → SettingsPanels-wkOx3NMK.js} +2 -2
  75. package/dist/client/assets/{SettingsPanels.logic-BSXSdFru.js → SettingsPanels.logic-BwMoKlP_.js} +2 -2
  76. package/dist/client/assets/{SettingsScopeNotice-MbxDDMZ9.js → SettingsScopeNotice-5BIXPKKZ.js} +2 -2
  77. package/dist/client/assets/{SidebarStageBackdrop-B0F--sat.js → SidebarStageBackdrop-Cc8Os5aB.js} +2 -2
  78. package/dist/client/assets/{T3PCR2KE-C0_7R2Oa.js → T3PCR2KE-DF_ihTb_.js} +2 -2
  79. package/dist/client/assets/{TKWO2OVW-DqJmzuhq.js → TKWO2OVW-BpYa7JbN.js} +2 -2
  80. package/dist/client/assets/{TSHNXIZL-CmCl4WMk.js → TSHNXIZL-icuUBQJZ.js} +2 -2
  81. package/dist/client/assets/{ThemeEditorPanel-IhSXPcO9.js → ThemeEditorPanel-K5Z_cKr_.js} +2 -2
  82. package/dist/client/assets/{ThreadTerminalDrawer-DnOstFPr.js → ThreadTerminalDrawer-BEzEKbGr.js} +2 -2
  83. package/dist/client/assets/{UQJE5E4I-U1f_Qxq0.js → UQJE5E4I-jTtBmXGD.js} +2 -2
  84. package/dist/client/assets/{USNYFO5S-BFU1s0-x.js → USNYFO5S-COMhBWxE.js} +2 -2
  85. package/dist/client/assets/{Virtualizer-CI2uidEs.js → Virtualizer-3W_tqqHL.js} +2 -2
  86. package/dist/client/assets/{WEVWDWVA-DVuH1I8D.js → WEVWDWVA-DoGSbgZU.js} +2 -2
  87. package/dist/client/assets/{X5RFHQXM-DhiPjZ2I.js → X5RFHQXM-pFbOarC5.js} +2 -2
  88. package/dist/client/assets/{X62E3GBT-BoEmDIYA.js → X62E3GBT-CSXB08Iw.js} +2 -2
  89. package/dist/client/assets/{XBNEOJTC-ACchb7zJ.js → XBNEOJTC-CvXlFTiB.js} +2 -2
  90. package/dist/client/assets/{YHV2MVVZ-WIW1NclZ.js → YHV2MVVZ-BxyA2-Iu.js} +2 -2
  91. package/dist/client/assets/{YURCZMG2-D8PyipKA.js → YURCZMG2-WkhL6rVs.js} +2 -2
  92. package/dist/client/assets/{YVG2LODB-BQvBC9bF.js → YVG2LODB-BlCOW5Bm.js} +2 -2
  93. package/dist/client/assets/{_chat-DDGjgFMR.js → _chat-B72aqP_1.js} +14 -14
  94. package/dist/client/assets/{_chat.design-DjIqnlVZ.js → _chat.design-BzS-6FDR.js} +2 -2
  95. package/dist/client/assets/{_chat.index-Dku1iZH1.js → _chat.index-DyO0DElX.js} +2 -2
  96. package/dist/client/assets/{_chat.new-8-cjg5K7.js → _chat.new-Dy39C0PE.js} +2 -2
  97. package/dist/client/assets/{_chat.pull-requests-DVfSewSZ.js → _chat.pull-requests-Bzb1CyG6.js} +2 -2
  98. package/dist/client/assets/{assetUrls-BOJMUK_1.js → assetUrls-DSeSTRY1.js} +2 -2
  99. package/dist/client/assets/{assets-6zZLBDZw.js → assets-B_r3wLhD.js} +2 -2
  100. package/dist/client/assets/{browserHistoryStore-TJXTYA-V.js → browserHistoryStore-BG8TrOnZ.js} +2 -2
  101. package/dist/client/assets/{browserLinkTarget-DRbX4L_9.js → browserLinkTarget-jRu1-WRM.js} +2 -2
  102. package/dist/client/assets/{connect-Dp9BB7ev.js → connect-a25FIa26.js} +2 -2
  103. package/dist/client/assets/{connect-agent-DkbIqI-8.js → connect-agent-C1UODlly.js} +2 -2
  104. package/dist/client/assets/{design-Dn5DzqF2.js → design-C7HRMO73.js} +2 -2
  105. package/dist/client/assets/{device-dylO5xoO.js → device-BNK9g-io.js} +2 -2
  106. package/dist/client/assets/{diffRendering-MXukhqw1.js → diffRendering-UEl_19xa.js} +2 -2
  107. package/dist/client/assets/{dist-ceTe_mn7.js → dist-ATiHSdUa.js} +2 -2
  108. package/dist/client/assets/{duoViewer-C0aL6Kyr.js → duoViewer-C7BduYuF.js} +2 -2
  109. package/dist/client/assets/{dynamic-DTzzXo3L.js → dynamic-CFqi-4NG.js} +2 -2
  110. package/dist/client/assets/{embeddedScripts-DcWCyBxX.js → embeddedScripts-BNfDELW_.js} +2 -2
  111. package/dist/client/assets/{entities-eRiwvW2F.js → entities-pafv-XUM.js} +2 -2
  112. package/dist/client/assets/{fileLinks-CYejoXPq.js → fileLinks-pJLWwULO.js} +2 -2
  113. package/dist/client/assets/{fileTreeExpansion-wG1G7D6R.js → fileTreeExpansion-CXgwpUPc.js} +2 -2
  114. package/dist/client/assets/{getDiffFileInput-CzeweGHs.js → getDiffFileInput-eTK8du_O.js} +2 -2
  115. package/dist/client/assets/{guideRunStore-DAYN2Zd7.js → guideRunStore-83fw4RPw.js} +2 -2
  116. package/dist/client/assets/{index-DA9og9YW.js → index-C0oEvzQc.js} +3 -3
  117. package/dist/client/assets/{lazy-Ccs3klKO.js → lazy-B292152Q.js} +4 -4
  118. package/dist/client/assets/{linkedPrompt-BJh0Yqud.js → linkedPrompt-BOQDb8-o.js} +2 -2
  119. package/dist/client/assets/{main-DleJeMZO.js → main-Cywp3EWc.js} +7 -7
  120. package/dist/client/assets/{mediaReference-BbSbhpkR.js → mediaReference-onv8z3Oz.js} +2 -2
  121. package/dist/client/assets/{mediaSource-B_75uvyp.js → mediaSource-BhEv5iyl.js} +2 -2
  122. package/dist/client/assets/{onboarding-1Zg3fM0A.js → onboarding-y217_KQL.js} +2 -2
  123. package/dist/client/assets/{openFileInPreview-CiPuDrfB.js → openFileInPreview-DeuqxJFn.js} +2 -2
  124. package/dist/client/assets/{p4ProjectFile-BVKW5TIA.js → p4ProjectFile-BuzidL5M.js} +2 -2
  125. package/dist/client/assets/{pair-DUv1mY4i.js → pair-BjRq2ZHP.js} +2 -2
  126. package/dist/client/assets/{phoneViewer-CStYy_tX.js → phoneViewer-DYOR2qAi.js} +2 -2
  127. package/dist/client/assets/{pierre-icons-D3vWvKqU.js → pierre-icons-BDVVO9cA.js} +2 -2
  128. package/dist/client/assets/{preview-ipLyyv_l.js → preview-BoTHkmVi.js} +2 -2
  129. package/dist/client/assets/{primary-CMBPxKMH.js → primary-DiwDV4KJ.js} +2 -2
  130. package/dist/client/assets/{primaryCloudLinkState-CER468V5.js → primaryCloudLinkState-BgmcA0C5.js} +2 -2
  131. package/dist/client/assets/{projectFilesQueryState-D4FdR3Xm.js → projectFilesQueryState-C_yH-05-.js} +2 -2
  132. package/dist/client/assets/{projectScriptEditor-4wQTbXvz.js → projectScriptEditor-Cu65VaAw.js} +2 -2
  133. package/dist/client/assets/{providerSkills-D3rxPB_g.js → providerSkills-CgtkB3rc.js} +2 -2
  134. package/dist/client/assets/{pullRequestDetail.logic-Bkh57WzV.js → pullRequestDetail.logic-FUlKz34F.js} +2 -2
  135. package/dist/client/assets/{pullRequests-DggtcbhA.js → pullRequests-C8-SkuQU.js} +2 -2
  136. package/dist/client/assets/{queries-DJfKGsHe.js → queries-BZGM6AjA.js} +2 -2
  137. package/dist/client/assets/{renderScheduler-BgGYA97h.js → renderScheduler-CGMZZETC.js} +2 -2
  138. package/dist/client/assets/{runtime-BOlBBevr.js → runtime-BBIAfWJY.js} +3 -3
  139. package/dist/client/assets/{runtime-CeFhsGnm.js → runtime-CABaKt1A.js} +3 -3
  140. package/dist/client/assets/{scheduledTasksSettings.logic-BpOBCcOk.js → scheduledTasksSettings.logic-DFlgKyt2.js} +2 -2
  141. package/dist/client/assets/{server-DvWrfyUO.js → server-mIR8e8Vz.js} +2 -2
  142. package/dist/client/assets/{session-D3gY-tOR.js → session-BlCBDyVn.js} +2 -2
  143. package/dist/client/assets/{session-logic-OeNFZd_V.js → session-logic-CwBN7BBv.js} +2 -2
  144. package/dist/client/assets/{settings-C6gUwixG.js → settings-fTPmNkCr.js} +2 -2
  145. package/dist/client/assets/{settings.appearance-BdGq8dkT.js → settings.appearance-D96WohbH.js} +2 -2
  146. package/dist/client/assets/settings.archived-CnXEwX0Z.js +2 -0
  147. package/dist/client/assets/{settings.computer-use-DTAvnNqQ.js → settings.computer-use-DZTx8sD-.js} +2 -2
  148. package/dist/client/assets/{settings.connections-CZD-0BNX.js → settings.connections-Rl7zwQ75.js} +2 -2
  149. package/dist/client/assets/{settings.data-controls-CTVHY8Rd.js → settings.data-controls-DuyfuMcN.js} +2 -2
  150. package/dist/client/assets/{settings.decisions-D3zMITNw.js → settings.decisions-eRAu1hqY.js} +2 -2
  151. package/dist/client/assets/{settings.designs-DWeI1d2s.js → settings.designs-C0RxEgfD.js} +2 -2
  152. package/dist/client/assets/{settings.diagnostics-CqC6fhz6.js → settings.diagnostics-BDo1Ma1e.js} +2 -2
  153. package/dist/client/assets/{settings.general-BDEcQVI4.js → settings.general-CpbG8_Ml.js} +2 -2
  154. package/dist/client/assets/{settings.integrations-BmqNoylk.js → settings.integrations-CujbsXfc.js} +2 -2
  155. package/dist/client/assets/{settings.keybindings-Mt7J5TKC.js → settings.keybindings-CQ5xk9v3.js} +2 -2
  156. package/dist/client/assets/{settings.open-source-licenses-Dvex7Jce.js → settings.open-source-licenses-DIBdHSDB.js} +2 -2
  157. package/dist/client/assets/{settings.plugins-BAFed2wY.js → settings.plugins-BbsrwhRq.js} +2 -2
  158. package/dist/client/assets/{settings.projects-DhuXD_vx.js → settings.projects-BeNHSNe9.js} +3 -3
  159. package/dist/client/assets/{settings.providers-D_-kNRqH.js → settings.providers-DQT6izvS.js} +3 -3
  160. package/dist/client/assets/{settings.scheduled-tasks-Z4aprmEO.js → settings.scheduled-tasks-vKCtN-OC.js} +2 -2
  161. package/dist/client/assets/{settings.snap-shot-o0bdbS5t.js → settings.snap-shot-DgPUS-Zo.js} +2 -2
  162. package/dist/client/assets/{settings.source-control-CwJzBnSu.js → settings.source-control-B87geXn3.js} +2 -2
  163. package/dist/client/assets/{settings.storage-B4ahmlhx.js → settings.storage-BYfdzwhk.js} +2 -2
  164. package/dist/client/assets/{settingsLayout-DrhqvTJ8.js → settingsLayout-vgYGia0Q.js} +2 -2
  165. package/dist/client/assets/{sidebarProjectGrouping-DDt6qTcu.js → sidebarProjectGrouping-DaMfJpqc.js} +2 -2
  166. package/dist/client/assets/{sourceControl-Dqo9EYNC.js → sourceControl-CcPqr0UX.js} +2 -2
  167. package/dist/client/assets/{sourceControlClients-DGnHi6Rd.js → sourceControlClients-DtjbXUDt.js} +2 -2
  168. package/dist/client/assets/{terminalSessions-BykgTNwT.js → terminalSessions-0YYscaVr.js} +2 -2
  169. package/dist/client/assets/{toast-C61oyZY1.js → toast-D26NINYU.js} +2 -2
  170. package/dist/client/assets/{uiStateStore-DL8OsPjd.js → uiStateStore-CKKy2mq4.js} +2 -2
  171. package/dist/client/assets/{usage-DATBL2Du.js → usage-BDFFNkIV.js} +2 -2
  172. package/dist/client/assets/{use-atom-command-Bt7x9oO0.js → use-atom-command-C4y634Qy.js} +2 -2
  173. package/dist/client/assets/{useHandleNewThread-BOKOo2wA.js → useHandleNewThread-C7ynA68A.js} +2 -2
  174. package/dist/client/assets/{useP4ConnectAuthPrompt-D63n-MFC.js → useP4ConnectAuthPrompt-5uCMQUT1.js} +2 -2
  175. package/dist/client/assets/{usePullRequestActions-D53oZord.js → usePullRequestActions-cmzmOrJ-.js} +2 -2
  176. package/dist/client/assets/{useScopedModelAvailability-CeAUx0qZ.js → useScopedModelAvailability-kczZtr1M.js} +2 -2
  177. package/dist/client/assets/{useSettings-VTow9ZEM.js → useSettings-CHt2_4He.js} +2 -2
  178. package/dist/client/assets/{vcsRefInvalidation-B2f3qDSR.js → vcsRefInvalidation-CytQodoP.js} +2 -2
  179. package/dist/client/assets/{welcome-CQgOocvj.js → welcome-pbssrwWd.js} +2 -2
  180. package/dist/client/index.html +1 -1
  181. package/package.json +1 -1
  182. package/dist/client/assets/JZOYTAAL-BrzaFmLe.js +0 -1
  183. package/dist/client/assets/settings.archived-DobN7ZtC.js +0 -2
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{M_ as i,Md as a,N_ as o,X_ as s,aE as c,dr as l,gh as u,kd as d,l as f,of as p,t as m,ts as h,vh as g,xb as _}from"./utils-CBe1bHL7.js";import{R as v,W as y}from"./runtime-CeFhsGnm.js";import{D as b,K as x,S as ee,d as te,x as S}from"./useSettings-VTow9ZEM.js";import{f as C}from"./server-DvWrfyUO.js";import{i as w,n as ne}from"./session-D3gY-tOR.js";import{n as re}from"./query-B3Zo1YOE.js";import{t as T}from"./use-atom-command-Bt7x9oO0.js";import{n as E,t as D}from"./radio-group-l1Zl-3hQ.js";import{t as ie}from"./input-DXGWoa4O.js";import{a as ae,c as O,i as oe,r as se,s as ce,t as le}from"./dialog-_vbB7RKH.js";import{x as k}from"./Icons-B1qw9fnR.js";import{t as ue}from"./preview-O1ZL8Awg.js";import{S as A,t as de}from"./ChatGptUsageButton-3K5PpaVk.js";import{a as j}from"./settingsLayout-DrhqvTJ8.js";import{Dr as M,ao as N,ba as fe,co as pe,io as me,lo as P,oo as he,ro as F,xa as I}from"./main-DleJeMZO.js";var L=e(t(),1),R=n(),z=e(r(),1);function B(e){let t=(0,R.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,z.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,z.jsxs)(l,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function ge(e){let t=(0,R.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(ve),[s,c]=(0,L.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,z.jsxs)(ae,{children:[(0,z.jsx)(O,{children:`Reconnect ChatGPT`}),(0,z.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(_e),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,z.jsx)(D,{value:`chatgpt-change-account`}),(0,z.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,z.jsx)(`div`,{className:`px-6 pb-6`,children:(0,z.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,z.jsx)(oe,{children:(0,z.jsx)(B,{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,z.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,z.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 _e(e){return(0,z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,z.jsx)(D,{value:e.id}),(0,z.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function ve(e){return e.id.startsWith(`chatgpt-profile:`)}function ye(e){let t=(0,R.c)(36),{environmentId:n,onClose:r,renderSetup:a,onAccountCreated:c}=e,u=w(n,s),d=te(n),p;t[0]===n?p=t[1]:(p=C.providersValueAtom(n),t[0]=n,t[1]=p);let m=h(p),g=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,L.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,ee]=(0,L.useState)(null),[S,re]=(0,L.useState)(!1),E=m?.find(e=>e.instanceId===x),D=A(E),ae=(0,L.useEffectEvent)(r);(0,L.useEffect)(()=>{D&&ae()},[D]);let O;t[4]!==b||t[5]!==n||t[6]!==_||t[7]!==c||t[8]!==r||t[9]!==S||t[10]!==d||t[11]!==g?(O=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=o.make(`codex_${f()}`);(await g({environmentId:n,input:{patch:{providerInstances:{...d.providerInstances,[e]:{driver:i.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(c?(c(e,b),r()):ee(e)),re(!1)},t[4]=b,t[5]=n,t[6]=_,t[7]=c,t[8]=r,t[9]=S,t[10]=d,t[11]=g,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=he,de=x?b:`Add ChatGPT account`,M;t[15]===de?M=t[16]:(M=(0,z.jsx)(me,{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=N,pe=x?E?.setup?a(x,E):(0,z.jsx)(j,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,z.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),oe()},children:(0,z.jsx)(j,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,z.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),P;t[17]!==fe||t[18]!==pe?(P=(0,z.jsx)(fe,{children:pe}),t[17]=fe,t[18]=pe,t[19]=P):P=t[19];let I;t[20]!==u||t[21]!==x||t[22]!==_||t[23]!==r||t[24]!==S?(I=(0,z.jsx)(F,{children:x?(0,z.jsx)(l,{variant:`outline`,onClick:r,children:`Finish later`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,z.jsx)(l,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!u,children:S?`Adding account…`:`Continue`})]})}),t[20]=u,t[21]=x,t[22]=_,t[23]=r,t[24]=S,t[25]=I):I=t[25];let B;t[26]!==ue||t[27]!==P||t[28]!==I||t[29]!==M?(B=(0,z.jsxs)(ue,{size:`wide`,children:[M,P,I]}),t[26]=ue,t[27]=P,t[28]=I,t[29]=M,t[30]=B):B=t[30];let ge;return t[31]!==se||t[32]!==B||t[33]!==ce||t[34]!==k?(ge=(0,z.jsx)(se,{open:ce,onOpenChange:k,children:B}),t[31]=se,t[32]=B,t[33]=ce,t[34]=k,t[35]=ge):ge=t[35],ge}var be=_(u),xe=_(g),Se=/^[A-Za-z0-9_./:\\-]+$/;function Ce(e,t,n){return Se.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 we(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 V={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function H(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||V[we(n)]>V[we(e)])&&t.set(n.driver,n)}return t}var Te={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 Ee(e,t){let n=Te[e];return t===`windows`?n.windows:n.posix}function De(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=be(r?.config??{});return`${Ce(c(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=xe(r?.config??{});return`${Ce(c(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var Oe={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function U(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 ke(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=ke(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=ke(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,R.c)(11),[n,r]=(0,L.useState)(!1),i;t[0]===e.provider?i=t[1]:(i=we(e.provider),t[0]=e.provider,t[1]=i);let a=i,o=e.enabled&&a===`ready`,s=e.provider?.auth.status===`authenticated`,c=a===`checking`,u;t[2]===e.provider?u=t[3]:(u=U(e.provider),t[2]=e.provider,t[3]=u);let f=u,p;return t[4]!==s||t[5]!==c||t[6]!==o||t[7]!==f||t[8]!==e||t[9]!==n?(p=e.mode===`existing`&&e.presentation===`onboarding`?(0,z.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:o?e.provider?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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.`:c?`Checking your Codex CLI...`:e.provider?.installed?f.headline:`Code with your ChatGPT subscription.`,control:o?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Ready`]}):c?(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):s?(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.headline}):(0,z.jsx)(B,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!s&&!o&&!c?(0,z.jsx)(l,{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,z.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,z.jsx)(Ie,{}),control:(0,z.jsx)(l,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,z.jsx)(j,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,z.jsx)(Fe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=s,t[5]=c,t[6]=o,t[7]=f,t[8]=e,t[9]=n,t[10]=p):p=t[10],p}function Pe(e){let t=(0,R.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,s),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,z.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 c;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(c=(0,z.jsx)(ye,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=c):c=t[8],c}function Fe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:i,onModeChange:a,autoStart:o,onAutoStartConsumed:s,allowExistingCli:c=!0,presentation:u,displayName:f,onSignInCancelled:h}){let g={environmentId:e,input:{instanceId:t}},_=re(C.providerAuthState(g)),te=re(C.providerInstallState(g)),[w,ne]=(0,L.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:_.data,[ae,O]=(0,L.useState)(!1),[oe,se]=(0,L.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),F={reportFailure:!1,reportDefect:!1},R=T(C.startProviderAuth,F),_e=T(C.refreshProviders,F),ve=T(C.completeProviderAuth,F),ye=T(C.cancelProviderAuth,F),be=T(C.logoutProviderAuth,F),xe=T(C.startProviderInstall,F),Se=T(C.cancelProviderInstall,F),Ce=T(C.chatGptReconnectProfile,F),we=T(C.chatGptImportProfile,F),V=!w&&(!he||window.desktopBridge?.receiveProviderAuthCallback!==void 0),H=V&&!window.desktopBridge?.receiveProviderAuthCallback,Te=b(),Ee=S(Te),De=ee(Te),Oe=!he&&Te&&Ee?.connection.phase===`connected`&&De&&ue(new URL(De).hostname)&&(window.desktopBridge!==void 0||ue(window.location.hostname))?Te:null,U=new URL(window.location.href);U.pathname===`/welcome`&&(U.hash=`agents:${e}`),U.pathname===`/settings/providers`&&U.searchParams.set(`instanceId`,t);let ke=H,Ae=(0,L.useId)(),[je,Me]=(0,L.useState)(!1),[Ne,Pe]=(0,L.useState)({flowId:``,value:``}),Fe=Ne.flowId===D?.flowId?Ne.value:``,[W,Re]=(0,L.useState)(!1),[ze,Be]=(0,L.useState)(null),Ve=(0,L.useRef)(!1),[He,Ue]=(0,L.useState)(null),G=(0,L.useRef)(null),We=(0,L.useRef)(!1),Ge=(0,L.useRef)(null),[Ke,qe]=(0,L.useState)(!1),K=N?.installedVersion!=null,q=n?.auth.status===`authenticated`,Je=K&&N?.source!==`local`&&N?.version!=null&&N.version!==N.installedVersion,Ye=ze!==null&&!q&&(D?.phase===`succeeded`||ze===`handoff`);(0,L.useEffect)(()=>{(q||D?.phase===`failed`||D?.phase===`cancelled`)&&Be(null)},[q,D?.phase]),(0,L.useEffect)(()=>{ze&&D?.phase===`succeeded`&&_e({environmentId:e,input:{instanceId:t}})},[ze,D?.phase,_e,e,t]);let Xe=o&&!Ke,Ze=ze===`sign-in`&&!q&&(D===null||D.phase===`idle`),Qe=Ye||Ze||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,J=N?.phase===`downloading`||N?.phase===`extracting`||N?.phase===`verifying`,Y=Xe||Qe||W&&!J,X=i||!r||W||_.error!==null||te.error!==null,Z=W||Qe||J,Q=(0,L.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},[]),$e=(0,L.useId)(),et=(0,L.useRef)(0),tt=(0,L.useRef)(null),[nt,rt]=(0,L.useState)(!1),it=(0,L.useCallback)(async n=>{let r=await Q(()=>we({environmentId:e,input:{instanceId:t,profile:n}}));r&&(Be(`handoff`),ne(null)),rt(!r)},[Q,we,e,t]);(0,L.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;tt.current!==e&&(tt.current=e,it(E.data.profile))},[w,E.data,it]),(0,L.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 at=(0,L.useCallback)(()=>(Be(null),w?(ne(null),Promise.resolve()):Q(()=>ye({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,Q,ye,e,t,D]),ot=(0,L.useCallback)(async(n=`chatgpt`)=>{if(Ve.current)return;We.current=!0,rt(!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),Oe){let i=`${$e}:${++et.current}`;await Q(()=>Ce({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:Oe,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(We.current=!1);return}await Q(()=>R({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:V?`client`:`server`}}),()=>Be(`sign-in`))||(We.current=!1)},[e,t,Q,R,V,Oe,Ce,$e]),$=(0,L.useCallback)(async(n=`chatgpt`)=>{X||Z||(K&&!Je?await ot(n):(G.current=n,await Q(()=>xe({environmentId:e,input:{instanceId:t}}))||(G.current=null)))},[X,Z,K,Je,ot,Q,xe,e,t]);(0,L.useEffect)(()=>{!o||Ke||X||Z||N===null||!n?.setup?.canInstall||(qe(!0),s(),$())},[o,Ke,X,Z,N,n?.setup?.canInstall,s,$]),(0,L.useEffect)(()=>{if(!(!G.current||W||J)){if(N?.phase===`failed`||N?.phase===`cancelled`)G.current=null;else if(K){let e=G.current;G.current=null,ot(e)}}},[W,J,N?.phase,K,ot]);let st=(0,L.useRef)(null),ct=D?.flowId,lt=(0,L.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&V&&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 Q(()=>ve({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.`)}},[V,ct,Q,ve,e,t]);(0,L.useEffect)(()=>{if(V&&A&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===A&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(A).catch(()=>void 0)}},[V,A]),(0,L.useEffect)(()=>{We.current&&D?.phase===`waiting`&&D.flowId&&A&&Ge.current!==D.flowId&&(Ge.current=D.flowId,We.current=!1,H||lt(A))},[D?.phase,D?.flowId,A,lt,H]);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.`:K?`${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=Ye?`Finishing sign-in...`:J?ut:Y||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&le?`Continue as ${le} on OpenAI.`:D?.message??`Finish signing in in your browser.`:q?n?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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=ke&&A&&D?.flowId&&I(U.toString())?fe({authorizationUrl:A,returnUrl:U.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,z.jsx)(l,{size:`sm`,variant:H?`default`:`outline`,className:u===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?W||!nt:!A||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?it(E.data.profile):A&&lt(A)},children:Ye?`Finishing sign-in...`:E.data?.phase===`finished`?nt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?H?`Open ChatGPT sign-in`:`Open sign-in page`:u===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&A?(0,z.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,z.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;Q(()=>ve({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Pe({flowId:i,value:``})})},children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.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||i,onChange:e=>Pe({flowId:D.flowId??``,value:e.target.value})})}),(0,z.jsx)(l,{variant:`outline`,type:`submit`,disabled:W||i||!Fe.trim(),children:`Connect`})]}),H?null:(0,z.jsx)(`div`,{children:(0,z.jsxs)(l,{size:`xs`,variant:`ghost-muted`,onClick:()=>void x().shell.openExternal(A),children:[`Try sign-in in your browser`,(0,z.jsx)(p,{className:`size-3.5`})]})}),ft?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,z.jsx)(l,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,z.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,z.jsx)(pe,{open:je,children:(0,z.jsx)(P,{children:(0,z.jsx)(`div`,{id:Ae,className:m(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=ke?mt:mt?(0,z.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,z.jsx)(Ie,{label:`Having trouble signing in?`,expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,z.jsx)(ge,{open:ae,methods:D?.methods??[],onClose:()=>O(!1),onSelect:e=>{O(!1),$(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(u===`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,z.jsxs)(z.Fragment,{children:[_t,(0,z.jsxs)(Le,{title:f||n?.displayName||`Codex`,description:J?ut:q?n?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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&&!ke?(0,z.jsx)(Ie,{expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}):Xe||Ze||D?.phase===`starting`||D?.phase===`waiting`||W&&!J?(0,z.jsx)(Ie,{}):Y||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:q&&!Z?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Ready`]}):Y?pt:(0,z.jsx)(B,{size:`sm`,disabled:X||Z||(K?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):$()},children:J||W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:Y&&!Ye||J?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:W||i,onClick:()=>{We.current=!1,G.current=null,w||Y&&D?.flowId?at():N?.operationId&&Q(()=>Se({environmentId:e,input:{instanceId:t,operationId:N.operationId}}))},children:`Cancel`}):!Y&&!q&&k?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:X||Z,onClick:()=>void $(`chatgpt-change-account`),children:`Use a different account`}):!Y&&!q&&c?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:i||Z,onClick:()=>a(`existing`),children:`Use existing CLI`}):null,children:[ke?gt:ht(),r?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,z.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,z.jsx)(j,{title:`ChatGPT account`,description:dt,control:(0,z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:Y?(0,z.jsxs)(z.Fragment,{children:[pt,!Ye&&(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{(w||D?.flowId)&&(We.current=!1,at(),h?.())},children:`Cancel`})]}):J?(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{N?.operationId&&(G.current=null,Q(()=>Se({environmentId:e,input:{instanceId:t,operationId:N.operationId}})))},children:`Cancel`}):q?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{size:`sm`,variant:`outline`,disabled:X||Z,onClick:()=>O(!0),children:`Change account`}),(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:X||Z,onClick:()=>void Q(()=>be(g)),children:`Disconnect`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(B,{size:`sm`,disabled:X||Z||(K?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):$()},children:W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),k?(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:X||Z,onClick:()=>void $(`chatgpt-change-account`),children:`Use a different account`}):null]})})}),q?(0,z.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,z.jsx)(de,{})}):null,vt?(0,z.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,z.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,He||_.error||te.error||N?.phase===`failed`?(0,z.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,R.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,z.jsx)(j,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.jsx)(j,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.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,z.jsxs)(z.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,R.c)(10),{label:n,expanded:r,controls:i,onToggle:o}=e,s=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!o){let e;return t[0]===s?e=t[1]:(e=(0,z.jsx)(`div`,{className:`leading-relaxed`,children:s}),t[0]=s,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,z.jsx)(a,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==s||t[7]!==o||t[8]!==u?(d=(0,z.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:o,children:[s,u]}),t[4]=i,t[5]=c,t[6]=s,t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Le(e){let t=(0,R.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=L.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.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,z.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,z.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,z.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,z.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,z.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,z.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,z.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{Oe as a,ke as c,De as d,H as f,Ne as i,we as l,Pe as n,U as o,B as p,W as r,je as s,Re as t,Ee as u};
2
- //# sourceMappingURL=CodexSetupSection.logic-BepCZ25p.js.map
1
+ import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{M_ as i,Md as a,N_ as o,X_ as s,aE as c,dr as l,gh as u,kd as d,l as f,of as p,t as m,ts as h,vh as g,xb as _}from"./utils-CBe1bHL7.js";import{R as v,W as y}from"./runtime-CABaKt1A.js";import{D as b,K as x,S as ee,d as te,x as S}from"./useSettings-CHt2_4He.js";import{f as C}from"./server-mIR8e8Vz.js";import{i as w,n as ne}from"./session-BlCBDyVn.js";import{n as re}from"./query-B3Zo1YOE.js";import{t as T}from"./use-atom-command-C4y634Qy.js";import{n as E,t as D}from"./radio-group-l1Zl-3hQ.js";import{t as ie}from"./input-DXGWoa4O.js";import{a as ae,c as O,i as oe,r as se,s as ce,t as le}from"./dialog-_vbB7RKH.js";import{x as k}from"./Icons-B1qw9fnR.js";import{t as ue}from"./preview-O1ZL8Awg.js";import{S as A,t as de}from"./ChatGptUsageButton-DqJ-vZMe.js";import{a as j}from"./settingsLayout-vgYGia0Q.js";import{Dr as M,ao as N,ba as fe,co as pe,io as me,lo as P,oo as he,ro as F,xa as I}from"./main-Cywp3EWc.js";var L=e(t(),1),R=n(),z=e(r(),1);function B(e){let t=(0,R.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,z.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,z.jsxs)(l,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function ge(e){let t=(0,R.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(ve),[s,c]=(0,L.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,z.jsxs)(ae,{children:[(0,z.jsx)(O,{children:`Reconnect ChatGPT`}),(0,z.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(_e),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,z.jsx)(D,{value:`chatgpt-change-account`}),(0,z.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,z.jsx)(`div`,{className:`px-6 pb-6`,children:(0,z.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,z.jsx)(oe,{children:(0,z.jsx)(B,{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,z.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,z.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 _e(e){return(0,z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,z.jsx)(D,{value:e.id}),(0,z.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function ve(e){return e.id.startsWith(`chatgpt-profile:`)}function ye(e){let t=(0,R.c)(36),{environmentId:n,onClose:r,renderSetup:a,onAccountCreated:c}=e,u=w(n,s),d=te(n),p;t[0]===n?p=t[1]:(p=C.providersValueAtom(n),t[0]=n,t[1]=p);let m=h(p),g=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,L.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,ee]=(0,L.useState)(null),[S,re]=(0,L.useState)(!1),E=m?.find(e=>e.instanceId===x),D=A(E),ae=(0,L.useEffectEvent)(r);(0,L.useEffect)(()=>{D&&ae()},[D]);let O;t[4]!==b||t[5]!==n||t[6]!==_||t[7]!==c||t[8]!==r||t[9]!==S||t[10]!==d||t[11]!==g?(O=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=o.make(`codex_${f()}`);(await g({environmentId:n,input:{patch:{providerInstances:{...d.providerInstances,[e]:{driver:i.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(c?(c(e,b),r()):ee(e)),re(!1)},t[4]=b,t[5]=n,t[6]=_,t[7]=c,t[8]=r,t[9]=S,t[10]=d,t[11]=g,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=he,de=x?b:`Add ChatGPT account`,M;t[15]===de?M=t[16]:(M=(0,z.jsx)(me,{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=N,pe=x?E?.setup?a(x,E):(0,z.jsx)(j,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,z.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),oe()},children:(0,z.jsx)(j,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,z.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),P;t[17]!==fe||t[18]!==pe?(P=(0,z.jsx)(fe,{children:pe}),t[17]=fe,t[18]=pe,t[19]=P):P=t[19];let I;t[20]!==u||t[21]!==x||t[22]!==_||t[23]!==r||t[24]!==S?(I=(0,z.jsx)(F,{children:x?(0,z.jsx)(l,{variant:`outline`,onClick:r,children:`Finish later`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,z.jsx)(l,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!u,children:S?`Adding account…`:`Continue`})]})}),t[20]=u,t[21]=x,t[22]=_,t[23]=r,t[24]=S,t[25]=I):I=t[25];let B;t[26]!==ue||t[27]!==P||t[28]!==I||t[29]!==M?(B=(0,z.jsxs)(ue,{size:`wide`,children:[M,P,I]}),t[26]=ue,t[27]=P,t[28]=I,t[29]=M,t[30]=B):B=t[30];let ge;return t[31]!==se||t[32]!==B||t[33]!==ce||t[34]!==k?(ge=(0,z.jsx)(se,{open:ce,onOpenChange:k,children:B}),t[31]=se,t[32]=B,t[33]=ce,t[34]=k,t[35]=ge):ge=t[35],ge}var be=_(u),xe=_(g),Se=/^[A-Za-z0-9_./:\\-]+$/;function Ce(e,t,n){return Se.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 we(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 V={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function H(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||V[we(n)]>V[we(e)])&&t.set(n.driver,n)}return t}var Te={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 Ee(e,t){let n=Te[e];return t===`windows`?n.windows:n.posix}function De(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=be(r?.config??{});return`${Ce(c(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=xe(r?.config??{});return`${Ce(c(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var Oe={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function U(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 ke(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=ke(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=ke(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,R.c)(11),[n,r]=(0,L.useState)(!1),i;t[0]===e.provider?i=t[1]:(i=we(e.provider),t[0]=e.provider,t[1]=i);let a=i,o=e.enabled&&a===`ready`,s=e.provider?.auth.status===`authenticated`,c=a===`checking`,u;t[2]===e.provider?u=t[3]:(u=U(e.provider),t[2]=e.provider,t[3]=u);let f=u,p;return t[4]!==s||t[5]!==c||t[6]!==o||t[7]!==f||t[8]!==e||t[9]!==n?(p=e.mode===`existing`&&e.presentation===`onboarding`?(0,z.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:o?e.provider?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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.`:c?`Checking your Codex CLI...`:e.provider?.installed?f.headline:`Code with your ChatGPT subscription.`,control:o?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Ready`]}):c?(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):s?(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f.headline}):(0,z.jsx)(B,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!s&&!o&&!c?(0,z.jsx)(l,{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,z.jsx)(Le,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,z.jsx)(Ie,{}),control:(0,z.jsx)(l,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,z.jsx)(j,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,z.jsx)(Fe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=s,t[5]=c,t[6]=o,t[7]=f,t[8]=e,t[9]=n,t[10]=p):p=t[10],p}function Pe(e){let t=(0,R.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,s),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,z.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 c;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(c=(0,z.jsx)(ye,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=c):c=t[8],c}function Fe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:i,onModeChange:a,autoStart:o,onAutoStartConsumed:s,allowExistingCli:c=!0,presentation:u,displayName:f,onSignInCancelled:h}){let g={environmentId:e,input:{instanceId:t}},_=re(C.providerAuthState(g)),te=re(C.providerInstallState(g)),[w,ne]=(0,L.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:_.data,[ae,O]=(0,L.useState)(!1),[oe,se]=(0,L.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),F={reportFailure:!1,reportDefect:!1},R=T(C.startProviderAuth,F),_e=T(C.refreshProviders,F),ve=T(C.completeProviderAuth,F),ye=T(C.cancelProviderAuth,F),be=T(C.logoutProviderAuth,F),xe=T(C.startProviderInstall,F),Se=T(C.cancelProviderInstall,F),Ce=T(C.chatGptReconnectProfile,F),we=T(C.chatGptImportProfile,F),V=!w&&(!he||window.desktopBridge?.receiveProviderAuthCallback!==void 0),H=V&&!window.desktopBridge?.receiveProviderAuthCallback,Te=b(),Ee=S(Te),De=ee(Te),Oe=!he&&Te&&Ee?.connection.phase===`connected`&&De&&ue(new URL(De).hostname)&&(window.desktopBridge!==void 0||ue(window.location.hostname))?Te:null,U=new URL(window.location.href);U.pathname===`/welcome`&&(U.hash=`agents:${e}`),U.pathname===`/settings/providers`&&U.searchParams.set(`instanceId`,t);let ke=H,Ae=(0,L.useId)(),[je,Me]=(0,L.useState)(!1),[Ne,Pe]=(0,L.useState)({flowId:``,value:``}),Fe=Ne.flowId===D?.flowId?Ne.value:``,[W,Re]=(0,L.useState)(!1),[ze,Be]=(0,L.useState)(null),Ve=(0,L.useRef)(!1),[He,Ue]=(0,L.useState)(null),G=(0,L.useRef)(null),We=(0,L.useRef)(!1),Ge=(0,L.useRef)(null),[Ke,qe]=(0,L.useState)(!1),K=N?.installedVersion!=null,q=n?.auth.status===`authenticated`,Je=K&&N?.source!==`local`&&N?.version!=null&&N.version!==N.installedVersion,Ye=ze!==null&&!q&&(D?.phase===`succeeded`||ze===`handoff`);(0,L.useEffect)(()=>{(q||D?.phase===`failed`||D?.phase===`cancelled`)&&Be(null)},[q,D?.phase]),(0,L.useEffect)(()=>{ze&&D?.phase===`succeeded`&&_e({environmentId:e,input:{instanceId:t}})},[ze,D?.phase,_e,e,t]);let Xe=o&&!Ke,Ze=ze===`sign-in`&&!q&&(D===null||D.phase===`idle`),Qe=Ye||Ze||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,J=N?.phase===`downloading`||N?.phase===`extracting`||N?.phase===`verifying`,Y=Xe||Qe||W&&!J,X=i||!r||W||_.error!==null||te.error!==null,Z=W||Qe||J,Q=(0,L.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},[]),$e=(0,L.useId)(),et=(0,L.useRef)(0),tt=(0,L.useRef)(null),[nt,rt]=(0,L.useState)(!1),it=(0,L.useCallback)(async n=>{let r=await Q(()=>we({environmentId:e,input:{instanceId:t,profile:n}}));r&&(Be(`handoff`),ne(null)),rt(!r)},[Q,we,e,t]);(0,L.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;tt.current!==e&&(tt.current=e,it(E.data.profile))},[w,E.data,it]),(0,L.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 at=(0,L.useCallback)(()=>(Be(null),w?(ne(null),Promise.resolve()):Q(()=>ye({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,Q,ye,e,t,D]),ot=(0,L.useCallback)(async(n=`chatgpt`)=>{if(Ve.current)return;We.current=!0,rt(!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),Oe){let i=`${$e}:${++et.current}`;await Q(()=>Ce({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:Oe,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(We.current=!1);return}await Q(()=>R({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:V?`client`:`server`}}),()=>Be(`sign-in`))||(We.current=!1)},[e,t,Q,R,V,Oe,Ce,$e]),$=(0,L.useCallback)(async(n=`chatgpt`)=>{X||Z||(K&&!Je?await ot(n):(G.current=n,await Q(()=>xe({environmentId:e,input:{instanceId:t}}))||(G.current=null)))},[X,Z,K,Je,ot,Q,xe,e,t]);(0,L.useEffect)(()=>{!o||Ke||X||Z||N===null||!n?.setup?.canInstall||(qe(!0),s(),$())},[o,Ke,X,Z,N,n?.setup?.canInstall,s,$]),(0,L.useEffect)(()=>{if(!(!G.current||W||J)){if(N?.phase===`failed`||N?.phase===`cancelled`)G.current=null;else if(K){let e=G.current;G.current=null,ot(e)}}},[W,J,N?.phase,K,ot]);let st=(0,L.useRef)(null),ct=D?.flowId,lt=(0,L.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&V&&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 Q(()=>ve({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.`)}},[V,ct,Q,ve,e,t]);(0,L.useEffect)(()=>{if(V&&A&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===A&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(A).catch(()=>void 0)}},[V,A]),(0,L.useEffect)(()=>{We.current&&D?.phase===`waiting`&&D.flowId&&A&&Ge.current!==D.flowId&&(Ge.current=D.flowId,We.current=!1,H||lt(A))},[D?.phase,D?.flowId,A,lt,H]);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.`:K?`${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=Ye?`Finishing sign-in...`:J?ut:Y||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&le?`Continue as ${le} on OpenAI.`:D?.message??`Finish signing in in your browser.`:q?n?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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=ke&&A&&D?.flowId&&I(U.toString())?fe({authorizationUrl:A,returnUrl:U.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,z.jsx)(l,{size:`sm`,variant:H?`default`:`outline`,className:u===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?W||!nt:!A||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?it(E.data.profile):A&&lt(A)},children:Ye?`Finishing sign-in...`:E.data?.phase===`finished`?nt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?H?`Open ChatGPT sign-in`:`Open sign-in page`:u===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&A?(0,z.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,z.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;Q(()=>ve({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Pe({flowId:i,value:``})})},children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.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||i,onChange:e=>Pe({flowId:D.flowId??``,value:e.target.value})})}),(0,z.jsx)(l,{variant:`outline`,type:`submit`,disabled:W||i||!Fe.trim(),children:`Connect`})]}),H?null:(0,z.jsx)(`div`,{children:(0,z.jsxs)(l,{size:`xs`,variant:`ghost-muted`,onClick:()=>void x().shell.openExternal(A),children:[`Try sign-in in your browser`,(0,z.jsx)(p,{className:`size-3.5`})]})}),ft?(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,z.jsx)(l,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,z.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,z.jsx)(pe,{open:je,children:(0,z.jsx)(P,{children:(0,z.jsx)(`div`,{id:Ae,className:m(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=ke?mt:mt?(0,z.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,z.jsx)(Ie,{label:`Having trouble signing in?`,expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,z.jsx)(ge,{open:ae,methods:D?.methods??[],onClose:()=>O(!1),onSelect:e=>{O(!1),$(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(u===`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,z.jsxs)(z.Fragment,{children:[_t,(0,z.jsxs)(Le,{title:f||n?.displayName||`Codex`,description:J?ut:q?n?.auth.email?.trim()?(0,z.jsxs)(z.Fragment,{children:[`Signed in as`,` `,(0,z.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&&!ke?(0,z.jsx)(Ie,{expanded:je,controls:Ae,onToggle:()=>Me(e=>!e)}):Xe||Ze||D?.phase===`starting`||D?.phase===`waiting`||W&&!J?(0,z.jsx)(Ie,{}):Y||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:q&&!Z?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,z.jsx)(d,{className:`size-3.5`}),`Ready`]}):Y?pt:(0,z.jsx)(B,{size:`sm`,disabled:X||Z||(K?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):$()},children:J||W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:Y&&!Ye||J?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:W||i,onClick:()=>{We.current=!1,G.current=null,w||Y&&D?.flowId?at():N?.operationId&&Q(()=>Se({environmentId:e,input:{instanceId:t,operationId:N.operationId}}))},children:`Cancel`}):!Y&&!q&&k?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:X||Z,onClick:()=>void $(`chatgpt-change-account`),children:`Use a different account`}):!Y&&!q&&c?(0,z.jsx)(l,{size:`sm`,variant:`ghost-muted`,disabled:i||Z,onClick:()=>a(`existing`),children:`Use existing CLI`}):null,children:[ke?gt:ht(),r?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,z.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,z.jsx)(j,{title:`ChatGPT account`,description:dt,control:(0,z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:Y?(0,z.jsxs)(z.Fragment,{children:[pt,!Ye&&(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{(w||D?.flowId)&&(We.current=!1,at(),h?.())},children:`Cancel`})]}):J?(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:W||i,onClick:()=>{N?.operationId&&(G.current=null,Q(()=>Se({environmentId:e,input:{instanceId:t,operationId:N.operationId}})))},children:`Cancel`}):q?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{size:`sm`,variant:`outline`,disabled:X||Z,onClick:()=>O(!0),children:`Change account`}),(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:X||Z,onClick:()=>void Q(()=>be(g)),children:`Disconnect`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(B,{size:`sm`,disabled:X||Z||(K?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{k?O(!0):$()},children:W?`Setting up...`:k?`Reconnect account`:`Continue with ChatGPT`}),k?(0,z.jsx)(l,{size:`sm`,variant:`ghost`,disabled:X||Z,onClick:()=>void $(`chatgpt-change-account`),children:`Use a different account`}):null]})})}),q?(0,z.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,z.jsx)(de,{})}):null,vt?(0,z.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,z.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,He||_.error||te.error||N?.phase===`failed`?(0,z.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,R.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,z.jsx)(j,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.jsx)(j,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,z.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,z.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,z.jsxs)(z.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,R.c)(10),{label:n,expanded:r,controls:i,onToggle:o}=e,s=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!o){let e;return t[0]===s?e=t[1]:(e=(0,z.jsx)(`div`,{className:`leading-relaxed`,children:s}),t[0]=s,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,z.jsx)(a,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==s||t[7]!==o||t[8]!==u?(d=(0,z.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:o,children:[s,u]}),t[4]=i,t[5]=c,t[6]=s,t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Le(e){let t=(0,R.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=L.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.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,z.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,z.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,z.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,z.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,z.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,z.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,z.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{Oe as a,ke as c,De as d,H as f,Ne as i,we as l,Pe as n,U as o,B as p,W as r,je as s,Re as t,Ee as u};
2
+ //# sourceMappingURL=CodexSetupSection.logic-DOe05Yxb.js.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./react-DH3P2YXY.js";import{n as t,t as n}from"./jsx-runtime-BnjsACtP.js";import{dr as r,t as i}from"./utils-CBe1bHL7.js";import{S as a,d as o,l as s}from"./TooltipViewport-DJXNIjFt.js";import{p as c}from"./toast-C61oyZY1.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-C967hvdK.js.map
1
+ import{a as e}from"./react-DH3P2YXY.js";import{n as t,t as n}from"./jsx-runtime-BnjsACtP.js";import{dr as r,t as i}from"./utils-CBe1bHL7.js";import{S as a,d as o,l as s}from"./TooltipViewport-DJXNIjFt.js";import{p as c}from"./toast-D26NINYU.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-BUY_4yYG.js.map
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReadOnlySourcePreview-DPJWK3HJ.js","assets/react-DH3P2YXY.js","assets/jsx-runtime-BnjsACtP.js","assets/useSettings-VTow9ZEM.js","assets/utils-CBe1bHL7.js","assets/activity-BT9zGwI4.js","assets/createLucideIcon-BRvysHna.js","assets/Icon-BiSXef-P.js","assets/alarm-clock-DLm_0oDD.js","assets/app-window-CBNJqZPl.js","assets/archive-D_14z4Xm.js","assets/arrow-down-up-Tu6B2hri.js","assets/arrow-down-Bo_WAMYh.js","assets/arrow-left-Ba8eq_9S.js","assets/arrow-right-left-DyJucsB1.js","assets/arrow-right-Bg4mlTrk.js","assets/arrow-up-down-AigUcA_4.js","assets/arrow-up-left-C6F8l2kC.js","assets/arrow-up-right-BNXlwlzJ.js","assets/arrow-up-D4kutFpL.js","assets/battery-DdftvRcq.js","assets/bell-4pS2DvJU.js","assets/blocks-N48yRCu0.js","assets/book-open-m1zikk07.js","assets/bookmark-DCumPe18.js","assets/bot-C71zefL3.js","assets/box-N7KHNXgQ.js","assets/bug-_77C5nd4.js","assets/calendar-arrow-down-tK2df2Gr.js","assets/calendar-arrow-up-DoqzmS-b.js","assets/calendar-clock-D24iG-gJ.js","assets/calendar-CuDpKI2e.js","assets/camera-CRxcom4Z.js","assets/chart-no-axes-column-CWRXr09M.js","assets/check-Cs_SSACZ.js","assets/chevron-down-Do9qqNbR.js","assets/chevron-left-D56AngEd.js","assets/chevron-right-CcbZ6PxZ.js","assets/chevron-up-CZEzk9UW.js","assets/chevrons-left-right-ellipsis-BuDdURW0.js","assets/chevrons-up-down-CMYBD15h.js","assets/chromium-IRgsGkxl.js","assets/circle-alert-Rh3WFq8P.js","assets/circle-arrow-up-CBkBThPI.js","assets/circle-check-Davl0yih.js","assets/circle-dashed-Divqvc3s.js","assets/circle-dot-DDXvyPkX.js","assets/circle-slash-BHppGVB2.js","assets/circle-x-DCG47j33.js","assets/circle-BXaepj2J.js","assets/clock-3-BjqRuWmx.js","assets/clock-BZce7MqL.js","assets/cloud-download-Cw2Qyeof.js","assets/cloud-upload-Bbq2IGQX.js","assets/cloud-Cnpuf424.js","assets/code-xml-C7_RVxwx.js","assets/code-C8ZFD3fi.js","assets/columns-2-R7e6oP5f.js","assets/copy-C6t_ZU58.js","assets/corner-left-up-CIgtHeD1.js","assets/corner-up-right-BWhPHx5s.js","assets/cpu-4YV41FL_.js","assets/database-0EoDfSWv.js","assets/download-CfEwtjBn.js","assets/earth-B0lYBmT1.js","assets/ellipsis-vertical-BM1Lc1f1.js","assets/ellipsis-CSD7gEuG.js","assets/external-link-Df6uBnqH.js","assets/eye-off-D5GkPp8X.js","assets/eye-DlWBkL1d.js","assets/file-braces-DycW5IfR.js","assets/file-code-corner-Bph0gpk_.js","assets/file-diff-uE_kfwjO.js","assets/file-search-BxZuGCW_.js","assets/file-spreadsheet-BDzNPY8g.js","assets/file-text-Bn72KOhu.js","assets/file-DHjVYhLT.js","assets/files-DsO7Sg8V.js","assets/film-Bbn0ceXE.js","assets/flask-conical-Cg6idKdH.js","assets/folder-closed-D6kbWc3q.js","assets/folder-cog-CBSQaLA2.js","assets/folder-git-2-n1sLmp_t.js","assets/folder-git-DCVI-R4l.js","assets/folder-open-Bu-nFCGY.js","assets/folder-plus-wg03g0vP.js","assets/folder-tree-FUExeKOH.js","assets/folder-Cieksypr.js","assets/gauge-Cgf0xSWC.js","assets/git-branch-plus-GXmZfN57.js","assets/git-branch-BWQfoO37.js","assets/git-commit-horizontal-BI_Z5Kib.js","assets/git-fork-CK2oK4JM.js","assets/git-merge-CH86CpaI.js","assets/git-pull-request-arrow-BYmuTHnq.js","assets/git-pull-request-closed-EzDnMgeA.js","assets/git-pull-request-draft-DbMmZ9EC.js","assets/globe-DHq8q48U.js","assets/grip-vertical-sTbvrVma.js","assets/hammer-BnFrycrq.js","assets/hard-drive-CnhXqMSu.js","assets/hat-glasses-C1sL_lJD.js","assets/history-BOloOry4.js","assets/house-LvUaI36y.js","assets/image-DFl_i29V.js","assets/inbox-Bfua4pqw.js","assets/info-Bwtivk15.js","assets/keyboard-C94dd8zf.js","assets/laptop-BJfWDOqH.js","assets/layers-BczY2xKh.js","assets/lightbulb-AbDNyk1F.js","assets/link-2-J9n7Ukgt.js","assets/link-iM9yOrD5.js","assets/list-checks--PgwqWme.js","assets/list-filter-C7uwdO5w.js","assets/list-ordered-JmJCtT6d.js","assets/list-todo-BOZtqLIw.js","assets/list-BNel2JmV.js","assets/loader-circle-DOPuwGUy.js","assets/lock-open-qdfB-3sG.js","assets/lock-CNeMaiIX.js","assets/log-in-DuxSLs9h.js","assets/mail-DrFNo5rr.js","assets/maximize-2-C4jSdiqI.js","assets/maximize-BKkQJR3r.js","assets/memory-stick-yVhfpVno.js","assets/message-circle-question-mark-qR5q6Xbi.js","assets/message-circle-qu3riBnu.js","assets/message-square-dashed-BDjE-epL.js","assets/message-square-off-BF3vA0b4.js","assets/message-square-text-CfjrqiSr.js","assets/message-square-warning-6MHWBWO6.js","assets/message-square-B2NO3ViY.js","assets/messages-square-BDA1tcVi.js","assets/minimize-2-D1qaBNiP.js","assets/minus-DVH2v7vL.js","assets/monitor-DYdSXGUQ.js","assets/moon-z0kk2bkY.js","assets/mouse-pointer-2-BzC5PGDm.js","assets/mouse-pointer-click-_zj1O0gg.js","assets/octagon-alert-BQp6gUkE.js","assets/package-plus-DaYcLmCH.js","assets/package-BDRaz7Ff.js","assets/paintbrush-Cd3ye7YJ.js","assets/palette-DWDYvvRF.js","assets/panel-bottom-DX8HINCH.js","assets/panel-left-aKsqIRJO.js","assets/panel-right-XrDzcWDK.js","assets/paperclip-BAtVoM2Q.js","assets/panels-top-left-ug17nD5b.js","assets/pen-line-BtsHFcuV.js","assets/pencil-ruler-u4ck96IX.js","assets/pencil-CS36_8K6.js","assets/picture-in-picture-2-CTTZM7s_.js","assets/pilcrow-B0pICPe4.js","assets/pin-B28emPdt.js","assets/play-utur7gJ1.js","assets/plug-2-BbsYUlrD.js","assets/plus-BFikiw2m.js","assets/plug-Cz_1a3P7.js","assets/power-lnBvrj1p.js","assets/presentation-DuhP07nk.js","assets/puzzle-_xVT2Tkf.js","assets/qr-code-8OyojaA-.js","assets/quote-CY1r_9f2.js","assets/radio-tower-CQ9UBgC-.js","assets/redo-2-CMJUpQN9.js","assets/refresh-cw-Bb4DfPZ_.js","assets/rotate-ccw-DIk8O74I.js","assets/rotate-cw-BCqL9vBU.js","assets/route-DDK4p_jp.js","assets/rows-3-KtFgL-bn.js","assets/scale-BWqluNv-.js","assets/search-2NYXmfL3.js","assets/send-Usbx4MSt.js","assets/server-C5VT7--0.js","assets/settings-2-CG9Vl9Oj.js","assets/settings-CSrjOUO8.js","assets/shield-check-BhnliHga.js","assets/shield-question-mark-DJzZ_XtG.js","assets/shield-Bo3bXsl5.js","assets/sliders-horizontal-CbQdxecl.js","assets/smartphone-DLXjLUvY.js","assets/smile-plus-B6sk7n9M.js","assets/sparkles-D72pVUsJ.js","assets/square-arrow-out-up-right-D4Y8_c2a.js","assets/square-pen-B9IATJSK.js","assets/square-split-horizontal-BEBi5lgX.js","assets/square-split-vertical-BvRRvh2L.js","assets/square-terminal-MebNo2O3.js","assets/square-ChD_5l-9.js","assets/star-BFGG9hcF.js","assets/sun-CV31Z7e1.js","assets/tag-DAyj5h5G.js","assets/target-DRkzkaHT.js","assets/terminal-Dbk8nKIT.js","assets/text-align-start-BlQ02nAY.js","assets/text-search-CmNwvT1W.js","assets/text-wrap-Y7SHIazH.js","assets/ticket-B3TOD4z9.js","assets/trash-2-vrfXuXSc.js","assets/trending-down-0HJRpRPf.js","assets/trending-up-B0AABrFJ.js","assets/triangle-alert-DcIYyjDc.js","assets/type-CcxvYAFU.js","assets/undo-2-CbzuoKHe.js","assets/unlink-2-Cu9CVRNc.js","assets/unplug-D0qX6EAT.js","assets/upload-_7gAV2BZ.js","assets/user-check-vIX5oc4W.js","assets/user-lock-Bz0imDJs.js","assets/user-plus-6mh3DQc1.js","assets/user-round-x-Dyi0-TdA.js","assets/user-round-CdU_AaX_.js","assets/users-CfjzCdxE.js","assets/wifi-off-DzVPlURa.js","assets/workflow-DbsdAT4Y.js","assets/wrench-Bjp_8iLx.js","assets/x-CJgPyqpa.js","assets/zap-C_GfNMdZ.js","assets/runtime-CeFhsGnm.js","assets/runtime-BOlBBevr.js","assets/toast-C61oyZY1.js","assets/TooltipViewport-DJXNIjFt.js","assets/spinner-BZh9P0sD.js","assets/useParams-C5D_t-0u.js","assets/server-DvWrfyUO.js","assets/session-D3gY-tOR.js","assets/use-atom-command-Bt7x9oO0.js","assets/themePalette-MbAn2gqj.js","assets/diffRendering-MXukhqw1.js","assets/index-DA9og9YW.js","assets/Virtualizer-CI2uidEs.js","assets/getDiffFileInput-CzeweGHs.js","assets/main-DleJeMZO.js","assets/vcsRefInvalidation-B2f3qDSR.js","assets/entities-eRiwvW2F.js","assets/query-B3Zo1YOE.js","assets/number-field-qEfih146.js","assets/useRegisterFieldControl-DUs9w2Me.js","assets/FormContext-DcLeIpxJ.js","assets/CSPContext-DGVCKkcb.js","assets/select-Cbpdz6n3.js","assets/SelectScrollUpArrow-DeRXucOo.js","assets/link-C3TbL1do.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BU0ER5FO.js","assets/useNavigate-Cdrlv-yJ.js","assets/useLocation-Cwv1HZ3K.js","assets/rightPanelStore-Cv1U3yrU.js","assets/toastHelpers-DxXYm50b.js","assets/queries-DJfKGsHe.js","assets/session-logic-OeNFZd_V.js","assets/htmlRender-C3rZ0xgC.js","assets/mediaSource-B_75uvyp.js","assets/fileLinks-CYejoXPq.js","assets/mediaReference-BbSbhpkR.js","assets/usageFormat-D5Mz5ugL.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-ChmjT8Ns.js","assets/skeleton-CFtayHTe.js","assets/useAriaLabelledBy-DjNn9irU.js","assets/toggle-B03MQDgB.js","assets/toggle-group-yF5GZ53o.js","assets/CompositeRoot-BFPe8O0M.js","assets/input-DXGWoa4O.js","assets/Input-DQflEYBs.js","assets/FieldControl-BOrs67_f.js","assets/scroll-area-CQNIjQ8U.js","assets/ScrollAreaCorner-DF4GCx0d.js","assets/dist-ceTe_mn7.js","assets/DialogTitle-DNp9zThp.js","assets/dialog-_vbB7RKH.js","assets/sidebar-BhJqncti.js","assets/useResizeDrag-Dc7crya0.js","assets/observeResize-DzSkewug.js","assets/AnimatedHeight-BZhIfVtA.js","assets/assets-6zZLBDZw.js","assets/sourceControl-Dqo9EYNC.js","assets/assetUrls-BOJMUK_1.js","assets/browserHistoryStore-TJXTYA-V.js","assets/preview-O1ZL8Awg.js","assets/openFileInPreview-CiPuDrfB.js","assets/keybindings-DAHl8jIl.js","assets/Icons-B1qw9fnR.js","assets/preview-ipLyyv_l.js","assets/PierreEntryIcon-wm-IkF2y.js","assets/pierre-icons-D3vWvKqU.js","assets/RenderErrorBoundary-BI5KBtsb.js","assets/sourceControlClients-DGnHi6Rd.js","assets/browserLinkTarget-DRbX4L_9.js","assets/pullRequestIcons-DPbMXqGp.js","assets/pullRequests-DggtcbhA.js","assets/threadSort-Bd2rijEy.js","assets/popover-CogH2zM4.js","assets/PopoverHandle-CqjlXffy.js","assets/ProjectFavicon-zExdjKgc.js","assets/ProjectMonogram-Ba70a8_s.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-D4FdR3Xm.js","assets/checkbox-4yBjrqWQ.js","assets/CheckboxIndicator-DZ8vBLEv.js","assets/FieldItemContext-BsKb7ObC.js","assets/terminalSessions-BykgTNwT.js","assets/AlertDialogRoot-D5eL1YFA.js","assets/useHandleNewThread-BOKOo2wA.js","assets/p4ProjectFile-BVKW5TIA.js","assets/uiStateStore-DL8OsPjd.js","assets/guideRunStore-DAYN2Zd7.js","assets/pullRequestDetail.logic-Bkh57WzV.js","assets/pullRequestReviewStore-BAxwf6rl.js","assets/sidebarProjectGrouping-DDt6qTcu.js","assets/EnvironmentMachineIcon-DBWK6C8T.js","assets/alert-DpVw79VA.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-3K5PpaVk.js","assets/kbd-WWNLIkTn.js","assets/settingsLayout-DrhqvTJ8.js","assets/WorkspacePageContainer-MDWEFwmu.js","assets/KeybindingsSettings.logic-BA5WG7V2.js","assets/usageShortcuts-mAekk3eG.js","assets/primaryCloudLinkState-CER468V5.js","assets/command-D8XZec1r.js","assets/ComboboxClear-By718biy.js","assets/ComboboxGroupLabel-DjWIIS5_.js","assets/ConnectionStatusDot-wmgCjAfF.js","assets/standalone-page-3TM7ZX16.js","assets/primary-CMBPxKMH.js","assets/onboarding-1Zg3fM0A.js","assets/scheduledTasksSettings.logic-BpOBCcOk.js","assets/main-DjrB0l0D.css","assets/DiffWorkerPoolProvider-CqmToECA.js"])))=>i.map(i=>d[i]);
2
- import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-DA9og9YW.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$ as a,Ad as o,Ai as s,Ct as c,Gu as l,J as u,Lc as d,Lm as f,Md as p,Nc as m,Oc as h,Op as g,Pc as _,Q as v,Tc as y,Uu as b,Wu as x,X as S,Y as C,__ as w,_t as T,bp as E,bt as ee,dr as te,eh as ne,hc as re,if as ie,it as D,jm as O,jt as ae,kd as oe,ki as se,m_ as ce,mt as le,ot as ue,pp as de,rh as fe,rt as pe,st as me,t as he,ts as ge,vt as _e,wa as ve,wc as k,wt as ye,y as be,yt as xe}from"./utils-CBe1bHL7.js";import{k as Se}from"./entities-eRiwvW2F.js";import{l as Ce,o as we,s as Te}from"./runtime-BOlBBevr.js";import{S as Ee,U as De,b as Oe,d as ke,l as Ae,w as A}from"./TooltipViewport-DJXNIjFt.js";import{A as je,C as Me,D as Ne,E as Pe,O as Fe,S as Ie,T as Le,a as Re,b as ze,j as Be,k as Ve,l as He,n as Ue,r as We,s as Ge,v as Ke,w as qe,y as Je}from"./ChatMarkdown-EK5C8Dje.js";import{t as Ye}from"./spinner-BZh9P0sD.js";import{t as Xe}from"./link-C3TbL1do.js";import{i as Ze,p as Qe}from"./toast-C61oyZY1.js";import{G as $e,_ as et,q as tt,s as nt}from"./useSettings-VTow9ZEM.js";import{f as rt,s as it}from"./server-DvWrfyUO.js";import{P as at,R as ot,_ as st,g as ct,p as lt,z as ut}from"./themePalette-MbAn2gqj.js";import{l as dt,t as ft}from"./diffRendering-MXukhqw1.js";import{c as pt,d as mt,f as ht,l as gt,m as _t,o as vt,p as yt,s as bt,t as xt,u as St}from"./htmlRender-C3rZ0xgC.js";import{a as Ct,n as wt,t as Tt}from"./tooltip-ChmjT8Ns.js";import{n as Et,o as Dt}from"./pierre-icons-D3vWvKqU.js";import{t as Ot}from"./toggle-B03MQDgB.js";import{i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft}from"./combobox-CKWbcPIR.js";import{t as It}from"./scroll-area-CQNIjQ8U.js";import{t as Lt}from"./assetUrls-BOJMUK_1.js";import{v as Rt}from"./keybindings-DAHl8jIl.js";import{o as zt,t as Bt}from"./PierreEntryIcon-wm-IkF2y.js";import{M as Vt,N as Ht,lt as Ut,ot as Wt}from"./RenderErrorBoundary-BI5KBtsb.js";import{n as Gt}from"./pullRequestIcons-DPbMXqGp.js";import{Gt as Kt,Kt as qt,Lt as Jt,Mt as Yt,Nt as Xt,Ut as Zt,Vt as Qt,Wt as $t,Xa as en,po as tn,zt as nn}from"./main-DleJeMZO.js";var j=e(t(),1),M=r(),N=e(i(),1),rn=e(ve(),1),an=s(),on=se();function sn(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 cn(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-CUL87R5C.js","assets/react-DH3P2YXY.js","assets/jsx-runtime-BnjsACtP.js","assets/useSettings-CHt2_4He.js","assets/utils-CBe1bHL7.js","assets/activity-BT9zGwI4.js","assets/createLucideIcon-BRvysHna.js","assets/Icon-BiSXef-P.js","assets/alarm-clock-DLm_0oDD.js","assets/app-window-CBNJqZPl.js","assets/archive-D_14z4Xm.js","assets/arrow-down-up-Tu6B2hri.js","assets/arrow-down-Bo_WAMYh.js","assets/arrow-left-Ba8eq_9S.js","assets/arrow-right-left-DyJucsB1.js","assets/arrow-right-Bg4mlTrk.js","assets/arrow-up-down-AigUcA_4.js","assets/arrow-up-left-C6F8l2kC.js","assets/arrow-up-right-BNXlwlzJ.js","assets/arrow-up-D4kutFpL.js","assets/battery-DdftvRcq.js","assets/bell-4pS2DvJU.js","assets/blocks-N48yRCu0.js","assets/book-open-m1zikk07.js","assets/bookmark-DCumPe18.js","assets/bot-C71zefL3.js","assets/box-N7KHNXgQ.js","assets/bug-_77C5nd4.js","assets/calendar-arrow-down-tK2df2Gr.js","assets/calendar-arrow-up-DoqzmS-b.js","assets/calendar-clock-D24iG-gJ.js","assets/calendar-CuDpKI2e.js","assets/camera-CRxcom4Z.js","assets/chart-no-axes-column-CWRXr09M.js","assets/check-Cs_SSACZ.js","assets/chevron-down-Do9qqNbR.js","assets/chevron-left-D56AngEd.js","assets/chevron-right-CcbZ6PxZ.js","assets/chevron-up-CZEzk9UW.js","assets/chevrons-left-right-ellipsis-BuDdURW0.js","assets/chevrons-up-down-CMYBD15h.js","assets/chromium-IRgsGkxl.js","assets/circle-alert-Rh3WFq8P.js","assets/circle-arrow-up-CBkBThPI.js","assets/circle-check-Davl0yih.js","assets/circle-dashed-Divqvc3s.js","assets/circle-dot-DDXvyPkX.js","assets/circle-slash-BHppGVB2.js","assets/circle-x-DCG47j33.js","assets/circle-BXaepj2J.js","assets/clock-3-BjqRuWmx.js","assets/clock-BZce7MqL.js","assets/cloud-download-Cw2Qyeof.js","assets/cloud-upload-Bbq2IGQX.js","assets/cloud-Cnpuf424.js","assets/code-xml-C7_RVxwx.js","assets/code-C8ZFD3fi.js","assets/columns-2-R7e6oP5f.js","assets/copy-C6t_ZU58.js","assets/corner-left-up-CIgtHeD1.js","assets/corner-up-right-BWhPHx5s.js","assets/cpu-4YV41FL_.js","assets/database-0EoDfSWv.js","assets/download-CfEwtjBn.js","assets/earth-B0lYBmT1.js","assets/ellipsis-vertical-BM1Lc1f1.js","assets/ellipsis-CSD7gEuG.js","assets/external-link-Df6uBnqH.js","assets/eye-off-D5GkPp8X.js","assets/eye-DlWBkL1d.js","assets/file-braces-DycW5IfR.js","assets/file-code-corner-Bph0gpk_.js","assets/file-diff-uE_kfwjO.js","assets/file-search-BxZuGCW_.js","assets/file-spreadsheet-BDzNPY8g.js","assets/file-text-Bn72KOhu.js","assets/file-DHjVYhLT.js","assets/files-DsO7Sg8V.js","assets/film-Bbn0ceXE.js","assets/flask-conical-Cg6idKdH.js","assets/folder-closed-D6kbWc3q.js","assets/folder-cog-CBSQaLA2.js","assets/folder-git-2-n1sLmp_t.js","assets/folder-git-DCVI-R4l.js","assets/folder-open-Bu-nFCGY.js","assets/folder-plus-wg03g0vP.js","assets/folder-tree-FUExeKOH.js","assets/folder-Cieksypr.js","assets/gauge-Cgf0xSWC.js","assets/git-branch-plus-GXmZfN57.js","assets/git-branch-BWQfoO37.js","assets/git-commit-horizontal-BI_Z5Kib.js","assets/git-fork-CK2oK4JM.js","assets/git-merge-CH86CpaI.js","assets/git-pull-request-arrow-BYmuTHnq.js","assets/git-pull-request-closed-EzDnMgeA.js","assets/git-pull-request-draft-DbMmZ9EC.js","assets/globe-DHq8q48U.js","assets/grip-vertical-sTbvrVma.js","assets/hammer-BnFrycrq.js","assets/hard-drive-CnhXqMSu.js","assets/hat-glasses-C1sL_lJD.js","assets/history-BOloOry4.js","assets/house-LvUaI36y.js","assets/image-DFl_i29V.js","assets/inbox-Bfua4pqw.js","assets/info-Bwtivk15.js","assets/keyboard-C94dd8zf.js","assets/laptop-BJfWDOqH.js","assets/layers-BczY2xKh.js","assets/lightbulb-AbDNyk1F.js","assets/link-2-J9n7Ukgt.js","assets/link-iM9yOrD5.js","assets/list-checks--PgwqWme.js","assets/list-filter-C7uwdO5w.js","assets/list-ordered-JmJCtT6d.js","assets/list-todo-BOZtqLIw.js","assets/list-BNel2JmV.js","assets/loader-circle-DOPuwGUy.js","assets/lock-open-qdfB-3sG.js","assets/lock-CNeMaiIX.js","assets/log-in-DuxSLs9h.js","assets/mail-DrFNo5rr.js","assets/maximize-2-C4jSdiqI.js","assets/maximize-BKkQJR3r.js","assets/memory-stick-yVhfpVno.js","assets/message-circle-question-mark-qR5q6Xbi.js","assets/message-circle-qu3riBnu.js","assets/message-square-dashed-BDjE-epL.js","assets/message-square-off-BF3vA0b4.js","assets/message-square-text-CfjrqiSr.js","assets/message-square-warning-6MHWBWO6.js","assets/message-square-B2NO3ViY.js","assets/messages-square-BDA1tcVi.js","assets/minimize-2-D1qaBNiP.js","assets/minus-DVH2v7vL.js","assets/monitor-DYdSXGUQ.js","assets/moon-z0kk2bkY.js","assets/mouse-pointer-2-BzC5PGDm.js","assets/mouse-pointer-click-_zj1O0gg.js","assets/octagon-alert-BQp6gUkE.js","assets/package-plus-DaYcLmCH.js","assets/package-BDRaz7Ff.js","assets/paintbrush-Cd3ye7YJ.js","assets/palette-DWDYvvRF.js","assets/panel-bottom-DX8HINCH.js","assets/panel-left-aKsqIRJO.js","assets/panel-right-XrDzcWDK.js","assets/paperclip-BAtVoM2Q.js","assets/panels-top-left-ug17nD5b.js","assets/pen-line-BtsHFcuV.js","assets/pencil-ruler-u4ck96IX.js","assets/pencil-CS36_8K6.js","assets/picture-in-picture-2-CTTZM7s_.js","assets/pilcrow-B0pICPe4.js","assets/pin-B28emPdt.js","assets/play-utur7gJ1.js","assets/plug-2-BbsYUlrD.js","assets/plus-BFikiw2m.js","assets/plug-Cz_1a3P7.js","assets/power-lnBvrj1p.js","assets/presentation-DuhP07nk.js","assets/puzzle-_xVT2Tkf.js","assets/qr-code-8OyojaA-.js","assets/quote-CY1r_9f2.js","assets/radio-tower-CQ9UBgC-.js","assets/redo-2-CMJUpQN9.js","assets/refresh-cw-Bb4DfPZ_.js","assets/rotate-ccw-DIk8O74I.js","assets/rotate-cw-BCqL9vBU.js","assets/route-DDK4p_jp.js","assets/rows-3-KtFgL-bn.js","assets/scale-BWqluNv-.js","assets/search-2NYXmfL3.js","assets/send-Usbx4MSt.js","assets/server-C5VT7--0.js","assets/settings-2-CG9Vl9Oj.js","assets/settings-CSrjOUO8.js","assets/shield-check-BhnliHga.js","assets/shield-question-mark-DJzZ_XtG.js","assets/shield-Bo3bXsl5.js","assets/sliders-horizontal-CbQdxecl.js","assets/smartphone-DLXjLUvY.js","assets/smile-plus-B6sk7n9M.js","assets/sparkles-D72pVUsJ.js","assets/square-arrow-out-up-right-D4Y8_c2a.js","assets/square-pen-B9IATJSK.js","assets/square-split-horizontal-BEBi5lgX.js","assets/square-split-vertical-BvRRvh2L.js","assets/square-terminal-MebNo2O3.js","assets/square-ChD_5l-9.js","assets/star-BFGG9hcF.js","assets/sun-CV31Z7e1.js","assets/tag-DAyj5h5G.js","assets/target-DRkzkaHT.js","assets/terminal-Dbk8nKIT.js","assets/text-align-start-BlQ02nAY.js","assets/text-search-CmNwvT1W.js","assets/text-wrap-Y7SHIazH.js","assets/ticket-B3TOD4z9.js","assets/trash-2-vrfXuXSc.js","assets/trending-down-0HJRpRPf.js","assets/trending-up-B0AABrFJ.js","assets/triangle-alert-DcIYyjDc.js","assets/type-CcxvYAFU.js","assets/undo-2-CbzuoKHe.js","assets/unlink-2-Cu9CVRNc.js","assets/unplug-D0qX6EAT.js","assets/upload-_7gAV2BZ.js","assets/user-check-vIX5oc4W.js","assets/user-lock-Bz0imDJs.js","assets/user-plus-6mh3DQc1.js","assets/user-round-x-Dyi0-TdA.js","assets/user-round-CdU_AaX_.js","assets/users-CfjzCdxE.js","assets/wifi-off-DzVPlURa.js","assets/workflow-DbsdAT4Y.js","assets/wrench-Bjp_8iLx.js","assets/x-CJgPyqpa.js","assets/zap-C_GfNMdZ.js","assets/runtime-CABaKt1A.js","assets/runtime-BBIAfWJY.js","assets/toast-D26NINYU.js","assets/TooltipViewport-DJXNIjFt.js","assets/spinner-BZh9P0sD.js","assets/useParams-C5D_t-0u.js","assets/server-mIR8e8Vz.js","assets/session-BlCBDyVn.js","assets/use-atom-command-C4y634Qy.js","assets/themePalette-MbAn2gqj.js","assets/diffRendering-UEl_19xa.js","assets/index-C0oEvzQc.js","assets/Virtualizer-3W_tqqHL.js","assets/getDiffFileInput-eTK8du_O.js","assets/main-Cywp3EWc.js","assets/vcsRefInvalidation-CytQodoP.js","assets/entities-pafv-XUM.js","assets/query-B3Zo1YOE.js","assets/number-field-qEfih146.js","assets/useRegisterFieldControl-DUs9w2Me.js","assets/FormContext-DcLeIpxJ.js","assets/CSPContext-DGVCKkcb.js","assets/select-Cbpdz6n3.js","assets/SelectScrollUpArrow-DeRXucOo.js","assets/link-C3TbL1do.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BU0ER5FO.js","assets/useNavigate-Cdrlv-yJ.js","assets/useLocation-Cwv1HZ3K.js","assets/rightPanelStore-Cv1U3yrU.js","assets/toastHelpers-DxXYm50b.js","assets/queries-BZGM6AjA.js","assets/session-logic-CwBN7BBv.js","assets/htmlRender-C3rZ0xgC.js","assets/mediaSource-BhEv5iyl.js","assets/fileLinks-pJLWwULO.js","assets/mediaReference-onv8z3Oz.js","assets/usageFormat-D5Mz5ugL.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-ChmjT8Ns.js","assets/skeleton-CFtayHTe.js","assets/useAriaLabelledBy-DjNn9irU.js","assets/toggle-B03MQDgB.js","assets/toggle-group-yF5GZ53o.js","assets/CompositeRoot-BFPe8O0M.js","assets/input-DXGWoa4O.js","assets/Input-DQflEYBs.js","assets/FieldControl-BOrs67_f.js","assets/scroll-area-CQNIjQ8U.js","assets/ScrollAreaCorner-DF4GCx0d.js","assets/dist-ATiHSdUa.js","assets/DialogTitle-DNp9zThp.js","assets/dialog-_vbB7RKH.js","assets/sidebar-BhJqncti.js","assets/useResizeDrag-Dc7crya0.js","assets/observeResize-DzSkewug.js","assets/AnimatedHeight-BZhIfVtA.js","assets/assets-B_r3wLhD.js","assets/sourceControl-CcPqr0UX.js","assets/assetUrls-DSeSTRY1.js","assets/browserHistoryStore-BG8TrOnZ.js","assets/preview-O1ZL8Awg.js","assets/openFileInPreview-DeuqxJFn.js","assets/keybindings-DAHl8jIl.js","assets/Icons-B1qw9fnR.js","assets/preview-BoTHkmVi.js","assets/PierreEntryIcon-BCv2OXDn.js","assets/pierre-icons-BDVVO9cA.js","assets/RenderErrorBoundary-CEX4aXRH.js","assets/sourceControlClients-DtjbXUDt.js","assets/browserLinkTarget-jRu1-WRM.js","assets/pullRequestIcons-DPbMXqGp.js","assets/pullRequests-C8-SkuQU.js","assets/threadSort-Bd2rijEy.js","assets/popover-CogH2zM4.js","assets/PopoverHandle-CqjlXffy.js","assets/ProjectFavicon-BzkwZEKX.js","assets/ProjectMonogram-Ba70a8_s.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-C_yH-05-.js","assets/checkbox-4yBjrqWQ.js","assets/CheckboxIndicator-DZ8vBLEv.js","assets/FieldItemContext-BsKb7ObC.js","assets/terminalSessions-0YYscaVr.js","assets/AlertDialogRoot-D5eL1YFA.js","assets/useHandleNewThread-C7ynA68A.js","assets/p4ProjectFile-BuzidL5M.js","assets/uiStateStore-CKKy2mq4.js","assets/guideRunStore-83fw4RPw.js","assets/pullRequestDetail.logic-FUlKz34F.js","assets/pullRequestReviewStore-BAxwf6rl.js","assets/sidebarProjectGrouping-DaMfJpqc.js","assets/EnvironmentMachineIcon-DBWK6C8T.js","assets/alert-DpVw79VA.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-DqJ-vZMe.js","assets/kbd-WWNLIkTn.js","assets/settingsLayout-vgYGia0Q.js","assets/WorkspacePageContainer-MDWEFwmu.js","assets/KeybindingsSettings.logic-BA5WG7V2.js","assets/usageShortcuts-mAekk3eG.js","assets/primaryCloudLinkState-BgmcA0C5.js","assets/command-D8XZec1r.js","assets/ComboboxClear-By718biy.js","assets/ComboboxGroupLabel-DjWIIS5_.js","assets/ConnectionStatusDot-wmgCjAfF.js","assets/standalone-page-3TM7ZX16.js","assets/primary-DiwDV4KJ.js","assets/onboarding-y217_KQL.js","assets/scheduledTasksSettings.logic-DFlgKyt2.js","assets/main-DjrB0l0D.css","assets/DiffWorkerPoolProvider-elvn0oLt.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-C0oEvzQc.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$ as a,Ad as o,Ai as s,Ct as c,Gu as l,J as u,Lc as d,Lm as f,Md as p,Nc as m,Oc as h,Op as g,Pc as _,Q as v,Tc as y,Uu as b,Wu as x,X as S,Y as C,__ as w,_t as T,bp as E,bt as ee,dr as te,eh as ne,hc as re,if as ie,it as D,jm as O,jt as ae,kd as oe,ki as se,m_ as ce,mt as le,ot as ue,pp as de,rh as fe,rt as pe,st as me,t as he,ts as ge,vt as _e,wa as ve,wc as k,wt as ye,y as be,yt as xe}from"./utils-CBe1bHL7.js";import{k as Se}from"./entities-pafv-XUM.js";import{l as Ce,o as we,s as Te}from"./runtime-BBIAfWJY.js";import{S as Ee,U as De,b as Oe,d as ke,l as Ae,w as A}from"./TooltipViewport-DJXNIjFt.js";import{A as je,C as Me,D as Ne,E as Pe,O as Fe,S as Ie,T as Le,a as Re,b as ze,j as Be,k as Ve,l as He,n as Ue,r as We,s as Ge,v as Ke,w as qe,y as Je}from"./ChatMarkdown-C94Vrzqf.js";import{t as Ye}from"./spinner-BZh9P0sD.js";import{t as Xe}from"./link-C3TbL1do.js";import{i as Ze,p as Qe}from"./toast-D26NINYU.js";import{G as $e,_ as et,q as tt,s as nt}from"./useSettings-CHt2_4He.js";import{f as rt,s as it}from"./server-mIR8e8Vz.js";import{P as at,R as ot,_ as st,g as ct,p as lt,z as ut}from"./themePalette-MbAn2gqj.js";import{l as dt,t as ft}from"./diffRendering-UEl_19xa.js";import{c as pt,d as mt,f as ht,l as gt,m as _t,o as vt,p as yt,s as bt,t as xt,u as St}from"./htmlRender-C3rZ0xgC.js";import{a as Ct,n as wt,t as Tt}from"./tooltip-ChmjT8Ns.js";import{n as Et,o as Dt}from"./pierre-icons-BDVVO9cA.js";import{t as Ot}from"./toggle-B03MQDgB.js";import{i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft}from"./combobox-CKWbcPIR.js";import{t as It}from"./scroll-area-CQNIjQ8U.js";import{t as Lt}from"./assetUrls-DSeSTRY1.js";import{v as Rt}from"./keybindings-DAHl8jIl.js";import{o as zt,t as Bt}from"./PierreEntryIcon-BCv2OXDn.js";import{M as Vt,N as Ht,lt as Ut,ot as Wt}from"./RenderErrorBoundary-CEX4aXRH.js";import{n as Gt}from"./pullRequestIcons-DPbMXqGp.js";import{Gt as Kt,Kt as qt,Lt as Jt,Mt as Yt,Nt as Xt,Ut as Zt,Vt as Qt,Wt as $t,Xa as en,po as tn,zt as nn}from"./main-Cywp3EWc.js";var j=e(t(),1),M=r(),N=e(i(),1),rn=e(ve(),1),an=s(),on=se();function sn(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 cn(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 ln(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=we+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 Te(s)}function un(e){let t=(0,M.c)(4),n;return t[0]!==e.name||t[1]!==e.onError||t[2]!==e.src?(n=(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,N.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 dn(e,t,n){let r=st(at(e,t,n));return r===null?lt(n):ct(r,n)??r.colors}function fn(){let e=(0,M.c)(11),{theme:t,resolvedTheme:n,themeHalves:r}=$e(),i;e[0]!==n||e[1]!==t||e[2]!==r?(i=()=>dn(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=()=>lt(n),e[4]=n,e[5]=a);let o=(0,j.useSyncExternalStore)(ot,i,a),s=nt(hn),c=nt(mn),l;return e[6]!==o||e[7]!==c||e[8]!==n||e[9]!==s?(l=pt(Object.fromEntries(Object.entries(o).map(pn)),n,{sans:en(s,xt.sans),mono:en(c,xt.mono)}),e[6]=o,e[7]=c,e[8]=n,e[9]=s,e[10]=l):l=e[10],l}function pn(e){let[t,n]=e;return[t,ut(n)??n]}function mn(e){return e.fontFamilyCode}function hn(e){return e.fontFamilySans}var gn=`#toolbar=0&view=FitH`,_n=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`,...w,...ce]),vn=e=>/\.pdf$/i.test(e.split(/[?#]/,1)[0]??``);function yn(e){let t=(0,M.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,N.jsx)(`iframe`,{src:`${e.src}${gn}`,title:e.title,className:`min-h-0 flex-1 border-0 bg-white`},e.src):e.htmlRender?(0,N.jsx)(xn,{src:e.src,title:e.title,threadRef:e.threadRef,className:`min-h-0 flex-1`},n):(0,N.jsx)(bn,{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 bn(e){let t=(0,M.c)(3),[n]=(0,j.useState)(e.src),r;return t[0]!==e.title||t[1]!==n?(r=(0,N.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 xn(e){let t=(0,M.c)(57),n=fn(),r=(0,j.useRef)(null),i;t[0]!==e.src||t[1]!==n?(i=()=>`${e.src.split(`#`,1)[0]}${gt(n)}`,t[0]=e.src,t[1]=n,t[2]=i):i=t[2];let[a]=(0,j.useState)(i),[o,s]=(0,j.useState)(!1),[c,l]=(0,j.useState)(null),u;t[3]===n?u=t[4]:(u=()=>{r.current?.contentWindow?.postMessage(St(n),`*`)},t[3]=n,t[4]=u);let f=u,p;t[5]===n?p=t[6]:(p=[n],t[5]=n,t[6]=p),(0,j.useEffect)(f,p);let h=ge(it),g=ge(rt.configValueAtom(e.threadRef?.environmentId??null))?.keybindings,v;if(t[7]!==g||t[8]!==h){let e=m(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=[...h,...g??[]].filter(En).map(e=>n(e.shortcut)),i=new Map;for(let{command:e,shortcut:t}of h)_n.has(e)&&(t.metaKey||t.ctrlKey||t.modKey)&&i.set(Rt(t),n(t));v={shortcuts:[...i.values()],blocked:r},t[7]=g,t[8]=h,t[9]=v}else v=t[9];let{shortcuts:y,blocked:b}=v,x;t[10]!==b||t[11]!==y?(x=()=>{r.current?.contentWindow?.postMessage(bt(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,j.useEffect)(S,C);let w;t[16]!==b||t[17]!==y?(w=e=>{let t=t=>_(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===d(e.key)))},t[16]=b,t[17]=y,t[18]=w):w=t[18];let T=(0,j.useEffectEvent)(w),E=Wt(e.threadRef),ee=Ut(e.threadRef),te;t[19]!==E||t[20]!==ee||t[21]!==e.threadRef?(te=(t,n)=>{if(n.metaKey||n.ctrlKey){tt()?.shell.openExternal(t).catch(Tn);return}e.threadRef!==void 0&&E({...n,preventDefault:wn,stopPropagation:Cn},t,void 0,e.threadRef.environmentId)||ee(t,{event:n}).catch(Sn)},t[19]=E,t[20]=ee,t[21]=e.threadRef,t[22]=te):te=t[22];let ne=(0,j.useEffectEvent)(te),re;t[23]===ne?re=t[24]:(re=()=>{let e=e=>{let t=r.current,n=_t(e.data);n!==void 0&&t!==null&&e.source===t.contentWindow&&document.activeElement===t&&navigator.userActivation?.isActive!==!1&&(ne(n.url,n),t.contentWindow?.postMessage(vt(n.id),`*`))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},t[23]=ne,t[24]=re);let ie;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ie=[],t[25]=ie):ie=t[25],(0,j.useEffect)(re,ie);let D;t[26]===T?D=t[27]:(D=()=>{let e=e=>{let t=r.current,n=yt(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]=D);let O;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[28]=O):O=t[28],(0,j.useEffect)(D,O);let ae,oe;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=e=>{let t=r.current,n=ht(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)},oe=[],t[29]=ae,t[30]=oe):(ae=t[29],oe=t[30]),(0,j.useEffect)(ae,oe);let{onFullscreenChange:se}=e,ce,le;t[31]!==c||t[32]!==se?(ce=()=>{if(c!==null)return se?.(!0),()=>se?.(!1)},le=[c,se],t[31]=c,t[32]=se,t[33]=ce,t[34]=le):(ce=t[33],le=t[34]),(0,j.useEffect)(ce,le);let{onContentHeight:ue}=e,de,fe;t[35]===ue?(de=t[36],fe=t[37]):(de=()=>{if(ue===void 0)return;let e=e=>{let t=mt(e.data);t!==void 0&&e.source===r.current?.contentWindow&&ue(t)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},fe=[ue],t[35]=ue,t[36]=de,t[37]=fe),(0,j.useLayoutEffect)(de,fe);let pe=e.title,me;t[38]!==S||t[39]!==f?(me=()=>{s(!0),f(),S()},t[38]=S,t[39]=f,t[40]=me):me=t[40];let _e;t[41]===e.className?_e=t[42]:(_e=he(`border-0 scheme-light`,e.className),t[41]=e.className,t[42]=_e);let ve;t[43]!==o||t[44]!==n?(ve=o?{colorScheme:n.appearance}:void 0,t[43]=o,t[44]=n,t[45]=ve):ve=t[45];let k;t[46]!==e.title||t[47]!==a||t[48]!==me||t[49]!==_e||t[50]!==ve?(k=(0,N.jsx)(`iframe`,{ref:r,src:a,title:pe,sandbox:`allow-scripts allow-forms`,loading:`lazy`,onLoad:me,className:_e,style:ve}),t[46]=e.title,t[47]=a,t[48]=me,t[49]=_e,t[50]=ve,t[51]=k):k=t[51];let ye;t[52]===c?ye=t[53]:(ye=c===null?null:(0,N.jsx)(He,{preview:c,onClose:()=>l(null)}),t[52]=c,t[53]=ye);let be;return t[54]!==k||t[55]!==ye?(be=(0,N.jsxs)(N.Fragment,{children:[k,ye]}),t[54]=k,t[55]=ye,t[56]=be):be=t[56],be}function Sn(e){return console.error(e)}function Cn(){}function wn(){}function Tn(e){return console.error(e)}function En(e){return!_n.has(e.command)}var Dn=`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`,On=`data-file-link-reveal`,kn=`
5
5
  ${ft}
@@ -45,7 +45,7 @@ import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-DA9og9YW.js
45
45
  ) !important;
46
46
  color: var(--diffs-selection-number-fg) !important;
47
47
  }
48
- `;function An(e){let t=(0,M.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,N.jsx)(Ct,{render:n===void 0?(0,N.jsx)(te,{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,N.jsx)(Ot,{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,N.jsx)(wt,{children:e.label}),t[6]=e.label,t[7]=i);let a;return t[8]!==r||t[9]!==i?(a=(0,N.jsxs)(Tt,{children:[r,i]}),t[8]=r,t[9]=i,t[10]=a):a=t[10],a}function jn(e){let t=(0,M.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,N.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 Mn(e){let t=(0,M.c)(5),n;t[0]===e.className?n=t[1]:(n=he(`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,N.jsx)(Ye,{size:`lg`}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,N.jsx)(`div`,{role:`status`,"aria-label":`Loading file`,className:n,children:r}),t[3]=n,t[4]=i),i}function Nn(e){let t=(0,M.c)(7),n;t[0]===e.message?n=t[1]:(n=(0,N.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,N.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,N.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 Pn(e){let t=(0,M.c)(29),n;t[0]!==e.delimiter||t[1]!==e.text?(n=cn(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,N.jsx)(jn,{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,N.jsx)(`thead`,{className:`sticky top-0 z-10`,children:(0,N.jsx)(`tr`,{children:n.map(Ln)})}):null,t[15]=n,t[16]=o),u=(0,N.jsx)(`tbody`,{children:d.map(Fn)}),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,N.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,N.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,N.jsxs)(`div`,{className:c,children:[l,f]}),t[25]=c,t[26]=l,t[27]=f,t[28]=p):p=t[28],p}function Fn(e,t){return(0,N.jsx)(`tr`,{className:`even:bg-muted/30`,children:e.map(In)},t)}function In(e,t){return(0,N.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 Ln(e,t){return(0,N.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 Rn=(0,j.lazy)(()=>n(()=>import(`./ReadOnlySourcePreview-DPJWK3HJ.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]))),zn=3e5;function Bn(e){let t=(0,M.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,N.jsx)(Mn,{className:`p-4`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,N.jsx)(j.Suspense,{fallback:n,children:(0,N.jsx)(Rn,{...e})}),t[1]=e,t[2]=r),r}function Vn(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 Hn(e){let t=Ce(e),n=sn(e),r=t===`markdown`?`markdown`:t===`html`?`html`:n?`table`:null,i=e.asset?.attachmentId,{copyToClipboard:a,isCopied:o}=Qe({target:e.name}),s=(0,j.useMemo)(()=>i?{_tag:`attachment`,attachmentId:i,fileName:e.name,mimeType:e.mimeType,disposition:`inline`}:null,[i,e.name,e.mimeType]),c=Lt(e.file?null:e.asset?.environmentId??null,e.file?null:s),l=(0,j.useMemo)(()=>s?{...s,disposition:`attachment`}:null,[s]),u=Lt(e.asset?.environmentId??null,l),[d,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null),[_,v]=(0,j.useState)(null),[y,b]=(0,j.useState)(!0),[x,S]=(0,j.useState)(0),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)(null),[ee,te]=(0,j.useState)(null),re=(0,j.useRef)(0);(0,j.useEffect)(()=>{if(!e.file)return;let t=URL.createObjectURL(e.file);return g(t),()=>URL.revokeObjectURL(t)},[e.file]),(0,j.useEffect)(()=>{if(e.file)return;let t=!1;return v(null),E(null),c().then(e=>{if(!t){if(!e)throw Error(`Reconnect to the environment and try again.`);re.current=Date.now(),v(e)}}).catch(e=>{t||E(e instanceof Error?e.message:`The attachment is unavailable.`)}),()=>{t=!0}},[e.file,c,x]);let D=e.file?h:_,O=t===`text`||t===`markdown`||t===`html`&&!y;(0,j.useEffect)(()=>{if(!O||!D)return;let t=new AbortController;w(null),te(null);let n=e.file;return(async()=>{if(!n&&Date.now()-re.current>zn){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!==D){v(e);return}}let r=await ln(n?{ok:!0,body:n.stream()}:await fetch(D,{signal:t.signal,...e.sizeBytes>0?{headers:{Range:`bytes=0-${we}`}}:{},cache:x===0?`default`:`reload`}),t.signal);t.signal.aborted||w(r)})().catch(e=>{t.signal.aborted||te(e instanceof Error?e.message:`Could not load this file.`)}),()=>t.abort()},[D,O,x,e.sizeBytes,e.file,c]);let ae=T??(O?ee:null),oe=nt(e=>e.wordWrap),se=et(),ce=ae===null&&O&&C!==null&&!(n&&y)&&!(t===`markdown`&&y),le=()=>{m(!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){Ze.add({type:`error`,title:`Could not save file`,description:e instanceof Error?e.message:`Please try again.`})}finally{m(!1)}})()},ue=ae?(0,N.jsx)(Nn,{message:ae,onRetry:()=>{E(null),S(e=>e+1)}}):!D||O&&!C?(0,N.jsx)(Mn,{}):O&&C?n&&y?(0,N.jsx)(Pn,{name:e.name,text:C.text,delimiter:n}):t===`markdown`&&y?(0,N.jsx)(It,{className:`min-h-0 flex-1`,children:(0,N.jsx)(Ue,{text:C.text,cwd:void 0,className:`mx-auto max-w-4xl px-6 py-5`})}):(0,N.jsx)(Bn,{name:e.name,text:C.text}):t===`pdf`||t===`html`?(0,N.jsx)(yn,{src:D,title:e.name,pdf:t===`pdf`,htmlRender:e.htmlRender===!0,threadRef:e.threadRef}):t===`audio`?(0,N.jsx)(un,{src:D,name:e.name,onError:()=>E(`Unable to load audio.`)}):t===`video`?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black`,children:(0,N.jsx)(`video`,{controls:!0,playsInline:!0,src:D,"aria-label":e.name,className:`max-h-full max-w-full`,onError:()=>E(`Unable to load video.`)})}):t===`image`?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,N.jsx)(`img`,{src:D,alt:e.name,className:`max-h-full max-w-full object-contain`,onError:()=>E(`Unable to load image.`)})}):(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-1 px-6 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium`,children:`No preview for this file`}),(0,N.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,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,N.jsxs)(`div`,{className:he(Dn),"data-surface-subheader":!0,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center text-xs`,children:[(0,N.jsx)(`span`,{className:`shrink-0 px-0.5 text-muted-foreground`,children:e.origin??`Attachment`}),(0,N.jsx)(p,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}),(0,N.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate px-0.5 font-medium text-foreground`,children:e.name}),e.sizeBytes>0?(0,N.jsx)(`span`,{className:`ml-2 shrink-0 text-muted-foreground`,children:zt(e.sizeBytes)}):null]}),r?(0,N.jsx)(An,{label:Vn(r,y),pressed:y,onPress:()=>b(e=>!e),children:(0,N.jsx)(Ae,{className:`size-3.5`,icon:y?Oe:r===`table`?De:A})}):null,ce?(0,N.jsx)(An,{label:oe?`Disable word wrap`:`Enable word wrap`,pressed:oe,onPress:()=>se({wordWrap:!oe}),children:(0,N.jsx)(ne,{className:`size-3.5`})}):null,C?(0,N.jsx)(An,{label:o?`Copied`:C.truncated?`Copy preview`:`Copy contents`,onPress:()=>a(C.text,void 0),children:(0,N.jsx)(Ae,{className:`size-3.5`,icon:o?ke:Ee})}):null,D?(0,N.jsx)(An,{label:d?`Preparing file…`:`Save file`,disabled:d,onPress:le,children:(0,N.jsx)(ie,{className:`size-3.5`})}):null,e.onRemove?(0,N.jsx)(An,{label:`Remove from draft`,onPress:e.onRemove,children:(0,N.jsx)(f,{className:`size-3.5`})}):null,e.onClose?(0,N.jsx)(An,{label:`Close`,onPress:e.onClose,children:(0,N.jsx)(fe,{className:`size-3.5`})}):null]}),C?.truncated?(0,N.jsxs)(jn,{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,ue]})}function Un(e){let t=e.getData(`text/plain`),n=xe(e.getData(`web application/x-p4-context-fragment+json`))??_e(e.getData(`text/html`));if(n===null)return null;let r=new Set(k(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 Wn(e,t){let n=e.getData(`text/plain`),r=t?Un(e):null,i=r&&r.records.length>0?t(r):null;return i&&i.size>0?h(n,e=>{let t=i.get(e.contextId);return t?y({...e,contextId:l.make(t),kind:e.kind===`element`?`preview-annotation`:e.kind}):e.source}):n}var Gn=`Ask for changes, send follow-ups, or attach images`;function Kn(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 qn(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 Jn(e){return e.kind===`ordered`?`${e.indent}${qn(`${e.numberText}${e.delimiter}`)} `:e.kind===`task`?`${e.indent}- [ ] `:`${e.indent}${e.bullet} `}function Yn(e){return e.type===`text`?e.text:e.source}function Xn(e,t){let n=0;for(let r of Kt(e)){let e=n+Yn(r).length;if(r.type!==`text`&&t>n&&t<e)return!0;n=e}return!1}function Zn(e,t){let n=e.lastIndexOf(`
48
+ `;function An(e){let t=(0,M.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,N.jsx)(Ct,{render:n===void 0?(0,N.jsx)(te,{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,N.jsx)(Ot,{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,N.jsx)(wt,{children:e.label}),t[6]=e.label,t[7]=i);let a;return t[8]!==r||t[9]!==i?(a=(0,N.jsxs)(Tt,{children:[r,i]}),t[8]=r,t[9]=i,t[10]=a):a=t[10],a}function jn(e){let t=(0,M.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,N.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 Mn(e){let t=(0,M.c)(5),n;t[0]===e.className?n=t[1]:(n=he(`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,N.jsx)(Ye,{size:`lg`}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,N.jsx)(`div`,{role:`status`,"aria-label":`Loading file`,className:n,children:r}),t[3]=n,t[4]=i),i}function Nn(e){let t=(0,M.c)(7),n;t[0]===e.message?n=t[1]:(n=(0,N.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,N.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,N.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 Pn(e){let t=(0,M.c)(29),n;t[0]!==e.delimiter||t[1]!==e.text?(n=cn(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,N.jsx)(jn,{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,N.jsx)(`thead`,{className:`sticky top-0 z-10`,children:(0,N.jsx)(`tr`,{children:n.map(Ln)})}):null,t[15]=n,t[16]=o),u=(0,N.jsx)(`tbody`,{children:d.map(Fn)}),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,N.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,N.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,N.jsxs)(`div`,{className:c,children:[l,f]}),t[25]=c,t[26]=l,t[27]=f,t[28]=p):p=t[28],p}function Fn(e,t){return(0,N.jsx)(`tr`,{className:`even:bg-muted/30`,children:e.map(In)},t)}function In(e,t){return(0,N.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 Ln(e,t){return(0,N.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 Rn=(0,j.lazy)(()=>n(()=>import(`./ReadOnlySourcePreview-CUL87R5C.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]))),zn=3e5;function Bn(e){let t=(0,M.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,N.jsx)(Mn,{className:`p-4`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,N.jsx)(j.Suspense,{fallback:n,children:(0,N.jsx)(Rn,{...e})}),t[1]=e,t[2]=r),r}function Vn(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 Hn(e){let t=Ce(e),n=sn(e),r=t===`markdown`?`markdown`:t===`html`?`html`:n?`table`:null,i=e.asset?.attachmentId,{copyToClipboard:a,isCopied:o}=Qe({target:e.name}),s=(0,j.useMemo)(()=>i?{_tag:`attachment`,attachmentId:i,fileName:e.name,mimeType:e.mimeType,disposition:`inline`}:null,[i,e.name,e.mimeType]),c=Lt(e.file?null:e.asset?.environmentId??null,e.file?null:s),l=(0,j.useMemo)(()=>s?{...s,disposition:`attachment`}:null,[s]),u=Lt(e.asset?.environmentId??null,l),[d,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null),[_,v]=(0,j.useState)(null),[y,b]=(0,j.useState)(!0),[x,S]=(0,j.useState)(0),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)(null),[ee,te]=(0,j.useState)(null),re=(0,j.useRef)(0);(0,j.useEffect)(()=>{if(!e.file)return;let t=URL.createObjectURL(e.file);return g(t),()=>URL.revokeObjectURL(t)},[e.file]),(0,j.useEffect)(()=>{if(e.file)return;let t=!1;return v(null),E(null),c().then(e=>{if(!t){if(!e)throw Error(`Reconnect to the environment and try again.`);re.current=Date.now(),v(e)}}).catch(e=>{t||E(e instanceof Error?e.message:`The attachment is unavailable.`)}),()=>{t=!0}},[e.file,c,x]);let D=e.file?h:_,O=t===`text`||t===`markdown`||t===`html`&&!y;(0,j.useEffect)(()=>{if(!O||!D)return;let t=new AbortController;w(null),te(null);let n=e.file;return(async()=>{if(!n&&Date.now()-re.current>zn){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!==D){v(e);return}}let r=await ln(n?{ok:!0,body:n.stream()}:await fetch(D,{signal:t.signal,...e.sizeBytes>0?{headers:{Range:`bytes=0-${we}`}}:{},cache:x===0?`default`:`reload`}),t.signal);t.signal.aborted||w(r)})().catch(e=>{t.signal.aborted||te(e instanceof Error?e.message:`Could not load this file.`)}),()=>t.abort()},[D,O,x,e.sizeBytes,e.file,c]);let ae=T??(O?ee:null),oe=nt(e=>e.wordWrap),se=et(),ce=ae===null&&O&&C!==null&&!(n&&y)&&!(t===`markdown`&&y),le=()=>{m(!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){Ze.add({type:`error`,title:`Could not save file`,description:e instanceof Error?e.message:`Please try again.`})}finally{m(!1)}})()},ue=ae?(0,N.jsx)(Nn,{message:ae,onRetry:()=>{E(null),S(e=>e+1)}}):!D||O&&!C?(0,N.jsx)(Mn,{}):O&&C?n&&y?(0,N.jsx)(Pn,{name:e.name,text:C.text,delimiter:n}):t===`markdown`&&y?(0,N.jsx)(It,{className:`min-h-0 flex-1`,children:(0,N.jsx)(Ue,{text:C.text,cwd:void 0,className:`mx-auto max-w-4xl px-6 py-5`})}):(0,N.jsx)(Bn,{name:e.name,text:C.text}):t===`pdf`||t===`html`?(0,N.jsx)(yn,{src:D,title:e.name,pdf:t===`pdf`,htmlRender:e.htmlRender===!0,threadRef:e.threadRef}):t===`audio`?(0,N.jsx)(un,{src:D,name:e.name,onError:()=>E(`Unable to load audio.`)}):t===`video`?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center bg-black`,children:(0,N.jsx)(`video`,{controls:!0,playsInline:!0,src:D,"aria-label":e.name,className:`max-h-full max-w-full`,onError:()=>E(`Unable to load video.`)})}):t===`image`?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,N.jsx)(`img`,{src:D,alt:e.name,className:`max-h-full max-w-full object-contain`,onError:()=>E(`Unable to load image.`)})}):(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-1 px-6 text-center`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium`,children:`No preview for this file`}),(0,N.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,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,N.jsxs)(`div`,{className:he(Dn),"data-surface-subheader":!0,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center text-xs`,children:[(0,N.jsx)(`span`,{className:`shrink-0 px-0.5 text-muted-foreground`,children:e.origin??`Attachment`}),(0,N.jsx)(p,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}),(0,N.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate px-0.5 font-medium text-foreground`,children:e.name}),e.sizeBytes>0?(0,N.jsx)(`span`,{className:`ml-2 shrink-0 text-muted-foreground`,children:zt(e.sizeBytes)}):null]}),r?(0,N.jsx)(An,{label:Vn(r,y),pressed:y,onPress:()=>b(e=>!e),children:(0,N.jsx)(Ae,{className:`size-3.5`,icon:y?Oe:r===`table`?De:A})}):null,ce?(0,N.jsx)(An,{label:oe?`Disable word wrap`:`Enable word wrap`,pressed:oe,onPress:()=>se({wordWrap:!oe}),children:(0,N.jsx)(ne,{className:`size-3.5`})}):null,C?(0,N.jsx)(An,{label:o?`Copied`:C.truncated?`Copy preview`:`Copy contents`,onPress:()=>a(C.text,void 0),children:(0,N.jsx)(Ae,{className:`size-3.5`,icon:o?ke:Ee})}):null,D?(0,N.jsx)(An,{label:d?`Preparing file…`:`Save file`,disabled:d,onPress:le,children:(0,N.jsx)(ie,{className:`size-3.5`})}):null,e.onRemove?(0,N.jsx)(An,{label:`Remove from draft`,onPress:e.onRemove,children:(0,N.jsx)(f,{className:`size-3.5`})}):null,e.onClose?(0,N.jsx)(An,{label:`Close`,onPress:e.onClose,children:(0,N.jsx)(fe,{className:`size-3.5`})}):null]}),C?.truncated?(0,N.jsxs)(jn,{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,ue]})}function Un(e){let t=e.getData(`text/plain`),n=xe(e.getData(`web application/x-p4-context-fragment+json`))??_e(e.getData(`text/html`));if(n===null)return null;let r=new Set(k(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 Wn(e,t){let n=e.getData(`text/plain`),r=t?Un(e):null,i=r&&r.records.length>0?t(r):null;return i&&i.size>0?h(n,e=>{let t=i.get(e.contextId);return t?y({...e,contextId:l.make(t),kind:e.kind===`element`?`preview-annotation`:e.kind}):e.source}):n}var Gn=`Ask for changes, send follow-ups, or attach images`;function Kn(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 qn(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 Jn(e){return e.kind===`ordered`?`${e.indent}${qn(`${e.numberText}${e.delimiter}`)} `:e.kind===`task`?`${e.indent}- [ ] `:`${e.indent}${e.bullet} `}function Yn(e){return e.type===`text`?e.text:e.source}function Xn(e,t){let n=0;for(let r of Kt(e)){let e=n+Yn(r).length;if(r.type!==`text`&&t>n&&t<e)return!0;n=e}return!1}function Zn(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 Qn(e,t){if(!Number.isInteger(t)||t<0||t>e.length)return null;let n=Zn(e,t),r=Kn(n.text);if(!r||r.marker.space===``)return null;let i=n.start+r.markerEnd;return t<i||Xn(e,t)?null:e.slice(i,n.end).trim()===``?{start:n.start,end:Math.max(t,i),replacement:``}:{start:t,end:t,replacement:`\n${Jn(r.marker)}`}}function $n(e,t,n){if(!Number.isInteger(t)||t!==n||t<0||t>e.length)return null;let r=Zn(e,t);return!Kn(r.text)||Xn(e,t)?null:{start:r.start,end:r.start,replacement:` `}}function er(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 tr(e){return`${Math.floor(Math.max(0,Math.min(1,Number.isFinite(e)?e:0))*100)}%`}var nr=Object.defineProperty,rr=(e,t)=>{let n={};for(var r in e)nr(n,r,{get:e[r],enumerable:!0});return t||nr(n,Symbol.toStringTag,{value:`Module`}),n};function ir(e){this.content=e}ir.prototype={constructor:ir,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 ir(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 ir(n)},addToStart:function(e,t){return new ir([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ir(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 ir(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=ir.from(e),e.size?new ir(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ir.from(e),e.size?new ir(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ir.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}},ir.from=function(e){if(e instanceof ir)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ir(t)};function ar(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;continue}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&&cr(e.charCodeAt(r-1))&&sr(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ar(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function or(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;continue}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&&cr(e.charCodeAt(i-1))&&sr(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=or(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function sr(e){return e>=56320&&e<57344}function cr(e){return e>=55296&&e<56320}var P=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 ar(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return or(this,e,t,n)}findIndex(e){if(e==0)return ur(0,e);if(e==this.size)return ur(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?ur(t+1,i):ur(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)`:``))}};P.empty=new P([],0);var lr={index:0,offset:0};function ur(e,t){return lr.index=e,lr.offset=t,lr}function dr(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(!dr(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!dr(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var F=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&&dr(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}};F.none=[];var fr=class extends Error{},I=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=mr(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(pr(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(P.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)}};I.empty=new I(P.empty,0,0);function pr(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(pr(a.content,t-i-1,n-i-1)))}function mr(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=mr(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 hr(e,t,n){if(n.openStart>e.depth)throw new fr(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fr(`Inconsistent open depths`);return gr(e,t,n,0)}function gr(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=gr(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return xr(a,Cr(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xr(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=wr(n,e);return xr(a,Sr(e,i,o,t,r))}}function _r(e,t){if(!t.type.compatibleContent(e.type))throw new fr(`Cannot join `+t.type.name+` onto `+e.type.name)}function vr(e,t,n){let r=e.node(n);return _r(r,t.node(n)),r}function yr(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 br(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&&(yr(e.nodeAfter,r),a++));for(let e=a;e<o;e++)yr(i.child(e),r);t&&t.depth==n&&t.textOffset&&yr(t.nodeBefore,r)}function xr(e,t){if(!e.type.validContent(t))throw new fr(`Invalid content for node `+e.type.name);return e.copy(t)}function Sr(e,t,n,r,i){let a=e.depth>i&&vr(e,t,i+1),o=r.depth>i&&vr(n,r,i+1),s=[];return br(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_r(a,o),yr(xr(a,Sr(e,t,n,r,i+1)),s)):(a&&yr(xr(a,Cr(e,t,i+1)),s),br(t,n,i,s),o&&yr(xr(o,Cr(n,r,i+1)),s)),br(r,null,i,s),new P(s)}function Cr(e,t,n){let r=[];return br(null,e,n,r),e.depth>n&&yr(xr(vr(e,t,n+1),Cr(e,t,n+1)),r),br(t,null,n,r),new P(r)}function wr(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(P.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Tr=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 F.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 kr(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=Or.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 Or.set(t,r=new Er);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Dr,i}},Er=class{constructor(){this.elts=[],this.i=0}},Dr=12,Or=new WeakMap,kr=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)}},Ar=Object.create(null),jr=class e{constructor(e,t,n,r=F.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||P.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&&dr(this.attrs,t||e.defaultAttrs||Ar)&&F.sameSet(this.marks,n||F.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 I.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new I(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return hr(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 Tr.resolveCached(this,e)}resolveNoCache(e){return Tr.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()+`)`),Nr(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=P.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=F.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(!F.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=P.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};jr.prototype.text=void 0;var Mr=class e extends jr{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):Nr(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 Nr(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pr=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fr(t,n);if(r.next==null)return e.empty;let i=Ir(r);r.next&&r.err(`Unexpected trailing text`);let a=Kr(Ur(i));return qr(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 P.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
  `)}};Pr.empty=new Pr(!0);var Fr=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 Ir(e){let t=[];do t.push(Lr(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Lr(e){let t=[];do t.push(Rr(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Rr(e){let t=Hr(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=Br(e,t);else break;return t}function zr(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Br(e,t){let n=zr(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:zr(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Vr(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 Hr(e){if(e.eat(`(`)){let t=Ir(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Vr(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 Ur(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 Wr(e,t){return t-e}function Gr(e,t){let n=[];return r(t),n.sort(Wr);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 Kr(e){let t=Object.create(null);return n(Gr(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]);Gr(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Pr(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Wr);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function qr(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 Jr(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 Yr(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 Xr(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 Zr(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new ei(e,r,t[r]);return n}var Qr=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=Zr(e,n.attrs),this.defaultAttrs=Jr(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==Pr.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:Yr(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new jr(this,this.computeAttrs(e),P.from(t),F.setFrom(n))}createChecked(e=null,t,n){return t=P.from(t),this.checkContent(t),new jr(this,this.computeAttrs(e),t,F.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=P.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(P.empty,!0);return i?new jr(this,e,t.append(i),F.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){Xr(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:F.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 $r(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 ei=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?$r(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ti=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Zr(e,r.attrs),this.excluded=null;let i=Jr(this.attrs);this.instance=i?new F(this,i):null}create(e=null){return!e&&this.instance?this.instance:new F(this,Yr(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){Xr(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},ni=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=ir.from(e.nodes),t.marks=ir.from(e.marks||{}),this.nodes=Qr.compile(this.spec.nodes,this),this.marks=ti.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]=Pr.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?ri(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==``?[]:ri(this,n.split(` `))}this.nodeFromJSON=e=>jr.fromJSON(this,e),this.markFromJSON=e=>F.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 Qr))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 Mr(n,n.defaultAttrs,e,F.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 ri(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 ii(e){return e.tag!=null}function ai(e){return e.style!=null}var oi=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ii(e))this.tags.push(e);else if(ai(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 hi(this,t,!1);return n.addAll(e,F.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new hi(this,t,!0);return n.addAll(e,F.none,t.from,t.to),I.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(_i(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=vi(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=vi(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)))}},si={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},ci={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},li={ol:!0,ul:!0},ui=1,di=2,fi=4;function pi(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?ui:0)|(t===`full`?di:0)}var mi=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=F.none,this.match=i||(a&fi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(P.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&ui)){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=P.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(P.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&&!si.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},hi=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=pi(null,t.preserveWhitespace,0)|(n?fi:0);i=r?new mi(r.type,r.attrs,F.none,!0,t.topMatch||r.type.contentMatch,a):n?new mi(null,null,F.none,!0,null,a):new mi(e.schema.topNodeType,null,F.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&di?`full`:this.localPreserveWS||(r.options&ui)>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(Fu.inline(o+t.from,o+t.to,{style:`color:${t.color}`}))}return H.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,j.createContext)({openComment:null,onOpenChange:()=>{},onDraftChange:()=>{},onSubmitAndSend:()=>{}}),gT=(0,j.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=J.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,M.c)(25),{node:n}=e,r=(0,j.use)(Mw),i=n.attrs.path??``,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,N.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=Et(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,N.jsx)(Re,{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,N.jsx)(je,{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,N.jsx)(Ct,{render:m}),t[16]=m,t[17]=h);let g;t[18]!==r.cwd||t[19]!==r.environmentId||t[20]!==i?(g=(0,N.jsx)(wt,{side:`top`,children:(0,N.jsx)(Ge,{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,N.jsx)(a_,{as:`span`,className:yT,children:(0,N.jsxs)(Tt,{children:[h,g]})}),t[22]=h,t[23]=g,t[24]=_):_=t[24],_}var ST=J.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,M.c)(21),{node:n}=e,r=(0,j.use)(Mw),i=(0,j.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,N.jsx)(Ke,{}),t[5]=u):u=t[5];let d=`Skill ${o}`,f;t[6]===o?f=t[7]:(f=(0,N.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,N.jsx)(`p`,{children:p}),t[8]=p,t[9]=m);let h;t[10]!==r||t[11]!==l?(h=l?.path?(0,N.jsx)(te,{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,N.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,N.jsx)(a_,{as:`span`,className:yT,children:(0,N.jsx)(Me,{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=J.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,M.c)(47),{node:n,editor:r,getPos:i}=e,a=(0,j.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=Ht(i,e),o=r.state.tr.setNodeMarkup(t,void 0,{...n.attrs,citation:a,source:Vt(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,N.jsx)(ze,{citation:o,composer:!0,commentEditor:T}),t[41]=o,t[42]=T,t[43]=E):E=t[43];let ee;return t[44]!==E||t[45]!==v?(ee=(0,N.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]=ee):ee=t[46],ee}var ET=J.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,M.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,N.jsx)(a_,{as:`span`,className:yT,children:(0,N.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 sh({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 sh({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=zh({find:/^- \[([ xX])\] $/,type:e,getAttributes:e=>({checked:e[1]?.toLowerCase()===`x`})});return new sh({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 sh({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 sh({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 sh({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 V(`composer-rich-markers`),RT=new B({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(Fu.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(Fu.widget(t,s,{side:e,key:`marker-${t}-${e}-${s.textContent}`}))}return H.create(t,i)}var BT=q.create({name:`composer-rich-markers`,addProseMirrorPlugins(){return[RT]}});function VT(e){let t=(0,M.c)(3),n=e.literalText?`literal`:e.richTextEnabled?`rich`:`plain`,r;return t[0]!==e||t[1]!==n?(r=(0,N.jsx)(UT,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}var HT=q.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:d,suggestionListId:f,activeSuggestionId:p,isPathQueryActive:h,containerClassName:g,className:_,placeholderClassName:v,onChange:y,onVisibleSelectionChange:x,onCommandKeyDown:S,onPageScrollKeyDown:C,onPageScrollKeyUp:w,onPageScrollRelease:T,onCitationSubmitAndSend:E,onCitationDraftSave:te,onPaste:ne,editorRef:ie}=e,D=!i&&(r??!1),O=(0,j.useCallback)((e,t)=>i?Math.max(0,Math.min(e.length,Number.isFinite(t)?Math.floor(t):e.length)):Yt(e,t),[i]),ae=(0,j.useCallback)((e,t)=>i?t:Jt(e,t),[i]),oe=(0,j.useRef)(y),se=(0,j.useRef)(x),ce=(0,j.useRef)(S),le=(0,j.useRef)(h),ue=(0,j.useRef)(o),de=(0,j.useRef)(s),fe=(0,j.useRef)(c),pe=(0,j.useRef)(t),me=(0,j.useRef)(null);(0,j.useEffect)(()=>{oe.current=y},[y]),(0,j.useEffect)(()=>{se.current=x},[x]),(0,j.useEffect)(()=>{ce.current=S},[S]),(0,j.useEffect)(()=>{le.current=h},[h]),(0,j.useEffect)(()=>{ue.current=o},[o]),(0,j.useEffect)(()=>{de.current=s},[s]),(0,j.useEffect)(()=>{fe.current=c},[c]),(0,j.useLayoutEffect)(()=>{pe.current=t},[t]);let ge=(0,j.useCallback)(e=>{let t=e.startsWith(`$`)?e.slice(1):e,n=fe.current.find(e=>e.name===t);if(!n)return{label:Je({name:t}),description:null};let r=n.shortDescription?.trim();return{label:Je(n),description:r||n.description?.trim()||null}},[]),_e=O(t,n),ve=ae(t,_e),k=(0,j.useRef)({value:t,cursor:_e,expandedCursor:ve,contextIds:i?[]:re(t)}),ye=(0,j.useRef)({start:ve,end:ve}),be=(0,j.useRef)(!1),xe=(0,j.useRef)(!1),Se=(0,j.useRef)(null),[Ce,we]=(0,j.useState)(null),Te=(0,j.useRef)(null),[Ee,De]=(0,j.useState)(t.length===0),Oe=(0,j.useMemo)(()=>({openComment:Ce,onOpenChange:(e,t)=>{!t&&Te.current?.key===e&&(Te.current=null),we(n=>t?n?.key===e?n:{key:e}:n?.key===e?null:n)},onDraftChange:(e,t)=>{Te.current={key:e,comment:t}},onSubmitAndSend:E??(()=>{})}),[E,Ce]),ke=(0,j.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=O(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=ye.current;ye.current=d,De(c.length===0);let p=k.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(be.current)return;if(!m){mT(f,d)&&se.current?.();return}if(p.value===c&&c!==pe.current)return;k.current={value:c,cursor:l,expandedCursor:u,contextIds:n};let h=e.state.selection.$from.parent.type.spec.code===!0,g=i||h||nn(c,l,`left`)||nn(c,l,`right`);oe.current(c,l,u,g,n)},[O,i]),Ae=(0,j.useMemo)(()=>({class:he(`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`,_),"data-testid":`composer-editor`,"data-composer-rich-text":D?`true`:`false`,role:`textbox`,"aria-multiline":`true`,...d?{"aria-label":d}:{},...l?{"aria-readonly":`true`}:{},...!l&&f?{"aria-autocomplete":`list`,"aria-haspopup":`listbox`,...p?{"aria-controls":f,"aria-activedescendant":p}:{}}:{},"aria-placeholder":u}),[p,d,_,l,u,D,f]),A=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},...D?{}:{bold:!1,italic:!1,strike:!1}}),HT,bT,ST,wT,ET,BT,...D?[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:()=>dt(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:Je({name:t}),description:null};let r=n.shortDescription?.trim();return{label:Je(n),description:r||n.description?.trim()||null}},{styling:D,literalText:i}),editable:!l,editorProps:{attributes:Ae,handleKeyDown:(e,t)=>{if(m(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(R.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?R.atStart(e.state.doc).from:R.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(R.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`&&D&&!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)||Eo(e.state,n)}if(sw(e.state,t=>e.dispatch(t)))return t.preventDefault(),t.stopPropagation(),!0}let n=ce.current;if(t.key===`Enter`){let r=me.current,i=D&&(r?.isActive(`taskItem`)??!1),a=D&&(r?.isActive(`listItem`)??!1);return n?.(`Enter`,t,i||a)??!1?(t.preventDefault(),t.stopPropagation(),!0):(t.preventDefault(),(i||a)&&r&&jC(r)||D&&r&&MT(e.state.selection.$from,`blockquote`)&&e.state.selection.$from.parent.content.size===0&&r.commands.lift(`blockquote`)?!0:No(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($t(s.value,c,l))return!1;let u=e.state.tr.insertText(a,n).insertText(r,t);return u.setSelection(R.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=de.current,o=!i&&a?Wn(n,a):r,s=i?[]:Zt(`${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:Qt(u,o,le.current?.()),f=me.current;if(f){let t=e.state.selection.$from,n=[`listItem`,`taskItem`,`blockquote`].some(e=>MT(t,e));WT(o,ge,{styling:D,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 z)||!t.node.isBlock||(e.doc.resolve(t.to).nodeAfter?.isTextblock||e.insert(t.to,e.doc.type.schema.nodes.paragraph.create()),e.setSelection(R.create(e.doc,t.to+1)),!0)}).run()}),GT(f)}return!0}},onUpdate:({editor:e})=>{ke(e)},onSelectionUpdate:({editor:e})=>{ke(e)}},[]);(0,j.useEffect)(()=>{A?.setEditable(!l)},[l,A]),(0,j.useEffect)(()=>{me.current=A},[A]),(0,j.useLayoutEffect)(()=>{A?.isInitialized&&A.view.setProps({attributes:Ae})},[A,Ae]);let je=(0,j.useCallback)(()=>{let e=k.current;if(!A)return e;let t=VC(A.state.doc),{from:n,to:r}=A.state.selection,a=JC(t,n),o={value:t.value,cursor:O(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 ye.current={start:Math.min(o.expandedCursor,GC(t,s)),end:Math.max(o.expandedCursor,GC(t,s))},k.current=o,o},[O,A,i]),Me=(0,j.useEffectEvent)((e,t)=>{let n=Te.current;if(Te.current=null,!n||!te)return;let[r]=ip(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=Ie({reason:`none`,draft:n.comment,savedComment:o.comment});if(s.kind!==`commit`)return;let c=Ht(o,s.comment);e.view.dispatch(e.state.tr.setNodeMarkup(a,void 0,{...i.attrs,citation:c,source:Vt(c)}).setMeta(`addToHistory`,!1)),te(t,VC(e.state.doc).value)});(0,j.useLayoutEffect)(()=>{if(!A)return;let e=!xe.current;xe.current=!0;let r=O(t,n),a=k.current;if(!e&&a.value===t&&a.cursor===r)return;let o=ae(t,r);k.current={value:t,cursor:r,expandedCursor:o,contextIds:re(t)},ye.current={start:o,end:o},De(t.length===0);let s=A.view.dom,c=!!(s&&document.activeElement===s);if(!e&&a.value===t&&!c)return;be.current=!0;let l=Se.current?.value===t?Se.current:null;a.value!==t&&(Me(A,a.value),A.commands.setContent(CC(t,ge,{styling:D,literalText:i}),{emitUpdate:!1}));let u=VC(A.state.doc),d=KC(u,r);if(A.commands.setTextSelection(qC(u,d)),c&&GT(A),l){Se.current=null;let e=u.runs.find(e=>e.kind===`token`&&e.nodeName===`composer-citation`&&e.mdStart===l.citationStart);if(e){let t=A.state.doc.nodeAt(e.pmPos)?.attrs?.citeKey;t&&we({key:t,sourceAnchor:l.sourceAnchor,removeOnCancel:l.insertedSpaces})}}queueMicrotask(()=>{be.current=!1})},[O,n,A,ae,i,D,ge,t]);let Ne=(0,j.useCallback)(e=>{if(!A||(A.view.focus(),k.current.value!==pe.current))return;let t=O(k.current.value,e),n=VC(A.state.doc),r=KC(n,t);A.commands.setTextSelection(qC(n,r)),GT(A),t!==k.current.cursor&&(k.current={value:k.current.value,cursor:t,expandedCursor:ae(k.current.value,t),contextIds:k.current.contextIds},ye.current={start:k.current.expandedCursor,end:k.current.expandedCursor},oe.current(k.current.value,t,k.current.expandedCursor,i,k.current.contextIds))},[O,A,ae,i]);(0,j.useImperativeHandle)(ie,()=>({focus:()=>{Ne(k.current.cursor)},focusAt:Ne,focusAtEnd:()=>{Ne(i?k.current.value.length:Xt(k.current.value,k.current.value.length))},readSelectionRange:()=>(je(),ye.current),requestCitationComment:e=>{if(Se.current=e,!A)return;let t=VC(A.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=A.state.doc.nodeAt(n.pmPos)?.attrs?.citeKey;r&&(Se.current=null,we({key:r,sourceAnchor:e.sourceAnchor,removeOnCancel:e.insertedSpaces}))},readSnapshot:je,isCaretOnVisualEdge:e=>{let t=je();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=A?.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}}),[A,Ne,i,je]);let Pe=(0,j.useCallback)((e,t)=>{let n=ue.current;if(!A||t&&!A.isEditable)return;let r=e.clipboardData,{from:a,to:o}=A.state.selection;if(a===o)return;let s=BC(A.state.doc,a,o),c=i?[]:Array.from(new Set(re(s))),l=c.length>0?n?.(c):null;e.preventDefault(),r.setData(`text/plain`,s),l&&(r.setData(b,l),r.setData(`text/html`,ee(s,l))),t&&A.chain().focus().command(({tr:e})=>(lw(e,`cut`),!0)).deleteSelection().run()},[A,i]);return(0,N.jsx)(gT,{value:c,children:(0,N.jsx)(Fw,{value:a,children:(0,N.jsx)(hT,{value:Oe,children:(0,N.jsxs)(`div`,{className:he(`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)`,g),children:[(0,N.jsx)(qg,{editor:A,onKeyDown:e=>{if((e.key===`Control`||e.key===`Meta`||e.key===`Alt`||e.key===`Shift`)&&T?.(),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});if(!n){T?.();return}C&&(e.preventDefault(),C(n))},onKeyUp:e=>w?.(e.key),onBlur:T,onPasteCapture:ne,onCopyCapture:e=>Pe(e,!1),onCutCapture:e=>Pe(e,!0)}),Ee&&a.size===0&&u?(0,N.jsx)(`div`,{className:he(`pointer-events-none absolute inset-0 leading-relaxed text-placeholder/75`,v),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);return}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,M.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(VT,{...e}),t[0]=e,t[1]=n),n}export{un as A,An as C,xn as D,yn as E,vn as O,Dn as S,Mn as T,Hn as _,Pw as a,On as b,ww as c,tr as d,Qn as f,Un as g,Wn as h,Iw as i,sn as j,fn as k,Cw as l,Gn as m,Mw as n,jw as o,$n as p,Nw as r,Ew as s,qT as t,er as u,Bn as v,Nn as w,kn as x,Pn as y};
204
- //# sourceMappingURL=ComposerPromptEditor-kPs79YCA.js.map
204
+ //# sourceMappingURL=ComposerPromptEditor-BXlsIVOQ.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Md as i,Os as a,cE as o,dr as s,eE as c,t as l,tE as u,ts as d}from"./utils-CBe1bHL7.js";import{At as f,Sn as p,kt as m}from"./runtime-CeFhsGnm.js";import{F as h,Ft as g,Pt as _}from"./runtime-BOlBBevr.js";import{i as v,p as y}from"./toast-C61oyZY1.js";import{k as b}from"./useSettings-VTow9ZEM.js";import{h as x}from"./server-DvWrfyUO.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=c(a(d(r)),D),s=b().environments.get(n)?.status,l;t[2]===e.entry?l=t[3]:(l=m(e.entry),t[2]=e.entry,t[3]=l);let p=l,_;t[4]!==e.entry||t[5]!==p.length?(_=p.length===1&&f(e.entry),t[4]=e.entry,t[5]=p.length,t[6]=_):_=t[6];let v=_,y=e.connection.phase,S=e.entry.enabled&&y!==`connected`&&y!==`unsupported`?g({hostLabel:e.label,state:i,via:v?`relay`:`direct`,relayStatus:v?u(s??o()):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 u;t[2]===r?u=t[3]:(u=r===null?null:(0,T.jsx)(j,{retryAt:r}),t[2]=r,t[3]=u);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=l(`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]!==u||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:[u,d,f,p,_]}),t[20]=u,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 g;t[15]===r.facts?g=t[16]:(g=r.facts.map(P),t[15]=r.facts,t[16]=g);let v;t[17]===g?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:g}),t[17]=g,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=_(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:l(`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:l(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-B5VXf5lv.js.map
1
+ import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Md as i,Os as a,cE as o,dr as s,eE as c,t as l,tE as u,ts as d}from"./utils-CBe1bHL7.js";import{At as f,Sn as p,kt as m}from"./runtime-CABaKt1A.js";import{F as h,Ft as g,Pt as _}from"./runtime-BBIAfWJY.js";import{i as v,p as y}from"./toast-D26NINYU.js";import{k as b}from"./useSettings-CHt2_4He.js";import{h as x}from"./server-mIR8e8Vz.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=c(a(d(r)),D),s=b().environments.get(n)?.status,l;t[2]===e.entry?l=t[3]:(l=m(e.entry),t[2]=e.entry,t[3]=l);let p=l,_;t[4]!==e.entry||t[5]!==p.length?(_=p.length===1&&f(e.entry),t[4]=e.entry,t[5]=p.length,t[6]=_):_=t[6];let v=_,y=e.connection.phase,S=e.entry.enabled&&y!==`connected`&&y!==`unsupported`?g({hostLabel:e.label,state:i,via:v?`relay`:`direct`,relayStatus:v?u(s??o()):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 u;t[2]===r?u=t[3]:(u=r===null?null:(0,T.jsx)(j,{retryAt:r}),t[2]=r,t[3]=u);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=l(`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]!==u||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:[u,d,f,p,_]}),t[20]=u,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 g;t[15]===r.facts?g=t[16]:(g=r.facts.map(P),t[15]=r.facts,t[16]=g);let v;t[17]===g?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:g}),t[17]=g,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=_(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:l(`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:l(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-DoemNrMF.js.map