@p4code/cli 0.9.15 → 0.9.17

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 (422) hide show
  1. package/dist/AcpMcpStdioBridge-Bv41U5Ym.mjs +3 -0
  2. package/dist/{AcpMcpStdioBridge-BPNHFfTr.mjs → AcpMcpStdioBridge-CvhQaaYj.mjs} +3 -3
  3. package/dist/{Effect-COOccdaU.mjs → Effect-_Rz7VLdg.mjs} +33 -2
  4. package/dist/{Schema-BXiVImR2.mjs → Schema-APnY3Ozr.mjs} +2 -2
  5. package/dist/{Stream-D2XZdzH6.mjs → Stream-CJtpwu3-.mjs} +2 -2
  6. package/dist/bin.mjs +2 -2
  7. package/dist/{binCli-06acKUH_.mjs → binCli-B298WI-F.mjs} +6254 -4331
  8. package/dist/claude-history-worker.mjs +1 -1
  9. package/dist/{claudeHistoryWorker-BJKXFgWC.mjs → claudeHistoryWorker-Dgk6e0nY.mjs} +2 -2
  10. package/dist/client/.vite/manifest.json +2296 -2067
  11. package/dist/client/assets/{2NI2N5EU-CzVcbH89.js → 2NI2N5EU-D4f5i1y_.js} +2 -2
  12. package/dist/client/assets/{4UO7MD6I-DS3UFSUE.js → 4UO7MD6I-RrpAQ0X1.js} +2 -2
  13. package/dist/client/assets/{5B3SVYGG-lbor_c4_.js → 5B3SVYGG-ClZSmzf_.js} +2 -2
  14. package/dist/client/assets/{5GK6JWQ2-DufacBFC.js → 5GK6JWQ2-B1md9I9Z.js} +2 -2
  15. package/dist/client/assets/{5N7A7DKN-B3iWX-TC.js → 5N7A7DKN-BQIARO23.js} +2 -2
  16. package/dist/client/assets/{5OC2THR4-DoDDWXtD.js → 5OC2THR4-351ZCzKk.js} +2 -2
  17. package/dist/client/assets/{5S6HY5KT-7n94quvm.js → 5S6HY5KT-DmJkK7tt.js} +2 -2
  18. package/dist/client/assets/{6IMQ5BUJ-CqcR9lZq.js → 6IMQ5BUJ-BpvNx_p4.js} +2 -2
  19. package/dist/client/assets/{6OLKWJ4F-BeCI6be_.js → 6OLKWJ4F-C2xPWRsp.js} +2 -2
  20. package/dist/client/assets/{74OO7NKP-XWvi4Kgp.js → 74OO7NKP--xC0IYpN.js} +2 -2
  21. package/dist/client/assets/{75O6YZUN-BbbGiqdI.js → 75O6YZUN-CK0ONIHW.js} +2 -2
  22. package/dist/client/assets/{77XECAW3-BVGMXOi_.js → 77XECAW3-BcsWkjLy.js} +2 -2
  23. package/dist/client/assets/{ABYRPUBD-D4oehH5y.js → ABYRPUBD-D3uBdyxY.js} +2 -2
  24. package/dist/client/assets/AlertDialogRoot-CPanDrss.js +2 -0
  25. package/dist/client/assets/{AnimatedHeight-DT585xP0.js → AnimatedHeight-CVfEvZ5q.js} +2 -2
  26. package/dist/client/assets/{AuthSurfaceShell-C312CXz7.js → AuthSurfaceShell-Cfzl0v4C.js} +2 -2
  27. package/dist/client/assets/{BB2UYUI2-BkFcdWkE.js → BB2UYUI2-BOnjWgZo.js} +2 -2
  28. package/dist/client/assets/{BUM34MOA-DK6xDbTB.js → BUM34MOA-B7RHMom2.js} +2 -2
  29. package/dist/client/assets/{CEQABKGZ-rLn9wSBN.js → CEQABKGZ-Cc9Oxare.js} +2 -2
  30. package/dist/client/assets/{CXAC5362-C1eQCQMX.js → CXAC5362-BNdOJTpr.js} +2 -2
  31. package/dist/client/assets/ChatGptUsageButton-xIp-6pmC.js +2 -0
  32. package/dist/client/assets/{ChatMarkdown-BUoR67CT.js → ChatMarkdown-Bueup3X5.js} +24 -24
  33. package/dist/client/assets/CheckboxIndicator-Bx7Oi3gX.js +2 -0
  34. package/dist/client/assets/ClippedText-CIorIVl7.js +2 -0
  35. package/dist/client/assets/CodexSetupSection.logic-C7e1n48R.js +2 -0
  36. package/dist/client/assets/ComboboxClear-HZ-hIKnq.js +2 -0
  37. package/dist/client/assets/ComboboxGroupLabel-DUYNaL5F.js +2 -0
  38. package/dist/client/assets/{CommandBlock-40eSIrOe.js → CommandBlock-4iMcWKQI.js} +2 -2
  39. package/dist/client/assets/CompositeRoot-BBK88_pH.js +2 -0
  40. package/dist/client/assets/ConnectAgentSurface-BWOV2eWU.js +2 -0
  41. package/dist/client/assets/{ConnectionStatusDot-7Tjfknn6.js → ConnectionStatusDot-ChSEZVFH.js} +2 -2
  42. package/dist/client/assets/DRACOLoader-DluumOSd.js +3 -0
  43. package/dist/client/assets/{DRLTVNUE-BPoomdQn.js → DRLTVNUE-DFsymRUq.js} +2 -2
  44. package/dist/client/assets/{DYY6UVD2-BVvdA84B.js → DYY6UVD2-CBGlYjYj.js} +2 -2
  45. package/dist/client/assets/DevicePanel-DbUlYPs5.js +2 -0
  46. package/dist/client/assets/DeviceSetup-DwoJ9gYG.js +2 -0
  47. package/dist/client/assets/DialogTitle-CZ-x-t6r.js +2 -0
  48. package/dist/client/assets/{DiffCommentAnnotation-C28NAT6f.js → DiffCommentAnnotation-I1NLNQ4a.js} +3 -3
  49. package/dist/client/assets/{DiffFileTree-DNP9E3To.js → DiffFileTree-D2Less6B.js} +2 -2
  50. package/dist/client/assets/DiffPanel-CbeaPGl7.js +2 -0
  51. package/dist/client/assets/{DiffWorkerPoolProvider-TgqbZJCv.js → DiffWorkerPoolProvider-Ed_Eu_5j.js} +3 -3
  52. package/dist/client/assets/{EmbeddedDesign-B4RMmwTG.css → EmbeddedDesign-2h_Gl1nY.css} +1 -1
  53. package/dist/client/assets/EmbeddedDesign-cg069GMG.js +22 -0
  54. package/dist/client/assets/{EnvironmentMachineIcon-B81Bujkx.js → EnvironmentMachineIcon-DX1kvIxN.js} +2 -2
  55. package/dist/client/assets/{ExpandableText-CViqRFUp.js → ExpandableText-DjawxN-Z.js} +2 -2
  56. package/dist/client/assets/{FNOVOB4O-CmMgcKnc.js → FNOVOB4O-CyUhwNfJ.js} +2 -2
  57. package/dist/client/assets/FieldControl-HtKPFtzy.js +2 -0
  58. package/dist/client/assets/{FileDiff-BnZVGRTP.js → FileDiff-B-y5La4j.js} +2 -2
  59. package/dist/client/assets/{FilePreviewPanel-BUTTBdpa.js → FilePreviewPanel-c9WvfrZ_.js} +6 -6
  60. package/dist/client/assets/{FoldedSettingsSection-CioXtXIT.js → FoldedSettingsSection-BJZLAjOM.js} +2 -2
  61. package/dist/client/assets/FormContext-CXpUoAJn.js +2 -0
  62. package/dist/client/assets/GLTFLoader-DL026JyV.js +3833 -0
  63. package/dist/client/assets/{HDGCDEEZ-BsN0BbNt.js → HDGCDEEZ-Bl6z86eT.js} +2 -2
  64. package/dist/client/assets/{HSJLKHB7-Bn8VFRt5.js → HSJLKHB7-Cfn1dqKq.js} +2 -2
  65. package/dist/client/assets/{Icons-D_LFMxsj.js → Icons-CnCqDzcX.js} +2 -2
  66. package/dist/client/assets/Input-DivTTwcy.js +2 -0
  67. package/dist/client/assets/IntervalSecondsField-BEYqyqtO.js +2 -0
  68. package/dist/client/assets/JZOYTAAL-5Iy_ls5m.js +1 -0
  69. package/dist/client/assets/{K3MD6TGW-BEaTend7.js → K3MD6TGW-DbKn4Q-g.js} +2 -2
  70. package/dist/client/assets/{K7RP3OMA-Ca837W6z.js → K7RP3OMA-C2LcLP3I.js} +2 -2
  71. package/dist/client/assets/KeybindingsSettings.logic-BBUqSPsh.js +2 -0
  72. package/dist/client/assets/{LHDIQX7Q-kLYZmy22.js → LHDIQX7Q-D15jphae.js} +2 -2
  73. package/dist/client/assets/{LUXOKEGN-C6-9ARpy.js → LUXOKEGN-a5epevQp.js} +2 -2
  74. package/dist/client/assets/LinkMachineSelect-BeDb1a2o.js +2 -0
  75. package/dist/client/assets/{MathTypeset-CO0wlzDm.js → MathTypeset-wh9NB-6n.js} +2 -2
  76. package/dist/client/assets/ModelLiveLayer-vM3B8fTs.js +3 -0
  77. package/dist/client/assets/{N3JZAHOW-BFAKVTw8.js → N3JZAHOW-CnXyo2Xv.js} +2 -2
  78. package/dist/client/assets/{NUIALGQ3-DJg3tvBl.js → NUIALGQ3-Be5ePBJU.js} +2 -2
  79. package/dist/client/assets/{NoProjectsHero-ClDVFY0-.js → NoProjectsHero-D-hOorzE.js} +2 -2
  80. package/dist/client/assets/{O65XPQGZ-C5dkxqix.js → O65XPQGZ-B6ecTWo6.js} +2 -2
  81. package/dist/client/assets/{O7XIQ6OM-BUT403yQ.js → O7XIQ6OM-DvY9hhop.js} +2 -2
  82. package/dist/client/assets/{OFQON5FD-BPK3FXUG.js → OFQON5FD-Csir9i2q.js} +2 -2
  83. package/dist/client/assets/P4ConnectAccountPages-0UQXNoHX.js +2 -0
  84. package/dist/client/assets/{P4ConnectSidebarSignIn-D7BBbl_u.js → P4ConnectSidebarSignIn-DNS-Ar_U.js} +2 -2
  85. package/dist/client/assets/{PJQHF43J-DrfICuu-.js → PJQHF43J-DDRN0fWF.js} +2 -2
  86. package/dist/client/assets/PanelLayoutControls-1wZHYpgc.js +216 -0
  87. package/dist/client/assets/PierreEntryIcon-C-UBRZGs.js +2 -0
  88. package/dist/client/assets/PopoverHandle-AuBayEmY.js +2 -0
  89. package/dist/client/assets/PreviewPanel-5UQIDtjs.js +2 -0
  90. package/dist/client/assets/ProjectDefaultsSettings-BuSgjMGJ.js +2 -0
  91. package/dist/client/assets/{ProjectFavicon-BbtNdeB8.js → ProjectFavicon-Rj7LmbUX.js} +3 -3
  92. package/dist/client/assets/ProjectIconPickerDialog-75VZboJk.js +2 -0
  93. package/dist/client/assets/{ProjectMonogram-CjAGnMXr.js → ProjectMonogram-o7ZBa1RK.js} +2 -2
  94. package/dist/client/assets/{ProviderAuthTerminal-83vDClUK.js → ProviderAuthTerminal-884jYkPg.js} +2 -2
  95. package/dist/client/assets/ProviderModelPicker-446NiacH.js +2 -0
  96. package/dist/client/assets/ProviderSettingsForm-CBS1Dlfm.js +2 -0
  97. package/dist/client/assets/PullRequestCodeTab-DQzL88wU.js +6 -0
  98. package/dist/client/assets/{RHNBAITX-CzAdLNMd.js → RHNBAITX-DkWE42El.js} +2 -2
  99. package/dist/client/assets/{ReadOnlySourcePreview-CRy5hHfx.js → ReadOnlySourcePreview-DwfiVQrm.js} +2 -2
  100. package/dist/client/assets/{RedactedSensitiveText-B-u4PB3I.js → RedactedSensitiveText-DCu9USVF.js} +2 -2
  101. package/dist/client/assets/{RenderErrorBoundary-BbxLD-66.js → RenderErrorBoundary-ZQ6mGx7s.js} +3 -3
  102. package/dist/client/assets/RightPanelResizeHandle-8oJQkwcU.js +2 -0
  103. package/dist/client/assets/RoomEnvironment-Iz7-KYrN.js +2 -0
  104. package/dist/client/assets/{SLD4V6NK-DIFaAadw.js → SLD4V6NK-DTdKN7s4.js} +2 -2
  105. package/dist/client/assets/ScheduledTasksSettings-BFBxrkf4.js +6 -0
  106. package/dist/client/assets/{ScopedSwitch-sSIKDf2q.js → ScopedSwitch-BC1gPotW.js} +2 -2
  107. package/dist/client/assets/ScrollAreaCorner-C2BGnFEt.js +2 -0
  108. package/dist/client/assets/{SecretInput-DxjaAnSE.js → SecretInput-CTGlsesz.js} +2 -2
  109. package/dist/client/assets/SelectScrollUpArrow-BCdPJCNh.js +2 -0
  110. package/dist/client/assets/SelfImproveSettingsSection-DrWeWHZ3.js +2 -0
  111. package/dist/client/assets/SettingsPanels-dLjfE4mE.js +46 -0
  112. package/dist/client/assets/SettingsPanels.logic-DmWR8tPG.js +2 -0
  113. package/dist/client/assets/{SettingsScopeNotice-B1JDmqM6.js → SettingsScopeNotice-C3QzVYEB.js} +2 -2
  114. package/dist/client/assets/{SidebarStageBackdrop-Bbv3JBlJ.js → SidebarStageBackdrop-B1pFHa1_.js} +2 -2
  115. package/dist/client/assets/{T3PCR2KE-CACWvOHn.js → T3PCR2KE-17rNrwIa.js} +2 -2
  116. package/dist/client/assets/{TKWO2OVW-DpiGaVko.js → TKWO2OVW-duPpJj5d.js} +2 -2
  117. package/dist/client/assets/{TSHNXIZL-Cs6g4gXN.js → TSHNXIZL-DU0_NvP6.js} +2 -2
  118. package/dist/client/assets/{ThemeEditorPanel-w-RJEK3t.js → ThemeEditorPanel-75j9OkFZ.js} +3 -3
  119. package/dist/client/assets/{ThreadDetailsItemsMenu-DEwUOoLt.js → ThreadDetailsItemsMenu-D9bVwLRx.js} +45 -45
  120. package/dist/client/assets/ThreadTerminalDrawer-CdfREoC-.js +5 -0
  121. package/dist/client/assets/TooltipProvider-BUHMH_xT.js +2 -0
  122. package/dist/client/assets/{UQJE5E4I-C2gKDRv_.js → UQJE5E4I-B6R9z_Jl.js} +2 -2
  123. package/dist/client/assets/{USNYFO5S-CQ8LfY6F.js → USNYFO5S-CoqkxDVj.js} +2 -2
  124. package/dist/client/assets/{Virtualizer-DsEq6qUF.js → Virtualizer-CmU5Fo0Z.js} +2 -2
  125. package/dist/client/assets/{WEVWDWVA-DK2GTAKk.js → WEVWDWVA-C_7PWsV9.js} +2 -2
  126. package/dist/client/assets/{WorkspaceBreadcrumb-BImJJpuo.js → WorkspaceBreadcrumb-wSY6JpgP.js} +2 -2
  127. package/dist/client/assets/{WorkspacePageContainer-BlYFBUKE.js → WorkspacePageContainer-Bv3Si0zJ.js} +2 -2
  128. package/dist/client/assets/{WorkspacePageHeader-B7O16593.js → WorkspacePageHeader-D35ZiFO-.js} +2 -2
  129. package/dist/client/assets/{X5RFHQXM-sPxDCIwv.js → X5RFHQXM-BUhlFLY4.js} +2 -2
  130. package/dist/client/assets/{X62E3GBT-DVWr270S.js → X62E3GBT-BpMRLXKj.js} +2 -2
  131. package/dist/client/assets/{XBNEOJTC-C4ZNtSrU.js → XBNEOJTC-BRtSarTS.js} +2 -2
  132. package/dist/client/assets/{YHV2MVVZ-aSYUfq9n.js → YHV2MVVZ-Csy6jL8n.js} +2 -2
  133. package/dist/client/assets/{YURCZMG2-fnxZxUja.js → YURCZMG2-BWgVyhae.js} +2 -2
  134. package/dist/client/assets/{YVG2LODB-DxaZKaXT.js → YVG2LODB-BaRjN-Cm.js} +2 -2
  135. package/dist/client/assets/_chat-3NFUtZzk.js +47 -0
  136. package/dist/client/assets/_chat.design-CPUGyCaX.js +2 -0
  137. package/dist/client/assets/{_chat.index-D1csjyRQ.js → _chat.index-BMWR9-dz.js} +2 -2
  138. package/dist/client/assets/_chat.new-CFxwzp_c.js +4 -0
  139. package/dist/client/assets/_chat.pull-requests-BeA7vnLo.js +2 -0
  140. package/dist/client/assets/alert-DNQ3Wqlu.js +2 -0
  141. package/dist/client/assets/{alert-dialog-BCq0Qme9.js → alert-dialog-BRZulAlJ.js} +2 -2
  142. package/dist/client/assets/{assetUrls-CpRsTTqn.js → assetUrls-C1PZWceM.js} +2 -2
  143. package/dist/client/assets/assets-DPxWpbK1.js +2 -0
  144. package/dist/client/assets/browserHistoryStore-or0m8nek.js +2 -0
  145. package/dist/client/assets/{browserLinkTarget-IOprEiHF.js → browserLinkTarget-DE8VZ118.js} +2 -2
  146. package/dist/client/assets/{checkbox-CGhJug34.js → checkbox-Cz3A131i.js} +2 -2
  147. package/dist/client/assets/{color-picker-CRaqqL5F.js → color-picker-BqJjpRIx.js} +2 -2
  148. package/dist/client/assets/combobox-D28ATySv.js +2 -0
  149. package/dist/client/assets/{command-06bu9QoQ.js → command-BjQ8TOGE.js} +2 -2
  150. package/dist/client/assets/{connect-7OV1IEwO.js → connect-CpfP9Azm.js} +2 -2
  151. package/dist/client/assets/connect-agent-19TQkO9t.js +2 -0
  152. package/dist/client/assets/design-Bz1IpqHZ.js +2 -0
  153. package/dist/client/assets/device-DuASmK9r.js +2 -0
  154. package/dist/client/assets/dialog-BJ3R7bWN.js +2 -0
  155. package/dist/client/assets/diffPanelStore-Yh6lox6N.js +2 -0
  156. package/dist/client/assets/{diffRendering-DAzPanqh.js → diffRendering-CeqwU9XS.js} +2 -2
  157. package/dist/client/assets/{dist-BuxsAlG0.js → dist-C2W3DEZU.js} +3 -3
  158. package/dist/client/assets/draco_decoder-DZ63_CFx.js +2 -0
  159. package/dist/client/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
  160. package/dist/client/assets/draco_wasm_wrapper-9cRAE0qV.js +2 -0
  161. package/dist/client/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
  162. package/dist/client/assets/draft-input-D7yqLT1A.js +2 -0
  163. package/dist/client/assets/duoViewer-DQzDc4Z4.js +2 -0
  164. package/dist/client/assets/{dynamic-wBSCLNxy.js → dynamic-Dz4eLTaa.js} +3 -3
  165. package/dist/client/assets/{embeddedScripts-ZebptRJ0.js → embeddedScripts-DZ2Ii9dE.js} +2 -2
  166. package/dist/client/assets/empty-BwsFVBxJ.js +2 -0
  167. package/dist/client/assets/entities-CNmVqAZs.js +2 -0
  168. package/dist/client/assets/{fileLinks-BfcK2bJU.js → fileLinks-E3IIVHgM.js} +2 -2
  169. package/dist/client/assets/{fileTreeExpansion-DjiK1m5s.js → fileTreeExpansion-gTas243c.js} +2 -2
  170. package/dist/client/assets/{getDiffFileInput-XE3jyXxK.js → getDiffFileInput-CUXcOkYa.js} +2 -2
  171. package/dist/client/assets/{htmlRender-DGe3WaPg.js → htmlRender-DSw3CY7L.js} +2 -2
  172. package/dist/client/assets/hubAccess-CsZ8CNmg.js +2 -0
  173. package/dist/client/assets/image-up-f7X837EZ.js +2 -0
  174. package/dist/client/assets/{index-CurDuwfz.js → index-Bxj8VaXa.js} +3 -3
  175. package/dist/client/assets/{input-CQaedaQh.js → input-BwujRX3Y.js} +2 -2
  176. package/dist/client/assets/input-group-euoW8Z7h.js +2 -0
  177. package/dist/client/assets/{kbd-DQRicdHu.js → kbd-GiLKf_On.js} +2 -2
  178. package/dist/client/assets/keybindings-CCmLKtII.js +2 -0
  179. package/dist/client/assets/{lazy-DmPH_lNd.js → lazy-JsFnphfP.js} +4 -4
  180. package/dist/client/assets/{lazyRouteComponent-CE6uW_5p.js → lazyRouteComponent-DZOLCSfI.js} +2 -2
  181. package/dist/client/assets/{link-CKfckeju.js → link-ByE5ZkNW.js} +2 -2
  182. package/dist/client/assets/{linkedPrompt-68_t5vwh.js → linkedPrompt-Dv_ZP8G8.js} +2 -2
  183. package/dist/client/assets/main-D8lKEPYS.js +37 -0
  184. package/dist/client/assets/main-DIHqY9YX.css +2 -0
  185. package/dist/client/assets/{mediaReference-DQ6GIZY7.js → mediaReference-DKsJ-9R8.js} +2 -2
  186. package/dist/client/assets/mediaSource-CF8tZyds.js +2 -0
  187. package/dist/client/assets/meshopt_decoder.module-BE7cuDBs.js +2 -0
  188. package/dist/client/assets/modelScene-DxcxMNRA.js +3 -0
  189. package/dist/client/assets/number-field-CWsDuEfo.js +2 -0
  190. package/dist/client/assets/{observeResize-BbXolq6K.js → observeResize-BxfFu2qN.js} +2 -2
  191. package/dist/client/assets/onboarding-DbYQeYSX.js +2 -0
  192. package/dist/client/assets/openFileInPreview-BiuuqQ-l.js +2 -0
  193. package/dist/client/assets/orbit-CTbdaXs-.js +2 -0
  194. package/dist/client/assets/p4ProjectFile-CZQao9GZ.js +2 -0
  195. package/dist/client/assets/{pair-BpCo33SH.js → pair-JgOCPd7m.js} +2 -2
  196. package/dist/client/assets/pause-5XtmSS7L.js +2 -0
  197. package/dist/client/assets/{pendingSendStore-Ba--K6cH.js → pendingSendStore-Bf499-Oy.js} +2 -2
  198. package/dist/client/assets/phoneViewer-Bqeu_y-d.js +2 -0
  199. package/dist/client/assets/{pierre-icons-BdcegjLq.js → pierre-icons-tmWDDsbZ.js} +2 -2
  200. package/dist/client/assets/popover-D2KZg7__.js +2 -0
  201. package/dist/client/assets/preview-eatXH_DC.js +2 -0
  202. package/dist/client/assets/preview-rGycedjV.js +2 -0
  203. package/dist/client/assets/previewMiniPlayerStore-7pQoYbpL.js +2 -0
  204. package/dist/client/assets/primary-C0adlG4a.js +2 -0
  205. package/dist/client/assets/primaryCloudLinkState-DStOgXZ7.js +2 -0
  206. package/dist/client/assets/projectFilesQueryState-CXzO_JXd.js +2 -0
  207. package/dist/client/assets/projectScriptEditor-B9Q_BBbL.js +2 -0
  208. package/dist/client/assets/providerSkills-BYU6vU9U.js +2 -0
  209. package/dist/client/assets/pullRequestDetail.logic-CAA5BrcO.js +10 -0
  210. package/dist/client/assets/{pullRequestIcons-CbDg0o8q.js → pullRequestIcons-D0TNfVUp.js} +2 -2
  211. package/dist/client/assets/{pullRequestReviewStore-0WIH92NQ.js → pullRequestReviewStore-szmuenZj.js} +2 -2
  212. package/dist/client/assets/pullRequests-tu-Mn-gv.js +2 -0
  213. package/dist/client/assets/queries-BhrI_odm.js +2 -0
  214. package/dist/client/assets/query-DmYgeaGK.js +2 -0
  215. package/dist/client/assets/radio-group-YcYZQjQu.js +2 -0
  216. package/dist/client/assets/relay-DcCuBtiq.js +2 -0
  217. package/dist/client/assets/renderScheduler-BgdSr0UC.js +2 -0
  218. package/dist/client/assets/rightPanelStore-BpUwMEU6.js +2 -0
  219. package/dist/client/assets/runtime-DciS6GP9.js +7 -0
  220. package/dist/client/assets/{runtimeModeConfig-CRXk0H6e.js → runtimeModeConfig-B8OcO6E5.js} +2 -2
  221. package/dist/client/assets/{scheduledTasksSettings.logic-Dw_swg_M.js → scheduledTasksSettings.logic-Cnm8G_wO.js} +3 -3
  222. package/dist/client/assets/{scroll-area-Cm9XZdHp.js → scroll-area-D7wKdOM7.js} +2 -2
  223. package/dist/client/assets/select--26O8gr7.js +2 -0
  224. package/dist/client/assets/selfImproveFindings-CQHbA_SP.js +2 -0
  225. package/dist/client/assets/server-DKB_3xTN.js +2 -0
  226. package/dist/client/assets/session-D_OiLzln.js +2 -0
  227. package/dist/client/assets/session-logic-lUPcTQRy.js +26 -0
  228. package/dist/client/assets/{settings-Yvo1RMvg.js → settings-BDigjNQr.js} +2 -2
  229. package/dist/client/assets/{settings.appearance-ONDNW-gc.js → settings.appearance-pv_RhojI.js} +2 -2
  230. package/dist/client/assets/settings.archived-UHO0BqSp.js +2 -0
  231. package/dist/client/assets/settings.computer-use-C7FCVkB8.js +2 -0
  232. package/dist/client/assets/settings.connections-MCKul-Qb.js +2 -0
  233. package/dist/client/assets/settings.data-controls-DHSiH1XK.js +2 -0
  234. package/dist/client/assets/settings.decisions-DVAZFuiP.js +2 -0
  235. package/dist/client/assets/settings.designs-Cq_57Bul.js +2 -0
  236. package/dist/client/assets/settings.diagnostics-D3vvP_U2.js +2 -0
  237. package/dist/client/assets/{settings.general-Cf_bIbyH.js → settings.general-BVlKme_0.js} +2 -2
  238. package/dist/client/assets/settings.integrations-CfX639cu.js +2 -0
  239. package/dist/client/assets/settings.keybindings-C4ufqFiE.js +2 -0
  240. package/dist/client/assets/{settings.open-source-licenses-DlqO6HBa.js → settings.open-source-licenses-C7SQX7_o.js} +2 -2
  241. package/dist/client/assets/settings.plugins-JB-_3lB3.js +5 -0
  242. package/dist/client/assets/settings.projects-HbUqS8EQ.js +4 -0
  243. package/dist/client/assets/settings.providers-DDaicTRG.js +3 -0
  244. package/dist/client/assets/{settings.scheduled-tasks-BIaHEXVF.js → settings.scheduled-tasks-CsfZkMNc.js} +2 -2
  245. package/dist/client/assets/settings.secrets-DmkUTUBC.js +2 -0
  246. package/dist/client/assets/settings.snap-shot-CxBBb3GG.js +2 -0
  247. package/dist/client/assets/settings.source-control-Buh1svx1.js +2 -0
  248. package/dist/client/assets/settings.storage-BoCdHcfz.js +2 -0
  249. package/dist/client/assets/settingsLayout-EWRSNE9F.js +3 -0
  250. package/dist/client/assets/sidebar-B2McbSnM.js +2 -0
  251. package/dist/client/assets/{sidebarProjectGrouping-Cy06FqQF.js → sidebarProjectGrouping-ManvShfB.js} +2 -2
  252. package/dist/client/assets/skeleton-CfxEpnM8.js +2 -0
  253. package/dist/client/assets/sourceControl-2E-torWB.js +2 -0
  254. package/dist/client/assets/sourceControlClients-DTwwk4H6.js +2 -0
  255. package/dist/client/assets/spinner-DiQtYQvU.js +2 -0
  256. package/dist/client/assets/src-aYUfWMsw.js +15 -0
  257. package/dist/client/assets/{terminal-links-DkNuyYrs.js → terminal-links-DalIS_T6.js} +2 -2
  258. package/dist/client/assets/terminalSessions-BXRGhdwO.js +2 -0
  259. package/dist/client/assets/textarea-CgJxMEC6.js +2 -0
  260. package/dist/client/assets/{themePalette-1UQmJk98.js → themePalette-BAJL8JDR.js} +3 -3
  261. package/dist/client/assets/threadCheckpoints-A01VyLzN.js +2 -0
  262. package/dist/client/assets/toggle-fVPE0kyD.js +2 -0
  263. package/dist/client/assets/toggle-group-BQBgK4Fh.js +2 -0
  264. package/dist/client/assets/{tooltip-C7NAkYG3.js → tooltip-DDv-MvO4.js} +2 -2
  265. package/dist/client/assets/{uiStateStore-FYiLqqos.js → uiStateStore-Cyle2Grh.js} +2 -2
  266. package/dist/client/assets/usage-DfkVwFPy.js +2 -0
  267. package/dist/client/assets/usageAccess-DGGNF6kP.js +2 -0
  268. package/dist/client/assets/usageFormat-DvpnUmwI.js +2 -0
  269. package/dist/client/assets/{usageShortcuts-BJyp1xT6.js → usageShortcuts-BefcatkO.js} +2 -2
  270. package/dist/client/assets/{use-atom-command-BbFDhw_c.js → use-atom-command-Bfi4daMj.js} +2 -2
  271. package/dist/client/assets/{useAriaLabelledBy-BJnK5b5h.js → useAriaLabelledBy-DjrGw7Iw.js} +2 -2
  272. package/dist/client/assets/useHandleNewThread-idXLHXR7.js +2 -0
  273. package/dist/client/assets/{useLocation-NTw9A5XQ.js → useLocation-fNQqSFar.js} +2 -2
  274. package/dist/client/assets/{useNavigate-DV9bXnWr.js → useNavigate-DwXZ6yA7.js} +2 -2
  275. package/dist/client/assets/{useNavigateBack-D62rsj_4.js → useNavigateBack-mLGu4w8K.js} +2 -2
  276. package/dist/client/assets/{useP4ConnectAuthPrompt-Bj5GIxgy.js → useP4ConnectAuthPrompt-BXgvqiOd.js} +2 -2
  277. package/dist/client/assets/{useParams-jklHVL7l.js → useParams-qFbmBdAa.js} +2 -2
  278. package/dist/client/assets/{usePermissionStatus-DaCu90iN.js → usePermissionStatus-CTyZ03Js.js} +2 -2
  279. package/dist/client/assets/usePopupViewport-Dc46kF33.js +2 -0
  280. package/dist/client/assets/usePullRequestActions-DJ1WiiLA.js +3 -0
  281. package/dist/client/assets/useRegisterFieldControl-BL6Ml_ar.js +2 -0
  282. package/dist/client/assets/useRender-BP5vR6yH.js +2 -0
  283. package/dist/client/assets/{useScopedModelAvailability-hsJL85Tg.js → useScopedModelAvailability-CLTKL2Jf.js} +2 -2
  284. package/dist/client/assets/useSettings-CnHpxSBo.js +3 -0
  285. package/dist/client/assets/utils-CtzgibkN.js +24 -0
  286. package/dist/client/assets/vcsRefInvalidation-BewBnMos.js +2 -0
  287. package/dist/client/assets/welcome-BkJ7M2_8.js +2 -0
  288. package/dist/client/index.html +1 -1
  289. package/dist/{renderer-D9dDeERN.mjs → renderer-7PhJbGDm.mjs} +19 -4
  290. package/dist/{runtime-C3UJDGLb.mjs → runtime-Dbm6Vqjj.mjs} +511 -233
  291. package/package.json +1 -1
  292. package/dist/AcpMcpStdioBridge-CtXfvrFO.mjs +0 -3
  293. package/dist/client/assets/AlertDialogRoot-BI19p1Pb.js +0 -2
  294. package/dist/client/assets/ChatGptUsageButton-BldpBXxU.js +0 -2
  295. package/dist/client/assets/CheckboxIndicator-C4iAbUMh.js +0 -2
  296. package/dist/client/assets/ClippedText-TtLeyAVc.js +0 -2
  297. package/dist/client/assets/CodexSetupSection.logic-BO6ZAijp.js +0 -2
  298. package/dist/client/assets/ComboboxClear-CtNsa8Al.js +0 -2
  299. package/dist/client/assets/ComboboxGroupLabel-vQ7y8c50.js +0 -2
  300. package/dist/client/assets/CompositeRoot-CL7X20MU.js +0 -2
  301. package/dist/client/assets/ConnectAgentSurface-B_AYPHWs.js +0 -2
  302. package/dist/client/assets/DevicePanel-Cqexcbm2.js +0 -2
  303. package/dist/client/assets/DeviceSetup-Cdyw5Z9a.js +0 -2
  304. package/dist/client/assets/DialogTitle-CFYK6V6-.js +0 -2
  305. package/dist/client/assets/DiffPanel-CrswOKS6.js +0 -2
  306. package/dist/client/assets/EmbeddedDesign-Bdq5oAfI.js +0 -21
  307. package/dist/client/assets/FieldControl-95mCsa0m.js +0 -2
  308. package/dist/client/assets/FormContext-BcA1kdFD.js +0 -2
  309. package/dist/client/assets/Input-C9KIhPlP.js +0 -2
  310. package/dist/client/assets/JZOYTAAL-B8H2VC7A.js +0 -1
  311. package/dist/client/assets/KeybindingsSettings.logic-DwMUZYvv.js +0 -2
  312. package/dist/client/assets/LinkMachineSelect-BVNnYUBb.js +0 -2
  313. package/dist/client/assets/P4ConnectAccountPages-ChT866qO.js +0 -2
  314. package/dist/client/assets/PanelLayoutControls-DMUv135M.js +0 -216
  315. package/dist/client/assets/PierreEntryIcon-DLXDEcqA.js +0 -2
  316. package/dist/client/assets/PopoverHandle-D8JhsX32.js +0 -2
  317. package/dist/client/assets/PreviewPanel-D7YWnWZS.js +0 -2
  318. package/dist/client/assets/ProjectDefaultsSettings-BZSw74tU.js +0 -2
  319. package/dist/client/assets/ProjectIconPickerDialog-7vur_TCX.js +0 -2
  320. package/dist/client/assets/ProviderModelPicker-af7MWLPO.js +0 -2
  321. package/dist/client/assets/ProviderSettingsForm-B4N4tsxv.js +0 -2
  322. package/dist/client/assets/PullRequestCodeTab-B07M_QW4.js +0 -6
  323. package/dist/client/assets/RightPanelResizeHandle-BODMyZa6.js +0 -2
  324. package/dist/client/assets/ScheduledTasksSettings-BTi69FRq.js +0 -6
  325. package/dist/client/assets/ScrollAreaCorner-CsKGemsf.js +0 -2
  326. package/dist/client/assets/SelectScrollUpArrow-BMZtcPXM.js +0 -2
  327. package/dist/client/assets/SelfImproveSettingsSection-Dx6spJXh.js +0 -2
  328. package/dist/client/assets/SettingsPanels-DhuEF0_Y.js +0 -46
  329. package/dist/client/assets/SettingsPanels.logic-D5Fnq4gS.js +0 -2
  330. package/dist/client/assets/ThreadTerminalDrawer-CY2qHldP.js +0 -5
  331. package/dist/client/assets/TooltipProvider-Czzm7ro-.js +0 -2
  332. package/dist/client/assets/_chat-BeJoXsdK.js +0 -47
  333. package/dist/client/assets/_chat.design-AJz30uXq.js +0 -2
  334. package/dist/client/assets/_chat.new-IhhWgwNo.js +0 -4
  335. package/dist/client/assets/_chat.pull-requests-B84LUHIv.js +0 -2
  336. package/dist/client/assets/alert-D6MFRWZv.js +0 -2
  337. package/dist/client/assets/assets-Dh1LFwqL.js +0 -2
  338. package/dist/client/assets/browserHistoryStore-BVEWgOnh.js +0 -2
  339. package/dist/client/assets/combobox-5RzytEjd.js +0 -2
  340. package/dist/client/assets/connect-agent-B6pgZuy8.js +0 -2
  341. package/dist/client/assets/design-DSoix9e1.js +0 -2
  342. package/dist/client/assets/device-DQmQm4GC.js +0 -2
  343. package/dist/client/assets/dialog-DTVhbEqi.js +0 -2
  344. package/dist/client/assets/draft-input-BTetoXSt.js +0 -2
  345. package/dist/client/assets/duoViewer-DxmaOmHS.js +0 -2
  346. package/dist/client/assets/empty-B4h5DyMQ.js +0 -2
  347. package/dist/client/assets/entities-CWtNgawi.js +0 -2
  348. package/dist/client/assets/guideRunStore-CzF0q6A8.js +0 -2
  349. package/dist/client/assets/image-up-BN-uYqtM.js +0 -2
  350. package/dist/client/assets/input-group-BQ_2ox-w.js +0 -2
  351. package/dist/client/assets/keybindings-tgj8XFFz.js +0 -2
  352. package/dist/client/assets/main-B1sXOjZZ.js +0 -37
  353. package/dist/client/assets/main-CbkvDRKP.css +0 -2
  354. package/dist/client/assets/mediaSource-DfTsMdqm.js +0 -2
  355. package/dist/client/assets/number-field-xEi5ylvp.js +0 -2
  356. package/dist/client/assets/onboarding-CkdZxdNL.js +0 -2
  357. package/dist/client/assets/openFileInPreview-BHhDd-id.js +0 -2
  358. package/dist/client/assets/orbit-aOr6_vTe.js +0 -2
  359. package/dist/client/assets/p4ProjectFile-5VDI-yAx.js +0 -2
  360. package/dist/client/assets/pause-C-5l1Ug3.js +0 -2
  361. package/dist/client/assets/phoneViewer-C1aGY-h1.js +0 -2
  362. package/dist/client/assets/popover-BB2K1---.js +0 -2
  363. package/dist/client/assets/preview-B4_sjsUX.js +0 -2
  364. package/dist/client/assets/preview-DgXn94k5.js +0 -2
  365. package/dist/client/assets/previewMiniPlayerStore-DguWdL1f.js +0 -2
  366. package/dist/client/assets/primary-BDoRkJqU.js +0 -2
  367. package/dist/client/assets/primaryCloudLinkState-Cc0Xobh6.js +0 -2
  368. package/dist/client/assets/projectFilesQueryState-BdfD5cZ2.js +0 -2
  369. package/dist/client/assets/projectScriptEditor-faOsFlds.js +0 -2
  370. package/dist/client/assets/providerSkills-C8PrnHb-.js +0 -2
  371. package/dist/client/assets/pullRequestDetail.logic-kOhR5jr9.js +0 -10
  372. package/dist/client/assets/pullRequests-Cf9E2kW-.js +0 -2
  373. package/dist/client/assets/queries-Cl508kPw.js +0 -2
  374. package/dist/client/assets/query-D3KVoW9G.js +0 -2
  375. package/dist/client/assets/radio-group-BnZVD-CO.js +0 -2
  376. package/dist/client/assets/relay-Do9UB5iT.js +0 -2
  377. package/dist/client/assets/renderScheduler-DsjkE3rh.js +0 -3833
  378. package/dist/client/assets/rightPanelStore-DB1OP4MT.js +0 -2
  379. package/dist/client/assets/runtime-BBYIQ0f-.js +0 -7
  380. package/dist/client/assets/select-Cz_1ByI4.js +0 -2
  381. package/dist/client/assets/selfImproveFindings-DtoTFNL_.js +0 -2
  382. package/dist/client/assets/server-Dkj4NeYG.js +0 -2
  383. package/dist/client/assets/session-CBEVNHld.js +0 -2
  384. package/dist/client/assets/session-logic-DB_ei-pn.js +0 -26
  385. package/dist/client/assets/settings.archived-CjdyCMyi.js +0 -2
  386. package/dist/client/assets/settings.computer-use-97ffp9C_.js +0 -2
  387. package/dist/client/assets/settings.connections-w3qKRKGa.js +0 -2
  388. package/dist/client/assets/settings.data-controls-C8ozSexu.js +0 -2
  389. package/dist/client/assets/settings.decisions-BvR3_OTv.js +0 -2
  390. package/dist/client/assets/settings.designs-CB8PWHwW.js +0 -2
  391. package/dist/client/assets/settings.diagnostics-DdInPrq0.js +0 -2
  392. package/dist/client/assets/settings.integrations-pj9KVvtd.js +0 -2
  393. package/dist/client/assets/settings.keybindings-3diGciV1.js +0 -2
  394. package/dist/client/assets/settings.plugins-DpaJJH_J.js +0 -5
  395. package/dist/client/assets/settings.projects-Bfh3CJ1a.js +0 -4
  396. package/dist/client/assets/settings.providers-DNiEeQYT.js +0 -3
  397. package/dist/client/assets/settings.secrets-BSNXem5A.js +0 -2
  398. package/dist/client/assets/settings.snap-shot-Ds0ywKhE.js +0 -2
  399. package/dist/client/assets/settings.source-control-C41AVNSm.js +0 -2
  400. package/dist/client/assets/settings.storage-B-Hm5vEC.js +0 -2
  401. package/dist/client/assets/settingsLayout-BbEwQ6Fy.js +0 -3
  402. package/dist/client/assets/sidebar-B70J7v16.js +0 -2
  403. package/dist/client/assets/skeleton-BavPX8IL.js +0 -2
  404. package/dist/client/assets/sourceControl-De64nxc-.js +0 -2
  405. package/dist/client/assets/sourceControlClients-BofXnV5S.js +0 -2
  406. package/dist/client/assets/spinner-BiCpg0TU.js +0 -2
  407. package/dist/client/assets/terminalSessions-BLnAzTpE.js +0 -2
  408. package/dist/client/assets/textarea-DPWqoJRQ.js +0 -2
  409. package/dist/client/assets/threadCheckpoints-C5aLz9nv.js +0 -2
  410. package/dist/client/assets/toggle-DERKSGyC.js +0 -2
  411. package/dist/client/assets/toggle-group-DYSJFIn3.js +0 -2
  412. package/dist/client/assets/usage-CtcqAwlu.js +0 -2
  413. package/dist/client/assets/usageAccess-2Wks5kIN.js +0 -2
  414. package/dist/client/assets/usageFormat-BZJ9qCn4.js +0 -2
  415. package/dist/client/assets/useHandleNewThread-C6MtV3AM.js +0 -2
  416. package/dist/client/assets/usePopupViewport-D1lXH2SQ.js +0 -2
  417. package/dist/client/assets/usePullRequestActions-WFmep5Tm.js +0 -3
  418. package/dist/client/assets/useRegisterFieldControl-BtJcyaxh.js +0 -2
  419. package/dist/client/assets/useSettings-EYJbJzT3.js +0 -3
  420. package/dist/client/assets/utils-DjbLtxuo.js +0 -37
  421. package/dist/client/assets/vcsRefInvalidation-DkXoQApH.js +0 -2
  422. package/dist/client/assets/welcome-uKSqaFeK.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p4code/cli",
