decocms 3.36.1 → 3.36.3

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 (237) hide show
  1. package/dist/client/assets/{AlertCircle-BnqV2fhH.js → AlertCircle-BU9gj1Zb.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DLu3LSuz.js → ArrowUpRight-D2O4sQl3.js} +1 -1
  3. package/dist/client/assets/{Check-eh46ZGML.js → Check-BmF1hQRY.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-C0r3mBzW.js → CheckCircle-C4XwcfjN.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-4LxQ5oPz.js → ChevronDown-BIO7wba7.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-D0NHXMar.js → ChevronLeft-CW2G6JyB.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CxxNo5xV.js → ChevronRight-CwhL8zaw.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-ATBl3MAi.js → ChevronUp-DdLEv_cl.js} +1 -1
  9. package/dist/client/assets/{Container-CV0p7hHO.js → Container-Dyf0TzBH.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CNRvkzVu.js → DotsVertical-DQMFAww2.js} +1 -1
  11. package/dist/client/assets/{Eye-DVlN5jxk.js → Eye-Bi1ejTfS.js} +1 -1
  12. package/dist/client/assets/{FilterLines-L07hHUB-.js → FilterLines-jWyOgIfr.js} +1 -1
  13. package/dist/client/assets/{Globe01-B9VL3QNT.js → Globe01-DF9PUq9k.js} +1 -1
  14. package/dist/client/assets/{HardDrive-COh7IrR0.js → HardDrive-BIzpSh2R.js} +1 -1
  15. package/dist/client/assets/{Key01-aulVwqL7.js → Key01-DJaxTkjl.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-DWk83m69.js → LayoutLeft-C3u21iqS.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-D_x8dxjY.js → LinkExternal01-D7mXn_q6.js} +1 -1
  18. package/dist/client/assets/{Monitor01-2xEKWZVQ.js → Monitor01-B2V0QJVA.js} +1 -1
  19. package/dist/client/assets/{Palette-IBuOwnrk.js → Palette-CvjTgNao.js} +1 -1
  20. package/dist/client/assets/{Play-C1Dc-lf9.js → Play-6yxi-kVu.js} +1 -1
  21. package/dist/client/assets/{Plus-BLTD9g1p.js → Plus-D-k489Hw.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-CXJQK3v9.js → RefreshCcw01-0Z7TeT1O.js} +1 -1
  23. package/dist/client/assets/{SearchMd-B3lNgj0Q.js → SearchMd-BdcI0VcO.js} +1 -1
  24. package/dist/client/assets/{Settings02-BtL-CPg2.js → Settings02-C6hr8Qy9.js} +1 -1
  25. package/dist/client/assets/{Shield01-JtF9z5lI.js → Shield01-DOB3vgca.js} +1 -1
  26. package/dist/client/assets/{Star01-D0denzoA.js → Star01-Du_V1z61.js} +1 -1
  27. package/dist/client/assets/{Stars01-b6QvFAbV.js → Stars01-BAC8f8eM.js} +1 -1
  28. package/dist/client/assets/{Stars02-DiuJq52q.js → Stars02-CpPe-VPg.js} +1 -1
  29. package/dist/client/assets/{Sun-BQHzenzm.js → Sun-C3Zhz8pG.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-C4dRfRR7.js → SwitchHorizontal01-BRvArA9H.js} +1 -1
  31. package/dist/client/assets/{Tool01-DCdaNaEY.js → Tool01-yFL5Dn59.js} +1 -1
  32. package/dist/client/assets/{Trash01-mLRbM1z9.js → Trash01-Br13J6pg.js} +1 -1
  33. package/dist/client/assets/{Upload01-BP26EgoC.js → Upload01-D4q_2hTt.js} +1 -1
  34. package/dist/client/assets/{User01-DpZZxZQw.js → User01-BtejVxVG.js} +1 -1
  35. package/dist/client/assets/{Users01-CTI49oYx.js → Users01-Dy4pn4ki.js} +1 -1
  36. package/dist/client/assets/{Users03-CORMvH6Y.js → Users03-CmfKEZdY.js} +1 -1
  37. package/dist/client/assets/{X-gn1ly4Nc.js → X-DcDNiBgo.js} +1 -1
  38. package/dist/client/assets/{XCircle-BGJwPzuZ.js → XCircle-e29W-Gcn.js} +1 -1
  39. package/dist/client/assets/{XClose-BwlE-Nu8.js → XClose-D4RzaaY5.js} +1 -1
  40. package/dist/client/assets/{Zap-DqD6AduN.js → Zap-Cp6OTaVi.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-B2POR1ZS.js → ZapSquare-CvMxvmoA.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-BM2NUDgV.js → ZoomOut-m5WCE6Ow.js} +1 -1
  43. package/dist/client/assets/{access-gate-DACRNgiY.js → access-gate-B7iLwSTn.js} +1 -1
  44. package/dist/client/assets/{accordion-DggLsDzc.js → accordion-DyJkloNK.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-C3xNe_xo.js → add-section-modal-CRDse3LE.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-Bm-PLFs1.js → agent-capabilities--0Cd735F.js} +1 -1
  47. package/dist/client/assets/{agent-icon-CkXhv6DR.js → agent-icon-MPxc_53p.js} +1 -1
  48. package/dist/client/assets/{agents-list-_LMmNXh7.js → agents-list-DvMDGpVE.js} +1 -1
  49. package/dist/client/assets/{ai-providers-CdE9elzv.js → ai-providers-BZpaXRIt.js} +1 -1
  50. package/dist/client/assets/{alert-Di1nAgGl.js → alert--QwThtUs.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-ZJsAqfzl.js → alert-dialog-DAZnJbEa.js} +1 -1
  52. package/dist/client/assets/app-editor-DOKG-0MP.js +1 -0
  53. package/dist/client/assets/{auth-C28A30Tc.js → auth-Rhn0UUKX.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-Gykc1ayZ.js → auth-catchall-COEk5Dgt.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-BLQZfqqR.js → auth-split-layout-BU5p8xYF.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-BS580Xxk.js → automation-list-row-BkqsYOIc.js} +1 -1
  57. package/dist/client/assets/{automation-runs-C1x-2avW.js → automation-runs-CfLYge75.js} +1 -1
  58. package/dist/client/assets/{automations-D045v3lS.js → automations-E9ZspVSN.js} +1 -1
  59. package/dist/client/assets/{avatar-B_BYzpDz.js → avatar-DgWkRz32.js} +1 -1
  60. package/dist/client/assets/{badge-BzbbNtAh.js → badge-Ckvq5EMT.js} +1 -1
  61. package/dist/client/assets/{brand-context-BwCpbN9i.js → brand-context-Cm9JdTeG.js} +1 -1
  62. package/dist/client/assets/{buckets-UoUGoesM.js → buckets-Dja8qKdg.js} +1 -1
  63. package/dist/client/assets/{calendar-CVM_PlWs.js → calendar-C4NMm-GW.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-C8q5gpVF.js → capability-load-error-DGtjMdu6.js} +1 -1
  65. package/dist/client/assets/{card-DV27UhYe.js → card-DV2a7ud0.js} +1 -1
  66. package/dist/client/assets/{chat-context-B17fAiGJ.js → chat-context-CQJ83DKW.js} +1 -1
  67. package/dist/client/assets/{checkbox-C8E6yiOS.js → checkbox-Eb0jgSAR.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-DXKtTRqn.js → cli-auth-success-C5I6pdNq.js} +1 -1
  69. package/dist/client/assets/{collection-detail-DYTXe-vX.js → collection-detail-QmVn7T6P.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-DkvliZfy.js → collection-display-button-k6e_w5_8.js} +1 -1
  71. package/dist/client/assets/{collection-search-6oM8sAkn.js → collection-search-q3LrsDP0.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-BoznEa1p.js → collection-table-wrapper-Wg4_kRAB.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-IWqiXV1e.js → collection-tabs-CvaARsvN.js} +1 -1
  74. package/dist/client/assets/{collections-DFNd7jPX.js → collections-DjlDVd1Q.js} +1 -1
  75. package/dist/client/assets/{command-D1SdiPwD.js → command--rBvALtU.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-D-tmt4pE.js → connect-desktop-dialog-CkEEvZPz.js} +1 -1
  77. package/dist/client/assets/{connection-card-DIcosm0X.js → connection-card-DqPMpeMB.js} +1 -1
  78. package/dist/client/assets/{connection-detail-Bb7E7eEJ.js → connection-detail-Ceck3IrK.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-ChlYhyg6.js → connection-form-helpers-B6xP1FXS.js} +1 -1
  80. package/dist/client/assets/{connections-BkTeF878.js → connections-BvYO4I8Q.js} +1 -1
  81. package/dist/client/assets/{decopilot-D_s8NcrD.js → decopilot-DxHNnnUA.js} +1 -1
  82. package/dist/client/assets/decopilot-sse-pool-CKBDifRl.js +1 -0
  83. package/dist/client/assets/{dialog-BSB689j7.js → dialog-pxIgcxdx.js} +1 -1
  84. package/dist/client/assets/{domain-settings-DHNs_g_j.js → domain-settings-CGcPdYTM.js} +1 -1
  85. package/dist/client/assets/{drawer-C82Ms0Cv.js → drawer-BrCENAAY.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-FYqDJehF.js → dropdown-menu-BS4mK__m.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-5sKc8jyc.js → dynamic-plugin-layout-Cn1BTjpz.js} +1 -1
  88. package/dist/client/assets/{empty-state-C1tavIlq.js → empty-state-Cp1JLYcR.js} +1 -1
  89. package/dist/client/assets/{empty-state-BxzxLrPP.js → empty-state-vCEwHb1v.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-CnLrafQF.js → extract-connection-data-16MvAzOh.js} +1 -1
  91. package/dist/client/assets/{features-BpHY8f6J.js → features-Dc3bQW1I.js} +1 -1
  92. package/dist/client/assets/{file-explorer-BZVx-0O5.js → file-explorer-CelbZiCq.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-Bw8qs6o2.js → file-type-icon-B3ZaCMP2.js} +1 -1
  94. package/dist/client/assets/{files-DxGJVld5.js → files-B5orgVDs.js} +1 -1
  95. package/dist/client/assets/{form-UO3a-lMt.js → form-DsGRrH4I.js} +1 -1
  96. package/dist/client/assets/{general-B1BA_GZn.js → general-DvWuRP0a.js} +1 -1
  97. package/dist/client/assets/{generate-id-CZUSC7-8.js → generate-id-B0UU4AyI.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-FLFbegfT.js → github-repo-picker-BciViNc8.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-BOKDj9bu.js → header-tab-button-elaOU0d9.js} +1 -1
  100. package/dist/client/assets/{hover-card-C3LYC-kn.js → hover-card-DfhDOin0.js} +1 -1
  101. package/dist/client/assets/{image-field-B-axyZ2P.js → image-field-BIrSC9Gs.js} +1 -1
  102. package/dist/client/assets/{index-CPTdDHuM.js → index-3WWLSqtl.js} +1 -1
  103. package/dist/client/assets/{index-B1OoDAS2.js → index-BKFf6V9A.js} +1 -1
  104. package/dist/client/assets/{index-WvB9UFs-.js → index-BLEyVrBm.js} +1 -1
  105. package/dist/client/assets/{index-DEbs6yYd.js → index-BMSOEHke.js} +1 -1
  106. package/dist/client/assets/{index-Cb4WTt-q.js → index-C8saI2Kn.js} +26 -26
  107. package/dist/client/assets/{index-CiybtfLu.js → index-ChdATVAA.js} +3 -3
  108. package/dist/client/assets/{index-CflW-8xl.js → index-CkV2wRTX.js} +1 -1
  109. package/dist/client/assets/{index-BHwbsS0f.js → index-D4tq1hPm.js} +1 -1
  110. package/dist/client/assets/{index-BMLWSX3S.js → index-DLRMbGKZ.js} +1 -1
  111. package/dist/client/assets/{index-DppM2zVg.js → index-DNM2q8BY.js} +1 -1
  112. package/dist/client/assets/{index-DGUKxx9B.js → index-DgyLJoal.js} +1 -1
  113. package/dist/client/assets/{index-C6tCJ6iD.js → index-Dupl0DR-.js} +1 -1
  114. package/dist/client/assets/{index-DR94I8IC.js → index-L_0VXlrp.js} +1 -1
  115. package/dist/client/assets/{index-DJOtAj7h.js → index-m-rxA9SC.js} +1 -1
  116. package/dist/client/assets/{index-redirect-DxTNMkbp.js → index-redirect-Cl16_UY5.js} +1 -1
  117. package/dist/client/assets/{index-SkqPgX26.js → index-xNHaP-xT.js} +1 -1
  118. package/dist/client/assets/{input-BIou7x1s.js → input-BZ-4l6sv.js} +1 -1
  119. package/dist/client/assets/{integration-icon-BG6b6lUb.js → integration-icon-LHjd4NGc.js} +1 -1
  120. package/dist/client/assets/{label-BALZ87Ne.js → label-CGY9toLT.js} +1 -1
  121. package/dist/client/assets/{layout-D3wKVNIg.js → layout-C8nv7dxR.js} +1 -1
  122. package/dist/client/assets/{login-njuJcB71.js → login-D5x6WUee.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-CJ3fuseB.js → mcp-oauth-BeZ96noC.js} +1 -1
  124. package/dist/client/assets/{members-BeYdJt0r.js → members-0_y-hP8y.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-CLILoFVJ.js → monaco-editor-C8DVCvK_.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-u_reVPx1.js → monitoring-stats-row-Dy60nPc4.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-ai-provider-BDRagMAu.js → oauth-callback-ai-provider-CQlojnmt.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-DirC5TV0.js → oauth-callback-rU6P6YYM.js} +1 -1
  129. package/dist/client/assets/{onboarding-DlgWGyxq.js → onboarding-BsFG_79R.js} +1 -1
  130. package/dist/client/assets/{org-install-DVgIW0Qi.js → org-install-CGnSzU4n.js} +1 -1
  131. package/dist/client/assets/{org-layout-Bre11PNt.js → org-layout-ayqAcIyF.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-BXBCHZWd.js → org-plugin-layout-KLX9VenO.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-DUSMHeEJ.js → page-seo-form-DJemjXau.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-CnqIZbrb.js +1 -0
  135. package/dist/client/assets/{pair-lHmdq1Qv.js → pair-BriGg-MY.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-DAWeTPEc.js → plugin-empty-state-CKqj8hWW.js} +1 -1
  137. package/dist/client/assets/{plugin-header-DFfO2BIK.js → plugin-header-Dg_-PVfV.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-syGxbFUV.js → plugin-layout-CFCRHuug.js} +1 -1
  139. package/dist/client/assets/{popover-DwdaLh0V.js → popover-hHdVOt7q.js} +1 -1
  140. package/dist/client/assets/{post-editor-C9ncA3ry.js → post-editor-DZXsYKGZ.js} +1 -1
  141. package/dist/client/assets/{primitives-B-U4LZoe.js → primitives-CNx5bddX.js} +1 -1
  142. package/dist/client/assets/{profile-Ht_-FnbL.js → profile-B3k1aQmn.js} +1 -1
  143. package/dist/client/assets/project-app-view-B-NllsZl.js +1 -0
  144. package/dist/client/assets/record-editor-DxhzZA73.js +1 -0
  145. package/dist/client/assets/registry-D_rElF24.js +2 -0
  146. package/dist/client/assets/{registry-layout-Bw_kbjOh.js → registry-layout-C9QKLcDQ.js} +1 -1
  147. package/dist/client/assets/{require-capability-BJtu48OI.js → require-capability-D5XZoZnS.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-DI6zQAQY.js → required-auth-layout-DhqvkBI0.js} +1 -1
  149. package/dist/client/assets/{reset-password-D4hK6pUY.js → reset-password-D7s0P0GF.js} +1 -1
  150. package/dist/client/assets/{resizable-B2XskWDt.js → resizable-BRT-qUaD.js} +1 -1
  151. package/dist/client/assets/{roles-Cqt-ohZl.js → roles-CPQyhIdH.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-VHJ6rXLi.js +1 -0
  153. package/dist/client/assets/{save-status-B5RVyMMa.js → save-status-D1jAW4JE.js} +1 -1
  154. package/dist/client/assets/schema-form-D3MP878L.js +1 -0
  155. package/dist/client/assets/{scroll-area-CUtpZ3i2.js → scroll-area-DKNnXldV.js} +1 -1
  156. package/dist/client/assets/{search-input-D_Czo7sj.js → search-input-BQKJCNNI.js} +1 -1
  157. package/dist/client/assets/{secrets-DqDtbfQI.js → secrets-J5Pwn3p4.js} +1 -1
  158. package/dist/client/assets/{sections-editor-TRTd4goB.js → sections-editor-rePIiHP9.js} +1 -1
  159. package/dist/client/assets/{select-DyYLWAtt.js → select-6yI1bUUl.js} +1 -1
  160. package/dist/client/assets/{select-model-Bgdox0ak.js → select-model-z3ovXylT.js} +1 -1
  161. package/dist/client/assets/{seo-editor-NEYssb1U.js → seo-editor--9JZnrI6.js} +1 -1
  162. package/dist/client/assets/{settings-layout-BjHnX_Rv.js → settings-layout-BKOOm0iL.js} +1 -1
  163. package/dist/client/assets/{settings-section-ByNQkiKy.js → settings-section-BDeKU196.js} +1 -1
  164. package/dist/client/assets/{sheet-CJSR0f_J.js → sheet-l2LhhOCY.js} +1 -1
  165. package/dist/client/assets/{shell-controls-0WsfKqkV.js → shell-controls-BxC6c_cJ.js} +1 -1
  166. package/dist/client/assets/{shell-layout-CvbgPIaO.js → shell-layout-DSzgNlpN.js} +1 -1
  167. package/dist/client/assets/shell-route-loading-D-NySFQN.js +1 -0
  168. package/dist/client/assets/{sidebar-CT4nDj9F.js → sidebar-ZxffB9i3.js} +1 -1
  169. package/dist/client/assets/{skeleton-C0n2MBSC.js → skeleton-DsBtdATm.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-BzXaOB_3.js → sortable.esm-B7SCN4Iq.js} +1 -1
  171. package/dist/client/assets/{spinner-DBVYiKjc.js → spinner-DynhmXJb.js} +1 -1
  172. package/dist/client/assets/{sso-DqRvx49i.js → sso-Bya3BiB0.js} +1 -1
  173. package/dist/client/assets/{store-BYx1pzM7.js → store-C4ZU4zXI.js} +1 -1
  174. package/dist/client/assets/store-registry-WPLrtDu9.js +2 -0
  175. package/dist/client/assets/{studio-tools-ByWE0fVB.js → studio-tools-tx_ynP6E.js} +1 -1
  176. package/dist/client/assets/{switch-CFZgZOoT.js → switch-DWpVVt2b.js} +1 -1
  177. package/dist/client/assets/{tab-id-D6XV4CDL.js → tab-id-CGE8BPr3.js} +1 -1
  178. package/dist/client/assets/{table-DRy0atlv.js → table-1jrYsVvf.js} +1 -1
  179. package/dist/client/assets/{tabs-B4Xt74wj.js → tabs-B9aEuz_5.js} +1 -1
  180. package/dist/client/assets/{task-status-CizXRJxN.js → task-status-BgRp2OfZ.js} +1 -1
  181. package/dist/client/assets/{textarea-CpqLWirc.js → textarea-DbtEiAgf.js} +1 -1
  182. package/dist/client/assets/{toggle-group-CUuptLSP.js → toggle-group-BCauVBxS.js} +1 -1
  183. package/dist/client/assets/{toolbar-Brcztx2Q.js → toolbar-C9WpnxRP.js} +1 -1
  184. package/dist/client/assets/{tools-list-DJunsBR9.js → tools-list-C-j8gu56.js} +1 -1
  185. package/dist/client/assets/{tooltip-BjyXwk4-.js → tooltip-CVKtA6h7.js} +1 -1
  186. package/dist/client/assets/{types-CTAso5N_.js → types-Bik0zSxz.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-BJZDY8Y9.js → use-ai-providers-Bf7NstiT.js} +1 -1
  188. package/dist/client/assets/{use-automations-Cmrz96gF.js → use-automations-DQhoL7n_.js} +1 -1
  189. package/dist/client/assets/{use-capability-B0pYY0r2.js → use-capability-BekxNShN.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-B7ba5G_w.js → use-clock-tick-CQKT35Lf.js} +1 -1
  191. package/dist/client/assets/{use-collections-DJpkyqRG.js → use-collections-DYulUuYs.js} +1 -1
  192. package/dist/client/assets/{use-connection-B5A06L65.js → use-connection-DpR6JQF5.js} +1 -1
  193. package/dist/client/assets/{use-copy-Dp9AIDyE.js → use-copy-BhHE-xFV.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-DvFTy-qt.js → use-create-virtual-mcp-ZidK7zTv.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-BYXOYkk-.js → use-debounced-autosave-2ixaaEOx.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-WF5NfIcz.js → use-delete-connection-b1BC9mo1.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-DZ1IbDAN.js → use-file-configs-CvNjCdnD.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-DUQ6svQh.js → use-infinite-scroll-BfpP7RsP.js} +1 -1
  199. package/dist/client/assets/{use-list-state-Bx7Ncrk2.js → use-list-state-BvQ5j7vs.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-D1Wt1Ama.js → use-mcp-client-DjqC1nd8.js} +1 -1
  201. package/dist/client/assets/{use-mcp-prompts-C3lAYJn0.js → use-mcp-prompts-Drzzskll.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-B_6LkwOm.js → use-mcp-tools-BUMls37h.js} +1 -1
  203. package/dist/client/assets/{use-members-Ch8rP11v.js → use-members-BiyrTP5I.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-Df96tRB5.js → use-navigate-to-agent-B7_UOyHZ.js} +1 -1
  205. package/dist/client/assets/{use-org-auth-client-BafLVU4c.js → use-org-auth-client-BrG8JDW1.js} +1 -1
  206. package/dist/client/assets/{use-org-sso-Dy5nNvp5.js → use-org-sso-mx87uCVa.js} +1 -1
  207. package/dist/client/assets/{use-organization-roles-D6FDnuQ7.js → use-organization-roles-_Z-_Ox1y.js} +1 -1
  208. package/dist/client/assets/{use-organization-settings-9bjAS-Lz.js → use-organization-settings-BWseGhxw.js} +1 -1
  209. package/dist/client/assets/{use-registry-connections-zD4mCaEh.js → use-registry-connections-BFZcaU10.js} +1 -1
  210. package/dist/client/assets/{use-secrets-ClIBWX3M.js → use-secrets-C-XHa3-0.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-DCDAeOy7.js → use-status-sounds-D1fVHGXs.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-lpAtoRqW.js → use-view-mode-DjLpAg7F.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-BsZRrdSO.js → use-virtual-mcp-BldCtSoA.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-aPUoKLwo.js +1 -0
  215. package/dist/client/assets/{useRouterState-D6isJH0F.js → useRouterState-BZKGSD2r.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-CuHxM8XU.js +1 -0
  217. package/dist/client/assets/{user-BLD1kA1s.js → user-Coe1o0e6.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-C-NsBriE.js → view-mode-toggle-GEdPTd_M.js} +1 -1
  219. package/dist/client/assets/{watch-sse-pool-BSUvJM1x.js → watch-sse-pool-C_YrQqjE.js} +1 -1
  220. package/dist/client/assets/{workflow-BxTaQjnF.js → workflow-ZbQ4bKoz.js} +1 -1
  221. package/dist/client/assets/workflow-detail-DEuNJrY-.js +1 -0
  222. package/dist/client/index.html +1 -1
  223. package/dist/server/cli.js +1 -1
  224. package/package.json +1 -1
  225. package/dist/client/assets/app-editor-CwrKwl6S.js +0 -1
  226. package/dist/client/assets/decopilot-sse-pool-DqoHsSxc.js +0 -1
  227. package/dist/client/assets/page-seo-sheet-NSwZ2Bog.js +0 -1
  228. package/dist/client/assets/project-app-view-HB2vBeZ5.js +0 -1
  229. package/dist/client/assets/record-editor-8FmeVsnk.js +0 -1
  230. package/dist/client/assets/registry-FHAA-0GH.js +0 -2
  231. package/dist/client/assets/save-referenced-block-CjAVAUIA.js +0 -1
  232. package/dist/client/assets/schema-form-MsvEbpzs.js +0 -1
  233. package/dist/client/assets/shell-route-loading-BQKfSVKy.js +0 -1
  234. package/dist/client/assets/store-registry-6iSO897G.js +0 -2
  235. package/dist/client/assets/useInfiniteQuery-CvW-Zfuj.js +0 -1
  236. package/dist/client/assets/useSuspenseInfiniteQuery-DGYfhNPQ.js +0 -1
  237. package/dist/client/assets/workflow-detail-Dw0wzylw.js +0 -1
@@ -1,3 +1,3 @@
1
- import{F as Be,r as w,ar as $s,ap as zs,e as O,p as ce,c as z,j as s,E as Bs,n as ie,P as ge,aE as Us,R as _e,aF as Dt,L as Ks,B as se,G as qs,H as Qs,aG as Ys,aH as Hs,Y as Ie,C as Gs,aI as Pe,aJ as Jt,f as rt,a as Mt,t as G,aK as Ws,s as Rn,M as Js,aL as Zs,b as Tn,aM as Xs,aN as Pn,aO as er,aP as Ve,aQ as gt,aR as tr,aS as nr,aT as bt,aU as sr,aV as rr,aW as or,aX as ar,q as lr,K as Oe,aY as ir,aZ as cr,a_ as ur,a$ as Vr,b0 as Dn,b1 as Fe,m as dr,l as fr,D as Mn}from"./index-CiybtfLu.js";import{c as pe,a as Ue,d as ot,u as mr,b as pr,f as hr,g as Fn,A as xr,h as gr}from"./chat-context-B17fAiGJ.js";import{e as On,s as at,g as fe,P as Je,f as Ft,t as br,h as vr,M as yr,i as Ar,j as Le,k as jr,l as wr,F as Sr,c as Cr,S as Nr,m as kr,n as Zt}from"./pair-lHmdq1Qv.js";import{S as Ct}from"./spinner-DBVYiKjc.js";import{c as Nt,u as _r,T as be,a as ve,b as ye}from"./tooltip-BjyXwk4-.js";import{b as lt,c as it,a as ct,D as ut,e as Ot}from"./dialog-BSB689j7.js";import{c as Ir,D as Er,a as Rr,b as Tr}from"./drawer-C82Ms0Cv.js";import{C as Pr}from"./collection-search-6oM8sAkn.js";import{g as Vt,u as Ee,a as Dr,i as Xt}from"./use-mcp-client-D1Wt1Ama.js";import{u as Mr,g as dt,l as kt}from"./use-mcp-prompts-C3lAYJn0.js";import{t as ft}from"./ChevronDown-4LxQ5oPz.js";import{i as De}from"./X-gn1ly4Nc.js";import{t as Fr,z as Or,u as Lr,w as $r,A as zr}from"./tab-id-D6XV4CDL.js";import{K as Br,i as Ur}from"./shell-layout-CvbgPIaO.js";import{a as Kr,u as qr}from"./use-virtual-mcp-BsZRrdSO.js";import{i as Qr}from"./SwitchHorizontal01-C4dRfRR7.js";import{n as Ln}from"./ZapSquare-B2POR1ZS.js";import{i as Ke}from"./Check-eh46ZGML.js";import{s as $n}from"./Star01-D0denzoA.js";import{a as zn}from"./Tool01-DCdaNaEY.js";import{a1 as mt,o as Yr,M as Bn,A as Un,a2 as Hr,i as He,b as Gr,P as Wr,a3 as Jr,s as Zr,a4 as Xr,a5 as eo,Y as Kn}from"./agent-icon-CkXhv6DR.js";import{i as to}from"./Upload01-BP26EgoC.js";import{i as qn}from"./AlertCircle-BnqV2fhH.js";import{a as no}from"./Eye-DVlN5jxk.js";import{a as _t,b as Lt,d as $t,f as zt,F as Qn}from"./form-UO3a-lMt.js";import{b as so,d as ro,c as oo,S as ao,a as lo}from"./select-DyYLWAtt.js";import{i as io}from"./RefreshCcw01-CXJQK3v9.js";import{a as Yn,t as It,b as co}from"./XCircle-BGJwPzuZ.js";import{b as uo,c as Vo}from"./tabs-B4Xt74wj.js";import{T as Hn,a as Ze}from"./toggle-group-CUuptLSP.js";import{I as Gn}from"./input-BIou7x1s.js";import{u as Wn,g as Jn,A as fo}from"./sortable.esm-BzXaOB_3.js";import{u as Zn}from"./studio-tools-ByWE0fVB.js";import{i as Bt}from"./Monitor01-2xEKWZVQ.js";import{C as Xn,a as es,b as ts}from"./connect-desktop-dialog-D-tmt4pE.js";import{m as pt,i as mo,g as ns,a as po,N as ho}from"./decopilot-D_s8NcrD.js";import{P as Ut,a as Kt,b as qt}from"./popover-DwdaLh0V.js";import{a as en,e as tn,f as xo,c as go,C as bo,d as vo,b as yo}from"./command-D1SdiPwD.js";import{u as Ao}from"./useInfiniteQuery-CvW-Zfuj.js";import{t as jo}from"./Stars01-b6QvFAbV.js";import{P as Et,a as wo,b as So,u as Co,E as No,c as Qt,i as ko,d as _o}from"./scroll-area-CUtpZ3i2.js";import{S as Io}from"./index-DEbs6yYd.js";import{D as Eo,a as Ro,b as To,c as he,d as nn,e as sn,f as rn,h as Po,i as Do}from"./dropdown-menu-FYqDJehF.js";import{s as on}from"./Plus-BLTD9g1p.js";import{p as Mo,q as Fo}from"./question-004-sINsf4GQ.js";import{i as Oo}from"./ChevronRight-CxxNo5xV.js";function Lo(t,e){const n=Be(e);return $o({filters:{...t,status:"pending"}},n).length}function an(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function $o(t={},e){const n=Be(e).getMutationCache(),r=w.useRef(t),o=w.useRef(null);return o.current===null&&(o.current=an(n,t)),w.useEffect(()=>{r.current=t}),w.useSyncExternalStore(w.useCallback(a=>n.subscribe(()=>{const l=$s(o.current,an(n,r.current));o.current!==l&&(o.current=l,zs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const ln=3,ss="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",zo="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function rs(t){const e=O.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:u}=n;let V;if(e[0]!==u._meta||e[1]!==u.name||e[2]!==u.title){const C=fe(u._meta);V=u.title??Ft(u.name,C),e[0]=u._meta,e[1]=u.name,e[2]=u.title,e[3]=V}else V=e[3];const d=V,i=u.description||null;if(c==="card"){let C;e[4]!==r||e[5]!==u?(C=()=>r(u),e[4]=r,e[5]=u,e[6]=C):C=e[6];const S=a||o,N=o&&"bg-accent/40",D=(a||o)&&"cursor-not-allowed opacity-50";let k;e[7]!==N||e[8]!==D?(k=z(zo,"hover:bg-accent/60 text-foreground",N,D),e[7]=N,e[8]=D,e[9]=k):k=e[9];let P;e[10]!==d?(P=s.jsx("span",{className:"font-medium truncate capitalize",children:d}),e[10]=d,e[11]=P):P=e[11];let T;e[12]!==o?(T=o&&s.jsx(Ct,{size:"xs"}),e[12]=o,e[13]=T):T=e[13];let _;e[14]!==P||e[15]!==T?(_=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P,T]}),e[14]=P,e[15]=T,e[16]=_):_=e[16];let R;e[17]!==i?(R=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=R):R=e[18];let F;return e[19]!==_||e[20]!==R||e[21]!==C||e[22]!==S||e[23]!==k?(F=s.jsxs("button",{type:"button",onClick:C,disabled:S,className:k,children:[_,R]}),e[19]=_,e[20]=R,e[21]=C,e[22]=S,e[23]=k,e[24]=F):F=e[24],F}let m;e[25]!==r||e[26]!==u?(m=()=>r(u),e[25]=r,e[26]=u,e[27]=m):m=e[27];const f=a||o,x=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let h;e[28]!==x||e[29]!==p?(h=z(ss,"hover:bg-muted/70 hover:text-foreground",x,p),e[28]=x,e[29]=p,e[30]=h):h=e[30];let g;e[31]!==d?(g=s.jsx("span",{className:"capitalize",children:d}),e[31]=d,e[32]=g):g=e[32];let b;e[33]!==o?(b=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=b):b=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==h||e[38]!==g||e[39]!==b?(v=s.jsx(be,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:h,children:[g,b]})}),e[35]=m,e[36]=f,e[37]=h,e[38]=g,e[39]=b,e[40]=v):v=e[40];const y=i??d;let j;e[41]!==y?(j=s.jsx(ve,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=j):j=e[42];let A;return e[43]!==v||e[44]!==j?(A=s.jsxs(ye,{delayDuration:400,children:[v,j]}),e[43]=v,e[44]=j,e[45]=A):A=e[45],A}function Bo(t){const e=O.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,u]=w.useState(""),V=!!l;let d;e[0]!==n||e[1]!==c?(d=c.trim()?n.filter(S=>{const N=c.toLowerCase();return S.prompt.name.toLowerCase().includes(N)||(S.prompt.title??"").toLowerCase().includes(N)||(S.prompt.description??"").toLowerCase().includes(N)}):n,e[0]=n,e[1]=c,e[2]=d):d=e[2];const i=d,m=_r();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let x;if(e[6]!==i||e[7]!==V||e[8]!==l?.name||e[9]!==o||e[10]!==a){let S;e[12]!==V||e[13]!==l?.name||e[14]!==o||e[15]!==a?(S=N=>s.jsx(rs,{item:N,variant:"card",onSelect:D=>{o(!1),a(D)},isLoading:l?.name===N.prompt.name,isDisabled:V&&l?.name!==N.prompt.name},N.prompt.name),e[12]=V,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=S):S=e[16],x=i.map(S),e[6]=i,e[7]=V,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=x}else x=e[11];let p;e[17]!==f||e[18]!==x?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,x]})}),e[17]=f,e[18]=x,e[19]=p):p=e[19];const h=p;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=S=>{S.key==="Escape"&&u("")},e[20]=g):g=e[20];let b;e[21]!==c?(b=s.jsx(Pr,{value:c,onChange:u,placeholder:"Search prompts...",onKeyDown:g}),e[21]=c,e[22]=b):b=e[22];const v=b;if(m){let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Ir,{className:"sr-only",children:s.jsx(Er,{children:"All prompts"})}),e[23]=S):S=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=N):N=e[24];let D;e[25]!==h||e[26]!==v?(D=s.jsxs(Rr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[S,N,v,h]}),e[25]=h,e[26]=v,e[27]=D):D=e[27];let k;return e[28]!==o||e[29]!==r||e[30]!==D?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(Tr,{open:r,onOpenChange:o,children:D})}),e[28]=o,e[29]=r,e[30]=D,e[31]=k):k=e[31],k}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let j;e[33]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=j):j=e[33];let A;e[34]!==h||e[35]!==v?(A=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,j,v,h]}),e[34]=h,e[35]=v,e[36]=A):A=e[36];let C;return e[37]!==o||e[38]!==r||e[39]!==A?(C=s.jsx(Nt,{delayDuration:400,children:s.jsx(ut,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=C):C=e[40],C}function Uo(t){const e=O.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=w.useState(!1);if(n.length===0)return null;let u,V,d;if(e[0]!==n||e[1]!==o||e[2]!==r){const g=n.slice(0,ln);let b;e[6]!==n?(b=n.slice(ln),e[6]=n,e[7]=b):b=e[7],u=b,V=!!o;let v;e[8]!==V||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(rs,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:V&&o?.name!==y.prompt.name},y.prompt.name),e[8]=V,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],d=g.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=u,e[4]=V,e[5]=d}else u=e[3],V=e[4],d=e[5];const i=d;let m;e[12]!==a?(m=z("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==u.length||e[15]!==V?(f=u.length>0&&s.jsxs("button",{type:"button",disabled:V,onClick:()=>c(!0),className:z(ss,"hover:bg-muted/70 hover:text-foreground",V&&"opacity-50 cursor-not-allowed"),children:["+",u.length," more"]}),e[14]=u.length,e[15]=V,e[16]=f):f=e[16];let x;e[17]!==i||e[18]!==m||e[19]!==f?(x=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=x):x=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(Bo,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let h;return e[26]!==x||e[27]!==p?(h=s.jsxs(Nt,{delayDuration:400,children:[x,p]}),e[26]=x,e[27]=p,e[28]=h):h=e[28],h}function Ko(){return null}function qo(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Qo(t){const e=O.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{org:o}=ce();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Ee(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:u}=Mr(c);let V;e[6]!==u?.prompts?(V=u?.prompts??[],e[6]=u?.prompts,e[7]=V):V=e[7];const d=V;let i;e[8]!==d?(i=d.map(Yo),e[8]=d,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[x,p]=w.useReducer(qo,f),[h,g]=w.useState(null);let b;e[11]!==l||e[12]!==r?(b=async(T,_)=>{if(!l){ie.error("MCP client not available"),p({type:"RESET"});return}try{const R=await dt(l,T.name,_);p({type:"RESET"});const F={type:"doc",content:[{type:"paragraph",content:[On({id:T.name,name:at(T.name,fe(T._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(F)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ie.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=b):b=e[13];const v=b;let y;e[14]!==v?(y=async T=>{if(T.arguments&&T.arguments.length>0){p({type:"SELECT_PROMPT",prompt:T}),g(T);return}p({type:"START_LOADING",prompt:T}),await v(T)},e[14]=v,e[15]=y):y=e[15];const j=y;let A;e[16]!==h||e[17]!==v?(A=async T=>{h&&(p({type:"START_LOADING",prompt:h,arguments:T}),g(null),await v(h,T))},e[16]=h,e[17]=v,e[18]=A):A=e[18];const C=A;if(m.length===0)return null;const S=x.stage==="loading"?x.prompt:null;let N;e[19]!==j||e[20]!==m||e[21]!==S?(N=s.jsx(Uo,{items:m,onSelect:j,loadingPrompt:S}),e[19]=j,e[20]=m,e[21]=S,e[22]=N):N=e[22];let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{g(null),p({type:"RESET"})},e[23]=D):D=e[23];let k;e[24]!==h||e[25]!==C?(k=s.jsx(Je,{prompt:h,setPrompt:D,onSubmit:C}),e[24]=h,e[25]=C,e[26]=k):k=e[26];let P;return e[27]!==N||e[28]!==k?(P=s.jsxs(s.Fragment,{children:[N,k]}),e[27]=N,e[28]=k,e[29]=P):P=e[29],P}function Yo(t){return{prompt:t}}function Ho(t){const e=O.c(13),{className:n}=t,{selectedVirtualMcp:r}=pe(),{org:o}=ce();let a;e[0]!==o.id?(a=Vt(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let u;e[2]!==n?(u=z("w-full @container",n),e[2]=n,e[3]=u):u=e[3];const V=c??"default";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ko,{}),e[4]=d):d=e[4];let i;e[5]!==c?(i=s.jsx(Qo,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==V||e[8]!==i?(m=s.jsx(Bs,{fallback:null,children:s.jsx(w.Suspense,{fallback:d,children:i},V)}),e[7]=V,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==u||e[11]!==m?(f=s.jsx("div",{className:u,children:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f}const vt="cubic-bezier(0.645, 0.045, 0.355, 1)",Go=44,Wo={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},Jo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},Zo={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function me(t){const e=O.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:u,defaultExpanded:V,variant:d,onClose:i}=t,m=d===void 0?"default":d,[f,x]=w.useState(V),[p,h]=w.useState(!1);let g;e[0]!==i?(g=()=>{h(!0),i?.()},e[0]=i,e[1]=g):g=e[1];const b=g;if(p)return null;const v=Jo[m],y=Wo[m];let j;e[2]!==v||e[3]!==y?(j=z("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=j):j=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(Xo),e[5]=A):A=e[5];const C=f&&"rounded-b-none",S=!f&&"rounded-b-xl";let N;e[6]!==C||e[7]!==S?(N=z("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",C,S),e[6]=C,e[7]=S,e[8]=N):N=e[8];const D=Zo[m];let k;e[9]!==D?(k=z("shrink-0",D),e[9]=D,e[10]=k):k=e[10];let P;e[11]!==n||e[12]!==k?(P=s.jsx("span",{className:k,children:n}),e[11]=n,e[12]=k,e[13]=P):P=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=T):T=e[15];let _;e[16]!==o?(_=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=_):_=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let F;e[18]!==R?(F=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ft,{size:16,style:{transform:R,transition:`transform 180ms ${vt}`}})}),e[18]=R,e[19]=F):F=e[19];let E,I;e[20]!==b?(E=W=>{W.stopPropagation(),b()},I=W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),b())},e[20]=b,e[21]=E,e[22]=I):(E=e[21],I=e[22]);let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(De,{size:16}),e[23]=$):$=e[23];let B;e[24]!==E||e[25]!==I?(B=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:E,onKeyDown:I,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[24]=E,e[25]=I,e[26]=B):B=e[26];let L;e[27]!==f||e[28]!==P||e[29]!==T||e[30]!==_||e[31]!==F||e[32]!==B||e[33]!==N?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:N,children:[P,T,_,F,B]}),e[27]=f,e[28]=P,e[29]=T,e[30]=_,e[31]=F,e[32]=B,e[33]=N,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let M;e[35]!==q?(M={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${vt}`},e[35]=q,e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U={overflow:"hidden",minHeight:0},e[37]=U):U=e[37];const Q=f?1:0;let K;e[38]!==Q?(K={opacity:Q,transition:`opacity 120ms ${vt}`},e[38]=Q,e[39]=K):K=e[39];let H;e[40]!==a?(H=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=H):H=e[41];let ne;e[42]!==u||e[43]!==a?(ne=u?s.jsx("div",{className:z("overflow-clip pb-4",!a&&"pt-4"),children:u}):null,e[42]=u,e[43]=a,e[44]=ne):ne=e[44];let ee;e[45]!==l||e[46]!==c?(ee=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=ee):ee=e[47];let te;e[48]!==K||e[49]!==H||e[50]!==ne||e[51]!==ee?(te=s.jsx("div",{style:U,children:s.jsxs("div",{style:K,children:[H,ne,ee]})}),e[48]=K,e[49]=H,e[50]=ne,e[51]=ee,e[52]=te):te=e[52];let J;e[53]!==M||e[54]!==te?(J=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:te}),e[53]=M,e[54]=te,e[55]=J):J=e[55];let Z;return e[56]!==L||e[57]!==J||e[58]!==j||e[59]!==m?(Z=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:j,children:[L,J]}),e[56]=L,e[57]=J,e[58]=j,e[59]=m,e[60]=Z):Z=e[60],Z}function Xo(t){return!t}const ea=ge({content:_e().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:_e().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),os=ge({todos:Us(ea)}),ta="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Fr({description:ta,inputSchema:Or(os),execute:async({todos:t})=>({ok:!0,count:t.length})});const na="tool-todo_write",sa=new Set(["input-available","output-available"]);function as(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==na||typeof a.state!="string"||!sa.has(a.state))continue;const l=os.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ls(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:br(vr(r)),input:n.input})}return e}function is(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function ra(t){return t?t.message.startsWith("[CREDITS]"):!1}const oa={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function aa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&ra(n))return{...oa,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],u=c,d=!!u.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=is(c),m=ls(u),f=as(e),x=!o&&!!n,p=m.length>0||o&&a,h=i.length>0,b=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(d||p||h))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:b,hasApprovals:p,hasPlans:h,isWaitingForUserInput:d}}function cs(){const t=O.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),l=n??null,c=r??null;let u;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(u=aa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=u):u=t[5],u}function la(){const t=cs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function us(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const ia="__home__";function Yt(t,e){return Ks.chatDraft(t,e)}function ca(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function ua(t,e,n,r,o){const a=Yt(e,n);if(us(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(u){if(da(u)){const V=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:V});return}throw u}}function cn(t,e,n){const r=Yt(e,n),o=t.getItem(r),a=ca(o);return o!==null&&a===null&&t.removeItem(r),a}function Va(t,e,n){t.removeItem(Yt(e,n))}function da(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function fa(t){const e=O.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let u;e[0]!==c?(u=z("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=u):u=e[1];let V;e[2]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(io,{size:14}),e[2]=V):V=e[2];let d;e[3]!==o||e[4]!==l||e[5]!==u?(d=s.jsx("button",{type:"button",onClick:o,disabled:l,className:u,"aria-label":"Previous question",children:V}),e[3]=o,e[4]=l,e[5]=u,e[6]=d):d=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,x=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==x?(p=z("p-0.5 rounded transition-colors",x),e[10]=x,e[11]=p):p=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Yn,{size:14}),e[12]=h):h=e[12];let g;e[13]!==a||e[14]!==p||e[15]!==f?(g=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:h}),e[13]=a,e[14]=p,e[15]=f,e[16]=g):g=e[16];let b;return e[17]!==g||e[18]!==d||e[19]!==m?(b=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[d,m,g]}),e[17]=g,e[18]=d,e[19]=m,e[20]=b):b=e[20],b}function Vs(t){const e=O.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(fa,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let u;return e[5]!==l||e[6]!==c?(u=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=u):u=e[7],u}function ma(t){const e=O.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,d=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const x=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==x?(p=z("h-7 px-2.5 text-xs",x),e[3]=x,e[4]=p):p=e[4];let h;e[5]!==i||e[6]!==d||e[7]!==f||e[8]!==p?(h=s.jsx(se,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:d}),e[5]=i,e[6]=d,e[7]=f,e[8]=p,e[9]=h):h=e[9];const g=h;if(!m)return g;let b;e[10]!==g?(b=s.jsx(be,{asChild:!0,children:g}),e[10]=g,e[11]=b):b=e[11];let v;e[12]!==m?(v=s.jsx(ve,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==b||e[15]!==v?(y=s.jsxs(ye,{children:[b,v]}),e[14]=b,e[15]=v,e[16]=y):y=e[16],y}function ds(t,e,n){return t.findIndex(r=>e(r)===n)}function un(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function Vn(t,e,n,r,o){if(t.length===0)return null;const a=ds(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const u=e(c);if(u!==o&&!r(n[u]))return u}return null}function pa(t){return!t.isStreaming&&t.allAnswered}function fs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,u=e[0]?n(e[0]):"",[V,d]=w.useState(u),[i,m]=w.useState(!1),f=qs({resolver:Qs(r),defaultValues:o}),x=f.watch(),p=ds(e,n,V),h=p>=0?e[p]:void 0,g=l(x[V]),b=un(e,n,x,l),v=pa({isStreaming:a,allAnswered:b}),y=()=>{if(p>0){const k=e[p-1];k&&d(n(k))}},j=()=>{if(p>=0&&p<e.length-1){const k=e[p+1];k&&d(n(k))}},A=()=>{const k=f.getValues(),P=Vn(e,n,k,l,V);P&&d(P)},C=()=>{f.handleSubmit(k=>{const P=k;for(const T of e)c(T,P[n(T)])})()},S=w.useRef(C);S.current=C;const N=()=>{v&&(m(!1),S.current())},D=()=>{const k=f.getValues();if(un(e,n,k,l)){if(a){m(!0);return}m(!1),S.current()}else{const P=Vn(e,n,k,l,V);P&&d(P)}};return w.useEffect(()=>{if(i&&!a){if(!b){m(!1);return}m(!1),S.current()}},[i,a,b]),{form:f,activeKey:V,setActiveKey:d,currentIndex:p,currentPart:h,isCurrentAnswered:g,isAllAnswered:b,canSubmit:v,goPrev:y,goNext:j,advanceToNextUnanswered:A,submit:N,submitOrAdvance:D}}const ms="User denied this tool call, give other alternatives.";function ps(t){const e=O.c(9),{onYolo:n}=t,[r,o]=Ie();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=d=>{const i=d;o({...r,toolApprovalLevel:i}),i==="auto"&&n(i)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ao,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:xa,children:s.jsx(lo,{})}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(so,{children:Pe.map(ha)}),e[5]=u):u=e[5];let V;return e[6]!==l||e[7]!==r.toolApprovalLevel?(V=s.jsxs(ro,{value:r.toolApprovalLevel,onValueChange:l,children:[c,u]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=V):V=e[8],V}function ha(t){return s.jsx(oo,{value:t.value,children:t.label},t.value)}function xa(t){return t.stopPropagation()}function hs(t){const e=O.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function ga(t){const e=O.c(28),{approval:n,onRespond:r}=t,[o]=Ie(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ms,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let u;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(u=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=u):u=e[7];const V=u;let d;e[8]!==n.approvalId||e[9]!==r?(d=j=>r(n.approvalId,!0,void 0,j),e[8]=n.approvalId,e[9]=r,e[10]=d):d=e[10];const i=d;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(ps,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=x):x=e[14];let p;e[15]!==V?(p=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:V,children:"Accept"}),e[15]=V,e[16]=p):p=e[16];let h;e[17]!==x||e[18]!==p?(h=s.jsxs(s.Fragment,{children:[x,p]}),e[17]=x,e[18]=p,e[19]=h):h=e[19];const g=h;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(mt,{size:14}),e[20]=b):b=e[20];let v;e[21]!==n.input?(v=s.jsx(hs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==g||e[26]!==v?(y=s.jsx(me,{icon:b,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:g,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=g,e[26]=v,e[27]=y):y=e[27],y}const ba=Ys(_e(),ge({approved:Hs().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function va(t){const e=O.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ie(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(ja)),e[0]=n,e[1]=c):c=e[1];const u=c;let V;e[2]!==l||e[3]!==o?(V=(D,k)=>{const P=k;typeof P?.approved=="boolean"&&o(D.approvalId,P.approved,P.approved===!1?ms:void 0,P.levelOverride??l)},e[2]=l,e[3]=o,e[4]=V):V=e[4];let d;e[5]!==n||e[6]!==u||e[7]!==r||e[8]!==V?(d={parts:n,partKey:Aa,schema:ba,defaultValues:u,isStreaming:r,hasAnswer:ya,onSubmit:V},e[5]=n,e[6]=u,e[7]=r,e[8]=V,e[9]=d):d=e[9];const i=fs(d);let m;e[10]!==n||e[11]!==i?(m=D=>{i.form.reset(Object.fromEntries(n.map(k=>[k.approvalId,{approved:!0,levelOverride:D}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,x=i.currentPart;let p;e[13]!==i?(p=D=>{D.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{size:14}),e[15]=h):h=e[15];const g=`${n.length} approvals pending`,b=x?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(ps,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(y=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=y):y=e[23];let j;e[24]!==x||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(j=x?s.jsx(wa,{approvalId:x.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=x,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=j):j=e[27];let A;e[28]!==x?(A=x?s.jsx(hs,{input:x.input}):null,e[28]=x,e[29]=A):A=e[29];let C;e[30]!==y||e[31]!==j||e[32]!==A||e[33]!==g||e[34]!==b?(C=s.jsx(me,{icon:h,label:g,title:b,defaultExpanded:!0,footerLeft:y,footerRight:j,children:A}),e[30]=y,e[31]=j,e[32]=A,e[33]=g,e[34]=b,e[35]=C):C=e[35];let S;e[36]!==C||e[37]!==p?(S=s.jsx("form",{onSubmit:p,children:C}),e[36]=C,e[37]=p,e[38]=S):S=e[38];let N;return e[39]!==i.form||e[40]!==S?(N=s.jsx(_t,{...i.form,children:S}),e[39]=i.form,e[40]=S,e[41]=N):N=e[41],N}function ya(t){return typeof t?.approved=="boolean"}function Aa(t){return t.approvalId}function ja(t){return[t.approvalId,{approved:void 0}]}function wa(t){const e=O.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=u=>{const{field:V}=u,d=V.value===!0,i=V.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(se,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{V.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(se,{type:"button",variant:d?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{V.onChange(!0),o()},"aria-pressed":d,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Gs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function Sa(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(mt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ca(t){const e=O.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Sa,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(ga,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(va,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Na(t){const e=O.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let u;e[5]!==l?(u=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=u):u=e[6];let V;e[7]!==c||e[8]!==u?(V=s.jsxs(s.Fragment,{children:[c,u]}),e[7]=c,e[8]=u,e[9]=V):V=e[9];const d=V;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Yr,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(yr,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==d||e[14]!==m?(f=s.jsx(me,{icon:i,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:d,children:m}),e[13]=d,e[14]=m,e[15]=f):f=e[15],f}function ka(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ke,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function _a(t){const e=O.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let V;return e[0]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(ka,{}),e[0]=V):V=e[0],V}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let u;return e[3]!==c||e[4]!==o||e[5]!==a?(u=s.jsx(Na,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=u):u=e[6],u}function xs(t){return t?"response"in t?t.response:t.option??t.draft:""}const dn=ge({response:_e().min(1,"Response is required")}),Ia=ge({option:_e().nullable(),draft:_e()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ea=ge({response:Dt(["yes","no"])});function Ra(t){switch(t.type){case"text":return dn;case"choice":return Ia;case"confirm":return Ea;default:return dn}}function Ta(t){const e={};for(const n of t)e[n.toolCallId]=Ra(n.input);return ge(e)}function Pa(t){const e=O.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:u}=c,V=u.value??"";return s.jsxs(Lt,{children:[s.jsx($t,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...u,value:V,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Qn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function gs(t,e){const n=O.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const u=Number.parseInt(l.key,10);u>=1&&u<=t&&(l.preventDefault(),e(u-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),w.useEffect(r,o)}function Da(t){const e=O.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Jt(l),u=`${r}.draft`;let V;e[3]!==n||e[4]!==u?(V={control:n,name:u,defaultValue:""},e[3]=n,e[4]=u,e[5]=V):V=e[5];const{field:d}=Jt(V),i=c.value,m=d.value??"";let f;if(e[6]!==c||e[7]!==o?(f=P=>{const T=o[P];T!=null&&c.onChange(T)},e[6]=c,e[7]=o,e[8]=f):f=e[8],gs(o.length,f),o.length===0)return null;const x=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let P;e[13]!==c||e[14]!==i?(P=(T,_)=>{const R=i===T;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(T),className:z("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${T}`,children:[s.jsx("span",{className:z("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:T})]},`${_}-${T}`)},e[13]=c,e[14]=i,e[15]=P):P=e[15],p=o.map(P),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const h=x&&"bg-accent/50",g=!x&&"hover:bg-accent/30";let b;e[16]!==h||e[17]!==g?(b=z("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",h,g),e[16]=h,e[17]=g,e[18]=b):b=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=x?m:"";let j;e[20]!==d||e[21]!==c||e[22]!==i?(j=P=>{d.onChange(P.target.value),i!==null&&c.onChange(null)},e[20]=d,e[21]=c,e[22]=i,e[23]=j):j=e[23];let A;e[24]!==c||e[25]!==i?(A=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=A):A=e[26];let C;e[27]!==y||e[28]!==j||e[29]!==A?(C=s.jsx("input",{type:"text",value:y,onChange:j,onFocus:A,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=y,e[28]=j,e[29]=A,e[30]=C):C=e[30];let S;e[31]!==C||e[32]!==b?(S=s.jsxs("label",{className:b,children:[v,C]}),e[31]=C,e[32]=b,e[33]=S):S=e[33];let N;e[34]!==S||e[35]!==p?(N=s.jsx($t,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,S]})}),e[34]=S,e[35]=p,e[36]=N):N=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(zt,{}),e[37]=D):D=e[37];let k;return e[38]!==N?(k=s.jsxs(Lt,{children:[N,D]}),e[38]=N,e[39]=k):k=e[39],k}function Ma(t){const e=O.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=w.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=d=>{l.current?.onChange(a[d]??"")},e[1]=c):c=e[1],gs(a.length,c);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:i}=d;return l.current=i,s.jsxs(Lt,{children:[s.jsx($t,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:z("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:z("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(zt,{})]})},e[2]=u):u=e[2];let V;return e[3]!==n||e[4]!==r?(V=s.jsx(Qn,{control:n,name:r,render:u}),e[3]=n,e[4]=r,e[5]=V):V=e[5],V}function fn(t){const e=O.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Pa,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Da,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ma,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Fa(t){const e=O.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ta(n.map(za)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map($a)),e[2]=n,e[3]=c):c=e[3];const u=c;let V;e[4]!==o?(V=(E,I)=>{const $=xs(I);$&&o(E,$)},e[4]=o,e[5]=V):V=e[5];let d;e[6]!==u||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==V?(d={parts:n,partKey:La,schema:l,defaultValues:u,isStreaming:r,hasAnswer:Oa,onSubmit:V},e[6]=u,e[7]=r,e[8]=n,e[9]=l,e[10]=V,e[11]=d):d=e[11];const i=fs(d),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const E=m;if(!E)return;const I=E.toolCallId;E.input?.type==="choice"?(i.form.setValue(`${I}.option`,null),i.form.setValue(`${I}.draft`,"user has skip this question")):i.form.setValue(`${I}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const x=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const h=p;let g;e[20]!==x?(g=s.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=g):g=e[21];let b;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(b=s.jsx(ma,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=b):b=e[26];let v;e[27]!==g||e[28]!==b?(v=s.jsxs(s.Fragment,{children:[g,b]}),e[27]=g,e[28]=b,e[29]=v):v=e[29];const y=v;if(n.length===1){const E=n[0];if(!E?.input)return null;let I;e[30]!==i?(I=K=>{K.preventDefault(),i.submit()},e[30]=i,e[31]=I):I=e[31];let $;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(It,{size:14}),e[32]=$):$=e[32];const B=E.input?.prompt??"Question",L=E.input;let q;e[33]!==i.form.control||e[34]!==E.toolCallId||e[35]!==L?(q=s.jsx(fn,{input:L,control:i.form.control,toolCallId:E.toolCallId}),e[33]=i.form.control,e[34]=E.toolCallId,e[35]=L,e[36]=q):q=e[36];let M;e[37]!==y||e[38]!==B||e[39]!==q?(M=s.jsx(me,{icon:$,label:"Question pending",title:B,defaultExpanded:!0,footerRight:y,children:q}),e[37]=y,e[38]=B,e[39]=q,e[40]=M):M=e[40];let U;e[41]!==I||e[42]!==M?(U=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=U):U=e[43];let Q;return e[44]!==i.form||e[45]!==U?(Q=s.jsx(_t,{...i.form,children:U}),e[44]=i.form,e[45]=U,e[46]=Q):Q=e[46],Q}const j=i.form;let A;e[47]!==i?(A=E=>{E.preventDefault(),i.submit()},e[47]=i,e[48]=A):A=e[48];let C;e[49]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(It,{size:14}),e[49]=C):C=e[49];const S=`${i.currentIndex+1} of ${n.length}`,N=m?.input?.prompt??"Question",D=i.activeKey,k=i.setActiveKey;let P;if(e[50]!==i.form||e[51]!==n){let E;e[53]!==i.form?(E=I=>s.jsx(uo,{value:I.toolCallId,className:"mt-0",children:s.jsx(fn,{input:I.input,control:i.form.control,toolCallId:I.toolCallId})},I.toolCallId),e[53]=i.form,e[54]=E):E=e[54],P=n.map(E),e[50]=i.form,e[51]=n,e[52]=P}else P=e[52];let T;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==P?(T=s.jsx(Vo,{value:D,onValueChange:k,children:P}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=P,e[58]=T):T=e[58];let _;e[59]!==h||e[60]!==y||e[61]!==S||e[62]!==N||e[63]!==T?(_=s.jsx(me,{icon:C,label:"Question pending",count:S,title:N,defaultExpanded:!0,footerLeft:h,footerRight:y,children:T}),e[59]=h,e[60]=y,e[61]=S,e[62]=N,e[63]=T,e[64]=_):_=e[64];let R;e[65]!==A||e[66]!==_?(R=s.jsx("form",{onSubmit:A,autoComplete:"off",children:_}),e[65]=A,e[66]=_,e[67]=R):R=e[67];let F;return e[68]!==i.form||e[69]!==R?(F=s.jsx(_t,{...j,children:R}),e[68]=i.form,e[69]=R,e[70]=F):F=e[70],F}function Oa(t){return!!xs(t)}function La(t){return t.toolCallId}function $a(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function za(t){return{toolCallId:t.toolCallId,input:t.input}}function Ba(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(It,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function bs(t){const e=O.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Ua),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ba,{}),e[2]=u):u=e[2],u}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Fa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Ua(t){return t.state==="input-available"}function Ka(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function qa(){const t=O.c(21),{messages:e}=Ue();let n,r,o,a,l,c,u,V,d;if(t[0]!==e){d=Symbol.for("react.early_return_sentinel");e:{const f=as(e);if(f.length===0){d=null;break e}const x=Ka(f);n=me,l=s.jsx(Ga,{status:x.icon}),c=x.activity,u=x.progress,V=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Qa)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=u,t[8]=V,t[9]=d}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],u=t[7],V=t[8],d=t[9];if(d!==Symbol.for("react.early_return_sentinel"))return d;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==u||t[18]!==V||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:u,defaultExpanded:V,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=u,t[18]=V,t[19]=i,t[20]=m):m=t[20],m}function Qa(t,e){return s.jsx(Ya,{todo:t},e)}function Ya(t){const e=O.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(Ha,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let u;e[2]!==c?(u=z("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=u):u=e[3];const V=r?"100%":"0%",d=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==V||e[5]!==d?(i=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:V,transition:d}}),e[4]=V,e[5]=d,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==u||e[9]!==i?(m=s.jsxs("span",{className:u,children:[a,i]}),e[7]=a,e[8]=u,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function Ha(t){const e=O.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function Ga(t){const e=O.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const Wa={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Ja=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function vs(t){const e=O.c(41),{onDismiss:n}=t,{org:r}=ce(),o=rt(),{decoKeyId:a}=Wn(),l=Zn(),[c,u]=w.useState(""),[V,d]=w.useState(!1),[i,m]=w.useState("usd"),f=i==="brl"?"R$":"$";let x,p;e[0]!==r.id?(x=()=>{G("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=x,e[2]=p):(x=e[1],p=e[2]),w.useEffect(x,p);let h;e[3]!==i||e[4]!==l?(h=async E=>{const{url:I}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:E,currency:i});return I},e[3]=i,e[4]=l,e[5]=h):h=e[5];let g;e[6]!==n?(g=E=>{E&&window.open(E,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=g):g=e[7];let b;e[8]!==h||e[9]!==g?(b={mutationFn:h,onSuccess:g,onError:el},e[8]=h,e[9]=g,e[10]=b):b=e[10];const{mutate:v,isPending:y}=Mt(b),j=parseFloat(c),A=!isNaN(j)&&j>=1;let C;e[11]!==n?(C=E=>!E&&n?.(),e[11]=n,e[12]=C):C=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=S):S=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:S.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=N):N=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,s.jsxs(lt,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=D):D=e[15];let k;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==j||e[20]!==a||e[21]!==A||e[22]!==y||e[23]!==V||e[24]!==v?(k=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Hn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:E=>{E&&m(E)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Wa[i].map(E=>{const{dollars:I,label:$}=E;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{G("credits_topup_clicked",{amount_cents:I*100,currency:i,tier_label:$,source:"exhausted_banner"}),v(I*100)},className:z("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,I]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},I)})}),V?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Gn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:E=>u(E.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!A||y,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(j*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Ja.map(Za)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=j,e[20]=a,e[21]=A,e[22]=y,e[23]=V,e[24]=v,e[25]=k):k=e[25];let P;e[26]!==n?(P=s.jsx(se,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=P):P=e[27];let T;e[28]!==o||e[29]!==n||e[30]!==r.slug?(T=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=T):T=e[31];let _;e[32]!==P||e[33]!==T?(_=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[P,T]}),e[32]=P,e[33]=T,e[34]=_):_=e[34];let R;e[35]!==k||e[36]!==_?(R=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Xa,children:[D,k,_]}),e[35]=k,e[36]=_,e[37]=R):R=e[37];let F;return e[38]!==R||e[39]!==C?(F=s.jsx(ut,{open:!0,onOpenChange:C,children:R}),e[38]=R,e[39]=C,e[40]=F):F=e[40],F}function Za(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Xa(t){return t.preventDefault()}function el(t){ie.error(`Top-up failed: ${t.message}`)}function tl(){const t=O.c(5),e=ot(),n=mr(),[r,o]=w.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(se,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(me,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=u):u=t[2];let V;return t[3]!==r?(V=s.jsxs(s.Fragment,{children:[u,s.jsx(Xn,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=V):V=t[4],V}function nl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const u=c[1]?.trim().replace(/\.$/,"");return{summary:u?`Your sandbox didn't finish starting up (${u}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const sl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Xe(t){const e=O.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?qn:Rn,c=o?t.error.message:sl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let u;e[0]!==o||e[1]!==c?(u=o?nl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=u):u=e[2];const{summary:V,rawDetails:d}=u;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(se,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(se,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==d?(f=d?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(d).then(ol).catch(rl)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(no,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:d})]})]}):null,e[9]=d,e[10]=f):f=e[10];let x;return e[11]!==a||e[12]!==r||e[13]!==V||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(x=s.jsx(me,{icon:i,label:a,title:V,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=V,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=x):x=e[18],x}function rl(){return ie.error("Could not copy")}function ol(){return ie.success("Copied to clipboard")}function ht(){const t=O.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:u}=Ue(),[V,d]=Ie(),{virtualMcpId:i,createTaskWithMessage:m}=pr(),{chatMode:f,simpleModeTier:x}=pe();let p;t[0]!==f||t[1]!==x||t[2]!==i?(p=X=>({tier:x,mode:f,toolApprovalLevel:X,agent:i?{id:i}:void 0}),t[0]=f,t[1]=x,t[2]=i,t[3]=p):p=t[3];const h=p;let g;t[4]!==V.toolApprovalLevel?(g=V.toolApprovalLevel??Ws(),t[4]=V.toolApprovalLevel,t[5]=g):g=t[5];const b=g,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],j=y.filter(cl),A=is(y),C=ls(y);let S;t[6]!==e||t[7]!==u?(S=()=>{if(e){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};u(re)}},t[6]=e,t[7]=u,t[8]=S):S=t[8];const N=S;let D;t[9]!==u?(D=()=>{u({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=u,t[10]=D):D=t[10];const k=D;let P;t[11]!==h||t[12]!==b||t[13]!==c?(P=(X,re)=>{c({kind:"toolOutput",toolCallId:X.toolCallId,output:{response:re}},h(b))},t[11]=h,t[12]=b,t[13]=c,t[14]=P):P=t[14];const T=P;let _;t[15]!==m||t[16]!==V||t[17]!==d||t[18]!==i?(_=X=>{d({...V,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
1
+ import{F as Be,r as w,ar as $s,ap as zs,e as O,p as ce,c as z,j as s,E as Bs,n as ie,P as ge,aE as Us,R as _e,aF as Dt,L as Ks,B as se,G as qs,H as Qs,aG as Ys,aH as Hs,Y as Ie,C as Gs,aI as Pe,aJ as Jt,f as rt,a as Mt,t as G,aK as Ws,s as Rn,M as Js,aL as Zs,b as Tn,aM as Xs,aN as Pn,aO as er,aP as Ve,aQ as gt,aR as tr,aS as nr,aT as bt,aU as sr,aV as rr,aW as or,aX as ar,q as lr,K as Oe,aY as ir,aZ as cr,a_ as ur,a$ as Vr,b0 as Dn,b1 as Fe,m as dr,l as fr,D as Mn}from"./index-ChdATVAA.js";import{c as pe,a as Ue,d as ot,u as mr,b as pr,f as hr,g as Fn,A as xr,h as gr}from"./chat-context-CQJ83DKW.js";import{e as On,s as at,g as fe,P as Je,f as Ft,t as br,h as vr,M as yr,i as Ar,j as Le,k as jr,l as wr,F as Sr,c as Cr,S as Nr,m as kr,n as Zt}from"./pair-BriGg-MY.js";import{S as Ct}from"./spinner-DynhmXJb.js";import{c as Nt,u as _r,T as be,a as ve,b as ye}from"./tooltip-CVKtA6h7.js";import{b as lt,c as it,a as ct,D as ut,e as Ot}from"./dialog-pxIgcxdx.js";import{c as Ir,D as Er,a as Rr,b as Tr}from"./drawer-BrCENAAY.js";import{C as Pr}from"./collection-search-q3LrsDP0.js";import{g as Vt,u as Ee,a as Dr,i as Xt}from"./use-mcp-client-DjqC1nd8.js";import{u as Mr,g as dt,l as kt}from"./use-mcp-prompts-Drzzskll.js";import{t as ft}from"./ChevronDown-BIO7wba7.js";import{i as De}from"./X-DcDNiBgo.js";import{t as Fr,z as Or,u as Lr,w as $r,A as zr}from"./tab-id-CGE8BPr3.js";import{K as Br,i as Ur}from"./shell-layout-DSzgNlpN.js";import{a as Kr,u as qr}from"./use-virtual-mcp-BldCtSoA.js";import{i as Qr}from"./SwitchHorizontal01-BRvArA9H.js";import{n as Ln}from"./ZapSquare-CvMxvmoA.js";import{i as Ke}from"./Check-BmF1hQRY.js";import{s as $n}from"./Star01-Du_V1z61.js";import{a as zn}from"./Tool01-yFL5Dn59.js";import{a1 as mt,o as Yr,M as Bn,A as Un,a2 as Hr,i as He,b as Gr,P as Wr,a3 as Jr,s as Zr,a4 as Xr,a5 as eo,Y as Kn}from"./agent-icon-MPxc_53p.js";import{i as to}from"./Upload01-D4q_2hTt.js";import{i as qn}from"./AlertCircle-BU9gj1Zb.js";import{a as no}from"./Eye-Bi1ejTfS.js";import{a as _t,b as Lt,d as $t,f as zt,F as Qn}from"./form-DsGRrH4I.js";import{b as so,d as ro,c as oo,S as ao,a as lo}from"./select-6yI1bUUl.js";import{i as io}from"./RefreshCcw01-0Z7TeT1O.js";import{a as Yn,t as It,b as co}from"./XCircle-e29W-Gcn.js";import{b as uo,c as Vo}from"./tabs-B9aEuz_5.js";import{T as Hn,a as Ze}from"./toggle-group-BCauVBxS.js";import{I as Gn}from"./input-BZ-4l6sv.js";import{u as Wn,g as Jn,A as fo}from"./sortable.esm-B7SCN4Iq.js";import{u as Zn}from"./studio-tools-tx_ynP6E.js";import{i as Bt}from"./Monitor01-B2V0QJVA.js";import{C as Xn,a as es,b as ts}from"./connect-desktop-dialog-CkEEvZPz.js";import{m as pt,i as mo,g as ns,a as po,N as ho}from"./decopilot-DxHNnnUA.js";import{P as Ut,a as Kt,b as qt}from"./popover-hHdVOt7q.js";import{a as en,e as tn,f as xo,c as go,C as bo,d as vo,b as yo}from"./command--rBvALtU.js";import{u as Ao}from"./useInfiniteQuery-aPUoKLwo.js";import{t as jo}from"./Stars01-BAC8f8eM.js";import{P as Et,a as wo,b as So,u as Co,E as No,c as Qt,i as ko,d as _o}from"./scroll-area-DKNnXldV.js";import{S as Io}from"./index-BMSOEHke.js";import{D as Eo,a as Ro,b as To,c as he,d as nn,e as sn,f as rn,h as Po,i as Do}from"./dropdown-menu-BS4mK__m.js";import{s as on}from"./Plus-D-k489Hw.js";import{p as Mo,q as Fo}from"./question-004-sINsf4GQ.js";import{i as Oo}from"./ChevronRight-CwhL8zaw.js";function Lo(t,e){const n=Be(e);return $o({filters:{...t,status:"pending"}},n).length}function an(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function $o(t={},e){const n=Be(e).getMutationCache(),r=w.useRef(t),o=w.useRef(null);return o.current===null&&(o.current=an(n,t)),w.useEffect(()=>{r.current=t}),w.useSyncExternalStore(w.useCallback(a=>n.subscribe(()=>{const l=$s(o.current,an(n,r.current));o.current!==l&&(o.current=l,zs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const ln=3,ss="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",zo="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function rs(t){const e=O.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:u}=n;let V;if(e[0]!==u._meta||e[1]!==u.name||e[2]!==u.title){const C=fe(u._meta);V=u.title??Ft(u.name,C),e[0]=u._meta,e[1]=u.name,e[2]=u.title,e[3]=V}else V=e[3];const d=V,i=u.description||null;if(c==="card"){let C;e[4]!==r||e[5]!==u?(C=()=>r(u),e[4]=r,e[5]=u,e[6]=C):C=e[6];const S=a||o,N=o&&"bg-accent/40",D=(a||o)&&"cursor-not-allowed opacity-50";let k;e[7]!==N||e[8]!==D?(k=z(zo,"hover:bg-accent/60 text-foreground",N,D),e[7]=N,e[8]=D,e[9]=k):k=e[9];let P;e[10]!==d?(P=s.jsx("span",{className:"font-medium truncate capitalize",children:d}),e[10]=d,e[11]=P):P=e[11];let T;e[12]!==o?(T=o&&s.jsx(Ct,{size:"xs"}),e[12]=o,e[13]=T):T=e[13];let _;e[14]!==P||e[15]!==T?(_=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P,T]}),e[14]=P,e[15]=T,e[16]=_):_=e[16];let R;e[17]!==i?(R=i&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[17]=i,e[18]=R):R=e[18];let F;return e[19]!==_||e[20]!==R||e[21]!==C||e[22]!==S||e[23]!==k?(F=s.jsxs("button",{type:"button",onClick:C,disabled:S,className:k,children:[_,R]}),e[19]=_,e[20]=R,e[21]=C,e[22]=S,e[23]=k,e[24]=F):F=e[24],F}let m;e[25]!==r||e[26]!==u?(m=()=>r(u),e[25]=r,e[26]=u,e[27]=m):m=e[27];const f=a||o,x=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let h;e[28]!==x||e[29]!==p?(h=z(ss,"hover:bg-muted/70 hover:text-foreground",x,p),e[28]=x,e[29]=p,e[30]=h):h=e[30];let g;e[31]!==d?(g=s.jsx("span",{className:"capitalize",children:d}),e[31]=d,e[32]=g):g=e[32];let b;e[33]!==o?(b=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=b):b=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==h||e[38]!==g||e[39]!==b?(v=s.jsx(be,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:h,children:[g,b]})}),e[35]=m,e[36]=f,e[37]=h,e[38]=g,e[39]=b,e[40]=v):v=e[40];const y=i??d;let j;e[41]!==y?(j=s.jsx(ve,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=j):j=e[42];let A;return e[43]!==v||e[44]!==j?(A=s.jsxs(ye,{delayDuration:400,children:[v,j]}),e[43]=v,e[44]=j,e[45]=A):A=e[45],A}function Bo(t){const e=O.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,u]=w.useState(""),V=!!l;let d;e[0]!==n||e[1]!==c?(d=c.trim()?n.filter(S=>{const N=c.toLowerCase();return S.prompt.name.toLowerCase().includes(N)||(S.prompt.title??"").toLowerCase().includes(N)||(S.prompt.description??"").toLowerCase().includes(N)}):n,e[0]=n,e[1]=c,e[2]=d):d=e[2];const i=d,m=_r();let f;e[3]!==i.length||e[4]!==c?(f=i.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=i.length,e[4]=c,e[5]=f):f=e[5];let x;if(e[6]!==i||e[7]!==V||e[8]!==l?.name||e[9]!==o||e[10]!==a){let S;e[12]!==V||e[13]!==l?.name||e[14]!==o||e[15]!==a?(S=N=>s.jsx(rs,{item:N,variant:"card",onSelect:D=>{o(!1),a(D)},isLoading:l?.name===N.prompt.name,isDisabled:V&&l?.name!==N.prompt.name},N.prompt.name),e[12]=V,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=S):S=e[16],x=i.map(S),e[6]=i,e[7]=V,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=x}else x=e[11];let p;e[17]!==f||e[18]!==x?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,x]})}),e[17]=f,e[18]=x,e[19]=p):p=e[19];const h=p;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=S=>{S.key==="Escape"&&u("")},e[20]=g):g=e[20];let b;e[21]!==c?(b=s.jsx(Pr,{value:c,onChange:u,placeholder:"Search prompts...",onKeyDown:g}),e[21]=c,e[22]=b):b=e[22];const v=b;if(m){let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Ir,{className:"sr-only",children:s.jsx(Er,{children:"All prompts"})}),e[23]=S):S=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=N):N=e[24];let D;e[25]!==h||e[26]!==v?(D=s.jsxs(Rr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[S,N,v,h]}),e[25]=h,e[26]=v,e[27]=D):D=e[27];let k;return e[28]!==o||e[29]!==r||e[30]!==D?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(Tr,{open:r,onOpenChange:o,children:D})}),e[28]=o,e[29]=r,e[30]=D,e[31]=k):k=e[31],k}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let j;e[33]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=j):j=e[33];let A;e[34]!==h||e[35]!==v?(A=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,j,v,h]}),e[34]=h,e[35]=v,e[36]=A):A=e[36];let C;return e[37]!==o||e[38]!==r||e[39]!==A?(C=s.jsx(Nt,{delayDuration:400,children:s.jsx(ut,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=C):C=e[40],C}function Uo(t){const e=O.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=w.useState(!1);if(n.length===0)return null;let u,V,d;if(e[0]!==n||e[1]!==o||e[2]!==r){const g=n.slice(0,ln);let b;e[6]!==n?(b=n.slice(ln),e[6]=n,e[7]=b):b=e[7],u=b,V=!!o;let v;e[8]!==V||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(rs,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:V&&o?.name!==y.prompt.name},y.prompt.name),e[8]=V,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],d=g.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=u,e[4]=V,e[5]=d}else u=e[3],V=e[4],d=e[5];const i=d;let m;e[12]!==a?(m=z("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==u.length||e[15]!==V?(f=u.length>0&&s.jsxs("button",{type:"button",disabled:V,onClick:()=>c(!0),className:z(ss,"hover:bg-muted/70 hover:text-foreground",V&&"opacity-50 cursor-not-allowed"),children:["+",u.length," more"]}),e[14]=u.length,e[15]=V,e[16]=f):f=e[16];let x;e[17]!==i||e[18]!==m||e[19]!==f?(x=s.jsxs("div",{className:m,children:[i,f]}),e[17]=i,e[18]=m,e[19]=f,e[20]=x):x=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(p=s.jsx(Bo,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=p):p=e[25];let h;return e[26]!==x||e[27]!==p?(h=s.jsxs(Nt,{delayDuration:400,children:[x,p]}),e[26]=x,e[27]=p,e[28]=h):h=e[28],h}function Ko(){return null}function qo(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Qo(t){const e=O.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{org:o}=ce();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=Ee(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:u}=Mr(c);let V;e[6]!==u?.prompts?(V=u?.prompts??[],e[6]=u?.prompts,e[7]=V):V=e[7];const d=V;let i;e[8]!==d?(i=d.map(Yo),e[8]=d,e[9]=i):i=e[9];const m=i;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[x,p]=w.useReducer(qo,f),[h,g]=w.useState(null);let b;e[11]!==l||e[12]!==r?(b=async(T,_)=>{if(!l){ie.error("MCP client not available"),p({type:"RESET"});return}try{const R=await dt(l,T.name,_);p({type:"RESET"});const F={type:"doc",content:[{type:"paragraph",content:[On({id:T.name,name:at(T.name,fe(T._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(F)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ie.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=b):b=e[13];const v=b;let y;e[14]!==v?(y=async T=>{if(T.arguments&&T.arguments.length>0){p({type:"SELECT_PROMPT",prompt:T}),g(T);return}p({type:"START_LOADING",prompt:T}),await v(T)},e[14]=v,e[15]=y):y=e[15];const j=y;let A;e[16]!==h||e[17]!==v?(A=async T=>{h&&(p({type:"START_LOADING",prompt:h,arguments:T}),g(null),await v(h,T))},e[16]=h,e[17]=v,e[18]=A):A=e[18];const C=A;if(m.length===0)return null;const S=x.stage==="loading"?x.prompt:null;let N;e[19]!==j||e[20]!==m||e[21]!==S?(N=s.jsx(Uo,{items:m,onSelect:j,loadingPrompt:S}),e[19]=j,e[20]=m,e[21]=S,e[22]=N):N=e[22];let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{g(null),p({type:"RESET"})},e[23]=D):D=e[23];let k;e[24]!==h||e[25]!==C?(k=s.jsx(Je,{prompt:h,setPrompt:D,onSubmit:C}),e[24]=h,e[25]=C,e[26]=k):k=e[26];let P;return e[27]!==N||e[28]!==k?(P=s.jsxs(s.Fragment,{children:[N,k]}),e[27]=N,e[28]=k,e[29]=P):P=e[29],P}function Yo(t){return{prompt:t}}function Ho(t){const e=O.c(13),{className:n}=t,{selectedVirtualMcp:r}=pe(),{org:o}=ce();let a;e[0]!==o.id?(a=Vt(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let u;e[2]!==n?(u=z("w-full @container",n),e[2]=n,e[3]=u):u=e[3];const V=c??"default";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ko,{}),e[4]=d):d=e[4];let i;e[5]!==c?(i=s.jsx(Qo,{connectionId:c}),e[5]=c,e[6]=i):i=e[6];let m;e[7]!==V||e[8]!==i?(m=s.jsx(Bs,{fallback:null,children:s.jsx(w.Suspense,{fallback:d,children:i},V)}),e[7]=V,e[8]=i,e[9]=m):m=e[9];let f;return e[10]!==u||e[11]!==m?(f=s.jsx("div",{className:u,children:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f}const vt="cubic-bezier(0.645, 0.045, 0.355, 1)",Go=44,Wo={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},Jo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},Zo={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function me(t){const e=O.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:u,defaultExpanded:V,variant:d,onClose:i}=t,m=d===void 0?"default":d,[f,x]=w.useState(V),[p,h]=w.useState(!1);let g;e[0]!==i?(g=()=>{h(!0),i?.()},e[0]=i,e[1]=g):g=e[1];const b=g;if(p)return null;const v=Jo[m],y=Wo[m];let j;e[2]!==v||e[3]!==y?(j=z("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=j):j=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(Xo),e[5]=A):A=e[5];const C=f&&"rounded-b-none",S=!f&&"rounded-b-xl";let N;e[6]!==C||e[7]!==S?(N=z("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",C,S),e[6]=C,e[7]=S,e[8]=N):N=e[8];const D=Zo[m];let k;e[9]!==D?(k=z("shrink-0",D),e[9]=D,e[10]=k):k=e[10];let P;e[11]!==n||e[12]!==k?(P=s.jsx("span",{className:k,children:n}),e[11]=n,e[12]=k,e[13]=P):P=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=T):T=e[15];let _;e[16]!==o?(_=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=_):_=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let F;e[18]!==R?(F=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ft,{size:16,style:{transform:R,transition:`transform 180ms ${vt}`}})}),e[18]=R,e[19]=F):F=e[19];let E,I;e[20]!==b?(E=W=>{W.stopPropagation(),b()},I=W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),W.stopPropagation(),b())},e[20]=b,e[21]=E,e[22]=I):(E=e[21],I=e[22]);let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(De,{size:16}),e[23]=$):$=e[23];let B;e[24]!==E||e[25]!==I?(B=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:E,onKeyDown:I,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[24]=E,e[25]=I,e[26]=B):B=e[26];let L;e[27]!==f||e[28]!==P||e[29]!==T||e[30]!==_||e[31]!==F||e[32]!==B||e[33]!==N?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:N,children:[P,T,_,F,B]}),e[27]=f,e[28]=P,e[29]=T,e[30]=_,e[31]=F,e[32]=B,e[33]=N,e[34]=L):L=e[34];const q=f?"1fr":"0fr";let M;e[35]!==q?(M={display:"grid",gridTemplateRows:q,transition:`grid-template-rows 180ms ${vt}`},e[35]=q,e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U={overflow:"hidden",minHeight:0},e[37]=U):U=e[37];const Q=f?1:0;let K;e[38]!==Q?(K={opacity:Q,transition:`opacity 120ms ${vt}`},e[38]=Q,e[39]=K):K=e[39];let H;e[40]!==a?(H=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=H):H=e[41];let ne;e[42]!==u||e[43]!==a?(ne=u?s.jsx("div",{className:z("overflow-clip pb-4",!a&&"pt-4"),children:u}):null,e[42]=u,e[43]=a,e[44]=ne):ne=e[44];let ee;e[45]!==l||e[46]!==c?(ee=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=ee):ee=e[47];let te;e[48]!==K||e[49]!==H||e[50]!==ne||e[51]!==ee?(te=s.jsx("div",{style:U,children:s.jsxs("div",{style:K,children:[H,ne,ee]})}),e[48]=K,e[49]=H,e[50]=ne,e[51]=ee,e[52]=te):te=e[52];let J;e[53]!==M||e[54]!==te?(J=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:te}),e[53]=M,e[54]=te,e[55]=J):J=e[55];let Z;return e[56]!==L||e[57]!==J||e[58]!==j||e[59]!==m?(Z=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:j,children:[L,J]}),e[56]=L,e[57]=J,e[58]=j,e[59]=m,e[60]=Z):Z=e[60],Z}function Xo(t){return!t}const ea=ge({content:_e().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:_e().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),os=ge({todos:Us(ea)}),ta="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Fr({description:ta,inputSchema:Or(os),execute:async({todos:t})=>({ok:!0,count:t.length})});const na="tool-todo_write",sa=new Set(["input-available","output-available"]);function as(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==na||typeof a.state!="string"||!sa.has(a.state))continue;const l=os.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ls(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:br(vr(r)),input:n.input})}return e}function is(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function ra(t){return t?t.message.startsWith("[CREDITS]"):!1}const oa={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function aa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&ra(n))return{...oa,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],u=c,d=!!u.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,i=is(c),m=ls(u),f=as(e),x=!o&&!!n,p=m.length>0||o&&a,h=i.length>0,b=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(d||p||h))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:b,hasApprovals:p,hasPlans:h,isWaitingForUserInput:d}}function cs(){const t=O.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),l=n??null,c=r??null;let u;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(u=aa({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=u):u=t[5],u}function la(){const t=cs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function us(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const ia="__home__";function Yt(t,e){return Ks.chatDraft(t,e)}function ca(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function ua(t,e,n,r,o){const a=Yt(e,n);if(us(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(u){if(da(u)){const V=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:V});return}throw u}}function cn(t,e,n){const r=Yt(e,n),o=t.getItem(r),a=ca(o);return o!==null&&a===null&&t.removeItem(r),a}function Va(t,e,n){t.removeItem(Yt(e,n))}function da(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function fa(t){const e=O.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let u;e[0]!==c?(u=z("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=u):u=e[1];let V;e[2]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(io,{size:14}),e[2]=V):V=e[2];let d;e[3]!==o||e[4]!==l||e[5]!==u?(d=s.jsx("button",{type:"button",onClick:o,disabled:l,className:u,"aria-label":"Previous question",children:V}),e[3]=o,e[4]=l,e[5]=u,e[6]=d):d=e[6];const i=n+1;let m;e[7]!==i||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[i," of ",r]}),e[7]=i,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,x=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==x?(p=z("p-0.5 rounded transition-colors",x),e[10]=x,e[11]=p):p=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Yn,{size:14}),e[12]=h):h=e[12];let g;e[13]!==a||e[14]!==p||e[15]!==f?(g=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:h}),e[13]=a,e[14]=p,e[15]=f,e[16]=g):g=e[16];let b;return e[17]!==g||e[18]!==d||e[19]!==m?(b=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[d,m,g]}),e[17]=g,e[18]=d,e[19]=m,e[20]=b):b=e[20],b}function Vs(t){const e=O.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(fa,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let u;return e[5]!==l||e[6]!==c?(u=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=u):u=e[7],u}function ma(t){const e=O.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,d=r?l===void 0?"Submit":l:c===void 0?"Next":c,i=r?n:!o,m=i?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==i||e[1]!==a?(f=()=>{i||a()},e[0]=i,e[1]=a,e[2]=f):f=e[2];const x=i&&"opacity-50 cursor-not-allowed";let p;e[3]!==x?(p=z("h-7 px-2.5 text-xs",x),e[3]=x,e[4]=p):p=e[4];let h;e[5]!==i||e[6]!==d||e[7]!==f||e[8]!==p?(h=s.jsx(se,{type:"button",size:"sm","aria-disabled":i,onClick:f,className:p,children:d}),e[5]=i,e[6]=d,e[7]=f,e[8]=p,e[9]=h):h=e[9];const g=h;if(!m)return g;let b;e[10]!==g?(b=s.jsx(be,{asChild:!0,children:g}),e[10]=g,e[11]=b):b=e[11];let v;e[12]!==m?(v=s.jsx(ve,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==b||e[15]!==v?(y=s.jsxs(ye,{children:[b,v]}),e[14]=b,e[15]=v,e[16]=y):y=e[16],y}function ds(t,e,n){return t.findIndex(r=>e(r)===n)}function un(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function Vn(t,e,n,r,o){if(t.length===0)return null;const a=ds(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const u=e(c);if(u!==o&&!r(n[u]))return u}return null}function pa(t){return!t.isStreaming&&t.allAnswered}function fs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,u=e[0]?n(e[0]):"",[V,d]=w.useState(u),[i,m]=w.useState(!1),f=qs({resolver:Qs(r),defaultValues:o}),x=f.watch(),p=ds(e,n,V),h=p>=0?e[p]:void 0,g=l(x[V]),b=un(e,n,x,l),v=pa({isStreaming:a,allAnswered:b}),y=()=>{if(p>0){const k=e[p-1];k&&d(n(k))}},j=()=>{if(p>=0&&p<e.length-1){const k=e[p+1];k&&d(n(k))}},A=()=>{const k=f.getValues(),P=Vn(e,n,k,l,V);P&&d(P)},C=()=>{f.handleSubmit(k=>{const P=k;for(const T of e)c(T,P[n(T)])})()},S=w.useRef(C);S.current=C;const N=()=>{v&&(m(!1),S.current())},D=()=>{const k=f.getValues();if(un(e,n,k,l)){if(a){m(!0);return}m(!1),S.current()}else{const P=Vn(e,n,k,l,V);P&&d(P)}};return w.useEffect(()=>{if(i&&!a){if(!b){m(!1);return}m(!1),S.current()}},[i,a,b]),{form:f,activeKey:V,setActiveKey:d,currentIndex:p,currentPart:h,isCurrentAnswered:g,isAllAnswered:b,canSubmit:v,goPrev:y,goNext:j,advanceToNextUnanswered:A,submit:N,submitOrAdvance:D}}const ms="User denied this tool call, give other alternatives.";function ps(t){const e=O.c(9),{onYolo:n}=t,[r,o]=Ie();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=d=>{const i=d;o({...r,toolApprovalLevel:i}),i==="auto"&&n(i)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ao,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:xa,children:s.jsx(lo,{})}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(so,{children:Pe.map(ha)}),e[5]=u):u=e[5];let V;return e[6]!==l||e[7]!==r.toolApprovalLevel?(V=s.jsxs(ro,{value:r.toolApprovalLevel,onValueChange:l,children:[c,u]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=V):V=e[8],V}function ha(t){return s.jsx(oo,{value:t.value,children:t.label},t.value)}function xa(t){return t.stopPropagation()}function hs(t){const e=O.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function ga(t){const e=O.c(28),{approval:n,onRespond:r}=t,[o]=Ie(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ms,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let u;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(u=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=u):u=e[7];const V=u;let d;e[8]!==n.approvalId||e[9]!==r?(d=j=>r(n.approvalId,!0,void 0,j),e[8]=n.approvalId,e[9]=r,e[10]=d):d=e[10];const i=d;let m;e[11]!==i?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(ps,{onYolo:i})}),e[11]=i,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=x):x=e[14];let p;e[15]!==V?(p=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:V,children:"Accept"}),e[15]=V,e[16]=p):p=e[16];let h;e[17]!==x||e[18]!==p?(h=s.jsxs(s.Fragment,{children:[x,p]}),e[17]=x,e[18]=p,e[19]=h):h=e[19];const g=h;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(mt,{size:14}),e[20]=b):b=e[20];let v;e[21]!==n.input?(v=s.jsx(hs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==g||e[26]!==v?(y=s.jsx(me,{icon:b,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:g,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=g,e[26]=v,e[27]=y):y=e[27],y}const ba=Ys(_e(),ge({approved:Hs().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function va(t){const e=O.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ie(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(ja)),e[0]=n,e[1]=c):c=e[1];const u=c;let V;e[2]!==l||e[3]!==o?(V=(D,k)=>{const P=k;typeof P?.approved=="boolean"&&o(D.approvalId,P.approved,P.approved===!1?ms:void 0,P.levelOverride??l)},e[2]=l,e[3]=o,e[4]=V):V=e[4];let d;e[5]!==n||e[6]!==u||e[7]!==r||e[8]!==V?(d={parts:n,partKey:Aa,schema:ba,defaultValues:u,isStreaming:r,hasAnswer:ya,onSubmit:V},e[5]=n,e[6]=u,e[7]=r,e[8]=V,e[9]=d):d=e[9];const i=fs(d);let m;e[10]!==n||e[11]!==i?(m=D=>{i.form.reset(Object.fromEntries(n.map(k=>[k.approvalId,{approved:!0,levelOverride:D}]))),i.submitOrAdvance()},e[10]=n,e[11]=i,e[12]=m):m=e[12];const f=m,x=i.currentPart;let p;e[13]!==i?(p=D=>{D.preventDefault(),i.submit()},e[13]=i,e[14]=p):p=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(mt,{size:14}),e[15]=h):h=e[15];const g=`${n.length} approvals pending`,b=x?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(ps,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==i.currentIndex||e[20]!==i.goNext||e[21]!==i.goPrev||e[22]!==v?(y=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext,extraLeft:v}),e[18]=n.length,e[19]=i.currentIndex,e[20]=i.goNext,e[21]=i.goPrev,e[22]=v,e[23]=y):y=e[23];let j;e[24]!==x||e[25]!==i.form.control||e[26]!==i.submitOrAdvance?(j=x?s.jsx(wa,{approvalId:x.approvalId,control:i.form.control,onChange:i.submitOrAdvance}):null,e[24]=x,e[25]=i.form.control,e[26]=i.submitOrAdvance,e[27]=j):j=e[27];let A;e[28]!==x?(A=x?s.jsx(hs,{input:x.input}):null,e[28]=x,e[29]=A):A=e[29];let C;e[30]!==y||e[31]!==j||e[32]!==A||e[33]!==g||e[34]!==b?(C=s.jsx(me,{icon:h,label:g,title:b,defaultExpanded:!0,footerLeft:y,footerRight:j,children:A}),e[30]=y,e[31]=j,e[32]=A,e[33]=g,e[34]=b,e[35]=C):C=e[35];let S;e[36]!==C||e[37]!==p?(S=s.jsx("form",{onSubmit:p,children:C}),e[36]=C,e[37]=p,e[38]=S):S=e[38];let N;return e[39]!==i.form||e[40]!==S?(N=s.jsx(_t,{...i.form,children:S}),e[39]=i.form,e[40]=S,e[41]=N):N=e[41],N}function ya(t){return typeof t?.approved=="boolean"}function Aa(t){return t.approvalId}function ja(t){return[t.approvalId,{approved:void 0}]}function wa(t){const e=O.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=u=>{const{field:V}=u,d=V.value===!0,i=V.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(se,{type:"button",variant:i?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{V.onChange(!1),o()},"aria-pressed":i,children:"Deny"}),s.jsx(se,{type:"button",variant:d?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{V.onChange(!0),o()},"aria-pressed":d,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Gs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function Sa(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(mt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Ca(t){const e=O.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Sa,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(ga,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(va,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Na(t){const e=O.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let u;e[5]!==l?(u=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=u):u=e[6];let V;e[7]!==c||e[8]!==u?(V=s.jsxs(s.Fragment,{children:[c,u]}),e[7]=c,e[8]=u,e[9]=V):V=e[9];const d=V;let i;e[10]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Yr,{size:14}),e[10]=i):i=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(yr,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==d||e[14]!==m?(f=s.jsx(me,{icon:i,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:d,children:m}),e[13]=d,e[14]=m,e[15]=f):f=e[15],f}function ka(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ke,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function _a(t){const e=O.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let V;return e[0]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(ka,{}),e[0]=V):V=e[0],V}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let u;return e[3]!==c||e[4]!==o||e[5]!==a?(u=s.jsx(Na,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=u):u=e[6],u}function xs(t){return t?"response"in t?t.response:t.option??t.draft:""}const dn=ge({response:_e().min(1,"Response is required")}),Ia=ge({option:_e().nullable(),draft:_e()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ea=ge({response:Dt(["yes","no"])});function Ra(t){switch(t.type){case"text":return dn;case"choice":return Ia;case"confirm":return Ea;default:return dn}}function Ta(t){const e={};for(const n of t)e[n.toolCallId]=Ra(n.input);return ge(e)}function Pa(t){const e=O.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:u}=c,V=u.value??"";return s.jsxs(Lt,{children:[s.jsx($t,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...u,value:V,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Qn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function gs(t,e){const n=O.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const u=Number.parseInt(l.key,10);u>=1&&u<=t&&(l.preventDefault(),e(u-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),w.useEffect(r,o)}function Da(t){const e=O.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Jt(l),u=`${r}.draft`;let V;e[3]!==n||e[4]!==u?(V={control:n,name:u,defaultValue:""},e[3]=n,e[4]=u,e[5]=V):V=e[5];const{field:d}=Jt(V),i=c.value,m=d.value??"";let f;if(e[6]!==c||e[7]!==o?(f=P=>{const T=o[P];T!=null&&c.onChange(T)},e[6]=c,e[7]=o,e[8]=f):f=e[8],gs(o.length,f),o.length===0)return null;const x=i===null;let p;if(e[9]!==c||e[10]!==i||e[11]!==o){let P;e[13]!==c||e[14]!==i?(P=(T,_)=>{const R=i===T;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(T),className:z("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${T}`,children:[s.jsx("span",{className:z("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:T})]},`${_}-${T}`)},e[13]=c,e[14]=i,e[15]=P):P=e[15],p=o.map(P),e[9]=c,e[10]=i,e[11]=o,e[12]=p}else p=e[12];const h=x&&"bg-accent/50",g=!x&&"hover:bg-accent/30";let b;e[16]!==h||e[17]!==g?(b=z("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",h,g),e[16]=h,e[17]=g,e[18]=b):b=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=x?m:"";let j;e[20]!==d||e[21]!==c||e[22]!==i?(j=P=>{d.onChange(P.target.value),i!==null&&c.onChange(null)},e[20]=d,e[21]=c,e[22]=i,e[23]=j):j=e[23];let A;e[24]!==c||e[25]!==i?(A=()=>{i!==null&&c.onChange(null)},e[24]=c,e[25]=i,e[26]=A):A=e[26];let C;e[27]!==y||e[28]!==j||e[29]!==A?(C=s.jsx("input",{type:"text",value:y,onChange:j,onFocus:A,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=y,e[28]=j,e[29]=A,e[30]=C):C=e[30];let S;e[31]!==C||e[32]!==b?(S=s.jsxs("label",{className:b,children:[v,C]}),e[31]=C,e[32]=b,e[33]=S):S=e[33];let N;e[34]!==S||e[35]!==p?(N=s.jsx($t,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,S]})}),e[34]=S,e[35]=p,e[36]=N):N=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(zt,{}),e[37]=D):D=e[37];let k;return e[38]!==N?(k=s.jsxs(Lt,{children:[N,D]}),e[38]=N,e[39]=k):k=e[39],k}function Ma(t){const e=O.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=w.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=d=>{l.current?.onChange(a[d]??"")},e[1]=c):c=e[1],gs(a.length,c);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=d=>{const{field:i}=d;return l.current=i,s.jsxs(Lt,{children:[s.jsx($t,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=i.value===m;return s.jsxs("button",{type:"button",onClick:()=>i.onChange(m),className:z("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:z("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(zt,{})]})},e[2]=u):u=e[2];let V;return e[3]!==n||e[4]!==r?(V=s.jsx(Qn,{control:n,name:r,render:u}),e[3]=n,e[4]=r,e[5]=V):V=e[5],V}function fn(t){const e=O.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Pa,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Da,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ma,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Fa(t){const e=O.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ta(n.map(za)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map($a)),e[2]=n,e[3]=c):c=e[3];const u=c;let V;e[4]!==o?(V=(E,I)=>{const $=xs(I);$&&o(E,$)},e[4]=o,e[5]=V):V=e[5];let d;e[6]!==u||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==V?(d={parts:n,partKey:La,schema:l,defaultValues:u,isStreaming:r,hasAnswer:Oa,onSubmit:V},e[6]=u,e[7]=r,e[8]=n,e[9]=l,e[10]=V,e[11]=d):d=e[11];const i=fs(d),m=i.currentPart;let f;e[12]!==m||e[13]!==i?(f=()=>{const E=m;if(!E)return;const I=E.toolCallId;E.input?.type==="choice"?(i.form.setValue(`${I}.option`,null),i.form.setValue(`${I}.draft`,"user has skip this question")):i.form.setValue(`${I}.response`,"user has skip this question"),i.advanceToNextUnanswered()},e[12]=m,e[13]=i,e[14]=f):f=e[14];const x=f;let p;e[15]!==i.currentIndex||e[16]!==i.goNext||e[17]!==i.goPrev||e[18]!==n.length?(p=s.jsx(Vs,{currentIndex:i.currentIndex,total:n.length,onPrev:i.goPrev,onNext:i.goNext}),e[15]=i.currentIndex,e[16]=i.goNext,e[17]=i.goPrev,e[18]=n.length,e[19]=p):p=e[19];const h=p;let g;e[20]!==x?(g=s.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=g):g=e[21];let b;e[22]!==i.isAllAnswered||e[23]!==i.isCurrentAnswered||e[24]!==i.submitOrAdvance||e[25]!==r?(b=s.jsx(ma,{isStreaming:r,isAllAnswered:i.isAllAnswered,isCurrentAnswered:i.isCurrentAnswered,onAdvanceOrSubmit:i.submitOrAdvance}),e[22]=i.isAllAnswered,e[23]=i.isCurrentAnswered,e[24]=i.submitOrAdvance,e[25]=r,e[26]=b):b=e[26];let v;e[27]!==g||e[28]!==b?(v=s.jsxs(s.Fragment,{children:[g,b]}),e[27]=g,e[28]=b,e[29]=v):v=e[29];const y=v;if(n.length===1){const E=n[0];if(!E?.input)return null;let I;e[30]!==i?(I=K=>{K.preventDefault(),i.submit()},e[30]=i,e[31]=I):I=e[31];let $;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(It,{size:14}),e[32]=$):$=e[32];const B=E.input?.prompt??"Question",L=E.input;let q;e[33]!==i.form.control||e[34]!==E.toolCallId||e[35]!==L?(q=s.jsx(fn,{input:L,control:i.form.control,toolCallId:E.toolCallId}),e[33]=i.form.control,e[34]=E.toolCallId,e[35]=L,e[36]=q):q=e[36];let M;e[37]!==y||e[38]!==B||e[39]!==q?(M=s.jsx(me,{icon:$,label:"Question pending",title:B,defaultExpanded:!0,footerRight:y,children:q}),e[37]=y,e[38]=B,e[39]=q,e[40]=M):M=e[40];let U;e[41]!==I||e[42]!==M?(U=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=U):U=e[43];let Q;return e[44]!==i.form||e[45]!==U?(Q=s.jsx(_t,{...i.form,children:U}),e[44]=i.form,e[45]=U,e[46]=Q):Q=e[46],Q}const j=i.form;let A;e[47]!==i?(A=E=>{E.preventDefault(),i.submit()},e[47]=i,e[48]=A):A=e[48];let C;e[49]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(It,{size:14}),e[49]=C):C=e[49];const S=`${i.currentIndex+1} of ${n.length}`,N=m?.input?.prompt??"Question",D=i.activeKey,k=i.setActiveKey;let P;if(e[50]!==i.form||e[51]!==n){let E;e[53]!==i.form?(E=I=>s.jsx(uo,{value:I.toolCallId,className:"mt-0",children:s.jsx(fn,{input:I.input,control:i.form.control,toolCallId:I.toolCallId})},I.toolCallId),e[53]=i.form,e[54]=E):E=e[54],P=n.map(E),e[50]=i.form,e[51]=n,e[52]=P}else P=e[52];let T;e[55]!==i.activeKey||e[56]!==i.setActiveKey||e[57]!==P?(T=s.jsx(Vo,{value:D,onValueChange:k,children:P}),e[55]=i.activeKey,e[56]=i.setActiveKey,e[57]=P,e[58]=T):T=e[58];let _;e[59]!==h||e[60]!==y||e[61]!==S||e[62]!==N||e[63]!==T?(_=s.jsx(me,{icon:C,label:"Question pending",count:S,title:N,defaultExpanded:!0,footerLeft:h,footerRight:y,children:T}),e[59]=h,e[60]=y,e[61]=S,e[62]=N,e[63]=T,e[64]=_):_=e[64];let R;e[65]!==A||e[66]!==_?(R=s.jsx("form",{onSubmit:A,autoComplete:"off",children:_}),e[65]=A,e[66]=_,e[67]=R):R=e[67];let F;return e[68]!==i.form||e[69]!==R?(F=s.jsx(_t,{...j,children:R}),e[68]=i.form,e[69]=R,e[70]=F):F=e[70],F}function Oa(t){return!!xs(t)}function La(t){return t.toolCallId}function $a(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function za(t){return{toolCallId:t.toolCallId,input:t.input}}function Ba(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(It,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function bs(t){const e=O.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Ua),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ba,{}),e[2]=u):u=e[2],u}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Fa,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Ua(t){return t.state==="input-available"}function Ka(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function qa(){const t=O.c(21),{messages:e}=Ue();let n,r,o,a,l,c,u,V,d;if(t[0]!==e){d=Symbol.for("react.early_return_sentinel");e:{const f=as(e);if(f.length===0){d=null;break e}const x=Ka(f);n=me,l=s.jsx(Ga,{status:x.icon}),c=x.activity,u=x.progress,V=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Qa)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=u,t[8]=V,t[9]=d}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],u=t[7],V=t[8],d=t[9];if(d!==Symbol.for("react.early_return_sentinel"))return d;let i;t[10]!==r||t[11]!==o||t[12]!==a?(i=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=i):i=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==u||t[18]!==V||t[19]!==i?(m=s.jsx(n,{icon:l,label:c,count:u,defaultExpanded:V,children:i}),t[14]=n,t[15]=l,t[16]=c,t[17]=u,t[18]=V,t[19]=i,t[20]=m):m=t[20],m}function Qa(t,e){return s.jsx(Ya,{todo:t},e)}function Ya(t){const e=O.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(Ha,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let u;e[2]!==c?(u=z("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=u):u=e[3];const V=r?"100%":"0%",d=r?"width 300ms ease 200ms":"width 150ms ease";let i;e[4]!==V||e[5]!==d?(i=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:V,transition:d}}),e[4]=V,e[5]=d,e[6]=i):i=e[6];let m;e[7]!==a||e[8]!==u||e[9]!==i?(m=s.jsxs("span",{className:u,children:[a,i]}),e[7]=a,e[8]=u,e[9]=i,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function Ha(t){const e=O.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function Ga(t){const e=O.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const Wa={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Ja=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function vs(t){const e=O.c(41),{onDismiss:n}=t,{org:r}=ce(),o=rt(),{decoKeyId:a}=Wn(),l=Zn(),[c,u]=w.useState(""),[V,d]=w.useState(!1),[i,m]=w.useState("usd"),f=i==="brl"?"R$":"$";let x,p;e[0]!==r.id?(x=()=>{G("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=x,e[2]=p):(x=e[1],p=e[2]),w.useEffect(x,p);let h;e[3]!==i||e[4]!==l?(h=async E=>{const{url:I}=await l.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:E,currency:i});return I},e[3]=i,e[4]=l,e[5]=h):h=e[5];let g;e[6]!==n?(g=E=>{E&&window.open(E,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=g):g=e[7];let b;e[8]!==h||e[9]!==g?(b={mutationFn:h,onSuccess:g,onError:el},e[8]=h,e[9]=g,e[10]=b):b=e[10];const{mutate:v,isPending:y}=Mt(b),j=parseFloat(c),A=!isNaN(j)&&j>=1;let C;e[11]!==n?(C=E=>!E&&n?.(),e[11]=n,e[12]=C):C=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=S):S=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:S.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=N):N=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[N,s.jsxs(lt,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=D):D=e[15];let k;e[16]!==i||e[17]!==f||e[18]!==c||e[19]!==j||e[20]!==a||e[21]!==A||e[22]!==y||e[23]!==V||e[24]!==v?(k=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Hn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:E=>{E&&m(E)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Wa[i].map(E=>{const{dollars:I,label:$}=E;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{G("credits_topup_clicked",{amount_cents:I*100,currency:i,tier_label:$,source:"exhausted_banner"}),v(I*100)},className:z("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,I]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},I)})}),V?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Gn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:E=>u(E.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!A||y,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:i,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(j*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Ja.map(Za)})]}),e[16]=i,e[17]=f,e[18]=c,e[19]=j,e[20]=a,e[21]=A,e[22]=y,e[23]=V,e[24]=v,e[25]=k):k=e[25];let P;e[26]!==n?(P=s.jsx(se,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=P):P=e[27];let T;e[28]!==o||e[29]!==n||e[30]!==r.slug?(T=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=T):T=e[31];let _;e[32]!==P||e[33]!==T?(_=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[P,T]}),e[32]=P,e[33]=T,e[34]=_):_=e[34];let R;e[35]!==k||e[36]!==_?(R=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Xa,children:[D,k,_]}),e[35]=k,e[36]=_,e[37]=R):R=e[37];let F;return e[38]!==R||e[39]!==C?(F=s.jsx(ut,{open:!0,onOpenChange:C,children:R}),e[38]=R,e[39]=C,e[40]=F):F=e[40],F}function Za(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Xa(t){return t.preventDefault()}function el(t){ie.error(`Top-up failed: ${t.message}`)}function tl(){const t=O.c(5),e=ot(),n=mr(),[r,o]=w.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Bt,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(se,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(me,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=u):u=t[2];let V;return t[3]!==r?(V=s.jsxs(s.Fragment,{children:[u,s.jsx(Xn,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=V):V=t[4],V}function nl(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const u=c[1]?.trim().replace(/\.$/,"");return{summary:u?`Your sandbox didn't finish starting up (${u}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const sl={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Xe(t){const e=O.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?qn:Rn,c=o?t.error.message:sl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let u;e[0]!==o||e[1]!==c?(u=o?nl(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=u):u=e[2];const{summary:V,rawDetails:d}=u;let i;e[3]!==l?(i=s.jsx(l,{size:14}),e[3]=l,e[4]=i):i=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(se,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(se,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==d?(f=d?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(d).then(ol).catch(rl)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(no,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:d})]})]}):null,e[9]=d,e[10]=f):f=e[10];let x;return e[11]!==a||e[12]!==r||e[13]!==V||e[14]!==i||e[15]!==m||e[16]!==f||e[17]!==n?(x=s.jsx(me,{icon:i,label:a,title:V,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=V,e[14]=i,e[15]=m,e[16]=f,e[17]=n,e[18]=x):x=e[18],x}function rl(){return ie.error("Could not copy")}function ol(){return ie.success("Copied to clipboard")}function ht(){const t=O.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:u}=Ue(),[V,d]=Ie(),{virtualMcpId:i,createTaskWithMessage:m}=pr(),{chatMode:f,simpleModeTier:x}=pe();let p;t[0]!==f||t[1]!==x||t[2]!==i?(p=X=>({tier:x,mode:f,toolApprovalLevel:X,agent:i?{id:i}:void 0}),t[0]=f,t[1]=x,t[2]=i,t[3]=p):p=t[3];const h=p;let g;t[4]!==V.toolApprovalLevel?(g=V.toolApprovalLevel??Ws(),t[4]=V.toolApprovalLevel,t[5]=g):g=t[5];const b=g,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],j=y.filter(cl),A=is(y),C=ls(y);let S;t[6]!==e||t[7]!==u?(S=()=>{if(e){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};u(re)}},t[6]=e,t[7]=u,t[8]=S):S=t[8];const N=S;let D;t[9]!==u?(D=()=>{u({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=u,t[10]=D):D=t[10];const k=D;let P;t[11]!==h||t[12]!==b||t[13]!==c?(P=(X,re)=>{c({kind:"toolOutput",toolCallId:X.toolCallId,output:{response:re}},h(b))},t[11]=h,t[12]=b,t[13]=c,t[14]=P):P=t[14];const T=P;let _;t[15]!==m||t[16]!==V||t[17]!==d||t[18]!==i?(_=X=>{d({...V,toolApprovalLevel:"auto"}),m({virtualMcpId:i,message:{parts:[{type:"text",text:`Implement this plan:
2
2
 
3
3
  ${X}`}]}})},t[15]=m,t[16]=V,t[17]=d,t[18]=i,t[19]=_):_=t[19];const R=_,F=il;let E;t[20]!==h||t[21]!==c?(E=(X,re,Y,oe)=>{c({kind:"approval",approvalId:X,approved:re,...Y?{reason:Y}:{}},h(oe))},t[20]=h,t[21]=c,t[22]=E):E=t[22];const I=E,$=cs();if($.isCreditExhausted){let X;return t[23]!==n?(X=s.jsx(vs,{onDismiss:n}),t[23]=n,t[24]=X):X=t[24],X}const{showError:B,showWarning:L,hasApprovals:q}=$,M=j.map(ll).join("|"),U=A[0]?.toolCallId??"",Q=C.map(al).join("|");let K,H;t[25]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(qa,{}),H=s.jsx(tl,{}),t[25]=K,t[26]=H):(K=t[25],H=t[26]);let ne;t[27]!==n||t[28]!==e||t[29]!==N||t[30]!==B?(ne=B&&s.jsx(Xe,{variant:"error",error:e,onDismiss:n,onFixInChat:N}),t[27]=n,t[28]=e,t[29]=N,t[30]=B,t[31]=ne):ne=t[31];let ee;t[32]!==o||t[33]!==r||t[34]!==k||t[35]!==L?(ee=L&&s.jsx(Xe,{variant:"warning",finishReason:r,onDismiss:o,onContinue:k}),t[32]=o,t[33]=r,t[34]=k,t[35]=L,t[36]=ee):ee=t[36];let te;t[37]!==Q||t[38]!==I||t[39]!==q||t[40]!==l||t[41]!==C?(te=q&&s.jsx(Ca,{approvals:C,isStreaming:l,onRespond:I},Q),t[37]=Q,t[38]=I,t[39]=q,t[40]=l,t[41]=C,t[42]=te):te=t[42];let J;t[43]!==$.hasPlans||t[44]!==R||t[45]!==F||t[46]!==l||t[47]!==A||t[48]!==U?(J=$.hasPlans&&s.jsx(_a,{plans:A,isStreaming:l,onApprove:R,onDismiss:F},U),t[43]=$.hasPlans,t[44]=R,t[45]=F,t[46]=l,t[47]=A,t[48]=U,t[49]=J):J=t[49];let Z;t[50]!==$.isWaitingForUserInput||t[51]!==T||t[52]!==l||t[53]!==M||t[54]!==j?(Z=$.isWaitingForUserInput&&s.jsx(bs,{userAskParts:j,isStreaming:l,onSubmit:T},M),t[50]=$.isWaitingForUserInput,t[51]=T,t[52]=l,t[53]=M,t[54]=j,t[55]=Z):Z=t[55];let W;return t[56]!==ee||t[57]!==te||t[58]!==J||t[59]!==Z||t[60]!==ne?(W=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[K,H,ne,ee,te,J,Z]}),t[56]=ee,t[57]=te,t[58]=J,t[59]=Z,t[60]=ne,t[61]=W):W=t[61],W}function al(t){return t.approvalId}function ll(t){return t.toolCallId}function il(){document.querySelector("[data-chat-input]")?.focus()}function cl(t){return t.type==="tool-user_ask"}ht.Error=function(e){return s.jsx(Xe,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};ht.Warning=function(e){return s.jsx(Xe,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};ht.UserAskQuestion=bs;async function ul(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const ys=["SANDBOX_START"],Qe=new Map,Vl=t=>`${t.virtualMcpId}::${t.branch??""}`,yt=new Set,dl={mark:(t,e)=>yt.add(`${t}::${e}`),clear:(t,e)=>yt.delete(`${t}::${e}`),isStopped:(t,e)=>yt.has(`${t}::${e}`)};function fl(t){const e=Be();return Mt({mutationKey:ys,mutationFn:async n=>{n.branch&&dl.clear(n.virtualMcpId,n.branch);const r=Vl(n),o=Qe.get(r);if(o)return o;const a=(async()=>(await ul(t,"SANDBOX_START",n)).structuredContent)();Qe.set(r,a);try{return await a}finally{Qe.get(r)===a&&Qe.delete(r)}},onSuccess:()=>{Js(e)}})}function eV(t,e){const n=O.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:ys,predicate:a=>{if(!t)return!1;const l=a.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],Lo(r)>0}const ml={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 4.6"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},pl={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function hl(t){return t==="claude-code"?ml:t==="codex"?pl:null}function mn(t,e){return hl(t)?.[e]??null}const xl={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},gl={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function bl(t){return xl[t]}function vl(t){return t===null?"cloud-decopilot":gl[t]}function As(){const t=O.c(2),{pendingAgentOption:e}=pe();let n;return t[0]!==e?(n=vl(e),t[0]=e,t[1]=n):n=t[1],n}function yl(){const t=O.c(2),{setPendingAgentOption:e}=pe();let n;return t[0]!==e?(n=r=>e(bl(r)),t[0]=e,t[1]=n):n=t[1],n}function Al(){return pe().simpleModeTier}function jl(){return pe().setSimpleModeTier}const wl={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function Sl(t,e){return t==="local-claude-code"?mn("claude-code",e)?.label??null:t==="local-codex"?mn("codex",e)?.label??null:wl[e]}const Cl={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},Nl=Vt("").icon;function et(t){const e=O.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=z(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(Un,{icon:Nl,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const kl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(et,{}),isAvailable:t=>t.agentSandbox},_l={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(et,{}),isAvailable:t=>t.userDesktop},Il={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(es,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},El={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(ts,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},tt=[kl,_l,Il,El];function Rl(t,e){return tt.some(n=>n.mode===t&&n.isAvailable(e))}function Tl(t,e){return Rl(t,e)?t:tt.find(n=>n.isAvailable(e))?.mode??t}function js(t){return t==="local-decopilot"?{icon:s.jsx(et,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(es,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(ts,{size:14}),text:"Codex"}:{icon:s.jsx(et,{compact:!0}),text:"Decopilot"}}function Pl(t){const{text:e}=js(t);return{icon:t==="cloud-decopilot"?s.jsx(Hr,{size:14}):s.jsx(Bt,{size:14}),text:e}}function At(t){return t==="cloud-decopilot"?"cloud":"desktop"}const Dl="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Ml="text-success hover:text-success";function Fl(t){const e=O.c(95),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l,onConnectDesktop:c}=t,[u,V]=w.useState(!1);let d;e[0]!==o||e[1]!==n?(d=o?js(n):Pl(n),e[0]=o,e[1]=n,e[2]=d):d=e[2];const{icon:i,text:m}=d;let f;e[3]!==n?(f=At(n),e[3]=n,e[4]=f):f=e[4];const x=`${m} on ${f}`,p=n!=="cloud-decopilot",h=a!=null,g=a?Cl[a]:null;let b,v,y,j,A,C,S,N,D,k,P,T,_;if(e[5]!==r||e[6]!==g||e[7]!==i||e[8]!==p||e[9]!==x||e[10]!==o||e[11]!==n||e[12]!==c||e[13]!==l||e[14]!==u||e[15]!==h||e[16]!==m){let I;e[30]!==r?(I=ae=>ae.group==="cloud"&&ae.isAvailable(r),e[30]=r,e[31]=I):I=e[31];const $=tt.filter(I),B=tt.filter(Ol);let L;e[32]!==l?(L=ae=>{l(ae),V(!1)},e[32]=l,e[33]=L):L=e[33];const q=L;let M;e[34]!==c?(M=()=>{V(!1),c?.()},e[34]=c,e[35]=M):M=e[35];const U=M;v=Ut,j=u,A=o?void 0:V;let Q;e[36]!==g||e[37]!==x||e[38]!==n||e[39]!==h?(Q=h&&g?`This chat is using ${g} on ${At(n)}. Start a new chat to use a different runtime.`:x,e[36]=g,e[37]=x,e[38]=n,e[39]=h,e[40]=Q):Q=e[40];const K=o?"mode-picker-locked":"mode-picker",H=p&&Ml,ne=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let ee;e[41]!==H||e[42]!==ne?(ee=z(Dl,H,"shrink min-w-0",ne),e[41]=H,e[42]=ne,e[43]=ee):ee=e[43];const te=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let J;e[44]!==te?(J=z("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",te),e[44]=te,e[45]=J):J=e[45];let Z;e[46]!==J||e[47]!==m?(Z=s.jsx("span",{className:J,children:m}),e[46]=J,e[47]=m,e[48]=Z):Z=e[48];let W;e[49]!==o?(W=!o&&s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[49]=o,e[50]=W):W=e[50];let X;e[51]!==i||e[52]!==o||e[53]!==Q||e[54]!==K||e[55]!==ee||e[56]!==Z||e[57]!==W?(X=s.jsx(be,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default","aria-label":Q,disabled:o,"data-testid":K,className:ee,children:[i,Z,W]})})})}),e[51]=i,e[52]=o,e[53]=Q,e[54]=K,e[55]=ee,e[56]=Z,e[57]=W,e[58]=X):X=e[58];let re;e[59]!==g||e[60]!==x||e[61]!==n||e[62]!==h?(re=h&&g?`This chat is using ${g} on ${At(n)}. Start a new chat to use a different runtime.`:x,e[59]=g,e[60]=x,e[61]=n,e[62]=h,e[63]=re):re=e[63];let Y;e[64]!==re?(Y=s.jsx(ve,{children:re}),e[64]=re,e[65]=Y):Y=e[65],e[66]!==X||e[67]!==Y?(C=s.jsxs(ye,{children:[X,Y]}),e[66]=X,e[67]=Y,e[68]=C):C=e[68],b=qt,_="start",y="p-1 w-64",S="menu",N="flex flex-col",D=$.length>0&&s.jsx(pn,{title:"Cloud"});let oe;e[69]!==q||e[70]!==n?(oe=ae=>s.jsx(hn,{row:ae,active:n===ae.mode,onSelect:q},ae.mode),e[69]=q,e[70]=n,e[71]=oe):oe=e[71],k=$.map(oe),P=B.length>0&&s.jsx(pn,{title:"Local",variant:"success",icon:s.jsx(Bt,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let ue;e[72]!==r||e[73]!==U||e[74]!==q||e[75]!==n?(ue=ae=>{const de=ae.isAvailable(r);return s.jsx(hn,{row:ae,active:de&&n===ae.mode,onSelect:q,unavailableHint:de?void 0:r.userDesktop?"Not detected on your desktop":"Connect your desktop to enable",onUnavailableClick:U},ae.mode)},e[72]=r,e[73]=U,e[74]=q,e[75]=n,e[76]=ue):ue=e[76],T=B.map(ue),e[5]=r,e[6]=g,e[7]=i,e[8]=p,e[9]=x,e[10]=o,e[11]=n,e[12]=c,e[13]=l,e[14]=u,e[15]=h,e[16]=m,e[17]=b,e[18]=v,e[19]=y,e[20]=j,e[21]=A,e[22]=C,e[23]=S,e[24]=N,e[25]=D,e[26]=k,e[27]=P,e[28]=T,e[29]=_}else b=e[17],v=e[18],y=e[19],j=e[20],A=e[21],C=e[22],S=e[23],N=e[24],D=e[25],k=e[26],P=e[27],T=e[28],_=e[29];let R;e[77]!==S||e[78]!==N||e[79]!==D||e[80]!==k||e[81]!==P||e[82]!==T?(R=s.jsxs("div",{role:S,className:N,children:[D,k,P,T]}),e[77]=S,e[78]=N,e[79]=D,e[80]=k,e[81]=P,e[82]=T,e[83]=R):R=e[83];let F;e[84]!==b||e[85]!==y||e[86]!==R||e[87]!==_?(F=s.jsx(b,{align:_,className:y,children:R}),e[84]=b,e[85]=y,e[86]=R,e[87]=_,e[88]=F):F=e[88];let E;return e[89]!==v||e[90]!==j||e[91]!==A||e[92]!==C||e[93]!==F?(E=s.jsxs(v,{open:j,onOpenChange:A,children:[C,F]}),e[89]=v,e[90]=j,e[91]=A,e[92]=C,e[93]=F,e[94]=E):E=e[94],E}function Ol(t){return t.group==="local"}function pn(t){const e=O.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let u;e[0]!==c?(u=z("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=u):u=e[1];let V;e[2]!==n?(V=s.jsx("span",{children:n}),e[2]=n,e[3]=V):V=e[3];let d;return e[4]!==o||e[5]!==u||e[6]!==V||e[7]!==a?(d=s.jsxs("div",{"data-testid":a,className:u,children:[o,V]}),e[4]=o,e[5]=u,e[6]=V,e[7]=a,e[8]=d):d=e[8],d}function hn(t){const e=O.c(25),{row:n,active:r,onSelect:o,unavailableHint:a,onUnavailableClick:l}=t,c=a!=null,u=c||void 0;let V;e[0]!==o||e[1]!==l||e[2]!==n.mode||e[3]!==c?(V=()=>c?l?.():o(n.mode),e[0]=o,e[1]=l,e[2]=n.mode,e[3]=c,e[4]=V):V=e[4];const d=c&&"opacity-60";let i;e[5]!==d?(i=z("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted",d),e[5]=d,e[6]=i):i=e[6];let m;e[7]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[7]=n.icon,e[8]=m):m=e[8];let f;e[9]!==n.label?(f=s.jsx("div",{className:"text-sm",children:n.label}),e[9]=n.label,e[10]=f):f=e[10];const x=a??n.description;let p;e[11]!==x?(p=s.jsx("div",{className:"text-xs text-muted-foreground",children:x}),e[11]=x,e[12]=p):p=e[12];let h;e[13]!==f||e[14]!==p?(h=s.jsxs("div",{className:"flex-1",children:[f,p]}),e[13]=f,e[14]=p,e[15]=h):h=e[15];let g;e[16]!==r?(g=r&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"}),e[16]=r,e[17]=g):g=e[17];let b;return e[18]!==u||e[19]!==g||e[20]!==V||e[21]!==i||e[22]!==m||e[23]!==h?(b=s.jsxs("button",{type:"button",role:"menuitem","aria-disabled":u,onClick:V,className:i,children:[m,h,g]}),e[18]=u,e[19]=g,e[20]=V,e[21]=i,e[22]=m,e[23]=h,e[24]=b):b=e[24],b}function Ll(t){const e=O.c(23),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=As(),l=yl(),{org:c}=ce();let u;e[0]!==c.id||e[1]!==c.slug?(u={connectionId:Dr,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=u):u=e[2];const V=Ee(u),d=fl(V),m=ot()?.lockedHarness??null,f=hr();let x;e[3]!==f||e[4]!==a?(x=Tl(a,f),e[3]=f,e[4]=a,e[5]=x):x=e[5];const p=x,[h,g]=w.useState(!1);let b;e[6]!==r||e[7]!==l||e[8]!==d||e[9]!==o?(b=S=>{l(S),G("agent_mode_selected",{mode:S}),r&&d.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:S==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[6]=r,e[7]=l,e[8]=d,e[9]=o,e[10]=b):b=e[10];const v=b;let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{G("agent_mode_connect_desktop_opened"),g(!0)},e[11]=y):y=e[11];let j;e[12]!==f||e[13]!==v||e[14]!==n||e[15]!==m||e[16]!==p?(j=s.jsx(Fl,{mode:p,availability:f,locked:n,lockedHarness:m,onSelect:v,onConnectDesktop:y}),e[12]=f,e[13]=v,e[14]=n,e[15]=m,e[16]=p,e[17]=j):j=e[17];let A;e[18]!==h?(A=s.jsx(Xn,{open:h,onOpenChange:g}),e[18]=h,e[19]=A):A=e[19];let C;return e[20]!==j||e[21]!==A?(C=s.jsxs(s.Fragment,{children:[j,A]}),e[20]=j,e[21]=A,e[22]=C):C=e[22],C}const xn=["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega"],gn=["andromedae","antliae","apodis","aquarii","aquilae","arae","arietis","aurigae","bootis","caeli","camelopardalis","cancri","capricorni","carinae","cassiopeiae","centauri","cephei","ceti","chamaeleontis","circini","columbae","corvi","crateris","crucis","cygni","delphini","doradus","draconis","equulei","eridani","fornacis","geminorum","gruis","herculis","horologii","hydrae","hydri","indi","lacertae","leonis","leporis","librae","lupi","lyncis","lyrae","mensae","microscopii","monocerotis","muscae","normae","octantis","ophiuchi","orionis","pavonis","pegasi","persei","phoenicis","pictoris","piscium","puppis","pyxidis","reticuli","sagittae","sagittarii","scorpii","sculptoris","scuti","serpentis","sextantis","tauri","telescopii","trianguli","tucanae","velorum","virginis","volantis","vulpeculae"];function $l(){const t=xn[Math.floor(Math.random()*xn.length)],e=gn[Math.floor(Math.random()*gn.length)];return`${t}-${e}`}const Ge=100;function zl(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function Bl(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function Ul(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function Kl(t){const e=O.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:l,owner:c,repo:u,enabled:V}=t,d=V===void 0?!0:V,i=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==i?(m={connectionId:i,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=i,e[3]=m):m=e[3];const f=Ee(m);let x;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==u?(x=Zs.githubBranches(n,r,a,c,u),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=u,e[9]=x):x=e[9];const p=d&&!!a&&!!c&&!!u;let h;e[10]!==f||e[11]!==c||e[12]!==u?(h=async L=>{const{pageParam:q,signal:M}=L,U=Number(q),Q=await f.callTool({name:"list_branches",arguments:{owner:c,repo:u,page:U,perPage:Ge}},void 0,{signal:M}),K=Ul(Q);return{branches:Array.isArray(K)?K:K.branches??[],default_branch:Array.isArray(K)?null:K.default_branch??null,page:U}},e[10]=f,e[11]=c,e[12]=u,e[13]=h):h=e[13];let g;e[14]!==x||e[15]!==p||e[16]!==h?(g={queryKey:x,enabled:p,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:h,getNextPageParam:Wl},e[14]=x,e[15]=p,e[16]=h,e[17]=g):g=e[17];const{data:b,isLoading:v,isError:y,hasNextPage:j,isFetchingNextPage:A,fetchNextPage:C}=Ao(g);let S,N;e[18]!==l||e[19]!==o?(N=new Set(Object.keys(l?.[o]??{})),S=[...N].sort().map(Gl),e[18]=l,e[19]=o,e[20]=S,e[21]=N):(S=e[20],N=e[21]);const D=S;let k;if(e[22]!==b?.pages){const L=new Map;for(const M of b?.pages??[])for(const U of M.branches)typeof U.name=="string"&&L.set(U.name,U);k=[...L.values()].filter(Hl),e[22]=b?.pages,e[23]=k}else k=e[23];let P;e[24]!==k||e[25]!==N?(P=k.filter(L=>!N.has(L.name)).map(Yl),e[24]=k,e[25]=N,e[26]=P):P=e[26];const T=P;let _;e[27]!==b?.pages?(_=b?.pages.find(Ql)?.default_branch??null,e[27]=b?.pages,e[28]=_):_=e[28];const R=_;let F;e[29]!==b?.pages||e[30]!==C||e[31]!==A||e[32]!==N?(F=async(L,q)=>{const M=q===void 0?ql:q;if(!M()||Bl(N,L)||A)return;let U=b?.pages??[];for(;M()&&!zl(U,L,N)&&(U.at(-1)?.branches.length??Ge)>=Ge;){const Q=await C();if(!M())break;const K=Q.data?.pages??U;if(K.length===U.length)break;U=K}},e[29]=b?.pages,e[30]=C,e[31]=A,e[32]=N,e[33]=F):F=e[33];const E=F,I=j??!1;let $;e[34]!==C||e[35]!==j||e[36]!==A?($=()=>{j&&!A&&C()},e[34]=C,e[35]=j,e[36]=A,e[37]=$):$=e[37];let B;return e[38]!==R||e[39]!==E||e[40]!==y||e[41]!==A||e[42]!==v||e[43]!==T||e[44]!==I||e[45]!==$||e[46]!==D?(B={yours:D,others:T,defaultBase:R,isLoading:v,isError:y,hasMore:I,isFetchingMore:A,fetchMore:$,fetchUntilMatch:E},e[38]=R,e[39]=E,e[40]=y,e[41]=A,e[42]=v,e[43]=T,e[44]=I,e[45]=$,e[46]=D,e[47]=B):B=e[47],B}function ql(){return!0}function Ql(t){return t.default_branch}function Yl(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Hl(t){return typeof t.name=="string"}function Gl(t){return{name:t,source:"yours"}}function Wl(t){if(!(t.branches.length<Ge))return t.page+1}function Jl(t){const e=O.c(84),{orgId:n,orgSlug:r,userId:o,connectionId:a,owner:l,repo:c,sandboxMap:u,value:V,onChange:d,disabled:i,placement:m}=t,f=i===void 0?!1:i,p=(m===void 0?"chat":m)==="header",[h,g]=w.useState(!1),[b,v]=w.useState(""),[y,j]=w.useState(!1),A=w.useRef(0);let C;e[0]!==a||e[1]!==h||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==c||e[6]!==u||e[7]!==o?(C={orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:u,owner:l,repo:c,enabled:h},e[0]=a,e[1]=h,e[2]=n,e[3]=r,e[4]=l,e[5]=c,e[6]=u,e[7]=o,e[8]=C):C=e[8];const{yours:S,others:N,isLoading:D,isError:k,hasMore:P,isFetchingMore:T,fetchMore:_,fetchUntilMatch:R}=Kl(C);let F;e[9]!==d?(F=le=>{d(le),g(!1)},e[9]=d,e[10]=F):F=e[10];const E=F,I=V??"Select branch…";let $;e[11]!==R?($=le=>{v(le),A.current=A.current+1;const Ne=A.current,xt=le.trim();if(!xt){j(!1);return}j(!0),R(xt,()=>Ne===A.current).finally(()=>{Ne===A.current&&j(!1)})},e[11]=R,e[12]=$):$=e[12];const B=$;let L;e[13]!==_?(L=le=>{const Ne=le.currentTarget;Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight<48&&_()},e[13]=_,e[14]=L):L=e[14];const q=L,M=f?void 0:g,U=p?"outline":"ghost",Q=p?"sm":"default";let K;e[15]!==f||e[16]!==p?(K=z("font-mono shrink min-w-0 max-w-[200px]",p?"gap-1.5 text-xs":z("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",f?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=f,e[16]=p,e[17]=K):K=e[17];let H;e[18]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=H):H=e[18];const ne=p?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let ee;e[19]!==ne?(ee=z("min-w-0 truncate",ne),e[19]=ne,e[20]=ee):ee=e[20];let te;e[21]!==I||e[22]!==ee?(te=s.jsx("span",{className:ee,children:I}),e[21]=I,e[22]=ee,e[23]=te):te=e[23];let J;e[24]!==f||e[25]!==p?(J=!f&&s.jsx(ft,{size:12,className:z("opacity-60 shrink-0",p?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=f,e[25]=p,e[26]=J):J=e[26];let Z;e[27]!==f||e[28]!==I||e[29]!==K||e[30]!==te||e[31]!==J||e[32]!==U||e[33]!==Q?(Z=s.jsx(be,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(se,{variant:U,size:Q,"aria-label":I,disabled:f,className:K,children:[H,te,J]})})})}),e[27]=f,e[28]=I,e[29]=K,e[30]=te,e[31]=J,e[32]=U,e[33]=Q,e[34]=Z):Z=e[34];let W;e[35]!==I?(W=s.jsx(ve,{children:I}),e[35]=I,e[36]=W):W=e[36];let X;e[37]!==Z||e[38]!==W?(X=s.jsxs(ye,{children:[Z,W]}),e[37]=Z,e[38]=W,e[39]=X):X=e[39];let re;e[40]!==B||e[41]!==b?(re=s.jsx(go,{placeholder:"Search loaded branches…",value:b,onValueChange:B}),e[40]=B,e[41]=b,e[42]=re):re=e[42];let Y;e[43]!==E?(Y=s.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>E($l()),children:"New"}),e[43]=E,e[44]=Y):Y=e[44];let oe;e[45]!==re||e[46]!==Y?(oe=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[re,Y]}),e[45]=re,e[46]=Y,e[47]=oe):oe=e[47];let ue;e[48]!==k?(ue=k&&s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[48]=k,e[49]=ue):ue=e[49];let ae;e[50]!==P||e[51]!==k||e[52]!==D?(ae=!k&&!D&&s.jsx(bo,{children:P?"Looking through more branches...":"No branches found."}),e[50]=P,e[51]=k,e[52]=D,e[53]=ae):ae=e[53];let de;e[54]!==E||e[55]!==S?(de=S.length>0&&s.jsx(en,{heading:"Your branches",children:S.map(le=>s.jsxs(tn,{value:le.name,onSelect:()=>E(le.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:le.name})]},le.name))}),e[54]=E,e[55]=S,e[56]=de):de=e[56];let Ae;e[57]!==N||e[58]!==E?(Ae=N.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(xo,{}),s.jsx(en,{heading:"Other branches in repo",children:N.map(le=>s.jsxs(tn,{value:le.name,onSelect:()=>E(le.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:le.name}),le.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",le.author]})]},le.name))})]}),e[57]=N,e[58]=E,e[59]=Ae):Ae=e[59];let je;e[60]!==_||e[61]!==P||e[62]!==T||e[63]!==y?(je=P&&s.jsx("div",{className:"border-t p-2",children:s.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:T,onClick:_,children:T||y?"Loading more…":"Load more branches"})}),e[60]=_,e[61]=P,e[62]=T,e[63]=y,e[64]=je):je=e[64];let we;e[65]!==P||e[66]!==N.length?(we=!P&&N.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[65]=P,e[66]=N.length,e[67]=we):we=e[67];let Se;e[68]!==q||e[69]!==ue||e[70]!==ae||e[71]!==de||e[72]!==Ae||e[73]!==je||e[74]!==we?(Se=s.jsxs(vo,{onScroll:q,children:[ue,ae,de,Ae,je,we]}),e[68]=q,e[69]=ue,e[70]=ae,e[71]=de,e[72]=Ae,e[73]=je,e[74]=we,e[75]=Se):Se=e[75];let Ce;e[76]!==oe||e[77]!==Se?(Ce=s.jsx(qt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(yo,{children:[oe,Se]})}),e[76]=oe,e[77]=Se,e[78]=Ce):Ce=e[78];let qe;return e[79]!==h||e[80]!==X||e[81]!==Ce||e[82]!==M?(qe=s.jsxs(Ut,{open:h,onOpenChange:M,children:[X,Ce]}),e[79]=h,e[80]=X,e[81]=Ce,e[82]=M,e[83]=qe):qe=e[83],qe}function Zl(t){const e=O.c(25);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const l=r==="header";if(n){const u=a??"(no branch)",V=l?"h-8 gap-1.5 border border-input bg-background px-2.5":"h-9 gap-0 px-2";let d;e[5]!==V?(d=z("inline-flex items-center rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",V),e[5]=V,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=i):i=e[7];const m=l?"":"max-w-0 opacity-0";let f;e[8]!==m?(f=z("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let x;e[10]!==u||e[11]!==f?(x=s.jsx("span",{className:f,children:u}),e[10]=u,e[11]=f,e[12]=x):x=e[12];let p;e[13]!==d||e[14]!==x?(p=s.jsx(be,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:d,children:[i,x]})}),e[13]=d,e[14]=x,e[15]=p):p=e[15];let h;e[16]!==u?(h=s.jsxs(ve,{children:["This chat is using branch ",u,". Start a new chat to use a different branch."]}),e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==p||e[19]!==h?(g=s.jsxs(ye,{children:[p,h]}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}let c;return e[21]!==r||e[22]!==o||e[23]!==a?(c=s.jsx(Jl,{...o,value:a,placement:r}),e[21]=r,e[22]=o,e[23]=a,e[24]=c):c=e[24],c}function Xl(t){const e=O.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function ei(t){const e=O.c(22),{virtualMcp:n,currentBranch:r}=t,o=Fn(),a=ot();let l;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(l=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=l):l=e[2];const c=l,u=a?.setCurrentTaskBranch;let V;e[3]!==n?(V=Jn(n),e[3]=n,e[4]=V):V=e[4];const d=V,i=d?.connectionId,{data:m}=Tn.useSession(),f=m?.user?.id??"",{org:x}=ce();let p;e[5]!==i||e[6]!==r||e[7]!==d||e[8]!==c||e[9]!==x||e[10]!==u||e[11]!==f||e[12]!==n?.id||e[13]!==n?.metadata?.sandboxMap?(p=d&&i?s.jsx(Zl,{orgId:x.id,orgSlug:x.slug,userId:f,virtualMcpId:n?.id??"",connectionId:i,owner:d.owner,repo:d.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:j=>{u&&u(j)},locked:c,placement:"chat"}):null,e[5]=i,e[6]=r,e[7]=d,e[8]=c,e[9]=x,e[10]=u,e[11]=f,e[12]=n?.id,e[13]=n?.metadata?.sandboxMap,e[14]=p):p=e[14];const h=p,g=n?.id??"";let b;e[15]!==r||e[16]!==c||e[17]!==g?(b=s.jsx(Ll,{locked:c,currentBranch:r,virtualMcpId:g}),e[15]=r,e[16]=c,e[17]=g,e[18]=b):b=e[18];const v=b;let y;return e[19]!==h||e[20]!==v?(y=s.jsx(Xl,{branchPill:h,modePicker:v}),e[19]=h,e[20]=v,e[21]=y):y=e[21],y}const ti=["fast","smart","thinking"],Re={fast:"Fast",smart:"Smart",thinking:"Thinking"};function ni(t){const e=O.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[l,c]=w.useState(!1);let u;e[0]!==a?(u=S=>{a(S),c(!1)},e[0]=a,e[1]=u):u=e[1];const V=u,d=Re[n];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=z("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=i):i=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=z("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const x=Re[n];let p;e[7]!==x?(p=s.jsx("span",{className:f,children:x}),e[7]=x,e[8]=p):p=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ft,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=h):h=e[9];let g;e[10]!==d||e[11]!==m||e[12]!==p?(g=s.jsx(be,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Kt,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default","aria-label":d,className:i,children:[m,p,h]})})})}),e[10]=d,e[11]=m,e[12]=p,e[13]=g):g=e[13];const b=Re[n];let v;e[14]!==b?(v=s.jsx(ve,{children:b}),e[14]=b,e[15]=v):v=e[15];let y;e[16]!==v||e[17]!==g?(y=s.jsxs(ye,{children:[g,v]}),e[16]=v,e[17]=g,e[18]=y):y=e[18];let j;e[19]!==V||e[20]!==o||e[21]!==r||e[22]!==n?(j=ti.map(S=>{const N=r(S),D=o?.(S),k=S===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Re[S],onClick:()=>V(S),className:z("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[D&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:D}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:Re[S]}),N&&s.jsx("div",{className:"text-xs text-muted-foreground",children:N})]}),k&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"})]},S)}),e[19]=V,e[20]=o,e[21]=r,e[22]=n,e[23]=j):j=e[23];let A;e[24]!==j?(A=s.jsx(qt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:j})}),e[24]=j,e[25]=A):A=e[25];let C;return e[26]!==l||e[27]!==y||e[28]!==A?(C=s.jsxs(Ut,{open:l,onOpenChange:c,children:[y,A]}),e[26]=l,e[27]=y,e[28]=A,e[29]=C):C=e[29],C}function si(t){return t==="fast"?s.jsx(Gr,{size:16}):t==="thinking"?s.jsx(Wr,{size:16}):s.jsx(jo,{size:16})}function ri(){const t=O.c(6),e=Al(),n=jl(),r=As();let o;t[0]!==r?(o=c=>Sl(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let l;return t[2]!==n||t[3]!==a||t[4]!==e?(l=s.jsx(ni,{tier:e,subtitleFor:a,iconFor:si,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Ht(t,e,n,r,o){if(!pt(e)){ie.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!mo(a,e)){const c=ns(e),u=e?.title??"This model";o?o({fileName:n.name,modelName:u,accepted:c}):ie.error(`"${n.name}" can't be attached`,{description:`${u} accepts ${c}.`});return}const l=10*1024*1024;if(n.size>l){ie.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,u=new Promise((i,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const x=f.includes(",")?f.split(",")[1]??f:f;i(x)},c.onerror=m});c.readAsDataURL(n);const V=await u,d={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:V};Ar(t,{from:r,to:r},d)}catch(c){console.error("Failed to process file:",c),ie.error(`Failed to load file "${n.name}"`)}}function oi(t){const e=O.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=w.useRef(li);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(d,i)=>{await Ht(n,r,d,i,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=l,e[4]=c):(l=e[3],c=e[4]),w.useEffect(l,c);let u,V;return e[5]!==n?(u=()=>{if(n?.isDestroyed)return;const d=new Et("fileDropHandler");n.state.plugins.find(f=>f.spec.key===d)&&n.unregisterPlugin(d);const m=new wo({key:d,props:{handleDrop:(f,x,p,h)=>{if(h)return!1;const g=x.dataTransfer?.files;if(!g||g.length===0)return!1;x.preventDefault();const b=f.posAtCoords({left:x.clientX,top:x.clientY});if(!b)return!1;const v=Array.from(g),y=b.pos;for(const j of v)a.current?.(j,y);return!0},handlePaste:(f,x)=>{const p=x.clipboardData?.items;if(!p)return!1;const h=Array.from(p).filter(ai);if(h.length===0)return!1;x.preventDefault();const{from:g}=f.state.selection;for(const b of h){const v=b.getAsFile();v&&a.current?.(v,g)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(d)}},V=[n],e[5]=n,e[6]=u,e[7]=V):(u=e[6],V=e[7]),w.useEffect(u,V),null}function ai(t){return t.kind==="file"}function li(){return Promise.resolve()}function ii(t){const e=O.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=j=>!j&&r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let u,V;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(Rn,{size:18})}),V=s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=u,e[5]=V):(u=e[4],V=e[5]);const d=n?.fileName;let i;e[6]!==d?(i=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(lt,{className:"relative gap-4",children:[u,s.jsxs("div",{children:[V,s.jsxs(Ot,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",d,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=d,e[7]=i):i=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Jr,{size:14,className:"text-muted-foreground"}),e[10]=x):x=e[10];const p=n?.accepted;let h;e[11]!==p?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[x,s.jsx("span",{className:"capitalize",children:p})]}),e[11]=p,e[12]=h):h=e[12];let g;e[13]!==f||e[14]!==h?(g=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,h]})}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let b;e[16]!==r?(b=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(se,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=b):b=e[17];let v;e[18]!==g||e[19]!==b||e[20]!==i?(v=s.jsxs(ct,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ci,children:[i,g,b]}),e[18]=g,e[19]=b,e[20]=i,e[21]=v):v=e[21];let y;return e[22]!==o||e[23]!==v||e[24]!==a?(y=s.jsx(ut,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=y):y=e[25],y}function ci(t){return t.preventDefault()}function ui(){const t=O.c(3),[e,n]=w.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var Vi=So;var di=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Rt=di.join(","),ws=typeof Element>"u",$e=ws?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nt=!ws&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},st=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",l=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):st(e.parentNode));return l},fi=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},mi=function(e,n,r){if(st(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Rt));return n&&$e.call(e,Rt)&&o.unshift(e),o=o.filter(r),o},Tt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!st(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),u=c.length?c:l.children,V=Tt(u,!0,r);r.flatten?o.push.apply(o,V):o.push({scopeParent:l,candidates:V})}else{var d=$e.call(l,Rt);d&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var i=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!st(i,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(i&&m){var f=Tt(i===!0?l.children:i.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else a.unshift.apply(a,l.children)}}return o},Ss=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Cs=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||fi(e))&&!Ss(e)?0:e.tabIndex},pi=function(e,n){var r=Cs(e);return r<0&&n&&!Ss(e)?0:r},hi=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Ns=function(e){return e.tagName==="INPUT"},xi=function(e){return Ns(e)&&e.type==="hidden"},gi=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},bi=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},vi=function(e){if(!e.name)return!0;var n=e.form||nt(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var a=bi(o,e.form);return!a||a===e},yi=function(e){return Ns(e)&&e.type==="radio"},Ai=function(e){return yi(e)&&!vi(e)},ji=function(e){var n,r=e&&nt(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var l,c,u;for(a=!!((l=o)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(u=e.ownerDocument)!==null&&u!==void 0&&u.contains(e));!a&&o;){var V,d,i;r=nt(o),o=(V=r)===null||V===void 0?void 0:V.host,a=!!((d=o)!==null&&d!==void 0&&(i=d.ownerDocument)!==null&&i!==void 0&&i.contains(o))}}return a},bn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},wi=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var l=$e.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if($e.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var u=e;e;){var V=e.parentElement,d=nt(e);if(V&&!V.shadowRoot&&o(V)===!0)return bn(e);e.assignedSlot?e=e.assignedSlot:!V&&d!==e.ownerDocument?e=d.host:e=V}e=u}if(ji(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bn(e);return!1},Si=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return $e.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Ci=function(e,n){return!(n.disabled||xi(n)||wi(n,e)||gi(n)||Si(n))},vn=function(e,n){return!(Ai(n)||Cs(n)<0||!Ci(e,n))},Ni=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ks=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,u=pi(c,l),V=l?ks(o.candidates):c;u===0?l?n.push.apply(n,V):n.push(c):r.push({documentOrder:a,tabIndex:u,item:o,isScope:l,content:V})}),r.sort(hi).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},_s=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Tt([e],n.includeContainer,{filter:vn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ni}):r=mi(e,n.includeContainer,vn.bind(null,n)),ks(r)};function ki(){return/apple/i.test(navigator.vendor)}const yn="data-floating-ui-focusable";function _i(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Pt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Xs(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function jt(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Ii(t){return t.matches("html,body")}function ze(t){return t?.ownerDocument||document}function Ei(t){return t?t.hasAttribute(yn)?t:t.querySelector("["+yn+"]")||t:null}function We(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...We(t,o.id,n)])}function Ri(t){return"nativeEvent"in t}var Ti=typeof document<"u",Pi=function(){},xe=Ti?w.useLayoutEffect:Pi;const Di={...Pn},Mi=Di.useInsertionEffect,Fi=Mi||(t=>t());function ke(t){const e=w.useRef(()=>{});return Fi(()=>{e.current=t}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Is=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Es(t,e){const n=_s(t,Is()),r=n.length;if(r===0)return;const o=_i(ze(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function Oi(t){return Es(ze(t).body,1)||t}function Li(t){return Es(ze(t).body,-1)||t}function wt(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Pt(n,r)}function $i(t){_s(t,Is()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function An(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const zi="data-floating-ui-focusable",jn="active",wn="selected",Bi={...Pn};let Sn=!1,Ui=0;const Cn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ui++;function Ki(){const[t,e]=w.useState(()=>Sn?Cn():void 0);return xe(()=>{t==null&&e(Cn())},[]),w.useEffect(()=>{Sn=!0},[]),t}const qi=Bi.useId,Gt=qi||Ki;function Qi(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const Yi=w.createContext(null),Hi=w.createContext(null),Rs=()=>{var t;return((t=w.useContext(Yi))==null?void 0:t.id)||null},Ts=()=>w.useContext(Hi);function Wt(t){return"data-floating-ui-"+t}const Gi={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Nn=w.forwardRef(function(e,n){const[r,o]=w.useState();xe(()=>{ki()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Wt("focus-guard")]:"",style:Gi};return s.jsx("span",{...e,...a})}),Wi={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ps=w.createContext(null),kn=Wt("portal");function Ji(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Gt(),o=Xi(),[a,l]=w.useState(null),c=w.useRef(null);return xe(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),xe(()=>{if(!r||c.current)return;const u=e?document.getElementById(e):null;if(!u)return;const V=document.createElement("div");V.id=r,V.setAttribute(kn,""),u.appendChild(V),c.current=V,l(V)},[e,r]),xe(()=>{if(n===null||!r||c.current)return;let u=n||o?.portalNode;u&&!ar(u)&&(u=u.current),u=u||document.body;let V=null;e&&(V=document.createElement("div"),V.id=e,u.appendChild(V));const d=document.createElement("div");d.id=r,d.setAttribute(kn,""),u=V||u,u.appendChild(d),c.current=d,l(d)},[e,n,r,o]),a}function Zi(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=Ji({id:n,root:r}),[l,c]=w.useState(null),u=w.useRef(null),V=w.useRef(null),d=w.useRef(null),i=w.useRef(null),m=l?.modal,f=l?.open,x=!!l&&!l.modal&&l.open&&o&&!!(r||a);return w.useEffect(()=>{if(!a||!o||m)return;function p(h){a&&wt(h)&&(h.type==="focusin"?An:$i)(a)}return a.addEventListener("focusin",p,!0),a.addEventListener("focusout",p,!0),()=>{a.removeEventListener("focusin",p,!0),a.removeEventListener("focusout",p,!0)}},[a,o,m]),w.useEffect(()=>{a&&(f||An(a))},[f,a]),s.jsxs(Ps.Provider,{value:w.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:u,afterOutsideRef:V,beforeInsideRef:d,afterInsideRef:i,portalNode:a,setFocusManagerState:c}),[o,a]),children:[x&&a&&s.jsx(Nn,{"data-type":"outside",ref:u,onFocus:p=>{if(wt(p,a)){var h;(h=d.current)==null||h.focus()}else{const g=l?l.domReference:null,b=Li(g);b?.focus()}}}),x&&a&&s.jsx("span",{"aria-owns":a.id,style:Wi}),a&&tr.createPortal(e,a),x&&a&&s.jsx(Nn,{"data-type":"outside",ref:V,onFocus:p=>{if(wt(p,a)){var h;(h=i.current)==null||h.focus()}else{const g=l?l.domReference:null,b=Oi(g);b?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,p.nativeEvent,"focus-out")}}})]})}const Xi=()=>w.useContext(Ps),ec={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},tc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},_n=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function nc(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:l=!0,escapeKey:c=!0,outsidePress:u=!0,outsidePressEvent:V="pointerdown",referencePress:d=!1,referencePressEvent:i="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:x}=e,p=Ts(),h=ke(typeof u=="function"?u:()=>!1),g=typeof u=="function"?h:u,b=w.useRef(!1),{escapeKey:v,outsidePress:y}=_n(f),{escapeKey:j,outsidePress:A}=_n(x),C=w.useRef(!1),S=ke(_=>{var R;if(!n||!l||!c||_.key!=="Escape"||C.current)return;const F=(R=a.current.floatingContext)==null?void 0:R.nodeId,E=p?We(p.nodesRef.current,F):[];if(!v&&(_.stopPropagation(),E.length>0)){let I=!0;if(E.forEach($=>{var B;if((B=$.context)!=null&&B.open&&!$.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}r(!1,Ri(_)?_.nativeEvent:_,"escape-key")}),N=ke(_=>{var R;const F=()=>{var E;S(_),(E=Te(_))==null||E.removeEventListener("keydown",F)};(R=Te(_))==null||R.addEventListener("keydown",F)}),D=ke(_=>{var R;const F=a.current.insideReactTree;a.current.insideReactTree=!1;const E=b.current;if(b.current=!1,V==="click"&&E||F||typeof g=="function"&&!g(_))return;const I=Te(_),$="["+Wt("inert")+"]",B=ze(o.floating).querySelectorAll($);let L=Ve(I)?I:null;for(;L&&!bt(L);){const Q=sr(L);if(bt(Q)||!Ve(Q))break;L=Q}if(B.length&&Ve(I)&&!Ii(I)&&!Pt(I,o.floating)&&Array.from(B).every(Q=>!Pt(L,Q)))return;if(rr(I)&&T){const Q=bt(I),K=or(I),H=/auto|scroll/,ne=Q||H.test(K.overflowX),ee=Q||H.test(K.overflowY),te=ne&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,J=ee&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,Z=K.direction==="rtl",W=J&&(Z?_.offsetX<=I.offsetWidth-I.clientWidth:_.offsetX>I.clientWidth),X=te&&_.offsetY>I.clientHeight;if(W||X)return}const q=(R=a.current.floatingContext)==null?void 0:R.nodeId,M=p&&We(p.nodesRef.current,q).some(Q=>{var K;return jt(_,(K=Q.context)==null?void 0:K.elements.floating)});if(jt(_,o.floating)||jt(_,o.domReference)||M)return;const U=p?We(p.nodesRef.current,q):[];if(U.length>0){let Q=!0;if(U.forEach(K=>{var H;if((H=K.context)!=null&&H.open&&!K.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}r(!1,_,"outside-press")}),k=ke(_=>{var R;const F=()=>{var E;D(_),(E=Te(_))==null||E.removeEventListener(V,F)};(R=Te(_))==null||R.addEventListener(V,F)});w.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=y;let _=-1;function R(B){r(!1,B,"ancestor-scroll")}function F(){window.clearTimeout(_),C.current=!0}function E(){_=window.setTimeout(()=>{C.current=!1},nr()?5:0)}const I=ze(o.floating);c&&(I.addEventListener("keydown",j?N:S,j),I.addEventListener("compositionstart",F),I.addEventListener("compositionend",E)),g&&I.addEventListener(V,A?k:D,A);let $=[];return m&&(Ve(o.domReference)&&($=gt(o.domReference)),Ve(o.floating)&&($=$.concat(gt(o.floating))),!Ve(o.reference)&&o.reference&&o.reference.contextElement&&($=$.concat(gt(o.reference.contextElement)))),$=$.filter(B=>{var L;return B!==((L=I.defaultView)==null?void 0:L.visualViewport)}),$.forEach(B=>{B.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(I.removeEventListener("keydown",j?N:S,j),I.removeEventListener("compositionstart",F),I.removeEventListener("compositionend",E)),g&&I.removeEventListener(V,A?k:D,A),$.forEach(B=>{B.removeEventListener("scroll",R)}),window.clearTimeout(_)}},[a,o,c,g,V,n,r,m,l,v,y,S,j,N,D,A,k]),w.useEffect(()=>{a.current.insideReactTree=!1},[a,g,V]);const P=w.useMemo(()=>({onKeyDown:S,...d&&{[ec[i]]:_=>{r(!1,_.nativeEvent,"reference-press")},...i!=="click"&&{onClick(_){r(!1,_.nativeEvent,"reference-press")}}}}),[S,r,d,i]),T=w.useMemo(()=>{function _(R){R.button===0&&(b.current=!0)}return{onKeyDown:S,onMouseDown:_,onMouseUp:_,[tc[V]]:()=>{a.current.insideReactTree=!0}}},[S,V,a]);return w.useMemo(()=>l?{reference:P,floating:T}:{},[l,P,T])}function sc(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Gt(),a=w.useRef({}),[l]=w.useState(()=>Qi()),c=Rs()!=null,[u,V]=w.useState(r.reference),d=ke((f,x,p)=>{a.current.openEvent=f?x:void 0,l.emit("openchange",{open:f,event:x,reason:p,nested:c}),n?.(f,x,p)}),i=w.useMemo(()=>({setPositionReference:V}),[]),m=w.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return w.useMemo(()=>({dataRef:a,open:e,onOpenChange:d,elements:m,events:l,floatingId:o,refs:i}),[e,d,m,l,o,i])}function rc(t){t===void 0&&(t={});const{nodeId:e}=t,n=sc({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,l]=w.useState(null),[c,u]=w.useState(null),d=o?.domReference||a,i=w.useRef(null),m=Ts();xe(()=>{d&&(i.current=d)},[d]);const f=er({...t,elements:{...o,...c&&{reference:c}}}),x=w.useCallback(v=>{const y=Ve(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;u(y),f.refs.setReference(y)},[f.refs]),p=w.useCallback(v=>{(Ve(v)||v===null)&&(i.current=v,l(v)),(Ve(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!Ve(v))&&f.refs.setReference(v)},[f.refs]),h=w.useMemo(()=>({...f.refs,setReference:p,setPositionReference:x,domReference:i}),[f.refs,p,x]),g=w.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),b=w.useMemo(()=>({...f,...r,refs:h,elements:g,nodeId:e}),[f,h,g,e,r]);return xe(()=>{r.dataRef.current.floatingContext=b;const v=m?.nodesRef.current.find(y=>y.id===e);v&&(v.context=b)}),w.useMemo(()=>({...f,context:b,refs:h,elements:g}),[f,h,g,b])}function St(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[jn]:l,[wn]:c,...u}=t;a=u}return{...n==="floating"&&{tabIndex:-1,[zi]:""},...a,...e.map(l=>{const c=l?l[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((l,c)=>(c&&Object.entries(c).forEach(u=>{let[V,d]=u;if(!(o&&[jn,wn].includes(V)))if(V.indexOf("on")===0){if(r.has(V)||r.set(V,[]),typeof d=="function"){var i;(i=r.get(V))==null||i.push(d),l[V]=function(){for(var m,f=arguments.length,x=new Array(f),p=0;p<f;p++)x[p]=arguments[p];return(m=r.get(V))==null?void 0:m.map(h=>h(...x)).find(h=>h!==void 0)}}}else l[V]=d}),l),{})}}function oc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=w.useCallback(c=>St(c,t,"reference"),e),a=w.useCallback(c=>St(c,t,"floating"),n),l=w.useCallback(c=>St(c,t,"item"),r);return w.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const ac=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function lc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:l}=t,{enabled:c=!0,role:u="dialog"}=e,V=Gt(),d=((n=a.domReference)==null?void 0:n.id)||V,i=w.useMemo(()=>{var b;return((b=Ei(a.floating))==null?void 0:b.id)||l},[a.floating,l]),m=(r=ac.get(u))!=null?r:u,x=Rs()!=null,p=w.useMemo(()=>m==="tooltip"||u==="label"?{["aria-"+(u==="label"?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?i:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:d},...m==="menu"&&x&&{role:"menuitem"},...u==="select"&&{"aria-autocomplete":"none"},...u==="combobox"&&{"aria-autocomplete":"list"}},[m,i,x,o,d,u]),h=w.useMemo(()=>{const b={id:i,...m&&{role:m}};return m==="tooltip"||u==="label"?b:{...b,...m==="menu"&&{"aria-labelledby":d}}},[m,i,d,u]),g=w.useCallback(b=>{let{active:v,selected:y}=b;const j={role:"option",...v&&{id:i+"-fui-option"}};switch(u){case"select":case"combobox":return{...j,"aria-selected":y}}return{}},[i,u]);return w.useMemo(()=>c?{reference:p,floating:h,item:g}:{},[c,p,h,g])}function ic(t){const e=O.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:l}=t,[c,u]=w.useState(0),V=w.useRef(o),d=w.useRef(c),i=w.useRef(a),m=w.useRef(l),f=w.useDeferredValue(r);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{u(0)},e[0]=x):x=e[0];let p;e[1]!==f?(p=[f],e[1]=f,e[2]=p):p=e[2],w.useEffect(x,p);let h,g;e[3]!==o.length||e[4]!==c?(h=()=>{c>=o.length&&o.length>0&&u(0)},g=[o.length,c],e[3]=o.length,e[4]=c,e[5]=h,e[6]=g):(h=e[5],g=e[6]),w.useEffect(h,g);let b,v;e[7]!==o?(b=()=>{V.current=o},v=[o],e[7]=o,e[8]=b,e[9]=v):(b=e[8],v=e[9]),w.useEffect(b,v);let y,j;e[10]!==c?(y=()=>{d.current=c},j=[c],e[10]=c,e[11]=y,e[12]=j):(y=e[11],j=e[12]),w.useEffect(y,j);let A,C;e[13]!==a?(C=()=>{i.current=a},A=[a],e[13]=a,e[14]=A,e[15]=C):(A=e[14],C=e[15]),w.useEffect(C,A);let S,N;e[16]!==l?(S=()=>{m.current=l},N=[l],e[16]=l,e[17]=S,e[18]=N):(S=e[17],N=e[18]),w.useEffect(S,N);let D,k;e[19]!==n?(D=()=>{if(n?.isDestroyed)return;let _;try{_=n.view.dom}catch{return}if(!_)return;const R=E=>{const I=V.current;if(!I.length)return!1;const $=()=>u(L=>(L+1)%I.length),B=()=>u(L=>(L-1+I.length)%I.length);switch(E.key){case"ArrowUp":return E.preventDefault(),B(),!0;case"ArrowDown":return E.preventDefault(),$(),!0;case"Tab":return E.preventDefault(),E.shiftKey?B():$(),!0;case"Home":return E.preventDefault(),u(0),!0;case"End":return E.preventDefault(),u(I.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const L=d.current;return L!==-1&&I[L]&&i.current?.(I[L],L),!0}case"Escape":return E.preventDefault(),m.current?.(),!0;default:return!1}},F=E=>{R(E)};return _.addEventListener("keydown",F,!0),()=>{_?.removeEventListener("keydown",F,!0)}},k=[n],e[19]=n,e[20]=D,e[21]=k):(D=e[20],k=e[21]),w.useEffect(D,k);const P=o.length?c:void 0;let T;return e[22]!==P?(T={selectedIndex:P,setSelectedIndex:u},e[22]=P,e[23]=T):T=e[23],T}function cc(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const Ds=w.createContext(void 0);function Ms(){const t=w.useContext(Ds);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function uc({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=w.useReducer(cc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=w.useRef(o);return c.current=o,w.useEffect(()=>{if(t?.isDestroyed)return;const u=n instanceof Et?n:new Et(n);t.state.plugins.find(i=>i.spec.key===u)&&t.unregisterPlugin(u);const d=Io({pluginKey:u,editor:t,char:e,allow(i){const m=t.state.doc.resolve(i.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(i))},command(){},render:()=>({onStart:i=>{l({type:"ON_START",payload:{element:i.decorationNode??null,query:i.query,range:i.range}}),c.current?.(!0)},onUpdate:i=>{l({type:"ON_UPDATE",payload:{element:i.decorationNode??null,query:i.query,range:i.range}})},onKeyDown:i=>i.event.key==="Escape"?(l({type:"ON_EXIT"}),!0):!1,onExit:()=>{l({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(d),()=>{t?.isDestroyed||t.unregisterPlugin(u)}},[t,n,e,l,r]),{state:a,dispatch:l}}function Vc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=Ms(),l=w.useDeferredValue(o.query),{data:c}=lr({queryKey:Oe.suggestionItems(e,o.open,l),queryFn:()=>o.open?n({query:l}):[]}),u=()=>{a({type:"ON_EXIT"})},V=async(i,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:i});try{const{view:f}=t,p=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),h=o.range?{...o.range}:{from:0,to:0};p&&o.range&&(h.to+=1),await r({range:h,item:i})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):u()}catch{u()}}},{selectedIndex:d}=ic({editor:t,query:l,items:c,onSelect:V,onClose:u});return{selectedItem:o.selectedItem,items:c,selectedIndex:d,close:u,onSelect:V}}function dc({children:t}){const{state:e,dispatch:n}=Ms(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:u}=rc({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[ir(10),cr(),ur()],whileElementsMounted:Vr}),V=nc(u,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),d=lc(u,{role:"listbox"}),{getFloatingProps:i}=oc([V,d]);return r?s.jsx(Zi,{children:s.jsx("div",{ref:l.setFloating,style:c,...i(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const fc=t=>{const e=O.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:l}=t;let c;if(e[0]!==n){const A=fe(n._meta);c=n.title||Ft(n.name,A),e[0]=n,e[1]=c}else c=e[1];const u=c,V=n.description||null,d=n.icon,i=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==i||e[3]!==m?(f=z("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",i,m),e[2]=i,e[3]=m,e[4]=f):f=e[4];let x;e[5]!==d||e[6]!==u?(x=d!==void 0&&s.jsx(Un,{icon:d,name:u,size:"xs",className:"mr-2"}),e[5]=d,e[6]=u,e[7]=x):x=e[7];let p;e[8]!==u?(p=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:u}),e[8]=u,e[9]=p):p=e[9];let h;e[10]!==a?(h=a&&s.jsx(Ct,{size:"xs"}),e[10]=a,e[11]=h):h=e[11];let g;e[12]!==p||e[13]!==h?(g=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,h]}),e[12]=p,e[13]=h,e[14]=g):g=e[14];let b;e[15]!==V?(b=V&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:V}),e[15]=V,e[16]=b):b=e[16];let v;e[17]!==g||e[18]!==b?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[g,b]}),e[17]=g,e[18]=b,e[19]=v):v=e[19];let y;e[20]!==n.drillable?(y=n.drillable&&s.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=n.drillable,e[21]=y):y=e[21];let j;return e[22]!==o||e[23]!==l||e[24]!==v||e[25]!==y||e[26]!==f||e[27]!==x?(j=s.jsxs("div",{ref:l,onClick:o,className:f,children:[x,v,y]}),e[22]=o,e[23]=l,e[24]=v,e[25]=y,e[26]=f,e[27]=x,e[28]=j):j=e[28],j},mc=t=>{const e=O.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let l;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(l={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const{items:c,selectedIndex:u,onSelect:V,selectedItem:d}=Vc(l);if(!c.length){let x;return e[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=x):x=e[5],x}let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=i):i=e[6];let m;if(e[7]!==V||e[8]!==c||e[9]!==u||e[10]!==d?.name){let x;e[12]!==V||e[13]!==u||e[14]!==d?.name?(x=(p,h)=>s.jsx(fc,{item:p,isSelected:h===u,ref:h===u?xc:void 0,onSelect:()=>V(p,h),isLoading:d?.name===p.name},p.name),e[12]=V,e[13]=u,e[14]=d?.name,e[15]=x):x=e[15],m=c.map(x),e[7]=V,e[8]=c,e[9]=u,e[10]=d?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:i,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function pc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(hc)}),t[0]=e):e=t[0],e}function hc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Fs(t){const e=O.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:l,onSelect:c,allow:u,onOpenChange:V}=t;let d;e[0]!==u||e[1]!==r||e[2]!==n||e[3]!==V||e[4]!==o?(d={editor:n,char:r,pluginKey:o,allow:u,onOpenChange:V},e[0]=u,e[1]=r,e[2]=n,e[3]=V,e[4]=o,e[5]=d):d=e[5];const{state:i,dispatch:m}=uc(d);let f;e[6]!==m||e[7]!==i?(f={state:i,dispatch:m},e[6]=m,e[7]=i,e[8]=f):f=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(pc,{}),e[9]=x):x=e[9];let p;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(p=s.jsx(dc,{children:s.jsx(w.Suspense,{fallback:x,children:s.jsx(mc,{editor:n,queryKey:a,queryFn:l,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=l,e[13]=a,e[14]=p):p=e[14];let h;return e[15]!==f||e[16]!==p?(h=s.jsx(Ds.Provider,{value:f,children:p}),e[15]=f,e[16]=p,e[17]=h):h=e[17],h}function xc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const gc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],bc=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=ce(),o=Kr(),a=Ee({connectionId:e,orgId:r.id,orgSlug:r.slug}),l=Oe.virtualMcpResources(e,r.id),[c,u]=w.useState("categories"),V=w.useRef(c);V.current=c;const d=w.useRef(null),i=w.useRef(!1),m=["at-mention",r.id,e??"default",c],f=async({item:h,range:g})=>{if(G("chat_picker_item_selected",{picker:"@",item_kind:h.kind,item_name:h.name}),h.kind!=="category"&&(i.current=!0),h.kind==="category")return u(h.name==="agents"?"agents":"resources"),!1;if(h.kind==="agent"&&h.agentId){Le(t,g,{id:h.agentId,name:h.name,metadata:{agentId:h.agentId,title:h.name},char:"@"}),u("categories");return}if(h.kind==="resource"&&h.uri&&a){try{const b=await Dn(a,h.uri);Le(t,g,{id:h.uri,name:h.uri,metadata:b.contents,char:"@"})}catch(b){console.error("[at-mention] Failed to fetch resource:",b),ie.error("Failed to load resource. Please try again.")}u("categories");return}},x=async h=>{const{query:g}=h,b=V.current;if(b==="categories"){if(!g.trim())return gc;const j=g.toLowerCase(),A=o.filter(S=>S.status==="active"&&(!S.id||!Xt(S.id))&&S.id!==e&&(S.title.toLowerCase().includes(j)||S.description?.toLowerCase().includes(j))).map(S=>({name:S.title,title:S.title,description:S.description??void 0,icon:S.icon??null,kind:"agent",agentId:S.id})),C=await(async()=>{if(!a)return[];let S=n.getQueryData(l);return S||(S=await n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4})),(S?.resources??[]).filter(N=>N.uri.toLowerCase().includes(j)||N.name?.toLowerCase().includes(j)||N.description?.toLowerCase().includes(j)).map(N=>({name:N.name??N.uri,title:N.name,description:N.description,kind:"resource",uri:N.uri}))})();return[...A,...C]}if(b==="agents"){let j=o.filter(A=>A.status==="active"&&(!A.id||!Xt(A.id))&&A.id!==e);if(g.trim()){const A=g.toLowerCase();j=j.filter(C=>C.title.toLowerCase().includes(A)||C.description?.toLowerCase().includes(A))}return j.map(A=>({name:A.title,title:A.title,description:A.description??void 0,icon:A.icon??null,kind:"agent",agentId:A.id}))}if(!a)return[];let v=n.getQueryData(l);v?n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4}).catch(()=>{}):v=await n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4});let y=v?.resources??[];if(g.trim()){const j=g.toLowerCase();y=y.filter(A=>A.uri.toLowerCase().includes(j)||A.name?.toLowerCase().includes(j)||A.description?.toLowerCase().includes(j))}return y.map(j=>({name:j.name??j.uri,title:j.name,description:j.description,kind:"resource",uri:j.uri}))},p=h=>{if(h)d.current=Date.now(),i.current=!1,G("chat_picker_opened",{picker:"@"});else{const g=d.current;G("chat_picker_closed",{picker:"@",outcome:i.current?"selected":"dismissed",duration_ms:g?Date.now()-g:null}),d.current=null,u("categories")}};return s.jsx(Fs,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:x,onSelect:f,onOpenChange:p})};async function In(t,e,n,r,o,a){try{const l=await dt(n,r,a);Le(t,e,{id:r,name:at(r,o),metadata:l.messages,char:"/",kind:"prompt",args:a})}catch(l){console.error("[slash] Failed to fetch prompt:",l),ie.error("Failed to load prompt. Please try again.")}}async function vc(t,e,n,r){try{const o=await Dn(n,r);Le(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),ie.error("Failed to load resource. Please try again.")}}const yc=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=ce(),o=Ee({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Oe.virtualMcpPrompts(e,r.id),l=Oe.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[u,V]=w.useState(null),[d,i]=w.useState(null),m=jr(t);m&&(m.onEditChip=async y=>{if(o)try{const A=(await En(n,a,o)).find(C=>C.name===y.promptId);if(!A?.arguments||A.arguments.length===0)return;i({...y,prompt:A})}catch(j){console.error("[slash] Failed to load prompt for editing:",j),ie.error("Failed to load prompt. Please try again.")}});const f=w.useRef(null),x=w.useRef(!1),p=async({item:y,range:j})=>{if(G("chat_picker_item_selected",{picker:"/",item_kind:y.kind,item_name:y.name}),x.current=!0,!!o)if(y.kind==="prompt"){if(y.arguments&&y.arguments.length>0){V({range:j,item:y});return}const A=fe(y._meta);await In(t,j,o,y.name,A)}else y.uri&&await vc(t,j,o,y.uri)},h=async y=>{if(!u||!o)return;const{range:j,item:A}=u,C=fe(A._meta);await In(t,j,o,A.name,C,y),V(null)},g=async y=>{if(!(!d||!o)){try{const j=await dt(o,d.promptId,y),A=fe(d.prompt._meta);t.chain().focus().setNodeSelection(d.pos).deleteSelection().insertContentAt(d.pos,On({id:d.promptId,name:at(d.promptId,A),metadata:j.messages,char:"/",kind:"prompt",args:y})).run(),G("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:d.promptId})}catch(j){console.error("[slash] Failed to update prompt:",j),ie.error("Failed to update prompt. Please try again.")}i(null)}},b=async y=>{const{query:j}=y;if(!o)return[];const[A,C]=await Promise.all([En(n,a,o),Ac(n,l,o)]),S=j.trim().toLowerCase(),N=(A??[]).filter(k=>!S||k.name.toLowerCase().includes(S)||k.title?.toLowerCase().includes(S)||k.description?.toLowerCase().includes(S)).map(k=>({name:k.name,title:k.title,description:k.description,kind:"prompt",arguments:k.arguments,_meta:k._meta})),D=(C??[]).filter(k=>!S||k.uri.toLowerCase().includes(S)||k.name?.toLowerCase().includes(S)||k.description?.toLowerCase().includes(S)).map(k=>({name:k.name??k.uri,title:k.name,description:k.description,kind:"resource",uri:k.uri}));return[...N,...D]},v=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(Fs,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:b,onSelect:p,onOpenChange:y=>{if(y)f.current=Date.now(),x.current=!1,G("chat_picker_opened",{picker:"/"});else{const j=f.current;G("chat_picker_closed",{picker:"/",outcome:x.current?"selected":"dismissed",duration_ms:j?Date.now()-j:null}),f.current=null}}}),s.jsx(Je,{prompt:v,setPrompt:()=>V(null),onSubmit:h}),s.jsx(Je,{prompt:d?.prompt??null,setPrompt:()=>i(null),onSubmit:g,defaultValues:d?.args},d?`edit-${d.promptId}-${d.pos}`:"edit-idle")]})};async function En(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}),r?.prompts??[]}async function Ac(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}),r?.resources??[]}function jc(t){return[ko.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),Vi.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),wr,Sr]}function wc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:l}){const c=w.useRef(a),u=w.useRef(e),V=w.useRef(r),d=w.useRef(o),i=Co({extensions:jc(d),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&V.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{u.current(m?.getJSON())}});return w.useEffect(()=>{i?.setEditable(!n)},[i,n]),w.useEffect(()=>{c.current=a},[a]),w.useEffect(()=>{u.current=e},[e]),w.useEffect(()=>{V.current=r},[r]),w.useEffect(()=>{d.current=o},[o]),w.useEffect(()=>{if(!i||i.isDestroyed)return;const m=JSON.stringify(i.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&i.commands.setContent(t||{type:"doc",content:[]})},[i,t]),s.jsx(No.Provider,{value:{editor:i},children:l})}function Sc(t){const e=O.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:l,ref:c,className:u}=t,V=n===void 0?!1:n,d=o===void 0?!1:o,{editor:i}=Qt();let m,f;if(e[0]!==i?(m=()=>({focus:()=>{i?.commands.focus()},clear:()=>{i?.commands.clearContent(!0)},appendText:S=>{if(!i)return;const N=i.state.doc.textContent.trim()==="";i.commands.focus("end"),N||i.commands.insertContent(" "),i.commands.insertContent(S)},syncVoiceText:(S,N)=>{if(i&&(i.commands.setContent(S||{type:"doc",content:[]}),N)){i.commands.focus("end");const D=i.state.doc.textContent.trim().length>0;i.commands.insertContent(D?" "+N:N)}},restoreContent:S=>{i&&i.commands.setContent(S||{type:"doc",content:[]})}}),f=[i],e[0]=i,e[1]=m,e[2]=f):(m=e[1],f=e[2]),w.useImperativeHandle(c??null,m,f),!i)return null;const x=V&&"cursor-not-allowed opacity-70",p=V&&"[&_.ProseMirror]:cursor-not-allowed";let h;e[3]!==u||e[4]!==x||e[5]!==p?(h=z("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",u,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",x,p),e[3]=u,e[4]=x,e[5]=p,e[6]=h):h=e[6];let g;e[7]!==i||e[8]!==h?(g=s.jsx(_o,{editor:i,className:h}),e[7]=i,e[8]=h,e[9]=g):g=e[9];const b=r??null;let v;e[10]!==i||e[11]!==b?(v=s.jsx(w.Suspense,{fallback:null,children:s.jsx(yc,{editor:i,virtualMcpId:b})}),e[10]=i,e[11]=b,e[12]=v):v=e[12];const y=r??null;let j;e[13]!==i||e[14]!==y?(j=s.jsx(w.Suspense,{fallback:null,children:s.jsx(bc,{editor:i,virtualMcpId:y})}),e[13]=i,e[14]=y,e[15]=j):j=e[15];let A;e[16]!==i||e[17]!==l||e[18]!==a||e[19]!==d?(A=d&&a?s.jsx(oi,{editor:i,selectedModel:a,onUnsupportedFile:l}):null,e[16]=i,e[17]=l,e[18]=a,e[19]=d,e[20]=A):A=e[20];let C;return e[21]!==v||e[22]!==j||e[23]!==A||e[24]!==g?(C=s.jsxs(s.Fragment,{children:[g,v,j,A]}),e[21]=v,e[22]=j,e[23]=A,e[24]=g,e[25]=C):C=e[25],C}function Os(t){const e=O.c(3),[n]=Ie();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Mo(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const Cc={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},Nc=Br.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),kc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function _c(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:kc.map(Ic)}),t[0]=e):e=t[0],e}function Ic(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function Ec({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=w.useState(!1),u=Os(Cc),{org:V}=ce(),{editor:d}=Qt(),i=w.useRef(null),m=pt(r),f=()=>{!m||o||(c(!1),i.current?.click())},x=async M=>{const U=M.target.files;if(!U||U.length===0||!d)return;const Q=Array.from(U),{from:K}=d.state.selection;try{for(const H of Q)await Ht(d,r??null,H,K,a)}finally{i.current&&(i.current.value="")}},p=Ee({connectionId:n,orgId:V.id,orgSlug:V.slug}),h=Oe.virtualMcpPrompts(n,V.id),{data:g,isLoading:b}=dr({queryKey:h,queryFn:()=>kt(p),staleTime:6e4,enabled:l&&!!p}),v=g?.prompts??[],[y,j]=w.useState(null),{chatMode:A,setChatMode:C}=pe(),[S,N]=Ie(),k=(Pe.find(M=>M.value===S.toolApprovalLevel)??Pe[0]).short,P=M=>{const U=Pe.find(Q=>Q.value===M);if(U){if(U.value===S.toolApprovalLevel){c(!1);return}u(),G("chat_approval_level_changed",{from_level:S.toolApprovalLevel,to_level:U.value,source:"tools_popover"}),N({...S,toolApprovalLevel:U.value}),c(!1)}},T=A==="plan",_=()=>{u();const M=T?"default":"plan";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),C(M),c(!1)},R=()=>{e(),c(!1)},F=async(M,U)=>{if(!d||!p)return;const Q=fe(M._meta),K={from:d.state.selection.from,to:d.state.selection.to};try{const H=await dt(p,M.name,U);Le(d,K,{id:M.name,name:at(M.name,Q),metadata:H.messages,char:"/",kind:"prompt",args:U})}catch{ie.error("Failed to load prompt. Please try again.")}},E=async M=>{c(!1);const U=!!(M.arguments&&M.arguments.length>0);if(G("chat_prompt_inserted",{prompt_name:M.name,with_arguments:U}),U){j(M);return}await F(M)},I=async M=>{y&&(await F(y,M),j(null))},$=()=>{u();const M=A==="gen-image"?"default":"gen-image";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),C(M),c(!1)},B=()=>{u();const M=A==="web-search"?"default":"web-search";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),C(M),c(!1)},L=A==="gen-image",q=A==="web-search";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:i,type:"file",multiple:!0,accept:po(r??null),className:"hidden",onChange:x,disabled:o}),s.jsxs(Eo,{open:l,onOpenChange:M=>{M&&!l&&G("chat_tools_popover_opened",{chat_mode:A}),c(M)},children:[s.jsx(Ro,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:z("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(Zr,{size:14}),s.jsx("span",{className:z("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(To,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(he,{onClick:f,disabled:o,children:[s.jsx(on,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(ye,{children:[s.jsx(be,{asChild:!0,children:s.jsxs(he,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:M=>M.preventDefault(),children:[s.jsx(on,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(ve,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(he,{onClick:_,className:z(T&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(Ln,{size:16,className:z(T&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:z("text-xs text-muted-foreground",T&&"text-violet-500 font-medium"),children:Nc})]}),s.jsxs(he,{onClick:$,className:z(L&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(zn,{size:16,className:z(L&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),L&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(he,{onClick:B,className:z(q&&"text-blue-600 dark:text-blue-400"),children:[s.jsx($n,{size:16,className:z(q&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),q&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(nn,{children:[s.jsxs(sn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(rn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:b?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(fr,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(M=>s.jsxs(he,{onClick:()=>E(M),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:M.title||Ft(M.name,fe(M._meta))}),M.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]},M.name))})]}),s.jsxs(nn,{children:[s.jsxs(sn,{className:"gap-2",children:[s.jsx(mt,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:k})]}),s.jsx(rn,{className:"w-48 p-1.5",children:s.jsx(Po,{value:S.toolApprovalLevel,onValueChange:P,children:Pe.map(M=>s.jsx(Do,{value:M.value,children:M.label},M.value))})})]}),s.jsxs(he,{onClick:R,children:[s.jsx(co,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(w.Suspense,{children:s.jsx(_c,{})})]})]})]}),s.jsx(Je,{prompt:y,setPrompt:j,onSubmit:I})]})}const Rc=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function Tc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:Rc.map(Pc)}),t[0]=e):e=t[0],e}function Pc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Dc(t){const e=O.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=z("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(Tc,{}),l=s.jsx(Oo,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=l):(r=e[0],o=e[1],a=e[2],l=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,l]}),e[4]=n,e[5]=c):c=e[5],c}const Me=48;function Mc(){const t=O.c(9),[e,n]=w.useState("idle"),[r,o]=w.useState(""),[a,l]=w.useState(""),[c,u]=w.useState(Lc),V=w.useRef(null),d=w.useRef(null),i=w.useRef(null),m=w.useRef(null),f=w.useRef(0),x=w.useRef(!1),p=w.useRef(""),h=w.useRef(""),g=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),d.current?.close().catch(Oc),m.current?.getTracks().forEach(Fc),i.current=null,d.current=null,m.current=null},t[0]=b):b=t[0];const v=b;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const k=P=>{m.current=P;const T=new AudioContext;d.current=T;const _=T.createMediaStreamSource(P),R=T.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,_.connect(R),i.current=R;const F=new Uint8Array(R.frequencyBinCount),E=()=>{if(!i.current)return;i.current.getByteFrequencyData(F);const I=[];for(let $=0;$<Me;$++){const B=Math.floor($/Me*F.length);I.push(Math.max(.04,(F[B]??0)/255))}u(I),f.current=requestAnimationFrame(E)};E()};y=async()=>{const P=window.SpeechRecognition||window.webkitSpeechRecognition;if(!P){n("unsupported");return}let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),l(""),h.current="",p.current="",x.current=!0,n("recording"),k(T);const _=new P;V.current=_,_.interimResults=!0,_.continuous=!0,_.lang=navigator.language||"en-US",_.onresult=R=>{let F="",E="";for(let I=R.resultIndex;I<R.results.length;I++){const $=R.results[I],B=$?.[0]?.transcript??"";$?.isFinal?E=E+B:F=F+B}E&&(p.current=p.current+E,o(p.current)),h.current=F,l(F)},_.onend=()=>{if(x.current)try{_.start()}catch{}};try{_.start()}catch{n("idle")}},t[1]=y}else y=t[1];const j=y;let A;t[2]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x.current=!1,V.current?.stop(),v(),n("idle"),u(Array(Me).fill(.05)),l("");const k=(p.current+(h.current?" "+h.current:"")).trim();return o(""),p.current="",h.current="",k},t[2]=A):A=t[2];const C=A;let S;t[3]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{x.current=!1,V.current?.abort(),v(),n("idle"),o(""),l(""),u(Array(Me).fill(.05)),p.current="",h.current=""},t[3]=S):S=t[3];const N=S;let D;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(D={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:g,startRecording:j,stopRecording:C,cancelRecording:N},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=D):D=t[8],D}function Fc(t){return t.stop()}function Oc(){}function Lc(){return Array(Me).fill(.05)}function $c(t){const e=O.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(zc),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function zc(t,e){return s.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function Bc({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Uc(t,e){const n=O.c(5),{editor:r}=Qt(),[o,a]=w.useState(!1),l=w.useRef(0);let c,u;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const V=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),l.current=l.current+1,a(!0))},d=f=>{f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&a(!1)},i=Kc,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!pt(t))return;const x=f.dataTransfer?.files;if(!x||x.length===0)return;const{from:p}=r.state.selection;for(const h of Array.from(x))Ht(r,t,h,p,e)};return window.addEventListener("dragenter",V),window.addEventListener("dragleave",d),window.addEventListener("dragover",i),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",V),window.removeEventListener("dragleave",d),window.removeEventListener("dragover",i),window.removeEventListener("drop",m)}},u=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=u):(c=n[3],u=n[4]),w.useEffect(c,u),o}function Kc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function qc(t){const e=O.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=Uc(n,r);let a;e[0]!==n?(a=pt(n),e[0]=n,e[1]=a):a=e[1];const l=a,c=o?"opacity-100":"opacity-0 pointer-events-none",u=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let V;e[2]!==c||e[3]!==u?(V=z("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,u),e[2]=c,e[3]=u,e[4]=V):V=e[4];let d;e[5]!==n||e[6]!==l?(d=l?s.jsxs(s.Fragment,{children:[s.jsx(to,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",ns(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Mn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=l,e[7]=d):d=e[7];let i;return e[8]!==V||e[9]!==d?(i=s.jsx("div",{className:V,children:d}),e[8]=V,e[9]=d,e[10]=i):i=e[10],i}function Qc(){const t=O.c(6),e=rt(),{org:n,locator:r}=ce(),{create:o}=Lr();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async l=>{const{tiptapDoc:c,virtualMcp:u}=l,V=crypto.randomUUID(),d=u?.id??Vt(n.id).id;$r(sessionStorage,r,V,{tiptapDoc:c});try{await o({id:V,virtual_mcp_id:d})}catch{}const i={virtualmcpid:d,autosend:zr};e({to:"/$org/$taskId",params:{org:n.slug,taskId:V},search:i})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function Yc({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=Fn(),r=ot(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),u=r?.taskId??"",V=u||ia,d=Qc(),{selectedModel:i,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:x,imageModel:p,deepResearchModel:h,chatMode:g,setChatMode:b}=pe(),{data:v}=Tn.useSession(),y=v?.user?.id,{org:j,locator:A}=ce(),C=Vt(j.id).id,S=qr(m?.id??C),N=Os(Fo),[D,k]=w.useState(!1),{unsupportedFile:P,onUnsupportedFile:T,clearUnsupportedFile:_}=ui(),R=Mc(),F=w.useRef(void 0),E=async()=>{F.current=L,await R.startRecording();const Y=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";G("chat_voice_started",{thread_id:u,outcome:Y})},I=()=>{G("chat_voice_confirmed",{thread_id:u});const Y=R.stopRecording();H.current?.syncVoiceText(F.current,Y),H.current?.focus()},$=()=>{G("chat_voice_cancelled",{thread_id:u}),R.cancelRecording(),H.current?.restoreContent(F.current)};w.useEffect(()=>{if(R.status!=="recording")return;const Y=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();H.current?.syncVoiceText(F.current,Y)},[R.transcript,R.interimTranscript,R.status]);const B=r?.activeTask??null,[L,q]=w.useState(()=>cn(sessionStorage,A,V)??void 0),M=Y=>{q(Y),x.current=Y,ua(sessionStorage,A,V,Y,{onQuotaExceeded:({docSizeBytes:oe})=>{G("chat_draft_quota_exceeded",{thread_id:u||null,doc_size_bytes:oe}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},U=w.useRef(u);if(U.current!==u){U.current=u;const Y=cn(sessionStorage,A,V)??void 0;q(Y),x.current=Y}const K=[...o].reverse().find(Y=>Y.role==="assistant")?.metadata?.modelLimits?.contextWindow??i?.limits?.contextWindow,H=w.useRef(null),ne=g==="plan";w.useEffect(()=>{const Y=oe=>{Ur(oe)&&oe.code==="KeyL"&&(oe.preventDefault(),oe.shiftKey&&b(g==="plan"?"default":"plan"),H.current?.focus())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[g,b]);const ee=Cr(o),J=[...o].reverse().find(Y=>Y.role==="assistant"&&Y.metadata?.usage)?.metadata?.usage?.contextTokens??0,Z=!a&&!f&&!us(L),W=a||l,X=Bc({messageCount:o.length,showConnectionsBanner:e}),re=Y=>{Y?.preventDefault(),a?(G("chat_message_stopped",{thread_id:u}),c()):l?(G("chat_message_stopped",{thread_id:u}),c()):Z&&L&&(G("chat_message_sent",{thread_id:u||null,mode:g,model_id:i?.modelId??null,model_provider:i?.providerId??null,virtual_mcp_id:m?.id??null,submission:Y?"button_or_enter":"programmatic"}),n?n.sendMessage(L):d({tiptapDoc:L,virtualMcp:m}),Va(sessionStorage,A,V),M(void 0))};return y&&B?.created_by&&B.created_by!==y?s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[s.jsx(Mn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"text-sm",children:"Read only — you're viewing someone else's thread"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(ht,{}),s.jsx(wc,{tiptapDoc:L,setTiptapDoc:M,disabled:a,enterToSubmit:!0,onSubmit:re,children:s.jsxs("form",{onSubmit:re,className:z("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(qc,{selectedModel:i,onUnsupportedFile:T}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(Sc,{ref:H,disabled:a||R.status==="recording",virtualMcpId:m?.id??C,showFileUploader:!0,selectedModel:i,onUnsupportedFile:T})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx($c,{data:R.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:$,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:s.jsx(De,{size:16})}),s.jsx("button",{type:"button",onClick:I,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(Ke,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Ec,{disabled:a,onOpenConnections:()=>{G("connections_dialog_opened",{source:"tools_popover",mode:"add"}),k(!0)},virtualMcpId:m?.id??C,selectedModel:i,isStreaming:a,onUnsupportedFile:T}),ne&&s.jsxs("button",{type:"button",onClick:()=>{N(),G("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),b("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(Ln,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="gen-image"&&p&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{N(),G("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),b("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(zn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="web-search"&&h&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{N(),G("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),b("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx($n,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),K&&J>0&&s.jsx(Nr,{usage:ee,totalTokens:J,contextWindow:K,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[X&&s.jsx(ei,{virtualMcp:S,currentBranch:r?.currentBranch??null}),s.jsx(ri,{}),R.isSupported&&s.jsx(se,{type:"button",onClick:E,disabled:a||l,variant:"ghost",size:"icon",className:z("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(Xr,{size:18})}),s.jsx(se,{type:W?"button":"submit",onClick:Y=>{W&&(Y.preventDefault(),Y.stopPropagation(),c())},variant:Z||W?"default":"ghost",size:"icon",disabled:!Z&&!W,className:z("size-8 rounded-lg transition-all",!Z&&!W&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:a?"Stop generating":l?"Cancel run":"Send message (Enter)",children:W?s.jsx(eo,{size:20}):s.jsx(Qr,{size:20})})]})]})})]})},u),e&&s.jsx(Dc,{onClick:()=>{G("connections_banner_clicked",{source:"home_chat_input"}),G("connections_dialog_opened",{source:"home_banner",mode:"add"}),k(!0)}})]})}),s.jsx(fo,{mode:"browse",open:D,onOpenChange:k,defaultTab:"all"}),s.jsx(ii,{info:P,onClose:_})]})}const Hc={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function Ls(t){return`deco-credits-empty-dismissed:${t}`}function tV(t){try{return localStorage.getItem(Ls(t))==="1"}catch{return!1}}function Gc(){const t=O.c(47),{org:e}=ce(),n=rt(),{decoKeyId:r}=Wn(),o=Zn(),[a,l]=w.useState(!0),[c,u]=w.useState(""),[V,d]=w.useState(!1),[i,m]=w.useState("usd"),f=i==="brl"?"R$":"$";let x;t[0]!==e.id?(x=()=>{G("credits_empty_state_dismissed",{organization_id:e.id}),l(!1);try{localStorage.setItem(Ls(e.id),"1")}catch{}},t[0]=e.id,t[1]=x):x=t[1];const p=x;let h,g;t[2]!==a||t[3]!==e.id?(h=()=>{a&&G("credits_empty_state_shown",{organization_id:e.id})},g=[a,e.id],t[2]=a,t[3]=e.id,t[4]=h,t[5]=g):(h=t[4],g=t[5]),w.useEffect(h,g);let b;t[6]!==i||t[7]!==o?(b=async L=>{const{url:q}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:L,currency:i});return q},t[6]=i,t[7]=o,t[8]=b):b=t[8];let v;t[9]!==p?(v=L=>{L&&window.open(L,"_blank","noopener,noreferrer"),p()},t[9]=p,t[10]=v):v=t[10];let y;t[11]!==b||t[12]!==v?(y={mutationFn:b,onSuccess:v,onError:Jc},t[11]=b,t[12]=v,t[13]=y):y=t[13];const{mutate:j,isPending:A}=Mt(y),C=parseFloat(c),S=!isNaN(C)&&C>=1;if(!a)return null;let N;t[14]!==p?(N=L=>!L&&p(),t[14]=p,t[15]=N):N=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[16]=D):D=t[16];let k;t[17]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:s.jsx(Kn,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[17]=k):k=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[D,s.jsxs(lt,{className:"relative gap-3",children:[k,s.jsxs("div",{className:"text-center",children:[s.jsx(it,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx(Ot,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[18]=P):P=t[18];let T;t[19]!==i||t[20]!==f||t[21]!==c||t[22]!==C||t[23]!==r||t[24]!==S||t[25]!==A||t[26]!==V||t[27]!==j?(T=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Hn,{type:"single",variant:"outline",size:"sm",value:i,onValueChange:L=>{L&&m(L)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Hc[i].map(L=>{const{dollars:q,label:M}=L;return s.jsxs("button",{type:"button",disabled:A,onClick:()=>{G("credits_topup_clicked",{amount_cents:q*100,currency:i,tier_label:M,source:"empty_state"}),j(q*100)},className:z("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,q]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:M})]},q)})}),V?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Gn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:L=>u(L.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!S||A,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(C*100),currency:i,tier_label:"custom",source:"empty_state"}),j(Math.round(C*100))},children:A?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),t[19]=i,t[20]=f,t[21]=c,t[22]=C,t[23]=r,t[24]=S,t[25]=A,t[26]=V,t[27]=j,t[28]=T):T=t[28];let _;t[29]!==p||t[30]!==n||t[31]!==e.slug?(_=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[29]=p,t[30]=n,t[31]=e.slug,t[32]=_):_=t[32];let R;t[33]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Yn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[33]=R):R=t[33];let F;t[34]!==_?(F=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:_,children:["Use your own provider",R]}),t[34]=_,t[35]=F):F=t[35];let E;t[36]!==p?(E=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[36]=p,t[37]=E):E=t[37];let I;t[38]!==F||t[39]!==E?(I=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,E]}),t[38]=F,t[39]=E,t[40]=I):I=t[40];let $;t[41]!==T||t[42]!==I?($=s.jsxs(ct,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Wc,children:[P,T,I]}),t[41]=T,t[42]=I,t[43]=$):$=t[43];let B;return t[44]!==$||t[45]!==N?(B=s.jsx(ut,{open:!0,onOpenChange:N,children:$}),t[44]=$,t[45]=N,t[46]=B):B=t[46],B}function Wc(t){return t.preventDefault()}function Jc(t){ie.error(`Top-up failed: ${t.message}`)}function Zc(t){const e=O.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=z("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=s.jsx(Kn,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[l,s.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function Xc(){const t=O.c(8),{org:e}=ce(),n=rt();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=z("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=s.jsx(qn,{size:13,className:"text-amber-600 dark:text-amber-400"}),l=s.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=o,t[4]=a,t[5]=l):(o=t[3],a=t[4],l=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,l]}),t[6]=r,t[7]=c):c=t[7],c}function eu(t){const e=O.c(11),{className:n}=t;let r;e[0]!==n?(r=z("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(Ye,{align:"right",width:"w-3/4"}),s.jsx(Ye,{align:"left",width:"w-full",lines:3}),s.jsx(Ye,{align:"right",width:"w-2/3"}),s.jsx(Ye,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=u):u=e[6];let V;e[7]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=V):V=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[u,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[V,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=d):d=e[8];let i;return e[9]!==r?(i=s.jsxs("div",{className:r,children:[l,c,d]}),e[9]=r,e[10]=i):i=e[10],i}function Ye(t){const e=O.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,l=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let u;e[0]!==c?(u=z("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=u):u=e[1];const V=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let d;e[2]!==V?(d=z("flex min-w-0 flex-col gap-2",V),e[2]=V,e[3]=d):d=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=i):i=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=z("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let x;e[8]!==l?(x=Array.from({length:l}),e[8]=l,e[9]=x):x=e[9];let p;e[10]!==l||e[11]!==x?(p=s.jsx("div",{className:"space-y-2",children:x.map((v,y)=>s.jsx("div",{className:z("h-3 rounded bg-muted-foreground/20 animate-pulse",y===l-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=l,e[11]=x,e[12]=p):p=e[12];let h;e[13]!==p||e[14]!==f?(h=s.jsx("div",{className:f,children:p}),e[13]=p,e[14]=f,e[15]=h):h=e[15];let g;e[16]!==h||e[17]!==d?(g=s.jsxs("div",{className:d,children:[i,h]}),e[16]=h,e[17]=d,e[18]=g):g=e[18];let b;return e[19]!==g||e[20]!==u?(b=s.jsx("div",{className:u,children:g}),e[19]=g,e[20]=u,e[21]=b):b=e[21],b}function tu(t){const e=O.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:l}=t;let c,u;e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const V=r.current,d=n.current;if(!V||!d||!o)return;const i=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const x=d.scrollHeight,p=d.scrollTop;await l(),requestAnimationFrame(()=>{const h=d.scrollHeight;d.scrollTop=p+(h-x)})},{root:d,rootMargin:"200px 0px 0px 0px"});return i.observe(V),()=>i.disconnect()},u=[n,r,o,a,l],e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=u):(c=e[5],u=e[6]),w.useEffect(c,u)}function nu(t){const e=O.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=z("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function su(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=z("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function ru(t){const e=O.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function ou(){const t=O.c(27),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a}=Ue(),l=kr(e);let c;t[0]!==l?(c=l.at(-1),t[0]=l,t[1]=c):c=t[1];const u=c,d=la()*Go+16,i=w.useRef(null),m=w.useRef(null);let f;t[2]!==a||t[3]!==r||t[4]!==o?(f={scrollRef:i,sentinelRef:m,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a},t[2]=a,t[3]=r,t[4]=o,t[5]=f):f=t[5],tu(f);let x;t[6]!==d?(x={paddingBottom:d},t[6]=d,t[7]=x):x=t[7];let p;t[8]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("div",{ref:m,"aria-hidden":!0,className:"h-px"}),t[8]=p):p=t[8];let h;t[9]!==o?(h=o&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),t[9]=o,t[10]=h):h=t[10];let g;if(t[11]!==l||t[12]!==n){let j;t[14]!==l.length||t[15]!==n?(j=(A,C)=>s.jsx(Zt,{pair:A,isLastPair:!1,status:C===l.length-1?n:void 0},`pair-${A.user?.id??A.assistant?.id}`),t[14]=l.length,t[15]=n,t[16]=j):j=t[16],g=l.slice(0,-1).map(j),t[11]=l,t[12]=n,t[13]=g}else g=t[13];let b;t[17]!==h||t[18]!==g?(b=s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[p,h,g]}),t[17]=h,t[18]=g,t[19]=b):b=t[19];let v;t[20]!==u||t[21]!==n?(v=u&&s.jsx("div",{className:"min-h-full min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Zt,{pair:u,isLastPair:!0,status:n},`pair-${u.user?.id??u.assistant?.id}`)}),t[20]=u,t[21]=n,t[22]=v):v=t[22];let y;return t[23]!==x||t[24]!==b||t[25]!==v?(y=s.jsxs("div",{ref:i,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",style:x,children:[b,v]}),t[23]=x,t[24]=b,t[25]=v,t[26]=y):y=t[26],y}function au(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=z("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const nV=Object.assign(nu,{Main:su,Messages:ou,EmptyState:ru,Footer:au,Input:Yc,Provider:gr,ActiveTaskProvider:xr,Skeleton:eu,IceBreakers:Ho,NoAiProviderEmptyState:ho,CreditsEmptyState:Gc,CreditsEyebrow:Zc,NoCreditsEyebrow:Xc,CreditsExhaustedBanner:vs});function sV(t){if(typeof t!="object"||t===null)return!1;const n=t.githubRepo?.url;return typeof n=="string"&&n.length>0}function lu(t){return!!Jn(t??null)?.connectionId}function rV(t){return lu(t)}function oV(t){return t.online?t.capabilities.includes("claude-code")||t.capabilities.includes("codex"):!1}export{nV as C,wc as T,ei as a,sV as b,lu as c,Sc as d,rV as e,eV as f,$l as g,oV as h,Vi as i,dl as s,fl as u,tV as w};