decocms 4.355.1 → 4.355.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/client/assets/{AlertCircle-BnJSjvRr.js → AlertCircle-C2I0CPt8.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CZfx3tNT.js → AreaChart-DvG2Chn9.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-CFd_URtJ.js → ArrowLeft-DiFtyxtp.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CIjsALWT.js → ArrowRight-Cr3akrFT.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BL_Z3gaA.js → ArrowUp-DF6vzMhN.js} +1 -1
  6. package/dist/client/assets/{Check-PVF6vrar.js → Check-sicxXYN7.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-DWGenYVe.js → CheckCircle-Cbkf0Hrm.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-DZ_A_9gi.js → ChevronRight-r0gLJbn2.js} +1 -1
  9. package/dist/client/assets/{ChevronSelectorVertical-DM1bCZ5U.js → ChevronSelectorVertical-CejccrOe.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-DCxC4nqn.js → ChevronUp-CBLrm_OT.js} +1 -1
  11. package/dist/client/assets/{Copy01-DCWIjDLi.js → Copy01-BzbXBjHv.js} +1 -1
  12. package/dist/client/assets/{CreditCard01-C5_XNJti.js → CreditCard01-C8AQ6_dn.js} +1 -1
  13. package/dist/client/assets/{DotsVertical-DpjgNoh-.js → DotsVertical-Cyt1EoXA.js} +1 -1
  14. package/dist/client/assets/{Download01-Du8Vadan.js → Download01-Db1D2BD0.js} +1 -1
  15. package/dist/client/assets/{ErrorBarContext-DzIqoDvw.js → ErrorBarContext-BdZSwiSN.js} +1 -1
  16. package/dist/client/assets/{Eye-BByX4xau.js → Eye-QPQVcqGb.js} +1 -1
  17. package/dist/client/assets/{GitBranch01-BH6dGtWi.js → GitBranch01-D3Ep4J5o.js} +1 -1
  18. package/dist/client/assets/{Globe01-DlaG-NnI.js → Globe01-dlVOEKaQ.js} +1 -1
  19. package/dist/client/assets/{HardDrive-CUdLIQ85.js → HardDrive-W8kLhAmw.js} +1 -1
  20. package/dist/client/assets/{Image01-7KOsFSn6.js → Image01-B1m-gUl3.js} +1 -1
  21. package/dist/client/assets/{Key01-Cgpr5iVq.js → Key01-DquPZpqN.js} +1 -1
  22. package/dist/client/assets/{Link01-BwBpqz0z.js → Link01-ClTL5UTN.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-DEZgimKD.js → LinkExternal01-BepJT7Oz.js} +1 -1
  24. package/dist/client/assets/{Monitor01-BrWUHiMt.js → Monitor01-Bndg-M3Y.js} +1 -1
  25. package/dist/client/assets/{Package-Cz6cuFXC.js → Package-B2Up-gTH.js} +1 -1
  26. package/dist/client/assets/{Palette-C62-AS5d.js → Palette-BsEqDIgy.js} +1 -1
  27. package/dist/client/assets/{Play-y6LHuyl1.js → Play-DZtU_bVy.js} +1 -1
  28. package/dist/client/assets/{Plus-C4BLg9rY.js → Plus-5jblmb5M.js} +1 -1
  29. package/dist/client/assets/{SearchLg-5JXlPePj.js → SearchLg-DFeP1_X8.js} +1 -1
  30. package/dist/client/assets/{SearchMd-iLxrs9MR.js → SearchMd-CnBFXj_Z.js} +1 -1
  31. package/dist/client/assets/{Sector-DHEwtC7f.js → Sector-DnHG75nj.js} +1 -1
  32. package/dist/client/assets/{Settings02-HilGA_l8.js → Settings02-5WiTDc8b.js} +1 -1
  33. package/dist/client/assets/{Share07-C5fLDjhG.js → Share07-DzTdSg05.js} +1 -1
  34. package/dist/client/assets/{Shield01-CM8p_GEF.js → Shield01-qqcKLTxE.js} +1 -1
  35. package/dist/client/assets/{Stars01-B27dL-gW.js → Stars01-CFR1c-1g.js} +1 -1
  36. package/dist/client/assets/{Sun-C6IH4klW.js → Sun-Bxqb4eKN.js} +1 -1
  37. package/dist/client/assets/{Tool01-q_jLTCKZ.js → Tool01-DCz0PgHD.js} +1 -1
  38. package/dist/client/assets/{Tool02-DKVecUxz.js → Tool02-Dx9QVS5U.js} +1 -1
  39. package/dist/client/assets/{Trash01-DTRwSnwl.js → Trash01-D5ciFh4O.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-Dc0HNJry.js → TrendUp01-DjG8w8m_.js} +1 -1
  41. package/dist/client/assets/{Upload01-D7EURws9.js → Upload01-Dbydv0Li.js} +1 -1
  42. package/dist/client/assets/{User01-CIoTN2qr.js → User01-Dq0QszR-.js} +1 -1
  43. package/dist/client/assets/{UserSquare-BoLQORca.js → UserSquare-Bi0Jy-6E.js} +1 -1
  44. package/dist/client/assets/{Users01-DMZvF9yz.js → Users01-C_RVSWfd.js} +1 -1
  45. package/dist/client/assets/{Users03-C-hy1klX.js → Users03-DPq3XXBm.js} +1 -1
  46. package/dist/client/assets/{XCircle-B2HwIa6n.js → XCircle-CiIZAkGm.js} +1 -1
  47. package/dist/client/assets/{XClose-DljE5x9b.js → XClose-hM3AAAai.js} +1 -1
  48. package/dist/client/assets/{Zap-DL_o7-ob.js → Zap-Bb7Qo7M3.js} +1 -1
  49. package/dist/client/assets/{ZoomOut-RWKUY6hj.js → ZoomOut-B_xPvOLH.js} +1 -1
  50. package/dist/client/assets/{access-gate-D30eITwH.js → access-gate-B2eHW19E.js} +1 -1
  51. package/dist/client/assets/{agent-icon-BA5Q75L0.js → agent-icon-BMTcgZga.js} +1 -1
  52. package/dist/client/assets/{agents-list-NrabdqUD.js → agents-list-C54ZadWw.js} +1 -1
  53. package/dist/client/assets/{ai-providers-ClqQNrqt.js → ai-providers-BzDqK8qy.js} +1 -1
  54. package/dist/client/assets/{alert-pUX7_vwd.js → alert-BrLgpHg1.js} +1 -1
  55. package/dist/client/assets/{alert-dialog-B9Cqya-5.js → alert-dialog-BikX6FFY.js} +1 -1
  56. package/dist/client/assets/analytics-tab-CsPoqNEM.js +2 -0
  57. package/dist/client/assets/api-keys-Cdmmw61O.js +1 -0
  58. package/dist/client/assets/{api-keys-p8sqiCGM.js → api-keys-Cq2DDoKg.js} +1 -1
  59. package/dist/client/assets/app-editor-BNKwsB0C.js +1 -0
  60. package/dist/client/assets/{auth-SROEnleF.js → auth-CNVXmSkG.js} +1 -1
  61. package/dist/client/assets/{auth-catchall-B3FaofbX.js → auth-catchall-5CZsMp3G.js} +1 -1
  62. package/dist/client/assets/{auth-entry-D8OvofyR.js → auth-entry-CamvS-yK.js} +1 -1
  63. package/dist/client/assets/{auth-split-layout-C1ukWJzE.js → auth-split-layout-BOtLd_pv.js} +1 -1
  64. package/dist/client/assets/{authenticate-and-persist-oauth-B94cTWsZ.js → authenticate-and-persist-oauth-DZYDyEg2.js} +1 -1
  65. package/dist/client/assets/{automation-list-row-Cq-8ml_t.js → automation-list-row-Dj0Hlwog.js} +1 -1
  66. package/dist/client/assets/{automation-runs-D1o8Ui_t.js → automation-runs-2af22T9w.js} +8 -8
  67. package/dist/client/assets/{automations-5Xtw4sgu.js → automations-B2SV0OTy.js} +1 -1
  68. package/dist/client/assets/{autosend-BYDxYeyM.js → autosend-D9JhT_oZ.js} +1 -1
  69. package/dist/client/assets/{avatar-DCRnkiqQ.js → avatar-CPkw3h7t.js} +1 -1
  70. package/dist/client/assets/{badge-DTaRDPAR.js → badge-C_ARXG3i.js} +1 -1
  71. package/dist/client/assets/{block-document-CzuOrMeM.js → block-document-B8RakH2B.js} +1 -1
  72. package/dist/client/assets/{breadcrumb-DF8Vvl2V.js → breadcrumb-CsyYyKv7.js} +1 -1
  73. package/dist/client/assets/{buckets-OS788J9T.js → buckets-C3rsO-J0.js} +1 -1
  74. package/dist/client/assets/{bulk-category-panel-DemyqjzI.js → bulk-category-panel-8YfIcV58.js} +1 -1
  75. package/dist/client/assets/{capability-load-error-RhsCsNaD.js → capability-load-error-_DjYgnoI.js} +1 -1
  76. package/dist/client/assets/{cards-CJz74Frj.js → cards-C17dmtwv.js} +1 -1
  77. package/dist/client/assets/{category-editor-BPDkqZ1X.js → category-editor-DRxFVwt9.js} +1 -1
  78. package/dist/client/assets/{cdn-tab-Ce_KteSc.js → cdn-tab-xbZtzilg.js} +1 -1
  79. package/dist/client/assets/{chart-FV76nfQo.js → chart-HqfMLVT_.js} +1 -1
  80. package/dist/client/assets/{chat-context-BYX6I5Fd.js → chat-context-CvoU8WQ4.js} +1 -1
  81. package/dist/client/assets/{checkbox-BimlBJuz.js → checkbox-Cgrb5XJJ.js} +1 -1
  82. package/dist/client/assets/{choose-editor-vZzAVuzE.js → choose-editor-DWeJjqnG.js} +1 -1
  83. package/dist/client/assets/{cli-auth-success-BazJY0CD.js → cli-auth-success-BdI--VSg.js} +1 -1
  84. package/dist/client/assets/{client-icons-CshWnPu5.js → client-icons-B-EXG49U.js} +1 -1
  85. package/dist/client/assets/{collection-detail-BIN49Vpt.js → collection-detail-swCyhtIz.js} +1 -1
  86. package/dist/client/assets/{collection-display-button-DY2hUVUs.js → collection-display-button-BbFCPrTl.js} +1 -1
  87. package/dist/client/assets/{collection-search-D7Cj6HfC.js → collection-search-CJb7f2bn.js} +1 -1
  88. package/dist/client/assets/{collection-table-wrapper-B71xPUgB.js → collection-table-wrapper-DC-4y8I-.js} +1 -1
  89. package/dist/client/assets/{collection-tabs-DJy9997W.js → collection-tabs-BxnrIEJp.js} +1 -1
  90. package/dist/client/assets/{command-oMq_pqOr.js → command-CqNTTNRi.js} +1 -1
  91. package/dist/client/assets/{commerce-onboarding-Y7LU1MOI.js → commerce-onboarding-DFX26jT9.js} +1 -1
  92. package/dist/client/assets/{connect-fh0xumf2.js → connect-DtII47Uj.js} +1 -1
  93. package/dist/client/assets/{connect-layout-Bnimxjt0.js → connect-layout-TQ2j2S05.js} +1 -1
  94. package/dist/client/assets/{connection-BKgK4EEG.js → connection-DtCer1Uy.js} +1 -1
  95. package/dist/client/assets/{connection-card-CzNHvctS.js → connection-card-BzEzwA5b.js} +1 -1
  96. package/dist/client/assets/{connection-detail-CRdmgjvx.js → connection-detail-BqVCcP--.js} +1 -1
  97. package/dist/client/assets/{connection-form-helpers-DJji_Jb6.js → connection-form-helpers-swpd49hK.js} +1 -1
  98. package/dist/client/assets/{connections-C6KImWhr.js → connections-BtJpCjSi.js} +1 -1
  99. package/dist/client/assets/{create-organization-dialog-rvg59v3U.js → create-organization-dialog-_A_tQwgl.js} +1 -1
  100. package/dist/client/assets/{decopilot-sse-pool-ByRDScf2.js → decopilot-sse-pool-pjl5bOdE.js} +1 -1
  101. package/dist/client/assets/{dialog-B04kc62g.js → dialog-B0OdXcqs.js} +1 -1
  102. package/dist/client/assets/{domain-settings-oaLI5FB-.js → domain-settings-D9jM3qAJ.js} +1 -1
  103. package/dist/client/assets/{drawer-Bw_O4REy.js → drawer-C2s6Up5H.js} +1 -1
  104. package/dist/client/assets/{dropdown-menu-EWXYU2mk.js → dropdown-menu-CoV3z2Yq.js} +1 -1
  105. package/dist/client/assets/{e2e-tab-CF2p5Tm4.js → e2e-tab-H0hc-BZ9.js} +1 -1
  106. package/dist/client/assets/{editor-ChkB79mK.js → editor-DDZRpuBY.js} +1 -1
  107. package/dist/client/assets/{empty-state-8xdT9fUB.js → empty-state-CZg3u6TE.js} +1 -1
  108. package/dist/client/assets/{empty-state-CRzdgRHh.js → empty-state-UGFooPJ_.js} +1 -1
  109. package/dist/client/assets/{extract-connection-data-C-oki4yl.js → extract-connection-data-BPXLZ9J6.js} +1 -1
  110. package/dist/client/assets/{file-explorer-Duxdjlta.js → file-explorer-CDJlhfne.js} +1 -1
  111. package/dist/client/assets/{file-type-icon-BTszDjtn.js → file-type-icon-DnRMRlEa.js} +1 -1
  112. package/dist/client/assets/{folder-icon-zfr8GEIh.js → folder-icon-D1UH1rlz.js} +1 -1
  113. package/dist/client/assets/{form-NAnvNKNh.js → form-TWkufiDd.js} +1 -1
  114. package/dist/client/assets/{general-EYNf96uo.js → general-Dm-xRItO.js} +1 -1
  115. package/dist/client/assets/{github-icon-D2iLhKKS.js → github-icon-DMu-fvNj.js} +1 -1
  116. package/dist/client/assets/{hooks-5upKNaET.js → hooks-BJUiYjpq.js} +1 -1
  117. package/dist/client/assets/{index-BlPslUSo.js → index-B5IAGVkM.js} +6 -6
  118. package/dist/client/assets/{index-BLXX2F1Z.js → index-BI90bdn8.js} +1 -1
  119. package/dist/client/assets/{index-DbGHY7ae.js → index-BPwgxBBZ.js} +1 -1
  120. package/dist/client/assets/index-Bf3UYpNv.js +1 -0
  121. package/dist/client/assets/{index-U0llG_rw.js → index-CNT4COX0.js} +1 -1
  122. package/dist/client/assets/{index-Duje61Xv.js → index-D6kz3ebr.js} +4 -4
  123. package/dist/client/assets/index-DBDSE4L5.css +1 -0
  124. package/dist/client/assets/{index-CsMaAxoQ.js → index-DIovfAvf.js} +1 -1
  125. package/dist/client/assets/{index-BVkcOayd.js → index-DeOJD6d8.js} +1 -1
  126. package/dist/client/assets/{index-HsBszKk6.js → index-Dfke77qN.js} +1 -1
  127. package/dist/client/assets/{index-BICosFUY.js → index-DucBuZzH.js} +1 -1
  128. package/dist/client/assets/{index-CRkq3miP.js → index-KPDf_vWx.js} +1 -1
  129. package/dist/client/assets/{index-CHCyce6s.js → index-ObR7HuX3.js} +1 -1
  130. package/dist/client/assets/{index-redirect-lymg6hAq.js → index-redirect-n5VV5WB_.js} +1 -1
  131. package/dist/client/assets/{infiniteQueryObserver-BtQxTAMd.js → infiniteQueryObserver-Dld3rVqh.js} +1 -1
  132. package/dist/client/assets/{infra-billing-jf3Yd95B.js → infra-billing-D04CQzUh.js} +1 -1
  133. package/dist/client/assets/{input-CnXtEqVa.js → input-SHpohkkd.js} +1 -1
  134. package/dist/client/assets/{integration-icon-vlzFlFo_.js → integration-icon-BQARLIol.js} +1 -1
  135. package/dist/client/assets/{invite-member-dialog-BRD-sISH.js → invite-member-dialog-DGV9h8p7.js} +1 -1
  136. package/dist/client/assets/{label-Cde57soC.js → label-rD90jMRy.js} +1 -1
  137. package/dist/client/assets/{layout-d2-6fCTF.js → layout-DneON2K-.js} +1 -1
  138. package/dist/client/assets/{login-P60d9M35.js → login-KMTs7jKS.js} +1 -1
  139. package/dist/client/assets/{markdown-DazdNUyR.js → markdown-DOFXhXXc.js} +1 -1
  140. package/dist/client/assets/{mcp-app-renderer-Cfgwv9Wj.js → mcp-app-renderer-DzI0XDOX.js} +1 -1
  141. package/dist/client/assets/{mcp-oauth-86AEuQu1.js → mcp-oauth-DHIeN6FN.js} +1 -1
  142. package/dist/client/assets/{members-BHfkyhcb.js → members-AHwwCvg3.js} +1 -1
  143. package/dist/client/assets/{monaco-editor-IBD3LTXE.js → monaco-editor-BncUqSbn.js} +1 -1
  144. package/dist/client/assets/{monitoring-stats-row-BaKMUKiS.js → monitoring-stats-row-CEzHQPkU.js} +1 -1
  145. package/dist/client/assets/{multi-select-DSik8jKk.js → multi-select-BuWqwtfL.js} +1 -1
  146. package/dist/client/assets/{oauth-callback-Kh-wXxBV.js → oauth-callback-BC7x9Uxy.js} +1 -1
  147. package/dist/client/assets/{oauth-callback-ai-provider-Ji2YoCih.js → oauth-callback-ai-provider-Difk9x6B.js} +1 -1
  148. package/dist/client/assets/{onboarding-DI36rduC.js → onboarding-EhIUSeAF.js} +1 -1
  149. package/dist/client/assets/{org-layout-xq5l_bu4.js → org-layout-CSFqN6iA.js} +1 -1
  150. package/dist/client/assets/{organization-choice-DPa54bzi.js → organization-choice-NrSjC7-6.js} +1 -1
  151. package/dist/client/assets/{orgs-mzc4Kx78.js → orgs-02MvW8eo.js} +1 -1
  152. package/dist/client/assets/{page-seo-form-Dq9tYJrQ.js → page-seo-form-F8gftHfe.js} +1 -1
  153. package/dist/client/assets/{popover-BjSCyJZK.js → popover-DClv4J5a.js} +1 -1
  154. package/dist/client/assets/{post-calendar-BStgFHMo.js → post-calendar-BqjLapsw.js} +1 -1
  155. package/dist/client/assets/{post-editor-BfBnFBgl.js → post-editor-CKi-qWNG.js} +1 -1
  156. package/dist/client/assets/{primitives-B2Acr6Dc.js → primitives-DpTtwzO3.js} +1 -1
  157. package/dist/client/assets/{profile-DCWeRvLG.js → profile-DDFJC2Vv.js} +1 -1
  158. package/dist/client/assets/{project-app-view-Di4BAidr.js → project-app-view-BxEzaMDJ.js} +1 -1
  159. package/dist/client/assets/{project-icon-BVyI4baU.js → project-icon-DB0uWZzs.js} +1 -1
  160. package/dist/client/assets/{prompts-B3fp8Esg.js → prompts-Dwzm6Z4Z.js} +1 -1
  161. package/dist/client/assets/record-editor-DLoE_u56.js +1 -0
  162. package/dist/client/assets/redirect-editor-B9a7bR4b.js +1 -0
  163. package/dist/client/assets/registry-DJi9P9E9.js +2 -0
  164. package/dist/client/assets/{registry-layout-8a-v4D4w.js → registry-layout-DY-ilKoy.js} +1 -1
  165. package/dist/client/assets/{reports-s9Svwh5t.js → reports-dy7OW4nR.js} +1 -1
  166. package/dist/client/assets/{repositories-DmXLABm9.js → repositories-B3EUtLfQ.js} +1 -1
  167. package/dist/client/assets/{repository-import-picker-_l8ASYjL.js → repository-import-picker-Ds-7ia8x.js} +1 -1
  168. package/dist/client/assets/{repository-picker-BccrsPEM.js → repository-picker-zcqpFECf.js} +1 -1
  169. package/dist/client/assets/{require-capability-Bkv89TrS.js → require-capability-BkcUyh1H.js} +1 -1
  170. package/dist/client/assets/{required-auth-layout-DJNMkIXV.js → required-auth-layout-BkCbiYhR.js} +1 -1
  171. package/dist/client/assets/{reset-password-BIeLWYRD.js → reset-password-B5BEqtw9.js} +1 -1
  172. package/dist/client/assets/{review-settings-2purjtcb.js → review-settings-V3J_suZO.js} +1 -1
  173. package/dist/client/assets/{roles-B7gOar-B.js → roles-CFXICquL.js} +1 -1
  174. package/dist/client/assets/{schema-CAcwVKmY.js → schema-DQTSPDPc.js} +1 -1
  175. package/dist/client/assets/{scroll-area-DkGYPmJq.js → scroll-area-Bk3bop_C.js} +1 -1
  176. package/dist/client/assets/{search-input-BiMlIRHS.js → search-input-Cr1xDzOR.js} +1 -1
  177. package/dist/client/assets/{secrets-CyoBUMAP.js → secrets-D4THHRB2.js} +1 -1
  178. package/dist/client/assets/{sections-editor-C9s3lw32.js → sections-editor-of2aPbXF.js} +1 -1
  179. package/dist/client/assets/{select-B8LB9lO7.js → select-VruWLBER.js} +1 -1
  180. package/dist/client/assets/{select-model-Baf2kyO0.js → select-model-R6GRqP4o.js} +1 -1
  181. package/dist/client/assets/{self-tool-result-Slq8ovsm.js → self-tool-result-B6OwqL4s.js} +1 -1
  182. package/dist/client/assets/{seo-editor-C45phfWQ.js → seo-editor-BdFo1CDL.js} +1 -1
  183. package/dist/client/assets/settings-layout-BoOxkANz.js +1 -0
  184. package/dist/client/assets/{settings-sidebar-BiJXC2C-.js → settings-sidebar-fJ4N2ofG.js} +1 -1
  185. package/dist/client/assets/{shell-controls-6IQR3cDd.js → shell-controls-Di6eVhxs.js} +1 -1
  186. package/dist/client/assets/{shell-layout-CO1dT5ds.js → shell-layout-DtX3xYLo.js} +1 -1
  187. package/dist/client/assets/{skill-preview-UZAbAgBZ.js → skill-preview-Cn_VmuJU.js} +1 -1
  188. package/dist/client/assets/{skills-D2qDiu5k.js → skills-BYyTg_dQ.js} +1 -1
  189. package/dist/client/assets/{sso-CEWJ6VLR.js → sso-B4-17OvU.js} +1 -1
  190. package/dist/client/assets/{store-CyL9NuEO.js → store-duvEEQay.js} +1 -1
  191. package/dist/client/assets/store-registry-BQF4DMVv.js +2 -0
  192. package/dist/client/assets/{switch-BZ58mkBX.js → switch-D5mDYZzD.js} +1 -1
  193. package/dist/client/assets/{synced-repos-ChDFGnqn.js → synced-repos-BcFubVX4.js} +1 -1
  194. package/dist/client/assets/{table-CmlmtKb5.js → table-Co1Yo9Ou.js} +1 -1
  195. package/dist/client/assets/{tabs-d7ElgGKc.js → tabs-CzhgwOMh.js} +1 -1
  196. package/dist/client/assets/{task-board-Cnr1TJQ1.js → task-board-F9nWsjW0.js} +1 -1
  197. package/dist/client/assets/{task-route-B574jwlk.js → task-route-C50QtiSH.js} +1 -1
  198. package/dist/client/assets/{tasks-B0RW0MCw.js → tasks-PqS_Dc-u.js} +1 -1
  199. package/dist/client/assets/{textarea-BhDs4BBF.js → textarea-D5yUmTuo.js} +1 -1
  200. package/dist/client/assets/{thread-intent-CHazkyv1.js → thread-intent-CqM5vUU9.js} +1 -1
  201. package/dist/client/assets/{thread-route-BQtBayab.js → thread-route-B_3hJRNO.js} +1 -1
  202. package/dist/client/assets/{toggle-group-Bq2mpWXX.js → toggle-group-C6RmEYNw.js} +1 -1
  203. package/dist/client/assets/{toolbar-CegxR6KC.js → toolbar-DalvtXvG.js} +1 -1
  204. package/dist/client/assets/{toolbar-icon-button-Bb7pbVII.js → toolbar-icon-button-aV5MA64L.js} +1 -1
  205. package/dist/client/assets/{track-Cplx0Mu9.js → track-IbgYjppW.js} +1 -1
  206. package/dist/client/assets/{types-C3giwja2.js → types-CaQxQn--.js} +1 -1
  207. package/dist/client/assets/{use-ai-providers-CwXo7Cny.js → use-ai-providers-CBAbpFCs.js} +1 -1
  208. package/dist/client/assets/{use-automations-BElfIooR.js → use-automations-HZOOTOR3.js} +1 -1
  209. package/dist/client/assets/{use-autosave-Cph-jhEM.js → use-autosave-Cd2yn2WA.js} +1 -1
  210. package/dist/client/assets/{use-connection-FIA-Lf_9.js → use-connection-Cxk618DD.js} +1 -1
  211. package/dist/client/assets/{use-copy-Bdm0S55W.js → use-copy-JToNQsYl.js} +1 -1
  212. package/dist/client/assets/{use-create-virtual-mcp-DWkmjuGw.js → use-create-virtual-mcp-BDVK9Nnk.js} +1 -1
  213. package/dist/client/assets/{use-date-fns-locale-BjUZEcSO.js → use-date-fns-locale-BC9XewCs.js} +1 -1
  214. package/dist/client/assets/{use-debounced-autosave-BzRg2UAO.js → use-debounced-autosave-ChhxmJyP.js} +1 -1
  215. package/dist/client/assets/{use-debounced-value-BuXRpR3Q.js → use-debounced-value-B2sataBb.js} +1 -1
  216. package/dist/client/assets/{use-decopilot-events-BRvv0b78.js → use-decopilot-events-w-PNw0gQ.js} +1 -1
  217. package/dist/client/assets/{use-delete-connection-DfegaiO4.js → use-delete-connection-C0Ue1RpB.js} +1 -1
  218. package/dist/client/assets/{use-deployment-admin-CrJxsiox.js → use-deployment-admin-FdJOF92N.js} +1 -1
  219. package/dist/client/assets/{use-destination-route-CTsCUJVB.js → use-destination-route-DaFWrAHj.js} +1 -1
  220. package/dist/client/assets/{use-file-configs-lycL_AWx.js → use-file-configs-BszfQ6Ii.js} +1 -1
  221. package/dist/client/assets/{use-infinite-scroll-DChOO1cg.js → use-infinite-scroll-UlP3mdDG.js} +1 -1
  222. package/dist/client/assets/{use-join-requests-Dt0o50jr.js → use-join-requests-DbLnXh7p.js} +1 -1
  223. package/dist/client/assets/{use-mcp-auth-status-CBOBI4HE.js → use-mcp-auth-status-Dm4k96-0.js} +1 -1
  224. package/dist/client/assets/{use-mcp-client-CuZUnG6t.js → use-mcp-client-BS1HAuw9.js} +1 -1
  225. package/dist/client/assets/{use-mcp-prompts-HyDOtegX.js → use-mcp-prompts-Bqus7nV6.js} +1 -1
  226. package/dist/client/assets/{use-mcp-tools-CgIxaS-u.js → use-mcp-tools-CcPY1kUa.js} +1 -1
  227. package/dist/client/assets/{use-members-f6D1bcBl.js → use-members-BPrB4_B6.js} +1 -1
  228. package/dist/client/assets/{use-navigate-to-agent-i21QRbbT.js → use-navigate-to-agent-yGdOMWOW.js} +1 -1
  229. package/dist/client/assets/{use-org-auth-client-9XX1c-po.js → use-org-auth-client-BfcHu9OA.js} +1 -1
  230. package/dist/client/assets/{use-org-notice-D5-v8g1h.js → use-org-notice-CGWZZ-Tj.js} +1 -1
  231. package/dist/client/assets/{use-org-sso-CMIztxNP.js → use-org-sso-BD6r6b1F.js} +1 -1
  232. package/dist/client/assets/{use-organization-roles-BupS39pr.js → use-organization-roles-CSUyN-QR.js} +1 -1
  233. package/dist/client/assets/{use-organization-settings-CKyr56Kd.js → use-organization-settings-zsIQ5yKP.js} +1 -1
  234. package/dist/client/assets/{use-panel-navigate-DlAzxK8S.js → use-panel-navigate-Bnu_Y_WK.js} +1 -1
  235. package/dist/client/assets/{use-registry-connections-DhQHrKbp.js → use-registry-connections-D6NYr_lo.js} +1 -1
  236. package/dist/client/assets/{use-secrets-DNJM3_Iq.js → use-secrets-CEAwJE8l.js} +1 -1
  237. package/dist/client/assets/{use-section-preview-base-nhx9elgv.js → use-section-preview-base-CPX3fQrj.js} +1 -1
  238. package/dist/client/assets/{use-status-sounds-Da9LCTcB.js → use-status-sounds-BSHc34AF.js} +1 -1
  239. package/dist/client/assets/{use-tags-clLk5v1W.js → use-tags-u-doSjgu.js} +1 -1
  240. package/dist/client/assets/{use-view-mode-jaWbiw3O.js → use-view-mode-DIiapwc1.js} +1 -1
  241. package/dist/client/assets/{use-virtual-mcp-DFQ-_cXE.js → use-virtual-mcp-Ck5PGc0k.js} +1 -1
  242. package/dist/client/assets/useInfiniteQuery-ctaGuyQM.js +1 -0
  243. package/dist/client/assets/useSuspenseInfiniteQuery-IjFUp4RN.js +1 -0
  244. package/dist/client/assets/{users-CLqg0p6h.js → users-BitUrleX.js} +1 -1
  245. package/dist/client/assets/{variant-calendar-DN--0tLd.js → variant-calendar-52K0113C.js} +1 -1
  246. package/dist/client/assets/{view-mode-toggle-CRobbFgX.js → view-mode-toggle-tmEIJIQR.js} +1 -1
  247. package/dist/client/index.html +2 -2
  248. package/dist/server/cli.js +1 -1
  249. package/dist/server/server.js +1 -1
  250. package/package.json +1 -1
  251. package/dist/client/assets/analytics-tab-CZWO9-z3.js +0 -2
  252. package/dist/client/assets/api-keys-BC4QXn71.js +0 -1
  253. package/dist/client/assets/app-editor-zB_RgTfi.js +0 -1
  254. package/dist/client/assets/hosting-tab-BhNndoGk.js +0 -1
  255. package/dist/client/assets/index-7CIwuxYk.css +0 -1
  256. package/dist/client/assets/record-editor-W0g2bYOc.js +0 -1
  257. package/dist/client/assets/redirect-editor-D7U0akLq.js +0 -1
  258. package/dist/client/assets/registry-BQLcUCof.js +0 -2
  259. package/dist/client/assets/settings-layout-6xaNrNLJ.js +0 -1
  260. package/dist/client/assets/store-registry-Ba8_Y8s8.js +0 -2
  261. package/dist/client/assets/useInfiniteQuery-BWFATqB4.js +0 -1
  262. package/dist/client/assets/useSuspenseInfiniteQuery-BiSsymj1.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as L,c as _,b as J,ar as m1,j as p,h as hf,B as Ln,ag as Uc,ae as g1,aq as y1,cG as pf,cH as x1,aB as b1,be as $n,cI as v1,l as Q,o as k1,a1 as _n,a2 as Bn,a4 as zn,bu as S1,br as pl,by as C1,bx as w1,cJ as N1,bv as M1,cK as T1,bt as E1,G as xt,n as mf,a7 as gf,e as D1,K as ht,t as fa,m as ni,E as yf,bb as xf,a9 as O1,cL as bf,p as A1,bl as vf,bm as kf,bn as Sf,bo as Cf,d as ml,cM as I1,cN as j1,bB as qc,b6 as R1}from"./index-Duje61Xv.js";import{aJ as P1,b0 as L1,b1 as $1,C as _1,k as B1,u as ha,aq as z1,i as Kc,aC as F1,m as H1,b2 as W1,a_ as wf,b3 as V1,j as pa,b4 as Nf,A as Mf,b5 as wt,b6 as U1,W as q1,h as K1,z as J1,b7 as Y1,b8 as G1}from"./agent-icon-BA5Q75L0.js";import{i as ma}from"./ChevronRight-DZ_A_9gi.js";import{u as X1}from"./useInfiniteQuery-BWFATqB4.js";import{a as Tf,u as Q1}from"./use-connection-FIA-Lf_9.js";import{h as Z1,u as gl,p as e0,i as Ef,a as Df,S as t0}from"./use-mcp-client-CuZUnG6t.js";import{a as n0}from"./use-virtual-mcp-DFQ-_cXE.js";import{c as r0,e as s0,a as Of,d as Tr,b as o0,T as Er}from"./table-CmlmtKb5.js";import{E as Jc}from"./empty-state-CRzdgRHh.js";import{u as Af}from"./use-infinite-scroll-DChOO1cg.js";import{a as i0}from"./use-members-f6D1bcBl.js";import{i as yl}from"./AlertCircle-BnJSjvRr.js";import{i as a0}from"./CheckCircle-DWGenYVe.js";import{a as l0}from"./DotsVertical-DpjgNoh-.js";import{i as c0}from"./XCircle-B2HwIa6n.js";import{e as u0}from"./use-automations-BElfIooR.js";import{u as d0}from"./useSuspenseInfiniteQuery-BiSsymj1.js";import{A as f0}from"./avatar-DCRnkiqQ.js";import{t as If,n as h0}from"./ChevronUp-DCxC4nqn.js";import{t as p0,b as jf,n as Rf}from"./Tool02-DKVecUxz.js";import{t as ri}from"./Stars01-B27dL-gW.js";import{i as Pf}from"./ArrowRight-CIjsALWT.js";import{i as xl}from"./Check-PVF6vrar.js";import{a as Lf}from"./Copy01-DCWIjDLi.js";import{b as Fn,t as bl,c as Yc}from"./format-time-BtXRrtv4.js";import{u as $f}from"./use-copy-Bdm0S55W.js";import{M as vl,I as m0}from"./markdown-DazdNUyR.js";import{g as g0,a as y0,r as x0,d as b0}from"./hooks-5upKNaET.js";import{k as wr,q as v0,b as vs,a as k0,D as S0}from"./chat-context-BYX6I5Fd.js";import{c as C0}from"./monaco-editor-IBD3LTXE.js";import{M as w0}from"./mcp-app-renderer-Cfgwv9Wj.js";import{g as _f}from"./types-C3giwja2.js";import{s as N0}from"./Eye-BByX4xau.js";import{s as M0}from"./XClose-DljE5x9b.js";import{b as T0,a as E0}from"./Tool01-q_jLTCKZ.js";import{i as D0}from"./Share07-C5fLDjhG.js";import{i as O0}from"./SearchMd-iLxrs9MR.js";import{u as A0,a as I0}from"./shell-layout-CO1dT5ds.js";import{a as kl}from"./use-panel-navigate-DlAzxK8S.js";import{a as Ps}from"./Image01-7KOsFSn6.js";import{n as Bf}from"./LinkExternal01-DEZgimKD.js";import{I as Kn}from"./integration-icon-vlzFlFo_.js";import{b as Sl}from"./Users03-C-hy1klX.js";import{a as Nt}from"./Palette-C62-AS5d.js";import{u as zf}from"./use-navigate-to-agent-i21QRbbT.js";import{i as Ls}from"./Link01-BwBpqz0z.js";import{g as j0}from"./use-mcp-prompts-HyDOtegX.js";import{d as R0,c as P0,e as L0,b as $0,D as _0}from"./dialog-B04kc62g.js";import{F as B0,d as z0,a as F0,e as H0,b as W0,c as V0}from"./form-NAnvNKNh.js";import{I as U0}from"./input-CnXtEqVa.js";import{i as q0}from"./Globe01-DlaG-NnI.js";import{i as K0}from"./Monitor01-BrWUHiMt.js";import{n as J0}from"./Download01-Du8Vadan.js";import{F as Y0}from"./file-type-icon-BTszDjtn.js";import{u as G0}from"./use-decopilot-events-BRvv0b78.js";const X0={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Ff(t){if(!t?.providerMetadata)return 0;for(const e of Object.values(X0)){const n=e(t.providerMetadata);if(n!==null)return n}return 0}function Hf(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Wf(t,e){if(!e)return t;const n=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:t.inputTokens+(e.inputTokens??0),outputTokens:t.outputTokens+(e.outputTokens??0),reasoningTokens:t.reasoningTokens+(e.reasoningTokens??0),totalTokens:t.totalTokens+(e.totalTokens??0),cost:t.cost+Ff(e),cacheReadTokens:t.cacheReadTokens+n,cacheWriteTokens:t.cacheWriteTokens+r}}function Cl(t){const e=Math.max(t.inputTokens,t.cacheReadTokens+t.cacheWriteTokens);return e>0?t.cacheReadTokens/e:0}function KO(t){return t.reduce((e,n)=>Wf(e,n.metadata?.usage),Hf())}const Q0={damping:.7,stiffness:.05,mass:1.25},Z0=70,ey=1e3/60,ty=350;let si=!1;globalThis.document?.addEventListener("mousedown",()=>{si=!0});globalThis.document?.addEventListener("mouseup",()=>{si=!1});globalThis.document?.addEventListener("click",()=>{si=!1});const ny=(t={})=>{const[e,n]=L.useState(!1),[r,s]=L.useState(t.initial!==!1),[o,i]=L.useState(!1),a=L.useRef(null);a.current=t;const l=L.useCallback(()=>{if(!si)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const v=b.getRangeAt(0);return v.commonAncestorContainer.contains(g.current)||g.current?.contains(v.commonAncestorContainer)},[]),c=L.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=L.useCallback(b=>{d.escapedFromLock=b,n(b)},[]),d=L.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(v){if(g.current){const{scrollBehavior:k}=getComputedStyle(g.current);k!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=v,d.ignoreScrollToTop=g.current.scrollTop,k!=="auto"&&(g.current.style.scrollBehavior=k)}},get targetScrollTop(){return!g.current||!x.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!x.current)return 0;const{targetScrollTop:v}=this;if(!t.targetScrollTop)return v;if(b?.targetScrollTop===v)return b.calculatedScrollTop;const k=Math.max(Math.min(t.targetScrollTop(v,{scrollElement:g.current,contentElement:x.current}),v),0);return b={targetScrollTop:v,calculatedScrollTop:k},requestAnimationFrame(()=>{b=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Z0}}},[]),f=L.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const v=Date.now()+(Number(b.wait)||0),k=Mi(a.current,b.animation),{ignoreEscapes:N=!1}=b;let C,S=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{C=Date.now()}):C=v+(b.duration??0);const w=async()=>{const M=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:T}=d,O=performance.now(),A=(O-(d.lastTick??O))/ey;if(d.animation||(d.animation={behavior:k,promise:M,ignoreEscapes:N}),d.animation.behavior===k&&(d.lastTick=O),l()||v>Date.now())return w();if(T<Math.min(S,d.calculatedTargetScrollTop)){if(d.animation?.behavior===k){if(k==="instant")return d.scrollTop=d.calculatedTargetScrollTop,w();d.velocity=(k.damping*d.velocity+k.stiffness*d.scrollDifference)/k.mass,d.accumulated+=d.velocity*A,d.scrollTop+=d.accumulated,d.scrollTop!==T&&(d.accumulated=0)}return w()}return C>Date.now()?(S=d.calculatedTargetScrollTop,w()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Mi(a.current,a.current.resize),ignoreEscapes:N,duration:Math.max(0,C-Date.now())||void 0}):d.isAtBottom)});return M.then(T=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),T))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===k?d.animation.promise:w()},[c,l,d]),h=L.useCallback(()=>{u(!0),c(!1)},[u,c]),m=L.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:v,ignoreScrollToTop:k}=d;let{lastScrollTop:N=v}=d;d.lastScrollTop=v,d.ignoreScrollToTop=void 0,k&&k>v&&(N=k),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||v===k)return;if(l()){u(!0),c(!1);return}const C=v>N,S=v<N;if(d.animation?.ignoreEscapes){d.scrollTop=N;return}S&&(u(!0),c(!1)),C&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,l,d]),y=L.useCallback(({target:b,deltaY:v})=>{let k=b;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===g.current&&v<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),g=Gc(b=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",y),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",y,{passive:!0})},[]),x=Gc(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let v;d.resizeObserver=new ResizeObserver(([k])=>{const{height:N}=k.contentRect,C=N-(v??N);if(d.resizeDifference=C,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),C>=0){const S=Mi(a.current,v?a.current.resize:a.current.initial);f({animation:S,wait:!0,preserveScrollPosition:!0,duration:S==="instant"?void 0:ty})}else d.isNearBottom&&(u(!1),c(!0));v=N,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===C&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:x,scrollRef:g,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function Gc(t,e){const n=L.useCallback(r=>(n.current=r,t(r)),e);return n}const Ni=new Map;function Mi(...t){const e={...Q0};let n=!1;for(const s of t){if(s==="instant"){n=!0;continue}typeof s=="object"&&(n=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return Ni.has(r)||Ni.set(r,Object.freeze(e)),n?"instant":Ni.get(r)}function ry(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function wl(t){if(t&&typeof t=="object"&&"gatewayClientId"in t&&typeof t.gatewayClientId=="string")return t.gatewayClientId}function Nl(t,e){if(!e)return t;const n=`${ry(e)}_`;return t.startsWith(n)?t.slice(n.length):t}function sy(t,e){return Nl(t,e).replace(/[_-]/g," ").toLowerCase()}function oy(t,e){const n={};for(const r of t?.arguments??[])n[r.name]=r.required?Uc().min(1,e):Uc();return g1(n)}function iy(t,e){const n={};for(const r of t.arguments??[])n[r.name]=e?.[r.name]??"";return n}function ay(t){const e=_.c(74),{prompt:n,setPrompt:r,onSubmit:s,defaultValues:o}=t,i=L.useId(),a=J();let l,c;if(e[0]!==n||e[1]!==a){const W=oy(n,a("chat.dialogPromptArguments.required"));c=y1,l=m1(W),e[0]=n,e[1]=a,e[2]=l,e[3]=c}else l=e[2],c=e[3];let u;e[4]!==o||e[5]!==n?(u=n?iy(n,o):{},e[4]=o,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==l||e[8]!==u?(d={resolver:l,defaultValues:u,mode:"onChange"},e[7]=l,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==n?.arguments?(h=n?.arguments??[],e[10]=n?.arguments,e[11]=h):h=e[11];const m=h;let y;e[12]!==f||e[13]!==s||e[14]!==r?(y=async W=>{await s(W),r(null),f.reset()},e[12]=f,e[13]=s,e[14]=r,e[15]=y):y=e[15];const g=y;let x;e[16]!==f||e[17]!==r?(x=W=>{W||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=x):x=e[18];const b=x;if(!n)return null;let v;e[19]!==n._meta||e[20]!==n.name||e[21]!==n.title?(v=n.title||sy(n.name,wl(n._meta)),e[19]=n._meta,e[20]=n.name,e[21]=n.title,e[22]=v):v=e[22];let k;e[23]!==v?(k=p.jsx(R0,{children:p.jsx("span",{className:"capitalize",children:v})}),e[23]=v,e[24]=k):k=e[24];let N;e[25]!==n.description?(N=n.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[25]=n.description,e[26]=N):N=e[26];let C;e[27]!==N||e[28]!==k?(C=p.jsxs(P0,{children:[k,N]}),e[27]=N,e[28]=k,e[29]=C):C=e[29];let S;e[30]!==f||e[31]!==g?(S=W=>{W.stopPropagation(),f.handleSubmit(g)(W)},e[30]=f,e[31]=g,e[32]=S):S=e[32];let w;if(e[33]!==m||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==a){let W;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==a?(W=q=>p.jsx(z0,{control:f.control,name:q.name,render:G=>{const{field:te}=G;return p.jsxs(F0,{children:[p.jsxs(H0,{className:"text-xs",children:[q.name,q.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",a("chat.dialogPromptArguments.optional")]})]}),p.jsx(W0,{children:p.jsx(U0,{...te,value:te.value??"",required:q.required,placeholder:q.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(V0,{})]})}},q.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=a,e[41]=W):W=e[41],w=m.map(W),e[33]=m,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=a,e[37]=w}else w=e[37];let M;e[42]!==b?(M=()=>b(!1),e[42]=b,e[43]=M):M=e[43];const T=f.formState.isSubmitting;let O;e[44]!==a?(O=a("chat.dialogPromptArguments.cancel"),e[44]=a,e[45]=O):O=e[45];let A;e[46]!==f.formState.isSubmitting||e[47]!==M||e[48]!==O?(A=p.jsx(Ln,{type:"button",variant:"ghost",onClick:M,disabled:T,children:O}),e[46]=f.formState.isSubmitting,e[47]=M,e[48]=O,e[49]=A):A=e[49];let P;e[50]!==f.formState.isSubmitting||e[51]!==a?(P=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(hf,{size:"xs"}),a("chat.dialogPromptArguments.loading")]}):a("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=a,e[52]=P):P=e[52];let D;e[53]!==f.formState.isSubmitting||e[54]!==i||e[55]!==P?(D=p.jsx(Ln,{type:"submit",form:i,disabled:f.formState.isSubmitting,children:P}),e[53]=f.formState.isSubmitting,e[54]=i,e[55]=P,e[56]=D):D=e[56];let E;e[57]!==A||e[58]!==D?(E=p.jsxs(L0,{children:[A,D]}),e[57]=A,e[58]=D,e[59]=E):E=e[59];let j;e[60]!==i||e[61]!==S||e[62]!==w||e[63]!==E?(j=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:S,children:[w,E]}),e[60]=i,e[61]=S,e[62]=w,e[63]=E,e[64]=j):j=e[64];let I;e[65]!==f||e[66]!==j?(I=p.jsx(B0,{...f,children:j}),e[65]=f,e[66]=j,e[67]=I):I=e[67];let R;e[68]!==C||e[69]!==I?(R=p.jsxs($0,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[68]=C,e[69]=I,e[70]=R):R=e[70];let z;return e[71]!==b||e[72]!==R?(z=p.jsx(_0,{open:!0,onOpenChange:b,children:R}),e[71]=b,e[72]=R,e[73]=z):z=e[73],z}function ga(t){return t?t.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function It(t,e){return t==="output-error"||t==="output-denied"?"error":t==="approval-requested"?"approval":t==="input-streaming"||t==="input-available"||t==="output-available"&&e===!0?"loading":"idle"}function Nr(t){if(t==null||typeof t!="object")return;const e=t;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const n=e.content[0];if(n?.type==="text"&&typeof n.text=="string")try{return JSON.parse(n.text)}catch{return}return}return t}var Xc=Object.defineProperty,ly=(t,e)=>{let n={};for(var r in t)Xc(n,r,{get:t[r],enumerable:!0});return Xc(n,Symbol.toStringTag,{value:"Module"}),n};function Ie(t){this.content=t}Ie.prototype={constructor:Ie,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),o=r.content.slice();return s==-1?o.push(n||t,e):(o[s+1]=e,n&&(o[s]=n)),new Ie(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ie(n)},addToStart:function(t,e){return new Ie([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ie(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),o=r.find(t);return s.splice(o==-1?s.length:o,0,e,n),new Ie(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ie.from(t),t.size?new Ie(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ie.from(t),t.size?new Ie(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ie.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ie.from=function(t){if(t instanceof Ie)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ie(e)};function Vf(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),o=e.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){let i=s.text,a=o.text,l=0;for(;i[l]==a[l];l++)n++;return l&&l<i.length&&l<a.length&&Kf(i.charCodeAt(l-1))&&qf(i.charCodeAt(l))&&n--,n}if(s.content.size||o.content.size){let i=Vf(s.content,o.content,n+1);if(i!=null)return i}n+=s.nodeSize}}function Uf(t,e,n,r){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let i=t.child(--s),a=e.child(--o),l=i.nodeSize;if(i==a){n-=l,r-=l;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let c=i.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&Kf(c.charCodeAt(d-1))&&qf(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(i.content.size||a.content.size){let c=Uf(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}function qf(t){return t>=56320&&t<57344}function Kf(t){return t>=55296&&t<56320}class ${constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,o){for(let i=0,a=0;a<n;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&r(l,s+a,o||null,i)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let o="",i=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new $(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let o=0,i=0;i<n;o++){let a=this.content[o],l=i+a.nodeSize;l>e&&((i<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,n-i-1))),r.push(a),s+=a.nodeSize),i=l}return new $(r,s)}cutByIndex(e,n){return e==n?$.empty:e==0&&n==this.content.length?this:new $(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new $(s,o)}addToStart(e){return new $([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new $(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Vf(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Uf(this,e,n,r)}findIndex(e){if(e==0)return $s(0,e);if(e==this.size)return $s(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=e)return o==e?$s(n+1,o):$s(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return $.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return $.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return $.empty;let n,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(n||(n=e.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new $(n||e,r)}static from(e){if(!e)return $.empty;if(e instanceof $)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new $([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}$.empty=new $([],0);const Ti={index:0,offset:0};function $s(t,e){return Ti.index=t,Ti.offset=e,Ti}function io(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!io(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!io(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let le=class ya{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&io(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ya.none;if(e instanceof ya)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};le.none=[];class ss extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Yf(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(Jf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return F.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F($.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new F(e,r,s)}}F.empty=new F($.empty,0,0);function Jf(t,e,n){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r),{index:i,offset:a}=t.findIndex(n);if(s==e||o.isText){if(a!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Jf(o.content,e-s-1,n-s-1)))}function Yf(t,e,n,r,s,o){let{index:i,offset:a}=t.findIndex(e),l=t.maybeChild(i);if(a==e||l.isText)return o&&r<=0&&s<=0&&!o.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Yf(l.content,e-a-1,n,i==0?r-1:0,i==t.childCount-1?s-1:0,l);return c&&t.replaceChild(i,l.copy(c))}function cy(t,e,n){if(n.openStart>t.depth)throw new ss("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ss("Inconsistent open depths");return Gf(t,e,n,0)}function Gf(t,e,n,r){let s=t.index(r),o=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let i=Gf(t,e,n,r+1);return o.copy(o.content.replaceChild(s,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,a=i.content;return Dn(i,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=uy(n,t);return Dn(o,Qf(t,i,a,e,r))}else return Dn(o,ao(t,e,r))}function Xf(t,e){if(!e.type.compatibleContent(t.type))throw new ss("Cannot join "+e.type.name+" onto "+t.type.name)}function xa(t,e,n){let r=t.node(n);return Xf(r,e.node(n)),r}function En(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Wr(t,e,n,r){let s=(e||t).node(n),o=0,i=e?e.index(n):s.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(En(t.nodeAfter,r),o++));for(let a=o;a<i;a++)En(s.child(a),r);e&&e.depth==n&&e.textOffset&&En(e.nodeBefore,r)}function Dn(t,e){if(!t.type.validContent(e))throw new ss("Invalid content for node "+t.type.name);return t.copy(e)}function Qf(t,e,n,r,s){let o=t.depth>s&&xa(t,e,s+1),i=r.depth>s&&xa(n,r,s+1),a=[];return Wr(null,t,s,a),o&&i&&e.index(s)==n.index(s)?(Xf(o,i),En(Dn(o,Qf(t,e,n,r,s+1)),a)):(o&&En(Dn(o,ao(t,e,s+1)),a),Wr(e,n,s,a),i&&En(Dn(i,ao(n,r,s+1)),a)),Wr(r,null,s,a),new $(a)}function ao(t,e,n){let r=[];if(Wr(null,t,n,r),t.depth>n){let s=xa(t,e,n+1);En(Dn(s,ao(t,e,n+1)),r)}return Wr(e,null,n,r),new $(r)}function uy(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)s=e.node(o).copy($.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class is{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new lo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(o),c=o-l;if(r.push(i,a,s+l),!c||(i=i.child(a),i.isText))break;o=c-1,s+=l+1}return new is(n,r,o)}static resolveCached(e,n){let r=Qc.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==n)return i}else Qc.set(e,r=new dy);let s=r.elts[r.i]=is.resolve(e,n);return r.i=(r.i+1)%fy,s}}class dy{constructor(){this.elts=[],this.i=0}}const fy=12,Qc=new WeakMap;class lo{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const hy=Object.create(null);let On=class ba{constructor(e,n,r,s=le.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||$.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&io(this.attrs,n||e.defaultAttrs||hy)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new ba(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ba(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return F.empty;let s=this.resolve(e),o=this.resolve(n),i=r?0:s.sharedDepth(n),a=s.start(i),c=s.node(i).content.cut(s.pos-a,o.pos-a);return new F(c,s.depth-i,o.depth-i)}replace(e,n,r){return cy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return is.resolveCached(this,e)}resolveNoCache(e){return is.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Zf(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=$.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),a=i&&i.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=le.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=$.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,s,r);return o.type.checkAttrs(o.attrs),o}};On.prototype.text=void 0;class co extends On{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zf(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new co(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new co(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Zf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new py(e,n);if(r.next==null)return Hn.empty;let s=eh(r);r.next&&r.err("Unexpected trailing text");let o=ky(vy(s));return Sy(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function o(i,a){let l=i.matchFragment(e,r);if(l&&(!n||l.validEnd))return $.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,a.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let a=s;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:a,next:l}=o.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
1
+ import{r as L,c as _,b as J,ar as m1,j as p,h as hf,B as Ln,ag as Uc,ae as g1,aq as y1,cG as pf,cH as x1,aB as b1,be as $n,cI as v1,l as G,o as k1,a1 as _n,a2 as Bn,a4 as zn,bu as S1,br as pl,by as C1,bx as w1,cJ as N1,bv as M1,cK as T1,bt as E1,G as xt,n as mf,a7 as gf,e as D1,K as ht,t as fa,m as ni,E as yf,bb as xf,a9 as O1,cL as bf,p as A1,bl as vf,bm as kf,bn as Sf,bo as Cf,d as ml,cM as I1,cN as j1,bB as qc,b6 as R1}from"./index-D6kz3ebr.js";import{aJ as P1,b0 as L1,b1 as $1,C as _1,k as B1,u as ha,aq as z1,i as Kc,aC as F1,m as H1,b2 as W1,a_ as wf,b3 as V1,j as pa,b4 as Nf,A as Mf,b5 as wt,b6 as U1,W as q1,h as K1,z as J1,b7 as Y1,b8 as G1}from"./agent-icon-BMTcgZga.js";import{i as ma}from"./ChevronRight-r0gLJbn2.js";import{u as X1}from"./useInfiniteQuery-ctaGuyQM.js";import{a as Tf,u as Q1}from"./use-connection-Cxk618DD.js";import{h as Z1,u as gl,p as e0,i as Ef,a as Df,S as t0}from"./use-mcp-client-BS1HAuw9.js";import{a as n0}from"./use-virtual-mcp-Ck5PGc0k.js";import{c as r0,e as s0,a as Of,d as Tr,b as o0,T as Er}from"./table-Co1Yo9Ou.js";import{E as Jc}from"./empty-state-UGFooPJ_.js";import{u as Af}from"./use-infinite-scroll-UlP3mdDG.js";import{a as i0}from"./use-members-BPrB4_B6.js";import{i as yl}from"./AlertCircle-C2I0CPt8.js";import{i as a0}from"./CheckCircle-Cbkf0Hrm.js";import{a as l0}from"./DotsVertical-Cyt1EoXA.js";import{i as c0}from"./XCircle-CiIZAkGm.js";import{e as u0}from"./use-automations-HZOOTOR3.js";import{u as d0}from"./useSuspenseInfiniteQuery-IjFUp4RN.js";import{A as f0}from"./avatar-CPkw3h7t.js";import{t as If,n as h0}from"./ChevronUp-CBLrm_OT.js";import{t as p0,b as jf,n as Rf}from"./Tool02-Dx9QVS5U.js";import{t as ri}from"./Stars01-CFR1c-1g.js";import{i as Pf}from"./ArrowRight-Cr3akrFT.js";import{i as xl}from"./Check-sicxXYN7.js";import{a as Lf}from"./Copy01-BzbXBjHv.js";import{b as Fn,t as bl,c as Yc}from"./format-time-BtXRrtv4.js";import{u as $f}from"./use-copy-JToNQsYl.js";import{M as vl,I as m0}from"./markdown-DOFXhXXc.js";import{g as g0,a as y0,r as x0,d as b0}from"./hooks-BJUiYjpq.js";import{k as wr,q as v0,b as vs,a as k0,D as S0}from"./chat-context-CvoU8WQ4.js";import{c as C0}from"./monaco-editor-BncUqSbn.js";import{M as w0}from"./mcp-app-renderer-DzI0XDOX.js";import{g as _f}from"./types-CaQxQn--.js";import{s as N0}from"./Eye-QPQVcqGb.js";import{s as M0}from"./XClose-hM3AAAai.js";import{b as T0,a as E0}from"./Tool01-DCz0PgHD.js";import{i as D0}from"./Share07-DzTdSg05.js";import{i as O0}from"./SearchMd-CnBFXj_Z.js";import{u as A0,a as I0}from"./shell-layout-DtX3xYLo.js";import{a as kl}from"./use-panel-navigate-Bnu_Y_WK.js";import{a as Ps}from"./Image01-B1m-gUl3.js";import{n as Bf}from"./LinkExternal01-BepJT7Oz.js";import{I as Kn}from"./integration-icon-BQARLIol.js";import{b as Sl}from"./Users03-DPq3XXBm.js";import{a as Nt}from"./Palette-BsEqDIgy.js";import{u as zf}from"./use-navigate-to-agent-yGdOMWOW.js";import{i as Ls}from"./Link01-ClTL5UTN.js";import{g as j0}from"./use-mcp-prompts-Bqus7nV6.js";import{d as R0,c as P0,e as L0,b as $0,D as _0}from"./dialog-B0OdXcqs.js";import{F as B0,d as z0,a as F0,e as H0,b as W0,c as V0}from"./form-TWkufiDd.js";import{I as U0}from"./input-SHpohkkd.js";import{i as q0}from"./Globe01-dlVOEKaQ.js";import{i as K0}from"./Monitor01-Bndg-M3Y.js";import{n as J0}from"./Download01-Db1D2BD0.js";import{F as Y0}from"./file-type-icon-DnRMRlEa.js";import{u as G0}from"./use-decopilot-events-w-PNw0gQ.js";const X0={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function Ff(t){if(!t?.providerMetadata)return 0;for(const e of Object.values(X0)){const n=e(t.providerMetadata);if(n!==null)return n}return 0}function Hf(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Wf(t,e){if(!e)return t;const n=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:t.inputTokens+(e.inputTokens??0),outputTokens:t.outputTokens+(e.outputTokens??0),reasoningTokens:t.reasoningTokens+(e.reasoningTokens??0),totalTokens:t.totalTokens+(e.totalTokens??0),cost:t.cost+Ff(e),cacheReadTokens:t.cacheReadTokens+n,cacheWriteTokens:t.cacheWriteTokens+r}}function Cl(t){const e=Math.max(t.inputTokens,t.cacheReadTokens+t.cacheWriteTokens);return e>0?t.cacheReadTokens/e:0}function KO(t){return t.reduce((e,n)=>Wf(e,n.metadata?.usage),Hf())}const Q0={damping:.7,stiffness:.05,mass:1.25},Z0=70,ey=1e3/60,ty=350;let si=!1;globalThis.document?.addEventListener("mousedown",()=>{si=!0});globalThis.document?.addEventListener("mouseup",()=>{si=!1});globalThis.document?.addEventListener("click",()=>{si=!1});const ny=(t={})=>{const[e,n]=L.useState(!1),[r,s]=L.useState(t.initial!==!1),[o,i]=L.useState(!1),a=L.useRef(null);a.current=t;const l=L.useCallback(()=>{if(!si)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const v=b.getRangeAt(0);return v.commonAncestorContainer.contains(g.current)||g.current?.contains(v.commonAncestorContainer)},[]),c=L.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=L.useCallback(b=>{d.escapedFromLock=b,n(b)},[]),d=L.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(v){if(g.current){const{scrollBehavior:k}=getComputedStyle(g.current);k!=="auto"&&(g.current.style.scrollBehavior="auto"),g.current.scrollTop=v,d.ignoreScrollToTop=g.current.scrollTop,k!=="auto"&&(g.current.style.scrollBehavior=k)}},get targetScrollTop(){return!g.current||!x.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!x.current)return 0;const{targetScrollTop:v}=this;if(!t.targetScrollTop)return v;if(b?.targetScrollTop===v)return b.calculatedScrollTop;const k=Math.max(Math.min(t.targetScrollTop(v,{scrollElement:g.current,contentElement:x.current}),v),0);return b={targetScrollTop:v,calculatedScrollTop:k},requestAnimationFrame(()=>{b=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Z0}}},[]),f=L.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const v=Date.now()+(Number(b.wait)||0),k=Mi(a.current,b.animation),{ignoreEscapes:N=!1}=b;let C,S=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{C=Date.now()}):C=v+(b.duration??0);const w=async()=>{const M=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:T}=d,O=performance.now(),A=(O-(d.lastTick??O))/ey;if(d.animation||(d.animation={behavior:k,promise:M,ignoreEscapes:N}),d.animation.behavior===k&&(d.lastTick=O),l()||v>Date.now())return w();if(T<Math.min(S,d.calculatedTargetScrollTop)){if(d.animation?.behavior===k){if(k==="instant")return d.scrollTop=d.calculatedTargetScrollTop,w();d.velocity=(k.damping*d.velocity+k.stiffness*d.scrollDifference)/k.mass,d.accumulated+=d.velocity*A,d.scrollTop+=d.accumulated,d.scrollTop!==T&&(d.accumulated=0)}return w()}return C>Date.now()?(S=d.calculatedTargetScrollTop,w()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:Mi(a.current,a.current.resize),ignoreEscapes:N,duration:Math.max(0,C-Date.now())||void 0}):d.isAtBottom)});return M.then(T=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),T))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===k?d.animation.promise:w()},[c,l,d]),h=L.useCallback(()=>{u(!0),c(!1)},[u,c]),m=L.useCallback(({target:b})=>{if(b!==g.current)return;const{scrollTop:v,ignoreScrollToTop:k}=d;let{lastScrollTop:N=v}=d;d.lastScrollTop=v,d.ignoreScrollToTop=void 0,k&&k>v&&(N=k),i(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||v===k)return;if(l()){u(!0),c(!1);return}const C=v>N,S=v<N;if(d.animation?.ignoreEscapes){d.scrollTop=N;return}S&&(u(!0),c(!1)),C&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,l,d]),y=L.useCallback(({target:b,deltaY:v})=>{let k=b;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===g.current&&v<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),g=Gc(b=>{g.current?.removeEventListener("scroll",m),g.current?.removeEventListener("wheel",y),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",y,{passive:!0})},[]),x=Gc(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let v;d.resizeObserver=new ResizeObserver(([k])=>{const{height:N}=k.contentRect,C=N-(v??N);if(d.resizeDifference=C,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),i(d.isNearBottom),C>=0){const S=Mi(a.current,v?a.current.resize:a.current.initial);f({animation:S,wait:!0,preserveScrollPosition:!0,duration:S==="instant"?void 0:ty})}else d.isNearBottom&&(u(!1),c(!0));v=N,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===C&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:x,scrollRef:g,scrollToBottom:f,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:e,state:d}};function Gc(t,e){const n=L.useCallback(r=>(n.current=r,t(r)),e);return n}const Ni=new Map;function Mi(...t){const e={...Q0};let n=!1;for(const s of t){if(s==="instant"){n=!0;continue}typeof s=="object"&&(n=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const r=JSON.stringify(e);return Ni.has(r)||Ni.set(r,Object.freeze(e)),n?"instant":Ni.get(r)}function ry(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return`a${(e>>>0).toString(36).padStart(6,"0").slice(-6)}`}function wl(t){if(t&&typeof t=="object"&&"gatewayClientId"in t&&typeof t.gatewayClientId=="string")return t.gatewayClientId}function Nl(t,e){if(!e)return t;const n=`${ry(e)}_`;return t.startsWith(n)?t.slice(n.length):t}function sy(t,e){return Nl(t,e).replace(/[_-]/g," ").toLowerCase()}function oy(t,e){const n={};for(const r of t?.arguments??[])n[r.name]=r.required?Uc().min(1,e):Uc();return g1(n)}function iy(t,e){const n={};for(const r of t.arguments??[])n[r.name]=e?.[r.name]??"";return n}function ay(t){const e=_.c(74),{prompt:n,setPrompt:r,onSubmit:s,defaultValues:o}=t,i=L.useId(),a=J();let l,c;if(e[0]!==n||e[1]!==a){const W=oy(n,a("chat.dialogPromptArguments.required"));c=y1,l=m1(W),e[0]=n,e[1]=a,e[2]=l,e[3]=c}else l=e[2],c=e[3];let u;e[4]!==o||e[5]!==n?(u=n?iy(n,o):{},e[4]=o,e[5]=n,e[6]=u):u=e[6];let d;e[7]!==l||e[8]!==u?(d={resolver:l,defaultValues:u,mode:"onChange"},e[7]=l,e[8]=u,e[9]=d):d=e[9];const f=c(d);let h;e[10]!==n?.arguments?(h=n?.arguments??[],e[10]=n?.arguments,e[11]=h):h=e[11];const m=h;let y;e[12]!==f||e[13]!==s||e[14]!==r?(y=async W=>{await s(W),r(null),f.reset()},e[12]=f,e[13]=s,e[14]=r,e[15]=y):y=e[15];const g=y;let x;e[16]!==f||e[17]!==r?(x=W=>{W||(f.reset(),r(null))},e[16]=f,e[17]=r,e[18]=x):x=e[18];const b=x;if(!n)return null;let v;e[19]!==n._meta||e[20]!==n.name||e[21]!==n.title?(v=n.title||sy(n.name,wl(n._meta)),e[19]=n._meta,e[20]=n.name,e[21]=n.title,e[22]=v):v=e[22];let k;e[23]!==v?(k=p.jsx(R0,{children:p.jsx("span",{className:"capitalize",children:v})}),e[23]=v,e[24]=k):k=e[24];let N;e[25]!==n.description?(N=n.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[25]=n.description,e[26]=N):N=e[26];let C;e[27]!==N||e[28]!==k?(C=p.jsxs(P0,{children:[k,N]}),e[27]=N,e[28]=k,e[29]=C):C=e[29];let S;e[30]!==f||e[31]!==g?(S=W=>{W.stopPropagation(),f.handleSubmit(g)(W)},e[30]=f,e[31]=g,e[32]=S):S=e[32];let w;if(e[33]!==m||e[34]!==f.control||e[35]!==f.formState.isSubmitting||e[36]!==a){let W;e[38]!==f.control||e[39]!==f.formState.isSubmitting||e[40]!==a?(W=q=>p.jsx(z0,{control:f.control,name:q.name,render:X=>{const{field:te}=X;return p.jsxs(F0,{children:[p.jsxs(H0,{className:"text-xs",children:[q.name,q.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ",a("chat.dialogPromptArguments.optional")]})]}),p.jsx(W0,{children:p.jsx(U0,{...te,value:te.value??"",required:q.required,placeholder:q.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(V0,{})]})}},q.name),e[38]=f.control,e[39]=f.formState.isSubmitting,e[40]=a,e[41]=W):W=e[41],w=m.map(W),e[33]=m,e[34]=f.control,e[35]=f.formState.isSubmitting,e[36]=a,e[37]=w}else w=e[37];let M;e[42]!==b?(M=()=>b(!1),e[42]=b,e[43]=M):M=e[43];const T=f.formState.isSubmitting;let O;e[44]!==a?(O=a("chat.dialogPromptArguments.cancel"),e[44]=a,e[45]=O):O=e[45];let A;e[46]!==f.formState.isSubmitting||e[47]!==M||e[48]!==O?(A=p.jsx(Ln,{type:"button",variant:"ghost",onClick:M,disabled:T,children:O}),e[46]=f.formState.isSubmitting,e[47]=M,e[48]=O,e[49]=A):A=e[49];let P;e[50]!==f.formState.isSubmitting||e[51]!==a?(P=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(hf,{size:"xs"}),a("chat.dialogPromptArguments.loading")]}):a("chat.dialogPromptArguments.usePrompt"),e[50]=f.formState.isSubmitting,e[51]=a,e[52]=P):P=e[52];let D;e[53]!==f.formState.isSubmitting||e[54]!==i||e[55]!==P?(D=p.jsx(Ln,{type:"submit",form:i,disabled:f.formState.isSubmitting,children:P}),e[53]=f.formState.isSubmitting,e[54]=i,e[55]=P,e[56]=D):D=e[56];let E;e[57]!==A||e[58]!==D?(E=p.jsxs(L0,{children:[A,D]}),e[57]=A,e[58]=D,e[59]=E):E=e[59];let j;e[60]!==i||e[61]!==S||e[62]!==w||e[63]!==E?(j=p.jsxs("form",{id:i,className:"space-y-4 py-4",autoComplete:"off",onSubmit:S,children:[w,E]}),e[60]=i,e[61]=S,e[62]=w,e[63]=E,e[64]=j):j=e[64];let I;e[65]!==f||e[66]!==j?(I=p.jsx(B0,{...f,children:j}),e[65]=f,e[66]=j,e[67]=I):I=e[67];let R;e[68]!==C||e[69]!==I?(R=p.jsxs($0,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[68]=C,e[69]=I,e[70]=R):R=e[70];let z;return e[71]!==b||e[72]!==R?(z=p.jsx(_0,{open:!0,onOpenChange:b,children:R}),e[71]=b,e[72]=R,e[73]=z):z=e[73],z}function ga(t){return t?t.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function It(t,e){return t==="output-error"||t==="output-denied"?"error":t==="approval-requested"?"approval":t==="input-streaming"||t==="input-available"||t==="output-available"&&e===!0?"loading":"idle"}function Nr(t){if(t==null||typeof t!="object")return;const e=t;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const n=e.content[0];if(n?.type==="text"&&typeof n.text=="string")try{return JSON.parse(n.text)}catch{return}return}return t}var Xc=Object.defineProperty,ly=(t,e)=>{let n={};for(var r in t)Xc(n,r,{get:t[r],enumerable:!0});return Xc(n,Symbol.toStringTag,{value:"Module"}),n};function Ie(t){this.content=t}Ie.prototype={constructor:Ie,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,s=r.find(t),o=r.content.slice();return s==-1?o.push(n||t,e):(o[s+1]=e,n&&(o[s]=n)),new Ie(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ie(n)},addToStart:function(t,e){return new Ie([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ie(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),o=r.find(t);return s.splice(o==-1?s.length:o,0,e,n),new Ie(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ie.from(t),t.size?new Ie(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ie.from(t),t.size?new Ie(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ie.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ie.from=function(t){if(t instanceof Ie)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ie(e)};function Vf(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),o=e.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){let i=s.text,a=o.text,l=0;for(;i[l]==a[l];l++)n++;return l&&l<i.length&&l<a.length&&Kf(i.charCodeAt(l-1))&&qf(i.charCodeAt(l))&&n--,n}if(s.content.size||o.content.size){let i=Vf(s.content,o.content,n+1);if(i!=null)return i}n+=s.nodeSize}}function Uf(t,e,n,r){for(let s=t.childCount,o=e.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let i=t.child(--s),a=e.child(--o),l=i.nodeSize;if(i==a){n-=l,r-=l;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let c=i.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&Kf(c.charCodeAt(d-1))&&qf(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(i.content.size||a.content.size){let c=Uf(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}function qf(t){return t>=56320&&t<57344}function Kf(t){return t>=55296&&t<56320}class ${constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,s=0,o){for(let i=0,a=0;a<n;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&r(l,s+a,o||null,i)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let o="",i=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)s.push(e.content[o]);return new $(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let o=0,i=0;i<n;o++){let a=this.content[o],l=i+a.nodeSize;l>e&&((i<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,n-i-1))),r.push(a),s+=a.nodeSize),i=l}return new $(r,s)}cutByIndex(e,n){return e==n?$.empty:e==0&&n==this.content.length?this:new $(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new $(s,o)}addToStart(e){return new $([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new $(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return Vf(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Uf(this,e,n,r)}findIndex(e){if(e==0)return $s(0,e);if(e==this.size)return $s(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=e)return o==e?$s(n+1,o):$s(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return $.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return $.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return $.empty;let n,r=0;for(let s=0;s<e.length;s++){let o=e[s];r+=o.nodeSize,s&&o.isText&&e[s-1].sameMarkup(o)?(n||(n=e.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new $(n||e,r)}static from(e){if(!e)return $.empty;if(e instanceof $)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new $([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}$.empty=new $([],0);const Ti={index:0,offset:0};function $s(t,e){return Ti.index=t,Ti.offset=e,Ti}function io(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!io(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!io(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let le=class ya{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let o=e[s];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,s));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&io(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ya.none;if(e instanceof ya)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};le.none=[];class ss extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Yf(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(Jf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return F.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F($.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new F(e,r,s)}}F.empty=new F($.empty,0,0);function Jf(t,e,n){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r),{index:i,offset:a}=t.findIndex(n);if(s==e||o.isText){if(a!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Jf(o.content,e-s-1,n-s-1)))}function Yf(t,e,n,r,s,o){let{index:i,offset:a}=t.findIndex(e),l=t.maybeChild(i);if(a==e||l.isText)return o&&r<=0&&s<=0&&!o.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Yf(l.content,e-a-1,n,i==0?r-1:0,i==t.childCount-1?s-1:0,l);return c&&t.replaceChild(i,l.copy(c))}function cy(t,e,n){if(n.openStart>t.depth)throw new ss("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ss("Inconsistent open depths");return Gf(t,e,n,0)}function Gf(t,e,n,r){let s=t.index(r),o=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let i=Gf(t,e,n,r+1);return o.copy(o.content.replaceChild(s,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,a=i.content;return Dn(i,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=uy(n,t);return Dn(o,Qf(t,i,a,e,r))}else return Dn(o,ao(t,e,r))}function Xf(t,e){if(!e.type.compatibleContent(t.type))throw new ss("Cannot join "+e.type.name+" onto "+t.type.name)}function xa(t,e,n){let r=t.node(n);return Xf(r,e.node(n)),r}function En(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Wr(t,e,n,r){let s=(e||t).node(n),o=0,i=e?e.index(n):s.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(En(t.nodeAfter,r),o++));for(let a=o;a<i;a++)En(s.child(a),r);e&&e.depth==n&&e.textOffset&&En(e.nodeBefore,r)}function Dn(t,e){if(!t.type.validContent(e))throw new ss("Invalid content for node "+t.type.name);return t.copy(e)}function Qf(t,e,n,r,s){let o=t.depth>s&&xa(t,e,s+1),i=r.depth>s&&xa(n,r,s+1),a=[];return Wr(null,t,s,a),o&&i&&e.index(s)==n.index(s)?(Xf(o,i),En(Dn(o,Qf(t,e,n,r,s+1)),a)):(o&&En(Dn(o,ao(t,e,s+1)),a),Wr(e,n,s,a),i&&En(Dn(i,ao(n,r,s+1)),a)),Wr(r,null,s,a),new $(a)}function ao(t,e,n){let r=[];if(Wr(null,t,n,r),t.depth>n){let s=xa(t,e,n+1);En(Dn(s,ao(t,e,n+1)),r)}return Wr(e,null,n,r),new $(r)}function uy(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)s=e.node(o).copy($.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class is{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)s+=r.child(o).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return le.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new lo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(o),c=o-l;if(r.push(i,a,s+l),!c||(i=i.child(a),i.isText))break;o=c-1,s+=l+1}return new is(n,r,o)}static resolveCached(e,n){let r=Qc.get(e);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==n)return i}else Qc.set(e,r=new dy);let s=r.elts[r.i]=is.resolve(e,n);return r.i=(r.i+1)%fy,s}}class dy{constructor(){this.elts=[],this.i=0}}const fy=12,Qc=new WeakMap;class lo{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const hy=Object.create(null);let On=class ba{constructor(e,n,r,s=le.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||$.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,s=0){this.content.nodesBetween(e,n,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,s){return this.content.textBetween(e,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&io(this.attrs,n||e.defaultAttrs||hy)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new ba(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ba(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return F.empty;let s=this.resolve(e),o=this.resolve(n),i=r?0:s.sharedDepth(n),a=s.start(i),c=s.node(i).content.cut(s.pos-a,o.pos-a);return new F(c,s.depth-i,o.depth-i)}replace(e,n,r){return cy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return is.resolveCached(this,e)}resolveNoCache(e){return is.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Zf(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=$.empty,s=0,o=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,s,o),a=i&&i.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=le.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=$.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,s,r);return o.type.checkAttrs(o.attrs),o}};On.prototype.text=void 0;class co extends On{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zf(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new co(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new co(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Zf(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new py(e,n);if(r.next==null)return Hn.empty;let s=eh(r);r.next&&r.err("Unexpected trailing text");let o=ky(vy(s));return Sy(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(e.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let s=[this];function o(i,a){let l=i.matchFragment(e,r);if(l&&(!n||l.validEnd))return $.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=o(d,a.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(e)){let i=[];for(let a=s;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:a,next:l}=o.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return o}).join(`
2
2
  `)}}Hn.empty=new Hn(!0);class py{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function eh(t){let e=[];do e.push(my(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function my(t){let e=[];do e.push(gy(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function gy(t){let e=by(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=yy(t,e);else break;return e}function Zc(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function yy(t,e){let n=Zc(t),r=n;return t.eat(",")&&(t.next!="}"?r=Zc(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function xy(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let o in n){let i=n[o];i.isInGroup(e)&&s.push(i)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function by(t){if(t.eat("(")){let e=eh(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=xy(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function vy(t){let e=[[]];return s(o(t,0),n()),e;function n(){return e.push([])-1}function r(i,a,l){let c={term:l,to:a};return e[i].push(c),c}function s(i,a){i.forEach(l=>l.to=a)}function o(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=o(i.exprs[l],a);if(l==i.exprs.length-1)return c;s(c,a=n())}else if(i.type=="star"){let l=n();return r(a,l),s(o(i.expr,l),l),[r(l)]}else if(i.type=="plus"){let l=n();return s(o(i.expr,a),l),s(o(i.expr,l),l),[r(l)]}else{if(i.type=="opt")return[r(a)].concat(o(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let u=n();s(o(i.expr,l),u),l=u}if(i.max==-1)s(o(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let u=n();r(l,u),s(o(i.expr,l),u),l=u}return[r(l)]}else{if(i.type=="name")return[r(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function th(t,e){return e-t}function eu(t,e){let n=[];return r(e),n.sort(th);function r(s){let o=t[s];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(s);for(let i=0;i<o.length;i++){let{term:a,to:l}=o[i];!a&&n.indexOf(l)==-1&&r(l)}}}function ky(t){let e=Object.create(null);return n(eu(t,0));function n(r){let s=[];r.forEach(i=>{t[i].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);eu(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Hn(r.indexOf(t.length-1)>-1);for(let i=0;i<s.length;i++){let a=s[i][1].sort(th);o.next.push({type:s[i][0],next:e[a.join(",")]||n(a)})}return o}}function Sy(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],o=!s.validEnd,i=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];i.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function nh(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function rh(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let o=t[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function sh(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}function oh(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new wy(t,r,e[r]);return n}let tu=class ih{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=oh(e,r.attrs),this.defaultAttrs=nh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Hn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:rh(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new On(this,this.computeAttrs(e),$.from(n),le.setFrom(r))}createChecked(e=null,n,r){return n=$.from(n),this.checkContent(n),new On(this,this.computeAttrs(e),n,le.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=$.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let s=this.contentMatch.matchFragment(n),o=s&&s.fillBefore($.empty,!0);return o?new On(this,e,n.append(o),le.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){sh(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:le.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,i)=>r[o]=new ih(o,n,i));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Cy(t,e,n){let r=n.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class wy{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Cy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class oi{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=oh(e,s.attrs),this.excluded=null;let o=nh(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,rh(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((o,i)=>r[o]=new oi(o,s++,n,i)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){sh(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ah{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Ie.from(e.nodes),n.marks=Ie.from(e.marks||{}),this.nodes=tu.compile(this.spec.nodes,this),this.marks=oi.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],i=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=Hn.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?nu(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:nu(this,i.split(" "))}this.nodeFromJSON=s=>On.fromJSON(this,s),this.markFromJSON=s=>le.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof tu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new co(r,r.defaultAttrs,e,le.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function nu(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],o=t.marks[s],i=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Ny(t){return t.tag!=null}function My(t){return t.style!=null}class Et{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(Ny(s))this.tags.push(s);else if(My(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=e.nodes[s.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new su(this,n,!1);return r.addAll(e,le.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new su(this,n,!0);return r.addAll(e,le.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(Dy(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(e);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(e,n,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],a=i.style;if(!(a.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(i.getAttrs){let l=i.getAttrs(n);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(e){let n=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<n.length;i++){let a=n[i];if((a.priority==null?50:a.priority)<o)break}n.splice(i,0,s)}for(let s in e.marks){let o=e.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ou(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in e.nodes){let o=e.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=ou(i)),i.node||i.ignore||i.mark||(i.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Et(e,Et.schemaRules(e)))}}const lh={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ty={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ch={ol:!0,ul:!0},as=1,va=2,Vr=4;function ru(t,e,n){return e!=null?(e?as:0)|(e==="full"?va:0):t&&t.whitespace=="pre"?as|va:n&~Vr}class _s{constructor(e,n,r,s,o,i){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=le.none,this.match=o||(i&Vr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore($.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&as)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let n=$.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore($.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class su{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,o,i=ru(null,n.preserveWhitespace,0)|(r?Vr:0);s?o=new _s(s.type,s.attrs,le.none,!0,n.topMatch||s.type.contentMatch,i):r?o=new _s(null,null,le.none,!0,null,i):o=new _s(e.schema.topNodeType,null,le.none,!0,null,i),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,o=s.options&va?"full":this.localPreserveWS||(s.options&as)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(i.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),a;ch.hasOwnProperty(i)&&this.parser.normalizeLists&&Ey(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Ty.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(lh.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(o,i,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let o,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(i,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,s){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];i!=a;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,n);this.findAtPoint(e,o)}findPlace(e,n,r){let s,o;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,o=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)n=this.enterInner(s[i],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=le.none;for(let a of s.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):iu(a.type,e.type))&&(i=a.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,n,r,s){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,s)),o}enterInner(e,n,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=ru(e,o,i.options);i.options&Vr&&i.content.length==0&&(a|=Vr);let l=le.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):iu(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new _s(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=as)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(i(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return i(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Ey(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ch.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Dy(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ou(t){let e={};for(let n in t)e[n]=t[n];return e}function iu(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let o=[],i=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&i(u))return!0}};if(i(s.contentMatch))return!0}}class qt{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Bs(n).createDocumentFragment());let s=r,o=[];return e.forEach(i=>{if(o.length||i.marks.length){let a=0,l=0;for(;a<o.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)s=o.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],u=this.serializeMark(c,i.isInline,n);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){if(e.isText)return Bs(n).createTextNode(e.text);let{dom:r,contentDOM:s}=Zs(Bs(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let o=this.serializeMark(e.marks[s],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Zs(Bs(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:Zs(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new qt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=au(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return au(e.marks)}}function au(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Bs(t){return t.document||window.document}const lu=new WeakMap;function Oy(t){let e=lu.get(t);return e===void 0&&lu.set(t,e=Ay(t)),e}function Ay(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Zs(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Oy(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=s.indexOf(" ");i>0&&(n=s.slice(0,i),s=s.slice(i+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:m}=Zs(t,f,n,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const uh=65535,dh=Math.pow(2,16);function Iy(t,e){return t+e*dh}function cu(t){return t&uh}function jy(t){return(t-(t&uh))/dh}const fh=1,hh=2,eo=4,ph=8;class ka{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ph)>0}get deletedBefore(){return(this.delInfo&(fh|eo))>0}get deletedAfter(){return(this.delInfo&(hh|eo))>0}get deletedAcross(){return(this.delInfo&eo)>0}}class et{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&et.empty)return et.empty}recover(e){let n=0,r=cu(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+jy(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+o],u=this.ranges[a+i],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+s+(f<0?0:u);if(r)return h;let m=e==(n<0?l:d)?null:Iy(a/3,e-l),y=e==l?hh:e==d?fh:eo;return(n<0?e!=l:e!=d)&&(y|=ph),new ka(h,y,m)}s+=u-c}return r?e+s:new ka(e+s,0,null)}touches(e,n){let r=0,s=cu(n),o=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],a=i-(this.inverted?o:0),l=i+(this.inverted?0:o),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new et(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?et.empty:new et(e<0?[0,-e,0]:[0,0,e])}}et.empty=new et([]);class ls{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ls(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new ls;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],a=i.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new ka(e,s,null)}}const Ei=Object.create(null);class Fe{getMap(){return et.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ei[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ei)throw new RangeError("Duplicate use of step JSON ID "+e);return Ei[e]=n,n.prototype.jsonID=e,n}}class ke{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ke(e,null)}static fail(e){return new ke(null,e)}static fromReplace(e,n,r,s){try{return ke.ok(e.replace(n,r,s))}catch(o){if(o instanceof ss)return ke.fail(o.message);throw o}}}function Ml(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let o=t.child(s);o.content.size&&(o=o.copy(Ml(o.content,e,o))),o.isInline&&(o=e(o,n,s)),r.push(o)}return $.fromArray(r)}class sn extends Fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new F(Ml(n.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),n.openStart,n.openEnd);return ke.fromReplace(e,this.from,this.to,o)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new sn(n.pos,r.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}Fe.jsonID("addMark",sn);class pt extends Fe{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new F(Ml(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return ke.fromReplace(e,this.from,this.to,r)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new pt(n.pos,r.pos,this.mark)}merge(e){return e instanceof pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pt(n.from,n.to,e.markFromJSON(n.mark))}}Fe.jsonID("removeMark",pt);class on extends Fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ke.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ke.fromReplace(e,this.pos,this.pos+1,new F($.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new on(this.pos,n.marks[s]);return new on(this.pos,this.mark)}}return new Wn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new on(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new on(n.pos,e.markFromJSON(n.mark))}}Fe.jsonID("addNodeMark",on);class Wn extends Fe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ke.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ke.fromReplace(e,this.pos,this.pos+1,new F($.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new on(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wn(n.pos,e.markFromJSON(n.mark))}}Fe.jsonID("removeNodeMark",Wn);class ve extends Fe{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Sa(e,this.from,this.to)?ke.fail("Structure replace would overwrite content"):ke.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new et([this.from,this.to-this.from,this.slice.size])}invert(e){return new ve(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&ve.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new ve(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ve)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ve(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ve(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ve(n.from,n.to,F.fromJSON(e,n.slice),!!n.structure)}}ve.MAP_BIAS=1;Fe.jsonID("replace",ve);class Oe extends Fe{constructor(e,n,r,s,o,i,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=a}apply(e){if(this.structure&&(Sa(e,this.from,this.gapFrom)||Sa(e,this.gapTo,this.to)))return ke.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ke.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ke.fromReplace(e,this.from,this.to,r):ke.fail("Content does not fit in gap")}getMap(){return new et([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Oe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||o>r.pos?null:new Oe(n.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Oe(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}Fe.jsonID("replaceAround",Oe);function Sa(t,e,n){let r=t.resolve(e),s=n-e,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function Ry(t,e,n,r){let s=[],o=[],i,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let y=0;y<d.length;y++)d[y].isInSet(m)||(i&&i.to==f&&i.mark.eq(d[y])?i.to=h:s.push(i=new pt(f,h,d[y])));a&&a.to==f?a.to=h:o.push(a=new sn(f,h,r))}}),s.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function Py(t,e,n,r){let s=[],o=0;t.doc.nodesBetween(e,n,(i,a)=>{if(!i.isInline)return;o++;let l=null;if(r instanceof oi){let c=i.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(l=[r]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==o-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=o):s.push({style:d,from:Math.max(a,e),to:c,step:o})}}}),s.forEach(i=>t.step(new pt(i.from,i.to,i.style)))}function Tl(t,e,n,r=n.contentMatch,s=!0){let o=t.doc.nodeAt(e),i=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new ve(a,u,F.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new pt(a,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new F($.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new ve(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore($.empty,!0);t.replace(a,a,new F(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function Ly(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Mr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,o=0;;--r){let i=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-o;if(r<t.depth&&i.canReplace(a,l,n))return r;if(r==0||i.type.spec.isolating||!Ly(i,a,l))break;a&&(s=1),l<i.childCount&&(o=1)}return null}function $y(t,e,n){let{$from:r,$to:s,depth:o}=e,i=r.before(o+1),a=s.after(o+1),l=i,c=a,u=$.empty,d=0;for(let m=o,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,u=$.from(r.node(m).copy(u)),d++):l--;let f=$.empty,h=0;for(let m=o,y=!1;m>n;m--)y||s.after(m+1)<s.end(m)?(y=!0,f=$.from(s.node(m).copy(f)),h++):c++;t.step(new Oe(l,c,i,a,new F(u.append(f),d,h),u.size-d,!0))}function El(t,e,n=null,r=t){let s=_y(t,e),o=s&&By(r,e);return o?s.map(uu).concat({type:e,attrs:n}).concat(o.map(uu)):null}function uu(t){return{type:t,attrs:null}}function _y(t,e){let{parent:n,startIndex:r,endIndex:s}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let i=o.length?o[0]:e;return n.canReplaceWith(r,s,i)?o:null}function By(t,e){let{parent:n,startIndex:r,endIndex:s}=t,o=n.child(r),i=e.contentMatch.findWrapping(o.type);if(!i)return null;let l=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:i}function zy(t,e,n){let r=$.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let a=n[i].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=$.from(n[i].type.create(n[i].attrs,r))}let s=e.start,o=e.end;t.step(new Oe(s,o,s,o,new F(r,0,0),n.length,!0))}function Fy(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(i,a)=>{let l=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,l)&&Hy(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&gh(t,i,a,o),Tl(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let u=t.mapping.slice(o),d=u.map(a,1),f=u.map(a+i.nodeSize,1);return t.step(new Oe(d,f,d+1,f-1,new F($.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&mh(t,i,a,o),!1}})}function mh(t,e,n,r){e.forEach((s,o)=>{if(s.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+o+i.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function gh(t,e,n,r){e.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+o);t.replaceWith(i,i+1,e.type.schema.text(`
@@ -95,7 +95,7 @@ img.ProseMirror-separator {
95
95
  display: block;
96
96
  }`;var L2=class extends Xk{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:wk,createMappablePosition:Nk},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Pa(e,this.options.autofocus);this.editorState=Cn.create({doc:e,schema:this.schema,selection:n||void 0})}j2(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():hr.createFakeChain()}can(){return this.commandManager?this.commandManager.can():hr.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=f2(P2,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=Pp(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=n.filter(i=>!i.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[M2,S2.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),C2,E2,D2,A2.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),N2,O2,w2,I2.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new mi(n,this)}createCommandManager(){this.commandManager=new hr({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=$a(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=$a(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Cn.create({doc:n,schema:this.schema,selection:Pa(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,i=this.extensionManager.transformPastedHTML(o);this.editorView=new Cp(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:s,transformPastedHTML:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=i?.getMeta("focus"),l=i?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:i}),l&&this.emit("blur",{editor:this,event:l.event,transaction:i}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return zp(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return vk(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Kl(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
97
97
 
98
- `,textSerializers:n={}}=t||{};return hk(this.state.doc,{blockSeparator:e,textSerializers:{...Bp(this.schema),...n}})}get isEmpty(){return Ms(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new R2(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Un(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=oe(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=e,i=r[r.length-1],a=r[0];if(i){const l=a.search(/\S/),c=n.from+a.indexOf(i),u=c+i.length;if(Yl(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+l,c);const d=n.from+l+i.length;o.addMark(n.from+l,d,t.type.create(s||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function $2(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=oe(t.getAttributes,void 0,r)||{},{tr:o}=e,i=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){let c=i+r[0].lastIndexOf(r[1]);c>a?c=a:a=c+r[1].length;const u=r[0][r[0].length-1];o.insertText(u,i+r[0].length-1),o.replaceWith(c,a,l)}else if(r[0]){const c=t.type.isInline?i:i-1;o.insert(c,t.type.create(s)).delete(o.mapping.map(i),o.mapping.map(a))}o.scrollIntoView()},undoable:t.undoable})}function Ba(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),o=oe(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function Sr(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const o=oe(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),l=a&&El(a,t.type,o);if(!l)return null;if(i.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(y=>f.includes(y.type.name));i.ensureMarks(m)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,o).run()}const c=i.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&pn(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&i.join(n.from-1)},undoable:t.undoable})}const _2=t=>"touches"in t;var rA=class{constructor(t){var e,n,r,s,o,i;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((s=t.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((o=t.options)===null||o===void 0)&&o.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((i=t.options)===null||i===void 0)&&i.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),o=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),o&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,_2(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),o=this.applyConstraints(r,s,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const o=t.includes("right"),i=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return o?r=this.startWidth+e:i&&(r=this.startWidth-e),a?s=this.startHeight+n:l&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(o?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s;if(!n){var o,i;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((o=this.maxSize)===null||o===void 0)&&o.width&&(c=Math.min(this.maxSize.width,c)),!((i=this.maxSize)===null||i===void 0)&&i.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},qe=class em extends Gl{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new em(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},B2=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,s=t.target,o=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(s)||!o)return;let i=0,a=0;if(this.dom!==o){var l,c,u,d;const b=this.dom.getBoundingClientRect(),v=o.getBoundingClientRect(),k=(l=t.offsetX)!==null&&l!==void 0?l:(c=t.nativeEvent)===null||c===void 0?void 0:c.offsetX,N=(u=t.offsetY)!==null&&u!==void 0?u:(d=t.nativeEvent)===null||d===void 0?void 0:d.offsetY;i=v.x-b.x+k,a=v.y-b.y+N}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var m;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(m=t.dataTransfer)===null||m===void 0||m.setDragImage(f,i,a)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const y=this.getPos();if(typeof y!="number")return;const g=H.create(r.state.doc,y),x=r.state.tr.setSelection(g);r.dispatch(x)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(n))))return!1;const r=t.type.startsWith("drag"),s=t.type==="dragover"||t.type==="dragenter",o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;const{isEditable:i}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=H.isSelectable(this.node),u=t.type==="copy",d=t.type==="paste",f=t.type==="cut",h=t.type==="mousedown";if(!l&&c&&r&&t.target===this.dom&&t.preventDefault(),l&&r&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(l&&i&&!a&&h){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||o||u||d||f||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(hs()||La())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function hn(t){return new Qp({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const o=oe(t.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Yl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+a.length,i.addMark(n.from+u,c,t.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||i.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:z2,getOwnPropertySymbols:F2}=Object,{hasOwnProperty:H2}=Object.prototype;function Wi(t,e){return function(r,s,o){return t(r,s,o)&&e(r,s,o)}}function Vs(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:o}=s,i=o.get(n),a=o.get(r);if(i&&a)return i===r&&a===n;o.set(n,r),o.set(r,n);const l=t(n,r,s);return o.delete(n),o.delete(r),l}}function W2(t){return t?.[Symbol.toStringTag]}function ud(t){return z2(t).concat(F2(t))}const V2=Object.hasOwn||((t,e)=>H2.call(t,e));function Yn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const U2="__v",q2="__o",K2="_owner",{getOwnPropertyDescriptor:dd,keys:fd}=Object;function J2(t,e){return t.byteLength===e.byteLength&&yo(new Uint8Array(t),new Uint8Array(e))}function Y2(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function G2(t,e){return t.byteLength===e.byteLength&&yo(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function X2(t,e){return Yn(t.getTime(),e.getTime())}function Q2(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Z2(t,e){return t===e}function hd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.entries();let i,a,l=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(s[d]){d++;continue}const f=i.value,h=a.value;if(n.equals(f[0],h[0],l,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;l++}return!0}const eS=Yn;function tS(t,e,n){const r=fd(t);let s=r.length;if(fd(e).length!==s)return!1;for(;s-- >0;)if(!tm(t,e,n,r[s]))return!1;return!0}function Ir(t,e,n){const r=ud(t);let s=r.length;if(ud(e).length!==s)return!1;let o,i,a;for(;s-- >0;)if(o=r[s],!tm(t,e,n,o)||(i=dd(t,o),a=dd(e,o),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function nS(t,e){return Yn(t.valueOf(),e.valueOf())}function rS(t,e){return t.source===e.source&&t.flags===e.flags}function pd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.values();let i,a;for(;(i=o.next())&&!i.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!s[u]&&n.equals(i.value,a.value,i.value,a.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function yo(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function sS(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function tm(t,e,n,r){return(r===K2||r===q2||r===U2)&&(t.$$typeof||e.$$typeof)?!0:V2(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const oS="[object ArrayBuffer]",iS="[object Arguments]",aS="[object Boolean]",lS="[object DataView]",cS="[object Date]",uS="[object Error]",dS="[object Map]",fS="[object Number]",hS="[object Object]",pS="[object RegExp]",mS="[object Set]",gS="[object String]",yS={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},xS="[object URL]",bS=Object.prototype.toString;function vS({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:m}){return function(g,x,b){if(g===x)return!0;if(g==null||x==null)return!1;const v=typeof g;if(v!==typeof x)return!1;if(v!=="object")return v==="number"?a(g,x,b):v==="function"?o(g,x,b):!1;const k=g.constructor;if(k!==x.constructor)return!1;if(k===Object)return l(g,x,b);if(Array.isArray(g))return e(g,x,b);if(k===Date)return r(g,x,b);if(k===RegExp)return u(g,x,b);if(k===Map)return i(g,x,b);if(k===Set)return d(g,x,b);const N=bS.call(g);if(N===cS)return r(g,x,b);if(N===pS)return u(g,x,b);if(N===dS)return i(g,x,b);if(N===mS)return d(g,x,b);if(N===hS)return typeof g.then!="function"&&typeof x.then!="function"&&l(g,x,b);if(N===xS)return h(g,x,b);if(N===uS)return s(g,x,b);if(N===iS)return l(g,x,b);if(yS[N])return f(g,x,b);if(N===oS)return t(g,x,b);if(N===lS)return n(g,x,b);if(N===aS||N===fS||N===gS)return c(g,x,b);if(m){let C=m[N];if(!C){const S=W2(g);S&&(C=m[S])}if(C)return C(g,x,b)}return!1}}function kS({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:J2,areArraysEqual:n?Ir:Y2,areDataViewsEqual:G2,areDatesEqual:X2,areErrorsEqual:Q2,areFunctionsEqual:Z2,areMapsEqual:n?Wi(hd,Ir):hd,areNumbersEqual:eS,areObjectsEqual:n?Ir:tS,arePrimitiveWrappersEqual:nS,areRegExpsEqual:rS,areSetsEqual:n?Wi(pd,Ir):pd,areTypedArraysEqual:n?Wi(yo,Ir):yo,areUrlsEqual:sS,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Vs(r.areArraysEqual),o=Vs(r.areMapsEqual),i=Vs(r.areObjectsEqual),a=Vs(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:a})}return r}function SS(t){return function(e,n,r,s,o,i,a){return t(e,n,a)}}function CS({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,o)}}const wS=gn();gn({strict:!0});gn({circular:!0});gn({circular:!0,strict:!0});gn({createInternalComparator:()=>Yn});gn({strict:!0,createInternalComparator:()=>Yn});gn({circular:!0,createInternalComparator:()=>Yn});gn({circular:!0,createInternalComparator:()=>Yn,strict:!0});function gn(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,o=kS(t),i=vS(o),a=n?n(i):SS(i);return CS({circular:e,comparator:i,createState:r,equals:a,strict:s})}const NS=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},MS=({contentComponent:t})=>{const e=pf.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(e)})};function TS(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,o){e={...e,[s]:v1.createPortal(o.reactElement,o.element,s)},r()},removeRenderer(s){const o={...e};delete o[s],e=o,r()}}}var ES=class extends $n.Component{constructor(t){super(t),this.editorContentRef=$n.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=TS(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:NS(e,this.editorContentRef),...n}),t?.contentComponent&&p.jsx(MS,{contentComponent:t.contentComponent})]})}};const DS=L.forwardRef((t,e)=>{const n=$n.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return $n.createElement(ES,{key:n,innerRef:e,...t})}),nm=$n.memo(DS),OS=typeof window<"u"?L.useLayoutEffect:L.useEffect;var AS=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{s?.transaction!==void 0&&s.transaction===e||(e=s?.transaction,this.transactionNumber+=1,this.subscribers.forEach(o=>o()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function IS(t){var e;const[n]=L.useState(()=>new AS(t.editor)),r=x1.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:wS);return OS(()=>n.watch(t.editor),[t.editor,n]),L.useDebugValue(r),r}const jS=!1,rm=typeof window>"u",RS=rm||!!(typeof window<"u"&&window.next);var PS=class sm{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return rm?(n&&jS&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):RS&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...n)},onBlur:(...n)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...n)},onCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...n)},onDestroy:(...n)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...n)},onFocus:(...n)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...n)},onSelectionUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...n)},onTransaction:(...n)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...n)},onUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...n)},onContentError:(...n)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...n)},onDrop:(...n)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...n)},onPaste:(...n)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...n)},onDelete:(...n)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...n)},onMount:(...n)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...n)},onUnmount:(...n)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...n)}};return new L2(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,o)=>{var i;return s===((i=n.extensions)===null||i===void 0?void 0:i[o])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?sm.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function LS(t={},e=[]){const n=L.useRef(t);n.current=t;const[r]=L.useState(()=>new PS(n)),s=pf.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return L.useDebugValue(s),L.useEffect(r.onRender(e)),IS({editor:s,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),s}const Xl=L.createContext({editor:null});Xl.Consumer;const sA=()=>L.useContext(Xl),om=L.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),$S=()=>L.useContext(om),im=$n.forwardRef((t,e)=>{const{onDragStart:n}=$S(),r=t.as||"div";return p.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function md(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function gd(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function _S(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function BS(t){if(md(t)||gd(t))return!0;if(_S(t)){const e=t.type;if(e)return md(e)||gd(e)}return!1}function zS(){try{if(L.version)return parseInt(L.version.split(".")[0],10)>=19}catch{}return!1}var FS=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?b1.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,s=zS(),o=BS(e),i={...n};i.ref&&!(s||o)&&delete i.ref,!i.ref&&(s||o)&&(i.ref=a=>{this.ref=a}),this.reactElement=p.jsx(e,{...i}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const s=n[r];if(t[s]!==this.props[s]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};$n.createContext({markViewContentRef:()=>{}});function HS(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:s,anchorOffset:o,focusNode:i,focusOffset:a}=r;return!s||!i||!t.contains(s)||!t.contains(i)?null:()=>{try{r.setBaseAndExtent(s,o,i,a)}catch{}}}var WS=class extends B2{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,s){if(r==="storage"){var o;return(o=t.storage[e.name])!==null&&o!==void 0?o:{}}return Reflect.get(n,r,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:L.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{if(l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement){l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper");const c=HS(this.contentDOMElement);l.appendChild(this.contentDOMElement),c?.()}}},s=this.component,o=L.memo(l=>p.jsx(om.Provider,{value:r,children:L.createElement(s,l)}));o.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new FS(o,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{var t;this.selectionRafId=null;const e=(t=this.getPos())!==null&&t!==void 0?t:this.currentPos;if(typeof e=="number")if(Ck({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,a=this.decorations,l=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:l,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const s=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=s;const o={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=kr(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function am(t,e){return n=>n.editor.contentComponent?new WS(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Ql=L.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Ql.displayName="TiptapContext";const VS=()=>L.useContext(Ql);function lm({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=L.useMemo(()=>({editor:n}),[n]),s=L.useMemo(()=>({editor:n}),[n]);return p.jsx(Xl.Provider,{value:s,children:p.jsx(Ql.Provider,{value:r,children:t})})}lm.displayName="Tiptap";function cm({...t}){const{editor:e}=VS();return p.jsx(nm,{editor:e,...t})}cm.displayName="Tiptap.Content";Object.assign(lm,{Content:cm});function US(t){return t.storage.mention}function oA(t,e,n){t.chain().focus().insertContentAt(e,[um(n),{type:"text",text:" "}]).run()}function um(t){return{type:"mention",attrs:t}}function iA(t,e,n){const r=t.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===n}function qS(t){const e=_.c(34),{node:n,selected:r,view:s,editor:o,getPos:i}=t,{name:a,char:l,kind:c,id:u,args:d}=n.attrs,f=J(),h=r&&s.editable,m=c==="task",y=l==="@",g=s.editable&&l==="/"&&(c==="prompt"||c===void 0);let x;e[0]!==d||e[1]!==o||e[2]!==i||e[3]!==u||e[4]!==a?(x=()=>{const z=US(o)?.onEditChip;if(!z||typeof i!="function")return;const W=i();typeof W=="number"&&z({promptId:u,promptName:a,args:d??{},pos:W})},e[0]=d,e[1]=o,e[2]=i,e[3]=u,e[4]=a,e[5]=x):x=e[5];const b=x;let v;e[6]!==g||e[7]!==b?(v=R=>{g&&(R.preventDefault(),R.stopPropagation(),b())},e[6]=g,e[7]=b,e[8]=v):v=e[8];const k=v;let N;e[9]!==g||e[10]!==b?(N=R=>{g&&(R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),R.stopPropagation(),b()))},e[9]=g,e[10]=b,e[11]=N):N=e[11];const C=N,S=g?"button":void 0,w=g?0:void 0;let M;e[12]!==g||e[13]!==a||e[14]!==f?(M=g?f("chat.mention.editPrompt",{name:a?ga(a):""}):void 0,e[12]=g,e[13]=a,e[14]=f,e[15]=M):M=e[15];const T=g?"cursor-pointer":"cursor-default",O=y?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",A=h&&"outline-2 outline-blue-300 outline-offset-0",P=g&&"hover:brightness-95",D=!m&&"capitalize";let E;e[16]!==D||e[17]!==T||e[18]!==O||e[19]!==A||e[20]!==P?(E=Q("px-1 py-1 rounded","inline-flex items-center gap-1",T,"select-none","text-xs font-light",O,A,P,D),e[16]=D,e[17]=T,e[18]=O,e[19]=A,e[20]=P,e[21]=E):E=e[21];let j;e[22]!==m||e[23]!==a?(j=m?p.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:a??""}):a?ga(a):"",e[22]=m,e[23]=a,e[24]=j):j=e[24];let I;return e[25]!==l||e[26]!==k||e[27]!==C||e[28]!==E||e[29]!==j||e[30]!==S||e[31]!==w||e[32]!==M?(I=p.jsxs(im,{onClick:k,onKeyDown:C,role:S,tabIndex:w,"aria-label":M,className:E,children:[l,j]}),e[25]=l,e[26]=k,e[27]=C,e[28]=E,e[29]=j,e[30]=S,e[31]=w,e[32]=M,e[33]=I):I=e[33],I}const KS=qe.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}},kind:{default:void 0,parseHTML:t=>t.getAttribute("data-kind")||void 0,renderHTML:t=>t.kind?{"data-kind":t.kind}:{}},args:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-args")||"null")}catch{return null}},renderHTML:t=>t.args?{"data-args":JSON.stringify(t.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:t}){return["span",Se(t,{"data-type":"mention"})]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return am(qS)}}),JS=/^mcp__[a-zA-Z0-9_-]+__/;function dm(t){return t.replace(JS,"")}function gi(t){const e=_.c(19),{id:n,part:r,copyable:s,extraActions:o,alwaysShowActions:i,animate:a}=t,l=s===void 0?!1:s,c=i===void 0?!1:i,u=a===void 0?!1:a,{handleCopy:d}=$f(),f=J(),[h,m]=L.useState(!1);let y;e[0]!==d||e[1]!==n||e[2]!==r.text?(y=async()=>{k1("chat_message_copied",{message_id:n,chars:r.text.length}),await d(r.text),m(!0),setTimeout(()=>m(!1),2e3)},e[0]=d,e[1]=n,e[2]=r.text,e[3]=y):y=e[3];const g=y,x=l&&o,b=x||o;let v;e[4]!==u||e[5]!==n||e[6]!==r.text?(v=p.jsx(vl,{id:n,text:r.text,animate:u}),e[4]=u,e[5]=n,e[6]=r.text,e[7]=v):v=e[7];let k;e[8]!==c||e[9]!==o||e[10]!==g||e[11]!==h||e[12]!==b||e[13]!==x||e[14]!==f?(k=b&&p.jsxs("div",{className:Q("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[o,x&&o&&p.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),x&&p.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:h?p.jsx(xl,{className:"size-4"}):p.jsx(Lf,{className:"size-4"})})]}),e[8]=c,e[9]=o,e[10]=g,e[11]=h,e[12]=b,e[13]=x,e[14]=f,e[15]=k):k=e[15];let N;return e[16]!==v||e[17]!==k?(N=p.jsxs("div",{className:"group/part relative",children:[v,k]}),e[16]=v,e[17]=k,e[18]=N):N=e[18],N}function aA(t,e,n){t.chain().focus().insertContentAt(e,[YS(n),{type:"text",text:" "}]).run()}function YS(t){return{type:"file",attrs:t}}function GS(t){const e=_.c(17),{node:n,selected:r,view:s}=t,{name:o,mimeType:i,data:a}=n.attrs,l=r&&s.editable;let c;e[0]!==i?(c=i.startsWith("image/"),e[0]=i,e[1]=c):c=e[1];const u=c,d=l&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=Q("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==o?(h=p.jsx(_n,{asChild:!0,children:p.jsx("span",{children:o})}),e[4]=o,e[5]=h):h=e[5];let m;e[6]!==a||e[7]!==u||e[8]!==i||e[9]!==o?(m=p.jsx(Bn,{side:"top",className:"max-w-sm p-1.5",children:u?p.jsx("img",{src:`data:${i};base64,${a}`,alt:o,className:"max-w-full max-h-64 object-contain rounded"}):p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"font-medium",children:o}),p.jsx("div",{className:"text-muted-foreground mt-1",children:i})]})}),e[6]=a,e[7]=u,e[8]=i,e[9]=o,e[10]=m):m=e[10];let y;e[11]!==h||e[12]!==m?(y=p.jsxs(zn,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=y):y=e[13];let g;return e[14]!==f||e[15]!==y?(g=p.jsx(im,{className:f,children:y}),e[14]=f,e[15]=y,e[16]=g):g=e[16],g}const XS=qe.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return am(GS)}});function QS(t={}){return new pe({view(e){return new ZS(e,t)}})}class ZS{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,a=o.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),y=d?m.bottom:m.top;d&&f&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:m.left,right:m.right,top:y-g,bottom:y+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Dl(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Gn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},fm=function(t,e,n,r){return n&&(yd(t,e,n,r,-1)||yd(t,e,n,r,1))},eC=/^(img|br|input|textarea|hr)$/i;function yd(t,e,n,r,s){for(var o;;){if(t==n&&e==r)return!0;if(e==(s<0?0:xo(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Zl(t)||eC.test(t.nodeName)||t.contentEditable=="false")return!1;e=Gn(t)+(s<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else t=i,e=s<0?xo(t):0}else return!1}}function xo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tC(t,e,n){for(let r=e==0,s=e==xo(t);r||s;){if(t==n)return!0;let o=Gn(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,s=s&&o==xo(t)}}function Zl(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const hm=function(t){return t.focusNode&&fm(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function pm(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ot=typeof navigator<"u"?navigator:null,xd=typeof document<"u"?document:null,yn=Ot&&Ot.userAgent||"",za=/Edge\/(\d+)/.exec(yn),mm=/MSIE \d/.exec(yn),Fa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yn),Es=!!(mm||Fa||za),gm=mm?document.documentMode:Fa?+Fa[1]:za?+za[1]:0,yi=!Es&&/gecko\/(\d+)/i.test(yn);yi&&+(/Firefox\/(\d+)/.exec(yn)||[0,0])[1];const Ha=!Es&&/Chrome\/(\d+)/.exec(yn),Yt=!!Ha,ym=Ha?+Ha[1]:0,Xn=!Es&&!!Ot&&/Apple Computer/.test(Ot.vendor),ec=Xn&&(/Mobile\/\w+/.test(yn)||!!Ot&&Ot.maxTouchPoints>2),it=ec||(Ot?/Mac/.test(Ot.platform):!1),xm=Ot?/Win/.test(Ot.platform):!1,Ds=/Android \d/.test(yn),tc=!!xd&&"webkitFontSmoothing"in xd.documentElement.style,nC=tc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rC(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),o=s&&s.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let a=r.resolve(i),l,c;if(hm(n)){for(l=i;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&H.isSelectable(d)&&s.parent&&!(d.isInline&&tC(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new H(i==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,i]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(i)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=vm(t,u,a,d)}return c}function bm(t){return t.editable?t.hasFocus():aC(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function nc(t,e=!1){let n=t.state.selection;if(iC(t,n),!!bm(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Yt){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&fm(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)oC(t);else{let{anchor:r,head:s}=n,o,i;bd&&!(n instanceof V)&&(n.$from.parent.inlineContent||(o=vd(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=vd(t,n.to))),t.docView.setSelection(r,s,t,e),bd&&(o&&kd(o),i&&kd(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&sC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bd=Xn||Yt&&ym<63;function vd(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Xn&&s&&s.contentEditable=="false")return Vi(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return Vi(s);if(o)return Vi(o)}}function Vi(t){return t.contentEditable="true",Xn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function kd(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function sC(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!bm(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function oC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Gn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Es&&gm<=11&&(n.disabled=!0,n.disabled=!1)}function iC(t,e){if(e instanceof H){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Sd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Sd(t)}function Sd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function vm(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||V.between(e,n,r)}function aC(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Wa(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),o=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return o&&Y.findFrom(o,e)}function tn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Cd(t,e,n){let r=t.state.selection;if(r instanceof V)if(n.indexOf("s")>-1){let{$head:s}=r,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=t.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return tn(t,new V(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Wa(t.state,e);return s&&s instanceof H?tn(t,s):!1}else if(!(it&&n.indexOf("m")>-1)){let s=r.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let a=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?H.isSelectable(o)?tn(t,new H(e<0?t.state.doc.resolve(s.pos-o.nodeSize):s)):tc?tn(t,new V(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof H&&r.node.isInline)return tn(t,new V(e>0?r.$to:r.$from));{let s=Wa(t.state,e);return s?tn(t,s):!1}}}function bo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function nr(t,e){return e<0?lC(t):cC(t)}function lC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,o,i=!1;for(yi&&n.nodeType==1&&r<bo(n)&&Yr(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Yr(a,-1))s=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(km(n))break;{let a=n.previousSibling;for(;a&&Yr(a,-1);)s=n.parentNode,o=Gn(a),a=a.previousSibling;if(a)n=a,r=bo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Va(t,n,r):s&&Va(t,s,o)}function cC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=bo(n),o,i;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Yr(a,1))o=n,i=++r;else break}else{if(km(n))break;{let a=n.nextSibling;for(;a&&Yr(a,1);)o=a.parentNode,i=Gn(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=bo(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}o&&Va(t,o,i)}function km(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function uC(t,e){for(;t&&e==t.childNodes.length&&!Zl(t);)e=Gn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function dC(t,e){for(;t&&!e&&!Zl(t);)e=Gn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Va(t,e,n){if(e.nodeType!=3){let o,i;(i=uC(e,n))?(e=i,n=0):(o=dC(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(hm(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&nc(t)},50)}function wd(t,e){let n=t.state.doc.resolve(e);if(!(Yt||xm)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Nd(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||it&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Wa(t.state,e);if(i&&i instanceof H)return tn(t,i)}if(!s.parent.inlineContent){let i=e<0?s:o,a=r instanceof Xe?Y.near(i,e):Y.findFrom(i,e);return a?tn(t,a):!1}return!1}function Md(t,e){if(!(t.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let i=t.state.tr;return e<0?i.delete(n.pos-o.nodeSize,n.pos):i.delete(n.pos,n.pos+o.nodeSize),t.dispatch(i),!0}return!1}function Td(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function fC(t){if(!Xn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Td(t,r,"true"),setTimeout(()=>Td(t,r,"false"),20)}return!1}function hC(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function pC(t,e){let n=e.keyCode,r=hC(e);if(n==8||it&&n==72&&r=="c")return Md(t,-1)||nr(t,-1);if(n==46&&!e.shiftKey||it&&n==68&&r=="c")return Md(t,1)||nr(t,1);if(n==13||n==27)return!0;if(n==37||it&&n==66&&r=="c"){let s=n==37?wd(t,t.state.selection.from)=="ltr"?-1:1:-1;return Cd(t,s,r)||nr(t,s)}else if(n==39||it&&n==70&&r=="c"){let s=n==39?wd(t,t.state.selection.from)=="ltr"?1:-1:1;return Cd(t,s,r)||nr(t,s)}else{if(n==38||it&&n==80&&r=="c")return Nd(t,-1,r)||nr(t,-1);if(n==40||it&&n==78&&r=="c")return fC(t)||Nd(t,1,r)||nr(t,1);if(r==(it?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Sm(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=t.someProp("clipboardSerializer")||qt.fromSchema(t.state.schema),a=Em(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Tm[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
98
+ `,textSerializers:n={}}=t||{};return hk(this.state.doc,{blockSeparator:e,textSerializers:{...Bp(this.schema),...n}})}get isEmpty(){return Ms(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new R2(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Un(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=oe(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=e,i=r[r.length-1],a=r[0];if(i){const l=a.search(/\S/),c=n.from+a.indexOf(i),u=c+i.length;if(Yl(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+l,c);const d=n.from+l+i.length;o.addMark(n.from+l,d,t.type.create(s||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function $2(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=oe(t.getAttributes,void 0,r)||{},{tr:o}=e,i=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){let c=i+r[0].lastIndexOf(r[1]);c>a?c=a:a=c+r[1].length;const u=r[0][r[0].length-1];o.insertText(u,i+r[0].length-1),o.replaceWith(c,a,l)}else if(r[0]){const c=t.type.isInline?i:i-1;o.insert(c,t.type.create(s)).delete(o.mapping.map(i),o.mapping.map(a))}o.scrollIntoView()},undoable:t.undoable})}function Ba(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),o=oe(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function Sr(t){return new Ts({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const o=oe(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),l=a&&El(a,t.type,o);if(!l)return null;if(i.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(y=>f.includes(y.type.name));i.ensureMarks(m)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,o).run()}const c=i.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&pn(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&i.join(n.from-1)},undoable:t.undoable})}const _2=t=>"touches"in t;var rA=class{constructor(t){var e,n,r,s,o,i;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((s=t.options)===null||s===void 0)&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((o=t.options)===null||o===void 0)&&o.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((i=t.options)===null||i===void 0)&&i.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),o=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),o&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,_2(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),o=this.applyConstraints(r,s,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const o=t.includes("right"),i=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return o?r=this.startWidth+e:i&&(r=this.startWidth-e),a?s=this.startHeight+n:l&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(o?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s;if(!n){var o,i;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((o=this.maxSize)===null||o===void 0)&&o.width&&(c=Math.min(this.maxSize.width,c)),!((i=this.maxSize)===null||i===void 0)&&i.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),!((s=this.maxSize)===null||s===void 0)&&s.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},qe=class em extends Gl{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new em(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},B2=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,s=t.target,o=s.nodeType===3?(e=s.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(s)||!o)return;let i=0,a=0;if(this.dom!==o){var l,c,u,d;const b=this.dom.getBoundingClientRect(),v=o.getBoundingClientRect(),k=(l=t.offsetX)!==null&&l!==void 0?l:(c=t.nativeEvent)===null||c===void 0?void 0:c.offsetX,N=(u=t.offsetY)!==null&&u!==void 0?u:(d=t.nativeEvent)===null||d===void 0?void 0:d.offsetY;i=v.x-b.x+k,a=v.y-b.y+N}const f=this.dom.cloneNode(!0);try{const b=this.dom.getBoundingClientRect();f.style.width=`${Math.round(b.width)}px`,f.style.height=`${Math.round(b.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var m;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(m=t.dataTransfer)===null||m===void 0||m.setDragImage(f,i,a)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const y=this.getPos();if(typeof y!="number")return;const g=H.create(r.state.doc,y),x=r.state.tr.setSelection(g);r.dispatch(x)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(n))))return!1;const r=t.type.startsWith("drag"),s=t.type==="dragover"||t.type==="dragenter",o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;const{isEditable:i}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=H.isSelectable(this.node),u=t.type==="copy",d=t.type==="paste",f=t.type==="cut",h=t.type==="mousedown";if(!l&&c&&r&&t.target===this.dom&&t.preventDefault(),l&&r&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(l&&i&&!a&&h){const m=n.closest("[data-drag-handle]");m&&(this.dom===m||this.dom.contains(m))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||o||u||d||f||h&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(hs()||La())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function hn(t){return new Qp({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const o=oe(t.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Yl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+a.length,i.addMark(n.from+u,c,t.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||i.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:z2,getOwnPropertySymbols:F2}=Object,{hasOwnProperty:H2}=Object.prototype;function Wi(t,e){return function(r,s,o){return t(r,s,o)&&e(r,s,o)}}function Vs(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:o}=s,i=o.get(n),a=o.get(r);if(i&&a)return i===r&&a===n;o.set(n,r),o.set(r,n);const l=t(n,r,s);return o.delete(n),o.delete(r),l}}function W2(t){return t?.[Symbol.toStringTag]}function ud(t){return z2(t).concat(F2(t))}const V2=Object.hasOwn||((t,e)=>H2.call(t,e));function Yn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const U2="__v",q2="__o",K2="_owner",{getOwnPropertyDescriptor:dd,keys:fd}=Object;function J2(t,e){return t.byteLength===e.byteLength&&yo(new Uint8Array(t),new Uint8Array(e))}function Y2(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function G2(t,e){return t.byteLength===e.byteLength&&yo(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function X2(t,e){return Yn(t.getTime(),e.getTime())}function Q2(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Z2(t,e){return t===e}function hd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.entries();let i,a,l=0;for(;(i=o.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(s[d]){d++;continue}const f=i.value,h=a.value;if(n.equals(f[0],h[0],l,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;l++}return!0}const eS=Yn;function tS(t,e,n){const r=fd(t);let s=r.length;if(fd(e).length!==s)return!1;for(;s-- >0;)if(!tm(t,e,n,r[s]))return!1;return!0}function Ir(t,e,n){const r=ud(t);let s=r.length;if(ud(e).length!==s)return!1;let o,i,a;for(;s-- >0;)if(o=r[s],!tm(t,e,n,o)||(i=dd(t,o),a=dd(e,o),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function nS(t,e){return Yn(t.valueOf(),e.valueOf())}function rS(t,e){return t.source===e.source&&t.flags===e.flags}function pd(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),o=t.values();let i,a;for(;(i=o.next())&&!i.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!s[u]&&n.equals(i.value,a.value,i.value,a.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function yo(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function sS(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function tm(t,e,n,r){return(r===K2||r===q2||r===U2)&&(t.$$typeof||e.$$typeof)?!0:V2(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const oS="[object ArrayBuffer]",iS="[object Arguments]",aS="[object Boolean]",lS="[object DataView]",cS="[object Date]",uS="[object Error]",dS="[object Map]",fS="[object Number]",hS="[object Object]",pS="[object RegExp]",mS="[object Set]",gS="[object String]",yS={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},xS="[object URL]",bS=Object.prototype.toString;function vS({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:m}){return function(g,x,b){if(g===x)return!0;if(g==null||x==null)return!1;const v=typeof g;if(v!==typeof x)return!1;if(v!=="object")return v==="number"?a(g,x,b):v==="function"?o(g,x,b):!1;const k=g.constructor;if(k!==x.constructor)return!1;if(k===Object)return l(g,x,b);if(Array.isArray(g))return e(g,x,b);if(k===Date)return r(g,x,b);if(k===RegExp)return u(g,x,b);if(k===Map)return i(g,x,b);if(k===Set)return d(g,x,b);const N=bS.call(g);if(N===cS)return r(g,x,b);if(N===pS)return u(g,x,b);if(N===dS)return i(g,x,b);if(N===mS)return d(g,x,b);if(N===hS)return typeof g.then!="function"&&typeof x.then!="function"&&l(g,x,b);if(N===xS)return h(g,x,b);if(N===uS)return s(g,x,b);if(N===iS)return l(g,x,b);if(yS[N])return f(g,x,b);if(N===oS)return t(g,x,b);if(N===lS)return n(g,x,b);if(N===aS||N===fS||N===gS)return c(g,x,b);if(m){let C=m[N];if(!C){const S=W2(g);S&&(C=m[S])}if(C)return C(g,x,b)}return!1}}function kS({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:J2,areArraysEqual:n?Ir:Y2,areDataViewsEqual:G2,areDatesEqual:X2,areErrorsEqual:Q2,areFunctionsEqual:Z2,areMapsEqual:n?Wi(hd,Ir):hd,areNumbersEqual:eS,areObjectsEqual:n?Ir:tS,arePrimitiveWrappersEqual:nS,areRegExpsEqual:rS,areSetsEqual:n?Wi(pd,Ir):pd,areTypedArraysEqual:n?Wi(yo,Ir):yo,areUrlsEqual:sS,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Vs(r.areArraysEqual),o=Vs(r.areMapsEqual),i=Vs(r.areObjectsEqual),a=Vs(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:i,areSetsEqual:a})}return r}function SS(t){return function(e,n,r,s,o,i,a){return t(e,n,a)}}function CS({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const o={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,o)}}const wS=gn();gn({strict:!0});gn({circular:!0});gn({circular:!0,strict:!0});gn({createInternalComparator:()=>Yn});gn({strict:!0,createInternalComparator:()=>Yn});gn({circular:!0,createInternalComparator:()=>Yn});gn({circular:!0,createInternalComparator:()=>Yn,strict:!0});function gn(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,o=kS(t),i=vS(o),a=n?n(i):SS(i);return CS({circular:e,comparator:i,createState:r,equals:a,strict:s})}const NS=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},MS=({contentComponent:t})=>{const e=pf.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(e)})};function TS(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,o){e={...e,[s]:v1.createPortal(o.reactElement,o.element,s)},r()},removeRenderer(s){const o={...e};delete o[s],e=o,r()}}}var ES=class extends $n.Component{constructor(t){super(t),this.editorContentRef=$n.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=TS(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:NS(e,this.editorContentRef),...n}),t?.contentComponent&&p.jsx(MS,{contentComponent:t.contentComponent})]})}};const DS=L.forwardRef((t,e)=>{const n=$n.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return $n.createElement(ES,{key:n,innerRef:e,...t})}),nm=$n.memo(DS),OS=typeof window<"u"?L.useLayoutEffect:L.useEffect;var AS=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{s?.transaction!==void 0&&s.transaction===e||(e=s?.transaction,this.transactionNumber+=1,this.subscribers.forEach(o=>o()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function IS(t){var e;const[n]=L.useState(()=>new AS(t.editor)),r=x1.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:wS);return OS(()=>n.watch(t.editor),[t.editor,n]),L.useDebugValue(r),r}const jS=!1,rm=typeof window>"u",RS=rm||!!(typeof window<"u"&&window.next);var PS=class sm{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return rm?(n&&jS&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):RS&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...n)},onBlur:(...n)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...n)},onCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...n)},onDestroy:(...n)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...n)},onFocus:(...n)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...n)},onSelectionUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...n)},onTransaction:(...n)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...n)},onUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...n)},onContentError:(...n)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...n)},onDrop:(...n)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...n)},onPaste:(...n)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...n)},onDelete:(...n)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...n)},onMount:(...n)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...n)},onUnmount:(...n)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...n)}};return new L2(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,o)=>{var i;return s===((i=n.extensions)===null||i===void 0?void 0:i[o])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?sm.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function LS(t={},e=[]){const n=L.useRef(t);n.current=t;const[r]=L.useState(()=>new PS(n)),s=pf.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return L.useDebugValue(s),L.useEffect(r.onRender(e)),IS({editor:s,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),s}const Xl=L.createContext({editor:null});Xl.Consumer;const sA=()=>L.useContext(Xl),om=L.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),$S=()=>L.useContext(om),im=$n.forwardRef((t,e)=>{const{onDragStart:n}=$S(),r=t.as||"div";return p.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function md(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function gd(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function _S(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function BS(t){if(md(t)||gd(t))return!0;if(_S(t)){const e=t.type;if(e)return md(e)||gd(e)}return!1}function zS(){try{if(L.version)return parseInt(L.version.split(".")[0],10)>=19}catch{}return!1}var FS=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?b1.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,s=zS(),o=BS(e),i={...n};i.ref&&!(s||o)&&delete i.ref,!i.ref&&(s||o)&&(i.ref=a=>{this.ref=a}),this.reactElement=p.jsx(e,{...i}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const s=n[r];if(t[s]!==this.props[s]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};$n.createContext({markViewContentRef:()=>{}});function HS(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:s,anchorOffset:o,focusNode:i,focusOffset:a}=r;return!s||!i||!t.contains(s)||!t.contains(i)?null:()=>{try{r.setBaseAndExtent(s,o,i,a)}catch{}}}var WS=class extends B2{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,s){if(r==="storage"){var o;return(o=t.storage[e.name])!==null&&o!==void 0?o:{}}return Reflect.get(n,r,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:L.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{if(l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement){l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper");const c=HS(this.contentDOMElement);l.appendChild(this.contentDOMElement),c?.()}}},s=this.component,o=L.memo(l=>p.jsx(om.Provider,{value:r,children:L.createElement(s,l)}));o.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new FS(o,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{var t;this.selectionRafId=null;const e=(t=this.getPos())!==null&&t!==void 0?t:this.currentPos;if(typeof e=="number")if(Ck({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,a=this.decorations,l=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:l,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const s=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=s;const o={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=kr(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function am(t,e){return n=>n.editor.contentComponent?new WS(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Ql=L.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Ql.displayName="TiptapContext";const VS=()=>L.useContext(Ql);function lm({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=L.useMemo(()=>({editor:n}),[n]),s=L.useMemo(()=>({editor:n}),[n]);return p.jsx(Xl.Provider,{value:s,children:p.jsx(Ql.Provider,{value:r,children:t})})}lm.displayName="Tiptap";function cm({...t}){const{editor:e}=VS();return p.jsx(nm,{editor:e,...t})}cm.displayName="Tiptap.Content";Object.assign(lm,{Content:cm});function US(t){return t.storage.mention}function oA(t,e,n){t.chain().focus().insertContentAt(e,[um(n),{type:"text",text:" "}]).run()}function um(t){return{type:"mention",attrs:t}}function iA(t,e,n){const r=t.state.doc.nodeAt(e);return r?.type.name==="mention"&&r.attrs.id===n}function qS(t){const e=_.c(34),{node:n,selected:r,view:s,editor:o,getPos:i}=t,{name:a,char:l,kind:c,id:u,args:d}=n.attrs,f=J(),h=r&&s.editable,m=c==="task",y=l==="@",g=s.editable&&l==="/"&&(c==="prompt"||c===void 0);let x;e[0]!==d||e[1]!==o||e[2]!==i||e[3]!==u||e[4]!==a?(x=()=>{const z=US(o)?.onEditChip;if(!z||typeof i!="function")return;const W=i();typeof W=="number"&&z({promptId:u,promptName:a,args:d??{},pos:W})},e[0]=d,e[1]=o,e[2]=i,e[3]=u,e[4]=a,e[5]=x):x=e[5];const b=x;let v;e[6]!==g||e[7]!==b?(v=R=>{g&&(R.preventDefault(),R.stopPropagation(),b())},e[6]=g,e[7]=b,e[8]=v):v=e[8];const k=v;let N;e[9]!==g||e[10]!==b?(N=R=>{g&&(R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),R.stopPropagation(),b()))},e[9]=g,e[10]=b,e[11]=N):N=e[11];const C=N,S=g?"button":void 0,w=g?0:void 0;let M;e[12]!==g||e[13]!==a||e[14]!==f?(M=g?f("chat.mention.editPrompt",{name:a?ga(a):""}):void 0,e[12]=g,e[13]=a,e[14]=f,e[15]=M):M=e[15];const T=g?"cursor-pointer":"cursor-default",O=y?"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",A=h&&"outline-2 outline-blue-300 outline-offset-0",P=g&&"hover:brightness-95",D=!m&&"capitalize";let E;e[16]!==D||e[17]!==T||e[18]!==O||e[19]!==A||e[20]!==P?(E=G("px-1 py-1 rounded","inline-flex items-center gap-1",T,"select-none","text-xs font-light",O,A,P,D),e[16]=D,e[17]=T,e[18]=O,e[19]=A,e[20]=P,e[21]=E):E=e[21];let j;e[22]!==m||e[23]!==a?(j=m?p.jsx("span",{className:"inline-block max-w-[220px] truncate align-bottom",children:a??""}):a?ga(a):"",e[22]=m,e[23]=a,e[24]=j):j=e[24];let I;return e[25]!==l||e[26]!==k||e[27]!==C||e[28]!==E||e[29]!==j||e[30]!==S||e[31]!==w||e[32]!==M?(I=p.jsxs(im,{onClick:k,onKeyDown:C,role:S,tabIndex:w,"aria-label":M,className:E,children:[l,j]}),e[25]=l,e[26]=k,e[27]=C,e[28]=E,e[29]=j,e[30]=S,e[31]=w,e[32]=M,e[33]=I):I=e[33],I}const KS=qe.create({name:"mention",group:"inline",inline:!0,atom:!0,addStorage(){return{onEditChip:null}},addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},char:{default:"/",parseHTML:t=>t.getAttribute("data-char")||"/",renderHTML:t=>t.char?{"data-char":t.char}:{}},metadata:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-metadata")||"null")}catch{return null}},renderHTML:t=>t.metadata?{"data-metadata":JSON.stringify(t.metadata)}:{}},kind:{default:void 0,parseHTML:t=>t.getAttribute("data-kind")||void 0,renderHTML:t=>t.kind?{"data-kind":t.kind}:{}},args:{default:null,parseHTML:t=>{try{return JSON.parse(t.getAttribute("data-args")||"null")}catch{return null}},renderHTML:t=>t.args?{"data-args":JSON.stringify(t.args)}:{}}}},parseHTML(){return[{tag:'span[data-type="mention"]'}]},renderHTML({HTMLAttributes:t}){return["span",Se(t,{"data-type":"mention"})]},renderText({node:t}){const e=t.attrs.char??"@",n=t.attrs.name??"";return`${e}${n}`},addNodeView(){return am(qS)}}),JS=/^mcp__[a-zA-Z0-9_-]+__/;function dm(t){return t.replace(JS,"")}function gi(t){const e=_.c(19),{id:n,part:r,copyable:s,extraActions:o,alwaysShowActions:i,animate:a}=t,l=s===void 0?!1:s,c=i===void 0?!1:i,u=a===void 0?!1:a,{handleCopy:d}=$f(),f=J(),[h,m]=L.useState(!1);let y;e[0]!==d||e[1]!==n||e[2]!==r.text?(y=async()=>{k1("chat_message_copied",{message_id:n,chars:r.text.length}),await d(r.text),m(!0),setTimeout(()=>m(!1),2e3)},e[0]=d,e[1]=n,e[2]=r.text,e[3]=y):y=e[3];const g=y,x=l&&o,b=x||o;let v;e[4]!==u||e[5]!==n||e[6]!==r.text?(v=p.jsx(vl,{id:n,text:r.text,animate:u}),e[4]=u,e[5]=n,e[6]=r.text,e[7]=v):v=e[7];let k;e[8]!==c||e[9]!==o||e[10]!==g||e[11]!==h||e[12]!==b||e[13]!==x||e[14]!==f?(k=b&&p.jsxs("div",{className:G("flex w-full items-center gap-2 text-sm text-muted-foreground transition-all duration-200 mt-1 py-1",c?"opacity-100":"opacity-0 pointer-events-none group-hover/part:opacity-100 group-hover/part:pointer-events-auto"),children:[o,x&&o&&p.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),x&&p.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground [@media(hover:hover)]:hover:text-foreground transition-colors active:scale-[0.97]","aria-label":f("chat.textPart.copyMessage"),children:h?p.jsx(xl,{className:"size-4"}):p.jsx(Lf,{className:"size-4"})})]}),e[8]=c,e[9]=o,e[10]=g,e[11]=h,e[12]=b,e[13]=x,e[14]=f,e[15]=k):k=e[15];let N;return e[16]!==v||e[17]!==k?(N=p.jsxs("div",{className:"group/part relative",children:[v,k]}),e[16]=v,e[17]=k,e[18]=N):N=e[18],N}function aA(t,e,n){t.chain().focus().insertContentAt(e,[YS(n),{type:"text",text:" "}]).run()}function YS(t){return{type:"file",attrs:t}}function GS(t){const e=_.c(17),{node:n,selected:r,view:s}=t,{name:o,mimeType:i,data:a}=n.attrs,l=r&&s.editable;let c;e[0]!==i?(c=i.startsWith("image/"),e[0]=i,e[1]=c):c=e[1];const u=c,d=l&&"outline-2 outline-blue-300 outline-offset-0";let f;e[2]!==d?(f=G("px-1 py-1 rounded","inline-flex items-center gap-1","cursor-default select-none","text-xs font-light","bg-muted text-muted-foreground",d),e[2]=d,e[3]=f):f=e[3];let h;e[4]!==o?(h=p.jsx(_n,{asChild:!0,children:p.jsx("span",{children:o})}),e[4]=o,e[5]=h):h=e[5];let m;e[6]!==a||e[7]!==u||e[8]!==i||e[9]!==o?(m=p.jsx(Bn,{side:"top",className:"max-w-sm p-1.5",children:u?p.jsx("img",{src:`data:${i};base64,${a}`,alt:o,className:"max-w-full max-h-64 object-contain rounded"}):p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"font-medium",children:o}),p.jsx("div",{className:"text-muted-foreground mt-1",children:i})]})}),e[6]=a,e[7]=u,e[8]=i,e[9]=o,e[10]=m):m=e[10];let y;e[11]!==h||e[12]!==m?(y=p.jsxs(zn,{children:[h,m]}),e[11]=h,e[12]=m,e[13]=y):y=e[13];let g;return e[14]!==f||e[15]!==y?(g=p.jsx(im,{className:f,children:y}),e[14]=f,e[15]=y,e[16]=g):g=e[16],g}const XS=qe.create({name:"file",group:"inline",inline:!0,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id")||null,renderHTML:t=>t.id?{"data-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||null,renderHTML:t=>t.name?{"data-name":t.name}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type")||null,renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},size:{default:0,parseHTML:t=>{const e=t.getAttribute("data-size");return e?Number.parseInt(e,10):0},renderHTML:t=>t.size?{"data-size":String(t.size)}:{}},data:{default:null,parseHTML:t=>t.getAttribute("data-data")||null,renderHTML:t=>t.data?{"data-data":t.data}:{}}}},parseHTML(){return[{tag:'span[data-type="file"]'}]},renderHTML({node:t,HTMLAttributes:e}){const n={"data-type":"file"};return t.attrs.id&&(n["data-id"]=t.attrs.id),t.attrs.name&&(n["data-name"]=t.attrs.name),t.attrs.mimeType&&(n["data-mime-type"]=t.attrs.mimeType),t.attrs.size&&(n["data-size"]=String(t.attrs.size)),t.attrs.data&&(n["data-data"]=t.attrs.data),["span",{...e,...n}]},renderText({node:t}){return`[${t.attrs.name??""}]`},addNodeView(){return am(GS)}});function QS(t={}){return new pe({view(e){return new ZS(e,t)}})}class ZS{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let o=i=>{this[s](i)};return e.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,a=o.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),y=d?m.bottom:m.top;d&&f&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:m.left,right:m.right,top:y-g,bottom:y+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!o){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Dl(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Gn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},fm=function(t,e,n,r){return n&&(yd(t,e,n,r,-1)||yd(t,e,n,r,1))},eC=/^(img|br|input|textarea|hr)$/i;function yd(t,e,n,r,s){for(var o;;){if(t==n&&e==r)return!0;if(e==(s<0?0:xo(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Zl(t)||eC.test(t.nodeName)||t.contentEditable=="false")return!1;e=Gn(t)+(s<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=s;else return!1;else t=i,e=s<0?xo(t):0}else return!1}}function xo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tC(t,e,n){for(let r=e==0,s=e==xo(t);r||s;){if(t==n)return!0;let o=Gn(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,s=s&&o==xo(t)}}function Zl(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const hm=function(t){return t.focusNode&&fm(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function pm(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Ot=typeof navigator<"u"?navigator:null,xd=typeof document<"u"?document:null,yn=Ot&&Ot.userAgent||"",za=/Edge\/(\d+)/.exec(yn),mm=/MSIE \d/.exec(yn),Fa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yn),Es=!!(mm||Fa||za),gm=mm?document.documentMode:Fa?+Fa[1]:za?+za[1]:0,yi=!Es&&/gecko\/(\d+)/i.test(yn);yi&&+(/Firefox\/(\d+)/.exec(yn)||[0,0])[1];const Ha=!Es&&/Chrome\/(\d+)/.exec(yn),Yt=!!Ha,ym=Ha?+Ha[1]:0,Xn=!Es&&!!Ot&&/Apple Computer/.test(Ot.vendor),ec=Xn&&(/Mobile\/\w+/.test(yn)||!!Ot&&Ot.maxTouchPoints>2),it=ec||(Ot?/Mac/.test(Ot.platform):!1),xm=Ot?/Win/.test(Ot.platform):!1,Ds=/Android \d/.test(yn),tc=!!xd&&"webkitFontSmoothing"in xd.documentElement.style,nC=tc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rC(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),o=s&&s.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let a=r.resolve(i),l,c;if(hm(n)){for(l=i;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&H.isSelectable(d)&&s.parent&&!(d.isInline&&tC(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new H(i==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,i]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(i)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=vm(t,u,a,d)}return c}function bm(t){return t.editable?t.hasFocus():aC(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function nc(t,e=!1){let n=t.state.selection;if(iC(t,n),!!bm(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Yt){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&fm(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)oC(t);else{let{anchor:r,head:s}=n,o,i;bd&&!(n instanceof V)&&(n.$from.parent.inlineContent||(o=vd(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=vd(t,n.to))),t.docView.setSelection(r,s,t,e),bd&&(o&&kd(o),i&&kd(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&sC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bd=Xn||Yt&&ym<63;function vd(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Xn&&s&&s.contentEditable=="false")return Vi(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return Vi(s);if(o)return Vi(o)}}function Vi(t){return t.contentEditable="true",Xn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function kd(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function sC(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!bm(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function oC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Gn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Es&&gm<=11&&(n.disabled=!0,n.disabled=!1)}function iC(t,e){if(e instanceof H){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Sd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Sd(t)}function Sd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function vm(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||V.between(e,n,r)}function aC(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Wa(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),o=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return o&&Y.findFrom(o,e)}function tn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Cd(t,e,n){let r=t.state.selection;if(r instanceof V)if(n.indexOf("s")>-1){let{$head:s}=r,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=t.state.doc.resolve(s.pos+o.nodeSize*(e<0?-1:1));return tn(t,new V(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Wa(t.state,e);return s&&s instanceof H?tn(t,s):!1}else if(!(it&&n.indexOf("m")>-1)){let s=r.$head,o=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let a=e<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?H.isSelectable(o)?tn(t,new H(e<0?t.state.doc.resolve(s.pos-o.nodeSize):s)):tc?tn(t,new V(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof H&&r.node.isInline)return tn(t,new V(e>0?r.$to:r.$from));{let s=Wa(t.state,e);return s?tn(t,s):!1}}}function bo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function nr(t,e){return e<0?lC(t):cC(t)}function lC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,o,i=!1;for(yi&&n.nodeType==1&&r<bo(n)&&Yr(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Yr(a,-1))s=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(km(n))break;{let a=n.previousSibling;for(;a&&Yr(a,-1);)s=n.parentNode,o=Gn(a),a=a.previousSibling;if(a)n=a,r=bo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Va(t,n,r):s&&Va(t,s,o)}function cC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=bo(n),o,i;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Yr(a,1))o=n,i=++r;else break}else{if(km(n))break;{let a=n.nextSibling;for(;a&&Yr(a,1);)o=a.parentNode,i=Gn(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=bo(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}o&&Va(t,o,i)}function km(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function uC(t,e){for(;t&&e==t.childNodes.length&&!Zl(t);)e=Gn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function dC(t,e){for(;t&&!e&&!Zl(t);)e=Gn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Va(t,e,n){if(e.nodeType!=3){let o,i;(i=uC(e,n))?(e=i,n=0):(o=dC(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(hm(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&nc(t)},50)}function wd(t,e){let n=t.state.doc.resolve(e);if(!(Yt||xm)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Nd(t,e,n){let r=t.state.selection;if(r instanceof V&&!r.empty||n.indexOf("s")>-1||it&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Wa(t.state,e);if(i&&i instanceof H)return tn(t,i)}if(!s.parent.inlineContent){let i=e<0?s:o,a=r instanceof Xe?Y.near(i,e):Y.findFrom(i,e);return a?tn(t,a):!1}return!1}function Md(t,e){if(!(t.state.selection instanceof V))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let i=t.state.tr;return e<0?i.delete(n.pos-o.nodeSize,n.pos):i.delete(n.pos,n.pos+o.nodeSize),t.dispatch(i),!0}return!1}function Td(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function fC(t){if(!Xn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Td(t,r,"true"),setTimeout(()=>Td(t,r,"false"),20)}return!1}function hC(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function pC(t,e){let n=e.keyCode,r=hC(e);if(n==8||it&&n==72&&r=="c")return Md(t,-1)||nr(t,-1);if(n==46&&!e.shiftKey||it&&n==68&&r=="c")return Md(t,1)||nr(t,1);if(n==13||n==27)return!0;if(n==37||it&&n==66&&r=="c"){let s=n==37?wd(t,t.state.selection.from)=="ltr"?-1:1:-1;return Cd(t,s,r)||nr(t,s)}else if(n==39||it&&n==70&&r=="c"){let s=n==39?wd(t,t.state.selection.from)=="ltr"?1:-1:1;return Cd(t,s,r)||nr(t,s)}else{if(n==38||it&&n==80&&r=="c")return Nd(t,-1,r)||nr(t,-1);if(n==40||it&&n==78&&r=="c")return fC(t)||Nd(t,1,r)||nr(t,1);if(r==(it?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Sm(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:s,openEnd:o}=e;for(;s>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,o--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=t.someProp("clipboardSerializer")||qt.fromSchema(t.state.schema),a=Em(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Tm[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${o}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
99
99
 
100
100
  `);return{dom:l,text:f,slice:e}}function Cm(t,e,n,r,s){let o=s.parent.type.spec.code,i,a;if(!n&&!e)return null;let l=!!e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,o||r,t)}),o)return a=new F($.from(t.state.schema.text(e.replace(/\r\n?/g,`
101
101
  `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(d)a=d;else{let f=s.marks(),{schema:h}=t.state,m=qt.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let g=i.appendChild(document.createElement("p"));y&&g.appendChild(m.serializeNode(h.text(y,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=xC(n),tc&&bC(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Et.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!mC.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=vC(Ed(a,+u[1],+u[2]),u[4]);else if(a=F.maxOpen(gC(a.content,s),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Ed(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const mC=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function gC(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),o,i=[];if(t.forEach(a=>{if(!i)return;let l=s.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&o.length&&Nm(l,o,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=Mm(i[i.length-1],o.length));let u=wm(a,l);i.push(u),s=s.matchType(u.type),o=l}}),i)return $.from(i)}return t}function wm(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,$.from(t));return t}function Nm(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let o=Nm(t,e,n,r.lastChild,s+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append($.from(wm(n,t,s+1))))}}function Mm(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Mm(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore($.empty,!0);return t.copy(n.append(r))}function Ua(t,e,n,r,s,o){let i=e<0?t.firstChild:t.lastChild,a=i.content;return t.childCount>1&&(o=0),s<r-1&&(a=Ua(a,e,n,r,s+1,o)),s>=n&&(a=e<0?i.contentMatchAt(0).fillBefore(a,o<=s).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore($.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function Ed(t,e,n){return e<t.openStart&&(t=new F(Ua(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new F(Ua(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Tm={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Dd=null;function Em(){return Dd||(Dd=document.implementation.createHTMLDocument("title"))}let Ui=null;function yC(t){let e=window.trustedTypes;return e?(Ui||(Ui=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ui.createHTML(t)):t}function xC(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Em().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&Tm[r[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=yC(t),s)for(let o=0;o<s.length;o++)n=n.querySelector(s[o])||n;return n}function bC(t){let e=t.querySelectorAll(Yt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function vC(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:s,openStart:o,openEnd:i}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=$.from(l.create(r[a+1],s)),o++,i++}return new F(s,o,i)}const bt={},tt={};function an(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}tt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Om(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ds&&Yt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ec&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,pm(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||pC(t,n)?n.preventDefault():an(t,"key")};tt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};tt.keypress=(t,e)=>{let n=e;if(Om(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||it&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,s,o))&&t.dispatch(o()),n.preventDefault()}};function xi(t){return{left:t.clientX,top:t.clientY}}function kC(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function rc(t,e,n,r,s){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let i=o.depth+1;i>0;i--)if(t.someProp(e,a=>i>o.depth?a(t,n,o.nodeAfter,o.before(i),s,!0):a(t,n,o.node(i),o.before(i),s,!1)))return!0;return!1}function pr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function SC(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&H.isSelectable(r)?(pr(t,new H(n)),!0):!1}function CC(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof H&&(r=n.node);let o=t.state.doc.resolve(e);for(let i=o.depth+1;i>0;i--){let a=i>o.depth?o.nodeAfter:o.node(i);if(H.isSelectable(a)){r&&n.$from.depth>0&&i>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?s=o.before(n.$from.depth):s=o.before(i);break}}return s!=null?(pr(t,H.create(t.state.doc,s)),!0):!1}function wC(t,e,n,r,s){return rc(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(s?CC(t,n):SC(t,n))}function NC(t,e,n,r){return rc(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function MC(t,e,n,r){return rc(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||TC(t,n,r)}function TC(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(pr(t,V.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let o=s.depth+1;o>0;o--){let i=o>s.depth?s.nodeAfter:s.node(o),a=s.before(o);if(i.inlineContent)pr(t,V.create(r,a+1,a+1+i.content.size));else if(H.isSelectable(i))pr(t,H.create(r,a));else continue;return!0}}function sc(t){return vo(t)}const Dm=it?"metaKey":"ctrlKey";bt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=sc(t),s=Date.now(),o="singleClick";s-t.input.lastClick.time<500&&kC(n,t.input.lastClick)&&!n[Dm]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:o,button:n.button};let i=t.posAtCoords(xi(n));i&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new EC(t,i,n,!!r)):(o=="doubleClick"?NC:MC)(t,i.pos,i.inside,n)?n.preventDefault():an(t,"pointer"))};class EC{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Dm],this.allowDefault=r.shiftKey;let o,i;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),i=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,i=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof H&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&yi&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),an(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nc(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(xi(e))),this.updateAllowDefault(e),this.allowDefault||!n?an(this.view,"pointer"):wC(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Xn&&this.mightDrag&&!this.mightDrag.node.isAtom||Yt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(pr(this.view,Y.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):an(this.view,"pointer")}move(e){this.updateAllowDefault(e),an(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}bt.touchstart=t=>{t.input.lastTouch=Date.now(),sc(t),an(t,"pointer")};bt.touchmove=t=>{t.input.lastTouch=Date.now(),an(t,"pointer")};bt.contextmenu=t=>sc(t);function Om(t,e){return t.composing?!0:Xn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const DC=Ds?5e3:-1;tt.compositionstart=tt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof V&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Yt&&xm&&OC(t)))t.markCursor=t.state.storedMarks||n.marks(),vo(t,!0),t.markCursor=null;else if(vo(t,!e.selection.empty),yi&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,o=r.focusOffset;s&&s.nodeType==1&&o!=0;){let i=o<0?s.lastChild:s.childNodes[o-1];if(!i)break;if(i.nodeType==3){let a=t.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else s=i,o=-1}}t.input.composing=!0}Am(t,DC)};function OC(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}tt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Am(t,20))};function Am(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>vo(t),e))}function AC(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=IC());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function IC(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function vo(t,e=!1){if(!(Ds&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),AC(t),e||t.docView&&t.docView.dirty){let n=rC(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function jC(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ps=Es&&gm<15||ec&&nC<604;bt.copy=tt.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let o=ps?null:n.clipboardData,i=r.content(),{dom:a,text:l}=Sm(t,i);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):jC(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function RC(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function PC(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?qa(t,r.value,null,s,e):qa(t,r.textContent,r.innerHTML,s,e)},50)}function qa(t,e,n,r,s){let o=Cm(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,o||F.empty)))return!0;if(!o)return!1;let i=RC(o),a=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Im(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}tt.paste=(t,e)=>{let n=e;if(t.composing&&!Ds)return;let r=ps?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&qa(t,Im(r),r.getData("text/html"),s,n)?n.preventDefault():PC(t,n)};class LC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $C=it?"altKey":"ctrlKey";function jm(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[$C]}bt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,o=s.empty?null:t.posAtCoords(xi(n)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof H?s.to-1:s.to))){if(r&&r.mightDrag)i=H.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(i=H.create(t.state.doc,d.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:u}=Sm(t,a);(!n.dataTransfer.files.length||!Yt||ym>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ps?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ps||n.dataTransfer.setData("text/plain",c),t.dragging=new LC(u,jm(t,n),i)};bt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};tt.dragover=tt.dragenter=(t,e)=>e.preventDefault();tt.drop=(t,e)=>{try{_C(t,e,t.dragging)}finally{t.dragging=null}};function _C(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(xi(e));if(!r)return;let s=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",h=>{o=h(o,t,!1)}):o=Cm(t,Im(e.dataTransfer),ps?null:e.dataTransfer.getData("text/html"),!1,s);let i=!!(n&&jm(t,e));if(t.someProp("handleDrop",h=>h(t,e,o||F.empty,i))){e.preventDefault();return}if(!o)return;e.preventDefault();let a=o?Dl(t.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let l=t.state.tr;if(i){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&H.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new H(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,y,g,x)=>h=x),l.setSelection(vm(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}bt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&nc(t)},20))};bt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};bt.beforeinput=(t,e)=>{if(Yt&&Ds&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,pm(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in tt)bt[t]=tt[t];function ms(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ko{constructor(e,n){this.toDOM=e,this.spec=n||jn,this.side=this.spec.side||0}map(e,n,r,s){let{pos:o,deleted:i}=e.mapResult(n.from+s,this.side<0?-1:1);return i?null:new Mt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ko&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ms(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class dn{constructor(e,n){this.attrs=e,this.spec=n||jn}map(e,n,r,s){let o=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return o>=i?null:new Mt(o,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof dn&&ms(this.attrs,e.attrs)&&ms(this.spec,e.spec)}static is(e){return e.type instanceof dn}destroy(){}}class oc{constructor(e,n){this.attrs=e,this.spec=n||jn}map(e,n,r,s){let o=e.mapResult(n.from+s,1);if(o.deleted)return null;let i=e.mapResult(n.to+s,-1);return i.deleted||i.pos<=o.pos?null:new Mt(o.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),o;return s==n.from&&!(o=e.child(r)).isText&&s+o.nodeSize==n.to}eq(e){return this==e||e instanceof oc&&ms(this.attrs,e.attrs)&&ms(this.spec,e.spec)}destroy(){}}class Mt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Mt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Mt(e,e,new ko(n,r))}static inline(e,n,r,s){return new Mt(e,n,new dn(r,s))}static node(e,n,r,s){return new Mt(e,n,new oc(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof dn}get widget(){return this.type instanceof ko}}const lr=[],jn={};class De{constructor(e,n){this.local=e.length?e:lr,this.children=n.length?n:lr}static create(e,n){return n.length?So(n,e,0,jn):He}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,o){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,n-a,r,s+a,o)}}map(e,n,r){return this==He||e.maps.length==0?this:this.mapInner(e,n,0,0,r||jn)}mapInner(e,n,r,s,o){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?BC(this.children,i||[],e,n,r,s,o):i?new De(i.sort(Rn),lr):He}add(e,n){return n.length?this==He?De.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=Pm(n,a,c)){for(s||(s=this.children.slice());o<s.length&&s[o]<l;)o+=3;s[o]==l?s[o+2]=s[o+2].addInner(a,u,c+1):s.splice(o,0,l,l+a.nodeSize,So(u,a,c+1,jn)),o+=3}});let i=Rm(o?Lm(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new De(i.length?this.local.concat(i).sort(Rn):this.local,s||this.children)}remove(e){return e.length==0||this==He?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let o=0;o<r.length;o+=3){let i,a=r[o]+n,l=r[o+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(i,a+1);c!=He?r[o+2]=c:(r.splice(o,3),o-=3)}if(s.length){for(let o=0,i;o<e.length;o++)if(i=e[o])for(let a=0;a<s.length;a++)s[a].eq(i,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new De(s,r):He}forChild(e,n){if(this==He)return this;if(n.isLeaf)return De.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,i=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>o&&l.type instanceof dn){let c=Math.max(o,l.from)-o,u=Math.min(i,l.to)-o;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new De(s.sort(Rn),lr);return r?new Sn([a,r]):a}return r||He}eq(e){if(this==e)return!0;if(!(e instanceof De)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return ic(this.localsInner(e))}localsInner(e){if(this==He)return lr;if(e.inlineContent||!this.local.some(dn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof dn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}De.empty=new De([],[]);De.removeOverlap=ic;const He=De.empty;class Sn{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,jn));return Sn.from(r)}forChild(e,n){if(n.isLeaf)return De.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(e,n);o!=He&&(o instanceof Sn?r=r.concat(o.members):r.push(o))}return Sn.from(r)}eq(e){if(!(e instanceof Sn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let i=0;i<o.length;i++)n.push(o[i])}}return n?ic(r?n:n.sort(Rn)):lr}static from(e){switch(e.length){case 0:return He;case 1:return e[0];default:return new Sn(e.every(n=>n instanceof De)?e:e.reduce((n,r)=>n.concat(r instanceof De?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function BC(t,e,n,r,s,o,i){let a=t.slice();for(let c=0,u=o;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,m,y)=>{let g=y-m-(h-f);for(let x=0;x<a.length;x+=3){let b=a[x+1];if(b<0||f>b+u-d)continue;let v=a[x]+u-d;h>=v?a[x+1]=f<=v?-2:-1:f>=u&&g&&(a[x]+=g,a[x+1]+=g)}d+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+o),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+o,-1),h=f-s,{index:m,offset:y}=r.content.findIndex(d),g=r.maybeChild(m);if(g&&y==d&&y+g.nodeSize==h){let x=a[c+2].mapInner(n,g,u+1,t[c]+o+1,i);x!=He?(a[c]=d,a[c+1]=h,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=zC(a,t,e,n,s,o,i),u=So(c,r,0,i);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new De(e.sort(Rn),a)}function Rm(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Mt(s.from+e,s.to+e,s.type))}return n}function zC(t,e,n,r,s,o,i){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):i.onRemove&&i.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function Pm(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let o=0,i;o<t.length;o++)(i=t[o])&&i.from>n&&i.to<r&&((s||(s=[])).push(i),t[o]=null);return s}function Lm(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function So(t,e,n,r){let s=[],o=!1;e.forEach((a,l)=>{let c=Pm(t,a,l+n);if(c){o=!0;let u=So(c,a,n+l+1,r);u!=He&&s.push(l,l+a.nodeSize,u)}});let i=Rm(o?Lm(t):t,-n).sort(Rn);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||(r.onRemove&&r.onRemove(i[a].spec),i.splice(a--,1));return i.length||s.length?new De(i,s):He}function Rn(t,e){return t.from-e.from||t.to-e.to}function ic(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let o=e[s];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[s]=o.copy(o.from,r.to),Od(e,s+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Od(e,s,r.copy(o.from,r.to)));break}}}return e}function Od(t,e,n){for(;e<t.length&&Rn(n,t[e])>0;)e++;t.splice(e,0,n)}class ye extends Y{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ye.valid(r)?new ye(r):Y.near(r)}content(){return F.empty}eq(e){return e instanceof ye&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ye(e.resolve(n.pos))}getBookmark(){return new ac(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!FC(e)||!HC(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ye.valid(e))return e;let s=e.pos,o=null;for(let i=e.depth;;i--){let a=e.node(i);if(n>0?e.indexAfter(i)<a.childCount:e.index(i)>0){o=a.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;s+=n;let l=e.doc.resolve(s);if(ye.valid(l))return l}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!H.isSelectable(o)){e=e.doc.resolve(s+o.nodeSize*n),r=!1;continue e}break}o=i,s+=n;let a=e.doc.resolve(s);if(ye.valid(a))return a}return null}}}ye.prototype.visible=!1;ye.findFrom=ye.findGapCursorFrom;Y.jsonID("gapcursor",ye);class ac{constructor(e){this.pos=e}map(e){return new ac(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ye.valid(n)?new ye(n):Y.near(n)}}function $m(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function FC(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||$m(s.type))return!0;if(s.inlineContent)return!1}}return!0}function HC(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||$m(s.type))return!0;if(s.inlineContent)return!1}}return!0}function WC(){return new pe({props:{decorations:KC,createSelectionBetween(t,e,n){return e.pos==n.pos&&ye.valid(n)?new ye(n):null},handleClick:UC,handleKeyDown:VC,handleDOMEvents:{beforeinput:qC}}})}const VC=wp({ArrowLeft:Us("horiz",-1),ArrowRight:Us("horiz",1),ArrowUp:Us("vert",-1),ArrowDown:Us("vert",1)});function Us(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,o){let i=r.selection,a=e>0?i.$to:i.$from,l=i.empty;if(i instanceof V){if(!o.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ye.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new ye(c))),!0):!1}}function UC(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ye.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&H.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ye(r))),!0)}function qC(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ye))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=$.empty;for(let i=r.length-1;i>=0;i--)s=$.from(r[i].createAndFill(null,s));let o=t.state.tr.replace(n.pos,n.pos,new F(s,0,0));return o.setSelection(V.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function KC(t){if(!(t.selection instanceof ye))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[Mt.widget(t.selection.head,e,{key:"gapcursor"})])}var Co=200,Ae=function(){};Ae.prototype.append=function(e){return e.length?(e=Ae.from(e),!this.length&&e||e.length<Co&&this.leafAppend(e)||this.length<Co&&e.leafPrepend(this)||this.appendInner(e)):this};Ae.prototype.prepend=function(e){return e.length?Ae.from(e).append(this):this};Ae.prototype.appendInner=function(e){return new JC(this,e)};Ae.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ae.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ae.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ae.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ae.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(e(o,i))},n,r),s};Ae.from=function(e){return e instanceof Ae?e:e&&e.length?new _m(e):Ae.empty};var _m=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new e(this.values.slice(s,o))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,o,i,a){for(var l=o;l<i;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,o,i,a){for(var l=o-1;l>=i;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Co)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Co)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ae);Ae.empty=new _m([]);var JC=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,o,i){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(o,a),i)===!1||o>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,o)-a,i+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,i){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(o,a)-a,i+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(s,a),o,i)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ae);const YC=500;class ft{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;n&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),o=s.maps.length),o--,u.push(d);return}if(s){u.push(new kt(d.map));let h=d.step.map(s.slice(o)),m;h&&i.maybeStep(h).doc&&(m=i.mapping.maps[i.mapping.maps.length-1],c.push(new kt(m,void 0,void 0,c.length+u.length))),o--,m&&s.appendMap(m,o)}else i.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(o)):d.selection,l=new ft(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(e,n,r,s){let o=[],i=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new kt(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?o.pop():a=a.slice(0,a.length-1)),o.push(f),n&&(i++,n=void 0),s||(l=f)}let c=i-r.depth;return c>XC&&(a=GC(a,c),i-=c),new ft(a.append(o),i)}remapping(e,n){let r=new ls;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new ft(this.items.append(e.map(n=>new kt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),o=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=n;this.items.forEach(f=>{let h=o.getMirror(--l);if(h==null)return;i=Math.min(i,h);let m=o.maps[h];if(f.step){let y=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(o.slice(l+1,h));g&&a++,r.push(new kt(m,y,g))}else r.push(new kt(m))},s);let c=[];for(let f=n;f<i;f++)c.push(new kt(o.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new ft(u,a);return d.emptyItemCount()>YC&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],o=0;return this.items.forEach((i,a)=>{if(a>=e)s.push(i),i.selection&&o++;else if(i.step){let l=i.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=i.selection&&i.selection.map(n.slice(r));u&&o++;let d=new kt(c.invert(),l,u),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else i.map&&r--},this.items.length,0),new ft(Ae.from(s.reverse()),o)}}ft.empty=new ft(Ae.empty,0);function GC(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class kt{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new kt(n.getMap().invert(),n,this.selection)}}}class nn{constructor(e,n,r,s,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const XC=20;function QC(t,e,n,r){let s=n.getMeta(Pn),o;if(s)return s.historyState;n.getMeta(tw)&&(t=new nn(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(Pn))return i.getMeta(Pn).redo?new nn(t.done.addTransform(n,void 0,r,no(e)),t.undone,Ad(n.mapping.maps),t.prevTime,t.prevComposition):new nn(t.done,t.undone.addTransform(n,void 0,r,no(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!i&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!ZC(n,t.prevRanges)),c=i?qi(t.prevRanges,n.mapping):Ad(n.mapping.maps);return new nn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,no(e)),ft.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new nn(t.done.rebased(n,o),t.undone.rebased(n,o),qi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new nn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),qi(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ZC(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&s>=e[o]&&(n=!0)}),n}function Ad(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,o,i)=>e.push(o,i));return e}function qi(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),o=e.map(t[r+1],-1);s<=o&&n.push(s,o)}return n}function ew(t,e,n){let r=no(e),s=Pn.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),s,r),l=new nn(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(i).setMeta(Pn,{redo:n,historyState:l})}let Ki=!1,Id=null;function no(t){let e=t.plugins;if(Id!=e){Ki=!1,Id=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ki=!0;break}}return Ki}const Pn=new Ce("history"),tw=new Ce("closeHistory");function nw(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new pe({key:Pn,state:{init(){return new nn(ft.empty,ft.empty,null,0,-1)},apply(e,n,r){return QC(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?zm:r=="historyRedo"?Fm:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Bm(t,e){return(n,r)=>{let s=Pn.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let o=ew(s,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const zm=Bm(!1,!0),Fm=Bm(!0,!0);be.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new pe({key:new Ce("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,o=this.options.autoTrim;if(s==null||s===0||o===!1){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const a=i-s,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,a=i-(o-r),l=i;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}});const rw=be.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[QS(this.options)]}});be.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new pe({key:new Ce("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,o=[];if(!n||!r)return xe.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(!l.isText){if(!(s>=c&&s<=c+l.nodeSize-1))return!1;i+=1}});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(Kt.node(c,c+l.nodeSize,{class:this.options.className}))}),xe.create(t,o)}}})]}});const sw=be.create({name:"gapCursor",addProseMirrorPlugins(){return[WC()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=oe(U(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),Hm="placeholder",jd=new Ce("tiptap__placeholder");function Wm(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:o,isEmptyDoc:i,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=t,u=[l];return i&&u.push(c),Kt.node(s,s+o.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:o,pos:s,hasAnchor:a}):n})}function Vm(t,e){return typeof t=="function"?t(e):t}function Um({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:o,to:i}){const{anchor:a}=s,l=[],c=t.isEmpty;return r.nodesBetween(o,i,(u,d)=>{const f=a>=d&&a<=d+u.nodeSize,h=!u.isLeaf&&Ms(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&l.push(Wm({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Vm(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),l}function qm({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=s,i=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const l=r.resolve(o),c=l.depth>0?l.node(1):l.nodeAfter,u=l.depth>0?l.before(1):o;if(c&&c.type.isTextblock&&Ms(c)){const d=o>=u&&o<=u+c.nodeSize;i.push(Wm({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Vm(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else i.push(...Um({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return xe.create(r,i)}function Gr(t,e){const n=t.resolve(e);if(n.depth===0){var r;const o=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!o)return{from:e,to:e};const i=n.nodeAfter?e:e-o.nodeSize;return{from:i,to:i+o.nodeSize}}const s=n.before(1);return{from:s,to:s+n.node(1).nodeSize}}function Xr(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function ow(t,e,n){const r=[];return t.forEach((s,o)=>{const i=o,a=i+s.nodeSize,l=i+1,c=a+1;l<n&&c>e&&r.push({from:i,to:a})}),r}function iw(t){if(t.length===0)return[];const e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=n[n.length-1],o=e[r];o.from<=s.to?s.to=Math.max(s.to,o.to):n.push({...o})}return n}function aw(t,e){const n=ow(t,e.from,e.to);return n.push(Xr(t,Gr(t,e.from))),e.to>e.from?n.push(Xr(t,Gr(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Xr(t,Gr(t,Math.min(e.from+1,t.content.size)))),n}function lw(t,e,n){const r=[];if(t.docChanged){const s=pi(t);for(const o of s)r.push(...aw(n.doc,o.newRange))}return t.selectionSet&&(r.push(Xr(n.doc,Gr(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Xr(n.doc,Gr(n.doc,n.selection.anchor)))),iw(r)}function cw(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function uw({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:o,selection:i}){let a=t;for(const l of e){const{from:c,to:u}=cw(l.from,l.to,o),d=a.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(a=a.remove(d));const f=Um({editor:n,options:r,dataAttribute:s,doc:o,selection:i,from:c,to:u});f.length&&(a=a.add(o,f))}return a}function dw({editor:t,options:e,dataAttribute:n}){return{init(r,s){const o=qm({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return o??xe.empty},apply(r,s,o,i){return!r.docChanged&&!r.selectionSet?s:uw({decorations:s.map(r.mapping,r.doc),ranges:lw(r,o,i),editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection})}}}function fw(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function hw({editor:t,options:e}){const n=e.dataAttribute?`data-${fw(e.dataAttribute)}`:`data-${Hm}`,r=e.showOnlyCurrent&&!e.includeChildren;return new pe({key:jd,...r?{}:{state:dw({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:o})=>qm({editor:t,options:e,dataAttribute:n,doc:s,selection:o}):s=>{var o;return e.showOnlyWhenEditable&&!t.isEditable?xe.empty:(o=jd.getState(s))!==null&&o!==void 0?o:xe.empty}}})}const lA=be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Hm,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[hw({editor:this.editor,options:this.options})]}});function Ka(t,e){return!t.selection.empty&&!Fp(t.selection)&&e.isEditable}function pw(t,e){return Ka(t,e)&&!e.isFocused&&!e.view.dragging}function mw(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function gw(t){t.focus()}be.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new pe({key:new Ce("selection"),props:{decorations(n){return pw(n,t)?xe.create(n.doc,[Kt.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Ka(n.state,t)&&mw(),!1},focus(n){return Ka(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&gw(n)}),!1}}}})]}});function Rd({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}const yw=be.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ce(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new pe({key:e,appendTransaction:(s,o,i)=>{const{doc:a,tr:l,schema:c}=i,u=e.getState(i),d=a.content.size,f=c.nodes[n];if(!s.some(h=>h.getMeta("skipTrailingNode"))&&u)return l.insert(d,f.create())},state:{init:(s,o)=>{const i=o.tr.doc.lastChild;return!Rd({node:i,types:r})},apply:(s,o)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return o;const i=s.doc.lastChild;return!Rd({node:i,types:r})}}})]}}),xw=be.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>zm(t,e),redo:()=>({state:t,dispatch:e})=>Fm(t,e)}},addProseMirrorPlugins(){return[nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Km=new WeakSet,Jm=new WeakSet;function xn(t){const e=t;return Km.add(e),e}function Ja(t){return Array.isArray(t)&&Km.has(t)}function Ym(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&Jm.has(e)&&!Ja(e)?Ym(e):[e])}function bw(t,e){if(t==="slot")return 0;if(t instanceof Function){const s=t(e);return Array.isArray(s)&&!Ja(s)&&!Jm.has(s)?xn(s):s}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(Ja(n))return xn([t,r,n]);if(n.length===0)return xn([t,r]);const s=Ym(n);return s.length===0?xn([t,r]):xn([t,r,...s])}return n!=null?xn([t,r,n]):xn([t,r])}const wo=(t,e)=>bw(t,e),vw=(t,e)=>{var n;const{state:r}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:o}=s;if(o.parentOffset!==0)return!1;const i=o.depth-1;if(i<0)return!1;const a=o.node(i),l=o.index(i);if(l===0)return!1;if(a.type===e)return t.commands.lift(e.name);const c=a.child(l-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const u=o.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;const h=o.parent.content,m=new F(h,0,0);return d.replace(u,o.after(),m),d.setSelection(V.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},kw=/^\s*>\s$/,Sw=qe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return wo("blockquote",{...Se(this.options.HTMLAttributes,t),children:wo("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,o)=>{var i,a;const l=((i=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,s,o))!==null&&i!==void 0?i:e.renderChildren([s])).split(`
@@ -138,7 +138,7 @@ ${n}
138
138
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;const o=t.split(`
139
139
  `),[i,a]=HN(o);if(i.length===0)return;const l=xg(i,i[0].indent,n);if(l.length!==0)return{type:"list",ordered:!0,start:((r=i[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=i[0])===null||s===void 0?void 0:s.type,items:l,raw:o.slice(0,a).join(`
140
140
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qN,this.editor.getAttributes(Ud)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new pe({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(s?.trim())return!1;const o=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!o)return!1;const i=VN(o);if(!i)return!1;try{const a=t.state.schema.nodeFromJSON(i),l=t.state.tr.replaceSelectionWith(a);return t.dispatch(l),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=Sr({find:qd,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Sr({find:qd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Ud)}),joinPredicate:t,editor:this.editor})),[e]}}),KN=/^\s*(\[([( |x])?\])\s$/,JN="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",YN=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},GN=qe.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Se(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return Yp(t,e,r)},addExtensions(){return this.options.nested?[dg(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");i.style.cssText=JN;const c=d=>{const f=YN(d,d.attrs.checked,this.options.a11y);a.setAttribute("aria-label",f),i.textContent=f};c(t),o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=n();if(typeof m!="number")return!1;const y=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...y?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,o.append(a,i),s.append(o,l),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=kr(d,f),m=new Set(Object.keys(h)),y=this.options.HTMLAttributes;return u.forEach(g=>{m.has(g)||(g in y?s.setAttribute(g,y[g]):s.removeAttribute(g))}),Object.entries(h).forEach(([g,x])=>{x==null?g in y?s.setAttribute(g,y[g]):s.removeAttribute(g):s.setAttribute(g,x)}),u=m,!0}}}},addInputRules(){return[Sr({find:KN,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),XN=qe.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Se(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
141
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const i=ad(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i){const a={type:"taskList",raw:i.raw,items:i.items},l=o.slice(i.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(o)},s=ad(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});be.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(ug.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(mg.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(yg.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(bg.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(GN.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(XN.configure(this.options.taskList)),t}});const Gs="&nbsp;",ta=" ",QN=qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Se(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Gs||n[0].text===Gs||n[0].raw===ta||n[0].text===ta)&&r.length===1&&r[0].type==="text"&&(r[0].text===Gs||r[0].text===ta)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,o;const i=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(o=n.previousNode)===null||o===void 0?void 0:o.type)==="paragraph"&&i.length===0?Gs:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ZN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,eM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,tM=Jn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Se(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Un({find:ZN,type:this.type})]},addPasteRules(){return[hn({find:eM,type:this.type})]}}),nM=qe.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),rM=Jn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Se(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),sM=be.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(Tw.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(Sw.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ug.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Ow.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(jw.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Rw.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(rw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(sw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(Pw.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Lw.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(xw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push($w.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Hw.configure(this.options.italic)),this.options.listItem!==!1&&t.push(mg.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(yg.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(cg.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(bg.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(QN.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(tM.configure(this.options.strike)),this.options.text!==!1&&t.push(nM.configure(this.options.text)),this.options.underline!==!1){var r;t.push(rM.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(yw.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}});var oM=sM;const bn=16,sl=2.5,ol=(bn-sl)/2,na=2*Math.PI*ol;function vg(t){const e=_.c(29),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:s,outputTokens:o,cost:i}=n;if(!r&&!s&&!o)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(P1,{size:12}),e[0]=a):a=e[0];let l;e[1]!==i||e[2]!==r?(l=i>0?`$${i.toFixed(4)}`:r.toLocaleString(),e[1]=i,e[2]=r,e[3]=l):l=e[3];let c;e[4]!==l?(c=p.jsx(_n,{asChild:!0,children:p.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[a,p.jsx("span",{className:"text-sm font-mono tabular-nums",children:l})]})}),e[4]=l,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("span",{className:"text-muted",children:"in"}),e[7]=d):d=e[7];let f;e[8]!==s?(f=s.toLocaleString(),e[8]=s,e[9]=f):f=e[9];let h;e[10]!==f?(h=p.jsx("span",{className:"text-right tabular-nums",children:f}),e[10]=f,e[11]=h):h=e[11];let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=p.jsx("span",{className:"text-muted",children:"out"}),e[12]=m):m=e[12];const y=o-(n.reasoningTokens??0);let g;e[13]!==y?(g=y.toLocaleString(),e[13]=y,e[14]=g):g=e[14];let x;e[15]!==g?(x=p.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n?(b=(n.cacheReadTokens>0||n.cacheWriteTokens>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]}),e[17]=n,e[18]=b):b=e[18];let v;e[19]!==i?(v=i>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cost"}),p.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]})]}),e[19]=i,e[20]=v):v=e[20];let k;e[21]!==x||e[22]!==b||e[23]!==v||e[24]!==h?(k=p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[u,p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,h,m,x,b,v]})]}),e[21]=x,e[22]=b,e[23]=v,e[24]=h,e[25]=k):k=e[25];let N;return e[26]!==k||e[27]!==c?(N=p.jsxs(zn,{children:[c,k]}),e[26]=k,e[27]=c,e[28]=N):N=e[28],N}function iM(t){const e=_.c(19),{usage:n,duration:r}=t,s=r!=null&&r>0,o=n!=null&&(n.cost??0)>0,i=n!=null&&(n.totalTokens??0)>0;if(!s&&!o&&!i)return null;let a;e[0]!==r||e[1]!==s?(a=s?Fn(r/1e3):null,e[0]=r,e[1]=s,e[2]=a):a=e[2];const l=a;let c;e[3]!==r||e[4]!==l||e[5]!==n?(c=l&&p.jsxs(zn,{children:[p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:l})}),p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[p.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),p.jsx("span",{className:"tabular-nums",children:Fn(r/1e3)}),(n?.reasoningTokens??0)>0&&p.jsxs("span",{className:"ml-2 opacity-50",children:[n.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=r,e[4]=l,e[5]=n,e[6]=c):c=e[6];let u;e[7]!==o||e[8]!==s||e[9]!==i?(u=s&&(o||i)&&p.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=s,e[9]=i,e[10]=u):u=e[10];let d;e[11]!==o||e[12]!==i||e[13]!==n?(d=(o||i)&&p.jsxs(zn,{children:[p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:o?`$${n.cost.toFixed(4)}`:`${n.totalTokens.toLocaleString()} tok`})}),p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[p.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[p.jsx("span",{className:"opacity-60",children:"in"}),p.jsx("span",{className:"text-right tabular-nums",children:(n.inputTokens??0).toLocaleString()}),p.jsx("span",{className:"opacity-60",children:"out"}),p.jsx("span",{className:"text-right tabular-nums",children:((n.outputTokens??0)-(n?.reasoningTokens??0)).toLocaleString()}),(n?.reasoningTokens??0)>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-60",children:"think"}),p.jsx("span",{className:"text-right tabular-nums",children:n.reasoningTokens.toLocaleString()})]}),((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-60",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]})]})]})]}),e[11]=o,e[12]=i,e[13]=n,e[14]=d):d=e[14];let f;return e[15]!==c||e[16]!==u||e[17]!==d?(f=p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c,u,d]}),e[15]=c,e[16]=u,e[17]=d,e[18]=f):f=e[18],f}function uA(t){const e=_.c(49),{usage:n,totalTokens:r,contextWindow:s,onOpenContextPanel:o}=t,i=Math.min(r/s*100,100),a=na-i/100*na,l=n?.cost??0,c=n?.inputTokens??0,u=n?.outputTokens??0;let d;e[0]!==i?(d=i.toFixed(0),e[0]=i,e[1]=d):d=e[1];let f;e[2]!==l?(f=l>0?`, $${l.toFixed(2)}`:"",e[2]=l,e[3]=f):f=e[3];const h=`Context usage: ${d}%${f}`,m=o?"cursor-pointer":"cursor-default";let y;e[4]!==m?(y=Q("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",m),e[4]=m,e[5]=y):y=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx("circle",{cx:bn/2,cy:bn/2,r:ol,fill:"none",stroke:"currentColor",strokeWidth:sl,className:"opacity-15"}),e[6]=g):g=e[6];const x=i>90?"text-destructive":i>70?"text-warning":"text-muted-foreground";let b;e[7]!==x?(b=Q(x),e[7]=x,e[8]=b):b=e[8];let v;e[9]!==a||e[10]!==b?(v=p.jsxs("svg",{width:bn,height:bn,className:"-rotate-90",children:[g,p.jsx("circle",{cx:bn/2,cy:bn/2,r:ol,fill:"none",stroke:"currentColor",strokeWidth:sl,strokeDasharray:na,strokeDashoffset:a,strokeLinecap:"round",className:b})]}),e[9]=a,e[10]=b,e[11]=v):v=e[11];let k;e[12]!==i?(k=i.toFixed(0),e[12]=i,e[13]=k):k=e[13];let N;e[14]!==l?(N=l>0?` · $${l.toFixed(2)}`:"",e[14]=l,e[15]=N):N=e[15];let C;e[16]!==k||e[17]!==N?(C=p.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[k,"%",N]}),e[16]=k,e[17]=N,e[18]=C):C=e[18];let S;e[19]!==o||e[20]!==C||e[21]!==h||e[22]!==y||e[23]!==v?(S=p.jsx(_n,{asChild:!0,children:p.jsxs("button",{type:"button",onClick:o,"aria-label":h,className:y,children:[v,C]})}),e[19]=o,e[20]=C,e[21]=h,e[22]=y,e[23]=v,e[24]=S):S=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let M;e[26]!==r?(M=r.toLocaleString(),e[26]=r,e[27]=M):M=e[27];let T;e[28]!==s?(T=s.toLocaleString(),e[28]=s,e[29]=T):T=e[29];let O;e[30]!==i?(O=i.toFixed(1),e[30]=i,e[31]=O):O=e[31];let A;e[32]!==M||e[33]!==T||e[34]!==O?(A=p.jsxs("span",{className:"text-right tabular-nums",children:[M," / ",T," (",O,"%)"]}),e[32]=M,e[33]=T,e[34]=O,e[35]=A):A=e[35];let P;e[36]!==l||e[37]!==c||e[38]!==u?(P=l>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cost"}),p.jsxs("span",{className:"text-right tabular-nums",children:["$",l.toFixed(4)]}),p.jsx("span",{className:"text-muted",children:"in"}),p.jsx("span",{className:"text-right tabular-nums",children:c.toLocaleString()}),p.jsx("span",{className:"text-muted",children:"out"}),p.jsx("span",{className:"text-right tabular-nums",children:u.toLocaleString()})]}),e[36]=l,e[37]=c,e[38]=u,e[39]=P):P=e[39];let D;e[40]!==n?(D=((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]}),e[40]=n,e[41]=D):D=e[41];let E;e[42]!==A||e[43]!==P||e[44]!==D?(E=p.jsx(Bn,{side:"top",className:"font-mono text-[11px]",children:p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,A,P,D]})}),e[42]=A,e[43]=P,e[44]=D,e[45]=E):E=e[45];let j;return e[46]!==S||e[47]!==E?(j=p.jsxs(zn,{children:[S,E]}),e[46]=S,e[47]=E,e[48]=j):j=e[48],j}var Si="Collapsible",[aM,dA]=E1(Si),[lM,vc]=aM(Si),kg=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=t,[l,c]=S1({prop:r,defaultProp:s??!1,onChange:i,caller:Si});return p.jsx(lM,{scope:n,disabled:o,contentId:C1(),open:l,onOpenToggle:L.useCallback(()=>c(u=>!u),[c]),children:p.jsx(pl.div,{"data-state":wc(l),"data-disabled":o?"":void 0,...a,ref:e})})});kg.displayName=Si;var Sg="CollapsibleTrigger",kc=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=vc(Sg,n);return p.jsx(pl.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":wc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:w1(t.onClick,s.onOpenToggle)})});kc.displayName=Sg;var Sc="CollapsibleContent",Cc=L.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=vc(Sc,t.__scopeCollapsible);return p.jsx(N1,{present:n||s.open,children:({present:o})=>p.jsx(cM,{...r,ref:e,present:o})})});Cc.displayName=Sc;var cM=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=t,i=vc(Sc,n),[a,l]=L.useState(r),c=L.useRef(null),u=M1(e,c),d=L.useRef(0),f=d.current,h=L.useRef(0),m=h.current,y=i.open||a,g=L.useRef(y),x=L.useRef(void 0);return L.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),T1(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const v=b.getBoundingClientRect();d.current=v.height,h.current=v.width,g.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),l(r)}},[i.open,r]),p.jsx(pl.div,{"data-state":wc(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:y&&s})});function wc(t){return t?"open":"closed"}var uM=kg,fA=kc,hA=Cc;function dM(t){const e=_.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(uM,{"data-slot":"collapsible",...n}),e[2]=n,e[3]=r):r=e[3],r}function fM(t){const e=_.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(kc,{"data-slot":"collapsible-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function hM(t){const e=_.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(Cc,{"data-slot":"collapsible-content",...n}),e[2]=n,e[3]=r):r=e[3],r}function ne({icon:t,title:e,usage:n,summary:r,state:s,detail:o,detailVariant:i="code",forceOpen:a,variant:l="default",trailing:c,iconDestructive:u,alwaysChevron:d,defaultOpen:f,children:h}){const m=J(),[y,g]=L.useState(f??!1),{handleCopy:x,copied:b}=$f(),v=s==="loading",k=s==="error",C=!!(o&&o.trim())||!!h,S=l==="subtask",w=(a??!1)||y,M=ny({initial:v?"instant":!1}),T=p.jsxs(dM,{open:w,onOpenChange:a?void 0:g,className:"min-w-0",children:[p.jsxs(fM,{disabled:!C,className:Q("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",C&&"[@media(hover:hover)]:hover:bg-accent/30",!C&&"cursor-default",v&&"shimmer"),"aria-disabled":!C,children:[p.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:d?p.jsx(ma,{className:Q("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:Q("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",u?"[&>svg]:text-destructive/70":k?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",C&&(w?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),C&&p.jsx("div",{className:Q("absolute inset-0 flex items-center justify-center transition-opacity duration-150",w?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:p.jsx(ma,{className:Q("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")})})]})}),p.jsx("span",{className:Q("shrink-0 text-[14px] font-normal",k?"text-warning/80":"text-foreground"),children:e}),r?p.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):p.jsx("div",{className:"flex-1"}),c&&p.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:c}),p.jsx(vg,{usage:n})]}),C&&p.jsx(hM,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:h||(i==="prose"?p.jsx("div",{className:"mt-1 mb-1",children:p.jsx("div",{ref:M.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:p.jsx("p",{ref:M.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:o})})}):p.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:p.jsx("div",{ref:M.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:p.jsxs("div",{ref:M.contentRef,className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:p.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:o})}),p.jsx("button",{type:"button",onClick:()=>x(o),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":m("common.copy"),children:b?p.jsx(xl,{className:"size-3.5"}):p.jsx(Lf,{className:"size-3.5"})})]})})}))})]});return S?p.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:T}):T}function Le(t){const e=_.c(4),{latency:n}=t;if(n==null||n<=0)return null;let r;e[0]!==n?(r=Fn(n),e[0]=n,e[1]=r):r=e[1];let s;return e[2]!==r?(s=p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:r}),e[2]=r,e[3]=s):s=e[3],s}const Cg=4;function wg(t){const e=_.c(8),{count:n,noun:r,onClick:s}=t,o=J();let i;e[0]!==n||e[1]!==r||e[2]!==o?(i=o("common.seeAll",{count:n,noun:r}),e[0]=n,e[1]=r,e[2]=o,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(Pf,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==i?(l=p.jsxs("button",{type:"button",onClick:s,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[i,a]}),e[5]=s,e[6]=i,e[7]=l):l=e[7],l}function Ng(t){const e=_.c(12),{message:n,className:r}=t,s=n.created_at??n.metadata?.created_at??null;let o,i,a,l;if(e[0]!==r||e[1]!==s){l=Symbol.for("react.early_return_sentinel");e:{const u=bl(s);if(u===null){l=null;break e}const d=new Date(u);o=d.toLocaleString(),e[6]!==r?(i=Q("text-[11px] text-muted-foreground/60 select-none",r),e[6]=r,e[7]=i):i=e[7],a=d.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=r,e[1]=s,e[2]=o,e[3]=i,e[4]=a,e[5]=l}else o=e[2],i=e[3],a=e[4],l=e[5];if(l!==Symbol.for("react.early_return_sentinel"))return l;let c;return e[8]!==o||e[9]!==i||e[10]!==a?(c=p.jsx("span",{title:o,className:i,children:a}),e[8]=o,e[9]=i,e[10]=a,e[11]=c):c=e[11],c}function il(t){const e=_.c(9),{since:n}=t;let r;e[0]!==n?(r=()=>Yc(n,Date.now()),e[0]=n,e[1]=r):r=e[1];const[s,o]=L.useState(r);let i,a;e[2]!==n?(i=()=>{const d=setInterval(()=>o(Yc(n,Date.now())),100);return()=>clearInterval(d)},a=[n],e[2]=n,e[3]=i,e[4]=a):(i=e[3],a=e[4]),L.useEffect(i,a);const l=s/1e3;let c;e[5]!==l?(c=Fn(l),e[5]=l,e[6]=c):c=e[6];let u;return e[7]!==c?(u=p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:c}),e[7]=c,e[8]=u):u=e[8],u}const Mg=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function pM(){const t=_.c(5),[e]=L.useState(mM);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},t[0]=n):n=t[0];let r;t[1]!==e?(r=Mg.map((o,i)=>{const{delay:a}=o;return p.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[i],animation:"grid-ripple 1s ease infinite",animationDelay:`${a}ms`}},i)}),t[1]=e,t[2]=r):r=t[2];let s;return t[3]!==r?(s=p.jsx("div",{className:"grid",style:n,children:r}),t[3]=r,t[4]=s):s=t[4],s}function mM(){const t=`var(--chart-${Math.ceil(Math.random()*5)})`;return Mg.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":t)}const Jd=new Map;function Tg(t){let e=Jd.get(t);return e||(e={tick:0,subscribers:new Set,intervalId:null},Jd.set(t,e)),e}function gM(t,e){const n=Tg(t);return n.subscribers.add(e),n.intervalId===null&&(n.intervalId=setInterval(()=>{n.tick+=1;for(const r of n.subscribers)r()},t)),()=>{n.subscribers.delete(e),n.subscribers.size===0&&n.intervalId!==null&&(clearInterval(n.intervalId),n.intervalId=null)}}function Nc(t){const e=_.c(3),n=t===void 0?6e4:t;let r,s;return e[0]!==n?(r=o=>gM(n,o),s=()=>Tg(n).tick,e[0]=n,e[1]=r,e[2]=s):(r=e[1],s=e[2]),L.useSyncExternalStore(r,s,yM)}function yM(){return 0}function xM(t){return{planning:{icon:p.jsx($1,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.planningLabel"),detail:t("chat.thinkingIndicator.planningDetail")},thinking:{icon:p.jsx(ri,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.thinkingLabel"),detail:t("chat.thinkingIndicator.thinkingDetail")}}}const bM=1200;function al(t){const e=_.c(8),{icon:n,title:r,summary:s,detail:o,state:i,detailVariant:a,trailing:l}=t,c=a===void 0?"prose":a;let u;return e[0]!==o||e[1]!==c||e[2]!==n||e[3]!==i||e[4]!==s||e[5]!==r||e[6]!==l?(u=p.jsx(ne,{icon:n,title:r,summary:s,detail:o,state:i,detailVariant:c,trailing:l}),e[0]=o,e[1]=c,e[2]=n,e[3]=i,e[4]=s,e[5]=r,e[6]=l,e[7]=u):u=e[7],u}function vM(t){const e=_.c(22),{startedAt:n}=t,r=J(),s=wr()?.runStatusStage??null,[o,i]=L.useState("planning");let a,l;if(e[0]!==s?(a=()=>{if(s!==null)return;const y=setTimeout(()=>{i("thinking")},bM);return()=>{clearTimeout(y)}},l=[s],e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]),L.useEffect(a,l),s!==null){let y;e[3]!==s||e[4]!==r?(y=g0(r,s),e[3]=s,e[4]=r,e[5]=y):y=e[5];const g=y;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(ri,{className:"size-4"}),e[6]=x):x=e[6];const b=`${g.label}...`;let v;e[7]!==n?(v=n!==null&&p.jsx(il,{since:n}),e[7]=n,e[8]=v):v=e[8];let k;return e[9]!==g.detail||e[10]!==b||e[11]!==v?(k=p.jsx(al,{icon:x,title:b,summary:g.detail,state:"loading",trailing:v}),e[9]=g.detail,e[10]=b,e[11]=v,e[12]=k):k=e[12],k}let c;e[13]!==r?(c=xM(r),e[13]=r,e[14]=c):c=e[14];const d=c[o],f=`${d.label}...`;let h;e[15]!==n?(h=n!==null&&p.jsx(il,{since:n}),e[15]=n,e[16]=h):h=e[16];let m;return e[17]!==d.detail||e[18]!==d.icon||e[19]!==f||e[20]!==h?(m=p.jsx(al,{icon:d.icon,title:f,summary:d.detail,state:"loading",trailing:h}),e[17]=d.detail,e[18]=d.icon,e[19]=f,e[20]=h,e[21]=m):m=e[21],m}function kM(t){const e=_.c(3),{startedAt:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(pM,{}),e[0]=r):r=e[0];let s;return e[1]!==n?(s=p.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[r,p.jsx(il,{since:n})]}),e[1]=n,e[2]=s):s=e[2],s}const SM=2e4;function CM(t){const e=_.c(9),{startedAt:n}=t,r=J();Nc(1e3);const s=wr(),i=(n!==null?Date.now()-n:0)>=SM;let a;e[0]!==n?(a=p.jsx(vM,{startedAt:n}),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==i||e[3]!==s||e[4]!==r?(l=i&&s?.stop&&p.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[p.jsx("span",{children:r("chat.thinkingIndicator.takingLonger")}),p.jsx("button",{type:"button",onClick:()=>s.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:r("chat.thinkingIndicator.cancel")})]}),e[2]=i,e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=p.jsxs("div",{className:"flex flex-col gap-0.5",children:[a,l]}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function wM(t){const e=_.c(24),{duration:n,parts:r,isStreaming:s}=t,o=J();let i;e[0]!==r?(i=r.every(TM),e[0]=r,e[1]=i):i=e[1];const a=i;let l;e[2]!==n||e[3]!==o?(l=n&&n/1e3>1?o("chat.thinkingIndicator.thoughtFor",{duration:Fn(n/1e3)}):o("chat.thinkingIndicator.thought"),e[2]=n,e[3]=o,e[4]=l):l=e[4];const c=l;let u;if(e[5]!==a||e[6]!==s||e[7]!==r){const v=r.map(MM).join(`
141
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const i=ad(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i){const a={type:"taskList",raw:i.raw,items:i.items},l=o.slice(i.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(o)},s=ad(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,i)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:i}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});be.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(ug.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(mg.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(yg.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(bg.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(GN.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(XN.configure(this.options.taskList)),t}});const Gs="&nbsp;",ta=" ",QN=qe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Se(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Gs||n[0].text===Gs||n[0].raw===ta||n[0].text===ta)&&r.length===1&&r[0].type==="text"&&(r[0].text===Gs||r[0].text===ta)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,o;const i=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(o=n.previousNode)===null||o===void 0?void 0:o.type)==="paragraph"&&i.length===0?Gs:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ZN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,eM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,tM=Jn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Se(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Un({find:ZN,type:this.type})]},addPasteRules(){return[hn({find:eM,type:this.type})]}}),nM=qe.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),rM=Jn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Se(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),sM=be.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(Tw.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(Sw.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ug.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Ow.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(jw.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(Rw.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(rw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(sw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(Pw.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(Lw.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(xw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push($w.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Hw.configure(this.options.italic)),this.options.listItem!==!1&&t.push(mg.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(yg.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(cg.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(bg.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(QN.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(tM.configure(this.options.strike)),this.options.text!==!1&&t.push(nM.configure(this.options.text)),this.options.underline!==!1){var r;t.push(rM.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(yw.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}});var oM=sM;const bn=16,sl=2.5,ol=(bn-sl)/2,na=2*Math.PI*ol;function vg(t){const e=_.c(29),{usage:n}=t;if(!n)return null;const{totalTokens:r,inputTokens:s,outputTokens:o,cost:i}=n;if(!r&&!s&&!o)return null;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(P1,{size:12}),e[0]=a):a=e[0];let l;e[1]!==i||e[2]!==r?(l=i>0?`$${i.toFixed(4)}`:r.toLocaleString(),e[1]=i,e[2]=r,e[3]=l):l=e[3];let c;e[4]!==l?(c=p.jsx(_n,{asChild:!0,children:p.jsxs("span",{className:"inline-flex items-center text-muted-foreground [@media(hover:hover)]:hover:text-foreground pl-1 h-6 gap-1 whitespace-nowrap shrink-0 cursor-default",children:[a,p.jsx("span",{className:"text-sm font-mono tabular-nums",children:l})]})}),e[4]=l,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx("p",{className:"text-muted text-[10px] mb-1",children:"tokens"}),e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("span",{className:"text-muted",children:"in"}),e[7]=d):d=e[7];let f;e[8]!==s?(f=s.toLocaleString(),e[8]=s,e[9]=f):f=e[9];let h;e[10]!==f?(h=p.jsx("span",{className:"text-right tabular-nums",children:f}),e[10]=f,e[11]=h):h=e[11];let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=p.jsx("span",{className:"text-muted",children:"out"}),e[12]=m):m=e[12];const y=o-(n.reasoningTokens??0);let g;e[13]!==y?(g=y.toLocaleString(),e[13]=y,e[14]=g):g=e[14];let x;e[15]!==g?(x=p.jsx("span",{className:"text-right tabular-nums",children:g}),e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n?(b=(n.cacheReadTokens>0||n.cacheWriteTokens>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]}),e[17]=n,e[18]=b):b=e[18];let v;e[19]!==i?(v=i>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cost"}),p.jsxs("span",{className:"text-right tabular-nums",children:["$",i.toFixed(4)]})]}),e[19]=i,e[20]=v):v=e[20];let k;e[21]!==x||e[22]!==b||e[23]!==v||e[24]!==h?(k=p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[u,p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[d,h,m,x,b,v]})]}),e[21]=x,e[22]=b,e[23]=v,e[24]=h,e[25]=k):k=e[25];let N;return e[26]!==k||e[27]!==c?(N=p.jsxs(zn,{children:[c,k]}),e[26]=k,e[27]=c,e[28]=N):N=e[28],N}function iM(t){const e=_.c(19),{usage:n,duration:r}=t,s=r!=null&&r>0,o=n!=null&&(n.cost??0)>0,i=n!=null&&(n.totalTokens??0)>0;if(!s&&!o&&!i)return null;let a;e[0]!==r||e[1]!==s?(a=s?Fn(r/1e3):null,e[0]=r,e[1]=s,e[2]=a):a=e[2];const l=a;let c;e[3]!==r||e[4]!==l||e[5]!==n?(c=l&&p.jsxs(zn,{children:[p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:l})}),p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[p.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"thinking"}),p.jsx("span",{className:"tabular-nums",children:Fn(r/1e3)}),(n?.reasoningTokens??0)>0&&p.jsxs("span",{className:"ml-2 opacity-50",children:[n.reasoningTokens.toLocaleString()," tok"]})]})]}),e[3]=r,e[4]=l,e[5]=n,e[6]=c):c=e[6];let u;e[7]!==o||e[8]!==s||e[9]!==i?(u=s&&(o||i)&&p.jsx("span",{className:"text-muted-foreground/40 select-none",children:"·"}),e[7]=o,e[8]=s,e[9]=i,e[10]=u):u=e[10];let d;e[11]!==o||e[12]!==i||e[13]!==n?(d=(o||i)&&p.jsxs(zn,{children:[p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground cursor-default [@media(hover:hover)]:hover:text-foreground transition-colors select-none",children:o?`$${n.cost.toFixed(4)}`:`${n.totalTokens.toLocaleString()} tok`})}),p.jsxs(Bn,{side:"top",className:"font-mono text-[11px]",children:[p.jsx("p",{className:"opacity-60 text-[10px] mb-1",children:"tokens"}),p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[p.jsx("span",{className:"opacity-60",children:"in"}),p.jsx("span",{className:"text-right tabular-nums",children:(n.inputTokens??0).toLocaleString()}),p.jsx("span",{className:"opacity-60",children:"out"}),p.jsx("span",{className:"text-right tabular-nums",children:((n.outputTokens??0)-(n?.reasoningTokens??0)).toLocaleString()}),(n?.reasoningTokens??0)>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-60",children:"think"}),p.jsx("span",{className:"text-right tabular-nums",children:n.reasoningTokens.toLocaleString()})]}),((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"opacity-60",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]})]})]})]}),e[11]=o,e[12]=i,e[13]=n,e[14]=d):d=e[14];let f;return e[15]!==c||e[16]!==u||e[17]!==d?(f=p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c,u,d]}),e[15]=c,e[16]=u,e[17]=d,e[18]=f):f=e[18],f}function uA(t){const e=_.c(49),{usage:n,totalTokens:r,contextWindow:s,onOpenContextPanel:o}=t,i=Math.min(r/s*100,100),a=na-i/100*na,l=n?.cost??0,c=n?.inputTokens??0,u=n?.outputTokens??0;let d;e[0]!==i?(d=i.toFixed(0),e[0]=i,e[1]=d):d=e[1];let f;e[2]!==l?(f=l>0?`, $${l.toFixed(2)}`:"",e[2]=l,e[3]=f):f=e[3];const h=`Context usage: ${d}%${f}`,m=o?"cursor-pointer":"cursor-default";let y;e[4]!==m?(y=G("flex items-center gap-1.5 text-muted-foreground hover:text-foreground h-6 px-1 shrink-0",m),e[4]=m,e[5]=y):y=e[5];let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx("circle",{cx:bn/2,cy:bn/2,r:ol,fill:"none",stroke:"currentColor",strokeWidth:sl,className:"opacity-15"}),e[6]=g):g=e[6];const x=i>90?"text-destructive":i>70?"text-warning":"text-muted-foreground";let b;e[7]!==x?(b=G(x),e[7]=x,e[8]=b):b=e[8];let v;e[9]!==a||e[10]!==b?(v=p.jsxs("svg",{width:bn,height:bn,className:"-rotate-90",children:[g,p.jsx("circle",{cx:bn/2,cy:bn/2,r:ol,fill:"none",stroke:"currentColor",strokeWidth:sl,strokeDasharray:na,strokeDashoffset:a,strokeLinecap:"round",className:b})]}),e[9]=a,e[10]=b,e[11]=v):v=e[11];let k;e[12]!==i?(k=i.toFixed(0),e[12]=i,e[13]=k):k=e[13];let N;e[14]!==l?(N=l>0?` · $${l.toFixed(2)}`:"",e[14]=l,e[15]=N):N=e[15];let C;e[16]!==k||e[17]!==N?(C=p.jsxs("span",{className:"inline-block overflow-hidden whitespace-nowrap max-w-0 opacity-0 transition-[max-width,opacity] duration-200 ease-out @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100 text-[11px] font-mono tabular-nums",children:[k,"%",N]}),e[16]=k,e[17]=N,e[18]=C):C=e[18];let S;e[19]!==o||e[20]!==C||e[21]!==h||e[22]!==y||e[23]!==v?(S=p.jsx(_n,{asChild:!0,children:p.jsxs("button",{type:"button",onClick:o,"aria-label":h,className:y,children:[v,C]})}),e[19]=o,e[20]=C,e[21]=h,e[22]=y,e[23]=v,e[24]=S):S=e[24];let w;e[25]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx("span",{className:"text-muted",children:"context"}),e[25]=w):w=e[25];let M;e[26]!==r?(M=r.toLocaleString(),e[26]=r,e[27]=M):M=e[27];let T;e[28]!==s?(T=s.toLocaleString(),e[28]=s,e[29]=T):T=e[29];let O;e[30]!==i?(O=i.toFixed(1),e[30]=i,e[31]=O):O=e[31];let A;e[32]!==M||e[33]!==T||e[34]!==O?(A=p.jsxs("span",{className:"text-right tabular-nums",children:[M," / ",T," (",O,"%)"]}),e[32]=M,e[33]=T,e[34]=O,e[35]=A):A=e[35];let P;e[36]!==l||e[37]!==c||e[38]!==u?(P=l>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cost"}),p.jsxs("span",{className:"text-right tabular-nums",children:["$",l.toFixed(4)]}),p.jsx("span",{className:"text-muted",children:"in"}),p.jsx("span",{className:"text-right tabular-nums",children:c.toLocaleString()}),p.jsx("span",{className:"text-muted",children:"out"}),p.jsx("span",{className:"text-right tabular-nums",children:u.toLocaleString()})]}),e[36]=l,e[37]=c,e[38]=u,e[39]=P):P=e[39];let D;e[40]!==n?(D=((n?.cacheReadTokens??0)>0||(n?.cacheWriteTokens??0)>0)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted",children:"cache hit"}),p.jsx("span",{className:"text-right tabular-nums",children:`${(Cl(n)*100).toFixed(0)}%`})]}),e[40]=n,e[41]=D):D=e[41];let E;e[42]!==A||e[43]!==P||e[44]!==D?(E=p.jsx(Bn,{side:"top",className:"font-mono text-[11px]",children:p.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",children:[w,A,P,D]})}),e[42]=A,e[43]=P,e[44]=D,e[45]=E):E=e[45];let j;return e[46]!==S||e[47]!==E?(j=p.jsxs(zn,{children:[S,E]}),e[46]=S,e[47]=E,e[48]=j):j=e[48],j}var Si="Collapsible",[aM,dA]=E1(Si),[lM,vc]=aM(Si),kg=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:i,...a}=t,[l,c]=S1({prop:r,defaultProp:s??!1,onChange:i,caller:Si});return p.jsx(lM,{scope:n,disabled:o,contentId:C1(),open:l,onOpenToggle:L.useCallback(()=>c(u=>!u),[c]),children:p.jsx(pl.div,{"data-state":wc(l),"data-disabled":o?"":void 0,...a,ref:e})})});kg.displayName=Si;var Sg="CollapsibleTrigger",kc=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=vc(Sg,n);return p.jsx(pl.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":wc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:w1(t.onClick,s.onOpenToggle)})});kc.displayName=Sg;var Sc="CollapsibleContent",Cc=L.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=vc(Sc,t.__scopeCollapsible);return p.jsx(N1,{present:n||s.open,children:({present:o})=>p.jsx(cM,{...r,ref:e,present:o})})});Cc.displayName=Sc;var cM=L.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=t,i=vc(Sc,n),[a,l]=L.useState(r),c=L.useRef(null),u=M1(e,c),d=L.useRef(0),f=d.current,h=L.useRef(0),m=h.current,y=i.open||a,g=L.useRef(y),x=L.useRef(void 0);return L.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),T1(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const v=b.getBoundingClientRect();d.current=v.height,h.current=v.width,g.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),l(r)}},[i.open,r]),p.jsx(pl.div,{"data-state":wc(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...o,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:y&&s})});function wc(t){return t?"open":"closed"}var uM=kg,fA=kc,hA=Cc;function dM(t){const e=_.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(uM,{"data-slot":"collapsible",...n}),e[2]=n,e[3]=r):r=e[3],r}function fM(t){const e=_.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=p.jsx(kc,{"data-slot":"collapsible-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function hM(t){const e=_.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let s;e[3]!==n?(s=G("overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:animate-none",n),e[3]=n,e[4]=s):s=e[4];let o;return e[5]!==r||e[6]!==s?(o=p.jsx(Cc,{"data-slot":"collapsible-content",className:s,...r}),e[5]=r,e[6]=s,e[7]=o):o=e[7],o}function ne({icon:t,title:e,usage:n,summary:r,state:s,detail:o,detailVariant:i="code",forceOpen:a,variant:l="default",trailing:c,iconDestructive:u,alwaysChevron:d,defaultOpen:f,children:h}){const m=J(),[y,g]=L.useState(f??!1),{handleCopy:x,copied:b}=$f(),v=s==="loading",k=s==="error",C=!!(o&&o.trim())||!!h,S=l==="subtask",w=(a??!1)||y,M=ny({initial:v?"instant":!1}),T=p.jsxs(dM,{open:w,onOpenChange:a?void 0:g,className:"min-w-0",children:[p.jsxs(fM,{disabled:!C,className:G("group/tool flex items-center gap-2 w-full py-2.5 text-left transition-colors",C&&"[@media(hover:hover)]:hover:bg-accent/30",!C&&"cursor-default",v&&"shimmer"),"aria-disabled":!C,children:[p.jsx("div",{className:"relative shrink-0 size-4 flex items-center justify-center",children:d?p.jsx(ma,{className:G("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:G("absolute inset-0 flex items-center justify-center [&>svg]:size-4 transition-opacity duration-150",u?"[&>svg]:text-destructive/70":k?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75",C&&(w?"opacity-0":"[@media(hover:hover)]:group-hover/tool:opacity-0")),children:t}),C&&p.jsx("div",{className:G("absolute inset-0 flex items-center justify-center transition-opacity duration-150",w?"opacity-100":"opacity-0 [@media(hover:hover)]:group-hover/tool:opacity-100"),children:p.jsx(ma,{className:G("size-4 text-foreground/60 transition-transform duration-200 ease-in-out",w&&"rotate-90")})})]})}),p.jsx("span",{className:G("shrink-0 text-[14px] font-normal",k?"text-warning/80":"text-foreground"),children:e}),r?p.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:r})}):p.jsx("div",{className:"flex-1"}),c&&p.jsx("div",{className:"shrink-0 flex items-center gap-1 [&_svg]:size-3.5 [&_svg]:text-muted-foreground/50",children:c}),p.jsx(vg,{usage:n})]}),C&&p.jsx(hM,{className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden",children:h||(i==="prose"?p.jsx("div",{className:"mt-1 mb-1",children:p.jsx("div",{ref:M.scrollRef,className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:p.jsx("p",{ref:M.contentRef,className:"text-xs text-muted-foreground/70 whitespace-pre-wrap leading-relaxed wrap-break-word",children:o})})}):p.jsx("div",{className:"ml-[20px] pl-3 border-l border-border/30 mt-0.5 pb-1",children:p.jsx("div",{ref:M.scrollRef,className:"flex flex-col max-h-48 overflow-y-auto",children:p.jsxs("div",{ref:M.contentRef,className:"flex items-start justify-between gap-2",children:[p.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:p.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:o})}),p.jsx("button",{type:"button",onClick:()=>x(o),className:"shrink-0 p-1.5 rounded-md text-muted-foreground/50 [@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/50 transition-colors active:scale-[0.97]","aria-label":m("common.copy"),children:b?p.jsx(xl,{className:"size-3.5"}):p.jsx(Lf,{className:"size-3.5"})})]})})}))})]});return S?p.jsx("div",{className:"pl-4 border-l border-border/40 ml-1.5",children:T}):T}function Le(t){const e=_.c(4),{latency:n}=t;if(n==null||n<=0)return null;let r;e[0]!==n?(r=Fn(n),e[0]=n,e[1]=r):r=e[1];let s;return e[2]!==r?(s=p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground",children:r}),e[2]=r,e[3]=s):s=e[3],s}const Cg=4;function wg(t){const e=_.c(8),{count:n,noun:r,onClick:s}=t,o=J();let i;e[0]!==n||e[1]!==r||e[2]!==o?(i=o("common.seeAll",{count:n,noun:r}),e[0]=n,e[1]=r,e[2]=o,e[3]=i):i=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(Pf,{className:"size-4 transition-transform group-hover:translate-x-0.5","aria-hidden":"true"}),e[4]=a):a=e[4];let l;return e[5]!==s||e[6]!==i?(l=p.jsxs("button",{type:"button",onClick:s,className:"group flex w-full items-center justify-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[i,a]}),e[5]=s,e[6]=i,e[7]=l):l=e[7],l}function Ng(t){const e=_.c(12),{message:n,className:r}=t,s=n.created_at??n.metadata?.created_at??null;let o,i,a,l;if(e[0]!==r||e[1]!==s){l=Symbol.for("react.early_return_sentinel");e:{const u=bl(s);if(u===null){l=null;break e}const d=new Date(u);o=d.toLocaleString(),e[6]!==r?(i=G("text-[11px] text-muted-foreground/60 select-none",r),e[6]=r,e[7]=i):i=e[7],a=d.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}e[0]=r,e[1]=s,e[2]=o,e[3]=i,e[4]=a,e[5]=l}else o=e[2],i=e[3],a=e[4],l=e[5];if(l!==Symbol.for("react.early_return_sentinel"))return l;let c;return e[8]!==o||e[9]!==i||e[10]!==a?(c=p.jsx("span",{title:o,className:i,children:a}),e[8]=o,e[9]=i,e[10]=a,e[11]=c):c=e[11],c}function il(t){const e=_.c(9),{since:n}=t;let r;e[0]!==n?(r=()=>Yc(n,Date.now()),e[0]=n,e[1]=r):r=e[1];const[s,o]=L.useState(r);let i,a;e[2]!==n?(i=()=>{const d=setInterval(()=>o(Yc(n,Date.now())),100);return()=>clearInterval(d)},a=[n],e[2]=n,e[3]=i,e[4]=a):(i=e[3],a=e[4]),L.useEffect(i,a);const l=s/1e3;let c;e[5]!==l?(c=Fn(l),e[5]=l,e[6]=c):c=e[6];let u;return e[7]!==c?(u=p.jsx("span",{className:"tabular-nums text-sm font-mono text-muted-foreground/50",children:c}),e[7]=c,e[8]=u):u=e[8],u}const Mg=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function pM(){const t=_.c(5),[e]=L.useState(mM);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},t[0]=n):n=t[0];let r;t[1]!==e?(r=Mg.map((o,i)=>{const{delay:a}=o;return p.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[i],animation:"grid-ripple 1s ease infinite",animationDelay:`${a}ms`}},i)}),t[1]=e,t[2]=r):r=t[2];let s;return t[3]!==r?(s=p.jsx("div",{className:"grid",style:n,children:r}),t[3]=r,t[4]=s):s=t[4],s}function mM(){const t=`var(--chart-${Math.ceil(Math.random()*5)})`;return Mg.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":t)}const Jd=new Map;function Tg(t){let e=Jd.get(t);return e||(e={tick:0,subscribers:new Set,intervalId:null},Jd.set(t,e)),e}function gM(t,e){const n=Tg(t);return n.subscribers.add(e),n.intervalId===null&&(n.intervalId=setInterval(()=>{n.tick+=1;for(const r of n.subscribers)r()},t)),()=>{n.subscribers.delete(e),n.subscribers.size===0&&n.intervalId!==null&&(clearInterval(n.intervalId),n.intervalId=null)}}function Nc(t){const e=_.c(3),n=t===void 0?6e4:t;let r,s;return e[0]!==n?(r=o=>gM(n,o),s=()=>Tg(n).tick,e[0]=n,e[1]=r,e[2]=s):(r=e[1],s=e[2]),L.useSyncExternalStore(r,s,yM)}function yM(){return 0}function xM(t){return{planning:{icon:p.jsx($1,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.planningLabel"),detail:t("chat.thinkingIndicator.planningDetail")},thinking:{icon:p.jsx(ri,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:t("chat.thinkingIndicator.thinkingLabel"),detail:t("chat.thinkingIndicator.thinkingDetail")}}}const bM=1200;function al(t){const e=_.c(8),{icon:n,title:r,summary:s,detail:o,state:i,detailVariant:a,trailing:l}=t,c=a===void 0?"prose":a;let u;return e[0]!==o||e[1]!==c||e[2]!==n||e[3]!==i||e[4]!==s||e[5]!==r||e[6]!==l?(u=p.jsx(ne,{icon:n,title:r,summary:s,detail:o,state:i,detailVariant:c,trailing:l}),e[0]=o,e[1]=c,e[2]=n,e[3]=i,e[4]=s,e[5]=r,e[6]=l,e[7]=u):u=e[7],u}function vM(t){const e=_.c(22),{startedAt:n}=t,r=J(),s=wr()?.runStatusStage??null,[o,i]=L.useState("planning");let a,l;if(e[0]!==s?(a=()=>{if(s!==null)return;const y=setTimeout(()=>{i("thinking")},bM);return()=>{clearTimeout(y)}},l=[s],e[0]=s,e[1]=a,e[2]=l):(a=e[1],l=e[2]),L.useEffect(a,l),s!==null){let y;e[3]!==s||e[4]!==r?(y=g0(r,s),e[3]=s,e[4]=r,e[5]=y):y=e[5];const g=y;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(ri,{className:"size-4"}),e[6]=x):x=e[6];const b=`${g.label}...`;let v;e[7]!==n?(v=n!==null&&p.jsx(il,{since:n}),e[7]=n,e[8]=v):v=e[8];let k;return e[9]!==g.detail||e[10]!==b||e[11]!==v?(k=p.jsx(al,{icon:x,title:b,summary:g.detail,state:"loading",trailing:v}),e[9]=g.detail,e[10]=b,e[11]=v,e[12]=k):k=e[12],k}let c;e[13]!==r?(c=xM(r),e[13]=r,e[14]=c):c=e[14];const d=c[o],f=`${d.label}...`;let h;e[15]!==n?(h=n!==null&&p.jsx(il,{since:n}),e[15]=n,e[16]=h):h=e[16];let m;return e[17]!==d.detail||e[18]!==d.icon||e[19]!==f||e[20]!==h?(m=p.jsx(al,{icon:d.icon,title:f,summary:d.detail,state:"loading",trailing:h}),e[17]=d.detail,e[18]=d.icon,e[19]=f,e[20]=h,e[21]=m):m=e[21],m}function kM(t){const e=_.c(3),{startedAt:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(pM,{}),e[0]=r):r=e[0];let s;return e[1]!==n?(s=p.jsxs("div",{className:"flex items-center gap-2.5 mt-1 pb-1 text-muted-foreground/40 select-none",children:[r,p.jsx(il,{since:n})]}),e[1]=n,e[2]=s):s=e[2],s}const SM=2e4;function CM(t){const e=_.c(9),{startedAt:n}=t,r=J();Nc(1e3);const s=wr(),i=(n!==null?Date.now()-n:0)>=SM;let a;e[0]!==n?(a=p.jsx(vM,{startedAt:n}),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==i||e[3]!==s||e[4]!==r?(l=i&&s?.stop&&p.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[p.jsx("span",{children:r("chat.thinkingIndicator.takingLonger")}),p.jsx("button",{type:"button",onClick:()=>s.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:r("chat.thinkingIndicator.cancel")})]}),e[2]=i,e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==a||e[7]!==l?(c=p.jsxs("div",{className:"flex flex-col gap-0.5",children:[a,l]}),e[6]=a,e[7]=l,e[8]=c):c=e[8],c}function wM(t){const e=_.c(24),{duration:n,parts:r,isStreaming:s}=t,o=J();let i;e[0]!==r?(i=r.every(TM),e[0]=r,e[1]=i):i=e[1];const a=i;let l;e[2]!==n||e[3]!==o?(l=n&&n/1e3>1?o("chat.thinkingIndicator.thoughtFor",{duration:Fn(n/1e3)}):o("chat.thinkingIndicator.thought"),e[2]=n,e[3]=o,e[4]=l):l=e[4];const c=l;let u;if(e[5]!==a||e[6]!==s||e[7]!==r){const v=r.map(MM).join(`
142
142
  `).trim().split(`
143
143
  `).filter(Boolean),k=s?v[v.length-1]??"":v[0]??"";u=!a&&k?k.length>100?k.slice(0,100)+"…":k:void 0,e[5]=a,e[6]=s,e[7]=r,e[8]=u}else u=e[8];const d=u;let f;if(e[9]!==a||e[10]!==r){const b=r.map(NM).join(`
144
144
 
@@ -163,25 +163,25 @@ Error: Tool responded with an error`)}else if(r.state==="output-denied"){const o
163
163
  Input: ${o||"[No input]"}...
164
164
  Output: Tool execution was denied`)}}}return n.length>0?n.join(`
165
165
 
166
- `):null}function Yd(t){const e=t&&typeof t=="object"&&"created_at"in t?t.created_at:void 0;return typeof e=="string"||e instanceof Date?bl(e):null}function VM(t){const e=t&&typeof t=="object"&&"timeout"in t?t.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Xs(t){const e=_.c(7),{icon:n,label:r}=t;let s;e[0]!==n?(s=p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"flex items-center",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx(Bn,{side:"top",children:r}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsxs(zn,{children:[s,o]}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function UM(t){const e=_.c(19),{annotations:n,toolMeta:r}=t,s=J();let o;e[0]!==r?(o=_f(r),e[0]=r,e[1]=o):o=e[1];const i=!!o;if(!n&&!i)return null;let a;e[2]!==i||e[3]!==s?(a=i&&p.jsx(Xs,{icon:p.jsx(wf,{}),label:s("chat.generic.annotation.interactive")}),e[2]=i,e[3]=s,e[4]=a):a=e[4];let l;e[5]!==n?.readOnlyHint||e[6]!==s?(l=n?.readOnlyHint&&p.jsx(Xs,{icon:p.jsx(N0,{}),label:s("chat.generic.annotation.readOnly")}),e[5]=n?.readOnlyHint,e[6]=s,e[7]=l):l=e[7];let c;e[8]!==n?.destructiveHint||e[9]!==s?(c=n?.destructiveHint&&p.jsx(Xs,{icon:p.jsx(yl,{}),label:s("chat.generic.annotation.destructive")}),e[8]=n?.destructiveHint,e[9]=s,e[10]=c):c=e[10];let u;e[11]!==n?.openWorldHint||e[12]!==s?(u=n?.openWorldHint&&p.jsx(Xs,{icon:p.jsx(pa,{}),label:s("chat.generic.annotation.openWorld")}),e[11]=n?.openWorldHint,e[12]=s,e[13]=u):u=e[13];let d;return e[14]!==a||e[15]!==l||e[16]!==c||e[17]!==u?(d=p.jsxs(p.Fragment,{children:[a,l,c,u]}),e[14]=a,e[15]=l,e[16]=c,e[17]=u,e[18]=d):d=e[18],d}function qM(t){return t<1?`${Math.round(t*1e3)}ms`:t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function KM(t){const e=_.c(13),{latency:n,outputBytes:r}=t,s=typeof n=="number"&&n>0,o=typeof r=="number"&&r>=0;if(!s&&!o)return null;let i;e[0]!==s||e[1]!==n?(i=s&&p.jsx("span",{children:qM(n)}),e[0]=s,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==o||e[4]!==s?(a=s&&o&&p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=o,e[4]=s,e[5]=a):a=e[5];let l;e[6]!==o||e[7]!==r?(l=o&&p.jsx("span",{children:OM(r)}),e[6]=o,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==a||e[11]!==l?(c=p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[i,a,l]}),e[9]=i,e[10]=a,e[11]=l,e[12]=c):c=e[12],c}function JM(t,e,n,r){switch(t){case"input-streaming":case"input-available":return r?r("chat.generic.preparing"):"Preparing...";case"approval-requested":return r?r("chat.generic.waitingForApproval"):"Waiting for your approval";case"output-denied":return r?r("chat.generic.cancelled"):"Cancelled";case"output-error":return n??(r?r("chat.generic.failed"):"Failed");case"output-available":{if(e==null)return r?r("chat.generic.done"):"Done";if(typeof e=="string"){const s=e.trim();return s.length>100?s.slice(0,100)+"…":s}if(typeof e=="object"){for(const s of Object.keys(e)){const o=e[s];if(typeof o=="string"&&o.trim()){const i=o.trim();return i.length>100?i.slice(0,100)+"…":i}}return""}return String(e).slice(0,100)}default:return""}}function Gd(t){const e=_.c(76),{part:n,annotations:r,latency:s,outputBytes:o,isLastMessage:i,toolMeta:a}=t,l=J(),c="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type==="dynamic-tool"?l("chat.generic.dynamicTool"):n.type.replace("tool-","")||"Tool",u=dm(c),d=wr(),f=v0(),{org:h}=xt(),{openSidePanel:m}=A0(),y=vs()?.taskId??null,{addOrReplaceEager:g}=DM(y),{openPanel:x}=kl(),b=a&&typeof a=="object"&&a!==null&&"connectionId"in a&&a.connectionId!=null&&a.connectionId!==""?String(a.connectionId):f?.selectedVirtualMcp?.id??null,{toolDef:v}=AM(b?c:null,b,h.id,h.slug),k=v?._meta??a,N=wl(k),C=Nl(u,N),S=IM[C],w=v?.title??(S?.labelKey?l(S.labelKey):void 0)??ga(C);let M;e[0]!==k?(M=_f(k),e[0]=k,e[1]=M):M=e[1];const T=M,O=!!T&&n.state==="output-available",A=b?`${b}:${c}`:null,P=!!r?.destructiveHint,D=O&&!!b&&!P&&!!y;let E;e[2]!==g||e[3]!==b||e[4]!==x||e[5]!==n||e[6]!==c?(E=()=>{if(!b)return;const ue="input"in n&&n.input&&typeof n.input=="object"?n.input:{};g({toolName:c,appId:b,args:ue}),x(O1(b,c))},e[2]=g,e[3]=b,e[4]=x,e[5]=n,e[6]=c,e[7]=E):E=e[7];const j=E;let I;e[8]!==D||e[9]!==j?(I=ue=>ue==="fullscreen"&&D?(j(),"fullscreen"):"inline",e[8]=D,e[9]=j,e[10]=I):I=e[10];const R=I;let z;e[11]!==d||e[12]!==m?(z=ue=>{const Me=C0(ue.content);Me.content.length>0&&(m(),d?.sendMessage(Me))},e[11]=d,e[12]=m,e[13]=z):z=e[13];const W=z,q=n.state==="approval-requested"&&i===!1,G=n.state==="output-denied"||q,te=n.state==="output-available"&&typeof n.output=="object"&&n.output!=null&&"isError"in n.output&&n.output.isError===!0;let ae;e[14]!==n.state?(ae=It(n.state),e[14]=n.state,e[15]=ae):ae=e[15];const fe=ae,ce=q||fe==="approval"?"idle":te?"error":fe;let we,$e;if(e[16]!==ce||e[17]!==te||e[18]!==q||e[19]!==n||e[20]!==l||e[21]!==C){we=n.state==="output-error"?Ci(n):void 0;const ue=C==="bash"&&ce==="loading"&&n.input&&typeof n.input=="object"&&typeof n.input.command=="string"?n.input.command:null;let Me;e[24]!==ue?(Me=ue!==null?FM(ue):null,e[24]=ue,e[25]=Me):Me=e[25];const Te=Me;let Rs;e[26]!==n.input||e[27]!==Te?(Rs=Te!==null?Math.min(Te,VM(n.input)):null,e[26]=n.input,e[27]=Te,e[28]=Rs):Rs=e[28];const Wc=Rs,Vc="toolCallId"in n?n.toolCallId:"";$e=Wc!==null?p.jsx($M,{toolCallId:Vc,durationMs:Wc,anchorMs:Yd(n)}):ce==="loading"?p.jsx(BM,{toolCallId:Vc,anchorMs:Yd(n)}):q?l("chat.generic.cancelled"):te?l("chat.generic.failed"):JM(n.state,n.output,we,l),e[16]=ce,e[17]=te,e[18]=q,e[19]=n,e[20]=l,e[21]=C,e[22]=we,e[23]=$e}else we=e[22],$e=e[23];const Ne=$e;let me="";n.input!==void 0&&(me=`# Input
166
+ `):null}function Yd(t){const e=t&&typeof t=="object"&&"created_at"in t?t.created_at:void 0;return typeof e=="string"||e instanceof Date?bl(e):null}function VM(t){const e=t&&typeof t=="object"&&"timeout"in t?t.timeout:void 0;return Math.min(typeof e=="number"?e:3e4,12e4)}function Xs(t){const e=_.c(7),{icon:n,label:r}=t;let s;e[0]!==n?(s=p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"flex items-center",children:n})}),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx(Bn,{side:"top",children:r}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsxs(zn,{children:[s,o]}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function UM(t){const e=_.c(19),{annotations:n,toolMeta:r}=t,s=J();let o;e[0]!==r?(o=_f(r),e[0]=r,e[1]=o):o=e[1];const i=!!o;if(!n&&!i)return null;let a;e[2]!==i||e[3]!==s?(a=i&&p.jsx(Xs,{icon:p.jsx(wf,{}),label:s("chat.generic.annotation.interactive")}),e[2]=i,e[3]=s,e[4]=a):a=e[4];let l;e[5]!==n?.readOnlyHint||e[6]!==s?(l=n?.readOnlyHint&&p.jsx(Xs,{icon:p.jsx(N0,{}),label:s("chat.generic.annotation.readOnly")}),e[5]=n?.readOnlyHint,e[6]=s,e[7]=l):l=e[7];let c;e[8]!==n?.destructiveHint||e[9]!==s?(c=n?.destructiveHint&&p.jsx(Xs,{icon:p.jsx(yl,{}),label:s("chat.generic.annotation.destructive")}),e[8]=n?.destructiveHint,e[9]=s,e[10]=c):c=e[10];let u;e[11]!==n?.openWorldHint||e[12]!==s?(u=n?.openWorldHint&&p.jsx(Xs,{icon:p.jsx(pa,{}),label:s("chat.generic.annotation.openWorld")}),e[11]=n?.openWorldHint,e[12]=s,e[13]=u):u=e[13];let d;return e[14]!==a||e[15]!==l||e[16]!==c||e[17]!==u?(d=p.jsxs(p.Fragment,{children:[a,l,c,u]}),e[14]=a,e[15]=l,e[16]=c,e[17]=u,e[18]=d):d=e[18],d}function qM(t){return t<1?`${Math.round(t*1e3)}ms`:t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function KM(t){const e=_.c(13),{latency:n,outputBytes:r}=t,s=typeof n=="number"&&n>0,o=typeof r=="number"&&r>=0;if(!s&&!o)return null;let i;e[0]!==s||e[1]!==n?(i=s&&p.jsx("span",{children:qM(n)}),e[0]=s,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==o||e[4]!==s?(a=s&&o&&p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[3]=o,e[4]=s,e[5]=a):a=e[5];let l;e[6]!==o||e[7]!==r?(l=o&&p.jsx("span",{children:OM(r)}),e[6]=o,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==a||e[11]!==l?(c=p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-mono tabular-nums text-muted-foreground/60 px-1 leading-none",children:[i,a,l]}),e[9]=i,e[10]=a,e[11]=l,e[12]=c):c=e[12],c}function JM(t,e,n,r){switch(t){case"input-streaming":case"input-available":return r?r("chat.generic.preparing"):"Preparing...";case"approval-requested":return r?r("chat.generic.waitingForApproval"):"Waiting for your approval";case"output-denied":return r?r("chat.generic.cancelled"):"Cancelled";case"output-error":return n??(r?r("chat.generic.failed"):"Failed");case"output-available":{if(e==null)return r?r("chat.generic.done"):"Done";if(typeof e=="string"){const s=e.trim();return s.length>100?s.slice(0,100)+"…":s}if(typeof e=="object"){for(const s of Object.keys(e)){const o=e[s];if(typeof o=="string"&&o.trim()){const i=o.trim();return i.length>100?i.slice(0,100)+"…":i}}return""}return String(e).slice(0,100)}default:return""}}function Gd(t){const e=_.c(76),{part:n,annotations:r,latency:s,outputBytes:o,isLastMessage:i,toolMeta:a}=t,l=J(),c="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type==="dynamic-tool"?l("chat.generic.dynamicTool"):n.type.replace("tool-","")||"Tool",u=dm(c),d=wr(),f=v0(),{org:h}=xt(),{openSidePanel:m}=A0(),y=vs()?.taskId??null,{addOrReplaceEager:g}=DM(y),{openPanel:x}=kl(),b=a&&typeof a=="object"&&a!==null&&"connectionId"in a&&a.connectionId!=null&&a.connectionId!==""?String(a.connectionId):f?.selectedVirtualMcp?.id??null,{toolDef:v}=AM(b?c:null,b,h.id,h.slug),k=v?._meta??a,N=wl(k),C=Nl(u,N),S=IM[C],w=v?.title??(S?.labelKey?l(S.labelKey):void 0)??ga(C);let M;e[0]!==k?(M=_f(k),e[0]=k,e[1]=M):M=e[1];const T=M,O=!!T&&n.state==="output-available",A=b?`${b}:${c}`:null,P=!!r?.destructiveHint,D=O&&!!b&&!P&&!!y;let E;e[2]!==g||e[3]!==b||e[4]!==x||e[5]!==n||e[6]!==c?(E=()=>{if(!b)return;const ue="input"in n&&n.input&&typeof n.input=="object"?n.input:{};g({toolName:c,appId:b,args:ue}),x(O1(b,c))},e[2]=g,e[3]=b,e[4]=x,e[5]=n,e[6]=c,e[7]=E):E=e[7];const j=E;let I;e[8]!==D||e[9]!==j?(I=ue=>ue==="fullscreen"&&D?(j(),"fullscreen"):"inline",e[8]=D,e[9]=j,e[10]=I):I=e[10];const R=I;let z;e[11]!==d||e[12]!==m?(z=ue=>{const Me=C0(ue.content);Me.content.length>0&&(m(),d?.sendMessage(Me))},e[11]=d,e[12]=m,e[13]=z):z=e[13];const W=z,q=n.state==="approval-requested"&&i===!1,X=n.state==="output-denied"||q,te=n.state==="output-available"&&typeof n.output=="object"&&n.output!=null&&"isError"in n.output&&n.output.isError===!0;let ae;e[14]!==n.state?(ae=It(n.state),e[14]=n.state,e[15]=ae):ae=e[15];const fe=ae,ce=q||fe==="approval"?"idle":te?"error":fe;let we,$e;if(e[16]!==ce||e[17]!==te||e[18]!==q||e[19]!==n||e[20]!==l||e[21]!==C){we=n.state==="output-error"?Ci(n):void 0;const ue=C==="bash"&&ce==="loading"&&n.input&&typeof n.input=="object"&&typeof n.input.command=="string"?n.input.command:null;let Me;e[24]!==ue?(Me=ue!==null?FM(ue):null,e[24]=ue,e[25]=Me):Me=e[25];const Te=Me;let Rs;e[26]!==n.input||e[27]!==Te?(Rs=Te!==null?Math.min(Te,VM(n.input)):null,e[26]=n.input,e[27]=Te,e[28]=Rs):Rs=e[28];const Wc=Rs,Vc="toolCallId"in n?n.toolCallId:"";$e=Wc!==null?p.jsx($M,{toolCallId:Vc,durationMs:Wc,anchorMs:Yd(n)}):ce==="loading"?p.jsx(BM,{toolCallId:Vc,anchorMs:Yd(n)}):q?l("chat.generic.cancelled"):te?l("chat.generic.failed"):JM(n.state,n.output,we,l),e[16]=ce,e[17]=te,e[18]=q,e[19]=n,e[20]=l,e[21]=C,e[22]=we,e[23]=$e}else we=e[22],$e=e[23];const Ne=$e;let me="";n.input!==void 0&&(me=`# Input
167
167
  `+Zo(n.input)),n.state==="output-error"?(me&&(me=me+`
168
168
 
169
169
  `),me=me+(`# Error
170
170
  `+(we??""))):n.output!==void 0&&!O&&(me&&(me=me+`
171
171
 
172
172
  `),me=me+(`# Output
173
- `+Zo(n.output)));let Ke;e:{if(G){let Te;e[29]===Symbol.for("react.memo_cache_sentinel")?(Te=p.jsx(M0,{}),e[29]=Te):Te=e[29],Ke=Te;break e}if(O){let Te;e[30]===Symbol.for("react.memo_cache_sentinel")?(Te=p.jsx(wf,{className:"size-4 text-muted-foreground"}),e[30]=Te):Te=e[30],Ke=Te;break e}const ue=S?.icon;if(ue){let Te;e[31]!==ue?(Te=p.jsx(ue,{className:"size-4 text-muted-foreground"}),e[31]=ue,e[32]=Te):Te=e[32],Ke=Te;break e}let Me;e[33]===Symbol.for("react.memo_cache_sentinel")?(Me=p.jsx(V1,{className:"size-4 text-muted-foreground"}),e[33]=Me):Me=e[33],Ke=Me}let X;e[34]!==r||e[35]!==a?(X=p.jsx(UM,{annotations:r,toolMeta:a}),e[34]=r,e[35]=a,e[36]=X):X=e[36];let ee;e[37]!==s||e[38]!==o?(ee=p.jsx(KM,{latency:s,outputBytes:o}),e[37]=s,e[38]=o,e[39]=ee):ee=e[39];let se;e[40]!==X||e[41]!==ee?(se=p.jsxs(p.Fragment,{children:[X,ee]}),e[40]=X,e[41]=ee,e[42]=se):se=e[42];const _e=me||null;let Je;e[43]!==ce||e[44]!==w||e[45]!==G||e[46]!==Ne||e[47]!==se||e[48]!==_e||e[49]!==Ke?(Je=p.jsx(ne,{icon:Ke,iconDestructive:G,trailing:se,title:w,summary:Ne,state:ce,detail:_e}),e[43]=ce,e[44]=w,e[45]=G,e[46]=Ne,e[47]=se,e[48]=_e,e[49]=Ke,e[50]=Je):Je=e[50];let vt;e[51]!==D||e[52]!==j||e[53]!==l?(vt=D&&p.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:p.jsxs("button",{type:"button",onClick:j,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground rounded-md [@media(hover:hover)]:hover:bg-accent/50 [@media(hover:hover)]:hover:text-foreground transition-colors",children:[p.jsx(W1,{className:"size-3.5"}),l("chat.generic.openInPanel")]})}),e[51]=D,e[52]=j,e[53]=l,e[54]=vt):vt=e[54];let ut;e[55]!==D||e[56]!==f||e[57]!==b||e[58]!==w||e[59]!==W||e[60]!==R||e[61]!==O||e[62]!==k||e[63]!==h.id||e[64]!==h.slug||e[65]!==n.input||e[66]!==n.output||e[67]!==A||e[68]!==l||e[69]!==C||e[70]!==T?(ut=O&&T&&b&&h?.id&&p.jsx(p.Fragment,{children:p.jsx(yf,{fallback:ue=>{const{resetError:Me}=ue;return p.jsxs("div",{className:"mt-2 flex items-center gap-2 px-3 py-2.5 border border-dashed border-destructive/30 bg-destructive/5 rounded-lg",children:[p.jsx(yl,{size:16,className:"shrink-0 text-destructive"}),p.jsx("span",{className:"flex-1 text-xs text-destructive font-medium",children:l("chat.generic.failedToLoad",{toolName:w})}),p.jsxs(Ln,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:Me,children:[p.jsx(xf,{className:"size-3.5"}),l("chat.generic.retry")]})]})},children:p.jsx(L.Suspense,{fallback:p.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[p.jsx(hf,{className:"size-4"}),p.jsx("span",{className:"text-sm",children:l("chat.generic.loadingApp")})]})}),children:p.jsx(XM,{uiResourceUri:T,connectionId:b,orgId:h.id,orgSlug:h.slug,toolName:C,toolInput:n.input,toolResult:n.output,toolMeta:k,onMessage:W,onUpdateModelContext:A&&f?ue=>f.setAppContext(A,ue):void 0,onTeardown:A&&f?()=>f.clearAppContext(A):void 0,onRequestDisplayMode:D?R:void 0})})})}),e[55]=D,e[56]=f,e[57]=b,e[58]=w,e[59]=W,e[60]=R,e[61]=O,e[62]=k,e[63]=h.id,e[64]=h.slug,e[65]=n.input,e[66]=n.output,e[67]=A,e[68]=l,e[69]=C,e[70]=T,e[71]=ut):ut=e[71];let dt;return e[72]!==Je||e[73]!==vt||e[74]!==ut?(dt=p.jsxs("div",{children:[Je,vt,ut]}),e[72]=Je,e[73]=vt,e[74]=ut,e[75]=dt):dt=e[75],dt}function Ag(t){return typeof t=="object"&&t!=null&&"type"in t&&t.type==="mcpToolCall"}function YM(t){if(t!=null)return Ag(t)?t.arguments??void 0:t}function GM(t){if(t==null)return;if(Ag(t)&&t.result!=null)return t.result;if(typeof t=="object"&&"content"in t&&Array.isArray(t.content)){const n=t.content;if(n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"type"in n[0])return t}const e=typeof t=="string"?t:JSON.stringify(t);return{structuredContent:typeof t=="object"&&!Array.isArray(t)?t:void 0,content:[{type:"text",text:e}]}}function XM(t){const e=_.c(27),{uiResourceUri:n,connectionId:r,orgId:s,orgSlug:o,toolName:i,toolInput:a,toolResult:l,toolMeta:c,onMessage:u,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:h}=t;let m;e[0]!==r||e[1]!==s||e[2]!==o?(m={connectionId:r,orgId:s,orgSlug:o},e[0]=r,e[1]=s,e[2]=o,e[3]=m):m=e[3];const y=gl(m);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g={type:"object"},e[4]=g):g=e[4];let x;e[5]!==c?(x=c!=null&&{_meta:c},e[5]=c,e[6]=x):x=e[6];let b;e[7]!==x||e[8]!==i?(b={name:i,inputSchema:g,...x},e[7]=x,e[8]=i,e[9]=b):b=e[9];const v=b;let k;e[10]!==v?(k={tool:v},e[10]=v,e[11]=k):k=e[11];let N;e[12]!==a?(N=YM(a),e[12]=a,e[13]=N):N=e[13];let C;e[14]!==l?(C=GM(l),e[14]=l,e[15]=C):C=e[15];let S;return e[16]!==y||e[17]!==u||e[18]!==h||e[19]!==f||e[20]!==d||e[21]!==s||e[22]!==k||e[23]!==N||e[24]!==C||e[25]!==n?(S=p.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:p.jsx(w0,{resourceURI:n,orgId:s,toolInfo:k,toolInput:N,toolResult:C,client:y,onMessage:u,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:h})}),e[16]=y,e[17]=u,e[18]=h,e[19]=f,e[20]=d,e[21]=s,e[22]=k,e[23]=N,e[24]=C,e[25]=n,e[26]=S):S=e[26],S}const Xd="studio-storage://",Qd="mesh-storage://";function Mc(t){return t.startsWith(Xd)?t.slice(Xd.length):t.startsWith(Qd)?t.slice(Qd.length):null}function Ig(t,e){const n=Mc(t);return n!==null?`/api/${e}/files/${n}`:t}function QM(t){return Array.isArray(t?.images)?t.images:void 0}function ZM(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,r=e+n;return r?{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:r,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function eT(t){const e=_.c(14),{uri:n,orgSlug:r}=t,s=J();let o;e[0]!==r||e[1]!==n?(o=Ig(n,r),e[0]=r,e[1]=n,e[2]=o):o=e[2];const i=o;let a;e[3]!==s||e[4]!==n?(a=Mc(n)!==null?n.slice(n.lastIndexOf("/")+1):s("chat.generateImage.reference"),e[3]=s,e[4]=n,e[5]=a):a=e[5];const l=a;let c;e[6]!==l?(c=p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded bg-muted text-muted-foreground text-xs cursor-default select-none",children:l})}),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==l||e[9]!==i?(u=p.jsx(Bn,{side:"top",className:"max-w-sm p-1.5",children:p.jsx("img",{src:i,alt:l,className:"max-w-full max-h-64 object-contain rounded"})}),e[8]=l,e[9]=i,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==u?(d=p.jsxs(zn,{children:[c,u]}),e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function tT(t){const e=_.c(75),{part:n,latency:r}=t,s=J(),o=bf();let i;e[0]!==n.state?(i=It(n.state),e[0]=n.state,e[1]=i):i=e[1];const a=i,l=n.input,c=n.output;let u,d,f,h,m;if(e[2]!==l||e[3]!==r||e[4]!==o||e[5]!==n||e[6]!==c||e[7]!==a||e[8]!==s){m=Symbol.for("react.early_return_sentinel");e:{const x=QM(c);let b;e[14]!==c?(b=ZM(c),e[14]=c,e[15]=b):b=e[15];const v=b,k=c?.model,N=Array.isArray(l?.referenceImages)?l.referenceImages.filter(nT):void 0;let C;e[16]!==r?(C=r!=null&&r>0?p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Fn(r)}):null,e[16]=r,e[17]=C):C=e[17];const S=C;if(a==="loading"){let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx(Ps,{size:14}),e[18]=D):D=e[18];let E;e[19]!==s?(E=s("chat.generateImage.generatingImage"),e[19]=s,e[20]=E):E=e[20];let j;e[21]!==l?(j=l?.prompt?`"${l.prompt.slice(0,80)}…"`:void 0,e[21]=l,e[22]=j):j=e[22];let I;e[23]!==E||e[24]!==j?(I=p.jsx(ne,{icon:D,title:E,summary:j,state:"loading"}),e[23]=E,e[24]=j,e[25]=I):I=e[25],m=I;break e}if(c?.background){let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx(Ps,{size:14}),e[26]=D):D=e[26];let E;e[27]!==s?(E=s("chat.generateImage.imageQueuedGeneratingInBackground"),e[27]=s,e[28]=E):E=e[28];let j;e[29]!==l?(j=l?.prompt?`"${l.prompt.slice(0,80)}…"`:void 0,e[29]=l,e[30]=j):j=e[30];let I;e[31]!==E||e[32]!==j?(I=p.jsx(ne,{icon:D,title:E,summary:j,state:"idle"}),e[31]=E,e[32]=j,e[33]=I):I=e[33],m=I;break e}if(a==="error"||!x||x.length===0){let D;e[34]!==n||e[35]!==a?(D=a==="error"?Ci(n):void 0,e[34]=n,e[35]=a,e[36]=D):D=e[36];const E=D;let j="";l!==void 0&&(j=`# Input
173
+ `+Zo(n.output)));let Ke;e:{if(X){let Te;e[29]===Symbol.for("react.memo_cache_sentinel")?(Te=p.jsx(M0,{}),e[29]=Te):Te=e[29],Ke=Te;break e}if(O){let Te;e[30]===Symbol.for("react.memo_cache_sentinel")?(Te=p.jsx(wf,{className:"size-4 text-muted-foreground"}),e[30]=Te):Te=e[30],Ke=Te;break e}const ue=S?.icon;if(ue){let Te;e[31]!==ue?(Te=p.jsx(ue,{className:"size-4 text-muted-foreground"}),e[31]=ue,e[32]=Te):Te=e[32],Ke=Te;break e}let Me;e[33]===Symbol.for("react.memo_cache_sentinel")?(Me=p.jsx(V1,{className:"size-4 text-muted-foreground"}),e[33]=Me):Me=e[33],Ke=Me}let Q;e[34]!==r||e[35]!==a?(Q=p.jsx(UM,{annotations:r,toolMeta:a}),e[34]=r,e[35]=a,e[36]=Q):Q=e[36];let ee;e[37]!==s||e[38]!==o?(ee=p.jsx(KM,{latency:s,outputBytes:o}),e[37]=s,e[38]=o,e[39]=ee):ee=e[39];let se;e[40]!==Q||e[41]!==ee?(se=p.jsxs(p.Fragment,{children:[Q,ee]}),e[40]=Q,e[41]=ee,e[42]=se):se=e[42];const _e=me||null;let Je;e[43]!==ce||e[44]!==w||e[45]!==X||e[46]!==Ne||e[47]!==se||e[48]!==_e||e[49]!==Ke?(Je=p.jsx(ne,{icon:Ke,iconDestructive:X,trailing:se,title:w,summary:Ne,state:ce,detail:_e}),e[43]=ce,e[44]=w,e[45]=X,e[46]=Ne,e[47]=se,e[48]=_e,e[49]=Ke,e[50]=Je):Je=e[50];let vt;e[51]!==D||e[52]!==j||e[53]!==l?(vt=D&&p.jsx("div",{className:"flex justify-end mt-1.5 mb-1",children:p.jsxs("button",{type:"button",onClick:j,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground rounded-md [@media(hover:hover)]:hover:bg-accent/50 [@media(hover:hover)]:hover:text-foreground transition-colors",children:[p.jsx(W1,{className:"size-3.5"}),l("chat.generic.openInPanel")]})}),e[51]=D,e[52]=j,e[53]=l,e[54]=vt):vt=e[54];let ut;e[55]!==D||e[56]!==f||e[57]!==b||e[58]!==w||e[59]!==W||e[60]!==R||e[61]!==O||e[62]!==k||e[63]!==h.id||e[64]!==h.slug||e[65]!==n.input||e[66]!==n.output||e[67]!==A||e[68]!==l||e[69]!==C||e[70]!==T?(ut=O&&T&&b&&h?.id&&p.jsx(p.Fragment,{children:p.jsx(yf,{fallback:ue=>{const{resetError:Me}=ue;return p.jsxs("div",{className:"mt-2 flex items-center gap-2 px-3 py-2.5 border border-dashed border-destructive/30 bg-destructive/5 rounded-lg",children:[p.jsx(yl,{size:16,className:"shrink-0 text-destructive"}),p.jsx("span",{className:"flex-1 text-xs text-destructive font-medium",children:l("chat.generic.failedToLoad",{toolName:w})}),p.jsxs(Ln,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 shrink-0",onClick:Me,children:[p.jsx(xf,{className:"size-3.5"}),l("chat.generic.retry")]})]})},children:p.jsx(L.Suspense,{fallback:p.jsx("div",{className:"mt-2 flex items-center justify-center h-12 border border-border/75 rounded-lg overflow-hidden p-3",children:p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[p.jsx(hf,{className:"size-4"}),p.jsx("span",{className:"text-sm",children:l("chat.generic.loadingApp")})]})}),children:p.jsx(XM,{uiResourceUri:T,connectionId:b,orgId:h.id,orgSlug:h.slug,toolName:C,toolInput:n.input,toolResult:n.output,toolMeta:k,onMessage:W,onUpdateModelContext:A&&f?ue=>f.setAppContext(A,ue):void 0,onTeardown:A&&f?()=>f.clearAppContext(A):void 0,onRequestDisplayMode:D?R:void 0})})})}),e[55]=D,e[56]=f,e[57]=b,e[58]=w,e[59]=W,e[60]=R,e[61]=O,e[62]=k,e[63]=h.id,e[64]=h.slug,e[65]=n.input,e[66]=n.output,e[67]=A,e[68]=l,e[69]=C,e[70]=T,e[71]=ut):ut=e[71];let dt;return e[72]!==Je||e[73]!==vt||e[74]!==ut?(dt=p.jsxs("div",{children:[Je,vt,ut]}),e[72]=Je,e[73]=vt,e[74]=ut,e[75]=dt):dt=e[75],dt}function Ag(t){return typeof t=="object"&&t!=null&&"type"in t&&t.type==="mcpToolCall"}function YM(t){if(t!=null)return Ag(t)?t.arguments??void 0:t}function GM(t){if(t==null)return;if(Ag(t)&&t.result!=null)return t.result;if(typeof t=="object"&&"content"in t&&Array.isArray(t.content)){const n=t.content;if(n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"type"in n[0])return t}const e=typeof t=="string"?t:JSON.stringify(t);return{structuredContent:typeof t=="object"&&!Array.isArray(t)?t:void 0,content:[{type:"text",text:e}]}}function XM(t){const e=_.c(27),{uiResourceUri:n,connectionId:r,orgId:s,orgSlug:o,toolName:i,toolInput:a,toolResult:l,toolMeta:c,onMessage:u,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:h}=t;let m;e[0]!==r||e[1]!==s||e[2]!==o?(m={connectionId:r,orgId:s,orgSlug:o},e[0]=r,e[1]=s,e[2]=o,e[3]=m):m=e[3];const y=gl(m);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g={type:"object"},e[4]=g):g=e[4];let x;e[5]!==c?(x=c!=null&&{_meta:c},e[5]=c,e[6]=x):x=e[6];let b;e[7]!==x||e[8]!==i?(b={name:i,inputSchema:g,...x},e[7]=x,e[8]=i,e[9]=b):b=e[9];const v=b;let k;e[10]!==v?(k={tool:v},e[10]=v,e[11]=k):k=e[11];let N;e[12]!==a?(N=YM(a),e[12]=a,e[13]=N):N=e[13];let C;e[14]!==l?(C=GM(l),e[14]=l,e[15]=C):C=e[15];let S;return e[16]!==y||e[17]!==u||e[18]!==h||e[19]!==f||e[20]!==d||e[21]!==s||e[22]!==k||e[23]!==N||e[24]!==C||e[25]!==n?(S=p.jsx("div",{className:"mt-2 border border-border/75 rounded-lg overflow-hidden p-3",children:p.jsx(w0,{resourceURI:n,orgId:s,toolInfo:k,toolInput:N,toolResult:C,client:y,onMessage:u,onUpdateModelContext:d,onTeardown:f,onRequestDisplayMode:h})}),e[16]=y,e[17]=u,e[18]=h,e[19]=f,e[20]=d,e[21]=s,e[22]=k,e[23]=N,e[24]=C,e[25]=n,e[26]=S):S=e[26],S}const Xd="studio-storage://",Qd="mesh-storage://";function Mc(t){return t.startsWith(Xd)?t.slice(Xd.length):t.startsWith(Qd)?t.slice(Qd.length):null}function Ig(t,e){const n=Mc(t);return n!==null?`/api/${e}/files/${n}`:t}function QM(t){return Array.isArray(t?.images)?t.images:void 0}function ZM(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,r=e+n;return r?{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:r,cost:0,cacheReadTokens:0,cacheWriteTokens:0}:null}function eT(t){const e=_.c(14),{uri:n,orgSlug:r}=t,s=J();let o;e[0]!==r||e[1]!==n?(o=Ig(n,r),e[0]=r,e[1]=n,e[2]=o):o=e[2];const i=o;let a;e[3]!==s||e[4]!==n?(a=Mc(n)!==null?n.slice(n.lastIndexOf("/")+1):s("chat.generateImage.reference"),e[3]=s,e[4]=n,e[5]=a):a=e[5];const l=a;let c;e[6]!==l?(c=p.jsx(_n,{asChild:!0,children:p.jsx("span",{className:"inline-flex items-center gap-1 px-1 py-0.5 rounded bg-muted text-muted-foreground text-xs cursor-default select-none",children:l})}),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==l||e[9]!==i?(u=p.jsx(Bn,{side:"top",className:"max-w-sm p-1.5",children:p.jsx("img",{src:i,alt:l,className:"max-w-full max-h-64 object-contain rounded"})}),e[8]=l,e[9]=i,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==u?(d=p.jsxs(zn,{children:[c,u]}),e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function tT(t){const e=_.c(75),{part:n,latency:r}=t,s=J(),o=bf();let i;e[0]!==n.state?(i=It(n.state),e[0]=n.state,e[1]=i):i=e[1];const a=i,l=n.input,c=n.output;let u,d,f,h,m;if(e[2]!==l||e[3]!==r||e[4]!==o||e[5]!==n||e[6]!==c||e[7]!==a||e[8]!==s){m=Symbol.for("react.early_return_sentinel");e:{const x=QM(c);let b;e[14]!==c?(b=ZM(c),e[14]=c,e[15]=b):b=e[15];const v=b,k=c?.model,N=Array.isArray(l?.referenceImages)?l.referenceImages.filter(nT):void 0;let C;e[16]!==r?(C=r!=null&&r>0?p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Fn(r)}):null,e[16]=r,e[17]=C):C=e[17];const S=C;if(a==="loading"){let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx(Ps,{size:14}),e[18]=D):D=e[18];let E;e[19]!==s?(E=s("chat.generateImage.generatingImage"),e[19]=s,e[20]=E):E=e[20];let j;e[21]!==l?(j=l?.prompt?`"${l.prompt.slice(0,80)}…"`:void 0,e[21]=l,e[22]=j):j=e[22];let I;e[23]!==E||e[24]!==j?(I=p.jsx(ne,{icon:D,title:E,summary:j,state:"loading"}),e[23]=E,e[24]=j,e[25]=I):I=e[25],m=I;break e}if(c?.background){let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx(Ps,{size:14}),e[26]=D):D=e[26];let E;e[27]!==s?(E=s("chat.generateImage.imageQueuedGeneratingInBackground"),e[27]=s,e[28]=E):E=e[28];let j;e[29]!==l?(j=l?.prompt?`"${l.prompt.slice(0,80)}…"`:void 0,e[29]=l,e[30]=j):j=e[30];let I;e[31]!==E||e[32]!==j?(I=p.jsx(ne,{icon:D,title:E,summary:j,state:"idle"}),e[31]=E,e[32]=j,e[33]=I):I=e[33],m=I;break e}if(a==="error"||!x||x.length===0){let D;e[34]!==n||e[35]!==a?(D=a==="error"?Ci(n):void 0,e[34]=n,e[35]=a,e[36]=D):D=e[36];const E=D;let j="";l!==void 0&&(j=`# Input
174
174
  `+Zo(l)),E?(j&&(j=j+`
175
175
 
176
176
  `),j=j+(`# Error
177
177
  `+E)):c!==void 0&&(j&&(j=j+`
178
178
 
179
179
  `),j=j+(`# Output
180
- `+Zo(c)));let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx(Ps,{size:14}),e[37]=I):I=e[37];let R;e[38]!==s?(R=s("chat.generateImage.imageGeneration"),e[38]=s,e[39]=R):R=e[39];let z;e[40]!==a||e[41]!==s?(z=s(a==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[40]=a,e[41]=s,e[42]=z):z=e[42];const W=a==="error"?"error":"idle",q=j||null;let G;e[43]!==S||e[44]!==R||e[45]!==z||e[46]!==W||e[47]!==q||e[48]!==v?(G=p.jsx(ne,{icon:I,title:R,summary:z,state:W,usage:v,trailing:S,detail:q}),e[43]=S,e[44]=R,e[45]=z,e[46]=W,e[47]=q,e[48]=v,e[49]=G):G=e[49],m=G;break e}f="flex flex-col gap-2";let w;e[50]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Ps,{size:14,className:"text-pink-500"}),e[50]=w):w=e[50];let M;e[51]!==s?(M=s("chat.generateImage.generatedImage"),e[51]=s,e[52]=M):M=e[52];let T;e[53]!==l?(T=l?.prompt&&p.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:l.prompt}),e[53]=l,e[54]=T):T=e[54];const O=N&&N.length>0&&p.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[p.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:s("chat.generateImage.references")}),N.map((D,E)=>{const j=D.uri??D.url;return p.jsx(eT,{uri:j,orgSlug:o.slug},E)})]});let A;e[55]!==T||e[56]!==O?(A=p.jsxs("div",{className:"flex flex-col gap-1 pb-2 pl-6",children:[T,O]}),e[55]=T,e[56]=O,e[57]=A):A=e[57],e[58]!==S||e[59]!==k||e[60]!==M||e[61]!==A||e[62]!==v?(h=p.jsx(ne,{icon:w,title:M,summary:k,state:"idle",usage:v,trailing:S,children:A}),e[58]=S,e[59]=k,e[60]=M,e[61]=A,e[62]=v,e[63]=h):h=e[63],u="flex flex-wrap gap-2";let P;e[64]!==l?.prompt||e[65]!==o||e[66]!==s?(P=(D,E)=>{const j=D.uri??D.url;if(!j)return null;const I=Ig(j,o.slug);return p.jsx(m0,{src:I,alt:l?.prompt??s("chat.generateImage.generatedImageAlt"),children:p.jsx("img",{src:I,alt:l?.prompt??s("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},E)},e[64]=l?.prompt,e[65]=o,e[66]=s,e[67]=P):P=e[67],d=x.map(P)}e[2]=l,e[3]=r,e[4]=o,e[5]=n,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=f,e[12]=h,e[13]=m}else u=e[9],d=e[10],f=e[11],h=e[12],m=e[13];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[68]!==u||e[69]!==d?(y=p.jsx("div",{className:u,children:d}),e[68]=u,e[69]=d,e[70]=y):y=e[70];let g;return e[71]!==f||e[72]!==h||e[73]!==y?(g=p.jsxs("div",{className:f,children:[h,y]}),e[71]=f,e[72]=h,e[73]=y,e[74]=g):g=e[74],g}function nT(t){return t.uri??t.url}function rT(t,e){const n=Mc(t);return n!==null?`/api/${e}/files/${n}`:t}function sT(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,r=e+n;if(!r)return null;const s={providerMetadata:t.usage.providerMetadata};return{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:r,cost:Ff(s),cacheReadTokens:0,cacheWriteTokens:0}}function oT(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function iT(t){try{return`${new URL(t).origin}/favicon.ico`}catch{return""}}function aT(t){const e=_.c(16),{citation:n,index:r}=t;let s;e[0]!==n.url?(s=oT(n.url),e[0]=n.url,e[1]=s):s=e[1];const o=s;let i;e[2]!==n.url?(i=iT(n.url),e[2]=n.url,e[3]=i):i=e[3];const a=i,l=n.title||o;let c;e[4]!==a?(c=p.jsx("img",{src:a,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:lT}),e[4]=a,e[5]=c):c=e[5];let u;e[6]!==l?(u=p.jsx("span",{className:"truncate max-w-[180px]",children:l}),e[6]=l,e[7]=u):u=e[7];const d=r+1;let f;e[8]!==d?(f=p.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",d,"]"]}),e[8]=d,e[9]=f):f=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Bf,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=h):h=e[10];let m;return e[11]!==n.url||e[12]!==c||e[13]!==u||e[14]!==f?(m=p.jsxs("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[c,u,f,h]}),e[11]=n.url,e[12]=c,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function lT(t){t.target.style.display="none"}function cT(t,e){return t.replace(/\[(\d+)\]/g,(n,r)=>{const s=parseInt(r,10)-1,o=e[s];return o?`[\\[${r}\\]](${o.url})`:n})}const ra=5;function uT(t){const e=_.c(13),{citations:n}=t,r=J(),[s,o]=L.useState(!1),i=n.length>ra;let a;e[0]!==n||e[1]!==s?(a=s?n:n.slice(0,ra),e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a;let c;e[3]!==l?(c=l.map(fT),e[3]=l,e[4]=c):c=e[4];let u;e[5]!==n.length||e[6]!==s||e[7]!==i||e[8]!==r?(u=i&&p.jsx("button",{type:"button",onClick:()=>o(dT),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:s?r("chat.webSearch.showLess"):r("chat.webSearch.showMore",{count:n.length-ra})}),e[5]=n.length,e[6]=s,e[7]=i,e[8]=r,e[9]=u):u=e[9];let d;return e[10]!==c||e[11]!==u?(d=p.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c,u]}),e[10]=c,e[11]=u,e[12]=d):d=e[12],d}function dT(t){return!t}function fT(t,e){return p.jsx(aT,{citation:t,index:e},t.url)}function hT(t){const e=_.c(60),{part:n,latency:r,streamingText:s}=t,o=J(),i=bf();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a,c=n.input,u=n.output;let d,f,h;e[2]!==i||e[3]!==u?(d=u?.uri?rT(u.uri,i.slug):void 0,h=ni,f=ht.webSearchBlob(d??""),e[2]=i,e[3]=u,e[4]=d,e[5]=f,e[6]=h):(d=e[4],f=e[5],h=e[6]);let m;e[7]!==d?(m=async()=>{const te=await fetch(d);if(!te.ok)throw new Error(`Failed to fetch: ${te.status}`);return te.text()},e[7]=d,e[8]=m):m=e[8];const y=!!d;let g;e[9]!==f||e[10]!==m||e[11]!==y?(g={queryKey:f,queryFn:m,enabled:y,staleTime:1/0},e[9]=f,e[10]=m,e[11]=y,e[12]=g):g=e[12];const{data:x}=h(g),b=l==="loading",v=l!=="loading"&&l!=="error",k=u?.citations;let N;e[13]!==u?(N=sT(u),e[13]=u,e[14]=N):N=e[14];const C=N,S=u?.content??x??s;let w;e[15]!==k||e[16]!==S?(w=S&&k?.length?cT(S,k):S,e[15]=k,e[16]=S,e[17]=w):w=e[17];const M=w;let T;e[18]!==r?(T=r!=null&&r>0?p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Fn(r)}):null,e[18]=r,e[19]=T):T=e[19];const O=T;if(l==="error"){let te;e[20]===Symbol.for("react.memo_cache_sentinel")?(te=p.jsx(pa,{size:14}),e[20]=te):te=e[20];let ae;e[21]!==o?(ae=o("chat.webSearch.title"),e[21]=o,e[22]=ae):ae=e[22];let fe;e[23]!==o?(fe=o("chat.webSearch.failed"),e[23]=o,e[24]=fe):fe=e[24];let ce;return e[25]!==O||e[26]!==ae||e[27]!==fe||e[28]!==C?(ce=p.jsx(ne,{icon:te,title:ae,summary:fe,state:"error",usage:C,trailing:O}),e[25]=O,e[26]=ae,e[27]=fe,e[28]=C,e[29]=ce):ce=e[29],ce}const A=b?"animate-pulse":"text-blue-500";let P;e[30]!==A?(P=Q(A),e[30]=A,e[31]=P):P=e[31];let D;e[32]!==P?(D=p.jsx(pa,{size:14,className:P}),e[32]=P,e[33]=D):D=e[33];let E;e[34]!==b||e[35]!==o?(E=o(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=o,e[36]=E):E=e[36];let j;e[37]!==c||e[38]!==v||e[39]!==u?.model?(j=v?u?.model??c?.query?.slice(0,60):c?.query?`"${c.query.slice(0,80)}"`:void 0,e[37]=c,e[38]=v,e[39]=u?.model,e[40]=j):j=e[40];const I=b?"loading":"idle";let R;e[41]!==c?(R=c?.query&&p.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.query}),e[41]=c,e[42]=R):R=e[42];let z;e[43]!==M||e[44]!==n.toolCallId?(z=M?p.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:p.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:p.jsx(vl,{id:n.toolCallId,text:M})})}):p.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:p.jsxs("div",{className:"space-y-2 animate-pulse",children:[p.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),p.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=M,e[44]=n.toolCallId,e[45]=z):z=e[45];let W;e[46]!==k?(W=k&&k.length>0&&p.jsx(uT,{citations:k}),e[46]=k,e[47]=W):W=e[47];let q;e[48]!==R||e[49]!==z||e[50]!==W?(q=p.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[R,z,W]}),e[48]=R,e[49]=z,e[50]=W,e[51]=q):q=e[51];let G;return e[52]!==O||e[53]!==D||e[54]!==E||e[55]!==j||e[56]!==I||e[57]!==q||e[58]!==C?(G=p.jsx(ne,{icon:D,title:E,summary:j,state:I,usage:C,trailing:O,defaultOpen:!0,children:q}),e[52]=O,e[53]=D,e[54]=E,e[55]=j,e[56]=I,e[57]=q,e[58]=C,e[59]=G):G=e[59],G}function pT(t){const e=_.c(16),{part:n}=t,r=J();if(!n.state.startsWith("output-"))return null;let s;e[0]!==n.input?.prompt||e[1]!==r?(s=n.input?.prompt?.trim()||r("chat.userAskQuestion.question"),e[0]=n.input?.prompt,e[1]=r,e[2]=s):s=e[2];const o=s,i=n.state==="output-error"||n.state==="output-denied",a=n.state==="output-denied";let l;e[3]!==a||e[4]!==n||e[5]!==r?(l=a?r("chat.userAskQuestion.skippedAnswer"):n.state==="output-error"?Ci(n)??r("chat.subtask.errorLabel"):n.output?.response??"",e[3]=a,e[4]=n,e[5]=r,e[6]=l):l=e[6];const c=l;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(p0,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[7]=u):u=e[7];let d;e[8]!==o?(d=p.jsxs("div",{className:"flex items-start gap-2",children:[u,p.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:o})]}),e[8]=o,e[9]=d):d=e[9];let f;e[10]!==c||e[11]!==i?(f=c&&p.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:p.jsx("span",{className:Q("text-[14px] leading-snug",i?"text-muted-foreground/50 italic":"text-foreground/70"),children:c})}),e[10]=c,e[11]=i,e[12]=f):f=e[12];let h;return e[13]!==d||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[d,f]}),e[13]=d,e[14]=f,e[15]=h):h=e[15],h}const jg=L.createContext(new Map);function pA(t){const e=_.c(5),{messages:n,children:r}=t;let s;if(e[0]!==n){s=new Map;for(const i of n){const a=i.metadata?.subtaskJobId;if(!a)continue;const l=s.get(a);l?l.push(i):s.set(a,[i])}e[0]=n,e[1]=s}else s=e[1];let o;return e[2]!==s||e[3]!==r?(o=p.jsx(jg.Provider,{value:s,children:r}),e[2]=s,e[3]=r,e[4]=o):o=e[4],o}function mT(t){const e=_.c(3),n=L.useContext(jg);let r;return e[0]!==t||e[1]!==n?(r=t?n.get(t)??[]:[],e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function gT(t){return new ReadableStream({async start(e){const n=t.getReader(),r=new TextDecoder;let s="";try{for(;;){const{done:o,value:i}=await n.read();if(o)break;s+=r.decode(i,{stream:!0});let a;for(;(a=s.indexOf(`
180
+ `+Zo(c)));let I;e[37]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx(Ps,{size:14}),e[37]=I):I=e[37];let R;e[38]!==s?(R=s("chat.generateImage.imageGeneration"),e[38]=s,e[39]=R):R=e[39];let z;e[40]!==a||e[41]!==s?(z=s(a==="error"?"chat.generateImage.failed":"chat.generateImage.noImagesGenerated"),e[40]=a,e[41]=s,e[42]=z):z=e[42];const W=a==="error"?"error":"idle",q=j||null;let X;e[43]!==S||e[44]!==R||e[45]!==z||e[46]!==W||e[47]!==q||e[48]!==v?(X=p.jsx(ne,{icon:I,title:R,summary:z,state:W,usage:v,trailing:S,detail:q}),e[43]=S,e[44]=R,e[45]=z,e[46]=W,e[47]=q,e[48]=v,e[49]=X):X=e[49],m=X;break e}f="flex flex-col gap-2";let w;e[50]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Ps,{size:14,className:"text-pink-500"}),e[50]=w):w=e[50];let M;e[51]!==s?(M=s("chat.generateImage.generatedImage"),e[51]=s,e[52]=M):M=e[52];let T;e[53]!==l?(T=l?.prompt&&p.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:l.prompt}),e[53]=l,e[54]=T):T=e[54];const O=N&&N.length>0&&p.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[p.jsx("span",{className:"text-[11px] text-muted-foreground/50",children:s("chat.generateImage.references")}),N.map((D,E)=>{const j=D.uri??D.url;return p.jsx(eT,{uri:j,orgSlug:o.slug},E)})]});let A;e[55]!==T||e[56]!==O?(A=p.jsxs("div",{className:"flex flex-col gap-1 pb-2 pl-6",children:[T,O]}),e[55]=T,e[56]=O,e[57]=A):A=e[57],e[58]!==S||e[59]!==k||e[60]!==M||e[61]!==A||e[62]!==v?(h=p.jsx(ne,{icon:w,title:M,summary:k,state:"idle",usage:v,trailing:S,children:A}),e[58]=S,e[59]=k,e[60]=M,e[61]=A,e[62]=v,e[63]=h):h=e[63],u="flex flex-wrap gap-2";let P;e[64]!==l?.prompt||e[65]!==o||e[66]!==s?(P=(D,E)=>{const j=D.uri??D.url;if(!j)return null;const I=Ig(j,o.slug);return p.jsx(m0,{src:I,alt:l?.prompt??s("chat.generateImage.generatedImageAlt"),children:p.jsx("img",{src:I,alt:l?.prompt??s("chat.generateImage.generatedImageAlt"),className:"max-w-sm max-h-80 object-contain rounded-lg border border-border hover:border-foreground/20 transition-colors"})},E)},e[64]=l?.prompt,e[65]=o,e[66]=s,e[67]=P):P=e[67],d=x.map(P)}e[2]=l,e[3]=r,e[4]=o,e[5]=n,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=f,e[12]=h,e[13]=m}else u=e[9],d=e[10],f=e[11],h=e[12],m=e[13];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[68]!==u||e[69]!==d?(y=p.jsx("div",{className:u,children:d}),e[68]=u,e[69]=d,e[70]=y):y=e[70];let g;return e[71]!==f||e[72]!==h||e[73]!==y?(g=p.jsxs("div",{className:f,children:[h,y]}),e[71]=f,e[72]=h,e[73]=y,e[74]=g):g=e[74],g}function nT(t){return t.uri??t.url}function rT(t,e){const n=Mc(t);return n!==null?`/api/${e}/files/${n}`:t}function sT(t){if(!t?.usage)return null;const e=t.usage.inputTokens??0,n=t.usage.outputTokens??0,r=e+n;if(!r)return null;const s={providerMetadata:t.usage.providerMetadata};return{inputTokens:e,outputTokens:n,reasoningTokens:0,totalTokens:r,cost:Ff(s),cacheReadTokens:0,cacheWriteTokens:0}}function oT(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function iT(t){try{return`${new URL(t).origin}/favicon.ico`}catch{return""}}function aT(t){const e=_.c(16),{citation:n,index:r}=t;let s;e[0]!==n.url?(s=oT(n.url),e[0]=n.url,e[1]=s):s=e[1];const o=s;let i;e[2]!==n.url?(i=iT(n.url),e[2]=n.url,e[3]=i):i=e[3];const a=i,l=n.title||o;let c;e[4]!==a?(c=p.jsx("img",{src:a,alt:"",className:"size-3.5 rounded-sm shrink-0",onError:lT}),e[4]=a,e[5]=c):c=e[5];let u;e[6]!==l?(u=p.jsx("span",{className:"truncate max-w-[180px]",children:l}),e[6]=l,e[7]=u):u=e[7];const d=r+1;let f;e[8]!==d?(f=p.jsxs("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0",children:["[",d,"]"]}),e[8]=d,e[9]=f):f=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Bf,{size:10,className:"shrink-0 opacity-0 group-hover/src:opacity-100 transition-opacity"}),e[10]=h):h=e[10];let m;return e[11]!==n.url||e[12]!==c||e[13]!==u||e[14]!==f?(m=p.jsxs("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"group/src inline-flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:[c,u,f,h]}),e[11]=n.url,e[12]=c,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function lT(t){t.target.style.display="none"}function cT(t,e){return t.replace(/\[(\d+)\]/g,(n,r)=>{const s=parseInt(r,10)-1,o=e[s];return o?`[\\[${r}\\]](${o.url})`:n})}const ra=5;function uT(t){const e=_.c(13),{citations:n}=t,r=J(),[s,o]=L.useState(!1),i=n.length>ra;let a;e[0]!==n||e[1]!==s?(a=s?n:n.slice(0,ra),e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a;let c;e[3]!==l?(c=l.map(fT),e[3]=l,e[4]=c):c=e[4];let u;e[5]!==n.length||e[6]!==s||e[7]!==i||e[8]!==r?(u=i&&p.jsx("button",{type:"button",onClick:()=>o(dT),className:"inline-flex items-center rounded-md border border-border/50 bg-muted/30 px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:border-border hover:text-foreground",children:s?r("chat.webSearch.showLess"):r("chat.webSearch.showMore",{count:n.length-ra})}),e[5]=n.length,e[6]=s,e[7]=i,e[8]=r,e[9]=u):u=e[9];let d;return e[10]!==c||e[11]!==u?(d=p.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c,u]}),e[10]=c,e[11]=u,e[12]=d):d=e[12],d}function dT(t){return!t}function fT(t,e){return p.jsx(aT,{citation:t,index:e},t.url)}function hT(t){const e=_.c(60),{part:n,latency:r,streamingText:s}=t,o=J(),i=bf();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a,c=n.input,u=n.output;let d,f,h;e[2]!==i||e[3]!==u?(d=u?.uri?rT(u.uri,i.slug):void 0,h=ni,f=ht.webSearchBlob(d??""),e[2]=i,e[3]=u,e[4]=d,e[5]=f,e[6]=h):(d=e[4],f=e[5],h=e[6]);let m;e[7]!==d?(m=async()=>{const te=await fetch(d);if(!te.ok)throw new Error(`Failed to fetch: ${te.status}`);return te.text()},e[7]=d,e[8]=m):m=e[8];const y=!!d;let g;e[9]!==f||e[10]!==m||e[11]!==y?(g={queryKey:f,queryFn:m,enabled:y,staleTime:1/0},e[9]=f,e[10]=m,e[11]=y,e[12]=g):g=e[12];const{data:x}=h(g),b=l==="loading",v=l!=="loading"&&l!=="error",k=u?.citations;let N;e[13]!==u?(N=sT(u),e[13]=u,e[14]=N):N=e[14];const C=N,S=u?.content??x??s;let w;e[15]!==k||e[16]!==S?(w=S&&k?.length?cT(S,k):S,e[15]=k,e[16]=S,e[17]=w):w=e[17];const M=w;let T;e[18]!==r?(T=r!=null&&r>0?p.jsx("span",{className:"text-[11px] font-mono tabular-nums text-muted-foreground/60",children:Fn(r)}):null,e[18]=r,e[19]=T):T=e[19];const O=T;if(l==="error"){let te;e[20]===Symbol.for("react.memo_cache_sentinel")?(te=p.jsx(pa,{size:14}),e[20]=te):te=e[20];let ae;e[21]!==o?(ae=o("chat.webSearch.title"),e[21]=o,e[22]=ae):ae=e[22];let fe;e[23]!==o?(fe=o("chat.webSearch.failed"),e[23]=o,e[24]=fe):fe=e[24];let ce;return e[25]!==O||e[26]!==ae||e[27]!==fe||e[28]!==C?(ce=p.jsx(ne,{icon:te,title:ae,summary:fe,state:"error",usage:C,trailing:O}),e[25]=O,e[26]=ae,e[27]=fe,e[28]=C,e[29]=ce):ce=e[29],ce}const A=b?"animate-pulse":"text-blue-500";let P;e[30]!==A?(P=G(A),e[30]=A,e[31]=P):P=e[31];let D;e[32]!==P?(D=p.jsx(pa,{size:14,className:P}),e[32]=P,e[33]=D):D=e[33];let E;e[34]!==b||e[35]!==o?(E=o(b?"chat.webSearch.researching":"chat.webSearch.title"),e[34]=b,e[35]=o,e[36]=E):E=e[36];let j;e[37]!==c||e[38]!==v||e[39]!==u?.model?(j=v?u?.model??c?.query?.slice(0,60):c?.query?`"${c.query.slice(0,80)}"`:void 0,e[37]=c,e[38]=v,e[39]=u?.model,e[40]=j):j=e[40];const I=b?"loading":"idle";let R;e[41]!==c?(R=c?.query&&p.jsx("p",{className:"text-xs text-muted-foreground/70 whitespace-pre-wrap wrap-break-word",children:c.query}),e[41]=c,e[42]=R):R=e[42];let z;e[43]!==M||e[44]!==n.toolCallId?(z=M?p.jsx("div",{className:"max-h-96 overflow-y-auto overflow-x-hidden rounded-lg border border-border/40 bg-muted/20 px-4 py-3 min-w-0",children:p.jsx("div",{className:"prose prose-sm prose-neutral dark:prose-invert max-w-none text-[13px] leading-relaxed break-words",children:p.jsx(vl,{id:n.toolCallId,text:M})})}):p.jsx("div",{className:"rounded-lg border border-border/40 bg-muted/20 px-4 py-3",children:p.jsxs("div",{className:"space-y-2 animate-pulse",children:[p.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-3/4"}),p.jsx("div",{className:"h-3 rounded bg-muted-foreground/10 w-1/2"})]})}),e[43]=M,e[44]=n.toolCallId,e[45]=z):z=e[45];let W;e[46]!==k?(W=k&&k.length>0&&p.jsx(uT,{citations:k}),e[46]=k,e[47]=W):W=e[47];let q;e[48]!==R||e[49]!==z||e[50]!==W?(q=p.jsxs("div",{className:"pl-6 pb-3 flex flex-col gap-1 min-w-0",children:[R,z,W]}),e[48]=R,e[49]=z,e[50]=W,e[51]=q):q=e[51];let X;return e[52]!==O||e[53]!==D||e[54]!==E||e[55]!==j||e[56]!==I||e[57]!==q||e[58]!==C?(X=p.jsx(ne,{icon:D,title:E,summary:j,state:I,usage:C,trailing:O,defaultOpen:!0,children:q}),e[52]=O,e[53]=D,e[54]=E,e[55]=j,e[56]=I,e[57]=q,e[58]=C,e[59]=X):X=e[59],X}function pT(t){const e=_.c(16),{part:n}=t,r=J();if(!n.state.startsWith("output-"))return null;let s;e[0]!==n.input?.prompt||e[1]!==r?(s=n.input?.prompt?.trim()||r("chat.userAskQuestion.question"),e[0]=n.input?.prompt,e[1]=r,e[2]=s):s=e[2];const o=s,i=n.state==="output-error"||n.state==="output-denied",a=n.state==="output-denied";let l;e[3]!==a||e[4]!==n||e[5]!==r?(l=a?r("chat.userAskQuestion.skippedAnswer"):n.state==="output-error"?Ci(n)??r("chat.subtask.errorLabel"):n.output?.response??"",e[3]=a,e[4]=n,e[5]=r,e[6]=l):l=e[6];const c=l;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(p0,{className:"size-4 text-muted-foreground/50 shrink-0 mt-0.5"}),e[7]=u):u=e[7];let d;e[8]!==o?(d=p.jsxs("div",{className:"flex items-start gap-2",children:[u,p.jsx("span",{className:"text-[14px] text-muted-foreground leading-snug",children:o})]}),e[8]=o,e[9]=d):d=e[9];let f;e[10]!==c||e[11]!==i?(f=c&&p.jsx("div",{className:"ml-6 pl-2 border-l border-border/50",children:p.jsx("span",{className:G("text-[14px] leading-snug",i?"text-muted-foreground/50 italic":"text-foreground/70"),children:c})}),e[10]=c,e[11]=i,e[12]=f):f=e[12];let h;return e[13]!==d||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[d,f]}),e[13]=d,e[14]=f,e[15]=h):h=e[15],h}const jg=L.createContext(new Map);function pA(t){const e=_.c(5),{messages:n,children:r}=t;let s;if(e[0]!==n){s=new Map;for(const i of n){const a=i.metadata?.subtaskJobId;if(!a)continue;const l=s.get(a);l?l.push(i):s.set(a,[i])}e[0]=n,e[1]=s}else s=e[1];let o;return e[2]!==s||e[3]!==r?(o=p.jsx(jg.Provider,{value:s,children:r}),e[2]=s,e[3]=r,e[4]=o):o=e[4],o}function mT(t){const e=_.c(3),n=L.useContext(jg);let r;return e[0]!==t||e[1]!==n?(r=t?n.get(t)??[]:[],e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function gT(t){return new ReadableStream({async start(e){const n=t.getReader(),r=new TextDecoder;let s="";try{for(;;){const{done:o,value:i}=await n.read();if(o)break;s+=r.decode(i,{stream:!0});let a;for(;(a=s.indexOf(`
181
181
 
182
182
  `))!==-1;){const l=s.slice(0,a);s=s.slice(a+2);const c=l.split(`
183
183
  `).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trim()).join(`
184
184
  `);if(c)try{e.enqueue(JSON.parse(c))}catch{}}}}finally{n.releaseLock(),e.close()}}})}function yT(t){const{orgSlug:e,threadId:n,jobId:r,enabled:s}=t,[o,i]=L.useState([]),[a,l]=L.useState(!1);return L.useEffect(()=>{if(!s||!r||!n)return;const c=new AbortController;return i([]),l(!0),(async()=>{try{const u=await fetch(`/api/${encodeURIComponent(e)}/decopilot/threads/${encodeURIComponent(n)}/jobs/${encodeURIComponent(r)}/stream`,{headers:{accept:"text/event-stream"},credentials:"include",signal:c.signal});if(!u.ok||!u.body)return;for await(const d of x0({stream:b0(gT(u.body),void 0)})){if(c.signal.aborted)return;i([d])}}catch{}finally{c.signal.aborted||l(!1)}})(),()=>c.abort()},[s,r,n,e]),{messages:o,streaming:a}}function xT(t,e){if(t&&typeof t=="object"&&!Array.isArray(t)){const n=t;if(typeof n.text=="string"||typeof n.error=="string"||typeof n.finishReason=="string"){if(typeof n.error=="string"&&n.error.length>0)return e("chat.subtask.failedWithError",{error:n.error});const s=typeof n.text=="string"?n.text.trim():"",o=n.finishReason==="length";return s?(o?`${e("chat.subtask.stepLimitPartial")}
185
185
 
186
- `:"")+s:e(o?"chat.subtask.stepLimitNoOutput":"chat.subtask.completedNoOutput")}}return WM(t)}function Rg(t){return!!t&&typeof t=="object"&&t.background===!0}function Pg({part:t,subtaskMeta:e},n){const r=t.state==="input-streaming"||t.state==="input-available",s=t.state==="output-available"&&t.preliminary===!0,o=t.state==="output-available"&&!t.preliminary,i=t.state==="output-error",a=It(t.state,"preliminary"in t?t.preliminary:!1),l=a==="approval"?"idle":a,c=n(r?"chat.subtask.startingEllipsis":s?"chat.subtask.runningEllipsis":o?"chat.subtask.completedTitle":i?"chat.subtask.failedTitle":"chat.subtask.subtaskNoun"),u=t.input?.prompt??"",d=t.state==="approval-requested"?n("chat.subtask.awaitingApproval"):u.length>120?u.slice(0,120)+"…":u;return{fallbackTitle:c,summary:d,usage:e?.usage,state:l}}function Lg(t){return t.state==="input-available"?!0:t.state==="output-available"?"preliminary"in t&&t.preliminary===!0:!1}function $g(t){const e=_.c(4),n=vs()?.taskId??null,{org:r}=xt();if(!n)return null;let s;return e[0]!==r||e[1]!==n||e[2]!==t?(s=async()=>{if(n===null)return;const o=await fetch(`/api/${encodeURIComponent(r.slug)}/decopilot/flip/${encodeURIComponent(n)}`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({toolCallId:t})});if(!o.ok)throw new Error(`flip failed: ${o.status}`)},e[0]=r,e[1]=n,e[2]=t,e[3]=s):s=e[3],s}function bT(t){const e=_.c(10),{onFlip:n}=t,r=J(),[s,o]=L.useState(!1);let i;e[0]!==n?(i=async u=>{u.stopPropagation(),o(!0);try{await n()}catch{o(!1)}},e[0]=n,e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=Q("shrink-0 text-[12px] text-muted-foreground/70 px-2 py-1 rounded-md transition-colors","[@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/40","disabled:opacity-50"),e[2]=a):a=e[2];let l;e[3]!==s||e[4]!==r?(l=r(s?"chat.subtask.flipping":"chat.subtask.flipToBackground"),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==s||e[7]!==i||e[8]!==l?(c=p.jsx("button",{type:"button",disabled:s,onClick:i,className:a,children:l}),e[6]=s,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Tc(t){const e=_.c(54),{icon:n,title:r,summary:s,state:o,usage:i,latency:a,onOpenChange:l,onFlip:c,children:u}=t,[d,f]=L.useState(!1);let h;e[0]!==l?(h=te=>{f(te),l?.(te)},e[0]=l,e[1]=h):h=e[1];const m=h,y=o==="loading",g=o==="error";let x;e[2]!==m?(x=()=>m(!0),e[2]=m,e[3]=x):x=e[3];const b=y&&"shimmer";let v;e[4]!==b?(v=Q("group/tool flex items-center gap-2 flex-1 min-w-0 py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",b),e[4]=b,e[5]=v):v=e[5];const k=g?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let N;e[6]!==k?(N=Q("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",k),e[6]=k,e[7]=N):N=e[7];let C;e[8]!==n||e[9]!==N?(C=p.jsx("div",{className:N,children:n}),e[8]=n,e[9]=N,e[10]=C):C=e[10];const S=g?"text-warning/80":"text-foreground";let w;e[11]!==S?(w=Q("shrink-0 text-[14px] font-normal",S),e[11]=S,e[12]=w):w=e[12];let M;e[13]!==w||e[14]!==r?(M=p.jsx("span",{className:w,children:r}),e[13]=w,e[14]=r,e[15]=M):M=e[15];let T;e[16]!==s?(T=s?p.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:s})}):p.jsx("div",{className:"flex-1"}),e[16]=s,e[17]=T):T=e[17];let O;e[18]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx(A1,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=O):O=e[18];let A;e[19]!==a?(A=p.jsx(Le,{latency:a}),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==i?(P=p.jsx(vg,{usage:i}),e[21]=i,e[22]=P):P=e[22];let D;e[23]!==M||e[24]!==T||e[25]!==A||e[26]!==P||e[27]!==x||e[28]!==v||e[29]!==C?(D=p.jsxs("button",{type:"button",onClick:x,className:v,children:[C,M,T,O,A,P]}),e[23]=M,e[24]=T,e[25]=A,e[26]=P,e[27]=x,e[28]=v,e[29]=C,e[30]=D):D=e[30];let E;e[31]!==y||e[32]!==c?(E=c&&y?p.jsx(bT,{onFlip:c}):null,e[31]=y,e[32]=c,e[33]=E):E=e[33];let j;e[34]!==D||e[35]!==E?(j=p.jsxs("div",{className:"flex items-center gap-1 w-full",children:[D,E]}),e[34]=D,e[35]=E,e[36]=j):j=e[36];let I;e[37]!==n?(I=p.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:n}),e[37]=n,e[38]=I):I=e[38];let R;e[39]!==I||e[40]!==r?(R=p.jsx(vf,{className:"px-4 py-3 border-b border-border shrink-0",children:p.jsxs(kf,{className:"flex items-center gap-2 text-sm font-medium",children:[I,r]})}),e[39]=I,e[40]=r,e[41]=R):R=e[41];let z;e[42]!==u?(z=p.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:u}),e[42]=u,e[43]=z):z=e[43];let W;e[44]!==R||e[45]!==z?(W=p.jsxs(Sf,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[R,z]}),e[44]=R,e[45]=z,e[46]=W):W=e[46];let q;e[47]!==d||e[48]!==m||e[49]!==W?(q=p.jsx(Cf,{open:d,onOpenChange:m,children:W}),e[47]=d,e[48]=m,e[49]=W,e[50]=q):q=e[50];let G;return e[51]!==j||e[52]!==q?(G=p.jsxs(p.Fragment,{children:[j,q]}),e[51]=j,e[52]=q,e[53]=G):G=e[53],G}function _g(t){const e=_.c(22),{part:n}=t,r=J(),s=n.state==="output-error";let o;e[0]!==n.input?.prompt||e[1]!==r?(o=n.input?.prompt??r("chat.subtask.noPromptProvided"),e[0]=n.input?.prompt,e[1]=r,e[2]=o):o=e[2];const i=o;let a;if(e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==r){const l=s?Ci(n):xT(n.output,r)??"";let c;e[8]!==r?(c=r("chat.subtask.taskLabel"),e[8]=r,e[9]=c):c=e[9];let u;e[10]!==c?(u=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[10]=c,e[11]=u):u=e[11];let d;e[12]!==i?(d=p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:i}),e[12]=i,e[13]=d):d=e[13];let f;e[14]!==u||e[15]!==d?(f=p.jsxs("section",{children:[u,d]}),e[14]=u,e[15]=d,e[16]=f):f=e[16];let h;e[17]!==s||e[18]!==r?(h=r(s?"chat.subtask.errorLabel":"chat.subtask.resultLabel"),e[17]=s,e[18]=r,e[19]=h):h=e[19];let m;e[20]!==h?(m=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:h}),e[20]=h,e[21]=m):m=e[21],a=p.jsxs("div",{className:"flex flex-col gap-4",children:[f,p.jsxs("section",{children:[m,l.trim()?p.jsx(vl,{id:`${n.toolCallId}-result`,text:l}):p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:r("chat.subtask.running")})]})]}),e[3]=s,e[4]=n,e[5]=i,e[6]=r,e[7]=a}else a=e[7];return a}const sa=600;function vT(t){const e=_.c(12),{part:n}=t,r=n.type??"";let s;e[0]!==n.toolName||e[1]!==r?(s=r==="dynamic-tool"?n.toolName??"tool":r.slice(5),e[0]=n.toolName,e[1]=r,e[2]=s):s=e[2];const o=s;let i;if(e[3]!==n.input){const f=n.input!=null?JSON.stringify(n.input):"";i=f.length>80?`${f.slice(0,80)}…`:f||void 0,e[3]=n.input,e[4]=i}else i=e[4];const a=i;let l;if(e[5]!==n.input){const f=n.input!=null?JSON.stringify(n.input,null,2):null;l=f&&f.length>sa?`${f.slice(0,sa)}
187
- … (${f.length-sa} more characters)`:f,e[5]=n.input,e[6]=l}else l=e[6];const c=l;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(jf,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==o||e[10]!==a?(d=p.jsx(ne,{icon:u,title:o,summary:a,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=o,e[10]=a,e[11]=d):d=e[11],d}function kT(t){const e=_.c(19),{jobId:n,prompt:r,items:s,streaming:o}=t,i=J();let a;e[0]!==i?(a=i("chat.subtask.taskLabel"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==r?(c=p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r}),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u=p.jsxs("section",{children:[l,c]}),e[6]=l,e[7]=c,e[8]=u):u=e[8];let d;e[9]!==s||e[10]!==n||e[11]!==o||e[12]!==i?(d=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:i("chat.subtask.runningInBackground")}):s.map((m,y)=>{const g=m,x=g.type??"";return x==="text"?g.text?.trim()?p.jsx(gi,{id:`${n}-sub-${y}`,part:m,animate:o},`${n}-sub-${y}`):null:x==="dynamic-tool"||x.startsWith("tool-")&&x!=="tool-todo_write"&&x!=="tool-update_interests"?p.jsx(vT,{part:g},`${n}-sub-${y}`):null}),e[9]=s,e[10]=n,e[11]=o,e[12]=i,e[13]=d):d=e[13];let f;e[14]!==d?(f=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:d}),e[14]=d,e[15]=f):f=e[15];let h;return e[16]!==u||e[17]!==f?(h=p.jsxs("div",{className:"flex flex-col gap-4",children:[u,f]}),e[16]=u,e[17]=f,e[18]=h):h=e[18],h}function Bg(t){const e=_.c(32),{part:n}=t,r=J(),s=n.output?.jobId,o=vs()?.taskId??null,{org:i}=xt(),[a,l]=L.useState(!1),c=mT(s),u=o??"",d=a&&!!o;let f;e[0]!==s||e[1]!==i.slug||e[2]!==u||e[3]!==d?(f={orgSlug:i.slug,threadId:u,jobId:s,enabled:d},e[0]=s,e[1]=i.slug,e[2]=u,e[3]=d,e[4]=f):f=e[4];const h=yT(f);let m;e[5]!==h.messages?(m=h.messages.flatMap(CT),e[5]=h.messages,e[6]=m):m=e[6];const y=m;let g;e[7]!==c?(g=c.flatMap(ST),e[7]=c,e[8]=g):g=e[8];const x=g,b=y.length>0?y:x;let v;e[9]!==n.input?.prompt||e[10]!==r?(v=n.input?.prompt??r("chat.subtask.noPromptProvided"),e[9]=n.input?.prompt,e[10]=r,e[11]=v):v=e[11];const k=v;let N;e[12]!==k?(N=k.length>120?`${k.slice(0,120)}…`:k,e[12]=k,e[13]=N):N=e[13];const C=N,S=c.length===0;let w;e[14]!==r?(w=r("chat.subtask.subtaskNoun"),e[14]=r,e[15]=w):w=e[15];let M;e[16]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx(Sl,{}),e[16]=M):M=e[16];let T;e[17]!==w?(T=p.jsx(Kn,{icon:void 0,name:w,size:"2xs",className:"rounded-xs",fallbackIcon:M}),e[17]=w,e[18]=T):T=e[18];let O;e[19]!==r?(O=r("chat.subtask.subtaskNoun"),e[19]=r,e[20]=O):O=e[20];const A=S?"loading":"idle",P=h.streaming||S;let D;e[21]!==b||e[22]!==s||e[23]!==k||e[24]!==P?(D=p.jsx(kT,{jobId:s,prompt:k,items:b,streaming:P}),e[21]=b,e[22]=s,e[23]=k,e[24]=P,e[25]=D):D=e[25];let E;return e[26]!==C||e[27]!==T||e[28]!==O||e[29]!==A||e[30]!==D?(E=p.jsx(Tc,{icon:T,title:O,summary:C,state:A,onOpenChange:l,children:D}),e[26]=C,e[27]=T,e[28]=O,e[29]=A,e[30]=D,e[31]=E):E=e[31],E}function ST(t){return t.parts??[]}function CT(t){return t.parts??[]}function wT(t){const e=_.c(24),n=J(),r=$g(t.part.toolCallId);if(Rg(t.part.output)){let y;return e[0]!==t?(y=p.jsx(Bg,{...t}),e[0]=t,e[1]=y):y=e[1],y}let s;e[2]!==t||e[3]!==n?(s=Pg(t,n),e[2]=t,e[3]=n,e[4]=s):s=e[4];const{fallbackTitle:o,summary:i,usage:a,state:l}=s;let c;e[5]!==n?(c=n("chat.subtask.subtaskNoun"),e[5]=n,e[6]=c):c=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Sl,{}),e[7]=u):u=e[7];let d;e[8]!==c?(d=p.jsx(Kn,{icon:void 0,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[8]=c,e[9]=d):d=e[9];let f;e[10]!==r||e[11]!==t.part?(f=r&&Lg(t.part)?r:void 0,e[10]=r,e[11]=t.part,e[12]=f):f=e[12];let h;e[13]!==t.part?(h=p.jsx(_g,{part:t.part}),e[13]=t.part,e[14]=h):h=e[14];let m;return e[15]!==o||e[16]!==t.latency||e[17]!==l||e[18]!==i||e[19]!==d||e[20]!==f||e[21]!==h||e[22]!==a?(m=p.jsx(Tc,{icon:d,title:o,summary:i,state:l,usage:a,latency:t.latency,onFlip:f,children:h}),e[15]=o,e[16]=t.latency,e[17]=l,e[18]=i,e[19]=d,e[20]=f,e[21]=h,e[22]=a,e[23]=m):m=e[23],m}function NT(t){const e=_.c(26),n=J(),r=Tf(t.part.input?.agent_id),s=$g(t.part.toolCallId);if(Rg(t.part.output)){let b;return e[0]!==t?(b=p.jsx(Bg,{...t}),e[0]=t,e[1]=b):b=e[1],b}let o;e[2]!==t||e[3]!==n?(o=Pg(t,n),e[2]=t,e[3]=n,e[4]=o):o=e[4];const{fallbackTitle:i,summary:a,usage:l,state:c}=o,u=r?.icon;let d;e[5]!==n||e[6]!==r?.title?(d=r?.title??n("chat.subtask.subtaskNoun"),e[5]=n,e[6]=r?.title,e[7]=d):d=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(Sl,{}),e[8]=f):f=e[8];let h;e[9]!==u||e[10]!==d?(h=p.jsx(Kn,{icon:u,name:d,size:"2xs",className:"rounded-xs",fallbackIcon:f}),e[9]=u,e[10]=d,e[11]=h):h=e[11];const m=r?.title??i;let y;e[12]!==s||e[13]!==t.part?(y=s&&Lg(t.part)?s:void 0,e[12]=s,e[13]=t.part,e[14]=y):y=e[14];let g;e[15]!==t.part?(g=p.jsx(_g,{part:t.part}),e[15]=t.part,e[16]=g):g=e[16];let x;return e[17]!==t.latency||e[18]!==c||e[19]!==a||e[20]!==h||e[21]!==m||e[22]!==y||e[23]!==g||e[24]!==l?(x=p.jsx(Tc,{icon:h,title:m,summary:a,state:c,usage:l,latency:t.latency,onFlip:y,children:g}),e[17]=t.latency,e[18]=c,e[19]=a,e[20]=h,e[21]=m,e[22]=y,e[23]=g,e[24]=l,e[25]=x):x=e[25],x}function MT(t){const e=_.c(28),{part:n}=t,r=J();if(!n.state.startsWith("output-"))return null;const s=n.input?.plan??"",i=n.output?.approved===!0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(ha,{className:"size-4 text-purple-500 shrink-0"}),e[0]=a):a=e[0];let l;e[1]!==r?(l=r("chat.proposePlan.implementationPlan"),e[1]=r,e[2]=l):l=e[2];let c;e[3]!==l?(c=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:l}),e[3]=l,e[4]=c):c=e[4];let u;e[5]!==i||e[6]!==r?(u=i&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[p.jsx(xl,{size:12}),r("chat.proposePlan.approved")]}),e[5]=i,e[6]=r,e[7]=u):u=e[7];let d;e[8]!==i||e[9]!==n.state||e[10]!==r?(d=!i&&n.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:r("chat.proposePlan.rejected")}),e[8]=i,e[9]=n.state,e[10]=r,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==u||e[14]!==d?(f=p.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,d]}),e[12]=c,e[13]=u,e[14]=d,e[15]=f):f=e[15];let h;e[16]!==r?(h=r("chat.proposePlan.viewPlan"),e[16]=r,e[17]=h):h=e[17];let m;e[18]!==h?(m=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:h}),e[18]=h,e[19]=m):m=e[19];let y;e[20]!==s?(y=p.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:p.jsx(gi,{id:"plan-content",part:{type:"text",text:s}})}),e[20]=s,e[21]=y):y=e[21];let g;e[22]!==m||e[23]!==y?(g=p.jsxs("details",{className:"ml-6",children:[m,y]}),e[22]=m,e[23]=y,e[24]=g):g=e[24];let x;return e[25]!==g||e[26]!==f?(x=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,g]}),e[25]=g,e[26]=f,e[27]=x):x=e[27],x}function Ec(t){return{primary:t("chat.brandContext.colorPrimary"),secondary:t("chat.brandContext.colorSecondary"),accent:t("chat.brandContext.colorAccent"),background:t("chat.brandContext.colorBackground"),foreground:t("chat.brandContext.colorForeground")}}function TT(t){try{const e=new URL(t.startsWith("http")?t:`https://${t}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function Dc(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function ET(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Zd(t){const e=_.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function DT(t){const e=_.c(12),{name:n,value:r}=t;let s;e[0]!==r?(s=p.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:r},"aria-hidden":!0}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=p.jsx("span",{className:"text-sm text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r?(i=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=i):i=e[5];let a;e[6]!==o||e[7]!==i?(a=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=a):a=e[8];let l;return e[9]!==s||e[10]!==a?(l=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,a]}),e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function OT(t){const e=_.c(15),{role:n,family:r}=t;let s;e[0]!==r?(s=p.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:r},"aria-hidden":!0,children:"Aa"}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=p.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r?(i={fontFamily:r},e[4]=r,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a=p.jsx("span",{className:"text-sm text-foreground",style:i,children:r}),e[6]=r,e[7]=i,e[8]=a):a=e[8];let l;e[9]!==o||e[10]!==a?(l=p.jsxs("div",{className:"flex flex-col leading-tight",children:[o,a]}),e[9]=o,e[10]=a,e[11]=l):l=e[11];let c;return e[12]!==s||e[13]!==l?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,l]}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c}function AT(t){const e=_.c(3),{logo:n,favicon:r,name:s}=t,o=n??r;if(!o)return null;const i=s?`${s} logo`:"";let a;return e[0]!==o||e[1]!==i?(a=p.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:IT}),e[0]=o,e[1]=i,e[2]=a):a=e[2],a}function IT(t){t.target.style.display="none"}function zg(t){const e=_.c(12),{colors:n}=t,r=J();let s;e[0]!==r?(s=Ec(r),e[0]=r,e[1]=s):s=e[1];const o=s;let i,a,l;if(e[2]!==o||e[3]!==n){l=Symbol.for("react.early_return_sentinel");e:{const u=Dc(n);if(u.length===0){l=null;break e}i="flex h-1.5";let d;e[7]!==o?(d=f=>{const[h,m]=f;return p.jsx("span",{className:"flex-1",style:{backgroundColor:m},title:`${o[h]}: ${m}`,"aria-hidden":!0},h)},e[7]=o,e[8]=d):d=e[8],a=u.map(d)}e[2]=o,e[3]=n,e[4]=i,e[5]=a,e[6]=l}else i=e[4],a=e[5],l=e[6];if(l!==Symbol.for("react.early_return_sentinel"))return l;let c;return e[9]!==i||e[10]!==a?(c=p.jsx("div",{className:i,children:a}),e[9]=i,e[10]=a,e[11]=c):c=e[11],c}function Fg(t){const e=_.c(51),{logo:n,favicon:r,name:s,domain:o,overview:i,colors:a,fonts:l,showDefaultBadge:c,isDefault:u}=t,d=J();let f;e[0]!==d?(f=Ec(d),e[0]=d,e[1]=f):f=e[1];const h=f;let m,y,g,x,b,v,k;if(e[2]!==h||e[3]!==a||e[4]!==o||e[5]!==r||e[6]!==l||e[7]!==u||e[8]!==n||e[9]!==s||e[10]!==i||e[11]!==c||e[12]!==d){const S=Dc(a),w=ET(l);v="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==a?(k=a&&p.jsx(zg,{colors:a}),e[20]=a,e[21]=k):k=e[21],m="p-5 flex flex-col gap-6";let M;e[22]!==r||e[23]!==n||e[24]!==s?(M=p.jsx(AT,{logo:n,favicon:r,name:s}),e[22]=r,e[23]=n,e[24]=s,e[25]=M):M=e[25];let T;e[26]!==u||e[27]!==s||e[28]!==c||e[29]!==d?(T=s&&p.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[s,c&&u&&p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[p.jsx(Nf,{className:"size-3 text-amber-500"}),d("chat.brandContext.defaultBadge")]})]}),e[26]=u,e[27]=s,e[28]=c,e[29]=d,e[30]=T):T=e[30];let O;e[31]!==o?(O=o&&p.jsxs("a",{href:TT(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,p.jsx(Bf,{className:"size-3 shrink-0"})]}),e[31]=o,e[32]=O):O=e[32];let A;e[33]!==T||e[34]!==O?(A=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[T,O]}),e[33]=T,e[34]=O,e[35]=A):A=e[35],e[36]!==A||e[37]!==M?(y=p.jsxs("div",{className:"flex items-center gap-4",children:[M,A]}),e[36]=A,e[37]=M,e[38]=y):y=e[38],e[39]!==i?(g=i&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[39]=i,e[40]=g):g=e[40],x=S.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Zd,{children:d("chat.brandContext.colorsSection")}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:S.map(P=>{const[D,E]=P;return p.jsx(DT,{name:h[D],value:E},D)})})]}),b=w.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Zd,{children:d("chat.brandContext.typographySection")}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(jT)})]}),e[2]=h,e[3]=a,e[4]=o,e[5]=r,e[6]=l,e[7]=u,e[8]=n,e[9]=s,e[10]=i,e[11]=c,e[12]=d,e[13]=m,e[14]=y,e[15]=g,e[16]=x,e[17]=b,e[18]=v,e[19]=k}else m=e[13],y=e[14],g=e[15],x=e[16],b=e[17],v=e[18],k=e[19];let N;e[41]!==m||e[42]!==y||e[43]!==g||e[44]!==x||e[45]!==b?(N=p.jsxs("div",{className:m,children:[y,g,x,b]}),e[41]=m,e[42]=y,e[43]=g,e[44]=x,e[45]=b,e[46]=N):N=e[46];let C;return e[47]!==v||e[48]!==k||e[49]!==N?(C=p.jsxs("div",{className:v,children:[k,N]}),e[47]=v,e[48]=k,e[49]=N,e[50]=C):C=e[50],C}function jT(t){const[e,n]=t;return p.jsx(OT,{role:e,family:n},e)}function RT(t){const e=_.c(46),{part:n,latency:r}=t,s=J();let o;e[0]!==n.state?(o=It(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let a,l,c,u,d;if(e[2]!==r||e[3]!==n.input||e[4]!==n.output||e[5]!==i||e[6]!==s){d=Symbol.for("react.early_return_sentinel");e:{l=Nr(n.output);const w=i==="loading",M=i==="error"||l&&l.success===!1;if(w){const T=n.input;let O;e[12]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx(Nt,{className:"animate-pulse"}),e[12]=O):O=e[12];let A;e[13]!==s?(A=s("chat.brandContext.extractingBrand"),e[13]=s,e[14]=A):A=e[14];let P;e[15]!==T||e[16]!==s?(P=T?.domain?s("chat.brandContext.fromDomain",{domain:T.domain}):void 0,e[15]=T,e[16]=s,e[17]=P):P=e[17];let D;e[18]!==A||e[19]!==P?(D=p.jsx(ne,{icon:O,title:A,summary:P,state:"loading",defaultOpen:!0}),e[18]=A,e[19]=P,e[20]=D):D=e[20],d=D;break e}if(M){let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(Nt,{}),e[21]=T):T=e[21];let O;e[22]!==s?(O=s("chat.brandContext.extractionFailed"),e[22]=s,e[23]=O):O=e[23];let A;e[24]!==r?(A=p.jsx(Le,{latency:r}),e[24]=r,e[25]=A):A=e[25],d=p.jsx(ne,{icon:T,title:O,summary:l?.error??s("chat.brandContext.unknownError"),state:"error",trailing:A});break e}a=ne,e[26]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Nt,{className:"text-fuchsia-500"}),e[26]=c):c=e[26],u=l?.name?s("chat.brandContext.brandSet",{name:l.name}):s("chat.brandContext.brandContextSet")}e[2]=r,e[3]=n.input,e[4]=n.output,e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=u,e[11]=d}else a=e[7],l=e[8],c=e[9],u=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const f=l?.domain;let h;e[27]!==r?(h=p.jsx(Le,{latency:r}),e[27]=r,e[28]=h):h=e[28];let m;e[29]!==a||e[30]!==c||e[31]!==u||e[32]!==f||e[33]!==h?(m=p.jsx(a,{icon:c,title:u,summary:f,state:"idle",trailing:h}),e[29]=a,e[30]=c,e[31]=u,e[32]=f,e[33]=h,e[34]=m):m=e[34];const y=l?.logo,g=l?.favicon,x=l?.name,b=l?.domain,v=l?.overview,k=l?.colors,N=l?.fonts;let C;e[35]!==x||e[36]!==b||e[37]!==v||e[38]!==k||e[39]!==N||e[40]!==y||e[41]!==g?(C=p.jsx(Fg,{logo:y,favicon:g,name:x,domain:b,overview:v,colors:k,fonts:N}),e[35]=x,e[36]=b,e[37]=v,e[38]=k,e[39]=N,e[40]=y,e[41]=g,e[42]=C):C=e[42];let S;return e[43]!==C||e[44]!==m?(S=p.jsxs(p.Fragment,{children:[m,C]}),e[43]=C,e[44]=m,e[45]=S):S=e[45],S}function PT(t){const e=_.c(45),{part:n,latency:r}=t,s=J();let o;e[0]!==n.state?(o=It(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let a,l,c,u,d;if(e[2]!==r||e[3]!==n.output||e[4]!==i||e[5]!==s){d=Symbol.for("react.early_return_sentinel");e:{l=Nr(n.output);const g=i==="loading",x=i==="error"||l&&l.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Nt,{className:"animate-pulse"}),e[11]=b):b=e[11];let v;e[12]!==s?(v=s("chat.brandContext.loadingBrand"),e[12]=s,e[13]=v):v=e[13];let k;e[14]!==v?(k=p.jsx(ne,{icon:b,title:v,state:"loading"}),e[14]=v,e[15]=k):k=e[15],d=k;break e}if(x||!l){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Nt,{}),e[16]=b):b=e[16];let v;e[17]!==s?(v=s("chat.brandContext.couldNotLoadBrand"),e[17]=s,e[18]=v):v=e[18];let k;e[19]!==r?(k=p.jsx(Le,{latency:r}),e[19]=r,e[20]=k):k=e[20];let N;e[21]!==v||e[22]!==k?(N=p.jsx(ne,{icon:b,title:v,state:"error",trailing:k}),e[21]=v,e[22]=k,e[23]=N):N=e[23],d=N;break e}a=ne,e[24]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Nt,{className:"text-fuchsia-500"}),e[24]=c):c=e[24],u=l.name?s("chat.brandContext.brandWithName",{name:l.name}):s("chat.brandContext.brand")}e[2]=r,e[3]=n.output,e[4]=i,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d}else a=e[6],l=e[7],c=e[8],u=e[9],d=e[10];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[25]!==r?(f=p.jsx(Le,{latency:r}),e[25]=r,e[26]=f):f=e[26];let h;e[27]!==a||e[28]!==l.domain||e[29]!==c||e[30]!==u||e[31]!==f?(h=p.jsx(a,{icon:c,title:u,summary:l.domain,state:"idle",trailing:f}),e[27]=a,e[28]=l.domain,e[29]=c,e[30]=u,e[31]=f,e[32]=h):h=e[32];let m;e[33]!==l.colors||e[34]!==l.domain||e[35]!==l.favicon||e[36]!==l.fonts||e[37]!==l.isDefault||e[38]!==l.logo||e[39]!==l.name||e[40]!==l.overview?(m=p.jsx(Fg,{logo:l.logo,favicon:l.favicon,name:l.name,domain:l.domain,overview:l.overview,colors:l.colors,fonts:l.fonts,showDefaultBadge:!0,isDefault:l.isDefault}),e[33]=l.colors,e[34]=l.domain,e[35]=l.favicon,e[36]=l.fonts,e[37]=l.isDefault,e[38]=l.logo,e[39]=l.name,e[40]=l.overview,e[41]=m):m=e[41];let y;return e[42]!==h||e[43]!==m?(y=p.jsxs(p.Fragment,{children:[h,m]}),e[42]=h,e[43]=m,e[44]=y):y=e[44],y}function LT(t){const e=_.c(49),{part:n,latency:r}=t,s=J();let o;e[0]!==s?(o=Ec(s),e[0]=s,e[1]=o):o=e[1];const i=o;let a;e[2]!==n.state?(a=It(n.state),e[2]=n.state,e[3]=a):a=e[3];const l=a;let c,u,d,f;if(e[4]!==i||e[5]!==r||e[6]!==n.output||e[7]!==l||e[8]!==s){f=Symbol.for("react.early_return_sentinel");e:{const y=Nr(n.output),g=Array.isArray(y?.items)?y.items:[],x=l==="loading",b=l==="error";if(x){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.brandContext.loadingBrands"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],f=w;break e}if(b){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{}),e[18]=C):C=e[18];let S;e[19]!==s?(S=s("chat.brandContext.couldNotLoadBrands"),e[19]=s,e[20]=S):S=e[20];let w;e[21]!==r?(w=p.jsx(Le,{latency:r}),e[21]=r,e[22]=w):w=e[22];let M;e[23]!==S||e[24]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[23]=S,e[24]=w,e[25]=M):M=e[25],f=M;break e}if(g.length===0){let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{}),e[26]=C):C=e[26];let S;e[27]!==s?(S=s("chat.brandContext.noBrandsYet"),e[27]=s,e[28]=S):S=e[28];let w;e[29]!==s?(w=s("chat.brandContext.noBrandsContext"),e[29]=s,e[30]=w):w=e[30];let M;e[31]!==r?(M=p.jsx(Le,{latency:r}),e[31]=r,e[32]=M):M=e[32];let T;e[33]!==M||e[34]!==S||e[35]!==w?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[33]=M,e[34]=S,e[35]=w,e[36]=T):T=e[36],f=T;break e}let v;e[37]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(Nt,{className:"text-fuchsia-500"}),e[37]=v):v=e[37];let k;e[38]!==r?(k=p.jsx(Le,{latency:r}),e[38]=r,e[39]=k):k=e[39],d=p.jsx(ne,{icon:v,title:g.length===1?s("chat.brandContext.oneBrand"):s("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:k}),c="mt-2 flex flex-col gap-1.5";let N;e[40]!==i||e[41]!==s?(N=(C,S)=>{const w=Dc(C.colors);return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[C.colors&&p.jsx(zg,{colors:C.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(C.logo||C.favicon)&&p.jsx("img",{src:C.logo??C.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:$T}),p.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[C.name??s("chat.brandContext.untitled"),C.isDefault&&p.jsx(Nf,{className:"size-3 text-amber-500 shrink-0"})]}),C.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:C.domain})]}),w.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(M=>{const[T,O]=M;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:O},title:`${i[T]}: ${O}`,"aria-hidden":!0},T)})})]})]},C.id??`${C.name}-${C.domain}-${S}`)},e[40]=i,e[41]=s,e[42]=N):N=e[42],u=g.map(N)}e[4]=i,e[5]=r,e[6]=n.output,e[7]=l,e[8]=s,e[9]=c,e[10]=u,e[11]=d,e[12]=f}else c=e[9],u=e[10],d=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let h;e[43]!==c||e[44]!==u?(h=p.jsx("div",{className:c,children:u}),e[43]=c,e[44]=u,e[45]=h):h=e[45];let m;return e[46]!==d||e[47]!==h?(m=p.jsxs(p.Fragment,{children:[d,h]}),e[46]=d,e[47]=h,e[48]=m):m=e[48],m}function $T(t){t.target.style.display="none"}function ll(t){const e=_.c(4),{connection_id:n,iconSize:r}=t,s=r===void 0?"xs":r,o=Tf(n);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==s?(i=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(Kn,{icon:o.icon,name:o.title,size:s})}),e[0]=o.icon,e[1]=o.title,e[2]=s,e[3]=i):i=e[3],i}ll.Fallback=function({iconSize:e="xs"}){const n=e==="sm"?"size-6":"size-5";return p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:Q(n,"rounded bg-muted animate-pulse")})})};function xs(t){const e=_.c(18),{connectionIds:n,maxVisibleIcons:r,iconSize:s,className:o}=t,i=r===void 0?2:r,a=s===void 0?"xs":s;if(n.length===0)return null;let l,c,u;if(e[0]!==o||e[1]!==n||e[2]!==a||e[3]!==i){const h=n.slice(0,i);l=n.length-i,e[7]!==o?(c=Q("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=c):c=e[8];let m;e[9]!==a?(m=y=>p.jsx(L.Suspense,{fallback:p.jsx(ll.Fallback,{iconSize:a}),children:p.jsx(ll,{connection_id:y,iconSize:a})},y),e[9]=a,e[10]=m):m=e[10],u=h.map(m),e[0]=o,e[1]=n,e[2]=a,e[3]=i,e[4]=l,e[5]=c,e[6]=u}else l=e[4],c=e[5],u=e[6];let d;e[11]!==a||e[12]!==l?(d=l>0&&p.jsx("div",{className:Q("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",a==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:Q(a==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${l} more`,children:["+",l]})}),e[11]=a,e[12]=l,e[13]=d):d=e[13];let f;return e[14]!==c||e[15]!==u||e[16]!==d?(f=p.jsxs("div",{className:c,children:[u,d]}),e[14]=c,e[15]=u,e[16]=d,e[17]=f):f=e[17],f}xs.Fallback=function({maxVisibleIcons:e=2,totalCount:n,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",o=r==="sm"?"size-8":"size-6",i=n!==void 0&&n>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((a,l)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:Q(s,"rounded bg-muted animate-pulse")})},l)),i&&p.jsx("div",{className:Q("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:p.jsx("div",{className:Q(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const _T="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",ef=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function BT(t){const e=_.c(105),{part:n,latency:r}=t,s=J(),o=zf(),i=It(n.state),a=L.useRef(null),l=L.useRef(null),c=L.useRef(null),u=L.useRef(null),d=L.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{ef?.matches||(d.current=a.current?.getBoundingClientRect()??null,a.current&&(a.current.style.willChange="transform"))},e[0]=f):f=e[0];const h=f;let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=X=>{if(ef?.matches)return;const ee=d.current,se=a.current;if(!ee||!se)return;const _e=(X.clientX-ee.left)/ee.width*100,Je=(X.clientY-ee.top)/ee.height*100;se.style.transform=`perspective(800px) rotateY(${(_e-50)*.05}deg) rotateX(${(Je-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(_e-50)*.15}px, ${(Je-50)*.15}px)`),c.current&&(c.current.style.opacity="0.45"),u.current&&(u.current.style.opacity="0.45")},e[1]=m):m=e[1];const y=m;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const X=a.current;X&&(X.style.transform="none",X.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),c.current&&(c.current.style.opacity="0.3"),u.current&&(u.current.style.opacity="0.3"),d.current=null},e[2]=g):g=e[2];const x=g;if(i==="loading"){let X;e[3]===Symbol.for("react.memo_cache_sentinel")?(X=p.jsx(wt,{className:"animate-pulse"}),e[3]=X):X=e[3];let ee;e[4]!==s?(ee=s("chat.agentCreate.creating"),e[4]=s,e[5]=ee):ee=e[5];let se;return e[6]!==ee?(se=p.jsx(ne,{icon:X,title:ee,state:"loading",defaultOpen:!0}),e[6]=ee,e[7]=se):se=e[7],se}if(i==="approval"){let X;e[8]===Symbol.for("react.memo_cache_sentinel")?(X=p.jsx(wt,{}),e[8]=X):X=e[8];let ee;e[9]!==s?(ee=s("chat.agentCreate.createAgent"),e[9]=s,e[10]=ee):ee=e[10];let se;return e[11]!==ee?(se=p.jsx(ne,{icon:X,title:ee,state:"idle"}),e[11]=ee,e[12]=se):se=e[12],se}if(i==="error"){let X;e[13]===Symbol.for("react.memo_cache_sentinel")?(X=p.jsx(wt,{}),e[13]=X):X=e[13];let ee;e[14]!==n.state||e[15]!==s?(ee=n.state==="output-denied"?s("chat.agentCreate.cancelled"):s("chat.agentCreate.couldntCreate"),e[14]=n.state,e[15]=s,e[16]=ee):ee=e[16];let se;e[17]!==r?(se=p.jsx(Le,{latency:r}),e[17]=r,e[18]=se):se=e[18];let _e;return e[19]!==ee||e[20]!==se?(_e=p.jsx(ne,{icon:X,title:ee,state:"error",trailing:se}),e[19]=ee,e[20]=se,e[21]=_e):_e=e[21],_e}let b,v,k,N,C,S,w,M,T,O,A,P,D,E,j,I,R,z,W,q,G,te,ae;if(e[22]!==r||e[23]!==o||e[24]!==n.output||e[25]!==s){R=Symbol.for("react.early_return_sentinel");e:{const X=Nr(n.output)?.item;if(!X?.id||!X?.title){let ut;e[49]===Symbol.for("react.memo_cache_sentinel")?(ut=p.jsx(wt,{}),e[49]=ut):ut=e[49];let dt;e[50]!==s?(dt=s("chat.agentCreate.created"),e[50]=s,e[51]=dt):dt=e[51];let ue;e[52]!==r?(ue=p.jsx(Le,{latency:r}),e[52]=r,e[53]=ue):ue=e[53];let Me;e[54]!==dt||e[55]!==ue?(Me=p.jsx(ne,{icon:ut,title:dt,state:"idle",trailing:ue}),e[54]=dt,e[55]=ue,e[56]=Me):Me=e[56],R=Me;break e}const ee=(X.connections??[]).map(zT);let se;e[57]===Symbol.for("react.memo_cache_sentinel")?(se=p.jsx(wt,{className:"text-success"}),e[57]=se):se=e[57];let _e;e[58]!==r?(_e=p.jsx(Le,{latency:r}),e[58]=r,e[59]=_e):_e=e[59],I=p.jsx(ne,{icon:se,title:s("chat.agentCreate.agentCreated",{name:X.title}),state:"idle",trailing:_e}),j="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",k=a,N="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(C={transition:"transform 0.3s ease-out"},e[60]=C):C=e[60],S=h,w=y,M=x,e[61]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx("div",{ref:l,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[61]=T):T=e[61];let Je;e[62]===Symbol.for("react.memo_cache_sentinel")?(Je={textAlign:"justify",wordBreak:"break-all"},e[62]=Je):Je=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:Je,"aria-hidden":"true",children:_T.repeat(6)}),A=p.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[63]=O,e[64]=A):(O=e[63],A=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(P=p.jsx("img",{ref:c,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[65]=P):P=e[65],e[66]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx("img",{ref:u,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[66]=D):D=e[66],E=p.jsxs("div",{className:"relative",children:[p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[p.jsx(Mf,{icon:X.icon,name:X.title,size:"md"}),p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:X.title})})]}),X.description&&p.jsx("div",{className:"px-2 pt-1 pr-16",children:p.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:X.description})})]}),ae="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const vt=ee.length>0&&p.jsx(L.Suspense,{fallback:p.jsx(xs.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:ee.length}),children:p.jsx(xs,{connectionIds:ee,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==vt?(v=p.jsx("div",{className:"flex-1 min-w-0",children:vt}),e[67]=vt,e[68]=v):v=e[68],te="flex items-center gap-2 shrink-0",b=Ln,z="sm",W="h-7",q=()=>o(X.id),G=s("chat.agentCreate.seeAgentLabel",{name:X.title})}e[22]=r,e[23]=o,e[24]=n.output,e[25]=s,e[26]=b,e[27]=v,e[28]=k,e[29]=N,e[30]=C,e[31]=S,e[32]=w,e[33]=M,e[34]=T,e[35]=O,e[36]=A,e[37]=P,e[38]=D,e[39]=E,e[40]=j,e[41]=I,e[42]=R,e[43]=z,e[44]=W,e[45]=q,e[46]=G,e[47]=te,e[48]=ae}else b=e[26],v=e[27],k=e[28],N=e[29],C=e[30],S=e[31],w=e[32],M=e[33],T=e[34],O=e[35],A=e[36],P=e[37],D=e[38],E=e[39],j=e[40],I=e[41],R=e[42],z=e[43],W=e[44],q=e[45],G=e[46],te=e[47],ae=e[48];if(R!==Symbol.for("react.early_return_sentinel"))return R;let fe;e[69]!==s?(fe=s("chat.agentCreate.seeAgent"),e[69]=s,e[70]=fe):fe=e[70];let ce;e[71]!==b||e[72]!==fe||e[73]!==z||e[74]!==W||e[75]!==q||e[76]!==G?(ce=p.jsx(b,{size:z,className:W,onClick:q,"aria-label":G,children:fe}),e[71]=b,e[72]=fe,e[73]=z,e[74]=W,e[75]=q,e[76]=G,e[77]=ce):ce=e[77];let we;e[78]!==ce||e[79]!==te?(we=p.jsx("div",{className:te,children:ce}),e[78]=ce,e[79]=te,e[80]=we):we=e[80];let $e;e[81]!==v||e[82]!==we||e[83]!==ae?($e=p.jsxs("div",{className:ae,children:[v,we]}),e[81]=v,e[82]=we,e[83]=ae,e[84]=$e):$e=e[84];let Ne;e[85]!==k||e[86]!==N||e[87]!==C||e[88]!==S||e[89]!==w||e[90]!==M||e[91]!==T||e[92]!==O||e[93]!==A||e[94]!==P||e[95]!==D||e[96]!==E||e[97]!==$e?(Ne=p.jsxs("div",{ref:k,className:N,style:C,onMouseEnter:S,onMouseMove:w,onMouseLeave:M,children:[T,O,A,P,D,E,$e]}),e[85]=k,e[86]=N,e[87]=C,e[88]=S,e[89]=w,e[90]=M,e[91]=T,e[92]=O,e[93]=A,e[94]=P,e[95]=D,e[96]=E,e[97]=$e,e[98]=Ne):Ne=e[98];let me;e[99]!==j||e[100]!==Ne?(me=p.jsx("div",{className:j,children:Ne}),e[99]=j,e[100]=Ne,e[101]=me):me=e[101];let Ke;return e[102]!==I||e[103]!==me?(Ke=p.jsxs(p.Fragment,{children:[I,me]}),e[102]=I,e[103]=me,e[104]=Ke):Ke=e[104],Ke}function zT(t){return t.connection_id}function FT(t){const e=_.c(24),{agent:n}=t,r=zf();if(!n.id)return null;let s;e[0]!==n.connections?(s=n.connections??[],e[0]=n.connections,e[1]=s):s=e[1];let o;e[2]!==s?(o=s.map(HT),e[2]=s,e[3]=o):o=e[3];const i=o;let a;e[4]!==n.id||e[5]!==r?(a=()=>r(n.id),e[4]=n.id,e[5]=r,e[6]=a):a=e[6];let l;e[7]!==n.icon||e[8]!==n.title?(l=p.jsx(Mf,{icon:n.icon,name:n.title,size:"sm"}),e[7]=n.icon,e[8]=n.title,e[9]=l):l=e[9];let c;e[10]!==n.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[10]=n.title,e[11]=c):c=e[11];let u;e[12]!==n.description?(u=n.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=u):u=e[13];let d;e[14]!==c||e[15]!==u?(d=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&p.jsx(L.Suspense,{fallback:p.jsx(xs.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:p.jsx(xs,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let h;return e[19]!==a||e[20]!==l||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[l,d,f]}),e[19]=a,e[20]=l,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function HT(t){return t.connection_id}function WT(t){const e=_.c(59),{part:n,latency:r}=t,s=J(),o=ml(),{org:i}=xt();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a;let c,u,d,f,h,m;if(e[2]!==r||e[3]!==n.output||e[4]!==n.state||e[5]!==l||e[6]!==s){m=Symbol.for("react.early_return_sentinel");e:{const b=Nr(n.output);if(u=Array.isArray(b?.items)?b.items:[],l==="loading"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.agentList.loading"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],m=w;break e}if(l==="approval"){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[18]=C):C=e[18];let S;e[19]!==s?(S=s("chat.agentList.listAgents"),e[19]=s,e[20]=S):S=e[20];let w;e[21]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"idle"}),e[21]=S,e[22]=w):w=e[22],m=w;break e}if(l==="error"){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[23]=C):C=e[23];let S;e[24]!==n.state||e[25]!==s?(S=n.state==="output-denied"?s("chat.agentList.unavailable"):s("chat.agentList.couldntLoad"),e[24]=n.state,e[25]=s,e[26]=S):S=e[26];let w;e[27]!==r?(w=p.jsx(Le,{latency:r}),e[27]=r,e[28]=w):w=e[28];let M;e[29]!==S||e[30]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[29]=S,e[30]=w,e[31]=M):M=e[31],m=M;break e}if(u.length===0){let C;e[32]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[32]=C):C=e[32];let S;e[33]!==s?(S=s("chat.agentList.noAgents"),e[33]=s,e[34]=S):S=e[34];let w;e[35]!==s?(w=s("chat.agentList.noAgentsDesc"),e[35]=s,e[36]=w):w=e[36];let M;e[37]!==r?(M=p.jsx(Le,{latency:r}),e[37]=r,e[38]=M):M=e[38];let T;e[39]!==S||e[40]!==w||e[41]!==M?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[39]=S,e[40]=w,e[41]=M,e[42]=T):T=e[42],m=T;break e}const v=u.slice(0,Cg);c=u.length-v.length;let k;e[43]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(wt,{className:"text-success"}),e[43]=k):k=e[43];let N;e[44]!==r?(N=p.jsx(Le,{latency:r}),e[44]=r,e[45]=N):N=e[45],h=p.jsx(ne,{icon:k,title:u.length===1?s("chat.agentList.oneAgent"):s("chat.agentList.multiAgents",{count:u.length}),state:"idle",trailing:N}),d="mt-2 flex flex-col gap-1.5",f=v.map(VT)}e[2]=r,e[3]=n.output,e[4]=n.state,e[5]=l,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m}else c=e[7],u=e[8],d=e[9],f=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[46]!==c||e[47]!==u||e[48]!==o||e[49]!==i||e[50]!==s?(y=c>0&&p.jsx(wg,{count:u.length,noun:s("chat.agentList.agentsNoun"),onClick:()=>o({to:"/$org/settings/agents",params:{org:i.slug}})}),e[46]=c,e[47]=u,e[48]=o,e[49]=i,e[50]=s,e[51]=y):y=e[51];let g;e[52]!==d||e[53]!==f||e[54]!==y?(g=p.jsxs("div",{className:d,children:[f,y]}),e[52]=d,e[53]=f,e[54]=y,e[55]=g):g=e[55];let x;return e[56]!==h||e[57]!==g?(x=p.jsxs(p.Fragment,{children:[h,g]}),e[56]=h,e[57]=g,e[58]=x):x=e[58],x}function VT(t){return p.jsx(FT,{agent:t},t.id)}const UT={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function qT(t){const e=_.c(27),{connection:n}=t,r=ml(),{org:s}=xt(),o=n.slug,i=n.description||n.app_name,a=!o||void 0;let l;e[0]!==r||e[1]!==s||e[2]!==o?(l=()=>o&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:o}}),e[0]=r,e[1]=s,e[2]=o,e[3]=l):l=e[3];let c;e[4]!==n.icon||e[5]!==n.title?(c=p.jsx(Kn,{icon:n.icon,name:n.title,size:"sm"}),e[4]=n.icon,e[5]=n.title,e[6]=c):c=e[6];let u;e[7]!==n.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[7]=n.title,e[8]=u):u=e[8];let d;e[9]!==i?(d=i&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==u||e[12]!==d?(f=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,d]}),e[11]=u,e[12]=d,e[13]=f):f=e[13];const h=UT[n.status]??"bg-muted-foreground";let m;e[14]!==h?(m=Q("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let y;e[16]!==m?(y=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=y):y=e[17];let g;e[18]!==n.status?(g=p.jsx("span",{className:"sr-only",children:n.status}),e[18]=n.status,e[19]=g):g=e[19];let x;return e[20]!==a||e[21]!==g||e[22]!==l||e[23]!==c||e[24]!==f||e[25]!==y?(x=p.jsxs("button",{type:"button","aria-disabled":a,onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,y,g]}),e[20]=a,e[21]=g,e[22]=l,e[23]=c,e[24]=f,e[25]=y,e[26]=x):x=e[26],x}function KT(t){const e=_.c(54),{part:n,latency:r}=t,s=J(),o=ml(),{org:i}=xt();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a;let c,u,d,f,h,m;if(e[2]!==r||e[3]!==n.output||e[4]!==n.state||e[5]!==l||e[6]!==s){m=Symbol.for("react.early_return_sentinel");e:{const b=Nr(n.output);if(u=(Array.isArray(b?.items)?b.items:[]).filter(YT),l==="loading"||l==="approval"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.connectionList.loadingTitle"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],m=w;break e}if(l==="error"){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{}),e[18]=C):C=e[18];let S;e[19]!==n.state||e[20]!==s?(S=n.state==="output-denied"?s("chat.connectionList.unavailableTitle"):s("chat.connectionList.errorTitle"),e[19]=n.state,e[20]=s,e[21]=S):S=e[21];let w;e[22]!==r?(w=p.jsx(Le,{latency:r}),e[22]=r,e[23]=w):w=e[23];let M;e[24]!==S||e[25]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[24]=S,e[25]=w,e[26]=M):M=e[26],m=M;break e}if(u.length===0){let C;e[27]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{}),e[27]=C):C=e[27];let S;e[28]!==s?(S=s("chat.connectionList.emptyTitle"),e[28]=s,e[29]=S):S=e[29];let w;e[30]!==s?(w=s("chat.connectionList.emptySummary"),e[30]=s,e[31]=w):w=e[31];let M;e[32]!==r?(M=p.jsx(Le,{latency:r}),e[32]=r,e[33]=M):M=e[33];let T;e[34]!==S||e[35]!==w||e[36]!==M?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[34]=S,e[35]=w,e[36]=M,e[37]=T):T=e[37],m=T;break e}const v=u.slice(0,Cg);c=u.length-v.length;let k;e[38]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Ls,{className:"text-success"}),e[38]=k):k=e[38];let N;e[39]!==r?(N=p.jsx(Le,{latency:r}),e[39]=r,e[40]=N):N=e[40],h=p.jsx(ne,{icon:k,title:u.length===1?s("chat.connectionList.singleConnection"):s("chat.connectionList.multipleConnections",{count:u.length}),state:"idle",trailing:N}),d="mt-2 flex flex-col gap-1.5",f=v.map(JT)}e[2]=r,e[3]=n.output,e[4]=n.state,e[5]=l,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m}else c=e[7],u=e[8],d=e[9],f=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[41]!==c||e[42]!==u||e[43]!==o||e[44]!==i||e[45]!==s?(y=c>0&&p.jsx(wg,{count:u.length,noun:s("chat.connectionList.connectionNoun"),onClick:()=>o({to:"/$org/settings/connections",params:{org:i.slug}})}),e[41]=c,e[42]=u,e[43]=o,e[44]=i,e[45]=s,e[46]=y):y=e[46];let g;e[47]!==d||e[48]!==f||e[49]!==y?(g=p.jsxs("div",{className:d,children:[f,y]}),e[47]=d,e[48]=f,e[49]=y,e[50]=g):g=e[50];let x;return e[51]!==h||e[52]!==g?(x=p.jsxs(p.Fragment,{children:[h,g]}),e[51]=h,e[52]=g,e[53]=x):x=e[53],x}function JT(t){return p.jsx(qT,{connection:t},t.id)}function YT(t){return t.connection_type!=="VIRTUAL"}function GT(){const t=_.c(42),e=J(),n=vs(),{sendMessage:r,isStreaming:s,messages:o}=k0(),{org:i}=xt(),a=n?.virtualMcpId,{prompts:l}=I0(i.slug),c=a??null;let u;t[0]!==i.id||t[1]!==i.slug||t[2]!==c?(u={connectionId:c,orgId:i.id,orgSlug:i.slug},t[0]=i.id,t[1]=i.slug,t[2]=c,t[3]=u):u=t[3];const d=gl(u),[f,h]=L.useState(null);if(!a||s||!e0(a)||!o.some(XT))return null;let y;if(t[4]!==l||t[5]!==a){let E;t[7]!==a?(E=j=>j.agentId===a&&j.promptName,t[7]=a,t[8]=E):E=t[8],y=l.find(E),t[4]=l,t[5]=a,t[6]=y}else y=t[6];const g=y;if(!g)return null;let x;t[9]!==d||t[10]!==r||t[11]!==e?(x=async(E,j)=>{if(!d){fa.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const I=await j0(d,E.name,j);await r({type:"doc",content:[{type:"paragraph",content:[um({id:E.name,name:Nl(E.name,wl(E._meta)),metadata:I.messages,char:"/",kind:"prompt",args:j}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),fa.error(e("chat.nextActionChip.failedLoadPrompt"))}},t[9]=d,t[10]=r,t[11]=e,t[12]=x):x=t[12];const b=x;let v;t[13]!==g._meta||t[14]!==g.arguments||t[15]!==g.description||t[16]!==g.promptName||t[17]!==g.title||t[18]!==b?(v=()=>{const E={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(E.arguments&&E.arguments.length>0){h(E);return}b(E)},t[13]=g._meta,t[14]=g.arguments,t[15]=g.description,t[16]=g.promptName,t[17]=g.title,t[18]=b,t[19]=v):v=t[19];const k=v;let N;t[20]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(U1,{size:12,className:"shrink-0 text-purple-500"}),t[20]=N):N=t[20];let C;t[21]!==e?(C=e("chat.nextActionChip.next"),t[21]=e,t[22]=C):C=t[22];let S;t[23]!==C?(S=p.jsx("span",{className:"font-medium text-foreground/80",children:C}),t[23]=C,t[24]=S):S=t[24];let w;t[25]!==g.title?(w=p.jsx("span",{className:"truncate",children:g.title}),t[25]=g.title,t[26]=w):w=t[26];let M;t[27]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx(Pf,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),t[27]=M):M=t[27];let T;t[28]!==k||t[29]!==S||t[30]!==w?(T=p.jsxs("button",{type:"button",onClick:k,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[N,S,w,M]}),t[28]=k,t[29]=S,t[30]=w,t[31]=T):T=t[31];let O;t[32]===Symbol.for("react.memo_cache_sentinel")?(O=E=>h(E),t[32]=O):O=t[32];let A;t[33]!==f||t[34]!==b?(A=async E=>{const j=f;h(null),j&&await b(j,E)},t[33]=f,t[34]=b,t[35]=A):A=t[35];let P;t[36]!==f||t[37]!==A?(P=p.jsx(ay,{prompt:f,setPrompt:O,onSubmit:A}),t[36]=f,t[37]=A,t[38]=P):P=t[38];let D;return t[39]!==T||t[40]!==P?(D=p.jsxs(p.Fragment,{children:[T,P]}),t[39]=T,t[40]=P,t[41]=D):D=t[41],D}function XT(t){return t.role==="user"||t.parts.some(QT)}function QT(t){return t.type==="tool-user_ask"&&t.state==="output-available"}function ZT(t){const e=new Map;for(let n=t.length-1;n>=0;n--){const r=t[n]?.parts;if(r)for(const s of r){const o=s;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const a=`deck:${i.path}`;e.has(a)||e.set(a,{tabId:I1(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function e3(){const t=_.c(9),{openPanel:e}=kl(),n=wr()?.messages??[],r=ZT(n);if(r.length===0)return null;const s=r.some(n3),o=r.some(t3),i=s?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",a="flex flex-col gap-1.5 py-2";let l;t[0]!==i?(l=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),t[0]=i,t[1]=l):l=t[1];const c="flex flex-wrap gap-2";let u;t[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e(m.tabId),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[m.kind==="deck"?p.jsx(K0,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(q0,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),t[2]=e,t[3]=u):u=t[3];const d=r.map(u);let f;t[4]!==d?(f=p.jsx("div",{className:c,children:d}),t[4]=d,t[5]=f):f=t[5];let h;return t[6]!==l||t[7]!==f?(h=p.jsxs("div",{className:a,children:[l,f]}),t[6]=l,t[7]=f,t[8]=h):h=t[8],h}function t3(t){return t.kind==="page"}function n3(t){return t.kind==="deck"}async function r3(t,e){const n=await fetch(`/api/${e}/threads/${encodeURIComponent(t)}/outputs`,{credentials:"include"});if(!n.ok)throw new Error(`Failed to fetch thread outputs: ${n.status}`);return(await n.json()).objects??[]}function mA(){const t=_.c(2),e=wr()?.messages??[];let n;return t[0]!==e?(n=e.some(s3),t[0]=e,t[1]=n):n=t[1],n}function s3(t){return t.parts?.some(o3)}function o3(t){const e=t;return(e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function i3(t,e){const n=_.c(9),{org:r}=xt();let s;n[0]!==t?(s=ht.threadOutputs(t??""),n[0]=t,n[1]=s):s=n[1];let o;n[2]!==r||n[3]!==t?(o=()=>r3(t??"",r.slug),n[2]=r,n[3]=t,n[4]=o):o=n[4];const i=!!t&&(e?.enabled??!0);let a;return n[5]!==s||n[6]!==o||n[7]!==i?(a={queryKey:s,queryFn:o,enabled:i,staleTime:0},n[5]=s,n[6]=o,n[7]=i,n[8]=a):a=n[8],ni(a)}function a3(t){const e=_.c(29),{file:n}=t,r=J(),{openPanel:s}=kl();let o;e[0]!==n.key||e[1]!==s?(o=()=>s(j1(n.key)),e[0]=n.key,e[1]=s,e[2]=o):o=e[2];const i=o;let a;e[3]!==n.filename?(a=p.jsx(Y0,{filename:n.filename,className:"h-5 w-4 shrink-0"}),e[3]=n.filename,e[4]=a):a=e[4];let l;e[5]!==n.filename||e[6]!==i?(l=p.jsx("button",{type:"button",onClick:i,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:n.filename,children:n.filename}),e[5]=n.filename,e[6]=i,e[7]=l):l=e[7];const c=n.downloadUrl,u=n.filename;let d;e[8]!==r?(d=r("chat.outputFileRow.download"),e[8]=r,e[9]=d):d=e[9];let f;e[10]!==n.filename||e[11]!==r?(f=r("chat.outputFileRow.downloadFile",{filename:n.filename}),e[10]=n.filename,e[11]=r,e[12]=f):f=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(J0,{className:"size-3.5"}),e[13]=h):h=e[13];let m;e[14]!==n.downloadUrl||e[15]!==n.filename||e[16]!==d||e[17]!==f?(m=p.jsx("a",{href:c,download:u,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:d,"aria-label":f,children:h}),e[14]=n.downloadUrl,e[15]=n.filename,e[16]=d,e[17]=f,e[18]=m):m=e[18];let y;e[19]!==r?(y=r("chat.outputFileRow.open"),e[19]=r,e[20]=y):y=e[20];let g;e[21]!==i||e[22]!==y?(g=p.jsx(Ln,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:y}),e[21]=i,e[22]=y,e[23]=g):g=e[23];let x;return e[24]!==g||e[25]!==a||e[26]!==l||e[27]!==m?(x=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[a,l,m,g]}),e[24]=g,e[25]=a,e[26]=l,e[27]=m,e[28]=x):x=e[28],x}function l3(t){return t.split("/").pop()??t}const c3=/(^|\/)output\//;function u3(t){const e=new Set;for(const n of t.parts??[]){const r=n;if(r.state==="output-available"&&r.type==="tool-write"){const s=r.input?.path;s&&c3.test(s)&&e.add(l3(s))}}return e}function d3(t){const e=_.c(4),{threadId:n,message:r}=t,s=u3(r),o=s.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:a}=i3(n,i);if(s.size===0)return null;const l=(a??[]).filter(f=>s.has(f.filename));if(l.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=l.map(f3);let d;return e[2]!==u?(d=p.jsx("div",{className:c,children:u}),e[2]=u,e[3]=d):d=e[3],d}function f3(t){return p.jsx(a3,{file:t},t.key)}function h3(t){return t.type==="reasoning"}function p3(t){const e=[],n=new Set,r=new Map,s=new Map,o=new Map;if(t){let a=null;for(let l=0;l<t.parts.length;l++){const c=t.parts[l];if(h3(c)){a||(a={parts:[],startIndex:l},e.push(a)),a.parts.push(c),n.add(l);continue}if(a=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const u=c.data,d={};u.annotations&&(d.annotations=u.annotations),typeof u.latencyMs=="number"&&Number.isFinite(u.latencyMs)&&(d.latencySeconds=u.latencyMs/1e3),typeof u.outputBytes=="number"&&Number.isFinite(u.outputBytes)&&u.outputBytes>=0&&(d.outputBytes=u.outputBytes),u._meta&&typeof u._meta=="object"&&(d._meta=u._meta),r.set(c.id,d);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){s.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const u=c.id,d=c.data;o.set(u,d.text??"");continue}}}const i=[];if(t)for(let a=0;a<t.parts.length;a++){const l=t.parts[a];if(l.type!=="step-start"){if(n.has(a)){const c=e.find(u=>u.startIndex===a);c&&i.push({kind:"reasoning-group",group:c});continue}l.type.startsWith("data-")||i.push({kind:"part",index:a})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:o}}}const m3=3;function g3(t,e){let n=-1;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.kind==="part"&&e[s.index]?.type==="text"){n=r;break}}return n===-1?{collapsed:[],tail:t}:{collapsed:t.slice(0,n),tail:t.slice(n)}}function y3(t,e){let n=0,r=0;for(const s of t)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&n++}return{toolCalls:n,messages:r}}function x3(t){const e=_.c(10),{toolCalls:n,messages:r}=t,s=J();let o;e[0]!==r||e[1]!==s||e[2]!==n?(o=n>0&&p.jsxs(p.Fragment,{children:[p.jsx(jf,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[s("chat.assistant.toolCallPlural",{count:n}),r>0?",":""]})]}),e[0]=r,e[1]=s,e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r||e[5]!==s?(i=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(q1,{className:"size-3.5 shrink-0"}),p.jsx("span",{children:s("chat.assistant.messagePlural",{count:r})})]}),e[4]=r,e[5]=s,e[6]=i):i=e[6];let a;return e[7]!==o||e[8]!==i?(a=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o,i]}),e[7]=o,e[8]=i,e[9]=a):a=e[9],a}function b3(t){const e=_.c(28),{items:n,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:a,isLoading:l,isLast:c}=t;let u;e[0]!==n||e[1]!==r.parts?(u=y3(n,r.parts),e[0]=n,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(x3,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==a||e[7]!==c||e[8]!==l||e[9]!==o||e[10]!==n||e[11]!==r||e[12]!==s||e[13]!==i){let x;e[15]!==a||e[16]!==c||e[17]!==l||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(x=(b,v)=>Hg({item:b,renderIndex:v,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:a,isLoading:l,isLast:c,isLastVisiblePart:!1}),e[15]=a,e[16]=c,e[17]=l,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=x):x=e[22],m=n.map(x),e[6]=a,e[7]=c,e[8]=l,e[9]=o,e[10]=n,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let y;e[23]!==m?(y=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=y):y=e[24];let g;return e[25]!==h||e[26]!==y?(g=p.jsx(ne,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:y}),e[25]=h,e[26]=y,e[27]=g):g=e[27],g}function Hg({item:t,renderIndex:e,message:n,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:a,isLast:l,isLastVisiblePart:c,renderOrder:u}){if(t.kind==="reasoning-group"){const{group:m}=t,y=m===r[r.length-1],g=s&&y;if(!m.parts.some(v=>v.text?.trim())&&!g)return null;const b=r.length===1?o:null;return p.jsx(wM,{duration:b,parts:m.parts,isStreaming:g},`${n.id}-reasoning-${m.startIndex}`)}const d=n.parts[t.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?Wf(Hf(),n.metadata?.usage):null;return p.jsx(v3,{part:d,id:n.id,usageStats:f&&p.jsx(iM,{usage:h,duration:o}),dataParts:i,isLoading:a,isLastMessage:l},`${n.id}-${t.index}`)}function v3(t){const e=_.c(115),{part:n,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:a}=t;let l;e[0]!==o.toolMetadata?(l=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=l):l=e[1];const c=l;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(n.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==n.toolCallId?(f=c(n.toolCallId)?.annotations,e[4]=c,e[5]=n.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==n.toolCallId?(h=c(n.toolCallId)?.latencySeconds,e[7]=c,e[8]=n.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==n.toolCallId?(m=c(n.toolCallId)?.outputBytes,e[10]=c,e[11]=n.toolCallId,e[12]=m):m=e[12];let y;e[13]!==c||e[14]!==n.toolCallId?(y=c(n.toolCallId)?._meta,e[13]=c,e[14]=n.toolCallId,e[15]=y):y=e[15];let g;return e[16]!==a||e[17]!==n||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==y?(g=p.jsx(Gd,{part:n,annotations:f,latency:h,outputBytes:m,isLastMessage:a,toolMeta:y}),e[16]=a,e[17]=n,e[18]=f,e[19]=h,e[20]=m,e[21]=y,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[23]=c,e[24]=n.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==n||e[27]!==f?(h=p.jsx(pT,{part:n,latency:f}),e[26]=n,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==n?(f=p.jsx(MT,{part:n}),e[29]=n,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[31]=c,e[32]=n.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==n||e[35]!==f?(h=p.jsx(tT,{part:n,latency:f}),e[34]=n,e[35]=f,e[36]=h):h=e[36],h}case"tool-web_search":case"tool-deep_research":{let f;e[37]!==c||e[38]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[37]=c,e[38]=n.toolCallId,e[39]=f):f=e[39];let h;e[40]!==o.webSearchStreaming||e[41]!==n.toolCallId?(h=o.webSearchStreaming.get(n.toolCallId),e[40]=o.webSearchStreaming,e[41]=n.toolCallId,e[42]=h):h=e[42];let m;return e[43]!==n||e[44]!==f||e[45]!==h?(m=p.jsx(hT,{part:n,latency:f,streamingText:h}),e[43]=n,e[44]=f,e[45]=h,e[46]=m):m=e[46],m}case"tool-subtask":{let f;e[47]!==d||e[48]!==n.toolCallId?(f=d(n.toolCallId),e[47]=d,e[48]=n.toolCallId,e[49]=f):f=e[49];let h;e[50]!==c||e[51]!==n.toolCallId?(h=c(n.toolCallId)?.annotations,e[50]=c,e[51]=n.toolCallId,e[52]=h):h=e[52];let m;e[53]!==c||e[54]!==n.toolCallId?(m=c(n.toolCallId)?.latencySeconds,e[53]=c,e[54]=n.toolCallId,e[55]=m):m=e[55];let y;e[56]!==n||e[57]!==f||e[58]!==h||e[59]!==m?(y={part:n,subtaskMeta:f,annotations:h,latency:m},e[56]=n,e[57]=f,e[58]=h,e[59]=m,e[60]=y):y=e[60];const g=y;let x;return e[61]!==g?(x=p.jsx(L.Suspense,{fallback:p.jsx(wT,{...g}),children:p.jsx(NT,{...g})}),e[61]=g,e[62]=x):x=e[62],x}case"text":{const f=!!s&&!i,h=i&&a;let m;return e[63]!==r||e[64]!==n||e[65]!==f||e[66]!==h||e[67]!==s?(m=p.jsx(gi,{id:r,part:n,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[63]=r,e[64]=n,e[65]=f,e[66]=h,e[67]=s,e[68]=m):m=e[68],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=n;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[69]!==f.toolCallId||e[70]!==c?(h=c(f.toolCallId)?.latencySeconds,e[69]=f.toolCallId,e[70]=c,e[71]=h):h=e[71];let m;return e[72]!==f||e[73]!==h?(m=p.jsx(RT,{part:f,latency:h}),e[72]=f,e[73]=h,e[74]=m):m=e[74],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(PT,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(LT,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(BT,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(WT,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(KT,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[105]!==o.toolMetadata||e[106]!==h?(m=o.toolMetadata.get(h),e[105]=o.toolMetadata,e[106]=h,e[107]=m):m=e[107];const y=m,g=y?.annotations,x=y?.latencySeconds,b=y?.outputBytes,v=y?._meta;let k;return e[108]!==f||e[109]!==a||e[110]!==g||e[111]!==x||e[112]!==b||e[113]!==v?(k=p.jsx(Gd,{part:f,annotations:g,latency:x,outputBytes:b,isLastMessage:a,toolMeta:v}),e[108]=f,e[109]=a,e[110]=g,e[111]=x,e[112]=b,e[113]=v,e[114]=k):k=e[114],k}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function k3(t){const e=_.c(9),{isRunInProgress:n}=t,r=J();if(n){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx(ri,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=i):i=e[0];let a;e[1]!==r?(a=r("chat.assistant.resumingTask"),e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==a?(l=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[i,p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:a})]})}),e[3]=a,e[4]=l):l=e[4],l}let s;e[5]!==r?(s=r("chat.assistant.noResponseGenerated"),e[5]=r,e[6]=s):s=e[6];let o;return e[7]!==s?(o=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:s}),e[7]=s,e[8]=o):o=e[8],o}function S3(t){const e=_.c(7),{className:n,children:r}=t;let s;e[0]!==n?(s=Q("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function C3(t){const e=_.c(32),{message:n,turnStartedAt:r,status:s,className:o,isLast:i}=t,a=i===void 0?!1:i,l=J(),{isRunInProgress:c}=wr()??{},u=c===void 0?!1:c,d=vs()?.taskId??null,f=s==="streaming",m=f||s==="submitted";let y;e[0]!==r?(y=bl(r),e[0]=r,e[1]=y):y=e[1];const g=y;let x;e[2]!==m?(x=()=>m?Date.now():null,e[2]=m,e[3]=x):x=e[3];const[b,v]=L.useState(x),[k,N]=L.useState(m);k!==m&&(N(m),v(m?Date.now():null));const C=g??b,{reasoningGroups:S,renderOrder:w,dataParts:M}=p3(n),T=n!==null&&w.length>0,O=n&&n.parts.length>0?n.parts[n.parts.length-1]:null,A=f&&O?.type==="reasoning";let P;if(e[4]!==n){const W=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,q=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;P=W!==null?q.getTime()-W.getTime():null,e[4]=n,e[5]=P}else P=e[5];const D=P;let E;e[6]!==a||e[7]!==n?(E=!a||!n||!n.parts.some(N3),e[6]=a,e[7]=n,e[8]=E):E=e[8];const j=E;let I;e[9]!==T||e[10]!==m||e[11]!==j||e[12]!==n||e[13]!==w?(I=!m&&T&&j&&(()=>{let W=0;for(const q of w)if(q.kind==="part"){const G=n.parts[q.index]?.type;(G==="dynamic-tool"||G?.startsWith("tool-"))&&W++}return W>=m3})(),e[9]=T,e[10]=m,e[11]=j,e[12]=n,e[13]=w,e[14]=I):I=e[14];const R=I;let z;if(e[15]!==o||e[16]!==M||e[17]!==T||e[18]!==a||e[19]!==m||e[20]!==A||e[21]!==u||e[22]!==j||e[23]!==n||e[24]!==S||e[25]!==w||e[26]!==R||e[27]!==C||e[28]!==l||e[29]!==d||e[30]!==D){const{collapsed:W,tail:q}=R?g3(w,n.parts):{collapsed:[],tail:w};z=p.jsx(S3,{className:o,children:T?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[n.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(xf,{className:"size-3 shrink-0"}),p.jsx("span",{children:l("chat.assistant.resumedBackgroundTask")})]}),W.length>0&&p.jsx(b3,{items:W,message:n,reasoningGroups:S,isReasoningActive:A,totalDuration:D,dataParts:M,isLoading:m,isLast:a}),q.map((G,te)=>{const ae=W.length+te,fe=q.findLastIndex(w3)===te;return Hg({item:G,renderIndex:ae,message:n,reasoningGroups:S,isReasoningActive:A,totalDuration:D,dataParts:M,isLoading:m,isLast:a,isLastVisiblePart:fe,renderOrder:w})}),d&&p.jsx(d3,{threadId:d,message:n}),a&&m&&C!==null&&p.jsx(kM,{startedAt:C}),a&&!m&&d&&p.jsxs(p.Fragment,{children:[p.jsx(e3,{}),j&&p.jsx(GT,{})]}),!m&&p.jsx(Ng,{message:n})]}):m?p.jsx(CM,{startedAt:C}):p.jsx(k3,{isRunInProgress:a&&u})}),e[15]=o,e[16]=M,e[17]=T,e[18]=a,e[19]=m,e[20]=A,e[21]=u,e[22]=j,e[23]=n,e[24]=S,e[25]=w,e[26]=R,e[27]=C,e[28]=l,e[29]=d,e[30]=D,e[31]=z}else z=e[31];return z}function w3(t){return t.kind==="part"}function N3(t){const e=t.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const n=t.state;return n==="input-streaming"||n==="input-available"||n==="approval-requested"}function M3(t){const e=_.c(25),{event:n}=t,r=J(),[s,o]=L.useState(!1);let i;e[0]!==n.data?(i=JSON.stringify(n.data,null,2),e[0]=n.data,e[1]=i):i=e[1];const a=i;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(T3),e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(K1,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=c):c=e[3];let u;e[4]!==r?(u=r("chat.triggerEventPart.triggeredByEvent"),e[4]=r,e[5]=u):u=e[5];let d;e[6]!==u?(d=p.jsx("span",{className:"font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let f;e[8]!==n.type?(f=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:n.type}),e[8]=n.type,e[9]=f):f=e[9];const h=s&&"rotate-180";let m;e[10]!==h?(m=Q("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",h),e[10]=h,e[11]=m):m=e[11];let y;e[12]!==m?(y=p.jsx(If,{className:m}),e[12]=m,e[13]=y):y=e[13];let g;e[14]!==d||e[15]!==f||e[16]!==y?(g=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[c,d,f,y]}),e[14]=d,e[15]=f,e[16]=y,e[17]=g):g=e[17];let x;e[18]!==n.source||e[19]!==s||e[20]!==a?(x=s&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:n.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:a})]}),e[18]=n.source,e[19]=s,e[20]=a,e[21]=x):x=e[21];let b;return e[22]!==g||e[23]!==x?(b=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[g,x]}),e[22]=g,e[23]=x,e[24]=b):b=e[24],b}function T3(t){return!t}const E3=[oM.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),KS,XS];function D3(t){const e=_.c(5),{tiptapDoc:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==n?(s={extensions:E3,content:n,editable:!1,editorProps:r},e[1]=n,e[2]=s):s=e[2];const o=LS(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(nm,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function O3(t){const e=_.c(38),{message:n,className:r,onScrollToPair:s}=t,{id:o,parts:i,metadata:a}=n,[l,c]=L.useState(!1),[u,d]=L.useState(!1),f=L.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=E=>{E&&!f.current&&(f.current=!0,d(E.scrollHeight>E.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let y;e[1]!==s?(y=()=>{c(!0),s?.()},e[1]=s,e[2]=y):y=e[2];const g=y,x=a?.tiptapDoc;let b;e[3]!==r?(b=Q("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let v,k;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=()=>c(!0),k=()=>c(!1),e[5]=v,e[6]=k):(v=e[5],k=e[6]);let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=N):N=e[7];let C;e[8]!==l||e[9]!==u?(C=Q("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",l?"max-h-[50vh] overflow-auto opacity-100":Q("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=l,e[9]=u,e[10]=C):C=e[10];let S;if(e[11]!==o||e[12]!==i){let E;e[14]!==o?(E=(j,I)=>j.type==="data-trigger-event"?p.jsx(M3,{event:j.data},`${o}-${I}`):null,e[14]=o,e[15]=E):E=e[15],S=i.map(E),e[11]=o,e[12]=i,e[13]=S}else S=e[13];let w;e[16]!==x||e[17]!==o||e[18]!==a||e[19]!==i?(w=x?p.jsx(D3,{tiptapDoc:a.tiptapDoc}):i.map((E,j)=>E.type==="text"?i[j-1]?.type==="data-trigger-event"?null:p.jsx(gi,{id:o,part:E},`${o}-${j}`):null),e[16]=x,e[17]=o,e[18]=a,e[19]=i,e[20]=w):w=e[20];let M;e[21]!==S||e[22]!==w?(M=p.jsxs("div",{className:"flex flex-col gap-2",children:[S,w]}),e[21]=S,e[22]=w,e[23]=M):M=e[23];let T;e[24]!==M||e[25]!==C?(T=p.jsx("div",{ref:m,className:C,children:M}),e[24]=M,e[25]=C,e[26]=T):T=e[26];let O;e[27]!==g||e[28]!==T?(O=p.jsxs("div",{tabIndex:0,onClick:g,onFocus:v,onBlur:k,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[N,T]}),e[27]=g,e[28]=T,e[29]=O):O=e[29];let A;e[30]!==n?(A=p.jsx(Ng,{message:n,className:"mt-1 mr-1 self-end"}),e[30]=n,e[31]=A):A=e[31];let P;e[32]!==O||e[33]!==A?(P=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[O,A]}),e[32]=O,e[33]=A,e[34]=P):P=e[34];let D;return e[35]!==P||e[36]!==b?(D=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:P})}),e[35]=P,e[36]=b,e[37]=D):D=e[37],D}function A3(t){const e=[],n=t.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<n.length;r++){const s=n[r];if(s)if(s.role==="user"){const o=n[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function I3(t){const e=_.c(19),{pair:n,isLastPair:r,status:s}=t,o=L.useRef(null),i=L.useRef(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=a):a=e[0];const l=a;let c;e[1]!==r||e[2]!==n.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=x=>{if(o.current=x,!r||!x||i.current||(i.current=!0,n.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){x.scrollIntoView({behavior:"smooth",block:"start"});return}const b=x.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:x.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=n.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!n.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=Q("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==n.user?(h=n.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(O3,{message:n.user,onScrollToPair:l})})]}),e[7]=n.user,e[8]=h):h=e[8];const m=n.user?.created_at??null;let y;e[9]!==r||e[10]!==n.assistant||e[11]!==s||e[12]!==m?(y=p.jsx(C3,{message:n.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=n.assistant,e[11]=s,e[12]=m,e[13]=y):y=e[13];let g;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==y?(g=p.jsxs("div",{ref:u,className:f,children:[h,y]}),e[14]=u,e[15]=f,e[16]=h,e[17]=y,e[18]=g):g=e[18],g}function re(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function nt(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function We(t,e){const n=re(t);return isNaN(e)?nt(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function gt(t,e){const n=re(t);if(isNaN(e))return nt(t,NaN);if(!e)return n;const r=n.getDate(),s=nt(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const o=s.getDate();return r>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const Oc=6048e5,j3=864e5;let R3={};function Os(){return R3}function At(t,e){const n=Os(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=re(t),o=s.getDay(),i=(o<r?7:0)+o-r;return s.setDate(s.getDate()-i),s.setHours(0,0,0,0),s}function qn(t){return At(t,{weekStartsOn:1})}function Wg(t){const e=re(t),n=e.getFullYear(),r=nt(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=qn(r),o=nt(t,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const i=qn(o);return e.getTime()>=s.getTime()?n+1:e.getTime()>=i.getTime()?n:n-1}function Cr(t){const e=re(t);return e.setHours(0,0,0,0),e}function ei(t){const e=re(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Tt(t,e){const n=Cr(t),r=Cr(e),s=+n-ei(n),o=+r-ei(r);return Math.round((s-o)/j3)}function P3(t){const e=Wg(t),n=nt(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),qn(n)}function cl(t,e){const n=e*7;return We(t,n)}function L3(t,e){return gt(t,e*12)}function $3(t){let e;return t.forEach(function(n){const r=re(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function _3(t){let e;return t.forEach(n=>{const r=re(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function Ge(t,e){const n=Cr(t),r=Cr(e);return+n==+r}function Ac(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function B3(t){if(!Ac(t)&&typeof t!="number")return!1;const e=re(t);return!isNaN(Number(e))}function bs(t,e){const n=re(t),r=re(e),s=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return s*12+o}function z3(t,e,n){const r=At(t,n),s=At(e,n),o=+r-ei(r),i=+s-ei(s);return Math.round((o-i)/Oc)}function Ic(t){const e=re(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Ze(t){const e=re(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Vg(t){const e=re(t),n=nt(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jc(t,e){const n=Os(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=re(t),o=s.getDay(),i=(o<r?-7:0)+6-(o-r);return s.setDate(s.getDate()+i),s.setHours(23,59,59,999),s}function Ug(t){return jc(t,{weekStartsOn:1})}const F3={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},H3=(t,e,n)=>{let r;const s=F3[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function oa(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const W3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},V3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},U3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},q3={date:oa({formats:W3,defaultWidth:"full"}),time:oa({formats:V3,defaultWidth:"full"}),dateTime:oa({formats:U3,defaultWidth:"full"})},K3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},J3=(t,e,n,r)=>K3[t];function Rr(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):i;s=t.formattingValues[a]||t.formattingValues[i]}else{const i=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;s=t.values[a]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(e):e;return s[o]}}const Y3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},G3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},X3={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Q3={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Z3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},eE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tE=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},nE={ordinalNumber:tE,era:Rr({values:Y3,defaultWidth:"wide"}),quarter:Rr({values:G3,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Rr({values:X3,defaultWidth:"wide"}),day:Rr({values:Q3,defaultWidth:"wide"}),dayPeriod:Rr({values:Z3,defaultWidth:"wide",formattingValues:eE,defaultFormattingWidth:"wide"})};function Pr(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(s);if(!o)return null;const i=o[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?sE(a,d=>d.test(i)):rE(a,d=>d.test(i));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(i.length);return{value:c,rest:u}}}function rE(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function sE(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function oE(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],o=e.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const a=e.slice(s.length);return{value:i,rest:a}}}const iE=/^(\d+)(th|st|nd|rd)?/i,aE=/\d+/i,lE={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},cE={any:[/^b/i,/^(a|c)/i]},uE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},dE={any:[/1/i,/2/i,/3/i,/4/i]},fE={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},hE={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pE={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},mE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},gE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},yE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xE={ordinalNumber:oE({matchPattern:iE,parsePattern:aE,valueCallback:t=>parseInt(t,10)}),era:Pr({matchPatterns:lE,defaultMatchWidth:"wide",parsePatterns:cE,defaultParseWidth:"any"}),quarter:Pr({matchPatterns:uE,defaultMatchWidth:"wide",parsePatterns:dE,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Pr({matchPatterns:fE,defaultMatchWidth:"wide",parsePatterns:hE,defaultParseWidth:"any"}),day:Pr({matchPatterns:pE,defaultMatchWidth:"wide",parsePatterns:mE,defaultParseWidth:"any"}),dayPeriod:Pr({matchPatterns:gE,defaultMatchWidth:"any",parsePatterns:yE,defaultParseWidth:"any"})},qg={code:"en-US",formatDistance:H3,formatLong:q3,formatRelative:J3,localize:nE,match:xE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function bE(t){const e=re(t);return Tt(e,Vg(e))+1}function Kg(t){const e=re(t),n=+qn(e)-+P3(e);return Math.round(n/Oc)+1}function Jg(t,e){const n=re(t),r=n.getFullYear(),s=Os(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=nt(t,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const a=At(i,e),l=nt(t,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=At(l,e);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function vE(t,e){const n=Os(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Jg(t,e),o=nt(t,0);return o.setFullYear(s,0,r),o.setHours(0,0,0,0),At(o,e)}function Yg(t,e){const n=re(t),r=+At(n,e)-+vE(n,e);return Math.round(r/Oc)+1}function ie(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Xt={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return ie(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):ie(n+1,2)},d(t,e){return ie(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return ie(t.getHours()%12||12,e.length)},H(t,e){return ie(t.getHours(),e.length)},m(t,e){return ie(t.getMinutes(),e.length)},s(t,e){return ie(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return ie(s,e.length)}},rr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},tf={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Xt.y(t,e)},Y:function(t,e,n,r){const s=Jg(t,r),o=s>0?s:1-s;if(e==="YY"){const i=o%100;return ie(i,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):ie(o,e.length)},R:function(t,e){const n=Wg(t);return ie(n,e.length)},u:function(t,e){const n=t.getFullYear();return ie(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return ie(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return ie(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Xt.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return ie(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=Yg(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):ie(s,e.length)},I:function(t,e,n){const r=Kg(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):ie(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Xt.d(t,e)},D:function(t,e,n){const r=bE(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ie(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return ie(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return ie(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return ie(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=rr.noon:r===0?s=rr.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=rr.evening:r>=12?s=rr.afternoon:r>=4?s=rr.morning:s=rr.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Xt.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Xt.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ie(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):ie(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Xt.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Xt.s(t,e)},S:function(t,e){return Xt.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return rf(r);case"XXXX":case"XX":return vn(r);default:return vn(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return rf(r);case"xxxx":case"xx":return vn(r);default:return vn(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+nf(r,":");default:return"GMT"+vn(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+nf(r,":");default:return"GMT"+vn(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return ie(r,e.length)},T:function(t,e,n){const r=t.getTime();return ie(r,e.length)}};function nf(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),o=r%60;return o===0?n+String(s):n+String(s)+e+ie(o,2)}function rf(t,e){return t%60===0?(t>0?"-":"+")+ie(Math.abs(t)/60,2):vn(t,e)}function vn(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=ie(Math.trunc(r/60),2),o=ie(r%60,2);return n+s+e+o}const sf=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Gg=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},kE=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return sf(t,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",sf(r,e)).replace("{{time}}",Gg(s,e))},SE={p:Gg,P:kE},CE=/^D+$/,wE=/^Y+$/,NE=["D","DD","YY","YYYY"];function ME(t){return CE.test(t)}function TE(t){return wE.test(t)}function EE(t,e,n){const r=DE(t,e,n);if(console.warn(r),NE.includes(t))throw new RangeError(r)}function DE(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const OE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,IE=/^'([^]*?)'?$/,jE=/''/g,RE=/[a-zA-Z]/;function Qn(t,e,n){const r=Os(),s=n?.locale??r.locale??qg,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=re(t);if(!B3(a))throw new RangeError("Invalid time value");let l=e.match(AE).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=SE[d];return f(u,s.formatLong)}return u}).join("").match(OE).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:PE(u)};if(tf[d])return{isToken:!0,value:u};if(d.match(RE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:s};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&TE(d)||!n?.useAdditionalDayOfYearTokens&&ME(d))&&EE(d,e,String(t));const f=tf[d[0]];return f(a,d,s.localize,c)}).join("")}function PE(t){const e=t.match(IE);return e?e[1].replace(jE,"'"):t}function LE(t){const e=re(t),n=e.getFullYear(),r=e.getMonth(),s=nt(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function $E(t){return Math.trunc(+re(t)/1e3)}function _E(t){const e=re(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function BE(t,e){return z3(_E(t),Ze(t),e)+1}function ul(t,e){const n=re(t),r=re(e);return n.getTime()>r.getTime()}function Xg(t,e){const n=re(t),r=re(e);return+n<+r}function Rc(t,e){const n=re(t),r=re(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function zE(t,e){const n=re(t),r=re(e);return n.getFullYear()===r.getFullYear()}function ia(t,e){return We(t,-e)}function aa(t,e){const n=re(t),r=n.getFullYear(),s=n.getDate(),o=nt(t,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const i=LE(o);return n.setMonth(e,Math.min(s,i)),n}function of(t,e){const n=re(t);return isNaN(+n)?nt(t,NaN):(n.setFullYear(e),n)}var K=function(){return K=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},K.apply(this,arguments)};function FE(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Qg(t,e,n){for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function As(t){return t.mode==="multiple"}function Is(t){return t.mode==="range"}function wi(t){return t.mode==="single"}var HE={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function WE(t,e){return Qn(t,"LLLL y",e)}function VE(t,e){return Qn(t,"d",e)}function UE(t,e){return Qn(t,"LLLL",e)}function qE(t){return"".concat(t)}function KE(t,e){return Qn(t,"cccccc",e)}function JE(t,e){return Qn(t,"yyyy",e)}var YE=Object.freeze({__proto__:null,formatCaption:WE,formatDay:VE,formatMonthCaption:UE,formatWeekNumber:qE,formatWeekdayName:KE,formatYearCaption:JE}),GE=function(t,e,n){return Qn(t,"do MMMM (EEEE)",n)},XE=function(){return"Month: "},QE=function(){return"Go to next month"},ZE=function(){return"Go to previous month"},e4=function(t,e){return Qn(t,"cccc",e)},t4=function(t){return"Week n. ".concat(t)},n4=function(){return"Year: "},r4=Object.freeze({__proto__:null,labelDay:GE,labelMonthDropdown:XE,labelNext:QE,labelPrevious:ZE,labelWeekNumber:t4,labelWeekday:e4,labelYearDropdown:n4});function s4(){var t="buttons",e=HE,n=qg,r={},s={},o=1,i={},a=new Date;return{captionLayout:t,classNames:e,formatters:YE,labels:r4,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:o,styles:i,today:a,mode:"default"}}function o4(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,o=t.fromDate,i=t.toDate;return r?o=Ze(r):e&&(o=new Date(e,0,1)),s?i=Ic(s):n&&(i=new Date(n,11,31)),{fromDate:o?Cr(o):void 0,toDate:i?Cr(i):void 0}}var Zg=L.createContext(void 0);function i4(t){var e,n=t.initialProps,r=s4(),s=o4(n),o=s.fromDate,i=s.toDate,a=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!o||!i)&&(a="buttons");var l;(wi(n)||As(n)||Is(n))&&(l=n.onSelect);var c=K(K(K({},r),n),{captionLayout:a,classNames:K(K({},r.classNames),n.classNames),components:K({},n.components),formatters:K(K({},r.formatters),n.formatters),fromDate:o,labels:K(K({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:K(K({},r.modifiers),n.modifiers),modifiersClassNames:K(K({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:K(K({},r.styles),n.styles),toDate:i});return p.jsx(Zg.Provider,{value:c,children:t.children})}function de(){var t=L.useContext(Zg);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function e1(t){var e=de(),n=e.locale,r=e.classNames,s=e.styles,o=e.formatters.formatCaption;return p.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:o(t.displayMonth,{locale:n})})}function a4(t){return p.jsx("svg",K({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:p.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function t1(t){var e,n,r=t.onChange,s=t.value,o=t.children,i=t.caption,a=t.className,l=t.style,c=de(),u=(n=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:a4;return p.jsxs("div",{className:a,style:l,children:[p.jsx("span",{className:c.classNames.vhidden,children:t["aria-label"]}),p.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:s,onChange:r,children:o}),p.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[i,p.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function l4(t){var e,n=de(),r=n.fromDate,s=n.toDate,o=n.styles,i=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return p.jsx(p.Fragment,{});if(!s)return p.jsx(p.Fragment,{});var d=[];if(zE(r,s))for(var f=Ze(r),h=r.getMonth();h<=s.getMonth();h++)d.push(aa(f,h));else for(var f=Ze(new Date),h=0;h<=11;h++)d.push(aa(f,h));var m=function(g){var x=Number(g.target.value),b=aa(Ze(t.displayMonth),x);t.onChange(b)},y=(e=c?.Dropdown)!==null&&e!==void 0?e:t1;return p.jsx(y,{name:"months","aria-label":u(),className:l.dropdown_month,style:o.dropdown_month,onChange:m,value:t.displayMonth.getMonth(),caption:a(t.displayMonth,{locale:i}),children:d.map(function(g){return p.jsx("option",{value:g.getMonth(),children:a(g,{locale:i})},g.getMonth())})})}function c4(t){var e,n=t.displayMonth,r=de(),s=r.fromDate,o=r.toDate,i=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!s)return p.jsx(p.Fragment,{});if(!o)return p.jsx(p.Fragment,{});for(var h=s.getFullYear(),m=o.getFullYear(),y=h;y<=m;y++)f.push(of(Vg(new Date),y));var g=function(b){var v=of(Ze(n),Number(b.target.value));t.onChange(v)},x=(e=c?.Dropdown)!==null&&e!==void 0?e:t1;return p.jsx(x,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:g,value:n.getFullYear(),caption:u(n,{locale:i}),children:f.map(function(b){return p.jsx("option",{value:b.getFullYear(),children:u(b,{locale:i})},b.getFullYear())})})}function u4(t,e){var n=L.useState(t),r=n[0],s=n[1],o=e===void 0?r:e;return[o,s]}function d4(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,o=t.toDate,i=t.fromDate,a=t.numberOfMonths,l=a===void 0?1:a;if(o&&bs(o,s)<0){var c=-1*(l-1);s=gt(o,c)}return i&&bs(s,i)<0&&(s=i),Ze(s)}function f4(){var t=de(),e=d4(t),n=u4(e,t.month),r=n[0],s=n[1],o=function(i){var a;if(!t.disableNavigation){var l=Ze(i);s(l),(a=t.onMonthChange)===null||a===void 0||a.call(t,l)}};return[r,o]}function h4(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=Ze(t),o=Ze(gt(s,r)),i=bs(o,s),a=[],l=0;l<i;l++){var c=gt(s,l);a.push(c)}return n&&(a=a.reverse()),a}function p4(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,o=s===void 0?1:s,i=r?o:1,a=Ze(t);if(!n)return gt(a,i);var l=bs(n,t);if(!(l<o))return gt(a,i)}}function m4(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,o=s===void 0?1:s,i=r?o:1,a=Ze(t);if(!n)return gt(a,-i);var l=bs(a,n);if(!(l<=0))return gt(a,-i)}}var n1=L.createContext(void 0);function g4(t){var e=de(),n=f4(),r=n[0],s=n[1],o=h4(r,e),i=p4(r,e),a=m4(r,e),l=function(d){return o.some(function(f){return Rc(d,f)})},c=function(d,f){l(d)||(f&&Xg(d,f)?s(gt(d,1+e.numberOfMonths*-1)):s(d))},u={currentMonth:r,displayMonths:o,goToMonth:s,goToDate:c,previousMonth:a,nextMonth:i,isDateDisplayed:l};return p.jsx(n1.Provider,{value:u,children:t.children})}function js(){var t=L.useContext(n1);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function af(t){var e,n=de(),r=n.classNames,s=n.styles,o=n.components,i=js().goToMonth,a=function(u){i(gt(u,t.displayIndex?-t.displayIndex:0))},l=(e=o?.CaptionLabel)!==null&&e!==void 0?e:e1,c=p.jsx(l,{id:t.id,displayMonth:t.displayMonth});return p.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[p.jsx("div",{className:r.vhidden,children:c}),p.jsx(l4,{onChange:a,displayMonth:t.displayMonth}),p.jsx(c4,{onChange:a,displayMonth:t.displayMonth})]})}function y4(t){return p.jsx("svg",K({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:p.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function x4(t){return p.jsx("svg",K({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:p.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var ti=L.forwardRef(function(t,e){var n=de(),r=n.classNames,s=n.styles,o=[r.button_reset,r.button];t.className&&o.push(t.className);var i=o.join(" "),a=K(K({},s.button_reset),s.button);return t.style&&Object.assign(a,t.style),p.jsx("button",K({},t,{ref:e,type:"button",className:i,style:a}))});function b4(t){var e,n,r=de(),s=r.dir,o=r.locale,i=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!t.nextMonth&&!t.previousMonth)return p.jsx(p.Fragment,{});var f=c(t.previousMonth,{locale:o}),h=[i.nav_button,i.nav_button_previous].join(" "),m=u(t.nextMonth,{locale:o}),y=[i.nav_button,i.nav_button_next].join(" "),g=(e=d?.IconRight)!==null&&e!==void 0?e:x4,x=(n=d?.IconLeft)!==null&&n!==void 0?n:y4;return p.jsxs("div",{className:i.nav,style:a.nav,children:[!t.hidePrevious&&p.jsx(ti,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?p.jsx(g,{className:i.nav_icon,style:a.nav_icon}):p.jsx(x,{className:i.nav_icon,style:a.nav_icon})}),!t.hideNext&&p.jsx(ti,{name:"next-month","aria-label":m,className:y,style:a.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?p.jsx(x,{className:i.nav_icon,style:a.nav_icon}):p.jsx(g,{className:i.nav_icon,style:a.nav_icon})})]})}function lf(t){var e=de().numberOfMonths,n=js(),r=n.previousMonth,s=n.nextMonth,o=n.goToMonth,i=n.displayMonths,a=i.findIndex(function(m){return Rc(t.displayMonth,m)}),l=a===0,c=a===i.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){r&&o(r)},h=function(){s&&o(s)};return p.jsx(b4,{displayMonth:t.displayMonth,hideNext:u,hidePrevious:d,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:h})}function v4(t){var e,n=de(),r=n.classNames,s=n.disableNavigation,o=n.styles,i=n.captionLayout,a=n.components,l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:e1,c;return s?c=p.jsx(l,{id:t.id,displayMonth:t.displayMonth}):i==="dropdown"?c=p.jsx(af,{displayMonth:t.displayMonth,id:t.id}):i==="dropdown-buttons"?c=p.jsxs(p.Fragment,{children:[p.jsx(af,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),p.jsx(lf,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):c=p.jsxs(p.Fragment,{children:[p.jsx(l,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),p.jsx(lf,{displayMonth:t.displayMonth,id:t.id})]}),p.jsx("div",{className:r.caption,style:o.caption,children:c})}function k4(t){var e=de(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?p.jsx("tfoot",{className:s,style:r.tfoot,children:p.jsx("tr",{children:p.jsx("td",{colSpan:8,children:n})})}):p.jsx(p.Fragment,{})}function S4(t,e,n){for(var r=n?qn(new Date):At(new Date,{locale:t,weekStartsOn:e}),s=[],o=0;o<7;o++){var i=We(r,o);s.push(i)}return s}function C4(){var t=de(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,o=t.weekStartsOn,i=t.ISOWeek,a=t.formatters.formatWeekdayName,l=t.labels.labelWeekday,c=S4(s,o,i);return p.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&p.jsx("td",{style:n.head_cell,className:e.head_cell}),c.map(function(u,d){return p.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":l(u,{locale:s}),children:a(u,{locale:s})},d)})]})}function w4(){var t,e=de(),n=e.classNames,r=e.styles,s=e.components,o=(t=s?.HeadRow)!==null&&t!==void 0?t:C4;return p.jsx("thead",{style:r.head,className:n.head,children:p.jsx(o,{})})}function N4(t){var e=de(),n=e.locale,r=e.formatters.formatDay;return p.jsx(p.Fragment,{children:r(t.date,{locale:n})})}var Pc=L.createContext(void 0);function M4(t){if(!As(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return p.jsx(Pc.Provider,{value:e,children:t.children})}return p.jsx(T4,{initialProps:t.initialProps,children:t.children})}function T4(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,o=e.max,i=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var m=!!(u.selected&&s&&r?.length===s);if(!m){var y=!!(!u.selected&&o&&r?.length===o);if(!y){var g=r?Qg([],r):[];if(u.selected){var x=g.findIndex(function(b){return Ge(c,b)});g.splice(x,1)}else g.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,g,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=o&&r.length>o-1,d=r.some(function(f){return Ge(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:i,modifiers:a};return p.jsx(Pc.Provider,{value:l,children:n})}function Lc(){var t=L.useContext(Pc);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function E4(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?Ge(s,t)&&Ge(r,t)?void 0:Ge(s,t)?{from:s,to:void 0}:Ge(r,t)?void 0:ul(r,t)?{from:t,to:s}:{from:r,to:t}:s?ul(t,s)?{from:s,to:t}:{from:t,to:s}:r?Xg(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var $c=L.createContext(void 0);function D4(t){if(!Is(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return p.jsx($c.Provider,{value:e,children:t.children})}return p.jsx(O4,{initialProps:t.initialProps,children:t.children})}function O4(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},o=s.from,i=s.to,a=e.min,l=e.max,c=function(h,m,y){var g,x;(g=e.onDayClick)===null||g===void 0||g.call(e,h,m,y);var b=E4(h,r);(x=e.onSelect)===null||x===void 0||x.call(e,b,h,m,y)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],i?(u.range_end=[i],Ge(o,i)||(u.range_middle=[{after:o,before:i}])):u.range_end=[o]):i&&(u.range_start=[i],u.range_end=[i]),a&&(o&&!i&&u.disabled.push({after:ia(o,a-1),before:We(o,a-1)}),o&&i&&u.disabled.push({after:o,before:We(o,a-1)}),!o&&i&&u.disabled.push({after:ia(i,a-1),before:We(i,a-1)})),l){if(o&&!i&&(u.disabled.push({before:We(o,-l+1)}),u.disabled.push({after:We(o,l-1)})),o&&i){var d=Tt(i,o)+1,f=l-d;u.disabled.push({before:ia(o,f)}),u.disabled.push({after:We(i,f)})}!o&&i&&(u.disabled.push({before:We(i,-l+1)}),u.disabled.push({after:We(i,l-1)}))}return p.jsx($c.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function _c(){var t=L.useContext($c);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function so(t){return Array.isArray(t)?Qg([],t):t!==void 0?[t]:[]}function A4(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=so(s)}),e}var yt;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(yt||(yt={}));var I4=yt.Selected,$t=yt.Disabled,j4=yt.Hidden,R4=yt.Today,la=yt.RangeEnd,ca=yt.RangeMiddle,ua=yt.RangeStart,P4=yt.Outside;function L4(t,e,n){var r,s=(r={},r[I4]=so(t.selected),r[$t]=so(t.disabled),r[j4]=so(t.hidden),r[R4]=[t.today],r[la]=[],r[ca]=[],r[ua]=[],r[P4]=[],r);return t.fromDate&&s[$t].push({before:t.fromDate}),t.toDate&&s[$t].push({after:t.toDate}),As(t)?s[$t]=s[$t].concat(e.modifiers[$t]):Is(t)&&(s[$t]=s[$t].concat(n.modifiers[$t]),s[ua]=n.modifiers[ua],s[ca]=n.modifiers[ca],s[la]=n.modifiers[la]),s}var r1=L.createContext(void 0);function $4(t){var e=de(),n=Lc(),r=_c(),s=L4(e,n,r),o=A4(e.modifiers),i=K(K({},s),o);return p.jsx(r1.Provider,{value:i,children:t.children})}function s1(){var t=L.useContext(r1);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function _4(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function B4(t){return!!(t&&typeof t=="object"&&"from"in t)}function z4(t){return!!(t&&typeof t=="object"&&"after"in t)}function F4(t){return!!(t&&typeof t=="object"&&"before"in t)}function H4(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function W4(t,e){var n,r=e.from,s=e.to;if(r&&s){var o=Tt(s,r)<0;o&&(n=[s,r],r=n[0],s=n[1]);var i=Tt(t,r)>=0&&Tt(s,t)>=0;return i}return s?Ge(s,t):r?Ge(r,t):!1}function V4(t){return Ac(t)}function U4(t){return Array.isArray(t)&&t.every(Ac)}function q4(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(V4(n))return Ge(t,n);if(U4(n))return n.includes(t);if(B4(n))return W4(t,n);if(H4(n))return n.dayOfWeek.includes(t.getDay());if(_4(n)){var r=Tt(n.before,t),s=Tt(n.after,t),o=r>0,i=s<0,a=ul(n.before,n.after);return a?i&&o:o||i}return z4(n)?Tt(t,n.after)>0:F4(n)?Tt(n.before,t)>0:typeof n=="function"?n(t):!1})}function Bc(t,e,n){var r=Object.keys(e).reduce(function(o,i){var a=e[i];return q4(t,a)&&o.push(i),o},[]),s={};return r.forEach(function(o){return s[o]=!0}),n&&!Rc(t,n)&&(s.outside=!0),s}function K4(t,e){for(var n=Ze(t[0]),r=Ic(t[t.length-1]),s,o,i=n;i<=r;){var a=Bc(i,e),l=!a.disabled&&!a.hidden;if(!l){i=We(i,1);continue}if(a.selected)return i;a.today&&!o&&(o=i),s||(s=i),i=We(i,1)}return o||s}var J4=365;function o1(t,e){var n=e.moveBy,r=e.direction,s=e.context,o=e.modifiers,i=e.retry,a=i===void 0?{count:0,lastFocused:t}:i,l=s.weekStartsOn,c=s.fromDate,u=s.toDate,d=s.locale,f={day:We,week:cl,month:gt,year:L3,startOfWeek:function(g){return s.ISOWeek?qn(g):At(g,{locale:d,weekStartsOn:l})},endOfWeek:function(g){return s.ISOWeek?Ug(g):jc(g,{locale:d,weekStartsOn:l})}},h=f[n](t,r==="after"?1:-1);r==="before"&&c?h=$3([c,h]):r==="after"&&u&&(h=_3([u,h]));var m=!0;if(o){var y=Bc(h,o);m=!y.disabled&&!y.hidden}return m?h:a.count>J4?a.lastFocused:o1(h,{moveBy:n,direction:r,context:s,modifiers:o,retry:K(K({},a),{count:a.count+1})})}var i1=L.createContext(void 0);function Y4(t){var e=js(),n=s1(),r=L.useState(),s=r[0],o=r[1],i=L.useState(),a=i[0],l=i[1],c=K4(e.displayMonths,n),u=s??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(s),o(void 0)},f=function(g){o(g)},h=de(),m=function(g,x){if(s){var b=o1(s,{moveBy:g,direction:x,context:h,modifiers:n});Ge(s,b)||(e.goToDate(b,s),f(b))}},y={focusedDay:s,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return p.jsx(i1.Provider,{value:y,children:t.children})}function zc(){var t=L.useContext(i1);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function G4(t,e){var n=s1(),r=Bc(t,n,e);return r}var Fc=L.createContext(void 0);function X4(t){if(!wi(t.initialProps)){var e={selected:void 0};return p.jsx(Fc.Provider,{value:e,children:t.children})}return p.jsx(Q4,{initialProps:t.initialProps,children:t.children})}function Q4(t){var e=t.initialProps,n=t.children,r=function(o,i,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,o,i,a),i.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,o,i,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,o,o,i,a)},s={selected:e.selected,onDayClick:r};return p.jsx(Fc.Provider,{value:s,children:n})}function a1(){var t=L.useContext(Fc);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Z4(t,e){var n=de(),r=a1(),s=Lc(),o=_c(),i=zc(),a=i.focusDayAfter,l=i.focusDayBefore,c=i.focusWeekAfter,u=i.focusWeekBefore,d=i.blur,f=i.focus,h=i.focusMonthBefore,m=i.focusMonthAfter,y=i.focusYearBefore,g=i.focusYearAfter,x=i.focusStartOfWeek,b=i.focusEndOfWeek,v=function(I){var R,z,W,q;wi(n)?(R=r.onDayClick)===null||R===void 0||R.call(r,t,e,I):As(n)?(z=s.onDayClick)===null||z===void 0||z.call(s,t,e,I):Is(n)?(W=o.onDayClick)===null||W===void 0||W.call(o,t,e,I):(q=n.onDayClick)===null||q===void 0||q.call(n,t,e,I)},k=function(I){var R;f(t),(R=n.onDayFocus)===null||R===void 0||R.call(n,t,e,I)},N=function(I){var R;d(),(R=n.onDayBlur)===null||R===void 0||R.call(n,t,e,I)},C=function(I){var R;(R=n.onDayMouseEnter)===null||R===void 0||R.call(n,t,e,I)},S=function(I){var R;(R=n.onDayMouseLeave)===null||R===void 0||R.call(n,t,e,I)},w=function(I){var R;(R=n.onDayPointerEnter)===null||R===void 0||R.call(n,t,e,I)},M=function(I){var R;(R=n.onDayPointerLeave)===null||R===void 0||R.call(n,t,e,I)},T=function(I){var R;(R=n.onDayTouchCancel)===null||R===void 0||R.call(n,t,e,I)},O=function(I){var R;(R=n.onDayTouchEnd)===null||R===void 0||R.call(n,t,e,I)},A=function(I){var R;(R=n.onDayTouchMove)===null||R===void 0||R.call(n,t,e,I)},P=function(I){var R;(R=n.onDayTouchStart)===null||R===void 0||R.call(n,t,e,I)},D=function(I){var R;(R=n.onDayKeyUp)===null||R===void 0||R.call(n,t,e,I)},E=function(I){var R;switch(I.key){case"ArrowLeft":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":I.preventDefault(),I.stopPropagation(),c();break;case"ArrowUp":I.preventDefault(),I.stopPropagation(),u();break;case"PageUp":I.preventDefault(),I.stopPropagation(),I.shiftKey?y():h();break;case"PageDown":I.preventDefault(),I.stopPropagation(),I.shiftKey?g():m();break;case"Home":I.preventDefault(),I.stopPropagation(),x();break;case"End":I.preventDefault(),I.stopPropagation(),b();break}(R=n.onDayKeyDown)===null||R===void 0||R.call(n,t,e,I)},j={onClick:v,onFocus:k,onBlur:N,onKeyDown:E,onKeyUp:D,onMouseEnter:C,onMouseLeave:S,onPointerEnter:w,onPointerLeave:M,onTouchCancel:T,onTouchEnd:O,onTouchMove:A,onTouchStart:P};return j}function eD(){var t=de(),e=a1(),n=Lc(),r=_c(),s=wi(t)?e.selected:As(t)?n.selected:Is(t)?r.selected:void 0;return s}function tD(t){return Object.values(yt).includes(t)}function nD(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(tD(r)){var o=t.classNames["day_".concat(r)];o&&n.push(o)}}),n}function rD(t,e){var n=K({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=K(K({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function sD(t,e,n){var r,s,o,i=de(),a=zc(),l=G4(t,e),c=Z4(t,l),u=eD(),d=!!(i.onDayClick||i.mode!=="default");L.useEffect(function(){var C;l.outside||a.focusedDay&&d&&Ge(a.focusedDay,t)&&((C=n.current)===null||C===void 0||C.focus())},[a.focusedDay,t,n,d,l.outside]);var f=nD(i,l).join(" "),h=rD(i,l),m=!!(l.outside&&!i.showOutsideDays||l.hidden),y=(o=(s=i.components)===null||s===void 0?void 0:s.DayContent)!==null&&o!==void 0?o:N4,g=p.jsx(y,{date:t,displayMonth:e,activeModifiers:l}),x={style:h,className:f,children:g,role:"gridcell"},b=a.focusTarget&&Ge(a.focusTarget,t)&&!l.outside,v=a.focusedDay&&Ge(a.focusedDay,t),k=K(K(K({},x),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=v||b?0:-1,r)),c),N={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:k,divProps:x};return N}function oD(t){var e=L.useRef(null),n=sD(t.date,t.displayMonth,e);return n.isHidden?p.jsx("div",{role:"gridcell"}):n.isButton?p.jsx(ti,K({name:"day",ref:e},n.buttonProps)):p.jsx("div",K({},n.divProps))}function iD(t){var e=t.number,n=t.dates,r=de(),s=r.onWeekNumberClick,o=r.styles,i=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!s)return p.jsx("span",{className:i.weeknumber,style:o.weeknumber,children:u});var d=l(Number(e),{locale:a}),f=function(h){s(e,n,h)};return p.jsx(ti,{name:"week-number","aria-label":d,className:i.weeknumber,style:o.weeknumber,onClick:f,children:u})}function aD(t){var e,n,r=de(),s=r.styles,o=r.classNames,i=r.showWeekNumber,a=r.components,l=(e=a?.Day)!==null&&e!==void 0?e:oD,c=(n=a?.WeekNumber)!==null&&n!==void 0?n:iD,u;return i&&(u=p.jsx("td",{className:o.cell,style:s.cell,children:p.jsx(c,{number:t.weekNumber,dates:t.dates})})),p.jsxs("tr",{className:o.row,style:s.row,children:[u,t.dates.map(function(d){return p.jsx("td",{className:o.cell,style:s.cell,role:"presentation",children:p.jsx(l,{displayMonth:t.displayMonth,date:d})},$E(d))})]})}function cf(t,e,n){for(var r=n?.ISOWeek?Ug(e):jc(e,n),s=n?.ISOWeek?qn(t):At(t,n),o=Tt(r,s),i=[],a=0;a<=o;a++)i.push(We(s,a));var l=i.reduce(function(c,u){var d=n?.ISOWeek?Kg(u):Yg(u,n),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function lD(t,e){var n=cf(Ze(t),Ic(t),e);if(e?.useFixedWeeks){var r=BE(t,e);if(r<6){var s=n[n.length-1],o=s.dates[s.dates.length-1],i=cl(o,6-r),a=cf(cl(o,1),i,e);n.push.apply(n,a)}}return n}function cD(t){var e,n,r,s=de(),o=s.locale,i=s.classNames,a=s.styles,l=s.hideHead,c=s.fixedWeeks,u=s.components,d=s.weekStartsOn,f=s.firstWeekContainsDate,h=s.ISOWeek,m=lD(t.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:o,weekStartsOn:d,firstWeekContainsDate:f}),y=(e=u?.Head)!==null&&e!==void 0?e:w4,g=(n=u?.Row)!==null&&n!==void 0?n:aD,x=(r=u?.Footer)!==null&&r!==void 0?r:k4;return p.jsxs("table",{id:t.id,className:i.table,style:a.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!l&&p.jsx(y,{}),p.jsx("tbody",{className:i.tbody,style:a.tbody,children:m.map(function(b){return p.jsx(g,{displayMonth:t.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),p.jsx(x,{displayMonth:t.displayMonth})]})}function uD(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var dD=uD()?L.useLayoutEffect:L.useEffect,da=!1,fD=0;function uf(){return"react-day-picker-".concat(++fD)}function hD(t){var e,n=t??(da?uf():null),r=L.useState(n),s=r[0],o=r[1];return dD(function(){s===null&&o(uf())},[]),L.useEffect(function(){da===!1&&(da=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function pD(t){var e,n,r=de(),s=r.dir,o=r.classNames,i=r.styles,a=r.components,l=js().displayMonths,c=hD(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,d=[o.month],f=i.month,h=t.displayIndex===0,m=t.displayIndex===l.length-1,y=!h&&!m;s==="rtl"&&(e=[h,m],m=e[0],h=e[1]),h&&(d.push(o.caption_start),f=K(K({},f),i.caption_start)),m&&(d.push(o.caption_end),f=K(K({},f),i.caption_end)),y&&(d.push(o.caption_between),f=K(K({},f),i.caption_between));var g=(n=a?.Caption)!==null&&n!==void 0?n:v4;return p.jsxs("div",{className:d.join(" "),style:f,children:[p.jsx(g,{id:c,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),p.jsx(cD,{id:u,"aria-labelledby":c,displayMonth:t.displayMonth})]},t.displayIndex)}function mD(t){var e=de(),n=e.classNames,r=e.styles;return p.jsx("div",{className:n.months,style:r.months,children:t.children})}function gD(t){var e,n,r=t.initialProps,s=de(),o=zc(),i=js(),a=L.useState(!1),l=a[0],c=a[1];L.useEffect(function(){s.initialFocus&&o.focusTarget&&(l||(o.focus(o.focusTarget),c(!0)))},[s.initialFocus,l,o.focus,o.focusTarget,o]);var u=[s.classNames.root,s.className];s.numberOfMonths>1&&u.push(s.classNames.multiple_months),s.showWeekNumber&&u.push(s.classNames.with_weeknumber);var d=K(K({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,y){var g;return K(K({},m),(g={},g[y]=r[y],g))},{}),h=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:mD;return p.jsx("div",K({className:u.join(" "),style:d,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:p.jsx(h,{children:i.displayMonths.map(function(m,y){return p.jsx(pD,{displayIndex:y,displayMonth:m},y)})})}))}function yD(t){var e=t.children,n=FE(t,["children"]);return p.jsx(i4,{initialProps:n,children:p.jsx(g4,{children:p.jsx(X4,{initialProps:n,children:p.jsx(M4,{initialProps:n,children:p.jsx(D4,{initialProps:n,children:p.jsx($4,{children:p.jsx(Y4,{children:e})})})})})})})}function xD(t){return p.jsx(yD,K({},t,{children:p.jsx(gD,{initialProps:t})}))}function gA(t){const e=_.c(20);let n,r,s,o;e[0]!==t?({className:n,classNames:r,showOutsideDays:o,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=o):(n=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!0:o;let a;e[5]!==n?(a=Q("p-3",n),e[5]=n,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=Q(qc({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),e[7]=l):l=e[7];const c=s.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md";let u;e[8]!==c?(u=Q("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",c),e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=Q(qc({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),e[10]=d):d=e[10];let f;e[11]!==r||e[12]!==u?(f={months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:l,nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:u,day:d,day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...r},e[11]=r,e[12]=u,e[13]=f):f=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h={IconLeft:vD,IconRight:bD},e[14]=h):h=e[14];let m;return e[15]!==s||e[16]!==i||e[17]!==a||e[18]!==f?(m=p.jsx(xD,{showOutsideDays:i,className:a,classNames:f,components:h,...s}),e[15]=s,e[16]=i,e[17]=a,e[18]=f,e[19]=m):m=e[19],m}function bD(t){const{className:e,...n}=t;return p.jsx(ma,{className:Q("size-4",e),...n})}function vD(t){const{className:e,...n}=t;return p.jsx(J1,{className:Q("size-4",e),...n})}const l1={requires_action:{labelKey:"common.taskStatus.requiresAction",icon:yl,iconClassName:"text-warning",labelColor:"text-warning"},failed:{labelKey:"common.taskStatus.failed",icon:c0,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{labelKey:"common.taskStatus.expired",icon:G1,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{labelKey:"common.taskStatus.inProgress",icon:Y1,iconClassName:"text-primary",labelColor:"text-primary"},completed:{labelKey:"common.taskStatus.completed",icon:a0,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},df={labelKey:"common.taskStatus.unknown",icon:l0,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function kD(t){return t in l1}function c1(t){if(t===null)return df;const e=t??"completed";return kD(e)?l1[e]:df}const oo=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],SD=40;function yA(t){const n=(t.endDate.getTime()-t.startDate.getTime())/SD;return oo.find(s=>s.ms>=n)?.label??oo[oo.length-1].label}function Hc(t){const e=oo.find(o=>o.label===t);if(e)return e.ms;const n=/^(\d+)([mhd])$/.exec(t);if(!n)return 6e4;const r=parseInt(n[1],10),s=n[2];return s==="h"?r*36e5:s==="d"?r*864e5:r*6e4}function CD(t,e){const n=new Date(t);return Hc(e)>=864e5?n.toLocaleDateString([],{month:"short",day:"numeric"}):n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ff(t,e){const n=Hc(e);return new Date(Math.floor(t.getTime()/n)*n)}function wD(t){return t>=1e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function u1(t){return Number.isFinite(t)?t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toLocaleString():"0"}function d1(t){return Number.isFinite(t)?`$${t.toFixed(t<1?4:2)}`:"$0.00"}function xA(t,e,n){const r=Hc(n),s=ff(e.startDate,n).getTime(),o=e.endDate.getTime(),i=new Map(t.map(l=>[ff(new Date(l.timestamp),n).getTime(),l])),a=[];for(let l=s;l<=o;l+=r){const c=i.get(l),u=new Date(l).toISOString();a.push({t:u,ts:l,label:CD(u,n),calls:c?.calls??0,errors:c?.errors??0,errorRate:c?.errorRate??0,avg:c?.avg??0,p50:c?.p50??0,p95:c?.p95??0,inputTokens:c?.inputTokens??0,outputTokens:c?.outputTokens??0,totalTokens:c?.totalTokens??0,costUsd:c?.costUsd??0})}return a}function bA(t,e,n,r){const s=new Map;for(const d of t)s.set(d.toolName,(s.get(d.toolName)??0)+d[e]);const o=[...s.entries()].sort((d,f)=>f[1]-d[1]).slice(0,n).map(([d])=>d),i=new Set(o),a=new Map,l=new Map;for(const d of t){if(!i.has(d.toolName))continue;const f=d.virtualMcpId??"";a.set(f,(a.get(f)??0)+d[e]),l.set(`${f}::${d.toolName}`,{calls:d.calls,errors:d.errors,outputSize:d.outputSize})}const c=[...a.entries()].sort((d,f)=>f[1]-d[1]).slice(0,r).map(([d])=>d);let u=0;for(const d of c)for(const f of o){const h=l.get(`${d}::${f}`);h&&h[e]>u&&(u=h[e])}return{topTools:o,topAgentIds:c,cellMap:l,maxValue:u}}function vA(t,e){return e==="requests"?t.calls:e==="errors"?t.errorRate:t.avgDurationMs}function kA(t,e){return e==="requests"?t.calls.toLocaleString():e==="errors"?`${t.errorRate.toFixed(1)}%`:wD(t.avgDurationMs)}function f1(t){return(t.run_config??{}).agent?.id??(t.virtual_mcp_id||null)}function h1(t,e,n,r){if(!t)return r;const s=e.find(i=>i.id===t)??n?.find(i=>i.id===t);if(s?.title)return s.title;const o=Ef(t);return o?Df(o).title??r:t}function p1(t,e,n){if(!t)return null;const r=e.find(o=>o.id===t)??n?.find(o=>o.id===t);if(r?.icon)return r.icon;const s=Ef(t);return s?Df(s).icon??null:null}function ND(t){return t?.data?.members??[]}function dl(t){const e=_.c(32),{thread:n,connections:r,virtualMcps:s,nav:o}=t,i=J();let a,l;if(e[0]!==r||e[1]!==n||e[2]!==s){const k=f1(n);a=h1(k,s,r,""),l=p1(k,s,r),e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=l}else a=e[3],l=e[4];const c=l;let u;e[5]!==a||e[6]!==i||e[7]!==n.title?(u=a||n.title||i("orgs.threads.untitledChat"),e[5]=a,e[6]=i,e[7]=n.title,e[8]=u):u=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(Rf,{}),e[9]=d):d=e[9];let f;e[10]!==c||e[11]!==u?(f=p.jsx(Kn,{icon:c,name:u,size:"sm",fallbackIcon:d,className:"shadow-sm shrink-0 rounded-md"}),e[10]=c,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==i||e[14]!==n.title?(h=n.title||i("orgs.threads.untitledChat"),e[13]=i,e[14]=n.title,e[15]=h):h=e[15];let m;e[16]!==h?(m=p.jsx(kf,{className:"text-sm leading-snug truncate",children:h}),e[16]=h,e[17]=m):m=e[17];let y;e[18]!==a?(y=a&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a}),e[18]=a,e[19]=y):y=e[19];let g;e[20]!==m||e[21]!==y?(g=p.jsxs("div",{className:"min-w-0",children:[m,y]}),e[20]=m,e[21]=y,e[22]=g):g=e[22];let x;e[23]!==f||e[24]!==g?(x=p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[f,g]}),e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==o||e[27]!==i?(b=o&&p.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[p.jsx(Ln,{size:"icon",variant:"ghost",onClick:o.onPrev,disabled:o.index===0,className:"h-7 w-7 text-muted-foreground","aria-label":i("orgs.threads.previousChat"),children:p.jsx(h0,{size:14})}),p.jsx(Ln,{size:"icon",variant:"ghost",onClick:o.onNext,disabled:o.index===o.total-1,className:"h-7 w-7 text-muted-foreground","aria-label":i("orgs.threads.nextChat"),children:p.jsx(If,{size:14})})]}),e[26]=o,e[27]=i,e[28]=b):b=e[28];let v;return e[29]!==b||e[30]!==x?(v=p.jsx(vf,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[x,b]})}),e[29]=b,e[30]=x,e[31]=v):v=e[31],v}function MD(t){const e=_.c(62),{thread:n,connections:r,virtualMcps:s,members:o}=t,i=J();let a,l;if(e[0]!==r||e[1]!==n||e[2]!==s){const I=f1(n);a=h1(I,s,r,""),l=p1(I,s,r),e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=l}else a=e[3],l=e[4];const c=l;let u;if(e[5]!==o||e[6]!==n.created_by){const I=ND(o);let R;e[8]!==n.created_by?(R=z=>z.userId===n.created_by,e[8]=n.created_by,e[9]=R):R=e[9],u=I.find(R),e[5]=o,e[6]=n.created_by,e[7]=u}else u=e[7];const d=u;let f;e[10]!==d?.user.email||e[11]!==d?.user.name||e[12]!==n.created_by?(f=d?.user.name??d?.user.email??n.created_by?.substring(0,8)??"—",e[10]=d?.user.email,e[11]=d?.user.name,e[12]=n.created_by,e[13]=f):f=e[13];const h=f,m=d?.user.image??void 0;let y;e[14]!==n.created_at?(y=new Date(n.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=n.created_at,e[15]=y):y=e[15];const g=y;let x,b,v,k,N,C;if(e[16]!==i||e[17]!==n.status){const I=c1(n.status),R=I.icon;x="px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm";let z;e[24]!==i?(z=i("orgs.threads.status"),e[24]=i,e[25]=z):z=e[25],e[26]!==z?(C=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:z}),e[26]=z,e[27]=C):C=e[27],k="flex items-center gap-1.5",N=p.jsx(R,{size:13,className:I.iconClassName}),b=Q("text-sm",I.labelColor),v=i(I.labelKey),e[16]=i,e[17]=n.status,e[18]=x,e[19]=b,e[20]=v,e[21]=k,e[22]=N,e[23]=C}else x=e[18],b=e[19],v=e[20],k=e[21],N=e[22],C=e[23];let S;e[28]!==b||e[29]!==v?(S=p.jsx("span",{className:b,children:v}),e[28]=b,e[29]=v,e[30]=S):S=e[30];let w;e[31]!==S||e[32]!==k||e[33]!==N?(w=p.jsxs("div",{className:k,children:[N,S]}),e[31]=S,e[32]=k,e[33]=N,e[34]=w):w=e[34];let M;e[35]!==w||e[36]!==C?(M=p.jsxs("div",{children:[C,w]}),e[35]=w,e[36]=C,e[37]=M):M=e[37];let T;e[38]!==i?(T=i("orgs.threads.date"),e[38]=i,e[39]=T):T=e[39];let O;e[40]!==T?(O=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:T}),e[40]=T,e[41]=O):O=e[41];let A;e[42]!==g?(A=p.jsx("div",{className:"text-sm text-foreground",children:g}),e[42]=g,e[43]=A):A=e[43];let P;e[44]!==O||e[45]!==A?(P=p.jsxs("div",{children:[O,A]}),e[44]=O,e[45]=A,e[46]=P):P=e[46];let D;e[47]!==i||e[48]!==n.created_by||e[49]!==m||e[50]!==h?(D=n.created_by&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.user")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(f0,{url:m,fallback:h,shape:"circle",size:"2xs",className:"shrink-0"}),p.jsx("span",{className:"text-sm text-foreground",children:h})]})]}),e[47]=i,e[48]=n.created_by,e[49]=m,e[50]=h,e[51]=D):D=e[51];let E;e[52]!==c||e[53]!==a||e[54]!==i?(E=a&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.agent")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Kn,{icon:c,name:a,size:"xs",fallbackIcon:p.jsx(Rf,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),p.jsx("span",{className:"text-sm text-foreground",children:a})]})]}),e[52]=c,e[53]=a,e[54]=i,e[55]=E):E=e[55];let j;return e[56]!==x||e[57]!==M||e[58]!==P||e[59]!==D||e[60]!==E?(j=p.jsxs("div",{className:x,children:[M,P,D,E]}),e[56]=x,e[57]=M,e[58]=P,e[59]=D,e[60]=E,e[61]=j):j=e[61],j}const fl=100;function TD(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.noMessagesInChat"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function ED(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}const DD=400,OD=5e3;function AD(t,e,n){const r=_.c(8),s=mf(),o=L.useRef(null);let i;r[0]!==e||r[1]!==s||r[2]!==n?(i=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,s.invalidateQueries({queryKey:ht.threadMessages(e,n)})},DD)},r[0]=e,r[1]=s,r[2]=n,r[3]=i):i=r[3];const a=i;let l;r[4]!==t||r[5]!==a||r[6]!==n?(l={orgSlug:t,taskId:n,onStep:a,onFinish:a,onReconnect:a},r[4]=t,r[5]=a,r[6]=n,r[7]=l):l=r[7],G0(l)}function ID(t){const e=_.c(36),{client:n,locator:r,thread:s,connections:o,virtualMcps:i,members:a,nav:l,meta:c}=t,{org:u}=xt();let d;e[0]!==r||e[1]!==s.id?(d=ht.threadMessages(r,s.id),e[0]=r,e[1]=s.id,e[2]=d):d=e[2];let f;e[3]!==n||e[4]!==s.id?(f=async O=>{const{pageParam:A}=O,P=A===void 0?0:A;if(!n)throw new Error("MCP client is not available");const D=await n.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:s.id,limit:fl,offset:P}});return D.structuredContent??D},e[3]=n,e[4]=s.id,e[5]=f):f=e[5];let h;e[6]!==d||e[7]!==f?(h={queryKey:d,queryFn:f,initialPageParam:0,getNextPageParam:PD,staleTime:0,refetchInterval:OD},e[6]=d,e[7]=f,e[8]=h):h=e[8];const{data:m,fetchNextPage:y,hasNextPage:g,isFetchingNextPage:x}=d0(h);AD(u.slug,r,s.id);let b;e[9]!==m.pages?(b=m.pages.flatMap(RD).filter(jD),e[9]=m.pages,e[10]=b):b=e[10];const v=b,k=A3(v);let N;e[11]!==y||e[12]!==g||e[13]!==x?(N=()=>{g&&!x&&y()},e[11]=y,e[12]=g,e[13]=x,e[14]=N):N=e[14];const C=Af(N,g??!1,x);let S;e[15]!==o||e[16]!==l||e[17]!==s||e[18]!==i?(S=p.jsx(dl,{thread:s,connections:o,virtualMcps:i,nav:l}),e[15]=o,e[16]=l,e[17]=s,e[18]=i,e[19]=S):S=e[19];let w;e[20]!==o||e[21]!==a||e[22]!==c||e[23]!==s||e[24]!==i?(w=c&&p.jsx(MD,{thread:s,connections:o,virtualMcps:i,members:a}),e[20]=o,e[21]=a,e[22]=c,e[23]=s,e[24]=i,e[25]=w):w=e[25];let M;e[26]!==x||e[27]!==C||e[28]!==k||e[29]!==v.length||e[30]!==s.status?(M=v.length===0?p.jsx(TD,{}):p.jsx("div",{"data-chat-scroller":!0,className:"flex-1 overflow-y-auto min-h-0",children:p.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[k.map((O,A)=>p.jsx("div",{ref:A===k.length-1?C:void 0,children:p.jsx(I3,{pair:O,isLastPair:A===k.length-1,status:A===k.length-1&&s.status==="in_progress"?"streaming":"ready"})},`pair-${O.user?.id??O.assistant?.id}`)),x&&p.jsx(ED,{})]})}),e[26]=x,e[27]=C,e[28]=k,e[29]=v.length,e[30]=s.status,e[31]=M):M=e[31];let T;return e[32]!==S||e[33]!==w||e[34]!==M?(T=p.jsxs(p.Fragment,{children:[S,w,M]}),e[32]=S,e[33]=w,e[34]=M,e[35]=T):T=e[35],T}function jD(t){return t.role==="user"||t.role==="assistant"}function RD(t){return t.items??[]}function PD(t,e){const n=t,r=e;if(!((n?.items?.length??0)<fl))return r.length*fl}function LD(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.failedToLoadMessages"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function $D(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.loadingConversation"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function _D(t){const e=_.c(31),{thread:n,client:r,locator:s,connections:o,virtualMcps:i,members:a,nav:l,meta:c}=t,u=c===void 0?!0:c;let d;e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==i?(d=p.jsx(dl,{thread:n,connections:o,virtualMcps:i,nav:l}),e[0]=o,e[1]=l,e[2]=n,e[3]=i,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(LD,{}),e[5]=f):f=e[5];let h;e[6]!==d?(h=p.jsxs(p.Fragment,{children:[d,f]}),e[6]=d,e[7]=h):h=e[7];let m;e[8]!==o||e[9]!==l||e[10]!==n||e[11]!==i?(m=p.jsx(dl,{thread:n,connections:o,virtualMcps:i,nav:l}),e[8]=o,e[9]=l,e[10]=n,e[11]=i,e[12]=m):m=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=p.jsx($D,{}),e[13]=y):y=e[13];let g;e[14]!==m?(g=p.jsxs(p.Fragment,{children:[m,y]}),e[14]=m,e[15]=g):g=e[15];let x;e[16]!==r||e[17]!==o||e[18]!==s||e[19]!==a||e[20]!==u||e[21]!==l||e[22]!==n||e[23]!==i?(x=p.jsx(ID,{client:r,locator:s,thread:n,connections:o,virtualMcps:i,members:a,nav:l,meta:u}),e[16]=r,e[17]=o,e[18]=s,e[19]=a,e[20]=u,e[21]=l,e[22]=n,e[23]=i,e[24]=x):x=e[24];let b;e[25]!==g||e[26]!==x?(b=p.jsx(L.Suspense,{fallback:g,children:x}),e[25]=g,e[26]=x,e[27]=b):b=e[27];let v;return e[28]!==h||e[29]!==b?(v=p.jsx(S0,{children:p.jsx(yf,{fallback:h,children:b})}),e[28]=h,e[29]=b,e[30]=v):v=e[30],v}function BD(t){const e=_.c(15),[n,r]=L.useState(null);let s;e[0]!==t||e[1]!==n?(s=n!==null?t.findIndex(h=>h.id===n):-1,e[0]=t,e[1]=n,e[2]=s):s=e[2];const o=s,i=o!==-1?t[o]:null,a=i!==null;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h=>r(h),c=()=>r(null),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let u,d;e[5]!==o||e[6]!==t?(u=()=>{const h=t[o-1];o>0&&h&&r(h.id)},d=()=>{const h=t[o+1];o!==-1&&h&&r(h.id)},e[5]=o,e[6]=t,e[7]=u,e[8]=d):(u=e[7],d=e[8]);let f;return e[9]!==o||e[10]!==i||e[11]!==a||e[12]!==u||e[13]!==d?(f={selected:i,index:o,isOpen:a,select:l,close:c,prev:u,next:d},e[9]=o,e[10]=i,e[11]=a,e[12]=u,e[13]=d,e[14]=f):f=e[14],f}const hl=50;function Qs(t){const e=_.c(10),{title:n,value:r,subtitle:s}=t;let o;e[0]!==n?(o=p.jsx("span",{className:"text-sm text-foreground/70",children:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==r?(i=p.jsx("span",{className:"text-3xl font-normal tabular-nums",children:r}),e[2]=r,e[3]=i):i=e[3];let a;e[4]!==s?(a=s&&p.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[4]=s,e[5]=a):a=e[5];let l;return e[6]!==o||e[7]!==i||e[8]!==a?(l=p.jsxs(R1,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,a]}),e[6]=o,e[7]=i,e[8]=a,e[9]=l):l=e[9],l}function zD(t){const e=_.c(45),{automationId:n,range:r}=t,s=J(),{data:o,isLoading:i}=u0(n,r),a=o?.runs,l=o?.usage;let c;e[0]!==a?(c=a&&a.total>0?`${Math.round(a.completed/a.total*100)}%`:"—",e[0]=a,e[1]=c):c=e[1];const u=c;let d;e[2]!==s||e[3]!==l?(d=l&&l.truncated?s("automations.automationRuns.lastRunsSubtitle",{count:l.sampledRuns}):void 0,e[2]=s,e[3]=l,e[4]=d):d=e[4];const f=d;let h;e[5]!==s?(h=s("automations.automationRuns.runsTitle"),e[5]=s,e[6]=h):h=e[6];let m;e[7]!==i||e[8]!==a?.total?(m=i?"…":a?.total.toLocaleString()??"0",e[7]=i,e[8]=a?.total,e[9]=m):m=e[9];let y;e[10]!==a||e[11]!==s?(y=a?`${a.completed} ${s("automations.automationRuns.ok")} · ${a.failed} ${s("automations.automationRuns.failed")}${a.inProgress>0?` · ${a.inProgress} ${s("automations.automationRuns.running")}`:""}`:void 0,e[10]=a,e[11]=s,e[12]=y):y=e[12];let g;e[13]!==h||e[14]!==m||e[15]!==y?(g=p.jsx(Qs,{title:h,value:m,subtitle:y}),e[13]=h,e[14]=m,e[15]=y,e[16]=g):g=e[16];let x;e[17]!==s?(x=s("automations.automationRuns.successRateTitle"),e[17]=s,e[18]=x):x=e[18];const b=i?"…":u;let v;e[19]!==x||e[20]!==b?(v=p.jsx(Qs,{title:x,value:b}),e[19]=x,e[20]=b,e[21]=v):v=e[21];let k;e[22]!==s?(k=s("automations.automationRuns.tokensTitle"),e[22]=s,e[23]=k):k=e[23];let N;e[24]!==i||e[25]!==l?.totalTokens?(N=i?"…":u1(l?.totalTokens??0),e[24]=i,e[25]=l?.totalTokens,e[26]=N):N=e[26];let C;e[27]!==k||e[28]!==N||e[29]!==f?(C=p.jsx(Qs,{title:k,value:N,subtitle:f}),e[27]=k,e[28]=N,e[29]=f,e[30]=C):C=e[30];let S;e[31]!==s?(S=s("automations.automationRuns.costTitle"),e[31]=s,e[32]=S):S=e[32];let w;e[33]!==i||e[34]!==l?(w=i?"…":l&&l.costUsd>0?d1(l.costUsd):"—",e[33]=i,e[34]=l,e[35]=w):w=e[35];let M;e[36]!==S||e[37]!==w||e[38]!==f?(M=p.jsx(Qs,{title:S,value:w,subtitle:f}),e[36]=S,e[37]=w,e[38]=f,e[39]=M):M=e[39];let T;return e[40]!==C||e[41]!==M||e[42]!==g||e[43]!==v?(T=p.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,v,C,M]}),e[40]=C,e[41]=M,e[42]=g,e[43]=v,e[44]=T):T=e[44],T}function FD(t){const e=_.c(57),{run:n,usage:r,onClick:s,lastRowRef:o}=t,i=J();let a,l;if(e[0]!==n.created_at){const j=new Date(n.created_at);a=j.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=j.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=n.created_at,e[1]=a,e[2]=l}else a=e[1],l=e[2];const c=l;let u,d,f,h,m,y,g,x,b,v,k;if(e[3]!==o||e[4]!==s||e[5]!==n.status||e[6]!==n.title||e[7]!==i){const j=c1(n.status),I=j.icon;d=Of,b=o,v="h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",k=s,e[19]!==n.title?(f=p.jsx(Er,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[19]=n.title,e[20]=f):f=e[20],u=Er,x="w-28 px-3",y="flex items-center gap-1.5",g=p.jsx(I,{size:14,className:j.iconClassName}),h=Q("text-sm",j.labelColor),m=i(j.labelKey),e[3]=o,e[4]=s,e[5]=n.status,e[6]=n.title,e[7]=i,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m,e[13]=y,e[14]=g,e[15]=x,e[16]=b,e[17]=v,e[18]=k}else u=e[8],d=e[9],f=e[10],h=e[11],m=e[12],y=e[13],g=e[14],x=e[15],b=e[16],v=e[17],k=e[18];let N;e[21]!==h||e[22]!==m?(N=p.jsx("span",{className:h,children:m}),e[21]=h,e[22]=m,e[23]=N):N=e[23];let C;e[24]!==N||e[25]!==y||e[26]!==g?(C=p.jsxs("div",{className:y,children:[g,N]}),e[24]=N,e[25]=y,e[26]=g,e[27]=C):C=e[27];let S;e[28]!==u||e[29]!==C||e[30]!==x?(S=p.jsx(u,{className:x,children:C}),e[28]=u,e[29]=C,e[30]=x,e[31]=S):S=e[31];let w;e[32]!==r?(w=r?u1(r.totalTokens):"—",e[32]=r,e[33]=w):w=e[33];let M;e[34]!==w?(M=p.jsx(Er,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:w}),e[34]=w,e[35]=M):M=e[35];let T;e[36]!==r?(T=r&&r.costUsd>0?d1(r.costUsd):"—",e[36]=r,e[37]=T):T=e[37];let O;e[38]!==T?(O=p.jsx(Er,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:T}),e[38]=T,e[39]=O):O=e[39];let A;e[40]!==a?(A=p.jsx("div",{children:a}),e[40]=a,e[41]=A):A=e[41];let P;e[42]!==c?(P=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[42]=c,e[43]=P):P=e[43];let D;e[44]!==A||e[45]!==P?(D=p.jsxs(Er,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[A,P]}),e[44]=A,e[45]=P,e[46]=D):D=e[46];let E;return e[47]!==d||e[48]!==f||e[49]!==S||e[50]!==M||e[51]!==O||e[52]!==D||e[53]!==b||e[54]!==v||e[55]!==k?(E=p.jsxs(d,{ref:b,className:v,onClick:k,children:[f,S,M,O,D]}),e[47]=d,e[48]=f,e[49]=S,e[50]=M,e[51]=O,e[52]=D,e[53]=b,e[54]=v,e[55]=k,e[56]=E):E=e[56],E}function SA(t){const e=_.c(73),{automationId:n,triggerIds:r,range:s}=t,o=J(),{org:i,locator:a}=xt();let l;e[0]!==i.id||e[1]!==i.slug?(l={connectionId:t0,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=l):l=e[2];const c=gl(l),u=gf(),d=Q1(),f=n0(),{data:h}=i0(),m=r.length>0;let y;e[3]!==n||e[4]!==i.id||e[5]!==r?(y=ht.automationRuns(i.id,n,r),e[3]=n,e[4]=i.id,e[5]=r,e[6]=y):y=e[6];let g;e[7]!==u||e[8]!==r?(g=async Ne=>{const{pageParam:me}=Ne,Ke=me===void 0?0:me;return await u.call("COLLECTION_THREADS_LIST",{limit:hl,offset:Ke,where:{trigger_ids:r}})},e[7]=u,e[8]=r,e[9]=g):g=e[9];let x;e[10]!==m||e[11]!==y||e[12]!==g?(x={queryKey:y,queryFn:g,initialPageParam:0,getNextPageParam:UD,enabled:m,staleTime:3e4},e[10]=m,e[11]=y,e[12]=g,e[13]=x):x=e[13];const{data:b,fetchNextPage:v,hasNextPage:k,isFetchingNextPage:N,isLoading:C}=X1(x);let S,w,M,T;e[14]!==b?.pages||e[15]!==a||e[16]!==s?(S=(b?.pages??[]).flatMap(VD),T=S.map(WD),M=ni,w=ht.monitoringThreadUsage(a,JSON.stringify({ids:T,...s})),e[14]=b?.pages,e[15]=a,e[16]=s,e[17]=S,e[18]=w,e[19]=M,e[20]=T):(S=e[17],w=e[18],M=e[19],T=e[20]);let O;e[21]!==s||e[22]!==u||e[23]!==T?(O=async()=>await u.call("MONITORING_THREAD_USAGE",{threadIds:T,...s.startDate?{startDate:s.startDate}:{},...s.endDate?{endDate:s.endDate}:{}}),e[21]=s,e[22]=u,e[23]=T,e[24]=O):O=e[24];const A=T.length>0;let P;e[25]!==w||e[26]!==O||e[27]!==A?(P={queryKey:w,queryFn:O,enabled:A,staleTime:3e4},e[25]=w,e[26]=O,e[27]=A,e[28]=P):P=e[28];const{data:D}=M(P);let E;e[29]!==D?.items?(E=new Map((D?.items??[]).map(HD)),e[29]=D?.items,e[30]=E):E=e[30];const j=E;let I;e[31]!==v||e[32]!==k||e[33]!==N?(I=()=>{k&&!N&&v()},e[31]=v,e[32]=k,e[33]=N,e[34]=I):I=e[34];const R=Af(I,k??!1,N),z=BD(S),W=z.selected;let q;e[35]!==n||e[36]!==s?(q=p.jsx(zD,{automationId:n,range:s}),e[35]=n,e[36]=s,e[37]=q):q=e[37];let G;e[38]!==m||e[39]!==C||e[40]!==R||e[41]!==S||e[42]!==z||e[43]!==o||e[44]!==j?(G=m?C?p.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingRuns")}):S.length===0?p.jsx("div",{className:"py-16",children:p.jsx(Jc,{title:o("automations.automationRuns.noRunsTitle"),description:o("automations.automationRuns.noRunsDescription")})}):p.jsxs(r0,{className:"w-full border-collapse",children:[p.jsx(s0,{className:"border-b-0",children:p.jsxs(Of,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Tr,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.runHeader")}),p.jsx(Tr,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.statusHeader")}),p.jsx(Tr,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.tokensHeader")}),p.jsx(Tr,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.costHeader")}),p.jsx(Tr,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.startedHeader")})]})}),p.jsx(o0,{children:S.map((Ne,me)=>p.jsx(FD,{run:Ne,usage:j.get(Ne.id),onClick:()=>z.select(Ne.id),lastRowRef:me===S.length-1?R:void 0},Ne.id))})]}):p.jsx("div",{className:"py-16",children:p.jsx(Jc,{title:o("automations.automationRuns.noStartersTitle"),description:o("automations.automationRuns.noStartersDescription")})}),e[38]=m,e[39]=C,e[40]=R,e[41]=S,e[42]=z,e[43]=o,e[44]=j,e[45]=G):G=e[45];let te;e[46]!==N||e[47]!==o?(te=N&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingMore")}),e[46]=N,e[47]=o,e[48]=te):te=e[48];let ae;e[49]!==z?(ae=Ne=>{Ne||z.close()},e[49]=z,e[50]=ae):ae=e[50];let fe;e[51]!==d||e[52]!==f||e[53]!==c||e[54]!==a||e[55]!==h||e[56]!==S||e[57]!==W||e[58]!==z.index||e[59]!==z.next||e[60]!==z.prev?(fe=W&&p.jsx(_D,{thread:W,client:c,locator:a,connections:d,virtualMcps:f,members:h,nav:{index:z.index,total:S.length,onPrev:z.prev,onNext:z.next}}),e[51]=d,e[52]=f,e[53]=c,e[54]=a,e[55]=h,e[56]=S,e[57]=W,e[58]=z.index,e[59]=z.next,e[60]=z.prev,e[61]=fe):fe=e[61];let ce;e[62]!==fe?(ce=p.jsx(Sf,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:fe}),e[62]=fe,e[63]=ce):ce=e[63];let we;e[64]!==z.isOpen||e[65]!==ae||e[66]!==ce?(we=p.jsx(Cf,{open:z.isOpen,onOpenChange:ae,children:ce}),e[64]=z.isOpen,e[65]=ae,e[66]=ce,e[67]=we):we=e[67];let $e;return e[68]!==q||e[69]!==G||e[70]!==te||e[71]!==we?($e=p.jsxs("div",{className:"flex flex-col gap-5",children:[q,G,te,we]}),e[68]=q,e[69]=G,e[70]=te,e[71]=we,e[72]=$e):$e=e[72],$e}function HD(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function WD(t){return t.id}function VD(t){return t.items??[]}function UD(t,e){const n=t,r=e;if(!((n?.items?.length??0)<hl))return r.length*hl}export{ql as $,i3 as A,EM as B,Y as C,xe as D,Xl as E,XS as F,wp as G,ex as H,$ as I,F as J,De as K,Mt as L,gi as M,H as N,a3 as O,ay as P,Sh as Q,XO as R,uA as S,V as T,Ul as U,be as V,hk as W,Bp as X,IS as Y,Yk as Z,Jr as _,dm as a,oe as a0,U as a1,eA as a2,nA as a3,GO as a4,fk as a5,tA as a6,u2 as a7,qe as a8,Se as a9,yA as aA,xA as aB,u1 as aC,wD as aD,d1 as aE,kA as aF,vA as aG,bA as aH,ND as aI,BD as aJ,f1 as aK,h1 as aL,p1 as aM,ak as aa,am as ab,im as ac,$2 as ad,rA as ae,kr as af,cA as ag,XN as ah,GN as ai,_D as aj,gA as ak,fM as al,hM as am,dM as an,fA as ao,dA as ap,uM as aq,hA as ar,pM as as,Jn as at,ZO as au,SA as av,c1 as aw,Nc as ax,l1 as ay,OM as az,Ce as b,um as c,sy as d,pe as e,lA as f,wl as g,Kt as h,aA as i,QO as j,oA as k,US as l,iA as m,sA as n,KS as o,oM as p,nm as q,KO as r,Nl as s,ga as t,LS as u,A3 as v,ny as w,pA as x,I3 as y,mA as z};
186
+ `:"")+s:e(o?"chat.subtask.stepLimitNoOutput":"chat.subtask.completedNoOutput")}}return WM(t)}function Rg(t){return!!t&&typeof t=="object"&&t.background===!0}function Pg({part:t,subtaskMeta:e},n){const r=t.state==="input-streaming"||t.state==="input-available",s=t.state==="output-available"&&t.preliminary===!0,o=t.state==="output-available"&&!t.preliminary,i=t.state==="output-error",a=It(t.state,"preliminary"in t?t.preliminary:!1),l=a==="approval"?"idle":a,c=n(r?"chat.subtask.startingEllipsis":s?"chat.subtask.runningEllipsis":o?"chat.subtask.completedTitle":i?"chat.subtask.failedTitle":"chat.subtask.subtaskNoun"),u=t.input?.prompt??"",d=t.state==="approval-requested"?n("chat.subtask.awaitingApproval"):u.length>120?u.slice(0,120)+"…":u;return{fallbackTitle:c,summary:d,usage:e?.usage,state:l}}function Lg(t){return t.state==="input-available"?!0:t.state==="output-available"?"preliminary"in t&&t.preliminary===!0:!1}function $g(t){const e=_.c(4),n=vs()?.taskId??null,{org:r}=xt();if(!n)return null;let s;return e[0]!==r||e[1]!==n||e[2]!==t?(s=async()=>{if(n===null)return;const o=await fetch(`/api/${encodeURIComponent(r.slug)}/decopilot/flip/${encodeURIComponent(n)}`,{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({toolCallId:t})});if(!o.ok)throw new Error(`flip failed: ${o.status}`)},e[0]=r,e[1]=n,e[2]=t,e[3]=s):s=e[3],s}function bT(t){const e=_.c(10),{onFlip:n}=t,r=J(),[s,o]=L.useState(!1);let i;e[0]!==n?(i=async u=>{u.stopPropagation(),o(!0);try{await n()}catch{o(!1)}},e[0]=n,e[1]=i):i=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=G("shrink-0 text-[12px] text-muted-foreground/70 px-2 py-1 rounded-md transition-colors","[@media(hover:hover)]:hover:text-foreground [@media(hover:hover)]:hover:bg-accent/40","disabled:opacity-50"),e[2]=a):a=e[2];let l;e[3]!==s||e[4]!==r?(l=r(s?"chat.subtask.flipping":"chat.subtask.flipToBackground"),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==s||e[7]!==i||e[8]!==l?(c=p.jsx("button",{type:"button",disabled:s,onClick:i,className:a,children:l}),e[6]=s,e[7]=i,e[8]=l,e[9]=c):c=e[9],c}function Tc(t){const e=_.c(54),{icon:n,title:r,summary:s,state:o,usage:i,latency:a,onOpenChange:l,onFlip:c,children:u}=t,[d,f]=L.useState(!1);let h;e[0]!==l?(h=te=>{f(te),l?.(te)},e[0]=l,e[1]=h):h=e[1];const m=h,y=o==="loading",g=o==="error";let x;e[2]!==m?(x=()=>m(!0),e[2]=m,e[3]=x):x=e[3];const b=y&&"shimmer";let v;e[4]!==b?(v=G("group/tool flex items-center gap-2 flex-1 min-w-0 py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",b),e[4]=b,e[5]=v):v=e[5];const k=g?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let N;e[6]!==k?(N=G("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",k),e[6]=k,e[7]=N):N=e[7];let C;e[8]!==n||e[9]!==N?(C=p.jsx("div",{className:N,children:n}),e[8]=n,e[9]=N,e[10]=C):C=e[10];const S=g?"text-warning/80":"text-foreground";let w;e[11]!==S?(w=G("shrink-0 text-[14px] font-normal",S),e[11]=S,e[12]=w):w=e[12];let M;e[13]!==w||e[14]!==r?(M=p.jsx("span",{className:w,children:r}),e[13]=w,e[14]=r,e[15]=M):M=e[15];let T;e[16]!==s?(T=s?p.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.jsx("span",{className:"text-[12px] text-muted-foreground/60 bg-muted/50 rounded-[3px] px-1 py-px leading-none",children:s})}):p.jsx("div",{className:"flex-1"}),e[16]=s,e[17]=T):T=e[17];let O;e[18]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx(A1,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=O):O=e[18];let A;e[19]!==a?(A=p.jsx(Le,{latency:a}),e[19]=a,e[20]=A):A=e[20];let P;e[21]!==i?(P=p.jsx(vg,{usage:i}),e[21]=i,e[22]=P):P=e[22];let D;e[23]!==M||e[24]!==T||e[25]!==A||e[26]!==P||e[27]!==x||e[28]!==v||e[29]!==C?(D=p.jsxs("button",{type:"button",onClick:x,className:v,children:[C,M,T,O,A,P]}),e[23]=M,e[24]=T,e[25]=A,e[26]=P,e[27]=x,e[28]=v,e[29]=C,e[30]=D):D=e[30];let E;e[31]!==y||e[32]!==c?(E=c&&y?p.jsx(bT,{onFlip:c}):null,e[31]=y,e[32]=c,e[33]=E):E=e[33];let j;e[34]!==D||e[35]!==E?(j=p.jsxs("div",{className:"flex items-center gap-1 w-full",children:[D,E]}),e[34]=D,e[35]=E,e[36]=j):j=e[36];let I;e[37]!==n?(I=p.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:n}),e[37]=n,e[38]=I):I=e[38];let R;e[39]!==I||e[40]!==r?(R=p.jsx(vf,{className:"px-4 py-3 border-b border-border shrink-0",children:p.jsxs(kf,{className:"flex items-center gap-2 text-sm font-medium",children:[I,r]})}),e[39]=I,e[40]=r,e[41]=R):R=e[41];let z;e[42]!==u?(z=p.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:u}),e[42]=u,e[43]=z):z=e[43];let W;e[44]!==R||e[45]!==z?(W=p.jsxs(Sf,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[R,z]}),e[44]=R,e[45]=z,e[46]=W):W=e[46];let q;e[47]!==d||e[48]!==m||e[49]!==W?(q=p.jsx(Cf,{open:d,onOpenChange:m,children:W}),e[47]=d,e[48]=m,e[49]=W,e[50]=q):q=e[50];let X;return e[51]!==j||e[52]!==q?(X=p.jsxs(p.Fragment,{children:[j,q]}),e[51]=j,e[52]=q,e[53]=X):X=e[53],X}function _g(t){const e=_.c(22),{part:n}=t,r=J(),s=n.state==="output-error";let o;e[0]!==n.input?.prompt||e[1]!==r?(o=n.input?.prompt??r("chat.subtask.noPromptProvided"),e[0]=n.input?.prompt,e[1]=r,e[2]=o):o=e[2];const i=o;let a;if(e[3]!==s||e[4]!==n||e[5]!==i||e[6]!==r){const l=s?Ci(n):xT(n.output,r)??"";let c;e[8]!==r?(c=r("chat.subtask.taskLabel"),e[8]=r,e[9]=c):c=e[9];let u;e[10]!==c?(u=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[10]=c,e[11]=u):u=e[11];let d;e[12]!==i?(d=p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:i}),e[12]=i,e[13]=d):d=e[13];let f;e[14]!==u||e[15]!==d?(f=p.jsxs("section",{children:[u,d]}),e[14]=u,e[15]=d,e[16]=f):f=e[16];let h;e[17]!==s||e[18]!==r?(h=r(s?"chat.subtask.errorLabel":"chat.subtask.resultLabel"),e[17]=s,e[18]=r,e[19]=h):h=e[19];let m;e[20]!==h?(m=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:h}),e[20]=h,e[21]=m):m=e[21],a=p.jsxs("div",{className:"flex flex-col gap-4",children:[f,p.jsxs("section",{children:[m,l.trim()?p.jsx(vl,{id:`${n.toolCallId}-result`,text:l}):p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:r("chat.subtask.running")})]})]}),e[3]=s,e[4]=n,e[5]=i,e[6]=r,e[7]=a}else a=e[7];return a}const sa=600;function vT(t){const e=_.c(12),{part:n}=t,r=n.type??"";let s;e[0]!==n.toolName||e[1]!==r?(s=r==="dynamic-tool"?n.toolName??"tool":r.slice(5),e[0]=n.toolName,e[1]=r,e[2]=s):s=e[2];const o=s;let i;if(e[3]!==n.input){const f=n.input!=null?JSON.stringify(n.input):"";i=f.length>80?`${f.slice(0,80)}…`:f||void 0,e[3]=n.input,e[4]=i}else i=e[4];const a=i;let l;if(e[5]!==n.input){const f=n.input!=null?JSON.stringify(n.input,null,2):null;l=f&&f.length>sa?`${f.slice(0,sa)}
187
+ … (${f.length-sa} more characters)`:f,e[5]=n.input,e[6]=l}else l=e[6];const c=l;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(jf,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==o||e[10]!==a?(d=p.jsx(ne,{icon:u,title:o,summary:a,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=o,e[10]=a,e[11]=d):d=e[11],d}function kT(t){const e=_.c(19),{jobId:n,prompt:r,items:s,streaming:o}=t,i=J();let a;e[0]!==i?(a=i("chat.subtask.taskLabel"),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==a?(l=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:a}),e[2]=a,e[3]=l):l=e[3];let c;e[4]!==r?(c=p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r}),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u=p.jsxs("section",{children:[l,c]}),e[6]=l,e[7]=c,e[8]=u):u=e[8];let d;e[9]!==s||e[10]!==n||e[11]!==o||e[12]!==i?(d=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:i("chat.subtask.runningInBackground")}):s.map((m,y)=>{const g=m,x=g.type??"";return x==="text"?g.text?.trim()?p.jsx(gi,{id:`${n}-sub-${y}`,part:m,animate:o},`${n}-sub-${y}`):null:x==="dynamic-tool"||x.startsWith("tool-")&&x!=="tool-todo_write"&&x!=="tool-update_interests"?p.jsx(vT,{part:g},`${n}-sub-${y}`):null}),e[9]=s,e[10]=n,e[11]=o,e[12]=i,e[13]=d):d=e[13];let f;e[14]!==d?(f=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:d}),e[14]=d,e[15]=f):f=e[15];let h;return e[16]!==u||e[17]!==f?(h=p.jsxs("div",{className:"flex flex-col gap-4",children:[u,f]}),e[16]=u,e[17]=f,e[18]=h):h=e[18],h}function Bg(t){const e=_.c(32),{part:n}=t,r=J(),s=n.output?.jobId,o=vs()?.taskId??null,{org:i}=xt(),[a,l]=L.useState(!1),c=mT(s),u=o??"",d=a&&!!o;let f;e[0]!==s||e[1]!==i.slug||e[2]!==u||e[3]!==d?(f={orgSlug:i.slug,threadId:u,jobId:s,enabled:d},e[0]=s,e[1]=i.slug,e[2]=u,e[3]=d,e[4]=f):f=e[4];const h=yT(f);let m;e[5]!==h.messages?(m=h.messages.flatMap(CT),e[5]=h.messages,e[6]=m):m=e[6];const y=m;let g;e[7]!==c?(g=c.flatMap(ST),e[7]=c,e[8]=g):g=e[8];const x=g,b=y.length>0?y:x;let v;e[9]!==n.input?.prompt||e[10]!==r?(v=n.input?.prompt??r("chat.subtask.noPromptProvided"),e[9]=n.input?.prompt,e[10]=r,e[11]=v):v=e[11];const k=v;let N;e[12]!==k?(N=k.length>120?`${k.slice(0,120)}…`:k,e[12]=k,e[13]=N):N=e[13];const C=N,S=c.length===0;let w;e[14]!==r?(w=r("chat.subtask.subtaskNoun"),e[14]=r,e[15]=w):w=e[15];let M;e[16]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx(Sl,{}),e[16]=M):M=e[16];let T;e[17]!==w?(T=p.jsx(Kn,{icon:void 0,name:w,size:"2xs",className:"rounded-xs",fallbackIcon:M}),e[17]=w,e[18]=T):T=e[18];let O;e[19]!==r?(O=r("chat.subtask.subtaskNoun"),e[19]=r,e[20]=O):O=e[20];const A=S?"loading":"idle",P=h.streaming||S;let D;e[21]!==b||e[22]!==s||e[23]!==k||e[24]!==P?(D=p.jsx(kT,{jobId:s,prompt:k,items:b,streaming:P}),e[21]=b,e[22]=s,e[23]=k,e[24]=P,e[25]=D):D=e[25];let E;return e[26]!==C||e[27]!==T||e[28]!==O||e[29]!==A||e[30]!==D?(E=p.jsx(Tc,{icon:T,title:O,summary:C,state:A,onOpenChange:l,children:D}),e[26]=C,e[27]=T,e[28]=O,e[29]=A,e[30]=D,e[31]=E):E=e[31],E}function ST(t){return t.parts??[]}function CT(t){return t.parts??[]}function wT(t){const e=_.c(24),n=J(),r=$g(t.part.toolCallId);if(Rg(t.part.output)){let y;return e[0]!==t?(y=p.jsx(Bg,{...t}),e[0]=t,e[1]=y):y=e[1],y}let s;e[2]!==t||e[3]!==n?(s=Pg(t,n),e[2]=t,e[3]=n,e[4]=s):s=e[4];const{fallbackTitle:o,summary:i,usage:a,state:l}=s;let c;e[5]!==n?(c=n("chat.subtask.subtaskNoun"),e[5]=n,e[6]=c):c=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(Sl,{}),e[7]=u):u=e[7];let d;e[8]!==c?(d=p.jsx(Kn,{icon:void 0,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[8]=c,e[9]=d):d=e[9];let f;e[10]!==r||e[11]!==t.part?(f=r&&Lg(t.part)?r:void 0,e[10]=r,e[11]=t.part,e[12]=f):f=e[12];let h;e[13]!==t.part?(h=p.jsx(_g,{part:t.part}),e[13]=t.part,e[14]=h):h=e[14];let m;return e[15]!==o||e[16]!==t.latency||e[17]!==l||e[18]!==i||e[19]!==d||e[20]!==f||e[21]!==h||e[22]!==a?(m=p.jsx(Tc,{icon:d,title:o,summary:i,state:l,usage:a,latency:t.latency,onFlip:f,children:h}),e[15]=o,e[16]=t.latency,e[17]=l,e[18]=i,e[19]=d,e[20]=f,e[21]=h,e[22]=a,e[23]=m):m=e[23],m}function NT(t){const e=_.c(26),n=J(),r=Tf(t.part.input?.agent_id),s=$g(t.part.toolCallId);if(Rg(t.part.output)){let b;return e[0]!==t?(b=p.jsx(Bg,{...t}),e[0]=t,e[1]=b):b=e[1],b}let o;e[2]!==t||e[3]!==n?(o=Pg(t,n),e[2]=t,e[3]=n,e[4]=o):o=e[4];const{fallbackTitle:i,summary:a,usage:l,state:c}=o,u=r?.icon;let d;e[5]!==n||e[6]!==r?.title?(d=r?.title??n("chat.subtask.subtaskNoun"),e[5]=n,e[6]=r?.title,e[7]=d):d=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(Sl,{}),e[8]=f):f=e[8];let h;e[9]!==u||e[10]!==d?(h=p.jsx(Kn,{icon:u,name:d,size:"2xs",className:"rounded-xs",fallbackIcon:f}),e[9]=u,e[10]=d,e[11]=h):h=e[11];const m=r?.title??i;let y;e[12]!==s||e[13]!==t.part?(y=s&&Lg(t.part)?s:void 0,e[12]=s,e[13]=t.part,e[14]=y):y=e[14];let g;e[15]!==t.part?(g=p.jsx(_g,{part:t.part}),e[15]=t.part,e[16]=g):g=e[16];let x;return e[17]!==t.latency||e[18]!==c||e[19]!==a||e[20]!==h||e[21]!==m||e[22]!==y||e[23]!==g||e[24]!==l?(x=p.jsx(Tc,{icon:h,title:m,summary:a,state:c,usage:l,latency:t.latency,onFlip:y,children:g}),e[17]=t.latency,e[18]=c,e[19]=a,e[20]=h,e[21]=m,e[22]=y,e[23]=g,e[24]=l,e[25]=x):x=e[25],x}function MT(t){const e=_.c(28),{part:n}=t,r=J();if(!n.state.startsWith("output-"))return null;const s=n.input?.plan??"",i=n.output?.approved===!0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsx(ha,{className:"size-4 text-purple-500 shrink-0"}),e[0]=a):a=e[0];let l;e[1]!==r?(l=r("chat.proposePlan.implementationPlan"),e[1]=r,e[2]=l):l=e[2];let c;e[3]!==l?(c=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:l}),e[3]=l,e[4]=c):c=e[4];let u;e[5]!==i||e[6]!==r?(u=i&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-success bg-success/10 px-1.5 py-0.5 rounded-md",children:[p.jsx(xl,{size:12}),r("chat.proposePlan.approved")]}),e[5]=i,e[6]=r,e[7]=u):u=e[7];let d;e[8]!==i||e[9]!==n.state||e[10]!==r?(d=!i&&n.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:r("chat.proposePlan.rejected")}),e[8]=i,e[9]=n.state,e[10]=r,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==u||e[14]!==d?(f=p.jsxs("div",{className:"flex items-center gap-2",children:[a,c,u,d]}),e[12]=c,e[13]=u,e[14]=d,e[15]=f):f=e[15];let h;e[16]!==r?(h=r("chat.proposePlan.viewPlan"),e[16]=r,e[17]=h):h=e[17];let m;e[18]!==h?(m=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:h}),e[18]=h,e[19]=m):m=e[19];let y;e[20]!==s?(y=p.jsx("div",{className:"mt-1 pl-2 border-l-2 border-purple-500/30 prose prose-sm max-w-none text-sm",children:p.jsx(gi,{id:"plan-content",part:{type:"text",text:s}})}),e[20]=s,e[21]=y):y=e[21];let g;e[22]!==m||e[23]!==y?(g=p.jsxs("details",{className:"ml-6",children:[m,y]}),e[22]=m,e[23]=y,e[24]=g):g=e[24];let x;return e[25]!==g||e[26]!==f?(x=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[f,g]}),e[25]=g,e[26]=f,e[27]=x):x=e[27],x}function Ec(t){return{primary:t("chat.brandContext.colorPrimary"),secondary:t("chat.brandContext.colorSecondary"),accent:t("chat.brandContext.colorAccent"),background:t("chat.brandContext.colorBackground"),foreground:t("chat.brandContext.colorForeground")}}function TT(t){try{const e=new URL(t.startsWith("http")?t:`https://${t}`);return e.protocol!=="http:"&&e.protocol!=="https:"?"about:blank":e.href}catch{return"about:blank"}}function Dc(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function ET(t){return t?Object.entries(t).filter(([,e])=>typeof e=="string"&&e.trim().length>0):[]}function Zd(t){const e=_.c(2),{children:n}=t;let r;return e[0]!==n?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function DT(t){const e=_.c(12),{name:n,value:r}=t;let s;e[0]!==r?(s=p.jsx("span",{className:"size-7 shrink-0 rounded-md border border-border",style:{backgroundColor:r},"aria-hidden":!0}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=p.jsx("span",{className:"text-sm text-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r?(i=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=i):i=e[5];let a;e[6]!==o||e[7]!==i?(a=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[o,i]}),e[6]=o,e[7]=i,e[8]=a):a=e[8];let l;return e[9]!==s||e[10]!==a?(l=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,a]}),e[9]=s,e[10]=a,e[11]=l):l=e[11],l}function OT(t){const e=_.c(15),{role:n,family:r}=t;let s;e[0]!==r?(s=p.jsx("span",{className:"text-2xl font-medium leading-none text-foreground shrink-0",style:{fontFamily:r},"aria-hidden":!0,children:"Aa"}),e[0]=r,e[1]=s):s=e[1];let o;e[2]!==n?(o=p.jsx("span",{className:"text-xs text-muted-foreground",children:n}),e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r?(i={fontFamily:r},e[4]=r,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a=p.jsx("span",{className:"text-sm text-foreground",style:i,children:r}),e[6]=r,e[7]=i,e[8]=a):a=e[8];let l;e[9]!==o||e[10]!==a?(l=p.jsxs("div",{className:"flex flex-col leading-tight",children:[o,a]}),e[9]=o,e[10]=a,e[11]=l):l=e[11];let c;return e[12]!==s||e[13]!==l?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,l]}),e[12]=s,e[13]=l,e[14]=c):c=e[14],c}function AT(t){const e=_.c(3),{logo:n,favicon:r,name:s}=t,o=n??r;if(!o)return null;const i=s?`${s} logo`:"";let a;return e[0]!==o||e[1]!==i?(a=p.jsx("img",{src:o,alt:i,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:IT}),e[0]=o,e[1]=i,e[2]=a):a=e[2],a}function IT(t){t.target.style.display="none"}function zg(t){const e=_.c(12),{colors:n}=t,r=J();let s;e[0]!==r?(s=Ec(r),e[0]=r,e[1]=s):s=e[1];const o=s;let i,a,l;if(e[2]!==o||e[3]!==n){l=Symbol.for("react.early_return_sentinel");e:{const u=Dc(n);if(u.length===0){l=null;break e}i="flex h-1.5";let d;e[7]!==o?(d=f=>{const[h,m]=f;return p.jsx("span",{className:"flex-1",style:{backgroundColor:m},title:`${o[h]}: ${m}`,"aria-hidden":!0},h)},e[7]=o,e[8]=d):d=e[8],a=u.map(d)}e[2]=o,e[3]=n,e[4]=i,e[5]=a,e[6]=l}else i=e[4],a=e[5],l=e[6];if(l!==Symbol.for("react.early_return_sentinel"))return l;let c;return e[9]!==i||e[10]!==a?(c=p.jsx("div",{className:i,children:a}),e[9]=i,e[10]=a,e[11]=c):c=e[11],c}function Fg(t){const e=_.c(51),{logo:n,favicon:r,name:s,domain:o,overview:i,colors:a,fonts:l,showDefaultBadge:c,isDefault:u}=t,d=J();let f;e[0]!==d?(f=Ec(d),e[0]=d,e[1]=f):f=e[1];const h=f;let m,y,g,x,b,v,k;if(e[2]!==h||e[3]!==a||e[4]!==o||e[5]!==r||e[6]!==l||e[7]!==u||e[8]!==n||e[9]!==s||e[10]!==i||e[11]!==c||e[12]!==d){const S=Dc(a),w=ET(l);v="mt-2 rounded-lg overflow-hidden border border-border",e[20]!==a?(k=a&&p.jsx(zg,{colors:a}),e[20]=a,e[21]=k):k=e[21],m="p-5 flex flex-col gap-6";let M;e[22]!==r||e[23]!==n||e[24]!==s?(M=p.jsx(AT,{logo:n,favicon:r,name:s}),e[22]=r,e[23]=n,e[24]=s,e[25]=M):M=e[25];let T;e[26]!==u||e[27]!==s||e[28]!==c||e[29]!==d?(T=s&&p.jsxs("span",{className:"inline-flex items-center gap-2 text-lg font-semibold text-foreground truncate",children:[s,c&&u&&p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[p.jsx(Nf,{className:"size-3 text-amber-500"}),d("chat.brandContext.defaultBadge")]})]}),e[26]=u,e[27]=s,e[28]=c,e[29]=d,e[30]=T):T=e[30];let O;e[31]!==o?(O=o&&p.jsxs("a",{href:TT(o),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[o,p.jsx(Bf,{className:"size-3 shrink-0"})]}),e[31]=o,e[32]=O):O=e[32];let A;e[33]!==T||e[34]!==O?(A=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[T,O]}),e[33]=T,e[34]=O,e[35]=A):A=e[35],e[36]!==A||e[37]!==M?(y=p.jsxs("div",{className:"flex items-center gap-4",children:[M,A]}),e[36]=A,e[37]=M,e[38]=y):y=e[38],e[39]!==i?(g=i&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:i}),e[39]=i,e[40]=g):g=e[40],x=S.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Zd,{children:d("chat.brandContext.colorsSection")}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:S.map(P=>{const[D,E]=P;return p.jsx(DT,{name:h[D],value:E},D)})})]}),b=w.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Zd,{children:d("chat.brandContext.typographySection")}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:w.map(jT)})]}),e[2]=h,e[3]=a,e[4]=o,e[5]=r,e[6]=l,e[7]=u,e[8]=n,e[9]=s,e[10]=i,e[11]=c,e[12]=d,e[13]=m,e[14]=y,e[15]=g,e[16]=x,e[17]=b,e[18]=v,e[19]=k}else m=e[13],y=e[14],g=e[15],x=e[16],b=e[17],v=e[18],k=e[19];let N;e[41]!==m||e[42]!==y||e[43]!==g||e[44]!==x||e[45]!==b?(N=p.jsxs("div",{className:m,children:[y,g,x,b]}),e[41]=m,e[42]=y,e[43]=g,e[44]=x,e[45]=b,e[46]=N):N=e[46];let C;return e[47]!==v||e[48]!==k||e[49]!==N?(C=p.jsxs("div",{className:v,children:[k,N]}),e[47]=v,e[48]=k,e[49]=N,e[50]=C):C=e[50],C}function jT(t){const[e,n]=t;return p.jsx(OT,{role:e,family:n},e)}function RT(t){const e=_.c(46),{part:n,latency:r}=t,s=J();let o;e[0]!==n.state?(o=It(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let a,l,c,u,d;if(e[2]!==r||e[3]!==n.input||e[4]!==n.output||e[5]!==i||e[6]!==s){d=Symbol.for("react.early_return_sentinel");e:{l=Nr(n.output);const w=i==="loading",M=i==="error"||l&&l.success===!1;if(w){const T=n.input;let O;e[12]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx(Nt,{className:"animate-pulse"}),e[12]=O):O=e[12];let A;e[13]!==s?(A=s("chat.brandContext.extractingBrand"),e[13]=s,e[14]=A):A=e[14];let P;e[15]!==T||e[16]!==s?(P=T?.domain?s("chat.brandContext.fromDomain",{domain:T.domain}):void 0,e[15]=T,e[16]=s,e[17]=P):P=e[17];let D;e[18]!==A||e[19]!==P?(D=p.jsx(ne,{icon:O,title:A,summary:P,state:"loading",defaultOpen:!0}),e[18]=A,e[19]=P,e[20]=D):D=e[20],d=D;break e}if(M){let T;e[21]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(Nt,{}),e[21]=T):T=e[21];let O;e[22]!==s?(O=s("chat.brandContext.extractionFailed"),e[22]=s,e[23]=O):O=e[23];let A;e[24]!==r?(A=p.jsx(Le,{latency:r}),e[24]=r,e[25]=A):A=e[25],d=p.jsx(ne,{icon:T,title:O,summary:l?.error??s("chat.brandContext.unknownError"),state:"error",trailing:A});break e}a=ne,e[26]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Nt,{className:"text-fuchsia-500"}),e[26]=c):c=e[26],u=l?.name?s("chat.brandContext.brandSet",{name:l.name}):s("chat.brandContext.brandContextSet")}e[2]=r,e[3]=n.input,e[4]=n.output,e[5]=i,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=u,e[11]=d}else a=e[7],l=e[8],c=e[9],u=e[10],d=e[11];if(d!==Symbol.for("react.early_return_sentinel"))return d;const f=l?.domain;let h;e[27]!==r?(h=p.jsx(Le,{latency:r}),e[27]=r,e[28]=h):h=e[28];let m;e[29]!==a||e[30]!==c||e[31]!==u||e[32]!==f||e[33]!==h?(m=p.jsx(a,{icon:c,title:u,summary:f,state:"idle",trailing:h}),e[29]=a,e[30]=c,e[31]=u,e[32]=f,e[33]=h,e[34]=m):m=e[34];const y=l?.logo,g=l?.favicon,x=l?.name,b=l?.domain,v=l?.overview,k=l?.colors,N=l?.fonts;let C;e[35]!==x||e[36]!==b||e[37]!==v||e[38]!==k||e[39]!==N||e[40]!==y||e[41]!==g?(C=p.jsx(Fg,{logo:y,favicon:g,name:x,domain:b,overview:v,colors:k,fonts:N}),e[35]=x,e[36]=b,e[37]=v,e[38]=k,e[39]=N,e[40]=y,e[41]=g,e[42]=C):C=e[42];let S;return e[43]!==C||e[44]!==m?(S=p.jsxs(p.Fragment,{children:[m,C]}),e[43]=C,e[44]=m,e[45]=S):S=e[45],S}function PT(t){const e=_.c(45),{part:n,latency:r}=t,s=J();let o;e[0]!==n.state?(o=It(n.state),e[0]=n.state,e[1]=o):o=e[1];const i=o;let a,l,c,u,d;if(e[2]!==r||e[3]!==n.output||e[4]!==i||e[5]!==s){d=Symbol.for("react.early_return_sentinel");e:{l=Nr(n.output);const g=i==="loading",x=i==="error"||l&&l.success===!1;if(g){let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Nt,{className:"animate-pulse"}),e[11]=b):b=e[11];let v;e[12]!==s?(v=s("chat.brandContext.loadingBrand"),e[12]=s,e[13]=v):v=e[13];let k;e[14]!==v?(k=p.jsx(ne,{icon:b,title:v,state:"loading"}),e[14]=v,e[15]=k):k=e[15],d=k;break e}if(x||!l){let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Nt,{}),e[16]=b):b=e[16];let v;e[17]!==s?(v=s("chat.brandContext.couldNotLoadBrand"),e[17]=s,e[18]=v):v=e[18];let k;e[19]!==r?(k=p.jsx(Le,{latency:r}),e[19]=r,e[20]=k):k=e[20];let N;e[21]!==v||e[22]!==k?(N=p.jsx(ne,{icon:b,title:v,state:"error",trailing:k}),e[21]=v,e[22]=k,e[23]=N):N=e[23],d=N;break e}a=ne,e[24]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Nt,{className:"text-fuchsia-500"}),e[24]=c):c=e[24],u=l.name?s("chat.brandContext.brandWithName",{name:l.name}):s("chat.brandContext.brand")}e[2]=r,e[3]=n.output,e[4]=i,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d}else a=e[6],l=e[7],c=e[8],u=e[9],d=e[10];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[25]!==r?(f=p.jsx(Le,{latency:r}),e[25]=r,e[26]=f):f=e[26];let h;e[27]!==a||e[28]!==l.domain||e[29]!==c||e[30]!==u||e[31]!==f?(h=p.jsx(a,{icon:c,title:u,summary:l.domain,state:"idle",trailing:f}),e[27]=a,e[28]=l.domain,e[29]=c,e[30]=u,e[31]=f,e[32]=h):h=e[32];let m;e[33]!==l.colors||e[34]!==l.domain||e[35]!==l.favicon||e[36]!==l.fonts||e[37]!==l.isDefault||e[38]!==l.logo||e[39]!==l.name||e[40]!==l.overview?(m=p.jsx(Fg,{logo:l.logo,favicon:l.favicon,name:l.name,domain:l.domain,overview:l.overview,colors:l.colors,fonts:l.fonts,showDefaultBadge:!0,isDefault:l.isDefault}),e[33]=l.colors,e[34]=l.domain,e[35]=l.favicon,e[36]=l.fonts,e[37]=l.isDefault,e[38]=l.logo,e[39]=l.name,e[40]=l.overview,e[41]=m):m=e[41];let y;return e[42]!==h||e[43]!==m?(y=p.jsxs(p.Fragment,{children:[h,m]}),e[42]=h,e[43]=m,e[44]=y):y=e[44],y}function LT(t){const e=_.c(49),{part:n,latency:r}=t,s=J();let o;e[0]!==s?(o=Ec(s),e[0]=s,e[1]=o):o=e[1];const i=o;let a;e[2]!==n.state?(a=It(n.state),e[2]=n.state,e[3]=a):a=e[3];const l=a;let c,u,d,f;if(e[4]!==i||e[5]!==r||e[6]!==n.output||e[7]!==l||e[8]!==s){f=Symbol.for("react.early_return_sentinel");e:{const y=Nr(n.output),g=Array.isArray(y?.items)?y.items:[],x=l==="loading",b=l==="error";if(x){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.brandContext.loadingBrands"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],f=w;break e}if(b){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{}),e[18]=C):C=e[18];let S;e[19]!==s?(S=s("chat.brandContext.couldNotLoadBrands"),e[19]=s,e[20]=S):S=e[20];let w;e[21]!==r?(w=p.jsx(Le,{latency:r}),e[21]=r,e[22]=w):w=e[22];let M;e[23]!==S||e[24]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[23]=S,e[24]=w,e[25]=M):M=e[25],f=M;break e}if(g.length===0){let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Nt,{}),e[26]=C):C=e[26];let S;e[27]!==s?(S=s("chat.brandContext.noBrandsYet"),e[27]=s,e[28]=S):S=e[28];let w;e[29]!==s?(w=s("chat.brandContext.noBrandsContext"),e[29]=s,e[30]=w):w=e[30];let M;e[31]!==r?(M=p.jsx(Le,{latency:r}),e[31]=r,e[32]=M):M=e[32];let T;e[33]!==M||e[34]!==S||e[35]!==w?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[33]=M,e[34]=S,e[35]=w,e[36]=T):T=e[36],f=T;break e}let v;e[37]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(Nt,{className:"text-fuchsia-500"}),e[37]=v):v=e[37];let k;e[38]!==r?(k=p.jsx(Le,{latency:r}),e[38]=r,e[39]=k):k=e[39],d=p.jsx(ne,{icon:v,title:g.length===1?s("chat.brandContext.oneBrand"):s("chat.brandContext.multipleBrands",{count:g.length}),state:"idle",trailing:k}),c="mt-2 flex flex-col gap-1.5";let N;e[40]!==i||e[41]!==s?(N=(C,S)=>{const w=Dc(C.colors);return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[C.colors&&p.jsx(zg,{colors:C.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(C.logo||C.favicon)&&p.jsx("img",{src:C.logo??C.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:$T}),p.jsxs("div",{className:"flex flex-col leading-tight min-w-0 flex-1",children:[p.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground truncate",children:[C.name??s("chat.brandContext.untitled"),C.isDefault&&p.jsx(Nf,{className:"size-3 text-amber-500 shrink-0"})]}),C.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:C.domain})]}),w.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:w.slice(0,5).map(M=>{const[T,O]=M;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:O},title:`${i[T]}: ${O}`,"aria-hidden":!0},T)})})]})]},C.id??`${C.name}-${C.domain}-${S}`)},e[40]=i,e[41]=s,e[42]=N):N=e[42],u=g.map(N)}e[4]=i,e[5]=r,e[6]=n.output,e[7]=l,e[8]=s,e[9]=c,e[10]=u,e[11]=d,e[12]=f}else c=e[9],u=e[10],d=e[11],f=e[12];if(f!==Symbol.for("react.early_return_sentinel"))return f;let h;e[43]!==c||e[44]!==u?(h=p.jsx("div",{className:c,children:u}),e[43]=c,e[44]=u,e[45]=h):h=e[45];let m;return e[46]!==d||e[47]!==h?(m=p.jsxs(p.Fragment,{children:[d,h]}),e[46]=d,e[47]=h,e[48]=m):m=e[48],m}function $T(t){t.target.style.display="none"}function ll(t){const e=_.c(4),{connection_id:n,iconSize:r}=t,s=r===void 0?"xs":r,o=Tf(n);if(!o)return null;let i;return e[0]!==o.icon||e[1]!==o.title||e[2]!==s?(i=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(Kn,{icon:o.icon,name:o.title,size:s})}),e[0]=o.icon,e[1]=o.title,e[2]=s,e[3]=i):i=e[3],i}ll.Fallback=function({iconSize:e="xs"}){const n=e==="sm"?"size-6":"size-5";return p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:G(n,"rounded bg-muted animate-pulse")})})};function xs(t){const e=_.c(18),{connectionIds:n,maxVisibleIcons:r,iconSize:s,className:o}=t,i=r===void 0?2:r,a=s===void 0?"xs":s;if(n.length===0)return null;let l,c,u;if(e[0]!==o||e[1]!==n||e[2]!==a||e[3]!==i){const h=n.slice(0,i);l=n.length-i,e[7]!==o?(c=G("flex items-center justify-end -space-x-2",o),e[7]=o,e[8]=c):c=e[8];let m;e[9]!==a?(m=y=>p.jsx(L.Suspense,{fallback:p.jsx(ll.Fallback,{iconSize:a}),children:p.jsx(ll,{connection_id:y,iconSize:a})},y),e[9]=a,e[10]=m):m=e[10],u=h.map(m),e[0]=o,e[1]=n,e[2]=a,e[3]=i,e[4]=l,e[5]=c,e[6]=u}else l=e[4],c=e[5],u=e[6];let d;e[11]!==a||e[12]!==l?(d=l>0&&p.jsx("div",{className:G("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",a==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:G(a==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${l} more`,children:["+",l]})}),e[11]=a,e[12]=l,e[13]=d):d=e[13];let f;return e[14]!==c||e[15]!==u||e[16]!==d?(f=p.jsxs("div",{className:c,children:[u,d]}),e[14]=c,e[15]=u,e[16]=d,e[17]=f):f=e[17],f}xs.Fallback=function({maxVisibleIcons:e=2,totalCount:n,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",o=r==="sm"?"size-8":"size-6",i=n!==void 0&&n>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((a,l)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:G(s,"rounded bg-muted animate-pulse")})},l)),i&&p.jsx("div",{className:G("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",o),children:p.jsx("div",{className:G(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const _T="This document certifies that the bearer agent has been granted authorized access to the tools and capabilities described herein. The agent is permitted to operate within the scope defined by its instructions and shall act in accordance with the constraints set forth by the issuing organization. This credential remains valid for the duration of the agent's active status. Unauthorized modification of this agent's permissions or scope is prohibited. The issuing authority reserves the right to revoke access at any time. All actions performed by this agent are subject to audit and review by the organization administrator. ",ef=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function BT(t){const e=_.c(105),{part:n,latency:r}=t,s=J(),o=zf(),i=It(n.state),a=L.useRef(null),l=L.useRef(null),c=L.useRef(null),u=L.useRef(null),d=L.useRef(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{ef?.matches||(d.current=a.current?.getBoundingClientRect()??null,a.current&&(a.current.style.willChange="transform"))},e[0]=f):f=e[0];const h=f;let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=Q=>{if(ef?.matches)return;const ee=d.current,se=a.current;if(!ee||!se)return;const _e=(Q.clientX-ee.left)/ee.width*100,Je=(Q.clientY-ee.top)/ee.height*100;se.style.transform=`perspective(800px) rotateY(${(_e-50)*.05}deg) rotateX(${(Je-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(_e-50)*.15}px, ${(Je-50)*.15}px)`),c.current&&(c.current.style.opacity="0.45"),u.current&&(u.current.style.opacity="0.45")},e[1]=m):m=e[1];const y=m;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const Q=a.current;Q&&(Q.style.transform="none",Q.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),c.current&&(c.current.style.opacity="0.3"),u.current&&(u.current.style.opacity="0.3"),d.current=null},e[2]=g):g=e[2];const x=g;if(i==="loading"){let Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q=p.jsx(wt,{className:"animate-pulse"}),e[3]=Q):Q=e[3];let ee;e[4]!==s?(ee=s("chat.agentCreate.creating"),e[4]=s,e[5]=ee):ee=e[5];let se;return e[6]!==ee?(se=p.jsx(ne,{icon:Q,title:ee,state:"loading",defaultOpen:!0}),e[6]=ee,e[7]=se):se=e[7],se}if(i==="approval"){let Q;e[8]===Symbol.for("react.memo_cache_sentinel")?(Q=p.jsx(wt,{}),e[8]=Q):Q=e[8];let ee;e[9]!==s?(ee=s("chat.agentCreate.createAgent"),e[9]=s,e[10]=ee):ee=e[10];let se;return e[11]!==ee?(se=p.jsx(ne,{icon:Q,title:ee,state:"idle"}),e[11]=ee,e[12]=se):se=e[12],se}if(i==="error"){let Q;e[13]===Symbol.for("react.memo_cache_sentinel")?(Q=p.jsx(wt,{}),e[13]=Q):Q=e[13];let ee;e[14]!==n.state||e[15]!==s?(ee=n.state==="output-denied"?s("chat.agentCreate.cancelled"):s("chat.agentCreate.couldntCreate"),e[14]=n.state,e[15]=s,e[16]=ee):ee=e[16];let se;e[17]!==r?(se=p.jsx(Le,{latency:r}),e[17]=r,e[18]=se):se=e[18];let _e;return e[19]!==ee||e[20]!==se?(_e=p.jsx(ne,{icon:Q,title:ee,state:"error",trailing:se}),e[19]=ee,e[20]=se,e[21]=_e):_e=e[21],_e}let b,v,k,N,C,S,w,M,T,O,A,P,D,E,j,I,R,z,W,q,X,te,ae;if(e[22]!==r||e[23]!==o||e[24]!==n.output||e[25]!==s){R=Symbol.for("react.early_return_sentinel");e:{const Q=Nr(n.output)?.item;if(!Q?.id||!Q?.title){let ut;e[49]===Symbol.for("react.memo_cache_sentinel")?(ut=p.jsx(wt,{}),e[49]=ut):ut=e[49];let dt;e[50]!==s?(dt=s("chat.agentCreate.created"),e[50]=s,e[51]=dt):dt=e[51];let ue;e[52]!==r?(ue=p.jsx(Le,{latency:r}),e[52]=r,e[53]=ue):ue=e[53];let Me;e[54]!==dt||e[55]!==ue?(Me=p.jsx(ne,{icon:ut,title:dt,state:"idle",trailing:ue}),e[54]=dt,e[55]=ue,e[56]=Me):Me=e[56],R=Me;break e}const ee=(Q.connections??[]).map(zT);let se;e[57]===Symbol.for("react.memo_cache_sentinel")?(se=p.jsx(wt,{className:"text-success"}),e[57]=se):se=e[57];let _e;e[58]!==r?(_e=p.jsx(Le,{latency:r}),e[58]=r,e[59]=_e):_e=e[59],I=p.jsx(ne,{icon:se,title:s("chat.agentCreate.agentCreated",{name:Q.title}),state:"idle",trailing:_e}),j="mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",k=a,N="relative overflow-hidden rounded-lg bg-accent/25 p-2",e[60]===Symbol.for("react.memo_cache_sentinel")?(C={transition:"transform 0.3s ease-out"},e[60]=C):C=e[60],S=h,w=y,M=x,e[61]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx("div",{ref:l,className:"pointer-events-none absolute inset-[-20%] z-[1] select-none rounded-lg",style:{background:"linear-gradient(135deg, hsla(280, 60%, 80%, 0.35) 0%, transparent 35%), linear-gradient(315deg, hsla(190, 70%, 80%, 0.35) 0%, transparent 35%), linear-gradient(225deg, hsla(140, 55%, 80%, 0.3) 0%, transparent 30%), linear-gradient(45deg, hsla(320, 55%, 82%, 0.3) 0%, transparent 30%)",opacity:.4,transition:"opacity 0.3s ease, transform 0.3s ease-out"},"aria-hidden":"true"}),e[61]=T):T=e[61];let Je;e[62]===Symbol.for("react.memo_cache_sentinel")?(Je={textAlign:"justify",wordBreak:"break-all"},e[62]=Je):Je=e[62],e[63]===Symbol.for("react.memo_cache_sentinel")?(O=p.jsx("p",{className:"pointer-events-none absolute inset-0 z-[1] select-none overflow-hidden text-[6px] font-light leading-[1.5] tracking-[0.06px] text-background opacity-50 mix-blend-overlay",style:Je,"aria-hidden":"true",children:_T.repeat(6)}),A=p.jsx("img",{src:"/stamp.svg",alt:"",className:"pointer-events-none absolute -right-10 -top-10 size-[140px] opacity-50 select-none","aria-hidden":"true"}),e[63]=O,e[64]=A):(O=e[63],A=e[64]),e[65]===Symbol.for("react.memo_cache_sentinel")?(P=p.jsx("img",{ref:c,src:"/left-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 left-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[65]=P):P=e[65],e[66]===Symbol.for("react.memo_cache_sentinel")?(D=p.jsx("img",{ref:u,src:"/right-guilloche.png",alt:"",className:"pointer-events-none absolute inset-y-0 right-0 h-full w-auto select-none z-[1] mix-blend-overlay",style:{opacity:.3,transition:"opacity 0.3s ease"},"aria-hidden":"true"}),e[66]=D):D=e[66],E=p.jsxs("div",{className:"relative",children:[p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[p.jsx(Mf,{icon:Q.icon,name:Q.title,size:"md"}),p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:Q.title})})]}),Q.description&&p.jsx("div",{className:"px-2 pt-1 pr-16",children:p.jsx("p",{className:"text-sm leading-snug text-muted-foreground line-clamp-2",children:Q.description})})]}),ae="relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1";const vt=ee.length>0&&p.jsx(L.Suspense,{fallback:p.jsx(xs.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:ee.length}),children:p.jsx(xs,{connectionIds:ee,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})});e[67]!==vt?(v=p.jsx("div",{className:"flex-1 min-w-0",children:vt}),e[67]=vt,e[68]=v):v=e[68],te="flex items-center gap-2 shrink-0",b=Ln,z="sm",W="h-7",q=()=>o(Q.id),X=s("chat.agentCreate.seeAgentLabel",{name:Q.title})}e[22]=r,e[23]=o,e[24]=n.output,e[25]=s,e[26]=b,e[27]=v,e[28]=k,e[29]=N,e[30]=C,e[31]=S,e[32]=w,e[33]=M,e[34]=T,e[35]=O,e[36]=A,e[37]=P,e[38]=D,e[39]=E,e[40]=j,e[41]=I,e[42]=R,e[43]=z,e[44]=W,e[45]=q,e[46]=X,e[47]=te,e[48]=ae}else b=e[26],v=e[27],k=e[28],N=e[29],C=e[30],S=e[31],w=e[32],M=e[33],T=e[34],O=e[35],A=e[36],P=e[37],D=e[38],E=e[39],j=e[40],I=e[41],R=e[42],z=e[43],W=e[44],q=e[45],X=e[46],te=e[47],ae=e[48];if(R!==Symbol.for("react.early_return_sentinel"))return R;let fe;e[69]!==s?(fe=s("chat.agentCreate.seeAgent"),e[69]=s,e[70]=fe):fe=e[70];let ce;e[71]!==b||e[72]!==fe||e[73]!==z||e[74]!==W||e[75]!==q||e[76]!==X?(ce=p.jsx(b,{size:z,className:W,onClick:q,"aria-label":X,children:fe}),e[71]=b,e[72]=fe,e[73]=z,e[74]=W,e[75]=q,e[76]=X,e[77]=ce):ce=e[77];let we;e[78]!==ce||e[79]!==te?(we=p.jsx("div",{className:te,children:ce}),e[78]=ce,e[79]=te,e[80]=we):we=e[80];let $e;e[81]!==v||e[82]!==we||e[83]!==ae?($e=p.jsxs("div",{className:ae,children:[v,we]}),e[81]=v,e[82]=we,e[83]=ae,e[84]=$e):$e=e[84];let Ne;e[85]!==k||e[86]!==N||e[87]!==C||e[88]!==S||e[89]!==w||e[90]!==M||e[91]!==T||e[92]!==O||e[93]!==A||e[94]!==P||e[95]!==D||e[96]!==E||e[97]!==$e?(Ne=p.jsxs("div",{ref:k,className:N,style:C,onMouseEnter:S,onMouseMove:w,onMouseLeave:M,children:[T,O,A,P,D,E,$e]}),e[85]=k,e[86]=N,e[87]=C,e[88]=S,e[89]=w,e[90]=M,e[91]=T,e[92]=O,e[93]=A,e[94]=P,e[95]=D,e[96]=E,e[97]=$e,e[98]=Ne):Ne=e[98];let me;e[99]!==j||e[100]!==Ne?(me=p.jsx("div",{className:j,children:Ne}),e[99]=j,e[100]=Ne,e[101]=me):me=e[101];let Ke;return e[102]!==I||e[103]!==me?(Ke=p.jsxs(p.Fragment,{children:[I,me]}),e[102]=I,e[103]=me,e[104]=Ke):Ke=e[104],Ke}function zT(t){return t.connection_id}function FT(t){const e=_.c(24),{agent:n}=t,r=zf();if(!n.id)return null;let s;e[0]!==n.connections?(s=n.connections??[],e[0]=n.connections,e[1]=s):s=e[1];let o;e[2]!==s?(o=s.map(HT),e[2]=s,e[3]=o):o=e[3];const i=o;let a;e[4]!==n.id||e[5]!==r?(a=()=>r(n.id),e[4]=n.id,e[5]=r,e[6]=a):a=e[6];let l;e[7]!==n.icon||e[8]!==n.title?(l=p.jsx(Mf,{icon:n.icon,name:n.title,size:"sm"}),e[7]=n.icon,e[8]=n.title,e[9]=l):l=e[9];let c;e[10]!==n.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[10]=n.title,e[11]=c):c=e[11];let u;e[12]!==n.description?(u=n.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}),e[12]=n.description,e[13]=u):u=e[13];let d;e[14]!==c||e[15]!==u?(d=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==i?(f=i.length>0&&p.jsx(L.Suspense,{fallback:p.jsx(xs.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:i.length}),children:p.jsx(xs,{connectionIds:i,iconSize:"xs",maxVisibleIcons:3})}),e[17]=i,e[18]=f):f=e[18];let h;return e[19]!==a||e[20]!==l||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[l,d,f]}),e[19]=a,e[20]=l,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function HT(t){return t.connection_id}function WT(t){const e=_.c(59),{part:n,latency:r}=t,s=J(),o=ml(),{org:i}=xt();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a;let c,u,d,f,h,m;if(e[2]!==r||e[3]!==n.output||e[4]!==n.state||e[5]!==l||e[6]!==s){m=Symbol.for("react.early_return_sentinel");e:{const b=Nr(n.output);if(u=Array.isArray(b?.items)?b.items:[],l==="loading"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.agentList.loading"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],m=w;break e}if(l==="approval"){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[18]=C):C=e[18];let S;e[19]!==s?(S=s("chat.agentList.listAgents"),e[19]=s,e[20]=S):S=e[20];let w;e[21]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"idle"}),e[21]=S,e[22]=w):w=e[22],m=w;break e}if(l==="error"){let C;e[23]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[23]=C):C=e[23];let S;e[24]!==n.state||e[25]!==s?(S=n.state==="output-denied"?s("chat.agentList.unavailable"):s("chat.agentList.couldntLoad"),e[24]=n.state,e[25]=s,e[26]=S):S=e[26];let w;e[27]!==r?(w=p.jsx(Le,{latency:r}),e[27]=r,e[28]=w):w=e[28];let M;e[29]!==S||e[30]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[29]=S,e[30]=w,e[31]=M):M=e[31],m=M;break e}if(u.length===0){let C;e[32]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(wt,{}),e[32]=C):C=e[32];let S;e[33]!==s?(S=s("chat.agentList.noAgents"),e[33]=s,e[34]=S):S=e[34];let w;e[35]!==s?(w=s("chat.agentList.noAgentsDesc"),e[35]=s,e[36]=w):w=e[36];let M;e[37]!==r?(M=p.jsx(Le,{latency:r}),e[37]=r,e[38]=M):M=e[38];let T;e[39]!==S||e[40]!==w||e[41]!==M?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[39]=S,e[40]=w,e[41]=M,e[42]=T):T=e[42],m=T;break e}const v=u.slice(0,Cg);c=u.length-v.length;let k;e[43]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(wt,{className:"text-success"}),e[43]=k):k=e[43];let N;e[44]!==r?(N=p.jsx(Le,{latency:r}),e[44]=r,e[45]=N):N=e[45],h=p.jsx(ne,{icon:k,title:u.length===1?s("chat.agentList.oneAgent"):s("chat.agentList.multiAgents",{count:u.length}),state:"idle",trailing:N}),d="mt-2 flex flex-col gap-1.5",f=v.map(VT)}e[2]=r,e[3]=n.output,e[4]=n.state,e[5]=l,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m}else c=e[7],u=e[8],d=e[9],f=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[46]!==c||e[47]!==u||e[48]!==o||e[49]!==i||e[50]!==s?(y=c>0&&p.jsx(wg,{count:u.length,noun:s("chat.agentList.agentsNoun"),onClick:()=>o({to:"/$org/settings/agents",params:{org:i.slug}})}),e[46]=c,e[47]=u,e[48]=o,e[49]=i,e[50]=s,e[51]=y):y=e[51];let g;e[52]!==d||e[53]!==f||e[54]!==y?(g=p.jsxs("div",{className:d,children:[f,y]}),e[52]=d,e[53]=f,e[54]=y,e[55]=g):g=e[55];let x;return e[56]!==h||e[57]!==g?(x=p.jsxs(p.Fragment,{children:[h,g]}),e[56]=h,e[57]=g,e[58]=x):x=e[58],x}function VT(t){return p.jsx(FT,{agent:t},t.id)}const UT={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function qT(t){const e=_.c(27),{connection:n}=t,r=ml(),{org:s}=xt(),o=n.slug,i=n.description||n.app_name,a=!o||void 0;let l;e[0]!==r||e[1]!==s||e[2]!==o?(l=()=>o&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:o}}),e[0]=r,e[1]=s,e[2]=o,e[3]=l):l=e[3];let c;e[4]!==n.icon||e[5]!==n.title?(c=p.jsx(Kn,{icon:n.icon,name:n.title,size:"sm"}),e[4]=n.icon,e[5]=n.title,e[6]=c):c=e[6];let u;e[7]!==n.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.title}),e[7]=n.title,e[8]=u):u=e[8];let d;e[9]!==i?(d=i&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i}),e[9]=i,e[10]=d):d=e[10];let f;e[11]!==u||e[12]!==d?(f=p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[u,d]}),e[11]=u,e[12]=d,e[13]=f):f=e[13];const h=UT[n.status]??"bg-muted-foreground";let m;e[14]!==h?(m=G("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let y;e[16]!==m?(y=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=y):y=e[17];let g;e[18]!==n.status?(g=p.jsx("span",{className:"sr-only",children:n.status}),e[18]=n.status,e[19]=g):g=e[19];let x;return e[20]!==a||e[21]!==g||e[22]!==l||e[23]!==c||e[24]!==f||e[25]!==y?(x=p.jsxs("button",{type:"button","aria-disabled":a,onClick:l,className:"group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,y,g]}),e[20]=a,e[21]=g,e[22]=l,e[23]=c,e[24]=f,e[25]=y,e[26]=x):x=e[26],x}function KT(t){const e=_.c(54),{part:n,latency:r}=t,s=J(),o=ml(),{org:i}=xt();let a;e[0]!==n.state?(a=It(n.state),e[0]=n.state,e[1]=a):a=e[1];const l=a;let c,u,d,f,h,m;if(e[2]!==r||e[3]!==n.output||e[4]!==n.state||e[5]!==l||e[6]!==s){m=Symbol.for("react.early_return_sentinel");e:{const b=Nr(n.output);if(u=(Array.isArray(b?.items)?b.items:[]).filter(YT),l==="loading"||l==="approval"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{className:"animate-pulse"}),e[13]=C):C=e[13];let S;e[14]!==s?(S=s("chat.connectionList.loadingTitle"),e[14]=s,e[15]=S):S=e[15];let w;e[16]!==S?(w=p.jsx(ne,{icon:C,title:S,state:"loading"}),e[16]=S,e[17]=w):w=e[17],m=w;break e}if(l==="error"){let C;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{}),e[18]=C):C=e[18];let S;e[19]!==n.state||e[20]!==s?(S=n.state==="output-denied"?s("chat.connectionList.unavailableTitle"):s("chat.connectionList.errorTitle"),e[19]=n.state,e[20]=s,e[21]=S):S=e[21];let w;e[22]!==r?(w=p.jsx(Le,{latency:r}),e[22]=r,e[23]=w):w=e[23];let M;e[24]!==S||e[25]!==w?(M=p.jsx(ne,{icon:C,title:S,state:"error",trailing:w}),e[24]=S,e[25]=w,e[26]=M):M=e[26],m=M;break e}if(u.length===0){let C;e[27]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Ls,{}),e[27]=C):C=e[27];let S;e[28]!==s?(S=s("chat.connectionList.emptyTitle"),e[28]=s,e[29]=S):S=e[29];let w;e[30]!==s?(w=s("chat.connectionList.emptySummary"),e[30]=s,e[31]=w):w=e[31];let M;e[32]!==r?(M=p.jsx(Le,{latency:r}),e[32]=r,e[33]=M):M=e[33];let T;e[34]!==S||e[35]!==w||e[36]!==M?(T=p.jsx(ne,{icon:C,title:S,summary:w,state:"idle",trailing:M}),e[34]=S,e[35]=w,e[36]=M,e[37]=T):T=e[37],m=T;break e}const v=u.slice(0,Cg);c=u.length-v.length;let k;e[38]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Ls,{className:"text-success"}),e[38]=k):k=e[38];let N;e[39]!==r?(N=p.jsx(Le,{latency:r}),e[39]=r,e[40]=N):N=e[40],h=p.jsx(ne,{icon:k,title:u.length===1?s("chat.connectionList.singleConnection"):s("chat.connectionList.multipleConnections",{count:u.length}),state:"idle",trailing:N}),d="mt-2 flex flex-col gap-1.5",f=v.map(JT)}e[2]=r,e[3]=n.output,e[4]=n.state,e[5]=l,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m}else c=e[7],u=e[8],d=e[9],f=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let y;e[41]!==c||e[42]!==u||e[43]!==o||e[44]!==i||e[45]!==s?(y=c>0&&p.jsx(wg,{count:u.length,noun:s("chat.connectionList.connectionNoun"),onClick:()=>o({to:"/$org/settings/connections",params:{org:i.slug}})}),e[41]=c,e[42]=u,e[43]=o,e[44]=i,e[45]=s,e[46]=y):y=e[46];let g;e[47]!==d||e[48]!==f||e[49]!==y?(g=p.jsxs("div",{className:d,children:[f,y]}),e[47]=d,e[48]=f,e[49]=y,e[50]=g):g=e[50];let x;return e[51]!==h||e[52]!==g?(x=p.jsxs(p.Fragment,{children:[h,g]}),e[51]=h,e[52]=g,e[53]=x):x=e[53],x}function JT(t){return p.jsx(qT,{connection:t},t.id)}function YT(t){return t.connection_type!=="VIRTUAL"}function GT(){const t=_.c(42),e=J(),n=vs(),{sendMessage:r,isStreaming:s,messages:o}=k0(),{org:i}=xt(),a=n?.virtualMcpId,{prompts:l}=I0(i.slug),c=a??null;let u;t[0]!==i.id||t[1]!==i.slug||t[2]!==c?(u={connectionId:c,orgId:i.id,orgSlug:i.slug},t[0]=i.id,t[1]=i.slug,t[2]=c,t[3]=u):u=t[3];const d=gl(u),[f,h]=L.useState(null);if(!a||s||!e0(a)||!o.some(XT))return null;let y;if(t[4]!==l||t[5]!==a){let E;t[7]!==a?(E=j=>j.agentId===a&&j.promptName,t[7]=a,t[8]=E):E=t[8],y=l.find(E),t[4]=l,t[5]=a,t[6]=y}else y=t[6];const g=y;if(!g)return null;let x;t[9]!==d||t[10]!==r||t[11]!==e?(x=async(E,j)=>{if(!d){fa.error(e("chat.nextActionChip.mcpClientNotAvailable"));return}try{const I=await j0(d,E.name,j);await r({type:"doc",content:[{type:"paragraph",content:[um({id:E.name,name:Nl(E.name,wl(E._meta)),metadata:I.messages,char:"/",kind:"prompt",args:j}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),fa.error(e("chat.nextActionChip.failedLoadPrompt"))}},t[9]=d,t[10]=r,t[11]=e,t[12]=x):x=t[12];const b=x;let v;t[13]!==g._meta||t[14]!==g.arguments||t[15]!==g.description||t[16]!==g.promptName||t[17]!==g.title||t[18]!==b?(v=()=>{const E={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(E.arguments&&E.arguments.length>0){h(E);return}b(E)},t[13]=g._meta,t[14]=g.arguments,t[15]=g.description,t[16]=g.promptName,t[17]=g.title,t[18]=b,t[19]=v):v=t[19];const k=v;let N;t[20]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(U1,{size:12,className:"shrink-0 text-purple-500"}),t[20]=N):N=t[20];let C;t[21]!==e?(C=e("chat.nextActionChip.next"),t[21]=e,t[22]=C):C=t[22];let S;t[23]!==C?(S=p.jsx("span",{className:"font-medium text-foreground/80",children:C}),t[23]=C,t[24]=S):S=t[24];let w;t[25]!==g.title?(w=p.jsx("span",{className:"truncate",children:g.title}),t[25]=g.title,t[26]=w):w=t[26];let M;t[27]===Symbol.for("react.memo_cache_sentinel")?(M=p.jsx(Pf,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),t[27]=M):M=t[27];let T;t[28]!==k||t[29]!==S||t[30]!==w?(T=p.jsxs("button",{type:"button",onClick:k,className:"group mt-3 flex items-center gap-2 self-start rounded-full border border-border bg-background px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:border-border hover:bg-accent/40 hover:text-foreground",children:[N,S,w,M]}),t[28]=k,t[29]=S,t[30]=w,t[31]=T):T=t[31];let O;t[32]===Symbol.for("react.memo_cache_sentinel")?(O=E=>h(E),t[32]=O):O=t[32];let A;t[33]!==f||t[34]!==b?(A=async E=>{const j=f;h(null),j&&await b(j,E)},t[33]=f,t[34]=b,t[35]=A):A=t[35];let P;t[36]!==f||t[37]!==A?(P=p.jsx(ay,{prompt:f,setPrompt:O,onSubmit:A}),t[36]=f,t[37]=A,t[38]=P):P=t[38];let D;return t[39]!==T||t[40]!==P?(D=p.jsxs(p.Fragment,{children:[T,P]}),t[39]=T,t[40]=P,t[41]=D):D=t[41],D}function XT(t){return t.role==="user"||t.parts.some(QT)}function QT(t){return t.type==="tool-user_ask"&&t.state==="output-available"}function ZT(t){const e=new Map;for(let n=t.length-1;n>=0;n--){const r=t[n]?.parts;if(r)for(const s of r){const o=s;if(o.type!=="data-deck-updated")continue;const i=o.data;if(!i?.path)continue;const a=`deck:${i.path}`;e.has(a)||e.set(a,{tabId:I1(i.path),label:i.name||i.path,kind:i.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function e3(){const t=_.c(9),{openPanel:e}=kl(),n=wr()?.messages??[],r=ZT(n);if(r.length===0)return null;const s=r.some(n3),o=r.some(t3),i=s?o?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",a="flex flex-col gap-1.5 py-2";let l;t[0]!==i?(l=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:i}),t[0]=i,t[1]=l):l=t[1];const c="flex flex-wrap gap-2";let u;t[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e(m.tabId),className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/30 hover:bg-muted/60 text-[13px] transition-colors",children:[m.kind==="deck"?p.jsx(K0,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(q0,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),t[2]=e,t[3]=u):u=t[3];const d=r.map(u);let f;t[4]!==d?(f=p.jsx("div",{className:c,children:d}),t[4]=d,t[5]=f):f=t[5];let h;return t[6]!==l||t[7]!==f?(h=p.jsxs("div",{className:a,children:[l,f]}),t[6]=l,t[7]=f,t[8]=h):h=t[8],h}function t3(t){return t.kind==="page"}function n3(t){return t.kind==="deck"}async function r3(t,e){const n=await fetch(`/api/${e}/threads/${encodeURIComponent(t)}/outputs`,{credentials:"include"});if(!n.ok)throw new Error(`Failed to fetch thread outputs: ${n.status}`);return(await n.json()).objects??[]}function mA(){const t=_.c(2),e=wr()?.messages??[];let n;return t[0]!==e?(n=e.some(s3),t[0]=e,t[1]=n):n=t[1],n}function s3(t){return t.parts?.some(o3)}function o3(t){const e=t;return(e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function i3(t,e){const n=_.c(9),{org:r}=xt();let s;n[0]!==t?(s=ht.threadOutputs(t??""),n[0]=t,n[1]=s):s=n[1];let o;n[2]!==r||n[3]!==t?(o=()=>r3(t??"",r.slug),n[2]=r,n[3]=t,n[4]=o):o=n[4];const i=!!t&&(e?.enabled??!0);let a;return n[5]!==s||n[6]!==o||n[7]!==i?(a={queryKey:s,queryFn:o,enabled:i,staleTime:0},n[5]=s,n[6]=o,n[7]=i,n[8]=a):a=n[8],ni(a)}function a3(t){const e=_.c(29),{file:n}=t,r=J(),{openPanel:s}=kl();let o;e[0]!==n.key||e[1]!==s?(o=()=>s(j1(n.key)),e[0]=n.key,e[1]=s,e[2]=o):o=e[2];const i=o;let a;e[3]!==n.filename?(a=p.jsx(Y0,{filename:n.filename,className:"h-5 w-4 shrink-0"}),e[3]=n.filename,e[4]=a):a=e[4];let l;e[5]!==n.filename||e[6]!==i?(l=p.jsx("button",{type:"button",onClick:i,className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-foreground hover:underline",title:n.filename,children:n.filename}),e[5]=n.filename,e[6]=i,e[7]=l):l=e[7];const c=n.downloadUrl,u=n.filename;let d;e[8]!==r?(d=r("chat.outputFileRow.download"),e[8]=r,e[9]=d):d=e[9];let f;e[10]!==n.filename||e[11]!==r?(f=r("chat.outputFileRow.downloadFile",{filename:n.filename}),e[10]=n.filename,e[11]=r,e[12]=f):f=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(J0,{className:"size-3.5"}),e[13]=h):h=e[13];let m;e[14]!==n.downloadUrl||e[15]!==n.filename||e[16]!==d||e[17]!==f?(m=p.jsx("a",{href:c,download:u,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:d,"aria-label":f,children:h}),e[14]=n.downloadUrl,e[15]=n.filename,e[16]=d,e[17]=f,e[18]=m):m=e[18];let y;e[19]!==r?(y=r("chat.outputFileRow.open"),e[19]=r,e[20]=y):y=e[20];let g;e[21]!==i||e[22]!==y?(g=p.jsx(Ln,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:y}),e[21]=i,e[22]=y,e[23]=g):g=e[23];let x;return e[24]!==g||e[25]!==a||e[26]!==l||e[27]!==m?(x=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[a,l,m,g]}),e[24]=g,e[25]=a,e[26]=l,e[27]=m,e[28]=x):x=e[28],x}function l3(t){return t.split("/").pop()??t}const c3=/(^|\/)output\//;function u3(t){const e=new Set;for(const n of t.parts??[]){const r=n;if(r.state==="output-available"&&r.type==="tool-write"){const s=r.input?.path;s&&c3.test(s)&&e.add(l3(s))}}return e}function d3(t){const e=_.c(4),{threadId:n,message:r}=t,s=u3(r),o=s.size>0;let i;e[0]!==o?(i={enabled:o},e[0]=o,e[1]=i):i=e[1];const{data:a}=i3(n,i);if(s.size===0)return null;const l=(a??[]).filter(f=>s.has(f.filename));if(l.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=l.map(f3);let d;return e[2]!==u?(d=p.jsx("div",{className:c,children:u}),e[2]=u,e[3]=d):d=e[3],d}function f3(t){return p.jsx(a3,{file:t},t.key)}function h3(t){return t.type==="reasoning"}function p3(t){const e=[],n=new Set,r=new Map,s=new Map,o=new Map;if(t){let a=null;for(let l=0;l<t.parts.length;l++){const c=t.parts[l];if(h3(c)){a||(a={parts:[],startIndex:l},e.push(a)),a.parts.push(c),n.add(l);continue}if(a=null,c.type==="data-tool-metadata"&&"id"in c&&"data"in c){const u=c.data,d={};u.annotations&&(d.annotations=u.annotations),typeof u.latencyMs=="number"&&Number.isFinite(u.latencyMs)&&(d.latencySeconds=u.latencyMs/1e3),typeof u.outputBytes=="number"&&Number.isFinite(u.outputBytes)&&u.outputBytes>=0&&(d.outputBytes=u.outputBytes),u._meta&&typeof u._meta=="object"&&(d._meta=u._meta),r.set(c.id,d);continue}if(c.type==="data-tool-subtask-metadata"&&"id"in c){s.set(c.id,c.data);continue}if(c.type==="data-web-search"&&"id"in c&&"data"in c){const u=c.id,d=c.data;o.set(u,d.text??"");continue}}}const i=[];if(t)for(let a=0;a<t.parts.length;a++){const l=t.parts[a];if(l.type!=="step-start"){if(n.has(a)){const c=e.find(u=>u.startIndex===a);c&&i.push({kind:"reasoning-group",group:c});continue}l.type.startsWith("data-")||i.push({kind:"part",index:a})}}return{reasoningGroups:e,renderOrder:i,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:o}}}const m3=3;function g3(t,e){let n=-1;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.kind==="part"&&e[s.index]?.type==="text"){n=r;break}}return n===-1?{collapsed:[],tail:t}:{collapsed:t.slice(0,n),tail:t.slice(n)}}function y3(t,e){let n=0,r=0;for(const s of t)if(s.kind==="reasoning-group")r++;else{const o=e[s.index]?.type;o==="text"?r++:(o==="dynamic-tool"||o?.startsWith("tool-"))&&o!=="tool-todo_write"&&o!=="tool-update_interests"&&n++}return{toolCalls:n,messages:r}}function x3(t){const e=_.c(10),{toolCalls:n,messages:r}=t,s=J();let o;e[0]!==r||e[1]!==s||e[2]!==n?(o=n>0&&p.jsxs(p.Fragment,{children:[p.jsx(jf,{className:"size-3.5 shrink-0"}),p.jsxs("span",{children:[s("chat.assistant.toolCallPlural",{count:n}),r>0?",":""]})]}),e[0]=r,e[1]=s,e[2]=n,e[3]=o):o=e[3];let i;e[4]!==r||e[5]!==s?(i=r>0&&p.jsxs(p.Fragment,{children:[p.jsx(q1,{className:"size-3.5 shrink-0"}),p.jsx("span",{children:s("chat.assistant.messagePlural",{count:r})})]}),e[4]=r,e[5]=s,e[6]=i):i=e[6];let a;return e[7]!==o||e[8]!==i?(a=p.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[o,i]}),e[7]=o,e[8]=i,e[9]=a):a=e[9],a}function b3(t){const e=_.c(28),{items:n,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:a,isLoading:l,isLast:c}=t;let u;e[0]!==n||e[1]!==r.parts?(u=y3(n,r.parts),e[0]=n,e[1]=r.parts,e[2]=u):u=e[2];const{toolCalls:d,messages:f}=u;if(d===0&&f===0)return null;let h;e[3]!==f||e[4]!==d?(h=p.jsx(x3,{toolCalls:d,messages:f}),e[3]=f,e[4]=d,e[5]=h):h=e[5];let m;if(e[6]!==a||e[7]!==c||e[8]!==l||e[9]!==o||e[10]!==n||e[11]!==r||e[12]!==s||e[13]!==i){let x;e[15]!==a||e[16]!==c||e[17]!==l||e[18]!==o||e[19]!==r||e[20]!==s||e[21]!==i?(x=(b,v)=>Hg({item:b,renderIndex:v,message:r,reasoningGroups:s,isReasoningActive:o,totalDuration:i,dataParts:a,isLoading:l,isLast:c,isLastVisiblePart:!1}),e[15]=a,e[16]=c,e[17]=l,e[18]=o,e[19]=r,e[20]=s,e[21]=i,e[22]=x):x=e[22],m=n.map(x),e[6]=a,e[7]=c,e[8]=l,e[9]=o,e[10]=n,e[11]=r,e[12]=s,e[13]=i,e[14]=m}else m=e[14];let y;e[23]!==m?(y=p.jsx("div",{className:"flex flex-col gap-3 sm:gap-2 pt-1",children:m}),e[23]=m,e[24]=y):y=e[24];let g;return e[25]!==h||e[26]!==y?(g=p.jsx(ne,{icon:null,alwaysChevron:!0,title:h,state:"idle",children:y}),e[25]=h,e[26]=y,e[27]=g):g=e[27],g}function Hg({item:t,renderIndex:e,message:n,reasoningGroups:r,isReasoningActive:s,totalDuration:o,dataParts:i,isLoading:a,isLast:l,isLastVisiblePart:c,renderOrder:u}){if(t.kind==="reasoning-group"){const{group:m}=t,y=m===r[r.length-1],g=s&&y;if(!m.parts.some(v=>v.text?.trim())&&!g)return null;const b=r.length===1?o:null;return p.jsx(wM,{duration:b,parts:m.parts,isStreaming:g},`${n.id}-reasoning-${m.startIndex}`)}const d=n.parts[t.index],f=c||(u?u.findLastIndex(m=>m.kind==="part")===e:!1),h=f?Wf(Hf(),n.metadata?.usage):null;return p.jsx(v3,{part:d,id:n.id,usageStats:f&&p.jsx(iM,{usage:h,duration:o}),dataParts:i,isLoading:a,isLastMessage:l},`${n.id}-${t.index}`)}function v3(t){const e=_.c(115),{part:n,id:r,usageStats:s,dataParts:o,isLoading:i,isLastMessage:a}=t;let l;e[0]!==o.toolMetadata?(l=f=>o.toolMetadata.get(f),e[0]=o.toolMetadata,e[1]=l):l=e[1];const c=l;let u;e[2]!==o.toolSubtaskMetadata?(u=f=>o.toolSubtaskMetadata.get(f),e[2]=o.toolSubtaskMetadata,e[3]=u):u=e[3];const d=u;switch(n.type){case"dynamic-tool":{let f;e[4]!==c||e[5]!==n.toolCallId?(f=c(n.toolCallId)?.annotations,e[4]=c,e[5]=n.toolCallId,e[6]=f):f=e[6];let h;e[7]!==c||e[8]!==n.toolCallId?(h=c(n.toolCallId)?.latencySeconds,e[7]=c,e[8]=n.toolCallId,e[9]=h):h=e[9];let m;e[10]!==c||e[11]!==n.toolCallId?(m=c(n.toolCallId)?.outputBytes,e[10]=c,e[11]=n.toolCallId,e[12]=m):m=e[12];let y;e[13]!==c||e[14]!==n.toolCallId?(y=c(n.toolCallId)?._meta,e[13]=c,e[14]=n.toolCallId,e[15]=y):y=e[15];let g;return e[16]!==a||e[17]!==n||e[18]!==f||e[19]!==h||e[20]!==m||e[21]!==y?(g=p.jsx(Gd,{part:n,annotations:f,latency:h,outputBytes:m,isLastMessage:a,toolMeta:y}),e[16]=a,e[17]=n,e[18]=f,e[19]=h,e[20]=m,e[21]=y,e[22]=g):g=e[22],g}case"tool-todo_write":return null;case"tool-update_interests":return null;case"tool-user_ask":{let f;e[23]!==c||e[24]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[23]=c,e[24]=n.toolCallId,e[25]=f):f=e[25];let h;return e[26]!==n||e[27]!==f?(h=p.jsx(pT,{part:n,latency:f}),e[26]=n,e[27]=f,e[28]=h):h=e[28],h}case"tool-propose_plan":{let f;return e[29]!==n?(f=p.jsx(MT,{part:n}),e[29]=n,e[30]=f):f=e[30],f}case"tool-generate_image":{let f;e[31]!==c||e[32]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[31]=c,e[32]=n.toolCallId,e[33]=f):f=e[33];let h;return e[34]!==n||e[35]!==f?(h=p.jsx(tT,{part:n,latency:f}),e[34]=n,e[35]=f,e[36]=h):h=e[36],h}case"tool-web_search":case"tool-deep_research":{let f;e[37]!==c||e[38]!==n.toolCallId?(f=c(n.toolCallId)?.latencySeconds,e[37]=c,e[38]=n.toolCallId,e[39]=f):f=e[39];let h;e[40]!==o.webSearchStreaming||e[41]!==n.toolCallId?(h=o.webSearchStreaming.get(n.toolCallId),e[40]=o.webSearchStreaming,e[41]=n.toolCallId,e[42]=h):h=e[42];let m;return e[43]!==n||e[44]!==f||e[45]!==h?(m=p.jsx(hT,{part:n,latency:f,streamingText:h}),e[43]=n,e[44]=f,e[45]=h,e[46]=m):m=e[46],m}case"tool-subtask":{let f;e[47]!==d||e[48]!==n.toolCallId?(f=d(n.toolCallId),e[47]=d,e[48]=n.toolCallId,e[49]=f):f=e[49];let h;e[50]!==c||e[51]!==n.toolCallId?(h=c(n.toolCallId)?.annotations,e[50]=c,e[51]=n.toolCallId,e[52]=h):h=e[52];let m;e[53]!==c||e[54]!==n.toolCallId?(m=c(n.toolCallId)?.latencySeconds,e[53]=c,e[54]=n.toolCallId,e[55]=m):m=e[55];let y;e[56]!==n||e[57]!==f||e[58]!==h||e[59]!==m?(y={part:n,subtaskMeta:f,annotations:h,latency:m},e[56]=n,e[57]=f,e[58]=h,e[59]=m,e[60]=y):y=e[60];const g=y;let x;return e[61]!==g?(x=p.jsx(L.Suspense,{fallback:p.jsx(wT,{...g}),children:p.jsx(NT,{...g})}),e[61]=g,e[62]=x):x=e[62],x}case"text":{const f=!!s&&!i,h=i&&a;let m;return e[63]!==r||e[64]!==n||e[65]!==f||e[66]!==h||e[67]!==s?(m=p.jsx(gi,{id:r,part:n,extraActions:s,copyable:!0,alwaysShowActions:f,animate:h}),e[63]=r,e[64]=n,e[65]=f,e[66]=h,e[67]=s,e[68]=m):m=e[68],m}case"reasoning":return null;case"step-start":case"file":case"source-url":case"source-document":return null;case"data-tool-metadata":case"data-tool-subtask-metadata":case"data-generate-image":case"data-web-search":return null;default:{const f=n;if(f.type==="tool-brand_context_setup"||f.type==="tool-BRAND_CONTEXT_EXTRACT"){let h;e[69]!==f.toolCallId||e[70]!==c?(h=c(f.toolCallId)?.latencySeconds,e[69]=f.toolCallId,e[70]=c,e[71]=h):h=e[71];let m;return e[72]!==f||e[73]!==h?(m=p.jsx(RT,{part:f,latency:h}),e[72]=f,e[73]=h,e[74]=m):m=e[74],m}if(f.type==="tool-BRAND_CONTEXT_GET"){let h;e[75]!==f.toolCallId||e[76]!==c?(h=c(f.toolCallId)?.latencySeconds,e[75]=f.toolCallId,e[76]=c,e[77]=h):h=e[77];let m;return e[78]!==f||e[79]!==h?(m=p.jsx(PT,{part:f,latency:h}),e[78]=f,e[79]=h,e[80]=m):m=e[80],m}if(f.type==="tool-BRAND_CONTEXT_LIST"){let h;e[81]!==f.toolCallId||e[82]!==c?(h=c(f.toolCallId)?.latencySeconds,e[81]=f.toolCallId,e[82]=c,e[83]=h):h=e[83];let m;return e[84]!==f||e[85]!==h?(m=p.jsx(LT,{part:f,latency:h}),e[84]=f,e[85]=h,e[86]=m):m=e[86],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_CREATE"){let h;e[87]!==f.toolCallId||e[88]!==c?(h=c(f.toolCallId)?.latencySeconds,e[87]=f.toolCallId,e[88]=c,e[89]=h):h=e[89];let m;return e[90]!==f||e[91]!==h?(m=p.jsx(BT,{part:f,latency:h}),e[90]=f,e[91]=h,e[92]=m):m=e[92],m}if(f.type==="tool-COLLECTION_VIRTUAL_MCP_LIST"){let h;e[93]!==f.toolCallId||e[94]!==c?(h=c(f.toolCallId)?.latencySeconds,e[93]=f.toolCallId,e[94]=c,e[95]=h):h=e[95];let m;return e[96]!==f||e[97]!==h?(m=p.jsx(WT,{part:f,latency:h}),e[96]=f,e[97]=h,e[98]=m):m=e[98],m}if(f.type==="tool-COLLECTION_CONNECTIONS_LIST"){let h;e[99]!==f.toolCallId||e[100]!==c?(h=c(f.toolCallId)?.latencySeconds,e[99]=f.toolCallId,e[100]=c,e[101]=h):h=e[101];let m;return e[102]!==f||e[103]!==h?(m=p.jsx(KT,{part:f,latency:h}),e[102]=f,e[103]=h,e[104]=m):m=e[104],m}if(f.type.startsWith("tool-")){const h=f.toolCallId;let m;e[105]!==o.toolMetadata||e[106]!==h?(m=o.toolMetadata.get(h),e[105]=o.toolMetadata,e[106]=h,e[107]=m):m=e[107];const y=m,g=y?.annotations,x=y?.latencySeconds,b=y?.outputBytes,v=y?._meta;let k;return e[108]!==f||e[109]!==a||e[110]!==g||e[111]!==x||e[112]!==b||e[113]!==v?(k=p.jsx(Gd,{part:f,annotations:g,latency:x,outputBytes:b,isLastMessage:a,toolMeta:v}),e[108]=f,e[109]=a,e[110]=g,e[111]=x,e[112]=b,e[113]=v,e[114]=k):k=e[114],k}if(f.type.startsWith("data-"))return null;throw new Error(`Unknown part type: ${f.type}`)}}}function k3(t){const e=_.c(9),{isRunInProgress:n}=t,r=J();if(n){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx(ri,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),e[0]=i):i=e[0];let a;e[1]!==r?(a=r("chat.assistant.resumingTask"),e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==a?(l=p.jsx("div",{className:"flex items-center gap-1.5 py-2 opacity-60",children:p.jsxs("span",{className:"flex items-center gap-1.5",children:[i,p.jsx("span",{className:"text-[14px] text-muted-foreground shimmer",children:a})]})}),e[3]=a,e[4]=l):l=e[4],l}let s;e[5]!==r?(s=r("chat.assistant.noResponseGenerated"),e[5]=r,e[6]=s):s=e[6];let o;return e[7]!==s?(o=p.jsx("div",{className:"text-[14px] text-muted-foreground/60 py-2",children:s}),e[7]=s,e[8]=o):o=e[8],o}function S3(t){const e=_.c(7),{className:n,children:r}=t;let s;e[0]!==n?(s=G("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",n),e[0]=n,e[1]=s):s=e[1];let o;e[2]!==r?(o=p.jsx("div",{className:"flex flex-col min-w-0 w-full items-start",children:p.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-[14px] wrap-break-word overflow-wrap-anywhere bg-transparent",children:r})}),e[2]=r,e[3]=o):o=e[3];let i;return e[4]!==s||e[5]!==o?(i=p.jsx("div",{className:s,children:o}),e[4]=s,e[5]=o,e[6]=i):i=e[6],i}function C3(t){const e=_.c(32),{message:n,turnStartedAt:r,status:s,className:o,isLast:i}=t,a=i===void 0?!1:i,l=J(),{isRunInProgress:c}=wr()??{},u=c===void 0?!1:c,d=vs()?.taskId??null,f=s==="streaming",m=f||s==="submitted";let y;e[0]!==r?(y=bl(r),e[0]=r,e[1]=y):y=e[1];const g=y;let x;e[2]!==m?(x=()=>m?Date.now():null,e[2]=m,e[3]=x):x=e[3];const[b,v]=L.useState(x),[k,N]=L.useState(m);k!==m&&(N(m),v(m?Date.now():null));const C=g??b,{reasoningGroups:S,renderOrder:w,dataParts:M}=p3(n),T=n!==null&&w.length>0,O=n&&n.parts.length>0?n.parts[n.parts.length-1]:null,A=f&&O?.type==="reasoning";let P;if(e[4]!==n){const W=n?.metadata?.reasoning_start_at?new Date(n.metadata.reasoning_start_at):null,q=n?.metadata?.reasoning_end_at?new Date(n.metadata.reasoning_end_at):new Date;P=W!==null?q.getTime()-W.getTime():null,e[4]=n,e[5]=P}else P=e[5];const D=P;let E;e[6]!==a||e[7]!==n?(E=!a||!n||!n.parts.some(N3),e[6]=a,e[7]=n,e[8]=E):E=e[8];const j=E;let I;e[9]!==T||e[10]!==m||e[11]!==j||e[12]!==n||e[13]!==w?(I=!m&&T&&j&&(()=>{let W=0;for(const q of w)if(q.kind==="part"){const X=n.parts[q.index]?.type;(X==="dynamic-tool"||X?.startsWith("tool-"))&&W++}return W>=m3})(),e[9]=T,e[10]=m,e[11]=j,e[12]=n,e[13]=w,e[14]=I):I=e[14];const R=I;let z;if(e[15]!==o||e[16]!==M||e[17]!==T||e[18]!==a||e[19]!==m||e[20]!==A||e[21]!==u||e[22]!==j||e[23]!==n||e[24]!==S||e[25]!==w||e[26]!==R||e[27]!==C||e[28]!==l||e[29]!==d||e[30]!==D){const{collapsed:W,tail:q}=R?g3(w,n.parts):{collapsed:[],tail:w};z=p.jsx(S3,{className:o,children:T?p.jsxs("div",{className:"flex flex-col gap-3 sm:gap-2",children:[n.metadata?.resumedFromBackground&&p.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground/60 select-none",children:[p.jsx(xf,{className:"size-3 shrink-0"}),p.jsx("span",{children:l("chat.assistant.resumedBackgroundTask")})]}),W.length>0&&p.jsx(b3,{items:W,message:n,reasoningGroups:S,isReasoningActive:A,totalDuration:D,dataParts:M,isLoading:m,isLast:a}),q.map((X,te)=>{const ae=W.length+te,fe=q.findLastIndex(w3)===te;return Hg({item:X,renderIndex:ae,message:n,reasoningGroups:S,isReasoningActive:A,totalDuration:D,dataParts:M,isLoading:m,isLast:a,isLastVisiblePart:fe,renderOrder:w})}),d&&p.jsx(d3,{threadId:d,message:n}),a&&m&&C!==null&&p.jsx(kM,{startedAt:C}),a&&!m&&d&&p.jsxs(p.Fragment,{children:[p.jsx(e3,{}),j&&p.jsx(GT,{})]}),!m&&p.jsx(Ng,{message:n})]}):m?p.jsx(CM,{startedAt:C}):p.jsx(k3,{isRunInProgress:a&&u})}),e[15]=o,e[16]=M,e[17]=T,e[18]=a,e[19]=m,e[20]=A,e[21]=u,e[22]=j,e[23]=n,e[24]=S,e[25]=w,e[26]=R,e[27]=C,e[28]=l,e[29]=d,e[30]=D,e[31]=z}else z=e[31];return z}function w3(t){return t.kind==="part"}function N3(t){const e=t.type;if(e!=="dynamic-tool"&&!e?.startsWith("tool-"))return!1;const n=t.state;return n==="input-streaming"||n==="input-available"||n==="approval-requested"}function M3(t){const e=_.c(25),{event:n}=t,r=J(),[s,o]=L.useState(!1);let i;e[0]!==n.data?(i=JSON.stringify(n.data,null,2),e[0]=n.data,e[1]=i):i=e[1];const a=i;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(T3),e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(K1,{className:"size-4 shrink-0 text-muted-foreground"}),e[3]=c):c=e[3];let u;e[4]!==r?(u=r("chat.triggerEventPart.triggeredByEvent"),e[4]=r,e[5]=u):u=e[5];let d;e[6]!==u?(d=p.jsx("span",{className:"font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let f;e[8]!==n.type?(f=p.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:n.type}),e[8]=n.type,e[9]=f):f=e[9];const h=s&&"rotate-180";let m;e[10]!==h?(m=G("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",h),e[10]=h,e[11]=m):m=e[11];let y;e[12]!==m?(y=p.jsx(If,{className:m}),e[12]=m,e[13]=y):y=e[13];let g;e[14]!==d||e[15]!==f||e[16]!==y?(g=p.jsxs("button",{type:"button",onClick:l,className:"flex w-full items-center gap-2 px-3 py-2 text-sm cursor-pointer",children:[c,d,f,y]}),e[14]=d,e[15]=f,e[16]=y,e[17]=g):g=e[17];let x;e[18]!==n.source||e[19]!==s||e[20]!==a?(x=s&&p.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[p.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:n.source}),p.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-words text-xs text-foreground",children:a})]}),e[18]=n.source,e[19]=s,e[20]=a,e[21]=x):x=e[21];let b;return e[22]!==g||e[23]!==x?(b=p.jsxs("div",{className:"rounded-lg border border-border/60 bg-background overflow-hidden text-left",children:[g,x]}),e[22]=g,e[23]=x,e[24]=b):b=e[24],b}function T3(t){return!t}const E3=[oM.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),KS,XS];function D3(t){const e=_.c(5),{tiptapDoc:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={attributes:{class:"prose prose-sm max-w-none focus:outline-none"}},e[0]=r):r=e[0];let s;e[1]!==n?(s={extensions:E3,content:n,editable:!1,editorProps:r},e[1]=n,e[2]=s):s=e[2];const o=LS(s);if(!o)return null;let i;return e[3]!==o?(i=p.jsx(nm,{editor:o,className:"[&_.ProseMirror]:outline-none [&_.ProseMirror]:cursor-text"}),e[3]=o,e[4]=i):i=e[4],i}function O3(t){const e=_.c(38),{message:n,className:r,onScrollToPair:s}=t,{id:o,parts:i,metadata:a}=n,[l,c]=L.useState(!1),[u,d]=L.useState(!1),f=L.useRef(!1);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=E=>{E&&!f.current&&(f.current=!0,d(E.scrollHeight>E.clientHeight))},e[0]=h):h=e[0];const m=h;if(!i||i.length===0)return null;let y;e[1]!==s?(y=()=>{c(!0),s?.()},e[1]=s,e[2]=y):y=e[2];const g=y,x=a?.tiptapDoc;let b;e[3]!==r?(b=G("message-block w-full min-w-0 relative flex items-start gap-4 px-2.5 text-foreground flex-row-reverse",r),e[3]=r,e[4]=b):b=e[4];let v,k;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=()=>c(!0),k=()=>c(!1),e[5]=v,e[6]=k):(v=e[5],k=e[6]);let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx("div",{className:"absolute inset-0 bg-muted/75 rounded-lg pointer-events-none"}),e[7]=N):N=e[7];let C;e[8]!==l||e[9]!==u?(C=G("z-10 px-4 py-2 flex-1 transition-[max-height,opacity] duration-300 ease-out",l?"max-h-[50vh] overflow-auto opacity-100":G("max-h-[84px] overflow-hidden opacity-99",u&&"mask-b-from-1%")),e[8]=l,e[9]=u,e[10]=C):C=e[10];let S;if(e[11]!==o||e[12]!==i){let E;e[14]!==o?(E=(j,I)=>j.type==="data-trigger-event"?p.jsx(M3,{event:j.data},`${o}-${I}`):null,e[14]=o,e[15]=E):E=e[15],S=i.map(E),e[11]=o,e[12]=i,e[13]=S}else S=e[13];let w;e[16]!==x||e[17]!==o||e[18]!==a||e[19]!==i?(w=x?p.jsx(D3,{tiptapDoc:a.tiptapDoc}):i.map((E,j)=>E.type==="text"?i[j-1]?.type==="data-trigger-event"?null:p.jsx(gi,{id:o,part:E},`${o}-${j}`):null),e[16]=x,e[17]=o,e[18]=a,e[19]=i,e[20]=w):w=e[20];let M;e[21]!==S||e[22]!==w?(M=p.jsxs("div",{className:"flex flex-col gap-2",children:[S,w]}),e[21]=S,e[22]=w,e[23]=M):M=e[23];let T;e[24]!==M||e[25]!==C?(T=p.jsx("div",{ref:m,className:C,children:M}),e[24]=M,e[25]=C,e[26]=T):T=e[26];let O;e[27]!==g||e[28]!==T?(O=p.jsxs("div",{tabIndex:0,onClick:g,onFocus:v,onBlur:k,className:"w-full border border-border/60 min-w-0 shadow-xs rounded-lg text-[14px] wrap-break-word overflow-wrap-anywhere bg-background cursor-pointer transition-colors relative flex outline-none",children:[N,T]}),e[27]=g,e[28]=T,e[29]=O):O=e[29];let A;e[30]!==n?(A=p.jsx(Ng,{message:n,className:"mt-1 mr-1 self-end"}),e[30]=n,e[31]=A):A=e[31];let P;e[32]!==O||e[33]!==A?(P=p.jsxs("div",{className:"w-full min-w-0 flex flex-col",children:[O,A]}),e[32]=O,e[33]=A,e[34]=P):P=e[34];let D;return e[35]!==P||e[36]!==b?(D=p.jsx(p.Fragment,{children:p.jsx("div",{className:b,children:P})}),e[35]=P,e[36]=b,e[37]=D):D=e[37],D}function A3(t){const e=[],n=t.filter(r=>r.role!=="system"&&!r.metadata?.internal&&!r.metadata?.subtaskJobId);for(let r=0;r<n.length;r++){const s=n[r];if(s)if(s.role==="user"){const o=n[r+1];o&&o.role==="assistant"?(e.push({user:s,assistant:o}),r++):e.push({user:s,assistant:null})}else s.role==="assistant"&&e.push({user:null,assistant:s})}return e}function I3(t){const e=_.c(19),{pair:n,isLastPair:r,status:s}=t,o=L.useRef(null),i=L.useRef(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})},e[0]=a):a=e[0];const l=a;let c;e[1]!==r||e[2]!==n.assistant?.metadata?.resumedFromBackground||e[3]!==s?(c=x=>{if(o.current=x,!r||!x||i.current||(i.current=!0,n.assistant?.metadata?.resumedFromBackground))return;if(s==="submitted"||s==="streaming"){x.scrollIntoView({behavior:"smooth",block:"start"});return}const b=x.closest("[data-chat-scroller]");b?b.scrollTop=b.scrollHeight:x.scrollIntoView({behavior:"instant",block:"start"})},e[1]=r,e[2]=n.assistant?.metadata?.resumedFromBackground,e[3]=s,e[4]=c):c=e[4];const u=c,d=!n.user&&"pt-8 sm:pt-6";let f;e[5]!==d?(f=G("flex flex-col pb-2 sm:pb-2",d),e[5]=d,e[6]=f):f=e[6];let h;e[7]!==n.user?(h=n.user&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"sticky top-0 z-50 w-full h-4 bg-background"}),p.jsx("div",{className:"sticky mb-8 sm:mb-6 top-4 z-50",children:p.jsx(O3,{message:n.user,onScrollToPair:l})})]}),e[7]=n.user,e[8]=h):h=e[8];const m=n.user?.created_at??null;let y;e[9]!==r||e[10]!==n.assistant||e[11]!==s||e[12]!==m?(y=p.jsx(C3,{message:n.assistant,turnStartedAt:m,status:s,isLast:r}),e[9]=r,e[10]=n.assistant,e[11]=s,e[12]=m,e[13]=y):y=e[13];let g;return e[14]!==u||e[15]!==f||e[16]!==h||e[17]!==y?(g=p.jsxs("div",{ref:u,className:f,children:[h,y]}),e[14]=u,e[15]=f,e[16]=h,e[17]=y,e[18]=g):g=e[18],g}function re(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function nt(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function We(t,e){const n=re(t);return isNaN(e)?nt(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function gt(t,e){const n=re(t);if(isNaN(e))return nt(t,NaN);if(!e)return n;const r=n.getDate(),s=nt(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const o=s.getDate();return r>=o?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const Oc=6048e5,j3=864e5;let R3={};function Os(){return R3}function At(t,e){const n=Os(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=re(t),o=s.getDay(),i=(o<r?7:0)+o-r;return s.setDate(s.getDate()-i),s.setHours(0,0,0,0),s}function qn(t){return At(t,{weekStartsOn:1})}function Wg(t){const e=re(t),n=e.getFullYear(),r=nt(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=qn(r),o=nt(t,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const i=qn(o);return e.getTime()>=s.getTime()?n+1:e.getTime()>=i.getTime()?n:n-1}function Cr(t){const e=re(t);return e.setHours(0,0,0,0),e}function ei(t){const e=re(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Tt(t,e){const n=Cr(t),r=Cr(e),s=+n-ei(n),o=+r-ei(r);return Math.round((s-o)/j3)}function P3(t){const e=Wg(t),n=nt(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),qn(n)}function cl(t,e){const n=e*7;return We(t,n)}function L3(t,e){return gt(t,e*12)}function $3(t){let e;return t.forEach(function(n){const r=re(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function _3(t){let e;return t.forEach(n=>{const r=re(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function Ge(t,e){const n=Cr(t),r=Cr(e);return+n==+r}function Ac(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function B3(t){if(!Ac(t)&&typeof t!="number")return!1;const e=re(t);return!isNaN(Number(e))}function bs(t,e){const n=re(t),r=re(e),s=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return s*12+o}function z3(t,e,n){const r=At(t,n),s=At(e,n),o=+r-ei(r),i=+s-ei(s);return Math.round((o-i)/Oc)}function Ic(t){const e=re(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Ze(t){const e=re(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Vg(t){const e=re(t),n=nt(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jc(t,e){const n=Os(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=re(t),o=s.getDay(),i=(o<r?-7:0)+6-(o-r);return s.setDate(s.getDate()+i),s.setHours(23,59,59,999),s}function Ug(t){return jc(t,{weekStartsOn:1})}const F3={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},H3=(t,e,n)=>{let r;const s=F3[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function oa(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const W3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},V3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},U3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},q3={date:oa({formats:W3,defaultWidth:"full"}),time:oa({formats:V3,defaultWidth:"full"}),dateTime:oa({formats:U3,defaultWidth:"full"})},K3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},J3=(t,e,n,r)=>K3[t];function Rr(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):i;s=t.formattingValues[a]||t.formattingValues[i]}else{const i=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;s=t.values[a]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(e):e;return s[o]}}const Y3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},G3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},X3={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Q3={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Z3={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},eE={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tE=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},nE={ordinalNumber:tE,era:Rr({values:Y3,defaultWidth:"wide"}),quarter:Rr({values:G3,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Rr({values:X3,defaultWidth:"wide"}),day:Rr({values:Q3,defaultWidth:"wide"}),dayPeriod:Rr({values:Z3,defaultWidth:"wide",formattingValues:eE,defaultFormattingWidth:"wide"})};function Pr(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(s);if(!o)return null;const i=o[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?sE(a,d=>d.test(i)):rE(a,d=>d.test(i));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(i.length);return{value:c,rest:u}}}function rE(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function sE(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function oE(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],o=e.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const a=e.slice(s.length);return{value:i,rest:a}}}const iE=/^(\d+)(th|st|nd|rd)?/i,aE=/\d+/i,lE={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},cE={any:[/^b/i,/^(a|c)/i]},uE={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},dE={any:[/1/i,/2/i,/3/i,/4/i]},fE={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},hE={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pE={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},mE={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},gE={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},yE={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xE={ordinalNumber:oE({matchPattern:iE,parsePattern:aE,valueCallback:t=>parseInt(t,10)}),era:Pr({matchPatterns:lE,defaultMatchWidth:"wide",parsePatterns:cE,defaultParseWidth:"any"}),quarter:Pr({matchPatterns:uE,defaultMatchWidth:"wide",parsePatterns:dE,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Pr({matchPatterns:fE,defaultMatchWidth:"wide",parsePatterns:hE,defaultParseWidth:"any"}),day:Pr({matchPatterns:pE,defaultMatchWidth:"wide",parsePatterns:mE,defaultParseWidth:"any"}),dayPeriod:Pr({matchPatterns:gE,defaultMatchWidth:"any",parsePatterns:yE,defaultParseWidth:"any"})},qg={code:"en-US",formatDistance:H3,formatLong:q3,formatRelative:J3,localize:nE,match:xE,options:{weekStartsOn:0,firstWeekContainsDate:1}};function bE(t){const e=re(t);return Tt(e,Vg(e))+1}function Kg(t){const e=re(t),n=+qn(e)-+P3(e);return Math.round(n/Oc)+1}function Jg(t,e){const n=re(t),r=n.getFullYear(),s=Os(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,i=nt(t,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const a=At(i,e),l=nt(t,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=At(l,e);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function vE(t,e){const n=Os(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Jg(t,e),o=nt(t,0);return o.setFullYear(s,0,r),o.setHours(0,0,0,0),At(o,e)}function Yg(t,e){const n=re(t),r=+At(n,e)-+vE(n,e);return Math.round(r/Oc)+1}function ie(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Xt={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return ie(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):ie(n+1,2)},d(t,e){return ie(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return ie(t.getHours()%12||12,e.length)},H(t,e){return ie(t.getHours(),e.length)},m(t,e){return ie(t.getMinutes(),e.length)},s(t,e){return ie(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return ie(s,e.length)}},rr={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},tf={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Xt.y(t,e)},Y:function(t,e,n,r){const s=Jg(t,r),o=s>0?s:1-s;if(e==="YY"){const i=o%100;return ie(i,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):ie(o,e.length)},R:function(t,e){const n=Wg(t);return ie(n,e.length)},u:function(t,e){const n=t.getFullYear();return ie(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return ie(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return ie(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Xt.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return ie(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=Yg(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):ie(s,e.length)},I:function(t,e,n){const r=Kg(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):ie(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Xt.d(t,e)},D:function(t,e,n){const r=bE(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ie(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return ie(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),o=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return ie(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return ie(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=rr.noon:r===0?s=rr.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=rr.evening:r>=12?s=rr.afternoon:r>=4?s=rr.morning:s=rr.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Xt.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Xt.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ie(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):ie(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Xt.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Xt.s(t,e)},S:function(t,e){return Xt.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return rf(r);case"XXXX":case"XX":return vn(r);default:return vn(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return rf(r);case"xxxx":case"xx":return vn(r);default:return vn(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+nf(r,":");default:return"GMT"+vn(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+nf(r,":");default:return"GMT"+vn(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return ie(r,e.length)},T:function(t,e,n){const r=t.getTime();return ie(r,e.length)}};function nf(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),o=r%60;return o===0?n+String(s):n+String(s)+e+ie(o,2)}function rf(t,e){return t%60===0?(t>0?"-":"+")+ie(Math.abs(t)/60,2):vn(t,e)}function vn(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=ie(Math.trunc(r/60),2),o=ie(r%60,2);return n+s+e+o}const sf=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Gg=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},kE=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return sf(t,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",sf(r,e)).replace("{{time}}",Gg(s,e))},SE={p:Gg,P:kE},CE=/^D+$/,wE=/^Y+$/,NE=["D","DD","YY","YYYY"];function ME(t){return CE.test(t)}function TE(t){return wE.test(t)}function EE(t,e,n){const r=DE(t,e,n);if(console.warn(r),NE.includes(t))throw new RangeError(r)}function DE(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const OE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,IE=/^'([^]*?)'?$/,jE=/''/g,RE=/[a-zA-Z]/;function Qn(t,e,n){const r=Os(),s=n?.locale??r.locale??qg,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=re(t);if(!B3(a))throw new RangeError("Invalid time value");let l=e.match(AE).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=SE[d];return f(u,s.formatLong)}return u}).join("").match(OE).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:PE(u)};if(tf[d])return{isToken:!0,value:u};if(d.match(RE))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(l=s.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:s};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&TE(d)||!n?.useAdditionalDayOfYearTokens&&ME(d))&&EE(d,e,String(t));const f=tf[d[0]];return f(a,d,s.localize,c)}).join("")}function PE(t){const e=t.match(IE);return e?e[1].replace(jE,"'"):t}function LE(t){const e=re(t),n=e.getFullYear(),r=e.getMonth(),s=nt(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function $E(t){return Math.trunc(+re(t)/1e3)}function _E(t){const e=re(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function BE(t,e){return z3(_E(t),Ze(t),e)+1}function ul(t,e){const n=re(t),r=re(e);return n.getTime()>r.getTime()}function Xg(t,e){const n=re(t),r=re(e);return+n<+r}function Rc(t,e){const n=re(t),r=re(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function zE(t,e){const n=re(t),r=re(e);return n.getFullYear()===r.getFullYear()}function ia(t,e){return We(t,-e)}function aa(t,e){const n=re(t),r=n.getFullYear(),s=n.getDate(),o=nt(t,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const i=LE(o);return n.setMonth(e,Math.min(s,i)),n}function of(t,e){const n=re(t);return isNaN(+n)?nt(t,NaN):(n.setFullYear(e),n)}var K=function(){return K=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},K.apply(this,arguments)};function FE(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Qg(t,e,n){for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function As(t){return t.mode==="multiple"}function Is(t){return t.mode==="range"}function wi(t){return t.mode==="single"}var HE={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function WE(t,e){return Qn(t,"LLLL y",e)}function VE(t,e){return Qn(t,"d",e)}function UE(t,e){return Qn(t,"LLLL",e)}function qE(t){return"".concat(t)}function KE(t,e){return Qn(t,"cccccc",e)}function JE(t,e){return Qn(t,"yyyy",e)}var YE=Object.freeze({__proto__:null,formatCaption:WE,formatDay:VE,formatMonthCaption:UE,formatWeekNumber:qE,formatWeekdayName:KE,formatYearCaption:JE}),GE=function(t,e,n){return Qn(t,"do MMMM (EEEE)",n)},XE=function(){return"Month: "},QE=function(){return"Go to next month"},ZE=function(){return"Go to previous month"},e4=function(t,e){return Qn(t,"cccc",e)},t4=function(t){return"Week n. ".concat(t)},n4=function(){return"Year: "},r4=Object.freeze({__proto__:null,labelDay:GE,labelMonthDropdown:XE,labelNext:QE,labelPrevious:ZE,labelWeekNumber:t4,labelWeekday:e4,labelYearDropdown:n4});function s4(){var t="buttons",e=HE,n=qg,r={},s={},o=1,i={},a=new Date;return{captionLayout:t,classNames:e,formatters:YE,labels:r4,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:o,styles:i,today:a,mode:"default"}}function o4(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,o=t.fromDate,i=t.toDate;return r?o=Ze(r):e&&(o=new Date(e,0,1)),s?i=Ic(s):n&&(i=new Date(n,11,31)),{fromDate:o?Cr(o):void 0,toDate:i?Cr(i):void 0}}var Zg=L.createContext(void 0);function i4(t){var e,n=t.initialProps,r=s4(),s=o4(n),o=s.fromDate,i=s.toDate,a=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;a!=="buttons"&&(!o||!i)&&(a="buttons");var l;(wi(n)||As(n)||Is(n))&&(l=n.onSelect);var c=K(K(K({},r),n),{captionLayout:a,classNames:K(K({},r.classNames),n.classNames),components:K({},n.components),formatters:K(K({},r.formatters),n.formatters),fromDate:o,labels:K(K({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:K(K({},r.modifiers),n.modifiers),modifiersClassNames:K(K({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:K(K({},r.styles),n.styles),toDate:i});return p.jsx(Zg.Provider,{value:c,children:t.children})}function de(){var t=L.useContext(Zg);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function e1(t){var e=de(),n=e.locale,r=e.classNames,s=e.styles,o=e.formatters.formatCaption;return p.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:o(t.displayMonth,{locale:n})})}function a4(t){return p.jsx("svg",K({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:p.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function t1(t){var e,n,r=t.onChange,s=t.value,o=t.children,i=t.caption,a=t.className,l=t.style,c=de(),u=(n=(e=c.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:a4;return p.jsxs("div",{className:a,style:l,children:[p.jsx("span",{className:c.classNames.vhidden,children:t["aria-label"]}),p.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:s,onChange:r,children:o}),p.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[i,p.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function l4(t){var e,n=de(),r=n.fromDate,s=n.toDate,o=n.styles,i=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return p.jsx(p.Fragment,{});if(!s)return p.jsx(p.Fragment,{});var d=[];if(zE(r,s))for(var f=Ze(r),h=r.getMonth();h<=s.getMonth();h++)d.push(aa(f,h));else for(var f=Ze(new Date),h=0;h<=11;h++)d.push(aa(f,h));var m=function(g){var x=Number(g.target.value),b=aa(Ze(t.displayMonth),x);t.onChange(b)},y=(e=c?.Dropdown)!==null&&e!==void 0?e:t1;return p.jsx(y,{name:"months","aria-label":u(),className:l.dropdown_month,style:o.dropdown_month,onChange:m,value:t.displayMonth.getMonth(),caption:a(t.displayMonth,{locale:i}),children:d.map(function(g){return p.jsx("option",{value:g.getMonth(),children:a(g,{locale:i})},g.getMonth())})})}function c4(t){var e,n=t.displayMonth,r=de(),s=r.fromDate,o=r.toDate,i=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,f=[];if(!s)return p.jsx(p.Fragment,{});if(!o)return p.jsx(p.Fragment,{});for(var h=s.getFullYear(),m=o.getFullYear(),y=h;y<=m;y++)f.push(of(Vg(new Date),y));var g=function(b){var v=of(Ze(n),Number(b.target.value));t.onChange(v)},x=(e=c?.Dropdown)!==null&&e!==void 0?e:t1;return p.jsx(x,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:g,value:n.getFullYear(),caption:u(n,{locale:i}),children:f.map(function(b){return p.jsx("option",{value:b.getFullYear(),children:u(b,{locale:i})},b.getFullYear())})})}function u4(t,e){var n=L.useState(t),r=n[0],s=n[1],o=e===void 0?r:e;return[o,s]}function d4(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,o=t.toDate,i=t.fromDate,a=t.numberOfMonths,l=a===void 0?1:a;if(o&&bs(o,s)<0){var c=-1*(l-1);s=gt(o,c)}return i&&bs(s,i)<0&&(s=i),Ze(s)}function f4(){var t=de(),e=d4(t),n=u4(e,t.month),r=n[0],s=n[1],o=function(i){var a;if(!t.disableNavigation){var l=Ze(i);s(l),(a=t.onMonthChange)===null||a===void 0||a.call(t,l)}};return[r,o]}function h4(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=Ze(t),o=Ze(gt(s,r)),i=bs(o,s),a=[],l=0;l<i;l++){var c=gt(s,l);a.push(c)}return n&&(a=a.reverse()),a}function p4(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,o=s===void 0?1:s,i=r?o:1,a=Ze(t);if(!n)return gt(a,i);var l=bs(n,t);if(!(l<o))return gt(a,i)}}function m4(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,o=s===void 0?1:s,i=r?o:1,a=Ze(t);if(!n)return gt(a,-i);var l=bs(a,n);if(!(l<=0))return gt(a,-i)}}var n1=L.createContext(void 0);function g4(t){var e=de(),n=f4(),r=n[0],s=n[1],o=h4(r,e),i=p4(r,e),a=m4(r,e),l=function(d){return o.some(function(f){return Rc(d,f)})},c=function(d,f){l(d)||(f&&Xg(d,f)?s(gt(d,1+e.numberOfMonths*-1)):s(d))},u={currentMonth:r,displayMonths:o,goToMonth:s,goToDate:c,previousMonth:a,nextMonth:i,isDateDisplayed:l};return p.jsx(n1.Provider,{value:u,children:t.children})}function js(){var t=L.useContext(n1);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function af(t){var e,n=de(),r=n.classNames,s=n.styles,o=n.components,i=js().goToMonth,a=function(u){i(gt(u,t.displayIndex?-t.displayIndex:0))},l=(e=o?.CaptionLabel)!==null&&e!==void 0?e:e1,c=p.jsx(l,{id:t.id,displayMonth:t.displayMonth});return p.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[p.jsx("div",{className:r.vhidden,children:c}),p.jsx(l4,{onChange:a,displayMonth:t.displayMonth}),p.jsx(c4,{onChange:a,displayMonth:t.displayMonth})]})}function y4(t){return p.jsx("svg",K({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:p.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function x4(t){return p.jsx("svg",K({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:p.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var ti=L.forwardRef(function(t,e){var n=de(),r=n.classNames,s=n.styles,o=[r.button_reset,r.button];t.className&&o.push(t.className);var i=o.join(" "),a=K(K({},s.button_reset),s.button);return t.style&&Object.assign(a,t.style),p.jsx("button",K({},t,{ref:e,type:"button",className:i,style:a}))});function b4(t){var e,n,r=de(),s=r.dir,o=r.locale,i=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!t.nextMonth&&!t.previousMonth)return p.jsx(p.Fragment,{});var f=c(t.previousMonth,{locale:o}),h=[i.nav_button,i.nav_button_previous].join(" "),m=u(t.nextMonth,{locale:o}),y=[i.nav_button,i.nav_button_next].join(" "),g=(e=d?.IconRight)!==null&&e!==void 0?e:x4,x=(n=d?.IconLeft)!==null&&n!==void 0?n:y4;return p.jsxs("div",{className:i.nav,style:a.nav,children:[!t.hidePrevious&&p.jsx(ti,{name:"previous-month","aria-label":f,className:h,style:a.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?p.jsx(g,{className:i.nav_icon,style:a.nav_icon}):p.jsx(x,{className:i.nav_icon,style:a.nav_icon})}),!t.hideNext&&p.jsx(ti,{name:"next-month","aria-label":m,className:y,style:a.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?p.jsx(x,{className:i.nav_icon,style:a.nav_icon}):p.jsx(g,{className:i.nav_icon,style:a.nav_icon})})]})}function lf(t){var e=de().numberOfMonths,n=js(),r=n.previousMonth,s=n.nextMonth,o=n.goToMonth,i=n.displayMonths,a=i.findIndex(function(m){return Rc(t.displayMonth,m)}),l=a===0,c=a===i.length-1,u=e>1&&(l||!c),d=e>1&&(c||!l),f=function(){r&&o(r)},h=function(){s&&o(s)};return p.jsx(b4,{displayMonth:t.displayMonth,hideNext:u,hidePrevious:d,nextMonth:s,previousMonth:r,onPreviousClick:f,onNextClick:h})}function v4(t){var e,n=de(),r=n.classNames,s=n.disableNavigation,o=n.styles,i=n.captionLayout,a=n.components,l=(e=a?.CaptionLabel)!==null&&e!==void 0?e:e1,c;return s?c=p.jsx(l,{id:t.id,displayMonth:t.displayMonth}):i==="dropdown"?c=p.jsx(af,{displayMonth:t.displayMonth,id:t.id}):i==="dropdown-buttons"?c=p.jsxs(p.Fragment,{children:[p.jsx(af,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),p.jsx(lf,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):c=p.jsxs(p.Fragment,{children:[p.jsx(l,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),p.jsx(lf,{displayMonth:t.displayMonth,id:t.id})]}),p.jsx("div",{className:r.caption,style:o.caption,children:c})}function k4(t){var e=de(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?p.jsx("tfoot",{className:s,style:r.tfoot,children:p.jsx("tr",{children:p.jsx("td",{colSpan:8,children:n})})}):p.jsx(p.Fragment,{})}function S4(t,e,n){for(var r=n?qn(new Date):At(new Date,{locale:t,weekStartsOn:e}),s=[],o=0;o<7;o++){var i=We(r,o);s.push(i)}return s}function C4(){var t=de(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,o=t.weekStartsOn,i=t.ISOWeek,a=t.formatters.formatWeekdayName,l=t.labels.labelWeekday,c=S4(s,o,i);return p.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&p.jsx("td",{style:n.head_cell,className:e.head_cell}),c.map(function(u,d){return p.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":l(u,{locale:s}),children:a(u,{locale:s})},d)})]})}function w4(){var t,e=de(),n=e.classNames,r=e.styles,s=e.components,o=(t=s?.HeadRow)!==null&&t!==void 0?t:C4;return p.jsx("thead",{style:r.head,className:n.head,children:p.jsx(o,{})})}function N4(t){var e=de(),n=e.locale,r=e.formatters.formatDay;return p.jsx(p.Fragment,{children:r(t.date,{locale:n})})}var Pc=L.createContext(void 0);function M4(t){if(!As(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return p.jsx(Pc.Provider,{value:e,children:t.children})}return p.jsx(T4,{initialProps:t.initialProps,children:t.children})}function T4(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,o=e.max,i=function(c,u,d){var f,h;(f=e.onDayClick)===null||f===void 0||f.call(e,c,u,d);var m=!!(u.selected&&s&&r?.length===s);if(!m){var y=!!(!u.selected&&o&&r?.length===o);if(!y){var g=r?Qg([],r):[];if(u.selected){var x=g.findIndex(function(b){return Ge(c,b)});g.splice(x,1)}else g.push(c);(h=e.onSelect)===null||h===void 0||h.call(e,g,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=o&&r.length>o-1,d=r.some(function(f){return Ge(f,c)});return!!(u&&!d)});var l={selected:r,onDayClick:i,modifiers:a};return p.jsx(Pc.Provider,{value:l,children:n})}function Lc(){var t=L.useContext(Pc);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function E4(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?Ge(s,t)&&Ge(r,t)?void 0:Ge(s,t)?{from:s,to:void 0}:Ge(r,t)?void 0:ul(r,t)?{from:t,to:s}:{from:r,to:t}:s?ul(t,s)?{from:s,to:t}:{from:t,to:s}:r?Xg(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var $c=L.createContext(void 0);function D4(t){if(!Is(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return p.jsx($c.Provider,{value:e,children:t.children})}return p.jsx(O4,{initialProps:t.initialProps,children:t.children})}function O4(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},o=s.from,i=s.to,a=e.min,l=e.max,c=function(h,m,y){var g,x;(g=e.onDayClick)===null||g===void 0||g.call(e,h,m,y);var b=E4(h,r);(x=e.onSelect)===null||x===void 0||x.call(e,b,h,m,y)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(u.range_start=[o],i?(u.range_end=[i],Ge(o,i)||(u.range_middle=[{after:o,before:i}])):u.range_end=[o]):i&&(u.range_start=[i],u.range_end=[i]),a&&(o&&!i&&u.disabled.push({after:ia(o,a-1),before:We(o,a-1)}),o&&i&&u.disabled.push({after:o,before:We(o,a-1)}),!o&&i&&u.disabled.push({after:ia(i,a-1),before:We(i,a-1)})),l){if(o&&!i&&(u.disabled.push({before:We(o,-l+1)}),u.disabled.push({after:We(o,l-1)})),o&&i){var d=Tt(i,o)+1,f=l-d;u.disabled.push({before:ia(o,f)}),u.disabled.push({after:We(i,f)})}!o&&i&&(u.disabled.push({before:We(i,-l+1)}),u.disabled.push({after:We(i,l-1)}))}return p.jsx($c.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function _c(){var t=L.useContext($c);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function so(t){return Array.isArray(t)?Qg([],t):t!==void 0?[t]:[]}function A4(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=so(s)}),e}var yt;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(yt||(yt={}));var I4=yt.Selected,$t=yt.Disabled,j4=yt.Hidden,R4=yt.Today,la=yt.RangeEnd,ca=yt.RangeMiddle,ua=yt.RangeStart,P4=yt.Outside;function L4(t,e,n){var r,s=(r={},r[I4]=so(t.selected),r[$t]=so(t.disabled),r[j4]=so(t.hidden),r[R4]=[t.today],r[la]=[],r[ca]=[],r[ua]=[],r[P4]=[],r);return t.fromDate&&s[$t].push({before:t.fromDate}),t.toDate&&s[$t].push({after:t.toDate}),As(t)?s[$t]=s[$t].concat(e.modifiers[$t]):Is(t)&&(s[$t]=s[$t].concat(n.modifiers[$t]),s[ua]=n.modifiers[ua],s[ca]=n.modifiers[ca],s[la]=n.modifiers[la]),s}var r1=L.createContext(void 0);function $4(t){var e=de(),n=Lc(),r=_c(),s=L4(e,n,r),o=A4(e.modifiers),i=K(K({},s),o);return p.jsx(r1.Provider,{value:i,children:t.children})}function s1(){var t=L.useContext(r1);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function _4(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function B4(t){return!!(t&&typeof t=="object"&&"from"in t)}function z4(t){return!!(t&&typeof t=="object"&&"after"in t)}function F4(t){return!!(t&&typeof t=="object"&&"before"in t)}function H4(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function W4(t,e){var n,r=e.from,s=e.to;if(r&&s){var o=Tt(s,r)<0;o&&(n=[s,r],r=n[0],s=n[1]);var i=Tt(t,r)>=0&&Tt(s,t)>=0;return i}return s?Ge(s,t):r?Ge(r,t):!1}function V4(t){return Ac(t)}function U4(t){return Array.isArray(t)&&t.every(Ac)}function q4(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(V4(n))return Ge(t,n);if(U4(n))return n.includes(t);if(B4(n))return W4(t,n);if(H4(n))return n.dayOfWeek.includes(t.getDay());if(_4(n)){var r=Tt(n.before,t),s=Tt(n.after,t),o=r>0,i=s<0,a=ul(n.before,n.after);return a?i&&o:o||i}return z4(n)?Tt(t,n.after)>0:F4(n)?Tt(n.before,t)>0:typeof n=="function"?n(t):!1})}function Bc(t,e,n){var r=Object.keys(e).reduce(function(o,i){var a=e[i];return q4(t,a)&&o.push(i),o},[]),s={};return r.forEach(function(o){return s[o]=!0}),n&&!Rc(t,n)&&(s.outside=!0),s}function K4(t,e){for(var n=Ze(t[0]),r=Ic(t[t.length-1]),s,o,i=n;i<=r;){var a=Bc(i,e),l=!a.disabled&&!a.hidden;if(!l){i=We(i,1);continue}if(a.selected)return i;a.today&&!o&&(o=i),s||(s=i),i=We(i,1)}return o||s}var J4=365;function o1(t,e){var n=e.moveBy,r=e.direction,s=e.context,o=e.modifiers,i=e.retry,a=i===void 0?{count:0,lastFocused:t}:i,l=s.weekStartsOn,c=s.fromDate,u=s.toDate,d=s.locale,f={day:We,week:cl,month:gt,year:L3,startOfWeek:function(g){return s.ISOWeek?qn(g):At(g,{locale:d,weekStartsOn:l})},endOfWeek:function(g){return s.ISOWeek?Ug(g):jc(g,{locale:d,weekStartsOn:l})}},h=f[n](t,r==="after"?1:-1);r==="before"&&c?h=$3([c,h]):r==="after"&&u&&(h=_3([u,h]));var m=!0;if(o){var y=Bc(h,o);m=!y.disabled&&!y.hidden}return m?h:a.count>J4?a.lastFocused:o1(h,{moveBy:n,direction:r,context:s,modifiers:o,retry:K(K({},a),{count:a.count+1})})}var i1=L.createContext(void 0);function Y4(t){var e=js(),n=s1(),r=L.useState(),s=r[0],o=r[1],i=L.useState(),a=i[0],l=i[1],c=K4(e.displayMonths,n),u=s??(a&&e.isDateDisplayed(a))?a:c,d=function(){l(s),o(void 0)},f=function(g){o(g)},h=de(),m=function(g,x){if(s){var b=o1(s,{moveBy:g,direction:x,context:h,modifiers:n});Ge(s,b)||(e.goToDate(b,s),f(b))}},y={focusedDay:s,focusTarget:u,blur:d,focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return p.jsx(i1.Provider,{value:y,children:t.children})}function zc(){var t=L.useContext(i1);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function G4(t,e){var n=s1(),r=Bc(t,n,e);return r}var Fc=L.createContext(void 0);function X4(t){if(!wi(t.initialProps)){var e={selected:void 0};return p.jsx(Fc.Provider,{value:e,children:t.children})}return p.jsx(Q4,{initialProps:t.initialProps,children:t.children})}function Q4(t){var e=t.initialProps,n=t.children,r=function(o,i,a){var l,c,u;if((l=e.onDayClick)===null||l===void 0||l.call(e,o,i,a),i.selected&&!e.required){(c=e.onSelect)===null||c===void 0||c.call(e,void 0,o,i,a);return}(u=e.onSelect)===null||u===void 0||u.call(e,o,o,i,a)},s={selected:e.selected,onDayClick:r};return p.jsx(Fc.Provider,{value:s,children:n})}function a1(){var t=L.useContext(Fc);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Z4(t,e){var n=de(),r=a1(),s=Lc(),o=_c(),i=zc(),a=i.focusDayAfter,l=i.focusDayBefore,c=i.focusWeekAfter,u=i.focusWeekBefore,d=i.blur,f=i.focus,h=i.focusMonthBefore,m=i.focusMonthAfter,y=i.focusYearBefore,g=i.focusYearAfter,x=i.focusStartOfWeek,b=i.focusEndOfWeek,v=function(I){var R,z,W,q;wi(n)?(R=r.onDayClick)===null||R===void 0||R.call(r,t,e,I):As(n)?(z=s.onDayClick)===null||z===void 0||z.call(s,t,e,I):Is(n)?(W=o.onDayClick)===null||W===void 0||W.call(o,t,e,I):(q=n.onDayClick)===null||q===void 0||q.call(n,t,e,I)},k=function(I){var R;f(t),(R=n.onDayFocus)===null||R===void 0||R.call(n,t,e,I)},N=function(I){var R;d(),(R=n.onDayBlur)===null||R===void 0||R.call(n,t,e,I)},C=function(I){var R;(R=n.onDayMouseEnter)===null||R===void 0||R.call(n,t,e,I)},S=function(I){var R;(R=n.onDayMouseLeave)===null||R===void 0||R.call(n,t,e,I)},w=function(I){var R;(R=n.onDayPointerEnter)===null||R===void 0||R.call(n,t,e,I)},M=function(I){var R;(R=n.onDayPointerLeave)===null||R===void 0||R.call(n,t,e,I)},T=function(I){var R;(R=n.onDayTouchCancel)===null||R===void 0||R.call(n,t,e,I)},O=function(I){var R;(R=n.onDayTouchEnd)===null||R===void 0||R.call(n,t,e,I)},A=function(I){var R;(R=n.onDayTouchMove)===null||R===void 0||R.call(n,t,e,I)},P=function(I){var R;(R=n.onDayTouchStart)===null||R===void 0||R.call(n,t,e,I)},D=function(I){var R;(R=n.onDayKeyUp)===null||R===void 0||R.call(n,t,e,I)},E=function(I){var R;switch(I.key){case"ArrowLeft":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":I.preventDefault(),I.stopPropagation(),c();break;case"ArrowUp":I.preventDefault(),I.stopPropagation(),u();break;case"PageUp":I.preventDefault(),I.stopPropagation(),I.shiftKey?y():h();break;case"PageDown":I.preventDefault(),I.stopPropagation(),I.shiftKey?g():m();break;case"Home":I.preventDefault(),I.stopPropagation(),x();break;case"End":I.preventDefault(),I.stopPropagation(),b();break}(R=n.onDayKeyDown)===null||R===void 0||R.call(n,t,e,I)},j={onClick:v,onFocus:k,onBlur:N,onKeyDown:E,onKeyUp:D,onMouseEnter:C,onMouseLeave:S,onPointerEnter:w,onPointerLeave:M,onTouchCancel:T,onTouchEnd:O,onTouchMove:A,onTouchStart:P};return j}function eD(){var t=de(),e=a1(),n=Lc(),r=_c(),s=wi(t)?e.selected:As(t)?n.selected:Is(t)?r.selected:void 0;return s}function tD(t){return Object.values(yt).includes(t)}function nD(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(tD(r)){var o=t.classNames["day_".concat(r)];o&&n.push(o)}}),n}function rD(t,e){var n=K({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=K(K({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function sD(t,e,n){var r,s,o,i=de(),a=zc(),l=G4(t,e),c=Z4(t,l),u=eD(),d=!!(i.onDayClick||i.mode!=="default");L.useEffect(function(){var C;l.outside||a.focusedDay&&d&&Ge(a.focusedDay,t)&&((C=n.current)===null||C===void 0||C.focus())},[a.focusedDay,t,n,d,l.outside]);var f=nD(i,l).join(" "),h=rD(i,l),m=!!(l.outside&&!i.showOutsideDays||l.hidden),y=(o=(s=i.components)===null||s===void 0?void 0:s.DayContent)!==null&&o!==void 0?o:N4,g=p.jsx(y,{date:t,displayMonth:e,activeModifiers:l}),x={style:h,className:f,children:g,role:"gridcell"},b=a.focusTarget&&Ge(a.focusTarget,t)&&!l.outside,v=a.focusedDay&&Ge(a.focusedDay,t),k=K(K(K({},x),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=v||b?0:-1,r)),c),N={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:k,divProps:x};return N}function oD(t){var e=L.useRef(null),n=sD(t.date,t.displayMonth,e);return n.isHidden?p.jsx("div",{role:"gridcell"}):n.isButton?p.jsx(ti,K({name:"day",ref:e},n.buttonProps)):p.jsx("div",K({},n.divProps))}function iD(t){var e=t.number,n=t.dates,r=de(),s=r.onWeekNumberClick,o=r.styles,i=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(e),{locale:a});if(!s)return p.jsx("span",{className:i.weeknumber,style:o.weeknumber,children:u});var d=l(Number(e),{locale:a}),f=function(h){s(e,n,h)};return p.jsx(ti,{name:"week-number","aria-label":d,className:i.weeknumber,style:o.weeknumber,onClick:f,children:u})}function aD(t){var e,n,r=de(),s=r.styles,o=r.classNames,i=r.showWeekNumber,a=r.components,l=(e=a?.Day)!==null&&e!==void 0?e:oD,c=(n=a?.WeekNumber)!==null&&n!==void 0?n:iD,u;return i&&(u=p.jsx("td",{className:o.cell,style:s.cell,children:p.jsx(c,{number:t.weekNumber,dates:t.dates})})),p.jsxs("tr",{className:o.row,style:s.row,children:[u,t.dates.map(function(d){return p.jsx("td",{className:o.cell,style:s.cell,role:"presentation",children:p.jsx(l,{displayMonth:t.displayMonth,date:d})},$E(d))})]})}function cf(t,e,n){for(var r=n?.ISOWeek?Ug(e):jc(e,n),s=n?.ISOWeek?qn(t):At(t,n),o=Tt(r,s),i=[],a=0;a<=o;a++)i.push(We(s,a));var l=i.reduce(function(c,u){var d=n?.ISOWeek?Kg(u):Yg(u,n),f=c.find(function(h){return h.weekNumber===d});return f?(f.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function lD(t,e){var n=cf(Ze(t),Ic(t),e);if(e?.useFixedWeeks){var r=BE(t,e);if(r<6){var s=n[n.length-1],o=s.dates[s.dates.length-1],i=cl(o,6-r),a=cf(cl(o,1),i,e);n.push.apply(n,a)}}return n}function cD(t){var e,n,r,s=de(),o=s.locale,i=s.classNames,a=s.styles,l=s.hideHead,c=s.fixedWeeks,u=s.components,d=s.weekStartsOn,f=s.firstWeekContainsDate,h=s.ISOWeek,m=lD(t.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:o,weekStartsOn:d,firstWeekContainsDate:f}),y=(e=u?.Head)!==null&&e!==void 0?e:w4,g=(n=u?.Row)!==null&&n!==void 0?n:aD,x=(r=u?.Footer)!==null&&r!==void 0?r:k4;return p.jsxs("table",{id:t.id,className:i.table,style:a.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!l&&p.jsx(y,{}),p.jsx("tbody",{className:i.tbody,style:a.tbody,children:m.map(function(b){return p.jsx(g,{displayMonth:t.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),p.jsx(x,{displayMonth:t.displayMonth})]})}function uD(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var dD=uD()?L.useLayoutEffect:L.useEffect,da=!1,fD=0;function uf(){return"react-day-picker-".concat(++fD)}function hD(t){var e,n=t??(da?uf():null),r=L.useState(n),s=r[0],o=r[1];return dD(function(){s===null&&o(uf())},[]),L.useEffect(function(){da===!1&&(da=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function pD(t){var e,n,r=de(),s=r.dir,o=r.classNames,i=r.styles,a=r.components,l=js().displayMonths,c=hD(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,d=[o.month],f=i.month,h=t.displayIndex===0,m=t.displayIndex===l.length-1,y=!h&&!m;s==="rtl"&&(e=[h,m],m=e[0],h=e[1]),h&&(d.push(o.caption_start),f=K(K({},f),i.caption_start)),m&&(d.push(o.caption_end),f=K(K({},f),i.caption_end)),y&&(d.push(o.caption_between),f=K(K({},f),i.caption_between));var g=(n=a?.Caption)!==null&&n!==void 0?n:v4;return p.jsxs("div",{className:d.join(" "),style:f,children:[p.jsx(g,{id:c,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),p.jsx(cD,{id:u,"aria-labelledby":c,displayMonth:t.displayMonth})]},t.displayIndex)}function mD(t){var e=de(),n=e.classNames,r=e.styles;return p.jsx("div",{className:n.months,style:r.months,children:t.children})}function gD(t){var e,n,r=t.initialProps,s=de(),o=zc(),i=js(),a=L.useState(!1),l=a[0],c=a[1];L.useEffect(function(){s.initialFocus&&o.focusTarget&&(l||(o.focus(o.focusTarget),c(!0)))},[s.initialFocus,l,o.focus,o.focusTarget,o]);var u=[s.classNames.root,s.className];s.numberOfMonths>1&&u.push(s.classNames.multiple_months),s.showWeekNumber&&u.push(s.classNames.with_weeknumber);var d=K(K({},s.styles.root),s.style),f=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,y){var g;return K(K({},m),(g={},g[y]=r[y],g))},{}),h=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:mD;return p.jsx("div",K({className:u.join(" "),style:d,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},f,{children:p.jsx(h,{children:i.displayMonths.map(function(m,y){return p.jsx(pD,{displayIndex:y,displayMonth:m},y)})})}))}function yD(t){var e=t.children,n=FE(t,["children"]);return p.jsx(i4,{initialProps:n,children:p.jsx(g4,{children:p.jsx(X4,{initialProps:n,children:p.jsx(M4,{initialProps:n,children:p.jsx(D4,{initialProps:n,children:p.jsx($4,{children:p.jsx(Y4,{children:e})})})})})})})}function xD(t){return p.jsx(yD,K({},t,{children:p.jsx(gD,{initialProps:t})}))}function gA(t){const e=_.c(20);let n,r,s,o;e[0]!==t?({className:n,classNames:r,showOutsideDays:o,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=o):(n=e[1],r=e[2],s=e[3],o=e[4]);const i=o===void 0?!0:o;let a;e[5]!==n?(a=G("p-3",n),e[5]=n,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=G(qc({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),e[7]=l):l=e[7];const c=s.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md";let u;e[8]!==c?(u=G("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",c),e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=G(qc({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),e[10]=d):d=e[10];let f;e[11]!==r||e[12]!==u?(f={months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:l,nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:u,day:d,day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...r},e[11]=r,e[12]=u,e[13]=f):f=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h={IconLeft:vD,IconRight:bD},e[14]=h):h=e[14];let m;return e[15]!==s||e[16]!==i||e[17]!==a||e[18]!==f?(m=p.jsx(xD,{showOutsideDays:i,className:a,classNames:f,components:h,...s}),e[15]=s,e[16]=i,e[17]=a,e[18]=f,e[19]=m):m=e[19],m}function bD(t){const{className:e,...n}=t;return p.jsx(ma,{className:G("size-4",e),...n})}function vD(t){const{className:e,...n}=t;return p.jsx(J1,{className:G("size-4",e),...n})}const l1={requires_action:{labelKey:"common.taskStatus.requiresAction",icon:yl,iconClassName:"text-warning",labelColor:"text-warning"},failed:{labelKey:"common.taskStatus.failed",icon:c0,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{labelKey:"common.taskStatus.expired",icon:G1,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{labelKey:"common.taskStatus.inProgress",icon:Y1,iconClassName:"text-primary",labelColor:"text-primary"},completed:{labelKey:"common.taskStatus.completed",icon:a0,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},df={labelKey:"common.taskStatus.unknown",icon:l0,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function kD(t){return t in l1}function c1(t){if(t===null)return df;const e=t??"completed";return kD(e)?l1[e]:df}const oo=[{ms:6e4,label:"1m"},{ms:12e4,label:"2m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:9e5,label:"15m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:72e5,label:"2h"},{ms:216e5,label:"6h"},{ms:432e5,label:"12h"},{ms:864e5,label:"1d"},{ms:6048e5,label:"7d"}],SD=40;function yA(t){const n=(t.endDate.getTime()-t.startDate.getTime())/SD;return oo.find(s=>s.ms>=n)?.label??oo[oo.length-1].label}function Hc(t){const e=oo.find(o=>o.label===t);if(e)return e.ms;const n=/^(\d+)([mhd])$/.exec(t);if(!n)return 6e4;const r=parseInt(n[1],10),s=n[2];return s==="h"?r*36e5:s==="d"?r*864e5:r*6e4}function CD(t,e){const n=new Date(t);return Hc(e)>=864e5?n.toLocaleDateString([],{month:"short",day:"numeric"}):n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ff(t,e){const n=Hc(e);return new Date(Math.floor(t.getTime()/n)*n)}function wD(t){return t>=1e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function u1(t){return Number.isFinite(t)?t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:Math.round(t).toLocaleString():"0"}function d1(t){return Number.isFinite(t)?`$${t.toFixed(t<1?4:2)}`:"$0.00"}function xA(t,e,n){const r=Hc(n),s=ff(e.startDate,n).getTime(),o=e.endDate.getTime(),i=new Map(t.map(l=>[ff(new Date(l.timestamp),n).getTime(),l])),a=[];for(let l=s;l<=o;l+=r){const c=i.get(l),u=new Date(l).toISOString();a.push({t:u,ts:l,label:CD(u,n),calls:c?.calls??0,errors:c?.errors??0,errorRate:c?.errorRate??0,avg:c?.avg??0,p50:c?.p50??0,p95:c?.p95??0,inputTokens:c?.inputTokens??0,outputTokens:c?.outputTokens??0,totalTokens:c?.totalTokens??0,costUsd:c?.costUsd??0})}return a}function bA(t,e,n,r){const s=new Map;for(const d of t)s.set(d.toolName,(s.get(d.toolName)??0)+d[e]);const o=[...s.entries()].sort((d,f)=>f[1]-d[1]).slice(0,n).map(([d])=>d),i=new Set(o),a=new Map,l=new Map;for(const d of t){if(!i.has(d.toolName))continue;const f=d.virtualMcpId??"";a.set(f,(a.get(f)??0)+d[e]),l.set(`${f}::${d.toolName}`,{calls:d.calls,errors:d.errors,outputSize:d.outputSize})}const c=[...a.entries()].sort((d,f)=>f[1]-d[1]).slice(0,r).map(([d])=>d);let u=0;for(const d of c)for(const f of o){const h=l.get(`${d}::${f}`);h&&h[e]>u&&(u=h[e])}return{topTools:o,topAgentIds:c,cellMap:l,maxValue:u}}function vA(t,e){return e==="requests"?t.calls:e==="errors"?t.errorRate:t.avgDurationMs}function kA(t,e){return e==="requests"?t.calls.toLocaleString():e==="errors"?`${t.errorRate.toFixed(1)}%`:wD(t.avgDurationMs)}function f1(t){return(t.run_config??{}).agent?.id??(t.virtual_mcp_id||null)}function h1(t,e,n,r){if(!t)return r;const s=e.find(i=>i.id===t)??n?.find(i=>i.id===t);if(s?.title)return s.title;const o=Ef(t);return o?Df(o).title??r:t}function p1(t,e,n){if(!t)return null;const r=e.find(o=>o.id===t)??n?.find(o=>o.id===t);if(r?.icon)return r.icon;const s=Ef(t);return s?Df(s).icon??null:null}function ND(t){return t?.data?.members??[]}function dl(t){const e=_.c(32),{thread:n,connections:r,virtualMcps:s,nav:o}=t,i=J();let a,l;if(e[0]!==r||e[1]!==n||e[2]!==s){const k=f1(n);a=h1(k,s,r,""),l=p1(k,s,r),e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=l}else a=e[3],l=e[4];const c=l;let u;e[5]!==a||e[6]!==i||e[7]!==n.title?(u=a||n.title||i("orgs.threads.untitledChat"),e[5]=a,e[6]=i,e[7]=n.title,e[8]=u):u=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx(Rf,{}),e[9]=d):d=e[9];let f;e[10]!==c||e[11]!==u?(f=p.jsx(Kn,{icon:c,name:u,size:"sm",fallbackIcon:d,className:"shadow-sm shrink-0 rounded-md"}),e[10]=c,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==i||e[14]!==n.title?(h=n.title||i("orgs.threads.untitledChat"),e[13]=i,e[14]=n.title,e[15]=h):h=e[15];let m;e[16]!==h?(m=p.jsx(kf,{className:"text-sm leading-snug truncate",children:h}),e[16]=h,e[17]=m):m=e[17];let y;e[18]!==a?(y=a&&p.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a}),e[18]=a,e[19]=y):y=e[19];let g;e[20]!==m||e[21]!==y?(g=p.jsxs("div",{className:"min-w-0",children:[m,y]}),e[20]=m,e[21]=y,e[22]=g):g=e[22];let x;e[23]!==f||e[24]!==g?(x=p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[f,g]}),e[23]=f,e[24]=g,e[25]=x):x=e[25];let b;e[26]!==o||e[27]!==i?(b=o&&p.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[p.jsx(Ln,{size:"icon",variant:"ghost",onClick:o.onPrev,disabled:o.index===0,className:"h-7 w-7 text-muted-foreground","aria-label":i("orgs.threads.previousChat"),children:p.jsx(h0,{size:14})}),p.jsx(Ln,{size:"icon",variant:"ghost",onClick:o.onNext,disabled:o.index===o.total-1,className:"h-7 w-7 text-muted-foreground","aria-label":i("orgs.threads.nextChat"),children:p.jsx(If,{size:14})})]}),e[26]=o,e[27]=i,e[28]=b):b=e[28];let v;return e[29]!==b||e[30]!==x?(v=p.jsx(vf,{className:"px-5 md:px-6 pt-6 pb-5 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-start justify-between gap-3 pr-8",children:[x,b]})}),e[29]=b,e[30]=x,e[31]=v):v=e[31],v}function MD(t){const e=_.c(62),{thread:n,connections:r,virtualMcps:s,members:o}=t,i=J();let a,l;if(e[0]!==r||e[1]!==n||e[2]!==s){const I=f1(n);a=h1(I,s,r,""),l=p1(I,s,r),e[0]=r,e[1]=n,e[2]=s,e[3]=a,e[4]=l}else a=e[3],l=e[4];const c=l;let u;if(e[5]!==o||e[6]!==n.created_by){const I=ND(o);let R;e[8]!==n.created_by?(R=z=>z.userId===n.created_by,e[8]=n.created_by,e[9]=R):R=e[9],u=I.find(R),e[5]=o,e[6]=n.created_by,e[7]=u}else u=e[7];const d=u;let f;e[10]!==d?.user.email||e[11]!==d?.user.name||e[12]!==n.created_by?(f=d?.user.name??d?.user.email??n.created_by?.substring(0,8)??"—",e[10]=d?.user.email,e[11]=d?.user.name,e[12]=n.created_by,e[13]=f):f=e[13];const h=f,m=d?.user.image??void 0;let y;e[14]!==n.created_at?(y=new Date(n.created_at).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),e[14]=n.created_at,e[15]=y):y=e[15];const g=y;let x,b,v,k,N,C;if(e[16]!==i||e[17]!==n.status){const I=c1(n.status),R=I.icon;x="px-5 md:px-6 py-5 border-b border-border grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4 text-sm";let z;e[24]!==i?(z=i("orgs.threads.status"),e[24]=i,e[25]=z):z=e[25],e[26]!==z?(C=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:z}),e[26]=z,e[27]=C):C=e[27],k="flex items-center gap-1.5",N=p.jsx(R,{size:13,className:I.iconClassName}),b=G("text-sm",I.labelColor),v=i(I.labelKey),e[16]=i,e[17]=n.status,e[18]=x,e[19]=b,e[20]=v,e[21]=k,e[22]=N,e[23]=C}else x=e[18],b=e[19],v=e[20],k=e[21],N=e[22],C=e[23];let S;e[28]!==b||e[29]!==v?(S=p.jsx("span",{className:b,children:v}),e[28]=b,e[29]=v,e[30]=S):S=e[30];let w;e[31]!==S||e[32]!==k||e[33]!==N?(w=p.jsxs("div",{className:k,children:[N,S]}),e[31]=S,e[32]=k,e[33]=N,e[34]=w):w=e[34];let M;e[35]!==w||e[36]!==C?(M=p.jsxs("div",{children:[C,w]}),e[35]=w,e[36]=C,e[37]=M):M=e[37];let T;e[38]!==i?(T=i("orgs.threads.date"),e[38]=i,e[39]=T):T=e[39];let O;e[40]!==T?(O=p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:T}),e[40]=T,e[41]=O):O=e[41];let A;e[42]!==g?(A=p.jsx("div",{className:"text-sm text-foreground",children:g}),e[42]=g,e[43]=A):A=e[43];let P;e[44]!==O||e[45]!==A?(P=p.jsxs("div",{children:[O,A]}),e[44]=O,e[45]=A,e[46]=P):P=e[46];let D;e[47]!==i||e[48]!==n.created_by||e[49]!==m||e[50]!==h?(D=n.created_by&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.user")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(f0,{url:m,fallback:h,shape:"circle",size:"2xs",className:"shrink-0"}),p.jsx("span",{className:"text-sm text-foreground",children:h})]})]}),e[47]=i,e[48]=n.created_by,e[49]=m,e[50]=h,e[51]=D):D=e[51];let E;e[52]!==c||e[53]!==a||e[54]!==i?(E=a&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:i("orgs.threads.agent")}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Kn,{icon:c,name:a,size:"xs",fallbackIcon:p.jsx(Rf,{}),className:"shrink-0 size-5! min-w-5! rounded-md"}),p.jsx("span",{className:"text-sm text-foreground",children:a})]})]}),e[52]=c,e[53]=a,e[54]=i,e[55]=E):E=e[55];let j;return e[56]!==x||e[57]!==M||e[58]!==P||e[59]!==D||e[60]!==E?(j=p.jsxs("div",{className:x,children:[M,P,D,E]}),e[56]=x,e[57]=M,e[58]=P,e[59]=D,e[60]=E,e[61]=j):j=e[61],j}const fl=100;function TD(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.noMessagesInChat"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function ED(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.loadingMore"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"py-4 text-center text-xs text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}const DD=400,OD=5e3;function AD(t,e,n){const r=_.c(8),s=mf(),o=L.useRef(null);let i;r[0]!==e||r[1]!==s||r[2]!==n?(i=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{o.current=null,s.invalidateQueries({queryKey:ht.threadMessages(e,n)})},DD)},r[0]=e,r[1]=s,r[2]=n,r[3]=i):i=r[3];const a=i;let l;r[4]!==t||r[5]!==a||r[6]!==n?(l={orgSlug:t,taskId:n,onStep:a,onFinish:a,onReconnect:a},r[4]=t,r[5]=a,r[6]=n,r[7]=l):l=r[7],G0(l)}function ID(t){const e=_.c(36),{client:n,locator:r,thread:s,connections:o,virtualMcps:i,members:a,nav:l,meta:c}=t,{org:u}=xt();let d;e[0]!==r||e[1]!==s.id?(d=ht.threadMessages(r,s.id),e[0]=r,e[1]=s.id,e[2]=d):d=e[2];let f;e[3]!==n||e[4]!==s.id?(f=async O=>{const{pageParam:A}=O,P=A===void 0?0:A;if(!n)throw new Error("MCP client is not available");const D=await n.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:s.id,limit:fl,offset:P}});return D.structuredContent??D},e[3]=n,e[4]=s.id,e[5]=f):f=e[5];let h;e[6]!==d||e[7]!==f?(h={queryKey:d,queryFn:f,initialPageParam:0,getNextPageParam:PD,staleTime:0,refetchInterval:OD},e[6]=d,e[7]=f,e[8]=h):h=e[8];const{data:m,fetchNextPage:y,hasNextPage:g,isFetchingNextPage:x}=d0(h);AD(u.slug,r,s.id);let b;e[9]!==m.pages?(b=m.pages.flatMap(RD).filter(jD),e[9]=m.pages,e[10]=b):b=e[10];const v=b,k=A3(v);let N;e[11]!==y||e[12]!==g||e[13]!==x?(N=()=>{g&&!x&&y()},e[11]=y,e[12]=g,e[13]=x,e[14]=N):N=e[14];const C=Af(N,g??!1,x);let S;e[15]!==o||e[16]!==l||e[17]!==s||e[18]!==i?(S=p.jsx(dl,{thread:s,connections:o,virtualMcps:i,nav:l}),e[15]=o,e[16]=l,e[17]=s,e[18]=i,e[19]=S):S=e[19];let w;e[20]!==o||e[21]!==a||e[22]!==c||e[23]!==s||e[24]!==i?(w=c&&p.jsx(MD,{thread:s,connections:o,virtualMcps:i,members:a}),e[20]=o,e[21]=a,e[22]=c,e[23]=s,e[24]=i,e[25]=w):w=e[25];let M;e[26]!==x||e[27]!==C||e[28]!==k||e[29]!==v.length||e[30]!==s.status?(M=v.length===0?p.jsx(TD,{}):p.jsx("div",{"data-chat-scroller":!0,className:"flex-1 overflow-y-auto min-h-0",children:p.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[k.map((O,A)=>p.jsx("div",{ref:A===k.length-1?C:void 0,children:p.jsx(I3,{pair:O,isLastPair:A===k.length-1,status:A===k.length-1&&s.status==="in_progress"?"streaming":"ready"})},`pair-${O.user?.id??O.assistant?.id}`)),x&&p.jsx(ED,{})]})}),e[26]=x,e[27]=C,e[28]=k,e[29]=v.length,e[30]=s.status,e[31]=M):M=e[31];let T;return e[32]!==S||e[33]!==w||e[34]!==M?(T=p.jsxs(p.Fragment,{children:[S,w,M]}),e[32]=S,e[33]=w,e[34]=M,e[35]=T):T=e[35],T}function jD(t){return t.role==="user"||t.role==="assistant"}function RD(t){return t.items??[]}function PD(t,e){const n=t,r=e;if(!((n?.items?.length??0)<fl))return r.length*fl}function LD(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.failedToLoadMessages"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function $D(){const t=_.c(4),e=J();let n;t[0]!==e?(n=e("orgs.threads.loadingConversation"),t[0]=e,t[1]=n):n=t[1];let r;return t[2]!==n?(r=p.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:n}),t[2]=n,t[3]=r):r=t[3],r}function _D(t){const e=_.c(31),{thread:n,client:r,locator:s,connections:o,virtualMcps:i,members:a,nav:l,meta:c}=t,u=c===void 0?!0:c;let d;e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==i?(d=p.jsx(dl,{thread:n,connections:o,virtualMcps:i,nav:l}),e[0]=o,e[1]=l,e[2]=n,e[3]=i,e[4]=d):d=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=p.jsx(LD,{}),e[5]=f):f=e[5];let h;e[6]!==d?(h=p.jsxs(p.Fragment,{children:[d,f]}),e[6]=d,e[7]=h):h=e[7];let m;e[8]!==o||e[9]!==l||e[10]!==n||e[11]!==i?(m=p.jsx(dl,{thread:n,connections:o,virtualMcps:i,nav:l}),e[8]=o,e[9]=l,e[10]=n,e[11]=i,e[12]=m):m=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=p.jsx($D,{}),e[13]=y):y=e[13];let g;e[14]!==m?(g=p.jsxs(p.Fragment,{children:[m,y]}),e[14]=m,e[15]=g):g=e[15];let x;e[16]!==r||e[17]!==o||e[18]!==s||e[19]!==a||e[20]!==u||e[21]!==l||e[22]!==n||e[23]!==i?(x=p.jsx(ID,{client:r,locator:s,thread:n,connections:o,virtualMcps:i,members:a,nav:l,meta:u}),e[16]=r,e[17]=o,e[18]=s,e[19]=a,e[20]=u,e[21]=l,e[22]=n,e[23]=i,e[24]=x):x=e[24];let b;e[25]!==g||e[26]!==x?(b=p.jsx(L.Suspense,{fallback:g,children:x}),e[25]=g,e[26]=x,e[27]=b):b=e[27];let v;return e[28]!==h||e[29]!==b?(v=p.jsx(S0,{children:p.jsx(yf,{fallback:h,children:b})}),e[28]=h,e[29]=b,e[30]=v):v=e[30],v}function BD(t){const e=_.c(15),[n,r]=L.useState(null);let s;e[0]!==t||e[1]!==n?(s=n!==null?t.findIndex(h=>h.id===n):-1,e[0]=t,e[1]=n,e[2]=s):s=e[2];const o=s,i=o!==-1?t[o]:null,a=i!==null;let l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h=>r(h),c=()=>r(null),e[3]=l,e[4]=c):(l=e[3],c=e[4]);let u,d;e[5]!==o||e[6]!==t?(u=()=>{const h=t[o-1];o>0&&h&&r(h.id)},d=()=>{const h=t[o+1];o!==-1&&h&&r(h.id)},e[5]=o,e[6]=t,e[7]=u,e[8]=d):(u=e[7],d=e[8]);let f;return e[9]!==o||e[10]!==i||e[11]!==a||e[12]!==u||e[13]!==d?(f={selected:i,index:o,isOpen:a,select:l,close:c,prev:u,next:d},e[9]=o,e[10]=i,e[11]=a,e[12]=u,e[13]=d,e[14]=f):f=e[14],f}const hl=50;function Qs(t){const e=_.c(10),{title:n,value:r,subtitle:s}=t;let o;e[0]!==n?(o=p.jsx("span",{className:"text-sm text-foreground/70",children:n}),e[0]=n,e[1]=o):o=e[1];let i;e[2]!==r?(i=p.jsx("span",{className:"text-3xl font-normal tabular-nums",children:r}),e[2]=r,e[3]=i):i=e[3];let a;e[4]!==s?(a=s&&p.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[4]=s,e[5]=a):a=e[5];let l;return e[6]!==o||e[7]!==i||e[8]!==a?(l=p.jsxs(R1,{className:"pt-4 px-4 pb-5 gap-1",children:[o,i,a]}),e[6]=o,e[7]=i,e[8]=a,e[9]=l):l=e[9],l}function zD(t){const e=_.c(45),{automationId:n,range:r}=t,s=J(),{data:o,isLoading:i}=u0(n,r),a=o?.runs,l=o?.usage;let c;e[0]!==a?(c=a&&a.total>0?`${Math.round(a.completed/a.total*100)}%`:"—",e[0]=a,e[1]=c):c=e[1];const u=c;let d;e[2]!==s||e[3]!==l?(d=l&&l.truncated?s("automations.automationRuns.lastRunsSubtitle",{count:l.sampledRuns}):void 0,e[2]=s,e[3]=l,e[4]=d):d=e[4];const f=d;let h;e[5]!==s?(h=s("automations.automationRuns.runsTitle"),e[5]=s,e[6]=h):h=e[6];let m;e[7]!==i||e[8]!==a?.total?(m=i?"…":a?.total.toLocaleString()??"0",e[7]=i,e[8]=a?.total,e[9]=m):m=e[9];let y;e[10]!==a||e[11]!==s?(y=a?`${a.completed} ${s("automations.automationRuns.ok")} · ${a.failed} ${s("automations.automationRuns.failed")}${a.inProgress>0?` · ${a.inProgress} ${s("automations.automationRuns.running")}`:""}`:void 0,e[10]=a,e[11]=s,e[12]=y):y=e[12];let g;e[13]!==h||e[14]!==m||e[15]!==y?(g=p.jsx(Qs,{title:h,value:m,subtitle:y}),e[13]=h,e[14]=m,e[15]=y,e[16]=g):g=e[16];let x;e[17]!==s?(x=s("automations.automationRuns.successRateTitle"),e[17]=s,e[18]=x):x=e[18];const b=i?"…":u;let v;e[19]!==x||e[20]!==b?(v=p.jsx(Qs,{title:x,value:b}),e[19]=x,e[20]=b,e[21]=v):v=e[21];let k;e[22]!==s?(k=s("automations.automationRuns.tokensTitle"),e[22]=s,e[23]=k):k=e[23];let N;e[24]!==i||e[25]!==l?.totalTokens?(N=i?"…":u1(l?.totalTokens??0),e[24]=i,e[25]=l?.totalTokens,e[26]=N):N=e[26];let C;e[27]!==k||e[28]!==N||e[29]!==f?(C=p.jsx(Qs,{title:k,value:N,subtitle:f}),e[27]=k,e[28]=N,e[29]=f,e[30]=C):C=e[30];let S;e[31]!==s?(S=s("automations.automationRuns.costTitle"),e[31]=s,e[32]=S):S=e[32];let w;e[33]!==i||e[34]!==l?(w=i?"…":l&&l.costUsd>0?d1(l.costUsd):"—",e[33]=i,e[34]=l,e[35]=w):w=e[35];let M;e[36]!==S||e[37]!==w||e[38]!==f?(M=p.jsx(Qs,{title:S,value:w,subtitle:f}),e[36]=S,e[37]=w,e[38]=f,e[39]=M):M=e[39];let T;return e[40]!==C||e[41]!==M||e[42]!==g||e[43]!==v?(T=p.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[g,v,C,M]}),e[40]=C,e[41]=M,e[42]=g,e[43]=v,e[44]=T):T=e[44],T}function FD(t){const e=_.c(57),{run:n,usage:r,onClick:s,lastRowRef:o}=t,i=J();let a,l;if(e[0]!==n.created_at){const j=new Date(n.created_at);a=j.toLocaleDateString("en-US",{month:"short",day:"numeric"}),l=j.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),e[0]=n.created_at,e[1]=a,e[2]=l}else a=e[1],l=e[2];const c=l;let u,d,f,h,m,y,g,x,b,v,k;if(e[3]!==o||e[4]!==s||e[5]!==n.status||e[6]!==n.title||e[7]!==i){const j=c1(n.status),I=j.icon;d=Of,b=o,v="h-14 cursor-pointer hover:bg-muted/40 transition-colors border-b-0",k=s,e[19]!==n.title?(f=p.jsx(Er,{className:"min-w-0 pr-2 pl-4 md:pr-4",children:p.jsx("div",{className:"font-medium text-foreground truncate",children:n.title})}),e[19]=n.title,e[20]=f):f=e[20],u=Er,x="w-28 px-3",y="flex items-center gap-1.5",g=p.jsx(I,{size:14,className:j.iconClassName}),h=G("text-sm",j.labelColor),m=i(j.labelKey),e[3]=o,e[4]=s,e[5]=n.status,e[6]=n.title,e[7]=i,e[8]=u,e[9]=d,e[10]=f,e[11]=h,e[12]=m,e[13]=y,e[14]=g,e[15]=x,e[16]=b,e[17]=v,e[18]=k}else u=e[8],d=e[9],f=e[10],h=e[11],m=e[12],y=e[13],g=e[14],x=e[15],b=e[16],v=e[17],k=e[18];let N;e[21]!==h||e[22]!==m?(N=p.jsx("span",{className:h,children:m}),e[21]=h,e[22]=m,e[23]=N):N=e[23];let C;e[24]!==N||e[25]!==y||e[26]!==g?(C=p.jsxs("div",{className:y,children:[g,N]}),e[24]=N,e[25]=y,e[26]=g,e[27]=C):C=e[27];let S;e[28]!==u||e[29]!==C||e[30]!==x?(S=p.jsx(u,{className:x,children:C}),e[28]=u,e[29]=C,e[30]=x,e[31]=S):S=e[31];let w;e[32]!==r?(w=r?u1(r.totalTokens):"—",e[32]=r,e[33]=w):w=e[33];let M;e[34]!==w?(M=p.jsx(Er,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:w}),e[34]=w,e[35]=M):M=e[35];let T;e[36]!==r?(T=r&&r.costUsd>0?d1(r.costUsd):"—",e[36]=r,e[37]=T):T=e[37];let O;e[38]!==T?(O=p.jsx(Er,{className:"w-24 px-3 text-right tabular-nums text-muted-foreground",children:T}),e[38]=T,e[39]=O):O=e[39];let A;e[40]!==a?(A=p.jsx("div",{children:a}),e[40]=a,e[41]=A):A=e[41];let P;e[42]!==c?(P=p.jsx("div",{className:"text-xs text-muted-foreground/60",children:c}),e[42]=c,e[43]=P):P=e[43];let D;e[44]!==A||e[45]!==P?(D=p.jsxs(Er,{className:"w-32 px-3 pr-5 text-muted-foreground",children:[A,P]}),e[44]=A,e[45]=P,e[46]=D):D=e[46];let E;return e[47]!==d||e[48]!==f||e[49]!==S||e[50]!==M||e[51]!==O||e[52]!==D||e[53]!==b||e[54]!==v||e[55]!==k?(E=p.jsxs(d,{ref:b,className:v,onClick:k,children:[f,S,M,O,D]}),e[47]=d,e[48]=f,e[49]=S,e[50]=M,e[51]=O,e[52]=D,e[53]=b,e[54]=v,e[55]=k,e[56]=E):E=e[56],E}function SA(t){const e=_.c(73),{automationId:n,triggerIds:r,range:s}=t,o=J(),{org:i,locator:a}=xt();let l;e[0]!==i.id||e[1]!==i.slug?(l={connectionId:t0,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=l):l=e[2];const c=gl(l),u=gf(),d=Q1(),f=n0(),{data:h}=i0(),m=r.length>0;let y;e[3]!==n||e[4]!==i.id||e[5]!==r?(y=ht.automationRuns(i.id,n,r),e[3]=n,e[4]=i.id,e[5]=r,e[6]=y):y=e[6];let g;e[7]!==u||e[8]!==r?(g=async Ne=>{const{pageParam:me}=Ne,Ke=me===void 0?0:me;return await u.call("COLLECTION_THREADS_LIST",{limit:hl,offset:Ke,where:{trigger_ids:r}})},e[7]=u,e[8]=r,e[9]=g):g=e[9];let x;e[10]!==m||e[11]!==y||e[12]!==g?(x={queryKey:y,queryFn:g,initialPageParam:0,getNextPageParam:UD,enabled:m,staleTime:3e4},e[10]=m,e[11]=y,e[12]=g,e[13]=x):x=e[13];const{data:b,fetchNextPage:v,hasNextPage:k,isFetchingNextPage:N,isLoading:C}=X1(x);let S,w,M,T;e[14]!==b?.pages||e[15]!==a||e[16]!==s?(S=(b?.pages??[]).flatMap(VD),T=S.map(WD),M=ni,w=ht.monitoringThreadUsage(a,JSON.stringify({ids:T,...s})),e[14]=b?.pages,e[15]=a,e[16]=s,e[17]=S,e[18]=w,e[19]=M,e[20]=T):(S=e[17],w=e[18],M=e[19],T=e[20]);let O;e[21]!==s||e[22]!==u||e[23]!==T?(O=async()=>await u.call("MONITORING_THREAD_USAGE",{threadIds:T,...s.startDate?{startDate:s.startDate}:{},...s.endDate?{endDate:s.endDate}:{}}),e[21]=s,e[22]=u,e[23]=T,e[24]=O):O=e[24];const A=T.length>0;let P;e[25]!==w||e[26]!==O||e[27]!==A?(P={queryKey:w,queryFn:O,enabled:A,staleTime:3e4},e[25]=w,e[26]=O,e[27]=A,e[28]=P):P=e[28];const{data:D}=M(P);let E;e[29]!==D?.items?(E=new Map((D?.items??[]).map(HD)),e[29]=D?.items,e[30]=E):E=e[30];const j=E;let I;e[31]!==v||e[32]!==k||e[33]!==N?(I=()=>{k&&!N&&v()},e[31]=v,e[32]=k,e[33]=N,e[34]=I):I=e[34];const R=Af(I,k??!1,N),z=BD(S),W=z.selected;let q;e[35]!==n||e[36]!==s?(q=p.jsx(zD,{automationId:n,range:s}),e[35]=n,e[36]=s,e[37]=q):q=e[37];let X;e[38]!==m||e[39]!==C||e[40]!==R||e[41]!==S||e[42]!==z||e[43]!==o||e[44]!==j?(X=m?C?p.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingRuns")}):S.length===0?p.jsx("div",{className:"py-16",children:p.jsx(Jc,{title:o("automations.automationRuns.noRunsTitle"),description:o("automations.automationRuns.noRunsDescription")})}):p.jsxs(r0,{className:"w-full border-collapse",children:[p.jsx(s0,{className:"border-b-0",children:p.jsxs(Of,{className:"h-9 hover:bg-transparent border-b border-border",children:[p.jsx(Tr,{className:"pl-4 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.runHeader")}),p.jsx(Tr,{className:"w-28 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.statusHeader")}),p.jsx(Tr,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.tokensHeader")}),p.jsx(Tr,{className:"w-24 px-3 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide text-right",children:o("automations.automationRuns.costHeader")}),p.jsx(Tr,{className:"w-32 px-3 pr-5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:o("automations.automationRuns.startedHeader")})]})}),p.jsx(o0,{children:S.map((Ne,me)=>p.jsx(FD,{run:Ne,usage:j.get(Ne.id),onClick:()=>z.select(Ne.id),lastRowRef:me===S.length-1?R:void 0},Ne.id))})]}):p.jsx("div",{className:"py-16",children:p.jsx(Jc,{title:o("automations.automationRuns.noStartersTitle"),description:o("automations.automationRuns.noStartersDescription")})}),e[38]=m,e[39]=C,e[40]=R,e[41]=S,e[42]=z,e[43]=o,e[44]=j,e[45]=X):X=e[45];let te;e[46]!==N||e[47]!==o?(te=N&&p.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:o("automations.automationRuns.loadingMore")}),e[46]=N,e[47]=o,e[48]=te):te=e[48];let ae;e[49]!==z?(ae=Ne=>{Ne||z.close()},e[49]=z,e[50]=ae):ae=e[50];let fe;e[51]!==d||e[52]!==f||e[53]!==c||e[54]!==a||e[55]!==h||e[56]!==S||e[57]!==W||e[58]!==z.index||e[59]!==z.next||e[60]!==z.prev?(fe=W&&p.jsx(_D,{thread:W,client:c,locator:a,connections:d,virtualMcps:f,members:h,nav:{index:z.index,total:S.length,onPrev:z.prev,onNext:z.next}}),e[51]=d,e[52]=f,e[53]=c,e[54]=a,e[55]=h,e[56]=S,e[57]=W,e[58]=z.index,e[59]=z.next,e[60]=z.prev,e[61]=fe):fe=e[61];let ce;e[62]!==fe?(ce=p.jsx(Sf,{className:"sm:max-w-2xl flex flex-col p-0 gap-0",children:fe}),e[62]=fe,e[63]=ce):ce=e[63];let we;e[64]!==z.isOpen||e[65]!==ae||e[66]!==ce?(we=p.jsx(Cf,{open:z.isOpen,onOpenChange:ae,children:ce}),e[64]=z.isOpen,e[65]=ae,e[66]=ce,e[67]=we):we=e[67];let $e;return e[68]!==q||e[69]!==X||e[70]!==te||e[71]!==we?($e=p.jsxs("div",{className:"flex flex-col gap-5",children:[q,X,te,we]}),e[68]=q,e[69]=X,e[70]=te,e[71]=we,e[72]=$e):$e=e[72],$e}function HD(t){return[t.threadId,{calls:t.calls,inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd}]}function WD(t){return t.id}function VD(t){return t.items??[]}function UD(t,e){const n=t,r=e;if(!((n?.items?.length??0)<hl))return r.length*hl}export{ql as $,i3 as A,EM as B,Y as C,xe as D,Xl as E,XS as F,wp as G,ex as H,$ as I,F as J,De as K,Mt as L,gi as M,H as N,a3 as O,ay as P,Sh as Q,XO as R,uA as S,V as T,Ul as U,be as V,hk as W,Bp as X,IS as Y,Yk as Z,Jr as _,dm as a,oe as a0,U as a1,eA as a2,nA as a3,GO as a4,fk as a5,tA as a6,u2 as a7,qe as a8,Se as a9,yA as aA,xA as aB,u1 as aC,wD as aD,d1 as aE,kA as aF,vA as aG,bA as aH,ND as aI,BD as aJ,f1 as aK,h1 as aL,p1 as aM,ak as aa,am as ab,im as ac,$2 as ad,rA as ae,kr as af,cA as ag,XN as ah,GN as ai,_D as aj,gA as ak,fM as al,hM as am,dM as an,fA as ao,dA as ap,uM as aq,hA as ar,pM as as,Jn as at,ZO as au,SA as av,c1 as aw,Nc as ax,l1 as ay,OM as az,Ce as b,um as c,sy as d,pe as e,lA as f,wl as g,Kt as h,aA as i,QO as j,oA as k,US as l,iA as m,sA as n,KS as o,oM as p,nm as q,KO as r,Nl as s,ga as t,LS as u,A3 as v,ny as w,pA as x,I3 as y,mA as z};