3
- "version": "0.9.15",
3
+ "version": "0.9.17",
4
4
  "description": "P4 Code coding agent server and command-line client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- export { i as runAcpMcpCliFastPath } from "./AcpMcpStdioBridge-BPNHFfTr.mjs";
@@ -1,2 +0,0 @@
1
- import{i as e}from"./DialogTitle-CFYK6V6-.js";function t(t){return e(t,`alert-dialog`)}export{t};
2
- //# sourceMappingURL=AlertDialogRoot-BI19p1Pb.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$_ as i,$u as a,Eb as o,Fx as s,Ib as c,Il as l,MC as u,O_ as d,Qt as f,ag as p,db as m,ed as h,jh as g,kh as _,lb as v,mr as y,og as b,rx as x,t as S,ub as C,ux as w,vb as T,vf as ee,wh as te,zx as ne}from"./utils-DjbLtxuo.js";import{q as re}from"./useSettings-EYJbJzT3.js";import{S as ie,r as ae,s as oe,t as se}from"./Icons-D_LFMxsj.js";var E=e(t(),1),D=n(),O=e(r(),1),k=6e4,A=60*k,j=24*A,M=`https://chatgpt.com/#settings/Usage`;function ce(e){return e?.auth.status===`authenticated`&&e.auth.subscriptionSharing===!0}var N=[{id:`totalPercentUsed`,label:`Overall`,description:`Combined usage across both allowances, not a third quota.`},{id:`autoPercentUsed`,label:`Cursor Models`,description:`Grok and Composer use this first. Auto can use either pool.`},{id:`apiPercentUsed`,label:`Other Models`,description:`Claude, GPT, and Gemini use this pool. Grok and Composer fall back here.`}];function le(e){return N.find(t=>t.id===e)}function P(e){let t=N.findIndex(t=>t.id===e);return t<0?N.length:t}function F(e){return e.filter(e=>e.enabled&&e.installed&&l(e)&&e.usageLimits!==void 0)}function ue(e){let t=new Map;for(let n of e.values())for(let e of F(n.serverConfig?.providers??[])){let r=e.usageLimits?.externalUsage;if(r&&e.auth.status===`authenticated`){let i=`${e.displayName??e.instanceId} on ${n.entry.target.label}`;t.set(r.url,{...r,message:e.usageLimits?.unavailable?.message,accounts:[...new Set([...t.get(r.url)?.accounts??[],i])]})}}return[...t.values()]}function I(e,t,n){let r=t?.trim().toLowerCase();return r?`${e}:${r}`:n?.credentialFingerprint?`${e}:credential:${n.credentialFingerprint}`:null}var L=e=>({driver:e.driver,email:e.auth.email,workspaceId:e.auth.workspaceId,usageLimits:e.usageLimits});function R(e){let t=new Map,n=new Map;for(let r of e){let e=I(r.driver,r.email,r.usageLimits);if(e&&r.workspaceId){t.set(e,(t.get(e)??new Set).add(r.workspaceId));let i=`${r.driver}:${r.workspaceId}`;n.set(i,(n.get(i)??new Set).add(e))}}return e=>{let r=I(e.driver,e.email,e.usageLimits);if(!r){if(!e.workspaceId)return null;let t=n.get(`${e.driver}:${e.workspaceId}`);return t?.size===1?`${[...t][0]}:${e.workspaceId}`:null}if(e.workspaceId)return`${r}:${e.workspaceId}`;let i=t.get(r);return i?i.size===1?`${r}:${[...i][0]}`:null:r}}function de(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=(e,a)=>{let o=r.get(e);a.redeem&&`sourceId`in a.redeem.input&&(!o||Date.parse(a.limits.checkedAt)>Date.parse(o.limits.checkedAt))&&r.set(e,a);let s=n.get(e);a.limits.resetCredits&&(!s||Date.parse(a.limits.checkedAt)>Date.parse(s.limits.checkedAt))&&n.set(e,a);let c=i.get(e);a.plan&&(!c||Date.parse(a.limits.checkedAt)>Date.parse(c.limits.checkedAt))&&i.set(e,a);let l=t.get(e);if(!l){t.set(e,a);return}let u=Date.parse(a.limits.checkedAt)>Date.parse(l.limits.checkedAt),d=[...l.environments,...a.environments.filter(e=>!l.environments.some(t=>t.environmentId===e.environmentId))],f=u?a:l,p=n.get(e);t.set(e,{...l,displayName:l.displayName??a.displayName,email:l.email??a.email,plan:i.get(e)?.plan??l.plan??a.plan,accentColor:l.accentColor??a.accentColor,environments:d,sourceLabel:d.length>0?null:l.sourceLabel??a.sourceLabel,redeem:r.get(e)?.redeem??(p?p.redeem:f.redeem??l.redeem??a.redeem),limits:{...f.limits,...p?.limits.resetCredits?{resetCredits:p.limits.resetCredits}:{resetCredits:void 0}}})},o=R([...e.values()].flatMap(e=>[...(e.serverConfig?.providers??[]).filter(e=>e.enabled).map(L),...(e.serverConfig?.usageLimitSources??[]).flatMap(e=>e.accounts)]));for(let[t,n]of e){let e=n.entry.target.label;for(let r of F(n.serverConfig?.providers??[]))r.usageLimits&&H(r.usageLimits)===null&&a(o(L(r))??`${t}:${r.instanceId}`,{key:`${t}:${r.instanceId}`,driver:r.driver,displayName:r.displayName?.trim()||null,email:r.auth.email,plan:r.auth.label,accentColor:r.accentColor,environments:[{environmentId:t,label:e}],sourceLabel:null,redeem:{environmentId:t,input:{instanceId:r.instanceId}},limits:r.usageLimits})}let s=e.size>1;for(let[t,n]of e)for(let e of n.serverConfig?.usageLimitSources??[]){let r=s?`${n.entry.target.label} · ${e.label}`:e.label;for(let n of e.accounts){if(H(n.usageLimits)!==null)continue;let i=`${e.id}:${n.id}${n.workspaceId?`:${n.workspaceId}`:``}`;a(o(n)??i,{key:i,driver:n.driver,displayName:n.email?null:n.id.replace(/\.json$/i,``),email:n.email,plan:n.plan,accentColor:void 0,environments:[],sourceLabel:r,redeem:n.usageLimits.resetCredits?.nextCreditId?{environmentId:t,input:{sourceId:e.id,accountId:n.id,creditId:n.usageLimits.resetCredits.nextCreditId}}:null,limits:n.usageLimits})}}return[...t.values()]}function fe(e){let t=(t,n)=>e.size>1?`${t} · ${n}`:n,n=[];for(let r of e.values()){let e=r.entry.target.label;for(let i of F(r.serverConfig?.providers??[])){if(i.usageLimits?.unavailable?.reason===`unsupported`)continue;let r=i.usageLimits?H(i.usageLimits):null,a=i.displayName?.trim()||String(i.driver);r&&n.push(`${t(e,a)}: ${r}`)}for(let i of r.serverConfig?.usageLimitSources??[])i.error?n.push(`${t(e,i.label)}: ${i.error}`):i.accounts.length===0&&n.push(`${t(e,i.label)}: No accounts reported.`)}return n}function pe(e){if(e.driver===`antigravity`)return[...e.windows].sort((e,t)=>Number(!e.id.startsWith(`gemini-`))-Number(!t.id.startsWith(`gemini-`))||e.id.replace(/-(5h|weekly|quota)$/,``).localeCompare(t.id.replace(/-(5h|weekly|quota)$/,``))||z[e.kind]-z[t.kind]);if(e.driver!==`cursor`)return e.windows;let t=e.windows.some(e=>e.id===`autoPercentUsed`),n=e.windows.some(e=>e.id===`apiPercentUsed`),r=t&&n;return e.windows.filter(e=>!r||e.id!==`totalPercentUsed`).sort((e,t)=>P(e.id)-P(t.id))}var z={session:0,weekly:1,monthly:2,other:3};function me(e,t){let n=new Map;for(let t of e){let e=n.get(t.driver);e?e.push(t):n.set(t.driver,[t])}return[...n].map(([e,n])=>{let r=n.flatMap(e=>e.limits.windows).sort((e,t)=>z[e.kind]-z[t.kind])[0],i=t=>{let n=t.limits.windows.find(t=>r&&V(e,t)===V(e,r));return(n?U(n):null)??1/0},a=[...n].sort((e,t)=>i(e)-i(t)||B(e).localeCompare(B(t))||e.key.localeCompare(t.key));return{driver:e,accounts:a,windows:he(a,t)}})}function B(e){return(e.displayName??e.email??e.key).toLowerCase()}function V(e,t){return e===`codex`?t.kind:`${t.kind}:${t.id}`}function he(e,t){let n=new Map;for(let t of e)for(let e of t.limits.windows){let r=V(t.driver,e),i=n.get(r)?.some(e=>e.account===t)?`${e.kind}:${e.id}`:r,a=n.get(i);a?a.push({account:t,window:e}):n.set(i,[{account:t,window:e}])}return[...n].map(([n,r])=>{let i=new Map(r.map(e=>[e.account.key,e])),a=r[0].window,o=r[0].account.driver===`codex`?n:a.id,s=r.reduce((e,t)=>e+t.window.usedPercent,0)/r.length,c=r.flatMap(e=>{let n=W(e.window,t);return n===null?[]:[{used:e.window.usedPercent,elapsed:n}]}),l=c.reduce((e,t)=>e+t.used,0)/c.length,u=c.length>0?c.reduce((e,t)=>e+t.elapsed,0)/c.length:null,d=r.flatMap(e=>{let t=U(e.window);return t===null?[]:[{member:e,at:t,restoresPercent:Math.round(e.window.usedPercent/r.length)}]}).sort((e,t)=>e.at-t.at);return{id:o,kind:a.kind,label:a.label,members:r,columns:e.map(e=>i.get(e.key)??{account:e,window:null}),usedPercent:Math.round(s),remainingPercent:Math.round(100-s),pace:u===null?null:G(l,u),resets:d}}).sort((e,t)=>z[e.kind]-z[t.kind])}function H(e){return e.unavailable?.reason===`unsupported`?e.unavailable.message??`This account has no subscription limits.`:e.unavailable?.reason===`probeFailed`?e.unavailable.message??`Could not read limits.`:e.windows.length===0?`No limits reported.`:null}function ge(e){return Math.round(100-Math.max(0,Math.min(100,e.usedPercent)))}function U(e){if(e.resetsAt===void 0)return null;let t=Date.parse(e.resetsAt);return Number.isFinite(t)?t:null}function W(e,t){let n=U(e);if(n===null||e.windowDurationMins===void 0)return null;let r=e.windowDurationMins*k;return r<=0?null:Math.max(0,Math.min(1,(r-(n-t))/r))}function _e(e,t){let n=W(e,t);return n===null?null:Math.round((1-n)*100)}function ve(e,t){let n=W(e,t);return n===null?null:G(e.usedPercent,n)}function G(e,t){let n=e-t*100;return n>5?`ahead`:n<-5?`under`:`on`}function K(e){let t=Math.max(0,e),n=Math.floor(t/j),r=Math.floor(t%j/A),i=Math.floor(t%A/k);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:`${i}m`}function ye(e,t){let n=U(e);return n===null?null:n<=t?`resets now`:n-t<k?`Resets momentarily`:`resets in ${K(n-t)}`}var be={name:`usage-limits`,description:`Show this provider's usage limits`};function xe(e){return e.trim().toLowerCase()===`/usage-limits`}function q(e,t,n){return F(t).some(t=>t.driver===e)||n.some(t=>t.accounts.some(t=>t.driver===e)||t.error!==void 0&&t.accounts.length===0)}function Se(e,t,n,r){let i=t.find(t=>t.instanceId===e);if(!i||!q(i.driver,t,n))return null;let a=F(t).filter(e=>e.driver===i.driver),o=R([...t.filter(e=>e.enabled).map(L),...n.flatMap(e=>e.accounts)]),c=new Set(a.flatMap(e=>{let t=o(L(e));return t&&e.usageLimits?.windows.length&&!e.usageLimits.unavailable?[t]:[]})),l=[],u=[];for(let e of a){if(!e.usageLimits)continue;let t=o(L(e)),r=n.flatMap(e=>e.accounts.map(t=>({source:e,account:t}))).filter(({account:e})=>t!==null&&o(e)===t&&e.usageLimits.resetCredits&&!H(e.usageLimits)).sort((e,t)=>Date.parse(t.account.usageLimits.checkedAt)-Date.parse(e.account.usageLimits.checkedAt))[0],i=r?.account.usageLimits.resetCredits?.nextCreditId,a=r&&(!e.usageLimits.resetCredits||Date.parse(r.account.usageLimits.checkedAt)>Date.parse(e.usageLimits.checkedAt));l.push({id:e.instanceId,driver:e.driver,label:`${e.displayName?.trim()||String(e.driver)} [${e.instanceId}]`,...e.auth.label?{plan:e.auth.label}:{},instanceId:e.instanceId,resetCreditInput:i&&r?{sourceId:r.source.id,accountId:r.account.id,creditId:i}:{instanceId:e.instanceId},...e.displayName?{displayName:e.displayName}:{},...e.accentColor?{accentColor:e.accentColor}:{},...e.auth.email?{email:e.auth.email}:{},limits:a?{...e.usageLimits,resetCredits:r.account.usageLimits.resetCredits}:e.usageLimits})}for(let e of n){let t=e.accounts.filter(e=>e.driver===i.driver);for(let n of t){let t=o(n);t&&c.has(t)||l.push({id:`${e.id}:${n.id}`,driver:n.driver,label:`${e.label} · ${n.id}`,sourceLabel:`CLI Proxy`,...n.usageLimits.resetCredits?.nextCreditId?{resetCreditInput:{sourceId:e.id,accountId:n.id,creditId:n.usageLimits.resetCredits.nextCreditId}}:{},...n.plan?{plan:n.plan}:{},...n.email?{email:n.email}:{},limits:n.usageLimits})}e.error&&(t.length>0||e.accounts.length===0)&&u.push(`${e.label}: ${e.error}`)}return{createdAt:s(ne(r)),accounts:l,notices:u}}function J(e){return e}function Ce(e){let t=new Map;for(let n of e){if(t.has(n.driverKind))throw Error(`Provider driver '${n.driverKind}' is defined more than once.`);t.set(n.driverKind,n)}return{definitions:e,get:e=>e===void 0?void 0:t.get(e)}}var we=T([`auto`,`binary`,`npx`,`uvx`]),Te=b({source:T([`registry`,`local`]).pipe(w(u(`registry`)),c({title:`ACP source`,providerSettingsForm:{control:`select`,options:[{value:`registry`,label:`ACP Registry`},{value:`local`,label:`Local command`}]}})),enabled:m.pipe(w(u(!0)),c({providerSettingsForm:{hidden:!0}})),agentId:v.pipe(w(u(``)),c({title:`Registry agent ID`,description:`Agent identifier from the official ACP Registry, for example 'devin'.`,providerSettingsForm:{placeholder:`devin`,clearWhenEmpty:`persist`}})),commandPath:v.pipe(w(u(``)),c({title:`Executable override`,description:`Executable on this environment. For registry agents, this overrides the distribution executable while keeping its arguments and environment.`,providerSettingsForm:{placeholder:`Registry default`,clearWhenEmpty:`omit`}})),commandArgs:C(o).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}})),authMethodId:v.pipe(w(u(``)),c({title:`Authentication method`,description:`Optional ACP authentication method ID. By default, the first agent-managed method is selected.`,providerSettingsForm:{placeholder:`auto`,clearWhenEmpty:`omit`}})),distribution:we.pipe(w(u(`auto`)),c({providerSettingsForm:{hidden:!0}})),customModels:C(o).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`source`,`agentId`,`commandPath`,`authMethodId`]}),Ee=J({driverKind:i.make(`acpRegistry`),label:`ACP Registry`,settingsSchema:Te,hasDefaultInstance:!1,icon:{viewBox:`0 0 576 220`,fill:{light:`#000000`,dark:`#FFFFFF`},paths:[{d:`M568.003 115.821L517.278 27.9661C507.183 10.4816 489.084 0.0227367 468.894 0.0227367C448.727 0.0227367 430.674 10.4361 420.556 27.8752L343.251 161.749H242.755C236.23 161.749 230.386 158.384 227.135 152.745C223.861 147.106 223.861 140.376 227.135 134.715L277.861 46.8603C281.112 41.2216 286.955 37.8338 293.481 37.8338C300.006 37.8338 305.827 41.1988 309.101 46.8603L312.125 52.0897C313.353 54.2042 315.604 55.5002 318.036 55.5002C320.469 55.5002 322.743 54.1815 323.948 52.067L337.385 28.5118C338.795 26.0335 338.522 22.9413 336.703 20.7586C325.699 7.57131 309.874 0 293.322 0C292.662 0 292.003 0 291.321 0.0454733C272.04 0.75031 254.76 11.1864 245.074 27.9434L200.215 105.657L155.81 29.1484C145.465 11.2092 126.594 0.0227367 106.608 0.0227367C105.949 0.0227367 105.289 0.0227367 104.607 0.06821C85.3265 0.773047 68.0467 11.2092 58.3608 27.9661L7.65806 115.821C-6.25678 139.899 -0.868187 168.82 21.05 187.759C29.8945 195.422 41.6039 199.628 54.0181 199.628H148.648C151.081 199.628 153.332 198.332 154.56 196.217L168.52 172.026C169.748 169.911 169.748 167.319 168.52 165.205C167.292 163.09 165.041 161.794 162.608 161.794H56.0417C49.5163 161.794 43.6729 158.429 40.4216 152.79C37.1475 147.152 37.1475 140.422 40.4216 134.76L91.1471 46.9057C94.3985 41.2671 100.242 37.8793 106.767 37.8793C113.293 37.8793 119.113 41.2443 122.387 46.9057L194.826 172.526C195.031 172.89 195.258 173.208 195.531 173.526C198.76 178.665 202.83 183.485 207.786 187.782C216.631 195.444 228.34 199.651 240.754 199.651H321.424L315.581 209.769C314.353 211.883 314.353 214.475 315.581 216.59C316.809 218.704 319.059 220 321.492 220H349.436C351.868 220 354.119 218.704 355.347 216.59L364.396 200.901L367.17 196.468C367.17 196.468 367.261 196.331 367.284 196.263L453.274 46.9285C456.525 41.2898 462.369 37.902 468.894 37.902C475.42 37.902 481.263 41.2671 484.514 46.9285L535.24 134.783C538.491 140.422 538.514 147.174 535.24 152.813C531.988 158.452 526.145 161.84 519.62 161.84H418.669C416.236 161.84 413.985 163.136 412.757 165.25L398.774 189.442C397.546 191.556 397.546 194.148 398.774 196.263C400.002 198.377 402.253 199.673 404.686 199.673H518.21C539.81 199.673 559.295 188.237 569.026 169.843C578.053 152.79 577.666 132.623 567.981 115.843L568.003 115.821Z`}]}}),De=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:x(v).pipe(c({providerSettingsForm:{hidden:!0}})),apiEndpoint:x(v).pipe(c({providerSettingsForm:{hidden:!0}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[]}),Oe=J({driverKind:i.make(`cursor`),label:`Cursor`,settingsSchema:De,environmentFields:[{name:`CURSOR_API_KEY`,label:`Cursor API key`,description:`Optional. Overrides browser sign-in for this provider.`,placeholder:`Paste API key`,sensitive:!0}],icon:{viewBox:`0 0 466.73 532.09`,fill:{light:`#26251E`,dark:`#EDECEC`},paths:[{d:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`}]}}),ke=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:p(`fx`).pipe(c({title:`Binary path`,description:`Path to the fx binary. All fx instances on this machine share its fx login.`,providerSettingsForm:{placeholder:`fx`,clearWhenEmpty:`omit`}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`]}),Ae=J({driverKind:i.make(`fx`),label:`fx`,settingsSchema:ke,icon:{viewBox:`166.241 0 155.861 156`,fill:{light:`#0F0F0F`,dark:`#F5F5F5`},paths:[{d:`M237.89 0C243.18 0 249.38 1.42 253.03 3.07L255.09 4.01L250.08 18.63L247.68 17.75C244.9 16.72 241.94 15.8 238.49 15.8C234.98 15.8 232.79 16.56 231.08 18.32C229.23 20.23 227.63 23.64 226.23 29.76L226.23 29.76L226.23 29.76L225.14 34.85H241.67L260.43 34.95L260.69 34.95L260.84 35.17L278.85 61.63L296.74 34.95H320.87L291.68 76.74L322.1 119.75H299.33L299.18 119.55L241.14 40.48L239.35 49.4H222.07L205.69 127.21C203.93 135.71 201.19 142.84 196.78 147.87C192.27 153.01 186.2 155.75 178.34 155.75C174.18 155.75 170.75 155.11 167.91 154.11L166.24 153.52V137.18L166.9 137.4L169.53 138.28C172.18 139.16 174.41 139.8 177.14 139.8C178.53 139.8 179.7 139.53 180.73 138.98C181.76 138.43 182.68 137.6 183.52 136.44C185.3 133.99 186.72 130.13 187.9 124.67L203.76 49.4H189.87L191.76 39.44L192.04 39.35L206.82 34.47L208.15 28.64C210.52 18.21 213.77 10.94 218.71 6.32C223.74 1.61 230.13 0 237.89 0ZM273.99 99.08L260.07 120.25H234.54L261 82.02L273.99 99.08Z`}]}}),je=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:p(`grok`).pipe(c({title:`Binary path`,description:`Path to the Grok CLI binary.`,providerSettingsForm:{placeholder:`grok`,clearWhenEmpty:`omit`}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`]}),Me=J({driverKind:i.make(`grok`),label:`Grok`,settingsSchema:je,icon:{viewBox:`0 0 24 24`,fill:{light:`#0F0F0F`,dark:`#F5F5F5`},paths:[{d:`M9.26905 15.284L17.2479 9.36086C17.6391 9.07047 18.1981 9.18374 18.3845 9.63478C19.3655 12.0135 18.9272 14.8721 16.9755 16.8349C15.0238 18.7976 12.3082 19.228 9.8261 18.2477L7.1146 19.5102C11.0037 22.1834 15.7263 21.5223 18.6774 18.5525C21.0182 16.1985 21.7432 12.9897 21.0653 10.0961L21.0714 10.1023C20.0884 5.85143 21.3131 4.15233 23.8218 0.677913C23.8812 0.595532 23.9406 0.513151 24 0.428711L20.6987 3.74866V3.73836L9.267 15.2861`},{d:`M7.62249 16.7237C4.83113 14.0422 5.3124 9.89222 7.69417 7.49905C9.45541 5.72786 12.341 5.00497 14.86 6.06768L17.5653 4.81138C17.0779 4.45714 16.4533 4.07613 15.7365 3.80839C12.4966 2.46764 8.6178 3.13492 5.98413 5.78141C3.45081 8.32904 2.65415 12.2463 4.02219 15.5889C5.04412 18.0871 3.36889 19.8541 1.68137 21.6377C1.08337 22.2699 0.483318 22.9022 0 23.5716L7.62045 16.7257`}]}}),Ne=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:p(`muse`).pipe(c({title:`Binary path`,description:`Path to the Muse Code binary on this environment. Sign in with muse login on that host.`,providerSettingsForm:{placeholder:`muse`,clearWhenEmpty:`omit`}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`]}),Pe=J({driverKind:i.make(`muse`),label:`Muse Code`,settingsSchema:Ne,badgeLabel:`Beta`,icon:{viewBox:`0 0 287.56 191`,fill:{light:`#0081fb`,dark:`#0081fb`},paths:[{d:`m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z`},{d:`m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z`,gradient:{x1:61,y1:117,x2:259,y2:127,stops:[{offset:0,color:`#0064e1`},{offset:.4,color:`#0064e1`},{offset:.83,color:`#0073ee`},{offset:1,color:`#0082fb`}]}},{d:`m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z`,gradient:{x1:45,y1:139,x2:45,y2:66,stops:[{offset:0,color:`#0082fb`},{offset:1,color:`#0064e0`}]}}]}}),Fe=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:p(`opencode`).pipe(c({title:`Binary path`,description:`Path to the OpenCode binary.`,providerSettingsForm:{placeholder:`opencode`,clearWhenEmpty:`omit`}})),serverUrl:v.pipe(w(u(``)),c({title:`Server URL`,description:`Leave blank to let P4 Code spawn the server when needed.`,providerSettingsForm:{placeholder:`http://127.0.0.1:4096`,clearWhenEmpty:`omit`}})),serverPassword:v.pipe(w(u(``)),c({title:`Server password`,description:`Stored in plain text on disk.`,providerSettingsForm:{control:`password`,placeholder:`Optional`,clearWhenEmpty:`omit`}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`serverUrl`,`serverPassword`]}),Ie=J({driverKind:i.make(`opencode`),label:`OpenCode`,settingsSchema:Fe,icon:{viewBox:`0 0 32 40`,fill:{light:`#211E1E`,dark:`#F1ECEC`},paths:[{d:`M24 32H8V16H24V32Z`,fill:{light:`#CFCECD`,dark:`#4B4646`}},{d:`M24 8H8V32H24V8ZM32 40H0V0H32V40Z`}]}}),Le=b({enabled:m.pipe(w(u(!1)),c({providerSettingsForm:{hidden:!0}})),binaryPath:p(`pi`).pipe(c({title:`Binary path`,description:`Path to the Pi coding agent binary.`,providerSettingsForm:{placeholder:`pi`,clearWhenEmpty:`omit`}})),launchArgs:v.pipe(w(u(``)),c({title:`Launch arguments`,description:`Additional CLI arguments passed to pi --mode rpc on session start.`,providerSettingsForm:{clearWhenEmpty:`omit`}})),customModels:C(d).pipe(w(u([])),c({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`launchArgs`]}),Re=J({driverKind:i.make(`pi`),label:`Pi`,settingsSchema:Le,icon:{viewBox:`165.29 165.29 469.43 469.43`,fill:{light:`#0F0F0F`,dark:`#F5F5F5`},paths:[{d:`M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z`,fillRule:`evenodd`},{d:`M517.36 400H634.72V634.72H517.36Z`}]}}),Y=Ce([{driverKind:i.make(`codex`),label:`Codex`,settingsSchema:g},{driverKind:i.make(`claudeAgent`),label:`Claude`,settingsSchema:_},Oe,Ae,Me,Ie,{driverKind:i.make(`antigravity`),label:`Antigravity`,settingsSchema:te},Pe,Re,Ee]);function ze(e){let t=(0,D.c)(24),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,E.useId)(),o=r.viewBox,s;t[4]===n?s=t[5]:(s=S(`fill-(--icon-light) dark:fill-(--icon-dark)`,n),t[4]=n,t[5]=s);let c;t[6]!==r.fill.dark||t[7]!==r.fill.light?(c={"--icon-light":r.fill.light,"--icon-dark":r.fill.dark},t[6]=r.fill.dark,t[7]=r.fill.light,t[8]=c):c=t[8];let l=c,u;t[9]!==a||t[10]!==r.paths?(u=r.paths.some(Ve)?(0,O.jsx)(`defs`,{children:r.paths.map((e,t)=>e.gradient?(0,O.jsx)(`linearGradient`,{id:`${a}-${t}`,x1:e.gradient.x1,y1:e.gradient.y1,x2:e.gradient.x2,y2:e.gradient.y2,gradientUnits:`userSpaceOnUse`,children:e.gradient.stops.map(Be)},e.d):null)}):null,t[9]=a,t[10]=r.paths,t[11]=u):u=t[11];let d;if(t[12]!==a||t[13]!==r.paths){let e;t[15]===a?e=t[16]:(e=(e,t)=>(0,O.jsx)(`path`,{d:e.d,fillRule:e.fillRule,fill:e.gradient?`url(#${a}-${t})`:void 0,"data-icon-detail":e.fill?!0:void 0,className:e.fill?`fill-(--path-light) dark:fill-(--path-dark)`:void 0,style:e.fill?{"--path-light":e.fill.light,"--path-dark":e.fill.dark}:void 0},e.d),t[15]=a,t[16]=e),d=r.paths.map(e),t[12]=a,t[13]=r.paths,t[14]=d}else d=t[14];let f;return t[17]!==r.viewBox||t[18]!==i||t[19]!==s||t[20]!==l||t[21]!==u||t[22]!==d?(f=(0,O.jsxs)(`svg`,{...i,viewBox:o,fill:`none`,"data-provider-package-icon":!0,className:s,style:l,children:[u,d]}),t[17]=r.viewBox,t[18]=i,t[19]=s,t[20]=l,t[21]=u,t[22]=d,t[23]=f):f=t[23],f}function Be(e){return(0,O.jsx)(`stop`,{offset:e.offset,stopColor:e.color},e.offset)}function Ve(e){return e.gradient}var He=`p4-acp-registry-icons-v1`,X=524288,Z=new Map;async function Q(e){if(!e.ok||e.redirected)throw Error(`ACP registry icon request failed.`);let t=e.headers.get(`content-type`)?.split(`;`,1)[0]?.trim()??``;if(!t.startsWith(`image/`))throw Error(`ACP registry icon was not an image.`);let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>X)throw Error(`ACP registry icon was too large.`);let r=await e.arrayBuffer();if(r.byteLength>X)throw Error(`ACP registry icon was too large.`);return new Blob([r],{type:t})}function Ue(e){if(h(e)!==e)return Promise.reject(Error(`ACP registry icon URL was not allowed.`));let t=Z.get(e);if(t)return t;let n=(async()=>{let t=null;if(typeof caches<`u`)try{t=await caches.open(He)}catch{}if(t!==null)try{let n=await t.match(e);if(n)return await Q(n)}catch{}let n=await fetch(e,{credentials:`omit`,redirect:`error`,referrerPolicy:`no-referrer`}),r=n.clone(),i=await Q(n);return await t?.put(e,r).catch(()=>void 0),i})();return Z.set(e,n),n.then(()=>Z.delete(e),()=>Z.delete(e)),n}function We(e){let t=(0,D.c)(24),{icon:n,className:r,fallbackClassName:i}=e,a=(0,E.useId)(),o;t[0]===n?o=t[1]:(o=h(n),t[0]=n,t[1]=o);let s=o,[c,l]=(0,E.useState)(null),u=c?.iconUrl===s?c:null,d=u?.source??null,f=u?.status??`loading`,p,m;t[2]===s?(p=t[3],m=t[4]):(p=()=>{if(s===null)return;let e=!0,t=null;return Ue(s).then(n=>{e&&(t=URL.createObjectURL(n),l({iconUrl:s,source:t,status:`loading`}))}).catch(()=>{e&&l(e=>e?.iconUrl===s?e:{iconUrl:s,source:s,status:`loading`})}),()=>{e=!1,t!==null&&URL.revokeObjectURL(t)}},m=[s],t[2]=s,t[3]=p,t[4]=m),(0,E.useEffect)(p,m);let g;t[5]===r?g=t[6]:(g=S(`relative flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-muted-foreground`,r),t[5]=r,t[6]=g);let _,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,O.jsx)(`feFlood`,{floodColor:`currentColor`}),v=(0,O.jsx)(`feComposite`,{in2:`SourceAlpha`,operator:`in`}),t[7]=_,t[8]=v):(_=t[7],v=t[8]);let y;t[9]===a?y=t[10]:(y=(0,O.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute size-0`,focusable:`false`,children:(0,O.jsx)(`defs`,{children:(0,O.jsxs)(`filter`,{id:a,colorInterpolationFilters:`sRGB`,children:[_,v]})})}),t[9]=a,t[10]=y);let b;t[11]!==i||t[12]!==f?(b=f===`loaded`?null:(0,O.jsx)(se,{className:S(`size-4`,i),"data-slot":`acp-icon-fallback`}),t[11]=i,t[12]=f,t[13]=b):b=t[13];let x;t[14]!==a||t[15]!==s||t[16]!==d||t[17]!==f?(x=d!==null&&f!==`failed`?(0,O.jsx)(`img`,{alt:``,className:S(`size-full object-contain`,f!==`loaded`&&`invisible absolute inset-0`),style:{filter:`url(#${a})`},decoding:`async`,referrerPolicy:`no-referrer`,src:d,onError:()=>{s!==null&&l(e=>e?.iconUrl===s&&e.source!==d?e:{iconUrl:s,source:d,status:`failed`})},onLoad:()=>{s!==null&&l({iconUrl:s,source:d,status:`loaded`})}}):null,t[14]=a,t[15]=s,t[16]=d,t[17]=f,t[18]=x):x=t[18];let C;return t[19]!==g||t[20]!==y||t[21]!==b||t[22]!==x?(C=(0,O.jsxs)(`span`,{"aria-hidden":!0,className:g,children:[y,b,x]}),t[19]=g,t[20]=y,t[21]=b,t[22]=x,t[23]=C):C=t[23],C}var $={[i.make(`codex`)]:ie,[i.make(`claudeAgent`)]:oe,[i.make(`antigravity`)]:ae},Ge={[i.make(`codex`)]:`text-black dark:text-white`,[i.make(`claudeAgent`)]:`text-[#d97757]`,[i.make(`antigravity`)]:`text-[#5b87bf]`};function Ke(e){let t=Y.get(e)?.icon;if(t)return{className:`text-(--icon-light) dark:text-(--icon-dark)`,style:{"--icon-light":t.fill.light,"--icon-dark":t.fill.dark}};let n=Ge[e];return n?{className:n}:{}}function qe(e){return e.driverKind===`acpRegistry`?h(e.iconUrl??null)??a(e.agentId?.trim()||null):null}var Je=(0,E.memo)(function(e){let t=(0,D.c)(32),n=$[e.driverKind]??null,r=Y.get(e.driverKind)?.icon,i=e.indicatorBackground??`var(--card)`,a;t[0]===e.accentColor?a=t[1]:(a=e.accentColor?{"--provider-accent":e.accentColor}:void 0,t[0]=e.accentColor,t[1]=a);let o=a,s=e.badgeContent??`initials`,c=e.driverKind===`acpRegistry`,l;t[2]!==e.acpRegistryAgentId||t[3]!==e.acpRegistryIconUrl||t[4]!==e.driverKind?(l=qe({driverKind:e.driverKind,agentId:e.acpRegistryAgentId,iconUrl:e.acpRegistryIconUrl}),t[2]=e.acpRegistryAgentId,t[3]=e.acpRegistryIconUrl,t[4]=e.driverKind,t[5]=l):l=t[5];let u=l,d;t[6]===e.className?d=t[7]:(d=S(`relative isolate z-30 inline-flex shrink-0 items-center justify-center overflow-visible`,e.className),t[6]=e.className,t[7]=d);let p;t[8]!==n||t[9]!==u||t[10]!==c||t[11]!==r||t[12]!==e.displayName||t[13]!==e.iconClassName?(p=c?(0,O.jsx)(We,{className:S(`size-5 rounded-none bg-transparent`,e.iconClassName),fallbackClassName:`size-full`,icon:u}):r?(0,O.jsx)(ze,{icon:r,className:S(`size-5 shrink-0`,e.iconClassName),"aria-hidden":!0}):n?(0,O.jsx)(n,{className:S(`size-5 shrink-0`,e.iconClassName),"aria-hidden":!0}):(0,O.jsx)(`span`,{className:S(`text-3xs font-semibold leading-none`,e.iconClassName),children:f(e.displayName)}),t[8]=n,t[9]=u,t[10]=c,t[11]=r,t[12]=e.displayName,t[13]=e.iconClassName,t[14]=p):p=t[14];let m;t[15]!==i||t[16]!==e.statusDotClassName?(m=e.statusDotClassName?(0,O.jsx)(`span`,{className:S(`pointer-events-none absolute -left-0.5 -top-0.5 z-10 size-2 rounded-full`,e.statusDotClassName),style:{boxShadow:`0 0 0 2px ${i}`},"aria-hidden":!0}):null,t[15]=i,t[16]=e.statusDotClassName,t[17]=m):m=t[17];let h;t[18]!==s||t[19]!==i||t[20]!==e.accentColor||t[21]!==e.badgeClassName||t[22]!==e.displayName||t[23]!==e.showBadge?(h=e.showBadge?(0,O.jsx)(`span`,{className:S(`pointer-events-none absolute right-0 bottom-0 z-10 flex h-3.5 min-w-3.5 items-center justify-center rounded-full border px-0.5 text-4xs font-semibold leading-none shadow-sm`,e.accentColor?`bg-(--provider-accent) text-white`:`bg-card text-muted-foreground`,e.badgeClassName),style:{borderColor:i},"aria-hidden":!0,children:s===`initials`?f(e.displayName):null}):null,t[18]=s,t[19]=i,t[20]=e.accentColor,t[21]=e.badgeClassName,t[22]=e.displayName,t[23]=e.showBadge,t[24]=h):h=t[24];let g;return t[25]!==o||t[26]!==e.accentColor||t[27]!==d||t[28]!==p||t[29]!==m||t[30]!==h?(g=(0,O.jsxs)(`span`,{className:d,style:o,"data-provider-accent-color":e.accentColor,children:[p,m,h]}),t[25]=o,t[26]=e.accentColor,t[27]=d,t[28]=p,t[29]=m,t[30]=h,t[31]=g):g=t[31],g});function Ye(e){let t=(0,D.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,O.jsx)(ee,{className:`size-3.5`,"aria-hidden":`true`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,O.jsxs)(y,{variant:`ghost-muted`,size:`sm`,...e,onClick:Xe,children:[`Manage usage`,n]}),t[1]=e,t[2]=r),r}function Xe(){re().shell.openExternal(M)}export{ce as S,xe as _,M as a,_e as b,de as c,Se as d,le as f,q as g,ye as h,Y as i,fe as l,K as m,Je as n,be as o,pe as p,Ke as r,ue as s,Ye as t,me as u,H as v,ge as x,ve as y};
2
- //# sourceMappingURL=ChatGptUsageButton-BldpBXxU.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{Bn as r,Do as i,Eo as a,Fo as o,Gn as s,Ha as ee,Ma as te,Mo as c,No as l,Oa as u,Oo as d,Pa as f,Po as p,Ta as m,Un as h,Wa as g,Xa as _,ca as v,jo as ne,kr as re,la as ie,po as ae,qa as oe}from"./utils-DjbLtxuo.js";import{t as se}from"./useRegisterFieldControl-BtJcyaxh.js";import{t as ce}from"./FormContext-BcA1kdFD.js";import{t as le}from"./useAriaLabelledBy-BJnK5b5h.js";import{t as ue}from"./FieldItemContext-sr3mCd2v.js";var y=e(t()),b=y.createContext(void 0);function de(e=!0){let t=y.useContext(b);if(t===void 0&&!e)throw Error(o(3));return t}function fe(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var x=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function S(e){return y.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[x.checked]:``}:{[x.unchecked]:``}},...s}),[e.indeterminate])}var C=y.createContext(void 0);function w(){let e=y.useContext(C);if(e===void 0)throw Error(o(14));return e}var T=e(n()),pe=`data-parent`,me=y.forwardRef(function(e,t){let{checked:n,className:a,defaultChecked:o=!1,"aria-labelledby":s,disabled:u=!1,form:m,id:b,indeterminate:x=!1,inputRef:w,name:me,onCheckedChange:he,parent:E=!1,readOnly:D=!1,render:ge,required:O=!1,uncheckedValue:k,value:A,nativeButton:j=!1,style:_e,...ve}=e,{clearErrors:ye}=ce(),{disabled:be,name:xe,setDirty:Se,setFilled:M,setFocused:N,setTouched:Ce,state:P,validationMode:we,validityData:Te,shouldValidateOnChange:Ee,validation:De}=h(),Oe=ue(),{labelId:ke,controlId:Ae,registerControlId:F,getDescriptionProps:I}=r(),L=de(),R=L?.parent,z=R&&L.allValues,B=be||Oe.disabled||L?.disabled||u,V=xe??me,H=A??V,je=f(),Me=f(),U=Ae;z?U=E?Me:`${R.id}-${H}`:b&&(U=b);let W={};z&&(E?W=L.parent.getParentProps():H&&(W=L.parent.getChildProps(H)));let{checked:Ne=n,indeterminate:G=x,onCheckedChange:Pe,...Fe}=W,K=L?.value,Ie=L?.setValue,Le=L?.defaultValue,q=y.useRef(null),J=p(()=>Symbol(`checkbox-control`)),Y=y.useRef(!1),{getButtonProps:Re,buttonRef:ze}=ee({disabled:B,native:j}),X=L?.validation??De,[Z,Be]=_({controlled:H&&K&&!E?K.includes(H):Ne,default:H&&Le&&!E?Le.includes(H):o,name:`Checkbox`,state:`checked`});g(()=>{F!==c&&(Y.current=!0,F(J.current,U))},[U,F,J]),y.useEffect(()=>{let e=J.current;return()=>{Y.current&&F!==c&&(Y.current=!1,F(e,void 0))}},[F,J]),se(q,je,Z,void 0,!L);let Q=y.useRef(null),Ve=l(w,Q,X.inputRef),He=le(s,ke,Q,!j,U??void 0);g(()=>{Q.current&&(Q.current.indeterminate=G,Z&&M(!0))},[Z,G,M]),re(Z,()=>{(!L||E)&&(ye(V),M(Z),Se(Z!==Te.initialValue),Ee()?X.commit(Z):X.commit(Z,!0))});let Ue=d({checked:Z,disabled:B,form:m,name:E?void 0:V,id:j?void 0:U??void 0,required:O,ref:Ve,style:V?ie:v,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(D){e.preventDefault();return}let t=e.currentTarget.checked,n=te(ae,e.nativeEvent);if(Pe?.(t,n),he?.(t,n),!n.isCanceled&&(Be(t),H&&K&&Ie&&!E&&!z)){let e=t?[...K,H]:K.filter(e=>e!==H);Ie(e,n)}},onFocus(){q.current?.focus()}},A===void 0?ne:{value:(L?Z&&A:A)||``},I,L?X.getValidationProps:X.getInputValidationProps),We=z?!!Ne:Z,Ge=z&&G||x;y.useEffect(()=>{if(!R||!H)return;let e=R.disabledStatesRef.current;return e.set(H,B),()=>{e.delete(H)}},[R,B,H]);let $=y.useMemo(()=>({...P,checked:We,disabled:B,readOnly:D,required:O,indeterminate:Ge}),[P,We,B,D,O,Ge]),Ke=S($),qe=i(`span`,e,{state:$,ref:[ze,q,t,L?.registerControlRef],props:[{id:j?U??void 0:je,role:`checkbox`,"aria-checked":G?`mixed`:Z,"aria-readonly":D||void 0,"aria-required":O||void 0,"aria-labelledby":He,[pe]:E?``:void 0,onFocus(){N(!0)},onBlur(){let e=Q.current;e&&(Ce(!0),N(!1),we===`onBlur`&&X.commit(L?K:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),oe(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||fe(t)?.click()})},onClick(e){if(D||B)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(oe(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},I,X.getValidationProps,ve,Fe,Re],stateAttributesMapping:Ke});return(0,T.jsxs)(C.Provider,{value:$,children:[qe,!Z&&!L&&V&&!E&&k!==void 0&&(0,T.jsx)(`input`,{type:`hidden`,form:m,name:V,value:k}),(0,T.jsx)(`input`,{...Ue,suppressHydrationWarning:!0})]})}),he=y.forwardRef(function(e,t){let{render:n,className:r,style:o,keepMounted:ee=!1,...te}=e,c=w(),l=c.checked||c.indeterminate,{mounted:d,transitionStatus:f,setMounted:p}=u(l),h=y.useRef(null),g={...c,transitionStatus:f};m({open:l,ref:h,onComplete(){l||p(!1)}});let _={...S(c),...a,...s},v=ee||d,ne=i(`span`,e,{ref:[t,h],state:g,stateAttributesMapping:_,props:te});return v?ne:null});export{me as n,he as t};
2
- //# sourceMappingURL=CheckboxIndicator-C4iAbUMh.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Bc as i,Do as a,ud as o}from"./utils-DjbLtxuo.js";import{a as s,i as c,l,n as u,o as d,r as f,s as p}from"./TooltipProvider-Czzm7ro-.js";import{t as m}from"./usePopupViewport-D1lXH2SQ.js";var h=e(t()),g=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),_={activationDirection:e=>e?{"data-activation-direction":e}:null},v=h.forwardRef(function(e,t){let{render:n,className:r,style:i,children:o,...s}=e,u=l(),d=c(),f=u.useState(`instantType`),{children:p,state:h}=m({store:u,side:d.side,cssVars:g,children:o}),v={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:f};return a(`div`,e,{state:v,ref:t,props:[s,{children:p}],stateAttributesMapping:_})}),y=n();function b(...e){return i(o(e))}var x=e(r(),1),S=p;function C(e){let t=(0,y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,x.jsx)(d,{"data-slot":`tooltip-trigger`,...e}),t[0]=e,t[1]=n),n}function w(e){let t=(0,y.c)(28),n,r,i,a,o,c,l,d,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],d=t[8],p=t[9]):({className:i,positionerClassName:a,align:c,sideOffset:l,side:d,variant:p,anchor:n,children:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=d,t[9]=p);let m=c===void 0?`center`:c,h=l===void 0?4:l,g=d===void 0?`top`:d,_=p===void 0?`default`:p,S;t[10]===a?S=t[11]:(S=b(`pointer-events-none z-[70] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,a),t[10]=a,t[11]=S);let C=_===`glass`?`dropdown-glass shadow-xl shadow-black/25 before:hidden`:`border bg-popover not-dark:bg-clip-padding shadow-md/5`,w;t[12]!==i||t[13]!==C?(w=b(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md text-popover-foreground text-xs transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,C,i),t[12]=i,t[13]=C,t[14]=w):w=t[14];let T;t[15]===r?T=t[16]:(T=(0,x.jsx)(v,{className:`relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,"data-slot":`tooltip-viewport`,children:r}),t[15]=r,t[16]=T);let E;t[17]!==o||t[18]!==w||t[19]!==T?(E=(0,x.jsx)(u,{className:w,"data-slot":`tooltip-popup`,...o,children:T}),t[17]=o,t[18]=w,t[19]=T,t[20]=E):E=t[20];let D;return t[21]!==m||t[22]!==n||t[23]!==g||t[24]!==h||t[25]!==S||t[26]!==E?(D=(0,x.jsx)(s,{children:(0,x.jsx)(f,{align:m,anchor:n,className:S,"data-slot":`tooltip-positioner`,side:g,sideOffset:h,children:E})}),t[21]=m,t[22]=n,t[23]=g,t[24]=h,t[25]=S,t[26]=E,t[27]=D):D=t[27],D}var T=e=>!!(e&&e.scrollWidth>e.clientWidth);function E(e,t){let n=(0,y.c)(5),[r,i]=(0,h.useState)(!1),a;n[0]===e?a=n[1]:(a=()=>{let t=e.current;if(!t)return;let n=()=>i(T(t));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},n[0]=e,n[1]=a);let o;return n[2]!==e||n[3]!==t?(o=[e,t],n[2]=e,n[3]=t,n[4]=o):o=n[4],(0,h.useLayoutEffect)(a,o),r}function D(e){let t=(0,y.c)(15),{children:n,full:r,className:i}=e,a=r===void 0?n:r,o=i===void 0?`design-truncate`:i,s=(0,h.useRef)(null),c=E(s,n),[l,u]=(0,h.useState)(!1),d=l&&c,f;t[0]===c?f=t[1]:(f=e=>u(e&&c),t[0]=c,t[1]=f);let p=c?0:void 0,m;t[2]!==o||t[3]!==p?(m=(0,x.jsx)(`span`,{ref:s,className:o,tabIndex:p}),t[2]=o,t[3]=p,t[4]=m):m=t[4];let g;t[5]!==n||t[6]!==m?(g=(0,x.jsx)(C,{render:m,children:n}),t[5]=n,t[6]=m,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=(0,x.jsx)(w,{children:a}),t[8]=a,t[9]=_);let v;return t[10]!==d||t[11]!==f||t[12]!==g||t[13]!==_?(v=(0,x.jsxs)(S,{open:d,onOpenChange:f,children:[g,_]}),t[10]=d,t[11]=f,t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function O(e){let t=(0,y.c)(12),{full:n,labelRef:r,render:i,children:a}=e,[o,s]=(0,h.useState)(!1),c;t[0]===r?c=t[1]:(c=e=>s(e&&T(r.current)),t[0]=r,t[1]=c);let l;t[2]!==a||t[3]!==i?(l=(0,x.jsx)(C,{render:i,children:a}),t[2]=a,t[3]=i,t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=(0,x.jsx)(w,{children:n}),t[5]=n,t[6]=u);let d;return t[7]!==o||t[8]!==c||t[9]!==l||t[10]!==u?(d=(0,x.jsxs)(S,{open:o,onOpenChange:c,children:[l,u]}),t[7]=o,t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}export{C as a,w as i,O as n,b as o,S as r,D as t};
2
- //# sourceMappingURL=ClippedText-TtLeyAVc.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$_ as i,Bd as a,ME as o,Ud as s,Wb as c,_v as l,ev as u,is as d,jh as f,kh as p,l as m,mr as h,t as g,vf as _}from"./utils-DjbLtxuo.js";import{Tr as v,br as y}from"./runtime-BBYIQ0f-.js";import{C as b,S as x,f as ee,k as te,q as S}from"./useSettings-EYJbJzT3.js";import{f as C}from"./server-Dkj4NeYG.js";import{i as w,n as ne}from"./session-CBEVNHld.js";import{n as re}from"./query-D3KVoW9G.js";import{t as T}from"./use-atom-command-BbFDhw_c.js";import{n as E,t as D}from"./radio-group-BnZVD-CO.js";import{t as ie}from"./input-CQaedaQh.js";import{a as O,c as k,i as A,r as j,s as M,t as ae}from"./dialog-DTVhbEqi.js";import{S as N}from"./Icons-D_LFMxsj.js";import{t as P}from"./preview-B4_sjsUX.js";import{S as F,t as oe}from"./ChatGptUsageButton-BldpBXxU.js";import{t as I}from"./RedactedSensitiveText-B-u4PB3I.js";import{a as se}from"./settingsLayout-BbEwQ6Fy.js";import{Da as ce,Oa as le,_o as ue,fo as L,ho as de,mo as fe,po as R,vo as pe}from"./main-B1sXOjZZ.js";var z=e(t(),1),B=n(),V=e(r(),1);function me(e){let t=(0,B.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,V.jsx)(N,{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,V.jsxs)(h,{...r,children:[i,a]}),t[4]=r,t[5]=a,t[6]=o):o=t[6],o}function he(e){let t=(0,B.c)(23),{open:n,methods:r,onClose:i,onSelect:a}=e,o=r.filter(_e),[s,c]=(0,z.useState)(null),l=s===`chatgpt-change-account`?s:o.find(e=>e.id===s)?.id??o[0]?.id??`chatgpt-change-account`,u=ae,d;t[0]===i?d=t[1]:(d=e=>{e||i()},t[0]=i,t[1]=d);let f=M,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,V.jsxs)(O,{children:[(0,V.jsx)(k,{children:`Reconnect ChatGPT`}),(0,V.jsx)(j,{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(ge),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,V.jsx)(D,{value:`chatgpt-change-account`}),(0,V.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,V.jsx)(`div`,{className:`px-6 pb-6`,children:(0,V.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,V.jsx)(A,{children:(0,V.jsx)(me,{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,V.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,V.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 ge(e){return(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-sm`,children:[(0,V.jsx)(D,{value:e.id}),(0,V.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.name})]},e.id)}function _e(e){return e.id.startsWith(`chatgpt-profile:`)}function ve(e){let t=(0,B.c)(58),{environmentId:n,onClose:r,renderSetup:a,onAccountCreated:o}=e,s=w(n,l),c=ee(n),f;t[0]===n?f=t[1]:(f=C.providersValueAtom(n),t[0]=n,t[1]=f);let p=d(f),g=T(C.updateSettings,`Add ChatGPT account`),[_,v]=(0,z.useState)(`Personal`),y;t[2]===_?y=t[3]:(y=_.trim(),t[2]=_,t[3]=y);let b=`ChatGPT - ${y}`,[x,te]=(0,z.useState)(null),[S,re]=(0,z.useState)(!1),E,D,O,k,A,j,M,N,P;if(t[4]!==b||t[5]!==n||t[6]!==x||t[7]!==_||t[8]!==o||t[9]!==r||t[10]!==S||t[11]!==p||t[12]!==a||t[13]!==c||t[14]!==g){let e=p?.find(e=>e.instanceId===x),s=F(e),l;t[24]!==b||t[25]!==n||t[26]!==_||t[27]!==o||t[28]!==r||t[29]!==S||t[30]!==c||t[31]!==g?(l=async()=>{if(S||!_.trim()||!ne(n,`providers:manage`))return;re(!0);let e=u.make(`codex_${m()}`);(await g({environmentId:n,input:{patch:{providerInstances:{...c.providerInstances,[e]:{driver:i.make(`codex`),displayName:b,enabled:!0,config:{enabled:!0,setupMode:`managed`}}}}}}))._tag===`Success`&&(o?(o(e,b),r()):te(e)),re(!1)},t[24]=b,t[25]=n,t[26]=_,t[27]=o,t[28]=r,t[29]=S,t[30]=c,t[31]=g,t[32]=l):l=t[32];let d=l;O=ae,M=!s,t[33]===r?N=t[34]:(N=e=>{e||r()},t[33]=r,t[34]=N),P=e=>{!e&&s&&r()},D=de,A=`wide`;let f=x?b:`Add ChatGPT account`;t[35]===f?j=t[36]:(j=(0,V.jsx)(R,{title:f,description:`Each account has its own Codex instance and sign-in. Choose the other account on the sign-in page.`}),t[35]=f,t[36]=j),E=fe,k=x?e?.setup?a(x,e):(0,V.jsx)(se,{title:`Codex runtime`,description:`Preparing managed setup.`}):(0,V.jsx)(`form`,{id:`add-codex-account`,onSubmit:e=>{e.preventDefault(),d()},children:(0,V.jsx)(se,{title:`Account name`,description:`Shown in the provider list and model picker.`,control:(0,V.jsx)(ie,{"aria-label":`Account name`,value:_,disabled:S,onChange:e=>v(e.target.value),placeholder:`e.g. Personal or Work`})})}),t[4]=b,t[5]=n,t[6]=x,t[7]=_,t[8]=o,t[9]=r,t[10]=S,t[11]=p,t[12]=a,t[13]=c,t[14]=g,t[15]=E,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=j,t[21]=M,t[22]=N,t[23]=P}else E=t[15],D=t[16],O=t[17],k=t[18],A=t[19],j=t[20],M=t[21],N=t[22],P=t[23];let oe;t[37]!==E||t[38]!==k?(oe=(0,V.jsx)(E,{children:k}),t[37]=E,t[38]=k,t[39]=oe):oe=t[39];let I;t[40]!==s||t[41]!==x||t[42]!==_||t[43]!==r||t[44]!==S?(I=(0,V.jsx)(L,{children:x?(0,V.jsx)(h,{variant:`outline`,onClick:r,children:`Finish later`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(h,{variant:`outline`,disabled:S,onClick:r,children:`Cancel`}),(0,V.jsx)(h,{type:`submit`,form:`add-codex-account`,disabled:S||!_.trim()||!s,children:S?`Adding account…`:`Continue`})]})}),t[40]=s,t[41]=x,t[42]=_,t[43]=r,t[44]=S,t[45]=I):I=t[45];let ce;t[46]!==D||t[47]!==I||t[48]!==A||t[49]!==j||t[50]!==oe?(ce=(0,V.jsxs)(D,{size:A,children:[j,oe,I]}),t[46]=D,t[47]=I,t[48]=A,t[49]=j,t[50]=oe,t[51]=ce):ce=t[51];let le;return t[52]!==O||t[53]!==ce||t[54]!==M||t[55]!==N||t[56]!==P?(le=(0,V.jsx)(O,{open:M,onOpenChange:N,onOpenChangeComplete:P,children:ce}),t[52]=O,t[53]=ce,t[54]=M,t[55]=N,t[56]=P,t[57]=le):le=t[57],le}var ye=c(p),be=c(f),xe=/^[A-Za-z0-9_./:\\-]+$/;function Se(e,t,n){return xe.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 Ce(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 H={checking:0,disabled:1,install:2,attention:3,signIn:4,ready:5};function U(e){let t=new Map;for(let n of e??[]){let e=t.get(n.driver);(e===void 0||H[Ce(n)]>H[Ce(e)])&&t.set(n.driver,n)}return t}var we={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 Te(e,t){let n=we[e];return t===`windows`?n.windows:n.posix}function Ee(e,t,n){let r=t.providerInstances[e.instanceId];if(e.driver===`claudeAgent`){let e=ye(r?.config??{});return`${Se(o(e)?e.value.binaryPath:`claude`,`claude`,n)} auth login`}if(e.driver===`codex`){let e=be(r?.config??{});return`${Se(o(e)?e.value.binaryPath:`codex`,`codex`,n)} login`}return e.driver}var De={disabled:{dot:`bg-muted-foreground/50`},error:{dot:`bg-destructive`},ready:{dot:`bg-success`},warning:{dot:`bg-warning`}};function W(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 Oe(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 ke={graceful:`Limited support`,unsupported:`Unsupported version`,broken:`Known broken version`};function Ae(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=Oe(n)??t.recommendedRange;return{title:ke[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=Oe(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 je=()=>void 0;function Me(e){let t=(0,B.c)(11),[n,r]=(0,z.useState)(!1),i;t[0]===e.provider?i=t[1]:(i=Ce(e.provider),t[0]=e.provider,t[1]=i);let o=i,s=e.enabled&&o===`ready`,c=e.provider?.auth.status===`authenticated`,l=o===`checking`,u;t[2]===e.provider?u=t[3]:(u=W(e.provider),t[2]=e.provider,t[3]=u);let d=u,f;return t[4]!==c||t[5]!==l||t[6]!==s||t[7]!==d||t[8]!==e||t[9]!==n?(f=e.mode===`existing`&&e.presentation===`onboarding`?(0,V.jsx)(Ie,{title:e.displayName||e.provider?.displayName||`Codex`,description:s?e.provider?.auth.email?.trim()?(0,V.jsxs)(V.Fragment,{children:[`Signed in as`,` `,(0,V.jsx)(I,{value:e.provider.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`,className:`break-all`}),`.`]}):`Connected with your Codex CLI.`:l?`Checking your Codex CLI...`:e.provider?.installed?d.headline:`Code with your ChatGPT subscription.`,control:s?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,V.jsx)(a,{className:`size-3.5`}),`Ready`]}):l?(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Checking...`}):c?(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d.headline}):(0,V.jsx)(me,{size:`sm`,disabled:e.readOnly,onClick:()=>{r(!0),e.onModeChange(`managed`)},children:`Continue with ChatGPT`}),secondaryControl:!c&&!s&&!l?(0,V.jsx)(h,{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,V.jsx)(Ie,{title:e.displayName||e.provider?.displayName||`Codex`,description:(0,V.jsx)(Fe,{}),control:(0,V.jsx)(h,{size:`sm`,variant:`outline`,className:`min-w-44`,disabled:!0,children:`Open sign-in page`}),secondaryControl:(0,V.jsx)(h,{size:`sm`,variant:`ghost-muted`,disabled:!0,children:`Cancel`})}):(0,V.jsx)(se,{title:`ChatGPT account`,description:`Preparing sign-in.`}):(0,V.jsx)(Pe,{...e,autoStart:n||e.autoStart===!0,onAutoStartConsumed:()=>{r(!1),e.onAutoStartConsumed?.()}},`${e.environmentId}:${e.instanceId}`),t[4]=c,t[5]=l,t[6]=s,t[7]=d,t[8]=e,t[9]=n,t[10]=f):f=t[10],f}function Ne(e){let t=(0,B.c)(9),{environmentId:n,onClose:r,onAccountCreated:i}=e,a=w(n,l),o;t[0]!==a||t[1]!==n||t[2]!==r?(o=(e,t)=>(0,V.jsx)(Pe,{environmentId:n,instanceId:e,provider:t,mode:`managed`,enabled:!0,readOnly:!a,autoStart:!0,onAutoStartConsumed:je,onModeChange:je,onSignInCancelled:r,allowExistingCli:!1},e),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==i||t[6]!==r||t[7]!==o?(s=(0,V.jsx)(ve,{environmentId:n,onClose:r,onAccountCreated:i,renderSetup:o}),t[4]=n,t[5]=i,t[6]=r,t[7]=o,t[8]=s):s=t[8],s}function Pe({environmentId:e,instanceId:t,provider:n,enabled:r,readOnly:i,onModeChange:o,autoStart:s,onAutoStartConsumed:c,allowExistingCli:l=!0,presentation:u,displayName:d,onSignInCancelled:f}){let p={environmentId:e,input:{instanceId:t}},m=re(C.providerAuthState(p)),ee=re(C.providerInstallState(p)),[w,ne]=(0,z.useState)(null),E=re(w?C.chatGptHandoffState(w):null),D=E.data?.phase===`auth`?E.data.state:m.data,[O,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(`chatgpt`),M=D?.methods?.find(e=>e.id===`chatgpt`)?.accountEmail,ae=D?.methods?.find(e=>e.id===A)?.accountEmail,N=D?.methods?.some(e=>e.id.startsWith(`chatgpt-profile:`)),F=D?.interaction?.type===`browser`?D.interaction.url:D?.authorizationUrl,L=ee.data,de=b(e),fe=de!==null&&P(new URL(de).hostname),R={reportFailure:!1,reportDefect:!1},B=T(C.startProviderAuth,R),ge=T(C.refreshProviders,R),_e=T(C.completeProviderAuth,R),ve=T(C.cancelProviderAuth,R),ye=T(C.logoutProviderAuth,R),be=T(C.startProviderInstall,R),xe=T(C.cancelProviderInstall,R),Se=T(C.chatGptReconnectProfile,R),Ce=T(C.chatGptImportProfile,R),H=!w&&(!fe||window.desktopBridge?.receiveProviderAuthCallback!==void 0),U=H&&!window.desktopBridge?.receiveProviderAuthCallback,we=te(),Te=x(we),Ee=b(we),De=!fe&&we&&Te?.connection.phase===`connected`&&Ee&&P(new URL(Ee).hostname)&&(window.desktopBridge!==void 0||P(window.location.hostname))?we:null,W=new URL(window.location.href);W.pathname===`/welcome`&&(W.hash=`agents:${e}`),W.pathname===`/settings/providers`&&W.searchParams.set(`instanceId`,t);let Oe=U,ke=(0,z.useId)(),[Ae,je]=(0,z.useState)(!1),[Me,Ne]=(0,z.useState)({flowId:``,value:``}),Pe=Me.flowId===D?.flowId?Me.value:``,[G,Le]=(0,z.useState)(!1),[Re,ze]=(0,z.useState)(null),Be=(0,z.useRef)(!1),[Ve,He]=(0,z.useState)(null),K=(0,z.useRef)(null),Ue=(0,z.useRef)(!1),We=(0,z.useRef)(null),[Ge,Ke]=(0,z.useState)(!1),q=L?.installedVersion!=null,J=n?.auth.status===`authenticated`,qe=q&&L?.source!==`local`&&L?.version!=null&&L.version!==L.installedVersion,Je=Re!==null&&!J&&(D?.phase===`succeeded`||Re===`handoff`);(0,z.useEffect)(()=>{(J||D?.phase===`failed`||D?.phase===`cancelled`)&&ze(null)},[J,D?.phase]),(0,z.useEffect)(()=>{Re&&D?.phase===`succeeded`&&ge({environmentId:e,input:{instanceId:t}})},[Re,D?.phase,ge,e,t]);let Ye=s&&!Ge,Xe=Re===`sign-in`&&!J&&(D===null||D.phase===`idle`),Ze=Je||Xe||w!==null||D?.phase===`starting`||D?.phase===`waiting`||D?.phase===`verifying`,Y=L?.phase===`downloading`||L?.phase===`extracting`||L?.phase===`verifying`,X=Ye||Ze||G&&!Y,Z=i||!r||G||m.error!==null||ee.error!==null,Q=G||Ze||Y,$=(0,z.useCallback)(async(e,t)=>{if(Be.current)return!1;Be.current=!0,Le(!0),He(null);let n=!1;try{let r=await e();if(r._tag===`Failure`){if(!y(r)){let e=v(r);He(e instanceof Error?e.message:`Codex setup failed. Try again.`)}}else n=!0,t?.(r.value)}catch{He(`Codex setup failed. Try again.`)}return Be.current=!1,Le(!1),n},[]),Qe=(0,z.useId)(),$e=(0,z.useRef)(0),et=(0,z.useRef)(null),[tt,nt]=(0,z.useState)(!1),rt=(0,z.useCallback)(async n=>{let r=await $(()=>Ce({environmentId:e,input:{instanceId:t,profile:n}}));r&&(ze(`handoff`),ne(null)),nt(!r)},[$,Ce,e,t]);(0,z.useEffect)(()=>{if(!w||E.data?.phase!==`finished`)return;let e=w.input.attemptId;et.current!==e&&(et.current=e,rt(E.data.profile))},[w,E.data,rt]),(0,z.useEffect)(()=>{w&&(E.error||E.data?.phase===`auth`&&[`failed`,`cancelled`].includes(E.data.state.phase))&&(He(E.data?.phase===`auth`?E.data.state.message??`ChatGPT sign-in could not finish. Try again.`:`ChatGPT sign-in on the primary environment was interrupted. Try again.`),ne(null))},[w,E.data,E.error]);let it=(0,z.useCallback)(()=>(ze(null),w?(ne(null),Promise.resolve()):$(()=>ve({environmentId:e,input:{instanceId:t,flowId:D.flowId}}))),[w,$,ve,e,t,D]),at=(0,z.useCallback)(async(n=`chatgpt`)=>{if(Be.current)return;Ue.current=!0,nt(!1),j(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),De){let i=`${Qe}:${++$e.current}`;await $(()=>Se({environmentId:e,input:{instanceId:t,methodId:n}}),n=>ne({environmentId:De,input:{instanceId:t,environmentId:e,attemptId:i,returnUrl:r.toString(),profile:n}}))||(Ue.current=!1)}else await $(()=>B({environmentId:e,input:{instanceId:t,methodId:n,returnUrl:r.toString(),callbackMode:H?`client`:`server`}}),()=>ze(`sign-in`))||(Ue.current=!1)},[e,t,$,B,H,De,Se,Qe]),ot=(0,z.useCallback)(async(n=`chatgpt`)=>{Z||Q||(q&&!qe?await at(n):(K.current=n,await $(()=>be({environmentId:e,input:{instanceId:t}}))||(K.current=null)))},[Z,Q,q,qe,at,$,be,e,t]);(0,z.useEffect)(()=>{!s||Ge||Z||Q||L===null||!n?.setup?.canInstall||(Ke(!0),c(),ot())},[s,Ge,Z,Q,L,n?.setup?.canInstall,c,ot]),(0,z.useEffect)(()=>{if(!(!K.current||G||Y)){if(L?.phase===`failed`||L?.phase===`cancelled`)K.current=null;else if(q){let e=K.current;K.current=null,at(e)}}},[G,Y,L?.phase,q,at]);let st=(0,z.useRef)(null),ct=D?.flowId,lt=(0,z.useCallback)(async n=>{try{let r=window.desktopBridge?.receiveProviderAuthCallback;if(r&&H&&ct){if(st.current===n){await S().shell.openExternal(n);return}st.current=n;let i=await r(n);if(st.current!==n)return;st.current=null,await $(()=>_e({environmentId:e,input:{instanceId:t,flowId:ct,callbackUrl:i}}))}else await S().shell.openExternal(n)}catch{He(`Could not finish sign-in on this computer. Try again or paste the redirect URL below.`)}},[H,ct,$,_e,e,t]);(0,z.useEffect)(()=>{if(H&&F&&window.desktopBridge?.cancelProviderAuthCallback)return()=>{st.current===F&&(st.current=null),window.desktopBridge?.cancelProviderAuthCallback?.(F).catch(()=>void 0)}},[H,F]),(0,z.useEffect)(()=>{Ue.current&&D?.phase===`waiting`&&D.flowId&&F&&We.current!==D.flowId&&(We.current=D.flowId,Ue.current=!1,U||lt(F))},[D?.phase,D?.flowId,F,lt,U]);let ut=L?.phase===`downloading`?`Downloading ${(L.downloadedBytes/1e6).toFixed(1)}${L.totalBytes===null?``:` of ${(L.totalBytes/1e6).toFixed(1)}`} MB.`:L?.phase===`extracting`?`Installing Codex.`:L?.phase===`verifying`?`Checking Codex.`:q?`${L?.source===`local`?`Using your installed Codex`:`Managed by P4 Code`}${L?.installedVersion?` · v${L.installedVersion}`:``}.`:L?.message??`P4 Code downloads and manages Codex for you.`,dt=Je?`Finishing sign-in...`:Y?ut:X||D?.phase===`failed`||D?.phase===`cancelled`?D?.phase===`waiting`&&ae?`Continue as ${ae} on OpenAI.`:D?.message??`Finish signing in in your browser.`:J?n?.auth.email?.trim()?(0,V.jsxs)(V.Fragment,{children:[`Signed in as`,` `,(0,V.jsx)(I,{value:n.auth.email.trim(),ariaLabel:`Toggle account email visibility`,revealTooltip:`Click to reveal email`,hideTooltip:`Click to hide email`}),`.`]}):`Signed in with ChatGPT.`:M??`Use your ChatGPT subscription.`,ft=Oe&&F&&D?.flowId&&le(W.toString())?ce({authorizationUrl:F,returnUrl:W.toString(),environmentId:e,instanceId:t,flowId:D.flowId},!1):null,pt=(0,V.jsx)(h,{size:`sm`,variant:U?`default`:`outline`,className:u===`onboarding`?`min-w-44`:void 0,disabled:E.data?.phase===`finished`?G||!tt:!F||D?.phase!==`waiting`,onClick:()=>{E.data?.phase===`finished`?rt(E.data.profile):F&&lt(F)},children:Je?`Finishing sign-in...`:E.data?.phase===`finished`?tt?`Retry connection`:`Finishing sign-in...`:D?.phase===`waiting`?U?`Open ChatGPT sign-in`:`Open sign-in page`:u===`onboarding`?`Open sign-in page`:`Signing in...`}),mt=!w&&D?.phase===`waiting`&&F?(0,V.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-xs leading-relaxed text-muted-foreground`,children:[(0,V.jsx)(`p`,{children:`If sign-in doesn't return to P4 Code, paste the URL from the final localhost page.`}),(0,V.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,onSubmit:n=>{if(n.preventDefault(),!D.flowId||!Pe.trim())return;let r=Pe.trim(),i=D.flowId;$(()=>_e({environmentId:e,input:{instanceId:t,flowId:i,callbackUrl:r}})).then(e=>{e&&Ne({flowId:i,value:``})})},children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(ie,{"aria-label":`ChatGPT sign-in redirect URL`,type:`password`,autoComplete:`off`,placeholder:`Paste the URL from the sign-in tab`,value:Pe,maxLength:16384,disabled:G||i,onChange:e=>Ne({flowId:D.flowId??``,value:e.target.value})})}),(0,V.jsx)(h,{variant:`outline`,type:`submit`,disabled:G||i||!Pe.trim(),children:`Connect`})]}),U?null:(0,V.jsx)(`div`,{children:(0,V.jsxs)(h,{size:`xs`,variant:`ghost-muted`,onClick:()=>void S().shell.openExternal(F),children:[`Try sign-in in your browser`,(0,V.jsx)(_,{className:`size-3.5`})]})}),ft?(0,V.jsxs)(`details`,{children:[(0,V.jsx)(`summary`,{className:`cursor-pointer`,children:`Other ways to connect`}),(0,V.jsx)(h,{className:`mt-2`,size:`sm`,variant:`outline`,render:(0,V.jsx)(`a`,{href:ft}),children:`Use P4 Code desktop for automatic return`})]}):null]}):null,ht=e=>mt?(0,V.jsx)(ue,{open:Ae,children:(0,V.jsx)(pe,{children:(0,V.jsx)(`div`,{id:ke,className:g(`w-full border-t border-border/50 pt-3`,e),children:mt})})}):null,gt=Oe?mt:mt?(0,V.jsxs)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[(0,V.jsx)(Fe,{label:`Having trouble signing in?`,expanded:Ae,controls:ke,onToggle:()=>je(e=>!e)}),ht(`mt-3`)]}):null,_t=(0,V.jsx)(he,{open:O,methods:D?.methods??[],onClose:()=>k(!1),onSelect:e=>{k(!1),ot(D?.methods?.some(t=>t.id===e)?e:`chatgpt-change-account`)}}),vt=D?.phase===`idle`&&D.message?.startsWith(`Signed out locally.`)?D.message:null;if(u===`onboarding`){let r=vt??Ve??(m.error||ee.error?`Could not read setup status. Reconnect and try again.`:L?.phase===`failed`?L.message:null);return(0,V.jsxs)(V.Fragment,{children:[_t,(0,V.jsxs)(Ie,{title:d||n?.displayName||`Codex`,description:Y?ut:J?n?.auth.email?.trim()?(0,V.jsxs)(V.Fragment,{children:[`Signed in as`,` `,(0,V.jsx)(I,{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&&!Oe?(0,V.jsx)(Fe,{expanded:Ae,controls:ke,onToggle:()=>je(e=>!e)}):Ye||Xe||D?.phase===`starting`||D?.phase===`waiting`||G&&!Y?(0,V.jsx)(Fe,{}):X||D?.phase===`failed`||D?.phase===`cancelled`?dt:`Code with your ChatGPT subscription.`,control:J&&!Q?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-success-foreground`,children:[(0,V.jsx)(a,{className:`size-3.5`}),`Ready`]}):X?pt:(0,V.jsx)(me,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{N?k(!0):ot()},children:Y||G?`Setting up...`:N?`Reconnect account`:`Continue with ChatGPT`}),secondaryControl:X&&!Je||Y?(0,V.jsx)(h,{size:`sm`,variant:`ghost-muted`,disabled:G||i,onClick:()=>{Ue.current=!1,K.current=null,w||X&&D?.flowId?it():L?.operationId&&$(()=>xe({environmentId:e,input:{instanceId:t,operationId:L.operationId}}))},children:`Cancel`}):!X&&!J&&N?(0,V.jsx)(h,{size:`sm`,variant:`ghost-muted`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):!X&&!J&&l?(0,V.jsx)(h,{size:`sm`,variant:`ghost-muted`,disabled:i||Q,onClick:()=>o(`existing`),children:`Use existing CLI`}):null,children:[Oe?gt:ht(),r?(0,V.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:r}):null]})]})}return(0,V.jsxs)(`section`,{"aria-label":`Codex setup`,className:`divide-y divide-border/50`,children:[_t,(0,V.jsx)(se,{title:`ChatGPT account`,description:dt,control:(0,V.jsx)(`div`,{className:`flex max-w-88 flex-wrap items-center justify-end gap-2`,children:X?(0,V.jsxs)(V.Fragment,{children:[pt,!Je&&(0,V.jsx)(h,{size:`sm`,variant:`ghost`,disabled:G||i,onClick:()=>{(w||D?.flowId)&&(Ue.current=!1,it(),f?.())},children:`Cancel`})]}):Y?(0,V.jsx)(h,{size:`sm`,variant:`ghost`,disabled:G||i,onClick:()=>{L?.operationId&&(K.current=null,$(()=>xe({environmentId:e,input:{instanceId:t,operationId:L.operationId}})))},children:`Cancel`}):J?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(h,{size:`sm`,variant:`outline`,disabled:Z||Q,onClick:()=>k(!0),children:`Change account`}),(0,V.jsx)(h,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void $(()=>ye(p)),children:`Disconnect`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(me,{size:`sm`,disabled:Z||Q||(q?!n?.setup?.canAuthenticate:!n?.setup?.canInstall),onClick:()=>{N?k(!0):ot()},children:G?`Setting up...`:N?`Reconnect account`:`Continue with ChatGPT`}),N?(0,V.jsx)(h,{size:`sm`,variant:`ghost`,disabled:Z||Q,onClick:()=>void ot(`chatgpt-change-account`),children:`Use a different account`}):null,l?(0,V.jsx)(h,{size:`sm`,variant:`ghost`,disabled:i||Q,onClick:()=>o(`existing`),children:`Use existing CLI`}):null]})})}),J?(0,V.jsx)(`div`,{className:`flex justify-end px-3 py-1 sm:px-4`,children:(0,V.jsx)(oe,{})}):null,vt?(0,V.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-muted-foreground sm:px-4`,children:vt}):null,gt?(0,V.jsx)(`div`,{className:`px-3 py-3 sm:px-4`,children:gt}):null,Ve||m.error||ee.error||L?.phase===`failed`?(0,V.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive sm:px-4`,children:Ve??(L?.phase===`failed`?L.message:`Could not read Codex setup status. Reconnect and try again.`)}):null]})}function G(e){let t=(0,B.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,V.jsx)(se,{title:`Binary path`,description:`Selected by P4 Code.`,control:(0,V.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,V.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,V.jsx)(se,{title:`CODEX_HOME path`,description:`Shared Codex config, sessions, and state.`,control:(0,V.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,V.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,V.jsx)(`div`,{className:`w-full sm:w-80`,children:(0,V.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,V.jsx)(se,{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,V.jsxs)(V.Fragment,{children:[l,f,v]}),t[16]=v,t[17]=l,t[18]=f,t[19]=y):y=t[19],y}function Fe(e){let t=(0,B.c)(10),{label:n,expanded:r,controls:i,onToggle:a}=e,o=n===void 0?`Complete sign-in in your browser.`:n,c=r!==void 0&&r;if(!a){let e;return t[0]===o?e=t[1]:(e=(0,V.jsx)(`div`,{className:`leading-relaxed`,children:o}),t[0]=o,t[1]=e),e}let l=`size-3 shrink-0 ${c?`rotate-90`:``}`,u;t[2]===l?u=t[3]:(u=(0,V.jsx)(s,{"aria-hidden":!0,className:l}),t[2]=l,t[3]=u);let d;return t[4]!==i||t[5]!==c||t[6]!==o||t[7]!==a||t[8]!==u?(d=(0,V.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-sm text-left leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":`Having trouble signing in?`,"aria-expanded":c,"aria-controls":i,onClick:a,children:[o,u]}),t[4]=i,t[5]=c,t[6]=o,t[7]=a,t[8]=u,t[9]=d):d=t[9],d}function Ie(e){let t=(0,B.c)(21),{title:n,description:r,control:i,secondaryControl:a,children:o}=e,s;t[0]===o?s=t[1]:(s=z.Children.toArray(o),t[0]=o,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,V.jsx)(N,{className:`size-5 shrink-0 fill-foreground`}),t[2]=l):l=t[2];let u;t[3]===n?u=t[4]:(u=(0,V.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,V.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,V.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,V.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,V.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,V.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,V.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 Le(e){return typeof e==`object`&&e&&`setupMode`in e&&e.setupMode===`managed`?`managed`:`existing`}export{De as a,Oe as c,Ee as d,U as f,Me as i,Ce as l,Ne as n,W as o,me as p,G as r,Ae as s,Le as t,Te as u};
2
- //# sourceMappingURL=CodexSetupSection.logic-BO6ZAijp.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{Ao as r,Ar as i,Ba as a,Bn as o,Br as s,Ca as c,Co as l,Cr as u,Da as d,Dn as f,Do as ee,Dr as p,Eo as m,Fn as te,Fo as h,Fr as g,Ga as _,Gn as v,Ha as y,Hn as b,Ia as x,Ii as S,In as C,Ir as w,La as T,Li as E,Ln as ne,Lr as D,Ma as O,Mn as k,Mo as A,Mr as re,Na as j,No as M,Oa as N,Oi as ie,On as ae,Oo as oe,Pa as se,Pi as P,Pn as ce,Po as F,Pr as le,Qa as ue,Ra as I,Ri as de,Rn as fe,So as pe,Ta as me,Tn as he,Ui as ge,Un as _e,Ur as ve,Vn as ye,Wa as L,Wn as be,Xa as xe,Za as Se,_a as Ce,ca as we,ci as Te,da as Ee,fo as De,jn as R,jo as Oe,ki as z,kr as ke,la as Ae,li as je,lo as Me,mi as Ne,oo as Pe,po as Fe,qi as Ie,so as Le,to as Re,ua as ze,uo as Be,va as Ve,wo as He,xa as Ue,yi as We,za as Ge,zn as Ke,zr as qe}from"./utils-DjbLtxuo.js";import{t as Je}from"./useRegisterFieldControl-BtJcyaxh.js";import{t as Ye}from"./FormContext-BcA1kdFD.js";var B=e(t()),Xe=B.createContext(void 0),Ze=B.createContext(void 0),Qe=B.createContext(void 0),$e=B.createContext(``);function et(){let e=B.useContext(Xe);if(!e)throw Error(h(22));return e}function tt(){let e=B.useContext(Ze);if(!e)throw Error(h(23));return e}function nt(){let e=B.useContext(Qe);if(!e)throw Error(h(24));return e}function rt(){return B.useContext($e)}var V={id:P(e=>e.id),labelId:P(e=>e.labelId),items:P(e=>e.items),selectedValue:P(e=>e.selectedValue),hasSelectionChips:P(e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0}),hasSelectedValue:P(e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0}),hasNullItemLabel:P((e,t)=>t?f(e.items):!1),open:P(e=>e.open),mounted:P(e=>e.mounted),forceMounted:P(e=>e.forceMounted),inline:P(e=>e.inline),activeIndex:P(e=>e.activeIndex),selectedIndex:P(e=>e.selectedIndex),isActive:P((e,t)=>e.activeIndex===t),isSelected:P((e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>ce(t,e,n)):ce(t,r,n)}),transitionStatus:P(e=>e.transitionStatus),popupProps:P(e=>e.popupProps),inputProps:P(e=>e.inputProps),triggerProps:P(e=>e.triggerProps),itemProps:P(e=>e.itemProps),positionerElement:P(e=>e.positionerElement),listElement:P(e=>e.listElement),triggerElement:P(e=>e.triggerElement),inputElement:P(e=>e.inputElement),inputGroupElement:P(e=>e.inputGroupElement),popupSide:P(e=>e.popupSide),openMethod:P(e=>e.openMethod),inputInsidePopup:P(e=>e.inputInsidePopup),inputOwnsFormValue:P(e=>e.inputOwnsFormValue),selectionMode:P(e=>e.selectionMode),name:P(e=>e.name),form:P(e=>e.form),disabled:P(e=>e.disabled),readOnly:P(e=>e.readOnly),required:P(e=>e.required),grid:P(e=>e.grid),virtualized:P(e=>e.virtualized),itemToStringLabel:P(e=>e.itemToStringLabel),isItemEqualToValue:P(e=>e.isItemEqualToValue),modal:P(e=>e.modal),autoHighlight:P(e=>e.autoHighlight),submitOnItemClick:P(e=>e.submitOnItemClick)};function it(e,t){return(n,r)=>{if(n==null)return!1;let i=R(n,t);return e.contains(i,r)}}function at(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;let a=R(r,t),o=n==null?``:R(n,t);return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(a,i)}}var H=new Map;function ot(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${st(e.locale)}|${JSON.stringify(t)}`,r=H.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=R(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=R(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=R(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return H.set(n,a),a}function st(e){return Array.isArray(e)?e.map(e=>st(e)).join(`,`):e==null?``:String(e)}var ct=ot;function lt(e={}){let{multiple:t=!1,value:n,...r}=e,i=ot(r),a=B.useCallback((e,r,a)=>t?it(i,a)(e,r):at(i,a,n)(e,r),[i,n,t]);return B.useMemo(()=>({contains:a,startsWith:i.startsWith,endsWith:i.endsWith}),[a,i])}var ut=Symbol(`none`),dt={value:ut,index:-1},U=e(n());function ft(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:a=null,selectedValue:o,onSelectedValueChange:s,defaultInputValue:c,inputValue:l,open:u,defaultOpen:d=!1,selectionMode:f=`none`,onItemHighlighted:ee,name:m,form:h,disabled:g=!1,readOnly:v=!1,required:y=!1,inputRef:b,grid:x=!1,items:w,filteredItems:T,filter:D,openOnInputClick:re=!0,autoHighlight:se=!1,keepHighlight:P=!1,highlightItemOnHover:le=!0,loopFocus:ue=!0,itemToStringLabel:I,itemToStringValue:de,isItemEqualToValue:pe=te,virtualized:he=!1,inline:ge=!1,fillInputOnItemPress:ve=!0,modal:ye=!1,limit:be=-1,autoComplete:Se=`list`,formAutoComplete:Te,locale:De,submitOnItemClick:Pe=!1}=e,{clearErrors:Ie}=Ye(),{setDirty:Re,validityData:ze,shouldValidateOnChange:He,setFilled:Ue,name:Ge,disabled:et,setTouched:tt,setFocused:nt,validationMode:rt,validation:H}=_e(),ot=qe(),st=Ke({id:t}),lt=ct({locale:De}),[ft,pt]=B.useState(!1),[mt,ht]=B.useState(null),gt=B.useRef([]),_t=B.useRef([]),vt=B.useRef(null),W=B.useRef(null),yt=B.useRef(null),bt=B.useRef(null),xt=B.useRef(null),St=B.useRef(!0),Ct=B.useRef(!1),wt=B.useRef(null),Tt=B.useRef(null),Et=B.useRef(null),Dt=B.useRef(dt),Ot=B.useRef(null),kt=B.useRef([]),At=B.useRef([]),jt=et||g,Mt=Ge??m,G=f===`multiple`,K=f===`single`,Nt=l!==void 0||c!==void 0,Pt=w!==void 0,Ft=T!==void 0,q;q=se===`always`?`always`:se?`input-change`:!1;let[J,It]=xe({controlled:o,default:G?a??r:a,name:`Combobox`,state:`selectedValue`}),Lt=B.useMemo(()=>D===null?()=>!0:D===void 0?K&&!ft?at(lt,I,J):it(lt,I):D,[D,K,J,ft,lt,I]),Rt=F(()=>Nt?c??``:K?R(J,I):``).current,[Y,zt]=xe({controlled:l,default:Rt,name:`Combobox`,state:`inputValue`}),[X,Bt]=xe({controlled:u,default:d,name:`Combobox`,state:`open`}),Vt=ae(w),Z=mt??(Y===``?``:String(Y).trim()),Ht=K?R(J,I):``,Ut=K&&!ft&&Z!==``&&Ht!==``&&Ht.length===Z.length&&lt.contains(Ht,Z),Wt=Ut?``:Z,Gt=Pt&&Ft&&Ut,Kt=B.useMemo(()=>w?Vt?w.flatMap(e=>e.items):w:r,[w,Vt]),qt=B.useMemo(()=>{if(T&&!Gt)return T;if(!w)return r;if(Vt){let e=w,t=[],n=0;for(let r of e){if(be>-1&&n>=be)break;let e=Wt===``?r.items:r.items.filter(e=>Lt(e,Wt,I));if(e.length===0)continue;let i=be>-1?be-n:1/0,a=e.slice(0,i);if(a.length>0){let e={...r,items:a};t.push(e),n+=a.length}}return t}if(Wt===``)return be>-1?Kt.slice(0,be):Kt;let e=[];for(let t of Kt){if(be>-1&&e.length>=be)break;Lt(t,Wt,I)&&e.push(t)}return e},[T,Gt,w,Vt,Wt,be,Lt,I,Kt]),Jt=B.useMemo(()=>Vt?qt.flatMap(e=>e.items):qt,[qt,Vt]),Q=F(()=>new ie({id:st,labelId:void 0,selectedValue:J,open:X,filter:Lt,query:Z,items:w,selectionMode:f,listRef:gt,labelsRef:_t,popupRef:vt,emptyRef:xt,inputRef:W,startDismissRef:yt,endDismissRef:bt,keyboardActiveRef:St,chipsContainerRef:wt,clearRef:Tt,valuesRef:kt,allValuesRef:At,selectionEventRef:Et,name:Mt,form:h,disabled:jt,readOnly:v,required:y,grid:x,isGrouped:Vt,virtualized:he,openOnInputClick:re,itemToStringLabel:I,isItemEqualToValue:pe,modal:ye,autoHighlight:q,submitOnItemClick:Pe,hasInputValue:Nt,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:ge,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},itemProps:Oe,positionerElement:null,listElement:null,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:f===`none`,onOpenChangeComplete:n||A,setOpen:A,setInputValue:A,setSelectedValue:A,setIndices:A,onItemHighlighted:A,handleSelection:A,forceMount:A,requestSubmit:A})).current,Yt=f===`none`?Y:J,Xt=B.useMemo(()=>f===`none`?Yt:Array.isArray(J)?J.map(e=>k(e,de)):k(J,de),[Yt,de,f,J]),Zt=_(ee),Qt=_(n),$t=z(Q,V.activeIndex),en=z(Q,V.selectedIndex),tn=z(Q,V.positionerElement),nn=z(Q,V.listElement),rn=z(Q,V.triggerElement),an=z(Q,V.inputElement),on=z(Q,V.inputGroupElement),$=z(Q,V.inline),sn=z(Q,V.inputInsidePopup),cn=z(Q,V.inputOwnsFormValue),ln=Ee(rn),{mounted:un,setMounted:dn,transitionStatus:fn}=N(X),{openMethod:pn,triggerProps:mn}=p(X),hn=_(()=>Xt);Je(sn?ln:W,st,Yt,hn);let gn=_(()=>{w?_t.current=Jt.map(e=>R(e,I)):Q.set(`forceMounted`,!0)}),_n=B.useRef(J);L(()=>{J!==_n.current&&gn()},[gn,J]);let vn=_(e=>{Q.update(e);let t=e.type||`none`;if(e.activeIndex!==void 0){if(e.activeIndex===null)Dt.current!==dt&&(Dt.current=dt,Zt(void 0,j(t,void 0,{index:-1})));else{let n=kt.current[e.activeIndex];Dt.current={value:n,index:e.activeIndex},Zt(n,j(t,void 0,{index:e.activeIndex}))}}}),yn=_((t,n)=>{if(Ct.current=n.reason===Le,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&pt(!0),Ot.current={hasQuery:e},e&&q&&Q.state.activeIndex==null&&Q.set(`activeIndex`,0)}}zt(t)}}),bn=_((t,n)=>{if(X!==t&&(n.reason===`escape-key`&&Pt&&Jt.length===0&&!Q.state.emptyRef.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&G&&sn&&!$&&mt!==null&&(pt(!1),ht(null),Y!==``&&yn(``,O(Le,n.event))),!t&&ft&&(K?($||ht(Z),Z===``&&pt(!1)):G&&($||ht(Z),sn&&vn({activeIndex:null}),(!sn||$)&&yn(``,O(Le,n.event)))),Bt(t),!t&&sn&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(tt(!0),nt(!1),rt===`onBlur`)))){let e=f===`none`?Y:J;H.commit(e)}}),xn=_((e,t)=>{s?.(e,t),!t.isCanceled&&(It(e),(f===`none`&&vt.current&&ve||K&&!Q.state.inputInsidePopup)&&yn(R(e,I),O(t.reason,t.event)),K&&e!=null&&t.reason!==`input-change`&&ft&&!$&&ht(Z))}),Sn=_((e,t)=>{let n=t;if(n===void 0){if($t===null)return;n=kt.current[$t]}let r=Ve(e),i=Et.current??e;Et.current=null;let a=O(Be,i),o=r?.closest(`a`)?.getAttribute(`href`);if(o)o.startsWith(`#`)&&bn(!1,a);else if(G){let e=Array.isArray(J)?J:[],t=fe(e,n,Q.state.isItemEqualToValue)?ne(e,n,Q.state.isItemEqualToValue):[...e,n];if(xn(t,a),!(W.current&&W.current.value.trim()!==``))return;Q.state.inputInsidePopup?yn(``,O(Le,a.event)):bn(!1,a)}else xn(n,a),bn(!1,a)}),Cn=_(()=>{if(!Q.state.submitOnItemClick)return;let e=H.inputRef.current?.form??Q.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),wn=_(()=>{if(dn(!1),Qt?.(!1),pt(!1),ht(null),vn(f===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),G&&W.current&&W.current.value!==``&&!Ct.current&&yn(``,O(Le)),K){if(Q.state.inputInsidePopup)W.current&&W.current.value!==``&&yn(``,O(Le));else{let e=R(J,I);W.current&&W.current.value!==e&&yn(e,O(e===``?Le:Fe))}}}),Tn=B.useMemo(()=>$&&tn?{current:tn.closest(`[role="dialog"]`)}:vt,[$,tn]);me({enabled:!e.actionsRef,open:X,ref:Tn,onComplete(){X||wn()}}),B.useImperativeHandle(e.actionsRef,()=>({unmount:wn}),[wn]),L(function(){if(X||f===`none`)return;let e=w?Kt:At.current;if(G){let t=Array.isArray(J)?J:[],n=t[t.length-1],r=C(e,n,pe);vn({selectedIndex:r===-1?null:r})}else{let t=C(e,J,pe);vn({selectedIndex:t===-1?null:t})}},[X,J,w,f,Kt,G,pe,vn]),L(()=>{w&&(kt.current=Jt,gt.current.length=Jt.length)},[w,Jt]),L(()=>{let e=Ot.current;if(e&&(e.hasQuery?q&&Q.set(`activeIndex`,0):q===`always`&&Q.set(`activeIndex`,0),Ot.current=null),!X&&!$)return;let t=Pt||Ft?Jt:kt.current,n=Q.state.activeIndex;if(n==null){if(q===`always`&&t.length>0){Q.set(`activeIndex`,0);return}Dt.current!==dt&&(Dt.current=dt,Q.state.onItemHighlighted(void 0,j(Fe,void 0,{index:-1})));return}if(n>=t.length){Dt.current!==dt&&(Dt.current=dt,Q.state.onItemHighlighted(void 0,j(Fe,void 0,{index:-1}))),Q.set(`activeIndex`,null);return}let r=t[n],i=Dt.current.value,a=i!==ut&&ce(r,i,Q.state.isItemEqualToValue);Dt.current.index===n&&a||(Dt.current={value:r,index:n},Q.state.onItemHighlighted(r,j(Fe,void 0,{index:n})))},[$t,q,Ft,Pt,Jt,$,X,Q]),L(()=>{Ue(f===`none`?String(Y)!==``:G?Array.isArray(J)&&J.length>0:J!=null)},[Ue,f,Y,J,G]),B.useEffect(()=>{Pt&&q&&Jt.length===0&&vn({activeIndex:null})},[Pt,q,Jt.length,vn]),ke(Z,()=>{X&&Z!==``&&Z!==String(Rt)&&pt(!0)}),ke(J,()=>{if(f!==`none`&&(Ie(Mt),Re(J!==ze.initialValue),He()?H.commit(J):H.commit(J,!0),K&&!Nt&&!sn)){let e=R(J,I);Y!==e&&yn(e,O(Fe))}}),ke(Y,()=>{f===`none`&&(Ie(Mt),Re(Y!==ze.initialValue),He()?H.commit(Y):H.commit(Y,!0))}),ke(w,()=>{if(!K||Nt||sn||ft)return;let e=R(J,I);Y!==e&&yn(e,O(Fe))});let En=Ne({open:$?!0:X,onOpenChange:bn,elements:{reference:sn?rn:an,floating:tn}}),Dn,On;$||(Dn=x?`grid`:`listbox`,On=X?`true`:`false`);let kn=B.useMemo(()=>{let e=an?.tagName===`INPUT`,t=an==null||e,n=t||X,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=On,r[`aria-haspopup`]=Dn,r[`aria-controls`]=X?nn?.id:void 0,r[`aria-autocomplete`]=Se),{reference:r,floating:{role:`presentation`}}},[an,X,On,Dn,nn?.id,Se]),An=E(En,{enabled:!v&&!jt&&re,event:`mousedown-only`,toggle:!1,touchOpenDelay:sn?0:100,reason:Me}),jn=S(En,{enabled:!v&&!jt&&!$,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:$?!0:void 0,outsidePress(e){let t=Ve(e);return!Ce(rn,t)&&!Ce(Tt.current,t)&&!Ce(wt.current,t)&&!Ce(on,t)}}),Mn=je(En,{enabled:!v&&!jt,id:st,listRef:gt,activeIndex:$t,selectedIndex:en,virtual:!0,loopFocus:ue,allowEscape:ue&&!q,focusItemOnOpen:ft||f===`none`&&!q?!1:`auto`,focusItemOnHover:le,resetOnPointerLeave:!P,cols:x?2:1,orientation:x?`horizontal`:void 0,rtl:ot===`rtl`,disabledIndices:r,onNavigate(e,t){(t||X)&&fn!==`ending`&&vn(t?{activeIndex:e,type:St.current?`keyboard`:`pointer`}:{activeIndex:e})}}),Nn=B.useMemo(()=>oe(Mn.reference,jn.reference,An.reference,kn.reference),[Mn.reference,jn.reference,An.reference,kn.reference]),Pn=B.useMemo(()=>oe(We,Mn.floating,jn.floating,kn.floating),[Mn.floating,jn.floating,kn.floating]),Fn=B.useMemo(()=>{let e=Mn.item;return e?{...e,onFocus:void 0}:Oe},[Mn.item]);i(()=>{Q.update({inline:ge,popupProps:Pn,inputProps:Nn,triggerProps:mn,itemProps:Fn,setOpen:bn,setInputValue:yn,setSelectedValue:xn,setIndices:vn,onItemHighlighted:Zt,handleSelection:Sn,forceMount:gn,requestSubmit:Cn})}),L(()=>{Q.update({id:st,selectedValue:J,open:X,mounted:un,transitionStatus:fn,items:w,inline:ge,popupProps:Pn,inputProps:Nn,triggerProps:mn,openMethod:pn,itemProps:Fn,selectionMode:f,name:Mt,form:h,disabled:jt,readOnly:v,required:y,grid:x,isGrouped:Vt,virtualized:he,onOpenChangeComplete:Qt,openOnInputClick:re,itemToStringLabel:I,modal:ye,autoHighlight:q,isItemEqualToValue:pe,submitOnItemClick:Pe,hasInputValue:Nt,requestSubmit:Cn,inputOwnsFormValue:f===`none`&&(ge||!Q.state.inputInsidePopup)})},[Q,st,J,X,un,fn,w,Pn,Nn,Fn,pn,mn,f,Mt,jt,v,y,H,x,Vt,he,Qt,re,I,ye,pe,Pe,Nt,ge,Cn,q,h]);let In=M(b,H.inputRef),Ln=B.useMemo(()=>({query:Z,hasItems:Pt,filteredItems:qt,flatFilteredItems:Jt}),[Z,Pt,qt,Jt]),Rn=B.useMemo(()=>Array.isArray(Yt)?``:k(Yt,de),[Yt,de]),zn=G&&Array.isArray(J)&&J.length>0,Bn=G||f===`none`&&cn?void 0:Mt,Vn=B.useMemo(()=>!G||!Array.isArray(J)||!Mt?null:J.map(e=>{let t=k(e,de);return(0,U.jsx)(`input`,{type:`hidden`,form:h,name:Mt,value:t},t)}),[G,J,h,Mt,de]),Hn=(0,U.jsxs)(B.Fragment,{children:[e.children,(0,U.jsx)(`input`,{...H.getInputValidationProps({onFocus(){sn?rn?.focus():(W.current||rn)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||jt||v){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=O(Fe,e.nativeEvent);function r(){if(G)return;if(f===`none`){Re(t!==ze.initialValue),yn(t,n),He()&&H.commit(t);return}let e=kt.current.find(e=>k(e,de).toLowerCase()===t.toLowerCase()||R(e,I).toLowerCase()===t.toLowerCase());e!=null&&(Re(e!==ze.initialValue),xn?.(e,n),He()&&H.commit(e))}w?r():(gn(),queueMicrotask(r))}}),id:st&&Bn==null?`${st}-hidden-input`:void 0,form:h,name:Bn,autoComplete:Te,disabled:jt,required:y&&!zn,readOnly:v,value:Rn,ref:In,style:Bn?Ae:we,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Vn]});return(0,U.jsx)(Xe.Provider,{value:Q,children:(0,U.jsx)(Ze.Provider,{value:En,children:(0,U.jsx)(Qe.Provider,{value:Ln,children:(0,U.jsx)($e.Provider,{value:Y,children:Hn})})})})}var pt={...l,...v,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},mt=B.createContext(void 0);function ht(){return B.useContext(mt)}var gt=B.createContext(void 0);function _t(e){let t=B.useContext(gt);if(t===void 0&&!e)throw Error(h(21));return t}var vt=B.forwardRef(function(e,t){let n=et(),{buttonRef:r,getButtonProps:i}=y({native:!1}),a=M(t,r);function o(e){n.state.setOpen(!1,O(ue,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,U.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Ae})}),W=B.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=_e(),{labelId:te}=o(),h=ht(),g=!!_t(!0),v=et(),{filteredItems:y}=nt(),x=rt(),S=qe(),C=z(v,V.required),w=z(v,V.disabled),T=z(v,V.readOnly),E=z(v,V.name),ne=z(v,V.form),D=z(v,V.selectionMode),k=z(v,V.autoHighlight),A=z(v,V.inputProps),re=z(v,V.triggerProps),j=z(v,V.open),M=z(v,V.mounted),N=z(v,V.selectedValue),ie=z(v,V.popupSide),ae=z(v,V.positionerElement),oe=z(v,V.id),P=z(v,V.inline),ce=z(v,V.modal),F=!!k,le=M&&ae?ie:null,ue=u||w||i,de=y.length===0,fe=g||P,pe=!fe||ce,me=se(a??(fe?void 0:oe)),ge=he(te,void 0),ve=g?be:l,[L,xe]=B.useState(null),Se=B.useRef(!1),Ce=B.useRef(null),we=B.useRef(!1),Te=D===`none`&&!g,Ee=_(e=>{let t=g||v.state.inline;t&&!v.state.hasInputValue&&v.state.setInputValue(``,O(Fe)),v.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:Te})}),De=g||!m?c:m.getValidationProps(c),R={...ve,open:j,disabled:ue,readOnly:T,popupSide:le,listEmpty:de};function Oe(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,i=S===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(n!==void 0){if(e.key===a)e.preventDefault(),t=n>0?n-1:void 0;else if(e.key===o)e.preventDefault(),t=n<r-1?n+1:void 0;else if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let r=n>=N.length-1?N.length-2:n;t=r>=0?r:void 0,v.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`})}return t}return e.key===a&&(e.currentTarget.selectionStart??0)===0&&N.length>0?(e.preventDefault(),t=r>0?r-1:void 0):e.key===`Backspace`&&e.currentTarget.value===``&&N.length>0&&(v.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`}),e.preventDefault()),t}let ke=ee(`input`,e,{state:R,ref:[t,v.state.inputRef,Ee],props:[A,re,{type:`text`,value:e.value??L??x,"aria-readonly":T||void 0,"aria-required":C||void 0,"aria-labelledby":ge,disabled:ue,readOnly:T,required:D===`none`?C:void 0,form:ne,...Te&&E&&{name:E},id:me,onFocus(){if(f(!0),!P||!we.current)return;we.current=!1;let e=Ce.current;e!=null&&Object.hasOwn(v.state.valuesRef.current,e)&&v.state.setIndices({activeIndex:e})},onBlur(){d(!0),f(!1);let e=v.state.activeIndex;if(P&&e!==null&&k!==`always`&&(Ce.current=e,we.current=!0,v.state.setIndices({activeIndex:null})),p===`onBlur`){let e=D===`none`?x:N;m.commit(e)}},onCompositionStart(e){I||(Se.current=!0,xe(e.currentTarget.value))},onCompositionEnd(e){Se.current=!1;let t=e.currentTarget.value;xe(null),v.state.setInputValue(t,O(Pe,e.nativeEvent))},onChange(e){let t=e.nativeEvent.inputType,n=!t||t===`insertReplacementText`,r=Se.current||!n;if(Se.current){let t=e.currentTarget.value;xe(t),t===``&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,O(Le,e.nativeEvent));let n=t.trim(),i=F&&n!==``;!T&&!ue&&n&&r&&(v.state.setOpen(!0,O(Pe,e.nativeEvent)),F||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?`keyboard`:`pointer`})),j&&v.state.activeIndex!==null&&!i&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?`keyboard`:`pointer`});return}v.state.setInputValue(e.currentTarget.value,O(Pe,e.nativeEvent));let i=e.currentTarget.value===``,a=O(Le,e.nativeEvent);i&&!v.state.inputInsidePopup&&(D===`single`&&v.state.setSelectedValue(null,a),v.state.openOnInputClick||v.state.setOpen(!1,a));let o=e.currentTarget.value.trim();!T&&!ue&&o&&r&&(v.state.setOpen(!0,O(Pe,e.nativeEvent)),F||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?`keyboard`:`pointer`})),j&&v.state.activeIndex!==null&&!F&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?`keyboard`:`pointer`})},onKeyDown(e){if(ue||T||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;v.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=S===`rtl`;if(e.key===`Home`){Ue(e);let n=Ge&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){Ue(e);let i=Ge&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!M&&e.key===`Escape`){let t=D===`multiple`&&Array.isArray(N)?N.length===0:N===null,n=O(Re,e.nativeEvent),r=D===`multiple`?[]:null;v.state.setInputValue(``,n),v.state.setSelectedValue(r,n),t||v.state.inline||n.isPropagationAllowed||e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(N)&&N.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:N.length-1,r=N.filter((e,t)=>t!==n);v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?`keyboard`:`pointer`}),v.state.setSelectedValue(r,O(Fe,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=Oe(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&v.state.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&j){let t=v.state.activeIndex,n=e.nativeEvent;if(t===null){if(P)return;v.state.setOpen(!1,O(Fe,n));return}Ue(e);let r=v.state.listRef.current[t];r&&(v.state.selectionEventRef.current=n,r.click(),v.state.selectionEventRef.current=null)}},onPointerMove(){v.state.keyboardActiveRef.current=!1},onPointerDown(){v.state.keyboardActiveRef.current=!1}},De],stateAttributesMapping:pt}),Ae=g?(0,U.jsx)(b.Provider,{value:ye,children:ke}):ke;return(0,U.jsxs)(B.Fragment,{children:[j&&pe&&(0,U.jsx)(vt,{ref:v.state.startDismissRef}),Ae]})}),yt=2,bt=B.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:s,style:l,...d}=e,{state:f,disabled:p,setTouched:m,setFocused:te,validationMode:h,validation:g}=_e(),{labelId:v}=o(),b=et(),{filteredItems:x}=nt(),S=z(b,V.selectionMode),C=z(b,V.disabled),w=z(b,V.readOnly),T=z(b,V.required),ne=z(b,V.mounted),D=z(b,V.popupSide),k=z(b,V.positionerElement),A=z(b,V.listElement),re=z(b,V.triggerProps),j=z(b,V.triggerElement),M=z(b,V.inputInsidePopup),N=z(b,V.id),ie=z(b,V.labelId),ae=z(b,V.open),oe=z(b,V.selectedValue),se=z(b,V.activeIndex),P=z(b,V.selectedIndex),ce=z(b,V.hasSelectedValue),F=tt(),le=rt(),ue=c(),I=p||C||a,de=x.length===0,fe=ne&&k?D:null;Ke({id:M?s:void 0});let pe=M?s??N:s,me=he(v,ie),ge=B.useRef(``);function ve(e){ge.current=e.pointerType}let ye=F.useState(`domReferenceElement`);B.useEffect(()=>{M&&j&&j!==ye&&F.set(`domReferenceElement`,j)},[j,ye,F,M]);let{reference:L}=Te(F,{enabled:!ae&&!w&&!C&&S===`single`,listRef:b.state.labelsRef,activeIndex:se,selectedIndex:P,onMatch(e){let t=b.state.valuesRef.current[e];t!==void 0&&b.state.setSelectedValue(t,O(`none`))}}),{reference:be}=E(F,{enabled:!w&&!C,event:`mousedown`}),{buttonRef:xe,getButtonProps:Se}=y({native:i,disabled:I}),we={...f,open:ae,disabled:I,popupSide:fe,listEmpty:de,placeholder:S!==`none`&&!ce},Ee=_(e=>{b.set(`triggerElement`,e)});return ee(`button`,e,{ref:[t,xe,Ee],state:we,props:[re,be,L,{id:pe,tabIndex:M?0:-1,role:M?`combobox`:void 0,"aria-expanded":ae?`true`:`false`,"aria-haspopup":M?`dialog`:`listbox`,"aria-controls":ae?A?.id:void 0,"aria-required":M&&T||void 0,"aria-labelledby":me,onPointerDown:ve,onPointerEnter:ve,onFocus(){te(!0),!(I||w)&&ue.start(0,b.state.forceMount)},onBlur(e){if(!Ce(k,e.relatedTarget)&&(m(!0),te(!1),h===`onBlur`)){let e=S===`none`?le:oe;g.commit(e)}},onMouseDown(e){if(I||w||(M||F.set(`domReferenceElement`,e.currentTarget),b.state.forceMount(),ge.current!==`touch`&&(b.state.inputRef.current?.focus(),M||e.preventDefault()),ae))return;let t=ze(e.currentTarget);function n(e){if(!j)return;let t=Ve(e),n=b.state.positionerElement,r=b.state.listElement;if(Ce(j,t)||Ce(n,t)||Ce(r,t)||t===j)return;let i=u(j),a=e.clientX>=i.left-yt&&e.clientX<=i.right+yt,o=e.clientY>=i.top-yt&&e.clientY<=i.bottom+yt;a&&o||b.state.setOpen(!1,O(`cancel-open`,e))}M&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){I||w||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(Ue(e),b.state.setOpen(!0,O(De,e.nativeEvent)),b.state.inputRef.current?.focus())}},g?g.getValidationProps(d):d,Se],stateAttributesMapping:pt})}),xt=B.createContext(null);function St(){return B.useContext(xt)}function Ct(e){let{children:t,items:n}=e,r=B.useMemo(()=>({items:n}),[n]);return(0,U.jsx)(xt.Provider,{value:r,children:t})}function wt(e){let{children:t}=e,{filteredItems:n}=nt(),r=St(),i=r?r.items:n;return i?(0,U.jsx)(B.Fragment,{children:i.map(t)}):null}var Tt=B.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=et(),l=tt(),u=!!_t(!0),{filteredItems:d,hasItems:f}=nt(),p=z(c,V.selectionMode),m=z(c,V.grid),te=z(c,V.popupProps),h=z(c,V.virtualized),g=p===`multiple`,v=d.length===0,y=_(e=>{c.set(`positionerElement`,e)}),b=_(e=>{c.set(`listElement`,e)}),x=B.useMemo(()=>typeof o==`function`?n||=(0,U.jsx)(wt,{children:o}):o,[o]),S={empty:v},C=l.useState(`floatingId`),T=ee(`div`,e,{state:S,ref:[t,b,u?null:y],props:[te,{children:x,tabIndex:-1,id:C,role:m?`grid`:`listbox`,"aria-multiselectable":g?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;Ue(e);let n=e.nativeEvent,r=c.state.listRef.current[t];r&&(c.state.selectionEventRef.current=n,r.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});return h?T:(0,U.jsx)(w,{elementsRef:c.state.listRef,labelsRef:f?void 0:c.state.labelsRef,children:T})}),Et=e(d()),Dt=`⁠`;function Ot(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function kt(){let e=c(),t=B.useRef(null);return B.useEffect(()=>{if(a)return;let n=t.current;if(n==null)return;let r=Ot(n);if(r==null)return;let i=r.nodeValue??``,o=`${i}${Dt}`;return r.nodeValue=o,e.start(200,()=>{r.nodeValue===o&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===o&&(r.nodeValue=i)}},[t,e]),t}var At=B.createContext(void 0);function jt(){let e=B.useContext(At);if(e===void 0)throw Error(h(20));return e}var Mt=B.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=et(),a=z(i,V.mounted),o=z(i,V.forceMounted);return a||n||o?(0,U.jsx)(At.Provider,{value:n,children:(0,U.jsx)(ge,{ref:t,...r})}):null}),G=B.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:ee=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:te=Ie,style:h,...v}=e,y=et(),{filteredItems:b}=nt(),x=tt(),S=jt(),C=z(y,V.modal),w=z(y,V.open),T=z(y,V.mounted),E=z(y,V.openMethod),ne=z(y,V.positionerElement),O=z(y,V.triggerElement),k=z(y,V.inputElement),A=z(y,V.inputGroupElement),j=z(y,V.inputInsidePopup),M=z(y,V.transitionStatus),N=b.length===0,ie=D({anchor:i??(j?O:A??k),floatingRootContext:x,positionMethod:a,mounted:T,side:o,sideOffset:l,align:c,alignOffset:u,arrowPadding:ee,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:m,keepMounted:S,collisionAvoidance:te,lazyFlip:!0});re(w&&C,E===`touch`,ne,O);let ae={open:w,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,empty:N};L(()=>{y.set(`popupSide`,ie.side)},[y,ie.side]);let oe=_(e=>{y.set(`positionerElement`,e)}),se=le(e,ae,{styles:ie.positionerStyles,transitionStatus:M,props:v,refs:[t,oe],hidden:!T,inert:!w});return(0,U.jsxs)(gt.Provider,{value:ie,children:[T&&C&&(0,U.jsx)(g,{inert:s(!w),cutout:A??k??O}),se]})}),K={...pe,...m},Nt=B.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=et(),l=_t(),u=tt(),{filteredItems:d}=nt(),f=z(c,V.mounted),p=z(c,V.open),m=z(c,V.openMethod),te=z(c,V.transitionStatus),h=z(c,V.inputInsidePopup),g=z(c,V.inputElement),_=z(c,V.modal),v=d.length===0;me({open:p,ref:c.state.popupRef,onComplete(){p&&c.state.onOpenChangeComplete(!0)}});let y={open:p,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:te,empty:v},b=ee(`div`,e,{state:y,ref:[t,c.state.popupRef],props:[{role:h?`dialog`:`presentation`,tabIndex:-1,onFocus(e){let t=Ve(e.nativeEvent);m!==`touch`&&(Ce(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},ve(te),s],stateAttributesMapping:K}),x=a===void 0?h?e=>e===`touch`?c.state.popupRef.current:g:!1:a,S;S=o??(h?void 0:!1);let C=!h||_;return(0,U.jsx)(de,{context:u,disabled:!f,modal:C,openInteractionType:m,initialFocus:x,returnFocus:S,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,U.jsxs)(B.Fragment,{children:[b,C&&(0,U.jsx)(vt,{ref:c.state.endDismissRef})]})})}),Pt=B.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return ee(`span`,e,{ref:t,props:[{"aria-hidden":!0,children:`▼`},a]})}),Ft=B.createContext(void 0),q=B.createContext(!1);function J(){return B.useContext(q)}var It=B.memo(B.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,index:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=B.useRef(!1),d=B.useRef(null),f=T({index:o,textRef:d,indexGuessBehavior:x.GuessFromOrder}),p=et(),m=J(),{flatFilteredItems:te,hasItems:h}=nt(),g=z(p,V.open),_=z(p,V.selectionMode),v=z(p,V.readOnly),b=z(p,V.virtualized),S=z(p,V.isItemEqualToValue),w=_!==`none`,E=o??(b?C(te,a,S):f.index),ne=f.index!==-1,D=z(p,V.id),O=z(p,V.isActive,E),k=z(p,V.isSelected,a),A=z(p,V.itemProps),re=B.useRef(null),j=D!=null&&ne?`${D}-${E}`:void 0,M=k&&w;L(()=>{if(!ne||!b&&o==null)return;let e=p.state.listRef.current;return e[E]=re.current,()=>{delete e[E]}},[ne,b,E,o,p]),L(()=>{if(!ne||h)return;let e=p.state.valuesRef.current;return e[E]=a,_!==`none`&&p.state.allValuesRef.current.push(a),()=>{delete e[E]}},[ne,h,E,a,p,_]),L(()=>{if(!g){u.current=!1;return}if(!ne||h)return;let e=p.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;ce(a,t,S)&&p.set(`selectedIndex`,E)},[ne,h,g,p,E,a,S]);let{getButtonProps:N,buttonRef:ie}=y({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),ae={disabled:s,selected:M,highlighted:O};function oe(e){function t(){p.state.handleSelection(e,a)}p.state.submitOnItemClick?(Et.flushSync(t),p.state.requestSubmit()):t()}let se={id:j,role:m?`gridcell`:`option`,"aria-selected":w?M:void 0,tabIndex:void 0,onPointerDownCapture(e){u.current=!0,e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){s||v||oe(e.nativeEvent)},onMouseUp(e){let t=u.current;u.current=!1,!(s||v||e.button!==0||t||!O)&&oe(e.nativeEvent)}},P=ee(`div`,e,{ref:[ie,t,f.ref,re],state:ae,props:[A,se,l,N]}),F=B.useMemo(()=>({selected:M,textRef:d}),[M,d]);return(0,U.jsx)(Ft.Provider,{value:F,children:P})})),Lt=B.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=nt(),c=et(),l=kt(),u=s.length===0?a:null;return ee(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),Rt={...m,...He},Y=B.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=_e(),u=et(),d=z(u,V.selectionMode),f=z(u,V.disabled),p=z(u,V.readOnly),m=z(u,V.open),te=z(u,V.selectedValue),h=z(u,V.hasSelectionChips),g=rt(),_=!1;_=d===`none`?g!==``:d===`single`?te!=null:h;let v=l||f||i,{buttonRef:b,getButtonProps:x}=y({native:a,disabled:v}),{mounted:S,transitionStatus:C,setMounted:w}=N(_),T={disabled:v,visible:_,open:m,transitionStatus:C};me({open:_,ref:u.state.clearRef,onComplete(){_||w(!1)}});let E=ee(`button`,e,{state:T,ref:[t,b,u.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(v||p)return;let t=u.state.keyboardActiveRef;u.state.setInputValue(``,O(Se,e.nativeEvent)),d===`none`?u.state.setIndices({activeIndex:null,type:t.current?`keyboard`:`pointer`}):(u.state.setSelectedValue(Array.isArray(te)?[]:null,O(Se,e.nativeEvent)),u.state.setIndices({activeIndex:null,selectedIndex:null,type:t.current?`keyboard`:`pointer`})),u.state.inputRef.current?.focus()}},c,x],stateAttributesMapping:Rt});return o||S?E:null});export{Nt as a,kt as c,Ct as d,bt as f,ct as g,lt as h,Pt as i,Tt as l,ft as m,Lt as n,G as o,W as p,It as r,Mt as s,Y as t,wt as u};
2
- //# sourceMappingURL=ComboboxClear-CtNsa8Al.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{Do as r,Fo as i,Pa as a,Wa as o}from"./utils-DjbLtxuo.js";import{d as s}from"./ComboboxClear-CtNsa8Al.js";var c=e(t()),l=c.createContext(void 0);function u(){let e=c.useContext(l);if(e===void 0)throw Error(i(18));return e}var d=e(n()),f=c.forwardRef(function(e,t){let{render:n,className:i,style:a,items:o,...u}=e,[f,p]=c.useState(),m=c.useMemo(()=>({labelId:f,setLabelId:p,items:o}),[f,p,o]),h=r(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":f},u]}),g=(0,d.jsx)(l.Provider,{value:m,children:h});return o?(0,d.jsx)(s,{items:o,children:g}):g}),p=c.forwardRef(function(e,t){let{render:n,className:i,style:s,id:c,...l}=e,{setLabelId:d}=u(),f=a(c);return o(()=>(d(f),()=>{d(void 0)}),[f,d]),r(`div`,e,{ref:t,props:[{id:f},l]})});export{f as n,p as t};
2
- //# sourceMappingURL=ComboboxGroupLabel-vQ7y8c50.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{$i as r,$r as i,Ao as a,Do as o,Ga as s,Gr as c,Ir as l,Jr as u,Kr as d,No as f,Qi as p,Qr as m,Ua as h,Wr as g,Xi as _,Yr as v,Zi as y,Zr as b,ea as x,ia as S,ii as C,jo as w,na as T,ni as E,qr as D,ra as O,ri as k,ta as A,ti as j,va as M,zr as N}from"./utils-DjbLtxuo.js";var P=e(t());function F(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var I=`data-composite-item-active`,L=[];function R(e){let{itemSizes:t,cols:n=1,loopFocus:i=!0,onLoop:a,dense:o=!1,orientation:l=`both`,direction:h,highlightedIndex:w,onHighlightedIndexChange:N,rootRef:I,enableHomeAndEndKeys:R=!1,stopEventPropagation:B=!1,disabledIndices:V,modifierKeys:H=L}=e,[U,W]=P.useState(0),G=n>1,K=P.useRef(null),q=f(K,I),J=P.useRef([]),Y=P.useRef(!1),X=w??U,Z=s((e,t=!1)=>{if((N??W)(e),t){let t=J.current[e];C(K.current,t,h,l)}}),Q=s(e=>{if(e.size===0||Y.current)return;Y.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&Z(r),C(K.current,n,h,l)}),ee=s((e,t,n)=>a?a?.(e,t,n,J):n),$=P.useMemo(()=>({"aria-orientation":l===`both`?void 0:l,ref:q,onFocus(e){let t=K.current,n=M(e.nativeEvent);t&&n!=null&&k(n)&&n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let s=R?v:c;if(!s.has(e.key)||z(e,H)||!K.current)return;let f=h===`rtl`,C=f?d:D,w={horizontal:C,vertical:g,both:C}[l],N=f?D:d,P={horizontal:N,vertical:u,both:N}[l],I=M(e.nativeEvent);if(I!=null&&k(I)&&!F(I)){let t=I.selectionStart,n=I.selectionEnd,r=I.value??``;if(t==null||e.shiftKey||t!==n||e.key!==P&&t<r.length||e.key!==w&&t>0)return}let L=X,U=T(J,V),W=A(J,V);if(G){let a=t||Array.from({length:J.current.length},()=>({width:1,height:1})),s=_(a,n,o),c=s.findIndex(e=>e!=null&&!S(J.current,e,V)),u=s.reduce((e,t,n)=>t!=null&&!S(J.current,t,V)?n:e,-1);L=s[x(s.map(e=>e==null?null:J.current[e]),{event:e,orientation:l,loopFocus:i,onLoop:ee,cols:n,disabledIndices:r([...V||J.current.map((e,t)=>S(J.current,t)?t:void 0),void 0],s),minIndex:c,maxIndex:u,prevIndex:p(X>W?U:X,a,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:f})]}let q={horizontal:[C],vertical:[g],both:[C,g]}[l],Y={horizontal:[N],vertical:[u],both:[N,u]}[l],Q=G?s:{horizontal:R?m:b,vertical:R?E:j,both:s}[l];R&&(e.key===`Home`?L=U:e.key===`End`&&(L=W)),L===X&&(q.includes(e.key)||Y.includes(e.key))&&(i&&L===W&&q.includes(e.key)?(L=U,a&&(L=a(e,X,L,J))):i&&L===U&&Y.includes(e.key)?(L=W,a&&(L=a(e,X,L,J))):L=y(J.current,{startingIndex:L,decrement:Y.includes(e.key),disabledIndices:V})),L!==X&&!O(J.current,L)&&(B&&e.stopPropagation(),Q.has(e.key)&&e.preventDefault(),Z(L,!0),queueMicrotask(()=>{J.current[L]?.focus()}))}}),[n,o,h,V,J,R,X,G,t,i,a,ee,q,H,Z,l,B]);return P.useMemo(()=>({props:$,highlightedIndex:X,onHighlightedIndexChange:Z,elementsRef:J,disabledIndices:V,onMapChange:Q,relayKeyboardEvent:$.onKeyDown}),[$,X,Z,J,V,Q])}function z(e,t){for(let n of i.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var B=e(n());function V(e){let{render:t,className:n,style:r,refs:i=a,props:s=a,state:c=w,stateAttributesMapping:u,highlightedIndex:d,onHighlightedIndexChange:f,orientation:p,dense:m,itemSizes:g,loopFocus:_,onLoop:v,cols:y,enableHomeAndEndKeys:b,onMapChange:x,stopEventPropagation:S=!0,rootRef:C,disabledIndices:T,modifierKeys:E,highlightItemOnHover:D=!1,tag:O=`div`,...k}=e,{props:A,highlightedIndex:j,onHighlightedIndexChange:M,elementsRef:F,onMapChange:I,relayKeyboardEvent:L}=R({itemSizes:g,cols:y,loopFocus:_,onLoop:v,dense:m,orientation:p,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:C,stopEventPropagation:S,enableHomeAndEndKeys:b,direction:N(),disabledIndices:T,modifierKeys:E}),z=o(O,e,{state:c,ref:i,props:[A,...s,k],stateAttributesMapping:u}),V=P.useMemo(()=>({highlightedIndex:j,onHighlightedIndexChange:M,highlightItemOnHover:D,relayKeyboardEvent:L}),[j,M,D,L]);return(0,B.jsx)(h.Provider,{value:V,children:(0,B.jsx)(l,{elementsRef:F,onMapChange:e=>{x?.(e),I(e)},children:z})})}export{I as n,V as t};
2
- //# sourceMappingURL=CompositeRoot-CL7X20MU.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{KS as i,MC as a,Yb as o,fv as s,mr as c,oS as l,pv as u,t as d,xS as f,yf as p}from"./utils-DjbLtxuo.js";import{B as m,nt as h}from"./runtime-BBYIQ0f-.js";import{t as g}from"./spinner-BiCpg0TU.js";import{i as _,n as ee}from"./radio-group-BnZVD-CO.js";import{t as te}from"./input-CQaedaQh.js";import{t as v}from"./preview-B4_sjsUX.js";import{r as ne,t as re}from"./alert-D6MFRWZv.js";import{t as y}from"./runtimeModeConfig-CRXk0H6e.js";import{t as b}from"./AuthSurfaceShell-C312CXz7.js";var x=n(),S=e(t(),1),C=e(r(),1),w={"read-only":{label:`Read only`,description:`Read projects and threads. Cannot start, message or change anything.`,icon:p},...y};function ie(e){return v(new URL(`http://${e}`).hostname)}var T=`Could not reach this environment. Try again.`,E=o(s);function ae(e){return m(h.pipe(f(e),i(e=>typeof e==`object`&&e&&`redirectTo`in e?{kind:`redirect`,url:e.redirectTo}:{kind:`ok`,value:e}),l(e=>a({kind:`error`,message:E(e)?e.message:T})))).catch(()=>({kind:`error`,message:T}))}function oe(){return Object.fromEntries(new URL(window.location.href).searchParams)}function D(e,t){return e.csrfToken!==void 0&&(e.oneClickAccess??[]).includes(t)}function O(){let e=(0,x.c)(71),[t]=(0,S.useState)(oe),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`loading`},e[0]=n):n=e[0];let[r,i]=(0,S.useState)(n),[a,o]=(0,S.useState)(`read-only`),[s,l]=(0,S.useState)(``),[d,f]=(0,S.useState)(``),[p,m]=(0,S.useState)(null),h,_;e[1]===t?(h=e[2],_=e[3]):(h=()=>{let e=!1;return ae(e=>e.mcpOAuth.approval({payload:t})).then(t=>{e||(t.kind===`redirect`?window.location.replace(t.url):i(t.kind===`error`?{status:`invalid`,message:t.message}:{status:`ready`,details:t.value}))}),()=>{e=!0}},_=[t],e[1]=t,e[2]=h,e[3]=_),(0,S.useEffect)(h,_);let v;e[4]!==a||e[5]!==t||e[6]!==r.details||e[7]!==r.status||e[8]!==s?(v=async e=>{if(r.status!==`ready`)return;m(e),f(``);let{csrfToken:n}=r.details,i=e===`deny`?{_tag:`deny`}:n!==void 0&&D(r.details,a)?{_tag:`browser-session`,access:a,csrfToken:n}:{_tag:`pairing-code`,access:a,code:s.trim()},o=await ae(e=>e.mcpOAuth.decision({payload:{authorization:t,decision:i}}));o.kind===`redirect`?window.location.replace(o.url):(m(null),f(o.kind===`error`?o.message:`The sign-in could not continue.`))},e[4]=a,e[5]=t,e[6]=r.details,e[7]=r.status,e[8]=s,e[9]=v):v=e[9];let y=v;if(r.status===`loading`){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(b,{children:[(0,C.jsx)(k,{title:`Checking the sign-in request`,description:`One moment while this environment verifies the agent's request.`}),(0,C.jsx)(g,{className:`mt-6`,size:`lg`,tone:`muted`})]}),e[10]=t):t=e[10],t}if(r.status===`invalid`){let t;e[11]===r.message?t=e[12]:(t=(0,C.jsx)(k,{title:`This sign-in cannot continue`,description:r.message}),e[11]=r.message,e[12]=t);let n;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,C.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Close this page and start the sign-in again from your agent.`}),e[13]=n):n=e[13];let i;return e[14]===t?i=e[15]:(i=(0,C.jsxs)(b,{children:[t,n]}),e[14]=t,e[15]=i),i}let{details:w}=r,T;e[16]!==a||e[17]!==w?(T=D(w,a),e[16]=a,e[17]=w,e[18]=T):T=e[18];let E=T,O;e[19]!==E||e[20]!==s||e[21]!==p?(O=p===null&&(E||s.trim().length>0),e[19]=E,e[20]=s,e[21]=p,e[22]=O):O=e[22];let A=O,j=`Connect ${w.clientName}`,M;e[23]===w.environmentHost?M=e[24]:(M=(0,C.jsxs)(C.Fragment,{children:[`This agent wants to use the threads in every project on`,` `,(0,C.jsx)(`span`,{className:`font-medium text-foreground`,children:w.environmentHost}),`.`]}),e[23]=w.environmentHost,e[24]=M);let N;e[25]!==j||e[26]!==M?(N=(0,C.jsx)(k,{title:j,description:M}),e[25]=j,e[26]=M,e[27]=N):N=e[27];let P;e[28]===w.redirectHost?P=e[29]:(P=(0,C.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:ie(w.redirectHost)?(0,C.jsxs)(C.Fragment,{children:[`The name is chosen by the agent. Approval returns to `,w.redirectHost,` on the computer that opened this page. Only approve a sign-in you just started.`]}):(0,C.jsxs)(C.Fragment,{children:[`The name is chosen by the agent. Approval gives access to whoever runs`,` `,(0,C.jsx)(`span`,{className:`font-medium text-foreground`,children:w.redirectHost}),`. Only approve a sign-in you just started there.`]})}),e[28]=w.redirectHost,e[29]=P);let F;e[30]!==A||e[31]!==y?(F=e=>{e.preventDefault(),A&&y(`approve`)},e[30]=A,e[31]=y,e[32]=F):F=e[32];let I;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,C.jsx)(`span`,{id:`connect-agent-access-label`,className:`text-sm font-medium`,children:`What it may do`}),e[33]=I):I=e[33];let L;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>o(e),e[34]=L):L=e[34];let R;e[35]===a?R=e[36]:(R=u.literals.map(e=>(0,C.jsx)(se,{access:e,selected:e===a},e)),e[35]=a,e[36]=R);let z;e[37]!==a||e[38]!==R?(z=(0,C.jsx)(ee,{"aria-labelledby":`connect-agent-access-label`,value:a,onValueChange:L,children:R}),e[37]=a,e[38]=R,e[39]=z):z=e[39];let B;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Beyond read only, it can start, message and stop threads, and none of them can run with more than the mode you pick.`}),e[40]=B):B=e[40];let V;e[41]===z?V=e[42]:(V=(0,C.jsxs)(`div`,{className:`space-y-2`,children:[I,z,B]}),e[41]=z,e[42]=V);let H;e[43]!==E||e[44]!==s||e[45]!==p?(H=E?null:(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:`connect-agent-pairing-code`,children:`Pairing code`}),(0,C.jsx)(te,{id:`connect-agent-pairing-code`,autoCapitalize:`none`,autoComplete:`one-time-code`,autoCorrect:`off`,disabled:p!==null,nativeInput:!0,onChange:e=>l(e.currentTarget.value),placeholder:`Paste a one-time pairing code`,spellCheck:!1,value:s}),(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Create one in Settings → Connections, or run `,(0,C.jsx)(`code`,{children:`p4c auth pairing create`}),` on this machine.`]})]}),e[43]=E,e[44]=s,e[45]=p,e[46]=H):H=e[46];let U;e[47]===d?U=e[48]:(U=d?(0,C.jsx)(re,{variant:`error`,children:(0,C.jsx)(ne,{children:d})}):null,e[47]=d,e[48]=U);let W=!A,G=p===`approve`?`Approving…`:`Approve`,K;e[49]!==W||e[50]!==G?(K=(0,C.jsx)(c,{disabled:W,type:`submit`,children:G}),e[49]=W,e[50]=G,e[51]=K):K=e[51];let q=p!==null,J;e[52]===y?J=e[53]:(J=()=>void y(`deny`),e[52]=y,e[53]=J);let Y=p===`deny`?`Denying…`:`Deny`,X;e[54]!==q||e[55]!==J||e[56]!==Y?(X=(0,C.jsx)(c,{disabled:q,onClick:J,type:`button`,variant:`outline`,children:Y}),e[54]=q,e[55]=J,e[56]=Y,e[57]=X):X=e[57];let Z;e[58]!==K||e[59]!==X?(Z=(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[K,X]}),e[58]=K,e[59]=X,e[60]=Z):Z=e[60];let Q;e[61]!==F||e[62]!==V||e[63]!==H||e[64]!==U||e[65]!==Z?(Q=(0,C.jsxs)(`form`,{className:`mt-6 space-y-5`,onSubmit:F,children:[V,H,U,Z]}),e[61]=F,e[62]=V,e[63]=H,e[64]=U,e[65]=Z,e[66]=Q):Q=e[66];let $;return e[67]!==Q||e[68]!==N||e[69]!==P?($=(0,C.jsxs)(b,{children:[N,P,Q]}),e[67]=Q,e[68]=N,e[69]=P,e[70]=$):$=e[70],$}function k(e){let t=(0,x.c)(8),{title:n,description:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsx)(`p`,{className:`text-3xs font-semibold tracking-widest text-primary uppercase`,children:`Agent sign-in`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,C.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold tracking-tight sm:text-3xl`,children:n}),t[1]=n,t[2]=a);let o;t[3]===r?o=t[4]:(o=(0,C.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:r}),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,C.jsxs)(C.Fragment,{children:[i,a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function se(e){let t=(0,x.c)(19),{access:n,selected:r}=e,{label:i,description:a,icon:o}=w[n],s=r?`border-primary bg-background ring-2 ring-inset ring-primary/25 dark:border-transparent dark:bg-primary/10 dark:ring-1 dark:ring-primary/30`:`border-border bg-background hover:bg-muted/50 dark:border-transparent dark:bg-white/[0.035] dark:hover:bg-accent`,c;t[0]===s?c=t[1]:(c=d(`flex cursor-pointer items-start gap-3 rounded-lg border px-3 py-2.5 text-left outline-none transition-[background-color,border-color,box-shadow]`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,s),t[0]=s,t[1]=c);let l=r?`text-primary`:`text-muted-foreground`,u;t[2]===l?u=t[3]:(u=d(`mt-0.5 size-4 shrink-0`,l),t[2]=l,t[3]=u);let f;t[4]!==o||t[5]!==u?(f=(0,C.jsx)(o,{"aria-hidden":!0,className:u}),t[4]=o,t[5]=u,t[6]=f):f=t[6];let p;t[7]===i?p=t[8]:(p=(0,C.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:i}),t[7]=i,t[8]=p);let m;t[9]===a?m=t[10]:(m=(0,C.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a}),t[9]=a,t[10]=m);let h;t[11]!==p||t[12]!==m?(h=(0,C.jsxs)(`span`,{className:`min-w-0`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=h):h=t[13];let g;return t[14]!==n||t[15]!==c||t[16]!==f||t[17]!==h?(g=(0,C.jsxs)(_,{value:n,className:c,children:[f,h]}),t[14]=n,t[15]=c,t[16]=f,t[17]=h,t[18]=g):g=t[18],g}export{w as n,O as t};
2
- //# sourceMappingURL=ConnectAgentSurface-B_AYPHWs.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Am as i,Fm as a,Hd as o,Jd as s,Md as c,Rd as l,Rp as u,Td as d,Vd as f,Zn as p,_m as m,am as h,ar as g,eh as _,fr as v,gh as y,ir as b,jm as x,lm as S,mr as C,nm as w,np as T,or as E,rr as D,sp as O,sr as k,t as ee,tr as A,wp as j}from"./utils-DjbLtxuo.js";import{R as te,U as ne,u as M}from"./TooltipProvider-Czzm7ro-.js";import{a as N,c as P,o as F,s as re,t as I}from"./select-Cz_1ByI4.js";import{t as ie}from"./spinner-BiCpg0TU.js";import{t as L}from"./query-D3KVoW9G.js";import{t as R}from"./use-atom-command-BbFDhw_c.js";import{u as ae}from"./rightPanelStore-DB1OP4MT.js";import{N as z}from"./PanelLayoutControls-DMUv135M.js";import{a as B,n as V,t as H}from"./tooltip-C7NAkYG3.js";import{n as oe,t as se}from"./toggle-group-DYSJFIn3.js";import{t as U}from"./input-CQaedaQh.js";import{t as ce}from"./dialog-DTVhbEqi.js";import{i as W,n as G,r as le,t as K}from"./device-DQmQm4GC.js";import{a as ue,i as de}from"./previewMiniPlayerStore-DguWdL1f.js";import{c as fe,r as q,s as J,u as Y}from"./DeviceSetup-Cdyw5Z9a.js";import{t as X}from"./discovery-list-VELXPQtS.js";import{_o as pe,bo as me,ho as he,vo as ge,yo as _e}from"./main-B1sXOjZZ.js";import{_ as ve,g as ye,h as be,x as xe}from"./_chat-BeJoXsdK.js";var Z=e(t(),1),Q=n(),Se=class extends Error{status;constructor(e){super(`Screenshot capture failed (${e}). Try again.`),this.status=e}};async function Ce(e,t){let n=e.platform===`ios`?`serve-sim`:`serve-emu`,r=ue(`${e.access.httpBase}/vendor/${n}/api/screenshot?device=${encodeURIComponent(e.deviceId)}`,e.access),i=await fetch(r,{method:`POST`,credentials:e.access.credentials?`include`:`omit`,signal:AbortSignal.any([t,AbortSignal.timeout(2e4)])});if(!i.ok)throw new Se(i.status);let a=await i.blob();if(!a.size)throw Error(`The device returned an empty screenshot. Try again.`);return a}var $=e(r(),1);function we(e){let t=(0,Q.c)(71),{view:n,handle:r,controls:s}=e,d=s.detail?.settings,f=!r?.inputConnected,h=e.hostKind===`local`||e.hostKind===`ssh`,g=d?.appearance===`dark`?`light`:`dark`,E;t[0]===r?E=t[1]:(E=()=>r?.pressButton(`home`),t[0]=r,t[1]=E);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(T,{}),t[2]=ee):ee=t[2];let N;t[3]!==f||t[4]!==E?(N=(0,$.jsx)(De,{tooltipSide:`left`,label:`Home`,disabled:f,onClick:E,children:ee}),t[3]=f,t[4]=E,t[5]=N):N=t[5];let P;t[6]!==s||t[7]!==r||t[8]!==f||t[9]!==e.platform||t[10]!==h||t[11]!==n.keyboard?.attached?(P=e.platform===`android`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{tooltipSide:`left`,label:`Back`,disabled:f,onClick:()=>r?.pressButton(`back`),children:(0,$.jsx)(o,{})}),(0,$.jsx)(De,{tooltipSide:`left`,label:`Recents`,disabled:f,onClick:()=>r?.pressButton(`recents`),children:(0,$.jsx)(a,{})}),h?(0,$.jsxs)(p,{children:[(0,$.jsx)(v,{render:(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`Rotate device`,disabled:s.disabled}),children:(0,$.jsx)(m,{})}),(0,$.jsxs)(D,{side:`left`,children:[(0,$.jsx)(A,{onClick:()=>void s.act({type:`setOrientation`,value:`portrait`}),children:`Portrait`}),(0,$.jsx)(A,{onClick:()=>void s.act({type:`setOrientation`,value:`landscape_left`}),children:`Landscape`})]})]}):null]}):(0,$.jsx)(De,{tooltipSide:`left`,label:`Rotate device`,disabled:f||!!n.keyboard?.attached,onClick:()=>r?.rotate(),children:(0,$.jsx)(m,{})}),t[6]=s,t[7]=r,t[8]=f,t[9]=e.platform,t[10]=h,t[11]=n.keyboard?.attached,t[12]=P):P=t[12];let F;t[13]!==s||t[14]!==g||t[15]!==e.onTools||t[16]!==e.toolsOpen||t[17]!==h||t[18]!==d?.appearance||t[19]!==d?.textSize?(F=h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsx)(De,{tooltipSide:`left`,label:`Switch device to ${g} mode`,disabled:s.disabled||!d?.appearance,onClick:()=>void s.act({type:`setAppearance`,value:g}),children:(0,$.jsx)(M,{icon:d?.appearance===`dark`?ne:te})}),(0,$.jsxs)(p,{children:[(0,$.jsx)(v,{render:(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`Device text size`,title:`Device text size`,disabled:s.disabled||!d?.textSize}),children:(0,$.jsx)(_,{})}),(0,$.jsx)(D,{side:`left`,className:`min-w-40`,children:(0,$.jsx)(b,{value:d?.textSize??``,onValueChange:e=>{(e===`small`||e==="default"||e===`large`||e===`extra-large`)&&s.act({type:`setTextSize`,value:e})},children:[[`small`,`Small`],[`default`,`Default`],[`large`,`Large`],[`extra-large`,`Extra large`]].map(Te)})})]}),(0,$.jsx)(De,{tooltipSide:`left`,label:`Device tools`,pressed:e.toolsOpen,onClick:e.onTools,children:(0,$.jsx)(i,{})})]}):null,t[13]=s,t[14]=g,t[15]=e.onTools,t[16]=e.toolsOpen,t[17]=h,t[18]=d?.appearance,t[19]=d?.textSize,t[20]=F):F=t[20];let re=e.screenshotPending?`Capturing screenshot`:`Save screenshot`,I=!n.streaming||e.screenshotPending,ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(l,{}),t[21]=ie):ie=t[21];let L;t[22]!==e.onScreenshot||t[23]!==re||t[24]!==I?(L=(0,$.jsx)(De,{tooltipSide:`left`,label:re,disabled:I,onClick:e.onScreenshot,children:ie}),t[22]=e.onScreenshot,t[23]=re,t[24]=I,t[25]=L):L=t[25];let R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(v,{render:(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`More device actions`,title:`More device actions`}),children:(0,$.jsx)(u,{})}),t[26]=R):R=t[26];let ae;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(w,{}),t[27]=ae):ae=t[27];let z;t[28]===e.onFloat?z=t[29]:(z=(0,$.jsxs)(A,{onClick:e.onFloat,children:[ae,`Float device over chat`]}),t[28]=e.onFloat,t[29]=z);let B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(y,{}),t[30]=B):B=t[30];let V;t[31]===e.onClose?V=t[32]:(V=(0,$.jsxs)(A,{onClick:e.onClose,children:[B,`Close device panel`]}),t[31]=e.onClose,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(k,{}),t[33]=H):H=t[33];let oe;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(S,{}),t[34]=oe):oe=t[34];let se;t[35]===e.onPowerOff?se=t[36]:(se=(0,$.jsxs)(A,{variant:`destructive`,onClick:e.onPowerOff,children:[oe,`Power off device`]}),t[35]=e.onPowerOff,t[36]=se);let U;t[37]!==z||t[38]!==V||t[39]!==se?(U=(0,$.jsxs)(p,{children:[R,(0,$.jsxs)(D,{side:`left`,align:`end`,children:[z,V,H,se]})]}),t[37]=z,t[38]=V,t[39]=se,t[40]=U):U=t[40];let ce;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(Ee,{}),t[41]=ce):ce=t[41];let W=!n.streaming||!!n.phoneUnavailableReason,G=n.phoneUnavailableReason??void 0,le;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(c,{}),t[42]=le):le=t[42];let K;t[43]!==W||t[44]!==G||t[45]!==n.phone||t[46]!==n.showPhone?(K=(0,$.jsx)(De,{tooltipSide:`left`,label:`3D view`,pressed:n.phone,disabled:W,description:G,onClick:n.showPhone,children:le}),t[43]=W,t[44]=G,t[45]=n.phone,t[46]=n.showPhone,t[47]=K):K=t[47];let ue=!n.phone,de=!n.streaming,fe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(x,{}),t[48]=fe):fe=t[48];let q;t[49]!==ue||t[50]!==de||t[51]!==n.showFlat?(q=(0,$.jsx)(De,{tooltipSide:`left`,label:`Flat view`,pressed:ue,disabled:de,onClick:n.showFlat,children:fe}),t[49]=ue,t[50]=de,t[51]=n.showFlat,t[52]=q):q=t[52];let J;t[53]===n.keyboard?J=t[54]:(J=n.keyboard?(0,$.jsx)(De,{tooltipSide:`left`,label:n.keyboard.attached?`Detach Magic Keyboard`:`Attach Magic Keyboard`,pressed:n.keyboard.attached,onClick:n.keyboard.toggle,children:(0,$.jsx)(O,{})}):null,t[53]=n.keyboard,t[54]=J);let Y;t[55]!==n.phone||t[56]!==n.resetView?(Y=n.phone?(0,$.jsx)(De,{tooltipSide:`left`,label:`Restore 3D view`,onClick:n.resetView,children:(0,$.jsx)(j,{})}):null,t[55]=n.phone,t[56]=n.resetView,t[57]=Y):Y=t[57];let X;t[58]!==U||t[59]!==N||t[60]!==K||t[61]!==q||t[62]!==J||t[63]!==Y||t[64]!==P||t[65]!==F||t[66]!==L?(X=(0,$.jsxs)(`div`,{className:`pointer-events-auto flex shrink-0 flex-col items-center gap-1 overflow-y-auto rounded-full border border-border/50 bg-background/80 p-2 shadow-sm [scrollbar-width:none]`,children:[N,P,F,L,U,ce,K,q,J,Y]}),t[58]=U,t[59]=N,t[60]=K,t[61]=q,t[62]=J,t[63]=Y,t[64]=P,t[65]=F,t[66]=L,t[67]=X):X=t[67];let pe;return t[68]!==X||t[69]!==n.foldingControls?(pe=(0,$.jsxs)(`aside`,{"aria-label":`Device controls`,"data-layout":`rail`,className:`pointer-events-none absolute inset-y-0 right-0 z-10 flex w-14 flex-col items-center gap-2 overflow-y-auto [justify-content:safe_center] py-3 pr-2 [scrollbar-width:none]`,children:[X,n.foldingControls]}),t[68]=X,t[69]=n.foldingControls,t[70]=pe):pe=t[70],pe}function Te(e){let[t,n]=e;return(0,$.jsx)(g,{value:t,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`flex-1`,children:n}),(0,$.jsx)(E,{})]})},t)}function Ee(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{"aria-hidden":!0,className:`my-1 h-px w-5 shrink-0 bg-border/70`}),e[0]=t):t=e[0],t}function De(e){let t=(0,Q.c)(18),n=e.pressed?`secondary`:`ghost`,r;t[0]!==e.children||t[1]!==e.disabled||t[2]!==e.label||t[3]!==e.onClick||t[4]!==e.pressed||t[5]!==n?(r=(0,$.jsx)(C,{size:`icon-sm`,variant:n,"aria-label":e.label,"aria-pressed":e.pressed,disabled:e.disabled,onClick:e.onClick,children:e.children}),t[0]=e.children,t[1]=e.disabled,t[2]=e.label,t[3]=e.onClick,t[4]=e.pressed,t[5]=n,t[6]=r):r=t[6];let i=r,a;t[7]!==i||t[8]!==e.description||t[9]!==e.disabled||t[10]!==e.label?(a=e.disabled&&e.description?(0,$.jsx)(B,{render:(0,$.jsx)(`span`,{className:`inline-flex`,tabIndex:0,role:`group`,"aria-label":e.label}),children:i}):(0,$.jsx)(B,{render:i}),t[7]=i,t[8]=e.description,t[9]=e.disabled,t[10]=e.label,t[11]=a):a=t[11];let o=e.description??e.label,s;t[12]!==e.tooltipSide||t[13]!==o?(s=(0,$.jsx)(V,{side:e.tooltipSide,children:o}),t[12]=e.tooltipSide,t[13]=o,t[14]=s):s=t[14];let c;return t[15]!==a||t[16]!==s?(c=(0,$.jsxs)(H,{children:[a,s]}),t[15]=a,t[16]=s,t[17]=c):c=t[17],c}var Oe=[{value:`small`,label:`Small`},{value:`default`,label:`Default`},{value:`large`,label:`Large`},{value:`extra-large`,label:`Extra large`}],ke=[{value:`none`,label:`None`},{value:`grayscale`,label:`Grayscale`},{value:`red-green`,label:`Red / green (protanopia)`},{value:`green-red`,label:`Green / red (deuteranopia)`},{value:`blue-yellow`,label:`Blue / yellow (tritanopia)`}],Ae=[{value:`portrait`,label:`Portrait`},{value:`landscape_left`,label:`Landscape left`},{value:`portrait_upside_down`,label:`Upside down`},{value:`landscape_right`,label:`Landscape right`}],je=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`reminders`,label:`Reminders`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Motion`},{value:`media-library`,label:`Media library`},{value:`faceid`,label:`Face ID`}],Me=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Physical activity`}],Ne=[{label:`San Francisco`,latitude:37.7749,longitude:-122.4194},{label:`New York`,latitude:40.7128,longitude:-74.006},{label:`London`,latitude:51.5074,longitude:-.1278},{label:`Stockholm`,latitude:59.3293,longitude:18.0686},{label:`Tokyo`,latitude:35.6762,longitude:139.6503}];function Pe(e){let t=(0,Q.c)(129),{device:n,controls:r}=e,{detail:i,pending:a,error:o,foregroundApp:s,disabled:c,act:l}=r,u=i?.settings,d=n.platform===`ios`,f;t[0]===e.className?f=t[1]:(f=ee(`flex min-h-0 flex-col border-border bg-background text-sm`,e.className),t[0]=e.className,t[1]=f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{className:`font-medium`,children:`Tools`}),t[2]=p):p=t[2];let m;t[3]===a?m=t[4]:(m=a?(0,$.jsx)(ie,{size:`sm`}):null,t[3]=a,t[4]=m);let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(y,{}),t[5]=h):h=t[5];let g;t[6]===e.onClose?g=t[7]:(g=(0,$.jsx)(C,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Close tools`,className:`ml-auto`,onClick:e.onClose,children:h}),t[6]=e.onClose,t[7]=g);let _;t[8]!==m||t[9]!==g?(_=(0,$.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b px-3`,children:[p,m,g]}),t[8]=m,t[9]=g,t[10]=_):_=t[10];let v;t[11]===o?v=t[12]:(v=o?(0,$.jsx)(`p`,{className:`border-b bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:o}):null,t[11]=o,t[12]=v);let b;t[13]!==i||t[14]!==o?(b=i===null&&!o?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(ie,{size:`sm`}),` Reading device settings…`]}):null,t[13]=i,t[14]=o,t[15]=b):b=t[15];let x;t[16]===e.hostDiagnostics?x=t[17]:(x=e.hostDiagnostics?(0,$.jsx)(Fe,{title:`Host diagnostics`,children:(0,$.jsx)(`p`,{className:`whitespace-pre-line text-xs text-muted-foreground`,children:e.hostDiagnostics})}):null,t[16]=e.hostDiagnostics,t[17]=x);let S=s?.id??`—`,w;t[18]===S?w=t[19]:(w=(0,$.jsx)(Ie,{label:`Foreground`,children:(0,$.jsx)(`span`,{className:`truncate font-mono text-xs`,children:S})}),t[18]=S,t[19]=w);let T;t[20]!==l||t[21]!==c||t[22]!==s?(T=s?(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void l({type:`terminateApp`,appId:s.id}),children:`Terminate`}),(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void l({type:`launchApp`,appId:s.id}),children:`Relaunch`})]}):null,t[20]=l,t[21]=c,t[22]=s,t[23]=T):T=t[23];let E;t[24]===l?E=t[25]:(E=e=>l({type:`openUrl`,url:e}),t[24]=l,t[25]=E);let D;t[26]!==c||t[27]!==E?(D=(0,$.jsx)(Be,{placeholder:`https://… or myapp://`,action:`Open`,disabled:c,onSubmit:E}),t[26]=c,t[27]=E,t[28]=D):D=t[28];let O=d?`Bundle ID to launch`:`Package name to launch`,k;t[29]===l?k=t[30]:(k=e=>l({type:`launchApp`,appId:e}),t[29]=l,t[30]=k);let A;t[31]!==c||t[32]!==O||t[33]!==k?(A=(0,$.jsx)(Be,{placeholder:O,action:`Launch`,disabled:c,onSubmit:k}),t[31]=c,t[32]=O,t[33]=k,t[34]=A):A=t[34];let j;t[35]!==w||t[36]!==T||t[37]!==D||t[38]!==A?(j=(0,$.jsxs)(Fe,{title:`App`,children:[w,T,D,A]}),t[35]=w,t[36]=T,t[37]=D,t[38]=A,t[39]=j):j=t[39];let te=d?`Simulator`:`Emulator`,ne;t[40]===u?ne=t[41]:(ne=u?.appearance?[u.appearance]:[],t[40]=u,t[41]=ne);let M;t[42]===l?M=t[43]:(M=e=>{let t=e[0];(t===`light`||t===`dark`)&&l({type:`setAppearance`,value:t})},t[42]=l,t[43]=M);let N,P;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(se,{value:`light`,children:`Light`}),P=(0,$.jsx)(se,{value:`dark`,children:`Dark`}),t[44]=N,t[45]=P):(N=t[44],P=t[45]);let F;t[46]!==c||t[47]!==ne||t[48]!==M?(F=(0,$.jsx)(Ie,{label:`Appearance`,children:(0,$.jsxs)(oe,{"aria-label":`Appearance`,value:ne,disabled:c,onValueChange:M,children:[N,P]})}),t[46]=c,t[47]=ne,t[48]=M,t[49]=F):F=t[49];let re=u?.textSize??null,I;t[50]===l?I=t[51]:(I=e=>l({type:`setTextSize`,value:e}),t[50]=l,t[51]=I);let L;t[52]!==c||t[53]!==re||t[54]!==I?(L=(0,$.jsx)(Ie,{label:`Text size`,children:(0,$.jsx)(Re,{ariaLabel:`Text size`,value:re,options:Oe,disabled:c,onChange:I})}),t[52]=c,t[53]=re,t[54]=I,t[55]=L):L=t[55];let R;t[56]!==l||t[57]!==c||t[58]!==d||t[59]!==u?(R=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ie,{label:`Liquid Glass`,children:(0,$.jsxs)(oe,{"aria-label":`Liquid Glass`,value:u?.liquidGlass?[u.liquidGlass]:[],disabled:c||u?.liquidGlass===void 0,onValueChange:e=>{let t=e[0];(t===`clear`||t===`tinted`)&&l({type:`setLiquidGlass`,value:t})},children:[(0,$.jsx)(se,{value:`clear`,children:`Clear`}),(0,$.jsx)(se,{value:`tinted`,children:`Tinted`})]})}),(0,$.jsx)(Ie,{label:`Color filter`,children:(0,$.jsx)(Re,{ariaLabel:`Color filter`,value:u?.colorFilter??null,options:ke,disabled:c,onChange:e=>l({type:`setColorFilter`,value:e})})})]}):(0,$.jsx)(Ie,{label:`Orientation`,children:(0,$.jsx)(Re,{ariaLabel:`Orientation`,value:null,placeholder:`Rotate to…`,options:Ae,disabled:c,onChange:e=>l({type:`setOrientation`,value:e})})}),t[56]=l,t[57]=c,t[58]=d,t[59]=u,t[60]=R):R=t[60];let ae=u?.reduceMotion,z;t[61]===l?z=t[62]:(z=e=>l({type:`setToggle`,setting:`reduceMotion`,value:e}),t[61]=l,t[62]=z);let B;t[63]!==c||t[64]!==ae||t[65]!==z?(B=(0,$.jsx)(Le,{label:`Reduce Motion`,checked:ae,disabled:c,onChange:z}),t[63]=c,t[64]=ae,t[65]=z,t[66]=B):B=t[66];let V;t[67]!==l||t[68]!==c||t[69]!==d||t[70]!==u?.increaseContrast||t[71]!==u?.networkEnabled||t[72]!==u?.reduceTransparency||t[73]!==u?.showBorders||t[74]!==u?.voiceOver?(V=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Le,{label:`Increase Contrast`,checked:u?.increaseContrast,disabled:c,onChange:e=>l({type:`setToggle`,setting:`increaseContrast`,value:e})}),(0,$.jsx)(Le,{label:`Reduce Transparency`,checked:u?.reduceTransparency,disabled:c,onChange:e=>l({type:`setToggle`,setting:`reduceTransparency`,value:e})}),(0,$.jsx)(Le,{label:`Show Borders`,checked:u?.showBorders,disabled:c,onChange:e=>l({type:`setToggle`,setting:`showBorders`,value:e})}),(0,$.jsx)(Le,{label:`VoiceOver`,checked:u?.voiceOver,disabled:c,onChange:e=>l({type:`setToggle`,setting:`voiceOver`,value:e})})]}):(0,$.jsx)(Le,{label:`Network`,checked:u?.networkEnabled,disabled:c,onChange:e=>l({type:`setToggle`,setting:`networkEnabled`,value:e})}),t[67]=l,t[68]=c,t[69]=d,t[70]=u?.increaseContrast,t[71]=u?.networkEnabled,t[72]=u?.reduceTransparency,t[73]=u?.showBorders,t[74]=u?.voiceOver,t[75]=V):V=t[75];let H;t[76]!==te||t[77]!==F||t[78]!==L||t[79]!==R||t[80]!==B||t[81]!==V?(H=(0,$.jsxs)(Fe,{title:te,children:[F,L,R,B,V]}),t[76]=te,t[77]=F,t[78]=L,t[79]=R,t[80]=B,t[81]=V,t[82]=H):H=t[82];let U=e.access===null,ce;t[83]===e?ce=t[84]:(ce=t=>(e.onAxOverlayChange(t),Promise.resolve()),t[83]=e,t[84]=ce);let W;t[85]!==e.axOverlay||t[86]!==U||t[87]!==ce?(W=(0,$.jsx)(Fe,{title:`Accessibility`,children:(0,$.jsx)(Le,{label:`Overlay element frames`,checked:e.axOverlay,disabled:U,onChange:ce})}),t[85]=e.axOverlay,t[86]=U,t[87]=ce,t[88]=W):W=t[88];let G,le;t[89]===l?(G=t[90],le=t[91]):(G=(e,t)=>l({type:`setLocation`,latitude:e,longitude:t}),le=()=>l({type:`clearLocation`}),t[89]=l,t[90]=G,t[91]=le);let K;t[92]!==c||t[93]!==d||t[94]!==G||t[95]!==le?(K=(0,$.jsx)(Ve,{disabled:c,canClear:d,onSet:G,onClear:le}),t[92]=c,t[93]=d,t[94]=G,t[95]=le,t[96]=K):K=t[96];let ue=d?je:Me,de=s?.id??``,fe;t[97]===l?fe=t[98]:(fe=(e,t,n)=>l({type:`setPermission`,appId:e,permission:t,decision:n}),t[97]=l,t[98]=fe);let q;t[99]!==c||t[100]!==d||t[101]!==ue||t[102]!==de||t[103]!==fe?(q=(0,$.jsx)(Ue,{permissions:ue,canReset:d,defaultAppId:de,disabled:c,onDecide:fe}),t[99]=c,t[100]=d,t[101]=ue,t[102]=de,t[103]=fe,t[104]=q):q=t[104];let J;t[105]!==l||t[106]!==c||t[107]!==s||t[108]!==d?(J=d?(0,$.jsxs)(Fe,{title:`Push notification`,children:[(0,$.jsx)(Be,{placeholder:`Alert text`,action:`Send`,disabled:c||!s,onSubmit:e=>s?l({type:`sendPush`,appId:s.id,payload:e}):Promise.resolve()}),s?null:(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Open an app first.`})]}):null,t[105]=l,t[106]=c,t[107]=s,t[108]=d,t[109]=J):J=t[109];let Y;t[110]!==n||t[111]!==d||t[112]!==e.access?(Y=d&&e.access?(0,$.jsx)(Ge,{access:e.access,device:n}):null,t[110]=n,t[111]=d,t[112]=e.access,t[113]=Y):Y=t[113];let X;t[114]!==j||t[115]!==H||t[116]!==W||t[117]!==K||t[118]!==q||t[119]!==J||t[120]!==Y||t[121]!==v||t[122]!==b||t[123]!==x?(X=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[v,b,x,j,H,W,K,q,J,Y]}),t[114]=j,t[115]=H,t[116]=W,t[117]=K,t[118]=q,t[119]=J,t[120]=Y,t[121]=v,t[122]=b,t[123]=x,t[124]=X):X=t[124];let pe;return t[125]!==f||t[126]!==X||t[127]!==_?(pe=(0,$.jsxs)(`div`,{className:f,children:[_,X]}),t[125]=f,t[126]=X,t[127]=_,t[128]=pe):pe=t[128],pe}function Fe(e){let t=(0,Q.c)(5),n;t[0]===e.title?n=t[1]:(n=(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.title}),t[0]=e.title,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,$.jsxs)(`section`,{className:`flex flex-col gap-2 border-b px-3 py-2.5 last:border-b-0`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function Ie(e){let t=(0,Q.c)(7),n;t[0]===e.label?n=t[1]:(n=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.label}),t[0]=e.label,t[1]=n);let r;t[2]===e.children?r=t[3]:(r=(0,$.jsx)(`div`,{className:`flex min-w-0 items-center justify-end`,children:e.children}),t[2]=e.children,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,$.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Le(e){let t=(0,Q.c)(10),n=e.checked??!1,r=e.disabled||e.checked===void 0,i;t[0]===e?i=t[1]:(i=t=>void e.onChange(t),t[0]=e,t[1]=i);let a;t[2]!==e.label||t[3]!==n||t[4]!==r||t[5]!==i?(a=(0,$.jsx)(me,{size:`sm`,"aria-label":e.label,checked:n,disabled:r,onCheckedChange:i}),t[2]=e.label,t[3]=n,t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.label||t[8]!==a?(o=(0,$.jsx)(Ie,{label:e.label,children:a}),t[7]=e.label,t[8]=a,t[9]=o):o=t[9],o}function Re(e){let t=(0,Q.c)(25),n;if(t[0]!==e.options||t[1]!==e.value){let r;t[3]===e.value?r=t[4]:(r=t=>t.value===e.value,t[3]=e.value,t[4]=r),n=e.options.find(r),t[0]=e.options,t[1]=e.value,t[2]=n}else n=t[2];let r=n,i=e.value,a=e.disabled,o;t[5]===e?o=t[6]:(o=t=>{t!==null&&t!==e.value&&e.onChange(t)},t[5]=e,t[6]=o);let s;t[7]!==r||t[8]!==e.placeholder?(s=r?r.label:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.placeholder??`Unknown`}),t[7]=r,t[8]=e.placeholder,t[9]=s):s=t[9];let c;t[10]===s?c=t[11]:(c=(0,$.jsx)(P,{children:s}),t[10]=s,t[11]=c);let l;t[12]!==e.ariaLabel||t[13]!==c?(l=(0,$.jsx)(re,{size:`xs`,className:`w-40`,"aria-label":e.ariaLabel,children:c}),t[12]=e.ariaLabel,t[13]=c,t[14]=l):l=t[14];let u;t[15]===e.options?u=t[16]:(u=e.options.map(ze),t[15]=e.options,t[16]=u);let d;t[17]===u?d=t[18]:(d=(0,$.jsx)(F,{align:`end`,alignItemWithTrigger:!1,children:u}),t[17]=u,t[18]=d);let f;return t[19]!==e.disabled||t[20]!==e.value||t[21]!==o||t[22]!==l||t[23]!==d?(f=(0,$.jsxs)(I,{value:i,disabled:a,onValueChange:o,children:[l,d]}),t[19]=e.disabled,t[20]=e.value,t[21]=o,t[22]=l,t[23]=d,t[24]=f):f=t[24],f}function ze(e){return(0,$.jsx)(N,{value:e.value,children:e.label},e.value)}function Be(e){let t=(0,Q.c)(20),[n,r]=(0,Z.useState)(``),i;t[0]!==e||t[1]!==n?(i=()=>{let t=n.trim();t&&e.onSubmit(t).then(()=>r(``))},t[0]=e,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a?o=t[4]:(o=e=>{e.preventDefault(),a()},t[3]=a,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>r(e.target.value),t[5]=s):s=t[5];let c;t[6]!==e.disabled||t[7]!==e.placeholder||t[8]!==n?(c=(0,$.jsx)(U,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:e.placeholder,value:n,disabled:e.disabled,onChange:s}),t[6]=e.disabled,t[7]=e.placeholder,t[8]=n,t[9]=c):c=t[9];let l;t[10]!==e.disabled||t[11]!==n?(l=e.disabled||n.trim().length===0,t[10]=e.disabled,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==e.action||t[14]!==l?(u=(0,$.jsx)(C,{type:`submit`,size:`xs`,variant:`outline`,disabled:l,children:e.action}),t[13]=e.action,t[14]=l,t[15]=u):u=t[15];let d;return t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,$.jsxs)(`form`,{className:`flex gap-1.5`,onSubmit:o,children:[c,u]}),t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function Ve(e){let t=(0,Q.c)(40),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),o=Number(n),s=Number(i),c,l;t[0]!==n||t[1]!==i||t[2]!==o||t[3]!==s?(c={latitude:o,longitude:s},l=n.trim()!==``&&i.trim()!==``&&Math.abs(c.latitude)<=90&&Math.abs(c.longitude)<=180,t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l):(c=t[4],l=t[5]);let u=l,d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==e.disabled?(f=(0,$.jsx)(U,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Latitude`,inputMode:`decimal`,value:n,disabled:e.disabled,onChange:d}),t[7]=n,t[8]=e.disabled,t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>a(e.target.value),t[10]=p):p=t[10];let m;t[11]!==i||t[12]!==e.disabled?(m=(0,$.jsx)(U,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Longitude`,inputMode:`decimal`,value:i,disabled:e.disabled,onChange:p}),t[11]=i,t[12]=e.disabled,t[13]=m):m=t[13];let h;t[14]!==f||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16];let g;t[17]===e?g=t[18]:(g=t=>{let n=Ne.find(e=>e.label===t);n&&(r(String(n.latitude)),a(String(n.longitude)),e.onSet(n.latitude,n.longitude))},t[17]=e,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(re,{size:`xs`,className:`w-32`,"aria-label":`Location preset`,children:(0,$.jsx)(P,{children:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Preset…`})})}),t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(F,{align:`start`,alignItemWithTrigger:!1,children:Ne.map(He)}),t[20]=v):v=t[20];let y;t[21]!==e.disabled||t[22]!==g?(y=(0,$.jsxs)(I,{value:null,disabled:e.disabled,onValueChange:g,children:[_,v]}),t[21]=e.disabled,t[22]=g,t[23]=y):y=t[23];let b=e.disabled||!u,x;t[24]!==c.latitude||t[25]!==c.longitude||t[26]!==e?(x=()=>void e.onSet(c.latitude,c.longitude),t[24]=c.latitude,t[25]=c.longitude,t[26]=e,t[27]=x):x=t[27];let S;t[28]!==b||t[29]!==x?(S=(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:b,onClick:x,children:`Set`}),t[28]=b,t[29]=x,t[30]=S):S=t[30];let w;t[31]===e?w=t[32]:(w=e.canClear?(0,$.jsx)(C,{size:`xs`,variant:`ghost`,disabled:e.disabled,onClick:()=>{r(``),a(``),e.onClear()},children:`Clear`}):null,t[31]=e,t[32]=w);let T;t[33]!==y||t[34]!==S||t[35]!==w?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[y,S,w]}),t[33]=y,t[34]=S,t[35]=w,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==h?(E=(0,$.jsxs)(Fe,{title:`Location`,children:[h,T]}),t[37]=T,t[38]=h,t[39]=E):E=t[39],E}function He(e){return(0,$.jsx)(N,{value:e.label,children:e.label},e.label)}function Ue(e){let t=(0,Q.c)(40),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(`camera`),o;t[0]!==n||t[1]!==e.defaultAppId?(o=n.trim()||e.defaultAppId,t[0]=n,t[1]=e.defaultAppId,t[2]=o):o=t[2];let s=o,c;t[3]!==i||t[4]!==e||t[5]!==s?(c=t=>void e.onDecide(s,i,t),t[3]=i,t[4]=e,t[5]=s,t[6]=c):c=t[6];let l=c,u=e.defaultAppId||`App ID`,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==e.disabled||t[10]!==u?(f=(0,$.jsx)(U,{size:`compact`,font:`mono`,placeholder:u,value:n,disabled:e.disabled,onChange:d}),t[8]=n,t[9]=e.disabled,t[10]=u,t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(a(e),Promise.resolve()),t[12]=p):p=t[12];let m;t[13]!==i||t[14]!==e.disabled||t[15]!==e.permissions?(m=(0,$.jsx)(Re,{ariaLabel:`Permission`,value:i,options:e.permissions,disabled:e.disabled,onChange:p}),t[13]=i,t[14]=e.disabled,t[15]=e.permissions,t[16]=m):m=t[16];let h=e.disabled||!s,g;t[17]===l?g=t[18]:(g=()=>l(`grant`),t[17]=l,t[18]=g);let _;t[19]!==h||t[20]!==g?(_=(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:h,onClick:g,children:`Grant`}),t[19]=h,t[20]=g,t[21]=_):_=t[21];let v=e.disabled||!s,y;t[22]===l?y=t[23]:(y=()=>l(`revoke`),t[22]=l,t[23]=y);let b;t[24]!==v||t[25]!==y?(b=(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:v,onClick:y,children:`Revoke`}),t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;t[27]!==l||t[28]!==e.canReset||t[29]!==e.disabled||t[30]!==s?(x=e.canReset?(0,$.jsx)(C,{size:`xs`,variant:`ghost`,disabled:e.disabled||!s,onClick:()=>l(`reset`),children:`Reset`}):null,t[27]=l,t[28]=e.canReset,t[29]=e.disabled,t[30]=s,t[31]=x):x=t[31];let S;t[32]!==b||t[33]!==x||t[34]!==m||t[35]!==_?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m,_,b,x]}),t[32]=b,t[33]=x,t[34]=m,t[35]=_,t[36]=S):S=t[36];let w;return t[37]!==S||t[38]!==f?(w=(0,$.jsxs)(Fe,{title:`Permissions`,children:[f,S]}),t[37]=S,t[38]=f,t[39]=w):w=t[39],w}var We=100;function Ge(e){let t=(0,Q.c)(19),[n,r]=(0,Z.useState)(!1),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Z.useState)(i),s,c;t[1]!==n||t[2]!==e.access||t[3]!==e.device.id||t[4]!==e.device.platform?(s=()=>{if(!n)return;let t=ye({access:e.access,platform:e.device.platform,deviceId:e.device.id},(e,t)=>{o(n=>{let r=t?[...e]:[...n,...e];return r.length>We?r.slice(-100):r})});return()=>{t(),o([])}},c=[n,e.access,e.device.id,e.device.platform],t[1]=n,t[2]=e.access,t[3]=e.device.id,t[4]=e.device.platform,t[5]=s,t[6]=c):(s=t[5],c=t[6]),(0,Z.useEffect)(s,c);let l=n&&`rotate-180`,u;t[7]===l?u=t[8]:(u=ee(`ml-auto size-3.5 transition-transform`,l),t[7]=l,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,$.jsxs)(_e,{className:`flex w-full items-center gap-1.5 border-b px-3 py-2.5 text-left text-xs font-medium text-muted-foreground`,children:[`Event log`,(0,$.jsx)(f,{className:u})]}),t[9]=u,t[10]=d);let p;t[11]===a?p=t[12]:(p=a.length===0?(0,$.jsx)(`li`,{className:`text-muted-foreground`,children:`No events yet.`}):a.map(Ke),t[11]=a,t[12]=p);let m;t[13]===p?m=t[14]:(m=(0,$.jsx)(ge,{children:(0,$.jsx)(`ol`,{className:`max-h-64 overflow-y-auto px-3 py-2 font-mono text-2xs leading-relaxed`,children:p})}),t[13]=p,t[14]=m);let h;return t[15]!==n||t[16]!==d||t[17]!==m?(h=(0,$.jsxs)(pe,{open:n,onOpenChange:r,children:[d,m]}),t[15]=n,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function Ke(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.timestamp.slice(11,19)}),(0,$.jsx)(`span`,{className:`truncate`,children:e.summary})]},e.id)}function qe(e){let t=(0,Q.c)(30),{environmentId:n,device:r,access:i,visible:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={reportFailure:!1},t[0]=o):o=t[0];let s=R(K.detail,o),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[1]=c):c=t[1];let l=R(K.action,c),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(),v=(0,Z.useRef)(!1),y=(0,Z.useRef)(0),b=(0,Z.useRef)(null),x;t[2]!==r.hostId||t[3]!==r.id?(x={hostId:r.hostId,deviceId:r.id},t[2]=r.hostId,t[3]=r.id,t[4]=x):x=t[4];let S=x,C,w;t[5]!==n||t[6]!==s||t[7]!==S||t[8]!==a?(C=()=>{let e=y.current+=1;if(!a)return;let t={environmentId:n,input:S};return b.current=t,s(t).then(t=>{y.current===e&&(t._tag===`Success`?(d(t.value),h(null)):(d(null),h(L(t.cause))))}),()=>{b.current=null,y.current+=1}},w=[n,s,S,a],t[5]=n,t[6]=s,t[7]=S,t[8]=a,t[9]=C,t[10]=w):(C=t[9],w=t[10]),(0,Z.useEffect)(C,w);let T,E;t[11]!==i||t[12]!==r.id||t[13]!==r.platform||t[14]!==a?(T=()=>{if(!i||!a)return;let e=!0,t=ve({access:i,platform:r.platform,deviceId:r.id},t=>{e&&_(t)});return()=>{e=!1,t(),_(void 0)}},E=[i,r.id,r.platform,a],t[11]=i,t[12]=r.id,t[13]=r.platform,t[14]=a,t[15]=T,t[16]=E):(T=t[15],E=t[16]),(0,Z.useEffect)(T,E);let D=u!==null&&a,O;t[17]!==D||t[18]!==n||t[19]!==s||t[20]!==l||t[21]!==S?(O=async e=>{if(v.current||!D)return;v.current=!0;let t=y.current+=1;return p(!0),h(null),l({environmentId:n,input:{...S,...e}}).then(e=>{if(y.current!==t){let e=b.current;if(!e)return;let t=y.current+=1;return s(e).then(e=>{y.current===t&&(e._tag===`Success`?(d(e.value),h(null)):(d(null),h(L(e.cause))))})}e._tag===`Success`?d(e.value):h(L(e.cause))}).finally(()=>{v.current=!1,p(!1)})},t[17]=D,t[18]=n,t[19]=s,t[20]=l,t[21]=S,t[22]=O):O=t[22];let k=O,ee=f||!u||!a,A=g===void 0?u?.foregroundApp??null:g,j;return t[23]!==k||t[24]!==u||t[25]!==m||t[26]!==f||t[27]!==ee||t[28]!==A?(j={detail:u,pending:f,error:m,act:k,disabled:ee,foregroundApp:A},t[23]=k,t[24]=u,t[25]=m,t[26]=f,t[27]=ee,t[28]=A,t[29]=j):j=t[29],j}function Je(e){let t=(0,Q.c)(53),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=le(e.environmentId,e.device.hostId),h=e.hostKind===`local`||e.hostKind===`ssh`,g=e.visible&&h,_;t[0]!==m||t[1]!==e||t[2]!==g?(_={...e,access:m,visible:g},t[0]=m,t[1]=e,t[2]=g,t[3]=_):_=t[3];let v=qe(_),y,b;t[4]!==m||t[5]!==e.visible?(y=()=>(m&&e.visible||f.current?.abort(),()=>{f.current?.abort(),p.current&&URL.revokeObjectURL(p.current),p.current=null}),b=[m,e.visible],t[4]=m,t[5]=e.visible,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Z.useEffect)(y,b);let x;t[8]!==m||t[9]!==e.device.id||t[10]!==e.device.name||t[11]!==e.device.platform||t[12]!==e.environmentId||t[13]!==e.visible?(x=()=>{if(!m||f.current||!e.visible)return;let t=new AbortController;return f.current=t,l(!0),d(null),Ce({access:m,platform:e.device.platform,deviceId:e.device.id},t.signal).then(n=>{if(t.signal.aborted)return;p.current&&URL.revokeObjectURL(p.current);let r=URL.createObjectURL(n);p.current=r;let i=document.createElement(`a`);i.href=r,i.download=`${e.device.name.replace(/[^a-z0-9-]/gi,`-`)}-${Date.now()}.png`,document.body.append(i),i.click(),i.remove()}).catch(n=>{t.signal.aborted||(n instanceof Se&&n.status===401&&G(e.environmentId),d(n instanceof Error?n.message:`Screenshot capture failed. Try again.`))}).finally(()=>{f.current===t&&(f.current=null,l(!1))})},t[8]=m,t[9]=e.device.id,t[10]=e.device.name,t[11]=e.device.platform,t[12]=e.environmentId,t[13]=e.visible,t[14]=x):x=t[14];let S=x,C;t[15]!==v||t[16]!==u||t[17]!==i?(C=u||v.error&&!i?(0,$.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:u??v.error}):null,t[15]=v,t[16]=u,t[17]=i,t[18]=C):C=t[18];let w=`${e.hostLabel} · ${e.device.version}`,T;t[19]!==v||t[20]!==n||t[21]!==e.device.platform||t[22]!==e.hostKind||t[23]!==e.onClose||t[24]!==e.onFloat||t[25]!==e.onPowerOff||t[26]!==S||t[27]!==c||t[28]!==i?(T=t=>(0,$.jsx)(we,{platform:e.device.platform,hostKind:e.hostKind,handle:n,view:t,controls:v,screenshotPending:c,onScreenshot:()=>void S(),toolsOpen:i,onTools:()=>a(!i),onFloat:e.onFloat,onClose:e.onClose,onPowerOff:e.onPowerOff}),t[19]=v,t[20]=n,t[21]=e.device.platform,t[22]=e.hostKind,t[23]=e.onClose,t[24]=e.onFloat,t[25]=e.onPowerOff,t[26]=S,t[27]=c,t[28]=i,t[29]=T):T=t[29];let E;t[30]!==o||t[31]!==e.device.hostId||t[32]!==e.device.id||t[33]!==e.device.name||t[34]!==e.device.platform||t[35]!==e.environmentId||t[36]!==e.visible||t[37]!==w||t[38]!==T?(E=(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(be,{environmentId:e.environmentId,platform:e.device.platform,deviceName:e.device.name,deviceDescription:w,deviceId:e.device.id,hostId:e.device.hostId,visible:e.visible,axOverlay:o,allowPhoneView:!0,onHandle:r,renderControls:T})}),t[30]=o,t[31]=e.device.hostId,t[32]=e.device.id,t[33]=e.device.name,t[34]=e.device.platform,t[35]=e.environmentId,t[36]=e.visible,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D;t[40]!==C||t[41]!==E?(D=(0,$.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[C,E]}),t[40]=C,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==m||t[44]!==o||t[45]!==v||t[46]!==e.device||t[47]!==e.hostDiagnostics||t[48]!==i?(O=i?(0,$.jsx)(Pe,{device:e.device,controls:v,hostDiagnostics:e.hostDiagnostics,access:m,axOverlay:o,onAxOverlayChange:s,onClose:()=>a(!1),className:`absolute inset-y-0 right-0 z-10 w-full max-w-72 border-l shadow-lg @[700px]:static @[700px]:w-72 @[700px]:shrink-0 @[700px]:shadow-none`}):null,t[43]=m,t[44]=o,t[45]=v,t[46]=e.device,t[47]=e.hostDiagnostics,t[48]=i,t[49]=O):O=t[49];let k;return t[50]!==O||t[51]!==D?(k=(0,$.jsxs)($.Fragment,{children:[D,O]}),t[50]=O,t[51]=D,t[52]=k):k=t[52],k}var Ye=e=>e===`ios`?`iOS Simulators`:`Android Emulators`,Xe=e=>`${e.hostId}\u0000${e.id}`;function Ze(e){let t=(0,Q.c)(87),{environmentId:n,threadId:r}=e.threadRef,{state:i,loaded:a,error:o,refresh:s}=W(n),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[0]=c):c=t[0];let l=R(K.list,c),u=R(K.open),f=R(K.close),p=`${n}\u0000${r}`,[m,g]=(0,Z.useState)(null),_=m?.scope===p?m.pending:null,v=m?.scope===p?m.error:null,y;t[1]===_?y=t[2]:(y=_?Xe(_):null,t[1]=_,t[2]=y);let b=y,S=i.hostStatus===`disabled`,w,T;t[3]!==n||t[4]!==S||t[5]!==l||t[6]!==a||t[7]!==e.visible?(w=()=>{e.visible&&a&&!S&&l({environmentId:n,input:{}})},T=[n,l,a,e.visible,S],t[3]=n,t[4]=S,t[5]=l,t[6]=a,t[7]=e.visible,t[8]=w,t[9]=T):(w=t[8],T=t[9]),(0,Z.useEffect)(w,T);let E;if(t[10]!==e.surface.target||t[11]!==i.sessions||t[12]!==r){let n;t[14]===r?n=t[15]:(n=e=>e.threadId===r,t[14]=r,t[15]=n);let a=i.sessions.filter(n);E=e.surface.target?a.find(t=>t.deviceId===e.surface.target?.deviceId&&t.hostId===e.surface.target.hostId):void 0,t[10]=e.surface.target,t[11]=i.sessions,t[12]=r,t[13]=E}else E=t[13];let D=E,O,k,A,j,te,ne,M;if(t[16]!==D||t[17]!==f||t[18]!==n||t[19]!==S||t[20]!==l||t[21]!==a||t[22]!==u||t[23]!==v||t[24]!==_||t[25]!==b||t[26]!==e||t[27]!==s||t[28]!==p||t[29]!==i||t[30]!==o||t[31]!==r){k=Symbol.for(`react.early_return_sentinel`);bb0:{let c=D?i.devices.find(e=>e.hostId===D.hostId&&e.id===D.deviceId):void 0,m=at(i),y;t[39]===p?y=t[40]:(y=e=>{let t={scope:p,pending:e,error:null};return g(t),e=>g(n=>n===t?{...t,pending:null,error:e}:n)},t[39]=p,t[40]=y);let w=y,T;t[41]!==n||t[42]!==u||t[43]!==e.threadRef||t[44]!==w||t[45]!==i.devices||t[46]!==r?(T=async t=>{let a=i.devices.find(e=>Xe(e)===t);if(!a)return;let o=w(a),s=await u({environmentId:n,input:{threadId:r,hostId:a.hostId,deviceId:a.id,platform:a.platform}});s._tag===`Failure`?o(L(s.cause)):(ae.getState().openDevice(e.threadRef,{hostId:s.value.hostId,deviceId:s.value.deviceId,platform:a.platform,name:a.name}),o(null))},t[41]=n,t[42]=u,t[43]=e.threadRef,t[44]=w,t[45]=i.devices,t[46]=r,t[47]=T):T=t[47];let E=T,N=()=>{c&&(de.getState().open(e.threadRef,{kind:`device`,hostId:c.hostId,deviceId:c.id,platform:c.platform,name:c.name}),ae.getState().close(e.threadRef))},P;t[48]!==D||t[49]!==f||t[50]!==n||t[51]!==e.surface.id||t[52]!==e.threadRef||t[53]!==w||t[54]!==r?(P=t=>{if(!t){ae.getState().closeSurface(e.threadRef,e.surface.id);return}if(!D)return;let i=w(null);f({environmentId:n,input:{threadId:r,hostId:D.hostId,deviceId:D.deviceId,shutdown:t}}).then(t=>{t._tag===`Failure`?i(L(t.cause)):ae.getState().closeSurface(e.threadRef,e.surface.id)})},t[48]=D,t[49]=f,t[50]=n,t[51]=e.surface.id,t[52]=e.threadRef,t[53]=w,t[54]=r,t[55]=P):P=t[55];let F=P,re=i.bootingDevices?.filter(e=>e.threadId===r)??[],{ready:I,busy:R}=J(i),B=!c&&(_!==null||R||!a),V=a?null:o,H;t[56]!==i.hostStatus||t[57]!==i.hostStatusDetail||t[58]!==i.hostStatuses?(H=e=>{let t=i.hostStatuses[e.id],n=t?.detail??(e.kind===`local`?i.hostStatusDetail:void 0);return n&&(t?.status??i.hostStatus)===`ready`?[{hostId:e.id,label:e.label,detail:n}]:[]},t[56]=i.hostStatus,t[57]=i.hostStatusDetail,t[58]=i.hostStatuses,t[59]=H):H=t[59];let oe=i.hosts.flatMap(H),se=i.hosts.flatMap(tt);if(a&&(!i.onboardingCompleted||S)){let r;t[60]===e?r=t[61]:(r=t=>{t||e.onDismissSetup()},t[60]=e,t[61]=r);let a;t[62]!==n||t[63]!==i?(a=(0,$.jsx)(he,{children:(0,$.jsx)(q,{environmentId:n,state:i})}),t[62]=n,t[63]=i,t[64]=a):a=t[64];let o;t[65]!==e.visible||t[66]!==r||t[67]!==a?(o=(0,$.jsx)(ce,{open:e.visible,onOpenChange:r,children:a}),t[65]=e.visible,t[66]=r,t[67]=a,t[68]=o):o=t[68],k=o;break bb0}O=z,M=e.mode,te=`relative flex min-h-0 flex-1 flex-col`;let U;t[69]===n?U=t[70]:(U=e=>(0,$.jsx)(it,{label:e.label,detail:e.detail},`${n}\u0000${e.hostId}\u0000${e.detail}`),t[69]=n,t[70]=U);let W;t[71]!==n||t[72]!==i?(W=(0,$.jsx)(Y,{state:i,environmentId:n}),t[71]=n,t[72]=i,t[73]=W):W=t[73];let G;t[74]===v?G=t[75]:(G=v?(0,$.jsx)(rt,{tone:`error`,onDismiss:()=>g(null),children:v}):null,t[74]=v,t[75]=G),ne=(0,$.jsxs)(`div`,{className:ee(`shrink-0 bg-background`,B&&`absolute inset-x-0 top-0 z-10 max-h-[40%] overflow-y-auto`),children:[(0,$.jsx)(`div`,{hidden:!!c,children:oe.map(U)}),W,re.length>0?(0,$.jsxs)(`div`,{role:`status`,className:`border-b px-3 py-2 text-xs text-muted-foreground`,children:[`Starting `,re.map(et).join(`, `),`… This can take a minute.`]}):null,G]}),A=`@container relative flex min-h-0 flex-1`,j=c&&D?(0,$.jsx)(Je,{environmentId:n,device:c,hostLabel:i.hosts.find(e=>e.id===c.hostId)?.label??`Device host`,hostKind:i.hosts.find(e=>e.id===c.hostId)?.kind,hostDiagnostics:oe.find(e=>{let{hostId:t}=e;return t===c.hostId})?.detail,visible:e.visible,onFloat:N,onClose:()=>F(!1),onPowerOff:()=>F(!0)},`${n}\u0000${Xe(c)}`):B?(0,$.jsx)(xe,{name:_?.name??`Devices`,description:_?`${i.hosts.find(e=>e.id===_.hostId)?.label??`Device host`} · ${_.version}`:``,stage:`opening`,message:V??(_?_.booted?`Opening device…`:`Starting device…`:i.hostStatus===`installing`?i.hostStatusDetail??`Installing device support…`:`Finding devices…`),error:V!==null,children:V===null?null:(0,$.jsx)(C,{size:`sm`,variant:`outline`,onClick:s,children:`Retry`})}):(0,$.jsx)(`div`,{className:`scrollbar-gutter-both flex size-full flex-col overflow-y-auto px-5 py-8 text-sm text-muted-foreground`,children:(0,$.jsxs)(`div`,{className:ee(`mx-auto flex w-full max-w-xl flex-col gap-6`,m.length===0&&`my-auto items-center text-center`),children:[m.length===0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(x,{className:`size-6 opacity-60`}),(0,$.jsx)(`p`,{className:`max-h-32 w-full max-w-sm overflow-y-auto whitespace-pre-line break-words`,tabIndex:i.hostStatus===`failed`?0:void 0,children:i.hostStatus===`failed`?i.hostStatusDetail??`The device hub failed to start.`:`No simulators or emulators were found on this environment.`})]}):null,I&&m.length>0?(0,$.jsx)(`div`,{className:`w-full space-y-6 text-left`,children:m.map(e=>(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(x,{className:`size-4 shrink-0`}),(0,$.jsx)(`h3`,{className:`font-medium`,children:Ye(e.platform)})]}),(0,$.jsx)(X,{children:e.devices.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-3`,children:[(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md border border-border/60`,children:(0,$.jsx)(x,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:`${i.hosts.find(t=>t.id===e.hostId)?.label} · ${e.version} · ${e.booted?`Running`:`Stopped`}`})]}),(0,$.jsxs)(C,{variant:`outline`,size:`sm`,disabled:b!==null,"aria-label":`${e.booted?`Open`:`Start`} ${e.name}`,onClick:()=>void E(Xe(e)),children:[b===Xe(e)?(0,$.jsx)(ie,{size:`xs`}):e.booted?(0,$.jsx)(d,{}):(0,$.jsx)(h,{}),e.booted?`Open`:`Start`]})]},Xe(e)))})]},e.platform))}):null,I&&!fe(i)&&!i.devices.some($e)&&!se.some(Qe)?(0,$.jsx)(`p`,{className:`max-w-sm text-xs`,children:`No Android virtual devices found. Create one in Android Studio's Device Manager, then refresh.`}):null,a&&!R?(0,$.jsx)(C,{className:m.length>0?`self-start`:`self-center`,variant:`outline`,size:`sm`,onClick:()=>void l({environmentId:n,input:{}}),children:`Refresh devices`}):null]})})}t[16]=D,t[17]=f,t[18]=n,t[19]=S,t[20]=l,t[21]=a,t[22]=u,t[23]=v,t[24]=_,t[25]=b,t[26]=e,t[27]=s,t[28]=p,t[29]=i,t[30]=o,t[31]=r,t[32]=O,t[33]=k,t[34]=A,t[35]=j,t[36]=te,t[37]=ne,t[38]=M}else O=t[32],k=t[33],A=t[34],j=t[35],te=t[36],ne=t[37],M=t[38];if(k!==Symbol.for(`react.early_return_sentinel`))return k;let N;t[76]!==A||t[77]!==j?(N=(0,$.jsx)(`div`,{className:A,children:j}),t[76]=A,t[77]=j,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==te||t[81]!==ne?(P=(0,$.jsxs)(`div`,{className:te,children:[ne,N]}),t[79]=N,t[80]=te,t[81]=ne,t[82]=P):P=t[82];let F;return t[83]!==O||t[84]!==P||t[85]!==M?(F=(0,$.jsx)(O,{mode:M,children:P}),t[83]=O,t[84]=P,t[85]=M,t[86]=F):F=t[86],F}function Qe(e){return e.platform===`android`}function $e(e){return e.platform===`android`}function et(e){return e.name}function tt(e){return e.platforms.filter(nt).map(t=>({...t,hostId:e.id,hostLabel:e.label}))}function nt(e){return!e.available}function rt(e){let t=(0,Q.c)(13),n=e.tone===`warning`?`bg-warning-surface text-warning-foreground`:`bg-destructive/5 text-destructive`,r;t[0]===n?r=t[1]:(r=ee(`flex items-start gap-2 border-b px-3 py-2 text-xs`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(s,{className:`mt-1 size-3.5 shrink-0`}),t[2]=i):i=t[2];let a;t[3]===e.children?a=t[4]:(a=(0,$.jsx)(`div`,{className:`max-h-32 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words`,tabIndex:0,children:e.children}),t[3]=e.children,t[4]=a);let o=e.tone===`warning`?`Dismiss device warning`:`Dismiss device error`,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(y,{}),t[5]=c):c=t[5];let l;t[6]!==e.onDismiss||t[7]!==o?(l=(0,$.jsx)(C,{size:`icon-xs`,variant:`ghost`,"aria-label":o,onClick:e.onDismiss,children:c}),t[6]=e.onDismiss,t[7]=o,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==a||t[11]!==l?(u=(0,$.jsxs)(`div`,{role:`alert`,className:r,children:[i,a,l]}),t[9]=r,t[10]=a,t[11]=l,t[12]=u):u=t[12],u}function it(e){let t=(0,Q.c)(6),[n,r]=(0,Z.useState)(!1);if(n)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>r(!0),t[0]=i):i=t[0];let a;t[1]===e.label?a=t[2]:(a=(0,$.jsxs)(`p`,{className:`font-medium`,children:[`Device discovery warning · `,e.label]}),t[1]=e.label,t[2]=a);let o;return t[3]!==e.detail||t[4]!==a?(o=(0,$.jsxs)(rt,{tone:`warning`,onDismiss:i,children:[a,e.detail]}),t[3]=e.detail,t[4]=a,t[5]=o):o=t[5],o}function at(e){let t=[];for(let n of[`ios`,`android`]){let r=e.devices.filter(e=>e.platform===n).toSorted((e,t)=>Number(t.booted)-Number(e.booted)||e.name.localeCompare(t.name));r.length>0&&t.push({platform:n,devices:r})}return t}export{Ze as DevicePanel};
2
- //# sourceMappingURL=DevicePanel-Cqexcbm2.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Bd as i,bv as a,mr as o,t as s}from"./utils-DjbLtxuo.js";import{f as c,u as l,y as u}from"./TooltipProvider-Czzm7ro-.js";import{t as d}from"./spinner-BiCpg0TU.js";import{i as f,n as p}from"./session-CBEVNHld.js";import{t as m}from"./use-atom-command-BbFDhw_c.js";import{n as h}from"./dialog-DTVhbEqi.js";import{t as g}from"./device-DQmQm4GC.js";import{bo as _,fo as v,go as ee,mo as te,po as y}from"./main-B1sXOjZZ.js";var b=n(),x=e(t(),1),S=e(r(),1);function C(e){let t=(0,b.c)(15),{state:n,environmentId:r}=e,i=m(g.list),[a,s]=(0,x.useState)(null);if(n.hostStatus===`disabled`)return null;let c;if(t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==n.hostStatuses||t[4]!==n.hosts||t[5]!==n.supportsHostRetry){let e;t[7]!==r||t[8]!==a||t[9]!==i||t[10]!==n.hostStatuses||t[11]!==n.supportsHostRetry?(e=e=>{let t=n.hostStatuses[e.id];if(!t||![`installing`,`starting`,`failed`].includes(t.status))return null;let c=t.status===`failed`;return(0,S.jsxs)(`div`,{role:c?`alert`:`status`,className:`flex items-start gap-3 rounded-md border border-border/60 px-3 py-2 text-xs`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`font-medium`,children:e.label}),(0,S.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:t.detail??(c?`Device support could not start.`:t.status===`installing`?`Installing device tools…`:`Starting device tools…`)}),c?(0,S.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Check the host connection and network access, then retry. Your device settings are saved.`}):null]}),c&&n.supportsHostRetry?(0,S.jsx)(o,{size:`compact`,variant:`outline`,disabled:a!==null,onClick:()=>{s(e.id),i({environmentId:r,input:{retryHostId:e.id}}).finally(()=>s(null))},children:a===e.id?`Retrying…`:`Retry`}):null]},e.id)},t[7]=r,t[8]=a,t[9]=i,t[10]=n.hostStatuses,t[11]=n.supportsHostRetry,t[12]=e):e=t[12],c=n.hosts.map(e),t[0]=r,t[1]=a,t[2]=i,t[3]=n.hostStatuses,t[4]=n.hosts,t[5]=n.supportsHostRetry,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,S.jsx)(`div`,{className:`space-y-2`,children:c}),t[13]=c,t[14]=l),l}var w=e=>e===`ios`?`iOS`:`Android`,T=`Enable this environment to open simulators and emulators, whether they run here or on a remote device host.`,E=`Allow new agent sessions in this environment to start and control local and remote devices, with required tools set up automatically.`,D=e=>Object.values(e.hostStatuses).some(e=>e.status===`ready`&&e.androidDiscoveryIncomplete);function O(e){let t=Object.values(e.hostStatuses).map(e=>e.status),n=e.hostStatus===`ready`||t.includes(`ready`);return{ready:n,busy:!n&&[e.hostStatus,...t].some(e=>e===`installing`||e===`starting`)}}function k(e,t){let n=e.devices.some(e=>e.platform===t);if(t===`android`&&!n&&D(e))return{ready:!1,message:`The Android device list may be incomplete. Check the device host and try again.`};let r=e.hosts.flatMap(e=>e.platforms.filter(e=>e.platform===t).map(t=>({...t,host:e}))),i=r.filter(e=>e.available).map(e=>e.host);if(i.length===0)return{ready:!1,message:r[0]?.reason??`${w(t)} support was not detected.`};if(i.filter(t=>e.hostStatuses[t.id]?.status===`ready`||t.kind===`local`&&e.hostStatus===`ready`).length>0&&!n)return{ready:!1,message:t===`ios`?`Xcode is installed, but no iOS Simulator is available. Install a runtime in Xcode Settings → Components.`:`The Android SDK is installed, but no virtual device exists. Create one in Android Studio → Device Manager.`};let a=i.every(e=>e.kind!==`local`)?i[0]:void 0,o=a?` on ${a.label}`:``;return{ready:!0,message:a?.kind===`eas`?`${a.label} starts ${t===`ios`?`iOS Simulators`:`Android emulators`} in the cloud with EAS Simulator.`:t===`ios`?`Xcode and iOS Simulator are available${o}.`:`The Android SDK and Emulator are available${o}.`}}function A(e){let t=(0,b.c)(75),n=f(e.environmentId,a),r=m(g.configure),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={reportFailure:!1},t[0]=i):i=t[0];let c=m(g.list,i),[l,u]=(0,x.useState)(null),[d,w]=(0,x.useState)(0),D=e.state.hostStatus!==`disabled`,k;t[1]===e.state?k=t[2]:(k=O(e.state),t[1]=e.state,t[2]=k);let{ready:A,busy:j}=k,F;t[3]===e.state.hosts?F=t[4]:(F=e.state.hosts.some(ne),t[3]=e.state.hosts,t[4]=F);let I=F,L,R;t[5]!==D||t[6]!==c||t[7]!==e.environmentId?(L=()=>{D&&c({environmentId:e.environmentId,input:{}})},R=[D,c,e.environmentId],t[5]=D,t[6]=c,t[7]=e.environmentId,t[8]=L,t[9]=R):(L=t[8],R=t[9]),(0,x.useEffect)(L,R);let z;t[10]!==r||t[11]!==e?(z=async(t,n)=>{if(!p(e.environmentId,`settings:write`))return;u(t);let i=await r({environmentId:e.environmentId,input:n});u(null),t===`complete`&&i._tag===`Success`&&e.onComplete?.()},t[10]=r,t[11]=e,t[12]=z):z=t[12];let B=z,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=[`Device hub`,`Simulators`,`Agent access`],t[13]=V):V=t[13];let H;t[14]!==j||t[15]!==l||t[16]!==d?(H=e=>j||l!==null||e>d,t[14]=j,t[15]=l,t[16]=d,t[17]=H):H=t[17];let U;t[18]!==d||t[19]!==H?(U=(0,S.jsx)(y,{title:`Set up devices`,description:`Review what runs on this environment before using simulators and emulators.`,children:(0,S.jsx)(ee,{steps:V,currentStep:d,onStepChange:w,isStepDisabled:H})}),t[18]=d,t[19]=H,t[20]=U):U=t[20];let W;t[21]!==e.environmentId||t[22]!==e.state?(W=(0,S.jsx)(C,{state:e.state,environmentId:e.environmentId}),t[21]=e.environmentId,t[22]=e.state,t[23]=W):W=t[23];let G;t[24]!==j||t[25]!==n||t[26]!==D||t[27]!==l||t[28]!==e.state||t[29]!==d||t[30]!==B?(G=d===0?(0,S.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Enable the device hub`}),(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,S.jsx)(`p`,{className:`text-muted-foreground`,children:T}),(0,S.jsx)(_,{checked:D,disabled:!n||j||l!==null,"aria-label":`Enable device hub`,onCheckedChange:e=>void B(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]}),(0,S.jsx)(M,{state:e.state,pending:l===`hub`||j&&l!==`agent`})]}):null,t[24]=j,t[25]=n,t[26]=D,t[27]=l,t[28]=e.state,t[29]=d,t[30]=B,t[31]=G):G=t[31];let K;t[32]!==j||t[33]!==D||t[34]!==c||t[35]!==I||t[36]!==l||t[37]!==e.environmentId||t[38]!==e.state||t[39]!==d?(K=d===1||d===0&&D&&I?(0,S.jsxs)(`section`,{className:s(`space-y-3 text-sm`,d===0&&`mt-4`),children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Check simulator support`}),(0,S.jsx)(N,{state:e.state,checking:l===`check`,disabled:!D||j||l!==null,onCheck:()=>{u(`check`),c({environmentId:e.environmentId,input:{}}).finally(()=>u(null))}})]}):null,t[32]=j,t[33]=D,t[34]=c,t[35]=I,t[36]=l,t[37]=e.environmentId,t[38]=e.state,t[39]=d,t[40]=K):K=t[40];let q;t[41]!==j||t[42]!==n||t[43]!==D||t[44]!==l||t[45]!==e.state||t[46]!==d||t[47]!==B?(q=d===2?(0,S.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,S.jsx)(`h3`,{className:`font-medium`,children:`Allow agent control`}),(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,S.jsx)(`p`,{className:`text-muted-foreground`,children:E}),(0,S.jsx)(_,{checked:e.state.agentAccessEnabled,disabled:!n||!D||j||l!==null,"aria-label":`Allow agents to control devices`,onCheckedChange:e=>void B(`agent`,{agentAccessEnabled:!!e})})]}),(0,S.jsx)(P,{state:e.state,pending:l===`agent`}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave this off to keep manual device controls without giving agents access.`})]}):null,t[41]=j,t[42]=n,t[43]=D,t[44]=l,t[45]=e.state,t[46]=d,t[47]=B,t[48]=q):q=t[48];let J;t[49]!==e.state.hostStatus||t[50]!==e.state.hostStatusDetail?(J=e.state.hostStatus===`failed`&&e.state.hostStatusDetail?(0,S.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-destructive`,children:e.state.hostStatusDetail}):null,t[49]=e.state.hostStatus,t[50]=e.state.hostStatusDetail,t[51]=J):J=t[51];let Y;t[52]!==G||t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==W?(Y=(0,S.jsxs)(te,{children:[W,G,K,q,J]}),t[52]=G,t[53]=K,t[54]=q,t[55]=J,t[56]=W,t[57]=Y):Y=t[57];let X;t[58]!==j||t[59]!==l||t[60]!==d?(X=d===0?(0,S.jsx)(h,{render:(0,S.jsx)(o,{variant:`outline`}),children:`Cancel`}):(0,S.jsx)(o,{variant:`outline`,disabled:j||l!==null,onClick:()=>w(d-1),children:`Back`}),t[58]=j,t[59]=l,t[60]=d,t[61]=X):X=t[61];let Z;t[62]!==n||t[63]!==l||t[64]!==A||t[65]!==d||t[66]!==B?(Z=d<2?(0,S.jsx)(o,{disabled:!A||l!==null,onClick:()=>w(d+1),children:`Continue`}):(0,S.jsx)(o,{disabled:!n||!A||l!==null,onClick:()=>void B(`complete`,{onboardingCompleted:!0}),children:l===`complete`?`Saving…`:`Done`}),t[62]=n,t[63]=l,t[64]=A,t[65]=d,t[66]=B,t[67]=Z):Z=t[67];let Q;t[68]!==X||t[69]!==Z?(Q=(0,S.jsxs)(v,{children:[X,Z]}),t[68]=X,t[69]=Z,t[70]=Q):Q=t[70];let $;return t[71]!==Y||t[72]!==Q||t[73]!==U?($=(0,S.jsxs)(S.Fragment,{children:[U,Y,Q]}),t[71]=Y,t[72]=Q,t[73]=U,t[74]=$):$=t[74],$}function ne(e){return e.kind===`local`&&!e.platforms.some(j)}function j(e){return e.available}function M(e){let t=(0,b.c)(5),{state:n,pending:r,compact:a}=e,o=a!==void 0&&a;if(!r&&!O(n).ready)return null;let s;t[0]===r?s=t[1]:(s=r?(0,S.jsx)(d,{size:`xs`}):(0,S.jsx)(i,{className:`size-3 text-success`}),t[0]=r,t[1]=s);let c=r?n.hostStatus===`installing`?o?`Installing…`:`Installing device hub…`:n.hostStatus===`starting`?o?`Starting…`:`Starting device hub…`:o?`Updating…`:`Updating device hub…`:`Device hub is ready.`,l;return t[2]!==s||t[3]!==c?(l=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[2]=s,t[3]=c,t[4]=l):l=t[4],l}function N(e){let t=(0,b.c)(20),n;t[0]===e.state?n=t[1]:(n=k(e.state,`ios`),t[0]=e.state,t[1]=n);let r;t[2]===n?r=t[3]:(r=(0,S.jsx)(I,{platform:`iOS`,status:n}),t[2]=n,t[3]=r);let i;t[4]===e.state?i=t[5]:(i=k(e.state,`android`),t[4]=e.state,t[5]=i);let a;t[6]===i?a=t[7]:(a=(0,S.jsx)(I,{platform:`Android`,status:i}),t[6]=i,t[7]=a);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`You can use either platform. Fixing a missing platform does not block the other one.`}),t[8]=s):s=t[8];let c;t[9]===e.checking?c=t[10]:(c=e.checking?(0,S.jsx)(d,{size:`xs`}):null,t[9]=e.checking,t[10]=c);let l=e.checking?`Checking…`:`Check again`,u;t[11]!==e.disabled||t[12]!==e.onCheck||t[13]!==c||t[14]!==l?(u=(0,S.jsxs)(o,{size:`compact`,variant:`outline`,disabled:e.disabled,onClick:e.onCheck,children:[c,l]}),t[11]=e.disabled,t[12]=e.onCheck,t[13]=c,t[14]=l,t[15]=u):u=t[15];let f;return t[16]!==r||t[17]!==a||t[18]!==u?(f=(0,S.jsxs)(`div`,{className:`space-y-3`,children:[r,a,s,u]}),t[16]=r,t[17]=a,t[18]=u,t[19]=f):f=t[19],f}function P(e){let t=(0,b.c)(4);if(e.pending){let n=e.state.hostStatus===`installing`?e.compact?`Installing…`:`Installing agent tools…`:e.state.hostStatus===`starting`?e.compact?`Starting…`:`Starting agent tools…`:e.compact?`Updating…`:`Updating agent access…`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,S.jsx)(d,{size:`xs`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[r,n]}),t[1]=n,t[2]=i),i}if(e.state.agentAccessEnabled&&O(e.state).ready&&e.state.hosts.some(F)){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,S.jsx)(i,{className:`size-3 text-success`}),`Agent tools are ready.`]}),t[3]=e):e=t[3],e}return null}function F(e){return e.agentDeviceInstalled}function I(e){let t=(0,b.c)(21),n=!e.compact&&`rounded-md border border-border/60 px-3 py-2`,r;t[0]===n?r=t[1]:(r=s(`flex gap-2`,n),t[0]=n,t[1]=r);let i=e.status.ready?`text-success`:`text-muted-foreground`,a;t[2]===i?a=t[3]:(a=s(`mt-0.5 size-4 shrink-0`,i),t[2]=i,t[3]=a);let o=e.status.ready?c:u,d;t[4]!==a||t[5]!==o?(d=(0,S.jsx)(l,{className:a,icon:o}),t[4]=a,t[5]=o,t[6]=d):d=t[6];let f=e.compact&&e.status.ready&&`flex items-center gap-2`,p;t[7]===f?p=t[8]:(p=s(f),t[7]=f,t[8]=p);let m;t[9]===e.platform?m=t[10]:(m=(0,S.jsx)(`p`,{className:`font-medium`,children:e.platform}),t[9]=e.platform,t[10]=m);let h=e.compact&&e.status.ready?`Ready`:e.status.message,g;t[11]===h?g=t[12]:(g=(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h}),t[11]=h,t[12]=g);let _;t[13]!==g||t[14]!==p||t[15]!==m?(_=(0,S.jsxs)(`div`,{className:p,children:[m,g]}),t[13]=g,t[14]=p,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_||t[19]!==d?(v=(0,S.jsxs)(`div`,{className:r,children:[d,_]}),t[17]=r,t[18]=_,t[19]=d,t[20]=v):v=t[20],v}export{E as a,D as c,I as i,k as l,M as n,T as o,A as r,O as s,P as t,C as u};
2
- //# sourceMappingURL=DeviceSetup-Cdyw5Z9a.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{Ar as r,Br as i,Ci as a,Di as o,Do as s,Eo as c,Fo as l,Fr as u,Ha as d,Ii as f,Ma as p,Nr as m,Oo as h,Pa as g,Pi as _,Qa as v,Ri as y,Si as b,So as x,Ta as S,Ti as C,Ui as w,Yr as T,_a as E,_i as D,bi as O,bo as k,gi as A,hi as j,jo as M,ro as N,va as P,vi as F,wi as ee,xi as te,yi as I}from"./utils-DjbLtxuo.js";var L=e(t()),R=L.createContext(!1),z=L.createContext(void 0);function B(e){let t=L.useContext(z);if(e===!1&&t===void 0)throw Error(l(27));return t}var ne={...x,...c},re=L.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:c}=B(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`mounted`),f={open:l,transitionStatus:c.useState(`transitionStatus`)};return s(`div`,e,{state:f,ref:[c.context.backdropRef,t],stateAttributesMapping:ne,props:[{role:`presentation`,hidden:!d,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!u})}),V=L.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...c}=e,{store:l}=B(),u=l.useState(`open`),{getButtonProps:f,buttonRef:m}=d({disabled:a,native:o}),h={disabled:a};function g(e){u&&l.setOpen(!1,p(v,e.nativeEvent))}return s(`button`,e,{state:h,ref:[t,m],props:[{onClick:g},c,f]})}),H=L.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:c}=B(),l=g(a);return c.useSyncedValueWithCleanup(`descriptionElementId`,l),s(`p`,e,{ref:t,props:[{id:l},o]})}),U=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),W=function(e){return e[e.open=k.open]=`open`,e[e.closed=k.closed]=`closed`,e[e.startingStyle=k.startingStyle]=`startingStyle`,e[e.endingStyle=k.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),G=L.createContext(void 0);function K(){let e=L.useContext(G);if(e===void 0)throw Error(l(26));return e}var q=e(n()),J={...x,...c,nestedDialogOpen(e){return e?{[W.nestedDialogOpen]:``}:null}},Y=L.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...c}=e,{store:l}=B(),u=l.useState(`descriptionElementId`),d=l.useState(`disablePointerDismissal`),f=l.useState(`floatingRootContext`),p=l.useState(`popupProps`),m=l.useState(`modal`),h=l.useState(`mounted`),g=l.useState(`nested`),_=l.useState(`nestedOpenDialogCount`),v=l.useState(`open`),b=l.useState(`openMethod`),x=l.useState(`titleElementId`),C=l.useState(`transitionStatus`),w=l.useState(`role`),E=f.useState(`floatingId`),D=c.id??E;K(),S({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}});function O(e){return e!==`touch`||l.context.popupRef.current}let k=o===void 0?O:o,A=_>0,j=l.useStateSetter(`popupElement`),M=s(`div`,e,{state:{open:v,nested:g,transitionStatus:C,nestedDialogOpen:A},props:[p,{id:D,"aria-labelledby":x??void 0,"aria-describedby":u??void 0,role:w,...I,hidden:!h,onKeyDown(e){T.has(e.key)&&e.stopPropagation()},style:{[U.nestedDialogs]:_}},c],ref:[t,l.context.popupRef,j],stateAttributesMapping:J});return(0,q.jsx)(y,{context:f,openInteractionType:b,disabled:!h,closeOnFocusOut:!d,initialFocus:k,returnFocus:a,modal:m!==!1,restoreFocus:`popup`,children:M})}),ie=L.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:a}=B(),o=a.useState(`mounted`),s=a.useState(`modal`),c=a.useState(`open`);return o||n?(0,q.jsx)(G.Provider,{value:n,children:(0,q.jsxs)(w,{ref:t,...r,children:[o&&s===!0&&(0,q.jsx)(u,{ref:a.context.internalBackdropRef,inert:i(!c)}),e.children]})}):null});function X(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`);ee(t,a),te(t);let{forceUnmount:o}=b(a,t),s=L.useCallback(()=>{t.setOpen(!1,p(N))},[t]);return L.useImperativeHandle(r,()=>({unmount:o,close:s}),[o,s]),{parentContext:n,isDrawer:i}}function ae({store:e,dialogRoot:t}){let{parentContext:n,isDrawer:r}=t,i=e.useState(`open`),o=e.useState(`disablePointerDismissal`),s=e.useState(`modal`),c=e.useState(`popupElement`),l=e.useState(`floatingRootContext`),[u,d]=L.useState(0),[p,g]=L.useState(0),_=u===0,v=f(l,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=P(t);if(_&&!o){let t=n;return s&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===t||e.context.backdropRef.current===t||E(t,c)&&!t?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});m(i&&s===!0,c),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{d(e),g(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{d(0),g(0)}),L.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(u+1,p+ +!!r),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[r,i,u,p,n]);let y=v.reference??M,b=v.trigger??M,x=L.useMemo(()=>h(I,v.floating),[v.floating]);return a(e,{activeTriggerProps:y,inactiveTriggerProps:b,popupProps:x,nestedOpenDialogCount:u,nestedOpenDrawerCount:p}),null}var oe={...D,modal:_(e=>e.modal),nested:_(e=>e.nested),nestedOpenDialogCount:_(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:_(e=>e.nestedOpenDrawerCount),disablePointerDismissal:_(e=>e.disablePointerDismissal),openMethod:_(e=>e.openMethod),descriptionElementId:_(e=>e.descriptionElementId),titleElementId:_(e=>e.titleElementId),viewportElement:_(e=>e.viewportElement),role:_(e=>e.role)},Z=class e extends o{constructor(e,t,n=!1){let r=new F,i=se(e);i.floatingRootContext=A(r,t,n),super(i,{popupRef:L.createRef(),backdropRef:L.createRef(),internalBackdropRef:L.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},oe)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};O(n,e,t.trigger),this.update(n)};static useStore(t,n){return C(t,(t,r)=>new e(n,t,r),!0).store}};function se(e={}){return{...j(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function Q(e,t=`dialog`){let{children:n,open:i,defaultOpen:a=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:c=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:p=null}=e,m=t===`drawer`,h=t===`alert-dialog`,g=h?!0:l,_=h||c,v=h?`alertdialog`:`dialog`,y=B(!0),b={modal:g,disablePointerDismissal:_,nested:!!y,role:v},x=Z.useStore(d?.store,{open:a,openProp:i,activeTriggerId:p,triggerIdProp:f,...b});r(()=>{let e=i===void 0&&x.state.open===!1&&a===!0?{open:!0,activeTriggerId:p}:null;h?x.update(e?{...b,...e}:b):e&&x.update(e)}),x.useControlledProp(`openProp`,i),x.useControlledProp(`triggerIdProp`,f),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,o),x.useContextCallback(`onOpenChangeComplete`,s);let S=x.useState(`open`),C=x.useState(`mounted`),w=x.useState(`payload`),T=X({store:x,actionsRef:u,parentContext:y?.store.context,isDrawer:m}),E=S||C,D=L.useMemo(()=>({store:x}),[x]);return(0,q.jsx)(R.Provider,{value:!1,children:(0,q.jsxs)(z.Provider,{value:D,children:[E&&(0,q.jsx)(ae,{store:x,dialogRoot:T}),typeof n==`function`?n({payload:w}):n]})})}function ce(e){return Q(e,L.useContext(R)?`drawer`:`dialog`)}var $=function(e){return e[e.open=k.open]=`open`,e[e.closed=k.closed]=`closed`,e[e.startingStyle=k.startingStyle]=`startingStyle`,e[e.endingStyle=k.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),le={...x,...c,nested(e){return e?{[$.nested]:``}:null},nestedDialogOpen(e){return e?{[$.nestedDialogOpen]:``}:null}},ue=L.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,c=K(),{store:l}=B(),u=l.useState(`open`),d=l.useState(`nested`),f=l.useState(`transitionStatus`),p=l.useState(`nestedOpenDialogCount`),m=l.useState(`mounted`),h=l.useStateSetter(`viewportElement`);return s(`div`,e,{enabled:c||m,state:{open:u,nested:d,transitionStatus:f,nestedDialogOpen:p>0},ref:[t,h],stateAttributesMapping:le,props:[{role:`presentation`,hidden:!m,style:{pointerEvents:u?void 0:`none`},children:a},o]})}),de=L.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:c}=B(),l=g(a);return c.useSyncedValueWithCleanup(`titleElementId`,l),s(`h2`,e,{ref:t,props:[{id:l},o]})});export{Z as a,H as c,B as d,Q as i,V as l,ue as n,ie as o,ce as r,Y as s,de as t,re as u};
2
- //# sourceMappingURL=DialogTitle-CFYK6V6-.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{A as i,Bd as a,D as o,Fx as s,I as c,Jm as l,MC as u,Ms as d,Rf as f,Rs as p,Vd as m,Zn as h,ap as g,ar as _,as as v,bm as ee,db as te,dr as y,el as b,fr as x,fs as ne,gS as S,ir as C,is as re,lr as w,mr as T,rm as ie,rr as E,ss as ae,t as D,uf as oe,ur as se,us as ce,vm as O,xS as k,xy as le,yd as ue,zg as A}from"./utils-DjbLtxuo.js";import{Or as j,Tr as M,Vr as N,br as P,dr as F,hr as de,mr as I,pr as L,t as R}from"./runtime-BBYIQ0f-.js";import{s as z}from"./vcsRefInvalidation-DkXoQApH.js";import{E as fe,O as pe,S as me}from"./entities-CWtNgawi.js";import{C as B,_ as he,f as ge,g as _e,m as ve,p as V,u as ye}from"./TooltipProvider-Czzm7ro-.js";import{t as be}from"./useParams-jklHVL7l.js";import{m as xe,u as Se}from"./relay-Do9UB5iT.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./DiffFileTree-DNP9E3To.js";import{K as Oe,s as ke,v as Ae}from"./useSettings-EYJbJzT3.js";import{f as je}from"./server-Dkj4NeYG.js";import{n as Me}from"./query-D3KVoW9G.js";import{t as Ne}from"./use-atom-command-BbFDhw_c.js";import{f as Pe,p as Fe}from"./providerSkills-C8PrnHb-.js";import{t as Ie,u as Le}from"./queries-Cl508kPw.js";import{a as Re,c as ze,l as Be,n as Ve,o as He,r as Ue,s as We,u as H}from"./diffRendering-DAzPanqh.js";import{B as Ge,F as Ke,L as qe,R as U,z as Je}from"./PanelLayoutControls-DMUv135M.js";import{t as Ye}from"./DiffCommentAnnotation-C28NAT6f.js";import{c as Xe}from"./timestampFormat-wac2e_Jz.js";import{B as Ze,H as Qe,V as W}from"./ThreadDetailsItemsMenu-DEwUOoLt.js";import{a as $e,n as et,t as tt}from"./tooltip-C7NAkYG3.js";import{n as G}from"./fileCommentAnnotations-BgdL_7u9.js";import{n as nt,t as rt}from"./toggle-group-DYSJFIn3.js";import{i as it,l as at,n as ot,o as st,r as ct,s as lt,t as ut}from"./combobox-5RzytEjd.js";import{Ao as dt,Do as ft,bo as pt,xo as mt}from"./main-B1sXOjZZ.js";import{C as ht,E as gt,S as _t,T as vt,w as yt}from"./_chat-BeJoXsdK.js";var K=e(t(),1),q=n();function bt(e,t){let n=(0,q.c)(4),r=Ie(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var J=e(r(),1);function xt(e){let t=(0,q.c)(17),{filePath:n}=e,r=(0,K.useRef)(null),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={onCopy:()=>Qe(r),onError:e=>W(r,e),timeout:Ze},t[0]=i):i=t[0];let{copyToClipboard:a,isCopied:o}=xe(i),s;t[1]!==a||t[2]!==n?(s=(0,J.jsx)(T,{ref:r,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Copy file path`,onClick:()=>a(n,void 0)}),t[1]=a,t[2]=n,t[3]=s):s=t[3];let c=o&&`text-success`,l;t[4]===c?l=t[5]:(l=D(`size-3`,c),t[4]=c,t[5]=l);let u=o?ge:B,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(ye,{className:l,icon:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==s||t[10]!==d?(f=(0,J.jsx)($e,{render:s,children:d}),t[9]=s,t[10]=d,t[11]=f):f=t[11];let p=o?`Copied`:`Copy path`,m;t[12]===p?m=t[13]:(m=(0,J.jsx)(et,{children:(0,J.jsx)(`p`,{children:p})}),t[12]=p,t[13]=m);let h;return t[14]!==f||t[15]!==m?(h=(0,J.jsxs)(tt,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var St=[];function Ct(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function Y(e,t,n){let r=Ct(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function wt(e){let t=(0,q.c)(66),{codeViewKey:n,files:r,sectionId:a,sectionTitle:s,composerDraftTarget:l,options:u,viewerRef:d,className:f,renderCodeViewFooter:p,unsafeCSSExtra:m,renderHeaderMetadata:h,renderHeaderFilenameSuffix:g,renderHeaderPrefix:_,onRevealSearchMatch:v}=e,ee=o(kt),te=o(X),y;t[0]===l?y=t[1]:(y=e=>e.getComposerDraft(l)?.reviewComments??St,t[0]=l,t[1]=y);let b=o(y),[x,ne]=(0,K.useState)(null),[S,C]=(0,K.useState)(null),[re,w]=(0,K.useState)(``),T;t[2]===r?T=t[3]:(T=new Map(r.map(Ot)),t[2]=r,t[3]=T);let ie=T,E;if(t[4]!==S||t[5]!==r||t[6]!==b||t[7]!==a){let e;t[9]!==S||t[10]!==b||t[11]!==a?(e=e=>{let{fileDiff:t,filePath:n,fileKey:r,fileVersion:i,collapsed:o}=e,s=b.filter(e=>e.sectionId===a&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=c(t,n);return r?Y(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),l=S?.fileKey===r?[...s,S.annotation]:s;return{id:r,type:`diff`,fileDiff:t,annotations:l,collapsed:o,version:Re(`${i}:${o?`1`:`0`}:${l.flatMap(Et).join(`:`)}`)}},t[9]=S,t[10]=b,t[11]=a,t[12]=e):e=t[12],E=r.map(e),t[4]=S,t[5]=r,t[6]=b,t[7]=a,t[8]=E}else E=t[8];let ae=E,D;t[13]!==l||t[14]!==S?.annotation||t[15]!==te?(D=e=>{ne(null),S?.annotation.metadata.entries.some(t=>t.id===e)?(C(null),w(``)):te(l,e)},t[13]=l,t[14]=S?.annotation,t[15]=te,t[16]=D):D=t[16];let oe=D,se;t[17]!==ee||t[18]!==l||t[19]!==S||t[20]!==ie||t[21]!==a||t[22]!==s?(se=(e,t)=>{let n=S?.annotation.metadata.entries.find(t=>t.id===e),r=S?ie.get(S.fileKey):void 0;if(!n||!r)return;let o=i({id:n.id,sectionId:a,sectionTitle:s,filePath:r.filePath,fileDiff:r.fileDiff,range:n.range,text:t});o&&ee(l,o),ne(null),C(null),w(``)},t[17]=ee,t[18]=l,t[19]=S,t[20]=ie,t[21]=a,t[22]=s,t[23]=se):se=t[23];let ce=se,O;t[24]!==a||t[25]!==s?(O=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let r=G(),o=i({id:r,sectionId:a,sectionTitle:s,filePath:H(n.fileDiff),fileDiff:n.fileDiff,range:e,text:``});o&&(w(``),C({fileKey:n.id,annotation:{side:Ct(e),lineNumber:e.end,metadata:{entries:[{id:r,kind:`draft`,range:e,rangeLabel:o.rangeLabel,text:``}]}}}))},t[24]=a,t[25]=s,t[26]=O):O=t[26];let k=O,le=S!==null,ue;t[27]===d?ue=t[28]:(ue=d?{viewerRef:d}:{},t[27]=d,t[28]=ue);let A;t[29]===f?A=t[30]:(A=f?{className:f}:{},t[29]=f,t[30]=A);let j;t[31]===m?j=t[32]:(j=m?{unsafeCSSExtra:m}:{},t[31]=m,t[32]=j);let M;t[33]===h?M=t[34]:(M=h?{renderHeaderMetadata:e=>e.type===`diff`?h(e.fileDiff):null}:{},t[33]=h,t[34]=M);let N;t[35]===p?N=t[36]:(N=p?{renderCodeViewFooter:p}:{},t[35]=p,t[36]=N);let P;t[37]===v?P=t[38]:(P=e=>v(e.id),t[37]=v,t[38]=P);let F=!le,de=!le,I;t[39]!==k||t[40]!==u||t[41]!==F||t[42]!==de?(I={...u,enableGutterUtility:F,enableLineSelection:de,onGutterUtilityClick:k},t[39]=k,t[40]=u,t[41]=F,t[42]=de,t[43]=I):I=t[43];let L;t[44]===g?L=t[45]:(L=e=>e.type===`diff`?g(e.fileDiff):null,t[44]=g,t[45]=L);let R;t[46]===_?R=t[47]:(R=e=>e.type===`diff`?_(e.fileDiff,e.id,e.collapsed===!0):null,t[46]=_,t[47]=R);let z;t[48]!==re||t[49]!==oe||t[50]!==ce?(z=e=>{let t=e.metadata.entries.some(Tt);return(0,J.jsx)(`div`,{className:t?`py-1`:`divide-y divide-border/30 border-y border-border/30`,children:e.metadata.entries.map(e=>(0,J.jsx)(Ye,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.kind===`draft`?re:e.text,onTextChange:w,onCancel:()=>oe(e.id),onComment:t=>ce(e.id,t),onDelete:()=>oe(e.id)},e.id))})},t[48]=re,t[49]=oe,t[50]=ce,t[51]=z):z=t[51];let fe;return t[52]!==n||t[53]!==ae||t[54]!==x||t[55]!==M||t[56]!==N||t[57]!==P||t[58]!==I||t[59]!==L||t[60]!==R||t[61]!==z||t[62]!==ue||t[63]!==A||t[64]!==j?(fe=(0,J.jsx)(qe,{...ue,...A,...j,...M,...N,items:ae,selectedLines:x,onSelectedLinesChange:ne,onRevealSearchMatch:P,options:I,renderHeaderFilenameSuffix:L,renderHeaderPrefix:R,renderAnnotation:z},n),t[52]=n,t[53]=ae,t[54]=x,t[55]=M,t[56]=N,t[57]=P,t[58]=I,t[59]=L,t[60]=R,t[61]=z,t[62]=ue,t[63]=A,t[64]=j,t[65]=fe):fe=t[65],fe}function Tt(e){return e.kind===`draft`}function Et(e){return e.metadata.entries.map(Dt)}function Dt(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ot(e){return[e.fileKey,e]}function X(e){return e.removeReviewComment}function kt(e){return e.addReviewComment}function At(e){let t=le(4),n=F();return{diffPreview:de(e,{label:`environment-data:review:diff-preview`,tag:b.reviewGetDiffPreview,staleTimeMs:5e3}),diffFilePatch:L(e,{label:`environment-data:review:diff-file-patch`,staleTimeMs:3e5,execute:e=>j(b.reviewGetDiffPreview,e.request).pipe(t.withPermit,k(t=>{let n=t.sources.find(t=>t.kind===e.request.file.sourceKind);return n?u(n):S(new A({operation:`review.diffFilePatch`,kind:`git`,detail:`Diff no longer available. Refresh the comparison.`}))}))}),diffFileContents:I(e,{label:`environment-data:review:diff-file-contents`,tag:b.reviewGetDiffFileContents,scheduler:n,concurrency:{mode:`singleFlight`,key:({environmentId:e,input:t})=>JSON.stringify([e,t.cwd,t.sourceKind,t.baseRef,t.headRef,t.oldPath,t.newPath,t.changeType])}})}}var jt=At(R);function Mt(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function Nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&Mt(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function Pt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var Ft=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function It(e){let t=(0,q.c)(86),{environmentId:n,cwd:r,source:i,baseRef:a,ignoreWhitespace:o,theme:s,revision:c,preview:l}=e,u=(0,K.useContext)(v),f;t[0]!==a||t[1]!==r||t[2]!==n||t[3]!==o||t[4]!==i?.diffHash||t[5]!==i?.kind?(f=JSON.stringify([n,r,i?.kind,i?.diffHash,a,o]),t[0]=a,t[1]=r,t[2]=n,t[3]=o,t[4]=i?.diffHash,t[5]=i?.kind,t[6]=f):f=t[6];let p=f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=[0,1,2,3],t[7]=m):m=t[7];let h;t[8]===p?h=t[9]:(h={scope:p,indices:m},t[8]=p,t[9]=h);let[g,_]=(0,K.useState)(h),ee;t[10]!==g.indices||t[11]!==g.scope||t[12]!==p?(ee=g.scope===p?g.indices:[0,1,2,3],t[10]=g.indices,t[11]=g.scope,t[12]=p,t[13]=ee):ee=t[13];let te=ee,y;t[14]===i?.files?y=t[15]:(y=()=>i?.files?.toSorted(Q)??[],t[14]=i?.files,t[15]=y),i?.files;let b;t[16]===y?b=t[17]:(b=y(),t[16]=y,t[17]=b);let x=b,S;t[18]!==a||t[19]!==r||t[20]!==n||t[21]!==x||t[22]!==o||t[23]!==te||t[24]!==p||t[25]!==i?(S=!n||!r||!i?[]:te.filter(e=>e<x.length).map(e=>{let t=x[e];return{index:e,query:jt.diffFilePatch({environmentId:n,input:{cacheKey:p,request:{cwd:r,...a?{baseRef:a}:{},ignoreWhitespace:o,file:{path:t.path,previousPath:t.previousPath,sourceKind:i.kind}}}})}}),t[18]=a,t[19]=r,t[20]=n,t[21]=x,t[22]=o,t[23]=te,t[24]=p,t[25]=i,t[26]=S):S=t[26];let C=S,w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[27]=w):w=t[27];let T;t[28]!==c||t[29]!==p?(T={scope:p,revision:c,queries:w},t[28]=c,t[29]=p,t[30]=T):T=t[30];let ie=(0,K.useRef)(T),E,D;t[31]!==C||t[32]!==u||t[33]!==c||t[34]!==p?(E=()=>{let e=ie.current;ie.current={scope:p,revision:c,queries:C};for(let{query:t}of C){let n=e.scope===p&&e.revision!==c,r=!e.queries.some(e=>e.query===t)&&u.get(t)._tag!==`Initial`&&!u.get(t).waiting;(n||r)&&u.refresh(t)}},D=[p,c,C,u],t[31]=C,t[32]=u,t[33]=c,t[34]=p,t[35]=E,t[36]=D):(E=t[35],D=t[36]),(0,K.useEffect)(E,D);let oe;t[37]===s?oe=t[38]:(oe=ae(e=>ne(e,e=>d(e,e=>{let t=ze(e.diff,`diff-panel:${s}`,{compactPartialHunkOffsets:!0});if(t?.kind===`files`&&t.files.length===1&&e.files?.length===1){let n=e.files[0],r={...t.files[0],name:n.path};n.previousPath===null?delete r.prevName:r.prevName=n.previousPath,t={...t,files:[r]}}return{source:e,patch:t}}))),t[37]=s,t[38]=oe);let se=oe,O;t[39]!==se||t[40]!==C?(O=ce(e=>new Map(C.map(t=>{let{index:n,query:r}=t;return[n,e(se(r))]}))),t[39]=se,t[40]=C,t[41]=O):O=t[41];let k=re(O),le;t[42]===k?le=t[43]:(le=(e,t)=>{let n=k.get(t);return!n||n._tag===`Initial`},t[42]=k,t[43]=le);let ue=x.findIndex(le),A=i?ue<0?x.length:ue:l?.kind===`files`?l.files.length:0,j;t[44]===p?j=t[45]:(j=e=>_(t=>{let n=t.scope===p?t.indices:[0,1,2,3],r=e.filter(e=>!n.includes(e));return r.length===0?t:{scope:p,indices:[...n,...r]}}),t[44]=p,t[45]=j);let M=j,N;t[46]!==M||t[47]!==A?(N=()=>M(Array.from({length:4},(e,t)=>A+t)),t[46]=M,t[47]=A,t[48]=N):N=t[48];let P=N,F;t[49]===M?F=t[50]:(F=e=>M([e]),t[49]=M,t[50]=F);let de=F,I;t[51]!==x||t[52]!==C?(I={queries:C,files:x},t[51]=x,t[52]=C,t[53]=I):I=t[53];let L=(0,K.useRef)(I),R,z;t[54]!==x||t[55]!==C?(R=()=>{L.current={queries:C,files:x}},z=[C,x],t[54]=x,t[55]=C,t[56]=R,t[57]=z):(R=t[56],z=t[57]),(0,K.useLayoutEffect)(R,z);let fe;t[58]===u?fe=t[59]:(fe=e=>{let{queries:t,files:n}=L.current,r=t.find(t=>{let{index:r}=t;return n[r]?.path===e})?.query;r&&u.refresh(r)},t[58]=u,t[59]=fe);let pe=fe,me;t[60]!==x||t[61]!==k||t[62]!==l||t[63]!==p||t[64]!==i?(me=i?x.map((e,t)=>{let n=k.get(t);if(n?._tag===`Success`&&n.value.patch?.kind===`files`){let t=n.value.patch.files.find(t=>H(t)===e.path);if(t)return t}return{name:e.path,...e.previousPath?{prevName:e.previousPath}:{},type:e.previousPath?`rename-changed`:`change`,hunks:[],additionLines:[],deletionLines:[],splitLineCount:0,unifiedLineCount:0,isPartial:!0,cacheKey:`${p}:${e.path}:pending`}}):(l?.kind===`files`?l.files:[]).toSorted(Rt),t[60]=x,t[61]=k,t[62]=l,t[63]=p,t[64]=i,t[65]=me):me=t[65];let B=me,he;if(t[66]!==x||t[67]!==k){let e;t[69]===k?e=t[70]:(e=(e,t)=>{let n=k.get(t);return[e.path,{error:n?._tag===`Failure`||n?._tag===`Success`&&(n.value.patch?.kind!==`files`||!n.value.patch.files.some(t=>H(t)===e.path)),truncated:n?._tag===`Success`&&n.value.source.truncated}]},t[69]=k,t[70]=e),he=new Map(x.map(e)),t[66]=x,t[67]=k,t[68]=he}else he=t[68];let ge=he,_e;if(t[71]!==x||t[72]!==k){let e;t[74]===k?e=t[75]:(e=(e,t)=>{let n=k.get(t);return n&&n._tag!==`Initial`},t[74]=k,t[75]=e),_e=new Set(x.filter(e).map(Lt)),t[71]=x,t[72]=k,t[73]=_e}else _e=t[73];let ve=_e,V=[...k.values()].some(Z),ye;return t[76]!==ge||t[77]!==P||t[78]!==ve||t[79]!==B||t[80]!==de||t[81]!==pe||t[82]!==p||t[83]!==A||t[84]!==V?(ye={scope:p,fileStates:ge,isPending:V,retry:pe,requestFile:de,readyFilePaths:ve,renderableFiles:B,settledFileCount:A,loadNextFiles:P},t[76]=ge,t[77]=P,t[78]=ve,t[79]=B,t[80]=de,t[81]=pe,t[82]=p,t[83]=A,t[84]=V,t[85]=ye):ye=t[85],ye}function Z(e){return e._tag===`Initial`||e.waiting}function Lt(e){return e.path}function Rt(e,t){return Ft.compare(H(e),H(t))}function Q(e,t){return Ft.compare(e.path,t.path)}function zt(e){let t=(0,q.c)(5),{load:n,count:r}=e,i=(0,K.useRef)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{if(!i.current)return;let e=new IntersectionObserver(e=>{e.some(Vt)&&n()},{rootMargin:`600px`});return e.observe(i.current),()=>e.disconnect()},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,K.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=(0,J.jsx)(`div`,{ref:i,role:`status`,"aria-label":`Loading diff…`,children:Array.from({length:Math.min(r,4)},Bt)}),t[3]=r,t[4]=s),s}function Bt(e,t){return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`border-b border-border/40`,children:(0,J.jsx)(U,{titleWidth:`medium`})},t)}function Vt(e){return e.isIntersecting}function Ht(e){let t=(0,q.c)(16),{error:n,truncated:r,retry:i}=e;if(!n&&!r)return null;let a=n?`Retry loading diff`:`Partial diff preview`,o;t[0]!==n||t[1]!==i?(o=e=>{e.stopPropagation(),n&&i()},t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==o?(s=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":a,onClick:o}),t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n?c=t[7]:(c=n?(0,J.jsx)(O,{className:`size-3`}):(0,J.jsx)(g,{className:`size-3`}),t[6]=n,t[7]=c);let l;t[8]!==s||t[9]!==c?(l=(0,J.jsx)($e,{render:s,children:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u=n?`Retry loading diff`:`This file is too large to show in full. Counts include all changes.`,d;t[11]===u?d=t[12]:(d=(0,J.jsx)(et,{children:u}),t[11]=u,t[12]=d);let f;return t[13]!==l||t[14]!==d?(f=(0,J.jsxs)(tt,{children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}var Ut=`__automatic_base_ref__`,Wt=`p4code.diffFileTreeOpen`,Gt=new WeakMap;function Kt(e){let t=Gt.get(e);if(t)return t;let n={fileDiff:e,fileKey:Ue(e),fileVersion:Ve(e)};return Gt.set(e,n),n}var qt=new Set;function Jt(e){let t=(0,q.c)(21),{filePath:n,fileKey:r,collapsed:i,unavailable:a,iconClassName:o,onToggle:s}=e,c=i?`Expand ${n}`:`Collapse ${n}`,l=!i,u;t[0]!==r||t[1]!==s?(u=e=>{e.stopPropagation(),s(r)},t[0]=r,t[1]=s,t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==l||t[5]!==u||t[6]!==a?(d=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost`,className:`-ms-0.5`,"aria-label":c,"aria-expanded":l,disabled:a,onClick:u}),t[3]=c,t[4]=l,t[5]=u,t[6]=a,t[7]=d):d=t[7];let f;t[8]===o?f=t[9]:(f=D(`size-4`,o),t[8]=o,t[9]=f);let p=i?ve:V,m;t[10]!==f||t[11]!==p?(m=(0,J.jsx)(ye,{className:f,icon:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,J.jsx)($e,{render:d,children:m}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let g=i?`Expand diff`:`Collapse diff`,_;t[16]===g?_=t[17]:(_=(0,J.jsx)(et,{side:`top`,children:g}),t[16]=g,t[17]=_);let v;return t[18]!==_||t[19]!==h?(v=(0,J.jsxs)(tt,{children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20],v}function Yt(e){let t=(0,q.c)(11),{filePath:n,hasStat:r,error:i,truncated:a,onRetry:o}=e,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(xt,{filePath:n}),t[0]=n,t[1]=s);let c;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o||t[6]!==a?(c=r?(0,J.jsx)(Ht,{error:i,truncated:a,retry:()=>o(n)}):null,t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=a,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==c?(l=(0,J.jsxs)(J.Fragment,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Xt({mode:e=`inline`,composerDraftTarget:t,workspaceMutationId:n}){let{resolvedTheme:r}=Oe(),i=ke(),o=i.diffLayout,c=Ae(),[u,d]=(0,K.useState)(i.wordWrap),[g,v]=(0,K.useState)(i.diffIgnoreWhitespace),[b,ne]=p(Wt,!1,te),[S,ae]=(0,K.useState)(``),[ce,O]=(0,K.useState)(()=>({scopeKey:null,fileKeys:qt})),[k,le]=(0,K.useState)(0),[A,j]=(0,K.useState)(null),F=be({strict:!1,select:e=>Se(e)}),de=F?.threadId??null,I=pe(F),L=fe(F)?.projection??null,R=z(I?.environmentId??null),{canReadFiles:B}=R,ge=I?.projectId??null,ve=me(I&&ge?{environmentId:I.environmentId,projectId:ge}:null),V=I?.worktreePath??ve?.workspaceRoot,xe=I?.worktreePath?void 0:ve?.repositoryIdentity?.rootPath,Ie=re(je.configValueAtom(I?.environmentId??null)),Re=Pe(I?.environmentId??null),Ve=ft(I?.environmentId??null,Ie?.availableEditors??[]),Ue=Ne(jt.diffFileContents),qe=Me(I!=null&&V!=null?Le.status({environmentId:I.environmentId,input:{cwd:V}}):null),U=gt(e=>vt(e.byThreadKey,F)),Ye=qe.data?.isRepo??!0,{turnDiffSummaries:Ze,inferredCheckpointTurnCountByRunId:Qe}=yt(L),W=(0,K.useMemo)(()=>[...Ze].toSorted((e,t)=>{let n=e.checkpointTurnCount??Qe[e.runId]??0,r=t.checkpointTurnCount??Qe[t.runId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[Qe,Ze]);(0,K.useEffect)(()=>{F&&U.kind===`turn`&&gt.getState().reconcileTurnSelection(F,W.map(e=>e.runId))},[U,W,F]);let G=U.kind===`turn`?U.turnId:null,q=U.kind===`unstaged`?`unstaged`:`branch`,xt=U.kind===`branch`?U.baseRef:null,St=U.kind===`turn`?U.filePath:null,Ct=U.kind===`turn`?U.revealRequestId:0,Y=G===null?void 0:W.find(e=>e.runId===G)??W[0],Tt=Y&&(Y.checkpointTurnCount??Qe[Y.runId]),Et=W[0],Dt=G===null?q===`unstaged`?`Uncommitted`:`Changes`:Y?.runId===Et?.runId?`Latest turn`:`Turn ${Tt??`?`}`,Ot=Y?`turn:${Y.runId}`:q,X=F?`${F.environmentId}:${F.threadId}:${Ot}`:null,kt=`${X??Ot}:${k}`,At=Y?`Turn ${Tt??`?`}`:q===`unstaged`?`Uncommitted`:`Changes`,Mt=(0,K.useMemo)(()=>typeof Tt==`number`?{fromTurnCount:Math.max(0,Tt-1),toTurnCount:Tt}:null,[Tt]),Ft=bt({environmentId:I?.environmentId??null,threadId:de,fromTurnCount:Mt?.fromTurnCount??null,toTurnCount:Mt?.toTurnCount??null,ignoreWhitespace:g,cacheScope:Y?`turn:${Y.runId}`:null},{enabled:Ye&&Y!==void 0}),Z=Me(B&&G===null&&I&&V?jt.diffPreview({environmentId:I.environmentId,input:{cwd:V,...xt?{baseRef:xt}:{},ignoreWhitespace:g}}):null),Lt=Ye&&G===null&&I!=null&&V!=null,Rt=F?`${F.environmentId}:${F.threadId}`:null,Q=Z.data?.sources.find(e=>e.kind===(q===`unstaged`?`working-tree`:`branch-range`)),Bt=Z.refresh,Vt=Bt,Ht=(0,K.useMemo)(()=>{let e=Z.data;if(G===null&&I&&e&&Q&&B)return Ke(Ue,{environmentId:I.environmentId,cwd:e.cwd,sourceKind:Q.kind,baseRef:Q.baseRef,headRef:Q.headRef,cacheKey:Q.diffHash})},[I,Z.data,Ue,B,Q,G]),Gt=(0,K.useRef)(Ht);Gt.current=Ht;let Xt=(0,K.useCallback)(async e=>{let t=Gt.current;if(!t)throw Error(`Diff file contents are unavailable for this selection.`);return t(e)},[]),Zt=Q?.headRef??qe.data?.refName??`HEAD`,Qt=Q?.baseRef??xt??`Automatic`,$t=G===null&&B&&Lt&&q===`branch`,en=Z.data?.cwd??V,tn=Me($t&&I&&en?Le.listRefs({environmentId:I.environmentId,input:{cwd:en,includeMatchingRemoteRefs:!0,refKind:`local`,...S.trim().length>0?{query:S.trim()}:{},limit:100}}):null),nn=Me($t&&I&&en?Le.listRefs({environmentId:I.environmentId,input:{cwd:en,includeMatchingRemoteRefs:!0,refKind:`remote`,...S.trim().length>0?{query:S.trim()}:{},limit:100}}):null),rn=Nt(tn.data?.refs.filter(e=>e.name!==Zt)??[],nn.data?.refs??[]),an=Pt(rn,S),on=e=>xt&&xt===e.remote?.name?xt:e.local?.name??e.remote?.name??e.id,sn=[Ut,...rn.map(on)],cn=[...S.trim().length===0?[Ut]:[],...an.map(on)],ln=Q?.diff,un=Y?Ft.data?.diff:ln,dn=!Y&&Q?.truncated===!0,fn=Y?Ft.isPending:Z.isPending,pn=Y?Ft.error:Z.error,mn=typeof un==`string`&&un.trim().length===0,$=!Y&&Q?.truncated&&Q.files?Q:null,hn=(0,K.useMemo)(()=>$?null:ze(un,`diff-panel:${r}`,{compactPartialHunkOffsets:G===null}),[$,r,un,G]),gn=(0,K.useMemo)(()=>new Map($?.files?.map(e=>[e.path,e])),[$?.files]),{scope:_n,isPending:vn,fileStates:yn,retry:bn,requestFile:xn,readyFilePaths:Sn,renderableFiles:Cn,settledFileCount:wn,loadNextFiles:Tn}=It({environmentId:I?.environmentId,cwd:Z.data?.cwd,source:$,baseRef:$?.baseRef??xt,ignoreWhitespace:g,theme:r,revision:Z.data?s(Z.data.generatedAt):void 0,preview:hn}),En=Bt;(0,K.useEffect)(()=>{if(!Lt)return;let e=()=>En();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Lt,En]),ht({enabled:Lt,mutationId:n,refresh:En,resourceKey:`diff:${Rt??``}`});let Dn=Z.isPending||vn,On=(0,K.useMemo)(()=>Cn.map(Kt),[Cn]),kn=(0,K.useMemo)(()=>i.diffFilesCollapsed?new Set(On.map(e=>e.fileKey)):qt,[On,i.diffFilesCollapsed]),An=ce.scopeKey===X?ce.fileKeys:kn,jn=(0,K.useCallback)(()=>wn<Cn.length?(0,J.jsx)(zt,{load:Tn,count:Cn.length-wn}):null,[wn,Cn.length,Tn]),Mn=(0,K.useMemo)(()=>On.filter(({fileDiff:e})=>!$||Sn.has(H(e))).map(({fileDiff:e,fileKey:t,fileVersion:n})=>({fileDiff:e,filePath:H(e),fileKey:t,fileVersion:n,collapsed:An.has(t)||e.cacheKey?.endsWith(`:pending`)===!0})),[An,On,$,Sn]),Nn=(0,K.useMemo)(()=>On.map(e=>e.fileKey),[On]),Pn=Ee(Nn,An),Fn=(0,K.useMemo)(()=>!Y&&Q?.files?Q.files.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}):We(Cn),[Cn,Q,Y]),In=(0,K.useMemo)(()=>Te(Cn),[Cn]),Ln=St?Mn.find(e=>e.filePath===St)?.fileKey??null:null;(0,K.useEffect)(()=>{Ln&&A?.getInstance()&&A.scrollTo({type:`item`,id:Ln,align:`start`})},[A,kt,Ln,Ct]);let Rn=(0,K.useMemo)(()=>({collapseScopeKey:X,diffSelection:U}),[X,U]),zn=Ce(A,Rn,Mn.map(e=>e.fileKey)),Bn=(0,K.useCallback)(e=>{let t=On.findIndex(t=>H(t.fileDiff)===e),n=On[t];n&&(O(e=>{let t=new Set(e.scopeKey===X?e.fileKeys:kn);return t.delete(n.fileKey),{scopeKey:X,fileKeys:t}}),$&&t>=wn&&xn(t),zn(n.fileKey))},[On,X,kn,zn,$,wn,xn]),Vn=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!$||!St)return;let e=`${St}:${Ct}`;(Vn.current?.cache!==_n||Vn.current.key!==e)&&(Vn.current={cache:_n,key:e},Bn(St))},[$,St,Ct,_n,Bn]);let Hn=(0,K.useCallback)(e=>{Fe({threadRef:F,filePath:e,activeCwd:V,repositoryRoot:xe,openInEditor:e=>{(async()=>{let t=await Ve(e);t._tag===`Failure`&&!P(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...F?{environmentId:F.environmentId,threadId:F.threadId}:{},...N(M(t))})})()}})},[V,xe,Ve,F]),Un=(0,K.useRef)({collapseScopeKey:X,defaultCollapsedDiffFileKeys:kn});(0,K.useLayoutEffect)(()=>{Un.current={collapseScopeKey:X,defaultCollapsedDiffFileKeys:kn}},[X,kn]);let Wn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=Un.current;O(r=>{let i=new Set(r.scopeKey===t?r.fileKeys:n);return i.has(e)?i.delete(e):i.add(e),{scopeKey:t,fileKeys:i}})},[]),Gn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=Un.current;O(r=>{let i=r.scopeKey===t?r.fileKeys:n;if(!i.has(e))return r;let a=new Set(i);return a.delete(e),{scopeKey:t,fileKeys:a}})},[]),Kn=(0,K.useCallback)(()=>{le(e=>e+1),O(e=>{let t=e.scopeKey===X?e.fileKeys:kn;return{scopeKey:X,fileKeys:we(Nn,t)}})},[X,kn,Nn]),qn=e=>{F&&gt.getState().selectTurn(F,e)},Jn=e=>{F&&gt.getState().selectGitScope(F,e)},Yn=e=>{F&&gt.getState().selectBranchBaseRef(F,e)},Xn=Y?`turn:${Y.runId}`:``,Zn=G===null?q:Y?.runId===Et?.runId?`latest`:Xn,Qn=e=>{if(e===`unstaged`||e===`branch`)Jn(e);else if(e===`latest`)Et&&qn(Et.runId);else{let t=W.find(t=>`turn:${t.runId}`===e);t&&qn(t.runId)}},$n=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,J.jsxs)(h,{children:[(0,J.jsxs)(x,{render:(0,J.jsx)(T,{size:`xs`,variant:`secondary`}),className:`max-w-full`,"aria-label":`Diff scope: ${Dt}`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Dt}),(0,J.jsx)(m,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(E,{align:`start`,children:[(0,J.jsxs)(C,{value:Zn,onValueChange:Qn,children:[(0,J.jsx)(_,{value:`branch`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Changes`})}),(0,J.jsx)(_,{value:`unstaged`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Uncommitted`})}),(0,J.jsx)(_,{value:`latest`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Latest turn`})})]}),(0,J.jsxs)(w,{children:[(0,J.jsx)(y,{children:`Turn`}),(0,J.jsx)(se,{children:(0,J.jsx)(C,{value:Xn,onValueChange:Qn,children:W.map(e=>{let t=e.checkpointTurnCount??Qe[e.runId]??`?`;return(0,J.jsx)(_,{value:`turn:${e.runId}`,closeOnClick:!0,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{children:[`Turn `,t]}),(0,J.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Xe(e.completedAt,i.timestampFormat)})]})},e.runId)})})})]})]})]}),$t&&(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,"aria-label":`Comparing ${Zt} against ${Qt}`,children:[(0,J.jsxs)(tt,{children:[(0,J.jsxs)($e,{render:(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`}),children:[(0,J.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Zt}),(0,J.jsx)(ue,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsx)(et,{side:`top`,children:`${Zt} → ${Qt}`})]}),(0,J.jsxs)(ut,{items:sn,filteredItems:cn,value:xt??Ut,onOpenChange:e=>{e||ae(``)},onValueChange:e=>{e&&Yn(e===Ut?null:e)},children:[(0,J.jsxs)(at,{render:(0,J.jsx)(T,{variant:`ghost-muted`,size:`xs`}),className:`min-w-0 max-w-48`,"aria-label":`Change comparison target. Currently ${Qt}`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Qt}),(0,J.jsx)(m,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(st,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden`,children:[(0,J.jsx)(lt,{placeholder:`Search refs...`,value:S,onChange:e=>ae(e.target.value)}),(0,J.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-3xs text-muted-foreground uppercase tracking-wide`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,J.jsx)(`span`,{children:`Branch`}),(0,J.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,J.jsx)(ot,{children:`No matching refs.`}),(0,J.jsxs)(it,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,J.jsx)(ct,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:Ut,children:(0,J.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),rn.map(e=>{let t=on(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,J.jsx)(ct,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:t,children:(0,J.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,J.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,J.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,J.jsx)(pt,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Yn(n)}})}):e.remote?(0,J.jsxs)(tt,{children:[(0,J.jsx)($e,{render:(0,J.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,children:(0,J.jsx)(a,{role:`img`,"aria-label":`Remote only`,className:`size-3`})})}),(0,J.jsx)(et,{side:`top`,children:`Remote only`})]}):null]})},e.id)})]})]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[Mn.length>0||!Y&&Q?.files?.length?(0,J.jsx)(_t,{additions:Fn.additions,deletions:Fn.deletions,className:`mr-1 text-2xs`,layout:`inline`}):null,Lt&&(0,J.jsxs)(tt,{children:[(0,J.jsx)($e,{render:(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Dn?`Refreshing diff`:`Refresh diff`,onClick:Vt}),children:(0,J.jsx)(dt,{size:`sm`,refreshing:Dn})}),(0,J.jsx)(et,{side:`top`,children:Dn?`Refreshing diff…`:`Refresh diff`})]}),Nn.length>0&&(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Pn?`Expand all files`:`Collapse all files`,onClick:Kn,children:(0,J.jsx)(ye,{className:`size-3.5`,icon:Pn?he:_e})}),(0,J.jsxs)(nt,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[o],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&c({diffLayout:t})},children:[(0,J.jsx)(rt,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,J.jsx)(ee,{className:`size-3.5`})}),(0,J.jsx)(rt,{"aria-label":`Split diff view`,value:`split`,children:(0,J.jsx)(oe,{className:`size-3.5`})})]}),(0,J.jsxs)(tt,{children:[(0,J.jsx)($e,{render:(0,J.jsx)(rt,{"aria-label":u?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:u,onPressedChange:e=>{d(!!e)}}),children:(0,J.jsx)(l,{className:`size-3.5`})}),(0,J.jsx)(et,{side:`top`,children:u?`Disable line wrapping`:`Enable line wrapping`})]}),(0,J.jsxs)(tt,{children:[(0,J.jsx)($e,{render:(0,J.jsx)(rt,{"aria-label":g?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:g,onPressedChange:e=>{v(!!e)}}),children:(0,J.jsx)(ie,{className:`size-3.5`})}),(0,J.jsx)(et,{side:`top`,children:g?`Show whitespace changes`:`Hide whitespace changes`})]}),Nn.length>0&&(0,J.jsxs)(tt,{children:[(0,J.jsx)($e,{render:(0,J.jsx)(rt,{"aria-label":b?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:b,onPressedChange:e=>ne(!!e)}),children:(0,J.jsx)(f,{className:`size-3.5`})}),(0,J.jsx)(et,{side:`top`,children:b?`Hide file tree`:`Show file tree`})]})]})]});return(0,J.jsx)(Ge,{mode:e,header:$n,children:I?Ye?G!==null&&W.length===0?(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):G===null&&!B?R.isPending?(0,J.jsx)(Je,{label:`Checking file access...`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:R.error??`This connection cannot read local diffs.`}):(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,children:[dn&&!$&&(0,J.jsxs)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-2xs text-muted-foreground`,children:[`This preview exceeds the size limit. Changes shown are incomplete.`,Q?.files?` Totals include all changes.`:``]}),pn&&!hn&&(0,J.jsx)(`div`,{className:`px-3`,children:(0,J.jsx)(`p`,{className:`mb-2 text-2xs text-error/80`,children:pn})}),!hn&&!$?fn?(0,J.jsx)(Je,{label:Y?`Loading checkpoint diff...`:q===`unstaged`?`Loading uncommitted changes...`:`Loading changes...`}):(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,J.jsx)(`p`,{children:mn?`No net changes in this selection.`:`No patch available for this selection.`})}):$||hn?.kind===`files`?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement&&(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent;if(n){Hn(n);return}let r=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-diffs-header`))?.querySelector(`[data-title]`)?.textContent;if(!r)return;let i=Mn.find(e=>e.filePath===r);i&&Wn(i.fileKey)},onContextMenuCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&(e.preventDefault(),Re({environmentId:I?.environmentId??null,filePath:t,workspaceRoot:V,repositoryRoot:xe},e))},children:(0,J.jsx)(wt,{viewerRef:j,codeViewKey:`${kt}:${$?_n:`preview`}`,className:`h-full min-h-0 overflow-auto`,files:Mn,renderCodeViewFooter:jn,sectionId:Ot,sectionTitle:At,composerDraftTarget:t,renderHeaderFilenameSuffix:e=>{let t=H(e),n=yn.get(t);return(0,J.jsx)(Yt,{filePath:t,hasStat:gn.has(t),error:n?.error??!1,truncated:n?.truncated??!1,onRetry:bn})},...$?{unsafeCSSExtra:`[data-additions-count], [data-deletions-count] { display: none; }`,renderHeaderMetadata:e=>{let t=gn.get(H(e));return t?(0,J.jsx)(_t,{additions:t.additions,deletions:t.deletions}):null}}:{},onRevealSearchMatch:Gn,renderHeaderPrefix:(e,t)=>{let n=e.cacheKey?.endsWith(`:pending`)===!0;return(0,J.jsx)(Jt,{filePath:H(e),fileKey:t,collapsed:n||An.has(t),unavailable:n,iconClassName:He(e),onToggle:Wn})},options:{diffStyle:o===`split`?`split`:`unified`,lineDiffType:`none`,overflow:u?`wrap`:`scroll`,theme:Be(r),preferredHighlighter:mt,themeType:r,stickyHeaders:!0,...Ht?{loadDiffFiles:Xt}:{}}},X??Ot)}),b?(0,J.jsx)(`aside`,{className:`flex w-[min(16rem,40%)] min-w-40 shrink-0 border-l border-border/60`,children:(0,J.jsx)(De,{ariaLabel:`${At} files`,entries:In,selectedPath:St,revealRequestId:Ct,onSelectFile:Bn})}):null]}):(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-2xs text-muted-foreground/75`,children:hn?.kind===`raw`?hn.reason:null}),(0,J.jsx)(`pre`,{className:D(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-2xs leading-relaxed text-muted-foreground/90`,u?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:hn?.kind===`raw`?hn.text:null})]})})]})}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Xt as default};
2
- //# sourceMappingURL=DiffPanel-CrswOKS6.js.map