decocms 4.514.5 → 4.515.0

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 (465) hide show
  1. package/dist/client/assets/ActiveShapeUtils-B2LFrfRE.js +1 -0
  2. package/dist/client/assets/{AlertCircle-xI8XX-bi.js → AlertCircle-BEMVsPah.js} +1 -1
  3. package/dist/client/assets/AreaChart-D7ncnKTv.js +1 -0
  4. package/dist/client/assets/{ArrowLeft-BKYzlDQY.js → ArrowLeft-BeJK1krP.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Cq3iZIwL.js → ArrowUp-CDPrL6Uz.js} +1 -1
  6. package/dist/client/assets/BarChart-D63RTQYz.js +1 -0
  7. package/dist/client/assets/{Building02-C9KWPxlH.js → Building02-BFpUButr.js} +1 -1
  8. package/dist/client/assets/CartesianChart-Cm278fbS.js +1 -0
  9. package/dist/client/assets/{CategoricalChart-DkwWvFDx.js → CategoricalChart-CNYNt0vK.js} +2 -2
  10. package/dist/client/assets/{CheckCircle-D30wPP6A.js → CheckCircle-Iq3Q6LLh.js} +1 -1
  11. package/dist/client/assets/{ChevronSelectorVertical-CknWVrzo.js → ChevronSelectorVertical-02lw_CbG.js} +1 -1
  12. package/dist/client/assets/{ChevronUp-CFN68hLk.js → ChevronUp-DeTPLyaf.js} +1 -1
  13. package/dist/client/assets/{Copy01-C73PJJxr.js → Copy01-DQtv3upd.js} +1 -1
  14. package/dist/client/assets/{CreditCard01-C8DlQ7Ge.js → CreditCard01-4SHg1t_a.js} +1 -1
  15. package/dist/client/assets/{DotsVertical-BvyfZIer.js → DotsVertical-Drns5Frs.js} +1 -1
  16. package/dist/client/assets/{ErrorBarContext-Bhpq3Y0r.js → ErrorBarContext-BkdZvkoD.js} +1 -1
  17. package/dist/client/assets/{Globe04-CVLAzwjm.js → Globe04-BXpRk-hX.js} +1 -1
  18. package/dist/client/assets/{Image01-DowwsvYG.js → Image01-1LQuy0wG.js} +1 -1
  19. package/dist/client/assets/{Key01-rbnGMz2E.js → Key01-CoFqvDTW.js} +1 -1
  20. package/dist/client/assets/{Link01-DRsKyIm5.js → Link01-DU3-3Ipb.js} +1 -1
  21. package/dist/client/assets/{LinkBroken01-ZRquEJUl.js → LinkBroken01-h_HqMIlK.js} +1 -1
  22. package/dist/client/assets/{Minus-DPDq6KAA.js → Minus-DpXFgo6a.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DMME8GIo.js → Monitor01-BbCpGNqh.js} +1 -1
  24. package/dist/client/assets/{Play-c6bc1b3-.js → Play-C8EB0NeI.js} +1 -1
  25. package/dist/client/assets/{Plus-xabrshQG.js → Plus-DPS97GtY.js} +1 -1
  26. package/dist/client/assets/ReferenceLine-zJMNrbMl.js +1 -0
  27. package/dist/client/assets/{SearchMd-BODiv7c9.js → SearchMd-5E3M_LtW.js} +1 -1
  28. package/dist/client/assets/Sector-Chcdibol.js +28 -0
  29. package/dist/client/assets/{ShoppingBag01-DAjyOiiw.js → ShoppingBag01-BlUZ1Giu.js} +1 -1
  30. package/dist/client/assets/{Sun-BqmeoxcG.js → Sun-Bt6BixS7.js} +1 -1
  31. package/dist/client/assets/{SwitchHorizontal01-CESO3nxl.js → SwitchHorizontal01-BLJAU7vB.js} +1 -1
  32. package/dist/client/assets/{Tool01-BGL2Qt57.js → Tool01-DhUw9Xii.js} +1 -1
  33. package/dist/client/assets/{Trash01-Cf6bGuCZ.js → Trash01-y0tx6OKR.js} +1 -1
  34. package/dist/client/assets/{Upload01-ZLE7vfB9.js → Upload01-BT7hKOY8.js} +1 -1
  35. package/dist/client/assets/{User01-Cfg0yVvz.js → User01-Dtm_f3tA.js} +1 -1
  36. package/dist/client/assets/{UserSquare-DJngEPjS.js → UserSquare-DWYhjY7l.js} +1 -1
  37. package/dist/client/assets/{Users01-vn3EOu8A.js → Users01-DE8h5H5p.js} +1 -1
  38. package/dist/client/assets/{XClose-CdzjyNb0.js → XClose-sbj0sr-y.js} +1 -1
  39. package/dist/client/assets/{ZoomOut-B55seUHX.js → ZoomOut-Ult5yHk2.js} +1 -1
  40. package/dist/client/assets/{access-gate-CgSSvGG3.js → access-gate-C5s_nhLu.js} +1 -1
  41. package/dist/client/assets/{add-connection-dialog-O4xCe9BP.js → add-connection-dialog-BbC6Awnv.js} +1 -1
  42. package/dist/client/assets/agent-analytics-DkajWLZM.js +2 -0
  43. package/dist/client/assets/agent-app-3J3u6Y8o.js +1 -0
  44. package/dist/client/assets/agent-assets-arexmZYy.js +1 -0
  45. package/dist/client/assets/{agent-automation-DBMflQw2.js → agent-automation-CJwaiyVY.js} +1 -1
  46. package/dist/client/assets/agent-automations-Cgl9-uX7.js +1 -0
  47. package/dist/client/assets/agent-calendar-CcJ-9tHm.js +1 -0
  48. package/dist/client/assets/{agent-connect-sources-CX6V3W-l.js → agent-connect-sources-BSWyCv4T.js} +1 -1
  49. package/dist/client/assets/agent-deck-D77BlzDi.js +1 -0
  50. package/dist/client/assets/agent-e2e-BZnv0041.js +1 -0
  51. package/dist/client/assets/agent-experiments-DU-xnevM.js +1 -0
  52. package/dist/client/assets/agent-file-CEbVOehe.js +1 -0
  53. package/dist/client/assets/agent-hosting-CLRf1egV.js +1 -0
  54. package/dist/client/assets/{agent-icon-c0hRUHIU.js → agent-icon-BLy2WH4s.js} +1 -1
  55. package/dist/client/assets/agent-library-CHysr2dn.js +1 -0
  56. package/dist/client/assets/agent-library-file-DCoIJ_Vl.js +1 -0
  57. package/dist/client/assets/agent-monitor-D4SI9Y1m.js +1 -0
  58. package/dist/client/assets/{agent-overview-C0WObUrB.js → agent-overview-DeQq_tHv.js} +1 -1
  59. package/dist/client/assets/agent-releases-Cp26QvMd.js +2 -0
  60. package/dist/client/assets/agent-settings-Bd8cfGLd.js +1 -0
  61. package/dist/client/assets/agent-site-editor-code-CGFxlenC.js +2 -0
  62. package/dist/client/assets/agent-site-editor-content-O4R-vecW.js +1 -0
  63. package/dist/client/assets/agent-site-editor-pMTgGoBo.js +16 -0
  64. package/dist/client/assets/agent-site-editor-preview-CCdH77a2.js +1 -0
  65. package/dist/client/assets/agent-view-COR3ZSfj.js +1 -0
  66. package/dist/client/assets/{agent-view-guard-CY0RZ3mz.js → agent-view-guard-26j3Evt5.js} +1 -1
  67. package/dist/client/assets/{agents-list-lrkIUH1p.js → agents-list-Dcd5sOX1.js} +1 -1
  68. package/dist/client/assets/{ai-providers-BJRpwnf3.js → ai-providers-C2RBL7tG.js} +2 -2
  69. package/dist/client/assets/alert-BV79ffMP.js +1 -0
  70. package/dist/client/assets/{alert-dialog-M8Y0zqSA.js → alert-dialog-BILupwtl.js} +3 -3
  71. package/dist/client/assets/analytics-sections-Wnoh3PYg.js +1 -0
  72. package/dist/client/assets/api-keys-BO3F5W2N.js +1 -0
  73. package/dist/client/assets/{api-keys-BuJhmHVr.js → api-keys-Drifqas3.js} +1 -1
  74. package/dist/client/assets/app-editor-DkKkzh3V.js +1 -0
  75. package/dist/client/assets/{asset-utils-D4ZYWTsd.js → asset-utils-CV_m_T7Z.js} +1 -1
  76. package/dist/client/assets/{auth-CJCUdDnK.js → auth-B7U7Hff4.js} +1 -1
  77. package/dist/client/assets/{auth-catchall-PMDrOrh4.js → auth-catchall-BM3zBwm1.js} +1 -1
  78. package/dist/client/assets/{auth-entry-D45yK4lP.js → auth-entry-BdihVcdH.js} +1 -1
  79. package/dist/client/assets/{auth-split-layout-BeoAmW98.js → auth-split-layout-CPsRiXhM.js} +1 -1
  80. package/dist/client/assets/{authenticate-and-persist-oauth-D7W1mkzH.js → authenticate-and-persist-oauth-UvzpQNLL.js} +1 -1
  81. package/dist/client/assets/automation-list-row-CmreC44g.js +1 -0
  82. package/dist/client/assets/{automation-runs-7CDwsw1m.js → automation-runs-Ubm7wrw7.js} +1 -1
  83. package/dist/client/assets/{automations-DpOWGNx_.js → automations-ZAC4-o9b.js} +1 -1
  84. package/dist/client/assets/{autosend-BiXCzDoT.js → autosend-DEKkS89d.js} +1 -1
  85. package/dist/client/assets/{avatar-CVrfZDpI.js → avatar-BaUatl4r.js} +1 -1
  86. package/dist/client/assets/badge-BDrcnhS0.js +1 -0
  87. package/dist/client/assets/{block-document-EFEgqy7V.js → block-document-DWpcrKxc.js} +3 -3
  88. package/dist/client/assets/{blocks-preview-workspace-context-FfAtB7Mh.js → blocks-preview-workspace-context-CNobOsoP.js} +1 -1
  89. package/dist/client/assets/blocks-tab-states-5KLuOsbu.js +1 -0
  90. package/dist/client/assets/blog-schema-BKkPmh2I.js +1 -0
  91. package/dist/client/assets/{buckets-EuucCx-Z.js → buckets-CfPMmliP.js} +1 -1
  92. package/dist/client/assets/{build-improve-prompt-doc-0HVt3TgE.js → build-improve-prompt-doc-DJbnBElj.js} +1 -1
  93. package/dist/client/assets/{calendar-B3WUDV6V.js → calendar-CCVXvCMs.js} +1 -1
  94. package/dist/client/assets/campaigns-view-CacWid3q.js +1 -0
  95. package/dist/client/assets/{capability-load-error-CaA022rx.js → capability-load-error-C-qrhNhU.js} +1 -1
  96. package/dist/client/assets/category-editor-CcRf7L2l.js +1 -0
  97. package/dist/client/assets/{chart-B6d33H1D.js → chart-gMXBaCie.js} +1 -1
  98. package/dist/client/assets/{chat-context-BnuwMOfj.js → chat-context-NcP7iS0u.js} +6 -6
  99. package/dist/client/assets/{chat-draft-D3EwPWFD.js → chat-draft-MYleVoub.js} +1 -1
  100. package/dist/client/assets/{checkbox-Dla8kRWj.js → checkbox-TbFNti2k.js} +1 -1
  101. package/dist/client/assets/{choose-editor-CFsJlwqs.js → choose-editor-CDZ08K_i.js} +1 -1
  102. package/dist/client/assets/{cli-auth-success-DADJ0ld_.js → cli-auth-success-DMlxLLEu.js} +1 -1
  103. package/dist/client/assets/{client-icons-M2KssD4J.js → client-icons-DolqWn8Q.js} +1 -1
  104. package/dist/client/assets/cms-settings-editor-D03L9L4-.js +1 -0
  105. package/dist/client/assets/{collapsible-BWjY8cOG.js → collapsible-DvAZmEoh.js} +1 -1
  106. package/dist/client/assets/collection-detail-CQ4bhfmW.js +1 -0
  107. package/dist/client/assets/{collection-display-button-DcSGVqBT.js → collection-display-button-DTfH30As.js} +1 -1
  108. package/dist/client/assets/{collection-search-C0nHL4Zi.js → collection-search-C00LN-O5.js} +1 -1
  109. package/dist/client/assets/{collection-table-wrapper-BqLbzGMr.js → collection-table-wrapper-DOUS3XlF.js} +1 -1
  110. package/dist/client/assets/{collection-tabs-DJst1PBn.js → collection-tabs-BjFLrDhl.js} +1 -1
  111. package/dist/client/assets/{column-rules-C6rmmvcZ.js → column-rules-13kfrugr.js} +1 -1
  112. package/dist/client/assets/{combobox-DJtWtG8e.js → combobox-CaB-y5Ze.js} +1 -1
  113. package/dist/client/assets/{coming-soon-page-CycWyIEs.js → coming-soon-page-Cyxpb_RU.js} +1 -1
  114. package/dist/client/assets/{command-DQxPvzO0.js → command-DF9CyXTP.js} +1 -1
  115. package/dist/client/assets/{companion-mcps-section-BaIOrb8k.js → companion-mcps-section-D4tO5Rpb.js} +1 -1
  116. package/dist/client/assets/{config-0dQr8OOs.js → config-BpbgNSKK.js} +1 -1
  117. package/dist/client/assets/{connect-AQ7wxQDD.js → connect-R8YgYoXN.js} +3 -3
  118. package/dist/client/assets/{connect-layout-CsBnyYo4.js → connect-layout-DCuq7jhf.js} +1 -1
  119. package/dist/client/assets/{connection-B5x-rxzp.js → connection-CynHS3Ve.js} +1 -1
  120. package/dist/client/assets/{connection-card-CFqu0_G8.js → connection-card-DWCHVdl-.js} +1 -1
  121. package/dist/client/assets/{connection-detail-B_xaSLIN.js → connection-detail-BvRd_OKE.js} +1 -1
  122. package/dist/client/assets/{connection-form-helpers-CouK82td.js → connection-form-helpers-Dta5jpsZ.js} +1 -1
  123. package/dist/client/assets/{connections-CrdtyJFL.js → connections-DhBzJz3R.js} +1 -1
  124. package/dist/client/assets/content-tab-COTFxvxm.js +22 -0
  125. package/dist/client/assets/context-DDY4mKfD.js +1 -0
  126. package/dist/client/assets/{context-menu-CI-AryjZ.js → context-menu-CUU-6Ui3.js} +1 -1
  127. package/dist/client/assets/{context-shell-BsFUt-ob.js → context-shell-CPsWfJ_3.js} +3 -3
  128. package/dist/client/assets/{core.esm-DOdwJCI5.js → core.esm-C0uaMHhK.js} +1 -1
  129. package/dist/client/assets/{create-organization-dialog-CDMsJ1wq.js → create-organization-dialog-DaLRO9Sp.js} +1 -1
  130. package/dist/client/assets/{daily-pulse-A6lEoniM.js → daily-pulse-DKIjgibs.js} +1 -1
  131. package/dist/client/assets/date-utils-CrvIKg-s.js +1 -0
  132. package/dist/client/assets/{discover-JQgSyvWz.js → discover-INKGTCGz.js} +1 -1
  133. package/dist/client/assets/{domain-settings-CNG0968P.js → domain-settings-DL4imbgg.js} +1 -1
  134. package/dist/client/assets/{drawer-CEiS53oX.js → drawer-CER6tItd.js} +1 -1
  135. package/dist/client/assets/{editor-DWhRi1_f.js → editor-DiFOLDbd.js} +1 -1
  136. package/dist/client/assets/{editor-classes-CZOMDDcn.js → editor-classes-BxczJlTk.js} +1 -1
  137. package/dist/client/assets/{empty-state-B1xpK558.js → empty-state-CEkcxXyE.js} +1 -1
  138. package/dist/client/assets/{empty-state-BoFIIv2e.js → empty-state-Cfwlgj7K.js} +1 -1
  139. package/dist/client/assets/experiments-tab-choice-CdB5dK1A.js +1 -0
  140. package/dist/client/assets/{extract-connection-data-CUvLfXNU.js → extract-connection-data-CnU07SX8.js} +1 -1
  141. package/dist/client/assets/{feature-gate-B9a4dBc0.js → feature-gate-Dnbny2HW.js} +1 -1
  142. package/dist/client/assets/{feature-paywall-DINMFUUx.js → feature-paywall-DruRkOvJ.js} +1 -1
  143. package/dist/client/assets/{file-explorer-2Z0Qhvp_.js → file-explorer-CsrTcKv1.js} +1 -1
  144. package/dist/client/assets/{file-preview-BFXgyqHl.js → file-preview-CUN1OHJ7.js} +1 -1
  145. package/dist/client/assets/{file-share-button-BIOHr9Xv.js → file-share-button-CEf0dwMj.js} +2 -2
  146. package/dist/client/assets/{file-type-icon-Ez8-DRHg.js → file-type-icon-etYEFstF.js} +1 -1
  147. package/dist/client/assets/{folder-icon-JgTmBbpC.js → folder-icon-8MGsFr-_.js} +2 -2
  148. package/dist/client/assets/{form-Bdh0vUeg.js → form-xTDgq-Tg.js} +1 -1
  149. package/dist/client/assets/{general-Dvy5SU0P.js → general-DKLM5WXB.js} +1 -1
  150. package/dist/client/assets/{home-UtAOwZ_a.js → home-iGYybPDR.js} +1 -1
  151. package/dist/client/assets/hosted-publish-api-BTYW-kmo.js +1 -0
  152. package/dist/client/assets/hosted-publish-feedback-DYVOaPsn.js +1 -0
  153. package/dist/client/assets/{icon-button-Dg2jSe-y.js → icon-button-Ht6P9npC.js} +1 -1
  154. package/dist/client/assets/{index-CrgWXxvo.js → index-1zZevs0I.js} +1 -1
  155. package/dist/client/assets/{index-1XeDvVO_.js → index-9equ5l6t.js} +1 -1
  156. package/dist/client/assets/{index-DxbCP5B6.js → index-B3yMIi0G.js} +1 -1
  157. package/dist/client/assets/index-BFqmRsAP.js +4 -0
  158. package/dist/client/assets/{index-DYLyKNcw.js → index-BbK9DXkK.js} +1 -1
  159. package/dist/client/assets/{index-DincrG3Y.js → index-Br0aaVqT.js} +3 -3
  160. package/dist/client/assets/{index-ILRCn1qM.js → index-CLvpgcGt.js} +6 -6
  161. package/dist/client/assets/{index-CXeJCI0G.js → index-CNohvsnC.js} +1 -1
  162. package/dist/client/assets/{index-_y92DzgS.js → index-D32uzOTA.js} +1 -1
  163. package/dist/client/assets/{index-7svLQYvL.js → index-DFJe-l7D.js} +1 -1
  164. package/dist/client/assets/{index-DKOhwHAG.js → index-DKwDh9fC.js} +1 -1
  165. package/dist/client/assets/{index-DcU2uHG-.js → index-DQaJBLJ-.js} +54 -54
  166. package/dist/client/assets/index-EoMx4WDO.css +1 -0
  167. package/dist/client/assets/{index-WjQsIrkp.js → index-IRwT0rOS.js} +1 -1
  168. package/dist/client/assets/{index-6B342dVL.js → index-TESbMzS4.js} +1 -1
  169. package/dist/client/assets/{index-De44zW_k.js → index-hUmTzopE.js} +1 -1
  170. package/dist/client/assets/{index-redirect-BHJ13xlS.js → index-redirect-WdHUcKlN.js} +1 -1
  171. package/dist/client/assets/{infiniteQueryObserver-P7ZNg4ZF.js → infiniteQueryObserver-Bia8aY1D.js} +1 -1
  172. package/dist/client/assets/infra-billing-CANL7vGd.js +1 -0
  173. package/dist/client/assets/{input-pg_Munw1.js → input-DQpuKkGH.js} +7 -7
  174. package/dist/client/assets/{input-HXHaYrka.js → input-rj9iyl8c.js} +1 -1
  175. package/dist/client/assets/{integration-icon-aeIvRSnw.js → integration-icon-BADY30E3.js} +1 -1
  176. package/dist/client/assets/{jira-icon-CZLCmGol.js → jira-icon-Bg6wm7Rh.js} +1 -1
  177. package/dist/client/assets/{label-DDPD5LQh.js → label-DwAqZKXh.js} +1 -1
  178. package/dist/client/assets/{layout-DGYUOV2D.js → layout-BS48rV-R.js} +1 -1
  179. package/dist/client/assets/{legacy-agents-deep-B3GKD6WQ.js → legacy-agents-deep-BsgIlRpK.js} +1 -1
  180. package/dist/client/assets/legacy-main-redirect-CpUMHeOI.js +1 -0
  181. package/dist/client/assets/library-D-XIUCN0.js +1 -0
  182. package/dist/client/assets/{login-syjpZA32.js → login-Bx_Dj1KX.js} +1 -1
  183. package/dist/client/assets/{markdown-1PeXOKNt.js → markdown-DCFmpcRh.js} +1 -1
  184. package/dist/client/assets/{mcp-app-renderer-DTPlWHGT.js → mcp-app-renderer-DlDykQO4.js} +1 -1
  185. package/dist/client/assets/{mcp-oauth-DP6VNnFQ.js → mcp-oauth-BV1FnXP9.js} +1 -1
  186. package/dist/client/assets/{mcp-oauth-xBzZujQ_.js → mcp-oauth-DHudAstl.js} +1 -1
  187. package/dist/client/assets/{members-uR8n9Rms.js → members-lS9QzMri.js} +1 -1
  188. package/dist/client/assets/{memory-BYqDBVHV.js → memory-Dt2VdoJi.js} +2 -2
  189. package/dist/client/assets/{mini-report-page-D7tpDtif.js → mini-report-page-SkCZ-B7b.js} +1 -1
  190. package/dist/client/assets/{mock-board-BOSDq94-.js → mock-board-b5JcXuBT.js} +3 -3
  191. package/dist/client/assets/{monaco-editor-e80GuCNv.js → monaco-editor-B77kgSL6.js} +2 -2
  192. package/dist/client/assets/monitoring-CN_CCaIK.js +1 -0
  193. package/dist/client/assets/{monitoring-stats-row-94Mta4Nq.js → monitoring-stats-row-DfhuiMFd.js} +1 -1
  194. package/dist/client/assets/{multi-select-CmbGOwtN.js → multi-select-BcTcaQtg.js} +1 -1
  195. package/dist/client/assets/mustache-B1PzKbLg.js +4 -0
  196. package/dist/client/assets/named-rule-uses-l2kNdc58.js +1 -0
  197. package/dist/client/assets/named-rule-view-VDvju2NZ.js +1 -0
  198. package/dist/client/assets/{new-project-dialog-ShudNZIG.js → new-project-dialog-C1yGAeBD.js} +1 -1
  199. package/dist/client/assets/{oauth-callback-ai-provider-DQtTsT-Q.js → oauth-callback-ai-provider-CSn2MVuO.js} +1 -1
  200. package/dist/client/assets/{oauth-callback-CuZCWVkp.js → oauth-callback-d5bTE61x.js} +1 -1
  201. package/dist/client/assets/{onboarding-BYvWDC_s.js → onboarding-DMAd7boI.js} +1 -1
  202. package/dist/client/assets/{openai-conversation-DgaJVito.js → openai-conversation-DVrrnMH9.js} +2 -2
  203. package/dist/client/assets/{optimistic-project-sidebar-views-CKzSSiC-.js → optimistic-project-sidebar-views-NiW-ZsA6.js} +1 -1
  204. package/dist/client/assets/order-monitor-day-D1J-iu59.js +1 -0
  205. package/dist/client/assets/{organization-choice-D_5aYbIz.js → organization-choice-DtzDl4nE.js} +1 -1
  206. package/dist/client/assets/{orgs-CN3Yh6bp.js → orgs-CvRk7OxE.js} +1 -1
  207. package/dist/client/assets/page-seo-form-YDVeWiAp.js +1 -0
  208. package/dist/client/assets/{pair-Cn70Tm81.js → pair-u6RslQ29.js} +7 -7
  209. package/dist/client/assets/parse-sections-CBNQNauq.js +1 -0
  210. package/dist/client/assets/plan-Cs9I3MbI.js +1 -0
  211. package/dist/client/assets/{plan-ladder-D5aCNSRy.js → plan-ladder-DF2W1fWC.js} +1 -1
  212. package/dist/client/assets/{popover-CVCbWisj.js → popover-BOhP5vgB.js} +1 -1
  213. package/dist/client/assets/post-calendar-T4dPJKYM.js +1 -0
  214. package/dist/client/assets/post-editor-D7KyvZ7t.js +2 -0
  215. package/dist/client/assets/{preview-content-Bin2hNFJ.js → preview-content-DVXm4Z8s.js} +1 -1
  216. package/dist/client/assets/{preview-dialog-Fls4giAH.js → preview-dialog-WEx44iRd.js} +1 -1
  217. package/dist/client/assets/{preview-panel-BPPH_1cI.js → preview-panel-D0nsWsZH.js} +1 -1
  218. package/dist/client/assets/preview-tab-Dl6aDnQL.js +551 -0
  219. package/dist/client/assets/product-picker-dialog-BhbqLRJa.js +1 -0
  220. package/dist/client/assets/{profile-BZA6I0p4.js → profile-DlCjy7UA.js} +1 -1
  221. package/dist/client/assets/{project-app-view-B2uzp3zO.js → project-app-view-D5kv8H-C.js} +1 -1
  222. package/dist/client/assets/project-apps-BkYCf7yh.js +1 -0
  223. package/dist/client/assets/{project-feed-CxXgvjMu.js → project-feed-CnSoTeWf.js} +1 -1
  224. package/dist/client/assets/{project-icon-Dy5ndHVf.js → project-icon-DeQ6esGK.js} +1 -1
  225. package/dist/client/assets/project-reports-DQYEQVTh.js +1 -0
  226. package/dist/client/assets/project-tasks-CyVxacvN.js +1 -0
  227. package/dist/client/assets/{projects-6tFWscR3.js → projects-B8yQNAzt.js} +1 -1
  228. package/dist/client/assets/{projects-empty-state-B25sfM8y.js → projects-empty-state-BeIkadaG.js} +1 -1
  229. package/dist/client/assets/{prompts-C8y9cYvX.js → prompts-GMn4cz1Q.js} +1 -1
  230. package/dist/client/assets/record-editor-CI7K6OM1.js +1 -0
  231. package/dist/client/assets/redirect-editor-B5L_G5_H.js +1 -0
  232. package/dist/client/assets/releases-api-r2wwTMcb.js +1 -0
  233. package/dist/client/assets/{reports-DZf5GwgJ.js → reports-BSyJkGbx.js} +1 -1
  234. package/dist/client/assets/reports-DceQf3hD.js +1 -0
  235. package/dist/client/assets/{reports-onboarding-Ba6c9nYx.js → reports-onboarding-DTyYEPnh.js} +1 -1
  236. package/dist/client/assets/reports-tab-DhZyGBNJ.js +2 -0
  237. package/dist/client/assets/repositories-1ckAW2Cr.js +1 -0
  238. package/dist/client/assets/{repositories-D_HBag21.js → repositories-DTzcHO2P.js} +1 -1
  239. package/dist/client/assets/{repository-binding-B-JblZ3B.js → repository-binding-WIxmR2C2.js} +1 -1
  240. package/dist/client/assets/{repository-import-picker-Aq7ItYog.js → repository-import-picker-Bwaz_IkW.js} +1 -1
  241. package/dist/client/assets/{repository-picker-CigkRPj6.js → repository-picker-C_FPAS2a.js} +1 -1
  242. package/dist/client/assets/{require-capability-fF33BjRE.js → require-capability-zDRexzvJ.js} +1 -1
  243. package/dist/client/assets/{required-auth-layout-n4GqwjUS.js → required-auth-layout-C9RNRyLG.js} +1 -1
  244. package/dist/client/assets/{reset-password-FYcr_EOZ.js → reset-password-D5Z9Z_ZV.js} +1 -1
  245. package/dist/client/assets/{resizable-B1jyEV0m.js → resizable-rv6DYDSR.js} +1 -1
  246. package/dist/client/assets/resolve-tab-icon-CDRcFoik.js +1 -0
  247. package/dist/client/assets/{review-settings-w0gSi3zN.js → review-settings-BOEOAp5O.js} +1 -1
  248. package/dist/client/assets/{roles-CD7KBus5.js → roles-CvRMacB_.js} +1 -1
  249. package/dist/client/assets/route-BrdNU9FL.js +1 -0
  250. package/dist/client/assets/route-CYnJcvFb.js +1 -0
  251. package/dist/client/assets/route-HQBi1e9d.js +1 -0
  252. package/dist/client/assets/runnable-block-editor-B9jSPnPq.js +20 -0
  253. package/dist/client/assets/{sandbox-git-api-CRxdlhrN.js → sandbox-git-api-CH_-QFpD.js} +1 -1
  254. package/dist/client/assets/{sandbox-lifecycle-context-Cyz-VR-q.js → sandbox-lifecycle-context-aKdVFwPA.js} +1 -1
  255. package/dist/client/assets/{schema-DTqdooJM.js → schema-C0M6s76A.js} +1 -1
  256. package/dist/client/assets/{schema-Jt-SHSRj.js → schema-CtKRQiER.js} +1 -1
  257. package/dist/client/assets/{scroll-area-DowOzl5a.js → scroll-area-L8VlxVDv.js} +1 -1
  258. package/dist/client/assets/{search-input-C77c23a_.js → search-input-BCaqzpfC.js} +1 -1
  259. package/dist/client/assets/{search-toggle-BqUvwbnO.js → search-toggle-BAKgZCht.js} +1 -1
  260. package/dist/client/assets/{secret-picker-D6q2PbZG.js → secret-picker-Ciz2Oc6M.js} +1 -1
  261. package/dist/client/assets/{secrets-C6FiSzJz.js → secrets-DWM0UMVi.js} +1 -1
  262. package/dist/client/assets/{sections-uFSvOb1s.js → sections-DM2-ez5A.js} +1 -1
  263. package/dist/client/assets/sections-editor-Cs3VV_t6.js +4 -0
  264. package/dist/client/assets/{select-B47VUguS.js → select-3Bvf55R2.js} +1 -1
  265. package/dist/client/assets/{select-model-B0eE99E3.js → select-model-BrppT0xN.js} +1 -1
  266. package/dist/client/assets/seo-editor-qr_EWKDI.js +1 -0
  267. package/dist/client/assets/{separator-tMi_6w_o.js → separator-BARWlQZQ.js} +1 -1
  268. package/dist/client/assets/settings-tab-BX9Vfre3.js +1 -0
  269. package/dist/client/assets/{sheet-R9Pr50Sb.js → sheet-BKZqYlDG.js} +1 -1
  270. package/dist/client/assets/shell-layout-iu5E7VAW.js +1 -0
  271. package/dist/client/assets/site-draft-actions-01MQ6c7Q.js +12 -0
  272. package/dist/client/assets/site-draft-view-D-xycIA0.js +2 -0
  273. package/dist/client/assets/site-editor-CF4F4ijZ.js +1 -0
  274. package/dist/client/assets/{skills-DTPuV4HK.js → skills-B3sr04ZB.js} +1 -1
  275. package/dist/client/assets/slider-f1cHo-xI.js +1 -0
  276. package/dist/client/assets/{sortable.esm-7lfZBBX2.js → sortable.esm-B_g_IXou.js} +1 -1
  277. package/dist/client/assets/{sso-lvoln_ad.js → sso-8XgQMaoN.js} +1 -1
  278. package/dist/client/assets/{suggestion-D_Z3LuMt.js → suggestion-B-6wzPND.js} +2 -2
  279. package/dist/client/assets/{switch-BQFbXMA-.js → switch-CZd0EYW9.js} +1 -1
  280. package/dist/client/assets/{symbol-CIh5AfyD.js → symbol-BY53tx69.js} +1 -1
  281. package/dist/client/assets/{synced-repos-DQxi8k5O.js → synced-repos-CWNIOZxK.js} +1 -1
  282. package/dist/client/assets/{tab-icon-glyph-B2rDBqdy.js → tab-icon-glyph-40t6GZmc.js} +1 -1
  283. package/dist/client/assets/{table-DuCeyVXY.js → table-DDQzGcYG.js} +1 -1
  284. package/dist/client/assets/{tabs-CJ70csAp.js → tabs-BOwO3aPj.js} +1 -1
  285. package/dist/client/assets/{task-assignee-avatar-vyXzgPAK.js → task-assignee-avatar-mmHhkk0_.js} +1 -1
  286. package/dist/client/assets/{task-board-CSpxMIw7.js → task-board-S0qduW2n.js} +1 -1
  287. package/dist/client/assets/{task-route-CeJ19bNy.js → task-route-BCl-VxJy.js} +1 -1
  288. package/dist/client/assets/{task-status-CFz3dyVR.js → task-status-CNAd19KA.js} +1 -1
  289. package/dist/client/assets/{taskboard-analytics-CfseXo9_.js → taskboard-analytics-BNfa4eCu.js} +1 -1
  290. package/dist/client/assets/tasks-CtYqrb00.js +1 -0
  291. package/dist/client/assets/{tasks-C3liOhO2.js → tasks-Cz1AP9M-.js} +3 -3
  292. package/dist/client/assets/{textarea-BDWvYouR.js → textarea-CGkc_NoY.js} +1 -1
  293. package/dist/client/assets/{thread-analytics-Bp5Zz9ej.js → thread-analytics-CHcQ4J9G.js} +1 -1
  294. package/dist/client/assets/{thread-intent-DlbBEzNn.js → thread-intent-D02hOLlA.js} +4 -4
  295. package/dist/client/assets/{thread-route-DsRsjMOv.js → thread-route-BG5FYdPA.js} +1 -1
  296. package/dist/client/assets/{thread-route-glK7AgQo.js → thread-route-D5TPqP61.js} +1 -1
  297. package/dist/client/assets/{thread-sheet-body-BW8H1wdb.js → thread-sheet-body-B1Y2cEvJ.js} +1 -1
  298. package/dist/client/assets/time-range-picker-B8MLDnPR.js +1 -0
  299. package/dist/client/assets/toggle-group-5-dW1fE5.js +1 -0
  300. package/dist/client/assets/{tool-namespace-FeAXQzXg.js → tool-namespace-_uAlvwp8.js} +1 -1
  301. package/dist/client/assets/{toolbar-icon-button-CTGjpqPD.js → toolbar-icon-button-BQvi-WW6.js} +1 -1
  302. package/dist/client/assets/{tooltip-BqHx2R4U.js → tooltip-CT8p-4e_.js} +1 -1
  303. package/dist/client/assets/tooltipContext-BqyDyVHC.js +1 -0
  304. package/dist/client/assets/{track-vnmuUrPF.js → track-wHia_J2E.js} +1 -1
  305. package/dist/client/assets/{types-Cj3BjtjJ.js → types-CKfFy-n_.js} +6 -6
  306. package/dist/client/assets/{url-slug-DfovzTSP.js → url-slug-BMSyCRIK.js} +1 -1
  307. package/dist/client/assets/{usage-stats-DcyLnEOC.js → usage-stats-tSDvCF_c.js} +1 -1
  308. package/dist/client/assets/{use-ai-providers-DugUJNG4.js → use-ai-providers-D5-3qHgJ.js} +1 -1
  309. package/dist/client/assets/use-apply-named-rule-BuleRH2R.js +1 -0
  310. package/dist/client/assets/{use-automations-Dhy5bAQi.js → use-automations-DL7E2sXy.js} +1 -1
  311. package/dist/client/assets/{use-autosave-BKifxWxQ.js → use-autosave-Bga6Lczj.js} +1 -1
  312. package/dist/client/assets/{use-chat-layout-state-CqPKeLYn.js → use-chat-layout-state-CrK3t-li.js} +1 -1
  313. package/dist/client/assets/{use-clock-tick-CbuQEbGd.js → use-clock-tick-Dt0Rxdj9.js} +1 -1
  314. package/dist/client/assets/{use-connect-companion-BBUs22Yl.js → use-connect-companion-BQ6P9NqQ.js} +1 -1
  315. package/dist/client/assets/{use-connection-Dj54skEw.js → use-connection-DEU6cL_M.js} +1 -1
  316. package/dist/client/assets/use-content-sync-78T7URzs.js +1 -0
  317. package/dist/client/assets/{use-copy-K9rQ1PJH.js → use-copy-Lp25RdQW.js} +1 -1
  318. package/dist/client/assets/use-create-virtual-mcp-B5688LVi.js +1 -0
  319. package/dist/client/assets/{use-date-fns-locale-CEVf4Ifn.js → use-date-fns-locale-DzYqNQVc.js} +1 -1
  320. package/dist/client/assets/{use-debounced-autosave-D0TGgFvB.js → use-debounced-autosave-B-FheggT.js} +1 -1
  321. package/dist/client/assets/{use-debounced-value-CDunmz6Z.js → use-debounced-value-DnWAg7xS.js} +1 -1
  322. package/dist/client/assets/{use-deco-credits-orVqTX6I.js → use-deco-credits-Dcf7REFq.js} +1 -1
  323. package/dist/client/assets/{use-decopilot-events-TumByBkr.js → use-decopilot-events-HymesIOH.js} +1 -1
  324. package/dist/client/assets/{use-delete-connection-BllZSjRL.js → use-delete-connection-GE6V1LSr.js} +1 -1
  325. package/dist/client/assets/{use-deployment-admin-BBVz6SL_.js → use-deployment-admin-BMcEtHAq.js} +1 -1
  326. package/dist/client/assets/use-fast-preview-draft-url-CCAgHiPb.js +1 -0
  327. package/dist/client/assets/{use-file-configs-BFq_wpSt.js → use-file-configs-C3GELqZ9.js} +1 -1
  328. package/dist/client/assets/{use-inbox-feed--WBiu__i.js → use-inbox-feed-60_eEWEx.js} +1 -1
  329. package/dist/client/assets/{use-infinite-scroll-7dT9x3fg.js → use-infinite-scroll-CktyBb0n.js} +1 -1
  330. package/dist/client/assets/{use-join-requests-ilYuD6XT.js → use-join-requests-Daf7hgc3.js} +1 -1
  331. package/dist/client/assets/use-main-panel-tabs-zwxUbRsW.js +1 -0
  332. package/dist/client/assets/{use-mcp-auth-status-2A9iou5g.js → use-mcp-auth-status-Ckh_s_m-.js} +1 -1
  333. package/dist/client/assets/use-mcp-client-BjCYOtMv.js +10 -0
  334. package/dist/client/assets/{use-mcp-prompts-JJb6q8dH.js → use-mcp-prompts-D4ntfVw2.js} +1 -1
  335. package/dist/client/assets/{use-mcp-tools-BwuN38Gh.js → use-mcp-tools-BQ-vDoB-.js} +1 -1
  336. package/dist/client/assets/{use-members-CzSQTDAS.js → use-members-BKwSn6l-.js} +1 -1
  337. package/dist/client/assets/{use-mobile-BfmJV4wy.js → use-mobile-exvgjs5E.js} +1 -1
  338. package/dist/client/assets/use-move-blocks-jGxZ60KS.js +1 -0
  339. package/dist/client/assets/{use-navigate-to-agent-D05JNc-L.js → use-navigate-to-agent-CoDY7b67.js} +1 -1
  340. package/dist/client/assets/{use-open-billing-url-pmLoKOyH.js → use-open-billing-url-gwWm2_gZ.js} +1 -1
  341. package/dist/client/assets/{use-org-auth-client-fPRUht_a.js → use-org-auth-client-D2nGERnL.js} +1 -1
  342. package/dist/client/assets/{use-org-fs-D82Vx4hB.js → use-org-fs-DsXUzUGl.js} +1 -1
  343. package/dist/client/assets/{use-org-repo-syncs-CD8TZnkH.js → use-org-repo-syncs-DTcvfXwj.js} +1 -1
  344. package/dist/client/assets/{use-org-sso-ClJ8vn5f.js → use-org-sso-BmpgR8iH.js} +1 -1
  345. package/dist/client/assets/{use-organization-roles-iaQivkLI.js → use-organization-roles-C9fRnsAm.js} +1 -1
  346. package/dist/client/assets/{use-organization-settings-DFkNTsS0.js → use-organization-settings-B5bwnmIE.js} +1 -1
  347. package/dist/client/assets/use-panel-navigate-D1HcWbMf.js +1 -0
  348. package/dist/client/assets/use-project-native-view-presence-WBIVN5MA.js +1 -0
  349. package/dist/client/assets/{use-project-scope-CGMALc0e.js → use-project-scope-0viRZIAS.js} +1 -1
  350. package/dist/client/assets/{use-recent-apps-C1945uiL.js → use-recent-apps-letFJ0RI.js} +1 -1
  351. package/dist/client/assets/{use-releases-D15mHXXN.js → use-releases-BzfYz1da.js} +1 -1
  352. package/dist/client/assets/{use-reports-diagnostic-BdbGTuns.js → use-reports-diagnostic-D4yF4iuL.js} +1 -1
  353. package/dist/client/assets/{use-secrets-DbkATagb.js → use-secrets-DS9zWxiz.js} +1 -1
  354. package/dist/client/assets/use-section-preview-base-H9VNpzGF.js +1 -0
  355. package/dist/client/assets/{use-sidebar-collapsed-BqLmDXCH.js → use-sidebar-collapsed-hUfsznLr.js} +1 -1
  356. package/dist/client/assets/{use-tags-Cn5U7HDa.js → use-tags-CVvzIGGr.js} +1 -1
  357. package/dist/client/assets/{use-task-board-analytics-CftsNPjL.js → use-task-board-analytics-BgxWC82w.js} +1 -1
  358. package/dist/client/assets/{use-task-board-events-BDk-u9KA.js → use-task-board-events-DBz1fm-T.js} +1 -1
  359. package/dist/client/assets/{use-task-board-item-prs-CNMGpOwt.js → use-task-board-item-prs-D2PBN926.js} +1 -1
  360. package/dist/client/assets/{use-task-metadata-0ueqwOxI.js → use-task-metadata-1k4pU8z_.js} +1 -1
  361. package/dist/client/assets/{use-thread-analytics-CgQGRl3S.js → use-thread-analytics-D40j8ndA.js} +1 -1
  362. package/dist/client/assets/{use-thread-outputs-DLitie4Q.js → use-thread-outputs-2XKKA9Gw.js} +1 -1
  363. package/dist/client/assets/useInfiniteQuery-v90E8EIL.js +1 -0
  364. package/dist/client/assets/{useQueries-BfkCTicr.js → useQueries-DT3VE95i.js} +1 -1
  365. package/dist/client/assets/useSuspenseInfiniteQuery-BoCx0vyL.js +1 -0
  366. package/dist/client/assets/{users-BIkPJzOg.js → users-GpxLvhWl.js} +1 -1
  367. package/dist/client/assets/{utils-Bp3fKbm9.js → utils-CkO9KdKe.js} +2 -2
  368. package/dist/client/assets/variant-calendar-CrETYYc9.js +1 -0
  369. package/dist/client/assets/variant-draft-pointer-jrxTxtyS.js +1 -0
  370. package/dist/client/assets/virtual-mcp-DHPQGUgu.js +1 -0
  371. package/dist/client/assets/{watch-sse-pool-CrLAsZHh.js → watch-sse-pool-Dc_r60nv.js} +1 -1
  372. package/dist/client/index.html +2 -2
  373. package/dist/server/server.js +684 -684
  374. package/package.json +1 -1
  375. package/dist/client/assets/ActiveShapeUtils-CDpScllU.js +0 -1
  376. package/dist/client/assets/AreaChart-Du66qHXY.js +0 -1
  377. package/dist/client/assets/BarChart-BXz-bUtC.js +0 -1
  378. package/dist/client/assets/CartesianChart-BZmgsxge.js +0 -1
  379. package/dist/client/assets/ReferenceLine-BPq2MnBR.js +0 -1
  380. package/dist/client/assets/Sector-BraX9V6h.js +0 -28
  381. package/dist/client/assets/agent-analytics-Biob4Jvo.js +0 -2
  382. package/dist/client/assets/agent-app-DTwyyqho.js +0 -1
  383. package/dist/client/assets/agent-assets-DpuZ7qUq.js +0 -1
  384. package/dist/client/assets/agent-automations-CHJpber1.js +0 -1
  385. package/dist/client/assets/agent-deck-DRCJIHES.js +0 -1
  386. package/dist/client/assets/agent-e2e-rlzvrptO.js +0 -1
  387. package/dist/client/assets/agent-experiments-BzSUejrS.js +0 -1
  388. package/dist/client/assets/agent-file-pM3fkLSV.js +0 -1
  389. package/dist/client/assets/agent-hosting-CIblOaW0.js +0 -1
  390. package/dist/client/assets/agent-library-BF5T38g7.js +0 -1
  391. package/dist/client/assets/agent-library-file-BTDXrKvZ.js +0 -1
  392. package/dist/client/assets/agent-monitor-CMU4bHqc.js +0 -1
  393. package/dist/client/assets/agent-releases-CEAPMdCY.js +0 -2
  394. package/dist/client/assets/agent-settings-9voN143W.js +0 -1
  395. package/dist/client/assets/agent-site-editor-WHTbnkdB.js +0 -27
  396. package/dist/client/assets/agent-site-editor-code-DxTJ31bR.js +0 -2
  397. package/dist/client/assets/agent-site-editor-content-B8OXp1G1.js +0 -1
  398. package/dist/client/assets/agent-site-editor-preview-Bu7A4U4r.js +0 -1
  399. package/dist/client/assets/agent-view-DW3bjKRU.js +0 -1
  400. package/dist/client/assets/alert-J8Wo4iMe.js +0 -1
  401. package/dist/client/assets/analytics-sections-Crtm-SOa.js +0 -1
  402. package/dist/client/assets/api-keys-DPclIgvr.js +0 -1
  403. package/dist/client/assets/app-editor-CWO6RLKf.js +0 -1
  404. package/dist/client/assets/automation-list-row-CO-7cr0O.js +0 -1
  405. package/dist/client/assets/badge-ByzdbptS.js +0 -1
  406. package/dist/client/assets/blocks-tab-states-diUqUrAK.js +0 -20
  407. package/dist/client/assets/blog-schema-pXyj_uKN.js +0 -1
  408. package/dist/client/assets/category-editor-16fFMZmU.js +0 -1
  409. package/dist/client/assets/cms-settings-editor-Cowvog2q.js +0 -1
  410. package/dist/client/assets/collection-detail-BVMX_w00.js +0 -1
  411. package/dist/client/assets/content-tab-CTbbT9Kp.js +0 -22
  412. package/dist/client/assets/context-DwXA-O6V.js +0 -1
  413. package/dist/client/assets/hosted-publish-feedback-NabikYNC.js +0 -1
  414. package/dist/client/assets/index-BqS2UmN9.css +0 -1
  415. package/dist/client/assets/index-CxtzBp5_.js +0 -4
  416. package/dist/client/assets/infra-billing-kRHrP-RL.js +0 -1
  417. package/dist/client/assets/legacy-main-redirect-BdnJuiDi.js +0 -1
  418. package/dist/client/assets/library-DYD_N6_K.js +0 -1
  419. package/dist/client/assets/monitoring-CgqK6OeU.js +0 -1
  420. package/dist/client/assets/mustache-Aw4qvxEW.js +0 -4
  421. package/dist/client/assets/order-monitor-day-CIHUt3pK.js +0 -1
  422. package/dist/client/assets/page-seo-form-CnjlIIXj.js +0 -1
  423. package/dist/client/assets/plan-ByMMI8KU.js +0 -1
  424. package/dist/client/assets/post-calendar-Dq_uFQwi.js +0 -1
  425. package/dist/client/assets/post-editor-DPLEIDHY.js +0 -2
  426. package/dist/client/assets/preview-tab-BHT_7Qja.js +0 -551
  427. package/dist/client/assets/product-picker-dialog-p0Ic9l9I.js +0 -1
  428. package/dist/client/assets/project-apps-v-sauknl.js +0 -1
  429. package/dist/client/assets/project-reports-CZJuTnYB.js +0 -1
  430. package/dist/client/assets/project-tasks-CGicoIeY.js +0 -1
  431. package/dist/client/assets/record-editor-Bh04Pm0_.js +0 -1
  432. package/dist/client/assets/redirect-editor-DQhKbdsA.js +0 -1
  433. package/dist/client/assets/reports-BupQ5Xhd.js +0 -1
  434. package/dist/client/assets/reports-tab-aEhqa7te.js +0 -2
  435. package/dist/client/assets/repositories-CEC-SgTJ.js +0 -1
  436. package/dist/client/assets/resolve-tab-icon-DtNff2Yq.js +0 -1
  437. package/dist/client/assets/route-Co7AkL50.js +0 -1
  438. package/dist/client/assets/route-D9eWdPea.js +0 -1
  439. package/dist/client/assets/route-P4X0mipC.js +0 -1
  440. package/dist/client/assets/secret-ciphertext-CI3Fu2ro.js +0 -1
  441. package/dist/client/assets/sections-editor-BgMrH8fq.js +0 -4
  442. package/dist/client/assets/seo-editor-C-YMij5b.js +0 -1
  443. package/dist/client/assets/settings-tab-Cp5pryb2.js +0 -1
  444. package/dist/client/assets/shell-layout-DNfiem0_.js +0 -1
  445. package/dist/client/assets/site-editor-Dsm_SPF7.js +0 -1
  446. package/dist/client/assets/site-editor-toast-L4A-Cxh7.js +0 -1
  447. package/dist/client/assets/slider-B9iKqweT.js +0 -1
  448. package/dist/client/assets/tasks-DrfrXIxf.js +0 -1
  449. package/dist/client/assets/time-range-picker-Dm5YljWh.js +0 -1
  450. package/dist/client/assets/toggle-group-CtPF-F41.js +0 -1
  451. package/dist/client/assets/tooltipContext-DFq6ns9J.js +0 -1
  452. package/dist/client/assets/use-content-sync-D4PHTEJr.js +0 -1
  453. package/dist/client/assets/use-create-virtual-mcp-C4gtrY2f.js +0 -1
  454. package/dist/client/assets/use-fast-preview-draft-url-6p2QJIdt.js +0 -1
  455. package/dist/client/assets/use-main-panel-tabs-kHysLFoZ.js +0 -1
  456. package/dist/client/assets/use-main-schema-v8-Dcb6Yskn.js +0 -1
  457. package/dist/client/assets/use-mcp-client-ZokR8_74.js +0 -10
  458. package/dist/client/assets/use-panel-navigate-K8ACrPML.js +0 -1
  459. package/dist/client/assets/use-project-native-view-presence-DJiBua9F.js +0 -1
  460. package/dist/client/assets/use-section-preview-base-De54Y3vh.js +0 -1
  461. package/dist/client/assets/useInfiniteQuery-B7za82zu.js +0 -1
  462. package/dist/client/assets/useSuspenseInfiniteQuery-B0JY_wMj.js +0 -1
  463. package/dist/client/assets/variant-calendar-BIblXEHb.js +0 -1
  464. package/dist/client/assets/variant-draft-pointer-fs9iIwvq.js +0 -1
  465. package/dist/client/assets/virtual-mcp-CeCtCq_o.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as $,b as j,r as E,j as b,l as q,af as Tt,t as ue,aY as Xe,a2 as vt,m as At,K as Mt,b5 as St,h as Ye}from"./index-DcU2uHG-.js";import{a as Ct,n as Je,E as ie,o as Rt,x as Et,y as P,z as $t,A as _t,B as et,C as N,G as Ee,H as Lt,I as It,J as $e,K as zt,L as V,N as D,m as H,O as J,T as tt,R as ke,Q as xe,U as Pt,V as Ht,W as jt,X as Nt,Y as Ot,s as Bt,Z as Dt,u as Ft,b as qt}from"./usage-stats-DcyLnEOC.js";import{T as _,n as Wt,i as Ut,E as Gt}from"./editor-classes-CZOMDDcn.js";import{a as Zt,e as nt,s as Vt,S as Kt}from"./suggestion-D_Z3LuMt.js";import{B as Qt,c as Xt,t as Yt,C as rt,f as Jt,g as _e,s as en,m as Le,a as Ie,b as tn,d as ze,e as nn,h as rn,i as sn,j as an,k as on,l as ln,n as cn}from"./index-6B342dVL.js";import{ak as un,al as hn,an as dn,a1 as pn,be as fn,aW as gn}from"./agent-icon-c0hRUHIU.js";import{i as mn}from"./SwitchHorizontal01-CESO3nxl.js";import{i as kn}from"./Link01-DRsKyIm5.js";import{s as xn}from"./Trash01-Cf6bGuCZ.js";import{i as bn,b as wn}from"./use-org-fs-D82Vx4hB.js";import{E as Pe,i as st,b as yn,c as Tn,A as vn,d as An,m as Mn,e as Sn,f as Cn}from"./markdown-1PeXOKNt.js";import{A as Rn}from"./avatar-CVrfZDpI.js";import{d as En,e as $n,c as _n,C as Ln,b as In}from"./command-DQxPvzO0.js";import{u as zn}from"./use-org-auth-client-fPRUht_a.js";import{I as Pn}from"./icon-button-Dg2jSe-y.js";function Hn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,u]=E.useState(!1);let c;e[0]!==n?(c=n.isActive("link"),e[0]=n,e[1]=c):c=e[1];const h=c;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),u(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=Wt(a);if(M===""){g();return}if(!Ut(M)){u(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=b.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=b.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let x;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(x=s&&b.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md bg-popover p-1 shadow-soft",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[b.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),u(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:q("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),b.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:b.jsx(Tt,{size:14})}),h&&b.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:b.jsx(xn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=x):x=e[26];let v;return e[27]!==T||e[28]!==x?(v=b.jsxs("div",{className:"relative",children:[T,x]}),e[27]=T,e[28]=x,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=b.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},He=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=b.jsx("span",{className:"text-2xs font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],jn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function Nn(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:On},e[0]=n,e[1]=a):a=e[1];const l=Ct(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let u;e[4]!==r?(u=r("markdownEditor.heading2"),e[4]=r,e[5]=u):u=e[5];let c;e[6]!==r?(c=r("markdownEditor.heading3"),e[6]=r,e[7]=c):c=e[7];let h;e[8]!==o||e[9]!==u||e[10]!==c?(h={1:o,2:u,3:c},e[8]=o,e[9]=u,e[10]=c,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&b.jsxs(Qt,{editor:n,shouldShow:jn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg bg-popover p-1 shadow-soft","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[b.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:b.jsx(un,{size:14})}),b.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:b.jsx(hn,{size:14})}),b.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:b.jsx(dn,{size:14})}),b.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:b.jsx(pn,{size:14})}),b.jsx(le,{}),it.map((g,m)=>b.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:b.jsx(He,{children:`H${g}`})},g)),b.jsx(le,{}),b.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:b.jsx(mn,{size:14})}),b.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:b.jsx(He,{children:"1."})}),b.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:b.jsx(fn,{size:14})}),b.jsx(le,{}),b.jsx(Hn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=b.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function On(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Bn=10,Dn=25,Fn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function qn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??Fn[t.type]??""}function Wn(){const t=$.c(4),e=j(),{upload:n}=bn(Pe),r=wn(Pe);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=st(a),o=l?Bn:Dn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const u=l?yn:Tn,c=`${crypto.randomUUID()}${qn(a)}`;try{return await n.mutateAsync({dir:u,files:[new File([a],c,{type:a.type})]}),r(`${u}/${c}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Je("uploadSlots"),Un=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Rt({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Gn(t,e){return ee.getState(t)?.get(e)}function Zn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,u=t.state.doc.resolve(e),c=u.parent.textBetween(Math.max(0,u.parentOffset-1),u.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...c&&!/\s/.test(c)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,x,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,x)=>{T===l&&(m=x+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Et.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Kn(t=!0){const e=j(),{uploadFile:n}=Wn(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=st(g);Zn(h,Gn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function be(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=be();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Qn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Xn=/^(?:[ \t]*(?:\n|$))+/,Yn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,K=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,er=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sr=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ir=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),ar=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:ar,code:Yn,def:rr,fences:Jn,heading:er,hr:K,html:ir,lheading:lt,list:sr,newline:Xn,paragraph:ct,table:O,text:nr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or={...Ae,lheading:tr,table:je,paragraph:A(ye).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},lr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",K).replace("heading",` *#{1,6} *[^
1
+ import{c as $,b as j,r as E,j as b,l as q,af as Tt,t as ue,aU as Xe,a2 as vt,m as At,K as Mt,b2 as St,h as Je}from"./index-DQaJBLJ-.js";import{a as Ct,n as Ye,E as ie,o as Rt,x as Et,y as P,z as $t,A as _t,B as et,C as N,G as Ee,H as Lt,I as It,J as $e,K as zt,L as V,N as D,m as H,O as Y,T as tt,R as ke,Q as xe,U as Pt,V as Ht,W as jt,X as Nt,Y as Ot,s as Bt,Z as Dt,u as Ft,b as qt}from"./usage-stats-tSDvCF_c.js";import{T as _,n as Wt,i as Ut,E as Gt}from"./editor-classes-BxczJlTk.js";import{a as Zt,e as nt,s as Vt,S as Kt}from"./suggestion-B-6wzPND.js";import{B as Qt,c as Xt,t as Jt,C as rt,f as Yt,g as _e,s as en,m as Le,a as Ie,b as tn,d as ze,e as nn,h as rn,i as sn,j as an,k as on,l as ln,n as cn}from"./index-TESbMzS4.js";import{ai as un,aj as hn,al as dn,a0 as pn,be as fn,aW as gn}from"./agent-icon-BLy2WH4s.js";import{i as mn}from"./SwitchHorizontal01-BLJAU7vB.js";import{i as kn}from"./Link01-DU3-3Ipb.js";import{s as xn}from"./Trash01-y0tx6OKR.js";import{i as bn,b as wn}from"./use-org-fs-DsXUzUGl.js";import{E as Pe,i as st,b as yn,c as Tn,A as vn,d as An,m as Mn,e as Sn,f as Cn}from"./markdown-DCFmpcRh.js";import{A as Rn}from"./avatar-BaUatl4r.js";import{d as En,e as $n,c as _n,C as Ln,b as In}from"./command-DF9CyXTP.js";import{u as zn}from"./use-org-auth-client-D2nGERnL.js";import{I as Pn}from"./icon-button-Ht6P9npC.js";function Hn(t){const e=$.c(30),{editor:n}=t,r=j(),[s,i]=E.useState(!1),[a,l]=E.useState(""),[o,u]=E.useState(!1);let c;e[0]!==n?(c=n.isActive("link"),e[0]=n,e[1]=c):c=e[1];const h=c;let d;e[2]!==n||e[3]!==s?(d=()=>{if(s){i(!1);return}const M=n.getAttributes("link").href;l(typeof M=="string"?M:""),u(!1),i(!0)},e[2]=n,e[3]=s,e[4]=d):d=e[4];const f=d;let p;e[5]!==n?(p=()=>{n.chain().focus().extendMarkRange("link").unsetLink().run(),i(!1)},e[5]=n,e[6]=p):p=e[6];const g=p;let m;e[7]!==a||e[8]!==n||e[9]!==g?(m=()=>{const M=Wt(a);if(M===""){g();return}if(!Ut(M)){u(!0);return}n.chain().focus().extendMarkRange("link").setLink({href:M}).run(),i(!1)},e[7]=a,e[8]=n,e[9]=g,e[10]=m):m=e[10];const k=m;let w;e[11]!==r?(w=r("markdownEditor.link"),e[11]=r,e[12]=w):w=e[12];let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=b.jsx(kn,{size:14}),e[13]=y):y=e[13];let T;e[14]!==h||e[15]!==w||e[16]!==f?(T=b.jsx(_,{active:h,label:w,onClick:f,children:y}),e[14]=h,e[15]=w,e[16]=f,e[17]=T):T=e[17];let x;e[18]!==h||e[19]!==k||e[20]!==a||e[21]!==n||e[22]!==o||e[23]!==s||e[24]!==g||e[25]!==r?(x=s&&b.jsxs("div",{className:"absolute left-0 top-full z-20 mt-1.5 flex w-64 items-center gap-0.5 rounded-md bg-popover p-1 shadow-soft",onBlur:M=>{M.currentTarget.contains(M.relatedTarget)||i(!1)},children:[b.jsx("input",{autoFocus:!0,type:"text","aria-label":r("markdownEditor.linkInputAriaLabel"),"aria-invalid":o,placeholder:r("markdownEditor.linkPlaceholder"),value:a,onChange:M=>{l(M.target.value),u(!1)},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),k()):M.key==="Escape"&&(M.preventDefault(),i(!1),n.chain().focus().run())},className:q("h-7 min-w-0 flex-1 rounded bg-transparent px-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",o&&"text-destructive")}),b.jsx(_,{active:!1,label:r("markdownEditor.linkApply"),onClick:k,children:b.jsx(Tt,{size:14})}),h&&b.jsx(_,{active:!1,label:r("markdownEditor.linkRemove"),onClick:g,children:b.jsx(xn,{size:14})})]}),e[18]=h,e[19]=k,e[20]=a,e[21]=n,e[22]=o,e[23]=s,e[24]=g,e[25]=r,e[26]=x):x=e[26];let v;return e[27]!==T||e[28]!==x?(v=b.jsxs("div",{className:"relative",children:[T,x]}),e[27]=T,e[28]=x,e[29]=v):v=e[29],v}const le=()=>{const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=b.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),t[0]=e):e=t[0],e},He=t=>{const e=$.c(2),{children:n}=t;let r;return e[0]!==n?(r=b.jsx("span",{className:"text-2xs font-semibold leading-none",children:n}),e[0]=n,e[1]=r):r=e[1],r},it=[1,2,3],jn=({editor:t,state:e})=>t.isEditable&&!e.selection.empty&&!t.isActive("image")&&!t.isActive("attachment")&&!t.isActive("codeBlock");function Nn(t){const e=$.c(20),{editor:n}=t,r=j(),[s,i]=E.useState(null);let a;e[0]!==n?(a={editor:n,selector:On},e[0]=n,e[1]=a):a=e[1];const l=Ct(a);let o;e[2]!==r?(o=r("markdownEditor.heading1"),e[2]=r,e[3]=o):o=e[3];let u;e[4]!==r?(u=r("markdownEditor.heading2"),e[4]=r,e[5]=u):u=e[5];let c;e[6]!==r?(c=r("markdownEditor.heading3"),e[6]=r,e[7]=c):c=e[7];let h;e[8]!==o||e[9]!==u||e[10]!==c?(h={1:o,2:u,3:c},e[8]=o,e[9]=u,e[10]=c,e[11]=h):h=e[11];const d=h;let f;e[12]!==n||e[13]!==d||e[14]!==s||e[15]!==l||e[16]!==r?(f=s&&b.jsxs(Qt,{editor:n,shouldShow:jn,appendTo:s,className:"flex items-center gap-0.5 rounded-lg bg-popover p-1 shadow-soft","aria-label":r("markdownEditor.toolbarAriaLabel"),children:[b.jsx(_,{active:l.bold,label:r("markdownEditor.bold"),onClick:()=>n.chain().focus().toggleBold().run(),children:b.jsx(un,{size:14})}),b.jsx(_,{active:l.italic,label:r("markdownEditor.italic"),onClick:()=>n.chain().focus().toggleItalic().run(),children:b.jsx(hn,{size:14})}),b.jsx(_,{active:l.strike,label:r("markdownEditor.strikethrough"),onClick:()=>n.chain().focus().toggleStrike().run(),children:b.jsx(dn,{size:14})}),b.jsx(_,{active:l.code,label:r("markdownEditor.code"),onClick:()=>n.chain().focus().toggleCode().run(),children:b.jsx(pn,{size:14})}),b.jsx(le,{}),it.map((g,m)=>b.jsx(_,{active:l.headings[m]??!1,label:d[g],onClick:()=>n.chain().focus().toggleHeading({level:g}).run(),children:b.jsx(He,{children:`H${g}`})},g)),b.jsx(le,{}),b.jsx(_,{active:l.bulletList,label:r("markdownEditor.bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),children:b.jsx(mn,{size:14})}),b.jsx(_,{active:l.orderedList,label:r("markdownEditor.orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),children:b.jsx(He,{children:"1."})}),b.jsx(_,{active:l.blockquote,label:r("markdownEditor.quote"),onClick:()=>n.chain().focus().toggleBlockquote().run(),children:b.jsx(fn,{size:14})}),b.jsx(le,{}),b.jsx(Hn,{editor:n})]}),e[12]=n,e[13]=d,e[14]=s,e[15]=l,e[16]=r,e[17]=f):f=e[17];let p;return e[18]!==f?(p=b.jsx("div",{ref:i,className:"relative z-20",children:f}),e[18]=f,e[19]=p):p=e[19],p}function On(t){const{editor:e}=t;return{bold:e.isActive("bold"),italic:e.isActive("italic"),strike:e.isActive("strike"),code:e.isActive("code"),headings:it.map(n=>e.isActive("heading",{level:n})),bulletList:e.isActive("bulletList"),orderedList:e.isActive("orderedList"),blockquote:e.isActive("blockquote")}}const Bn=10,Dn=25,Fn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","image/svg+xml":".svg"};function qn(t){return t.name.match(/\.[a-z0-9]{1,8}$/i)?.[0]??Fn[t.type]??""}function Wn(){const t=$.c(4),e=j(),{upload:n}=bn(Pe),r=wn(Pe);let s;return t[0]!==r||t[1]!==e||t[2]!==n?(s={uploadFile:async a=>{const l=st(a),o=l?Bn:Dn;if(a.size>o*1024*1024)return ue.error(e("markdownEditor.fileTooLarge",{name:a.name,max:String(o)})),null;const u=l?yn:Tn,c=`${crypto.randomUUID()}${qn(a)}`;try{return await n.mutateAsync({dir:u,files:[new File([a],c,{type:a.type})]}),r(`${u}/${c}`)}catch{return ue.error(e("markdownEditor.uploadFailed",{name:a.name})),null}}},t[0]=r,t[1]=e,t[2]=n,t[3]=s):s=t[3],s}const ee=new Ye("uploadSlots"),Un=ie.create({name:"uploadSlots",addProseMirrorPlugins(){return[new Rt({key:ee,state:{init:()=>new Map,apply(t,e){const n=t.getMeta(ee);if(!t.docChanged&&!n)return e;const r=new Map;for(const[s,i]of e)r.set(s,t.mapping.map(i));if(n){const[s,i]=n;i===null?r.delete(s):r.set(s,i)}return r}}})]}});function he(t,e,n){return t.setMeta(ee,[e,n])}function Gn(t,e){return ee.getState(t)?.get(e)}function Zn(t,e,n,r,s){const{schema:i}=t.state,a=i.nodes[n];if(!a)return;const l=a.create(r),o=t.state.selection.to===e,u=t.state.doc.resolve(e),c=u.parent.textBetween(Math.max(0,u.parentOffset-1),u.parentOffset,void 0,""),h=()=>i.text(" "),d=l.isInline?[...c&&!/\s/.test(c)?[h()]:[],l,h()]:l,f=t.state.tr.replaceWith(e,e,d);let p=e,g=e;f.mapping.maps.at(-1)?.forEach((T,x,v,M)=>{p=v,g=M});let m;f.doc.nodesBetween(p,g,(T,x)=>{T===l&&(m=x+T.nodeSize)});let k=m??g;m!==void 0&&l.isInline&&(k+=1);const w=i.nodes.paragraph;m!==void 0&&l.isBlock&&w&&(f.doc.resolve(m).nodeAfter?.isTextblock||f.insert(m,w.create()),k=m+1);const y=Et.near(f.doc.resolve(k));o&&f.setSelection(y),s&&he(f,s,y.to),t.dispatch(f)}function Vn(t){return!t||t.files.length===0?[]:t.getData("text/html")!==""&&t.getData("text/plain").trim()!==""?[]:Array.from(t.files)}function Kn(t=!0){const e=j(),{uploadFile:n}=Wn(),r=E.useRef(n);r.current=n;const[s,i]=E.useState(0),a=E.useRef(0),l=h=>{a.current+=h,i(a.current)},o=(h,d,f)=>{if(!t||d.length===0)return!1;l(d.length);const p=Symbol("upload");return h.dispatch(he(h.state.tr,p,f)),(async()=>{for(const g of d)try{const m=await r.current(g);if(!m||h.isDestroyed)continue;const k=st(g);Zn(h,Gn(h.state,p)??h.state.selection.to,k?"image":"attachment",k?{src:m,alt:g.name}:{href:m,name:g.name},p)}catch{ue.error(e("markdownEditor.uploadFailed",{name:g.name}))}finally{l(-1)}h.isDestroyed||h.dispatch(he(h.state.tr,p,null))})(),!0};return{pending:s,uploading:()=>a.current>0,uploadInto:o,handlePaste:(h,d)=>{const f=Vn(d.clipboardData);return f.length===0?!1:(d.stopPropagation(),o(h,f,h.state.selection.to))},handleDrop:(h,d,f,p)=>{if(p)return!1;const g=Array.from(d.dataTransfer?.files??[]);if(g.length===0)return!1;const m=h.posAtCoords({left:d.clientX,top:d.clientY})?.pos;return m===void 0?!1:(d.stopPropagation(),o(h,g,m))}}}function be(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var F=be();function at(t){F=t}var O={exec:()=>null};function A(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(R.caret,"$1"),n=n.replace(s,a),r},getRegex:()=>new RegExp(n,e)};return r}var Qn=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),R={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Xn=/^(?:[ \t]*(?:\n|$))+/,Jn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Yn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,K=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,er=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,we=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lt=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),tr=A(ot).replace(/bull/g,we).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nr=/^[^\n]+/,Te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rr=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sr=A(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,we).getRegex(),ae="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ir=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ve).replace("tag",ae).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ct=A(ye).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),ar=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ct).getRegex(),Ae={blockquote:ar,code:Jn,def:rr,fences:Yn,heading:er,hr:K,html:ir,lheading:lt,list:sr,newline:Xn,paragraph:ct,table:O,text:nr},je=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex(),or={...Ae,lheading:tr,table:je,paragraph:A(ye).replace("hr",K).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",je).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ae).getRegex()},lr={...Ae,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(ye).replace("hr",K).replace("heading",` *#{1,6} *[^
2
2
  ]`).replace("lheading",lt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},cr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ur=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,hr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,W=/[\p{P}\p{S}]/u,oe=/[\s\p{P}\p{S}]/u,Me=/[^\s\p{P}\p{S}]/u,dr=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oe).getRegex(),ht=/(?!~)[\p{P}\p{S}]/u,pr=/(?!~)[\s\p{P}\p{S}]/u,fr=/(?:[^\s\p{P}\p{S}]|~)/u,gr=A(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Qn?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,mr=A(dt,"u").replace(/punct/g,W).getRegex(),kr=A(dt,"u").replace(/punct/g,ht).getRegex(),pt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xr=A(pt,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,W).getRegex(),br=A(pt,"gu").replace(/notPunctSpace/g,fr).replace(/punctSpace/g,pr).replace(/punct/g,ht).getRegex(),wr=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,W).getRegex(),yr=A(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,W).getRegex(),Tr="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",vr=A(Tr,"gu").replace(/notPunctSpace/g,Me).replace(/punctSpace/g,oe).replace(/punct/g,W).getRegex(),Ar=A(/\\(punct)/,"gu").replace(/punct/g,W).getRegex(),Mr=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Sr=A(ve).replace("(?:-->|$)","-->").getRegex(),Cr=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Sr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Rr=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ft=A(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",Te).getRegex(),gt=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",Te).getRegex(),Er=A("reflink|nolink(?!\\()","g").replace("reflink",ft).replace("nolink",gt).getRegex(),Ne=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Se={_backpedal:O,anyPunctuation:Ar,autolink:Mr,blockSkip:gr,br:ut,code:ur,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:mr,emStrongRDelimAst:xr,emStrongRDelimUnd:wr,escape:cr,link:Rr,nolink:gt,punctuation:dr,reflink:ft,reflinkSearch:Er,tag:Cr,text:hr,url:O},$r={...Se,link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},de={...Se,emStrongRDelimAst:br,emStrongLDelim:kr,delLDelim:yr,delRDelim:vr,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ne).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ne).getRegex()},_r={...de,br:A(ut).replace("{2,}","*").getRegex(),text:A(de.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:Ae,gfm:or,pedantic:lr},U={normal:Se,gfm:de,breaks:_r,pedantic:$r},Lr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Oe=t=>Lr[t];function z(t,e){if(e){if(R.escapeTest.test(t))return t.replace(R.escapeReplace,Oe)}else if(R.escapeTestNoEncode.test(t))return t.replace(R.escapeReplaceNoEncode,Oe);return t}function Be(t){try{t=encodeURI(t).replace(R.percentDecode,"%")}catch{return null}return t}function De(t,e){let n=t.replace(R.findPipe,(i,a,l)=>{let o=!1,u=a;for(;--u>=0&&l[u]==="\\";)o=!o;return o?"|":" |"}),r=n.split(R.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(R.slashPipe,"|");return r}function G(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function Ir(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function zr(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Fe(t,e,n,r,s){let i=e.href,a=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,o}function Pr(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
3
3
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=s.length?i.slice(s.length):i}).join(`
4
4
  `)}var ne=class{options;rules;lexer;constructor(t){this.options=t||F}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:G(n,`
@@ -63,10 +63,10 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
63
63
  `),g=p[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),m=g?g[2]:"";let k=[];if(p.length>1&&p.slice(1).join(`
64
64
  `).trim()){const w=p.slice(1),y=w.filter(T=>T.trim());if(y.length>0){const T=Math.min(...y.map(v=>v.length-v.trimStart().length)),x=w.map(v=>v.trim()?v.slice(T):"").join(`
65
65
  `).trim();x&&(k=this.markedInstance.lexer(`${x}
66
- `))}}d={type:"taskItem",raw:"",mainContent:m,indentLevel:h,checked:c??!1,text:m,tokens:this.tokenizeInline(m),nestedTokens:k}}const f=u?"taskList":"list";i!==f?(s.length>0&&r.push({type:i,items:s}),s=[d],i=f):s.push(d)}s.length>0&&r.push({type:i,items:s});const a=[];for(let l=0;l<r.length;l+=1){const o=r[l],u={...t,type:o.type,items:o.items},c=this.parseToken(u);c&&(Array.isArray(c)?a.push(...c):a.push(c))}return a.length>0?a:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(r=>{if(!r.parseMarkdown)return!1;const s=r.parseMarkdown(t,n),i=this.normalizeParseResult(s);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){const e=[];for(let a=0;a<t.length;a+=1){const l=t[a];if(l.type==="text")e.push({type:"text",text:Ee(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,r;const o=((n=(r=l.raw)!==null&&r!==void 0?r:l.text)!==null&&n!==void 0?n:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(o),c=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&c&&!/\/>$/.test(o)){const d=c[1],f=this.escapeRegex(d),p=new RegExp(`^<\\/\\s*${f}\\b`,"i");let g=-1;const m=[o];for(let k=a+1;k<t.length;k+=1){var s,i;const w=t[k],y=((s=(i=w.raw)!==null&&i!==void 0?i:w.text)!==null&&s!==void 0?s:"").toString();if(m.push(y),w.type==="html"&&p.test(y)){g=k;break}}if(g!==-1){const k=m.join(""),w={type:"html",raw:k,text:k,block:!1},y=this.parseHTMLToken(w);if(y){const T=this.normalizeParseResult(y);Array.isArray(T)?e.push(...T):T&&e.push(T)}a=g;continue}}const h=this.parseHTMLToken(l);if(h){const d=this.normalizeParseResult(h);Array.isArray(d)?e.push(...d):d&&e.push(d)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const u=this.createParseHelpers(),c=o.parseMarkdown(l,u);if(this.isMarkResult(c)){const h=this.applyMarkToContent(c.mark,c.content,c.attrs);e.push(...h)}else{const h=this.normalizeParseResult(c);Array.isArray(h)?e.push(...h):h&&e.push(h)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let a=e.length-1;a>0;a-=1){const l=e[a],o=e[a-1];if(l.type==="text"&&o.type==="text"){const u=l.marks||[],c=o.marks||[];Lt(u,c)&&(o.text=(o.text||"")+(l.text||""),e.splice(a,1))}}return e}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:Ee(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=It(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const r=this.toInlineContent(n.content);return r.length>0?r:null}return n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}toInlineContent(t){const e=this.getInlineNodeTypes();return t.flatMap(n=>n.type&&e.has(n.type)?[n]:n.content?this.toInlineContent(n.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;const t=new Set(["text"]);try{const e=$e(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return Kr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=$e(this.baseExtensions),n=r=>{const s=r?.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof i?.tag=="string"){const a=i.tag.match(/^[a-zA-Z][\w-]*/);a&&t.add(a[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(r=>this.codeTypes.has(typeof r=="string"?r:r.type))?t:this.escapeMarkdownSyntax(zt(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const a=this.getHandlerForToken(t.type);if(!a)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(c,h)=>{const d=a.isIndenting?r+1:r;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,t,h||"",n,d):this.renderNodes(c,t,h||"",n,d)},renderChild:(c,h)=>{const d=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(c,t,h,d)},indent:c=>this.indentString+c,wrapInBlock:Or},u={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...s}};return((i=a.renderMarkdown)===null||i===void 0?void 0:i.call(a,t,o,u))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,a=new Set,l=new Map;return t.forEach((o,u)=>{const c=u<t.length-1?t[u+1]:null;if(o.type)if(o.type==="text"){let h=this.encodeTextForMarkdown(o.text||"",o,e);const d=new Map((o.marks||[]).map(x=>[x.type,x])),f=this.getMarksToOpenForSerialization(i,d,c),p=Br(d,c),g=p.filter(x=>i.has(x)),m=g.length>0&&f.length>0;let k="";if(p.length>0&&!m){const x=h.match(/(\s+)$/);x&&(k=x[1],h=h.slice(0,-k.length))}m||p.slice().reverse().forEach(x=>{if(!i.has(x))return;const v=d.get(x),M=this.getMarkClosing(x,v,l.get(x));M&&(h+=M),i.has(x)&&(i.delete(x),l.delete(x))});let w="";if(f.length>0){const x=h.match(/^(\s+)/);x&&(w=x[1],h=h.slice(w.length))}f.forEach(({type:x,mark:v})=>{const M=a.has(x)?"html":"markdown",C=this.getMarkOpening(x,v,M);C&&(h=C+h),l.set(x,M),a.delete(x)}),m||f.slice().reverse().forEach(({type:x,mark:v})=>{i.set(x,v)}),h=w+h;let y;if(m){const x=new Set((c?.marks||[]).map(C=>C.type));f.forEach(({type:C})=>{x.has(C)&&this.getHtmlReopenTags(C)&&a.add(C)});const v=Array.from(i.keys()),M=g.slice().sort((C,yt)=>v.indexOf(yt)-v.indexOf(C));y=[...f.map(C=>C.type),...M]}else y=Fr(i,d,c,this.markSetsEqual.bind(this));let T="";if(y.length>0){const x=h.match(/(\s+)$/);x&&(T=x[1],h=h.slice(0,-T.length))}y.forEach(x=>{var v;const M=(v=i.get(x))!==null&&v!==void 0?v:d.get(x),C=this.getMarkClosing(x,M,l.get(x));C&&(h+=C),i.delete(x),l.delete(x)}),h+=T,h+=k,s.push(h)}else{const h=new Set((o.marks||[]).map(k=>k.type)),d=new Map,f=new Map;i.forEach((k,w)=>{if(h.has(w)){var y;d.set(w,k),f.set(w,(y=l.get(w))!==null&&y!==void 0?y:"markdown")}});const p=qr(i,(k,w)=>this.getMarkClosing(k,w,l.get(k)));l.clear();const g=this.renderNodeToMarkdown(o,e,u,r),m=o.type==="hardBreak"?"":Wr(d,i,(k,w)=>{var y;const T=(y=f.get(k))!==null&&y!==void 0?y:"markdown";return l.set(k,T),this.getMarkOpening(k,w,T)});s.push(p+g+m)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.open)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:c=>c,wrapInBlock:(c,h)=>c+h},{index:0,level:0,parentType:"text",meta:{}}),u=o.indexOf(a);return u>=0?o.substring(0,u):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.close)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:h=>h,wrapInBlock:(h,d)=>h+d},{index:0,level:0,parentType:"text",meta:{}}),u=o.indexOf(a),c=u+33;return u>=0?o.substring(c):""}catch(o){throw new Error(`Failed to get mark closing for ${t}: ${o}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&V(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=Dr(t,e);if(r.length<=1)return r;const s=n?.marks||[],i=(u,c)=>s.some(h=>h.type===u&&V(h.attrs,c)),a=(u,c)=>{var h,d;const f=(h=this.extensionRanks.get(u.type))!==null&&h!==void 0?h:Number.MAX_SAFE_INTEGER,p=(d=this.extensionRanks.get(c.type))!==null&&d!==void 0?d:Number.MAX_SAFE_INTEGER;return f!==p?p-f:u.type.localeCompare(c.type)},l=r.filter(u=>!i(u.type,u.mark.attrs)).sort(a),o=r.filter(u=>i(u.type,u.mark.attrs)).sort(a);return[...l,...o]}};const Qr=ie.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return P.setContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.setContent(t,e);const n=this.editor.markdown.parse(t);return P.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return P.insertContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContent(t,e);const n=this.editor.markdown.parse(t);return P.insertContent(n,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType)return P.insertContentAt(t,e,n);if(X(e,n?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContentAt(t,e,n);const r=this.editor.markdown.parse(e);return P.insertContentAt(t,r,n)}}},addStorage(){return{manager:new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||X(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);!((t=e.content)===null||t===void 0)&&t.length&&(this.editor.options.content=e)}});function se(t){return t==="left"||t==="right"||t==="center"?t:null}function Xr(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return se(e||n)}function Yr(t){return se(t?.align)}function mt(){return{default:null,parseHTML:t=>Xr(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function Jr(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function kt(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):Jr(t)}const es=/[ \t\r\n\f]+/g;function xt(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(es,"")===""}function bt(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}const ts=D.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>xt(t)?{}:!1,getContent:(t,e)=>bt(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",H(this.options.HTMLAttributes,t),0]}}),ns=D.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>xt(t)?{}:!1,getContent:(t,e)=>bt(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",H(this.options.HTMLAttributes,t),0]}}),rs=D.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",H(this.options.HTMLAttributes,t),0]}});function ge(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function We(t,e,n,r,s,i){let a=0,l=!0,o=e.firstChild;const u=t.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:g}=u.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const k=s===f?i:g&&g[m],w=k?`${k}px`:"";if(a+=k||r,k||(l=!1),o){if(o.style.width!==w){const[y,T]=ge(r,k);o.style.setProperty(y,T)}o=o.nextSibling}else{const y=document.createElement("col"),[T,x]=ge(r,k);y.style.setProperty(T,x),e.appendChild(y)}}}for(;o;){var c;const d=o.nextSibling;(c=o.parentNode)===null||c===void 0||c.removeChild(o),o=d}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!h?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var ss=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),We(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,We(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function is(t,e,n,r){let s=0,i=!0;const a=[],l=t.firstChild;if(!l)return{};for(let c=0,h=0;c<l.childCount;c+=1){const{colspan:d,colwidth:f}=l.child(c).attrs;for(let p=0;p<d;p+=1,h+=1){const g=n===h?r:f&&f[p];s+=g||e,g||(i=!1);const[m,k]=ge(e,g);a.push(["col",{style:`${m}: ${k}`}])}}const o=i?`${s}px`:"",u=i?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:o,tableMinWidth:u}}function Ue(t,e){return t.createAndFill()}function as(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function os(t,e,n,r,s){const i=as(t),a=[],l=[];for(let u=0;u<n;u+=1){const c=Ue(i.cell);if(c&&l.push(c),r){const h=Ue(i.header_cell);h&&a.push(h)}}const o=[];for(let u=0;u<e;u+=1)o.push(i.row.createChecked(null,r&&u===0?a:l));return i.table.createChecked(null,o)}function ls(t){return t instanceof rt}const Y=({editor:t})=>{const{selection:e}=t.state;if(!ls(e))return!1;let n=0;const r=J(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function Ge(t,e){const n=t.mapping.map(e),r=J(t.selection.$from,a=>a.type.name==="table");if(r?.pos===n)return;const s=t.doc.nodeAt(n);if(!s)return;const i=n+s.nodeSize-1;t.setSelection(tt.near(t.doc.resolve(i),-1))}function cs(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let a=0;for(;s+a<t.length&&t[s+a]==="`";)a+=1;if(a===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,o=>o==="|"?"\\|":o)+t.slice(s,s+r),n=s+r,i=!0;break}s+=a}i||(e+=t.slice(n,n+r),n+=r)}return e}function us(t){return t.split(`
66
+ `))}}d={type:"taskItem",raw:"",mainContent:m,indentLevel:h,checked:c??!1,text:m,tokens:this.tokenizeInline(m),nestedTokens:k}}const f=u?"taskList":"list";i!==f?(s.length>0&&r.push({type:i,items:s}),s=[d],i=f):s.push(d)}s.length>0&&r.push({type:i,items:s});const a=[];for(let l=0;l<r.length;l+=1){const o=r[l],u={...t,type:o.type,items:o.items},c=this.parseToken(u);c&&(Array.isArray(c)?a.push(...c):a.push(c))}return a.length>0?a:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(r=>{if(!r.parseMarkdown)return!1;const s=r.parseMarkdown(t,n),i=this.normalizeParseResult(s);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){const e=[];for(let a=0;a<t.length;a+=1){const l=t[a];if(l.type==="text")e.push({type:"text",text:Ee(l.text||"")});else if(l.type==="escape")e.push({type:"text",text:l.text||""});else if(l.type==="html"){var n,r;const o=((n=(r=l.raw)!==null&&r!==void 0?r:l.text)!==null&&n!==void 0?n:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(o),c=o.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&c&&!/\/>$/.test(o)){const d=c[1],f=this.escapeRegex(d),p=new RegExp(`^<\\/\\s*${f}\\b`,"i");let g=-1;const m=[o];for(let k=a+1;k<t.length;k+=1){var s,i;const w=t[k],y=((s=(i=w.raw)!==null&&i!==void 0?i:w.text)!==null&&s!==void 0?s:"").toString();if(m.push(y),w.type==="html"&&p.test(y)){g=k;break}}if(g!==-1){const k=m.join(""),w={type:"html",raw:k,text:k,block:!1},y=this.parseHTMLToken(w);if(y){const T=this.normalizeParseResult(y);Array.isArray(T)?e.push(...T):T&&e.push(T)}a=g;continue}}const h=this.parseHTMLToken(l);if(h){const d=this.normalizeParseResult(h);Array.isArray(d)?e.push(...d):d&&e.push(d)}}else if(l.type){const o=this.getHandlerForToken(l.type);if(o&&o.parseMarkdown){const u=this.createParseHelpers(),c=o.parseMarkdown(l,u);if(this.isMarkResult(c)){const h=this.applyMarkToContent(c.mark,c.content,c.attrs);e.push(...h)}else{const h=this.normalizeParseResult(c);Array.isArray(h)?e.push(...h):h&&e.push(h)}}else l.tokens&&e.push(...this.parseInlineTokens(l.tokens))}}for(let a=e.length-1;a>0;a-=1){const l=e[a],o=e[a-1];if(l.type==="text"&&o.type==="text"){const u=l.marks||[],c=o.marks||[];Lt(u,c)&&(o.text=(o.text||"")+(l.text||""),e.splice(a,1))}}return e}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:Ee(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=It(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const r=this.toInlineContent(n.content);return r.length>0?r:null}return n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}toInlineContent(t){const e=this.getInlineNodeTypes();return t.flatMap(n=>n.type&&e.has(n.type)?[n]:n.content?this.toInlineContent(n.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;const t=new Set(["text"]);try{const e=$e(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return Kr(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=$e(this.baseExtensions),n=r=>{const s=r?.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof i?.tag=="string"){const a=i.tag.match(/^[a-zA-Z][\w-]*/);a&&t.add(a[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(r=>this.codeTypes.has(typeof r=="string"?r:r.type))?t:this.escapeMarkdownSyntax(zt(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const a=this.getHandlerForToken(t.type);if(!a)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,o={renderChildren:(c,h)=>{const d=a.isIndenting?r+1:r;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,t,h||"",n,d):this.renderNodes(c,t,h||"",n,d)},renderChild:(c,h)=>{const d=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(c,t,h,d)},indent:c=>this.indentString+c,wrapInBlock:Or},u={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...s}};return((i=a.renderMarkdown)===null||i===void 0?void 0:i.call(a,t,o,u))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,a=new Set,l=new Map;return t.forEach((o,u)=>{const c=u<t.length-1?t[u+1]:null;if(o.type)if(o.type==="text"){let h=this.encodeTextForMarkdown(o.text||"",o,e);const d=new Map((o.marks||[]).map(x=>[x.type,x])),f=this.getMarksToOpenForSerialization(i,d,c),p=Br(d,c),g=p.filter(x=>i.has(x)),m=g.length>0&&f.length>0;let k="";if(p.length>0&&!m){const x=h.match(/(\s+)$/);x&&(k=x[1],h=h.slice(0,-k.length))}m||p.slice().reverse().forEach(x=>{if(!i.has(x))return;const v=d.get(x),M=this.getMarkClosing(x,v,l.get(x));M&&(h+=M),i.has(x)&&(i.delete(x),l.delete(x))});let w="";if(f.length>0){const x=h.match(/^(\s+)/);x&&(w=x[1],h=h.slice(w.length))}f.forEach(({type:x,mark:v})=>{const M=a.has(x)?"html":"markdown",C=this.getMarkOpening(x,v,M);C&&(h=C+h),l.set(x,M),a.delete(x)}),m||f.slice().reverse().forEach(({type:x,mark:v})=>{i.set(x,v)}),h=w+h;let y;if(m){const x=new Set((c?.marks||[]).map(C=>C.type));f.forEach(({type:C})=>{x.has(C)&&this.getHtmlReopenTags(C)&&a.add(C)});const v=Array.from(i.keys()),M=g.slice().sort((C,yt)=>v.indexOf(yt)-v.indexOf(C));y=[...f.map(C=>C.type),...M]}else y=Fr(i,d,c,this.markSetsEqual.bind(this));let T="";if(y.length>0){const x=h.match(/(\s+)$/);x&&(T=x[1],h=h.slice(0,-T.length))}y.forEach(x=>{var v;const M=(v=i.get(x))!==null&&v!==void 0?v:d.get(x),C=this.getMarkClosing(x,M,l.get(x));C&&(h+=C),i.delete(x),l.delete(x)}),h+=T,h+=k,s.push(h)}else{const h=new Set((o.marks||[]).map(k=>k.type)),d=new Map,f=new Map;i.forEach((k,w)=>{if(h.has(w)){var y;d.set(w,k),f.set(w,(y=l.get(w))!==null&&y!==void 0?y:"markdown")}});const p=qr(i,(k,w)=>this.getMarkClosing(k,w,l.get(k)));l.clear();const g=this.renderNodeToMarkdown(o,e,u,r),m=o.type==="hardBreak"?"":Wr(d,i,(k,w)=>{var y;const T=(y=f.get(k))!==null&&y!==void 0?y:"markdown";return l.set(k,T),this.getMarkOpening(k,w,T)});s.push(p+g+m)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.open)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:c=>c,wrapInBlock:(c,h)=>c+h},{index:0,level:0,parentType:"text",meta:{}}),u=o.indexOf(a);return u>=0?o.substring(0,u):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e,n="markdown"){if(n==="html"){var r;return((r=this.getHtmlReopenTags(t))===null||r===void 0?void 0:r.close)||""}const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const o=i.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:h=>h,wrapInBlock:(h,d)=>h+d},{index:0,level:0,parentType:"text",meta:{}}),u=o.indexOf(a),c=u+33;return u>=0?o.substring(c):""}catch(o){throw new Error(`Failed to get mark closing for ${t}: ${o}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&V(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=Dr(t,e);if(r.length<=1)return r;const s=n?.marks||[],i=(u,c)=>s.some(h=>h.type===u&&V(h.attrs,c)),a=(u,c)=>{var h,d;const f=(h=this.extensionRanks.get(u.type))!==null&&h!==void 0?h:Number.MAX_SAFE_INTEGER,p=(d=this.extensionRanks.get(c.type))!==null&&d!==void 0?d:Number.MAX_SAFE_INTEGER;return f!==p?p-f:u.type.localeCompare(c.type)},l=r.filter(u=>!i(u.type,u.mark.attrs)).sort(a),o=r.filter(u=>i(u.type,u.mark.attrs)).sort(a);return[...l,...o]}};const Qr=ie.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType)return P.setContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.setContent(t,e);const n=this.editor.markdown.parse(t);return P.setContent(n,e)},insertContent:(t,e)=>{if(!e?.contentType)return P.insertContent(t,e);if(X(t,e?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContent(t,e);const n=this.editor.markdown.parse(t);return P.insertContent(n,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType)return P.insertContentAt(t,e,n);if(X(e,n?.contentType)!=="markdown"||!this.editor.markdown)return P.insertContentAt(t,e,n);const r=this.editor.markdown.parse(e);return P.insertContentAt(t,r,n)}}},addStorage(){return{manager:new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new qe({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||X(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);!((t=e.content)===null||t===void 0)&&t.length&&(this.editor.options.content=e)}});function se(t){return t==="left"||t==="right"||t==="center"?t:null}function Xr(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return se(e||n)}function Jr(t){return se(t?.align)}function mt(){return{default:null,parseHTML:t=>Xr(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function Yr(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function kt(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):Yr(t)}const es=/[ \t\r\n\f]+/g;function xt(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(es,"")===""}function bt(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}const ts=D.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>xt(t)?{}:!1,getContent:(t,e)=>bt(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",H(this.options.HTMLAttributes,t),0]}}),ns=D.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:kt},align:mt()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>xt(t)?{}:!1,getContent:(t,e)=>bt(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",H(this.options.HTMLAttributes,t),0]}}),rs=D.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",H(this.options.HTMLAttributes,t),0]}});function ge(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function We(t,e,n,r,s,i){let a=0,l=!0,o=e.firstChild;const u=t.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:g}=u.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const k=s===f?i:g&&g[m],w=k?`${k}px`:"";if(a+=k||r,k||(l=!1),o){if(o.style.width!==w){const[y,T]=ge(r,k);o.style.setProperty(y,T)}o=o.nextSibling}else{const y=document.createElement("col"),[T,x]=ge(r,k);y.style.setProperty(T,x),e.appendChild(y)}}}for(;o;){var c;const d=o.nextSibling;(c=o.parentNode)===null||c===void 0||c.removeChild(o),o=d}const h=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!h?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var ss=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),We(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,We(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function is(t,e,n,r){let s=0,i=!0;const a=[],l=t.firstChild;if(!l)return{};for(let c=0,h=0;c<l.childCount;c+=1){const{colspan:d,colwidth:f}=l.child(c).attrs;for(let p=0;p<d;p+=1,h+=1){const g=n===h?r:f&&f[p];s+=g||e,g||(i=!1);const[m,k]=ge(e,g);a.push(["col",{style:`${m}: ${k}`}])}}const o=i?`${s}px`:"",u=i?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:o,tableMinWidth:u}}function Ue(t,e){return t.createAndFill()}function as(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function os(t,e,n,r,s){const i=as(t),a=[],l=[];for(let u=0;u<n;u+=1){const c=Ue(i.cell);if(c&&l.push(c),r){const h=Ue(i.header_cell);h&&a.push(h)}}const o=[];for(let u=0;u<e;u+=1)o.push(i.row.createChecked(null,r&&u===0?a:l));return i.table.createChecked(null,o)}function ls(t){return t instanceof rt}const J=({editor:t})=>{const{selection:e}=t.state;if(!ls(e))return!1;let n=0;const r=Y(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function Ge(t,e){const n=t.mapping.map(e),r=Y(t.selection.$from,a=>a.type.name==="table");if(r?.pos===n)return;const s=t.doc.nodeAt(n);if(!s)return;const i=n+s.nodeSize-1;t.setSelection(tt.near(t.doc.resolve(i),-1))}function cs(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let a=0;for(;s+a<t.length&&t[s+a]==="`";)a+=1;if(a===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,o=>o==="|"?"\\|":o)+t.slice(s,s+r),n=s+r,i=!0;break}s+=a}i||(e+=t.slice(n,n+r),n+=r)}return e}function us(t){return t.split(`
67
67
  `).map(e=>!e.includes("|")||!e.includes("`")?e:cs(e)).join(`
68
68
  `)}function hs(t){return(t||"").replace(/\s+/g," ").trim()}function ds(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!==null&&r!==void 0?r:"";if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(p=>{const g=[];p.content&&p.content.forEach(m=>{let k="";m.content&&Array.isArray(m.content)&&m.content.length>1?k=m.content.map(x=>e.renderChildren(x)).join(s):k=m.content?e.renderChildren(m.content):"";const w=hs(k.split(s).join(`
69
- `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),y=m.type==="tableHeader",T=Yr(m.attrs);g.push({text:w,isHeader:y,align:T})}),i.push(g)});const a=i.reduce((p,g)=>Math.max(p,g.length),0);if(a===0)return"";const l=Array.from({length:a}).fill(0);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;const k=(((g=p[m])===null||g===void 0?void 0:g.text)||"").length;k>l[m]&&(l[m]=k),l[m]<3&&(l[m]=3)}});const o=(p,g)=>p+" ".repeat(Math.max(0,g-p.length)),u=i[0],c=u.some(p=>p.isHeader),h=Array.from({length:a}).fill(null);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;!h[m]&&(!((g=p[m])===null||g===void 0)&&g.align)&&(h[m]=p[m].align)}});let d=`
69
+ `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),y=m.type==="tableHeader",T=Jr(m.attrs);g.push({text:w,isHeader:y,align:T})}),i.push(g)});const a=i.reduce((p,g)=>Math.max(p,g.length),0);if(a===0)return"";const l=Array.from({length:a}).fill(0);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;const k=(((g=p[m])===null||g===void 0?void 0:g.text)||"").length;k>l[m]&&(l[m]=k),l[m]<3&&(l[m]=3)}});const o=(p,g)=>p+" ".repeat(Math.max(0,g-p.length)),u=i[0],c=u.some(p=>p.isHeader),h=Array.from({length:a}).fill(null);i.forEach(p=>{for(let m=0;m<a;m+=1){var g;!h[m]&&(!((g=p[m])===null||g===void 0)&&g.align)&&(h[m]=p[m].align)}});let d=`
70
70
  `;const f=Array.from({length:a}).map((p,g)=>c&&u[g]&&u[g].text||"");return d+=`| ${f.map((p,g)=>o(p,l[g])).join(" | ")} |
71
71
  `,d+=`| ${l.map((p,g)=>{const m=Math.max(3,p),k=h[g];return k==="left"?`:${"-".repeat(m)}`:k==="right"?`${"-".repeat(m)}:`:k==="center"?`:${"-".repeat(m)}:`:"-".repeat(m)}).join(" | ")} |
72
72
  `,(c?i.slice(1):i).forEach(p=>{d+=`| ${Array.from({length:a}).fill(0).map((g,m)=>o(p[m]&&p[m].text||"",l[m])).join(" | ")} |
@@ -77,7 +77,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
77
77
  `);if(i.length<2)return;const a=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(a)||!a.includes("|"))return;const l=us(s);if(l===s)return;const o=n.blockTokens(l)[0];if(o?.type!=="table"||!o.raw)return;const u=o.raw.split(`
78
78
  `).length,c=t.split(`
79
79
  `).slice(0,u).join(`
80
- `);return{...o,raw:c}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const a=os(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(tt.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>cn(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>ln(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{const n=J(t.selection.$from,r=>r.type.name==="table");return on(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>an(t,e),addRowAfter:()=>({state:t,dispatch:e})=>sn(t,e),deleteRow:()=>({state:t,dispatch:e})=>{const n=J(t.selection.$from,r=>r.type.name==="table");return rn(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>nn(t,e),mergeCells:()=>({state:t,dispatch:e})=>Le(t,e),splitCell:()=>({state:t,dispatch:e})=>Ie(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ze("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ze("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>tn(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Le(t,e)?!0:Ie(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>en(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>_e(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>_e(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Jt(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=rt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Y,"Mod-Backspace":Y,Delete:Y,"Mod-Delete":Y}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Xt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Yt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=H(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:et(N(t,"tableRole",e))}}}),fs=ie.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(ps.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ts.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(ns.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(rs.configure(this.options.tableRow)),t}});function gs(t){const e=$.c(13),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",u=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let c;e[0]!==u?(c=q(vn,"select-none",u),e[0]=u,e[1]=c):c=e[1];let h;e[2]!==i||e[3]!==s.isEditable||e[4]!==a?(h=s.isEditable&&b.jsx("button",{type:"button","aria-label":a("markdownEditor.removeFile"),onMouseDown:ms,onClick:i,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:b.jsx(Xe,{size:14})}),e[2]=i,e[3]=s.isEditable,e[4]=a,e[5]=h):h=e[5];let d;e[6]!==l||e[7]!==o||e[8]!==h?(d=b.jsx(An,{href:l,name:o,children:h}),e[6]=l,e[7]=o,e[8]=h,e[9]=d):d=e[9];let f;return e[10]!==c||e[11]!==d?(f=b.jsx(xe,{as:"span",className:c,children:d}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function ms(t){return t.preventDefault()}function ks(t){return t.replace(/([[\]])/g,"\\$1")}const xs=D.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",H(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${ks(n)}](${e})`},addNodeView(){return ke(gs)}});function bs(t){const e=$.c(5),{node:n,selected:r}=t,s=typeof n.attrs.name=="string"?n.attrs.name:"",i=r&&"ring-2 ring-ring";let a;e[0]!==i?(a=q("select-none rounded px-1 font-medium text-primary","bg-primary/10",i),e[0]=i,e[1]=a):a=e[1];let l;return e[2]!==s||e[3]!==a?(l=b.jsxs(xe,{as:"span","data-testid":"mention-chip",className:a,children:["@",s]}),e[2]=s,e[3]=a,e[4]=l):l=e[4],l}const ws=D.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-mention-name"),renderHTML:t=>t.name?{"data-mention-name":t.name}:{}}}},parseHTML(){return[{tag:"span[data-mention-id]"}]},renderHTML({HTMLAttributes:t,node:e}){return["span",H(t),`@${typeof e.attrs.name=="string"?e.attrs.name:""}`]},renderMarkdown:t=>{const e=typeof t.attrs?.id=="string"?t.attrs.id:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return e?Mn(e,n):`@${n}`},addNodeView(){return ke(bs)}}),ys="studio.mention-members.",me=new Map;function Ze(t){const e=me.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const r=JSON.parse(n);if(!Array.isArray(r))return;const s=r.filter(i=>!!i&&typeof i.id=="string"&&typeof i.name=="string");return me.set(t,s),s}catch{return}}function Ts(t,e){me.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function vs(t,e){if(!t?.length)return e;const n=new Map(t.map(r=>[r.id,r]));return e.map(r=>{const s=n.get(r.id);return s&&s.name===r.name&&s.email===r.email&&s.image===r.image?s:r})}function As(t){return t.map(e=>({id:e.userId,name:e.user?.name?.trim()||e.user?.email?.trim()||"",email:e.user?.email??"",image:e.user?.image??null})).filter(e=>!!e.name).sort((e,n)=>e.name.localeCompare(n.name))}function Ms(t){const e=$.c(17),{locator:n}=vt(),r=zn(),s=`${ys}${n}`;let i;e[0]!==n?(i=Mt.mentionMembers(n),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==s?(a=()=>Ze(s),e[2]=s,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==s?(l=async()=>{const f=await r.organization.listMembers(),p=vs(Ze(s),As(f?.data?.members??[]));return Ts(s,p),p},e[4]=r,e[5]=s,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==i||e[9]!==a||e[10]!==l?(o={queryKey:i,enabled:t,staleTime:0,placeholderData:a,queryFn:l},e[7]=t,e[8]=i,e[9]=a,e[10]=l,e[11]=o):o=e[11];const u=At(o);let c;e[12]!==u.data?(c=u.data??[],e[12]=u.data,e[13]=c):c=e[13];const h=u.isFetching&&!u.data;let d;return e[14]!==c||e[15]!==h?(d={members:c,loading:h},e[14]=c,e[15]=h,e[16]=d):d=e[16],d}const Ve={query:"",range:null,rect:null,editor:null};class Ss{state=Ve;listeners=new Set;dismissal=null;latched=!1;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;set(e){this.state=e;for(const n of this.listeners)n()}close(){this.latched=!1,this.set(Ve)}}const Re=new Je("markdownEditorMention");function Cs(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),nt(t.view,Re)}function Rs(t,e,n){const r=Math.min(e+n,t.content.size);return e>=r?"":t.textBetween(e,r,"","")}function wt(t,e){const n=e.getSnapshot().range??void 0;n&&n.to>n.from&&(e.dismissal={from:n.from,text:t.state.doc.textBetween(n.from,n.to,"")}),nt(t.view,Re)}function Es(t){return ie.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Re,allowedPrefixes:[" ",`
81
- `],allow:({state:n,range:r})=>{const s=t.dismissal;return s?r.from===s.from&&Rs(n.doc,s.from,s.text.length)===s.text?!1:(t.dismissal=null,!0):!0},items:()=>[],render:()=>({onStart:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onUpdate:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onKeyDown:({event:n})=>n.key==="Escape"?(wt(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Zt(e)]}})}const Ke=256,$s=40,Qe=280,_s=140;function Ls(t){const e=$.c(4),{store:n}=t,r=E.useSyncExternalStore(n.subscribe,n.getSnapshot),s=r.range!==null;let i;return e[0]!==s||e[1]!==r||e[2]!==n?(i=s?b.jsx(Is,{store:n,state:r}):null,e[0]=s,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}function Is({store:t,state:e}){const n=j(),{members:r,loading:s}=Ms(!0),[i,a]=E.useState(e.query),[l,o]=E.useState(null),u=zs(e.editor),c=u.getBoundingClientRect(),h=u===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):c,d=e.rect?.()??new DOMRect(0,0,0,0),f=h.bottom-d.bottom,p=f<Qe&&d.top-h.top>f,g=(p?d.top-h.top:f)-8,m=Math.min(Qe,Math.max(g,_s))-$s,k={position:"absolute",width:Ke,left:Math.min(d.left,h.right-Ke-8)-c.left,...p?{bottom:c.bottom-d.top+6}:{top:d.bottom-c.top+6}},w=()=>{e.editor&&wt(e.editor,t),t.close()},y=x=>{const v=x.relatedTarget;if((!v||e.editor?.view.dom.contains(v)===!0)&&t.latched){l?.focus();return}w()},T=x=>{!e.editor||!e.range||(Cs(e.editor,e.range,x),t.close())};return St.createPortal(b.jsx("div",{style:k,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg bg-popover shadow-soft",children:b.jsxs(En,{onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),w(),e.editor?.commands.focus())},children:[b.jsx($n,{ref:o,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:a,placeholder:n("markdownEditor.mentionSearch"),onBlur:y}),b.jsxs(_n,{style:{maxHeight:m},children:[s?b.jsx("div",{className:"flex items-center justify-center py-6",children:b.jsx(Ye,{size:"sm"})}):b.jsx(Ln,{children:n("markdownEditor.mentionEmpty")}),r.map(x=>b.jsxs(In,{value:`${x.name} ${x.email}`,onSelect:()=>T(x),onMouseDown:v=>v.preventDefault(),className:"gap-2",children:[b.jsx(Rn,{url:x.image??void 0,fallback:x.name??"?",shape:"circle",size:"xs"}),b.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.name})]},x.id))]})]})}),u)}function zs(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}const Ps=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Hs=D.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",H(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,a;const l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",o=(r=(s=t.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",u=(i=(a=t.attrs)===null||a===void 0?void 0:a.title)!==null&&i!==void 0?i:"";return u?`![${o}](${l} "${u}")`:`![${o}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:a,HTMLAttributes:l,editor:o})=>{const u=document.createElement("img");u.draggable=!1;const c=H(this.options.HTMLAttributes,l);Object.entries(c).forEach(([k,w])=>{if(w!=null)switch(k){case"src":case"width":case"height":break;default:u.setAttribute(k,w)}}),c.src!==null&&(u.src=c.src);let h={...l};const d=k=>{if(typeof k=="string"&&k!==""){u.getAttribute("src")!==k&&(u.src=k);return}u.hasAttribute("src")&&u.removeAttribute("src"),u.src!==""&&(u.src="")};d(l.src);const f=k=>{if(k.type!==i.type)return!1;const w=o.extensionManager.attributes.filter(T=>T.type===k.type.name),y=jt(k,w);return Object.keys(h).forEach(T=>{!s.has(T)&&!(T in y)&&u.removeAttribute(T)}),Object.entries(y).forEach(([T,x])=>{s.has(T)||(x!=null?u.setAttribute(T,x):u.removeAttribute(T))}),d(y.src),h=y,!0},p=new Ht({element:u,editor:o,node:i,getPos:a,onResize:(k,w)=>{u.style.width=`${k}px`,u.style.height=`${w}px`},onCommit:(k,w)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:k,height:w}).run()},onUpdate:f,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),g=p.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",u.complete&&u.naturalWidth>0?m():(u.onload=m,u.onerror=m),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Pt({find:Ps,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var js=Hs;function Ns(t){const e=$.c(16),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let u;e[0]!==o||e[1]!==a?(u=o||a("markdownEditor.imageAltFallback"),e[0]=o,e[1]=a,e[2]=u):u=e[2];const c=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==c?(h=q("max-h-[420px] max-w-full rounded-lg border border-border object-contain",c),e[3]=c,e[4]=h):h=e[4];let d;e[5]!==l||e[6]!==u||e[7]!==h?(d=b.jsx("img",{src:l,alt:u,draggable:!1,className:h}),e[5]=l,e[6]=u,e[7]=h,e[8]=d):d=e[8];let f;e[9]!==i||e[10]!==s.isEditable||e[11]!==a?(f=s.isEditable&&b.jsx("button",{type:"button","aria-label":a("markdownEditor.removeImage"),onMouseDown:Os,onClick:i,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg bg-card text-muted-foreground opacity-0 shadow-edge transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:b.jsx(Xe,{size:14})}),e[9]=i,e[10]=s.isEditable,e[11]=a,e[12]=f):f=e[12];let p;return e[13]!==d||e[14]!==f?(p=b.jsxs(xe,{className:"group/image relative my-3 w-fit max-w-full",children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15],p}function Os(t){return t.preventDefault()}const Bs=js.extend({addNodeView(){return ke(Ns)}}).configure({inline:!1,allowBase64:!1}),Ds={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},Fs=Nt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Sn(n))return e.createNode("attachment",{href:n,name:t.text??""});const r=Cn(n);return r?e.createNode("mention",{id:r,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function qs(t="",e){return[Bt.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),Fs.configure(Ds),Vt.configure({placeholder:t}),fs,Ot,Dt.configure({nested:!0}),Bs,xs,Un,ws,...e?[Es(e)]:[],Qr.configure({markedOptions:{breaks:!0}})]}const Ws=/^(\s*)([-*+]|\d+[.)])\s+\S/,Us=/^\s*(```|~~~)/,Gs=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Zs(t){const e=[];let n=!1,r=!1;for(const s of t.split(`
80
+ `);return{...o,raw:c}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const a=os(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(tt.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>cn(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>ln(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return on(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>an(t,e),addRowAfter:()=>({state:t,dispatch:e})=>sn(t,e),deleteRow:()=>({state:t,dispatch:e})=>{const n=Y(t.selection.$from,r=>r.type.name==="table");return rn(t,e&&(r=>{n&&Ge(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>nn(t,e),mergeCells:()=>({state:t,dispatch:e})=>Le(t,e),splitCell:()=>({state:t,dispatch:e})=>Ie(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ze("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ze("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>tn(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Le(t,e)?!0:Ie(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>en(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>_e(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>_e(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Yt(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=rt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:J,"Mod-Backspace":J,Delete:J,"Mod-Delete":J}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Xt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Jt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:s})=>{const i=H(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:et(N(t,"tableRole",e))}}}),fs=ie.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(ps.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ts.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(ns.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(rs.configure(this.options.tableRow)),t}});function gs(t){const e=$.c(13),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.href=="string"?n.attrs.href:"",o=typeof n.attrs.name=="string"?n.attrs.name:"",u=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let c;e[0]!==u?(c=q(vn,"select-none",u),e[0]=u,e[1]=c):c=e[1];let h;e[2]!==i||e[3]!==s.isEditable||e[4]!==a?(h=s.isEditable&&b.jsx("button",{type:"button","aria-label":a("markdownEditor.removeFile"),onMouseDown:ms,onClick:i,className:"shrink-0 rounded-lg p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:b.jsx(Xe,{size:14})}),e[2]=i,e[3]=s.isEditable,e[4]=a,e[5]=h):h=e[5];let d;e[6]!==l||e[7]!==o||e[8]!==h?(d=b.jsx(An,{href:l,name:o,children:h}),e[6]=l,e[7]=o,e[8]=h,e[9]=d):d=e[9];let f;return e[10]!==c||e[11]!==d?(f=b.jsx(xe,{as:"span",className:c,children:d}),e[10]=c,e[11]=d,e[12]=f):f=e[12],f}function ms(t){return t.preventDefault()}function ks(t){return t.replace(/([[\]])/g,"\\$1")}const xs=D.create({name:"attachment",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href"),renderHTML:t=>t.href?{href:t.href}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-name")||t.textContent,renderHTML:t=>t.name?{"data-name":t.name}:{}}}},parseHTML(){return[{tag:"a[data-attachment]"}]},renderHTML({HTMLAttributes:t,node:e}){return["a",H(t,{"data-attachment":""}),typeof e.attrs.name=="string"?e.attrs.name:""]},renderMarkdown:t=>{const e=typeof t.attrs?.href=="string"?t.attrs.href:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return`[${ks(n)}](${e})`},addNodeView(){return ke(gs)}});function bs(t){const e=$.c(5),{node:n,selected:r}=t,s=typeof n.attrs.name=="string"?n.attrs.name:"",i=r&&"ring-2 ring-ring";let a;e[0]!==i?(a=q("select-none rounded px-1 font-medium text-primary","bg-primary/10",i),e[0]=i,e[1]=a):a=e[1];let l;return e[2]!==s||e[3]!==a?(l=b.jsxs(xe,{as:"span","data-testid":"mention-chip",className:a,children:["@",s]}),e[2]=s,e[3]=a,e[4]=l):l=e[4],l}const ws=D.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-mention-id"),renderHTML:t=>t.id?{"data-mention-id":t.id}:{}},name:{default:null,parseHTML:t=>t.getAttribute("data-mention-name"),renderHTML:t=>t.name?{"data-mention-name":t.name}:{}}}},parseHTML(){return[{tag:"span[data-mention-id]"}]},renderHTML({HTMLAttributes:t,node:e}){return["span",H(t),`@${typeof e.attrs.name=="string"?e.attrs.name:""}`]},renderMarkdown:t=>{const e=typeof t.attrs?.id=="string"?t.attrs.id:"",n=typeof t.attrs?.name=="string"?t.attrs.name:"";return e?Mn(e,n):`@${n}`},addNodeView(){return ke(bs)}}),ys="studio.mention-members.",me=new Map;function Ze(t){const e=me.get(t);if(e)return e;try{const n=localStorage.getItem(t);if(!n)return;const r=JSON.parse(n);if(!Array.isArray(r))return;const s=r.filter(i=>!!i&&typeof i.id=="string"&&typeof i.name=="string");return me.set(t,s),s}catch{return}}function Ts(t,e){me.set(t,e);try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function vs(t,e){if(!t?.length)return e;const n=new Map(t.map(r=>[r.id,r]));return e.map(r=>{const s=n.get(r.id);return s&&s.name===r.name&&s.email===r.email&&s.image===r.image?s:r})}function As(t){return t.map(e=>({id:e.userId,name:e.user?.name?.trim()||e.user?.email?.trim()||"",email:e.user?.email??"",image:e.user?.image??null})).filter(e=>!!e.name).sort((e,n)=>e.name.localeCompare(n.name))}function Ms(t){const e=$.c(17),{locator:n}=vt(),r=zn(),s=`${ys}${n}`;let i;e[0]!==n?(i=Mt.mentionMembers(n),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==s?(a=()=>Ze(s),e[2]=s,e[3]=a):a=e[3];let l;e[4]!==r||e[5]!==s?(l=async()=>{const f=await r.organization.listMembers(),p=vs(Ze(s),As(f?.data?.members??[]));return Ts(s,p),p},e[4]=r,e[5]=s,e[6]=l):l=e[6];let o;e[7]!==t||e[8]!==i||e[9]!==a||e[10]!==l?(o={queryKey:i,enabled:t,staleTime:0,placeholderData:a,queryFn:l},e[7]=t,e[8]=i,e[9]=a,e[10]=l,e[11]=o):o=e[11];const u=At(o);let c;e[12]!==u.data?(c=u.data??[],e[12]=u.data,e[13]=c):c=e[13];const h=u.isFetching&&!u.data;let d;return e[14]!==c||e[15]!==h?(d={members:c,loading:h},e[14]=c,e[15]=h,e[16]=d):d=e[16],d}const Ve={query:"",range:null,rect:null,editor:null};class Ss{state=Ve;listeners=new Set;dismissal=null;latched=!1;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.state;set(e){this.state=e;for(const n of this.listeners)n()}close(){this.latched=!1,this.set(Ve)}}const Re=new Ye("markdownEditorMention");function Cs(t,e,n){t.chain().focus().insertContentAt(e,[{type:"mention",attrs:{id:n.id,name:n.name}},{type:"text",text:" "}]).run(),nt(t.view,Re)}function Rs(t,e,n){const r=Math.min(e+n,t.content.size);return e>=r?"":t.textBetween(e,r,"","")}function wt(t,e){const n=e.getSnapshot().range??void 0;n&&n.to>n.from&&(e.dismissal={from:n.from,text:t.state.doc.textBetween(n.from,n.to,"")}),nt(t.view,Re)}function Es(t){return ie.create({name:"mentionSuggestion",addProseMirrorPlugins(){const e={editor:this.editor,char:"@",pluginKey:Re,allowedPrefixes:[" ",`
81
+ `],allow:({state:n,range:r})=>{const s=t.dismissal;return s?r.from===s.from&&Rs(n.doc,s.from,s.text.length)===s.text?!1:(t.dismissal=null,!0):!0},items:()=>[],render:()=>({onStart:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onUpdate:n=>{t.set({query:n.query,range:n.range,rect:n.clientRect??null,editor:n.editor})},onKeyDown:({event:n})=>n.key==="Escape"?(wt(this.editor,t),t.close(),!0):!1,onExit:()=>{t.latched||t.close()}})};return[Zt(e)]}})}const Ke=256,$s=40,Qe=280,_s=140;function Ls(t){const e=$.c(4),{store:n}=t,r=E.useSyncExternalStore(n.subscribe,n.getSnapshot),s=r.range!==null;let i;return e[0]!==s||e[1]!==r||e[2]!==n?(i=s?b.jsx(Is,{store:n,state:r}):null,e[0]=s,e[1]=r,e[2]=n,e[3]=i):i=e[3],i}function Is({store:t,state:e}){const n=j(),{members:r,loading:s}=Ms(!0),[i,a]=E.useState(e.query),[l,o]=E.useState(null),u=zs(e.editor),c=u.getBoundingClientRect(),h=u===document.body?new DOMRect(0,0,window.innerWidth,window.innerHeight):c,d=e.rect?.()??new DOMRect(0,0,0,0),f=h.bottom-d.bottom,p=f<Qe&&d.top-h.top>f,g=(p?d.top-h.top:f)-8,m=Math.min(Qe,Math.max(g,_s))-$s,k={position:"absolute",width:Ke,left:Math.min(d.left,h.right-Ke-8)-c.left,...p?{bottom:c.bottom-d.top+6}:{top:d.bottom-c.top+6}},w=()=>{e.editor&&wt(e.editor,t),t.close()},y=x=>{const v=x.relatedTarget;if((!v||e.editor?.view.dom.contains(v)===!0)&&t.latched){l?.focus();return}w()},T=x=>{!e.editor||!e.range||(Cs(e.editor,e.range,x),t.close())};return St.createPortal(b.jsx("div",{style:k,"data-testid":"mention-menu",className:"z-50 overflow-hidden rounded-lg bg-popover shadow-soft",children:b.jsxs(En,{onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),w(),e.editor?.commands.focus())},children:[b.jsx($n,{ref:o,autoFocus:!0,onFocus:()=>{t.latched=!0},value:i,onValueChange:a,placeholder:n("markdownEditor.mentionSearch"),onBlur:y}),b.jsxs(_n,{style:{maxHeight:m},children:[s?b.jsx("div",{className:"flex items-center justify-center py-6",children:b.jsx(Je,{size:"sm"})}):b.jsx(Ln,{children:n("markdownEditor.mentionEmpty")}),r.map(x=>b.jsxs(In,{value:`${x.name} ${x.email}`,onSelect:()=>T(x),onMouseDown:v=>v.preventDefault(),className:"gap-2",children:[b.jsx(Rn,{url:x.image??void 0,fallback:x.name??"?",shape:"circle",size:"xs"}),b.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.name})]},x.id))]})]})}),u)}function zs(t){const e=t?.view.dom.closest('[role="dialog"]');return e instanceof HTMLElement?e:document.body}const Ps=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Hs=D.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",H(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,a;const l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",o=(r=(s=t.attrs)===null||s===void 0?void 0:s.alt)!==null&&r!==void 0?r:"",u=(i=(a=t.attrs)===null||a===void 0?void 0:a.title)!==null&&i!==void 0?i:"";return u?`![${o}](${l} "${u}")`:`![${o}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,s=new Set(["src","width","height"]);return({node:i,getPos:a,HTMLAttributes:l,editor:o})=>{const u=document.createElement("img");u.draggable=!1;const c=H(this.options.HTMLAttributes,l);Object.entries(c).forEach(([k,w])=>{if(w!=null)switch(k){case"src":case"width":case"height":break;default:u.setAttribute(k,w)}}),c.src!==null&&(u.src=c.src);let h={...l};const d=k=>{if(typeof k=="string"&&k!==""){u.getAttribute("src")!==k&&(u.src=k);return}u.hasAttribute("src")&&u.removeAttribute("src"),u.src!==""&&(u.src="")};d(l.src);const f=k=>{if(k.type!==i.type)return!1;const w=o.extensionManager.attributes.filter(T=>T.type===k.type.name),y=jt(k,w);return Object.keys(h).forEach(T=>{!s.has(T)&&!(T in y)&&u.removeAttribute(T)}),Object.entries(y).forEach(([T,x])=>{s.has(T)||(x!=null?u.setAttribute(T,x):u.removeAttribute(T))}),d(y.src),h=y,!0},p=new Ht({element:u,editor:o,node:i,getPos:a,onResize:(k,w)=>{u.style.width=`${k}px`,u.style.height=`${w}px`},onCommit:(k,w)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:k,height:w}).run()},onUpdate:f,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),g=p.dom,m=()=>{g.style.visibility="",g.style.pointerEvents=""};return g.style.visibility="hidden",g.style.pointerEvents="none",u.complete&&u.naturalWidth>0?m():(u.onload=m,u.onerror=m),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Pt({find:Ps,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}});var js=Hs;function Ns(t){const e=$.c(16),{node:n,selected:r,editor:s,deleteNode:i}=t,a=j(),l=typeof n.attrs.src=="string"?n.attrs.src:"",o=typeof n.attrs.alt=="string"?n.attrs.alt:"";let u;e[0]!==o||e[1]!==a?(u=o||a("markdownEditor.imageAltFallback"),e[0]=o,e[1]=a,e[2]=u):u=e[2];const c=r&&"ring-2 ring-ring ring-offset-2 ring-offset-background";let h;e[3]!==c?(h=q("max-h-[420px] max-w-full rounded-lg border border-border object-contain",c),e[3]=c,e[4]=h):h=e[4];let d;e[5]!==l||e[6]!==u||e[7]!==h?(d=b.jsx("img",{src:l,alt:u,draggable:!1,className:h}),e[5]=l,e[6]=u,e[7]=h,e[8]=d):d=e[8];let f;e[9]!==i||e[10]!==s.isEditable||e[11]!==a?(f=s.isEditable&&b.jsx("button",{type:"button","aria-label":a("markdownEditor.removeImage"),onMouseDown:Os,onClick:i,className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-lg bg-card text-muted-foreground opacity-0 shadow-edge transition-opacity hover:text-foreground focus-visible:opacity-100 group-hover/image:opacity-100",children:b.jsx(Xe,{size:14})}),e[9]=i,e[10]=s.isEditable,e[11]=a,e[12]=f):f=e[12];let p;return e[13]!==d||e[14]!==f?(p=b.jsxs(xe,{className:"group/image relative my-3 w-fit max-w-full",children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15],p}function Os(t){return t.preventDefault()}const Bs=js.extend({addNodeView(){return ke(Ns)}}).configure({inline:!1,allowBase64:!1}),Ds={openOnClick:!1,autolink:!0,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}},Fs=Nt.extend({parseMarkdown:(t,e)=>{const n=typeof t.href=="string"?t.href:"";if(Sn(n))return e.createNode("attachment",{href:n,name:t.text??""});const r=Cn(n);return r?e.createNode("mention",{id:r,name:(t.text??"").replace(/^@/,"")}):e.applyMark("link",e.parseInline(t.tokens??[]),{href:n,title:t.title||null})}});function qs(t="",e){return[Bt.configure({heading:{levels:[1,2,3]},underline:!1,link:!1}),Fs.configure(Ds),Vt.configure({placeholder:t}),fs,Ot,Dt.configure({nested:!0}),Bs,xs,Un,ws,...e?[Es(e)]:[],Qr.configure({markedOptions:{breaks:!0}})]}const Ws=/^(\s*)([-*+]|\d+[.)])\s+\S/,Us=/^\s*(```|~~~)/,Gs=/^\s+(?![-*+>#]|\d+[.)]\s)\S/;function Zs(t){const e=[];let n=!1,r=!1;for(const s of t.split(`
82
82
  `)){if(Us.test(s)){n=!n,r=!1,e.push(s);continue}if(n){e.push(s);continue}if(Ws.test(s)){r=!0,e.push(s);continue}if(!s.trim()){r=!1,e.push(s);continue}if(r&&Gs.test(s)){e[e.length-1]=`${e[e.length-1]} ${s.trim()}`;continue}r=!1,e.push(s)}return e.join(`
83
- `)}function Vs(t){const e=$.c(12),{onFiles:n,disabled:r}=t,s=j(),i=E.useRef(null);let a;e[0]!==s?(a=s("markdownEditor.attachFile"),e[0]=s,e[1]=a):a=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>i.current?.click(),o=b.jsx(gn,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let u;e[4]!==r||e[5]!==a?(u=b.jsx(Pn,{type:"button",label:a,disabled:r,onClick:l,children:o}),e[4]=r,e[5]=a,e[6]=u):u=e[6];let c;e[7]!==n?(c=b.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:d=>{const f=Array.from(d.target.files??[]);d.target.value="",f.length>0&&n(f)}}),e[7]=n,e[8]=c):c=e[8];let h;return e[9]!==u||e[10]!==c?(h=b.jsxs(b.Fragment,{children:[u,c]}),e[9]=u,e[10]=c,e[11]=h):h=e[11],h}function Ks(t){const e=$.c(6),{pending:n}=t,r=j();if(n===0)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=b.jsx(Ye,{className:"size-3"}),e[0]=s):s=e[0];let i;e[1]!==n||e[2]!==r?(i=n===1?r("markdownEditor.uploading"):r("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==i?(a=b.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[s,i]}),e[4]=i,e[5]=a):a=e[5],a}const Qs=["outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-sm","[&_pre_code]:bg-transparent [&_pre_code]:p-0",Gt,"[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground","[&_table]:my-3 [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse","[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top","[&_th>p]:my-0 [&_td>p]:my-0","[&_ul[data-type=taskList]]:my-3 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0","[&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:items-start [&_li[data-type=taskItem]]:gap-2","[&_li[data-type=taskItem]>label]:mt-1 [&_li[data-type=taskItem]>label]:shrink-0","[&_li[data-type=taskItem]>div]:min-w-0 [&_li[data-type=taskItem]>div>p]:my-0"].join(" "),Xs=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Ys(t){const e=$.c(10),{editor:n,mentions:r}=t,s=r.items;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["markdown-editor-mentions"],e[0]=i):i=e[0];let a;e[1]!==s?(a=u=>{const{query:c}=u,h=c.trim().toLowerCase();return Promise.resolve(h?s.filter(d=>`${d.name} ${d.title??""}`.toLowerCase().includes(h)):s)},e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=u=>{const{range:c,item:h}=u;n.chain().focus().insertContentAt(c,[{type:"text",text:`@${h.name}`,marks:h.href?[{type:"link",attrs:{href:h.href}}]:void 0},{type:"text",text:" "}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==r.emptyLabel||e[7]!==a||e[8]!==l?(o=b.jsx(Kt,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:i,queryFn:a,emptyLabel:r.emptyLabel,renderItem:Js,onSelect:l}),e[5]=n,e[6]=r.emptyLabel,e[7]=a,e[8]=l,e[9]=o):o=e[9],o}function Js(t){return b.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[b.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&b.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function gi({defaultValue:t,onChange:e,placeholder:n,editable:r=!0,attachments:s=!0,mentions:i,inline:a=!1}){const l=Kn(s),[o]=E.useState(()=>new Ss),u=E.useRef(e);u.current=e;const c=Ft({extensions:qs(n,i?void 0:o),content:Zs(t),contentType:"markdown",editable:r,autofocus:a?"end":!1,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:q(Qs,!a&&"min-h-[200px] sm:min-h-[320px]",Xs)},handlePaste:l.handlePaste,handleDrop:l.handleDrop},onUpdate:({editor:h,transaction:d})=>{d.docChanged&&u.current(h.getMarkdown())}});return c?b.jsxs("div",{className:"flex flex-col",children:[b.jsx(Nn,{editor:c}),!i&&b.jsx(Ls,{store:o}),b.jsx(qt,{editor:c,className:q(a?"text-sm text-foreground":"text-base text-muted-foreground")}),r&&i&&b.jsx(Ys,{editor:c,mentions:i}),b.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[r&&i?.hint&&b.jsx("span",{children:i.hint}),r&&s&&b.jsx(Vs,{onFiles:h=>l.uploadInto(c.view,h,c.state.selection.to)}),b.jsx(Ks,{pending:l.pending})]})]}):null}export{Vs as A,Ss as M,Un as U,ws as a,Qr as b,Bs as c,xs as d,Re as e,Ls as f,Ks as g,gi as h,Es as m,Kn as u};
83
+ `)}function Vs(t){const e=$.c(12),{onFiles:n,disabled:r}=t,s=j(),i=E.useRef(null);let a;e[0]!==s?(a=s("markdownEditor.attachFile"),e[0]=s,e[1]=a):a=e[1];let l,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>i.current?.click(),o=b.jsx(gn,{size:16}),e[2]=l,e[3]=o):(l=e[2],o=e[3]);let u;e[4]!==r||e[5]!==a?(u=b.jsx(Pn,{type:"button",label:a,disabled:r,onClick:l,children:o}),e[4]=r,e[5]=a,e[6]=u):u=e[6];let c;e[7]!==n?(c=b.jsx("input",{ref:i,type:"file",multiple:!0,className:"hidden",onChange:d=>{const f=Array.from(d.target.files??[]);d.target.value="",f.length>0&&n(f)}}),e[7]=n,e[8]=c):c=e[8];let h;return e[9]!==u||e[10]!==c?(h=b.jsxs(b.Fragment,{children:[u,c]}),e[9]=u,e[10]=c,e[11]=h):h=e[11],h}function Ks(t){const e=$.c(6),{pending:n}=t,r=j();if(n===0)return null;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=b.jsx(Je,{className:"size-3"}),e[0]=s):s=e[0];let i;e[1]!==n||e[2]!==r?(i=n===1?r("markdownEditor.uploading"):r("markdownEditor.uploadingCount",{count:String(n)}),e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;return e[4]!==i?(a=b.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[s,i]}),e[4]=i,e[5]=a):a=e[5],a}const Qs=["outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0","[&_p]:my-3 [&_p]:leading-[1.5]","[&_h1]:my-3 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:leading-[1.5] [&_h1]:text-foreground","[&_h2]:my-3 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:leading-[1.5] [&_h2]:text-foreground","[&_h3]:my-3 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:leading-[1.5] [&_h3]:text-foreground","[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-5","[&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:my-0.5 [&_li>p]:my-0","[&_blockquote]:my-2 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]","[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-sm","[&_pre_code]:bg-transparent [&_pre_code]:p-0",Gt,"[&_hr]:my-4 [&_hr]:border-border","[&_strong]:font-semibold [&_strong]:text-foreground","[&_table]:my-3 [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse","[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top","[&_th>p]:my-0 [&_td>p]:my-0","[&_ul[data-type=taskList]]:my-3 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0","[&_li[data-type=taskItem]]:flex [&_li[data-type=taskItem]]:items-start [&_li[data-type=taskItem]]:gap-2","[&_li[data-type=taskItem]>label]:mt-1 [&_li[data-type=taskItem]>label]:shrink-0","[&_li[data-type=taskItem]>div]:min-w-0 [&_li[data-type=taskItem]>div>p]:my-0"].join(" "),Xs=["[&_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_p.is-editor-empty:first-child::before]:text-muted-foreground/50","[&_p.is-editor-empty:first-child::before]:float-left","[&_p.is-editor-empty:first-child::before]:h-0","[&_p.is-editor-empty:first-child::before]:pointer-events-none"].join(" ");function Js(t){const e=$.c(10),{editor:n,mentions:r}=t,s=r.items;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["markdown-editor-mentions"],e[0]=i):i=e[0];let a;e[1]!==s?(a=u=>{const{query:c}=u,h=c.trim().toLowerCase();return Promise.resolve(h?s.filter(d=>`${d.name} ${d.title??""}`.toLowerCase().includes(h)):s)},e[1]=s,e[2]=a):a=e[2];let l;e[3]!==n?(l=u=>{const{range:c,item:h}=u;n.chain().focus().insertContentAt(c,[{type:"text",text:`@${h.name}`,marks:h.href?[{type:"link",attrs:{href:h.href}}]:void 0},{type:"text",text:" "}]).run()},e[3]=n,e[4]=l):l=e[4];let o;return e[5]!==n||e[6]!==r.emptyLabel||e[7]!==a||e[8]!==l?(o=b.jsx(Kt,{editor:n,char:"@",pluginKey:"markdownMentionMenu",queryKey:i,queryFn:a,emptyLabel:r.emptyLabel,renderItem:Ys,onSelect:l}),e[5]=n,e[6]=r.emptyLabel,e[7]=a,e[8]=l,e[9]=o):o=e[9],o}function Ys(t){return b.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[b.jsx("span",{className:"truncate font-medium",children:t.title??t.name}),t.description&&b.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:t.description})]})}function gi({defaultValue:t,onChange:e,placeholder:n,editable:r=!0,attachments:s=!0,mentions:i,inline:a=!1}){const l=Kn(s),[o]=E.useState(()=>new Ss),u=E.useRef(e);u.current=e;const c=Ft({extensions:qs(n,i?void 0:o),content:Zs(t),contentType:"markdown",editable:r,autofocus:a?"end":!1,editorProps:{attributes:{role:"textbox","aria-label":n??"","aria-multiline":"true",class:q(Qs,!a&&"min-h-[200px] sm:min-h-[320px]",Xs)},handlePaste:l.handlePaste,handleDrop:l.handleDrop},onUpdate:({editor:h,transaction:d})=>{d.docChanged&&u.current(h.getMarkdown())}});return c?b.jsxs("div",{className:"flex flex-col",children:[b.jsx(Nn,{editor:c}),!i&&b.jsx(Ls,{store:o}),b.jsx(qt,{editor:c,className:q(a?"text-sm text-foreground":"text-base text-muted-foreground")}),r&&i&&b.jsx(Js,{editor:c,mentions:i}),b.jsxs("div",{className:"mt-4 flex items-center gap-2 text-xs text-muted-foreground empty:mt-0",children:[r&&i?.hint&&b.jsx("span",{children:i.hint}),r&&s&&b.jsx(Vs,{onFiles:h=>l.uploadInto(c.view,h,c.state.selection.to)}),b.jsx(Ks,{pending:l.pending})]})]}):null}export{Vs as A,Ss as M,Un as U,ws as a,Qr as b,Bs as c,xs as d,Re as e,Ls as f,Ks as g,gi as h,Es as m,Kn as u};
@@ -1 +1 @@
1
- import{c as w,au as te,aw as ne,b as Q,a2 as se,aa as ae,k as ie,j as s,l as oe,n as X,r as M,d as le,aK as F,H as W,P as z,a$ as re,B as ce}from"./index-DcU2uHG-.js";import{u as de}from"./use-mobile-BfmJV4wy.js";import{h as ue,c as he,u as me,m as fe}from"./use-sidebar-collapsed-BqLmDXCH.js";import{a as Z,R as pe,b as ge}from"./resizable-B1jyEV0m.js";import{c as xe,r as be,m as ye}from"./use-chat-layout-state-CqPKeLYn.js";import{N as je,m as q}from"./agent-icon-c0hRUHIU.js";import{c as G,T as U,a as Y}from"./tooltip-BqHx2R4U.js";import{T as A}from"./toolbar-icon-button-CTGjpqPD.js";import{a as Se}from"./use-project-scope-CGMALc0e.js";import{c as ve}from"./repository-binding-B-JblZ3B.js";function J(l,e){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0||a>=100?e:a}function Ce(l,e){const a=w.c(8);let o;a[0]!==e?(o=c=>J(c,e),a[0]=e,a[1]=o):o=a[1];const[t,i]=te(l,o);let n;a[2]!==e||a[3]!==t?(n=J(t,e),a[2]=e,a[3]=t,a[4]=n):n=a[4];let d;return a[5]!==i||a[6]!==n?(d=[n,i],a[5]=i,a[6]=n,a[7]=d):d=a[7],d}const Te=33;function Ne(){const l=w.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=ne.sidePanelWidth(),l[0]=e):e=l[0],Ce(e,Te)}function Le(l){const e=w.c(54),{actions:a,navigation:o}=l,t=Q(),{org:i}=se(),n=Se(),d=ve(n),c=ue(),{toggleSidebar:r}=he(),h=me(),u=ee(),m=ae();let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={select:we},e[0]=x):x=e[0];const f=ie(x),b=f?.mainView==="overview";let N;e[1]!==d?.title||e[2]!==t?(N=d?.title??t("common.loading"),e[1]=d?.title,e[2]=t,e[3]=N):N=e[3];const p=N;let C;e[4]!==b||e[5]!==f?.mainView||e[6]!==f?.pageTitle||e[7]!==m||e[8]!==p||e[9]!==n||e[10]!==t?(C=b?n?p:t("sidebar.navDestinations.home"):m&&f?.mainView==="files"?t("sidebar.navDestinations.context"):t(f?.pageTitle??"page.view"),e[4]=b,e[5]=f?.mainView,e[6]=f?.pageTitle,e[7]=m,e[8]=p,e[9]=n,e[10]=t,e[11]=C):C=e[11];const v=C,L=n??"";let g;e[12]!==i.slug||e[13]!==L?(g={to:"/$org/projects/$agentId",params:{org:i.slug,agentId:L}},e[12]=i.slug,e[13]=L,e[14]=g):g=e[14];const S=g;let y;if(e[15]!==c||e[16]!==b||e[17]!==i.slug||e[18]!==S||e[19]!==p||e[20]!==n||e[21]!==t||e[22]!==v){if(y=[],c){let T;e[24]!==t?(T=t("sidebar.navDestinations.settings"),e[24]=t,e[25]=T):T=e[25];let E;e[26]!==i.slug?(E={to:"/$org/settings/general",params:{org:i.slug}},e[26]=i.slug,e[27]=E):E=e[27];let $;e[28]!==T||e[29]!==E?($={key:"settings",label:T,link:E},e[28]=T,e[29]=E,e[30]=$):$=e[30],y.push($)}else if(n&&!b){let T;e[31]!==S||e[32]!==p?(T={key:"project",label:p,link:S},e[31]=S,e[32]=p,e[33]=T):T=e[33],y.push(T)}let R;e[34]!==v?(R={key:"page",label:v},e[34]=v,e[35]=R):R=e[35],y.push(R),e[15]=c,e[16]=b,e[17]=i.slug,e[18]=S,e[19]=p,e[20]=n,e[21]=t,e[22]=v,e[23]=y}else y=e[23];const j=m&&h;let P;e[36]!==u||e[37]!==j||e[38]!==t?(P=j&&u&&!u.threadless&&s.jsxs(G,{children:[s.jsx(U,{asChild:!0,children:s.jsx(A,{"aria-label":t(u.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":u.threadOpen,active:u.threadOpen,onClick:u.toggleThread,children:s.jsx(je,{size:16})})}),s.jsx(Y,{side:"bottom",children:t(u.threadOpen?"page.closeThread":"page.openThread")})]}),e[36]=u,e[37]=j,e[38]=t,e[39]=P):P=e[39];const D=P;let O;e[40]!==m||e[41]!==j||e[42]!==t||e[43]!==r?(O=m?s.jsxs(G,{children:[s.jsx(U,{asChild:!0,children:s.jsx(A,{className:oe(!j&&"md:hidden"),onClick:r,"aria-label":t("page.expandSidebar"),children:s.jsx(q,{size:16})})}),s.jsx(Y,{side:"bottom",children:t("page.expandSidebar")})]}):s.jsx(A,{className:"md:hidden",onClick:r,"aria-label":t("layouts.shellControls.toggleSidebar"),children:s.jsx(q,{size:16})}),e[40]=m,e[41]=j,e[42]=t,e[43]=r,e[44]=O):O=e[44];let _;e[45]!==D||e[46]!==O?(_=s.jsxs(s.Fragment,{children:[O,D]}),e[45]=D,e[46]=O,e[47]=_):_=e[47];let I;return e[48]!==a||e[49]!==y||e[50]!==o||e[51]!==i.name||e[52]!==_?(I=s.jsx(X.Header,{leading:_,breadcrumbs:y,scope:i.name,actions:a,navigation:o}),e[48]=a,e[49]=y,e[50]=o,e[51]=i.name,e[52]=_,e[53]=I):I=e[53],I}function we(l){return l.matches.findLast(Pe)?.staticData}function Pe(l){return l.staticData.pageTitle}const k="chat-layout-thread",B="chat-layout-content",H=M.createContext(null);function ze(){return K()}function ee(){return M.use(H)}function K(){const l=M.use(H);if(!l)throw new Error("ChatLayout regions require a ChatLayout");return l}function Oe(l){const e=w.c(23),{children:a,...o}=l,t=de(),i=le(),n=M.useRef(null),[d,c]=Ne(),{threadOpen:r,contentOpen:h}=o,u=xe(o),m=r&&h?d:u.side,x=100-m,f=g=>{const S=g.getLayout(),y=S[k],j=S[B];typeof y!="number"||typeof j!="number"||Math.abs(y-m)<.001&&Math.abs(j-x)<.001||g.setLayout({[k]:m,[B]:x})},b=be({visibility:o,threadVisibilityExplicit:o.threadVisibilityExplicit});let N;e[0]!==t||e[1]!==o||e[2]!==b?(N={...o,isMobile:t,mobileSurface:b},e[0]=t,e[1]=o,e[2]=b,e[3]=N):N=e[3];const p=N;let C;e[4]!==t||e[5]!==o||e[6]!==i||e[7]!==r||e[8]!==p?(C=!o.threadless&&s.jsx(fe,{open:t?p.mobileSurface==="chat":r,onToggle:()=>{t?i({to:".",search:g=>({...g,...ye(p.mobileSurface==="chat"?"main":"chat")}),replace:!0}):o.toggleThread()}}),e[4]=t,e[5]=o,e[6]=i,e[7]=r,e[8]=p,e[9]=C):C=e[9];let v;e[10]!==a||e[11]!==h||e[12]!==x||e[13]!==t||e[14]!==c||e[15]!==f||e[16]!==r||e[17]!==m?(v=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(pe,{ref:g=>{if(n.current=g,!g)return;let S=!0;return queueMicrotask(()=>{S&&f(g)}),()=>{S=!1,n.current===g&&(n.current=null)}},defaultLayout:{[k]:m,[B]:x},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(g,S)=>{const{isUserInteraction:y}=S;if(!y){const P=n.current;P&&f(P);return}const j=g[k];r&&h&&typeof j=="number"&&j>0&&j<100&&c(j)},children:a}),e[10]=a,e[11]=h,e[12]=x,e[13]=t,e[14]=c,e[15]=f,e[16]=r,e[17]=m,e[18]=v):v=e[18];let L;return e[19]!==C||e[20]!==v||e[21]!==p?(L=s.jsxs(H,{value:p,children:[C,v]}),e[19]=C,e[20]=v,e[21]=p,e[22]=L):L=e[22],L}function _e(l){const e=w.c(16),{children:a,topbar:o}=l,t=K();if(t.isMobile){let u;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==o?(u=t.mobileSurface==="chat"?s.jsxs(z,{variant:"plain","data-slot":"chat-layout-thread",children:[o,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=o,e[3]=u):u=e[3],u}const i=t.threadOpen?"":void 0;let n;e[4]!==a||e[5]!==t.threadOpen||e[6]!==o?(n=t.threadOpen&&s.jsxs(s.Fragment,{children:[o,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=o,e[7]=n):n=e[7];let d;e[8]!==n?(d=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(z,{"data-testid":"side-panel",children:n})}),e[8]=n,e[9]=d):d=e[9];let c;e[10]!==i||e[11]!==d?(c=s.jsx(Z,{id:k,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":i,className:"min-w-0 overflow-hidden bg-sidebar",children:d}),e[10]=i,e[11]=d,e[12]=c):c=e[12];let r;e[13]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ge,{className:"bg-sidebar"}),e[13]=r):r=e[13];let h;return e[14]!==c?(h=s.jsxs(s.Fragment,{children:[c,r]}),e[14]=c,e[15]=h):h=e[15],h}function Ee({children:l,routeId:e}){return l}function V(l){const e=w.c(23),{children:a,actions:o,drawer:t,aside:i}=l,n=K();if(n.isMobile&&n.mobileSurface!=="main")return null;const d=n.isMobile?"plain":"card";let c;e[0]!==o||e[1]!==n.contentNavigation?(c=s.jsx(Le,{navigation:n.contentNavigation,actions:o}),e[0]=o,e[1]=n.contentNavigation,e[2]=c):c=e[2];let r;e[3]!==a||e[4]!==n.contentKey?(r=s.jsx(F,{children:s.jsx(Ee,{routeId:n.contentKey,children:a})}),e[3]=a,e[4]=n.contentKey,e[5]=r):r=e[5];let h;e[6]!==n.contentKey||e[7]!==r?(h=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(W,{children:r},n.contentKey)}),e[6]=n.contentKey,e[7]=r,e[8]=h):h=e[8];let u;e[9]!==t||e[10]!==h?(u=s.jsxs(z.Content,{children:[h,t]}),e[9]=t,e[10]=h,e[11]=u):u=e[11];let m;e[12]!==c||e[13]!==u?(m=s.jsxs(X.Breadcrumbs.Provider,{children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14];let x;e[15]!==d||e[16]!==m?(x=s.jsx(z,{"data-testid":"main-panel",variant:d,children:m}),e[15]=d,e[16]=m,e[17]=x):x=e[17];const f=x;let b;return e[18]!==i||e[19]!==n.contentOpen||e[20]!==n.isMobile||e[21]!==f?(b=n.isMobile?f:s.jsx(Z,{id:B,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsxs("div",{className:"flex h-full min-h-0",children:[s.jsx("div",{className:"h-full min-h-0 min-w-0 flex-1 p-0.5",children:f}),i&&s.jsx("div",{className:"h-full min-h-0 w-[42%] min-w-80 shrink-0 p-0.5",children:s.jsx(z,{"data-testid":"aside-panel",children:s.jsx(W,{children:s.jsx(F,{children:i})},M.isValidElement(i)?i.key??void 0:void 0)})})]})}),e[18]=i,e[19]=n.contentOpen,e[20]=n.isMobile,e[21]=f,e[22]=b):b=e[22],b}function ke(){const l=w.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(re,{})}),l[0]=e):e=l[0],e}function Me(l){const e=w.c(18),{error:a,reset:o}=l,t=Q();let i;e[0]!==t?(i=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=i):i=e[1];let n;e[2]!==i?(n=s.jsx("h2",{className:"text-lg font-medium",children:i}),e[2]=i,e[3]=n):n=e[3];let d;e[4]!==a.message||e[5]!==t?(d=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=d):d=e[6];let c;e[7]!==d?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=c):c=e[8];let r;e[9]!==t?(r=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=r):r=e[10];let h;e[11]!==o||e[12]!==r?(h=s.jsx(ce,{variant:"outline",onClick:o,children:r}),e[11]=o,e[12]=r,e[13]=h):h=e[13];let u;return e[14]!==n||e[15]!==c||e[16]!==h?(u=s.jsx(V,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[n,c,h]})}),e[14]=n,e[15]=c,e[16]=h,e[17]=u):u=e[17],u}const Ie=Object.assign(Oe,{Thread:_e,Content:V}),qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:Ie,ChatLayoutError:Me,ChatLayoutPending:ke,useChatLayout:ze,useOptionalChatLayout:ee},Symbol.toStringTag,{value:"Module"}));export{Ie as C,Le as R,qe as i,ze as u};
1
+ import{c as w,au as te,aw as ne,b as Q,a2 as se,aa as ae,k as ie,j as s,l as oe,n as X,r as M,d as le,aK as F,H as W,P as z,aY as re,B as ce}from"./index-DQaJBLJ-.js";import{u as de}from"./use-mobile-exvgjs5E.js";import{h as ue,c as he,u as me,m as fe}from"./use-sidebar-collapsed-hUfsznLr.js";import{a as Z,R as pe,b as ge}from"./resizable-rv6DYDSR.js";import{c as xe,r as be,m as ye}from"./use-chat-layout-state-CrK3t-li.js";import{O as je,m as q}from"./agent-icon-BLy2WH4s.js";import{c as G,T as U,a as Y}from"./tooltip-CT8p-4e_.js";import{T as A}from"./toolbar-icon-button-BQvi-WW6.js";import{a as Se}from"./use-project-scope-0viRZIAS.js";import{c as ve}from"./repository-binding-WIxmR2C2.js";function J(l,e){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0||a>=100?e:a}function Ce(l,e){const a=w.c(8);let o;a[0]!==e?(o=c=>J(c,e),a[0]=e,a[1]=o):o=a[1];const[t,i]=te(l,o);let n;a[2]!==e||a[3]!==t?(n=J(t,e),a[2]=e,a[3]=t,a[4]=n):n=a[4];let d;return a[5]!==i||a[6]!==n?(d=[n,i],a[5]=i,a[6]=n,a[7]=d):d=a[7],d}const Te=33;function Le(){const l=w.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=ne.sidePanelWidth(),l[0]=e):e=l[0],Ce(e,Te)}function Ne(l){const e=w.c(54),{actions:a,navigation:o}=l,t=Q(),{org:i}=se(),n=Se(),d=ve(n),c=ue(),{toggleSidebar:r}=he(),h=me(),u=ee(),m=ae();let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={select:we},e[0]=x):x=e[0];const f=ie(x),b=f?.mainView==="overview";let L;e[1]!==d?.title||e[2]!==t?(L=d?.title??t("common.loading"),e[1]=d?.title,e[2]=t,e[3]=L):L=e[3];const p=L;let C;e[4]!==b||e[5]!==f?.mainView||e[6]!==f?.pageTitle||e[7]!==m||e[8]!==p||e[9]!==n||e[10]!==t?(C=b?n?p:t("sidebar.navDestinations.home"):m&&f?.mainView==="files"?t("sidebar.navDestinations.context"):t(f?.pageTitle??"page.view"),e[4]=b,e[5]=f?.mainView,e[6]=f?.pageTitle,e[7]=m,e[8]=p,e[9]=n,e[10]=t,e[11]=C):C=e[11];const v=C,N=n??"";let g;e[12]!==i.slug||e[13]!==N?(g={to:"/$org/projects/$agentId",params:{org:i.slug,agentId:N}},e[12]=i.slug,e[13]=N,e[14]=g):g=e[14];const S=g;let y;if(e[15]!==c||e[16]!==b||e[17]!==i.slug||e[18]!==S||e[19]!==p||e[20]!==n||e[21]!==t||e[22]!==v){if(y=[],c){let T;e[24]!==t?(T=t("sidebar.navDestinations.settings"),e[24]=t,e[25]=T):T=e[25];let E;e[26]!==i.slug?(E={to:"/$org/settings/general",params:{org:i.slug}},e[26]=i.slug,e[27]=E):E=e[27];let B;e[28]!==T||e[29]!==E?(B={key:"settings",label:T,link:E},e[28]=T,e[29]=E,e[30]=B):B=e[30],y.push(B)}else if(n&&!b){let T;e[31]!==S||e[32]!==p?(T={key:"project",label:p,link:S},e[31]=S,e[32]=p,e[33]=T):T=e[33],y.push(T)}let R;e[34]!==v?(R={key:"page",label:v},e[34]=v,e[35]=R):R=e[35],y.push(R),e[15]=c,e[16]=b,e[17]=i.slug,e[18]=S,e[19]=p,e[20]=n,e[21]=t,e[22]=v,e[23]=y}else y=e[23];const j=m&&h;let P;e[36]!==u||e[37]!==j||e[38]!==t?(P=j&&u&&!u.threadless&&s.jsxs(G,{children:[s.jsx(U,{asChild:!0,children:s.jsx(A,{"aria-label":t(u.threadOpen?"page.closeThread":"page.openThread"),"aria-pressed":u.threadOpen,active:u.threadOpen,onClick:u.toggleThread,children:s.jsx(je,{size:16})})}),s.jsx(Y,{side:"bottom",children:t(u.threadOpen?"page.closeThread":"page.openThread")})]}),e[36]=u,e[37]=j,e[38]=t,e[39]=P):P=e[39];const D=P;let O;e[40]!==m||e[41]!==j||e[42]!==t||e[43]!==r?(O=m?s.jsxs(G,{children:[s.jsx(U,{asChild:!0,children:s.jsx(A,{className:oe(!j&&"md:hidden"),onClick:r,"aria-label":t("page.expandSidebar"),children:s.jsx(q,{size:16})})}),s.jsx(Y,{side:"bottom",children:t("page.expandSidebar")})]}):s.jsx(A,{className:"md:hidden",onClick:r,"aria-label":t("layouts.shellControls.toggleSidebar"),children:s.jsx(q,{size:16})}),e[40]=m,e[41]=j,e[42]=t,e[43]=r,e[44]=O):O=e[44];let _;e[45]!==D||e[46]!==O?(_=s.jsxs(s.Fragment,{children:[O,D]}),e[45]=D,e[46]=O,e[47]=_):_=e[47];let I;return e[48]!==a||e[49]!==y||e[50]!==o||e[51]!==i.name||e[52]!==_?(I=s.jsx(X.Header,{leading:_,breadcrumbs:y,scope:i.name,actions:a,navigation:o}),e[48]=a,e[49]=y,e[50]=o,e[51]=i.name,e[52]=_,e[53]=I):I=e[53],I}function we(l){return l.matches.findLast(Pe)?.staticData}function Pe(l){return l.staticData.pageTitle}const k="chat-layout-thread",$="chat-layout-content",H=M.createContext(null);function ze(){return K()}function ee(){return M.use(H)}function K(){const l=M.use(H);if(!l)throw new Error("ChatLayout regions require a ChatLayout");return l}function Oe(l){const e=w.c(23),{children:a,...o}=l,t=de(),i=le(),n=M.useRef(null),[d,c]=Le(),{threadOpen:r,contentOpen:h}=o,u=xe(o),m=r&&h?d:u.side,x=100-m,f=g=>{const S=g.getLayout(),y=S[k],j=S[$];typeof y!="number"||typeof j!="number"||Math.abs(y-m)<.001&&Math.abs(j-x)<.001||g.setLayout({[k]:m,[$]:x})},b=be({visibility:o,threadVisibilityExplicit:o.threadVisibilityExplicit});let L;e[0]!==t||e[1]!==o||e[2]!==b?(L={...o,isMobile:t,mobileSurface:b},e[0]=t,e[1]=o,e[2]=b,e[3]=L):L=e[3];const p=L;let C;e[4]!==t||e[5]!==o||e[6]!==i||e[7]!==r||e[8]!==p?(C=!o.threadless&&s.jsx(fe,{open:t?p.mobileSurface==="chat":r,onToggle:()=>{t?i({to:".",search:g=>({...g,...ye(p.mobileSurface==="chat"?"main":"chat")}),replace:!0}):o.toggleThread()}}),e[4]=t,e[5]=o,e[6]=i,e[7]=r,e[8]=p,e[9]=C):C=e[9];let v;e[10]!==a||e[11]!==h||e[12]!==x||e[13]!==t||e[14]!==c||e[15]!==f||e[16]!==r||e[17]!==m?(v=t?s.jsx("div",{"data-slot":"chat-layout",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",children:a}):s.jsx(pe,{ref:g=>{if(n.current=g,!g)return;let S=!0;return queueMicrotask(()=>{S&&f(g)}),()=>{S=!1,n.current===g&&(n.current=null)}},defaultLayout:{[k]:m,[$]:x},orientation:"horizontal","data-slot":"chat-layout",className:"flex-1 min-h-0 pt-1 pb-1 pr-1 pl-0 [&>[data-chat-layout-panel-open]]:!min-w-[320px]",style:{overflow:"visible"},onLayoutChanged:(g,S)=>{const{isUserInteraction:y}=S;if(!y){const P=n.current;P&&f(P);return}const j=g[k];r&&h&&typeof j=="number"&&j>0&&j<100&&c(j)},children:a}),e[10]=a,e[11]=h,e[12]=x,e[13]=t,e[14]=c,e[15]=f,e[16]=r,e[17]=m,e[18]=v):v=e[18];let N;return e[19]!==C||e[20]!==v||e[21]!==p?(N=s.jsxs(H,{value:p,children:[C,v]}),e[19]=C,e[20]=v,e[21]=p,e[22]=N):N=e[22],N}function _e(l){const e=w.c(16),{children:a,topbar:o}=l,t=K();if(t.isMobile){let u;return e[0]!==a||e[1]!==t.mobileSurface||e[2]!==o?(u=t.mobileSurface==="chat"?s.jsxs(z,{variant:"plain","data-slot":"chat-layout-thread",children:[o,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}):null,e[0]=a,e[1]=t.mobileSurface,e[2]=o,e[3]=u):u=e[3],u}const i=t.threadOpen?"":void 0;let n;e[4]!==a||e[5]!==t.threadOpen||e[6]!==o?(n=t.threadOpen&&s.jsxs(s.Fragment,{children:[o,s.jsx(z.Content,{"data-testid":"chat-panel",children:a})]}),e[4]=a,e[5]=t.threadOpen,e[6]=o,e[7]=n):n=e[7];let d;e[8]!==n?(d=s.jsx("div",{className:"h-full min-h-0 p-0.5",children:s.jsx(z,{"data-testid":"side-panel",children:n})}),e[8]=n,e[9]=d):d=e[9];let c;e[10]!==i||e[11]!==d?(c=s.jsx(Z,{id:k,defaultSize:"33%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":i,className:"min-w-0 overflow-hidden bg-sidebar",children:d}),e[10]=i,e[11]=d,e[12]=c):c=e[12];let r;e[13]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(ge,{className:"bg-sidebar"}),e[13]=r):r=e[13];let h;return e[14]!==c?(h=s.jsxs(s.Fragment,{children:[c,r]}),e[14]=c,e[15]=h):h=e[15],h}function Ee({children:l,routeId:e}){return l}function V(l){const e=w.c(23),{children:a,actions:o,drawer:t,aside:i}=l,n=K();if(n.isMobile&&n.mobileSurface!=="main")return null;const d=n.isMobile?"plain":"card";let c;e[0]!==o||e[1]!==n.contentNavigation?(c=s.jsx(Ne,{navigation:n.contentNavigation,actions:o}),e[0]=o,e[1]=n.contentNavigation,e[2]=c):c=e[2];let r;e[3]!==a||e[4]!==n.contentKey?(r=s.jsx(F,{children:s.jsx(Ee,{routeId:n.contentKey,children:a})}),e[3]=a,e[4]=n.contentKey,e[5]=r):r=e[5];let h;e[6]!==n.contentKey||e[7]!==r?(h=s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(W,{children:r},n.contentKey)}),e[6]=n.contentKey,e[7]=r,e[8]=h):h=e[8];let u;e[9]!==t||e[10]!==h?(u=s.jsxs(z.Content,{children:[h,t]}),e[9]=t,e[10]=h,e[11]=u):u=e[11];let m;e[12]!==c||e[13]!==u?(m=s.jsxs(X.Breadcrumbs.Provider,{children:[c,u]}),e[12]=c,e[13]=u,e[14]=m):m=e[14];let x;e[15]!==d||e[16]!==m?(x=s.jsx(z,{"data-testid":"main-panel",variant:d,children:m}),e[15]=d,e[16]=m,e[17]=x):x=e[17];const f=x;let b;return e[18]!==i||e[19]!==n.contentOpen||e[20]!==n.isMobile||e[21]!==f?(b=n.isMobile?f:s.jsx(Z,{id:$,defaultSize:"67%",minSize:"20%",collapsible:!0,collapsedSize:"0%","data-chat-layout-panel-open":n.contentOpen?"":void 0,className:"min-w-0 overflow-hidden bg-sidebar",children:s.jsxs("div",{className:"flex h-full min-h-0",children:[s.jsx("div",{className:"h-full min-h-0 min-w-0 flex-1 p-0.5",children:f}),i&&s.jsx("div",{className:"h-full min-h-0 w-[42%] min-w-80 shrink-0 p-0.5",children:s.jsx(z,{"data-testid":"aside-panel",children:s.jsx(W,{children:s.jsx(F,{children:i})},M.isValidElement(i)?i.key??void 0:void 0)})})]})}),e[18]=i,e[19]=n.contentOpen,e[20]=n.isMobile,e[21]=f,e[22]=b):b=e[22],b}function ke(){const l=w.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(re,{})}),l[0]=e):e=l[0],e}function Me(l){const e=w.c(18),{error:a,reset:o}=l,t=Q();let i;e[0]!==t?(i=t("common.errorBoundary.somethingWentWrong"),e[0]=t,e[1]=i):i=e[1];let n;e[2]!==i?(n=s.jsx("h2",{className:"text-lg font-medium",children:i}),e[2]=i,e[3]=n):n=e[3];let d;e[4]!==a.message||e[5]!==t?(d=a.message||t("common.errorBoundary.unexpectedError"),e[4]=a.message,e[5]=t,e[6]=d):d=e[6];let c;e[7]!==d?(c=s.jsx("p",{className:"max-w-lg whitespace-pre-wrap text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=c):c=e[8];let r;e[9]!==t?(r=t("common.errorBoundary.tryAgain"),e[9]=t,e[10]=r):r=e[10];let h;e[11]!==o||e[12]!==r?(h=s.jsx(ce,{variant:"outline",onClick:o,children:r}),e[11]=o,e[12]=r,e[13]=h):h=e[13];let u;return e[14]!==n||e[15]!==c||e[16]!==h?(u=s.jsx(V,{children:s.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-4 p-6 text-center",children:[n,c,h]})}),e[14]=n,e[15]=c,e[16]=h,e[17]=u):u=e[17],u}const Ie=Object.assign(Oe,{Thread:_e,Content:V}),qe=Object.freeze(Object.defineProperty({__proto__:null,ChatLayout:Ie,ChatLayoutError:Me,ChatLayoutPending:ke,useChatLayout:ze,useOptionalChatLayout:ee},Symbol.toStringTag,{value:"Module"}));export{Ie as C,Ne as R,qe as i,ze as u};
@@ -1,2 +1,2 @@
1
- import{a2 as X,o as Be,r as k,j as n,K as W,b9 as ie,c as F,aL as Oe,l as H,H as Ae,b as Z,t as ce,h as ue,s as be,v as ye,q as ve,D as Se,d as je,y as de,aM as Ie,B as Ee}from"./index-DcU2uHG-.js";import{u as we,d as $e,b as Ne,f as Fe,T as He,A as ze,i as Ke,c as qe,j as Ge,k as Ue,p as Qe,L as Ve}from"./chat-context-BnuwMOfj.js";import{b as Ye}from"./sandbox-url-D3mC8qhT.js";import{a as Je}from"./repository-binding-B-JblZ3B.js";import{e as We}from"./backoff-CrEUbyZT.js";import{n as Xe}from"./ArrowUp-Cq3iZIwL.js";import{s as Ze,g as Ce,d as et}from"./tool-namespace-FeAXQzXg.js";import{b as se,T as tt,a as st,c as nt}from"./tooltip-BqHx2R4U.js";import{d as rt,b as at,a as ot,D as lt}from"./drawer-CEiS53oX.js";import{C as it}from"./collection-search-C0nHL4Zi.js";import{u as ct}from"./use-mobile-BfmJV4wy.js";import{u as ut}from"./use-mcp-client-ZokR8_74.js";import{u as dt,g as ft}from"./use-mcp-prompts-JJb6q8dH.js";import{c as mt,P as pt}from"./usage-stats-DcyLnEOC.js";import{T as ht,d as gt,c as xt,e as bt,H as yt}from"./input-pg_Munw1.js";import{u as vt,a as St,S as jt,M as fe}from"./pair-Cn70Tm81.js";import{a as Et}from"./use-panel-navigate-K8ACrPML.js";import{u as wt}from"./thread-intent-DlbBEzNn.js";import{N as Nt}from"./index-De44zW_k.js";import{i as Ct}from"./LinkBroken01-ZRquEJUl.js";import{e as Te}from"./agent-icon-c0hRUHIU.js";import{e as Tt}from"./use-decopilot-events-TumByBkr.js";import{u as kt}from"./use-deco-credits-orVqTX6I.js";import{F as Pt}from"./feature-paywall-DINMFUUx.js";import{i as Dt}from"./AlertCircle-xI8XX-bi.js";function me(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const Rt={phase:null,lifecycle:{phase:"idle"},status:{state:"running"},branch:{kind:"unknown"},notFound:!1,scripts:[],activeProcesses:[],getBuffer:()=>"",hasData:()=>!1,subscribeChunks:()=>()=>{},subscribeReload:()=>()=>{}},ke=k.createContext(Rt),pe=16384;class _t{data="";append(e){this.data+=e,this.data.length>pe&&(this.data=this.data.slice(this.data.length-pe))}get(){return this.data}clear(){this.data=""}}const Lt=1e3,Mt=3e4,Bt=3e3,he=["lifecycle","status","tasks","scripts","branch","reload","file-changed"],ge="log";function Ot(t){if(!t)return null;try{return new URL("/_sandbox/events",t).href}catch{return null}}function At(t){return t===404}async function It(t){try{const e=await fetch(t,{headers:{Accept:"text/event-stream"},cache:"no-store",signal:AbortSignal.timeout(Bt)});return await e.body?.cancel().catch(()=>{}),At(e.status)}catch{return!1}}function Ds({virtualMcpId:t,branch:e,previewUrl:r=null,enabled:o=!0,children:s}){const{org:a}=X(),l=Be(),i=we()?.taskId??null,[c,u]=k.useState(null),[d,f]=k.useState({phase:"idle"}),[m,S]=k.useState({state:"running"}),[j,E]=k.useState({kind:"unknown"}),[x,b]=k.useState(!1),[C,y]=k.useState([]),[P,g]=k.useState([]),[,D]=k.useState(0),T=k.useRef(new Map),B=k.useRef(new Set),M=k.useRef(new Set),L=k.useRef(null),_=Ot(r),p=Je(t)?.metadata?.runtime?.selected==="deno",w=v=>{let N=T.current.get(v);return N||(N=new _t,T.current.set(v,N)),N};k.useEffect(()=>{if(u(null),f({phase:"idle"}),S({state:"running"}),E({kind:"unknown"}),L.current=null,b(!1),y([]),g([]),T.current.clear(),!t||!e||!o)return;const v=Ye({orgSlug:a.slug,virtualMcpId:t,branch:e,threadId:i??null},"events");let N=!1,$=0,Y=null,q=null,G=null,K=null,z=null,J=null;const Le=R=>{try{const O=JSON.parse(R.data);u(O),O.kind!=="failed"&&(b(!1),$=0),O.kind==="ready"&&oe()}catch(O){console.warn("[vm-events] bad phase payload",O)}},ne=()=>{b(!0),u(null),f({phase:"idle"}),S({state:"running"}),E({kind:"unknown"}),y([]),g([]),T.current.clear()},re=R=>{try{const O=JSON.parse(R.data);if(typeof O.data!="string")return;$=0;const I=O.data.replace(/\r?\n/g,`\r
1
+ import{a2 as X,o as Be,r as k,j as n,K as W,db as ie,c as F,aL as Oe,l as H,H as Ae,b as Z,t as ce,h as ue,s as be,v as ye,q as ve,D as Se,d as je,y as de,aM as Ie,B as Ee}from"./index-DQaJBLJ-.js";import{u as we,d as $e,b as Ne,f as Fe,T as He,A as ze,i as Ke,c as qe,j as Ge,k as Ue,p as Qe,L as Ve}from"./chat-context-NcP7iS0u.js";import{b as Ye}from"./sandbox-url-D3mC8qhT.js";import{a as Je}from"./repository-binding-WIxmR2C2.js";import{e as We}from"./backoff-CrEUbyZT.js";import{n as Xe}from"./ArrowUp-CDPrL6Uz.js";import{s as Ze,g as Ce,d as et}from"./tool-namespace-_uAlvwp8.js";import{b as se,T as tt,a as st,c as nt}from"./tooltip-CT8p-4e_.js";import{d as rt,b as at,a as ot,D as lt}from"./drawer-CER6tItd.js";import{C as it}from"./collection-search-C00LN-O5.js";import{u as ct}from"./use-mobile-exvgjs5E.js";import{u as ut}from"./use-mcp-client-BjCYOtMv.js";import{u as dt,g as ft}from"./use-mcp-prompts-D4ntfVw2.js";import{c as mt,P as pt}from"./usage-stats-tSDvCF_c.js";import{T as ht,d as gt,c as xt,e as bt,H as yt}from"./input-DQpuKkGH.js";import{u as vt,a as St,S as jt,M as fe}from"./pair-u6RslQ29.js";import{a as Et}from"./use-panel-navigate-D1HcWbMf.js";import{u as wt}from"./thread-intent-D02hOLlA.js";import{N as Nt}from"./index-hUmTzopE.js";import{i as Ct}from"./LinkBroken01-h_HqMIlK.js";import{e as Te}from"./agent-icon-BLy2WH4s.js";import{e as Tt}from"./use-decopilot-events-HymesIOH.js";import{u as kt}from"./use-deco-credits-Dcf7REFq.js";import{F as Pt}from"./feature-paywall-DruRkOvJ.js";import{i as Dt}from"./AlertCircle-BEMVsPah.js";function me(t){return t==="installing"||t==="install-failed"||t==="starting"||t==="start-failed"||t==="running"||t==="crashed"}const Rt={phase:null,lifecycle:{phase:"idle"},status:{state:"running"},branch:{kind:"unknown"},notFound:!1,scripts:[],activeProcesses:[],getBuffer:()=>"",hasData:()=>!1,subscribeChunks:()=>()=>{},subscribeReload:()=>()=>{}},ke=k.createContext(Rt),pe=16384;class _t{data="";append(e){this.data+=e,this.data.length>pe&&(this.data=this.data.slice(this.data.length-pe))}get(){return this.data}clear(){this.data=""}}const Lt=1e3,Mt=3e4,Bt=3e3,he=["lifecycle","status","tasks","scripts","branch","reload","file-changed"],ge="log";function Ot(t){if(!t)return null;try{return new URL("/_sandbox/events",t).href}catch{return null}}function At(t){return t===404}async function It(t){try{const e=await fetch(t,{headers:{Accept:"text/event-stream"},cache:"no-store",signal:AbortSignal.timeout(Bt)});return await e.body?.cancel().catch(()=>{}),At(e.status)}catch{return!1}}function Ds({virtualMcpId:t,branch:e,previewUrl:r=null,enabled:o=!0,children:s}){const{org:a}=X(),l=Be(),i=we()?.taskId??null,[c,u]=k.useState(null),[d,f]=k.useState({phase:"idle"}),[m,S]=k.useState({state:"running"}),[j,E]=k.useState({kind:"unknown"}),[x,b]=k.useState(!1),[C,y]=k.useState([]),[P,g]=k.useState([]),[,D]=k.useState(0),T=k.useRef(new Map),B=k.useRef(new Set),M=k.useRef(new Set),L=k.useRef(null),_=Ot(r),p=Je(t)?.metadata?.runtime?.selected==="deno",w=v=>{let N=T.current.get(v);return N||(N=new _t,T.current.set(v,N)),N};k.useEffect(()=>{if(u(null),f({phase:"idle"}),S({state:"running"}),E({kind:"unknown"}),L.current=null,b(!1),y([]),g([]),T.current.clear(),!t||!e||!o)return;const v=Ye({orgSlug:a.slug,virtualMcpId:t,branch:e,threadId:i??null},"events");let N=!1,$=0,Y=null,q=null,G=null,K=null,z=null,J=null;const Le=R=>{try{const O=JSON.parse(R.data);u(O),O.kind!=="failed"&&(b(!1),$=0),O.kind==="ready"&&oe()}catch(O){console.warn("[vm-events] bad phase payload",O)}},ne=()=>{b(!0),u(null),f({phase:"idle"}),S({state:"running"}),E({kind:"unknown"}),y([]),g([]),T.current.clear()},re=R=>{try{const O=JSON.parse(R.data);if(typeof O.data!="string")return;$=0;const I=O.data.replace(/\r?\n/g,`\r
2
2
  `);w(O.source).append(I);for(const A of B.current)try{A(O.source,I)}catch{}D(A=>A+1)}catch{}},ae=R=>{const O=R.type;try{const I=JSON.parse(R.data);switch($=0,O){case"lifecycle":{const A=I;f(A.state);const U=`${a.slug}/${t}/${e}`;if(me(A.state.phase)&&!(J&&me(J))){ie(l,a.id);const V=W.decofile(U);l.getQueryData(V)===void 0&&l.invalidateQueries({queryKey:V})}A.state.phase==="running"&&J!=="running"&&(ie(l,a.id),l.invalidateQueries({queryKey:W.decofile(U)}),l.invalidateQueries({queryKey:W.liveMeta(a.slug,t,e)})),J=A.state.phase;const Q=A.state.phase==="running"?A.state.port:null,te=L.current;if(L.current=Q,te!==null&&Q!==null&&te!==Q)for(const V of M.current)try{V()}catch{}return}case"status":S(I);return;case"tasks":{const U=I.active.map(Q=>Q.logName??"").filter(Boolean);g(U);return}case"scripts":y(I.scripts);return;case"branch":{const A=I.meta;E(A);return}case"reload":for(const A of M.current)try{A()}catch{}return;case"file-changed":{const{path:A}=I,U=`${a.slug}/${t}/${e}`;if(A.startsWith(".deco/")||A.includes("/.deco/")){if(!(J==="running"))return;G&&clearTimeout(G),G=setTimeout(()=>{if(G=null,l.invalidateQueries({queryKey:W.decofile(U)}),p)for(const V of M.current)try{V()}catch{}},500)}else q&&clearTimeout(q),q=setTimeout(()=>{q=null,l.invalidateQueries({queryKey:W.liveMeta(a.slug,t,e)})},1e3);return}}}catch{}};function ee(){if(N)return;const R=new EventSource(v);K=R,R.onopen=()=>{},R.onerror=()=>{K===R&&R.readyState===EventSource.CLOSED&&le("studio")},R.addEventListener("phase",Le),R.addEventListener("gone",ne),R.addEventListener(ge,re);for(const O of he)R.addEventListener(O,ae)}function oe(){if(N||!_||z)return;const R=new EventSource(_);z=R;let O=!1;R.onopen=()=>{if(N||z!==R)return;O=!0,$=0;const I=K;K=null,I?.close()},R.onerror=()=>{z===R&&R.readyState===EventSource.CLOSED&&Me(R,O)},R.addEventListener(ge,re);for(const I of he)R.addEventListener(I,ae)}async function Me(R,O){const I=_?await It(_):!1;if(!(N||z!==R)){if(R.close(),z=null,I){ne(),K||ee();return}O&&le("direct")}}function le(R){if(N||Y)return;const O=We(Mt,Lt,$,2,0);$++,Y=setTimeout(()=>{if(Y=null,!N){if(R==="direct"){z?.close(),z=null,oe();return}K?.close(),K=null,ee()}},O)}return ee(),()=>{N=!0,K?.close(),z?.close(),Y&&clearTimeout(Y),q&&clearTimeout(q),G&&clearTimeout(G)}},[t,e,a.slug,a.id,o,i,_,l,p]);const h={phase:c,lifecycle:d,status:m,branch:j,notFound:x,scripts:C,activeProcesses:P,getBuffer:v=>T.current.get(v)?.get()??"",hasData:v=>(T.current.get(v)?.get().length??0)>0,subscribeChunks:v=>(B.current.add(v),()=>{B.current.delete(v)}),subscribeReload:v=>(M.current.add(v),()=>{M.current.delete(v)})};return n.jsx(ke,{value:h,children:s})}function Pe(){return k.use(ke)}function Rs(t){const{subscribeChunks:e}=Pe(),r=k.useRef(t);r.current=t,k.useEffect(()=>e((a,l)=>{r.current?.(a,l)}),[e])}function _s(t){const{subscribeReload:e}=Pe(),r=k.useRef(t);r.current=t,k.useEffect(()=>e(()=>{r.current?.()}),[e])}const xe=3,De="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",$t="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function Re(t){const e=F.c(46),{item:r,onSelect:o,isLoading:s,isDisabled:a,variant:l}=t,i=l===void 0?"pill":l,{prompt:c}=r;let u;if(e[0]!==c._meta||e[1]!==c.name||e[2]!==c.title){const T=Ce(c._meta);u=c.title??et(c.name,T),e[0]=c._meta,e[1]=c.name,e[2]=c.title,e[3]=u}else u=e[3];const d=u,f=c.description||null;if(i==="card"){let T;e[4]!==o||e[5]!==c?(T=()=>o(c),e[4]=o,e[5]=c,e[6]=T):T=e[6];const B=a||s,M=s&&"bg-accent/40",L=(a||s)&&"cursor-not-allowed opacity-50";let _;e[7]!==M||e[8]!==L?(_=H($t,"hover:bg-accent text-foreground",M,L),e[7]=M,e[8]=L,e[9]=_):_=e[9];let p;e[10]!==d?(p=n.jsx("span",{className:"font-medium truncate capitalize",children:d}),e[10]=d,e[11]=p):p=e[11];let w;e[12]!==s?(w=s&&n.jsx(ue,{size:"xs"}),e[12]=s,e[13]=w):w=e[13];let h;e[14]!==p||e[15]!==w?(h=n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,w]}),e[14]=p,e[15]=w,e[16]=h):h=e[16];let v;e[17]!==f?(v=f&&n.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:f}),e[17]=f,e[18]=v):v=e[18];let N;return e[19]!==h||e[20]!==v||e[21]!==T||e[22]!==B||e[23]!==_?(N=n.jsxs("button",{type:"button",onClick:T,disabled:B,className:_,children:[h,v]}),e[19]=h,e[20]=v,e[21]=T,e[22]=B,e[23]=_,e[24]=N):N=e[24],N}let m;e[25]!==o||e[26]!==c?(m=()=>o(c),e[25]=o,e[26]=c,e[27]=m):m=e[27];const S=a||s,j=s&&"bg-muted/50",E=(a||s)&&"cursor-not-allowed opacity-50";let x;e[28]!==j||e[29]!==E?(x=H(De,"hover:bg-accent hover:text-foreground",j,E),e[28]=j,e[29]=E,e[30]=x):x=e[30];let b;e[31]!==d?(b=n.jsx("span",{className:"capitalize",children:d}),e[31]=d,e[32]=b):b=e[32];let C;e[33]!==s?(C=s&&n.jsx(ue,{size:"xs"}),e[33]=s,e[34]=C):C=e[34];let y;e[35]!==m||e[36]!==S||e[37]!==x||e[38]!==b||e[39]!==C?(y=n.jsx(tt,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:m,disabled:S,className:x,children:[b,C]})}),e[35]=m,e[36]=S,e[37]=x,e[38]=b,e[39]=C,e[40]=y):y=e[40];const P=f??d;let g;e[41]!==P?(g=n.jsx(st,{side:"top",className:"max-w-xs",children:n.jsx("p",{className:"text-xs",children:P})}),e[41]=P,e[42]=g):g=e[42];let D;return e[43]!==y||e[44]!==g?(D=n.jsxs(nt,{delayDuration:400,children:[y,g]}),e[43]=y,e[44]=g,e[45]=D):D=e[45],D}function Ft(t){const e=F.c(61),{items:r,open:o,onOpenChange:s,onSelect:a,loadingPrompt:l}=t,i=Z(),[c,u]=k.useState(""),d=!!l;let f;e[0]!==r||e[1]!==c?(f=c.trim()?r.filter(p=>{const w=c.toLowerCase();return p.prompt.name.toLowerCase().includes(w)||(p.prompt.title??"").toLowerCase().includes(w)||(p.prompt.description??"").toLowerCase().includes(w)}):r,e[0]=r,e[1]=c,e[2]=f):f=e[2];const m=f,S=ct();let j;e[3]!==m.length||e[4]!==c||e[5]!==i?(j=m.length===0&&n.jsx("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:i("chat.iceBreakers.noPromptsMatch",{search:c})}),e[3]=m.length,e[4]=c,e[5]=i,e[6]=j):j=e[6];let E;if(e[7]!==m||e[8]!==d||e[9]!==l?.name||e[10]!==s||e[11]!==a){let p;e[13]!==d||e[14]!==l?.name||e[15]!==s||e[16]!==a?(p=w=>n.jsx(Re,{item:w,variant:"card",onSelect:h=>{s(!1),a(h)},isLoading:l?.name===w.prompt.name,isDisabled:d&&l?.name!==w.prompt.name},w.prompt.name),e[13]=d,e[14]=l?.name,e[15]=s,e[16]=a,e[17]=p):p=e[17],E=m.map(p),e[7]=m,e[8]=d,e[9]=l?.name,e[10]=s,e[11]=a,e[12]=E}else E=e[12];let x;e[18]!==j||e[19]!==E?(x=n.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[j,E]})}),e[18]=j,e[19]=E,e[20]=x):x=e[20];const b=x;let C;e[21]!==i?(C=i("chat.iceBreakers.searchPromptsPlaceholder"),e[21]=i,e[22]=C):C=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=p=>{p.key==="Escape"&&u("")},e[23]=y):y=e[23];let P;e[24]!==c||e[25]!==C?(P=n.jsx(it,{value:c,onChange:u,placeholder:C,onKeyDown:y}),e[24]=c,e[25]=C,e[26]=P):P=e[26];const g=P;if(S){let p;e[27]!==i?(p=i("chat.iceBreakers.allPromptsTitle"),e[27]=i,e[28]=p):p=e[28];let w;e[29]!==p?(w=n.jsx(rt,{className:"sr-only",children:n.jsx(at,{children:p})}),e[29]=p,e[30]=w):w=e[30];let h;e[31]!==i?(h=i("chat.iceBreakers.promptsLabel"),e[31]=i,e[32]=h):h=e[32];let v;e[33]!==h?(v=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:h})}),e[33]=h,e[34]=v):v=e[34];let N;e[35]!==b||e[36]!==g||e[37]!==v||e[38]!==w?(N=n.jsxs(ot,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[w,v,g,b]}),e[35]=b,e[36]=g,e[37]=v,e[38]=w,e[39]=N):N=e[39];let $;return e[40]!==s||e[41]!==o||e[42]!==N?($=n.jsx(se,{delayDuration:400,children:n.jsx(lt,{open:o,onOpenChange:s,children:N})}),e[40]=s,e[41]=o,e[42]=N,e[43]=$):$=e[43],$}let D;e[44]!==i?(D=i("chat.iceBreakers.allPromptsTitle"),e[44]=i,e[45]=D):D=e[45];let T;e[46]!==D?(T=n.jsx(be,{className:"sr-only",children:n.jsx(ye,{children:D})}),e[46]=D,e[47]=T):T=e[47];let B;e[48]!==i?(B=i("chat.iceBreakers.promptsLabel"),e[48]=i,e[49]=B):B=e[49];let M;e[50]!==B?(M=n.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:n.jsx("span",{className:"text-sm font-medium text-foreground",children:B})}),e[50]=B,e[51]=M):M=e[51];let L;e[52]!==b||e[53]!==g||e[54]!==M||e[55]!==T?(L=n.jsxs(ve,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[T,M,g,b]}),e[52]=b,e[53]=g,e[54]=M,e[55]=T,e[56]=L):L=e[56];let _;return e[57]!==s||e[58]!==o||e[59]!==L?(_=n.jsx(se,{delayDuration:400,children:n.jsx(Se,{open:o,onOpenChange:s,children:L})}),e[57]=s,e[58]=o,e[59]=L,e[60]=_):_=e[60],_}function Ht(t){const e=F.c(30),{items:r,onSelect:o,loadingPrompt:s,className:a}=t,l=Z(),[i,c]=k.useState(!1);if(r.length===0)return null;let u,d,f,m,S;if(e[0]!==a||e[1]!==r||e[2]!==s||e[3]!==o||e[4]!==l){const b=r.slice(0,xe),C=r.slice(xe),y=!!s;let P;e[10]!==y||e[11]!==s?.name||e[12]!==o?(P=D=>n.jsx(Re,{item:D,onSelect:o,isLoading:s?.name===D.prompt.name,isDisabled:y&&s?.name!==D.prompt.name},D.prompt.name),e[10]=y,e[11]=s?.name,e[12]=o,e[13]=P):P=e[13];const g=b.map(P);u=se,S=400,e[14]!==a?(d=H("w-full flex flex-wrap gap-2 justify-center",a),e[14]=a,e[15]=d):d=e[15],f=g,m=C.length>0&&n.jsx("button",{type:"button",disabled:y,onClick:()=>c(!0),className:H(De,"hover:bg-accent hover:text-foreground",y&&"opacity-50 cursor-not-allowed"),children:l("chat.iceBreakers.moreButton",{count:C.length})}),e[0]=a,e[1]=r,e[2]=s,e[3]=o,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=m,e[9]=S}else u=e[5],d=e[6],f=e[7],m=e[8],S=e[9];let j;e[16]!==d||e[17]!==f||e[18]!==m?(j=n.jsxs("div",{className:d,children:[f,m]}),e[16]=d,e[17]=f,e[18]=m,e[19]=j):j=e[19];let E;e[20]!==r||e[21]!==s||e[22]!==i||e[23]!==o?(E=n.jsx(Ft,{items:r,open:i,onOpenChange:c,onSelect:o,loadingPrompt:s}),e[20]=r,e[21]=s,e[22]=i,e[23]=o,e[24]=E):E=e[24];let x;return e[25]!==u||e[26]!==S||e[27]!==j||e[28]!==E?(x=n.jsxs(u,{delayDuration:S,children:[j,E]}),e[25]=u,e[26]=S,e[27]=j,e[28]=E,e[29]=x):x=e[29],x}function zt(){return null}function Kt(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function qt(t){const e=F.c(31),{connectionId:r}=t,o=Z(),{sendMessage:s}=Ne(),{org:a}=X();let l;e[0]!==r||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:r,orgId:a.id,orgSlug:a.slug},e[0]=r,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const i=ut(l);let c;e[4]!==i?(c={client:i,staleTime:6e4},e[4]=i,e[5]=c):c=e[5];const{data:u}=dt(c);let d;e[6]!==u?.prompts?(d=u?.prompts??[],e[6]=u?.prompts,e[7]=d):d=e[7];const f=d;let m;e[8]!==f?(m=f.map(Gt),e[8]=f,e[9]=m):m=e[9];const S=m;let j;e[10]===Symbol.for("react.memo_cache_sentinel")?(j={stage:"idle"},e[10]=j):j=e[10];const[E,x]=k.useReducer(Kt,j),[b,C]=k.useState(null);let y;e[11]!==i||e[12]!==s||e[13]!==o?(y=async(h,v)=>{if(!i){ce.error(o("chat.iceBreakers.mcpClientNotAvailable")),x({type:"RESET"});return}try{const N=await ft(i,h.name,v);x({type:"RESET"});const $={type:"doc",content:[{type:"paragraph",content:[mt({id:h.name,name:Ze(h.name,Ce(h._meta)),metadata:N.messages,char:"/",kind:"prompt",args:v}),{type:"text",text:" "}]}]};await s($)}catch(N){console.error("[ice-breakers] Failed to fetch prompt:",N),ce.error(o("chat.iceBreakers.failedToLoadPrompt")),x({type:"RESET"})}},e[11]=i,e[12]=s,e[13]=o,e[14]=y):y=e[14];const P=y;let g;e[15]!==P?(g=async h=>{if(h.arguments&&h.arguments.length>0){x({type:"SELECT_PROMPT",prompt:h}),C(h);return}x({type:"START_LOADING",prompt:h}),await P(h)},e[15]=P,e[16]=g):g=e[16];const D=g;let T;e[17]!==b||e[18]!==P?(T=async h=>{b&&(x({type:"START_LOADING",prompt:b,arguments:h}),C(null),await P(b,h))},e[17]=b,e[18]=P,e[19]=T):T=e[19];const B=T;if(S.length===0)return null;const M=E.stage==="loading"?E.prompt:null;let L;e[20]!==D||e[21]!==S||e[22]!==M?(L=n.jsx(Ht,{items:S,onSelect:D,loadingPrompt:M}),e[20]=D,e[21]=S,e[22]=M,e[23]=L):L=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{C(null),x({type:"RESET"})},e[24]=_):_=e[24];let p;e[25]!==b||e[26]!==B?(p=n.jsx(pt,{prompt:b,setPrompt:_,onSubmit:B}),e[25]=b,e[26]=B,e[27]=p):p=e[27];let w;return e[28]!==L||e[29]!==p?(w=n.jsxs(n.Fragment,{children:[L,p]}),e[28]=L,e[29]=p,e[30]=w):w=e[30],w}function Gt(t){return{prompt:t}}function Ut(t){const e=F.c(13),{className:r}=t,{selectedVirtualMcp:o}=$e(),{org:s}=X();let a;e[0]!==s.id?(a=Oe(s.id),e[0]=s.id,e[1]=a):a=e[1];const l=a.id,i=o?.id??l;let c;e[2]!==r?(c=H("w-full @container",r),e[2]=r,e[3]=c):c=e[3];const u=i??"default";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(zt,{}),e[4]=d):d=e[4];let f;e[5]!==i?(f=n.jsx(qt,{connectionId:i}),e[5]=i,e[6]=f):f=e[6];let m;e[7]!==u||e[8]!==f?(m=n.jsx(Ae,{fallback:null,children:n.jsx(k.Suspense,{fallback:d,children:f},u)}),e[7]=u,e[8]=f,e[9]=m):m=e[9];let S;return e[10]!==c||e[11]!==m?(S=n.jsx("div",{className:c,children:m}),e[10]=c,e[11]=m,e[12]=S):S=e[12],S}function Qt(t){let e=0;for(const r of t)for(const o of r.parts??[]){const s=o;s.type==="tool-load_repo"&&s.state==="output-available"&&s.output?.success===!0&&e++}return e}function Vt(){const t=F.c(8),{openPanel:e}=Et(),r=wt(),o=Fe()?.messages??[],s=we()?.taskId??null;let a;t[0]!==o?(a=Qt(o),t[0]=o,t[1]=a):a=t[1];const l=a,i=k.useRef(null),c=k.useRef(null);let u,d;t[2]!==l||t[3]!==r||t[4]!==e||t[5]!==s?(u=()=>{if(!l||!s)return;const f=`${s}:${l}`;c.current!==f&&(c.current=f,r?.refreshThreadMetadata(s)),i.current!==s&&(i.current=s,e("site-editor"))},d=[l,s,e,r],t[2]=l,t[3]=r,t[4]=e,t[5]=s,t[6]=u,t[7]=d):(u=t[6],d=t[7]),k.useEffect(u,d)}function _e(t){return`deco-credits-empty-dismissed:${t}`}function Ls(t){try{return localStorage.getItem(_e(t))==="1"}catch{return!1}}function Yt(){const t=F.c(56),e=Z(),{org:r}=X(),o=Tt("credits"),s=je(),{decoKeyId:a}=kt(),[l,i]=k.useState(!0);let c;t[0]!==r.id?(c=()=>{de("credits_empty_state_dismissed",{organization_id:r.id}),i(!1);try{localStorage.setItem(_e(r.id),"1")}catch{}},t[0]=r.id,t[1]=c):c=t[1];const u=c;let d,f;if(t[2]!==l||t[3]!==r.id?(d=()=>{l&&de("credits_empty_state_shown",{organization_id:r.id})},f=[l,r.id],t[2]=l,t[3]=r.id,t[4]=d,t[5]=f):(d=t[4],f=t[5]),k.useEffect(d,f),!l)return null;if(!o){let h;t[6]!==e?(h=e("chat.input.allowanceExhaustedTitle"),t[6]=e,t[7]=h):h=t[7];let v;t[8]!==h?(v={title:h},t[8]=h,t[9]=v):v=t[9];let N;return t[10]!==u||t[11]!==v?(N=n.jsx(Pt,{feature:"chat",copy:v,onDismiss:u}),t[10]=u,t[11]=v,t[12]=N):N=t[12],N}let m;t[13]!==u?(m=h=>!h&&u(),t[13]=u,t[14]=m):m=t[14];let S;t[15]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-warning/8 to-transparent pointer-events-none rounded-t-lg"}),t[15]=S):S=t[15];let j;t[16]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-warning/10 border border-warning/20 mx-auto",children:n.jsx(Te,{size:20,className:"text-warning"})}),t[16]=j):j=t[16];let E;t[17]!==e?(E=e("chat.creditsEmptyState.title"),t[17]=e,t[18]=E):E=t[18];let x;t[19]!==E?(x=n.jsx(ye,{className:"text-lg font-semibold",children:E}),t[19]=E,t[20]=x):x=t[20];let b;t[21]!==e?(b=e("chat.creditsEmptyState.description"),t[21]=e,t[22]=b):b=t[22];let C;t[23]!==b?(C=n.jsx(Ie,{className:"mt-2 text-sm leading-relaxed max-w-[320px] mx-auto",children:b}),t[23]=b,t[24]=C):C=t[24];let y;t[25]!==x||t[26]!==C?(y=n.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[S,n.jsxs(be,{className:"relative gap-3",children:[j,n.jsxs("div",{className:"text-center",children:[x,C]})]})]}),t[25]=x,t[26]=C,t[27]=y):y=t[27];let P;t[28]!==a||t[29]!==u?(P=a&&n.jsx("div",{className:"px-6 pb-5",children:n.jsx(ht,{source:"empty_state",onDone:u})}),t[28]=a,t[29]=u,t[30]=P):P=t[30];let g;t[31]!==u||t[32]!==s||t[33]!==r.slug?(g=()=>{s({to:"/$org/settings/ai-providers",params:{org:r.slug}}),u()},t[31]=u,t[32]=s,t[33]=r.slug,t[34]=g):g=t[34];let D;t[35]!==e?(D=e("chat.creditsEmptyState.useYourOwnProvider"),t[35]=e,t[36]=D):D=t[36];let T;t[37]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(Ct,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[37]=T):T=t[37];let B;t[38]!==g||t[39]!==D?(B=n.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:g,children:[D,T]}),t[38]=g,t[39]=D,t[40]=B):B=t[40];let M;t[41]!==e?(M=e("chat.creditsEmptyState.skipForNow"),t[41]=e,t[42]=M):M=t[42];let L;t[43]!==u||t[44]!==M?(L=n.jsx(Ee,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:u,children:M}),t[43]=u,t[44]=M,t[45]=L):L=t[45];let _;t[46]!==B||t[47]!==L?(_=n.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[B,L]}),t[46]=B,t[47]=L,t[48]=_):_=t[48];let p;t[49]!==y||t[50]!==P||t[51]!==_?(p=n.jsxs(ve,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Jt,children:[y,P,_]}),t[49]=y,t[50]=P,t[51]=_,t[52]=p):p=t[52];let w;return t[53]!==p||t[54]!==m?(w=n.jsx(Se,{open:!0,onOpenChange:m,children:p}),t[53]=p,t[54]=m,t[55]=w):w=t[55],w}function Jt(t){return t.preventDefault()}function Wt(t){const e=F.c(6),{balanceDollars:r}=t;let o;e[0]!==r?(o=r.toFixed(2),e[0]=r,e[1]=o):o=e[1];const s=o;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=H("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-success/10 border border-success/20","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=n.jsx(Te,{size:13,className:"text-success"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let i;return e[4]!==s?(i=n.jsxs("div",{className:a,children:[l,n.jsxs("span",{className:"text-xs font-medium text-success tabular-nums",children:["$",s," in credits to get started"]})]}),e[4]=s,e[5]=i):i=e[5],i}function Xt(){const t=F.c(8),{org:e}=X(),r=je();let o;t[0]!==r||t[1]!==e.slug?(o=()=>r({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=r,t[1]=e.slug,t[2]=o):o=t[2];let s,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(s=H("inline-flex items-center gap-1.5 px-3 py-1 rounded-lg cursor-pointer","bg-warning/10 border border-warning/20","hover:bg-warning/15","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=n.jsx(Dt,{size:13,className:"text-warning"}),l=n.jsx("span",{className:"text-xs font-medium text-warning",children:"No credits remaining · Add more"}),t[3]=s,t[4]=a,t[5]=l):(s=t[3],a=t[4],l=t[5]);let i;return t[6]!==o?(i=n.jsxs("button",{type:"button",onClick:o,className:s,children:[a,l]}),t[6]=o,t[7]=i):i=t[7],i}function Zt(t){const e=F.c(7),{scrollRef:r,sentinelRef:o,hasMoreOlder:s,isFetchingOlder:a,fetchOlderMessages:l}=t;let i,c;e[0]!==l||e[1]!==s||e[2]!==a||e[3]!==r||e[4]!==o?(i=()=>{const u=o.current,d=r.current;if(!u||!d||!s)return;const f=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!s)return;const j=d.scrollHeight,E=d.scrollTop;await l(),requestAnimationFrame(()=>{const x=d.scrollHeight;d.scrollTop=E+(x-j)})},{root:d,rootMargin:"200px 0px 0px 0px"});return f.observe(u),()=>f.disconnect()},c=[r,o,s,a,l],e[0]=l,e[1]=s,e[2]=a,e[3]=r,e[4]=o,e[5]=i,e[6]=c):(i=e[5],c=e[6]),k.useEffect(i,c)}function es(t){const e=F.c(5),{className:r,children:o}=t;let s;e[0]!==r?(s=H("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",r),e[0]=r,e[1]=s):s=e[1];let a;return e[2]!==o||e[3]!==s?(a=n.jsx("div",{className:s,children:o}),e[2]=o,e[3]=s,e[4]=a):a=e[4],a}function ts(t){const e=F.c(5),{children:r,className:o}=t;let s;e[0]!==o?(s=H("flex-1 min-h-0 overflow-y-auto isolate",o),e[0]=o,e[1]=s):s=e[1];let a;return e[2]!==r||e[3]!==s?(a=n.jsx("div",{className:s,children:r}),e[2]=r,e[3]=s,e[4]=a):a=e[4],a}function ss(t){const e=F.c(2),{children:r}=t;let o;return e[0]!==r?(o=n.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:r}),e[0]=r,e[1]=o):o=e[1],o}function ns(){const t=Z(),{messages:e,status:r,hasMoreOlder:o,isFetchingOlder:s,fetchOlderMessages:a,isRunInProgress:l}=Ne(),{taskId:i}=qe();Vt();const c=Ge(i??""),u=Ue(c),d=u.size===0?e:e.filter(g=>!u.has(g.id)),f=Qe(d,r==="submitted"||r==="streaming"||l),m=f.visible,S=vt(m),j=S.at(-1),x=bt()*yt+16,b=k.useRef(null),C=k.useRef(null);Zt({scrollRef:b,sentinelRef:C,hasMoreOlder:o,isFetchingOlder:s,fetchOlderMessages:a});const y=St({initial:!1}),P=g=>{b.current=g,y.scrollRef(g)};return n.jsx(Ve.Provider,{value:f,children:n.jsx(jt,{messages:e,children:n.jsxs("div",{className:"relative h-full w-full min-w-0",children:[n.jsx("div",{ref:P,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full [container-type:size]",style:{paddingBottom:x},children:n.jsxs("div",{ref:y.contentRef,className:"overflow-x-clip",children:[n.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[n.jsx("div",{ref:C,"aria-hidden":!0,className:"h-px"}),s&&n.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:t("chat.chat.loadingOlderMessages")}),S.slice(0,-1).map((g,D)=>n.jsx(fe,{pair:g,isLastPair:!1,status:D===S.length-1?r:void 0},`pair-${g.user?.id??g.assistant?.id}`))]}),j&&n.jsx("div",{className:"min-h-[100cqh] min-w-0 max-w-2xl mx-auto w-full",children:n.jsx(fe,{pair:j,isLastPair:!0,status:r},`pair-${j.user?.id??j.assistant?.id}`)})]})}),!y.isAtBottom&&n.jsx(Ee,{type:"button",variant:"outline",size:"icon-sm","aria-label":t("chat.chat.jumpToLatest"),className:"absolute left-1/2 z-50 -translate-x-1/2 shadow-soft animate-in fade-in duration-200 dark:bg-background dark:hover:bg-accent",style:{bottom:x+8},onClick:()=>{y.scrollToBottom()},children:n.jsx(Xe,{size:14})})]})})})}function rs(t){const e=F.c(5),{children:r,className:o}=t;let s;e[0]!==o?(s=H("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",o),e[0]=o,e[1]=s):s=e[1];let a;return e[2]!==r||e[3]!==s?(a=n.jsx("div",{className:s,children:r}),e[2]=r,e[3]=s,e[4]=a):a=e[4],a}const Ms=Object.assign(es,{Main:ts,Messages:ns,EmptyState:ss,Footer:rs,Input:xt,Provider:Ke,ActiveTaskProvider:ze,ThreadlessProvider:He,IceBreakers:Ut,NoAiProviderEmptyState:Nt,CreditsEmptyState:Yt,CreditsEyebrow:Wt,NoCreditsEyebrow:Xt,CreditsExhaustedBanner:gt});export{Ms as C,Ds as S,Rs as a,_s as b,me as i,Pe as u,Ls as w};
@@ -1 +1 @@
1
- import{cz as _}from"./index-DcU2uHG-.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
1
+ import{cv as _}from"./index-DQaJBLJ-.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
@@ -1 +1 @@
1
- import{r as l,bB as ce,j as p,bH as _,bG as T,bE as C,bL as le,bA as de,bX as ue,bT as fe,bM as me}from"./index-DcU2uHG-.js";import{c as Y}from"./index-BdQq_4o_.js";var X=["PageUp","PageDown"],$=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[z,Se,pe]=le(M),[W]=fe(M,[pe]),[he,B]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],K]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),V=l.useRef(S);function j(x){const y=ye(S,x);A(x,y)}function se(x){A(x,f.current)}function ae(){const x=V.current[f.current];S[f.current]!==x&&d(S)}function A(x,y,{commit:k}={commit:!1}){const U=_e(c),H=Ce(Math.round((x-n)/c)*c+n,U),I=Y(H,[n,s]);K((D=[])=>{const P=xe(D,I,y);if(De(P,u*c)){f.current=P.indexOf(I);const F=String(P)!==String(D);return F&&k&&d(P),F?P:D}else return D})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(z.Provider,{scope:e.__scopeSlider,children:p.jsx(z.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(V.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:j,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&A(n,0,{commit:!0}),onEndKeyDown:()=>!a&&A(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const H=X.includes(x.key)||x.shiftKey&&$.includes(x.key)?10:1,I=f.current,D=S[I],P=c*H*y;A(D+P,I,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function E(w){const S=R.current||i.getBoundingClientRect(),K=[0,S.width],j=O(K,f?[o,n]:[n,o]);return R.current=S,j(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=E(w.clientX);r?.(S)},onSlideMove:w=>{const S=E(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const K=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:K?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=B(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):X.concat($).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=B(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=B(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=B(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,E=>b(E)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(z.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function Ee(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function De(e,t){if(t>0){const o=Ee(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ae=q,Ie=te,Te=ne,Be=oe;export{Te as R,Ie as T,Ae as a,Be as b};
1
+ import{r as l,bx as ce,j as p,bD as _,bC as T,bA as C,bH as le,bw as de,bT as ue,bP as fe,bI as me}from"./index-DQaJBLJ-.js";import{c as Y}from"./index-BdQq_4o_.js";var $=["PageUp","PageDown"],X=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},M="Slider",[z,Se,pe]=le(M),[W]=fe(M,[pe]),[he,V]=W(M),q=l.forwardRef((e,t)=>{const{name:o,min:n=0,max:s=100,step:c=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:b=[n],value:h,onValueChange:i=()=>{},onValueCommit:d=()=>{},inverted:v=!1,form:R,...g}=e,m=l.useRef(new Set),f=l.useRef(0),w=r==="horizontal"?ge:ve,[S=[],I]=ce({prop:h,defaultProp:b,onChange:x=>{[...m.current][f.current]?.focus(),i(x)}}),j=l.useRef(S);function B(x){const y=ye(S,x);K(x,y)}function se(x){K(x,f.current)}function ae(){const x=j.current[f.current];S[f.current]!==x&&d(S)}function K(x,y,{commit:k}={commit:!1}){const U=_e(c),H=Ce(Math.round((x-n)/c)*c+n,U),A=Y(H,[n,s]);I((E=[])=>{const P=xe(E,A,y);if(Ee(P,u*c)){f.current=P.indexOf(A);const F=String(P)!==String(E);return F&&k&&d(P),F?P:E}else return E})}return p.jsx(he,{scope:e.__scopeSlider,name:o,disabled:a,min:n,max:s,valueIndexToChangeRef:f,thumbs:m.current,values:S,orientation:r,form:R,children:p.jsx(z.Provider,{scope:e.__scopeSlider,children:p.jsx(z.Slot,{scope:e.__scopeSlider,children:p.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:_(g.onPointerDown,()=>{a||(j.current=S)}),min:n,max:s,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:se,onSlideEnd:a?void 0:ae,onHomeKeyDown:()=>!a&&K(n,0,{commit:!0}),onEndKeyDown:()=>!a&&K(s,S.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!a){const H=$.includes(x.key)||x.shiftKey&&X.includes(x.key)?10:1,A=f.current,E=S[A],P=c*H*y;K(E+P,A,{commit:!0})}}})})})})});q.displayName=M;var[J,Q]=W(M,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:o,max:n,dir:s,inverted:c,onSlideStart:r,onSlideMove:a,onSlideEnd:u,onStepKeyDown:b,...h}=e,[i,d]=l.useState(null),v=C(t,w=>d(w)),R=l.useRef(void 0),g=de(s),m=g==="ltr",f=m&&!c||!m&&c;function D(w){const S=R.current||i.getBoundingClientRect(),I=[0,S.width],B=O(I,f?[o,n]:[n,o]);return R.current=S,B(w-S.left)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:p.jsx(Z,{dir:g,"data-orientation":"horizontal",...h,ref:v,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=D(w.clientX);r?.(S)},onSlideMove:w=>{const S=D(w.clientX);a?.(S)},onSlideEnd:()=>{R.current=void 0,u?.()},onStepKeyDown:w=>{const I=G[f?"from-left":"from-right"].includes(w.key);b?.({event:w,direction:I?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:o,max:n,inverted:s,onSlideStart:c,onSlideMove:r,onSlideEnd:a,onStepKeyDown:u,...b}=e,h=l.useRef(null),i=C(t,h),d=l.useRef(void 0),v=!s;function R(g){const m=d.current||h.current.getBoundingClientRect(),f=[0,m.height],w=O(f,v?[n,o]:[o,n]);return d.current=m,w(g-m.top)}return p.jsx(J,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:p.jsx(Z,{"data-orientation":"vertical",...b,ref:i,style:{...b.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const m=R(g.clientY);c?.(m)},onSlideMove:g=>{const m=R(g.clientY);r?.(m)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:g=>{const f=G[v?"from-bottom":"from-top"].includes(g.key);u?.({event:g,direction:f?-1:1})}})})}),Z=l.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:n,onSlideMove:s,onSlideEnd:c,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:u,...b}=e,h=V(M,o);return p.jsx(T.span,{...b,ref:t,onKeyDown:_(e.onKeyDown,i=>{i.key==="Home"?(r(i),i.preventDefault()):i.key==="End"?(a(i),i.preventDefault()):$.concat(X).includes(i.key)&&(u(i),i.preventDefault())}),onPointerDown:_(e.onPointerDown,i=>{const d=i.target;d.setPointerCapture(i.pointerId),i.preventDefault(),h.thumbs.has(d)?d.focus():n(i)}),onPointerMove:_(e.onPointerMove,i=>{i.target.hasPointerCapture(i.pointerId)&&s(i)}),onPointerUp:_(e.onPointerUp,i=>{const d=i.target;d.hasPointerCapture(i.pointerId)&&(d.releasePointerCapture(i.pointerId),c(i))})})}),ee="SliderTrack",te=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(ee,o);return p.jsx(T.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});te.displayName=ee;var N="SliderRange",ne=l.forwardRef((e,t)=>{const{__scopeSlider:o,...n}=e,s=V(N,o),c=Q(N,o),r=l.useRef(null),a=C(t,r),u=s.values.length,b=s.values.map(d=>ie(d,s.min,s.max)),h=u>1?Math.min(...b):0,i=100-Math.max(...b);return p.jsx(T.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:a,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:i+"%"}})});ne.displayName=N;var L="SliderThumb",oe=l.forwardRef((e,t)=>{const o=Se(e.__scopeSlider),[n,s]=l.useState(null),c=C(t,a=>s(a)),r=l.useMemo(()=>n?o().findIndex(a=>a.ref.current===n):-1,[o,n]);return p.jsx(be,{...e,ref:c,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:o,index:n,name:s,...c}=e,r=V(L,o),a=Q(L,o),[u,b]=l.useState(null),h=C(t,D=>b(D)),i=u?r.form||!!u.closest("form"):!0,d=ue(u),v=r.values[n],R=v===void 0?0:ie(v,r.min,r.max),g=Re(n,r.values.length),m=d?.[a.size],f=m?Pe(m,R,a.direction):0;return l.useEffect(()=>{if(u)return r.thumbs.add(u),()=>{r.thumbs.delete(u)}},[u,r.thumbs]),p.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${R}% + ${f}px)`},children:[p.jsx(z.ItemSlot,{scope:e.__scopeSlider,children:p.jsx(T.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...c,ref:h,style:v===void 0?{display:"none"}:e.style,onFocus:_(e.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),i&&p.jsx(re,{name:s??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},n)]})});oe.displayName=L;var we="RadioBubbleInput",re=l.forwardRef(({__scopeSlider:e,value:t,...o},n)=>{const s=l.useRef(null),c=C(s,n),r=me(t);return l.useEffect(()=>{const a=s.current;if(!a)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(r!==t&&h){const i=new Event("input",{bubbles:!0});h.call(a,t),a.dispatchEvent(i)}},[r,t]),p.jsx(T.input,{style:{display:"none"},...o,ref:c,defaultValue:t})});re.displayName=we;function xe(e=[],t,o){const n=[...e];return n[o]=t,n.sort((s,c)=>s-c)}function ie(e,t,o){const c=100/(o-t)*(e-t);return Y(c,[0,100])}function Re(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const o=e.map(s=>Math.abs(s-t)),n=Math.min(...o);return o.indexOf(n)}function Pe(e,t,o){const n=e/2,c=O([0,50],[0,n]);return(n-c(t)*o)*o}function De(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Ee(e,t){if(t>0){const o=De(e);return Math.min(...o)>=t}return!0}function O(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(o-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var Ke=q,Ae=te,Te=ne,Ve=oe;export{Te as R,Ae as T,Ke as a,Ve as b};