decocms 4.76.26 → 4.76.28

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 (234) hide show
  1. package/dist/client/assets/{AlertCircle-JEjdNMaq.js → AlertCircle-C0LNRXFL.js} +1 -1
  2. package/dist/client/assets/{AreaChart-PnztWdjA.js → AreaChart-DRbv2Se_.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-DywFPxe6.js → ArrowUp-DEIsNZJ7.js} +1 -1
  4. package/dist/client/assets/{ArrowUpRight-DLRJTLkX.js → ArrowUpRight-CfyQUwOR.js} +1 -1
  5. package/dist/client/assets/{Check-DD8Xmahb.js → Check-CHx9EjoK.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-7cd8BjDx.js → CheckCircle-DuKYtqTR.js} +1 -1
  7. package/dist/client/assets/{ChevronDown-QIhX3Guq.js → ChevronDown-UK2bP1UQ.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BE8X0Uvv.js → ChevronRight-EIxlJCAn.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CHU-pqaF.js → ChevronUp-C2du4mz8.js} +1 -1
  10. package/dist/client/assets/{Circle-Drh4lCf8.js → Circle-Dn33pGko.js} +1 -1
  11. package/dist/client/assets/{Copy01-bjw8s3CW.js → Copy01-Dec6QuUO.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-V24pvLf1.js → DotsVertical-DURNExIZ.js} +1 -1
  13. package/dist/client/assets/{Eye-D7S6ROXa.js → Eye-Tv0RqHHP.js} +1 -1
  14. package/dist/client/assets/{FilterLines-C7qMMnf_.js → FilterLines-DoBDuM0w.js} +1 -1
  15. package/dist/client/assets/{Flag01-O5w8Cwne.js → Flag01-UPbZzTjU.js} +1 -1
  16. package/dist/client/assets/{Globe01-B8VxPAUQ.js → Globe01-Dv1MemnH.js} +1 -1
  17. package/dist/client/assets/{Globe04-DY0990ND.js → Globe04-DlE3tpui.js} +1 -1
  18. package/dist/client/assets/{HardDrive-d1Xy0sKP.js → HardDrive-BSWP1vqJ.js} +1 -1
  19. package/dist/client/assets/{Key01-Peoi24lZ.js → Key01-DUQfSOZQ.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-Br0EAroS.js → LayoutLeft-BB_flP7V.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-BoeRl2uM.js → LinkExternal01-DTumzywO.js} +1 -1
  22. package/dist/client/assets/{List-DHfOraGc.js → List-Cearyjn7.js} +1 -1
  23. package/dist/client/assets/{Monitor01-4Nd5RcXO.js → Monitor01-BXWr0YEZ.js} +1 -1
  24. package/dist/client/assets/{Package-D5caCh1i.js → Package-Dc3diOZj.js} +1 -1
  25. package/dist/client/assets/{Palette-CfNf7kNL.js → Palette-DLRDeZMj.js} +1 -1
  26. package/dist/client/assets/{Play-3lCkFF0P.js → Play-B_VdYdQy.js} +1 -1
  27. package/dist/client/assets/{Plus-4NSGOzSP.js → Plus-BkEprJHF.js} +1 -1
  28. package/dist/client/assets/{SearchLg-DgQT4rWG.js → SearchLg-D_6LPW5y.js} +1 -1
  29. package/dist/client/assets/{SearchMd-CTQ2aPbD.js → SearchMd-DPgb_Mb5.js} +1 -1
  30. package/dist/client/assets/{Settings02-DUp_kXTN.js → Settings02-B4gKkQVa.js} +1 -1
  31. package/dist/client/assets/{Shield01-CzTOW1uS.js → Shield01-ByGL3nCz.js} +1 -1
  32. package/dist/client/assets/{Star01-D5_DRcqg.js → Star01-rwC6MUs1.js} +1 -1
  33. package/dist/client/assets/{Stars01-D7u2_dXb.js → Stars01-DkyiijKz.js} +1 -1
  34. package/dist/client/assets/{Stars02-DiL3YsnP.js → Stars02-CFJkyC0W.js} +1 -1
  35. package/dist/client/assets/{Sun-CIHi_RNB.js → Sun-D5EL7OWV.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-DcvoTMhH.js → SwitchHorizontal01-CfyLxrC_.js} +1 -1
  37. package/dist/client/assets/{Tool01-4ayLL1Pz.js → Tool01-vwcHp5vx.js} +1 -1
  38. package/dist/client/assets/{Tool02-LfwvX73M.js → Tool02-B9R6nZBJ.js} +1 -1
  39. package/dist/client/assets/{Trash01-Ceh1ErAt.js → Trash01-CQNpRi9v.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-BBcYJ_bQ.js → TrendUp01-DpJPP1Jq.js} +1 -1
  41. package/dist/client/assets/{Upload01-29mEqq4o.js → Upload01-CbyoXv84.js} +1 -1
  42. package/dist/client/assets/{User01-DOj07baz.js → User01-DVvBrT-K.js} +1 -1
  43. package/dist/client/assets/{UserPlus01-s4Mw01w4.js → UserPlus01-DoMT5VeR.js} +1 -1
  44. package/dist/client/assets/{Users01-BBI44anw.js → Users01-BTp0QmgZ.js} +1 -1
  45. package/dist/client/assets/{Users03-Dl4BYAiQ.js → Users03-CeF5jvSj.js} +1 -1
  46. package/dist/client/assets/{X-DOgQ9OMS.js → X-ehE2-PPh.js} +1 -1
  47. package/dist/client/assets/{XCircle-sJ0VkNnU.js → XCircle-H5V2L4xB.js} +1 -1
  48. package/dist/client/assets/{XClose-B9QnqYjT.js → XClose-AmEq2OYZ.js} +1 -1
  49. package/dist/client/assets/{Zap-CBDf1FZB.js → Zap-BUgMog8M.js} +1 -1
  50. package/dist/client/assets/{ZapSquare-Drbxe5yD.js → ZapSquare-D3GithUx.js} +1 -1
  51. package/dist/client/assets/{ZoomOut-BN419Auj.js → ZoomOut-CXi1AmaE.js} +1 -1
  52. package/dist/client/assets/{access-gate-BiIczTav.js → access-gate-CQxfoP_U.js} +1 -1
  53. package/dist/client/assets/{add-section-modal-BTGvgWjv.js → add-section-modal-IG3NiKUf.js} +1 -1
  54. package/dist/client/assets/{agent-icon-IzOMQqpr.js → agent-icon-CTdje-Yo.js} +1 -1
  55. package/dist/client/assets/{agents-list-D4um2swg.js → agents-list-DkDqV_RP.js} +1 -1
  56. package/dist/client/assets/{ai-providers-CdqKOQor.js → ai-providers-BVRPYmN7.js} +1 -1
  57. package/dist/client/assets/{alert-CbvFx1Bx.js → alert-Dw4nOyuN.js} +1 -1
  58. package/dist/client/assets/{alert-dialog-_7xK-_-l.js → alert-dialog-vSPTpv6H.js} +1 -1
  59. package/dist/client/assets/app-editor-CTVFzQ80.js +1 -0
  60. package/dist/client/assets/{auth-CQC1McEv.js → auth-CJQ6Yx_r.js} +1 -1
  61. package/dist/client/assets/{auth-catchall-BO5foWnf.js → auth-catchall-8vX-tkiK.js} +1 -1
  62. package/dist/client/assets/{auth-entry-CNzCDeae.js → auth-entry-DK32MCfV.js} +1 -1
  63. package/dist/client/assets/{auth-split-layout-Dh0uLyI-.js → auth-split-layout-DCKTSx3i.js} +1 -1
  64. package/dist/client/assets/{authenticate-and-persist-oauth-toG6RRhO.js → authenticate-and-persist-oauth-B70SAkix.js} +1 -1
  65. package/dist/client/assets/{automation-list-row-DI4iW8D8.js → automation-list-row-CnL5NUn0.js} +1 -1
  66. package/dist/client/assets/{automation-runs-BsUWX0YG.js → automation-runs-Cc4W98hs.js} +2 -2
  67. package/dist/client/assets/automations-BqDg5l7C.js +1 -0
  68. package/dist/client/assets/{autosend-DCRYPUxS.js → autosend-DYq_Jvzc.js} +1 -1
  69. package/dist/client/assets/{avatar-CRhRWgdF.js → avatar-BeXwGFfk.js} +1 -1
  70. package/dist/client/assets/{badge-BaNFbTzd.js → badge-Bu2YMz_4.js} +1 -1
  71. package/dist/client/assets/{block-document-BW8ImIhf.js → block-document-D5c4Dz22.js} +1 -1
  72. package/dist/client/assets/{brand-context-B_tY1g8X.js → brand-context-CLtfaJqj.js} +1 -1
  73. package/dist/client/assets/{buckets-CXg0DXgf.js → buckets-C9hZ8uQM.js} +1 -1
  74. package/dist/client/assets/{bulk-category-panel-DoHCSV1p.js → bulk-category-panel-BOZgPiQy.js} +1 -1
  75. package/dist/client/assets/{calendar-BhzpHYaK.js → calendar-PInr3mmc.js} +1 -1
  76. package/dist/client/assets/{capability-load-error-MZFL4N4q.js → capability-load-error-jrr5P4vz.js} +1 -1
  77. package/dist/client/assets/{card-BkChKAsi.js → card-CWxEyxBu.js} +1 -1
  78. package/dist/client/assets/{category-editor-BxkUDxqH.js → category-editor-BdRjbS6h.js} +1 -1
  79. package/dist/client/assets/{chat-context-D--jJ0mW.js → chat-context-Cr6qmlGy.js} +1 -1
  80. package/dist/client/assets/{checkbox-Da4u7m4z.js → checkbox-DHREKNj6.js} +1 -1
  81. package/dist/client/assets/{cli-auth-success-BpVDT2UE.js → cli-auth-success-BHKGsy9Q.js} +1 -1
  82. package/dist/client/assets/{collection-detail-BSS1LfKM.js → collection-detail-CrkU7mPY.js} +1 -1
  83. package/dist/client/assets/{collection-display-button-DlbI3hqv.js → collection-display-button-C8VvBTox.js} +1 -1
  84. package/dist/client/assets/{collection-search-CLUGJZF5.js → collection-search-ZIcj7LLW.js} +1 -1
  85. package/dist/client/assets/{collection-table-wrapper-DQ-MB43Q.js → collection-table-wrapper-DOKsgICB.js} +1 -1
  86. package/dist/client/assets/{collection-tabs-CPHe7zsN.js → collection-tabs-C1ybuJHO.js} +1 -1
  87. package/dist/client/assets/{command-CykJNafy.js → command-BwCOntKm.js} +1 -1
  88. package/dist/client/assets/{commerce-onboarding-BN2Y3zhL.js → commerce-onboarding-BQMESyPD.js} +1 -1
  89. package/dist/client/assets/{companions-core-CcN0T2OT.js → companions-core-1f14i-4e.js} +1 -1
  90. package/dist/client/assets/{connect-desktop-dialog-DhHmNLCN.js → connect-desktop-dialog-d7Jl0eRb.js} +1 -1
  91. package/dist/client/assets/{connection-card-Z6KPaA-g.js → connection-card-BOsDQ33m.js} +1 -1
  92. package/dist/client/assets/{connection-detail-CYNfdNu1.js → connection-detail-D6sRVx0b.js} +1 -1
  93. package/dist/client/assets/{connection-form-helpers-CrCzGAhg.js → connection-form-helpers-Bko18JmW.js} +1 -1
  94. package/dist/client/assets/{connections-zZn20lsz.js → connections-CZ3Mhjyz.js} +1 -1
  95. package/dist/client/assets/{decopilot-sse-pool-DG-jpnTO.js → decopilot-sse-pool-BM-tUdQR.js} +1 -1
  96. package/dist/client/assets/{dialog-DpRPtQlN.js → dialog-uPEldi6L.js} +1 -1
  97. package/dist/client/assets/{domain-settings-Clkjofl2.js → domain-settings-CQqGcD4z.js} +1 -1
  98. package/dist/client/assets/{drawer-CbyYzWfN.js → drawer-CeOMWORD.js} +1 -1
  99. package/dist/client/assets/{dropdown-menu-BK6Lb0Nq.js → dropdown-menu-BnqypSUe.js} +1 -1
  100. package/dist/client/assets/{empty-state-DbOLNoO_.js → empty-state-Dj1UiFtA.js} +1 -1
  101. package/dist/client/assets/{extract-connection-data-3T9XLYzt.js → extract-connection-data-rNjNJHae.js} +1 -1
  102. package/dist/client/assets/{file-explorer-DgPMaNMw.js → file-explorer-h3A6HenO.js} +1 -1
  103. package/dist/client/assets/{file-type-icon-qFgSOslJ.js → file-type-icon-mhXAsYz9.js} +1 -1
  104. package/dist/client/assets/{files-DdQcObk7.js → files-BQDBoPGe.js} +1 -1
  105. package/dist/client/assets/{form-ob0zetC8.js → form-CBIL6eiC.js} +1 -1
  106. package/dist/client/assets/{general-CiYgo3Y0.js → general-DpsClpa0.js} +1 -1
  107. package/dist/client/assets/{github-repo-picker-Bhh8AhS3.js → github-repo-picker-C6F-TBMc.js} +1 -1
  108. package/dist/client/assets/{hooks-CAkZ0hUS.js → hooks-C1wDxsG8.js} +1 -1
  109. package/dist/client/assets/{index-BuahLGL5.js → index-8weOSYP9.js} +1 -1
  110. package/dist/client/assets/{index-iLNVLpVB.js → index-BRT-eiWy.js} +5 -5
  111. package/dist/client/assets/{index-B9kvHfbV.js → index-Bc-Htd9N.js} +1 -1
  112. package/dist/client/assets/{index-SndQMS5v.js → index-CZMZ2qCP.js} +1 -1
  113. package/dist/client/assets/{index-D-g-Smyf.js → index-CyLw_PTZ.js} +1 -1
  114. package/dist/client/assets/{index-D16D3Xo8.js → index-Cz21JVVz.js} +2 -2
  115. package/dist/client/assets/{index-C4WNfAxp.js → index-CzoFhUGA.js} +2 -2
  116. package/dist/client/assets/{index-DHgBlK64.js → index-D8Sx01WH.js} +1 -1
  117. package/dist/client/assets/{index-WfIzPpeT.js → index-DE4xtToZ.js} +1 -1
  118. package/dist/client/assets/{index-BikctH4L.js → index-DaW53K3w.js} +1 -1
  119. package/dist/client/assets/{index--VbulPjz.js → index-DeM3xnRo.js} +1 -1
  120. package/dist/client/assets/{index-Br0McRCm.js → index-QRKcLEI9.js} +1 -1
  121. package/dist/client/assets/{index-MWQj12Ky.js → index-h0mm9XmA.js} +1 -1
  122. package/dist/client/assets/{index-C6rSPqKT.js → index-ibVYCtdk.js} +3 -3
  123. package/dist/client/assets/{index-redirect-DfO_XEMy.js → index-redirect-4WIiEC98.js} +1 -1
  124. package/dist/client/assets/{input-BOl29soq.js → input-CLma5TTa.js} +1 -1
  125. package/dist/client/assets/{integration-icon-Dobf_BcZ.js → integration-icon-CH7ULFsC.js} +1 -1
  126. package/dist/client/assets/{invite-member-dialog-CbtZoxDt.js → invite-member-dialog-B9TFFt67.js} +1 -1
  127. package/dist/client/assets/{label-YaOxmgC6.js → label-HegC4zUI.js} +1 -1
  128. package/dist/client/assets/{layout-BkTSJlfx.js → layout-D9xgYSWi.js} +1 -1
  129. package/dist/client/assets/{login-CDteB8qC.js → login-DFLMZ3qu.js} +1 -1
  130. package/dist/client/assets/{mcp-oauth-BoQhsehQ.js → mcp-oauth-refjE4PD.js} +1 -1
  131. package/dist/client/assets/{members-Cddy3pmx.js → members-DohQmAh4.js} +1 -1
  132. package/dist/client/assets/{monaco-editor-CXwRI0Db.js → monaco-editor-CbXE9Xqh.js} +1 -1
  133. package/dist/client/assets/{monitoring-stats-row-DI3ebezr.js → monitoring-stats-row-D2OaVmvA.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-CqvYc7SO.js → oauth-callback-BD-rnRKV.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-BH9uCTdA.js → oauth-callback-ai-provider-W6zgxeJt.js} +1 -1
  136. package/dist/client/assets/{onboarding-__gAytu9.js → onboarding-CcNFi16c.js} +1 -1
  137. package/dist/client/assets/{org-install-Bdfq7jWA.js → org-install--_QSmOJj.js} +1 -1
  138. package/dist/client/assets/{org-layout-C7mhFhR3.js → org-layout-DYZ_Vdd8.js} +1 -1
  139. package/dist/client/assets/{organization-choice-BqSvAe3n.js → organization-choice-DXf2eVHS.js} +1 -1
  140. package/dist/client/assets/{orgs-D7l9haYh.js → orgs-XCJtlsXs.js} +1 -1
  141. package/dist/client/assets/{page-seo-form-CZxlMiuU.js → page-seo-form-BJE4N0q6.js} +1 -1
  142. package/dist/client/assets/page-seo-sheet-Dn8gU-8w.js +1 -0
  143. package/dist/client/assets/{popover-FAMOUKCi.js → popover-D59OWen2.js} +1 -1
  144. package/dist/client/assets/{post-editor-D5QLnH1N.js → post-editor-DgVNv_rH.js} +1 -1
  145. package/dist/client/assets/{primitives-01Nkb1aE.js → primitives-DfbHf84t.js} +1 -1
  146. package/dist/client/assets/{profile-BTZBnjkn.js → profile-DltlP7xu.js} +1 -1
  147. package/dist/client/assets/project-app-view-Bnulcm0D.js +1 -0
  148. package/dist/client/assets/record-editor-FGIpxVOr.js +1 -0
  149. package/dist/client/assets/redirect-editor-COIPOqhB.js +1 -0
  150. package/dist/client/assets/registry-C2jCLyFo.js +2 -0
  151. package/dist/client/assets/{registry-layout-Ct5fZxcc.js → registry-layout-p_pDhyQI.js} +1 -1
  152. package/dist/client/assets/{reports-G-S2YiCT.js → reports-BUiMkCeS.js} +1 -1
  153. package/dist/client/assets/{require-capability-BQ52Qg2O.js → require-capability-BYYj6I9k.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-DTezT7SL.js → required-auth-layout-BdqwRFOI.js} +1 -1
  155. package/dist/client/assets/{reset-password-CSQioStu.js → reset-password-ILu_xind.js} +1 -1
  156. package/dist/client/assets/{roles-DN0ACc8V.js → roles-DBPdPEDv.js} +1 -1
  157. package/dist/client/assets/{search-input-B0hGe9Cn.js → search-input-D7ajgDO_.js} +1 -1
  158. package/dist/client/assets/{secrets-DAx3W6eh.js → secrets-CVk2A9J6.js} +1 -1
  159. package/dist/client/assets/{sections-editor-BF62-lT6.js → sections-editor-1a4sumOF.js} +1 -1
  160. package/dist/client/assets/{select-D0q7bCO5.js → select-DCMRbMTV.js} +1 -1
  161. package/dist/client/assets/{select-model-ssYbD-o4.js → select-model-Bx-Xed51.js} +1 -1
  162. package/dist/client/assets/{self-tool-result-DEhHfa16.js → self-tool-result-BtI_8CVd.js} +1 -1
  163. package/dist/client/assets/{seo-editor-as8ru-KG.js → seo-editor-Cs_3ZAXk.js} +1 -1
  164. package/dist/client/assets/{settings-layout-DbtQ3NJu.js → settings-layout-DbPYh7eX.js} +1 -1
  165. package/dist/client/assets/{settings-section-D_VsqESF.js → settings-section-Dss2hFT-.js} +1 -1
  166. package/dist/client/assets/{shell-controls-DEw6ukcl.js → shell-controls-C3MhzxnW.js} +1 -1
  167. package/dist/client/assets/{shell-layout-BOz65zhN.js → shell-layout-DPnzwBdL.js} +1 -1
  168. package/dist/client/assets/{sidebar-C2AB2RFw.js → sidebar-BIOIlAO_.js} +1 -1
  169. package/dist/client/assets/{skeleton-BjdIEsAI.js → skeleton-DcJ-AWeX.js} +1 -1
  170. package/dist/client/assets/{sso-C3ghvnj-.js → sso-DVhSY1Kw.js} +1 -1
  171. package/dist/client/assets/{store-BuWCrjLx.js → store-WNKCxnBi.js} +1 -1
  172. package/dist/client/assets/store-registry-As3TNtVB.js +2 -0
  173. package/dist/client/assets/{studio-tools-DnbtK9EU.js → studio-tools-CiEb3YCV.js} +1 -1
  174. package/dist/client/assets/{switch-CrEaBS4r.js → switch-CvVKCLWe.js} +1 -1
  175. package/dist/client/assets/{table-CcsfClB_.js → table-DUOWHqJQ.js} +1 -1
  176. package/dist/client/assets/{tabs-CTzez_zZ.js → tabs-BqGxXdoI.js} +1 -1
  177. package/dist/client/assets/{textarea-Cvg62Zwl.js → textarea-DV1w30pD.js} +1 -1
  178. package/dist/client/assets/{toggle-group-DaNw79Vt.js → toggle-group-BOYJJ8oi.js} +1 -1
  179. package/dist/client/assets/{toolbar-BawvGBDb.js → toolbar-D6dZQ1kJ.js} +1 -1
  180. package/dist/client/assets/{toolbar-icon-button-CKUrxf9y.js → toolbar-icon-button-D3ZfFn7X.js} +1 -1
  181. package/dist/client/assets/{tools-list-C_t4TrwL.js → tools-list-CggpcmV4.js} +1 -1
  182. package/dist/client/assets/{tooltip-DoczXJLQ.js → tooltip-DmGjSLGv.js} +1 -1
  183. package/dist/client/assets/{use-ai-providers-Co9QW_iN.js → use-ai-providers-CmNDf8vd.js} +1 -1
  184. package/dist/client/assets/{use-automations-t0Hn2O-v.js → use-automations-C8vesZ5J.js} +1 -1
  185. package/dist/client/assets/{use-autosave-ClLAcn6N.js → use-autosave-D46FxJLf.js} +1 -1
  186. package/dist/client/assets/{use-capability-D5VBTA74.js → use-capability-EhARhd3Z.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-DULwIbC5.js → use-clock-tick-2EW1HZaU.js} +1 -1
  188. package/dist/client/assets/{use-collections-CiFSj-2E.js → use-collections-CvDTPu4s.js} +1 -1
  189. package/dist/client/assets/{use-connection-Dy0a03AD.js → use-connection-DkYq5t3v.js} +1 -1
  190. package/dist/client/assets/{use-copy-sff5YRCn.js → use-copy-DqYfTFoV.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-CtEautQ8.js → use-create-virtual-mcp-CSvz7-rk.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-CoZwlL2r.js → use-debounced-autosave-DhohqvG9.js} +1 -1
  193. package/dist/client/assets/{use-debounced-value-Dzfbm8zZ.js → use-debounced-value-7buBvFAI.js} +1 -1
  194. package/dist/client/assets/{use-deco-credits-CAQDn7eP.js → use-deco-credits-CVzSYKYM.js} +1 -1
  195. package/dist/client/assets/{use-decopilot-events-CVKvugmx.js → use-decopilot-events-CkuFGVsY.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-siC3M2mG.js → use-delete-connection-C2WiA17l.js} +1 -1
  197. package/dist/client/assets/{use-deployment-admin-Coz3bxXZ.js → use-deployment-admin-C_Ql7vEL.js} +1 -1
  198. package/dist/client/assets/{use-file-configs-DEB-biCW.js → use-file-configs-CcqaFUoI.js} +1 -1
  199. package/dist/client/assets/{use-infinite-scroll-mMzHsNNR.js → use-infinite-scroll-BkLL2k_w.js} +1 -1
  200. package/dist/client/assets/{use-join-requests-DHm-57T6.js → use-join-requests-DULtcSY7.js} +1 -1
  201. package/dist/client/assets/{use-mcp-client-nyUUhjjA.js → use-mcp-client-OGs9WihN.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-DvfJnT3g.js → use-mcp-tools-B3ZOCtmr.js} +1 -1
  203. package/dist/client/assets/{use-members-DWezi5NP.js → use-members-BEIFWHR7.js} +1 -1
  204. package/dist/client/assets/{use-mobile-qj1W_Bbs.js → use-mobile-B1itw65d.js} +1 -1
  205. package/dist/client/assets/{use-navigate-to-agent-CsPUQI6s.js → use-navigate-to-agent-miif_g44.js} +1 -1
  206. package/dist/client/assets/{use-org-auth-client-CSmMVfbm.js → use-org-auth-client-D_9vuP20.js} +1 -1
  207. package/dist/client/assets/{use-org-sso-B4F4F8rq.js → use-org-sso-DCaBtTKN.js} +1 -1
  208. package/dist/client/assets/{use-organization-roles-izOzDhFz.js → use-organization-roles-C5Xk9wws.js} +1 -1
  209. package/dist/client/assets/{use-organization-settings-B2ne0tO2.js → use-organization-settings-D7VQkjik.js} +1 -1
  210. package/dist/client/assets/{use-registry-connections-CxSTD8pP.js → use-registry-connections-D7PghIBt.js} +1 -1
  211. package/dist/client/assets/{use-secrets-HUeETyue.js → use-secrets-DNdZ7I0w.js} +1 -1
  212. package/dist/client/assets/{use-status-sounds-o8g6ezne.js → use-status-sounds-CXNpvY3s.js} +1 -1
  213. package/dist/client/assets/{use-view-mode-B2RienOz.js → use-view-mode-CTcmjP_L.js} +1 -1
  214. package/dist/client/assets/{use-virtual-mcp-C4SSVzMO.js → use-virtual-mcp-CkueoyOa.js} +1 -1
  215. package/dist/client/assets/useInfiniteQuery-k0Oz8aiZ.js +1 -0
  216. package/dist/client/assets/{useRouterState-jJQX6j3i.js → useRouterState-DczLxF9S.js} +1 -1
  217. package/dist/client/assets/useSuspenseInfiniteQuery-D6yz4hO3.js +1 -0
  218. package/dist/client/assets/{users-BEVRwZFB.js → users-C_Ywx_9Z.js} +1 -1
  219. package/dist/client/assets/{variant-calendar-vNGZ4MqD.js → variant-calendar-DcAf2fYs.js} +1 -1
  220. package/dist/client/assets/{view-mode-toggle-DFwLIgKE.js → view-mode-toggle-DNrPFZMu.js} +1 -1
  221. package/dist/client/index.html +1 -1
  222. package/dist/server/cli.js +1 -1
  223. package/dist/server/server.js +1 -1
  224. package/package.json +1 -1
  225. package/dist/client/assets/app-editor-B4QOXpv-.js +0 -1
  226. package/dist/client/assets/automations-DnVTdwpg.js +0 -1
  227. package/dist/client/assets/page-seo-sheet-CvEUwTbF.js +0 -1
  228. package/dist/client/assets/project-app-view-WWDLR4ej.js +0 -1
  229. package/dist/client/assets/record-editor-D9xqtmM_.js +0 -1
  230. package/dist/client/assets/redirect-editor-CMYCgU_I.js +0 -1
  231. package/dist/client/assets/registry-CHkJpwnW.js +0 -2
  232. package/dist/client/assets/store-registry-DGY-vmZx.js +0 -2
  233. package/dist/client/assets/useInfiniteQuery-rUzOrzHT.js +0 -1
  234. package/dist/client/assets/useSuspenseInfiniteQuery-COnNX6yD.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as E,c as _,J as np,j as p,B as mt,I as la,H as rp,M as sp,bJ as eu,bK as ip,at as op,aM as hn,bL as lp,l as Z,p as ap,aR as cp,aO as Jt,aV as up,aU as Bt,ba as Ar,aS as vn,bM as tu,aQ as nu,C as Mt,n as dp,d as fp,K as nt,t as eo,m as jr,b as qn,E as ru,aL as su,bN as Uo,aT as hp,bO as tn}from"./index-C6rSPqKT.js";import{e as pp,a as mp,b as gp,c as xp,d as Pr,S as yp}from"./select-D0q7bCO5.js";import{u as iu}from"./useInfiniteQuery-rUzOrzHT.js";import{a as ou,u as bp}from"./use-connection-Dy0a03AD.js";import{c as kp,u as qo}from"./use-mcp-client-nyUUhjjA.js";import{u as Sp}from"./use-virtual-mcp-C4SSVzMO.js";import{b as vp,i as wp,a as Cp,S as Tp}from"./constants-D_FQAPnt.js";import{C as Np}from"./card-BkChKAsi.js";import{o as lu,m as au,p as Ko,q as Jo}from"./sidebar-C2AB2RFw.js";import{c as cu,d as uu,a as Ys,e as Qe,b as du,T as Ze}from"./table-CcsfClB_.js";import{E as to}from"./empty-state-DbOLNoO_.js";import{u as Go}from"./use-infinite-scroll-mMzHsNNR.js";import{u as Mp}from"./use-members-DWezi5NP.js";import{u as fu,S as Pn}from"./use-clock-tick-DULwIbC5.js";import{e as Ep}from"./use-automations-t0Hn2O-v.js";import{u as hu}from"./studio-tools-DnbtK9EU.js";import{u as Ap}from"./useSuspenseInfiniteQuery-COnNX6yD.js";import{B as rs}from"./badge-BaNFbTzd.js";import{C as aa}from"./checkbox-Da4u7m4z.js";import{t as Ln}from"./ChevronDown-QIhX3Guq.js";import{b as jp,C as Ip,a as ca,c as Op,e as Rp,d as Dp}from"./command-CykJNafy.js";import{P as pu,a as mu,b as gu}from"./popover-FAMOUKCi.js";import{A as xu}from"./avatar-CRhRWgdF.js";import{n as no}from"./ChevronUp-CHU-pqaF.js";import{t as Pp,a as yu,n as Xo}from"./Tool02-LfwvX73M.js";import{i as Lp}from"./FilterLines-C7qMMnf_.js";import{e as _p,U as $p,u as zp,ap as Bp,aa as Fp,af as Vp,j as Hp,an as bu,aq as Wp,ar as Up,A as ku,as as ht,at as qp,au as Kp,av as Jp}from"./agent-icon-IzOMQqpr.js";import{t as Qs}from"./Stars01-D7u2_dXb.js";import{i as Su,b as Lr}from"./XCircle-sJ0VkNnU.js";import{i as Yo}from"./Check-DD8Xmahb.js";import{i as ua}from"./ChevronRight-BE8X0Uvv.js";import{a as vu}from"./Copy01-bjw8s3CW.js";import{b as Ut,t as Qo,c as da}from"./format-time-BnbuEtat.js";import{u as wu}from"./use-copy-sff5YRCn.js";import{T as pn,a as mn,b as gn}from"./tooltip-DoczXJLQ.js";import{M as Zo,I as Cu,F as Gp}from"./file-type-icon-qFgSOslJ.js";import{c as Xp}from"./monaco-editor-CXwRI0Db.js";import{g as Tu,M as Yp}from"./index-B9kvHfbV.js";import{S as Qp,h as Kn,m as Zp,c as el,d as em,b as tm}from"./chat-context-D--jJ0mW.js";import{c as nm,r as rm,g as sm,R as im}from"./hooks-CAkZ0hUS.js";import{f as om,n as lm,o as am}from"./tab-id-BijBBRwE.js";import{i as Nu}from"./AlertCircle-JEjdNMaq.js";import{s as cm}from"./Eye-D7S6ROXa.js";import{s as ss,t as Mu}from"./Star01-D5_DRcqg.js";import{s as um}from"./XClose-B9QnqYjT.js";import{n as ro}from"./ZapSquare-Drbxe5yD.js";import{n as Eu,i as dm}from"./Globe01-B8VxPAUQ.js";import{d as fm,c as hm,a as _r}from"./Tool01-4ayLL1Pz.js";import{i as fa,a as pm}from"./ZoomOut-BN419Auj.js";import{i as ir}from"./Monitor01-4Nd5RcXO.js";import{i as mm}from"./SearchMd-CTQ2aPbD.js";import{i as gm}from"./Upload01-29mEqq4o.js";import{u as xm,a as ym}from"./shell-layout-BOz65zhN.js";import{n as Au}from"./LinkExternal01-BoeRl2uM.js";import{I as Gt}from"./integration-icon-Dobf_BcZ.js";import{i as bm}from"./ArrowUpRight-DLRJTLkX.js";import{a as tl}from"./Users03-Dl4BYAiQ.js";import{a as pt}from"./Palette-CfNf7kNL.js";import{c as ju}from"./use-navigate-to-agent-CsPUQI6s.js";import{a as km}from"./Stars02-DiL3YsnP.js";import{g as Sm}from"./AreaChart-PnztWdjA.js";import{a as vm,D as wm,c as Cm,d as Tm,e as Nm}from"./dialog-DpRPtQlN.js";import{a as Mm,F as Em,b as Am,c as jm,d as Im,f as Om}from"./form-ob0zetC8.js";import{I as Rm}from"./input-BOl29soq.js";import{i as Dm}from"./UserPlus01-s4Mw01w4.js";const Pm={openrouter:n=>{const e=n?.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 Iu(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Pm)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Ou(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Ru(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Iu(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function kT(n){return n.reduce((e,t)=>Ru(e,t.metadata?.usage),Ou())}const Lm={damping:.7,stiffness:.05,mass:1.25},_m=70,$m=1e3/60,zm=350;let Zs=!1;globalThis.document?.addEventListener("mousedown",()=>{Zs=!0});globalThis.document?.addEventListener("mouseup",()=>{Zs=!1});globalThis.document?.addEventListener("click",()=>{Zs=!1});const Bm=(n={})=>{const[e,t]=E.useState(!1),[r,s]=E.useState(n.initial!==!1),[i,o]=E.useState(!1),l=E.useRef(null);l.current=n;const a=E.useCallback(()=>{if(!Zs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(x.current)||x.current?.contains(k.commonAncestorContainer)},[]),c=E.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return x.current?.scrollTop??0},set scrollTop(k){if(x.current){const{scrollBehavior:S}=getComputedStyle(x.current);S!=="auto"&&(x.current.style.scrollBehavior="auto"),x.current.scrollTop=k,d.ignoreScrollToTop=x.current.scrollTop,S!=="auto"&&(x.current.style.scrollBehavior=S)}},get targetScrollTop(){return!x.current||!y.current?0:x.current.scrollHeight-1-x.current.clientHeight},get calculatedTargetScrollTop(){if(!x.current||!y.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const S=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:x.current,contentElement:y.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:S},requestAnimationFrame(()=>{b=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=_m}}},[]),f=E.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),S=wi(l.current,b.animation),{ignoreEscapes:v=!1}=b;let C,w=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{C=Date.now()}):C=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:M}=d,j=performance.now(),O=(j-(d.lastTick??j))/$m;if(d.animation||(d.animation={behavior:S,promise:N,ignoreEscapes:v}),d.animation.behavior===S&&(d.lastTick=j),a()||k>Date.now())return T();if(M<Math.min(w,d.calculatedTargetScrollTop)){if(d.animation?.behavior===S){if(S==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(S.damping*d.velocity+S.stiffness*d.scrollDifference)/S.mass,d.accumulated+=d.velocity*O,d.scrollTop+=d.accumulated,d.scrollTop!==M&&(d.accumulated=0)}return T()}return C>Date.now()?(w=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:wi(l.current,l.current.resize),ignoreEscapes:v,duration:Math.max(0,C-Date.now())||void 0}):d.isAtBottom)});return N.then(M=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),M))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===S?d.animation.promise:T()},[c,a,d]),h=E.useCallback(()=>{u(!0),c(!1)},[u,c]),m=E.useCallback(({target:b})=>{if(b!==x.current)return;const{scrollTop:k,ignoreScrollToTop:S}=d;let{lastScrollTop:v=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,S&&S>k&&(v=S),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===S)return;if(a()){u(!0),c(!1);return}const C=k>v,w=k<v;if(d.animation?.ignoreEscapes){d.scrollTop=v;return}w&&(u(!0),c(!1)),C&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=E.useCallback(({target:b,deltaY:k})=>{let S=b;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===x.current&&k<0&&x.current.scrollHeight>x.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),x=ha(b=>{x.current?.removeEventListener("scroll",m),x.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),y=ha(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:v}=S.contentRect,C=v-(k??v);if(d.resizeDifference=C,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),C>=0){const w=wi(l.current,k?l.current.resize:l.current.initial);f({animation:w,wait:!0,preserveScrollPosition:!0,duration:w==="instant"?void 0:zm})}else d.isNearBottom&&(u(!1),c(!0));k=v,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===C&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:x,scrollToBottom:f,stopScroll:h,isAtBottom:r||i,isNearBottom:i,escapedFromLock:e,state:d}};function ha(n,e){const t=E.useCallback(r=>(t.current=r,n(r)),e);return t}const vi=new Map;function wi(...n){const e={...Lm};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!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 vi.has(r)||vi.set(r,Object.freeze(e)),t?"instant":vi.get(r)}function Fm(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function nl(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function rl(n,e){if(!e)return n;const t=`${Fm(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Vm(n,e){return rl(n,e).replace(/[_-]/g," ").toLowerCase()}function Hm(n){const e={};for(const t of n?.arguments??[])e[t.name]=t.required?la().min(1,"Required"):la();return rp(e)}function Wm(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Um(n){const e=_.c(67),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=E.useId();let l,a;if(e[0]!==t){const P=Hm(t);a=sp,l=np(P),e[0]=t,e[1]=l,e[2]=a}else l=e[1],a=e[2];let c;e[3]!==i||e[4]!==t?(c=t?Wm(t,i):{},e[3]=i,e[4]=t,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u={resolver:l,defaultValues:c,mode:"onChange"},e[6]=l,e[7]=c,e[8]=u):u=e[8];const d=a(u);let f;e[9]!==t?.arguments?(f=t?.arguments??[],e[9]=t?.arguments,e[10]=f):f=e[10];const h=f;let m;e[11]!==d||e[12]!==s||e[13]!==r?(m=async P=>{await s(P),r(null),d.reset()},e[11]=d,e[12]=s,e[13]=r,e[14]=m):m=e[14];const g=m;let x;e[15]!==d||e[16]!==r?(x=P=>{P||(d.reset(),r(null))},e[15]=d,e[16]=r,e[17]=x):x=e[17];const y=x;if(!t)return null;let b;e[18]!==t._meta||e[19]!==t.name||e[20]!==t.title?(b=t.title||Vm(t.name,nl(t._meta)),e[18]=t._meta,e[19]=t.name,e[20]=t.title,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(vm,{children:p.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[24]=t.description,e[25]=S):S=e[25];let v;e[26]!==S||e[27]!==k?(v=p.jsxs(wm,{children:[k,S]}),e[26]=S,e[27]=k,e[28]=v):v=e[28];let C;e[29]!==d||e[30]!==g?(C=P=>{P.stopPropagation(),d.handleSubmit(g)(P)},e[29]=d,e[30]=g,e[31]=C):C=e[31];let w;if(e[32]!==h||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let P;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(P=z=>p.jsx(Em,{control:d.control,name:z.name,render:B=>{const{field:q}=B;return p.jsxs(Am,{children:[p.jsxs(jm,{className:"text-xs",children:[z.name,z.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Im,{children:p.jsx(Rm,{...q,value:q.value??"",required:z.required,placeholder:z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),p.jsx(Om,{})]})}},z.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=P):P=e[38],w=h.map(P),e[32]=h,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=w}else w=e[35];let T;e[39]!==y?(T=()=>y(!1),e[39]=y,e[40]=T):T=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==T?(N=p.jsx(mt,{type:"button",variant:"ghost",onClick:T,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=T,e[43]=N):N=e[43];let M;e[44]!==d.formState.isSubmitting?(M=d.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Qp,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=M):M=e[45];let j;e[46]!==d.formState.isSubmitting||e[47]!==o||e[48]!==M?(j=p.jsx(mt,{type:"submit",form:o,disabled:d.formState.isSubmitting,children:M}),e[46]=d.formState.isSubmitting,e[47]=o,e[48]=M,e[49]=j):j=e[49];let O;e[50]!==N||e[51]!==j?(O=p.jsxs(Cm,{children:[N,j]}),e[50]=N,e[51]=j,e[52]=O):O=e[52];let A;e[53]!==o||e[54]!==C||e[55]!==w||e[56]!==O?(A=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:C,children:[w,O]}),e[53]=o,e[54]=C,e[55]=w,e[56]=O,e[57]=A):A=e[57];let R;e[58]!==d||e[59]!==A?(R=p.jsx(Mm,{...d,children:A}),e[58]=d,e[59]=A,e[60]=R):R=e[60];let I;e[61]!==v||e[62]!==R?(I=p.jsxs(Tm,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,R]}),e[61]=v,e[62]=R,e[63]=I):I=e[63];let $;return e[64]!==y||e[65]!==I?($=p.jsx(Nm,{open:!0,onOpenChange:y,children:I}),e[64]=y,e[65]=I,e[66]=$):$=e[66],$}function Du(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function ct(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function Jn(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Oe(n){this.content=n}Oe.prototype={constructor:Oe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Oe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Oe(t)},addToStart:function(n,e){return new Oe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Oe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Oe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Oe.from(n),n.size?new Oe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Oe.from(n),n.size?new Oe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Oe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Oe.from=function(n){if(n instanceof Oe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Oe(e)};function Pu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Pu(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Lu(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Lu(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class D{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new D(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new D(r,s)}cutByIndex(e,t){return e==t?D.empty:e==0&&t==this.content.length?this:new D(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new D(s,i)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Pu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Lu(this,e,t,r)}findIndex(e){if(e==0)return $r(0,e);if(e==this.size)return $r(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?$r(t+1,i):$r(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return D.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new D(t||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Ci={index:0,offset:0};function $r(n,e){return Ci.index=n,Ci.offset=e,Ci}function is(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!is(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!is(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let fe=class so{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&is(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return so.none;if(e instanceof so)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};fe.none=[];class ls extends Error{}class F{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$u(this.content,e+this.openStart,t);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F(_u(this.content,e+this.openStart,t+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,t){if(!t)return F.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(D.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new F(e,r,s)}}F.empty=new F(D.empty,0,0);function _u(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(_u(i.content,e-s-1,t-s-1)))}function $u(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=$u(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function qm(n,e,t){if(t.openStart>n.depth)throw new ls("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ls("Inconsistent open depths");return zu(n,e,t,0)}function zu(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=zu(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return cn(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Km(t,n);return cn(i,Fu(n,o,l,e,r))}else return cn(i,as(n,e,r))}function Bu(n,e){if(!e.type.compatibleContent(n.type))throw new ls("Cannot join "+e.type.name+" onto "+n.type.name)}function io(n,e,t){let r=n.node(t);return Bu(r,e.node(t)),r}function an(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function or(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(an(n.nodeAfter,r),i++));for(let l=i;l<o;l++)an(s.child(l),r);e&&e.depth==t&&e.textOffset&&an(e.nodeBefore,r)}function cn(n,e){return n.type.checkContent(e),n.copy(e)}function Fu(n,e,t,r,s){let i=n.depth>s&&io(n,e,s+1),o=r.depth>s&&io(t,r,s+1),l=[];return or(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Bu(i,o),an(cn(i,Fu(n,e,t,r,s+1)),l)):(i&&an(cn(i,as(n,e,s+1)),l),or(e,t,s,l),o&&an(cn(o,as(t,r,s+1)),l)),or(r,null,s,l),new D(l)}function as(n,e,t){let r=[];if(or(null,n,t,r),n.depth>t){let s=io(n,e,t+1);an(cn(s,as(n,e,t+1)),r)}return or(e,null,t,r),new D(r)}function Km(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(D.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class xr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw 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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return fe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cs(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new xr(t,r,i)}static resolveCached(e,t){let r=pa.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else pa.set(e,r=new Jm);let s=r.elts[r.i]=xr.resolve(e,t);return r.i=(r.i+1)%Gm,s}}class Jm{constructor(){this.elts=[],this.i=0}}const Gm=12,pa=new WeakMap;class cs{constructor(e,t,r){this.$from=e,this.$to=t,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 Xm=Object.create(null);class at{constructor(e,t,r,s=fe.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||D.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,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,t,r,s){return this.content.textBetween(e,t,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,t,r){return this.type==e&&is(this.attrs,t||e.defaultAttrs||Xm)&&fe.sameSet(this.marks,r||fe.none)}copy(e=null){return e==this.content?this:new at(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new at(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return F.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new F(c,s.depth-o,i.depth-o)}replace(e,t,r){return qm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return xr.resolveCached(this,e)}resolveNoCache(e){return xr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.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()+")"),Vu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=D.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=fe.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=D.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}at.prototype.text=void 0;class us extends at{constructor(e,t,r,s){if(super(e,t,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):Vu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new us(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new us(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Vu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class xn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ym(e,t);if(r.next==null)return xn.empty;let s=Hu(r);r.next&&r.err("Unexpected trailing text");let i=sg(rg(s));return ig(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return D.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{r as E,c as _,J as np,j as p,B as mt,I as la,H as rp,M as sp,bJ as eu,bK as ip,at as op,aM as hn,bL as lp,l as Z,p as ap,aR as cp,aO as Jt,aV as up,aU as Bt,ba as Ar,aS as vn,bM as tu,aQ as nu,C as Mt,n as dp,d as fp,K as nt,t as eo,m as jr,b as qn,E as ru,aL as su,bN as Uo,aT as hp,bO as tn}from"./index-ibVYCtdk.js";import{e as pp,a as mp,b as gp,c as xp,d as Pr,S as yp}from"./select-DCMRbMTV.js";import{u as iu}from"./useInfiniteQuery-k0Oz8aiZ.js";import{a as ou,u as bp}from"./use-connection-DkYq5t3v.js";import{c as kp,u as qo}from"./use-mcp-client-OGs9WihN.js";import{u as Sp}from"./use-virtual-mcp-CkueoyOa.js";import{b as vp,i as wp,a as Cp,S as Tp}from"./constants-D_FQAPnt.js";import{C as Np}from"./card-CWxEyxBu.js";import{o as lu,m as au,p as Ko,q as Jo}from"./sidebar-BIOIlAO_.js";import{c as cu,d as uu,a as Ys,e as Qe,b as du,T as Ze}from"./table-DUOWHqJQ.js";import{E as to}from"./empty-state-Dj1UiFtA.js";import{u as Go}from"./use-infinite-scroll-BkLL2k_w.js";import{u as Mp}from"./use-members-BEIFWHR7.js";import{u as fu,S as Pn}from"./use-clock-tick-2EW1HZaU.js";import{e as Ep}from"./use-automations-C8vesZ5J.js";import{u as hu}from"./studio-tools-CiEb3YCV.js";import{u as Ap}from"./useSuspenseInfiniteQuery-D6yz4hO3.js";import{B as rs}from"./badge-Bu2YMz_4.js";import{C as aa}from"./checkbox-DHREKNj6.js";import{t as Ln}from"./ChevronDown-UK2bP1UQ.js";import{b as jp,C as Ip,a as ca,c as Op,e as Rp,d as Dp}from"./command-BwCOntKm.js";import{P as pu,a as mu,b as gu}from"./popover-D59OWen2.js";import{A as xu}from"./avatar-BeXwGFfk.js";import{n as no}from"./ChevronUp-C2du4mz8.js";import{t as Pp,a as yu,n as Xo}from"./Tool02-B9R6nZBJ.js";import{i as Lp}from"./FilterLines-DoBDuM0w.js";import{e as _p,U as $p,u as zp,ap as Bp,aa as Fp,af as Vp,j as Hp,an as bu,aq as Wp,ar as Up,A as ku,as as ht,at as qp,au as Kp,av as Jp}from"./agent-icon-CTdje-Yo.js";import{t as Qs}from"./Stars01-DkyiijKz.js";import{i as Su,b as Lr}from"./XCircle-H5V2L4xB.js";import{i as Yo}from"./Check-CHx9EjoK.js";import{i as ua}from"./ChevronRight-EIxlJCAn.js";import{a as vu}from"./Copy01-Dec6QuUO.js";import{b as Ut,t as Qo,c as da}from"./format-time-BnbuEtat.js";import{u as wu}from"./use-copy-DqYfTFoV.js";import{T as pn,a as mn,b as gn}from"./tooltip-DmGjSLGv.js";import{M as Zo,I as Cu,F as Gp}from"./file-type-icon-mhXAsYz9.js";import{c as Xp}from"./monaco-editor-CbXE9Xqh.js";import{g as Tu,M as Yp}from"./index-Bc-Htd9N.js";import{S as Qp,h as Kn,m as Zp,c as el,d as em,b as tm}from"./chat-context-Cr6qmlGy.js";import{c as nm,r as rm,g as sm,R as im}from"./hooks-C1wDxsG8.js";import{f as om,n as lm,o as am}from"./tab-id-BijBBRwE.js";import{i as Nu}from"./AlertCircle-C0LNRXFL.js";import{s as cm}from"./Eye-Tv0RqHHP.js";import{s as ss,t as Mu}from"./Star01-rwC6MUs1.js";import{s as um}from"./XClose-AmEq2OYZ.js";import{n as ro}from"./ZapSquare-D3GithUx.js";import{n as Eu,i as dm}from"./Globe01-Dv1MemnH.js";import{d as fm,c as hm,a as _r}from"./Tool01-vwcHp5vx.js";import{i as fa,a as pm}from"./ZoomOut-CXi1AmaE.js";import{i as ir}from"./Monitor01-BXWr0YEZ.js";import{i as mm}from"./SearchMd-DPgb_Mb5.js";import{i as gm}from"./Upload01-CbyoXv84.js";import{u as xm,a as ym}from"./shell-layout-DPnzwBdL.js";import{n as Au}from"./LinkExternal01-DTumzywO.js";import{I as Gt}from"./integration-icon-CH7ULFsC.js";import{i as bm}from"./ArrowUpRight-CfyQUwOR.js";import{a as tl}from"./Users03-CeF5jvSj.js";import{a as pt}from"./Palette-DLRDeZMj.js";import{c as ju}from"./use-navigate-to-agent-miif_g44.js";import{a as km}from"./Stars02-CFJkyC0W.js";import{g as Sm}from"./AreaChart-DRbv2Se_.js";import{a as vm,D as wm,c as Cm,d as Tm,e as Nm}from"./dialog-uPEldi6L.js";import{a as Mm,F as Em,b as Am,c as jm,d as Im,f as Om}from"./form-CBIL6eiC.js";import{I as Rm}from"./input-CLma5TTa.js";import{i as Dm}from"./UserPlus01-DoMT5VeR.js";const Pm={openrouter:n=>{const e=n?.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 Iu(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Pm)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Ou(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Ru(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+Iu(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function kT(n){return n.reduce((e,t)=>Ru(e,t.metadata?.usage),Ou())}const Lm={damping:.7,stiffness:.05,mass:1.25},_m=70,$m=1e3/60,zm=350;let Zs=!1;globalThis.document?.addEventListener("mousedown",()=>{Zs=!0});globalThis.document?.addEventListener("mouseup",()=>{Zs=!1});globalThis.document?.addEventListener("click",()=>{Zs=!1});const Bm=(n={})=>{const[e,t]=E.useState(!1),[r,s]=E.useState(n.initial!==!1),[i,o]=E.useState(!1),l=E.useRef(null);l.current=n;const a=E.useCallback(()=>{if(!Zs)return!1;const b=window.getSelection();if(!b||!b.rangeCount)return!1;const k=b.getRangeAt(0);return k.commonAncestorContainer.contains(x.current)||x.current?.contains(k.commonAncestorContainer)},[]),c=E.useCallback(b=>{d.isAtBottom=b,s(b)},[]),u=E.useCallback(b=>{d.escapedFromLock=b,t(b)},[]),d=E.useMemo(()=>{let b;return{escapedFromLock:e,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return x.current?.scrollTop??0},set scrollTop(k){if(x.current){const{scrollBehavior:S}=getComputedStyle(x.current);S!=="auto"&&(x.current.style.scrollBehavior="auto"),x.current.scrollTop=k,d.ignoreScrollToTop=x.current.scrollTop,S!=="auto"&&(x.current.style.scrollBehavior=S)}},get targetScrollTop(){return!x.current||!y.current?0:x.current.scrollHeight-1-x.current.clientHeight},get calculatedTargetScrollTop(){if(!x.current||!y.current)return 0;const{targetScrollTop:k}=this;if(!n.targetScrollTop)return k;if(b?.targetScrollTop===k)return b.calculatedScrollTop;const S=Math.max(Math.min(n.targetScrollTop(k,{scrollElement:x.current,contentElement:y.current}),k),0);return b={targetScrollTop:k,calculatedScrollTop:S},requestAnimationFrame(()=>{b=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=_m}}},[]),f=E.useCallback((b={})=>{typeof b=="string"&&(b={animation:b}),b.preserveScrollPosition||c(!0);const k=Date.now()+(Number(b.wait)||0),S=wi(l.current,b.animation),{ignoreEscapes:v=!1}=b;let C,w=d.calculatedTargetScrollTop;b.duration instanceof Promise?b.duration.finally(()=>{C=Date.now()}):C=k+(b.duration??0);const T=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;const{scrollTop:M}=d,j=performance.now(),O=(j-(d.lastTick??j))/$m;if(d.animation||(d.animation={behavior:S,promise:N,ignoreEscapes:v}),d.animation.behavior===S&&(d.lastTick=j),a()||k>Date.now())return T();if(M<Math.min(w,d.calculatedTargetScrollTop)){if(d.animation?.behavior===S){if(S==="instant")return d.scrollTop=d.calculatedTargetScrollTop,T();d.velocity=(S.damping*d.velocity+S.stiffness*d.scrollDifference)/S.mass,d.accumulated+=d.velocity*O,d.scrollTop+=d.accumulated,d.scrollTop!==M&&(d.accumulated=0)}return T()}return C>Date.now()?(w=d.calculatedTargetScrollTop,T()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:wi(l.current,l.current.resize),ignoreEscapes:v,duration:Math.max(0,C-Date.now())||void 0}):d.isAtBottom)});return N.then(M=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),M))};return b.wait!==!0&&(d.animation=void 0),d.animation?.behavior===S?d.animation.promise:T()},[c,a,d]),h=E.useCallback(()=>{u(!0),c(!1)},[u,c]),m=E.useCallback(({target:b})=>{if(b!==x.current)return;const{scrollTop:k,ignoreScrollToTop:S}=d;let{lastScrollTop:v=k}=d;d.lastScrollTop=k,d.ignoreScrollToTop=void 0,S&&S>k&&(v=S),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||k===S)return;if(a()){u(!0),c(!1);return}const C=k>v,w=k<v;if(d.animation?.ignoreEscapes){d.scrollTop=v;return}w&&(u(!0),c(!1)),C&&u(!1),!d.escapedFromLock&&d.isNearBottom&&c(!0)},1)},[u,c,a,d]),g=E.useCallback(({target:b,deltaY:k})=>{let S=b;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===x.current&&k<0&&x.current.scrollHeight>x.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),c(!1))},[u,c,d]),x=ha(b=>{x.current?.removeEventListener("scroll",m),x.current?.removeEventListener("wheel",g),b?.addEventListener("scroll",m,{passive:!0}),b?.addEventListener("wheel",g,{passive:!0})},[]),y=ha(b=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!b)return;let k;d.resizeObserver=new ResizeObserver(([S])=>{const{height:v}=S.contentRect,C=v-(k??v);if(d.resizeDifference=C,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),C>=0){const w=wi(l.current,k?l.current.resize:l.current.initial);f({animation:w,wait:!0,preserveScrollPosition:!0,duration:w==="instant"?void 0:zm})}else d.isNearBottom&&(u(!1),c(!0));k=v,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===C&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(b)},[]);return{contentRef:y,scrollRef:x,scrollToBottom:f,stopScroll:h,isAtBottom:r||i,isNearBottom:i,escapedFromLock:e,state:d}};function ha(n,e){const t=E.useCallback(r=>(t.current=r,n(r)),e);return t}const vi=new Map;function wi(...n){const e={...Lm};let t=!1;for(const s of n){if(s==="instant"){t=!0;continue}typeof s=="object"&&(t=!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 vi.has(r)||vi.set(r,Object.freeze(e)),t?"instant":vi.get(r)}function Fm(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function nl(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function rl(n,e){if(!e)return n;const t=`${Fm(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Vm(n,e){return rl(n,e).replace(/[_-]/g," ").toLowerCase()}function Hm(n){const e={};for(const t of n?.arguments??[])e[t.name]=t.required?la().min(1,"Required"):la();return rp(e)}function Wm(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Um(n){const e=_.c(67),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=E.useId();let l,a;if(e[0]!==t){const P=Hm(t);a=sp,l=np(P),e[0]=t,e[1]=l,e[2]=a}else l=e[1],a=e[2];let c;e[3]!==i||e[4]!==t?(c=t?Wm(t,i):{},e[3]=i,e[4]=t,e[5]=c):c=e[5];let u;e[6]!==l||e[7]!==c?(u={resolver:l,defaultValues:c,mode:"onChange"},e[6]=l,e[7]=c,e[8]=u):u=e[8];const d=a(u);let f;e[9]!==t?.arguments?(f=t?.arguments??[],e[9]=t?.arguments,e[10]=f):f=e[10];const h=f;let m;e[11]!==d||e[12]!==s||e[13]!==r?(m=async P=>{await s(P),r(null),d.reset()},e[11]=d,e[12]=s,e[13]=r,e[14]=m):m=e[14];const g=m;let x;e[15]!==d||e[16]!==r?(x=P=>{P||(d.reset(),r(null))},e[15]=d,e[16]=r,e[17]=x):x=e[17];const y=x;if(!t)return null;let b;e[18]!==t._meta||e[19]!==t.name||e[20]!==t.title?(b=t.title||Vm(t.name,nl(t._meta)),e[18]=t._meta,e[19]=t.name,e[20]=t.title,e[21]=b):b=e[21];let k;e[22]!==b?(k=p.jsx(vm,{children:p.jsx("span",{className:"capitalize",children:b})}),e[22]=b,e[23]=k):k=e[23];let S;e[24]!==t.description?(S=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[24]=t.description,e[25]=S):S=e[25];let v;e[26]!==S||e[27]!==k?(v=p.jsxs(wm,{children:[k,S]}),e[26]=S,e[27]=k,e[28]=v):v=e[28];let C;e[29]!==d||e[30]!==g?(C=P=>{P.stopPropagation(),d.handleSubmit(g)(P)},e[29]=d,e[30]=g,e[31]=C):C=e[31];let w;if(e[32]!==h||e[33]!==d.control||e[34]!==d.formState.isSubmitting){let P;e[36]!==d.control||e[37]!==d.formState.isSubmitting?(P=z=>p.jsx(Em,{control:d.control,name:z.name,render:B=>{const{field:q}=B;return p.jsxs(Am,{children:[p.jsxs(jm,{className:"text-xs",children:[z.name,z.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Im,{children:p.jsx(Rm,{...q,value:q.value??"",required:z.required,placeholder:z.description??"",className:"h-9",disabled:d.formState.isSubmitting})}),p.jsx(Om,{})]})}},z.name),e[36]=d.control,e[37]=d.formState.isSubmitting,e[38]=P):P=e[38],w=h.map(P),e[32]=h,e[33]=d.control,e[34]=d.formState.isSubmitting,e[35]=w}else w=e[35];let T;e[39]!==y?(T=()=>y(!1),e[39]=y,e[40]=T):T=e[40];let N;e[41]!==d.formState.isSubmitting||e[42]!==T?(N=p.jsx(mt,{type:"button",variant:"ghost",onClick:T,disabled:d.formState.isSubmitting,children:"Cancel"}),e[41]=d.formState.isSubmitting,e[42]=T,e[43]=N):N=e[43];let M;e[44]!==d.formState.isSubmitting?(M=d.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Qp,{size:"xs"}),"Loading..."]}):"Use prompt",e[44]=d.formState.isSubmitting,e[45]=M):M=e[45];let j;e[46]!==d.formState.isSubmitting||e[47]!==o||e[48]!==M?(j=p.jsx(mt,{type:"submit",form:o,disabled:d.formState.isSubmitting,children:M}),e[46]=d.formState.isSubmitting,e[47]=o,e[48]=M,e[49]=j):j=e[49];let O;e[50]!==N||e[51]!==j?(O=p.jsxs(Cm,{children:[N,j]}),e[50]=N,e[51]=j,e[52]=O):O=e[52];let A;e[53]!==o||e[54]!==C||e[55]!==w||e[56]!==O?(A=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:C,children:[w,O]}),e[53]=o,e[54]=C,e[55]=w,e[56]=O,e[57]=A):A=e[57];let R;e[58]!==d||e[59]!==A?(R=p.jsx(Mm,{...d,children:A}),e[58]=d,e[59]=A,e[60]=R):R=e[60];let I;e[61]!==v||e[62]!==R?(I=p.jsxs(Tm,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[v,R]}),e[61]=v,e[62]=R,e[63]=I):I=e[63];let $;return e[64]!==y||e[65]!==I?($=p.jsx(Nm,{open:!0,onOpenChange:y,children:I}),e[64]=y,e[65]=I,e[66]=$):$=e[66],$}function Du(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function ct(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function Jn(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Oe(n){this.content=n}Oe.prototype={constructor:Oe,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Oe(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Oe(t)},addToStart:function(n,e){return new Oe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Oe(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Oe(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Oe.from(n),n.size?new Oe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Oe.from(n),n.size?new Oe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Oe.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Oe.from=function(n){if(n instanceof Oe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Oe(e)};function Pu(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Pu(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Lu(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Lu(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class D{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new D(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new D(r,s)}cutByIndex(e,t){return e==t?D.empty:e==0&&t==this.content.length?this:new D(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new D(s,i)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Pu(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Lu(this,e,t,r)}findIndex(e){if(e==0)return $r(0,e);if(e==this.size)return $r(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?$r(t+1,i):$r(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return D.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new D(t||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Ci={index:0,offset:0};function $r(n,e){return Ci.index=n,Ci.offset=e,Ci}function is(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!is(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!is(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let fe=class so{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&is(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return so.none;if(e instanceof so)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};fe.none=[];class ls extends Error{}class F{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$u(this.content,e+this.openStart,t);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F(_u(this.content,e+this.openStart,t+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,t){if(!t)return F.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(D.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new F(e,r,s)}}F.empty=new F(D.empty,0,0);function _u(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(_u(i.content,e-s-1,t-s-1)))}function $u(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=$u(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function qm(n,e,t){if(t.openStart>n.depth)throw new ls("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ls("Inconsistent open depths");return zu(n,e,t,0)}function zu(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=zu(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return cn(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Km(t,n);return cn(i,Fu(n,o,l,e,r))}else return cn(i,as(n,e,r))}function Bu(n,e){if(!e.type.compatibleContent(n.type))throw new ls("Cannot join "+e.type.name+" onto "+n.type.name)}function io(n,e,t){let r=n.node(t);return Bu(r,e.node(t)),r}function an(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function or(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(an(n.nodeAfter,r),i++));for(let l=i;l<o;l++)an(s.child(l),r);e&&e.depth==t&&e.textOffset&&an(e.nodeBefore,r)}function cn(n,e){return n.type.checkContent(e),n.copy(e)}function Fu(n,e,t,r,s){let i=n.depth>s&&io(n,e,s+1),o=r.depth>s&&io(t,r,s+1),l=[];return or(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Bu(i,o),an(cn(i,Fu(n,e,t,r,s+1)),l)):(i&&an(cn(i,as(n,e,s+1)),l),or(e,t,s,l),o&&an(cn(o,as(t,r,s+1)),l)),or(r,null,s,l),new D(l)}function as(n,e,t){let r=[];if(or(null,n,t,r),n.depth>t){let s=io(n,e,t+1);an(cn(s,as(n,e,t+1)),r)}return or(e,null,t,r),new D(r)}function Km(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(D.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class xr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw 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,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return fe.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new cs(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 t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new xr(t,r,i)}static resolveCached(e,t){let r=pa.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else pa.set(e,r=new Jm);let s=r.elts[r.i]=xr.resolve(e,t);return r.i=(r.i+1)%Gm,s}}class Jm{constructor(){this.elts=[],this.i=0}}const Gm=12,pa=new WeakMap;class cs{constructor(e,t,r){this.$from=e,this.$to=t,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 Xm=Object.create(null);class at{constructor(e,t,r,s=fe.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||D.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,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,t,r,s){return this.content.textBetween(e,t,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,t,r){return this.type==e&&is(this.attrs,t||e.defaultAttrs||Xm)&&fe.sameSet(this.marks,r||fe.none)}copy(e=null){return e==this.content?this:new at(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new at(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return F.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new F(c,s.depth-o,i.depth-o)}replace(e,t,r){return qm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return xr.resolveCached(this,e)}resolveNoCache(e){return xr.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.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()+")"),Vu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=D.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.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=fe.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=D.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}at.prototype.text=void 0;class us extends at{constructor(e,t,r,s){if(super(e,t,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):Vu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new us(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new us(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Vu(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class xn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ym(e,t);if(r.next==null)return xn.empty;let s=Hu(r);r.next&&r.err("Unexpected trailing text");let i=sg(rg(s));return ig(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return D.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.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 t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}xn.empty=new xn(!0);class Ym{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hu(n){let e=[];do e.push(Qm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Qm(n){let e=[];do e.push(Zm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Zm(n){let e=ng(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=eg(n,e);else break;return e}function ma(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function eg(n,e){let t=ma(n),r=t;return n.eat(",")&&(n.next!="}"?r=ma(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function tg(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function ng(n){if(n.eat("(")){let e=Hu(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=tg(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function rg(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Wu(n,e){return e-n}function ga(n,e){let t=[];return r(e),t.sort(Wu);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function sg(n){let e=Object.create(null);return t(ga(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);ga(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new xn(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Wu);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function ig(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Uu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function Ku(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function Ju(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new lg(n,r,e[r]);return t}let xa=class Gu{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ju(e,r.attrs),this.defaultAttrs=Uu(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==xn.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:qu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new at(this,this.computeAttrs(e),D.from(t),fe.setFrom(r))}createChecked(e=null,t,r){return t=D.from(t),this.checkContent(t),new at(this,this.computeAttrs(e),t,fe.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=D.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(D.empty,!0);return i?new at(this,e,t.append(i),fe.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Ku(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:fe.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new Gu(i,t,o));let s=t.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 i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function og(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class lg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?og(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ei{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=Ju(e,s.attrs),this.excluded=null;let i=Uu(this.attrs);this.instance=i?new fe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new fe(this,qu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new ei(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ku(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Oe.from(e.nodes),t.marks=Oe.from(e.marks||{}),this.nodes=xa.compile(this.spec.nodes,this),this.marks=ei.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 i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=xn.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ya(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ya(this,o.split(" "))}this.nodeFromJSON=s=>at.fromJSON(this,s),this.markFromJSON=s=>fe.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xa){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(t,r,s)}text(e,t){let r=this.nodes.text;return new us(r,r.defaultAttrs,e,fe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ya(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ag(n){return n.tag!=null}function cg(n){return n.style!=null}class Ft{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(ag(s))this.tags.push(s);else if(cg(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new ka(this,t,!1);return r.addAll(e,fe.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ka(this,t,!0);return r.addAll(e,fe.none,t.from,t.to),F.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(fg(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Sa(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Sa(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ft(e,Ft.schemaRules(e)))}}const Yu={address:!0,article:!0,aside:!0,blockquote:!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},ug={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qu={ol:!0,ul:!0},yr=1,oo=2,lr=4;function ba(n,e,t){return e!=null?(e?yr:0)|(e==="full"?oo:0):n&&n.whitespace=="pre"?yr|oo:t&~lr}class zr{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=fe.none,this.match=i||(o&lr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(D.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&yr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=D.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(D.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Yu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ka{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=ba(null,t.preserveWhitespace,0)|(r?lr:0);s?i=new zr(s.type,s.attrs,fe.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new zr(null,null,fe.none,!0,null,o):i=new zr(e.schema.topNodeType,null,fe.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&oo?"full":this.localPreserveWS||(s.options&yr)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));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 l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Qu.hasOwnProperty(o)&&this.parser.normalizeLists&&dg(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:ug.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(Yu.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=fe.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):va(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=ba(e,i,o.options);o.options&lr&&o.content.length==0&&(l|=lr);let a=fe.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):va(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new zr(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=yr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function dg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Qu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function fg(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Sa(n){let e={};for(let t in n)e[t]=n[t];return e}function va(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class wn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ti(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Qr(Ti(t),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,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Qr(Ti(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Qr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=wa(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return wa(e.marks)}}function wa(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ti(n){return n.document||window.document}const Ca=new WeakMap;function hg(n){let e=Ca.get(n);return e===void 0&&Ca.set(n,e=pg(n)),e}function pg(n){let e=null;function t(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++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Qr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=hg(r))&&i.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 o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.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?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.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:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Qr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Zu=65535,ed=Math.pow(2,16);function mg(n,e){return n+e*ed}function Ta(n){return n&Zu}function gg(n){return(n-(n&Zu))/ed}const td=1,nd=2,Zr=4,rd=8;class lo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&rd)>0}get deletedBefore(){return(this.delInfo&(td|Zr))>0}get deletedAfter(){return(this.delInfo&(nd|Zr))>0}get deletedAcross(){return(this.delInfo&Zr)>0}}class Je{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Je.empty)return Je.empty}recover(e){let t=0,r=Ta(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+gg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:mg(l/3,e-a),g=e==a?nd:e==d?td:Zr;return(t<0?e!=a:e!=d)&&(g|=rd),new lo(h,g,m)}s+=u-c}return r?e+s:new lo(e+s,0,null)}touches(e,t){let r=0,s=Ta(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Je(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Je.empty:new Je(e<0?[0,-e,0]:[0,0,e])}}Je.empty=new Je([]);class br{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new br(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new br;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new lo(e,s,null)}}const Ni=Object.create(null);class Be{getMap(){return Je.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ni[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ni)throw new RangeError("Duplicate use of step JSON ID "+e);return Ni[e]=t,t.prototype.jsonID=e,t}}class Ce{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Ce(e,null)}static fail(e){return new Ce(null,e)}static fromReplace(e,t,r,s){try{return Ce.ok(e.replace(t,r,s))}catch(i){if(i instanceof ls)return Ce.fail(i.message);throw i}}}function sl(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(sl(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return D.fromArray(r)}class _t extends Be{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new F(sl(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return Ce.fromReplace(e,this.from,this.to,i)}invert(){return new lt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new _t(t.pos,r.pos,this.mark)}merge(e){return e instanceof _t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _t(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new _t(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("addMark",_t);class lt extends Be{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new F(sl(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Ce.fromReplace(e,this.from,this.to,r)}invert(){return new _t(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new lt(t.pos,r.pos,this.mark)}merge(e){return e instanceof lt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lt(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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new lt(t.from,t.to,e.markFromJSON(t.mark))}}Be.jsonID("removeMark",lt);class $t extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ce.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new F(D.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new $t(this.pos,t.marks[s]);return new $t(this.pos,this.mark)}}return new yn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new $t(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new $t(t.pos,e.markFromJSON(t.mark))}}Be.jsonID("addNodeMark",$t);class yn extends Be{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Ce.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Ce.fromReplace(e,this.pos,this.pos+1,new F(D.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new $t(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yn(t.pos,e.markFromJSON(t.mark))}}Be.jsonID("removeNodeMark",yn);class we extends Be{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&ao(e,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Je([this.from,this.to-this.from,this.slice.size])}invert(e){return new we(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&we.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new we(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof we)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=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 we(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=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 we(e.from,this.to,t,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,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new we(t.from,t.to,F.fromJSON(e,t.slice),!!t.structure)}}we.MAP_BIAS=1;Be.jsonID("replace",we);class Ae extends Be{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(ao(e,this.from,this.gapFrom)||ao(e,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Ce.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Ce.fromReplace(e,this.from,this.to,r):Ce.fail("Content does not fit in gap")}getMap(){return new Je([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ae(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Ae(t.pos,r.pos,s,i,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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ae(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}Be.jsonID("replaceAround",Ae);function ao(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function xg(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new lt(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new _t(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function yg(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof ei){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new lt(o.from,o.to,o.style)))}function il(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new we(l,u,F.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new lt(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new F(D.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new we(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(D.empty,!0);n.replace(l,l,new F(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function bg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Gn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!bg(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function kg(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=D.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=D.from(r.node(m).copy(u)),d++):a--;let f=D.empty,h=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=D.from(s.node(m).copy(f)),h++):c++;n.step(new Ae(a,c,o,l,new F(u.append(f),d,h),u.size-d,!0))}function ol(n,e,t=null,r=n){let s=Sg(n,e),i=s&&vg(r,e);return i?s.map(Na).concat({type:e,attrs:t}).concat(i.map(Na)):null}function Na(n){return{type:n,attrs:null}}function Sg(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function vg(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function wg(n,e,t){let r=D.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=D.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Ae(s,i,s,i,new F(r,0,0),t.length,!0))}function Cg(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&Tg(n.doc,n.mapping.slice(i).map(l),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&&id(n,o,l,i),il(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Ae(d,f,d+1,f-1,new F(D.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&sd(n,o,l,i),!1}})}function sd(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function id(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -181,7 +181,7 @@ Output: Tool execution was denied`)}}}return t.length>0?t.join(`
181
181
  `);if(c)try{e.enqueue(JSON.parse(c))}catch{}}}}finally{t.releaseLock(),e.close()}}})}function HS(n){const{orgSlug:e,threadId:t,jobId:r,enabled:s}=n,[i,o]=E.useState([]),[l,a]=E.useState(!1);return E.useEffect(()=>{if(!s||!r)return;const c=new AbortController;return o([]),a(!0),(async()=>{try{const u=await fetch(`/api/${encodeURIComponent(e)}/decopilot/threads/${encodeURIComponent(t)}/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 rm({stream:sm(VS(u.body),void 0)})){if(c.signal.aborted)return;o([d])}}catch{}finally{c.signal.aborted||a(!1)}})(),()=>c.abort()},[s,r,t,e]),{messages:i,streaming:l}}function WS(n){if(n&&typeof n=="object"&&!Array.isArray(n)){const e=n;if(typeof e.text=="string"||typeof e.error=="string"||typeof e.finishReason=="string"){if(typeof e.error=="string"&&e.error.length>0)return`Subtask failed: ${e.error}`;const r=typeof e.text=="string"?e.text.trim():"",s=e.finishReason==="length";return r?(s?`[Subtask hit step limit — partial result below; consider narrowing the task.]
182
182
 
183
183
  `:"")+r:s?"[Subtask hit step limit before producing a final report. The subagent did work but ran out of steps. Narrow the task or increase the budget.]":"Subtask completed (no output)."}}return hS(n)}function Oh(n){return!!n&&typeof n=="object"&&n.background===!0}function Rh({part:n,subtaskMeta:e}){const t=n.state==="input-streaming"||n.state==="input-available",r=n.state==="output-available"&&n.preliminary===!0,s=n.state==="output-available"&&!n.preliminary,i=n.state==="output-error",o=ct(n.state,"preliminary"in n?n.preliminary:!1),l=o==="approval"?"idle":o,a=t?"Starting subtask...":r?"Subtask running...":s?"Subtask completed":i?"Subtask failed":"Subtask",c=n.input?.prompt??"",u=n.state==="approval-requested"?"Awaiting approval...":c.length>120?c.slice(0,120)+"…":c;return{fallbackTitle:a,summary:u,usage:e?.usage,state:l}}function Xl(n){const e=_.c(45),{icon:t,title:r,summary:s,state:i,usage:o,onOpenChange:l,children:a}=n,[c,u]=E.useState(!1);let d;e[0]!==l?(d=z=>{u(z),l?.(z)},e[0]=l,e[1]=d):d=e[1];const f=d,h=i==="loading",m=i==="error";let g;e[2]!==f?(g=()=>f(!0),e[2]=f,e[3]=g):g=e[3];const x=h&&"shimmer";let y;e[4]!==x?(y=Z("group/tool flex items-center gap-2 w-full py-2.5 text-left rounded-md transition-colors","[@media(hover:hover)]:hover:bg-accent/30",x),e[4]=x,e[5]=y):y=e[5];const b=m?"[&>svg]:text-warning/70":"[&>svg]:text-muted-foreground/75";let k;e[6]!==b?(k=Z("relative shrink-0 size-4 flex items-center justify-center [&>svg]:size-4",b),e[6]=b,e[7]=k):k=e[7];let S;e[8]!==t||e[9]!==k?(S=p.jsx("div",{className:k,children:t}),e[8]=t,e[9]=k,e[10]=S):S=e[10];const v=m?"text-warning/80":"text-foreground";let C;e[11]!==v?(C=Z("shrink-0 text-[14px] font-normal",v),e[11]=v,e[12]=C):C=e[12];let w;e[13]!==C||e[14]!==r?(w=p.jsx("span",{className:C,children:r}),e[13]=C,e[14]=r,e[15]=w):w=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 N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=p.jsx(bm,{className:"size-3.5 shrink-0 text-muted-foreground/40 opacity-0 transition-opacity [@media(hover:hover)]:group-hover/tool:opacity-100"}),e[18]=N):N=e[18];let M;e[19]!==o?(M=p.jsx(wh,{usage:o}),e[19]=o,e[20]=M):M=e[20];let j;e[21]!==w||e[22]!==T||e[23]!==M||e[24]!==g||e[25]!==y||e[26]!==S?(j=p.jsxs("button",{type:"button",onClick:g,className:y,children:[S,w,T,N,M]}),e[21]=w,e[22]=T,e[23]=M,e[24]=g,e[25]=y,e[26]=S,e[27]=j):j=e[27];let O;e[28]!==t?(O=p.jsx("span",{className:"flex items-center [&>svg]:size-4 [&>svg]:text-muted-foreground/75",children:t}),e[28]=t,e[29]=O):O=e[29];let A;e[30]!==O||e[31]!==r?(A=p.jsx(lu,{className:"px-4 py-3 border-b border-border shrink-0",children:p.jsxs(au,{className:"flex items-center gap-2 text-sm font-medium",children:[O,r]})}),e[30]=O,e[31]=r,e[32]=A):A=e[32];let R;e[33]!==a?(R=p.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-4",children:a}),e[33]=a,e[34]=R):R=e[34];let I;e[35]!==A||e[36]!==R?(I=p.jsxs(Ko,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0 gap-0",children:[A,R]}),e[35]=A,e[36]=R,e[37]=I):I=e[37];let $;e[38]!==c||e[39]!==f||e[40]!==I?($=p.jsx(Jo,{open:c,onOpenChange:f,children:I}),e[38]=c,e[39]=f,e[40]=I,e[41]=$):$=e[41];let P;return e[42]!==j||e[43]!==$?(P=p.jsxs(p.Fragment,{children:[j,$]}),e[42]=j,e[43]=$,e[44]=P):P=e[44],P}function Dh(n){const e=_.c(9),{part:t}=n,r=t.state==="output-error",s=t.input?.prompt??"No prompt provided";let i;if(e[0]!==r||e[1]!==t||e[2]!==s){const o=r?xi(t):WS(t.output)??"";let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[4]=l):l=e[4];let a;e[5]!==s?(a=p.jsxs("section",{children:[l,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:s})]}),e[5]=s,e[6]=a):a=e[6];const c=r?"Error":"Result";let u;e[7]!==c?(u=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:c}),e[7]=c,e[8]=u):u=e[8],i=p.jsxs("div",{className:"flex flex-col gap-4",children:[a,p.jsxs("section",{children:[u,o.trim()?p.jsx(Zo,{id:`${t.toolCallId}-result`,text:o}):p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic",children:"Running…"})]})]}),e[0]=r,e[1]=t,e[2]=s,e[3]=i}else i=e[3];return i}const Zi=600;function US(n){const e=_.c(12),{part:t}=n,r=t.type??"";let s;e[0]!==t.toolName||e[1]!==r?(s=r==="dynamic-tool"?t.toolName??"tool":r.slice(5),e[0]=t.toolName,e[1]=r,e[2]=s):s=e[2];const i=s;let o;if(e[3]!==t.input){const f=t.input!=null?JSON.stringify(t.input):"";o=f.length>80?`${f.slice(0,80)}…`:f||void 0,e[3]=t.input,e[4]=o}else o=e[4];const l=o;let a;if(e[5]!==t.input){const f=t.input!=null?JSON.stringify(t.input,null,2):null;a=f&&f.length>Zi?`${f.slice(0,Zi)}
184
- … (${f.length-Zi} more characters)`:f,e[5]=t.input,e[6]=a}else a=e[6];const c=a;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(yu,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==i||e[10]!==l?(d=p.jsx(ee,{icon:u,title:i,summary:l,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=i,e[10]=l,e[11]=d):d=e[11],d}function qS(n){const e=_.c(12),{jobId:t,prompt:r,items:s,streaming:i}=n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[0]=o):o=e[0];let l;e[1]!==r?(l=p.jsxs("section",{children:[o,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r})]}),e[1]=r,e[2]=l):l=e[2];let a;e[3]!==s||e[4]!==t||e[5]!==i?(a=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:"Running in the background…"}):s.map((d,f)=>{const h=d,m=h.type??"";return m==="text"?h.text?.trim()?p.jsx(pi,{id:`${t}-sub-${f}`,part:d,animate:i},`${t}-sub-${f}`):null:m==="dynamic-tool"||m.startsWith("tool-")&&m!=="tool-todo_write"&&m!=="tool-update_interests"?p.jsx(US,{part:h},`${t}-sub-${f}`):null}),e[3]=s,e[4]=t,e[5]=i,e[6]=a):a=e[6];let c;e[7]!==a?(c=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:a}),e[7]=a,e[8]=c):c=e[8];let u;return e[9]!==l||e[10]!==c?(u=p.jsxs("div",{className:"flex flex-col gap-4",children:[l,c]}),e[9]=l,e[10]=c,e[11]=u):u=e[11],u}function Ph(n){const e=_.c(21),{part:t}=n,r=t.output?.jobId,{taskId:s}=em(),{org:i}=Mt(),[o,l]=E.useState(!1),a=FS(r);let c;e[0]!==r||e[1]!==o||e[2]!==i.slug||e[3]!==s?(c={orgSlug:i.slug,threadId:s,jobId:r,enabled:o},e[0]=r,e[1]=o,e[2]=i.slug,e[3]=s,e[4]=c):c=e[4];const u=HS(c);let d;e[5]!==u.messages?(d=u.messages.flatMap(JS),e[5]=u.messages,e[6]=d):d=e[6];const f=d;let h;e[7]!==a?(h=a.flatMap(KS),e[7]=a,e[8]=h):h=e[8];const m=h,g=f.length>0?f:m,x=t.input?.prompt??"No prompt provided";let y;e[9]!==x?(y=x.length>120?`${x.slice(0,120)}…`:x,e[9]=x,e[10]=y):y=e[10];const b=y,k=a.length===0;let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(Gt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(tl,{})}),e[11]=S):S=e[11];const v=k?"loading":"idle",C=u.streaming||k;let w;e[12]!==g||e[13]!==r||e[14]!==x||e[15]!==C?(w=p.jsx(qS,{jobId:r,prompt:x,items:g,streaming:C}),e[12]=g,e[13]=r,e[14]=x,e[15]=C,e[16]=w):w=e[16];let T;return e[17]!==b||e[18]!==v||e[19]!==w?(T=p.jsx(Xl,{icon:S,title:"Subtask",summary:b,state:v,onOpenChange:l,children:w}),e[17]=b,e[18]=v,e[19]=w,e[20]=T):T=e[20],T}function KS(n){return n.parts??[]}function JS(n){return n.parts??[]}function GS(n){const e=_.c(13);if(Oh(n.part.output)){let u;return e[0]!==n?(u=p.jsx(Ph,{...n}),e[0]=n,e[1]=u):u=e[1],u}let t;e[2]!==n?(t=Rh(n),e[2]=n,e[3]=t):t=e[3];const{fallbackTitle:r,summary:s,usage:i,state:o}=t;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Gt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(tl,{})}),e[4]=l):l=e[4];let a;e[5]!==n.part?(a=p.jsx(Dh,{part:n.part}),e[5]=n.part,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==o||e[9]!==s||e[10]!==a||e[11]!==i?(c=p.jsx(Xl,{icon:l,title:r,summary:s,state:o,usage:i,children:a}),e[7]=r,e[8]=o,e[9]=s,e[10]=a,e[11]=i,e[12]=c):c=e[12],c}function XS(n){const e=_.c(17),t=ou(n.part.input?.agent_id);if(Oh(n.part.output)){let g;return e[0]!==n?(g=p.jsx(Ph,{...n}),e[0]=n,e[1]=g):g=e[1],g}let r;e[2]!==n?(r=Rh(n),e[2]=n,e[3]=r):r=e[3];const{fallbackTitle:s,summary:i,usage:o,state:l}=r,a=t?.icon,c=t?.title??"Subtask";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(tl,{}),e[4]=u):u=e[4];let d;e[5]!==a||e[6]!==c?(d=p.jsx(Gt,{icon:a,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[5]=a,e[6]=c,e[7]=d):d=e[7];const f=t?.title??s;let h;e[8]!==n.part?(h=p.jsx(Dh,{part:n.part}),e[8]=n.part,e[9]=h):h=e[9];let m;return e[10]!==l||e[11]!==i||e[12]!==d||e[13]!==f||e[14]!==h||e[15]!==o?(m=p.jsx(Xl,{icon:d,title:f,summary:i,state:l,usage:o,children:h}),e[10]=l,e[11]=i,e[12]=d,e[13]=f,e[14]=h,e[15]=o,e[16]=m):m=e[16],m}function YS(n){const e=_.c(16),{part:t}=n;if(!t.state.startsWith("output-"))return null;const r=t.input?.plan??"",i=t.output?.approved===!0;let o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx(ro,{className:"size-4 text-purple-500 shrink-0"}),l=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=o,e[1]=l):(o=e[0],l=e[1]);let a;e[2]!==i?(a=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(Yo,{size:12}),"Approved"]}),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==t.state?(c=!i&&t.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=i,e[5]=t.state,e[6]=c):c=e[6];let u;e[7]!==a||e[8]!==c?(u=p.jsxs("div",{className:"flex items-center gap-2",children:[o,l,a,c]}),e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=d):d=e[10];let f;e[11]!==r?(f=p.jsxs("details",{className:"ml-6",children:[d,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(pi,{id:"plan-content",part:{type:"text",text:r}})})]}),e[11]=r,e[12]=f):f=e[12];let h;return e[13]!==u||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[u,f]}),e[13]=u,e[14]=f,e[15]=h):h=e[15],h}const Yl={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function QS(n){return n.startsWith("http")?n:`https://${n}`}function Jc(n){const e=_.c(2),{children:t}=n;let r;return e[0]!==t?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1],r}function ZS(n){const e=_.c(12),{name:t,value:r}=n;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 i;e[2]!==t?(i=p.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==r?(o=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=o):o=e[5];let l;e[6]!==i||e[7]!==o?(l=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[i,o]}),e[6]=i,e[7]=o,e[8]=l):l=e[8];let a;return e[9]!==s||e[10]!==l?(a=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,l]}),e[9]=s,e[10]=l,e[11]=a):a=e[11],a}function ev(n){const e=_.c(15),{role:t,family:r}=n;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 i;e[2]!==t?(i=p.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==r?(o={fontFamily:r},e[4]=r,e[5]=o):o=e[5];let l;e[6]!==r||e[7]!==o?(l=p.jsx("span",{className:"text-sm text-foreground",style:o,children:r}),e[6]=r,e[7]=o,e[8]=l):l=e[8];let a;e[9]!==i||e[10]!==l?(a=p.jsxs("div",{className:"flex flex-col leading-tight",children:[i,l]}),e[9]=i,e[10]=l,e[11]=a):a=e[11];let c;return e[12]!==s||e[13]!==a?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,a]}),e[12]=s,e[13]=a,e[14]=c):c=e[14],c}function tv(n){const e=_.c(3),{logo:t,favicon:r,name:s}=n,i=t??r;if(!i)return null;const o=s?`${s} logo`:"";let l;return e[0]!==i||e[1]!==o?(l=p.jsx("img",{src:i,alt:o,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:nv}),e[0]=i,e[1]=o,e[2]=l):l=e[2],l}function nv(n){n.target.style.display="none"}function Lh(n){const e=_.c(4),{colors:t}=n;let r;e[0]!==t?(r=Object.entries(t).filter(sv),e[0]=t,e[1]=r):r=e[1];const s=r;if(s.length===0)return null;let i;return e[2]!==s?(i=p.jsx("div",{className:"flex h-1.5",children:s.map(rv)}),e[2]=s,e[3]=i):i=e[3],i}function rv(n){const[e,t]=n;return p.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${Yl[e]}: ${t}`,"aria-hidden":!0},e)}function sv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function _h(n){const e=_.c(36),{logo:t,favicon:r,name:s,domain:i,overview:o,colors:l,fonts:a,showDefaultBadge:c,isDefault:u}=n;let d;e[0]!==l?(d=l?Object.entries(l).filter(av):[],e[0]=l,e[1]=d):d=e[1];const f=d;let h;e[2]!==a?(h=a?Object.entries(a).filter(lv):[],e[2]=a,e[3]=h):h=e[3];const m=h;let g;e[4]!==l?(g=l&&p.jsx(Lh,{colors:l}),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==r||e[7]!==t||e[8]!==s?(x=p.jsx(tv,{logo:t,favicon:r,name:s}),e[6]=r,e[7]=t,e[8]=s,e[9]=x):x=e[9];let y;e[10]!==u||e[11]!==s||e[12]!==c?(y=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(Mu,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=u,e[11]=s,e[12]=c,e[13]=y):y=e[13];let b;e[14]!==i?(b=i&&p.jsxs("a",{href:QS(i),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[i,p.jsx(Au,{className:"size-3 shrink-0"})]}),e[14]=i,e[15]=b):b=e[15];let k;e[16]!==y||e[17]!==b?(k=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[y,b]}),e[16]=y,e[17]=b,e[18]=k):k=e[18];let S;e[19]!==x||e[20]!==k?(S=p.jsxs("div",{className:"flex items-center gap-4",children:[x,k]}),e[19]=x,e[20]=k,e[21]=S):S=e[21];let v;e[22]!==o?(v=o&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o}),e[22]=o,e[23]=v):v=e[23];let C;e[24]!==f?(C=f.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Jc,{children:"Colors"}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:f.map(ov)})]}),e[24]=f,e[25]=C):C=e[25];let w;e[26]!==m?(w=m.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Jc,{children:"Typography"}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:m.map(iv)})]}),e[26]=m,e[27]=w):w=e[27];let T;e[28]!==C||e[29]!==w||e[30]!==S||e[31]!==v?(T=p.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[S,v,C,w]}),e[28]=C,e[29]=w,e[30]=S,e[31]=v,e[32]=T):T=e[32];let N;return e[33]!==T||e[34]!==g?(N=p.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,T]}),e[33]=T,e[34]=g,e[35]=N):N=e[35],N}function iv(n){const[e,t]=n;return p.jsx(ev,{role:e,family:t},e)}function ov(n){const[e,t]=n;return p.jsx(ZS,{name:Yl[e],value:t},e)}function lv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function av(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function cv(n){const e=_.c(29),{part:t,latency:r}=n,s=ct(t.state);let i;e[0]!==t.output?(i=Jn(t.output),e[0]=t.output,e[1]=i):i=e[1];const o=i,l=s==="loading",a=s==="error"||o&&o.success===!1;if(l){const w=t.input;let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(pt,{className:"animate-pulse"}),e[2]=T):T=e[2];const N=w?.domain?`from ${w.domain}`:void 0;let M;return e[3]!==N?(M=p.jsx(ee,{icon:T,title:"Extracting brand",summary:N,state:"loading",defaultOpen:!0}),e[3]=N,e[4]=M):M=e[4],M}if(a){let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(pt,{}),e[5]=w):w=e[5];const T=o?.error??"Unknown error";let N;e[6]!==r?(N=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[6]=r,e[7]=N):N=e[7];let M;return e[8]!==T||e[9]!==N?(M=p.jsx(ee,{icon:w,title:"Brand extraction failed",summary:T,state:"error",trailing:N}),e[8]=T,e[9]=N,e[10]=M):M=e[10],M}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(pt,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const u=o?.name?`Brand set: ${o.name}`:"Brand context set",d=o?.domain;let f;e[12]!==r?(f=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[12]=r,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==d||e[16]!==f?(h=p.jsx(ee,{icon:c,title:u,summary:d,state:"idle",trailing:f}),e[14]=u,e[15]=d,e[16]=f,e[17]=h):h=e[17];const m=o?.logo,g=o?.favicon,x=o?.name,y=o?.domain,b=o?.overview,k=o?.colors,S=o?.fonts;let v;e[18]!==y||e[19]!==b||e[20]!==k||e[21]!==S||e[22]!==m||e[23]!==g||e[24]!==x?(v=p.jsx(_h,{logo:m,favicon:g,name:x,domain:y,overview:b,colors:k,fonts:S}),e[18]=y,e[19]=b,e[20]=k,e[21]=S,e[22]=m,e[23]=g,e[24]=x,e[25]=v):v=e[25];let C;return e[26]!==v||e[27]!==h?(C=p.jsxs(p.Fragment,{children:[h,v]}),e[26]=v,e[27]=h,e[28]=C):C=e[28],C}function uv(n){const e=_.c(27),{part:t,latency:r}=n,s=ct(t.state);let i;e[0]!==t.output?(i=Jn(t.output),e[0]=t.output,e[1]=i):i=e[1];const o=i,l=s==="loading",a=s==="error"||o&&o.success===!1;if(l){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(ee,{icon:p.jsx(pt,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(a||!o){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(pt,{}),e[3]=g):g=e[3];let x;e[4]!==r?(x=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[4]=r,e[5]=x):x=e[5];let y;return e[6]!==x?(y=p.jsx(ee,{icon:g,title:"Couldn't load brand",state:"error",trailing:x}),e[6]=x,e[7]=y):y=e[7],y}let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(pt,{className:"text-fuchsia-500"}),e[8]=c):c=e[8];const u=o.name?`Brand · ${o.name}`:"Brand";let d;e[9]!==r?(d=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[9]=r,e[10]=d):d=e[10];let f;e[11]!==o.domain||e[12]!==u||e[13]!==d?(f=p.jsx(ee,{icon:c,title:u,summary:o.domain,state:"idle",trailing:d}),e[11]=o.domain,e[12]=u,e[13]=d,e[14]=f):f=e[14];let h;e[15]!==o.colors||e[16]!==o.domain||e[17]!==o.favicon||e[18]!==o.fonts||e[19]!==o.isDefault||e[20]!==o.logo||e[21]!==o.name||e[22]!==o.overview?(h=p.jsx(_h,{logo:o.logo,favicon:o.favicon,name:o.name,domain:o.domain,overview:o.overview,colors:o.colors,fonts:o.fonts,showDefaultBadge:!0,isDefault:o.isDefault}),e[15]=o.colors,e[16]=o.domain,e[17]=o.favicon,e[18]=o.fonts,e[19]=o.isDefault,e[20]=o.logo,e[21]=o.name,e[22]=o.overview,e[23]=h):h=e[23];let m;return e[24]!==f||e[25]!==h?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[24]=f,e[25]=h,e[26]=m):m=e[26],m}function dv(n){const e=_.c(32),{part:t,latency:r}=n;let s;e[0]!==t.state?(s=ct(t.state),e[0]=t.state,e[1]=s):s=e[1];const i=s;let o,l,a,c;if(e[2]!==r||e[3]!==t.output||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const f=Jn(t.output),h=Array.isArray(f?.items)?f.items:[],m=i==="loading",g=i==="error";if(m){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ee,{icon:p.jsx(pt,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=k):k=e[9],c=k;break e}if(g){let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(pt,{}),e[10]=k):k=e[10];let S;e[11]!==r?(S=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[11]=r,e[12]=S):S=e[12];let v;e[13]!==S?(v=p.jsx(ee,{icon:k,title:"Couldn't load brands",state:"error",trailing:S}),e[13]=S,e[14]=v):v=e[14],c=v;break e}if(h.length===0){let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(pt,{}),e[15]=k):k=e[15];let S;e[16]!==r?(S=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[16]=r,e[17]=S):S=e[17];let v;e[18]!==S?(v=p.jsx(ee,{icon:k,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:S}),e[18]=S,e[19]=v):v=e[19],c=v;break e}let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(pt,{className:"text-fuchsia-500"}),e[20]=x):x=e[20];const y=h.length===1?"1 brand":`${h.length} brands`;let b;e[21]!==r?(b=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[21]=r,e[22]=b):b=e[22],e[23]!==y||e[24]!==b?(a=p.jsx(ee,{icon:x,title:y,state:"idle",trailing:b}),e[23]=y,e[24]=b,e[25]=a):a=e[25],o="mt-2 flex flex-col gap-1.5",l=h.map(fv)}e[2]=r,e[3]=t.output,e[4]=i,e[5]=o,e[6]=l,e[7]=a,e[8]=c}else o=e[5],l=e[6],a=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;e[26]!==o||e[27]!==l?(u=p.jsx("div",{className:o,children:l}),e[26]=o,e[27]=l,e[28]=u):u=e[28];let d;return e[29]!==a||e[30]!==u?(d=p.jsxs(p.Fragment,{children:[a,u]}),e[29]=a,e[30]=u,e[31]=d):d=e[31],d}function fv(n){const e=n.colors?Object.entries(n.colors).filter(mv):[];return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[n.colors&&p.jsx(Lh,{colors:n.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(n.logo||n.favicon)&&p.jsx("img",{src:n.logo??n.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:pv}),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:[n.name??"Untitled",n.isDefault&&p.jsx(Mu,{className:"size-3 text-amber-500 shrink-0"})]}),n.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:n.domain})]}),e.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(hv)})]})]},n.id??`${n.name}-${n.domain}`)}function hv(n){const[e,t]=n;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${Yl[e]}: ${t}`,"aria-hidden":!0},e)}function pv(n){n.target.style.display="none"}function mv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function $o(n){const e=_.c(4),{connection_id:t,iconSize:r}=n,s=r===void 0?"xs":r,i=ou(t);if(!i)return null;let o;return e[0]!==i.icon||e[1]!==i.title||e[2]!==s?(o=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(Gt,{icon:i.icon,name:i.title,size:s})}),e[0]=i.icon,e[1]=i.title,e[2]=s,e[3]=o):o=e[3],o}$o.Fallback=function({iconSize:e="xs"}){const t=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:Z(t,"rounded bg-muted animate-pulse")})})};function Er(n){const e=_.c(18),{connectionIds:t,maxVisibleIcons:r,iconSize:s,className:i}=n,o=r===void 0?2:r,l=s===void 0?"xs":s;if(t.length===0)return null;let a,c,u;if(e[0]!==i||e[1]!==t||e[2]!==l||e[3]!==o){const h=t.slice(0,o);a=t.length-o,e[7]!==i?(c=Z("flex items-center justify-end -space-x-2",i),e[7]=i,e[8]=c):c=e[8];let m;e[9]!==l?(m=g=>p.jsx(E.Suspense,{fallback:p.jsx($o.Fallback,{iconSize:l}),children:p.jsx($o,{connection_id:g,iconSize:l})},g),e[9]=l,e[10]=m):m=e[10],u=h.map(m),e[0]=i,e[1]=t,e[2]=l,e[3]=o,e[4]=a,e[5]=c,e[6]=u}else a=e[4],c=e[5],u=e[6];let d;e[11]!==l||e[12]!==a?(d=a>0&&p.jsx("div",{className:Z("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:Z(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${a} more`,children:["+",a]})}),e[11]=l,e[12]=a,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}Er.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",i=r==="sm"?"size-8":"size-6",o=t!==void 0&&t>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,a)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:Z(s,"rounded bg-muted animate-pulse")})},a)),o&&p.jsx("div",{className:Z("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",i),children:p.jsx("div",{className:Z(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const gv="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. ",Gc=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function xv(n){const e=_.c(64),{part:t,latency:r}=n,s=ju(),i=ct(t.state),o=E.useRef(null),l=E.useRef(null),a=E.useRef(null),c=E.useRef(null),u=E.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{Gc?.matches||(u.current=o.current?.getBoundingClientRect()??null,o.current&&(o.current.style.willChange="transform"))},e[0]=d):d=e[0];const f=d;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=V=>{if(Gc?.matches)return;const se=u.current,ae=o.current;if(!se||!ae)return;const de=(V.clientX-se.left)/se.width*100,Ie=(V.clientY-se.top)/se.height*100;ae.style.transform=`perspective(800px) rotateY(${(de-50)*.05}deg) rotateX(${(Ie-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(de-50)*.15}px, ${(Ie-50)*.15}px)`),a.current&&(a.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=h):h=e[1];const m=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const V=o.current;V&&(V.style.transform="none",V.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),a.current&&(a.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),u.current=null},e[2]=g):g=e[2];const x=g;if(i==="loading"){let V;return e[3]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ee,{icon:p.jsx(ht,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=V):V=e[3],V}if(i==="approval"){let V;return e[4]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ee,{icon:p.jsx(ht,{}),title:"Create agent",state:"idle"}),e[4]=V):V=e[4],V}if(i==="error"){let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ht,{}),e[5]=V):V=e[5];const se=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let ae;e[6]!==r?(ae=p.jsx($e,{latency:r}),e[6]=r,e[7]=ae):ae=e[7];let de;return e[8]!==se||e[9]!==ae?(de=p.jsx(ee,{icon:V,title:se,state:"error",trailing:ae}),e[8]=se,e[9]=ae,e[10]=de):de=e[10],de}let y,b,k;if(e[11]!==r||e[12]!==t.output){k=Symbol.for("react.early_return_sentinel");e:{if(y=Jn(t.output)?.item,!y?.id||!y?.title){let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ht,{}),e[16]=V):V=e[16];let se;e[17]!==r?(se=p.jsx(ee,{icon:V,title:"Agent created",state:"idle",trailing:p.jsx($e,{latency:r})}),e[17]=r,e[18]=se):se=e[18],k=se;break e}b=(y.connections??[]).map(yv)}e[11]=r,e[12]=t.output,e[13]=y,e[14]=b,e[15]=k}else y=e[13],b=e[14],k=e[15];if(k!==Symbol.for("react.early_return_sentinel"))return k;const S=b;let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(ht,{className:"text-emerald-500"}),e[19]=v):v=e[19];const C=`Agent created: ${y.title}`;let w;e[20]!==r?(w=p.jsx($e,{latency:r}),e[20]=r,e[21]=w):w=e[21];let T;e[22]!==C||e[23]!==w?(T=p.jsx(ee,{icon:v,title:C,state:"idle",trailing:w}),e[22]=C,e[23]=w,e[24]=T):T=e[24];let N;e[25]===Symbol.for("react.memo_cache_sentinel")?(N={transition:"transform 0.3s ease-out"},e[25]=N):N=e[25];let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=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[26]=M):M=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j={textAlign:"justify",wordBreak:"break-all"},e[27]=j):j=e[27];let O,A;e[28]===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:j,"aria-hidden":"true",children:gv.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[28]=O,e[29]=A):(O=e[28],A=e[29]);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx("img",{ref:a,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[30]=R):R=e[30];let I;e[31]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx("img",{ref:c,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[31]=I):I=e[31];let $;e[32]!==y.icon||e[33]!==y.title?($=p.jsx(ku,{icon:y.icon,name:y.title,size:"md"}),e[32]=y.icon,e[33]=y.title,e[34]=$):$=e[34];let P;e[35]!==y.title?(P=p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:y.title})}),e[35]=y.title,e[36]=P):P=e[36];let z;e[37]!==$||e[38]!==P?(z=p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[$,P]}),e[37]=$,e[38]=P,e[39]=z):z=e[39];let B;e[40]!==y.description?(B=y.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:y.description})}),e[40]=y.description,e[41]=B):B=e[41];let q;e[42]!==z||e[43]!==B?(q=p.jsxs("div",{className:"relative",children:[z,B]}),e[42]=z,e[43]=B,e[44]=q):q=e[44];let X;e[45]!==S?(X=S.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Er.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:S.length}),children:p.jsx(Er,{connectionIds:S,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=S,e[46]=X):X=e[46];let U;e[47]!==X?(U=p.jsx("div",{className:"flex-1 min-w-0",children:X}),e[47]=X,e[48]=U):U=e[48];let G;e[49]!==y.id||e[50]!==s?(G=()=>s(y.id),e[49]=y.id,e[50]=s,e[51]=G):G=e[51];const te=`See agent: ${y.title}`;let ne;e[52]!==G||e[53]!==te?(ne=p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(mt,{size:"sm",className:"h-7",onClick:G,"aria-label":te,children:"See agent"})}),e[52]=G,e[53]=te,e[54]=ne):ne=e[54];let re;e[55]!==U||e[56]!==ne?(re=p.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[U,ne]}),e[55]=U,e[56]=ne,e[57]=re):re=e[57];let le;e[58]!==q||e[59]!==re?(le=p.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:p.jsxs("div",{ref:o,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:N,onMouseEnter:f,onMouseMove:m,onMouseLeave:x,children:[M,O,A,R,I,q,re]})}),e[58]=q,e[59]=re,e[60]=le):le=e[60];let ye;return e[61]!==le||e[62]!==T?(ye=p.jsxs(p.Fragment,{children:[T,le]}),e[61]=le,e[62]=T,e[63]=ye):ye=e[63],ye}function yv(n){return n.connection_id}function bv(n){const e=_.c(24),{agent:t}=n,r=ju();if(!t.id)return null;let s;e[0]!==t.connections?(s=t.connections??[],e[0]=t.connections,e[1]=s):s=e[1];let i;e[2]!==s?(i=s.map(kv),e[2]=s,e[3]=i):i=e[3];const o=i;let l;e[4]!==t.id||e[5]!==r?(l=()=>r(t.id),e[4]=t.id,e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t.icon||e[8]!==t.title?(a=p.jsx(ku,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=a):a=e[9];let c;e[10]!==t.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let u;e[12]!==t.description?(u=t.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.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]!==o?(f=o.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Er.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:o.length}),children:p.jsx(Er,{connectionIds:o,iconSize:"xs",maxVisibleIcons:3})}),e[17]=o,e[18]=f):f=e[18];let h;return e[19]!==l||e[20]!==a||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",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",children:[a,d,f]}),e[19]=l,e[20]=a,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function kv(n){return n.connection_id}function Sv(n){const e=_.c(41),{part:t,latency:r}=n,s=qn(),{org:i}=Mt();let o;e[0]!==t.state?(o=ct(t.state),e[0]=t.state,e[1]=o):o=e[1];const l=o;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Jn(t.output);if(c=Array.isArray(y?.items)?y.items:[],l==="loading"){let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(ht,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=C):C=e[12],h=C;break e}if(l==="approval"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(ht,{}),title:"List agents",state:"idle"}),e[13]=C):C=e[13],h=C;break e}if(l==="error"){let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ht,{}),e[14]=C):C=e[14];const w=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let T;e[15]!==r?(T=p.jsx($e,{latency:r}),e[15]=r,e[16]=T):T=e[16];let N;e[17]!==w||e[18]!==T?(N=p.jsx(ee,{icon:C,title:w,state:"error",trailing:T}),e[17]=w,e[18]=T,e[19]=N):N=e[19],h=N;break e}if(c.length===0){let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ht,{}),e[20]=C):C=e[20];let w;e[21]!==r?(w=p.jsx(ee,{icon:C,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:p.jsx($e,{latency:r})}),e[21]=r,e[22]=w):w=e[22],h=w;break e}const b=c.slice(0,Nh);a=c.length-b.length;let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ht,{className:"text-emerald-500"}),e[23]=k):k=e[23];const S=c.length===1?"1 agent":`${c.length} agents`;let v;e[24]!==r?(v=p.jsx($e,{latency:r}),e[24]=r,e[25]=v):v=e[25],e[26]!==S||e[27]!==v?(f=p.jsx(ee,{icon:k,title:S,state:"idle",trailing:v}),e[26]=S,e[27]=v,e[28]=f):f=e[28],u="mt-2 flex flex-col gap-1.5",d=b.map(vv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[29]!==a||e[30]!==c||e[31]!==s||e[32]!==i?(m=a>0&&p.jsx(Mh,{count:c.length,noun:"agents",onClick:()=>s({to:"/$org/settings/agents",params:{org:i.slug}})}),e[29]=a,e[30]=c,e[31]=s,e[32]=i,e[33]=m):m=e[33];let g;e[34]!==u||e[35]!==d||e[36]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[34]=u,e[35]=d,e[36]=m,e[37]=g):g=e[37];let x;return e[38]!==f||e[39]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[38]=f,e[39]=g,e[40]=x):x=e[40],x}function vv(n){return p.jsx(bv,{agent:n},n.id)}const wv={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function Cv(n){const e=_.c(27),{connection:t}=n,r=qn(),{org:s}=Mt(),i=t.slug,o=t.description||t.app_name,l=!i||void 0;let a;e[0]!==r||e[1]!==s||e[2]!==i?(a=()=>i&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:i}}),e[0]=r,e[1]=s,e[2]=i,e[3]=a):a=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=p.jsx(Gt,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let u;e[7]!==t.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=u):u=e[8];let d;e[9]!==o?(d=o&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:o}),e[9]=o,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=wv[t.status]??"bg-muted-foreground";let m;e[14]!==h?(m=Z("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let g;e[16]!==m?(g=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=g):g=e[17];let x;e[18]!==t.status?(x=p.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=x):x=e[19];let y;return e[20]!==l||e[21]!==x||e[22]!==a||e[23]!==c||e[24]!==f||e[25]!==g?(y=p.jsxs("button",{type:"button","aria-disabled":l,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 aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,g,x]}),e[20]=l,e[21]=x,e[22]=a,e[23]=c,e[24]=f,e[25]=g,e[26]=y):y=e[26],y}function Tv(n){const e=_.c(40),{part:t,latency:r}=n,s=qn(),{org:i}=Mt();let o;e[0]!==t.state?(o=ct(t.state),e[0]=t.state,e[1]=o):o=e[1];const l=o;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Jn(t.output);if(c=(Array.isArray(y?.items)?y.items:[]).filter(Mv),l==="loading"||l==="approval"){let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(Lr,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=C):C=e[12],h=C;break e}if(l==="error"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Lr,{}),e[13]=C):C=e[13];const w=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let T;e[14]!==r?(T=p.jsx($e,{latency:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==w||e[17]!==T?(N=p.jsx(ee,{icon:C,title:w,state:"error",trailing:T}),e[16]=w,e[17]=T,e[18]=N):N=e[18],h=N;break e}if(c.length===0){let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Lr,{}),e[19]=C):C=e[19];let w;e[20]!==r?(w=p.jsx(ee,{icon:C,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:p.jsx($e,{latency:r})}),e[20]=r,e[21]=w):w=e[21],h=w;break e}const b=c.slice(0,Nh);a=c.length-b.length;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Lr,{className:"text-success"}),e[22]=k):k=e[22];const S=c.length===1?"1 connection":`${c.length} connections`;let v;e[23]!==r?(v=p.jsx($e,{latency:r}),e[23]=r,e[24]=v):v=e[24],e[25]!==S||e[26]!==v?(f=p.jsx(ee,{icon:k,title:S,state:"idle",trailing:v}),e[25]=S,e[26]=v,e[27]=f):f=e[27],u="mt-2 flex flex-col gap-1.5",d=b.map(Nv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[28]!==a||e[29]!==c||e[30]!==s||e[31]!==i?(m=a>0&&p.jsx(Mh,{count:c.length,noun:"connections",onClick:()=>s({to:"/$org/settings/connections",params:{org:i.slug}})}),e[28]=a,e[29]=c,e[30]=s,e[31]=i,e[32]=m):m=e[32];let g;e[33]!==u||e[34]!==d||e[35]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[33]=u,e[34]=d,e[35]=m,e[36]=g):g=e[36];let x;return e[37]!==f||e[38]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[37]=f,e[38]=g,e[39]=x):x=e[39],x}function Nv(n){return p.jsx(Cv,{connection:n},n.id)}function Mv(n){return n.connection_type!=="VIRTUAL"}function Ev(){const n=_.c(37),e=el(),{sendMessage:t,isStreaming:r,messages:s}=tm(),{org:i}=Mt(),o=e?.virtualMcpId,{prompts:l}=ym(i.slug),a=o??null;let c;n[0]!==i.id||n[1]!==i.slug||n[2]!==a?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},n[0]=i.id,n[1]=i.slug,n[2]=a,n[3]=c):c=n[3];const u=qo(c),[d,f]=E.useState(null);if(!o||r||!vp(o)||!s.some(Av))return null;let m;if(n[4]!==l||n[5]!==o){let A;n[7]!==o?(A=R=>R.agentId===o&&R.promptName,n[7]=o,n[8]=A):A=n[8],m=l.find(A),n[4]=l,n[5]=o,n[6]=m}else m=n[6];const g=m;if(!g)return null;let x;n[9]!==u||n[10]!==t?(x=async(A,R)=>{if(!u){eo.error("MCP client not available");return}try{const I=await Sm(u,A.name,R);await t({type:"doc",content:[{type:"paragraph",content:[Yf({id:A.name,name:rl(A.name,nl(A._meta)),metadata:I.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),eo.error("Failed to load prompt. Please try again.")}},n[9]=u,n[10]=t,n[11]=x):x=n[11];const y=x;let b;n[12]!==g._meta||n[13]!==g.arguments||n[14]!==g.description||n[15]!==g.promptName||n[16]!==g.title||n[17]!==y?(b=()=>{const A={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(A.arguments&&A.arguments.length>0){f(A);return}y(A)},n[12]=g._meta,n[13]=g.arguments,n[14]=g.description,n[15]=g.promptName,n[16]=g.title,n[17]=y,n[18]=b):b=n[18];const k=b;let S,v;n[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(km,{size:12,className:"shrink-0 text-purple-500"}),v=p.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),n[19]=S,n[20]=v):(S=n[19],v=n[20]);let C;n[21]!==g.title?(C=p.jsx("span",{className:"truncate",children:g.title}),n[21]=g.title,n[22]=C):C=n[22];let w;n[23]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Su,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),n[23]=w):w=n[23];let T;n[24]!==k||n[25]!==C?(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:[S,v,C,w]}),n[24]=k,n[25]=C,n[26]=T):T=n[26];let N;n[27]===Symbol.for("react.memo_cache_sentinel")?(N=A=>f(A),n[27]=N):N=n[27];let M;n[28]!==d||n[29]!==y?(M=async A=>{const R=d;f(null),R&&await y(R,A)},n[28]=d,n[29]=y,n[30]=M):M=n[30];let j;n[31]!==d||n[32]!==M?(j=p.jsx(Um,{prompt:d,setPrompt:N,onSubmit:M}),n[31]=d,n[32]=M,n[33]=j):j=n[33];let O;return n[34]!==j||n[35]!==T?(O=p.jsxs(p.Fragment,{children:[T,j]}),n[34]=j,n[35]=T,n[36]=O):O=n[36],O}function Av(n){return n.role==="user"||n.parts.some(jv)}function jv(n){return n.type==="tool-user_ask"&&n.state==="output-available"}function Iv(n){const e=new Map;for(let t=n.length-1;t>=0;t--){const r=n[t]?.parts;if(r)for(const s of r){const i=s;if(i.type!=="data-deck-updated")continue;const o=i.data;if(!o?.path)continue;const l=`deck:${o.path}`;e.has(l)||e.set(l,{tabId:lm(o.path),label:o.name||o.path,kind:o.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Ov(){const n=_.c(9),e=qn(),t=Kn()?.messages??[],r=Iv(t);if(r.length===0)return null;const s=r.some(Dv),i=r.some(Rv),o=s?i?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let a;n[0]!==o?(a=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:o}),n[0]=o,n[1]=a):a=n[1];const c="flex flex-wrap gap-2";let u;n[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:m.tabId}),replace:!0}),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(ir,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(dm,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),n[2]=e,n[3]=u):u=n[3];const d=r.map(u);let f;n[4]!==d?(f=p.jsx("div",{className:c,children:d}),n[4]=d,n[5]=f):f=n[5];let h;return n[6]!==a||n[7]!==f?(h=p.jsxs("div",{className:l,children:[a,f]}),n[6]=a,n[7]=f,n[8]=h):h=n[8],h}function Rv(n){return n.kind==="page"}function Dv(n){return n.kind==="deck"}async function Pv(n,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(n)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function IT(){const n=_.c(2),e=Kn()?.messages??[];let t;return n[0]!==e?(t=e.some(Lv),n[0]=e,n[1]=t):t=n[1],t}function Lv(n){return n.parts?.some(_v)}function _v(n){const e=n;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function $v(n,e){const t=_.c(9),{org:r}=Mt();let s;t[0]!==n?(s=nt.threadOutputs(n??""),t[0]=n,t[1]=s):s=t[1];let i;t[2]!==r||t[3]!==n?(i=()=>Pv(n??"",r.slug),t[2]=r,t[3]=n,t[4]=i):i=t[4];const o=!!n&&(e?.enabled??!0);let l;return t[5]!==s||t[6]!==i||t[7]!==o?(l={queryKey:s,queryFn:i,enabled:o,staleTime:0},t[5]=s,t[6]=i,t[7]=o,t[8]=l):l=t[8],jr(l)}function zv(n){const e=_.c(20),{file:t}=n,r=qn();let s;e[0]!==t.key||e[1]!==r?(s=()=>r({to:".",search:h=>({...h,main:am(t.key)}),replace:!0}),e[0]=t.key,e[1]=r,e[2]=s):s=e[2];const i=s;let o;e[3]!==t.filename?(o=p.jsx(Gp,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=o):o=e[4];let l;e[5]!==t.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:t.filename,children:t.filename}),e[5]=t.filename,e[6]=i,e[7]=l):l=e[7];const a=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Eu,{className:"size-3.5"}),e[8]=c):c=e[8];let u;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==a?(u=p.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":a,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=a,e[12]=u):u=e[12];let d;e[13]!==i?(d=p.jsx(mt,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:"Open"}),e[13]=i,e[14]=d):d=e[14];let f;return e[15]!==o||e[16]!==l||e[17]!==u||e[18]!==d?(f=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[o,l,u,d]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}function Xc(n){return n.split("/").pop()??n}const Bv=/(^|\/)output\//;function Fv(n){const e=new Set;for(const t of n.parts??[]){const r=t;if(r.state==="output-available"){if(r.type==="tool-share_with_user"){const s=r.output?.filename??r.input?.name??(r.input?.source?Xc(r.input.source):null);s&&e.add(s)}else if(r.type==="tool-write"){const s=r.input?.path;s&&Bv.test(s)&&e.add(Xc(s))}}}return e}function Vv(n){const e=_.c(4),{threadId:t,message:r}=n,s=Fv(r),i=s.size>0;let o;e[0]!==i?(o={enabled:i},e[0]=i,e[1]=o):o=e[1];const{data:l}=$v(t,o);if(s.size===0)return null;const a=(l??[]).filter(f=>s.has(f.filename));if(a.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=a.map(Hv);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 Hv(n){return p.jsx(zv,{file:n},n.key)}function Wv(n){return n.type==="reasoning"}function Uv(n){const e=[],t=new Set,r=new Map,s=new Map,i=new Map;if(n){let l=null;for(let a=0;a<n.parts.length;a++){const c=n.parts[a];if(Wv(c)){l||(l={parts:[],startIndex:a},e.push(l)),l.parts.push(c),t.add(a);continue}if(l=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;i.set(u,d.text??"");continue}}}const o=[];if(n)for(let l=0;l<n.parts.length;l++){const a=n.parts[l];if(a.type!=="step-start"){if(t.has(l)){const c=e.find(u=>u.startIndex===l);c&&o.push({kind:"reasoning-group",group:c});continue}a.type.startsWith("data-")||o.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:o,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:i}}}function zo(n){const e=_.c(9),{since:t}=n;let r;e[0]!==t?(r=()=>da(t,Date.now()),e[0]=t,e[1]=r):r=e[1];const[s,i]=E.useState(r);let o,l;e[2]!==t?(o=()=>{const d=setInterval(()=>i(da(t,Date.now())),100);return()=>clearInterval(d)},l=[t],e[2]=t,e[3]=o,e[4]=l):(o=e[3],l=e[4]),E.useEffect(o,l);const a=s/1e3;let c;e[5]!==a?(c=Ut(a),e[5]=a,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 $h=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function qv(){const n=_.c(5),[e]=E.useState(Kv);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},n[0]=t):t=n[0];let r;n[1]!==e?(r=$h.map((i,o)=>{const{delay:l}=i;return p.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[o],animation:"grid-ripple 1s ease infinite",animationDelay:`${l}ms`}},o)}),n[1]=e,n[2]=r):r=n[2];let s;return n[3]!==r?(s=p.jsx("div",{className:"grid",style:t,children:r}),n[3]=r,n[4]=s):s=n[4],s}function Kv(){const n=`var(--chart-${Math.ceil(Math.random()*5)})`;return $h.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":n)}const Jv={planning:{icon:p.jsx(Kp,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves",detail:"Deciding how to approach the request"},thinking:{icon:p.jsx(Qs,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking",detail:"Working through the next response"}},Gv=1200;function Bo(n){const e=_.c(9),{icon:t,title:r,summary:s,detail:i,state:o,detailVariant:l,latency:a,trailing:c}=n,u=l===void 0?"prose":l;let d;return e[0]!==i||e[1]!==u||e[2]!==t||e[3]!==a||e[4]!==o||e[5]!==s||e[6]!==r||e[7]!==c?(d=p.jsx(ee,{icon:t,title:r,summary:s,detail:i,state:o,detailVariant:u,latency:a,trailing:c}),e[0]=i,e[1]=u,e[2]=t,e[3]=a,e[4]=o,e[5]=s,e[6]=r,e[7]=c,e[8]=d):d=e[8],d}function Xv(n){const e=_.c(17),{startedAt:t}=n,r=Kn()?.runStatusStage??null,[s,i]=E.useState("planning");let o,l;if(e[0]!==r?(o=()=>{if(r!==null)return;const f=setTimeout(()=>{i("thinking")},Gv);return()=>{clearTimeout(f)}},l=[r],e[0]=r,e[1]=o,e[2]=l):(o=e[1],l=e[2]),E.useEffect(o,l),r!==null){const f=im[r];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Qs,{className:"size-4"}),e[3]=h):h=e[3];const m=`${f.label}...`;let g;e[4]!==t?(g=t!==null&&p.jsx(zo,{since:t}),e[4]=t,e[5]=g):g=e[5];let x;return e[6]!==f.detail||e[7]!==m||e[8]!==g?(x=p.jsx(Bo,{icon:h,title:m,summary:f.detail,state:"loading",trailing:g}),e[6]=f.detail,e[7]=m,e[8]=g,e[9]=x):x=e[9],x}const a=Jv[s],c=`${a.label}...`;let u;e[10]!==t?(u=t!==null&&p.jsx(zo,{since:t}),e[10]=t,e[11]=u):u=e[11];let d;return e[12]!==a.detail||e[13]!==a.icon||e[14]!==c||e[15]!==u?(d=p.jsx(Bo,{icon:a.icon,title:c,summary:a.detail,state:"loading",trailing:u}),e[12]=a.detail,e[13]=a.icon,e[14]=c,e[15]=u,e[16]=d):d=e[16],d}function Yv(n){const e=_.c(3),{startedAt:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(qv,{}),e[0]=r):r=e[0];let s;return e[1]!==t?(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(zo,{since:t})]}),e[1]=t,e[2]=s):s=e[2],s}const Qv=2e4;function Zv(n){const e=_.c(8),{startedAt:t}=n;fu(1e3);const r=Kn(),i=(t!==null?Date.now()-t:0)>=Qv;let o;e[0]!==t?(o=p.jsx(Xv,{startedAt:t}),e[0]=t,e[1]=o):o=e[1];let l;e[2]!==i||e[3]!==r?(l=i&&r?.stop&&p.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[p.jsx("span",{children:"This is taking longer than usual."}),p.jsx("button",{type:"button",onClick:()=>r.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Cancel"})]}),e[2]=i,e[3]=r,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=p.jsxs("div",{className:"flex flex-col gap-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function ew(n){const e=_.c(20),{duration:t,parts:r,isStreaming:s}=n;let i;e[0]!==r?(i=r.every(rw),e[0]=r,e[1]=i):i=e[1];const o=i;let l;e[2]!==t?(l=t&&t/1e3>1?`Thought for ${Ut(t/1e3)}`:"Thought",e[2]=t,e[3]=l):l=e[3];const a=l;let c;if(e[4]!==o||e[5]!==s||e[6]!==r){const k=r.map(nw).join(`
184
+ … (${f.length-Zi} more characters)`:f,e[5]=t.input,e[6]=a}else a=e[6];const c=a;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(yu,{}),e[7]=u):u=e[7];let d;return e[8]!==c||e[9]!==i||e[10]!==l?(d=p.jsx(ee,{icon:u,title:i,summary:l,state:"idle",detail:c,detailVariant:"code"}),e[8]=c,e[9]=i,e[10]=l,e[11]=d):d=e[11],d}function qS(n){const e=_.c(12),{jobId:t,prompt:r,items:s,streaming:i}=n;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx("h3",{className:"text-xs font-medium text-muted-foreground/70 mb-1.5",children:"Task"}),e[0]=o):o=e[0];let l;e[1]!==r?(l=p.jsxs("section",{children:[o,p.jsx("p",{className:"text-[13px] text-foreground/90 whitespace-pre-wrap wrap-break-word",children:r})]}),e[1]=r,e[2]=l):l=e[2];let a;e[3]!==s||e[4]!==t||e[5]!==i?(a=s.length===0?p.jsx("p",{className:"text-[13px] text-muted-foreground/60 italic py-1",children:"Running in the background…"}):s.map((d,f)=>{const h=d,m=h.type??"";return m==="text"?h.text?.trim()?p.jsx(pi,{id:`${t}-sub-${f}`,part:d,animate:i},`${t}-sub-${f}`):null:m==="dynamic-tool"||m.startsWith("tool-")&&m!=="tool-todo_write"&&m!=="tool-update_interests"?p.jsx(US,{part:h},`${t}-sub-${f}`):null}),e[3]=s,e[4]=t,e[5]=i,e[6]=a):a=e[6];let c;e[7]!==a?(c=p.jsx("section",{className:"flex flex-col gap-3 sm:gap-2",children:a}),e[7]=a,e[8]=c):c=e[8];let u;return e[9]!==l||e[10]!==c?(u=p.jsxs("div",{className:"flex flex-col gap-4",children:[l,c]}),e[9]=l,e[10]=c,e[11]=u):u=e[11],u}function Ph(n){const e=_.c(21),{part:t}=n,r=t.output?.jobId,{taskId:s}=em(),{org:i}=Mt(),[o,l]=E.useState(!1),a=FS(r);let c;e[0]!==r||e[1]!==o||e[2]!==i.slug||e[3]!==s?(c={orgSlug:i.slug,threadId:s,jobId:r,enabled:o},e[0]=r,e[1]=o,e[2]=i.slug,e[3]=s,e[4]=c):c=e[4];const u=HS(c);let d;e[5]!==u.messages?(d=u.messages.flatMap(JS),e[5]=u.messages,e[6]=d):d=e[6];const f=d;let h;e[7]!==a?(h=a.flatMap(KS),e[7]=a,e[8]=h):h=e[8];const m=h,g=f.length>0?f:m,x=t.input?.prompt??"No prompt provided";let y;e[9]!==x?(y=x.length>120?`${x.slice(0,120)}…`:x,e[9]=x,e[10]=y):y=e[10];const b=y,k=a.length===0;let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(Gt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(tl,{})}),e[11]=S):S=e[11];const v=k?"loading":"idle",C=u.streaming||k;let w;e[12]!==g||e[13]!==r||e[14]!==x||e[15]!==C?(w=p.jsx(qS,{jobId:r,prompt:x,items:g,streaming:C}),e[12]=g,e[13]=r,e[14]=x,e[15]=C,e[16]=w):w=e[16];let T;return e[17]!==b||e[18]!==v||e[19]!==w?(T=p.jsx(Xl,{icon:S,title:"Subtask",summary:b,state:v,onOpenChange:l,children:w}),e[17]=b,e[18]=v,e[19]=w,e[20]=T):T=e[20],T}function KS(n){return n.parts??[]}function JS(n){return n.parts??[]}function GS(n){const e=_.c(13);if(Oh(n.part.output)){let u;return e[0]!==n?(u=p.jsx(Ph,{...n}),e[0]=n,e[1]=u):u=e[1],u}let t;e[2]!==n?(t=Rh(n),e[2]=n,e[3]=t):t=e[3];const{fallbackTitle:r,summary:s,usage:i,state:o}=t;let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=p.jsx(Gt,{icon:void 0,name:"Subtask",size:"2xs",className:"rounded-xs",fallbackIcon:p.jsx(tl,{})}),e[4]=l):l=e[4];let a;e[5]!==n.part?(a=p.jsx(Dh,{part:n.part}),e[5]=n.part,e[6]=a):a=e[6];let c;return e[7]!==r||e[8]!==o||e[9]!==s||e[10]!==a||e[11]!==i?(c=p.jsx(Xl,{icon:l,title:r,summary:s,state:o,usage:i,children:a}),e[7]=r,e[8]=o,e[9]=s,e[10]=a,e[11]=i,e[12]=c):c=e[12],c}function XS(n){const e=_.c(17),t=ou(n.part.input?.agent_id);if(Oh(n.part.output)){let g;return e[0]!==n?(g=p.jsx(Ph,{...n}),e[0]=n,e[1]=g):g=e[1],g}let r;e[2]!==n?(r=Rh(n),e[2]=n,e[3]=r):r=e[3];const{fallbackTitle:s,summary:i,usage:o,state:l}=r,a=t?.icon,c=t?.title??"Subtask";let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=p.jsx(tl,{}),e[4]=u):u=e[4];let d;e[5]!==a||e[6]!==c?(d=p.jsx(Gt,{icon:a,name:c,size:"2xs",className:"rounded-xs",fallbackIcon:u}),e[5]=a,e[6]=c,e[7]=d):d=e[7];const f=t?.title??s;let h;e[8]!==n.part?(h=p.jsx(Dh,{part:n.part}),e[8]=n.part,e[9]=h):h=e[9];let m;return e[10]!==l||e[11]!==i||e[12]!==d||e[13]!==f||e[14]!==h||e[15]!==o?(m=p.jsx(Xl,{icon:d,title:f,summary:i,state:l,usage:o,children:h}),e[10]=l,e[11]=i,e[12]=d,e[13]=f,e[14]=h,e[15]=o,e[16]=m):m=e[16],m}function YS(n){const e=_.c(16),{part:t}=n;if(!t.state.startsWith("output-"))return null;const r=t.input?.plan??"",i=t.output?.approved===!0;let o,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsx(ro,{className:"size-4 text-purple-500 shrink-0"}),l=p.jsx("span",{className:"text-[14px] font-medium text-foreground/80",children:"Implementation Plan"}),e[0]=o,e[1]=l):(o=e[0],l=e[1]);let a;e[2]!==i?(a=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(Yo,{size:12}),"Approved"]}),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==i||e[5]!==t.state?(c=!i&&t.state==="output-available"&&p.jsx("span",{className:"text-xs text-muted-foreground/70 italic",children:"Rejected"}),e[4]=i,e[5]=t.state,e[6]=c):c=e[6];let u;e[7]!==a||e[8]!==c?(u=p.jsxs("div",{className:"flex items-center gap-2",children:[o,l,a,c]}),e[7]=a,e[8]=c,e[9]=u):u=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=p.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:"View plan"}),e[10]=d):d=e[10];let f;e[11]!==r?(f=p.jsxs("details",{className:"ml-6",children:[d,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(pi,{id:"plan-content",part:{type:"text",text:r}})})]}),e[11]=r,e[12]=f):f=e[12];let h;return e[13]!==u||e[14]!==f?(h=p.jsxs("div",{className:"my-1.5 flex flex-col gap-1",children:[u,f]}),e[13]=u,e[14]=f,e[15]=h):h=e[15],h}const Yl={primary:"Primary",secondary:"Secondary",accent:"Accent",background:"Background",foreground:"Foreground"};function QS(n){return n.startsWith("http")?n:`https://${n}`}function Jc(n){const e=_.c(2),{children:t}=n;let r;return e[0]!==t?(r=p.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e[0]=t,e[1]=r):r=e[1],r}function ZS(n){const e=_.c(12),{name:t,value:r}=n;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 i;e[2]!==t?(i=p.jsx("span",{className:"text-sm text-foreground",children:t}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==r?(o=p.jsx("span",{className:"text-xs font-mono tabular-nums text-muted-foreground",children:r}),e[4]=r,e[5]=o):o=e[5];let l;e[6]!==i||e[7]!==o?(l=p.jsxs("div",{className:"flex flex-col leading-tight min-w-0",children:[i,o]}),e[6]=i,e[7]=o,e[8]=l):l=e[8];let a;return e[9]!==s||e[10]!==l?(a=p.jsxs("div",{className:"flex items-center gap-2.5",children:[s,l]}),e[9]=s,e[10]=l,e[11]=a):a=e[11],a}function ev(n){const e=_.c(15),{role:t,family:r}=n;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 i;e[2]!==t?(i=p.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e[2]=t,e[3]=i):i=e[3];let o;e[4]!==r?(o={fontFamily:r},e[4]=r,e[5]=o):o=e[5];let l;e[6]!==r||e[7]!==o?(l=p.jsx("span",{className:"text-sm text-foreground",style:o,children:r}),e[6]=r,e[7]=o,e[8]=l):l=e[8];let a;e[9]!==i||e[10]!==l?(a=p.jsxs("div",{className:"flex flex-col leading-tight",children:[i,l]}),e[9]=i,e[10]=l,e[11]=a):a=e[11];let c;return e[12]!==s||e[13]!==a?(c=p.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted px-4 py-3",children:[s,a]}),e[12]=s,e[13]=a,e[14]=c):c=e[14],c}function tv(n){const e=_.c(3),{logo:t,favicon:r,name:s}=n,i=t??r;if(!i)return null;const o=s?`${s} logo`:"";let l;return e[0]!==i||e[1]!==o?(l=p.jsx("img",{src:i,alt:o,className:"size-16 shrink-0 rounded-lg border border-border bg-background object-contain p-2",onError:nv}),e[0]=i,e[1]=o,e[2]=l):l=e[2],l}function nv(n){n.target.style.display="none"}function Lh(n){const e=_.c(4),{colors:t}=n;let r;e[0]!==t?(r=Object.entries(t).filter(sv),e[0]=t,e[1]=r):r=e[1];const s=r;if(s.length===0)return null;let i;return e[2]!==s?(i=p.jsx("div",{className:"flex h-1.5",children:s.map(rv)}),e[2]=s,e[3]=i):i=e[3],i}function rv(n){const[e,t]=n;return p.jsx("span",{className:"flex-1",style:{backgroundColor:t},title:`${Yl[e]}: ${t}`,"aria-hidden":!0},e)}function sv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function _h(n){const e=_.c(36),{logo:t,favicon:r,name:s,domain:i,overview:o,colors:l,fonts:a,showDefaultBadge:c,isDefault:u}=n;let d;e[0]!==l?(d=l?Object.entries(l).filter(av):[],e[0]=l,e[1]=d):d=e[1];const f=d;let h;e[2]!==a?(h=a?Object.entries(a).filter(lv):[],e[2]=a,e[3]=h):h=e[3];const m=h;let g;e[4]!==l?(g=l&&p.jsx(Lh,{colors:l}),e[4]=l,e[5]=g):g=e[5];let x;e[6]!==r||e[7]!==t||e[8]!==s?(x=p.jsx(tv,{logo:t,favicon:r,name:s}),e[6]=r,e[7]=t,e[8]=s,e[9]=x):x=e[9];let y;e[10]!==u||e[11]!==s||e[12]!==c?(y=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(Mu,{className:"size-3 text-amber-500"}),"default"]})]}),e[10]=u,e[11]=s,e[12]=c,e[13]=y):y=e[13];let b;e[14]!==i?(b=i&&p.jsxs("a",{href:QS(i),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[i,p.jsx(Au,{className:"size-3 shrink-0"})]}),e[14]=i,e[15]=b):b=e[15];let k;e[16]!==y||e[17]!==b?(k=p.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[y,b]}),e[16]=y,e[17]=b,e[18]=k):k=e[18];let S;e[19]!==x||e[20]!==k?(S=p.jsxs("div",{className:"flex items-center gap-4",children:[x,k]}),e[19]=x,e[20]=k,e[21]=S):S=e[21];let v;e[22]!==o?(v=o&&p.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o}),e[22]=o,e[23]=v):v=e[23];let C;e[24]!==f?(C=f.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Jc,{children:"Colors"}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-3",children:f.map(ov)})]}),e[24]=f,e[25]=C):C=e[25];let w;e[26]!==m?(w=m.length>0&&p.jsxs("div",{className:"flex flex-col gap-3",children:[p.jsx(Jc,{children:"Typography"}),p.jsx("div",{className:"flex flex-wrap gap-2.5",children:m.map(iv)})]}),e[26]=m,e[27]=w):w=e[27];let T;e[28]!==C||e[29]!==w||e[30]!==S||e[31]!==v?(T=p.jsxs("div",{className:"p-5 flex flex-col gap-6",children:[S,v,C,w]}),e[28]=C,e[29]=w,e[30]=S,e[31]=v,e[32]=T):T=e[32];let N;return e[33]!==T||e[34]!==g?(N=p.jsxs("div",{className:"mt-2 rounded-lg overflow-hidden border border-border",children:[g,T]}),e[33]=T,e[34]=g,e[35]=N):N=e[35],N}function iv(n){const[e,t]=n;return p.jsx(ev,{role:e,family:t},e)}function ov(n){const[e,t]=n;return p.jsx(ZS,{name:Yl[e],value:t},e)}function lv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function av(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function cv(n){const e=_.c(29),{part:t,latency:r}=n,s=ct(t.state);let i;e[0]!==t.output?(i=Jn(t.output),e[0]=t.output,e[1]=i):i=e[1];const o=i,l=s==="loading",a=s==="error"||o&&o.success===!1;if(l){const w=t.input;let T;e[2]===Symbol.for("react.memo_cache_sentinel")?(T=p.jsx(pt,{className:"animate-pulse"}),e[2]=T):T=e[2];const N=w?.domain?`from ${w.domain}`:void 0;let M;return e[3]!==N?(M=p.jsx(ee,{icon:T,title:"Extracting brand",summary:N,state:"loading",defaultOpen:!0}),e[3]=N,e[4]=M):M=e[4],M}if(a){let w;e[5]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(pt,{}),e[5]=w):w=e[5];const T=o?.error??"Unknown error";let N;e[6]!==r?(N=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[6]=r,e[7]=N):N=e[7];let M;return e[8]!==T||e[9]!==N?(M=p.jsx(ee,{icon:w,title:"Brand extraction failed",summary:T,state:"error",trailing:N}),e[8]=T,e[9]=N,e[10]=M):M=e[10],M}let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(pt,{className:"text-fuchsia-500"}),e[11]=c):c=e[11];const u=o?.name?`Brand set: ${o.name}`:"Brand context set",d=o?.domain;let f;e[12]!==r?(f=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[12]=r,e[13]=f):f=e[13];let h;e[14]!==u||e[15]!==d||e[16]!==f?(h=p.jsx(ee,{icon:c,title:u,summary:d,state:"idle",trailing:f}),e[14]=u,e[15]=d,e[16]=f,e[17]=h):h=e[17];const m=o?.logo,g=o?.favicon,x=o?.name,y=o?.domain,b=o?.overview,k=o?.colors,S=o?.fonts;let v;e[18]!==y||e[19]!==b||e[20]!==k||e[21]!==S||e[22]!==m||e[23]!==g||e[24]!==x?(v=p.jsx(_h,{logo:m,favicon:g,name:x,domain:y,overview:b,colors:k,fonts:S}),e[18]=y,e[19]=b,e[20]=k,e[21]=S,e[22]=m,e[23]=g,e[24]=x,e[25]=v):v=e[25];let C;return e[26]!==v||e[27]!==h?(C=p.jsxs(p.Fragment,{children:[h,v]}),e[26]=v,e[27]=h,e[28]=C):C=e[28],C}function uv(n){const e=_.c(27),{part:t,latency:r}=n,s=ct(t.state);let i;e[0]!==t.output?(i=Jn(t.output),e[0]=t.output,e[1]=i):i=e[1];const o=i,l=s==="loading",a=s==="error"||o&&o.success===!1;if(l){let g;return e[2]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(ee,{icon:p.jsx(pt,{className:"animate-pulse"}),title:"Loading brand",state:"loading"}),e[2]=g):g=e[2],g}if(a||!o){let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(pt,{}),e[3]=g):g=e[3];let x;e[4]!==r?(x=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[4]=r,e[5]=x):x=e[5];let y;return e[6]!==x?(y=p.jsx(ee,{icon:g,title:"Couldn't load brand",state:"error",trailing:x}),e[6]=x,e[7]=y):y=e[7],y}let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(pt,{className:"text-fuchsia-500"}),e[8]=c):c=e[8];const u=o.name?`Brand · ${o.name}`:"Brand";let d;e[9]!==r?(d=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[9]=r,e[10]=d):d=e[10];let f;e[11]!==o.domain||e[12]!==u||e[13]!==d?(f=p.jsx(ee,{icon:c,title:u,summary:o.domain,state:"idle",trailing:d}),e[11]=o.domain,e[12]=u,e[13]=d,e[14]=f):f=e[14];let h;e[15]!==o.colors||e[16]!==o.domain||e[17]!==o.favicon||e[18]!==o.fonts||e[19]!==o.isDefault||e[20]!==o.logo||e[21]!==o.name||e[22]!==o.overview?(h=p.jsx(_h,{logo:o.logo,favicon:o.favicon,name:o.name,domain:o.domain,overview:o.overview,colors:o.colors,fonts:o.fonts,showDefaultBadge:!0,isDefault:o.isDefault}),e[15]=o.colors,e[16]=o.domain,e[17]=o.favicon,e[18]=o.fonts,e[19]=o.isDefault,e[20]=o.logo,e[21]=o.name,e[22]=o.overview,e[23]=h):h=e[23];let m;return e[24]!==f||e[25]!==h?(m=p.jsxs(p.Fragment,{children:[f,h]}),e[24]=f,e[25]=h,e[26]=m):m=e[26],m}function dv(n){const e=_.c(32),{part:t,latency:r}=n;let s;e[0]!==t.state?(s=ct(t.state),e[0]=t.state,e[1]=s):s=e[1];const i=s;let o,l,a,c;if(e[2]!==r||e[3]!==t.output||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const f=Jn(t.output),h=Array.isArray(f?.items)?f.items:[],m=i==="loading",g=i==="error";if(m){let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ee,{icon:p.jsx(pt,{className:"animate-pulse"}),title:"Loading brands",state:"loading"}),e[9]=k):k=e[9],c=k;break e}if(g){let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(pt,{}),e[10]=k):k=e[10];let S;e[11]!==r?(S=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[11]=r,e[12]=S):S=e[12];let v;e[13]!==S?(v=p.jsx(ee,{icon:k,title:"Couldn't load brands",state:"error",trailing:S}),e[13]=S,e[14]=v):v=e[14],c=v;break e}if(h.length===0){let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(pt,{}),e[15]=k):k=e[15];let S;e[16]!==r?(S=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[16]=r,e[17]=S):S=e[17];let v;e[18]!==S?(v=p.jsx(ee,{icon:k,title:"No brands yet",summary:"The organization hasn't set up any brand context.",state:"idle",trailing:S}),e[18]=S,e[19]=v):v=e[19],c=v;break e}let x;e[20]===Symbol.for("react.memo_cache_sentinel")?(x=p.jsx(pt,{className:"text-fuchsia-500"}),e[20]=x):x=e[20];const y=h.length===1?"1 brand":`${h.length} brands`;let b;e[21]!==r?(b=r!=null&&r>0?p.jsx($e,{latency:r}):void 0,e[21]=r,e[22]=b):b=e[22],e[23]!==y||e[24]!==b?(a=p.jsx(ee,{icon:x,title:y,state:"idle",trailing:b}),e[23]=y,e[24]=b,e[25]=a):a=e[25],o="mt-2 flex flex-col gap-1.5",l=h.map(fv)}e[2]=r,e[3]=t.output,e[4]=i,e[5]=o,e[6]=l,e[7]=a,e[8]=c}else o=e[5],l=e[6],a=e[7],c=e[8];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;e[26]!==o||e[27]!==l?(u=p.jsx("div",{className:o,children:l}),e[26]=o,e[27]=l,e[28]=u):u=e[28];let d;return e[29]!==a||e[30]!==u?(d=p.jsxs(p.Fragment,{children:[a,u]}),e[29]=a,e[30]=u,e[31]=d):d=e[31],d}function fv(n){const e=n.colors?Object.entries(n.colors).filter(mv):[];return p.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[n.colors&&p.jsx(Lh,{colors:n.colors}),p.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(n.logo||n.favicon)&&p.jsx("img",{src:n.logo??n.favicon??void 0,alt:"",className:"size-8 shrink-0 rounded-md border border-border bg-background object-contain p-0.5",onError:pv}),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:[n.name??"Untitled",n.isDefault&&p.jsx(Mu,{className:"size-3 text-amber-500 shrink-0"})]}),n.domain&&p.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:n.domain})]}),e.length>0&&p.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:e.slice(0,5).map(hv)})]})]},n.id??`${n.name}-${n.domain}`)}function hv(n){const[e,t]=n;return p.jsx("span",{className:"size-3 rounded-full border border-border",style:{backgroundColor:t},title:`${Yl[e]}: ${t}`,"aria-hidden":!0},e)}function pv(n){n.target.style.display="none"}function mv(n){const[,e]=n;return typeof e=="string"&&e.trim().length>0}function $o(n){const e=_.c(4),{connection_id:t,iconSize:r}=n,s=r===void 0?"xs":r,i=ou(t);if(!i)return null;let o;return e[0]!==i.icon||e[1]!==i.title||e[2]!==s?(o=p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx(Gt,{icon:i.icon,name:i.title,size:s})}),e[0]=i.icon,e[1]=i.title,e[2]=s,e[3]=o):o=e[3],o}$o.Fallback=function({iconSize:e="xs"}){const t=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:Z(t,"rounded bg-muted animate-pulse")})})};function Er(n){const e=_.c(18),{connectionIds:t,maxVisibleIcons:r,iconSize:s,className:i}=n,o=r===void 0?2:r,l=s===void 0?"xs":s;if(t.length===0)return null;let a,c,u;if(e[0]!==i||e[1]!==t||e[2]!==l||e[3]!==o){const h=t.slice(0,o);a=t.length-o,e[7]!==i?(c=Z("flex items-center justify-end -space-x-2",i),e[7]=i,e[8]=c):c=e[8];let m;e[9]!==l?(m=g=>p.jsx(E.Suspense,{fallback:p.jsx($o.Fallback,{iconSize:l}),children:p.jsx($o,{connection_id:g,iconSize:l})},g),e[9]=l,e[10]=m):m=e[10],u=h.map(m),e[0]=i,e[1]=t,e[2]=l,e[3]=o,e[4]=a,e[5]=c,e[6]=u}else a=e[4],c=e[5],u=e[6];let d;e[11]!==l||e[12]!==a?(d=a>0&&p.jsx("div",{className:Z("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",l==="sm"?"size-8":"size-6"),children:p.jsxs("span",{className:Z(l==="sm"?"text-sm":"text-xs","font-medium text-muted-foreground"),"aria-label":`and ${a} more`,children:["+",a]})}),e[11]=l,e[12]=a,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}Er.Fallback=function({maxVisibleIcons:e=2,totalCount:t,iconSize:r="xs"}){const s=r==="sm"?"size-6":"size-5",i=r==="sm"?"size-8":"size-6",o=t!==void 0&&t>e;return p.jsxs("div",{className:"flex items-center -space-x-2",children:[Array.from({length:e}).map((l,a)=>p.jsx("div",{className:"shrink-0 bg-background ring-1 ring-background rounded-lg",children:p.jsx("div",{className:Z(s,"rounded bg-muted animate-pulse")})},a)),o&&p.jsx("div",{className:Z("shrink-0 bg-background ring-1 ring-background border border-border rounded-lg flex items-center justify-center",i),children:p.jsx("div",{className:Z(r==="sm"?"h-3.5 w-5":"h-3 w-4","rounded bg-muted animate-pulse")})})]})};const gv="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. ",Gc=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):null;function xv(n){const e=_.c(64),{part:t,latency:r}=n,s=ju(),i=ct(t.state),o=E.useRef(null),l=E.useRef(null),a=E.useRef(null),c=E.useRef(null),u=E.useRef(null);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{Gc?.matches||(u.current=o.current?.getBoundingClientRect()??null,o.current&&(o.current.style.willChange="transform"))},e[0]=d):d=e[0];const f=d;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=V=>{if(Gc?.matches)return;const se=u.current,ae=o.current;if(!se||!ae)return;const de=(V.clientX-se.left)/se.width*100,Ie=(V.clientY-se.top)/se.height*100;ae.style.transform=`perspective(800px) rotateY(${(de-50)*.05}deg) rotateX(${(Ie-50)*-.05}deg)`,l.current&&(l.current.style.opacity="1",l.current.style.transform=`translate(${(de-50)*.15}px, ${(Ie-50)*.15}px)`),a.current&&(a.current.style.opacity="0.45"),c.current&&(c.current.style.opacity="0.45")},e[1]=h):h=e[1];const m=h;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const V=o.current;V&&(V.style.transform="none",V.style.willChange="auto"),l.current&&(l.current.style.opacity="0.4",l.current.style.transform="translate(0, 0)"),a.current&&(a.current.style.opacity="0.3"),c.current&&(c.current.style.opacity="0.3"),u.current=null},e[2]=g):g=e[2];const x=g;if(i==="loading"){let V;return e[3]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ee,{icon:p.jsx(ht,{className:"animate-pulse"}),title:"Creating agent",state:"loading",defaultOpen:!0}),e[3]=V):V=e[3],V}if(i==="approval"){let V;return e[4]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ee,{icon:p.jsx(ht,{}),title:"Create agent",state:"idle"}),e[4]=V):V=e[4],V}if(i==="error"){let V;e[5]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ht,{}),e[5]=V):V=e[5];const se=t.state==="output-denied"?"Agent creation cancelled":"Couldn't create agent";let ae;e[6]!==r?(ae=p.jsx($e,{latency:r}),e[6]=r,e[7]=ae):ae=e[7];let de;return e[8]!==se||e[9]!==ae?(de=p.jsx(ee,{icon:V,title:se,state:"error",trailing:ae}),e[8]=se,e[9]=ae,e[10]=de):de=e[10],de}let y,b,k;if(e[11]!==r||e[12]!==t.output){k=Symbol.for("react.early_return_sentinel");e:{if(y=Jn(t.output)?.item,!y?.id||!y?.title){let V;e[16]===Symbol.for("react.memo_cache_sentinel")?(V=p.jsx(ht,{}),e[16]=V):V=e[16];let se;e[17]!==r?(se=p.jsx(ee,{icon:V,title:"Agent created",state:"idle",trailing:p.jsx($e,{latency:r})}),e[17]=r,e[18]=se):se=e[18],k=se;break e}b=(y.connections??[]).map(yv)}e[11]=r,e[12]=t.output,e[13]=y,e[14]=b,e[15]=k}else y=e[13],b=e[14],k=e[15];if(k!==Symbol.for("react.early_return_sentinel"))return k;const S=b;let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=p.jsx(ht,{className:"text-success"}),e[19]=v):v=e[19];const C=`Agent created: ${y.title}`;let w;e[20]!==r?(w=p.jsx($e,{latency:r}),e[20]=r,e[21]=w):w=e[21];let T;e[22]!==C||e[23]!==w?(T=p.jsx(ee,{icon:v,title:C,state:"idle",trailing:w}),e[22]=C,e[23]=w,e[24]=T):T=e[24];let N;e[25]===Symbol.for("react.memo_cache_sentinel")?(N={transition:"transform 0.3s ease-out"},e[25]=N):N=e[25];let M;e[26]===Symbol.for("react.memo_cache_sentinel")?(M=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[26]=M):M=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j={textAlign:"justify",wordBreak:"break-all"},e[27]=j):j=e[27];let O,A;e[28]===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:j,"aria-hidden":"true",children:gv.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[28]=O,e[29]=A):(O=e[28],A=e[29]);let R;e[30]===Symbol.for("react.memo_cache_sentinel")?(R=p.jsx("img",{ref:a,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[30]=R):R=e[30];let I;e[31]===Symbol.for("react.memo_cache_sentinel")?(I=p.jsx("img",{ref:c,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[31]=I):I=e[31];let $;e[32]!==y.icon||e[33]!==y.title?($=p.jsx(ku,{icon:y.icon,name:y.title,size:"md"}),e[32]=y.icon,e[33]=y.title,e[34]=$):$=e[34];let P;e[35]!==y.title?(P=p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:y.title})}),e[35]=y.title,e[36]=P):P=e[36];let z;e[37]!==$||e[38]!==P?(z=p.jsxs("div",{className:"flex items-center gap-2.5 p-2",children:[$,P]}),e[37]=$,e[38]=P,e[39]=z):z=e[39];let B;e[40]!==y.description?(B=y.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:y.description})}),e[40]=y.description,e[41]=B):B=e[41];let q;e[42]!==z||e[43]!==B?(q=p.jsxs("div",{className:"relative",children:[z,B]}),e[42]=z,e[43]=B,e[44]=q):q=e[44];let X;e[45]!==S?(X=S.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Er.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:S.length}),children:p.jsx(Er,{connectionIds:S,iconSize:"xs",maxVisibleIcons:3,className:"flex items-center justify-start -space-x-1"})}),e[45]=S,e[46]=X):X=e[46];let U;e[47]!==X?(U=p.jsx("div",{className:"flex-1 min-w-0",children:X}),e[47]=X,e[48]=U):U=e[48];let G;e[49]!==y.id||e[50]!==s?(G=()=>s(y.id),e[49]=y.id,e[50]=s,e[51]=G):G=e[51];const te=`See agent: ${y.title}`;let ne;e[52]!==G||e[53]!==te?(ne=p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:p.jsx(mt,{size:"sm",className:"h-7",onClick:G,"aria-label":te,children:"See agent"})}),e[52]=G,e[53]=te,e[54]=ne):ne=e[54];let re;e[55]!==U||e[56]!==ne?(re=p.jsxs("div",{className:"relative z-[3] flex items-center gap-2.5 px-2 pt-6 pb-1",children:[U,ne]}),e[55]=U,e[56]=ne,e[57]=re):re=e[57];let le;e[58]!==q||e[59]!==re?(le=p.jsx("div",{className:"mt-2 overflow-hidden rounded-xl border-[0.5px] border-border bg-card p-2.5",children:p.jsxs("div",{ref:o,className:"relative overflow-hidden rounded-lg bg-accent/25 p-2",style:N,onMouseEnter:f,onMouseMove:m,onMouseLeave:x,children:[M,O,A,R,I,q,re]})}),e[58]=q,e[59]=re,e[60]=le):le=e[60];let ye;return e[61]!==le||e[62]!==T?(ye=p.jsxs(p.Fragment,{children:[T,le]}),e[61]=le,e[62]=T,e[63]=ye):ye=e[63],ye}function yv(n){return n.connection_id}function bv(n){const e=_.c(24),{agent:t}=n,r=ju();if(!t.id)return null;let s;e[0]!==t.connections?(s=t.connections??[],e[0]=t.connections,e[1]=s):s=e[1];let i;e[2]!==s?(i=s.map(kv),e[2]=s,e[3]=i):i=e[3];const o=i;let l;e[4]!==t.id||e[5]!==r?(l=()=>r(t.id),e[4]=t.id,e[5]=r,e[6]=l):l=e[6];let a;e[7]!==t.icon||e[8]!==t.title?(a=p.jsx(ku,{icon:t.icon,name:t.title,size:"sm"}),e[7]=t.icon,e[8]=t.title,e[9]=a):a=e[9];let c;e[10]!==t.title?(c=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[10]=t.title,e[11]=c):c=e[11];let u;e[12]!==t.description?(u=t.description&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.description}),e[12]=t.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]!==o?(f=o.length>0&&p.jsx(E.Suspense,{fallback:p.jsx(Er.Fallback,{iconSize:"xs",maxVisibleIcons:3,totalCount:o.length}),children:p.jsx(Er,{connectionIds:o,iconSize:"xs",maxVisibleIcons:3})}),e[17]=o,e[18]=f):f=e[18];let h;return e[19]!==l||e[20]!==a||e[21]!==d||e[22]!==f?(h=p.jsxs("button",{type:"button",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",children:[a,d,f]}),e[19]=l,e[20]=a,e[21]=d,e[22]=f,e[23]=h):h=e[23],h}function kv(n){return n.connection_id}function Sv(n){const e=_.c(41),{part:t,latency:r}=n,s=qn(),{org:i}=Mt();let o;e[0]!==t.state?(o=ct(t.state),e[0]=t.state,e[1]=o):o=e[1];const l=o;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Jn(t.output);if(c=Array.isArray(y?.items)?y.items:[],l==="loading"){let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(ht,{className:"animate-pulse"}),title:"Loading agents",state:"loading"}),e[12]=C):C=e[12],h=C;break e}if(l==="approval"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(ht,{}),title:"List agents",state:"idle"}),e[13]=C):C=e[13],h=C;break e}if(l==="error"){let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ht,{}),e[14]=C):C=e[14];const w=t.state==="output-denied"?"Agent list unavailable":"Couldn't load agents";let T;e[15]!==r?(T=p.jsx($e,{latency:r}),e[15]=r,e[16]=T):T=e[16];let N;e[17]!==w||e[18]!==T?(N=p.jsx(ee,{icon:C,title:w,state:"error",trailing:T}),e[17]=w,e[18]=T,e[19]=N):N=e[19],h=N;break e}if(c.length===0){let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ht,{}),e[20]=C):C=e[20];let w;e[21]!==r?(w=p.jsx(ee,{icon:C,title:"No agents yet",summary:"This organization hasn't created any agents.",state:"idle",trailing:p.jsx($e,{latency:r})}),e[21]=r,e[22]=w):w=e[22],h=w;break e}const b=c.slice(0,Nh);a=c.length-b.length;let k;e[23]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(ht,{className:"text-success"}),e[23]=k):k=e[23];const S=c.length===1?"1 agent":`${c.length} agents`;let v;e[24]!==r?(v=p.jsx($e,{latency:r}),e[24]=r,e[25]=v):v=e[25],e[26]!==S||e[27]!==v?(f=p.jsx(ee,{icon:k,title:S,state:"idle",trailing:v}),e[26]=S,e[27]=v,e[28]=f):f=e[28],u="mt-2 flex flex-col gap-1.5",d=b.map(vv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[29]!==a||e[30]!==c||e[31]!==s||e[32]!==i?(m=a>0&&p.jsx(Mh,{count:c.length,noun:"agents",onClick:()=>s({to:"/$org/settings/agents",params:{org:i.slug}})}),e[29]=a,e[30]=c,e[31]=s,e[32]=i,e[33]=m):m=e[33];let g;e[34]!==u||e[35]!==d||e[36]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[34]=u,e[35]=d,e[36]=m,e[37]=g):g=e[37];let x;return e[38]!==f||e[39]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[38]=f,e[39]=g,e[40]=x):x=e[40],x}function vv(n){return p.jsx(bv,{agent:n},n.id)}const wv={active:"bg-success",inactive:"bg-muted-foreground",error:"bg-destructive"};function Cv(n){const e=_.c(27),{connection:t}=n,r=qn(),{org:s}=Mt(),i=t.slug,o=t.description||t.app_name,l=!i||void 0;let a;e[0]!==r||e[1]!==s||e[2]!==i?(a=()=>i&&r({to:"/$org/settings/connections/$appSlug",params:{org:s.slug,appSlug:i}}),e[0]=r,e[1]=s,e[2]=i,e[3]=a):a=e[3];let c;e[4]!==t.icon||e[5]!==t.title?(c=p.jsx(Gt,{icon:t.icon,name:t.title,size:"sm"}),e[4]=t.icon,e[5]=t.title,e[6]=c):c=e[6];let u;e[7]!==t.title?(u=p.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.title}),e[7]=t.title,e[8]=u):u=e[8];let d;e[9]!==o?(d=o&&p.jsx("span",{className:"truncate text-xs text-muted-foreground",children:o}),e[9]=o,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=wv[t.status]??"bg-muted-foreground";let m;e[14]!==h?(m=Z("size-2 shrink-0 rounded-full",h),e[14]=h,e[15]=m):m=e[15];let g;e[16]!==m?(g=p.jsx("span",{className:m,"aria-hidden":"true"}),e[16]=m,e[17]=g):g=e[17];let x;e[18]!==t.status?(x=p.jsx("span",{className:"sr-only",children:t.status}),e[18]=t.status,e[19]=x):x=e[19];let y;return e[20]!==l||e[21]!==x||e[22]!==a||e[23]!==c||e[24]!==f||e[25]!==g?(y=p.jsxs("button",{type:"button","aria-disabled":l,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 aria-disabled:cursor-default aria-disabled:hover:bg-card",children:[c,f,g,x]}),e[20]=l,e[21]=x,e[22]=a,e[23]=c,e[24]=f,e[25]=g,e[26]=y):y=e[26],y}function Tv(n){const e=_.c(40),{part:t,latency:r}=n,s=qn(),{org:i}=Mt();let o;e[0]!==t.state?(o=ct(t.state),e[0]=t.state,e[1]=o):o=e[1];const l=o;let a,c,u,d,f,h;if(e[2]!==r||e[3]!==t.output||e[4]!==t.state||e[5]!==l){h=Symbol.for("react.early_return_sentinel");e:{const y=Jn(t.output);if(c=(Array.isArray(y?.items)?y.items:[]).filter(Mv),l==="loading"||l==="approval"){let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(ee,{icon:p.jsx(Lr,{className:"animate-pulse"}),title:"Loading connections",state:"loading"}),e[12]=C):C=e[12],h=C;break e}if(l==="error"){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Lr,{}),e[13]=C):C=e[13];const w=t.state==="output-denied"?"Connection list unavailable":"Couldn't load connections";let T;e[14]!==r?(T=p.jsx($e,{latency:r}),e[14]=r,e[15]=T):T=e[15];let N;e[16]!==w||e[17]!==T?(N=p.jsx(ee,{icon:C,title:w,state:"error",trailing:T}),e[16]=w,e[17]=T,e[18]=N):N=e[18],h=N;break e}if(c.length===0){let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=p.jsx(Lr,{}),e[19]=C):C=e[19];let w;e[20]!==r?(w=p.jsx(ee,{icon:C,title:"No connections yet",summary:"This organization hasn't connected any MCPs.",state:"idle",trailing:p.jsx($e,{latency:r})}),e[20]=r,e[21]=w):w=e[21],h=w;break e}const b=c.slice(0,Nh);a=c.length-b.length;let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=p.jsx(Lr,{className:"text-success"}),e[22]=k):k=e[22];const S=c.length===1?"1 connection":`${c.length} connections`;let v;e[23]!==r?(v=p.jsx($e,{latency:r}),e[23]=r,e[24]=v):v=e[24],e[25]!==S||e[26]!==v?(f=p.jsx(ee,{icon:k,title:S,state:"idle",trailing:v}),e[25]=S,e[26]=v,e[27]=f):f=e[27],u="mt-2 flex flex-col gap-1.5",d=b.map(Nv)}e[2]=r,e[3]=t.output,e[4]=t.state,e[5]=l,e[6]=a,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=h}else a=e[6],c=e[7],u=e[8],d=e[9],f=e[10],h=e[11];if(h!==Symbol.for("react.early_return_sentinel"))return h;let m;e[28]!==a||e[29]!==c||e[30]!==s||e[31]!==i?(m=a>0&&p.jsx(Mh,{count:c.length,noun:"connections",onClick:()=>s({to:"/$org/settings/connections",params:{org:i.slug}})}),e[28]=a,e[29]=c,e[30]=s,e[31]=i,e[32]=m):m=e[32];let g;e[33]!==u||e[34]!==d||e[35]!==m?(g=p.jsxs("div",{className:u,children:[d,m]}),e[33]=u,e[34]=d,e[35]=m,e[36]=g):g=e[36];let x;return e[37]!==f||e[38]!==g?(x=p.jsxs(p.Fragment,{children:[f,g]}),e[37]=f,e[38]=g,e[39]=x):x=e[39],x}function Nv(n){return p.jsx(Cv,{connection:n},n.id)}function Mv(n){return n.connection_type!=="VIRTUAL"}function Ev(){const n=_.c(37),e=el(),{sendMessage:t,isStreaming:r,messages:s}=tm(),{org:i}=Mt(),o=e?.virtualMcpId,{prompts:l}=ym(i.slug),a=o??null;let c;n[0]!==i.id||n[1]!==i.slug||n[2]!==a?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},n[0]=i.id,n[1]=i.slug,n[2]=a,n[3]=c):c=n[3];const u=qo(c),[d,f]=E.useState(null);if(!o||r||!vp(o)||!s.some(Av))return null;let m;if(n[4]!==l||n[5]!==o){let A;n[7]!==o?(A=R=>R.agentId===o&&R.promptName,n[7]=o,n[8]=A):A=n[8],m=l.find(A),n[4]=l,n[5]=o,n[6]=m}else m=n[6];const g=m;if(!g)return null;let x;n[9]!==u||n[10]!==t?(x=async(A,R)=>{if(!u){eo.error("MCP client not available");return}try{const I=await Sm(u,A.name,R);await t({type:"doc",content:[{type:"paragraph",content:[Yf({id:A.name,name:rl(A.name,nl(A._meta)),metadata:I.messages,char:"/",kind:"prompt",args:R}),{type:"text",text:" "}]}]})}catch(I){console.error("[next-action-chip] failed",I),eo.error("Failed to load prompt. Please try again.")}},n[9]=u,n[10]=t,n[11]=x):x=n[11];const y=x;let b;n[12]!==g._meta||n[13]!==g.arguments||n[14]!==g.description||n[15]!==g.promptName||n[16]!==g.title||n[17]!==y?(b=()=>{const A={name:g.promptName,title:g.title,description:g.description,arguments:g.arguments,_meta:g._meta};if(A.arguments&&A.arguments.length>0){f(A);return}y(A)},n[12]=g._meta,n[13]=g.arguments,n[14]=g.description,n[15]=g.promptName,n[16]=g.title,n[17]=y,n[18]=b):b=n[18];const k=b;let S,v;n[19]===Symbol.for("react.memo_cache_sentinel")?(S=p.jsx(km,{size:12,className:"shrink-0 text-purple-500"}),v=p.jsx("span",{className:"font-medium text-foreground/80",children:"Next:"}),n[19]=S,n[20]=v):(S=n[19],v=n[20]);let C;n[21]!==g.title?(C=p.jsx("span",{className:"truncate",children:g.title}),n[21]=g.title,n[22]=C):C=n[22];let w;n[23]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(Su,{size:12,className:"shrink-0 transition-transform duration-150 group-hover:translate-x-0.5"}),n[23]=w):w=n[23];let T;n[24]!==k||n[25]!==C?(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:[S,v,C,w]}),n[24]=k,n[25]=C,n[26]=T):T=n[26];let N;n[27]===Symbol.for("react.memo_cache_sentinel")?(N=A=>f(A),n[27]=N):N=n[27];let M;n[28]!==d||n[29]!==y?(M=async A=>{const R=d;f(null),R&&await y(R,A)},n[28]=d,n[29]=y,n[30]=M):M=n[30];let j;n[31]!==d||n[32]!==M?(j=p.jsx(Um,{prompt:d,setPrompt:N,onSubmit:M}),n[31]=d,n[32]=M,n[33]=j):j=n[33];let O;return n[34]!==j||n[35]!==T?(O=p.jsxs(p.Fragment,{children:[T,j]}),n[34]=j,n[35]=T,n[36]=O):O=n[36],O}function Av(n){return n.role==="user"||n.parts.some(jv)}function jv(n){return n.type==="tool-user_ask"&&n.state==="output-available"}function Iv(n){const e=new Map;for(let t=n.length-1;t>=0;t--){const r=n[t]?.parts;if(r)for(const s of r){const i=s;if(i.type!=="data-deck-updated")continue;const o=i.data;if(!o?.path)continue;const l=`deck:${o.path}`;e.has(l)||e.set(l,{tabId:lm(o.path),label:o.name||o.path,kind:o.kind==="page"?"page":"deck"})}}return Array.from(e.values())}function Ov(){const n=_.c(9),e=qn(),t=Kn()?.messages??[],r=Iv(t);if(r.length===0)return null;const s=r.some(Dv),i=r.some(Rv),o=s?i?"Slides & pages in this chat":"Slides in this chat":"Pages in this chat",l="flex flex-col gap-1.5 py-2";let a;n[0]!==o?(a=p.jsx("div",{className:"text-[12px] text-muted-foreground/70 uppercase tracking-wide",children:o}),n[0]=o,n[1]=a):a=n[1];const c="flex flex-wrap gap-2";let u;n[2]!==e?(u=m=>p.jsxs("button",{type:"button",onClick:()=>e({to:".",search:g=>({...g,main:m.tabId}),replace:!0}),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(ir,{className:"size-3.5 shrink-0 text-muted-foreground"}):p.jsx(dm,{className:"size-3.5 shrink-0 text-muted-foreground"}),p.jsx("span",{className:"font-medium text-foreground",children:m.label})]},m.tabId),n[2]=e,n[3]=u):u=n[3];const d=r.map(u);let f;n[4]!==d?(f=p.jsx("div",{className:c,children:d}),n[4]=d,n[5]=f):f=n[5];let h;return n[6]!==a||n[7]!==f?(h=p.jsxs("div",{className:l,children:[a,f]}),n[6]=a,n[7]=f,n[8]=h):h=n[8],h}function Rv(n){return n.kind==="page"}function Dv(n){return n.kind==="deck"}async function Pv(n,e){const t=await fetch(`/api/${e}/threads/${encodeURIComponent(n)}/outputs`,{credentials:"include"});if(!t.ok)throw new Error(`Failed to fetch thread outputs: ${t.status}`);return(await t.json()).objects??[]}function IT(){const n=_.c(2),e=Kn()?.messages??[];let t;return n[0]!==e?(t=e.some(Lv),n[0]=e,n[1]=t):t=n[1],t}function Lv(n){return n.parts?.some(_v)}function _v(n){const e=n;return(e.type==="tool-share_with_user"||e.type==="tool-bash"||e.type==="tool-write")&&e.state==="output-available"}function $v(n,e){const t=_.c(9),{org:r}=Mt();let s;t[0]!==n?(s=nt.threadOutputs(n??""),t[0]=n,t[1]=s):s=t[1];let i;t[2]!==r||t[3]!==n?(i=()=>Pv(n??"",r.slug),t[2]=r,t[3]=n,t[4]=i):i=t[4];const o=!!n&&(e?.enabled??!0);let l;return t[5]!==s||t[6]!==i||t[7]!==o?(l={queryKey:s,queryFn:i,enabled:o,staleTime:0},t[5]=s,t[6]=i,t[7]=o,t[8]=l):l=t[8],jr(l)}function zv(n){const e=_.c(20),{file:t}=n,r=qn();let s;e[0]!==t.key||e[1]!==r?(s=()=>r({to:".",search:h=>({...h,main:am(t.key)}),replace:!0}),e[0]=t.key,e[1]=r,e[2]=s):s=e[2];const i=s;let o;e[3]!==t.filename?(o=p.jsx(Gp,{filename:t.filename,className:"h-5 w-4 shrink-0"}),e[3]=t.filename,e[4]=o):o=e[4];let l;e[5]!==t.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:t.filename,children:t.filename}),e[5]=t.filename,e[6]=i,e[7]=l):l=e[7];const a=`Download ${t.filename}`;let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=p.jsx(Eu,{className:"size-3.5"}),e[8]=c):c=e[8];let u;e[9]!==t.downloadUrl||e[10]!==t.filename||e[11]!==a?(u=p.jsx("a",{href:t.downloadUrl,download:t.filename,className:"hidden shrink-0 text-muted-foreground hover:text-foreground group-hover:block",title:"Download","aria-label":a,children:c}),e[9]=t.downloadUrl,e[10]=t.filename,e[11]=a,e[12]=u):u=e[12];let d;e[13]!==i?(d=p.jsx(mt,{variant:"outline",size:"sm",className:"h-7 shrink-0 px-2.5 text-xs",onClick:i,children:"Open"}),e[13]=i,e[14]=d):d=e[14];let f;return e[15]!==o||e[16]!==l||e[17]!==u||e[18]!==d?(f=p.jsxs("div",{className:"group flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[o,l,u,d]}),e[15]=o,e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}function Xc(n){return n.split("/").pop()??n}const Bv=/(^|\/)output\//;function Fv(n){const e=new Set;for(const t of n.parts??[]){const r=t;if(r.state==="output-available"){if(r.type==="tool-share_with_user"){const s=r.output?.filename??r.input?.name??(r.input?.source?Xc(r.input.source):null);s&&e.add(s)}else if(r.type==="tool-write"){const s=r.input?.path;s&&Bv.test(s)&&e.add(Xc(s))}}}return e}function Vv(n){const e=_.c(4),{threadId:t,message:r}=n,s=Fv(r),i=s.size>0;let o;e[0]!==i?(o={enabled:i},e[0]=i,e[1]=o):o=e[1];const{data:l}=$v(t,o);if(s.size===0)return null;const a=(l??[]).filter(f=>s.has(f.filename));if(a.length===0)return null;const c="flex flex-col gap-1.5 py-2",u=a.map(Hv);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 Hv(n){return p.jsx(zv,{file:n},n.key)}function Wv(n){return n.type==="reasoning"}function Uv(n){const e=[],t=new Set,r=new Map,s=new Map,i=new Map;if(n){let l=null;for(let a=0;a<n.parts.length;a++){const c=n.parts[a];if(Wv(c)){l||(l={parts:[],startIndex:a},e.push(l)),l.parts.push(c),t.add(a);continue}if(l=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;i.set(u,d.text??"");continue}}}const o=[];if(n)for(let l=0;l<n.parts.length;l++){const a=n.parts[l];if(a.type!=="step-start"){if(t.has(l)){const c=e.find(u=>u.startIndex===l);c&&o.push({kind:"reasoning-group",group:c});continue}a.type.startsWith("data-")||o.push({kind:"part",index:l})}}return{reasoningGroups:e,renderOrder:o,dataParts:{toolMetadata:r,toolSubtaskMetadata:s,webSearchStreaming:i}}}function zo(n){const e=_.c(9),{since:t}=n;let r;e[0]!==t?(r=()=>da(t,Date.now()),e[0]=t,e[1]=r):r=e[1];const[s,i]=E.useState(r);let o,l;e[2]!==t?(o=()=>{const d=setInterval(()=>i(da(t,Date.now())),100);return()=>clearInterval(d)},l=[t],e[2]=t,e[3]=o,e[4]=l):(o=e[3],l=e[4]),E.useEffect(o,l);const a=s/1e3;let c;e[5]!==a?(c=Ut(a),e[5]=a,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 $h=[{delay:0},{delay:100},{delay:200},{delay:100},{delay:200},{delay:200},{delay:300},{delay:300},{delay:400}];function qv(){const n=_.c(5),[e]=E.useState(Kv);let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t={gridTemplateColumns:"repeat(3, 3px)",gap:"1.5px",width:"fit-content"},n[0]=t):t=n[0];let r;n[1]!==e?(r=$h.map((i,o)=>{const{delay:l}=i;return p.jsx("div",{className:"rounded-[1px]",style:{width:3,height:3,"--cell-color":e[o],animation:"grid-ripple 1s ease infinite",animationDelay:`${l}ms`}},o)}),n[1]=e,n[2]=r):r=n[2];let s;return n[3]!==r?(s=p.jsx("div",{className:"grid",style:t,children:r}),n[3]=r,n[4]=s):s=n[4],s}function Kv(){const n=`var(--chart-${Math.ceil(Math.random()*5)})`;return $h.map(()=>Math.random()<.6?"color-mix(in srgb, var(--muted-foreground) 25%, transparent)":n)}const Jv={planning:{icon:p.jsx(Kp,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Planning next moves",detail:"Deciding how to approach the request"},thinking:{icon:p.jsx(Qs,{className:"text-muted-foreground shrink-0 animate-pulse",size:14}),label:"Thinking",detail:"Working through the next response"}},Gv=1200;function Bo(n){const e=_.c(9),{icon:t,title:r,summary:s,detail:i,state:o,detailVariant:l,latency:a,trailing:c}=n,u=l===void 0?"prose":l;let d;return e[0]!==i||e[1]!==u||e[2]!==t||e[3]!==a||e[4]!==o||e[5]!==s||e[6]!==r||e[7]!==c?(d=p.jsx(ee,{icon:t,title:r,summary:s,detail:i,state:o,detailVariant:u,latency:a,trailing:c}),e[0]=i,e[1]=u,e[2]=t,e[3]=a,e[4]=o,e[5]=s,e[6]=r,e[7]=c,e[8]=d):d=e[8],d}function Xv(n){const e=_.c(17),{startedAt:t}=n,r=Kn()?.runStatusStage??null,[s,i]=E.useState("planning");let o,l;if(e[0]!==r?(o=()=>{if(r!==null)return;const f=setTimeout(()=>{i("thinking")},Gv);return()=>{clearTimeout(f)}},l=[r],e[0]=r,e[1]=o,e[2]=l):(o=e[1],l=e[2]),E.useEffect(o,l),r!==null){const f=im[r];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=p.jsx(Qs,{className:"size-4"}),e[3]=h):h=e[3];const m=`${f.label}...`;let g;e[4]!==t?(g=t!==null&&p.jsx(zo,{since:t}),e[4]=t,e[5]=g):g=e[5];let x;return e[6]!==f.detail||e[7]!==m||e[8]!==g?(x=p.jsx(Bo,{icon:h,title:m,summary:f.detail,state:"loading",trailing:g}),e[6]=f.detail,e[7]=m,e[8]=g,e[9]=x):x=e[9],x}const a=Jv[s],c=`${a.label}...`;let u;e[10]!==t?(u=t!==null&&p.jsx(zo,{since:t}),e[10]=t,e[11]=u):u=e[11];let d;return e[12]!==a.detail||e[13]!==a.icon||e[14]!==c||e[15]!==u?(d=p.jsx(Bo,{icon:a.icon,title:c,summary:a.detail,state:"loading",trailing:u}),e[12]=a.detail,e[13]=a.icon,e[14]=c,e[15]=u,e[16]=d):d=e[16],d}function Yv(n){const e=_.c(3),{startedAt:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(qv,{}),e[0]=r):r=e[0];let s;return e[1]!==t?(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(zo,{since:t})]}),e[1]=t,e[2]=s):s=e[2],s}const Qv=2e4;function Zv(n){const e=_.c(8),{startedAt:t}=n;fu(1e3);const r=Kn(),i=(t!==null?Date.now()-t:0)>=Qv;let o;e[0]!==t?(o=p.jsx(Xv,{startedAt:t}),e[0]=t,e[1]=o):o=e[1];let l;e[2]!==i||e[3]!==r?(l=i&&r?.stop&&p.jsxs("div",{className:"flex items-center gap-2 pb-1 text-[13px] text-muted-foreground/60",children:[p.jsx("span",{children:"This is taking longer than usual."}),p.jsx("button",{type:"button",onClick:()=>r.stop(),className:"text-muted-foreground hover:text-foreground underline underline-offset-2",children:"Cancel"})]}),e[2]=i,e[3]=r,e[4]=l):l=e[4];let a;return e[5]!==o||e[6]!==l?(a=p.jsxs("div",{className:"flex flex-col gap-0.5",children:[o,l]}),e[5]=o,e[6]=l,e[7]=a):a=e[7],a}function ew(n){const e=_.c(20),{duration:t,parts:r,isStreaming:s}=n;let i;e[0]!==r?(i=r.every(rw),e[0]=r,e[1]=i):i=e[1];const o=i;let l;e[2]!==t?(l=t&&t/1e3>1?`Thought for ${Ut(t/1e3)}`:"Thought",e[2]=t,e[3]=l):l=e[3];const a=l;let c;if(e[4]!==o||e[5]!==s||e[6]!==r){const k=r.map(nw).join(`
185
185
  `).trim().split(`
186
186
  `).filter(Boolean),S=s?k[k.length-1]??"":k[0]??"";c=!o&&S?S.length>100?S.slice(0,100)+"…":S:void 0,e[4]=o,e[5]=s,e[6]=r,e[7]=c}else c=e[7];const u=c;let d;if(e[8]!==o||e[9]!==r){const b=r.map(tw).join(`
187
187
 
@@ -0,0 +1 @@
1
+ import{c as B,j as o,C as L,b as T,r as $,B as M,p as N}from"./index-ibVYCtdk.js";import{s as q}from"./Plus-BkEprJHF.js";import{i as S}from"./Zap-BUgMog8M.js";import{S as D}from"./search-input-D7ajgDO_.js";import{P as l}from"./index-DaW53K3w.js";import{E as b}from"./empty-state-Dj1UiFtA.js";import{c as O}from"./use-automations-C8vesZ5J.js";import{c as V}from"./use-navigate-to-agent-miif_g44.js";import{A as F}from"./automation-list-row-CnL5NUn0.js";import{f as G}from"./constants-D_FQAPnt.js";import{u as H}from"./use-virtual-mcp-CkueoyOa.js";import{R as J}from"./require-capability-BYYj6I9k.js";import"./SearchMd-DPgb_Mb5.js";import"./sidebar-BIOIlAO_.js";import"./LayoutLeft-BB_flP7V.js";import"./use-mobile-B1itw65d.js";import"./X-ehE2-PPh.js";import"./tooltip-DmGjSLGv.js";import"./use-mcp-client-OGs9WihN.js";import"./auth-CJQ6Yx_r.js";import"./studio-tools-CiEb3YCV.js";import"./hooks-C1wDxsG8.js";import"./decopilot-sse-pool-BM-tUdQR.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./reusable-new-chat-CouMjkYR.js";import"./alert-dialog-vSPTpv6H.js";import"./dropdown-menu-BnqypSUe.js";import"./Check-CHx9EjoK.js";import"./ChevronRight-EIxlJCAn.js";import"./Circle-Dn33pGko.js";import"./Stars02-CFJkyC0W.js";import"./DotsVertical-DURNExIZ.js";import"./Trash01-CQNpRi9v.js";import"./agent-icon-CTdje-Yo.js";import"./AlertCircle-C0LNRXFL.js";import"./UserPlus01-DoMT5VeR.js";import"./Tool01-vwcHp5vx.js";import"./ArrowUp-DEIsNZJ7.js";import"./Settings02-B4gKkQVa.js";import"./Tool02-B9R6nZBJ.js";import"./XCircle-H5V2L4xB.js";import"./ArrowUpRight-CfyQUwOR.js";import"./TrendUp01-DpJPP1Jq.js";import"./ZapSquare-D3GithUx.js";import"./Users03-CeF5jvSj.js";import"./CheckCircle-DuKYtqTR.js";import"./ChevronDown-UK2bP1UQ.js";import"./ChevronUp-C2du4mz8.js";import"./Copy01-Dec6QuUO.js";import"./ZoomOut-CXi1AmaE.js";import"./Globe01-Dv1MemnH.js";import"./Eye-Tv0RqHHP.js";import"./FilterLines-DoBDuM0w.js";import"./Flag01-UPbZzTjU.js";import"./Star01-rwC6MUs1.js";import"./Globe04-DlE3tpui.js";import"./SwitchHorizontal01-CfyLxrC_.js";import"./HardDrive-BSWP1vqJ.js";import"./Key01-DUQfSOZQ.js";import"./LinkExternal01-DTumzywO.js";import"./List-Cearyjn7.js";import"./Monitor01-BXWr0YEZ.js";import"./Sun-D5EL7OWV.js";import"./Package-Dc3diOZj.js";import"./Palette-DLRDeZMj.js";import"./Play-B_VdYdQy.js";import"./SearchLg-D_6LPW5y.js";import"./Shield01-ByGL3nCz.js";import"./Stars01-DkyiijKz.js";import"./Upload01-CbyoXv84.js";import"./User01-DVvBrT-K.js";import"./Users01-BTp0QmgZ.js";import"./XClose-AmEq2OYZ.js";import"./use-collections-CvDTPu4s.js";import"./use-capability-EhARhd3Z.js";import"./access-gate-CQxfoP_U.js";import"./capability-load-error-jrr5P4vz.js";function K(){const t=B.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const a=y.get(e.virtual_mcp_id);if(a&&a.title.toLowerCase().includes(g))return!0}return!1}),P=(e,a)=>{const A=a&&y.has(a)?a:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),k(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let m;t[10]!==h.Content||t[11]!==s?(m=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=m):m=t[12];let c;return t[13]!==x||t[14]!==m?(c=o.jsx(x,{children:m}),t[13]=x,t[14]=m,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function _o(){const t=B.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{_o as default};
@@ -1 +1 @@
1
- import{D as a}from"./index-C6rSPqKT.js";const i=1e4,m="true";function s(e,t){return a.chatAutosend(e,t)}function d(e){return e==="pending"||e==="sending"}function c(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||typeof t.createdAt!="number"||typeof t.message!="object"||!d(t.status)?null:t}function A(e,t,r,o,u=Date.now()){const n={message:o,createdAt:u,status:"pending"};return e.setItem(s(t,r),JSON.stringify(n)),n}function f(e,t,r){const o=s(t,r),u=c(e.getItem(o));return u||(e.removeItem(o),null)}function S(e,t,r,o=Date.now()){const u=s(t,r),n=f(e,t,r);return!n||n.status!=="pending"?null:o-n.createdAt>=i?(e.removeItem(u),null):(e.setItem(u,JSON.stringify({...n,status:"sending"})),{message:n.message,createdAt:n.createdAt})}function p(e,t,r){e.removeItem(s(t,r))}export{m as A,p as a,S as c,A as w};
1
+ import{D as a}from"./index-ibVYCtdk.js";const i=1e4,m="true";function s(e,t){return a.chatAutosend(e,t)}function d(e){return e==="pending"||e==="sending"}function c(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||typeof t.createdAt!="number"||typeof t.message!="object"||!d(t.status)?null:t}function A(e,t,r,o,u=Date.now()){const n={message:o,createdAt:u,status:"pending"};return e.setItem(s(t,r),JSON.stringify(n)),n}function f(e,t,r){const o=s(t,r),u=c(e.getItem(o));return u||(e.removeItem(o),null)}function S(e,t,r,o=Date.now()){const u=s(t,r),n=f(e,t,r);return!n||n.status!=="pending"?null:o-n.createdAt>=i?(e.removeItem(u),null):(e.setItem(u,JSON.stringify({...n,status:"sending"})),{message:n.message,createdAt:n.createdAt})}function p(e,t,r){e.removeItem(s(t,r))}export{m as A,p as a,S as c,A as w};